1import{Z as e}from"./vendor-ui-Cn6fg8C-.js";import{aq as s,A as t,z as r,y as a,f as o,an as n}from"./vendor-icons-Byg3HwjO.js";import{u as l,c as d,s as i}from"./vendor-forms-BG3e7igw.js";import{t as m}from"./zod-DVLk7Rcw.js";import{B as c,J as u,aU as x,aT as h}from"./index-99Vy6p_n.js";import{t as p}from"./errorMessages-KO5_OSqv.js";import{N as w}from"./Navbar-H2KFsm7e.js";import{u as f}from"./passwordReveal-BaTBRCBX.js";import{g}from"./vendor-utils-Buu2ZLTn.js";import{L as b}from"./vendor-react-CVjTfUnV.js";import"./vendor-charts-Bma9jRrq.js";import"./vendor-motion-BvcfpNQp.js";import"./vendor-intl-BIQtR30S.js";const j=d({email:i().email("Please enter a valid email address")}),N=d({token:i().min(1,"Reset code is required"),newPassword:i().min(8,"Password must be at least 8 characters").regex(/[A-Z]/,"Password must contain at least one uppercase letter").regex(/[a-z]/,"Password must contain at least one lowercase letter").regex(/[0-9]/,"Password must contain at least one number"),confirmPassword:i().min(1,"Please confirm your password")}).refine(e=>e.newPassword===e.confirmPassword,{message:"Passwords do not match",path:["confirmPassword"]}),v=({met:s,label:t})=>e.jsxs("li",{className:"flex items-center gap-1.5 text-xs",children:[s?e.jsx(o,{className:"h-3.5 w-3.5 text-green-500 shrink-0"}):e.jsx(n,{className:"h-3.5 w-3.5 text-muted-foreground/50 shrink-0"}),e.jsx("span",{className:s?"text-green-600":"text-muted-foreground",children:t})]}),y=()=>{const{t:n}=g(),[d,i]=s.useState("request"),[y,P]=s.useState(!1),[S,k]=s.useState(""),[C,q]=s.useState(""),[R,z]=s.useState(!1),[F,T]=s.useState(!1),E=l({resolver:m(j)}),A=l({resolver:m(N)}),D=A.watch("newPassword",""),L=A.watch("confirmPassword",""),I=[{met:D.length>=8,label:n("auth.req.minLength","At least 8 characters")},{met:/[A-Z]/.test(D),label:n("auth.req.uppercase","One uppercase letter")},{met:/[a-z]/.test(D),label:n("auth.req.lowercase","One lowercase letter")},{met:/[0-9]/.test(D),label:n("auth.req.number","One number")}],O=L.length>0&&D===L,Z=L.length>0&&D!==L,$="appearance-none relative block w-full px-3 py-2 border border-input rounded-md placeholder-muted-foreground text-foreground bg-background focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary text-sm";return e.jsxs("div",{className:"min-h-screen bg-background px-[20px]",children:[e.jsx(w,{}),e.jsx("main",{className:"pt-20 tablet:pt-24 pb-12",children:e.jsx("div",{className:"max-w-[1340px] mx-auto",children:e.jsxs("div",{className:"max-w-lg mx-auto",children:["request"===d&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-primary/10 rounded-3xl p-6 tablet:p-8 mb-8",children:[e.jsx("h1",{className:"font-heading text-2xl tablet:text-3xl font-bold text-primary mb-1",children:n("auth.forgotPasswordTitle","Forgot your password?")}),e.jsx("p",{className:"text-muted-foreground text-sm",children:n("auth.forgotPasswordDescription","Enter your email address and we'll send you a code to reset your password.")})]}),e.jsxs("form",{className:"space-y-6",onSubmit:E.handleSubmit(async e=>{P(!0),k("");try{await u.forgotPassword(e.email),x(),q(e.email),i("reset")}catch(s){k(p(s,"errors.generic"))}finally{P(!1)}}),children:[S&&e.jsx("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-4",children:e.jsx("p",{className:"text-sm text-destructive",children:S})}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-foreground mb-1",children:n("auth.email")}),e.jsx("input",{...E.register("email"),type:"email",id:"email",autoComplete:"email",className:$,placeholder:n("auth.emailPlaceholder")}),E.formState.errors.email&&e.jsx("p",{className:"mt-1 text-sm text-destructive",children:E.formState.errors.email.message})]}),e.jsx(c,{variant:"gradient",size:"lg",className:"w-full rounded-xl text-base",type:"submit",disabled:y,children:y?n("auth.sending","Sending..."):n("auth.send
1ResetCode","Send Reset Code")}),e.jsx("div",{className:"text-center",children:e.jsxs(b,{to:"/login",className:"inline-flex items-center gap-1 text-sm font-medium text-primary hover:text-primary/80 transition-colors",children:[e.jsx(t,{className:"h-4 w-4"}),n("auth.backToLogin","Back to login")]})})]})]}),"reset"===d&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-primary/10 rounded-3xl p-6 tablet:p-8 mb-8",children:[e.jsx("h1",{className:"font-heading text-2xl tablet:text-3xl font-bold text-primary mb-1",children:n("auth.resetPasswordTitle","Reset your password")}),e.jsx("p",{className:"text-muted-foreground text-sm",children:n("auth.resetPasswordDescription","We sent a code to {{email}}. Enter it below along with your new password.",{email:C})})]}),e.jsxs("form",{className:"space-y-6",onSubmit:A.handleSubmit(async e=>{P(!0),k("");try{await u.resetPassword(C,e.token,e.newPassword),h(),i("success")}catch(s){k(p(s,"errors.invalidCode"))}finally{P(!1)}}),children:[S&&e.jsx("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-4",children:e.jsx("p",{className:"text-sm text-destructive",children:S})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-foreground mb-1",children:n("auth.resetCode","Reset Code")}),e.jsx("input",{...A.register("token"),type:"text",id:"token",className:$,placeholder:n("auth.enterResetCode","Enter the code from your email")}),A.formState.errors.token&&e.jsx("p",{className:"mt-1 text-sm text-destructive",children:A.formState.errors.token.message})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"newPassword",className:"block text-sm font-medium text-foreground mb-1",children:n("auth.newPassword","New Password")}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{...A.register("newPassword"),type:R?"text":"password",id:"newPassword",autoComplete:"new-password",className:`${$} pr-10`,placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢"}),e.jsx("button",{type:"button",onClick:e=>{R||f(e.currentTarget.parentElement?.querySelector("input")),z(!R)},"aria-label":R?n("auth.hidePassword","Hide password"):n("auth.showPassword","Show password"),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:R?e.jsx(r,{className:"h-4 w-4"}):e.jsx(a,{className:"h-4 w-4"})})]}),A.formState.errors.newPassword&&e.jsx("p",{className:"mt-1 text-sm text-destructive",children:A.formState.errors.newPassword.message}),D.length>0&&e.jsx("ul",{className:"mt-2 space-y-1",children:I.map((s,t)=>e.jsx(v,{met:s.met,label:s.label},t))})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"confirmPassword",className:"block text-sm font-medium text-foreground mb-1",children:n("auth.confirmPassword","Confirm Password")}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{...A.register("confirmPassword"),type:F?"text":"password",id:"confirmPassword",autoComplete:"new-password",className:`${$} pr-10 ${O?"border-green-500 focus:ring-green-500 focus:border-green-500":Z?"border-destructive focus:ring-destructive focus:border-destructive":""}`,placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢"}),e.jsx("button",{type:"button",onClick:e=>{F||f(e.currentTarget.parentElement?.querySelector("input")),T(!F)},"aria-label":F?n("auth.hidePassword","Hide password"):n("auth.showPassword","Show password"),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:F?e.jsx(r,{className:"h-4 w-4"}):e.jsx(a,{className:"h-4 w-4"})})]}),O&&e.jsxs("p",{className:"mt-2 text-xs text-green-600 flex items-center gap-1",children:[e.jsx(o,{className:"h-3.5 w-3.5"}),n("auth.passwordsMatch","Passwords match")]}),A.formState.errors.confirmPassword&&e.jsx("p",{className:"mt-1 text-sm text-destructive",children:A.formState.errors.confirmPassword.message})]})]}),e.jsx(c,{variant:"gradient",size:"lg",className:"w-full rounded-xl text-base",type:"submit",disabled:y,children:y?n("auth.resetting","Resetting..."):n("auth.resetPassword","Reset Password")}),e.jsx("div",{className:"text-center",children:e.jsxs("button",{type:"button",onClick:()=>{i("request"),k("")},className:"inline-flex items-center gap-1 text-sm font-medium text-primary hover:text-primary/80 transition-colors",children:[e.jsx(t,{className:"h-4 w-4"}),n("auth.tryDifferentEmail","Try a different email")]})})]})]}),"success"===d&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-primary/10 rounded-3xl p-6 tablet:p-8 mb-8",children:[e.jsx("h1",{className:"font-heading text-2xl tablet:text-3xl font-bold text-primary mb-1",children:n("auth.passwordResetSuccess","Password reset successful")}),e.jsx("p",{className:"text-muted-foreground text-sm",children:n("auth.passwordResetSuccessDescription","Your password has been changed. You can now sign in with your new password.")})]}),e.jsx(c,{variant:"gradient",size:"lg",className:"w-full rounded-xl text-base",asChild:!0,children:e.jsx(b,{to:"/login",children:n("auth.signInLink")})})]})]})})})]})};export{y 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.