import{d as B,g as D,u as C,W as g,I as w,ae as p,j as x,c as E,a as I,n as e,o as P,k as c,l as s,cn as N,cu as S,_ as T,cp as V,cv as W,J as b,be as j}from"./index-DHPxdPUs.js";import{u as A}from"./usePageTitle-N_Vwn3MG.js";const O=B({__name:"BlockEdit",async setup(F){let o,n;const l=D(),u=C(),r=g("blockDocumentId"),t=([o,n]=w(()=>l.blockDocuments.getBlockDocument(r.value)),o=await o,n(),o),{blockType:i,blockSchema:_}=t,d=p(t.data),m=p(t.name);function f(k){l.blockDocuments.updateBlockDocument(t.id,k).then(()=>{b("Block updated successfully","success"),u.push(j.block(r.value))}).catch(a=>{b("Failed to update block","error"),console.error(a)})}function y(){u.back()}return A(`Edit Block: ${m.value}`),(k,a)=>{const v=x("p-layout-default");return e(t)?(P(),E(v,{key:0,class:"block-edit"},{header:c(()=>[s(e(W),{"block-document":e(t)},null,8,["block-document"])]),default:c(()=>[s(e(N),{"block-type":e(i)},{default:c(()=>[s(e(S),T({data:d.value,"onUpdate:data":a[0]||(a[0]=h=>d.value=h)},{name:m.value,blockSchema:e(_)},V({submit:f,cancel:y})),null,16,["data"])]),_:1},8,["block-type"])]),_:1})):I("",!0)}}});export{O as default};
//# sourceMappingURL=BlockEdit-B9Z6BfP8.js.map
