import{u as S}from"./index.5682e922.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.1c4947c7.js";import{b as M,r as P,c as N,d as T}from"./FormRunner.3b3eb93b.js";import{a as G}from"./asyncComputed.ab9c45d0.js";import{u as w}from"./uuid.ea1ce190.js";import{L as O}from"./CircularLoading.a4b53b02.js";import{f as j}from"./api.1075db62.js";import"./pubsub.87f1efb9.js";import"./fetch.af8f049b.js";import"./url.ca3e5e32.js";import"./Passwordless.c91b7df4.js";import"./index.9a13ccca.js";import"./PhArrowClockwise.vue.da7fffb1.js";import"./PlayerNavbar.d1445729.js";import"./PhKanban.vue.387ce6fc.js";import"./Text.4ed32514.js";import"./index.4e91d000.js";import"./Link.1d840e4c.js";import"./Paragraph.110c4a21.js";import"./Title.6f4ab7f6.js";import"./index.1f8fecc0.js";import"./WidgetsFrame.9c7b2e10.js";import"./Steps.1dcbb8b1.js";import"./Card.10f7bd77.js";import"./index.68ab62e0.js";import"./TabPane.333d1c75.js";import"./hasIn.58acd238.js";import"./runnerData.79bc4400.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]="faed63bb-43e2-4034-9e77-3dd4d105e65f",r._sentryDebugIdIdentifier="sentry-dbid-faed63bb-43e2-4034-9e77-3dd4d105e65f")}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 l=U(),f=F(),h=A({playerKey:w()}),u=g(null),_=g(null);R(l,()=>D());const{loading:b,result:t,error:k,refetch:D}=G(async()=>{h.playerKey=w();const o=l.path.slice(1),e=await j(o);if(!e)return null;const a=new N({formRunnerData:e,queryParams:l.query,userManager:S,logService:null,connectionManager:new T(e.id),onRedirect:v,onFormStart:()=>{},onFormEnd:()=>{},onAuthUpdate:i=>_.value=i,onStackTraceUpdate:null,onStateUpdate:i=>u.value=i}),s=a.getState();return _.value=s.passwordlessUser,u.value=s.formState,{runnerData:e,controller:a}});C(()=>{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 I=({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)?(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 Ce=K(oe,[["__scopeId","data-v-f61ea327"]]);export{Ce as default};
//# sourceMappingURL=Form.0695a329.js.map
