import{f,u as h}from"./js/app-core.52885c02.js";import{l as d}from"./js/vendor-lodash.b9aaf385.js";import"./js/vendor-vue-ui.c21c50b5.js";import"./js/vendor-other.ec82d685.js";if(window.aioseo.currentPost?.context==="post"){let i=[];window.wp.data.subscribe(()=>{p()});const p=d(()=>{const e=window.wp.data.select("core/block-editor").getBlocks();(e.length<i.length||e.length===1)&&u(),i=e},200);window.aioseoBus.$on("schemaBlockUpdated",()=>{u()});const u=d(()=>{let e=window.wp.data.select("core/block-editor").getBlocks();e=f(e),e=e.filter(t=>t?.attributes?.schemaBlockId),e=e.map(t=>(t.attributes.type=t.name,t));const l=h(),r=l.currentPost.schema?.blockGraphs||[];r.forEach((t,c)=>{const o=e.findIndex(n=>n?.attributes?.schemaBlockId===t?.schemaBlockId);if(o===-1){r.splice(c,1);return}const s={...e[o].attributes};["backgroundColor","textColor","fontSize","style"].forEach(n=>{delete s[n]}),Object.keys(s).forEach(n=>{typeof s[n]=="string"&&s[n].match(/^({.*}|\[.*\])$/)&&(s[n]=JSON.parse(s[n]))}),r[c]=s}),e.forEach(t=>{r.findIndex(o=>o?.schemaBlockId===t?.attributes?.schemaBlockId)===-1&&t?.attributes&&(Object.keys(t?.attributes).forEach(o=>{typeof t.attributes[o]=="string"&&t.attributes[o].match(/^({.*}|\[.*\])$/)&&(t.attributes[o]=JSON.parse(t.attributes[o]))}),r.push(t.attributes))}),r.sort((t,c)=>{const o=e.findIndex(a=>a?.attributes?.schemaBlockId===t?.schemaBlockId),s=e.findIndex(a=>a?.attributes?.schemaBlockId===c?.schemaBlockId);return o-s}),l.currentPost.schema.blockGraphs=r},200)}
