import{d as ue,o as pe,e as ve,r as C,f as N,w as le,g as D,a as G,h as ae,i as o,j as re,n as A,k as W,u as d,t as Y,T as fe,s as se,l as we,m as xe,p as ye,q as be,v as de,c as Xe,x as h,y as X,z as Te,A as Se,B as _e,C as ce,D as Ye,E as Ce,L as Be,H as Ie,F as Me,G as L,I as ke,J as Ae,K as Le,_ as ze}from"./index-wyO9_XA2.js";import{L as He}from"./index-DFSQhMs6.js";import{_ as We}from"./KoiDark.vue_vue_type_style_index_0_lang-DpmPr6_Y.js";const De="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAELklEQVRYR+2YW2wUZRTH//9vtlCoF9IoIklT3PqgPGi326hoetuaGEhIr9SgCYkkgt2WGOQVCca+GavWdr0GjD4YhG3RB3hply1LQA1tEQIxEXapGI2pEkys9LIzx2ylYWfY6e5sF0oi+7hzzvl+3/9855xvhrjNf7zN+XAHcL4Z+n8o6JWTeYt++W25S596AIZy6TB+n3yo+Nchlk8vmIIVowdXU9c3Q1gDSilBlQwjgBAYFGDvdF58/4milqvZwDpOcXWsb5Uh8hmBqkwXFMhlCN8aX5LXNbRy/T+Z+iXsHAFWRXs3QGQPyLucLDJrK5DgUXdTsxPfjAEro8E3Ce50EtxsKxPTwCPH3U2jTmJkBJgWTnAMxDeGMEoa0xQ+LJQnCD4HYFkCyAC3RdwN3U7gMkpxRTTYrMD91sCJIgCxV5R6O1Jcfy7VwonqLoj9/CqB2kF341qncGkBvRe+ureAWpRgoalCBecMFzcdK24YymZRJz5zprgq1tsJwXYL3CVZGvdGHmwZc7JQtra2gE+f712ep2QUYP714DJhaJrXLqXZQszlZwtYdSHoB9ljVk/ePVrSZFL0ZkAlxzQBVseCT8WhZhRThtFB8plk9Zi/qCi8cv0fNxvKFrDy4oF11NXXIFy2EII4iBcG3Y03VLZT8OqRd5aFPduvOEpxRayvXolxAKB2g6NgEhobBlc1HHYKY7WvHf5wtVAPgegIlbbZ9seUZ7AyFnwewi9pGoUyDmhrB931kfnC1ZwOeKlLP8GZJi6QLSFP2yep4toXSbT3ZQAfX3O6omt8Nhd9r/aHQAUMOQywYBZo5uZD2ThQ2rbPCjlnH6yI9rUryE5DU75ctJaake46Be4DuDjF8dFBNA94/AdtiySVxIlpMlTS8td801o70vMigM9huTda2lhcKHVHPO2HZv/P6LIwX7hk/+qzPSvUJGMkrg8AQYTkroRdXMlE+HH/twsG6BsOdJHYZlaO/lBZ6weOiiSXqs3Gqj0TeAxx+T75DIpgwjC0onD51pQD4JaluPrkR/cpFT9DcoVp84LOgTL/DjtBbglgou+puHwB8lEznPxJw1XSX77VtgizBvQNBw4RMqB7xt4Lc3c8lQKJaQHoO4R8ydz0/7MWoCXk8c85MrMC9J3qaafw/WtQlwXST+F3BnAeYB4obgJ1BJIuG+YtiKAjVOZ/Pd1ZdwzoG+4uBtSPpjaRbhXLcwF3hzytb2TilgVgT5BkYybBrTYC+Rvg5nRpdTRJrIs8+VPXPQXj2i4ItxC4O2NQQUQnN4U9rRcz9nH64p4ceM2lziX5Y4s3KHCdUHwE77ecMkMEp6BwhIa2Z6DslZRvfulgHafYLuCas58WLp2aLCFUga70qxOFU6dPFL2W1feYeaU43Y5z/TxnCuYabMEuC043ckdBp4pZ7f8FE5psOI1g6fwAAAAASUVORK5CYII=",Re=["width","height"],Ee=["width","height"],Fe=["width","height"],Ne=o("div",{class:"loading-gif_"},[o("span"),o("span"),o("span"),o("span"),o("span")],-1),Oe=[Ne],Pe={class:"auth-control_"},Ze={class:"range-text"},$e=o("div",null,null,-1),Qe=o("div",null,null,-1),Ue=o("div",null,null,-1),Ve=[$e,Qe,Ue],qe=ue({__name:"App",props:{type:{type:String,default:"modal"},canvasWidth:{type:Number,default:310},canvasHeight:{type:Number,default:160},show:{type:Boolean,default:!1},puzzleScale:{type:Number,default:1},sliderSize:{type:Number,default:50},range:{type:Number,default:10},zIndex:{type:Number,default:999},imgs:{type:Array,default:null},successText:{type:String,default:"验证通过!"},failText:{type:String,default:"验证失败,请重试"},sliderText:{type:String,default:"拖动滑块完成拼图"},className:{type:String,default:""}},emits:["success","fail","close","reset"],setup(c,{expose:R,emit:T}){const i=c;pe(()=>{document.addEventListener("mousemove",g,!1),document.addEventListener("mouseup",l,!1),document.addEventListener("touchmove",g,{passive:!1}),document.addEventListener("touchend",l,!1),t.isInside=i.type==="inside",i.show&&(!t.isInside&&document.body.classList.add("vue-puzzle-overflow"),M())}),ve(()=>{t.timer1&&clearTimeout(t.timer1),document.removeEventListener("mousemove",g,!1),document.removeEventListener("mouseup",l,!1),document.removeEventListener("touchmove",g,!1),document.removeEventListener("touchend",l,!1)});const S=C(),O=C(),P=C(),E=C(),t=N({isInside:!1,mouseDown:!1,startWidth:50,startX:0,newX:0,pinX:0,pinY:0,loading:!1,isCanSlide:!1,error:!1,infoBoxShow:!1,infoText:"",infoBoxFail:!1,timer1:void 0,closeDown:!1,isSuccess:!1,imgIndex:-1,isSubmting:!1});le(()=>i.show,s=>{s?(!t.isInside&&document.body.classList.add("vue-puzzle-overflow"),M()):(t.isSubmting=!1,t.isSuccess=!1,t.infoBoxShow=!1,document.body.classList.remove("vue-puzzle-overflow"))}),le(()=>i.type,s=>{s==="inside"?(t.isInside=!0,document.body.classList.remove("vue-puzzle-overflow")):t.isInside=!1});const B=D(()=>{const s=t.startWidth+t.newX-t.startX;return si.canvasWidth?i.canvasWidth:s}),r=D(()=>Math.round(Math.max(Math.min(i.puzzleScale,2),.2)*52.5+6)),u=D(()=>Math.max(Math.min(Math.round(i.sliderSize),Math.round(i.canvasWidth*.5)),10)),x=D(()=>i.zIndex!==999?`z-index:${i.zIndex}`:""),Z=()=>{!t.mouseDown&&!t.isSubmting&&(t.timer1&&clearTimeout(t.timer1),T("close"))},$=()=>{t.isInside||(t.closeDown=!0)},Q=()=>{t.closeDown&&Z(),t.closeDown=!1},U=s=>{var a;t.isCanSlide&&(t.mouseDown=!0,t.startWidth=((a=S.value)==null?void 0:a.clientWidth)||0,t.newX=s.clientX!==void 0?s.clientX:s.changedTouches[0].clientX,t.startX=s.clientX!==void 0?s.clientX:s.changedTouches[0].clientX)},g=s=>{t.mouseDown&&(s.preventDefault(),t.newX=s.clientX!==void 0?s.clientX:s.changedTouches[0].clientX)},l=()=>{t.mouseDown&&(t.mouseDown=!1,J())},I=(s=!1)=>{var a;if(t.loading&&!s)return;t.loading=!0,t.isCanSlide=!1;const p=O.value,m=P.value,f=E.value,e=p==null?void 0:p.getContext("2d",{willReadFrequently:!0}),y=m==null?void 0:m.getContext("2d"),q=f==null?void 0:f.getContext("2d");if(!e||!y||!q)return;const he=navigator.userAgent.indexOf("Firefox")>=0&&navigator.userAgent.indexOf("Windows")>=0,b=document.createElement("img");if(e.fillStyle="rgba(255,255,255,1)",q.fillStyle="rgba(255,255,255,1)",e.clearRect(0,0,i.canvasWidth,i.canvasHeight),y.clearRect(0,0,i.canvasWidth,i.canvasHeight),t.pinX=n(r.value+20,i.canvasWidth-r.value-10),t.pinY=n(20,i.canvasHeight-r.value-10),b.crossOrigin="anonymous",b.onload=()=>{const[w,K,ee,te]=_(b),ie=Math.random(),oe=Math.random(),ne=Math.random(),ge=Math.random(),F=ie<.33?-1:ie<.66?0:1,z=oe<.33?-1:oe<.66?0:1,H=ne<.33?-1:ne<.66?0:1;let k=ge<.6?1:0;F===z&&z===H&&H===k&&k===0&&(k=1),e.save(),v(e,F,z,H,k),e.closePath(),he?(e.clip(),e.save(),e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowColor="#000",e.shadowBlur=3,e.fill(),e.restore()):(e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowColor="#000",e.shadowBlur=3,e.fill(),e.clip()),e.drawImage(b,w,K,ee,te),q.fillRect(0,0,i.canvasWidth,i.canvasHeight),q.drawImage(b,w,K,ee,te),e.globalCompositeOperation="source-atop",v(e,F,z,H,k),e.arc(t.pinX+Math.ceil(r.value/2),t.pinY+Math.ceil(r.value/2),r.value*1.2,0,Math.PI*2,!0),e.closePath(),e.shadowColor="rgba(255, 255, 255, .8)",e.shadowOffsetX=-1,e.shadowOffsetY=-1,e.shadowBlur=Math.min(Math.ceil(8*i.puzzleScale),12),e.fillStyle="#ffffaa",e.fill();const me=e.getImageData(t.pinX-3,t.pinY-20,t.pinX+r.value+5,t.pinY+r.value+5);y.putImageData(me,0,t.pinY-20),e.restore(),e.clearRect(0,0,i.canvasWidth,i.canvasHeight),e.save(),v(e,F,z,H,k),e.globalAlpha=.8,e.fillStyle="#ffffff",e.fill(),e.restore(),e.save(),e.globalCompositeOperation="source-atop",v(e,F,z,H,k),e.arc(t.pinX+Math.ceil(r.value/2),t.pinY+Math.ceil(r.value/2),r.value*1.2,0,Math.PI*2,!0),e.shadowColor="#000",e.shadowOffsetX=2,e.shadowOffsetY=2,e.shadowBlur=16,e.fill(),e.restore(),e.save(),e.globalCompositeOperation="destination-over",e.drawImage(b,w,K,ee,te),e.restore(),t.loading=!1,t.isCanSlide=!0},b.onerror=()=>{I(!0)},!s&&(a=i.imgs)!=null&&a.length){let w=n(0,i.imgs.length-1);w===t.imgIndex&&(w===i.imgs.length-1?w=0:w++),t.imgIndex=w,b.src=i.imgs[w]}else b.src=V()},n=(s,a)=>Math.ceil(Math.random()*(a-s)+s),_=s=>{const a=s.width/s.height,p=i.canvasWidth/i.canvasHeight;let m=0,f=0,e=0,y=0;return a>p?(y=i.canvasHeight,e=a*y,f=0,m=(i.canvasWidth-e)/2):(e=i.canvasWidth,y=e/a,m=0,f=(i.canvasHeight-y)/2),[m,f,e,y]},v=(s,a,p,m,f)=>{const e=Math.ceil(15*i.puzzleScale);s.beginPath(),s.moveTo(t.pinX,t.pinY),s.lineTo(t.pinX+e,t.pinY),s.arcTo(t.pinX+e,t.pinY+a*e/2,t.pinX+e+e/2,t.pinY+a*e/2,e/2),s.arcTo(t.pinX+e+e,t.pinY+a*e/2,t.pinX+e+e,t.pinY,e/2),s.lineTo(t.pinX+e+e+e,t.pinY),s.lineTo(t.pinX+e+e+e,t.pinY+e),s.arcTo(t.pinX+e+e+e+p*e/2,t.pinY+e,t.pinX+e+e+e+p*e/2,t.pinY+e+e/2,e/2),s.arcTo(t.pinX+e+e+e+p*e/2,t.pinY+e+e,t.pinX+e+e+e,t.pinY+e+e,e/2),s.lineTo(t.pinX+e+e+e,t.pinY+e+e+e),s.lineTo(t.pinX+e+e,t.pinY+e+e+e),s.arcTo(t.pinX+e+e,t.pinY+e+e+e+m*e/2,t.pinX+e+e/2,t.pinY+e+e+e+m*e/2,e/2),s.arcTo(t.pinX+e,t.pinY+e+e+e+m*e/2,t.pinX+e,t.pinY+e+e+e,e/2),s.lineTo(t.pinX,t.pinY+e+e+e),s.lineTo(t.pinX,t.pinY+e+e),s.arcTo(t.pinX+f*e/2,t.pinY+e+e,t.pinX+f*e/2,t.pinY+e+e/2,e/2),s.arcTo(t.pinX+f*e/2,t.pinY+e,t.pinX,t.pinY+e,e/2),s.lineTo(t.pinX,t.pinY)},V=()=>{const s=document.createElement("canvas"),a=s.getContext("2d");if(!a)return"";s.width=i.canvasWidth,s.height=i.canvasHeight,a.fillStyle=`rgb(${n(100,255)},${n(100,255)},${n(100,255)})`,a.fillRect(0,0,i.canvasWidth,i.canvasHeight);for(let p=0;p<12;p++)if(a.fillStyle=`rgb(${n(100,255)},${n(100,255)},${n(100,255)})`,a.strokeStyle=`rgb(${n(100,255)},${n(100,255)},${n(100,255)})`,n(0,2)>1)a.save(),a.rotate(n(-90,90)*Math.PI/180),a.fillRect(n(-20,s.width-20),n(-20,s.height-20),n(10,s.width/2+10),n(10,s.height/2+10)),a.restore();else{a.beginPath();const m=n(-Math.PI,Math.PI);a.arc(n(0,s.width),n(0,s.height),n(10,s.height/2+10),m,m+Math.PI*1.5),a.closePath(),a.fill()}return s.toDataURL("image/png")},J=()=>{t.isSubmting=!0;const s=B.value-u.value-(r.value-u.value)*((B.value-u.value)/(i.canvasWidth-u.value)),a=t.pinX-3-s;Math.abs(a){t.isSubmting=!1,T("success",a,{deviation:a,offsetX:s,pinX:t.pinX-3})},800)):(t.infoText=i.failText,t.infoBoxFail=!0,t.infoBoxShow=!0,t.isCanSlide=!1,T("fail",a,{deviation:a,offsetX:s,pinX:t.pinX-3}),t.timer1&&clearTimeout(t.timer1),t.timer1=setTimeout(()=>{t.isSubmting=!1,M()},800))},j=()=>{t.infoBoxFail=!1,t.infoBoxShow=!1,t.isCanSlide=!1,t.isSuccess=!1,t.startWidth=u.value,t.startX=0,t.newX=0},M=s=>{t.isSubmting||(j(),I(),s&&T("reset"))};return R({reset:M}),(s,a)=>(G(),ae(fe,{to:"body",disabled:t.isInside},[o("div",{class:W(["vue-puzzle-vcode",{inside_:t.isInside,show_:c.show},c.className]),style:A(d(x)),onMousedown:$,onMouseup:Q,onTouchstartPassive:$,onTouchend:Q},[o("div",{class:"vue-auth-box_",onMousedown:a[3]||(a[3]=re(()=>{},["stop"])),onTouchstart:a[4]||(a[4]=re(()=>{},["stop"]))},[o("div",{class:"auth-body_",style:A(`width:${c.canvasWidth}px;height: ${c.canvasHeight}px`)},[o("canvas",{ref_key:"canvas1",ref:O,class:"auth-canvas1_",width:c.canvasWidth,height:c.canvasHeight},null,8,Re),o("canvas",{ref_key:"canvas3",ref:E,class:W(["auth-canvas3_",{show:t.isSuccess}]),width:c.canvasWidth,height:c.canvasHeight},null,10,Ee),o("canvas",{ref_key:"canvas2",ref:P,class:"auth-canvas2_",width:d(r),height:c.canvasHeight,style:A(`width:${d(r)}px;height:${c.canvasHeight}px;transform:translateX(${d(B)-d(u)-(d(r)-d(u))*((d(B)-d(u))/(c.canvasWidth-d(u)))}px)`)},null,12,Fe),o("div",{class:W(["loading-box_",{hide_:!t.loading}])},Oe,2),o("div",{class:W(["info-box_",{show:t.infoBoxShow},{fail:t.infoBoxFail}])},Y(t.infoText),3),o("div",{class:W(["flash_",{show:t.isSuccess}]),style:A(`transform: translateX(${t.isSuccess?`${c.canvasWidth+c.canvasHeight*.578}px`:`-${c.canvasHeight*.578}px`}) skew(-30deg, 0);`)},null,6),o("img",{class:"reset_",onClick:a[0]||(a[0]=p=>M(!0)),src:De})],4),o("div",Pe,[o("div",{class:"range-box",style:A(`height:${d(u)}px;width:${c.canvasWidth}px`)},[o("div",Ze,Y(c.sliderText),1),o("div",{class:"range-slider",ref_key:"rangeSlider",ref:S,style:A(`width:${d(B)}px`)},[o("div",{class:W(["range-btn",{isDown:t.mouseDown}]),style:A(`width:${d(u)}px`),onMousedown:a[1]||(a[1]=p=>U(p)),onTouchstart:a[2]||(a[2]=p=>U(p))},Ve,38)],4)],4)])],32)],38)],8,["disabled"]))}}),Ge={class:"h-full"},Je={class:"absolute top-10px right-10px flex flex-items-center"},je={class:"absolute text-center select-none"},Ke={class:"font-bold text-3xl chroma-text mb-6px text-center ke(i.language,se.loginTitle,se.loginEnTitle));const i=we(),S=xe(),O=ye(),P=be(),E=Ae(),t=de("images/logo/logo.png"),B=de("images/login/bg.png"),r=C(),u=C(!1),x=N({loginName:"",password:""});let Z=N({});Z=D(()=>i.language==="en"?N({loginName:[{required:!0,message:"The user name cannot be empty",trigger:"blur"}],password:[{required:!0,message:"The password cannot be empty",trigger:"blur"}],securityCode:[{required:!0,message:"The verification code cannot be empty",trigger:"blur"}]}):N({loginName:[{required:!0,message:"用户名不能为空",trigger:"blur"}],password:[{required:!0,message:"密码不能为空",trigger:"blur"}],securityCode:[{required:!0,message:"验证码不能为空",trigger:"blur"}]})),pe(()=>{});const $=()=>{R.value=!1,U()},Q=()=>{R.value=!0},U=()=>{r.value&&r.value.validate(async(g,l)=>{const I=x.loginName,n=x.password;if(g){u.value=!0;try{const _=await He({username:I,password:n});if(S.setToken(_.data.token),S.setUserInfo(_.data.user.username),S!=null&&S.token)await Ye();else{Ce("请重新登录🌻"),E.replace(Be);return}O.setTab([]),P.setKeepAliveName([]),E.replace(Ie)}catch{let v=1;setInterval(()=>{v--,v===0&&(u.value=!1)},1e3)}}else Me("校验失败,信息填写有误🌻")})};return(g,l)=>{const I=L("el-image"),n=L("el-col"),_=L("el-input"),v=L("el-form-item"),V=L("el-button"),J=L("el-form"),j=L("el-row"),M=Le("throttle");return G(),Xe("div",Ge,[h(j,{class:"h-100%"},{default:X(()=>[o("div",Je,[h(We)]),h(n,{lg:16,md:12,sm:15,xs:0,class:"flex items-center justify-center"},{default:X(()=>[l[2]||(l[2]=o("div",{class:"login-background w-85% h-100%"},null,-1)),o("div",je,[h(I,{class:"w-400px h-360px mb-50px animate-float [o("div",et,[h(I,{class:"rounded-full w-36px h-36px",src:d(t)},null,8,["src"]),o("div",tt,Y(T.value),1)]),o("div",st,[l[4]||(l[4]=o("span",{class:"h-1px w-16 bg-gray-300 inline-block"},null,-1)),o("span",at,Y(g.$t("login.account")),1),l[5]||(l[5]=o("span",{class:"h-1px w-16 bg-gray-300 inline-block"},null,-1))]),h(J,{ref_key:"loginFormRef",ref:r,model:x,rules:d(Z),class:"w-260px"},{default:X(()=>[h(v,{prop:"loginName"},{default:X(()=>[h(_,{type:"text",placeholder:g.$t("login.loginName"),"suffix-icon":d(Te),modelValue:x.loginName,"onUpdate:modelValue":l[0]||(l[0]=s=>x.loginName=s)},null,8,["placeholder","suffix-icon","modelValue"])]),_:1}),h(v,{prop:"password"},{default:X(()=>[h(_,{type:"password",placeholder:g.$t("login.password"),"show-password":"","suffix-icon":d(Se),modelValue:x.password,"onUpdate:modelValue":l[1]||(l[1]=s=>x.password=s)},null,8,["placeholder","suffix-icon","modelValue"])]),_:1}),h(v),h(v,null,{default:X(()=>[u.value?(G(),ae(V,{key:1,type:"primary",class:"w-245px bg-[--el-color-primary]",round:"",loading:u.value},{default:X(()=>[ce(Y(g.$t("login.center")),1)]),_:1},8,["loading"])):_e((G(),ae(V,{key:0,type:"primary",class:"w-245px bg-[--el-color-primary]",round:""},{default:X(()=>[ce(Y(g.$t("login.in")),1)]),_:1})),[[M,Q,"3000"]])]),_:1})]),_:1},8,["model","rules"]),l[6]||(l[6]=o("div",{class:"beianhao select-none lg:hidden"},[o("a",{class:"chroma-text",href:"https://beian.miit.gov.cn/",target:"_blank"})],-1))]),_:1})]),_:1}),h(d(qe),{show:R.value,onSuccess:$},null,8,["show"])])}}}),rt=ze(it,[["__scopeId","data-v-0ec0bda0"]]);export{rt as default};