import{u as w}from"./userStore-Bi6uE2pG.js";import{F as D,a as E,b as C}from"./FormRunner-0JPk8JYZ.js";import{a as k,P as R,r as S,H as F,ac as U,ad as A,c as I,b3 as L,D as W,k as V,b as N,p as x,g as B,u as t,j as K,e as f,aN as M}from"./jwt-decode.esm-C-pSId1x.js";import{r as P}from"./redirect-CiJ1U3Fd.js";import{a as j}from"./asyncComputed-BFeGpB4N.js";import{u as h}from"./uuid-EU9SeyOl.js";import{L as q}from"./CircularLoading-BoO6j31h.js";import{f as G}from"./workspaceStore-eHr1yftw.js";import"./Login.vue_vue_type_script_setup_true_lang-Bno5TaUL.js";import"./Logo-Dv3vQpmq.js";import"./string-3_vhV9g4.js";import"./index-8Hc8RFdj.js";import"./Steps-BX1QCCG1.js";import"./index-S1VxHDRd.js";import"./Watermark-CGQ6d0wj.js";import"./constants-C4XOKD8R.js";import"./url-E85CsM4U.js";import"./colorHelpers-C04Sii74.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new Error().stack;a&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[a]="2ad1692c-2664-477a-97d7-2e60c34e1bca",n._sentryDebugIdIdentifier="sentry-dbid-2ad1692c-2664-477a-97d7-2e60c34e1bca")}catch{}})();const H={key:0,class:"loading"},T=k({__name:"Form",setup(n){const a=U(),i=A(),d=R({playerKey:h()}),v=w(),s=S(null);F(a,()=>{a.name==="form"&&y()});const{loading:l,result:e,error:m,refetch:y}=j(async()=>{d.playerKey=h();const o=a.path.slice(1),r=await G(o);if(!r){i.push({name:"error",params:{status:"404"}});return}const u=new D({formRunnerData:r,logService:null,connectionManager:new E(r.id,"player",a.query),onRedirect:p,onFormStart:()=>{},onFormEnd:()=>{},onStackTraceUpdate:null,onStateUpdate:b=>s.value=b}),_=u.getState();return s.value=_.formState,{runnerData:r,controller:u}}),g=I(()=>{const o=!l,r=!!m,u=!e||s.value===null;return o&&(r||u)});L(()=>{g.value&&i.push({name:"error",params:{status:"500"}}),e.value?.runnerData&&e.value?.runnerData&&(document.title=e.value?.runnerData.title)});function p(o,r){window.removeEventListener("beforeunload",c),P("player",i,o,r)}W(async()=>{window.addEventListener("beforeunload",c)}),V(()=>{window.removeEventListener("beforeunload",c)});const c=o=>{if(e.value?.controller.handleCloseAttempt())return o.preventDefault(),""};return(o,r)=>t(l)?(f(),N("div",H,[K(q)])):t(e)&&t(e).runnerData&&s.value&&!t(m)&&!t(l)?(f(),x(C,{key:d.playerKey,"form-runner-data":t(e).runnerData,"form-state":s.value,"is-preview":!1,"user-email":t(v).email,onRedirect:p,onActionClicked:t(e)?.controller.handleActionClick,onUpdateWidgetErrors:t(e)?.controller.updateWidgetFrontendErrors,onUpdateWidgetValue:t(e)?.controller.updateWidgetValue,onAuthComplete:t(e)?.controller.handleAuthComplete},null,8,["form-runner-data","form-state","user-email","onActionClicked","onUpdateWidgetErrors","onUpdateWidgetValue","onAuthComplete"])):B("",!0)}}),ce=M(T,[["__scopeId","data-v-1b2b3f4f"]]);export{ce as default};
//# sourceMappingURL=Form-BCMYhCZ2.js.map
