1import{r as o,u as X,h as q,f as w,t as g,E as H,I as J,N as K,i as Q,k as Y,g as Z,l as ee,j as e,C as se,T as b,m as te,n as N,o as v,F as y,a as c,b as m,c as x,d as u,e as h,B as S,q as ae,s as re,v as oe,S as ne,L as ie,p as L}from"./index-CikpnCPq.js";import{A as le}from"./AuthPageLayout-Bd-MQ7da.js";import{I as P}from"./index-BwjBiYk8.js";import{F as O,a as V}from"./EyeIcon-KmpZSl_Y.js";function de({title:n,titleId:t,...i},r){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},i),n?o.createElement("title",{id:t},n):null,o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.75 6.75v10.5a2.25 2.25 0 0 1-2.25 2.25h-15a2.25 2.25 0 0 1-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25m19.5 0v.243a2.25 2.25 0 0 1-1.07 1.916l-7.5 4.615a2.25 2.25 0 0 1-2.36 0L3.32 8.91a2.25 2.25 0 0 1-1.07-1.916V6.75"}))}const ce=o.forwardRef(de),me=()=>({step:"email",email:""});function fe(){const n=X(),{toast:t}=q(),i=me(),[r,E]=o.useState(i.step),[l,A]=o.useState(i.email),[C,M]=o.useState(!1),[F,U]=o.useState(!1),p=w({resolver:g(H),defaultValues:{email:""}}),f=w({resolver:g(J),defaultValues:{otp:""}}),d=w({resolver:g(K),defaultValues:{newPassword:"",confirmPassword:""}}),{mutate:R,isPending:j}=Q(),{mutate:B,isPending:I}=Y(),{mutate:z,isPending:T}=Z(),{mutate:D}=ee(),W=({email:s})=>{R({email:s},{onSuccess(){A(s),E("otp"),t({title:"Check your email",description:"Enter the 6-digit code from the reset email to continue."})},onError(a){t({title:"Could not send reset email",description:a.message,variant:"destructive"})}})},G=({otp:s})=>{B({email:l,otp:s},{onSuccess(){E("password"),t({title:"Code verified",description:"Choose a new password for your account."})},onError(a){t({title:"Invalid or expired code",description:a.message,variant:"destructive"})}})},_=({confirmPassword:s})=>{z({password:s},{onSuccess(){D(void 0,{onSettled(){t({title:"Password updated",description:"Sign in with your new password."}),n(L.SIGN_IN)}})},onError(a){t({title:"Could not update password",description:a.message,variant:"destructive"})}})},$=()=>{l&&R({email:l},{onSuccess(){t({title:"Code resent",description:"A new reset code was sent to your email."})},onError(s){t({title:"Could not resend code",description:s.message,variant:"destructive"})}})};return e.jsx(le,{hideTeacherBanner:!0,autoHeight:!0,children:e.jsxs(se,{className:"flex flex-col px-8 py-6",children:[e.jsx("div",{className:"mb-2 mt-2 flex items-center justify-center",children:e.jsx(b,{size:v.XXL,color:N.CARD,fontWeight:te.BOLD,children:"Reset password"})}),e.jsxs(b,{size:v.SM,color:N.MUTED,className:"mb-5 px-1 text-center",children:[r==="email"&&"Enter your account email and we'll send you a code to get back in.",r==="otp"&&`Enter the 6-digit code sent to ${l}.`,r==="password"&&"Create a new password for your account."]}),e.jsxs("div",{className:"flex flex-col",children:[r==="email"&&e.jsx(y,{...p,children:e.jsxs("form",{onSubmit:p.handleSubmit(W),className:"flex flex-col",children:[e.jsx("div",{className:"space-y-2 px-1",children:e.jsx(c,{control:p.control,name:"email",render:({field:s})=>e.jsxs(m,{children:[e.jsx(x,{className:"text-sm font-medium text-foreground",children:"Email"}),e.jsx(u,{children:e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3 text-muted-foreground",children:e.jsx(ce,{className:"h-5 w-5"})}),e.jsx(P,{placeholder:"Enter email associated with your account",className:"h-11 pl-10",...s})]})}),e.jsx("p",{className:"mt-1.5 text-xs text-muted-foreground",children:"We'll email a 6-digit code to reset your password."}),e.jsx(h,{})]})})}),e.jsx("div",{className:"mt-4 px-1",children:e.jsx(S,{type:"submit",disabled:j,className:"h-11 w-full cursor-pointer rounded-lg bg-[#cc2b2b] text-sm font-semibold text-white hover:bg-[#b02222]",children:j?"Sending...":e.jsx(e.Fragment,{children:"Send reset code â"})})})]})}),r==="otp"&&e.jsx(y,{...f,children:e.jsxs("form",{onSubmit:f.handleSubmit(G),className:"flex flex-col",children:[e.jsx("div",{className:"space-y-4 px-1",children:e.jsx(c,{control:f.control,name:"otp",render:({field:s})=>e.jsxs(m,{children:[e.jsxs("div",{className:"flex items-end justify-between",children:[e.jsx(x,{className:"text-sm font-medium text-foreground",children:"Reset code"}),e.jsx("button",{type:"button",className:"text-xs font-medium text-red-600 hover:underline",onClick:$,disabled:j,children:"Resend code"})]}),e.jsx(u,{children:e.jsx(ae,{maxLength:6,...s,children:e.jsx(re,{className:"w-full justify-between gap-1",children:Array.from({length:6}).map((a,k)=>e.jsx(oe,{index:k,className:"h-11 w-11 rounded-md border text-center text-lg"},k))})})}),e.jsx(h,{})]})})}),e.jsx("div",{className:"mt-4 px-1",children:e.jsx(S,{type:"submit",disabled:I,className:"h-11 w-full cursor-pointer rounded-lg bg-[#cc2b2b] text-sm font-semibold text-white hover:bg-[#b02222]",children:I?"Verifying...":"
1Verify code"})})]})}),r==="password"&&e.jsx(y,{...d,children:e.jsxs("form",{onSubmit:d.handleSubmit(_),className:"flex flex-col",children:[e.jsxs("div",{className:"space-y-4 px-1",children:[e.jsx(c,{control:d.control,name:"newPassword",render:({field:s})=>e.jsxs(m,{children:[e.jsx(x,{className:"text-sm font-medium text-foreground",children:"New password"}),e.jsx(u,{children:e.jsxs("div",{className:"relative",children:[e.jsx(P,{type:C?"text":"password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",className:"h-11 pr-10",...s}),e.jsx("button",{type:"button",className:"absolute inset-y-0 right-0 flex w-10 items-center justify-center text-gray-500",onClick:()=>M(a=>!a),children:C?e.jsx(O,{className:"h-4 w-4"}):e.jsx(V,{className:"h-4 w-4"})})]})}),e.jsx(h,{})]})}),e.jsx(c,{control:d.control,name:"confirmPassword",render:({field:s})=>e.jsxs(m,{children:[e.jsx(x,{className:"text-sm font-medium text-foreground",children:"Confirm password"}),e.jsx(u,{children:e.jsxs("div",{className:"relative",children:[e.jsx(P,{type:F?"text":"password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",className:"h-11 pr-10",...s}),e.jsx("button",{type:"button",className:"absolute inset-y-0 right-0 flex w-10 items-center justify-center text-gray-500",onClick:()=>U(a=>!a),children:F?e.jsx(O,{className:"h-4 w-4"}):e.jsx(V,{className:"h-4 w-4"})})]})}),e.jsx(h,{})]})})]}),e.jsx("div",{className:"mt-4 px-1",children:e.jsx(S,{type:"submit",disabled:T,className:"h-11 w-full cursor-pointer rounded-lg bg-[#cc2b2b] text-sm font-semibold text-white hover:bg-[#b02222]",children:T?"Saving...":"Update password"})})]})})]}),e.jsxs("div",{className:"mt-5",children:[e.jsx(ne,{className:"mb-4 bg-gray-100"}),e.jsxs(b,{size:v.SM,color:N.MUTED,className:"text-center",children:["Remembered it?"," ",e.jsx(ie,{className:"font-semibold text-red-600 hover:underline",to:L.SIGN_IN,children:"Sign in â"})]})]})]})})}export{fe 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.