import{C as e,E as t,Ht as n,Q as r,R as i,W as a,b as o,d as s,g as c,gt as l,lt as u,ut as d,w as f}from"./vue.runtime.esm-bundler-56z_v_HH.js";import{i as p}from"./vue-router-_izWfDzq.js";import{t as m}from"./notification.store-EczSZ_VB.js";import{n as h,r as g}from"./error-handling-S7N4FACK.js";import{t as _}from"./store-DIrP_oUf.js";import{r as v}from"./routes-B4sdSdat.js";import{n as y}from"./vue-i18n-DhldrKy8.js";import{D as b,M as x,O as S,T as C}from"./main-CkEZzrzw.js";var w=t({__name:`CustomerPortalForgotPasswordView`,setup(t){let w=_(),T=m(),E=p(),{t:D}=y(),O=u({email:``}),k=d(!1),A=d(!1),j=c(()=>v(E.params.company)),M=C(c(()=>({email:{required:b.withMessage(D(`validation.required`),x),email:b.withMessage(D(`validation.email_incorrect`),S)}})),O);async function N(){if(M.value.$touch(),!(M.value.$invalid||!j.value)){A.value=!0;try{await w.forgotPassword({email:O.email,company:j.value}),T.showNotification({type:`success`,message:D(`general.send_mail_successfully`)}),k.value=!0}catch(e){P(e)}finally{A.value=!1}}}function P(e){let t=g(e),n=h(t.message);T.showNotification({type:`error`,message:n?D(n):t.message})}return(t,c)=>{let u=a(`BaseInput`),d=a(`BaseInputGroup`),p=a(`BaseButton`),m=a(`router-link`);return i(),o(`form`,{class:`space-y-6`,onSubmit:s(N,[`prevent`])},[f(d,{error:l(M).email.$error?String(l(M).email.$errors[0]?.$message):void 0,label:t.$t(`login.enter_email`),required:``},{default:r(()=>[f(u,{modelValue:O.email,"onUpdate:modelValue":c[0]||=e=>O.email=e,invalid:l(M).email.$error,focus:``,name:`email`,type:`email`,onInput:c[1]||=e=>l(M).email.$touch()},null,8,[`modelValue`,`invalid`])]),_:1},8,[`error`,`label`]),f(p,{disabled:A.value,loading:A.value,class:`w-full justify-center`,type:`submit`},{default:r(()=>[e(n(k.value?t.$t(`validation.not_yet`):t.$t(`validation.send_reset_link`)),1)]),_:1},8,[`disabled`,`loading`]),f(m,{to:{name:`customer-portal.login`,params:{company:j.value}},class:`inline-block text-sm text-primary-500 hover:text-heading`},{default:r(()=>[e(n(t.$t(`general.back_to_login`)),1)]),_:1},8,[`to`])],32)}}});export{w as default};