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