import{b7 as $,a as D,u as V,r as d,n as r,t as z,O as A,aY as B,aT as O,N as l,bf as L,a$ as e,b0 as i,ba as t,a_ as b,bi as R,bq as U,bJ as G,bg as M,a0 as v,bK as q,a4 as H,bL as J,aX as K}from"./index-xnhGKCfe.js";const P={class:"welcome-tips"},T={class:"new-user"},X={class:"wel-info"},Y={class:"wel-title"},Z={class:"wel-desc"},j={class:"new-user"},Q={class:"wel-info"},W={class:"wel-title"},ee={class:"wel-desc"},se={class:"loading"},ae=$({__name:"index",props:{guestLogin:{type:Function}},emits:["close","Logined"],setup(I,{emit:x}){var c,w,p;const{isEnableGuestLogin:y}=D(),{t:o}=V(),h=d(((p=(w=(c=r)==null?void 0:c.readClipboardPayloadNoEncode)==null?void 0:w.call(c))==null?void 0:p.data)||""),S=new RegExp(`^${r.SCHEME}\\?shortLoginCode=([a-zA-Z0-9]*)$`,"i"),m=d(h.value.replace(S,"$1")),u=z(),g=x,a=d(!1),f=I,n=d(!1),k=async()=>{if(localStorage.setItem(v.FirstIn,"new"),y.value===!1){a.value=!1;return}n.value=!0;const s=await f.guestLogin();n.value=!1,s?g("Logined"):u.push({name:"Login"}),a.value=!1},E=async()=>{localStorage.setItem(v.FirstIn,"old"),n.value=!0;const s=await f.guestLogin();n.value=!1,a.value=!1,s?g("Logined"):u.push({name:"Login"})},F=async()=>{var s,_;try{const{code:C,data:N}=await q({shortLoginCode:m.value,deviceId:((s=r)==null?void 0:s.getDeviceId())||((_=H.readEventConfigFromUrl())==null?void 0:_.deviceId)||""});C===0?(J(N),localStorage.setItem(v.FirstIn,"new"),a.value=!1,g("Logined"),u.push({name:"home"})):a.value=!0}catch{a.value=!0}};return A(async()=>{var s;(s=r)!=null&&s.isAndroid()&&!localStorage.getItem("ar_refresh_token")&&!localStorage.getItem("ar_token")?h.value.includes("shortLoginCode=")&&m.value?await F():a.value=!0:a.value=!1}),(s,_)=>(O(),B(M,null,[l(R,{modelValue:a.value,title:t(o)("t796"),customClass:"withdraw-dialog","z-index":9999999,hideClose:"",maskNotClose:!0},{default:L(()=>[e("div",P,i(t(o)("t797")),1),e("div",{class:"dialog-content-btns mb40",onClick:k},[e("div",T,[l(b,{class:"img",name:"wel-user"})]),e("div",X,[e("div",Y,i(t(o)("t798")),1),e("div",Z,i(t(o)("t799")),1)])]),e("div",{class:"dialog-content-btns",onClick:E},[e("div",j,[l(b,{class:"img",name:"wel-old"})]),e("div",Q,[e("div",W,i(t(o)("t800")),1),e("div",ee,i(t(o)("t801")),1)])])]),_:1},8,["modelValue","title"]),l(t(G),{show:n.value,"z-index":"1000000000000000000"},{default:L(()=>[e("div",se,[l(t(U))])]),_:1},8,["show"])],64))}}),oe=K(ae,[["__scopeId","data-v-4e024480"]]);export{oe as default};
