import{u as E}from"./index.98d02c55.js";import{d as b,f1 as R,f7 as U,N as C,r as h,O as F,y as S,ar as A,o as I,R as L,u as n,b as g,eV as V,f as W,c as B,eX as x,E as M}from"./outputWidgets.a6a6ef30.js";import{b as N,r as K,c as T,d as q}from"./FormRunner.dd1f3c95.js";import{a as G}from"./asyncComputed.d67c847a.js";import{u as w}from"./uuid.5e5824ab.js";import{L as O}from"./CircularLoading.39b4839a.js";import{f as P}from"./api.734f41cc.js";import"./fetch.2cdde52d.js";import"./pubsub.906f7e66.js";import"./url.00089ca9.js";import"./Login.vue_vue_type_script_setup_true_lang.d8380f3d.js";import"./index.4934d790.js";import"./PhArrowClockwise.vue.50cc3f5c.js";import"./WidgetsFrame.68dc535a.js";import"./Steps.049db4ae.js";import"./Card.6a760f62.js";import"./TabPane.c81c1fb6.js";import"./hasIn.b01cfd56.js";import"./runnerData.09340835.js";(function(){try{var l=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},u=new Error().stack;u&&(l._sentryDebugIds=l._sentryDebugIds||{},l._sentryDebugIds[u]="d9a97805-c902-4595-857f-e305790fd699",l._sentryDebugIdIdentifier="sentry-dbid-d9a97805-c902-4595-857f-e305790fd699")}catch{}})();const X={key:0,class:"loading"},j=b({__name:"Form",setup(l){const u=R(),d=U(),f=C({playerKey:w()}),i=h(null),c=h(null);F(u,()=>{u.name==="form"&&D()});const{loading:m,result:r,error:p,refetch:D}=G(async()=>{f.playerKey=w();const t=u.path.slice(1),e=await P(t);if(!e){d.push({name:"error",params:{status:"404"}});return}const o=new T({formRunnerData:e,userManager:E,logService:null,connectionManager:new q(e.id,"player",u.query),onRedirect:v,onFormStart:()=>{},onFormEnd:()=>{},onAuthUpdate:a=>c.value=a,onStackTraceUpdate:null,onStateUpdate:a=>i.value=a}),s=o.getState();return c.value=s.passwordlessUser,i.value=s.formState,{runnerData:e,controller:o}}),k=S(()=>{const t=!m,e=!!p,o=!r||i.value===null;return t&&(e||o)});A(()=>{var t,e,o,s,a;k.value&&d.push({name:"error",params:{status:"500"}}),!!((t=r.value)!=null&&t.runnerData)&&(e=r.value)!=null&&e.runnerData&&(document.title=(a=(o=r.value)==null?void 0:o.runnerData.welcomeTitle)!=null?a:(s=r.value)==null?void 0:s.runnerData.title)});function v(t,e){K("player",d,t,e)}I(async()=>{var e;!((e=window.should_ask_before_leave)==null||e)||window.addEventListener("beforeunload",_)}),L(()=>{window.removeEventListener("beforeunload",_)});const _=t=>{var e;if((e=r.value)!=null&&e.controller.handleCloseAttempt())return t.preventDefault(),""};return(t,e)=>{var o,s,a,y;return n(m)?(g(),V("div",X,[W(O)])):n(r)&&n(r).runnerData&&i.value&&!n(p)&&!n(m)?(g(),B(N,{key:f.playerKey,"form-runner-data":n(r).runnerData,"form-state":i.value,"is-preview":!1,"user-email":(o=c.value)==null?void 0:o.claims.email,onRedirect:v,onActionClicked:(s=n(r))==null?void 0:s.controller.handleActionClick,onUpdateWidgetErrors:(a=n(r))==null?void 0:a.controller.updateWidgetFrontendErrors,onUpdateWidgetValue:(y=n(r))==null?void 0:y.controller.updateWidgetValue},null,8,["form-runner-data","form-state","user-email","onActionClicked","onUpdateWidgetErrors","onUpdateWidgetValue"])):x("",!0)}}});const me=M(j,[["__scopeId","data-v-445f692c"]]);export{me as default};
//# sourceMappingURL=Form.3a86ebf7.js.map
