1import{b as e,j as s}from"./vendor-query-BzBixOjg.js";import{u as a,r,L as t}from"./vendor-react-DXT08UFj.js";import{u as n,C as l,e as o,B as i,b as c,d,h as m}from"./admin-DaOm9TmX.js";import{L as x,I as u}from"./blog-CqIzXoko.js";import{C as h,F as p,e as w,z as g,A as b}from"./index-9fO5ZjfQ.js";import{o as j,ai as y,E as v,A as f}from"./vendor-ui-misc-CWT3JJ-b.js";import"./vendor-charts-CcX-0eII.js";import"./vendor-stripe-CYrFaYzQ.js";import"./vendor-ui-radix-D9hJRGO8.js";import"./vendor-ai-9YAcD4D4.js";const N=g({password:b().min(8,"Password must be at least 8 characters long").regex(/[A-Z]/,"Password must contain at least one uppercase letter").regex(/[a-z]/,"Password must contain at least one lowercase letter").regex(/[0-9]/,"Password must contain at least one number")});function P(){const g=n(),[b]=a(),[,P]=a(),[k,q]=r.useState(!1),[S,z]=r.useState(!1),[A,C]=r.useState(null),{register:R,handleSubmit:E,formState:{errors:Y},watch:O}=h({resolver:p(N)}),F=O("password",""),I=[{text:"At least 8 characters",met:F.length>=8},{text:"One uppercase letter",met:/[A-Z]/.test(F)},{text:"One lowercase letter",met:/[a-z]/.test(F)},{text:"One number",met:/[0-9]/.test(F)}];r.useEffect(()=>{try{const e=b.includes("?")?b:window.location.href,s=new URL(e,window.location.origin).searchParams.get("token");s?C(s):g.error("Password reset link is invalid or expired. Please request a new one.")}catch(e){g.error("Password reset link is invalid or expired. Please request a new one.")}},[b,g]);const L=e({mutationFn:async e=>{if(!A)throw new Error("No reset token found");const s={...e,token:A};try{const e=await w("POST","/api/reset-password",s);return await e.json()}catch(a){throw a}},onSuccess:e=>{z(!0),g.success("Your password has been reset. You can now log in with your new password."),setTimeout(()=>{P("/login")},3e3)},onError:e=>{g.error(e.message||"Unable to reset password. Please request a new reset link.")}});return A?s.jsxs("div",{className:"min-h-screen bg-black relative flex items-center justify-center p-4",children:[s.jsxs("div",{className:"fixed inset-0 pointer-events-none",children:[s.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-green-900/20 via-cyan-900/20 to-purple-900/20"}),s.jsx("div",{className:"absolute top-1/4 left-1/4 w-96 h-96 bg-green-400/10 rounded-full blur-3xl animate-pulse"}),s.jsx("div",{className:"absolute bottom-1/4 right-1/4 w-96 h-96 bg-cyan-400/10 rounded-full blur-3xl animate-pulse delay-1000"})]}
1),s.jsxs("div",{className:"w-full max-w-md space-y-8 relative z-10",children:[s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"text-h1 gradient-text",children:"AiVoicePhone"}),s.jsx("p",{className:"mt-2 text-gray-300",children:"Create a new password"})]}),s.jsxs(l,{className:"bg-gray-900/95 backdrop-blur-md border border-cyan-400/30 shadow-2xl",children:[s.jsxs(c,{className:"space-y-1",children:[s.jsx(d,{className:"text-2xl text-center bg-gradient-to-r from-cyan-400 to-green-400 bg-clip-text text-transparent",children:S?"Password reset!":"Set new password"}),s.jsx(m,{className:"text-center text-gray-300",children:S?"You'll be redirected to login shortly":"Choose a strong password for your account"})]}),s.jsxs(o,{className:"space-y-4",children:[S?s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex justify-center",children:s.jsx("div",{className:"rounded-full bg-green-400/20 p-4 shadow-xl shadow-green-400/30",children:s.jsx(j,{className:"h-6 w-6 text-green-400"})})}),s.jsxs("div",{className:"text-center space-y-2",children:[s.jsx("p",{className:"text-gray-200",children:"Your password has been successfully reset!"}),s.jsx("p",{className:"text-small text-neutral-300",children:"You'll be redirected to the login page in a few seconds."})]}),s.jsx(t,{href:"/login",children:s.jsx(i,{className:"w-full bg-primary-500 hover:bg-primary-600 text-white shadow-md hover:shadow-lg transition-all duration-300 font-medium",children:"Go to login"})})]}):s.jsxs("form",{onSubmit:E(e=>{if(!A)return void g.error("Reset link expired. Please request a new one.");I.every(e=>e.met)?L.mutate({password:e.password}):g.warning("Please ensure your password meets all requirements.")}),className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(x,{htmlFor:"password",className:"text-gray-200",children:"New password"}),s.jsxs("div",{className:"relative",children:[s.jsx(u,{id:"password",type:k?"text":"password",placeholder:"Enter your new password",...R("password"),className:"bg-gray-800/50 border-cyan-400/30 text-white placeholder:text-neutral-300 focus:border-cyan-400 focus:ring-cyan-400/20 pr-10"}),s.jsx(i,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-4 py-2 hover:bg-transparent text-neutral-300 hover:text-cyan-400",onClick:()=>q(!k),children:k?s.jsx(y,{className:"h-4 w-4"}):s.jsx(v,{className:"h-4 w-4"})})]}),Y.password&&s.jsx("p",{className:"text-small text-red-400",children:Y.password.message}),F&&s.jsxs("div",{className:"space-y-1 pt-2",children:[s.jsx("p",{className:"text-small text-gray-300",children:"Password requirements:"}),I.map((e,a)=>s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:"w-2 h-2 rounded-full "+(e.met?"bg-green-400":"bg-gray-600")}),s.jsx("span",{className:"text-caption "+(e.met?"text-green-400":"text-neutral-300"),children:e.text})]},a))]})]}),s.jsx(i,{type:"submit",disabled:L.isPending||!A||!I.every(e=>e.met),onClick:e=>{},className:"w-full bg-primary-500 hover:bg-primary-600 text-white shadow-md hover:shadow-lg transition-all duration-300 font-medium disabled:opacity-50 disabled:cursor-not-allowed",children:L.isPending?"Resetting...":A?I.every(e=>e.met)?"Reset password":"Password Requirements Not Met":"Invalid Token"})]}),s.jsx("div",{className:"text-center",children:s.jsxs(t,{href:"/login",className:"inline-flex items-center text-small text-cyan-400 hover:text-cyan-300 transition-colors",children:[s.jsx(f,{className:"mr-1 h-4 w-4"}),"Back to login"]})})]})]})]})]}):s.jsxs("div",{className:"min-h-screen bg-black relative flex items-center justify-center p-4",children:[s.jsxs("div",{className:"fixed inset-0 pointer-events-none",children:[s.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-green-900/20 via-cyan-900/20 to-purple-900/20"}),s.jsx("div",{className:"absolute top-1/4 left-1/4 w-96 h-96 bg-green-400/10 rounded-full blur-3xl animate-pulse"}),s.jsx("div",{className:"absolute bottom-1/4 right-1/4 w-96 h-96 bg-cyan-400/10 rounded-full blur-3xl animate-pulse delay-1000"})]}),s.jsx(l,{className:"bg-gray-900/95 backdrop-blur-md border border-cyan-400/30 shadow-2xl w-full max-w-md relative z-10",children:s.jsxs(o,{className:"pt-6 text-center",children:[s.jsx("p",{className:"text-gray-200 mb-4",children:"Invalid or missing reset token."}),s.jsx(t,{href:"/forgot-password",children:s.jsx(i,{className:"bg-gradient-to-r from-cyan-400 to-green-400 text-black shadow-xl hover:shadow-2xl hover:shadow-cyan-400/30 border border-cyan-400/30 transition-all duration-300 font-medium",children:"Request new reset link"})})]})})]})}export{P 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.