1import{r,u as k,m as L,j as e,b as c,B as u,L as i,s as B}from"./index-B9xblx1X.js";import{I as x}from"./input-BgkJCVH0.js";import{L as h}from"./label-pqjvqnDT.js";import{C as p,a as f}from"./card-CK5sTH4r.js";import{B as j}from"./BrandLogo-CpiTv_d1.js";import{C as N}from"./circle-alert-CIxqSbDS.js";function z(){const[a,g]=r.useState(""),[n,v]=r.useState(""),[d,l]=r.useState(!1),[o,t]=r.useState(""),{session:b,loading:w}=k(),y=L(),C=async s=>{if(s.preventDefault(),t(""),a.length<8){t("Password must be at least 8 characters.");return}if(a!==n){t("Passwords do not match.");return}l(!0);const{error:m}=await B.auth.updateUser({password:a});if(l(!1),m){t(m.message);return}y("/app")};return w?e.jsx("div",{className:"min-h-[100dvh] flex items-center justify-center bg-background",children:e.jsx(c,{className:"h-6 w-6 animate-spin text-primary"})}):b?e.jsxs("div",{className:"min-h-[100dvh] flex items-center justify-center px-4 py-10 bg-background relative",children:[e.jsx("div",{className:"absolute inset-0 gradient-subtle"}),e.jsxs("div",{className:"w-full max-w-sm relative",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx(j,{size:44,className:"mx-auto mb-4"}),e.jsx("h1",{className:"text-2xl font-bold",children:"Choose a new password"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"You arrived here from a password reset email."})]}),e.jsx(p,{className:"border-border/60 shadow-medium",children:e.jsxs(f,{className:"p-6",children:[o&&e.jsxs("div",{role:"alert",className:"flex items-start gap-2.5 p-3 mb-4 rounded-lg bg-destructive/10 border border-destructive/20 text-sm text-destructive",children:[e.jsx(N,{className:"h-4 w-4 mt-0.5 shrink-0"}),e.jsx("span",{children:o})]}),e.jsxs("form",{onSubmit:C,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"password",className:"text-xs font-medium",children:"New password"}),e.jsx(x,{id:"password",type:"password",value:a,onChange:s=>g(s.target.value),required:!0,className:"h-10",minLength:8})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"confirm",className:"text-xs font-medium",children:"Confirm password"}),e.jsx(x,{id:"confirm",type:"password",value:n,onChange:s=>v(s.target.value),required:!0,className:"h-10",minLength:8})]}),e.jsx(u,{type:"submit",className:"w-full font-medium h-10",disabled:d,children:d?e.jsx(c,{className:"h-4 w-4 animate-spin"}):"Update password"})]}),e.jsx("p",{className:"text-center text-2xs text-muted-foreground mt-4",children:e.jsx(i,{to:"/auth/signin",className:"text-primary hover:underline",children:"Back to sign in"})})]})})]})]}):e.jsxs("div",{className:"min-h-[100dvh] flex items-center justify-center px-4 py-10 bg-background relative",children:[e.jsx("div",{className:"absolute inset-0 gradient-subtle"}),e.jsxs("div",{className:"w-full max-w-sm relative",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx(j,{size:44,className:"mx-auto mb-4"}),e.jsx("h1",{className:"text-2xl font-bold",children:"Invalid or expired link"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"This password reset link is invalid or has expired. Request a new one to continue."})]}),e.jsx(p,{className:"border-border/60 shadow-medium",children:e.jsxs(f,{className:"p-6 space-y-3",children:[e.jsxs("div",{role:"alert",className:"flex items-start gap-2.5 p-3 rounded-lg bg-destructive/10 border border-destructive/20 text-sm text-destructive",children:[e.jsx(N,{className:"h-4 w-4 mt-0.5 shrink-0"}),e.jsx("span",{children:"No recovery session found. Please request a new password reset email."})]}),e.jsx(u,{asChild:!0,className:"w-full font-medium h-10",children:e.jsx(i,{to:"/auth/forgot-password",children:"Request new reset link"})}),e.jsx("p",{className:"text-center text-2xs text-muted-foreground",children:e.jsx(i,{to:"/auth/signin",className:"text-primary hover:underline",children:"Back to sign in"})})]})})]})]})}export{z 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.