import{q as C,R as y,t as P,x as w,d as m,y as q,H as h,g as i,v as L,F as k,C as S,af as g,aX as E,w as D,a3 as N,a as _,f as H,P as V,h as $,T as j}from"./index-7ceda0c5.js";import{F as B}from"./index-f8be94d8.js";import{I as O}from"./index-1da83643.js";const[b,R]=C("row"),x=Symbol(b),A={tag:y("div"),wrap:P,align:String,gutter:w(0),justify:String};var z=m({name:b,props:A,setup(e,{slots:a}){const{children:c,linkChildren:l}=q(x),d=h(()=>{const t=[[]];let s=0;return c.forEach((o,u)=>{s+=Number(o.span),s>24?(t.push([u]),s-=24):t[t.length-1].push(u)}),t}),n=h(()=>{const t=Number(e.gutter),s=[];return t&&d.value.forEach(o=>{const u=t*(o.length-1)/o.length;o.forEach((p,F)=>{if(F===0)s.push({right:u});else{const v=t-s[p-1].right,T=u-v;s.push({left:v,right:T})}})}),s});return l({spaces:n}),()=>{const{tag:t,wrap:s,align:o,justify:u}=e;return i(t,{class:R({[`align-${o}`]:o,[`justify-${u}`]:u,nowrap:!s})},{default:()=>{var p;return[(p=a.default)==null?void 0:p.call(a)]}})}}});const[G,K]=C("col"),M={tag:y("div"),span:w(0),offset:L};var U=m({name:G,props:M,setup(e,{slots:a}){const{parent:c,index:l}=k(x),d=h(()=>{if(!c)return;const{spaces:n}=c;if(n&&n.value&&n.value[l.value]){const{left:t,right:s}=n.value[l.value];return{paddingLeft:t?`${t}px`:null,paddingRight:s?`${s}px`:null}}});return()=>{const{tag:n,span:t,offset:s}=e;return i(n,{style:d.value,class:K({[t]:t,[`offset-${s}`]:s})},{default:()=>{var o;return[(o=a.default)==null?void 0:o.call(a)]}})}}});const f=S(U);function W(e,a){const{days:c}=a;let{hours:l,minutes:d,seconds:n,milliseconds:t}=a;if(e.includes("DD")?e=e.replace("DD",g(c)):l+=c*24,e.includes("HH")?e=e.replace("HH",g(l)):d+=l*60,e.includes("mm")?e=e.replace("mm",g(d)):n+=d*60,e.includes("ss")?e=e.replace("ss",g(n)):t+=n*1e3,e.includes("S")){const s=g(t,3);e.includes("SSS")?e=e.replace("SSS",s):e.includes("SS")?e=e.replace("SS",s.slice(0,2)):e=e.replace("S",s.charAt(0))}return e}const[X,Y]=C("count-down"),Z={time:w(0),format:y("HH:mm:ss"),autoStart:P,millisecond:Boolean};var J=m({name:X,props:Z,emits:["change","finish"],setup(e,{emit:a,slots:c}){const{start:l,pause:d,reset:n,current:t}=E({time:+e.time,millisecond:e.millisecond,onChange:u=>a("change",u),onFinish:()=>a("finish")}),s=h(()=>W(e.format,t.value)),o=()=>{n(+e.time),e.autoStart&&l()};return D(()=>e.time,o,{immediate:!0}),N({start:l,pause:d,reset:o}),()=>i("div",{role:"timer",class:Y()},[c.default?c.default(t.value):s.value])}});const ce=S(J),I=S(z),Q="_imgCode_mq980_1",ee="_codeTitle_mq980_4",se="_img_mq980_1",te="_imgChange_mq980_16",ie="_field_mq980_23",ne="_imgCodePopup_mq980_27",r={imgCode:Q,codeTitle:ee,img:se,imgChange:te,field:ie,imgCodePopup:ne},ue=m({name:"o-img-code",props:{value:Boolean,phone:[String,Number],type:{type:String,default:"LOGIN"}},emits:["close","sendCode"],data(){return{isSuffix:"/api-web",showStatus:!1,identifyingCode:window.location.origin+"/api-web/code/getLoginImage?phone="+this.phone,code:""}},mounted(){this.showStatus=this.value},watch:{value(e){this.showStatus=e},code(e){e.length>=4&&this.checkVerifyLoginImage()}},methods:{async updateIdentifyingCode(){const e=window.location.origin;this.identifyingCode=`${e}/api-web/code/getLoginImage?phone=${this.phone}&token=${Math.random()}`},async checkVerifyLoginImage(){try{if(this.code.length<4)return;await _.post(`${this.isSuffix}/code/verifyLoginImage`,{requestType:"form",hideLoading:!0,data:{phone:this.phone,code:this.code}}),await _.post(`${this.isSuffix}/code/sendSms`,{requestType:"form",hideLoading:!0,data:{mobile:this.phone}}),setTimeout(()=>{H("验证码已发送")},100),this.$emit("close"),this.$emit("sendCode")}catch{this.code="",this.updateIdentifyingCode()}}},render(){return i(V,{show:this.showStatus,class:r.imgCodePopup,closeOnClickOverlay:!1,onClose:()=>{this.$emit("close")},closeable:!0,closeIcon:"close"},{default:()=>[i("div",{class:r.imgCode},[i("p",{class:r.codeTitle},[$("输入图形验证码")]),i(I,null,{default:()=>[i(f,{span:"14"},{default:()=>[i(B,{placeholder:"请输入验证码",modelValue:this.code,"onUpdate:modelValue":e=>this.code=e,class:r.field},null)]}),i(f,{span:"10",class:r.img},{default:()=>[i(O,{src:this.identifyingCode,onClick:()=>this.updateIdentifyingCode()},{loading:()=>i(j,{type:"spinner",size:"20"},null)})]})]}),i(I,{style:{display:"flex",justifyContent:"end"}},{default:()=>[i(f,{span:"10"},{default:()=>[i("span",{class:r.imgChange,onClick:()=>this.updateIdentifyingCode()},[$("看不清?换一换")])]})]})])]})}});export{ce as C,ue as I};