1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="8fd59a48-93ab-7c89-978d-42cb173d1d3b")}catch(e){}}();import{s as e}from"./rolldown-runtime-B6ubh40S.js";import{Ha as t,Ot as n,da as r,lo as i,pa as a,po as o}from"./vendor-9Auq8rqv.js";import{Bc as s,Bs as c,Co as l,Kr as u,Us as d,ai as f,bo as p,ci as m,hi as h,ii as g,li as _,oc as v,os as y,qr as b,si as x,tc as S,ui as C,vs as w}from"./ui-CNZ0y8KL.js";import"./graphql-generated-CgB1DyC0.js";import{An as T,En as E,Mn as D,Tn as O,gr as k,r as A}from"./index-CZ1u9usR.js";import{n as j,t as M}from"./password-schema-BZzN3Miw.js";var N=e(s(),1),P=e(v(),1),F=function(e){return e[e.ForgotPassword=0]=`ForgotPassword`,e[e.NewPassword=1]=`NewPassword`,e[e.Loading=2]=`Loading`,e}(F||{}),I=i({email:o().email(`Please enter a valid email address`)}),L=i({password:j});const R=()=>{let e=S(),{toast:i}=c(),{loading:o}=E(),{authentication:s}=D(),[v,j]=(0,N.useState)(F.Loading),[M,R]=(0,N.useState)(null),z=h({resolver:n(I),defaultValues:{email:``},mode:`onChange`}),B=h({resolver:n(L),defaultValues:{password:``},mode:`onChange`}),V=t({mutationFn:async e=>await k().profiles.authentication.resetPassword(e.email),onSuccess:t=>{i({title:`Success`,description:`Password reset email has been sent. Please check your inbox.`}),e(`${O.NEW_CONFIRM_PASSWORD_RESET}?email=${encodeURIComponent(z.getValues(`email`))}&resetPassword=true`)},onError:e=>{R(e.message||`An error occurred while sending the password reset email.`),i({title:`Error`,description:e.message||`An error occurred while sending the password reset email.`,variant:`destructive`})}}),H=t({mutationFn:async e=>{let t=T.getCurrentActionCode();if(!t)throw Error(`Invalid password reset link. Please request a new password reset email.`);return await r(a(),t,e.password)},onSuccess:()=>{i({title:`Success`,description:`Your password has been successfully reset.`}),e(O.NEW_LOGIN)},onError:e=>{R(e.message||`An error occurred while resetting your password.`),i({title:`Error`,description:e.message||`An error occurred while resetting your password.`,variant:`destructive`})}}),U=e=>{V.mutate(e)},W=e=>{H.mutate(e)};if((0,N.useEffect)(()=>{let e=T.getCurrentMode(),t=T.getCurrentActionCode();e===T.resetPasswordModeName&&t?j(F.NewPassword):j(F.ForgotPassword)},[]),o||v===F.Loading)return(0,P.jsx)(A,{children:(0,P.jsxs)(`div`,{className:`flex flex-col items-center space-y-6 w-full max-w-md`,children:[(0,P.jsx)(y,{className:`h-12 w-48 rounded-md`}),(0,P.jsx)(y,{className:`h-4 w-64 rounded-md`}),(0,P.jsx)(y,{className:`h-12 w-full rounded-md`}),(0,P.jsx)(y,{className:`h-12 w-full rounded-md`})]})});let G=V.isPending,K=H.isPending;return(0,P.jsx)(A,{children:(0,P.jsx)(`div`,{className:`flex flex-col gap-6 w-full max-w-md mx-auto`,children:(0,P.jsx)(u,{className:`w-full border-none shadow-none bg-transparent`,children:(0,P.jsxs)(b,{className:`space-y-6 px-0`,children:[v===F.ForgotPassword&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,P.jsx)(`h1`,{className:`text-3xl font-semibold `,children:`Forgot password?`}),(0,P.jsx)(`p`,{children:`Enter your email and we'll send you a password reset link`})]}),(0,P.jsxs)(g,{...z,children:[(0,P.jsxs)(`form`,{onSubmit:z.handleSubmit(U),className:`space-y-4`,children:[(0,P.jsx)(x,{control:z.control,name:`email`,render:({field:e})=>(0,P.jsxs)(m,{children:[(0,P.jsx)(_,{children:`Email`}),(0,P.jsx)(f,{children:(0,P.jsx)(p,{placeholder:`[email protected]`,type:`email`,autoComplete:`email`,...e,disabled:G})}),(0,P.jsx)(C,{})]})}),M&&(0,P.jsx)(`div`,{className:`text-sm text-destructive`,children:M}),(0,P.jsx)(l,{type:`submit`,variant:`default`,disabled:!z.formState.isValid||G,className:`w-full mt-3`,children:G?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(w,{className:`mr-2 h-4 w-4 animate-spin`}),`Sending instructions...`]}):`Send instructions`})]}),(0,P.jsx)(`div`,{className:`text-center text-sm mt-4`,children:(0,P.jsx)(d,{to:O.NEW_LOGIN,className:`underline underline-offset-4 text-primary`,children:`Back to login`})})]})]}),v===F.NewPassword&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,P.jsx)(`h1`,{className:`text-3xl font-semibold `,children:`Create new password`}),(0,P.jsx)(`p`,{children:`Enter your new password below`})]}),(0,P.jsxs)(g,{...B,children:[(0,P.jsxs)(`form`,{onSubmit:B.handleSubmit(W),className:`space-y-4`,children:[(0,P.jsx)(x,{control:B.control,name:`password`,render:({field:e})=>(0,P.jsxs)(m,{children:[(0,P.jsx)(_,{children:`New Password`}),(0,P.jsx)(f,{children:(0,P.jsx)(p,{placeholder:`Enter your new password`,type:`password`,autoComplete:`new-password`,...e,disabled:K})}),(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`At least 8 characters with uppercase, lowercase, and a number.`}),(0,P.jsx)(C,{})]})}),M&&(0,P.jsx)(`div`,{className:`text-sm text-destructive`,children:M}),(0,P.jsx)(l,{type:`submit`,variant:`default`,disabled:!B.formState.isValid||K,className:`w-full mt-3`,children:K?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(w,{className:`mr-2 h-4 w-4 animate-spin`}),`Changing password...`]}):`Change password`})]}),(0,P.jsx)(`div`,{className:`text-center text-sm mt-4`,children:(0,P.jsx)(d,{to:O.NEW_LOGIN,className:`underline underline-offset-4 text-primary`,children:`Back to login`})})]})]})]})})})})};export{R as ResetPasswordPage}; 2//# sourceMappingURL=reset-password-page-DtR8mLxh.js.map 3//# chunkId=8fd59a48-93ab-7c89-978d-42cb173d1d3b
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.