var m=Object.defineProperty;var v=(t,e,i)=>e in t?m(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var s=(t,e,i)=>(v(t,typeof e!="symbol"?e+"":e,i),i);import{d as g,X as w,ah as y,o,c as l,w as r,b as a,u as n,dh as p,dd as I,aG as c,dc as u,cP as b,em as x,en as P,a as h,a0 as W,e as A,ea as j}from"./index.0f630b70.js";import{_ as T}from"./AbstraLogo.vue_vue_type_script_setup_true_lang.7d96bf27.js";import{B as k}from"./BaseLayout.a58db6a0.js";import{l as f}from"./fetch.04be8a9e.js";import"./gateway.50cd3949.js";import{P as E}from"./project.79269899.js";import"./tables.78c50568.js";import"./Logo.e9eed733.js";import"./popupNotifcation.dd76a56c.js";import"./record.f729e500.js";import"./string.532e13bb.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="bf94c66d-0318-4f86-a964-63526ab33f89",t._sentryDebugIdIdentifier="sentry-dbid-bf94c66d-0318-4f86-a964-63526ab33f89")}catch{}})();const R=t=>(x("data-v-7a979853"),t=t(),P(),t),U=R(()=>h("div",{class:"video-container"},[h("iframe",{class:"responsive-iframe",src:"https://www.youtube.com/embed/videoseries?list=PLFPJgKA6K86ZdAHZ3aPWsrZHX_7jJ3Cc9&autoplay=1&mute=1",frameborder:"0",allow:"autoplay; picture-in-picture;",referrerpolicy:"strict-origin-when-cross-origin",allowfullscreen:""})],-1)),V=g({__name:"View",props:{controller:{}},setup(t){const e=t,i=e.controller.loadingPercentage();return w(()=>{e.controller.start()}),y(()=>{e.controller.cleanUp()}),(d,_)=>(o(),l(k,null,{content:r(()=>[a(n(p),{align:"center",justify:"center",style:{width:"100vw",height:"100dvh"}},{default:r(()=>[a(n(p),{gap:"large",align:"center",vertical:"",style:{width:"45%","min-width":"600px"}},{default:r(()=>[a(T,{size:"large"}),U,a(n(I),{level:3},{default:r(()=>[c("Preparing your environment")]),_:1}),n(i)<100?(o(),l(n(u),{key:0},{default:r(()=>[c("We are setting things up... This may take up to 4 minutes.")]),_:1})):(o(),l(n(u),{key:1},{default:r(()=>[c("You will be redirected soon")]),_:1})),a(n(b),{size:[10,10],"show-info":!1,percent:n(i),"stroke-color":"#EA576A"},null,8,["percent"])]),_:1})]),_:1})]),_:1}))}});const B=W(V,[["__scopeId","data-v-7a979853"]]);class C{constructor(e,i=f){s(this,"projectId");s(this,"loading");s(this,"fetch",f);s(this,"interval",null);s(this,"urls",null);s(this,"totalWaitTime");s(this,"poolingInterval");s(this,"pingResponded",!1);this.projectId=e,this.loading=A(0),this.fetch=i,this.totalWaitTime=27e4,this.poolingInterval=2500}increment(){this.loading.value+=100/(this.totalWaitTime/this.poolingInterval)}speedUp(){this.totalWaitTime=5e3,this.poolingInterval=500,this.interval&&clearInterval(this.interval),this.interval=setInterval(async()=>{this.increment(),this.loading.value>=100&&this.navigate()},this.poolingInterval)}navigate(){this.urls&&window.location.replace(this.urls.redirect),this.cleanUp()}async ping(){if(!this.urls)return!1;if(this.pingResponded)return!0;const e=await this.fetch(this.urls.ping,{signal:AbortSignal.timeout(500)});return this.pingResponded=e.status===200,this.pingResponded}async start(){const e=await E.startWebEditor(this.projectId);this.urls=e,this.interval=setInterval(async()=>{this.increment(),this.pingResponded||await this.ping()&&this.speedUp(),this.loading.value>=100&&this.navigate()},this.poolingInterval)}cleanUp(){this.interval&&clearInterval(this.interval)}loadingPercentage(){return this.loading}}const G=g({__name:"WebEditor",setup(t){const i=j().params.projectId,d=new C(i);return(_,D)=>(o(),l(B,{controller:n(d)},null,8,["controller"]))}});export{G as default};
//# sourceMappingURL=WebEditor.ed980a9b.js.map
