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