import{d as B,g as D,u as C,W as g,H as w,ae as p,j as x,c as I,a as E,p as e,o as F,k as c,l as s,cn as H,cu as N,X as P,cp as S,cv as T,I as b,be as V}from"./index-Cixz26l0.js";import{u as W}from"./usePageTitle-BPkBun_K.js";const R=B({__name:"BlockEdit",async setup(j){let t,l;const n=D(),u=C(),r=g("blockDocumentId"),o=([t,l]=w(()=>n.blockDocuments.getBlockDocument(r.value)),t=await t,l(),t),{blockType:i,blockSchema:_}=o,d=p(o.data),m=p(o.name);function f(k){n.blockDocuments.updateBlockDocument(o.id,k).then(()=>{b("Block updated successfully","success"),u.push(V.block(r.value))}).catch(a=>{b("Failed to update block","error"),console.error(a)})}function y(){u.back()}return W(`Edit Block: ${m.value}`),(k,a)=>{const v=x("p-layout-default");return e(o)?(F(),I(v,{key:0,class:"block-edit"},{header:c(()=>[s(e(T),{"block-document":e(o)},null,8,["block-document"])]),default:c(()=>[s(e(H),{"block-type":e(i)},{default:c(()=>[s(e(N),P({data:d.value,"onUpdate:data":a[0]||(a[0]=h=>d.value=h)},{name:m.value,blockSchema:e(_)},S({submit:f,cancel:y})),null,16,["data"])]),_:1},8,["block-type"])]),_:1})):E("",!0)}}});export{R as default};
//# sourceMappingURL=BlockEdit-BafdEmJG.js.map
