import{u as U}from"./index.d9a79603.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 c,f as W,c as q,eB as V,eC as x,e as p,v as M}from"./outputWidgets.be3472c2.js";import{b as N,r as P,c as K,d as T}from"./FormRunner.d00939b9.js";import{a as J}from"./asyncComputed.a619212b.js";import{u as w}from"./uuid.69ca436c.js";import{L as H}from"./CircularLoading.09bcc174.js";import{f as O}from"./api.4007eec5.js";import"./fetch.dd071db9.js";import"./pubsub.1063a0da.js";import"./url.7fe1be7b.js";import"./Passwordless.ae177d2b.js";import"./index.1db198b0.js";import"./PlayerNavbar.f9ccf92b.js";import"./PhKanban.vue.61eb6c5c.js";import"./PhSignOut.vue.ca4a6d5d.js";import"./Text.c9febe27.js";import"./index.4d45a574.js";import"./Link.bbb85664.js";import"./Paragraph.7601abde.js";import"./Title.65752aa0.js";import"./index.ec79aad2.js";import"./WidgetsFrame.93ee4bfa.js";import"./Steps.601de140.js";import"./PhInfo.vue.f68f343c.js";import"./Card.1ee02828.js";import"./TabPane.3d3ce947.js";import"./hasIn.bddd0a1a.js";import"./runnerData.c8a20a02.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]="fbe3706b-f61d-4e8f-8f34-6e69596ce359",r._sentryDebugIdIdentifier="sentry-dbid-fbe3706b-f61d-4e8f-8f34-6e69596ce359")}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()}),d=g(null),_=g(null);R(l,()=>D());const{loading:b,result:t,error:k,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=>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)}),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(b)?(u(),c("div",j,[W(H)])):n(k)||n(t)===null||d.value===null?(u(),c("div",z,X)):(a=n(t))!=null&&a.runnerData?(u(),c("div",Y,[(u(),q(N,{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 Ae=M(oe,[["__scopeId","data-v-f61ea327"]]);export{Ae as default};
//# sourceMappingURL=Form.f5ea1add.js.map
