import{u as E}from"./index.ac9b4c61.js";import{d as I,eE as U,eK as C,I as F,r as g,K as R,ax as A,o as L,O as x,u as n,b as u,ew as c,f as B,c as W,eC as q,eD as K,e as p,x as V}from"./outputWidgets.7dd23d3d.js";import{b as M,r as P,c as N,d as T}from"./FormRunner.ed350a77.js";import{a as O}from"./asyncComputed.8f047c40.js";import{u as w}from"./uuid.51158eea.js";import{L as j}from"./CircularLoading.deaf8cef.js";import{f as z}from"./api.8ecad6bb.js";import"./fetch.55a475bd.js";import"./pubsub.692bcdfa.js";import"./url.6301f7e9.js";import"./Login.vue_vue_type_script_setup_true_lang.f149680f.js";import"./Link.ffd51525.js";import"./Base.4bf9624b.js";import"./index.dad58b70.js";import"./PlayerNavbar.a89c1e87.js";import"./PhKanban.vue.b32a2861.js";import"./PhSignOut.vue.0b43dbfe.js";import"./Text.8f0caa1d.js";import"./index.63d9c692.js";import"./Paragraph.7df229fc.js";import"./Title.0952eb37.js";import"./index.3a6370f6.js";import"./WidgetsFrame.22445284.js";import"./Steps.4ba899ad.js";import"./PhInfo.vue.97f477fe.js";import"./Card.fee12f7e.js";import"./TabPane.d692f77b.js";import"./hasIn.7d5dcda7.js";import"./runnerData.13e158ee.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]="20d01142-c0c9-4f2d-9d06-8bf1cc87c38a",r._sentryDebugIdIdentifier="sentry-dbid-20d01142-c0c9-4f2d-9d06-8bf1cc87c38a")}catch{}})();const m=r=>(q("data-v-f61ea327"),r=r(),K(),r),G={key:0,class:"loading"},H={key:1,class:"error"},J=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=[J,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=I({__name:"Form",setup(r){const l=U(),f=C(),h=F({playerKey:w()}),d=g(null),_=g(null);R(l,()=>D());const{loading:k,result:t,error:b,refetch:D}=O(async()=>{h.playerKey=w();const o=l.path.slice(1),e=await z(o);if(!e)return null;const a=new N({formRunnerData:e,queryParams:l.query,userManager:E,logService:null,connectionManager:new T(e.id),onRedirect:v,onFormStart:()=>{},onFormEnd:()=>{},onAuthUpdate:i=>_.value=i,onStackTraceUpdate:null,onStateUpdate:i=>d.value=i}),s=a.getState();return _.value=s.passwordlessUser,d.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)}),x(()=>{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(),c("div",G,[B(j)])):n(b)||n(t)===null||d.value===null?(u(),c("div",H,X)):(a=n(t))!=null&&a.runnerData?(u(),c("div",Y,[(u(),W(M,{key:h.playerKey,"form-runner-data":n(t).runnerData,"form-state":d.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(),c("div",Z,te))}}});const Le=V(oe,[["__scopeId","data-v-f61ea327"]]);export{Le as default};
//# sourceMappingURL=Form.c3b3064c.js.map
