import{u as b}from"./userStore-DCfchFeR.js";import{F as D,a as E,b as R}from"./FormRunner-BnimCXhi.js";import{e as S,Y as F,r as v,M as U,an as W,aj as A,b as I,be as L,W as V,x,f as M,n as B,j as K,p as t,v as N,g as y,aQ as j}from"./jwt-decode.esm-Dwzi-xky.js";import{r as q}from"./redirect-CyszwYVY.js";import{a as G}from"./asyncComputed-4b4Vbuu-.js";import{u as h}from"./uuid-Dt96rgmh.js";import{L as P}from"./CircularLoading-3CRSxW8a.js";import{f as Q,c as T}from"./workspaceStore-BPtCmoi9.js";import"./Login.vue_vue_type_script_setup_true_lang-CJhXSILv.js";import"./OTPInput-QPex13uJ.js";import"./Logo-B6vnfjpC.js";import"./string-D_xS1NtB.js";import"./index-7imsqG5n.js";import"./Steps-CjQxSKnr.js";import"./index-DRfWJvaC.js";import"./Watermark-CxyzRGuA.js";import"./constants-ooMBp8zc.js";import"./url-BS2CA8Zo.js";import"./runnerData-DgQOUFhY.js";import"./colorHelpers-C3Rgr1MS.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]="266165f0-4614-493c-9141-51eecad93fdd",n._sentryDebugIdIdentifier="sentry-dbid-266165f0-4614-493c-9141-51eecad93fdd")}catch{}})();const Y={key:0,class:"loading"},z=S({__name:"Form",setup(n){const a=W(),i=A(),d=F({playerKey:h()}),g=b(),s=v(null),m=v(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 Q(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:C=>s.value=C}),k=l.getState();return s.value=k.formState,{runnerData:r,controller:l}}),_=I(()=>{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)}),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)?(y(),M("div",Y,[N(P)])):t(e)&&t(e).runnerData&&s.value&&!t(p)&&!t(u)?(y(),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-DFk9TyY8.js.map
