import{u as E}from"./index.c3315fab.js";import{d as I,eE as U,eK as C,I as F,r as w,K as R,ax as A,o as x,O as B,u as a,b as i,ew as m,f as L,c as W,eC as K,eD as V,e as c,x as M}from"./outputWidgets.e32c4de9.js";import{b as P,r as q,c as T,d as N}from"./FormRunner.38495311.js";import{a as O}from"./asyncComputed.cd8e83d5.js";import{u as k}from"./uuid.ef4872e8.js";import{L as j}from"./CircularLoading.044e32d0.js";import{f as z}from"./api.804e2c24.js";import"./fetch.c8ae2d51.js";import"./pubsub.574e50fa.js";import"./url.b82290c2.js";import"./Login.vue_vue_type_script_setup_true_lang.8b7731e0.js";import"./Link.b760dec6.js";import"./Base.583225bc.js";import"./index.ad13a0c4.js";import"./PhArrowClockwise.vue.f778f63b.js";import"./WidgetsFrame.ae5146ea.js";import"./Steps.5c300975.js";import"./PhInfo.vue.74b8c977.js";import"./Card.729aeeb4.js";import"./TabPane.e82bc195.js";import"./hasIn.e17bd528.js";import"./runnerData.9bc53e5d.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},d=new Error().stack;d&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[d]="73a461e6-d0f8-48d2-8cf9-aca8fe41e329",r._sentryDebugIdIdentifier="sentry-dbid-73a461e6-d0f8-48d2-8cf9-aca8fe41e329")}catch{}})();const p=r=>(K("data-v-a6c34f73"),r=r(),V(),r),G={key:0,class:"loading"},H={key:1,class:"error"},J=p(()=>c("h1",null,"Oops! Something went wrong",-1)),Q=p(()=>c("p",null,"An unknown error ocurred. Please try again or contact support.",-1)),X=[J,Q],Y={key:3,class:"error not-found",style:{height:"100vh"}},Z=p(()=>c("h1",null,"Page not found",-1)),$=p(()=>c("p",null,"The page you requested could not be found.",-1)),ee=[Z,$],te=I({__name:"Form",setup(r){const d=U(),_=C(),h=F({playerKey:k()}),u=w(null),f=w(null);R(d,()=>S());const{loading:D,result:t,error:b,refetch:S}=O(async()=>{h.playerKey=k();const o=d.path.slice(1),e=await z(o);if(!e)return null;const s=new T({formRunnerData:e,queryParams:d.query,userManager:E,logService:null,connectionManager:new N(e.id,"player"),onRedirect:v,onFormStart:()=>{},onFormEnd:()=>{},onAuthUpdate:n=>f.value=n,onStackTraceUpdate:null,onStateUpdate:n=>u.value=n}),l=s.getState();return f.value=l.passwordlessUser,u.value=l.formState,{runnerData:e,controller:s}});A(()=>{var o,e,s,l,n;!((o=t.value)!=null&&o.runnerData)||(e=t.value)!=null&&e.runnerData&&(document.title=(n=(s=t.value)==null?void 0:s.runnerData.welcomeTitle)!=null?n:(l=t.value)==null?void 0:l.runnerData.title)});function v(o,e){q("player",_,o,e)}x(async()=>{var e;!((e=window.should_ask_before_leave)==null||e)||window.addEventListener("beforeunload",y)}),B(()=>{window.removeEventListener("beforeunload",y)});const y=o=>{var e;if((e=t.value)!=null&&e.controller.handleCloseAttempt())return o.preventDefault(),""};return(o,e)=>{var s,l,n,g;return a(D)?(i(),m("div",G,[L(j)])):a(b)||a(t)===null||u.value===null?(i(),m("div",H,X)):a(t)&&a(t).runnerData?(i(),W(P,{key:h.playerKey,"form-runner-data":a(t).runnerData,"form-state":u.value,"is-preview":!1,"user-email":(s=f.value)==null?void 0:s.claims.email,onRedirect:v,onActionClicked:(l=a(t))==null?void 0:l.controller.handleActionClick,onUpdateWidgetErrors:(n=a(t))==null?void 0:n.controller.updateWidgetFrontendErrors,onUpdateWidgetValue:(g=a(t))==null?void 0:g.controller.updateWidgetValue},null,8,["form-runner-data","form-state","user-email","onActionClicked","onUpdateWidgetErrors","onUpdateWidgetValue"])):(i(),m("div",Y,ee))}}});const Se=M(te,[["__scopeId","data-v-a6c34f73"]]);export{Se as default};
//# sourceMappingURL=Form.ca9140a7.js.map
