import{u as U}from"./index.4eebfe3f.js";import{d as E,H as C,b as u,eu as f,e as o,eD as g,eE as W,eF as q,v as F,eI as A,eA as M,r as v,u as t,c as P,f as R,eK as B}from"./outputWidgets.67d01534.js";import{b as V,c as $,d as L,r as N}from"./FormRunner.4d31e5ef.js";import{a as H}from"./asyncComputed.9c2e7c90.js";import{L as O}from"./CircularLoading.730f9e72.js";import{F as T}from"./forms.060f6bdd.js";import{W as j}from"./workspaces.e9b90016.js";import"./envVars.5aa8e6b1.js";import"./pubsub.ce0b10ac.js";import"./fetch.03065101.js";import"./url.df413b89.js";import"./Passwordless.aeea0a55.js";import"./index.12d5bc2c.js";import"./PhArrowClockwise.vue.44900a24.js";import"./PlayerNavbar.39918cc6.js";import"./PhKanban.vue.01a8c7a1.js";import"./PhSignOut.vue.09fa917c.js";import"./Text.fce07a64.js";import"./index.a9d2fb7a.js";import"./Link.1ec60047.js";import"./Paragraph.5d6efe5b.js";import"./Title.3431c309.js";import"./index.cf78c4e6.js";import"./WidgetsFrame.da1bb74c.js";import"./Steps.286b5e8b.js";import"./PhInfo.vue.d5a630c4.js";import"./Card.e0b50de4.js";import"./index.e94f56d7.js";import"./TabPane.3015bf00.js";import"./hasIn.18867aca.js";import"./record.97ce606c.js";import"./runnerData.0c424852.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]="363ec66b-22bd-421b-9de3-9973846a03ff",e._sentryDebugIdIdentifier="sentry-dbid-363ec66b-22bd-421b-9de3-9973846a03ff")}catch{}})();const I=e=>(W("data-v-3e46b76c"),e=e(),q(),e),K={class:"error"},z=I(()=>o("h1",{class:"error-header"},"Error",-1)),G={class:"error-body"},J={class:"error-message"},Q={class:"error-details"},X=I(()=>o("span",null,"Reload",-1)),Y=[X],Z=E({__name:"Error",props:{error:{type:Object,required:!0},repeated:{type:Boolean,required:!1}},emits:["reload"],setup(e,{emit:a}){const s=e,n=C(()=>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",K,[z,o("div",G,[o("div",J,[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=F(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=E({__name:"FormPreview",setup(e){const a=A(),s=M(),n=v(null),l=v(null),h=s.query,m=v(null);function S(r,i){N("preview",a,r,i)}const{result:_,loading:D,refetch:y,error:w}=H(async()=>{const[r,i]=await Promise.all([T.get(s.params.id),j.get()]),c=new $({formRunnerData:r.makeRunnerData(i),queryParams:h,userManager:U,connectionManager:new L(r.id),onFormStart:()=>{},onFormEnd:()=>{},onRedirect:S,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,B({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(O,{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 Ve=F(se,[["__scopeId","data-v-a7c36a64"]]);export{Ve as default};
//# sourceMappingURL=FormPreview.a3562c64.js.map
