import{u as j,r,j as e,L as c,t as i,s as v}from"./index-C-9v46qO.js";import{B as y}from"./button-B-2orO_-.js";import{I as d}from"./input-Dr7-mDl9.js";import{L as u}from"./label-BXZLGOSD.js";import{C as N}from"./card-Bnq45TwS.js";import{o as w,s as p}from"./types-By9teAtI.js";import"./utils-BQHNewu7.js";const b=w({email:p().trim().email("সঠিক ইমেইল দিন").max(255),password:p().min(6,"পাসওয়ার্ড অন্তত ৬ অক্ষর").max(72)});function E(){const x=j(),[n,h]=r.useState(""),[o,f]=r.useState(""),[m,l]=r.useState(!1),g=async s=>{s.preventDefault();const t=b.safeParse({email:n,password:o});if(!t.success){i.error(t.error.issues[0].message);return}l(!0);const{error:a}=await v.auth.signInWithPassword(t.data);if(l(!1),a){i.error(a.message==="Invalid login credentials"?"ইমেইল বা পাসওয়ার্ড ভুল":a.message);return}i.success("সফলভাবে লগইন হয়েছে"),x({to:"/admin"})};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background px-4 py-12",children:e.jsxs(N,{className:"w-full max-w-md p-8",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("h1",{className:"font-script text-3xl text-primary",children:"Gulab Boutique"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"অ্যাডমিন লগইন"})]}),e.jsxs("form",{onSubmit:g,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"email",children:"ইমেইল"}),e.jsx(d,{id:"email",type:"email",value:n,onChange:s=>h(s.target.value),required:!0,autoComplete:"email"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(u,{htmlFor:"password",children:"পাসওয়ার্ড"}),e.jsx(c,{to:"/auth/forgot",className:"text-xs text-primary hover:underline",children:"পাসওয়ার্ড ভুলে গেছেন?"})]}),e.jsx(d,{id:"password",type:"password",value:o,onChange:s=>f(s.target.value),required:!0,autoComplete:"current-password"})]}),e.jsx(y,{type:"submit",className:"w-full",disabled:m,children:m?"লগইন হচ্ছে...":"লগইন"}),e.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:["অ্যাকাউন্ট নেই? ",e.jsx(c,{to:"/auth/signup",className:"text-primary hover:underline",children:"সাইনআপ"})]})]})]})})}export{E as component};
