import{u as C}from"./userStore-CViq8J7-.js";import{F as D,a as E,b as R}from"./FormRunner-BX1e2lO1.js";import{a as S,P as F,r as y,H as U,ac as A,ae as I,c as W,b3 as L,D as V,k as N,b as x,p as B,g as K,u as t,j as M,e as v,aN as P}from"./jwt-decode.esm-DyyavT6h.js";import{r as j}from"./redirect-DpBTr3iX.js";import{a as q}from"./asyncComputed-D5HqUDwR.js";import{u as b}from"./uuid-DHL8I4Aa.js";import{L as G}from"./CircularLoading-dfNnamlc.js";import{f as H,b as T}from"./workspaceStore-CxCWsO27.js";import"./Login.vue_vue_type_script_setup_true_lang-nM9tMueD.js";import"./OTPInput-CPuVANSf.js";import"./Logo-BLceuW0a.js";import"./string-C33uYcCb.js";import"./index-Bo37hDDz.js";import"./Steps-Ctz0ASy3.js";import"./index-BKkWnkAX.js";import"./Watermark-DUfCHBD4.js";import"./constants-BEk-t5le.js";import"./url-CaxRUwff.js";import"./colorHelpers-sG7zU7Nm.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]="75403b9a-06c6-4bd3-bf22-7bd1454346bc",n._sentryDebugIdIdentifier="sentry-dbid-75403b9a-06c6-4bd3-bf22-7bd1454346bc")}catch{}})();const z={key:0,class:"loading"},J=S({__name:"Form",setup(n){const a=A(),i=I(),d=F({playerKey:b()}),h=C(),s=y(null),m=y(null);U(a,()=>{a.name==="form"&&g()});const{loading:u,result:e,error:p,refetch:g}=q(async()=>{d.playerKey=b();const o=a.path.slice(1),r=await H(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}}),w=W(()=>{const o=!u,r=!!p,l=!e||s.value===null;return o&&(r||l)});L(()=>{w.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),j("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(G)])):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(h).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)}}),pe=P(J,[["__scopeId","data-v-22488e59"]]);export{pe as default};
//# sourceMappingURL=Form-5h8mHuGs.js.map
