import{_ as b,o as A,a as I,c as P,b as s,d as S,t as g,n as L,i as z,r as p,e as k,p as C,f as N,s as D,g as M,h as V,u as B,j as E}from"./index-CIAVq8iD-1776148658686.js";const F={class:"loading-view"},H={class:"loading-content"},U={class:"loading-text"},O={class:"main-text"},j={class:"sub-text"},q={class:"progress-container"},G={class:"progress-bar"},J={class:"progress-text"},K={__name:"LoadingView",setup(Q){const r=B(),f=()=>{const e=r.currentRoute.value,t=e.path,o=e.name;console.log("Checking redirect conditions:",{path:t,name:o,url:window.location.href});const a=t==="/"||o==="root",n=t==="/loading"||o==="loading";return console.log("Redirect decision:",{isRootAccess:a,isLoadingAccess:n,shouldRedirect:a||n}),a||n},v=p("Initializing..."),m=p("Setting up your experience"),c=p(0),l=[{text:"Connecting to server...",subText:"Establishing secure connection",duration:200},{text:"Loading user data...",subText:"Retrieving your information",duration:300},{text:"Setting up interface...",subText:"Preparing your workspace",duration:200},{text:"Almost ready...",subText:"Finalizing setup",duration:200}];let u=0,i=null,d=null;const _=async()=>{try{if(!f()){console.log("User accessed specific path directly, not performing redirect");return}z()&&await x(),y(),await w(),await T()}catch(e){console.error("Loading failed:",e),r.replace("/not_app")}},x=async()=>new Promise((e,t)=>{k(async o=>{try{const a=C(o);if(a.success){const n=N(a.data);await D(n),M.setConnected(n),e()}else t(new Error(a.error))}catch(a){t(a)}})}),y=()=>{let e=0;const o=100/l.reduce((a,n)=>a+n.duration,0)*50;i=setInterval(()=>{e+=o,c.value=Math.min(e,100),c.value>=100&&clearInterval(i)},50),h()},h=()=>{if(u<l.length){const e=l[u];v.value=e.text,m.value=e.subText,d=setTimeout(()=>{u++,h()},e.duration)}},w=()=>new Promise(e=>{const t=l.reduce((o,a)=>o+a.duration,0);setTimeout(e,t)}),T=async()=>{try{const e=r.currentRoute.value,t=e.path,o=e.name;if(console.log("Current path:",t),console.log("Route name:",o),t==="/"||o==="root"||t==="/loading"||o==="loading")console.log("Navigating to default page from root or loading"),r.replace(V());else{console.log("User accessed specific path, not redirecting:",t);return}}catch(e){console.error("Failed to get default page:",e),r.replace("/apply")}},R=()=>{i&&(clearInterval(i),i=null),d&&(clearTimeout(d),d=null)};return A(()=>{_()}),I(()=>{R()}),(e,t)=>(E(),P("div",F,[t[1]||(t[1]=s("div",{class:"loading-background"},null,-1)),s("div",H,[t[0]||(t[0]=S('<div class="logo-container" data-v-2275977a><div class="logo" data-v-2275977a><div class="logo-icon" data-v-2275977a>📱</div><h1 class="logo-text" data-v-2275977a>Azizi</h1></div></div><div class="loading-animation" data-v-2275977a><div class="spinner" data-v-2275977a><div class="spinner-ring" data-v-2275977a></div><div class="spinner-ring" data-v-2275977a></div><div class="spinner-ring" data-v-2275977a></div></div></div>',2)),s("div",U,[s("p",O,g(v.value),1),s("p",j,g(m.value),1)]),s("div",q,[s("div",G,[s("div",{class:"progress-fill",style:L({width:c.value+"%"})},null,4)]),s("span",J,g(Math.round(c.value))+"%",1)])]),t[2]||(t[2]=s("div",{class:"loading-footer"},[s("p",null,"Powered by Azizi Team")],-1))]))}},X=b(K,[["__scopeId","data-v-2275977a"]]);export{X as default};
