import{u as U}from"./index.4ba7585c.js";import{d as E,eD as I,eJ as C,H as F,r as g,J as R,aw as A,o as L,N as B,u as n,b as u,ev as d,f as W,c as q,eB as V,eC as x,e as p,v as M}from"./outputWidgets.0112c29a.js";import{b as N,r as P,c as K,d as T}from"./FormRunner.c346ef49.js";import{a as J}from"./asyncComputed.7a4cd8c0.js";import{u as w}from"./uuid.6c3cb55c.js";import{L as H}from"./CircularLoading.0dc47467.js";import{f as O}from"./api.a6dd0453.js";import"./fetch.bbceeb79.js";import"./pubsub.bc9264fd.js";import"./url.3a6cd3b5.js";import"./Passwordless.93d636f4.js";import"./index.dea2e84d.js";import"./PlayerNavbar.006e724b.js";import"./PhKanban.vue.6d01f3b2.js";import"./PhSignOut.vue.66e233e9.js";import"./Text.7fd7d6e4.js";import"./index.8e0f51a1.js";import"./Link.28aa17bf.js";import"./Paragraph.a79b7e0d.js";import"./Title.06b9fc65.js";import"./index.47282251.js";import"./WidgetsFrame.fc702995.js";import"./Steps.94a99344.js";import"./PhInfo.vue.01cc6bc2.js";import"./Card.8672cc2c.js";import"./TabPane.1bdf173f.js";import"./hasIn.9ed92b42.js";import"./runnerData.82c76ca2.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},l=new Error().stack;l&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[l]="18958491-50fd-464c-b408-7e542c7cf03c",r._sentryDebugIdIdentifier="sentry-dbid-18958491-50fd-464c-b408-7e542c7cf03c")}catch{}})();const m=r=>(V("data-v-f61ea327"),r=r(),x(),r),j={key:0,class:"loading"},z={key:1,class:"error"},G=m(()=>p("h1",null,"Oops! Something went wrong",-1)),Q=m(()=>p("p",null,"An unknown error ocurred. Please try again or contact support.",-1)),X=[G,Q],Y={key:2,class:"form"},Z={key:3,class:"error not-found",style:{height:"100vh"}},$=m(()=>p("h1",null,"Page not found",-1)),ee=m(()=>p("p",null,"The page you requested could not be found.",-1)),te=[$,ee],oe=E({__name:"Form",setup(r){const l=I(),f=C(),h=F({playerKey:w()}),c=g(null),_=g(null);R(l,()=>D());const{loading:k,result:t,error:b,refetch:D}=J(async()=>{h.playerKey=w();const o=l.path.slice(1),e=await O(o);if(!e)return null;const a=new K({formRunnerData:e,queryParams:l.query,userManager:U,logService:null,connectionManager:new T(e.id),onRedirect:v,onFormStart:()=>{},onFormEnd:()=>{},onAuthUpdate:i=>_.value=i,onStackTraceUpdate:null,onStateUpdate:i=>c.value=i}),s=a.getState();return _.value=s.passwordlessUser,c.value=s.formState,{runnerData:e,controller:a}});A(()=>{var o,e,a,s,i;!((o=t.value)!=null&&o.runnerData)||(e=t.value)!=null&&e.runnerData&&(document.title=(i=(a=t.value)==null?void 0:a.runnerData.welcomeTitle)!=null?i:(s=t.value)==null?void 0:s.runnerData.title)});function v(o,e){P("player",f,o,e)}const S=({path:o})=>{f.push({name:"form",query:l.query,params:{path:o.split("/")}})};L(async()=>{var e;!((e=window.should_ask_before_leave)==null||e)||window.addEventListener("beforeunload",y)}),B(()=>{window.removeEventListener("beforeunload",y)});const y=o=>{var e;if((e=t.value)!=null&&e.controller.handleCloseAttempt())return o.preventDefault(),""};return(o,e)=>{var a,s;return n(k)?(u(),d("div",j,[W(H)])):n(b)||n(t)===null||c.value===null?(u(),d("div",z,X)):(a=n(t))!=null&&a.runnerData?(u(),d("div",Y,[(u(),q(N,{key:h.playerKey,"form-runner-data":n(t).runnerData,"form-state":c.value,"is-preview":!1,"user-email":(s=_.value)==null?void 0:s.claims.email,class:"player",onNavigate:S,onRedirect:v,onActionClicked:n(t).controller.handleActionClick,onUpdateWidgetErrors:n(t).controller.updateWidgetFrontendErrors,onUpdateWidgetValue:n(t).controller.updateWidgetValue,onLogout:n(t).controller.logout},null,8,["form-runner-data","form-state","user-email","onActionClicked","onUpdateWidgetErrors","onUpdateWidgetValue","onLogout"]))])):(u(),d("div",Z,te))}}});const Ae=M(oe,[["__scopeId","data-v-f61ea327"]]);export{Ae as default};
//# sourceMappingURL=Form.abfb0cdc.js.map
