import{r as q}from"./index.6150da77.js";import{u as g}from"./uuid.e8567429.js";import{F as x,R as S}from"./broker.e9e43f98.js";import{d as B,v as K,a2 as m,K as f,z as a,b as s,c as u,e as E,t as k,J as N,H as O,O as T,Q as F,x as d,q as L}from"./registerWidgets.75ad232d.js";import{D as C,m as V}from"./DashPlayer.c53462c5.js";import{a as j}from"./asyncComputed.62fdaa3d.js";import{r as z,n as A}from"./runnerData.f94f315b.js";import{L as H}from"./CircularLoading.a5d89224.js";import"./passwordlessManager.e427d83f.js";import"./pubsub.98e48b80.js";import"./icons.79136e9f.js";import"./ActionButton.vue_vue_type_script_setup_true_lang.94563a79.js";import"./Passwordless.fbe1299e.js";import"./executeJs.36329e9a.js";import"./PlayerNavbar.f4ffe1a1.js";import"./WidgetsFrame.151ac7b7.js";import"./colors.55a42b18.js";import"./Modal.5f99340f.js";import"./lottie.24c4e251.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[e]="21ce9de3-0d0c-41c7-a71c-6e97f5b8bc40",r._sentryDebugIdIdentifier="sentry-dbid-21ce9de3-0d0c-41c7-a71c-6e97f5b8bc40")}catch{}})();async function J(r){const e=await fetch(`/_api/${r}`);if(e.status==404)return null;if(!e.ok)throw new Error(await e.text());const{form:n,dash:c}=await e.json();return{form:n&&z(n),dash:c&&A(c)}}const p=r=>(T("data-v-5d17475b"),r=r(),F(),r),Q={key:0,class:"loading"},$={key:1,class:"error"},G=p(()=>d("h1",null,"Oops! Something went wrong",-1)),M=p(()=>d("p",null,"An unknown error ocurred. Please try again or contact support.",-1)),U=[G,M],W={key:2,class:"form"},X={key:3,class:"dash-wrapper"},Y={key:4,class:"error not-found"},Z=p(()=>d("h1",null,"Page not found",-1)),ee=p(()=>d("p",null,"The page you requested could not be found.",-1)),te=[Z,ee],re=B({__name:"Player",setup(r){const e=N(),n=O(),c=K({playerKey:g()});m(e,()=>I());const _=({path:t})=>{n.push({name:"player",query:e.query,params:{path:t.split("/")}})},y=async()=>{c.playerKey=g()};m([()=>e.path,()=>e.query],()=>y());const{loading:w,result:o,error:D,refetch:I}=j(()=>{var t;return J((t=e.path.slice(1))!=null?t:"")}),h=f(()=>l.value?S.create({formPath:l.value.path}):null),l=f(()=>{var t,i;return(i=(t=o.value)==null?void 0:t.form)!=null?i:null}),v=f(()=>{var i,b;if(!((i=o.value)!=null&&i.dash))return null;const t=V((b=o.value)==null?void 0:b.dash);return t.onRedirect(({url:P,queryParams:R})=>q(n,P,R)),t});return m(o,()=>{var t;!o.value||(o.value.form?document.title=(t=o.value.form.welcomeTitle)!=null?t:o.value.form.title:o.value.dash&&(document.title=o.value.dash.title))}),(t,i)=>a(w)?(s(),u("div",Q,[E(H)])):a(D)?(s(),u("div",$,U)):a(l)&&a(h)?(s(),u("div",W,[(s(),k(x,{key:c.playerKey,class:"player",form:a(l),params:a(e).query,broker:a(h),"enable-auto-focus":!0,onNavigate:_,onLogout:y},null,8,["form","params","broker"]))])):a(v)?(s(),u("div",X,[(s(),k(C,{key:c.playerKey,class:"player","is-preview":!1,params:a(e).query,"dash-player-service":a(v),onNavigate:_},null,8,["params","dash-player-service"]))])):(s(),u("div",Y,te))}});const we=L(re,[["__scopeId","data-v-5d17475b"]]);export{we as default};
//# sourceMappingURL=Player.6032ad94.js.map
