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