import{u as S}from"./index.76924dfa.js";import{d as E,eA as U,eI as F,G as A,r as g,I as R,av as C,o as L,K as B,u as n,b as d,eu as c,f as W,c as q,eE as V,eF as x,e as p,v as K}from"./outputWidgets.260a3c99.js";import{b as M,r as P,c as N,d as T}from"./FormRunner.4d4c84a7.js";import{a as G}from"./asyncComputed.61df0e0c.js";import{u as w}from"./uuid.e153f05b.js";import{L as O}from"./CircularLoading.5c33d6d2.js";import{f as j}from"./api.8917e54c.js";import"./pubsub.ab27f2c0.js";import"./fetch.642bd10d.js";import"./url.13938513.js";import"./Passwordless.762d1b08.js";import"./index.1d812c5e.js";import"./PhArrowClockwise.vue.88725f38.js";import"./PlayerNavbar.2e825223.js";import"./PhKanban.vue.ac9ff90f.js";import"./PhSignOut.vue.7cf286a2.js";import"./Text.3b774738.js";import"./index.5bcf94e8.js";import"./Link.e028ce0e.js";import"./Paragraph.482f5128.js";import"./Title.9673e08a.js";import"./index.b2703a93.js";import"./WidgetsFrame.8e64f431.js";import"./Steps.5ab5a657.js";import"./PhInfo.vue.4bb508a5.js";import"./Card.a6a7eb10.js";import"./index.8ca3bef1.js";import"./TabPane.ccb73962.js";import"./hasIn.8ab3cbf4.js";import"./runnerData.90345b76.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},i=new Error().stack;i&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[i]="2894debb-a0d4-4cd8-8f81-c221df533dbe",r._sentryDebugIdIdentifier="sentry-dbid-2894debb-a0d4-4cd8-8f81-c221df533dbe")}catch{}})();const m=r=>(V("data-v-f61ea327"),r=r(),x(),r),z={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=E({__name:"Form",setup(r){const i=U(),f=F(),h=A({playerKey:w()}),u=g(null),_=g(null);R(i,()=>D());const{loading:b,result:t,error:k,refetch:D}=G(async()=>{h.playerKey=w();const o=i.path.slice(1),e=await j(o);if(!e)return null;const a=new N({formRunnerData:e,queryParams:i.query,userManager:S,logService:null,connectionManager:new T(e.id),onRedirect:v,onFormStart:()=>{},onFormEnd:()=>{},onAuthUpdate:l=>_.value=l,onStackTraceUpdate:null,onStateUpdate:l=>u.value=l}),s=a.getState();return _.value=s.passwordlessUser,u.value=s.formState,{runnerData:e,controller:a}});C(()=>{var o,e,a,s,l;!((o=t.value)!=null&&o.runnerData)||(e=t.value)!=null&&e.runnerData&&(document.title=(l=(a=t.value)==null?void 0:a.runnerData.welcomeTitle)!=null?l:(s=t.value)==null?void 0:s.runnerData.title)});function v(o,e){P("player",f,o,e)}const I=({path:o})=>{f.push({name:"form",query:i.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)?(d(),c("div",z,[W(O)])):n(k)||n(t)===null||u.value===null?(d(),c("div",H,X)):(a=n(t))!=null&&a.runnerData?(d(),c("div",Y,[(d(),q(M,{key:h.playerKey,"form-runner-data":n(t).runnerData,"form-state":u.value,"is-preview":!1,"user-email":(s=_.value)==null?void 0:s.claims.email,class:"player",onNavigate:I,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"]))])):(d(),c("div",Z,te))}}});const Be=K(oe,[["__scopeId","data-v-f61ea327"]]);export{Be as default};
//# sourceMappingURL=Form.a2a01fef.js.map
