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 r=(t,e,i)=>(v(t,typeof e!="symbol"?e+"":e,i),i);import{d as _,J as w,a8 as y,c as l,w as n,o as c,b as a,u as s,da as h,d6 as I,az as d,d5 as u,cI as b,eL as P,eM as x,a as f,Q as W,f as A,e4 as j}from"./index.e310aebb.js";import{_ as T}from"./AbstraLogo.vue_vue_type_script_setup_true_lang.280ece81.js";import{B as k}from"./BaseLayout.282c61a4.js";import{l as g}from"./fetch.ac0cc198.js";import"./gateway.4d0dc75b.js";import{a as R}from"./project.3b35cd7f.js";import"./columns.b1346706.js";import"./Logo.afdc4154.js";import"./popupNotifcation.fa3e65fc.js";import"./record.d2935dfa.js";import"./string.a01d17aa.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]="01be4076-078f-4798-95dd-33514b1c8a4d",t._sentryDebugIdIdentifier="sentry-dbid-01be4076-078f-4798-95dd-33514b1c8a4d")}catch{}})();const U=t=>(P("data-v-2536661a"),t=t(),x(),t),E=U(()=>f("div",{class:"video-container"},[f("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)),S=_({__name:"View",props:{controller:{}},setup(t){const e=t,i=e.controller.loadingPercentage();return w(()=>{e.controller.start()}),y(()=>{e.controller.cleanUp()}),(o,p)=>(c(),l(k,null,{content:n(()=>[a(s(h),{align:"center",justify:"center",style:{width:"100vw",height:"100dvh"}},{default:n(()=>[a(s(h),{gap:"large",align:"center",vertical:"",style:{width:"45%","min-width":"600px"}},{default:n(()=>[a(T,{size:"large"}),E,a(s(I),{level:3},{default:n(()=>[d("Preparing your environment")]),_:1}),s(i)<100?(c(),l(s(u),{key:0},{default:n(()=>[d("We are setting things up... This may take up to 1 minute.")]),_:1})):(c(),l(s(u),{key:1},{default:n(()=>[d("You will be redirected soon")]),_:1})),a(s(b),{size:[10,10],"show-info":!1,percent:s(i),"stroke-color":"#EA576A"},null,8,["percent"])]),_:1})]),_:1})]),_:1}))}});const V=W(S,[["__scopeId","data-v-2536661a"]]);class B{constructor(e,i,o=g){r(this,"projectId");r(this,"loading");r(this,"fetch",g);r(this,"interval",null);r(this,"urls",null);r(this,"totalWaitTime");r(this,"poolingInterval");r(this,"pingResponded",!1);r(this,"redirectPath");this.projectId=e,this.loading=A(0),this.fetch=o,this.totalWaitTime=6e4,this.poolingInterval=2500,this.redirectPath=i}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(){if(this.urls){const e=new URLSearchParams;this.redirectPath&&e.set("redirect",this.redirectPath),window.location.replace(this.urls.redirect+"?"+e.toString())}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 R.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 X=_({__name:"WebEditor",setup(t){const e=j(),i=e.params.projectId,o=e.query.redirect,p=new B(i,o);return(C,D)=>(c(),l(V,{controller:s(p)},null,8,["controller"]))}});export{X as default};
//# sourceMappingURL=WebEditor.92b0d866.js.map
