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