import{u as C}from"./userStore-2QX-Aqji.js";import{F as D,a as E,b as R}from"./FormRunner-BA7ynmHG.js";import{e as S,Z as F,r as y,R as U,an as A,ai as I,b as W,b5 as L,N as V,n as N,y as x,f as B,g as K,j as t,m as M,h as v,aO as j}from"./jwt-decode.esm-BJTSBhUK.js";import{r as q}from"./redirect-DUmh1t5n.js";import{a as G}from"./asyncComputed-BvQLJepS.js";import{u as h}from"./uuid-qERZoXwB.js";import{L as O}from"./CircularLoading-BSvgsM2c.js";import{f as P,c as T}from"./workspaceStore-B-8M4YJE.js";import"./Login.vue_vue_type_script_setup_true_lang-SlWhAgyY.js";import"./OTPInput-C0tjwO--.js";import"./Logo-3Y-n1Ku6.js";import"./string-C1f4nly_.js";import"./index-Du2sjeXv.js";import"./Steps-C0OQzrYd.js";import"./index-C7dxzsX-.js";import"./Watermark-B7avhfAc.js";import"./constants-CIm3pvgY.js";import"./url-D-YE6ZXS.js";import"./runnerData-Baasrs_-.js";import"./colorHelpers-CjEM1kZB.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]="d8fa9281-d340-4bad-93bc-01613916147a",n._sentryDebugIdIdentifier="sentry-dbid-d8fa9281-d340-4bad-93bc-01613916147a")}catch{}})();const Z={key:0,class:"loading"},z=S({__name:"Form",setup(n){const a=A(),i=I(),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}=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:f,onFormStart:()=>{},onFormEnd:()=>{},onStackTraceUpdate:null,onStateUpdate:k=>s.value=k}),b=l.getState();return s.value=b.formState,{runnerData:r,controller:l}}),_=W(()=>{const o=!u,r=!!p,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 f(o,r){window.removeEventListener("beforeunload",c),q("player",i,o,r)}V(async()=>{window.addEventListener("beforeunload",c)}),N(()=>{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",Z,[M(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"])):K("",!0)}}),fe=j(z,[["__scopeId","data-v-22488e59"]]);export{fe as default};
//# sourceMappingURL=Form-CTeMXL1G.js.map
