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