import{d as b,G as w,b as d,eu as c,e as s,eD as p,eE as q,eF as D,t as k,eA as $,eB as S,F as C,r as L,u as t,c as M,f as m}from"./outputWidgets.562826ac.js";import{L as N}from"./CircularLoading.1d439fd2.js";import{F as A,R as O}from"./FormRunner.e2193976.js";import{B as V}from"./BackButton.92c61053.js";import{a as g}from"./asyncComputed.df2d9552.js";import{F as W}from"./forms.5ca19b70.js";import{W as j}from"./workspaces.5bce544b.js";import{r as G}from"./executeJs.db6ddd3b.js";import"./index.89e36de9.js";import"./pubsub.7185b91b.js";import"./WidgetsFrame.0453e297.js";import"./ActionButton.vue_vue_type_script_setup_true_lang.8d5d072f.js";import"./icons.63405824.js";import"./activeRecord.6bb1bd7f.js";import"./url.5a1383d2.js";import"./runnerData.52ec0396.js";import"./PlayerNavbar.bf65d008.js";import"./Steps.cad82ea8.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},r=new Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="f9db9239-df28-4196-8eaf-e131db25bdf0",e._sentryDebugIdIdentifier="sentry-dbid-f9db9239-df28-4196-8eaf-e131db25bdf0")}catch{}})();const x=e=>(q("data-v-d3846761"),e=e(),D(),e),H={class:"error"},T=x(()=>s("h1",{class:"error-header"},"Error",-1)),U={class:"error-body"},z={class:"error-message"},J={class:"error-details"},K=x(()=>s("span",null,"Reload",-1)),Q=[K],X=b({__name:"Error",props:{error:{type:Object,required:!0},repeated:{type:Boolean,required:!1}},emits:["reload"],setup(e,{emit:r}){const o=e,n=w(()=>o.repeated?"Ooops. The same error occured, please try again later.":"An error occurred while loading.");function l(){r("reload")}return(u,f)=>(d(),c("div",H,[T,s("div",U,[s("div",z,[s("p",null,p(n.value),1),s("p",J,p(e.error.name)+": "+p(e.error.message),1)]),s("div",{class:"error-actions"},[s("button",{class:"btn btn-primary",onClick:l},Q)])])]))}});const Y=k(X,[["__scopeId","data-v-d3846761"]]),Z={class:"page"},ee={key:1,class:"error"},re={key:2,style:{width:"100%",height:"100%",display:"flex"}},oe={style:{width:"100%",height:"100%",display:"flex"}},te=b({__name:"FormPreview",setup(e){const r=$(),o=S(),n=C({started:!1});function l(a,i){G("preview",r,a,i)}const u=L(null),{loading:f,result:_,error:h,refetch:y}=g(()=>W.get(o.params.formPath)),{result:v}=g(()=>j.get()),P=w(()=>O.create({formPath:o.params.formPath})),I=async()=>{var a;if(!n.started){(a=u.value)==null||a.run();return}n.started=!1},F=({path:a,type:i})=>{i==="dash"?r.push({name:"dashPreview",params:{dashPath:a},query:o.query}):(r.push({name:"formPreview",params:{formPath:a},query:o.query}),y())},R=()=>{r.push(`/_editor/form/${encodeURIComponent(o.params.formPath)}`)},B=()=>{n.started=!0},E=()=>{n.started=!1};return(a,i)=>(d(),c("div",Z,[t(f)||!t(_)||!t(v)?(d(),M(N,{key:0})):t(h)?(d(),c("div",ee,[m(Y,{error:t(h),onReload:t(y)},null,8,["error","onReload"])])):(d(),c("main",re,[s("div",oe,[m(A,{ref_key:"runner",ref:u,form:t(_).makeRunnerData(t(v)),params:t(o).query,"is-preview":!0,"enable-auto-focus":!0,broker:P.value,style:{height:"unset",flex:1,overflow:"hidden"},onNavigate:F,onLogout:I,onExit:E,onStart:B,onRedirect:l},null,8,["form","params","broker"]),m(V,{onExitFullscreenPreview:R})])]))]))}});const ke=k(te,[["__scopeId","data-v-fa4f1951"]]);export{ke as default};
//# sourceMappingURL=FormPreview.0526c98c.js.map
