import{L as S,e as M,v as E,H as C,f as $,k as L,j as P,r as d,o as f,c as R,a as n,w as u,l as o,m as g,n as _,p as x,t as A,q as G,g as p,h as y,i as U,I as j,a0 as D}from"./main-B9dpPbRR.js";import{u as N}from"./global-1F4OAoew.js";import{u as O}from"./auth-6FPSPboo.js";const J={__name:"ResetPassword",setup(F){const c=S(),I=M(),b=O(),{t:i}=E.useI18n(),r=C({email:"",password:"",password_confirmation:""});N();let a=$(!1),v=$(!1);const V=L(()=>({email:{required:p.withMessage(i("validation.required"),y),email:p.withMessage(i("validation.email_incorrect"),U)},password:{required:p.withMessage(i("validation.required"),y),minLength:p.withMessage(i("validation.password_min_length",{count:8}),j(8))},password_confirmation:{sameAsPassword:p.withMessage(i("validation.password_incorrect"),D(r.password))}})),s=P(V,r);async function B(l){if(s.value.$touch(),!s.value.$invalid){let e={email:r.email,password:r.password,password_confirmation:r.password_confirmation,token:c.params.token};v.value=!0;let m=b.resetPassword(e,c.params.company);v.value=!1,m.data&&I.push({name:"customer.login"})}}return(l,e)=>{const m=d("BaseInput"),w=d("BaseInputGroup"),k=d("EyeOffIcon"),q=d("EyeIcon"),h=d("BaseButton");return f(),R("form",{id:"loginForm",onSubmit:G(B,["prevent"])},[n(w,{error:o(s).email.$error&&o(s).email.$errors[0].$message,label:l.$t("login.email"),class:"mb-4",required:""},{default:u(()=>[n(m,{modelValue:r.email,"onUpdate:modelValue":e[0]||(e[0]=t=>r.email=t),type:"email",name:"email",invalid:o(s).email.$error,onInput:e[1]||(e[1]=t=>o(s).email.$touch())},null,8,["modelValue","invalid"])]),_:1},8,["error","label"]),n(w,{error:o(s).password.$error&&o(s).password.$errors[0].$message,label:l.$t("login.password"),class:"mb-4",required:""},{default:u(()=>[n(m,{modelValue:r.password,"onUpdate:modelValue":e[4]||(e[4]=t=>r.password=t),type:o(a)?"text":"password",name:"password",invalid:o(s).password.$error,onInput:e[5]||(e[5]=t=>o(s).password.$touch())},{right:u(()=>[o(a)?(f(),g(k,{key:0,class:"w-5 h-5 mr-1 text-gray-500 cursor-pointer",onClick:e[2]||(e[2]=t=>_(a)?a.value=!o(a):a=!o(a))})):(f(),g(q,{key:1,class:"w-5 h-5 mr-1 text-gray-500 cursor-pointer",onClick:e[3]||(e[3]=t=>_(a)?a.value=!o(a):a=!o(a))}))]),_:1},8,["modelValue","type","invalid"])]),_:1},8,["error","label"]),n(w,{error:o(s).password_confirmation.$error&&o(s).password_confirmation.$errors[0].$message,label:l.$t("login.retype_password"),class:"mb-4",required:""},{default:u(()=>[n(m,{modelValue:r.password_confirmation,"onUpdate:modelValue":e[6]||(e[6]=t=>r.password_confirmation=t),type:"password",name:"password",invalid:o(s).password_confirmation.$error,onInput:e[7]||(e[7]=t=>o(s).password_confirmation.$touch())},null,8,["modelValue","invalid"])]),_:1},8,["error","label"]),n(h,{type:"submit",variant:"primary"},{default:u(()=>[x(A(l.$t("login.reset_password")),1)]),_:1})],32)}}};export{J as default};
