var f=Object.defineProperty;var h=(a,t,i)=>t in a?f(a,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[t]=i;var d=(a,t,i)=>h(a,typeof t!="symbol"?t+"":t,i);import{c as p}from"./runtime-dom.esm-bundler.dc49ee3e.js";import{c as y,a as b}from"./vue-router.41e9d860.js";import{l as D}from"./index.4b887428.js";import{l as M}from"./index.20093c86.js";import{l as x}from"./index.f5fa0cce.js";import{i as g}from"./helpers.1a09a04b.js";import{h as B}from"./runtime-core.esm-bundler.ce5add0b.js";let c=null,m=null,u=null;class A{constructor(t){d(this,"mountComponent",({name:t,component:i,rootContainer:l,data:o={},props:n={},useRouter:r=!1})=>{let e=p({name:t,data(){return o},render:()=>B(i,{...n})});if(e=M(e),e=x(e),r){const s=y({history:b(),routes:[{path:"/:pathMatch(.*)*",component:i}]});e.use(s),s.app=e}return D(e),e.mount(l),e});this.scoreBtn=t==null?void 0:t.scoreBtn,this.limitModifiedDate=t==null?void 0:t.limitModifiedDate,this.metabox=t==null?void 0:t.metabox,this.injectStyles=t==null?void 0:t.injectStyles,this.mount=async()=>{var l;const i=(o,n)=>{const r=document.createElement(o);for(const e in n)r.setAttribute(e,n[e]);return r};if(this.scoreBtn&&(this.scoreBtn.node.$wrapper.querySelector(`#${this.scoreBtn.node.attributes.id}`)||this.scoreBtn.node.$wrapper.insertAdjacentElement("beforeend",i(this.scoreBtn.node.tag,this.scoreBtn.node.attributes)),c==null||c.unmount(),c=this.mountComponent({name:this.scoreBtn.appName,component:this.scoreBtn.component,rootContainer:this.scoreBtn.node.$wrapper.querySelector(`#${this.scoreBtn.node.attributes.id}`),props:{onClick(){document.dispatchEvent(new Event("aioseo-pagebuilder-toggle-modal"))}}})),this.limitModifiedDate){const o=n=>{var r,e,s;n&&(n.querySelector(`#${this.limitModifiedDate.node.attributes.id}`)||n.insertAdjacentElement("beforeend",i(this.limitModifiedDate.node.tag,{...this.limitModifiedDate.node.attributes,class:((r=this.limitModifiedDate.node.attributes)==null?void 0:r.class)||((e=n.querySelector('[role="menuitem"]'))==null?void 0:e.classList.value)})),m==null||m.unmount(),m=this.mountComponent({name:this.limitModifiedDate.appName,component:this.limitModifiedDate.component,rootContainer:n.querySelector(`#${this.limitModifiedDate.node.attributes.id}`),props:((s=this.limitModifiedDate)==null?void 0:s.props)||{}}))};(l=this.limitModifiedDate.node)!=null&&l.mountLater?this.limitModifiedDate.node.mountLater(o):o(this.limitModifiedDate.node.$wrapper)}this.metabox&&(u==null||u.unmount(),u=this.mountComponent({name:this.metabox.appName,component:this.metabox.component,rootContainer:"#aioseo-modal-portal",data:{tableContext:window.aioseo.currentPost.context,screenContext:"metabox"},useRouter:!0})),this.injectStyles&&document.querySelectorAll('link[href*="all-in-one-seo-pack"]').forEach(n=>{g(n.href,n.id)})}}}export{A as P};
