import{u as D}from"./userStore.6b52d148.js";import{b as E,c as C,d as k}from"./FormRunner.1561ae47.js";import{d as R,ec as S,e4 as F,ad as U,r as A,w as I,c as L,aJ as W,k as V,j as x,u as o,a4 as B,f as K,a as M,h as N,o as y,_ as T}from"./jwt-decode.esm.4aed0432.js";import{r as j}from"./redirect.f8d75fde.js";import{a as q}from"./asyncComputed.728c1605.js";import{u as h}from"./uuid.65b5aa0e.js";import{L as G}from"./CircularLoading.f69910de.js";import{f as J}from"./workspaceStore.a95ba086.js";import"./Login.vue_vue_type_script_setup_true_lang.00ef6e7e.js";import"./Logo.0edaafdf.js";import"./string.8136e838.js";import"./index.b109d01f.js";import"./Steps.b110416b.js";import"./index.a2d9be71.js";import"./Watermark.70d083ce.js";import"./constants.6bea9d72.js";import"./url.b192466e.js";import"./runnerData.72dae76e.js";import"./colorHelpers.1c38eab0.js";(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new Error().stack;a&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[a]="16f361f0-86ef-4105-ba28-59bb85f6866b",i._sentryDebugIdIdentifier="sentry-dbid-16f361f0-86ef-4105-ba28-59bb85f6866b")}catch{}})();const P={key:0,class:"loading"},z=R({__name:"Form",setup(i){const a=S(),c=F(),f=U({playerKey:h()}),b=D(),l=A(null);I(a,()=>{a.name==="form"&&g()});const{loading:d,result:t,error:p,refetch:g}=q(async()=>{f.playerKey=h();const r=a.path.slice(1),e=await J(r);if(!e){c.push({name:"error",params:{status:"404"}});return}const n=new C({formRunnerData:e,logService:null,connectionManager:new k(e.id,"player",a.query),onRedirect:_,onFormStart:()=>{},onFormEnd:()=>{},onStackTraceUpdate:null,onStateUpdate:u=>l.value=u}),s=n.getState();return l.value=s.formState,{runnerData:e,controller:n}}),w=L(()=>{const r=!d,e=!!p,n=!t||l.value===null;return r&&(e||n)});W(()=>{var r,e,n,s,u;w.value&&c.push({name:"error",params:{status:"500"}}),!!((r=t.value)!=null&&r.runnerData)&&(e=t.value)!=null&&e.runnerData&&(document.title=(u=(n=t.value)==null?void 0:n.runnerData.welcomeTitle)!=null?u:(s=t.value)==null?void 0:s.runnerData.title)});function _(r,e){window.removeEventListener("beforeunload",m),j("player",c,r,e)}V(async()=>{window.addEventListener("beforeunload",m)}),x(()=>{window.removeEventListener("beforeunload",m)});const m=r=>{var e;if((e=t.value)!=null&&e.controller.handleCloseAttempt())return r.preventDefault(),""};return(r,e)=>{var n,s,u,v;return o(d)?(y(),B("div",P,[K(G)])):o(t)&&o(t).runnerData&&l.value&&!o(p)&&!o(d)?(y(),M(E,{key:f.playerKey,"form-runner-data":o(t).runnerData,"form-state":l.value,"is-preview":!1,"user-email":o(b).email,onRedirect:_,onActionClicked:(n=o(t))==null?void 0:n.controller.handleActionClick,onUpdateWidgetErrors:(s=o(t))==null?void 0:s.controller.updateWidgetFrontendErrors,onUpdateWidgetValue:(u=o(t))==null?void 0:u.controller.updateWidgetValue,onAuthComplete:(v=o(t))==null?void 0:v.controller.handleAuthComplete},null,8,["form-runner-data","form-state","user-email","onActionClicked","onUpdateWidgetErrors","onUpdateWidgetValue","onAuthComplete"])):N("",!0)}}});const me=T(z,[["__scopeId","data-v-9b9482e8"]]);export{me as default};
//# sourceMappingURL=Form.67628a01.js.map
