import{d as v,b as B,W as C,bo as g,f as k,j as e,c as w,g as c,a as x,h as A,a1 as H,o as I,n as s,bH as E,bI as F,bC as N,bD as P,bA as S,b5 as p,ae as T}from"./index-CPxpbp4R.js";import{u as V}from"./usePageTitle-CcH2lmI6.js";const U=v({__name:"BlockEdit",async setup(W){let t,l;const n=B(),u=H(),r=C("blockDocumentId"),o=([t,l]=g(()=>n.blockDocuments.getBlockDocument(r.value)),t=await t,l(),t),{blockType:i,blockSchema:_}=o,d=k(o.data),m=k(o.name);function f(b){n.blockDocuments.updateBlockDocument(o.id,b).then(()=>{p("Block updated successfully","success"),u.push(T.block(r.value))}).catch(a=>{p("Failed to update block","error"),console.error(a)})}function y(){u.back()}return V(`Edit Block: ${m.value}`),(b,a)=>{const h=A("p-layout-default");return e(o)?(I(),w(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(F),N({data:d.value,"onUpdate:data":a[0]||(a[0]=D=>d.value=D)},{name:m.value,blockSchema:e(_)},P({submit:f,cancel:y})),null,16,["data"])]),_:1},8,["block-type"])]),_:1})):x("",!0)}}});export{U as default};
//# sourceMappingURL=BlockEdit-Dv0GVYgm.js.map
