import{c as m,g as x,a as w,u as b,i as n,b as _,t as $}from"./web.4OCuPnM3.js";import{T as c,F as E}from"./toast.BAoR90zK.js";import{a as F,g as h}from"./errors.BxTAJicR.js";import"./router.BaxLfCzj.js";var y=$('<form method=post class="grid gap-5 md:gap-10 max-w-sm mx-auto"><!$><!/><div class="flex flex-wrap justify-center mt-5"><button type=submit class="bg-blue-950 rounded-lg text-white p-2 w-[10rem]">');const N=()=>{const[g,i]=m(!1),[f,l]=m();let s;const d=async t=>{t.preventDefault(),i(!0),l();try{const r=new FormData(s),{data:a,error:e}=await F.forgotPassword(r);l(e),await c.fire({icon:e?"error":"success",title:e?"Failed":"Successful",text:a?.message??e?.fields?"":e?.message}),e||s.reset()}catch(r){await c.fire({icon:"error",title:"Error",text:r.message})}finally{i(!1)}};return(()=>{var t=x(y),r=t.firstChild,[a,e]=w(r.nextSibling),p=a.nextSibling,u=p.firstChild;return b(o=>s=o,t),t.addEventListener("submit",o=>d(o)),n(t,_(E,{name:"email",label:"Email",type:"email",placeholder:"Email",className:"grow",error:()=>h("email",f())}),a,e),n(u,()=>g()?"...loading":"Submit"),t})()};export{N as ForgotPasswordForm};
