1import{j as e}from"./vendor-query-BVMb3S9f.js";import{r,u as g}from"./vendor-react-BmnyI7hj.js";import{u as y,s as x}from"./index-f89aq0IA.js";import"./vendor-ui-CGy3Dxhc.js";import"./vendor-supabase-cZ1AhKFM.js";import"./vendor-forms-DP4uz6ig.js";function E(){const[a,p]=r.useState(""),[o,h]=r.useState(""),[d,n]=r.useState(null),[i,l]=r.useState(!1),[f,b]=r.useState(!1),[c,m]=r.useState(null),{updatePassword:w}=y(),u=g();r.useEffect(()=>{x.auth.getSession().then(({data:{session:t}})=>{m(!!t)});const{data:{subscription:s}}=x.auth.onAuthStateChange(t=>{t==="PASSWORD_RECOVERY"&&m(!0)});return()=>s.unsubscribe()},[]);async function j(s){if(s.preventDefault(),n(null),a!==o){n("Passwords do not match");return}if(a.length<6){n("Password must be at least 6 characters");return}l(!0);try{await w(a),b(!0),setTimeout(()=>{u("/war-room")},2e3)}catch(t){n(t instanceof Error?t.message:"Failed to update password")}finally{l(!1)}}return c===null?e.jsx("div",{className:"min-h-screen bg-surface-secondary flex items-center justify-center p-4",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary-600"})}):c?f?e.jsx("div",{className:"min-h-screen bg-surface-secondary flex items-center justify-center p-4",children:e.jsx("div",{className:"w-full max-w-md",children:e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-border p-8 text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx("svg",{className:"w-8 h-8 text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("h1",{className:"text-2xl font-bold text-text-primary mb-2",children:"Password Updated!"}),e.jsx("p",{className:"text-text-secondary",children:"Redirecting you to the app..."})]})})}):e.jsx("div",{className:"min-h-screen bg-surface-secondary flex items-center justify-center p-4",children:e.jsx("div",{className:"w-full max-w-md",children:e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-border p-8",children:[e.jsx("h1",{className:"text-2xl font-bold text-text-primary text-center mb-2",children:"Set New Password"}),e.jsx("p",{className:"text-text-secondary text-center mb-8",children:"Enter your new password below"}),e.jsxs("form",{onSubmit:j,className:"space-y-4",children:[d&&e.jsx("div",{className:"bg-red-50 text-red-600 text-sm p-3 rounded-md",children:d}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-primary mb-1",children:"New Password"}),e.jsx("input",{id:"password",type:"password",value:a,onChange:s=>p(s.target.value),required:!0,className:"w-full px-3 py-2 border border-border rounded-md focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"confirmPassword",className:"block text-sm font-medium text-text-primary mb-1",children:"Confirm New Password"}),e.jsx("input",{id:"confirmPassword",type:"password",value:o,onChange:s=>h(s.target.value),required:!0,className:"w-full px-3 py-2 border border-border rounded-md focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢"})]}),e.jsx("button",{type:"submit",disabled:i,className:"w-full bg-primary-600 hover:bg-primary-700 text-white font-medium py-2 px-4 rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:i?"Updating...":"Update Password"})]})]})})}):e.jsx("div",{className:"min-h-screen bg-surface-secondary flex items-center justify-center p-4",children:e.jsx("div",{className:"w-full max-w-md",children:e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-border p-8 text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-red-100 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx("svg",{className:"w-8 h-8 text-red-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("h1",{className:"text-2xl font-bold text-text-primary mb-2",children:"Invalid or Expired Link"}),e.jsx("p",{className:"text-text-secondary mb-6",children:"This password reset link is invali
1d or has expired. Please request a new one."}),e.jsx("button",{onClick:()=>u("/login"),className:"inline-block bg-primary-600 hover:bg-primary-700 text-white font-medium py-2 px-6 rounded-md transition-colors",children:"Back to Login"})]})})})}export{E 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.