import{d as g,u as x,r as F,G as R,b as a,c as n,y as e,t as B,e as i,v as b,K as q,L as E,q as L}from"./registerWidgets.d12d7cf9.js";import{a as f,L as C}from"./CircularLoading.89577a16.js";import{E as I}from"./Error.e6ce10ba.js";import{F as N,R as M}from"./broker.22806872.js";import{B as V}from"./BackButton.f34770a2.js";import{F as W}from"./forms.7bc6baea.js";import{W as D}from"./workspaces.32af92db.js";import"./WidgetsFrame.015f5931.js";import"./icons.a63cb90b.js";import"./index.7a773bce.js";import"./Modal.8745ec05.js";import"./log.2520bfaa.js";import"./utils.3371dfe5.js";const G={class:"page"},H={key:1,class:"error"},K={key:2,style:{width:"100%",height:"100%",display:"flex"}},S={style:{width:"100%",height:"100%",display:"flex"}},U=g({__name:"FormPreview",setup($){const s=q(),r=E(),o=x({started:!1}),m=F(null),{loading:_,result:c,error:u,refetch:d}=f(()=>W.get(r.params.formPath)),{result:l}=f(()=>D.get()),h=R(()=>M.create({isLocal:!1,formPath:r.params.formPath,isPreview:!0})),v=async()=>{var t;if(!o.started){(t=m.value)==null||t.run();return}o.started=!1},y=({path:t,type:p})=>{p==="dash"?s.push({name:"dashPreview",params:{dashPath:t},query:r.query}):(s.push({name:"form-preview",params:{formPath:t},query:r.query}),d())},k=()=>{s.push(`/_editor/form/${encodeURIComponent(r.params.formPath)}`)},w=()=>{o.started=!0},P=()=>{o.started=!1};return(t,p)=>(a(),n("div",G,[e(_)||!e(c)||!e(l)?(a(),B(C,{key:0})):e(u)?(a(),n("div",H,[i(I,{error:e(u),onReload:e(d)},null,8,["error","onReload"])])):(a(),n("main",K,[b("div",S,[i(N,{ref_key:"runner",ref:m,form:e(c).makeRunnerData(e(l)),params:e(r).query,"is-preview":!0,"enable-auto-focus":!0,broker:e(h),style:{height:"unset",flex:1,overflow:"hidden"},onNavigate:y,onLogout:v,onExit:P,onStart:w},null,8,["form","params","broker"]),i(V,{onExitFullscreenPreview:k})])]))]))}});const oe=L(U,[["__scopeId","data-v-f7c2ba13"]]);export{oe as default};
//# sourceMappingURL=FormPreview.07bb010f.js.map
