import{d as B,aE as D,W as C,G as g,ae as p,i as e,c as x,f as c,a as w,g as E,u as I,o as $,h as s,cG as A,cH as F,X as G,cC as H,cA as N,$ as b,bl as P}from"./index-BOEdKJ1D.js";import{u as S}from"./usePageTitle-BkurcLK2.js";const z=B({__name:"BlockEdit",async setup(T){let t,l;const n=D(),u=I(),r=C("blockDocumentId"),o=([t,l]=g(()=>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(P.block(r.value))}).catch(a=>{b("Failed to update block","error"),console.error(a)})}function y(){u.back()}return S(`Edit Block: ${m.value}`),(k,a)=>{const h=E("p-layout-default");return e(o)?($(),x(h,{key:0,class:"block-edit"},{header:c(()=>[s(e(A),{"block-document":e(o)},null,8,["block-document"])]),default:c(()=>[s(e(N),{"block-type":e(i)},{default:c(()=>[s(e(F),G({data:d.value,"onUpdate:data":a[0]||(a[0]=v=>d.value=v)},{name:m.value,blockSchema:e(_)},H({submit:f,cancel:y})),null,16,["data"])]),_:1},8,["block-type"])]),_:1})):w("",!0)}}});export{z as default};
//# sourceMappingURL=BlockEdit-CPawJlfu.js.map
