import{r as R}from"./index.a245f875.js";import{u as b}from"./log.ab29b85c.js";import{F as q,R as x}from"./broker.1b95b3d3.js";import{d as S,v as B,R as g,K as f,z as o,b as s,c,e as K,t as w,J as E,H as L,O as N,Q as O,x as d,q as T}from"./registerWidgets.8e2e133d.js";import{D as F,n as C}from"./DashPlayer.81cb9013.js";import{a as V}from"./asyncComputed.a6090ca2.js";import{r as j,n as z}from"./runnerData.d93bd000.js";import{L as A}from"./CircularLoading.b144822c.js";import"./passwordlessManager.cb9f88a0.js";import"./icons.35c960d1.js";import"./ActionButton.vue_vue_type_script_setup_true_lang.20bd37d2.js";import"./Passwordless.399a4808.js";import"./executeJs.0d999a1c.js";import"./PlayerNavbar.cf04b8e0.js";import"./WidgetsFrame.c12866fb.js";import"./colors.351121a9.js";import"./Modal.2a0bcd16.js";import"./lottie.7a1c6d39.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[e]="cdb52ddf-ba0e-4aee-91b1-8b1d1174daf8",a._sentryDebugIdIdentifier="sentry-dbid-cdb52ddf-ba0e-4aee-91b1-8b1d1174daf8")}catch{}})();async function H(a){const e=await fetch(`/_api/${a}`);if(e.status==404)return null;if(!e.ok)throw new Error(await e.text());const{form:n,dash:l}=await e.json();return{form:n&&j(n),dash:l&&z(l)}}const p=a=>(N("data-v-7a49cef6"),a=a(),O(),a),J={key:0,class:"loading"},Q={key:1,class:"error"},$=p(()=>d("h1",null,"Oops! Something went wrong",-1)),G=p(()=>d("p",null,"An unknown error ocurred. Please try again or contact support.",-1)),M=[$,G],U={key:2,class:"form"},W={key:3,class:"dash-wrapper"},X={key:4,class:"error not-found"},Y=p(()=>d("h1",null,"Page not found",-1)),Z=p(()=>d("p",null,"The page you requested could not be found.",-1)),ee=[Y,Z],te=S({__name:"Player",setup(a){const e=E(),n=L(),l=B({playerKey:b()}),m=({path:t})=>{n.push({name:"player",query:e.query,params:{path:t.split("/")}})},_=async()=>{l.playerKey=b()};g([()=>e.path,()=>e.query],()=>_());const{loading:k,result:r,error:D}=V(()=>{var t;return H((t=e.path.slice(1))!=null?t:"")}),y=f(()=>i.value?x.create({isLocal:!1,isPreview:!1,formPath:i.value.path}):null),i=f(()=>{var t,u;return(u=(t=r.value)==null?void 0:t.form)!=null?u:null}),h=f(()=>{var u,v;if(!((u=r.value)!=null&&u.dash))return null;const t=C.create((v=r.value)==null?void 0:v.dash,!1);return t.onRedirect(({url:P,queryParams:I})=>R(n,P,I)),t});return g(r,()=>{var t;!r.value||(r.value.form?document.title=(t=r.value.form.welcomeTitle)!=null?t:r.value.form.title:r.value.dash&&(document.title=r.value.dash.title))}),(t,u)=>o(k)?(s(),c("div",J,[K(A)])):o(D)?(s(),c("div",Q,M)):o(i)&&o(y)?(s(),c("div",U,[(s(),w(q,{key:l.playerKey,class:"player",form:o(i),params:o(e).query,broker:o(y),"enable-auto-focus":!0,onNavigate:m,onLogout:_},null,8,["form","params","broker"]))])):o(h)?(s(),c("div",W,[(s(),w(F,{key:l.playerKey,class:"player","is-preview":!1,params:o(e).query,"dash-player-state":o(h),onNavigate:m},null,8,["params","dash-player-state"]))])):(s(),c("div",X,ee))}});const ge=T(te,[["__scopeId","data-v-7a49cef6"]]);export{ge as default};
//# sourceMappingURL=Player.92a58e0a.js.map
