import{j as e,B as l,L as d,R as c,q as u,t as x}from"./index-C-gKvEDq.js";import{u as h,F as p,a as j,b as f,c as g,d as y,e as w}from"./form-rPxRlXL8.js";import{u as b}from"./zod-B-5Oumzy.js";import{I as F}from"./input-B9yFYvyi.js";import{u as N,r as k}from"./reset-password.schema-CwyhfFqu.js";import{L as v}from"./loader-circle-MiR2w4nF.js";import"./label-B3YRGmn1.js";import"./schemas-IctYPUjJ.js";import"./query-keys-DGBjVswC.js";function L({onSuccess:a}){const{resetPassword:o,isResettingPassword:r}=N(),s=h({resolver:b(k),defaultValues:{email:""}}),m=async t=>{try{await o(t),s.reset(),a?.()}catch(i){const n=u(i)||"Failed to send reset email";x.error(n)}};return e.jsx(p,{...s,children:e.jsxs("form",{onSubmit:s.handleSubmit(m),className:"space-y-6",children:[e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Reset Password"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your email address and we'll send you a link to reset your password"})]}),e.jsx(j,{control:s.control,name:"email",render:({field:t})=>e.jsxs(f,{children:[e.jsx(g,{required:!0,children:"Email Address"}),e.jsx(y,{children:e.jsx(F,{type:"email",placeholder:"Enter your email",...t,disabled:r,autoComplete:"email"})}),e.jsx(w,{})]})}),e.jsxs(l,{type:"submit",className:"w-full",disabled:r,children:[r&&e.jsx(v,{className:"mr-2 h-4 w-4 animate-spin"}),"Send Reset Link"]}),e.jsx("div",{className:"text-center text-sm",children:e.jsx(d,{to:c.LOGIN,className:"text-primary hover:underline",children:"Back to login"})})]})})}function q(){return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-gradient-to-br from-blue-50 to-indigo-100 dark:from-gray-900 dark:to-gray-800",children:e.jsxs("div",{className:"w-full max-w-md space-y-8 rounded-lg bg-white p-8 shadow-xl dark:bg-gray-950",children:[e.jsx(L,{}),e.jsx("div",{className:"text-center text-sm text-muted-foreground dark:text-muted-foreground",children:e.jsxs("p",{children:["© ",new Date().getFullYear()," Absolin Hospital Management System"]})})]})})}export{q as ForgotPasswordPage};
