import{_ as j}from"./AppTextField.vue_vue_type_script_setup_true_lang-e8a09900.js";import{d as D,aC as E,l as o,b6 as U,r as $,o as b,b as z,w as s,q as a,n as i,a6 as x,s as e,L as F,ay as C,V as G,x as H,c as k,I as c,y as O,B as W,av as J,S as K,b4 as Q,aI as T,b7 as X,H as Y,bM as Z,W as ee,A as ae,bN as I,aB as V,bO as M}from"./index-2e57ee69.js";import{u as B,m as se,a as te}from"./misc-mask-light-8659f0a3.js";import{a as r,V as R}from"./VRow-22fc34ca.js";import{b as L}from"./route-block-83d24a4e.js";const oe="/assets/register-multistep-illustration-dark-159ee0de.png",le="/assets/register-multistep-illustration-light-ff53a568.png",ne={class:"position-relative bg-background rounded-lg w-100 ma-8 me-0"},re={class:"d-flex align-center justify-center w-100 h-100"},ie=i("h5",{class:"text-h5 mb-1"}," Actualización de contraseña 🔐 ",-1),de=i("p",{class:"mb-0"}," Ingresa tu correo electrónico y la contraseña a cambiar. ",-1),ue={key:0,class:"mb-0 text-warning text-body-2"},ce={key:0},me=i("a",{class:"text-primary",href:"/forgot-password"},"aquí",-1),fe={key:1},pe=i("a",{class:"text-primary",href:"/forgot-password"},"aquí",-1),_e=i("span",null,"Regresar al login",-1),ge=D({__name:"reset-password",setup(be){const h=E().query.token??"",w=o(),d=o(!1),v=o(!1),m=o(!1),f=o(!1),p=o(""),_=o(""),u=o(!1),l=o({email:"",password:"",token:h}),N=B(le,oe),S=B(te,se),q=async()=>{const{valid:g}=await w.value.validate();g&&v.value&&(d.value=!0,I.changePassword(l.value).then(()=>{V.success("Contraseña actualizada correctamente"),u.value=!1,setTimeout(()=>{M.push({name:"login",query:{email:l.value.email}})},1e3)}).catch(t=>{V.error(t),u.value=!0,_.value=t}).finally(()=>{d.value=!1}))},P=()=>{h||M.push({name:"login"}),I.checkResetToken(h).then(()=>{v.value=!0,u.value=!1}).catch(g=>{u.value=!0,_.value=g,V.error("Token inválido")})};return U(()=>{P()}),(g,t)=>{const y=j,A=$("RouterLink");return b(),z(R,{class:"auth-wrapper bg-surface","no-gutters":""},{default:s(()=>[a(r,{lg:"8",class:"d-none d-lg-flex"},{default:s(()=>[i("div",ne,[i("div",re,[a(x,{"max-width":"250",src:e(N),class:"auth-illustration mt-16 mb-2"},null,8,["src"])]),a(x,{class:"auth-footer-mask",src:e(S)},null,8,["src"])])]),_:1}),a(r,{cols:"12",lg:"4",class:"d-flex align-center justify-center"},{default:s(()=>[a(F,{flat:"","max-width":500,class:"mt-12 mt-sm-0 pa-4"},{default:s(()=>[a(C,null,{default:s(()=>[a(e(G),{nodes:e(H).app.logo,class:"mb-6"},null,8,["nodes"]),ie,de,e(u)?(b(),k("p",ue,[e(_)!==""?(b(),k("span",ce,[c(O(e(_))+" ",1),me,c(". ")])):(b(),k("span",fe,[c(" El token ha expirado. Por favor, solicita un nuevo token "),pe,c(" . ")]))])):W("",!0)]),_:1}),a(C,null,{default:s(()=>[a(J,{ref_key:"form",ref:w,onSubmit:K(q,["prevent"])},{default:s(()=>[a(R,null,{default:s(()=>[a(r,{cols:"12"},{default:s(()=>[a(y,{modelValue:e(l).email,"onUpdate:modelValue":t[0]||(t[0]=n=>e(l).email=n),autofocus:"",label:"Email",type:"email",disabled:e(d),rules:[e(Q)]},null,8,["modelValue","disabled","rules"])]),_:1}),a(r,{cols:"12"},{default:s(()=>[a(y,{modelValue:e(l).password,"onUpdate:modelValue":t[1]||(t[1]=n=>e(l).password=n),label:"Nueva contraseña",disabled:e(d),type:e(m)?"text":"password",clearable:"",rules:[e(T),e(X)(e(l).password,8)],"append-icon":e(m)?"mdi-eye":"mdi-eye-off","onClick:append":t[2]||(t[2]=n=>m.value=!e(m))},null,8,["modelValue","disabled","type","rules","append-icon"])]),_:1}),a(r,{cols:"12"},{default:s(()=>[a(y,{modelValue:e(p),"onUpdate:modelValue":t[3]||(t[3]=n=>Y(p)?p.value=n:null),label:"Confirmación de contraseña",disabled:e(d),type:e(f)?"text":"password",clearable:"",rules:[e(T),e(Z)(e(l).password,e(p))],"append-icon":e(f)?"mdi-eye":"mdi-eye-off","onClick:append":t[4]||(t[4]=n=>f.value=!e(f))},null,8,["modelValue","disabled","type","rules","append-icon"])]),_:1}),a(r,{cols:"12"},{default:s(()=>[a(ee,{block:"",type:"submit",style:{"text-transform":"none"},loading:e(d),disabled:!e(v)},{default:s(()=>[c(" Cambiar contraseña ")]),_:1},8,["loading","disabled"])]),_:1}),a(r,{cols:"12"},{default:s(()=>[a(A,{class:"d-flex align-center justify-center",to:{name:"login"}},{default:s(()=>[a(ae,{icon:"tabler-chevron-left",class:"flip-in-rtl"}),_e]),_:1})]),_:1})]),_:1})]),_:1},8,["onSubmit"])]),_:1})]),_:1})]),_:1})]),_:1})}}});typeof L=="function"&&L(ge);export{ge as default};
