import{j as r,k as B,l as w,_ as I,m as T}from"./index-ba596ae9.js";import{h as V,a1 as S,r as j,j as f,l as s,o as i,V as u,k as h,$ as F,T as g,U as k,W as $,a2 as y,p as l,m as L,X as N,Y as z,q as D,a3 as E}from"./vue-a39e6937.js";const x=o=>(N("data-v-006a2d18"),o=o(),z(),o),R=["id"],U={key:0,class:"loading"},X={key:1,class:"captcha-img-box"},Y=["src","alt"],q=["onClick"],M={key:2,class:"captcha-prompt"},P={key:3,class:"captcha-prompt"},W={class:"captcha-refresh-box"},A=x(()=>i("div",{class:"captcha-refresh-line captcha-refresh-line-l"},null,-1)),G=["title"],H=x(()=>i("div",{class:"captcha-refresh-line captcha-refresh-line-r"},null,-1)),J=V({__name:"index",props:{uuid:{default:""},callback:{type:Function,default:()=>{}},class:{default:""},unset:{type:Boolean,default:!1},error:{default:r.global.t("validate.The correct area is not clicked, please try again!")},success:{default:r.global.t("validate.Verification is successful!")}},setup(o){const e=o;S(t=>({"360a5c92":h(C),"334ac76a":h(b),"53e5fa0a":a.captcha.width,"5c773adc":a.captcha.height}));const a=j({loading:!0,xy:[],tip:"",captcha:{id:"",text:"",base64:"",width:350,height:200}}),n=()=>{a.loading=!0,B(e.uuid).then(t=>{a.xy=[],a.tip="",a.loading=!1,a.captcha=t.data})},m=t=>{if(a.xy.length{a.tip=e.success,setTimeout(()=>{var c;(c=e.callback)==null||c.call(e,p),_()},1500)}).catch(()=>{a.tip=e.error,setTimeout(()=>{n()},1500)})}},v=t=>{a.xy.splice(t,1)},_=()=>{var t;(t=document.getElementById(e.uuid))==null||t.remove()},b=f(()=>(a.captcha.height+200)/2+"px"),C=f(()=>(a.captcha.width+24)/2+"px");return n(),(t,p)=>(l(),s("div",{id:o.uuid},[i("div",{class:y(["ba-click-captcha",e.class])},[a.loading?(l(),s("div",U,u(h(r).global.t("utils.Loading")),1)):(l(),s("div",X,[i("img",{class:"captcha-img",onClick:p[0]||(p[0]=F(c=>m(c),["prevent"])),src:a.captcha.base64,alt:h(r).global.t("validate.Captcha loading failed, please click refresh button")},null,8,Y),(l(!0),s(g,null,k(a.xy,(c,d)=>(l(),s("span",{key:d,class:"step",onClick:O=>v(d),style:L(`left:${parseFloat(c.split(",")[0])-13}px;top:${parseFloat(c.split(",")[1])-13}px`)},u(d+1),13,q))),128))])),a.tip?(l(),s("div",M,u(a.tip),1)):(l(),s("div",P,[$(u(h(r).global.t("validate.Please click"))+" ",1),(l(!0),s(g,null,k(a.captcha.text,(c,d)=>(l(),s("span",{key:d,class:y(a.xy.length>d?"clicaptcha-clicked":"")},u(c),3))),128))])),i("div",W,[A,i("i",{class:"fa fa-refresh captcha-refresh-btn",title:h(r).global.t("refresh"),onClick:n},null,8,G),H])],2),i("div",{class:"ba-layout-shade",onClick:_})],8,R))}});const K=I(J,[["__scopeId","data-v-006a2d18"]]),aa=(o,e,a={})=>{let n=D(K,{uuid:o,callback:e,...a,key:T()});E(n,document.body),n=null};export{aa as c};