1import{r as N,S as k,T as A,a as P,x as T,j as e,U as E,V as U,m as C,W as z,q as V,X as D}from"./index-DeQNIeU9.js";import{s as L,o as I,b as S,a as x}from"./zod-B_DGK6-8.js";import{u as B}from"./index.esm-Dxb-CIYq.js";import{F as M,a as i,b as c,c as f,d as m}from"./form-DWaQfCd3.js";import{M as F}from"./index-TLxWmsnY.js";import{X as b}from"./input-CuPQuqW-.js";import"./index-_8mLSLd4.js";import"./label--tNzLS6T.js";import"./useFocusRing-CpgBDfYL.js";import"./render-CQ6op5QB.js";import"./label-BAX3aRJC.js";import"./description-CmnzD5Ro.js";const H=I({name:x().min(2,{message:"First name must be at least 2 characters long."}).max(20,{message:"First name cannot exceed 20 characters."}),lastName:x().min(2,{message:"Last name must be at least 2 characters long."}).max(30,{message:"Last name cannot exceed 30 characters."}),email:x().email({message:"Please enter a valid email address."}),password:x().min(6,{message:"Password must be at least 6 characters long."}).max(20,{message:"Password cannot exceed 20 characters."}),agreeTerms:S().refine(r=>r===!0,{message:"You must agree to the terms and conditions."}),subscribeEmails:S().default(!1)}),O=()=>{const[r,u]=N.useState(!1),{toast:g}=k(),[h,{isLoading:j}]=A(),p=P(),w=T(),a=B({resolver:L(H),defaultValues:{name:"",lastName:"",email:"",password:"",agreeTerms:!1,subscribeEmails:!1}});async function d(s){var o;try{console.log(s);const n={...s,role:"USER"},{user:l,accessToken:y,refreshToken:t}=await h(n).unwrap();g({title:"User register complete",className:"border-l-4 border-green-500",description:"Form submitted successfully."}),w(z({user:{id:l.id,email:l.email,name:l.name,lastName:l.lastName,role:l.role},accessToken:y,refreshToken:t})),a.reset(),p("/account/dashboard")}catch(n){console.log(n),g({title:"Error",className:"border-l-4 border-red-500",variant:"destructive",description:((o=n.data)==null?void 0:o.message)||n.error||"Registration failed."})}}return e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl text-center text-white mb-6 font-bold",children:"Create an Account"}),e.jsx(M,{...a,children:e.jsxs("form",{onSubmit:a.handleSubmit(d),children:[e.jsxs("div",{className:"flex space-x-3",children:[e.jsx(i,{control:a.control,name:"name",render:({field:s})=>e.jsxs(c,{className:"flex-1",children:[e.jsx("label",{htmlFor:"signup-name",className:"sr-only",children:"First name"}),e.jsx(f,{children:e.jsx(b,{id:"signup-name",autoComplete:"given-name",autoCorrect:"off",autoCapitalize:"off",placeholder:"First Name",...s,className:`w-full p-3 mb-4 rounded-full bg-transparent text-white border-gray-500 2 border focus:outline-none focus:ring-2 focus:ring-sapphire-400 focus:border-sapphire-600 transition-colors duration-300`})}),e.jsx(m,{})]})}),e.jsx(i,{control:a.control,name:"lastName",render:({field:s})=>e.jsxs(c,{className:"flex-1",children:[e.jsx("label",{htmlFor:"signup-lastname",className:"sr-only",children:"Last name"}),e.jsx(f,{children:e.jsx(b,{id:"signup-lastname",autoComplete:"family-name",autoCorrect:"off",autoCapitalize:"off",placeholder:"Last Name",...s,className:`w-full p-3 mb-4 rounded-full bg-transparent text-white border-gray-500 3 border focus:outline-none focus:ring-2 focus:ring-sapphire-400 focus:border-sapphire-600 transition-colors duration-300`})}),e.jsx(m,{})]})})]}),e.jsx(i,{control:a.control,name:"email",render:({field:s})=>e.jsxs(c,{children:[e.jsx("label",{htmlFor:"signup-email",className:"sr-only",children:"Email address"}),e.jsx(f,{children:e.jsx(b,{id:"signup-email",autoComplete:"email",autoCorrect:"off",autoCapitalize:"off",type:"email",placeholder:"Email",...s,className:`w-full p-3 mb-4 rounded-full bg-transparent text-white border-gray-500 4 border focus:outline-none focus:ring-2 focus:ring-sapphire-400 focus:border-sapphire-600 transition-colors duration-300`})}),e.jsx(m,{})]})}),e.jsx(i,{control:a.control,name:"password",render:({field:s})=>e.jsx(c,{children:e.jsxs("div",{className:"relative",children:[e.jsx("label",{htmlFor:"signup-password",className:"sr-only",children:"Password"}),e.jsx(f,{children:e.jsx(b,{id:"signup-password",type:r?"text":"password",placeholder:"Password",autoComplete:"new-password",...s,className:`w-full h-12 px-4 pr-12 mb-4 rounded-full 5 bg-transparent text-white border border-gray-500 6 focus:outline-none focus:ring-2 focus:ring-sapphire-400 focus:border-sapphire-400 7 transition-colors duration-300`})}),e.jsx("button",{type:"button",onClick:()=>u(o=>!o),className:` 8 absolute inset-y-0 right-4 9 my-auto 10 -translate-y-1/4 11 h-6 w-6 12 flex items-center justify-center 13 text-white 14 `,"aria-label":r?"Hide password":"Show password",children:r?e.jsx(E,{size:20}):e.jsx(U,{size:20})}),e.jsx(m,{})]})})}),e.jsx(i,{control:a.control,name:"agreeTerms",render:({field:s})=>e.jsxs(c,{className:"mb-4 flex items-center space-x-2",children:[e.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:s.value,onChange:s.onChange,onBlur:s.onBlur,name:s.name,ref:s.ref,className:"hidden"}),e.jsx(C.div,{whileTap:{scale:.9},className:`w-6 h-6 flex-shrink-0 border-2 rounded transition-all duration-200 flex justify-center items-center ${s.value?"bg-sapphire-700 border-sapphire-600":"bg-transparent border-gray-500"}`,children:s.value&&e.jsx(F,{className:"w-4 h-4 text-white"})}),e.jsxs("span",{className:"text-white text-sm",children:["By checking this box, I acknowledge that I have read and agree to the"," ",e.jsx("strong",{onClick:()=>p("/terms"),className:"hover:cursor-pointer hover:text-gray-300 underline",children:"Nox Terms and Conditions"}),"."]})]}),e.jsx(m,{})]})}),e.jsx(i,{control:a.control,name:"subscribeEmails",render:({field:s})=>e.jsx(c,{className:"mb-4 flex items-center space-x-2",children:e.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:s.value,onChange:s.onChange,onBlur:s.onBlur,name:s.name,ref:s.ref,className:"hidden"}),e.jsx(C.div,{whileTap:{scale:.9},className:`w-6 h-6 flex-shrink-0 border-2 rounded transition-all duration-200 flex justify-center items-center ${s.value?"bg-sapphire-700 border-sapphire-600":"bg-transparent border-gray-500"}`,children:s.value&&e.jsx(F,{className:"w-4 h-4 text-white"})}),e.jsx("span",{className:"text-white text-sm",children:"I would like to subscribe to emails to receive the latest news and offers."})]})})}),e.jsx("button",{type:"submit",disabled:j,className:`w-full py-3 rounded-full ${j?"bg-gray-500 cursor-not-allowed":"bg-gradient-to-r from-sapphire-500 to-sapphire-800 hover:from-sapphire-600 hover:to-sapphire-900 text-white font-bold transition "} text-white font-ArialBold transition-colors duration-300 shadow-md`,children:j?"Loading...":"Sign Up"}),e.jsxs("div",{className:"flex items-center justify-center mt-6",children:[e.jsx("button",{type:"button",onClick:()=>p("/privacy-policy"),className:"text-gray-300 text-center text-sm underline hover:text-white transition-colors",children:"Privacy Policy"}),e.jsx("span",{className:"text-gray-300 text-center mx-1",children:"&"}),e.jsx("button",{type:"button",onClick:()=>p("/terms"),className:"text-gray-300 text-center text-sm underline hover:text-white transition-colors",children:"Terms & Conditions"})]})]})})]})},W=I({email:x().email({message:"Please enter a valid email address."}),password:x().min(6,{message:"Password must be at least 6 characters long."}).max(20,{message:"Password cannot exceed 20 characters."})}),X=()=>{const[r,u]=N.useState(!1),{toast:g}=k(),h=P(),j=V(),[p,{isLoading:w}]=D(),a=T(),d=B({resolver:L(W),defaultValues:{email:"",password:""}});async function s(o){var n,l,y;try{const{user:t,accessToken:R,refreshToken:$}=await p(o).unwrap();g({title:"User login complete",className:"border-l-4 border-green-500",description:"Form submitted successfully."}),a(z({user:{id:t.id,email:t.email,name:t.name,lastName:t.lastName,role:t.role},accessToken:R,refreshToken:$})),d.reset();const v=(l=(n=j.state)==null?void 0:n.from)==null?void 0:l.pathname;v?h(v,{replace:!0}):t.role==="USER"?h("/account/dashboard"):h("/dashboard/orders")}catch(t){g({className:"border-l-4 border-red-500",title:"Error",description:((y=t.data)==null?void 0:y.message)||t.error||"Registration failed."})}}return e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl text-center text-white mb-6 font-bold",children:"Welcome Back"}),e.jsx(M,{...d,children:e.jsxs("form",{onSubmit:d.handleSubmit(s),children:[e.jsx(i,{control:d.control,name:"email",render:({field:o})=>e.jsxs(c,{children:[e.jsx("label",{htmlFor:"sign-in-email",className:"sr-only",children:"Email address"}),e.jsx(f,{children:e.jsx(b,{id:"sign-in-email",autoComplete:"email",autoCorrect:"off",autoCapitalize:"off",type:"email",placeholder:"Email",...o,className:"w-full p-3 mb-4 rounded-full bg-transparent text-white border-gray-500 border focus:outline-none focus:ring-2 focus:ring-sapphire-400 focus:border-sapphire-400 transition-colors duration-300"})}),e.jsx(m,{})]})}),e.jsx(i,{control:d.control,name:"password",render:({field:o})=>e.jsx(c,{children:e.jsxs("div",{className:"relative",children:[e.jsx("label",{htmlFor:"sign-in-password",className:"sr-only",children:"Password"}),e.jsx(f,{children:e.jsx(b,{id:"sign-in-password",type:r?"text":"password",placeholder:"Password",autoComplete:"current-password",...o,className:`w-full h-12 px-4 pr-12 mb-4 rounded-full 15 bg-transparent text-white border border-gray-500 16 focus:outline-none focus:ring-2 focus:ring-sapphire-400 focus:border-sapphire-400 17 transition-colors duration-300`})}),e.jsx("button",{type:"button",onClick:()=>u(n=>!n),className:` 18 absolute inset-y-0 right-4 19 my-auto 20 -translate-y-1/4 21 h-6 w-6 22 flex items-center justify-center 23 text-white 24 `,"aria-label":r?"Hide password":"Show password",children:r?e.jsx(E,{size:20}):e.jsx(U,{size:20})}),e.jsx(m,{})]})})}),e.jsx("div",{className:"items-center justify-center mb-6 flex font-ArialBold text-sm",children:e.jsx("button",{type:"button",onClick:()=>h("/reset-password"),className:"text-mustard-yellow-400 text-center hover:text-mustard-yellow-500",children:"Forget your password ?"})}),e.jsx("button",{type:"submit",disabled:w,className:`w-full py-3 rounded-full ${w?"bg-gray-500 cursor-not-allowed":"bg-gradient-to-r from-sapphire-500 to-sapphire-800 hover:from-sapphire-600 hover:to-sapphire-900"} text-white font-bold transition-colors duration-300 shadow-lg`,children:w?"Loading...":"Sign In"})]})})]})},te=()=>{const[r,u]=N.useState(!1);return e.jsx("div",{className:"relative flex items-center justify-center p-6",children:e.jsx("div",{className:"max-w-md w-full p-8 overflow-hidden",children:e.jsxs("div",{className:"relative z-10 ",children:[e.jsxs("div",{className:"relative w-full flex items-center justify-between bg-transparent border-gray-500 border rounded-full p-1 mb-8",children:[e.jsx("div",{className:`absolute top-0 left-0 h-full w-1/2 bg-gradient-to-r from-sapphire-500 to-sapphire-800 rounded-full transition-transform duration-300 ${r?"translate-x-full":"translate-x-0"}`}),e.jsx("button",{onClick:()=>u(!1),className:"flex-1 text-center py-2 text-white font-semibold relative z-10 transition-colors duration-300",children:"Sign In"}),e.jsx("button",{onClick:()=>u(!0),className:"flex-1 text-center py-2 text-white font-semibold relative z-10 transition-colors duration-300",children:"Sign Up"})]}),r?e.jsx(O,{}):e.jsx(X,{})]})})})};export{te as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.