import{d as h,_ as B,W as C,J as g,af as p,k as e,c as x,f as c,a as P,g as w,u as N,o as A,j as s,cz as E,cA as I,Z as S,cv as T,ct as V,P as b,bo as W}from"./index-BrFqolpA.js";import{u as j}from"./usePageTitle-CsnULHHx.js";const J=h({__name:"BlockEdit",async setup(z){let t,l;const n=B(),u=N(),r=C("blockDocumentId"),o=([t,l]=g(()=>n.blockDocuments.getBlockDocument(r.value)),t=await t,l(),t),{blockType:_,blockSchema:i}=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(W.block(r.value))}).catch(a=>{b("Failed to update block","error"),console.error(a)})}function y(){u.back()}return j(`Edit Block: ${m.value}`),(k,a)=>{const v=w("p-layout-default");return e(o)?(A(),x(v,{key:0,class:"block-edit"},{header:c(()=>[s(e(E),{"block-document":e(o)},null,8,["block-document"])]),default:c(()=>[s(e(V),{"block-type":e(_)},{default:c(()=>[s(e(I),S({data:d.value,"onUpdate:data":a[0]||(a[0]=D=>d.value=D)},{name:m.value,blockSchema:e(i)},T({submit:f,cancel:y})),null,16,["data"])]),_:1},8,["block-type"])]),_:1})):P("",!0)}}});export{J as default};
//# sourceMappingURL=BlockEdit-DRKBKl56.js.map
