1import{k as T,m as A,i as o,j as s,L as F}from"./react-vendor-Dv2rzRgw.js";import{np as E,b as L,$ as R,k1 as q,mh as z,fV as B}from"./index-Pg-MI9ur.js";import{g as D}from"./subdomain-CLTvirjS.js";import{A as l,F as w}from"./AuthShell-dvHXrpwy.js";function M(){var p,x;const b=T(),[f]=A(),c=f.get("token")??"",[e,y]=o.useState(""),[n,j]=o.useState(""),[d,m]=o.useState(!1),[k,v]=o.useState(!1),t=D(),r=E({queryKey:["branding",t],queryFn:()=>t?B(t):Promise.resolve(null),enabled:!!t,staleTime:5*60*1e3,retry:!1}),u=new TextEncoder().encode(e).length,h=u>72,N=e.length>0&&e.length<8,S=n.length>0&&n!==e,C=e.length>=8&&!h&&n===e;async function P(a){a.preventDefault(),m(!0);try{await q(c,e),v(!0)}catch(g){z.error(g instanceof Error?g.message:"This link is invalid or has expired")}finally{m(!1)}}if(t&&r.isLoading)return s.jsx("div",{className:"tnx",children:s.jsx("div",{className:"authx",style:{display:"grid",placeItems:"center"},children:s.jsx("p",{style:{color:"var(--tnx-muted)",fontSize:15},children:"Loadingâ¦"})})});const i={logo:((p=r.data)==null?void 0:p.logoUrl)||void 0,brandName:((x=r.data)==null?void 0:x.name)||L,showHome:!t};return c?k?s.jsxs(l,{...i,title:"Password set",children:[s.jsxs("div",{className:"notex ok",children:[s.jsx(R,{size:16}),s.jsx("span",{children:"You can sign in with it now."})]}),s.jsx("button",{className:"btnx primary block",onClick:()=>b("/login",{replace:!0}),children:"Go to sign in"})]}):s.jsx(l,{...i,title:"Set your password",subtitle:"Choose a password for your account.",footer:"This link works once and expires after an hour.",children:s.jsxs("form",{onSubmit:P,children:[s.jsx(w,{label:"New password",htmlFor:"rp-new",hint:N?s.jsx("span",{className:"bad",children:"At least 8 characters."}):h?s.jsxs("span",{className:"bad",children:["Too long â ",u," bytes, maximum 72."]}):void 0,children:s.jsx("input",{id:"rp-new",className:"inputx",type:"password",autoComplete:"new-password",value:e,autoFocus:!0,onChange:a=>y(a.target.value)})}),s.jsx(w,{label:"Confirm password",htmlFor:"rp-confirm",hint:S?s.jsx("span",{className:"bad",children:"Passwords do not match."}):void 0,children:s.jsx("input",{id:"rp-confirm",className:"inputx",type:"password",autoComplete:"new-password",value:n,onChange:a=>j(a.target.value)})}),s.jsx("button",{className:"btnx primary block",type:"submit",disabled:d||!C,children:d?"Setting passwordâ¦":"Set password"})]})}):s.jsx(l,{...i,title:"Invalid link",subtitle:"This link is missing its token. Ask for a new one, or reset your password with a code instead.",children:s.jsx(F,{to:"/forgot-password",className:"btnx primary block",children:"Reset with a code"})})}export{M as ResetPasswordPage};
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.