1import{r as s,j as e}from"./vendor-react-CbdTkigD.js";import{u as y,C as v,b as C,L as k,g as S}from"./index-D9Yn9XFB.js";import{B as i}from"./button-Bm4iUOY1.js";import{I as u}from"./input-D5rIXDBi.js";import{L as p}from"./label-vff1g-ck.js";import{N as h}from"./Navbar-CBxrZD00.js";import{r as L}from"./readErrorMessage-ffJxkrwI.js";import{A as f}from"./arrow-left-DHJMfwSB.js";import{m as P}from"./vendor-motion-nN0H-opo.js";import{C as E}from"./circle-check-big-CPebbUcX.js";import{K as A}from"./key-round-yt62e9Es.js";import"./vendor-pdf-D3Oto7XH.js";import"./vendor-query-HxFOCcRi.js";import"./vendor-ui-BCoOrj6z.js";import"./vendor-charts-C5VVN5rV.js";import"./chevron-right-CXOLYe2h.js";import"./users-Cqw8fWno.js";import"./circle-user-D-ZtXkaD.js";import"./file-text-B1Mr5kf6.js";import"./credit-card-Dtn0nqa7.js";import"./package-BNnsZTyJ.js";import"./shield-CyesUHJ5.js";import"./image-C33j8HoU.js";import"./truck-C2iWsKhz.js";import"./eye-DVkQfAY7.js";import"./log-out-BQExQW-E.js";import"./globe-B7pv3cgS.js";import"./link-2-V_EOdCuD.js";import"./activity-JDdGWL77.js";const B=[.16,1,.3,1];function de(){s.useEffect(()=>{let t=document.querySelector('meta[name="robots"]');return t||(t=document.createElement("meta"),t.setAttribute("name","robots"),document.head.appendChild(t)),t.content="noindex, nofollow",()=>{document.querySelector('meta[name="robots"]')?.remove()}},[]);const d=new URLSearchParams(window.location.search).get("token"),[r,g]=s.useState(""),[c,j]=s.useState(""),[l,m]=s.useState(!1),[w,N]=s.useState(!1),[x,a]=s.useState(""),[,n]=y();if(!d)return e.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[e.jsx(h,{}),e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-muted-foreground",children:"Invalid or missing reset token."}),e.jsxs(i,{onClick:()=>n("/tts-portal"),variant:"ghost",className:"mt-4 rounded-xl","data-testid":"link-back-to-login",children:[e.jsx(f,{className:"w-4 h-4 mr-2"}),"Back to Login"]})]})})]});const b=async t=>{if(t.preventDefault(),a(""),r!==c){a("Passwords do not match");return}if(r.length<6){a("Password must be at least 6 characters");return}m(!0);try{const o=await fetch("/api/auth/reset-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:d,password:r})});if(!o.ok)throw new Error(await L(o,"Failed to reset password. Please try again in a few minutes."));N(!0)}catch(o){a(S(o))}finally{m(!1)}};return e.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[e.jsx(h,{}),e.jsx("div",{className:"flex-1 flex items-center justify-center px-4",children:e.jsxs(P.div,{initial:{opacity:0,y:30},animate:{opacity:1,y:0},transition:{duration:.8,ease:B},className:"w-full max-w-md",children:[e.jsx(v,{className:"rounded-3xl border-border/50 shadow-xl",children:e.jsx(C,{className:"p-8 space-y-6",children:w?e.jsxs("div",{className:"text-center space-y-4",children:[e.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-green-500/10 flex items-center justify-center",children:e.jsx(E,{className:"w-8 h-8 text-green-500"})}),e.jsx("h2",{className:"text-2xl font-heading font-bold text-foreground",children:"Password Updated"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Your password has been set successfully. You can now sign in."}),e.jsx(i,{onClick:()=>n("/tts-portal"),className:"rounded-xl","data-testid":"button-go-to-login",children:"Go to Admin Login"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-center space-y-3",children:[e.jsx("div",{className:"mx-auto w-16 h-16 rounded-2xl bg-primary/10 flex items-center justify-center",children:e.jsx(A,{className:"w-8 h-8 text-primary"})}),e.jsx("h1",{className:"text-2xl font-heading font-bold text-foreground","data-testid":"text-reset-title",children:"Set Your Password"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose a secure password for your admin account."})]}),x&&e.jsx("div",{className:"flex items-center gap-2 p-3 rounded-xl bg-red-50 text-red-600 text-sm",children:e.jsx("span",{children:x})}),e.jsxs("form",{onSubmit:b,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(p,{htmlFor:"password",children:"New Password"}),e.jsx(u,{id:"password",type:"password",value:r,onChange:t=>g(t.target.value),placeholder:"Min 6 characters",required:!0,minLength:6,className:"rounded-xl h-12","data-testid":"input-new-password"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(p,{htmlFor:"confirm",children:"Confirm Password"}),e.jsx(u,{id:"confirm",type:"password",value:c,onChange:t=>j(t.target.value),placeholder:"Re-enter password",required:!0,minLength:6,className:"rounded-xl h-12","data-testid":"input-confirm-password"})]}),e.jsxs(i,{type:"submit",size:"lg",className:"w-full rounded-xl h-12 text-base",disabled:l,"data-testid":"button-reset-submit",children:[l?e.jsx(k,{className:"w-4 h-4 animate-spin mr-2"}):null,"Set Password"]})]})]})})}),e.jsx("div",{className:"mt-6 text-center",children:e.jsxs("button",{onClick:()=>n("/tts-portal"),className:"text-sm text-muted-foreground hover:text-primary transition-colors inline-flex items-center gap-1","data-testid":"link-back-to-login",children:[e.jsx(f,{className:"w-3.5 h-3.5"}),"Back to Admin Login"]})})]})})]})}export{de 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.