1import{u as F,r as t,j as s,R as c,m as d,B as h,al as v,am as N,f as R}from"./main-BImpsluT.js";import{A as f}from"./auth-card-Dk-OWQ_3.js";import{u as I,a as k,F as E,b as B,c as z,d as C,e as T,f as A,g as H}from"./zod-ceAGWNzh.js";import{F as M}from"./form-success-ft_w9di5.js";import{I as U}from"./input-ClxBbEig.js";import{I as V}from"./IconEyeOff-Ci_eBQyK.js";import{I as q}from"./IconEye-DV_cLXsN.js";import{I as O}from"./IconLoader2--3VUUmxB.js";import"./card-DGNb_koZ.js";import"./label-C_UjThVr.js";import"./useField-BY30g3lG.js";const e=d.auth.resetPassword,_=v({password:N().min(8,{message:e.minLength})});function D(){const w=F(),m=typeof window<"u"?new URLSearchParams(window.location.search).get("token"):null,x=typeof window<"u"?new URLSearchParams(window.location.search).get("error"):null,[g,l]=t.useState(""),[b,j]=t.useState(""),[r,u]=t.useState(!1),[a,P]=t.useState(!1),n=I({resolver:k(_),defaultValues:{password:""}});if(!m||x==="invalid_token")return s.jsx(f,{headerLabel:e.title,bottomButtonLabel:e.backToLogin,bottomButtonHref:c.Login,children:s.jsx("p",{className:"text-sm text-destructive py-4",children:e.invalidToken})});const y=()=>{P(o=>!o)},L=async o=>{await R.resetPassword({newPassword:o.password,token:m},{onRequest:()=>{u(!0),l(""),j("")},onResponse:()=>u(!1),onSuccess:()=>{w.navigate({to:c.Login})},onError:p=>{const i=p.error.code,S=i&&d.auth.error.codes[i]?d.auth.error.codes[i]:p.error.message;l(S)}})};return s.jsx(f,{headerLabel:e.title,bottomButtonLabel:e.backToLogin,bottomButtonHref:c.Login,children:s.jsx(E,{...n,children:s.jsxs("form",{onSubmit:n.handleSubmit(L),className:"space-y-6",children:[s.jsx("div",{className:"space-y-4",children:s.jsx(B,{control:n.control,name:"password",render:({field:o})=>s.jsxs(z,{children:[s.jsx(C,{children:e.password}),s.jsxs("div",{className:"relative",children:[s.jsx(T,{children:s.jsx(U,{...o,disabled:r,placeholder:e.placeholderPassword,type:a?"text":"password",className:"pr-10"})}),s.jsxs(h,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 border-0 bg-transparent hover:bg-transparent dark:hover:bg-transparent",onClick:y,disabled:r,children:[a?s.jsx(V,{className:"size-4 text-muted-foreground"}):s.jsx(q,{className:"size-4 text-muted-foreground"}),s.jsx("span",{className:"sr-only",children:a?e.hidePassword:e.showPassword})]})]}),s.jsx(A,{})]})})}),s.jsx(H,{message:g}),s.jsx(M,{message:b}),s.jsxs(h,{disabled:r,size:"lg",type:"submit",className:"w-full flex items-center justify-center gap-2",children:[r&&s.jsx(O,{className:"mr-2 size-4 animate-spin"}),s.jsx("span",{children:e.reset})]})]})})})}function os(){return s.jsx(D,{})}export{os as component};
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.