import{u as k}from"./index.8b944c64.js";import{d as E,eG as R,eM as U,N as C,r as h,O as F,y as A,az as S,o as I,R as L,u as n,b as g,ey as W,f as B,c as M,eA as V,E as x}from"./outputWidgets.52571dac.js";import{b as N,r as K,c as G,d as T}from"./FormRunner.8c2d1d7b.js";import{a as q}from"./asyncComputed.2a2a1288.js";import{u as w}from"./uuid.70b11652.js";import{L as z}from"./CircularLoading.49007855.js";import{f as O}from"./api.66aa9b15.js";import"./fetch.9dae2a64.js";import"./pubsub.be7004e9.js";import"./url.5cc70021.js";import"./Login.vue_vue_type_script_setup_true_lang.973f1fac.js";import"./Link.a6766c40.js";import"./Base.e64db743.js";import"./index.1b528fc3.js";import"./Paragraph.7aa2ce32.js";import"./Text.0586c869.js";import"./Title.8fbc2e7d.js";import"./index.7797c9cd.js";import"./PhArrowClockwise.vue.b5de7a26.js";import"./WidgetsFrame.6587888f.js";import"./Steps.b69a5c48.js";import"./PhInfo.vue.4f6623ee.js";import"./Card.d78b977b.js";import"./TabPane.dea34545.js";import"./hasIn.f1c353ba.js";import"./PlusOutlined.cf52d035.js";import"./runnerData.3982af84.js";(function(){try{var u=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},i=new Error().stack;i&&(u._sentryDebugIds=u._sentryDebugIds||{},u._sentryDebugIds[i]="e62f3ec9-5072-43ed-9a38-d9d59fe0b44e",u._sentryDebugIdIdentifier="sentry-dbid-e62f3ec9-5072-43ed-9a38-d9d59fe0b44e")}catch{}})();const P={key:0,class:"loading"},j=E({__name:"Form",setup(u){const i=R(),d=U(),p=C({playerKey:w()}),l=h(null),c=h(null);F(i,()=>b());const{loading:m,result:r,error:f,refetch:b}=q(async()=>{p.playerKey=w();const t=i.path.slice(1),e=await O(t);if(!e){d.push({name:"error",params:{status:"404"}});return}const o=new G({formRunnerData:e,userManager:k,logService:null,connectionManager:new T(e.id,"player",i.query),onRedirect:v,onFormStart:()=>{},onFormEnd:()=>{},onAuthUpdate:a=>c.value=a,onStackTraceUpdate:null,onStateUpdate:a=>l.value=a}),s=o.getState();return c.value=s.passwordlessUser,l.value=s.formState,{runnerData:e,controller:o}}),D=A(()=>{const t=!m,e=!!f,o=!r||l.value===null;return t&&(e||o)});S(()=>{var t,e,o,s,a;D.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(),W("div",P,[B(z)])):n(r)&&n(r).runnerData&&l.value&&!n(f)&&!n(m)?(g(),M(N,{key:p.playerKey,"form-runner-data":n(r).runnerData,"form-state":l.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"])):V("",!0)}}});const we=x(j,[["__scopeId","data-v-1020d95f"]]);export{we as default};
//# sourceMappingURL=Form.10866c8e.js.map
