import{_ as T}from"./CNIrc0EA.js";import{_ as U}from"./DrAtu1a1.js";import{_ as z}from"./DuhDFJjj.js";import{A}from"./AmaTRG5a.js";import{z as H,j as m,P as L,k as v,l as F,c as u,b as a,f,t as l,e as _,G as V,I as b,m as e,D as $,H as C,w as G,E as J,o as d,J as x,M as K}from"./Bgmy51Qv.js";import{u as O}from"./7pZkuj9N.js";import{u as Q}from"./LR-3m_fG.js";const W={class:"mb-30 mb-sm-15"},X={class:"input-wrapper"},Y={class:"icon-input"},Z=["placeholder"],ee={key:0,class:"error"},se={key:1,class:"error"},te={class:"input-wrapper"},ae={class:"icon-input"},oe=["placeholder"],ne={key:0,class:"error"},re={class:"input-wrapper"},le={key:0,class:"error"},ie={key:1,class:"error"},ue={class:"input-wrapper"},de={key:0,class:"error"},pe={key:1,class:"error"},ce={class:"dply-felx j-right mt-15"},we={__name:"verify-code",setup(me){const P=H(),{setErrors:q}=P,E=O(),{setRequest:M}=E,o=m(""),p=m(""),c=m(""),n=m(!1),y=m(!1),h=L(),r=v(()=>{var s;return(s=h==null?void 0:h.query)==null?void 0:s.email}),{isValidEmail:j,isValidLength:w}=Q(),g=v(()=>r.value&&!j(r.value)),B=v(()=>o.value&&!w(o.value)),k=v(()=>!w(o.value));v(()=>o.value&&!k.value);const N=async()=>{if(n.value=!1,!r.value||g.value||!p.value||!o.value||o.value!==c.value)return n.value=!0,!1;y.value=!0,await M({params:{password:o.value,email:r.value,code:p.value},api:"verifyCode"})&&K("/login"),y.value=!1};return F(()=>{q()}),(s,t)=>{const D=T,S=U,I=z,R=A;return d(),u("form",{onSubmit:t[4]||(t[4]=J(i=>N(),["prevent"])),class:$([{"has-error":e(n)},"login-form"])},[a("h4",W,l(s.$t("profile.putCode")),1),f(D),a("div",X,[a("div",Y,[t[5]||(t[5]=a("i",{class:"icon email-icon"}," ",-1)),V(a("input",{disabled:"",type:"text",placeholder:s.$t("fSale.email"),"onUpdate:modelValue":t[0]||(t[0]=i=>C(r)?r.value=i:null),class:$({invalid:!e(r)||e(g)})},null,10,Z),[[b,e(r),void 0,{trim:!0}]])]),!e(r)&&e(n)?(d(),u("span",ee,l(s.$t("category.req",{type:s.$t("fSale.email")})),1)):e(g)&&e(n)?(d(),u("span",se,l(s.$t("user.isValid",{type:s.$t("fSale.email")})),1)):_("",!0)]),a("div",te,[a("div",ae,[t[6]||(t[6]=a("i",{class:"icon code-icon"}," ",-1)),V(a("input",{type:"text",placeholder:s.$t("profile.cfe"),"onUpdate:modelValue":t[1]||(t[1]=i=>C(p)?p.value=i:null),class:$({invalid:!e(p)})},null,10,oe),[[b,e(p),void 0,{trim:!0}]])]),!e(p)&&e(n)?(d(),u("span",ne,l(s.$t("category.req",{type:s.$t("setting.code")})),1)):_("",!0)]),a("div",re,[f(S,{value:e(o),"is-invalid":e(B),onChangePassword:t[2]||(t[2]=i=>o.value=i)},null,8,["value","is-invalid"]),!e(o)&&e(n)?(d(),u("span",le,l(s.$t("category.req",{type:s.$t("user.pass")})),1)):e(k)&&e(n)?(d(),u("span",ie,l(s.$t("user.inPass")),1)):_("",!0)]),a("div",ue,[f(S,{value:e(c),onChangePassword:t[3]||(t[3]=i=>c.value=i)},null,8,["value"]),!e(c)&&e(n)?(d(),u("span",de,l(s.$t("category.req",{type:s.$t("user.pass")})),1)):e(c)!==e(o)&&e(n)?(d(),u("span",pe,l(s.$t("user.nMatch")),1)):_("",!0)]),a("div",ce,[f(I,{to:"/login",class:"link"},{default:G(()=>[x(l(s.$t("profile.ltya")),1)]),_:1})]),f(R,{class:"mt-20 primary-btn","fetching-data":e(y),"loading-text":s.$t("dataPage.verify"),text:s.$t("dataPage.up"),"activate-btn":!0},null,8,["fetching-data","loading-text","text"])],34)}}};export{we as default};
