import{b7 as V,u as x,$,aC as k,z as T,r as t,aS as E,aT as I,bf as r,a$ as p,b0 as c,ba as w,N as R,cg as S,b8 as B,ad as P,d1 as U,f as D,aX as N}from"./index-xnhGKCfe.js";const O={class:"tip"},z=V({__name:"bindEmail",setup(F){const u=t(null),s=t({phone:void 0,verifyCode:void 0}),n=t(""),f=t(),m=D(),{t:l}=x(),{getVerifyCode:v,loadingText:y}=$(P),{maskEmail:h,verifyEmail:d,getUserInfo:b}=T(),i=t(!1),g=k([{key:"email",icon:"email",prefix:!1,props:{placeholder:d.value?h.value:"Enter your email",type:"text",disabled:d.value},rule:{message:l("t783"),validate:a=>{var e;return(e=f.value)==null?void 0:e.validPhone(a)}}},{key:"verifyCode",icon:"safe",suffix:!0,props:{placeholder:l("t1122"),type:"text"},rule:{message:l("t1123"),validate:a=>!!a}}]);async function C(){var e;((e=u.value)==null?void 0:e.validate("phone"))&&await v({verifyCodeType:1,codeType:5,phoneOrEmail:`${n.value}${s.value.phone}`})}async function _(){const{phone:a,verifyCode:e}=s.value;if(!i.value)try{i.value=!0;const{code:o}=await U({phoneOrEmail:`${n.value}${a}`.trim(),code:e.trim()});o==0&&(m.success(l("t197")),await b())}finally{i.value=!1}}return(a,e)=>(I(),E(B,{ref_key:"formRef",ref:u,modelValue:s.value,"onUpdate:modelValue":e[1]||(e[1]=o=>s.value=o),configs:g.value,confirmText:i.value?a.$t("t1127"):a.$t("t962"),onSubmit:_},{phonePrefix:r(()=>[R(S,{ref_key:"phoneInputRef",ref:f,modelValue:n.value,"onUpdate:modelValue":e[0]||(e[0]=o=>n.value=o),isDialog:!0},null,8,["modelValue"])]),verifyCodeSuffix:r(()=>[p("button",{class:"send btn_main_style",onClick:C,type:"button"},c(w(y)),1)]),footer:r(()=>[p("div",O,c(a.$t("t810")),1)]),_:1},8,["modelValue","configs","confirmText"]))}}),j=N(z,[["__scopeId","data-v-3d60d2e7"]]);export{j as default};
