import{j as e,B as l,L as d,R as c,q as x,t as u}from"./index-Cc987VYg.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-CirgXhnc.js";import{a as b}from"./zod-BQ5psN1t.js";import{I as F}from"./input-DPNG9e3H.js";import{u as N,r as k}from"./reset-password.schema-CpuO5jb1.js";import{L as v}from"./label-npsA0UlW.js";import"./schemas-BrV_YNaF.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(n){const i=x(n)||"Failed to send reset email";u.error(i)}};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 M(){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{M as ForgotPasswordPage};
