import{d as w,J as b,b as d,et as c,e as s,eC as p,eD as q,eE as D,x as k,ez as $,eA as C,H as S,r as L,u as t,c as M,f as m}from"./outputWidgets.c072fe4e.js";import{L as N}from"./CircularLoading.1db5d4d0.js";import{F as A,R as H}from"./broker.edfeca40.js";import{B as O}from"./BackButton.6e721ade.js";import{a as g}from"./asyncComputed.376cdc00.js";import{F as V}from"./forms.db17259c.js";import{W}from"./workspaces.921d369d.js";import{r as j}from"./index.00103e26.js";import"./index.ad809a50.js";import"./pubsub.98ad9fe0.js";import"./executeJs.9d1a076f.js";import"./icons.158b4825.js";import"./PlayerNavbar.26f9089b.js";import"./Steps.1df0e634.js";import"./Modal.dfafcf8c.js";import"./WidgetsFrame.6a9a3802.js";import"./ActionButton.vue_vue_type_script_setup_true_lang.abbded52.js";import"./activeRecord.fdc25b97.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]="3e6c8e79-a764-4897-89ff-d9ffda078f9d",e._sentryDebugIdIdentifier="sentry-dbid-3e6c8e79-a764-4897-89ff-d9ffda078f9d")}catch{}})();const x=e=>(q("data-v-d3846761"),e=e(),D(),e),z={class:"error"},J=x(()=>s("h1",{class:"error-header"},"Error",-1)),T={class:"error-body"},U={class:"error-message"},G={class:"error-details"},K=x(()=>s("span",null,"Reload",-1)),Q=[K],X=w({__name:"Error",props:{error:{type:Object,required:!0},repeated:{type:Boolean,required:!1}},emits:["reload"],setup(e,{emit:r}){const o=e,n=b(()=>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",z,[J,s("div",T,[s("div",U,[s("p",null,p(n.value),1),s("p",G,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=w({__name:"FormPreview",setup(e){const r=$(),o=C(),n=S({started:!1});function l(a,i){j("preview",r,a,i)}const u=L(null),{loading:f,result:_,error:h,refetch:y}=g(()=>V.get(o.params.formPath)),{result:v}=g(()=>W.get()),P=b(()=>H.create({formPath:o.params.formPath})),I=async()=>{var a;if(!n.started){(a=u.value)==null||a.run();return}n.started=!1},R=({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())},E=()=>{r.push(`/_editor/form/${encodeURIComponent(o.params.formPath)}`)},B=()=>{n.started=!0},F=()=>{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:R,onLogout:I,onExit:F,onStart:B,onRedirect:l},null,8,["form","params","broker"]),m(O,{onExitFullscreenPreview:E})])]))]))}});const ke=k(te,[["__scopeId","data-v-fa4f1951"]]);export{ke as default};
//# sourceMappingURL=FormPreview.7fcfbf4e.js.map
