import{r as t,j as e,L as p,t as r,s as C}from"./index-C-9v46qO.js";import{B as h}from"./button-B-2orO_-.js";import{I as i}from"./input-Dr7-mDl9.js";import{L as n}from"./label-BXZLGOSD.js";import{C as f}from"./card-Bnq45TwS.js";import{o as S,s as l}from"./types-By9teAtI.js";import"./utils-BQHNewu7.js";const L=S({email:l().trim().email("সঠিক ইমেইল দিন").max(255),password:l().min(8,"পাসওয়ার্ড অন্তত ৮ অক্ষর").max(72),displayName:l().trim().min(2,"নাম অন্তত ২ অক্ষর").max(100)});function T(){const[m,j]=t.useState(""),[o,g]=t.useState(""),[c,N]=t.useState(""),[d,u]=t.useState(!1),[y,w]=t.useState(!1),b=async s=>{s.preventDefault();const a=L.safeParse({email:m,password:o,displayName:c});if(!a.success){r.error(a.error.issues[0].message);return}u(!0);const v=`${window.location.origin}/auth/login`,{error:x}=await C.auth.signUp({email:a.data.email,password:a.data.password,options:{emailRedirectTo:v,data:{display_name:a.data.displayName}}});if(u(!1),x){r.error(x.message);return}w(!0),r.success("ইমেইল পাঠানো হয়েছে। ইনবক্স চেক করুন।")};return y?e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background px-4 py-12",children:e.jsxs(f,{className:"w-full max-w-md p-8 text-center",children:[e.jsx("h1",{className:"text-2xl font-semibold mb-2",children:"ইমেইল চেক করুন"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"আপনার ইমেইলে একটি ভেরিফিকেশন লিংক পাঠানো হয়েছে। লিংকে ক্লিক করে ভেরিফাই করুন।"}),e.jsx(h,{asChild:!0,variant:"outline",className:"w-full",children:e.jsx(p,{to:"/auth/login",children:"লগইন পেজে যান"})})]})}):e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background px-4 py-12",children:e.jsxs(f,{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:b,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"name",children:"নাম"}),e.jsx(i,{id:"name",value:c,onChange:s=>N(s.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"email",children:"ইমেইল"}),e.jsx(i,{id:"email",type:"email",value:m,onChange:s=>j(s.target.value),required:!0,autoComplete:"email"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"password",children:"পাসওয়ার্ড"}),e.jsx(i,{id:"password",type:"password",value:o,onChange:s=>g(s.target.value),required:!0,autoComplete:"new-password",minLength:8}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"কমপক্ষে ৮ অক্ষর"})]}),e.jsx(h,{type:"submit",className:"w-full",disabled:d,children:d?"তৈরি হচ্ছে...":"সাইনআপ"}),e.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:["অ্যাকাউন্ট আছে? ",e.jsx(p,{to:"/auth/login",className:"text-primary hover:underline",children:"লগইন"})]})]})]})})}export{T as component};
