1import{n as D,d as H,e as W,b as L,s as G,_ as j,c as J}from"./kosRCU1r.js";import{K as M,o as i,b as u,e as a,F as Q,d as X,n as Y,t as w,_ as V,x as Z,M as ee,r as c,c as S,v as te,E as ae,h as x,g as oe,T as ne,C as I,L as se,z as le,V as A,R as ie,D as ue}from"./BafG0enI.js";import{u as re}from"./BbwJrXS9.js";import{t as ce}from"./b7c24pf3.js";import{s as de}from"./DhHT-QsW.js";import"./BporYn2C.js";const pe={class:"social-login","aria-label":"Ø±ÙØ´âÙØ§Û ÙØ±Ùد اجتÙ
اعÛ"},_e={class:"social-login__buttons"},ve=["disabled","aria-label","onClick"],me={class:"social-login__icon","aria-hidden":"true"},fe={key:0,class:"social-login__spinner"},be={key:1},he=M({__name:"SocialLoginButtons",props:{loadingProvider:{},disabled:{type:Boolean}},emits:["select"],setup(N){const C=[{value:"google",label:"Ú¯ÙÚ¯Ù",mark:"G"},{value:"twitch",label:"تÙÛÛÚ",mark:"T"},{value:"kick",label:"Ú©ÛÚ©",mark:"K"}];return(d,p)=>(i(),u("div",pe,[p[0]||(p[0]=a("div",{class:"social-login__divider","aria-hidden":"true"},[a("span"),a("small",null,"ÛØ§ ÙØ±Ùد Ø³Ø±ÛØ¹ با"),a("span")],-1)),a("div",_e,[(i(),u(Q,null,X(C,l=>a("button",{key:l.value,type:"button",class:Y(["social-login__button",`social-login__button--${l.value}`]),disabled:d.disabled||!!d.loadingProvider,"aria-label":`ÙØ±Ùد با ${l.label}`,onClick:s=>d.$emit("select",l.value)},[a("span",me,[d.loadingProvider===l.value?(i(),u("span",fe)):(i(),u("b",be,w(l.mark),1))]),a("span",null,"ÙØ±Ùد با "+w(l.label),1)],10,ve)),64))])]))}}),ge=V(he,[["__scopeId","data-v-eee40bbe"]]),ye={class:"auth-box",dir:"rtl"},ke={key:"cellphone"},xe={key:"otp"},we={class:"auth-box__description"},Ce={dir:"ltr"},$e={class:"auth-box__resend"},Se={key:0,class:"auth-box__checking"},Ie={key:2},Ae=M({__name:"auth",setup(N){Z({title:"ÙØ±Ùد"});const C=re(),d=ee(),p=c("cellphone"),l=c(""),s=c(!1),f=c(null),m=c(0),h=c(0),_=c(null),B=c(null);let g=null;const T=S({get:()=>l.value,set:t=>{l.value=D(t)}}),y=S(()=>D(l.value)),U=S(()=>/^09\d{9}$/.test(y.value));function P(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`}function $(t){ue().$toast.error((t==null?void 0:t.message)||"در Ø§ÙØ¬Ø§Ù
Ø¯Ø±Ø®ÙØ§Ø³Øª Ù
Ø´Ú©ÙÛ Ù¾ÛØ´ Ø¢Ù
د. Ø¯ÙØ¨Ø§Ø±Ù ØªÙØ§Ø´ Ú©ÙÛØ¯.",{theme:"colored",type:"error"})}async function z(){var e,n,o,v,r;if(!U.value||s.value)return;s.value=!0,h.value++,p.value==="otp"&&((e=_.value)==null||e.listenForWebOtp());let t=!1;try{const b=await H(y.value,P());t=!0,p.value="otp",O(Number(((n=b.data)==null?void 0:n.retry_after)||120))}catch(b){(o=_.value)==null||o.reset(),$(b)}finally{s.value=!1}t&&(await A(),await((v=_.value)==null?void 0:v.focus(0)),(r=_.value)==null||r.listenForWebOtp())}async function R(t){var n,o,v;if(t.length!==6||s.value)return;s.value=!0;let e=!1;try{const r=await W(y.value,t);C.addME(r.data.user);const b=L(d.query.redirect),K=(n=r.data.user)!=null&&n.is_kyc_complete?b||"/panel/dashboard":"/panel/kyc";await ie(K)}catch(r){h.value++,(o=_.value)==null||o.reset(),$(r),e=!0}finally{s.value=!1}e&&(await A(),await((v=_.value)==null?void 0:v.focus(0)))}function q(t,e){if(typeof e!="string")return null;const n={google:["accounts.google.com"],twitch:["id.twitch.tv"],kick:["id.kick.com"]};try{const o=new URL(e);return o.protocol!=="https:"||o.port||!n[t].includes(o.hostname)?null:o.toString()}catch{return null}}async function E(t){var e;if(!(s.value||f.value)){f.value=t;try{const n=await G(t,L(d.query.redirect)),o=q(t,(e=n.data)==null?void 0:e.authorization_url);if(!o)throw new Error("آدرس ÙØ±Ùد سرÙÛØ³ Ù
عتبر ÙÛØ³Øª. ÙØ·ÙØ§Ù Ø¯ÙØ¨Ø§Ø±Ù ØªÙØ§Ø´ Ú©ÙÛØ¯.");window.location.assign(o)}catch(n){f.value=null,$(n)}}}async function F(){var t;p.value="cellphone",h.value++,k(),await A(),(t=B.value)==null||t.focus()}function O(t){k(),m.value=t,g=de(()=>{m.value=Math.max(0,m.value-1),m.value===0&&k()},1e3)}function k(){g&&clearInterval(g),g=null}return te(()=>{k()}),(t,e)=>{const n=j,o=ge,v=J;return i(),u("section",ye,[e[9]||(e[9]=a("div",{class:"auth-box__mark"},[a("img",{src:ae,alt:"دÙÙÛØªÙ"})],-1)),x(ne,{name:"auth-step",mode:"out-in"},{default:oe(()=>[p.value==="cellphone"?(i(),u("div",ke,[e[2]||(e[2]=a("p",{class:"auth-box__description"},"Ø¨Ø±Ø§Û Ø§Ø³ØªÙØ§Ø¯Ù از Ù¾Ù٠٠خدÙ
ات دÙÙÛØªÙ ÙØ§Ø±Ø¯ Ø´ÙÛØ¯.",-1)),x(n,{ref_key:"mobileInput",ref:B,modelValue:T.value,"onUpdate:modelValue":e[0]||(e[0]=r=>T.value=r),valid:U.value,loading:s.value,disabled:!!f.value,autofocus:"",onSubmit:z},null,8,["modelValue","valid","loading","disabled"]),e[3]||(e[3]=a("p",{class:"auth-box__hint"},"کد تاÛÛØ¯ ب٠شÙ
ار٠Ù
ÙØ¨Ø§ÛÙ Ø´Ù
ا ارسا٠Ù
ÛâØ´ÙØ¯.",-1)),x(o,{"loading-provider":f.value,disabled:s.value,onSelect:E},null,8,["loading-provider","disabled"])])):(i(),u("div",xe,[a("button",{type:"button",class:"auth-box__back",onClick:F},e[4]||(e[4]=[a("span",{"aria-hidden":"true"},"â",-1),a("span",null,"تغÛÛØ± Ø´Ù
ارÙ",-1)])),e[8]||(e[8]=a("h1",{class:"auth-box__title"}
1,"کد تاÛÛØ¯ را ÙØ§Ø±Ø¯ Ú©ÙÛØ¯",-1)),a("p",we,[e[5]||(e[5]=I(" کد Ø´Ø´âØ±ÙÙ
Û Ø§Ø±Ø³Ø§ÙâØ´Ø¯Ù Ø¨Ù ")),a("b",Ce,w(y.value),1),e[6]||(e[6]=I(" را ÙØ§Ø±Ø¯ Ú©ÙÛØ¯. "))]),a("form",{class:"auth-box__form",onSubmit:e[1]||(e[1]=se(()=>{},["prevent"]))},[x(v,{ref_key:"otpInput",ref:_,"id-prefix":"auth-code",disabled:s.value,"reset-key":h.value,onComplete:R},null,8,["disabled","reset-key"])],32),a("div",$e,[s.value?(i(),u("span",Se,e[7]||(e[7]=[a("span",{class:"auth-box__spinner auth-box__spinner--small"},null,-1),I(" در ØØ§Ù Ø¨Ø±Ø±Ø³Û Ú©Ø¯ ")]))):m.value===0?(i(),u("button",{key:1,type:"button",onClick:z}," ارسا٠Ù
جدد کد ")):(i(),u("span",Ie,"ارسا٠Ù
جدد تا "+w(le(ce)(m.value))+" ثاÙÛÙ",1))])]))]),_:1})])}}}),Me=V(Ae,[["__scopeId","data-v-fd8ac075"]]);export{Me as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.