import{d as e,bn as a,aN as l,aL as s,m as o,w as n,l as t,N as i,c,a8 as r,a7 as u,e as d,g as p,O as m,t as v,aO as g,aH as f,aQ as h,r as y,b7 as b,bo as _,bj as w,F as x,a9 as V,ag as k,aK as z,o as K,b0 as j,D as S,al as E,b9 as N,ba as T,aY as C,bb as I,bp as L,am as D,ap as R,P as U,an as $,Q as A,b2 as F}from"./index.BFaMmrdh.js";import{E as G}from"./el-card.DF-g7L2j.js";import{_ as H}from"./index.FIigyu3Z.js";/* empty css */import{a as O,E as B,b as Q}from"./el-dropdown.B6Syxqff.js";import"./dropdown.Cz-QW5MJ.js";const q=e({__name:"index",props:{size:{type:String,required:!1}},setup(e){const f=[{label:"中文",value:a.ZH_CN},{label:"English",value:a.EN}],h=l(),{locale:y,t:b}=s();function _(e){y.value=e,h.changeLanguage(e),g.success(b("langSelect.message.success"))}return(a,l)=>{const s=H,g=Q,y=B,b=O;return d(),o(b,{trigger:"click",onCommand:_},{dropdown:n(()=>[i(y,null,{default:n(()=>[(d(),c(u,null,r(f,e=>i(g,{key:e.value,disabled:p(h).language===e.value,command:e.value},{default:n(()=>[m(v(e.label),1)]),_:2},1032,["disabled","command"])),64))]),_:1})]),default:n(()=>[t("div",null,[i(s,{"icon-class":"language",size:e.size},null,8,["size"])])]),_:1})}}}),J={class:"login-container"},M={class:"absolute-lt flex-x-end p-3 w-full"},P={class:"logo"},W=["src"],Y={class:"text-center relative"},Z={class:"flex-y-center w-full"},X={class:"flex-y-center w-full"},ee={class:"flex-y-center w-full"},ae=F(e({__name:"index",setup(e){l();const a=f(),s=h(),r=j(),u=y(s.theme===b.DARK),g=y(!0),F=y(!1),O=y(!1),B=y(_),{height:Q}=w(),ae=y(""),le=y({username:"",password:"",google_code:""});const se=x(()=>({})),oe=y("");function ne(){const e="/"+re.value.active;z.push({path:e})}function te(){B.value.validate(e=>{if(e){F.value=!0;const e=function(){let e=le.value;const a=re.value.active;return"payer"===a?e={...le.value,mer_name:le.value.username}:"payee"===a&&(e={...le.value,ms_name:le.value.username}),e}();a.login(e).then(e=>{ne()}).catch(()=>{}).finally(()=>{F.value=!1})}})}const ie=()=>{const e=s.theme===b.DARK?b.LIGHT:b.DARK;s.changeTheme(e)};function ce(e){e instanceof KeyboardEvent&&(O.value=e.getModifierState("CapsLock"))}V(()=>{Q.value<600?g.value=!1:g.value=!0});const re=y({active:"",list:[{identity:"other",name:"总后台"},{identity:"payer",name:"商户后台"},{identity:"payee",name:"四方管理后台"}]});k({visible:!1,type:"user-form",width:400,title:"",leftBtnText:"确 定",rightBtnText:""});let ue=JSON.parse(sessionStorage.getItem("loginInfo")||"{}");re.value.active=ue.loginType,ae.value&&ae.value!==re.value.active&&!["other","payee","payer"].includes(re.value.active)&&(localStorage.clear(),z.push({path:"/login",replace:!0})),ae.value=re.value.active;return localStorage.getItem(ae.value+"accessToken")&&ne(),K(()=>{re.value.active}),S(()=>r.path,e=>{e.startsWith("/login/")&&re.value.active}),(e,a)=>{const l=I,s=q,r=H,g=D,f=L,h=R,y=$,b=_,w=G;return d(),c("div",J,[t("div",M,[i(l,{modelValue:p(u),"onUpdate:modelValue":a[0]||(a[0]=e=>C(u)?u.value=e:null),"inline-prompt":"","active-icon":p(T),"inactive-icon":p(N),onChange:ie},null,8,["modelValue","active-icon","inactive-icon"]),i(s,{class:"ml-2 cursor-pointer"})]),p(re).active?(d(),o(w,{key:0,class:"login-input-container !border-none !bg-transparent !rounded-[4%] w-100 [t("div",P,[t("img",{src:p(oe),alt:""},null,8,W)]),t("div",Y,[t("h2",null,v(p(re).list.find(e=>e.identity===p(re).active).name),1)]),i(b,{ref_key:"loginFormRef",ref:B,model:p(le),rules:p(se),class:"login-form"},{default:n(()=>[i(f,{prop:"username"},{default:n(()=>[t("div",Z,[i(r,{"icon-class":"user",class:"mx-2"}),i(g,{ref:"username",modelValue:p(le).username,"onUpdate:modelValue":a[1]||(a[1]=e=>p(le).username=e),placeholder:e.$t("login.username"),name:"username",size:"large",class:"h-[48px]"},null,8,["modelValue","placeholder"])])]),_:1}),i(h,{visible:p(O),content:e.$t("login.capsLock"),placement:"right"},{default:n(()=>[i(f,{prop:"password"},{default:n(()=>[t("div",X,[i(r,{"icon-class":"lock",class:"mx-2"}),i(g,{modelValue:p(le).password,"onUpdate:modelValue":a[2]||(a[2]=e=>p(le).password=e),placeholder:e.$t("login.password"),type:"password",name:"password",onKeyup:[ce,U(te,["enter"])],size:"large",class:"h-[48px] pr-2","show-password":""},null,8,["modelValue","placeholder"])])]),_:1})]),_:1},8,["visible","content"]),i(f,{prop:"google_code"},{default:n(()=>[t("div",ee,[i(r,{"icon-class":"captcha",class:"mx-2"}),i(g,{modelValue:p(le).google_code,"onUpdate:modelValue":a[3]||(a[3]=e=>p(le).google_code=e),"auto-complete":"off",size:"large",class:"flex-1",placeholder:"Google验证码",onKeyup:U(te,["enter"])},null,8,["modelValue"])])]),_:1}),i(y,{loading:p(F),type:"primary",size:"large",class:"w-full",onClick:A(te,["prevent"])},{default:n(()=>[m(v(e.$t("login.login")),1)]),_:1},8,["loading"])]),_:1},8,["model","rules"])]),_:1})):E("",!0)])}}}),[["__scopeId","data-v-44e29361"]]);export{ae as default};