import{r as p,j as e}from"./jsx-runtime-BuFTgxwK.js";import{B as h}from"./button-BRWfsEaZ.js";import{C as g,a as f,b as N,c as b,d as v}from"./card-7ggvX2Pc.js";import{u as y,R as w,F as t,a as i,b as n,c as o,I as l,d as c,t as F}from"./index-C_G0F3KF.js";import{z as a}from"./index-dIKOytT1.js";import{A as C,a as S,b as k}from"./alert-C2pLUUBF.js";import{G as A}from"./google-icon-DATczjA9.js";import{e as L,F as j,L as E}from"./components-B6GhF_cz.js";import{c as u}from"./createLucideIcon-BJWIDuhZ.js";import{L as P}from"./loader-circle-C297kp5l.js";import"./index-DcYWq2xJ.js";import"./utils-DNoYR1v6.js";import"./index-DKeI6tIo.js";/**
 * @license lucide-react v0.365.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const I=u("EyeOff",[["path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24",key:"1jxqfv"}],["path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68",key:"9wicm4"}],["path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61",key:"1jreej"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/**
 * @license lucide-react v0.365.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const M=u("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);function K(){const s=y({resolver:F(R),defaultValues:{firstName:"",lastName:"",email:"",password:""}}),m=L(),[d,x]=p.useState(!1);return e.jsx("div",{className:"flex flex-col items-center h-screen justify-center",children:e.jsxs(g,{className:"mx-auto max-w-sm",children:[e.jsxs(f,{children:[e.jsx(N,{className:"text-xl",children:"Sign Up"}),e.jsx(b,{children:"Enter your information to create an account"})]}),e.jsxs(v,{children:[(m==null?void 0:m.error)&&e.jsxs(C,{variant:"destructive",className:"mb-4",children:[e.jsx(S,{children:"An error occured"}),e.jsx(k,{children:"An unexpected error occurred. Please try again later."})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsx(j,{method:"post",action:"/auth/oauth/google",children:e.jsxs(h,{className:"w-full flex items-center justify-center gap-2",variant:"outline",name:"_action",value:"register",type:"submit",children:[e.jsx(A,{}),"Sign up with Google"]})}),e.jsx("div",{className:"h-3.5 border-b border-slate-300 text-base text-center text-slate-500 mb-2",children:e.jsx("span",{className:"bg-white px-5",children:"or"})}),e.jsx(w,{...s,children:e.jsxs(j,{method:"post",onSubmit:s.handleSubmit,id:"loginForm",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx("div",{className:"grid gap-2",children:e.jsx(t,{control:s.control,name:"firstName",render:({field:r})=>e.jsxs(i,{children:[e.jsx(n,{children:"First name"}),e.jsx(o,{children:e.jsx(l,{...r,autoFocus:!0})}),e.jsx(c,{})]})})}),e.jsx("div",{className:"grid gap-2",children:e.jsx(t,{control:s.control,name:"lastName",render:({field:r})=>e.jsxs(i,{children:[e.jsx(n,{children:"Last name"}),e.jsx(o,{children:e.jsx(l,{...r})}),e.jsx(c,{})]})})})]}),e.jsx("div",{className:"grid gap-2",children:e.jsx(t,{control:s.control,name:"email",render:({field:r})=>e.jsxs(i,{children:[e.jsx(n,{children:"Email"}),e.jsx(o,{children:e.jsx(l,{...r})}),e.jsx(c,{})]})})}),e.jsx("div",{className:"grid gap-2",children:e.jsx(t,{control:s.control,name:"password",render:({field:r})=>e.jsxs(i,{children:[e.jsx(n,{children:"Password"}),e.jsx(o,{children:e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 cursor-pointer",children:d?e.jsx(I,{className:"w-5 h-5 text-slate-500",onClick:()=>x(!1)}):e.jsx(M,{className:"w-5 h-5 text-slate-500",onClick:()=>x(!0)})}),e.jsx(l,{...r,type:d?"text":"password",maxLength:100})]})}),e.jsx(c,{})]})})})]})}),e.jsxs(h,{type:"submit",className:"w-full",disabled:s.formState.isSubmitting,form:"loginForm",children:[s.formState.isSubmitting&&e.jsx(P,{className:"h-4 w-4 mr-2 animate-spin"}),"Create an account"]})]}),e.jsxs("div",{className:"mt-4 text-center text-sm",children:["Already have an account?"," ",e.jsx(E,{to:"/auth/login",className:"underline",children:"Sign in"})]})]})]})})}const R=a.object({firstName:a.string().min(1,"First name is required"),lastName:a.string().min(1,"Last name is required"),email:a.string().email("Invalid email address"),password:a.string().min(8,"Password must be at least 8 characters").max(100,"Password must be at most 100 characters")});export{K as default};
