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