import{d as _,F as k,b as i,et as d,e as a,eB as u,eC as $,eD as C,t as m,a as D,f as p,u as t,ao as q,ey as S,ez as L,E as N,r as A,c as M}from"./outputWidgets.b703ca45.js";import{L as V}from"./CircularLoading.63631aeb.js";import{F as O,r as T,R as W}from"./FormRunner.5f682dae.js";import{x as j}from"./icons.5202cd65.js";import{a as w}from"./asyncComputed.557fdbc3.js";import{F as z}from"./forms.4ae6c770.js";import{W as H}from"./workspaces.ac64317a.js";import"./url.7a748c18.js";import"./storage.4f0beb94.js";import"./pubsub.781c61cb.js";import"./jwt-decode.esm.74bd4619.js";import"./index.d4bb89c7.js";import"./PlayerNavbar.6e90d633.js";import"./ActionButton.7497460f.js";import"./WidgetsFrame.a8d8fb77.js";import"./index.5fc087d9.js";import"./Card.3c731ead.js";import"./TabPane.9316e440.js";import"./hasIn.66135dec.js";import"./index.006cef5c.js";import"./Text.4646803d.js";import"./Link.b9370a79.js";import"./Title.c76d824d.js";import"./record.6a34e5b4.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]="9eef0afd-58ad-449d-84bc-7e793f24de14",e._sentryDebugIdIdentifier="sentry-dbid-9eef0afd-58ad-449d-84bc-7e793f24de14")}catch{}})();const x=e=>($("data-v-3e46b76c"),e=e(),C(),e),U={class:"error"},G=x(()=>a("h1",{class:"error-header"},"Error",-1)),J={class:"error-body"},K={class:"error-message"},Q={class:"error-details"},X=x(()=>a("span",null,"Reload",-1)),Y=[X],Z=_({__name:"Error",props:{error:{type:Object,required:!0},repeated:{type:Boolean,required:!1}},emits:["reload"],setup(e,{emit:r}){const o=e,s=k(()=>o.repeated?"Ooops. The same error occured, please try again later.":"An error occurred while loading.");function c(){r("reload")}return(l,f)=>(i(),d("div",U,[G,a("div",J,[a("div",K,[a("p",null,u(s.value),1),a("p",Q,u(e.error.name)+": "+u(e.error.message),1)]),a("div",{class:"error-actions"},[a("button",{class:"btn btn-primary",onClick:c},Y)])])]))}});const ee=m(Z,[["__scopeId","data-v-3e46b76c"]]),re=_({__name:"BackButton",emits:["exitFullscreenPreview"],setup(e,{emit:r}){return(o,s)=>{const c=D("icon");return i(),d("button",{class:"back-btn",onClick:s[0]||(s[0]=l=>r("exitFullscreenPreview"))},[p(c,{class:"icon",path:t(j),width:"20",height:"20",fill:"#5A677A"},null,8,["path"]),q(" Editor ")])}}});const te=m(re,[["__scopeId","data-v-a3f31716"]]),oe={class:"page"},se={key:1,class:"error"},ae={key:2,style:{width:"100%",height:"100%",display:"flex"}},ne={style:{width:"100%",height:"100%",display:"flex"}},ie=_({__name:"FormPreview",setup(e){const r=S(),o=L(),s=N({started:!1});function c(n,g){T("preview",r,n,g)}const l=A(null),{loading:f,result:v,error:y,refetch:h}=w(()=>z.get(o.params.id)),{result:b}=w(()=>H.get()),B=k(()=>W.create(o.params.id)),I=async()=>{var n;if(!s.started){(n=l.value)==null||n.run();return}s.started=!1},F=async({id:n})=>{await r.push({params:{id:n},name:"formPreview",query:o.query}),h()},E=()=>{r.push(`/_editor/form/${encodeURIComponent(o.params.id)}`)},R=()=>{s.started=!0},P=()=>{s.started=!1};return(n,g)=>(i(),d("div",oe,[t(f)||!t(v)||!t(b)?(i(),M(V,{key:0})):t(y)?(i(),d("div",se,[p(ee,{error:t(y),onReload:t(h)},null,8,["error","onReload"])])):(i(),d("main",ae,[a("div",ne,[p(O,{ref_key:"runner",ref:l,form:t(v).makeRunnerData(t(b)),params:t(o).query,"is-preview":!0,"enable-auto-focus":!0,broker:B.value,style:{height:"unset",flex:1,overflow:"hidden"},onNavigate:F,onLogout:I,onExit:P,onStart:R,onRedirect:c},null,8,["form","params","broker"]),p(te,{onExitFullscreenPreview:E})])]))]))}});const De=m(ie,[["__scopeId","data-v-63264cab"]]);export{De as default};
//# sourceMappingURL=FormPreview.0eccfdf2.js.map
