import{d as v,aF as B,W as C,K as g,ae as p,k as e,c as x,g as c,a as F,h as w,u as P,o as A,j as s,cJ as E,cK as I,X as K,cF as N,cD as S,L as b,bo as T}from"./index-BqDjVCF_.js";import{u as V}from"./usePageTitle-CZh_IXm2.js";const J=v({__name:"BlockEdit",async setup(W){let t,l;const n=B(),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(T.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 h=w("p-layout-default");return e(o)?(A(),x(h,{key:0,class:"block-edit"},{header:c(()=>[s(e(E),{"block-document":e(o)},null,8,["block-document"])]),default:c(()=>[s(e(S),{"block-type":e(i)},{default:c(()=>[s(e(I),K({data:d.value,"onUpdate:data":a[0]||(a[0]=D=>d.value=D)},{name:m.value,blockSchema:e(_)},N({submit:f,cancel:y})),null,16,["data"])]),_:1},8,["block-type"])]),_:1})):F("",!0)}}});export{J as default};
//# sourceMappingURL=BlockEdit-B-WrFevw.js.map
