import{J as w,a0 as S,B as _,L as f,M as V,Q as I,T as x,r as n,o as l,e as u,f as r,w as m,u as t,t as d,h as M,i as N,U as q,a as j}from"./vendor.d12b5734.js";import{u as C,h as D}from"./main.465728e1.js";const E=["onSubmit"],G={key:0},L={key:1},T={class:"mt-4 mb-4 text-sm"},Q={setup(U){const g=C(),{t:c}=w(),i=S({email:""}),p=_(!1),o=_(!1),h={email:{required:f.withMessage(c("validation.required"),V),email:f.withMessage(c("validation.email_incorrect"),I)}},a=x(h,i);async function y(s){if(a.value.$touch(),!a.value.$invalid)try{o.value=!0,(await j.post("/api/v1/auth/password/email",i)).data&&g.showNotification({type:"success",message:"Mail sent successfully"}),p.value=!0,o.value=!1}catch(e){D(e),o.value=!1}}return(s,e)=>{const $=n("BaseInput"),b=n("BaseInputGroup"),B=n("BaseButton"),k=n("router-link");return l(),u("form",{id:"loginForm",onSubmit:q(y,["prevent"])},[r(b,{error:t(a).email.$error&&t(a).email.$errors[0].$message,label:s.$t("login.enter_email"),class:"mb-4",required:""},{default:m(()=>[r($,{modelValue:t(i).email,"onUpdate:modelValue":e[0]||(e[0]=v=>t(i).email=v),invalid:t(a).email.$error,focus:"",type:"email",name:"email",onInput:e[1]||(e[1]=v=>t(a).email.$touch())},null,8,["modelValue","invalid"])]),_:1},8,["error","label"]),r(B,{loading:o.value,disabled:o.value,type:"submit",variant:"primary"},{default:m(()=>[p.value?(l(),u("div",L,d(s.$t("validation.not_yet")),1)):(l(),u("div",G,d(s.$t("validation.send_reset_link")),1))]),_:1},8,["loading","disabled"]),M("div",T,[r(k,{to:"/login",class:"text-sm text-primary-400 hover:text-gray-700"},{default:m(()=>[N(d(s.$t("general.back_to_login")),1)]),_:1})])],40,E)}}};export{Q as default};
