import{u as C}from"./userStore-4FpRPoeM.js";import{F as D,a as E,b as R}from"./FormRunner-DxuG_5gW.js";import{a as S,W as F,r as y,O as U,ag as W,af as A,c as I,b0 as L,J as V,q as K,k as x,b as B,e as M,u as t,h as N,f as v,aK as q}from"./jwt-decode.esm-Dw_OlTCW.js";import{r as G}from"./redirect-BlXxmFll.js";import{a as J}from"./asyncComputed-3zrnCYug.js";import{u as h}from"./uuid-uY6ajUFo.js";import{L as O}from"./CircularLoading-KIKDgvZr.js";import{f as P,b as T}from"./workspaceStore-CeNiHwH_.js";import"./Login.vue_vue_type_script_setup_true_lang-BhhCxcTK.js";import"./OTPInput-BNXizKEV.js";import"./Logo-CecBL509.js";import"./string-BuQ9zSDy.js";import"./index-4hy9Zjs6.js";import"./Steps-BcOsmBCT.js";import"./index--PNRck0c.js";import"./Watermark-Bo0Yk0E7.js";import"./constants-DtajWhvQ.js";import"./url-vGC2YsRB.js";import"./runnerData-DZ54UJZ3.js";import"./colorHelpers-Chvd75S3.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]="1172b5e3-39ca-458b-97e8-473e5eedbf93",n._sentryDebugIdIdentifier="sentry-dbid-1172b5e3-39ca-458b-97e8-473e5eedbf93")}catch{}})();const j={key:0,class:"loading"},z=S({__name:"Form",setup(n){const a=W(),i=A(),d=F({playerKey:h()}),g=C(),s=y(null),m=y(null);U(a,()=>{a.name==="form"&&w()});const{loading:u,result:e,error:p,refetch:w}=J(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:f,onFormStart:()=>{},onFormEnd:()=>{},onStackTraceUpdate:null,onStateUpdate:k=>s.value=k}),_=l.getState();return s.value=_.formState,{runnerData:r,controller:l}}),b=I(()=>{const o=!u,r=!!p,l=!e||s.value===null;return o&&(r||l)});L(()=>{b.value&&i.push({name:"error",params:{status:"500"}}),e.value?.runnerData&&e.value?.runnerData&&(document.title=e.value?.runnerData.title)});function f(o,r){window.removeEventListener("beforeunload",c),G("player",i,o,r)}V(async()=>{window.addEventListener("beforeunload",c)}),K(()=>{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(),x("div",j,[N(O)])):t(e)&&t(e).runnerData&&s.value&&!t(p)&&!t(u)?(v(),B(R,{key:d.playerKey,"form-runner-data":t(e).runnerData,"form-state":s.value,"is-preview":!1,"user-email":t(g).email,"worker-capacity":m.value,onRedirect:f,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)}}),fe=q(z,[["__scopeId","data-v-22488e59"]]);export{fe as default};
//# sourceMappingURL=Form-IBZYXdAi.js.map
