import{u as C}from"./userStore-BE74D4vD.js";import{F as D,a as E,b as R}from"./FormRunner-DuAGYfHv.js";import{a as S,W as F,r as y,O as U,ak as W,af as A,c as I,b5 as L,J as V,q as x,k as B,b as K,e as M,u as t,h as N,f as v,aO as q}from"./jwt-decode.esm-BUhVyVlz.js";import{r as O}from"./redirect-DjJGZwcA.js";import{a as G}from"./asyncComputed-yxL-_N40.js";import{u as h}from"./uuid-Co724qsj.js";import{L as J}from"./CircularLoading-BuRh_i1k.js";import{f as P,c as T}from"./workspaceStore-DvIMqk3J.js";import"./Login.vue_vue_type_script_setup_true_lang-B7pJiKDr.js";import"./OTPInput-DCZtPrel.js";import"./Logo-c0WOaDFC.js";import"./string-DGCBHlx5.js";import"./index-DUgET7yi.js";import"./Steps-CRI1I7fm.js";import"./index-CCmPkIyA.js";import"./Watermark-CpWVuhyv.js";import"./constants-sXT52FXr.js";import"./url--41vRoge.js";import"./runnerData-D-etV1KP.js";import"./colorHelpers-PI4QQo4l.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]="3573a72f-523e-44f4-bb78-c6fed67c6f34",n._sentryDebugIdIdentifier="sentry-dbid-3573a72f-523e-44f4-bb78-c6fed67c6f34")}catch{}})();const j={key:0,class:"loading"},z=S({__name:"Form",setup(n){const a=W(),i=A(),d=F({playerKey:h()}),w=C(),s=y(null),m=y(null);U(a,()=>{a.name==="form"&&g()});const{loading:u,result:e,error:f,refetch:g}=G(async()=>{d.playerKey=h();const o=a.path.slice(1),r=await P(o);if(m.value=await T(),!r){i.push({name:"error",params:{status:"404"}});return}const l=new D({formRunnerData:r,logService:null,connectionManager:new E(r.id,"player",a.query),onRedirect:p,onFormStart:()=>{},onFormEnd:()=>{},onStackTraceUpdate:null,onStateUpdate:k=>s.value=k}),b=l.getState();return s.value=b.formState,{runnerData:r,controller:l}}),_=I(()=>{const o=!u,r=!!f,l=!e||s.value===null;return o&&(r||l)});L(()=>{_.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),O("player",i,o,r)}V(async()=>{window.addEventListener("beforeunload",c)}),x(()=>{window.removeEventListener("beforeunload",c),e.value?.controller.stop()});const c=o=>{if(e.value?.controller.handleCloseAttempt())return o.preventDefault(),""};return(o,r)=>t(u)?(v(),B("div",j,[N(J)])):t(e)&&t(e).runnerData&&s.value&&!t(f)&&!t(u)?(v(),K(R,{key:d.playerKey,"form-runner-data":t(e).runnerData,"form-state":s.value,"is-preview":!1,"user-email":t(w).email,"worker-capacity":m.value,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","worker-capacity","onActionClicked","onUpdateWidgetErrors","onUpdateWidgetValue","onAuthComplete"])):M("",!0)}}),pe=q(z,[["__scopeId","data-v-22488e59"]]);export{pe as default};
//# sourceMappingURL=Form-BoOrCZTL.js.map
