import{u as C}from"./index.d9a79603.js";import{d as I,I as U,b as u,ev as f,e as o,eG as g,eB as W,eC as M,v as S,eJ as q,eD as B,r as v,u as t,c as P,f as R,eM as A}from"./outputWidgets.be3472c2.js";import{b as V,c as $,d as L,r as N}from"./FormRunner.d00939b9.js";import{a as O}from"./asyncComputed.a619212b.js";import{L as T}from"./CircularLoading.09bcc174.js";import{F as j}from"./forms.40790dd0.js";import{W as G}from"./workspaces.7dc978fb.js";import"./envVars.3bfc7529.js";import"./fetch.dd071db9.js";import"./pubsub.1063a0da.js";import"./url.7fe1be7b.js";import"./Passwordless.ae177d2b.js";import"./index.1db198b0.js";import"./PlayerNavbar.f9ccf92b.js";import"./PhKanban.vue.61eb6c5c.js";import"./PhSignOut.vue.ca4a6d5d.js";import"./Text.c9febe27.js";import"./index.4d45a574.js";import"./Link.bbb85664.js";import"./Paragraph.7601abde.js";import"./Title.65752aa0.js";import"./index.ec79aad2.js";import"./WidgetsFrame.93ee4bfa.js";import"./Steps.601de140.js";import"./PhInfo.vue.f68f343c.js";import"./Card.1ee02828.js";import"./TabPane.3d3ce947.js";import"./hasIn.bddd0a1a.js";import"./record.820df198.js";import"./runnerData.c8a20a02.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="42eb7bd3-7529-4e2c-9aa6-31b121f32f1d",e._sentryDebugIdIdentifier="sentry-dbid-42eb7bd3-7529-4e2c-9aa6-31b121f32f1d")}catch{}})();const E=e=>(W("data-v-3e46b76c"),e=e(),M(),e),H={class:"error"},J=E(()=>o("h1",{class:"error-header"},"Error",-1)),z={class:"error-body"},K={class:"error-message"},Q={class:"error-details"},X=E(()=>o("span",null,"Reload",-1)),Y=[X],Z=I({__name:"Error",props:{error:{type:Object,required:!0},repeated:{type:Boolean,required:!1}},emits:["reload"],setup(e,{emit:a}){const s=e,n=U(()=>s.repeated?"Ooops. The same error occured, please try again later.":"An error occurred while loading.");function l(){a("reload")}return(h,m)=>(u(),f("div",H,[J,o("div",z,[o("div",K,[o("p",null,g(n.value),1),o("p",Q,g(e.error.name)+": "+g(e.error.message),1)]),o("div",{class:"error-actions"},[o("button",{class:"btn btn-primary",onClick:l},Y)])])]))}});const ee=S(Z,[["__scopeId","data-v-3e46b76c"]]),re={class:"page"},oe={key:1,class:"error"},te={key:2,style:{width:"100%",height:"100%",display:"flex"}},ae={style:{width:"100%",height:"100%",display:"flex"}},se=I({__name:"FormPreview",setup(e){const a=q(),s=B(),n=v(null),l=v(null),h=s.query,m=v(null);function F(r,i){N("preview",a,r,i)}const{result:_,loading:D,refetch:y,error:w}=O(async()=>{const[r,i]=await Promise.all([j.get(s.params.id),G.get()]),c=new $({formRunnerData:r.makeRunnerData(i),queryParams:h,userManager:C,connectionManager:new L(r.id),onFormStart:()=>{},onFormEnd:()=>{},onRedirect:F,onAuthUpdate:d=>m.value=d,onStateUpdate:d=>n.value=d,logService:null,onStackTraceUpdate:null});l.value=r.makeRunnerData(i);const p=c.getState();return n.value=p.formState,m.value=p.passwordlessUser,A({form:r,workspace:i,controller:c})}),x=async({id:r})=>{await a.push({params:{id:r},name:"formPreview",query:s.query}),y()};return(r,i)=>{var c,p,d,b,k;return u(),f("div",re,[t(D)||!n.value||!l.value?(u(),P(T,{key:0})):t(w)?(u(),f("div",oe,[R(ee,{error:t(w),onReload:t(y)},null,8,["error","onReload"])])):(u(),f("main",te,[o("div",ae,[R(V,{style:{height:"unset",flex:1,overflow:"hidden"},"is-preview":!1,"form-runner-data":l.value,"form-state":n.value,"user-email":(c=m.value)==null?void 0:c.claims.email,onUpdateWidgetErrors:(p=t(_))==null?void 0:p.controller.updateWidgetFrontendErrors,onUpdateWidgetValue:(d=t(_))==null?void 0:d.controller.updateWidgetValue,onActionClicked:(b=t(_))==null?void 0:b.controller.handleActionClick,onNavigate:x,onLogout:(k=t(_))==null?void 0:k.controller.logout},null,8,["form-runner-data","form-state","user-email","onUpdateWidgetErrors","onUpdateWidgetValue","onActionClicked","onLogout"])])]))])}}});const Pe=S(se,[["__scopeId","data-v-a7c36a64"]]);export{Pe as default};
//# sourceMappingURL=FormPreview.e464119f.js.map
