import{d as B,k as D,W as x,L as C,af as p,m as e,c as g,i as c,a as w,j as W,g as A,o as E,l as s,cy as I,cz as M,Y as N,cu as P,cs as S,M as b,bo as T}from"./index-7qezL2zM.js";import{u as V}from"./usePageTitle-k72s0--o.js";const F=B({__name:"BlockEdit",async setup(j){let t,l;const n=D(),u=A(),r=x("blockDocumentId"),o=([t,l]=C(()=>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)?(E(),g(h,{key:0,class:"block-edit"},{header:c(()=>[s(e(I),{"block-document":e(o)},null,8,["block-document"])]),default:c(()=>[s(e(S),{"block-type":e(i)},{default:c(()=>[s(e(M),N({data:d.value,"onUpdate:data":a[0]||(a[0]=v=>d.value=v)},{name:m.value,blockSchema:e(_)},P({submit:f,cancel:y})),null,16,["data"])]),_:1},8,["block-type"])]),_:1})):w("",!0)}}});export{F as default};
//# sourceMappingURL=BlockEdit-ZrNNg5H2.js.map
