import{d as _,H as k,b as i,ev as d,e as a,eD as u,eE as $,eF as D,v as m,a as C,f as p,u as t,ar as q,eA as S,eB as A,G as L,r as N,c as M}from"./outputWidgets.84fe9cdf.js";import{L as V}from"./CircularLoading.da6d195c.js";import{F as H,r as O,R as T}from"./FormRunner.7673ea58.js";import{x as W}from"./icons.fb80f0dd.js";import{a as w}from"./asyncComputed.6b982433.js";import{F as j}from"./forms.ac7e9970.js";import{W as G}from"./workspaces.f0c8759d.js";import"./api.0b487b10.js";import"./runnerData.17301334.js";import"./url.8de5cd7a.js";import"./Passwordless.94310c84.js";import"./index.72d3c468.js";import"./pubsub.e099f5f1.js";import"./PlayerNavbar.bb0f21f0.js";import"./ActionButton.e689c3e2.js";import"./WidgetsFrame.bef91c2b.js";import"./index.69c8862c.js";import"./Base.3448c1ef.js";import"./Link.10affec7.js";import"./Paragraph.7a7aafbc.js";import"./Text.6c3b9f60.js";import"./Title.59475fea.js";import"./Card.b3863c0d.js";import"./TabPane.dfbe23a9.js";import"./hasIn.892e96d0.js";import"./record.d584e714.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]="86fde1ba-2238-4f79-b774-cfbdd72208be",e._sentryDebugIdIdentifier="sentry-dbid-86fde1ba-2238-4f79-b774-cfbdd72208be")}catch{}})();const x=e=>($("data-v-3e46b76c"),e=e(),D(),e),U={class:"error"},z=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,[z,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=C("icon");return i(),d("button",{class:"back-btn",onClick:s[0]||(s[0]=l=>r("exitFullscreenPreview"))},[p(c,{class:"icon",path:t(W),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=A(),s=L({started:!1});function c(n,g){O("preview",r,n,g)}const l=N(null),{loading:f,result:v,error:h,refetch:y}=w(()=>j.get(o.params.id)),{result:b}=w(()=>G.get()),B=k(()=>T.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}),y()},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(h)?(i(),d("div",se,[p(ee,{error:t(h),onReload:t(y)},null,8,["error","onReload"])])):(i(),d("main",ae,[a("div",ne,[p(H,{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 Se=m(ie,[["__scopeId","data-v-63264cab"]]);export{Se as default};
//# sourceMappingURL=FormPreview.8160e764.js.map
