OwlCyberSecurity - MANAGER
Edit File: helpers.77f11e73.js
var Oe=Object.defineProperty;var Ge=(e,t,s)=>t in e?Oe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var P=(e,t,s)=>Ge(e,typeof t!="symbol"?t+"":t,s);import{p as Me,d as $e,e as m,b as x,h as $,l as q,k as qe,A as b,r as ne,u as ee,s as Ie,G as S,y as N,z as v,B as M,E as D,U as L,D as B,V as R,W as U,C as J,X as Q}from"./index.7377ee90.js";import{d as oe}from"./Caret.a21d4ca8.js";import{s as De}from"./metabox.8f8ea589.js";import{c as I}from"./cleanForSlug.97664b33.js";import{a as Le,g as T}from"./_baseSet.9f9da1bd.js";import{I as Be}from"./helpers.53868b98.js";import"./translations.d159963e.js";import{_ as p}from"./default-i18n.20001971.js";import{e as ue}from"./regex.8a6101c0.js";import{n as pe,g as Re,aT as re}from"./runtime-dom.esm-bundler.5c3c7d72.js";function Ue(e,t,s){return e==null?e:Le(e,t,s)}const d="all-in-one-seo-pack",Je=()=>{const e=[{slug:"article",graphName:"Article",label:p("Article",d)},{slug:"book",graphName:"Book",label:p("Book",d)},{slug:"course",graphName:"Course",label:p("Course",d)},{slug:"dataset",graphName:"Dataset",label:p("Dataset",d)},{slug:"event",graphName:"Event",label:p("Event",d)},{slug:"faq-page",graphName:"FAQPage",label:p("FAQ",d)},{slug:"fact-check",graphName:"FactCheck",label:p("Fact Check",d)},{slug:"how-to",graphName:"HowTo",label:p("How To",d)},{slug:"job-posting",graphName:"JobPosting",label:p("Job Posting",d)},{slug:"movie",graphName:"Movie",label:p("Movie",d)},{slug:"music",graphName:"Music",label:p("Music",d)},{slug:"person",graphName:"Person",label:p("Person",d)},{slug:"product",graphName:"Product",label:p("Product",d)},{slug:"product-review",graphName:"ProductReview",label:p("Product Review",d)},{slug:"car",graphName:"Car",label:p("Car",d)},{slug:"recipe",graphName:"Recipe",label:p("Recipe",d)},{slug:"service",graphName:"Service",label:p("Service",d)},{slug:"software-application",graphName:"SoftwareApplication",label:p("Software",d)},{slug:"video",graphName:"Video",label:p("Video",d)},{slug:"web-page",graphName:"WebPage",label:p("Web Page",d)}],t={Article:[{childGraphName:"BlogPosting",label:p("Blog Post",d)},{childGraphName:"NewsArticle",label:p("News Article",d)}],Music:[{childGraphName:"MusicAlbum",label:p("Music Album",d)},{childGraphName:"MusicGroup",label:p("Music Group",d)}],WebPage:[{childGraphName:"WebPage",label:p("Web Page",d)},{childGraphName:"AboutPage",label:p("About Page",d)},{childGraphName:"CheckoutPage",label:p("Checkout Page",d)},{childGraphName:"CollectionPage",label:p("Collection Page",d)},{childGraphName:"ContactPage",label:p("Contact Page",d)},{childGraphName:"ItemPage",label:p("Item Page",d)},{childGraphName:"MedicalWebPage",label:p("Medical Page",d)},{childGraphName:"ProfilePage",label:p("Profile Page",d)},{childGraphName:"RealEstateListing",label:p("Real Estate Listing",d)},{childGraphName:"SearchResultsPage",label:p("Search Results Page",d)}]};return{childGraphs:t,graphs:e,initSchemaEditor:o=>{const n=de(),c=JSON.stringify(n.graph);n.graph=Me(o,n.graph);const i=JSON.stringify(n.graph);JSON.stringify(c)!==JSON.stringify(i)&&(n.isDirty=!0)},getGraphObject:(o,n=!1)=>{var c;return!n&&((c=o==null?void 0:o.properties)==null?void 0:c.type)!==o.graphName&&t[o.graphName]?t[o.graphName].find(i=>i.childGraphName===o.properties.type):e.find(i=>i.slug===o.slug)},getParentGraphName:o=>{let n="";return Object.entries(t).forEach(c=>{const i=c[0];c[1].forEach(u=>{n||o===u.childGraphName&&(n=i)})}),n||o}}},de=$e("SchemaStore",{state:()=>({custom:{graphName:"",schema:""},defaultGraphParent:"",graph:null,graphCardsKey:0,isDirty:!1,isEditingCustomGraph:!1,isEditingCustomTemplate:!1,isEditingDefaultGraph:!1,isEditingGraph:!1,isEditingTemplate:!1,modalOpenMetabox:!1,modalOpenSidebar:!1,output:"",outputKey:0,tabs:{generator:"schema-templates",templates:"schema-catalog"},templateName:"",previousOutputRequestData:null}),actions:{getCustomObject(){return{id:"#aioseo-custom-"+new Date().getTime().toString(36),custom:!0,graphName:this.custom.graphName,schema:this.custom.schema}},resetSessionState(){this.custom={graphName:"",schema:""},this.defaultGraphParent="",this.graph=null,this.templateName="",this.isEditingCustomGraph=!1,this.isEditingCustomTemplate=!1,this.isEditingDefaultGraph=!1,this.isEditingGraph=!1,this.isEditingTemplate=!1,this.isDirty=!1},addCustomAsGraph(){const e=m();e.currentPost.schema.customGraphs.push(this.getCustomObject()),e.currentPost.schema.customGraphs=e.currentPost.schema.customGraphs.sort((t,s)=>t.graphName<s.graphName?-1:1),this.resetSessionState(),this.graphCardsKey=this.graphCardsKey+1,this.modalOpenMetabox=!1,this.modalOpenSidebar=!1},addCustomAsTemplate(){const e=x(),t={...this.getCustomObject()},s={...JSON.parse(JSON.stringify(t)),label:"Custom Schema - "+t.graphName};e.internalOptions.internal.schema.templates.push(this.getCustomObject()),this.resetSessionState(),this.setTabTemplates("your-templates"),$.post(q.restUrl("schema/templates")).send({template:s}).then(a=>{a.body.success&&a.body.templates&&this.parseAndUpdateTemplates(a.body.templates)})},addCustomTemplateAsGraph(){const e=m();e.currentPost.schema.customGraphs.push(this.graph),e.currentPost.schema.customGraphs=e.currentPost.schema.customGraphs.sort((t,s)=>t.graphName<s.graphName?-1:1),this.resetSessionState(),this.graphCardsKey=this.graphCardsKey+1,this.modalOpenMetabox=!1,this.modalOpenSidebar=!1},addDefaultGraph(){const e=m();e.currentPost.schema.default.isEnabled=!0,this.resetSessionState(),this.graphCardsKey=this.graphCardsKey+1,this.modalOpenMetabox=!1,this.modalOpenSidebar=!1},addGraph(){const e=m();e.currentPost.schema.graphs.push(this.graph),e.currentPost.schema.graphs=e.currentPost.schema.graphs.sort((t,s)=>t.graphName<s.graphName?-1:1),this.resetSessionState(),this.graphCardsKey=this.graphCardsKey+1,this.modalOpenMetabox=!1,this.modalOpenSidebar=!1},addGraphAsTemplate(){var a,r,o,n,c;const e=Je();(r=(a=this.graph)==null?void 0:a.properties)!=null&&r.type&&this.graph.properties.type!==this.graph.graphName?this.graph.label=((o=e.getGraphObject(this.graph,!0))==null?void 0:o.label)+" - "+((n=e.getGraphObject(this.graph))==null?void 0:n.label)+" - "+this.templateName:this.graph.label=((c=e.getGraphObject(this.graph,!0))==null?void 0:c.label)+" - "+this.templateName;const t=JSON.parse(JSON.stringify(this.graph));x().internalOptions.internal.schema.templates.push(this.graph),this.resetSessionState(),this.setTabTemplates("your-templates"),$.post(q.restUrl("schema/templates")).send({template:t}).then(i=>{i.body.success&&i.body.templates&&this.parseAndUpdateTemplates(i.body.templates)})},addTemplateAsGraph(e,t=""){let a=x().internalOptions.internal.schema.templates;if(t){const n=new RegExp(ue(t).replace(/\s/g,"\\s"),"i");a=a.filter(c=>{var i;return(i=c==null?void 0:c.label)==null?void 0:i.match(n)})}e===void 0&&(e=a.findIndex(n=>n.id===this.graph.id));const r=JSON.parse(JSON.stringify(a[e]));r.id=r.id+new Date().getTime().toString(18);const o=m();r.custom?(o.currentPost.schema.customGraphs.push(r),o.currentPost.schema.customGraphs=o.currentPost.schema.customGraphs.sort((n,c)=>n.graphName<c.graphName?-1:1)):(o.currentPost.schema.graphs.push(r),o.currentPost.schema.graphs=o.currentPost.schema.graphs.sort((n,c)=>n.graphName<c.graphName?-1:1)),this.resetSessionState(),this.graphCardsKey=this.graphCardsKey+1,this.modalOpenMetabox=!1,this.modalOpenSidebar=!1},deleteCustomGraph(e){const t=m();e===void 0&&(e=t.currentPost.schema.customGraphs.findIndex(s=>s.id===this.graph.id)),t.currentPost.schema.customGraphs.splice(e,1),this.resetSessionState(),this.graphCardsKey=this.graphCardsKey+1,this.modalOpenMetabox=!1,this.modalOpenSidebar=!1},deleteDefaultGraph(){const e=m();e.currentPost.schema.default.isEnabled=!1,this.resetSessionState(),this.graphCardsKey=this.graphCardsKey+1,this.modalOpenMetabox=!1,this.modalOpenSidebar=!1},deleteGraph(e){const t=m();e===void 0&&(e=t.currentPost.schema.graphs.findIndex(s=>s.id===this.graph.id)),t.currentPost.schema.graphs.splice(e,1),this.resetSessionState(),this.graphCardsKey=this.graphCardsKey+1,this.modalOpenMetabox=!1,this.modalOpenSidebar=!1},deleteTemplate(e){const t=this.graph.id,s=x();e===void 0&&(e=s.internalOptions.internal.schema.templates.findIndex(a=>a.id===t)),s.internalOptions.internal.schema.templates.splice(e,1),this.resetSessionState(),this.setTabTemplates("your-templates"),$.delete(q.restUrl("schema/templates")).send({templateId:t}).then(a=>{a.body.success&&a.body.templates&&this.parseAndUpdateTemplates(a.body.templates)})},editCustomGraph({customGraphIndex:e,isSidebar:t}){const s=m(),a=JSON.parse(JSON.stringify(s.currentPost.schema.customGraphs[e]));this.graph=a,this.isEditingCustomGraph=!0,this.tabs.generator="custom-schema",t?this.modalOpenSidebar=!0:this.modalOpenMetabox=!0},editDefaultGraph({isSidebar:e,parentGraphName:t}){this.defaultGraphParent=t;const s=m();s.currentPost.schema.default.data[t]&&(this.graph=s.currentPost.schema.default.data[t]),this.isEditingDefaultGraph=!0,this.tabs.generator="schema-templates",e?this.modalOpenSidebar=!0:this.modalOpenMetabox=!0},async editGraph({graphIndex:e,isSidebar:t}){const s=m(),a=JSON.parse(JSON.stringify(s.currentPost.schema.graphs[e]));this.graph=a,this.isEditingGraph=!0,this.tabs.generator="schema-templates",t?this.modalOpenSidebar=!0:this.modalOpenMetabox=!0,await pe(),this.isDirty=!1},async editTemplate(e,t=""){let a=x().internalOptions.internal.schema.templates;if(t){const o=new RegExp(ue(t).replace(/\s/g,"\\s"),"i");a=a.filter(n=>n.label.match(o))}const r=JSON.parse(JSON.stringify(a[e]));if(this.graph=r,r.custom)this.templateName=this.graphName,this.isEditingCustomTemplate=!0,this.tabs.generator="custom-schema";else{const o=new RegExp(`^${this.graph.graphName} -`,"i"),n=this.graph.label.replace(o,"");this.templateName=n,this.isEditingTemplate=!0}await pe(),this.isDirty=!1},updateCustomGraph(){const e=m(),t=e.currentPost.schema.customGraphs.findIndex(s=>s.id===this.graph.id);t!==-1&&(e.currentPost.schema.customGraphs[t]=this.graph,e.currentPost.schema.customGraphs=e.currentPost.schema.customGraphs.sort((s,a)=>s.graphName<a.graphName?-1:1),this.resetSessionState(),this.graphCardsKey=this.graphCardsKey+1,this.modalOpenMetabox=!1,this.modalOpenSidebar=!1)},updateDefaultGraph(){const e=m();e.currentPost.schema.default.data[this.defaultGraphParent]=this.graph,this.resetSessionState(),this.graphCardsKey=this.graphCardsKey+1,this.modalOpenMetabox=!1,this.modalOpenSidebar=!1},updateGraph(){const e=m(),t=e.currentPost.schema.graphs.findIndex(s=>s.id===this.graph.id);t!==-1&&(e.currentPost.schema.graphs[t]=this.graph,e.currentPost.schema.graphs=e.currentPost.schema.graphs.sort((s,a)=>s.graphName<a.graphName?-1:1),this.resetSessionState(),this.graphCardsKey=this.graphCardsKey+1,this.modalOpenMetabox=!1,this.modalOpenSidebar=!1)},updateSchemaOutput(){const e=m();if(qe().isUnlicensed)return;let s=e.currentPost.id;if(b()&&(s=window.wp.data.select("core/editor").getCurrentPostId()),!s||e.currentPost.context!=="post")return;const a={postId:s,graphs:e.currentPost.schema.graphs,customGraphs:e.currentPost.schema.customGraphs,default:e.currentPost.schema.default,blockGraphs:e.currentPost.schema.blockGraphs};JSON.stringify(a)!==this.previousOutputRequestData&&(this.previousOutputRequestData=JSON.stringify(a),$.post(q.restUrl("schema/validator/output")).send(a).then(r=>{if(r.body.success&&r.body.output){let o=null;try{o=JSON.parse(r.body.output)}catch{return}if(r.body.output=JSON.stringify(o,null," ").trim(),r.body.output===this.output)return;this.output=r.body.output,this.outputKey=this.outputKey+1}}))},updateTemplate(){this.graph.label=this.graph.graphName+" - "+this.templateName;const e=JSON.parse(JSON.stringify(this.graph)),t=x(),s=t.internalOptions.internal.schema.templates.findIndex(a=>a.id===this.graph.id);s!==-1&&(t.internalOptions.internal.schema.templates[s]=this.graph,this.resetSessionState(),this.setTabTemplates("your-templates"),$.put(q.restUrl("schema/templates")).send({template:e}).then(a=>{a.body.success&&a.body.templates&&this.parseAndUpdateTemplates(a.body.templates)}))},parseAndUpdateTemplates(e){e=e.map(s=>(typeof s!="string"||(s=JSON.parse(s)),s)),e=e.sort((s,a)=>{const r=s.custom?0:1;return s.graphName<a.graphName?-1:r});const t=x();t.internalOptions.internal.schema.templates=e},setModalOpen({isOpen:e,initialTab:t,isSidebar:s}){e||(this.resetSessionState(),this.setTabTemplates("schema-catalog")),s?this.modalOpenSidebar=e:this.modalOpenMetabox=e,t&&(this.tabs.generator=t)},setTabTemplates(e){this.tabs.generator="schema-templates",this.tabs.templates=e}}}),te=(e,t="div")=>{const s=document.createElement(t);return s.innerHTML=Ie(e.trim()),s},se=(e,t=!0,s="textContent")=>(typeof e=="string"&&(t&&(e=e.replace(/[\t|\n]/gm,"")),e=te(e)),e[s]||e.textContent||e.innerText||""),Ut=e=>(typeof e=="string"&&(e=te(e)),(e==null?void 0:e.outerText)??""),ie=e=>(typeof e=="string"&&(e=te(e)),e.querySelectorAll("img")),Jt=(e,t=200,s="…")=>e&&(t<e.length&&(e=e.substring(0,t).trim()+ne(s)),e),Kt=(e,t)=>{try{const s=JSON.parse(t);return s?s["@type"]&&(e===s["@type"]||Array.isArray(s["@type"])&&s["@type"].includes(e))?s:Array.isArray(s["@graph"])&&s["@graph"].find(r=>Array.isArray(r["@type"])?r["@type"].includes(e):r["@type"]===e)||!1:!1}catch{return!1}},jt=()=>{var e;return{url:window.location.href,title:document.title||"",description:((e=document.querySelector('meta[name="description"]'))==null?void 0:e.content)||""}},Wt=()=>{var t,s,a,r;const e={description:((t=document.querySelector('meta[property="og:description"]'))==null?void 0:t.content)||"",image:((s=document.querySelector('meta[property="og:image"]'))==null?void 0:s.content)||"",title:((a=document.querySelector('meta[property="og:title"]'))==null?void 0:a.content)||"",type:((r=document.querySelector('meta[property="og:type"]'))==null?void 0:r.content)||""};if(!e.title&&(e.title=document.title||"",!e.title)){const o=ee();e.title=o.aioseo.urls.domain}return e},Ht=()=>{var e,t,s,a;return{card:((e=document.querySelector('meta[name="twitter:card"]'))==null?void 0:e.content)||"",description:((t=document.querySelector('meta[name="twitter:description"]'))==null?void 0:t.content)||"",image:((s=document.querySelector('meta[name="twitter:image"]'))==null?void 0:s.content)||"",title:((a=document.querySelector('meta[name="twitter:title"]'))==null?void 0:a.content)||""}},Ke=e=>{var s;if(typeof(window==null?void 0:window.acf)!="object"||typeof((s=window.acf)==null?void 0:s.getField)!="function")return null;const t=window.acf.getField(e)||{};return typeof(t==null?void 0:t.val)!="function"?null:t.val()||{}},me=()=>{const t=m().currentPost.postType;if(!t)return"";const a=x().dynamicOptions.searchAppearance.postTypes[t].customFields;if(!a||!ke)return"";const r=()=>{G(500)},o=a.replace(/\n/g,",").split(","),n=[],c=["INPUT","TEXTAREA","IMG"];o.forEach(u=>{u=u.trim();const l=document.getElementById(`${u}`)||{},f=document.querySelectorAll("#the-list > tr"),C=document.querySelectorAll(".acf-field");c.includes(l==null?void 0:l.tagName)&&!(l!=null&&l.closest(".acf-field"))?n.push(l):f.forEach(g=>{const h=g.querySelector(`#${g.id}-key`),y=g.querySelector(`#${g.id}-value`);c.includes(y==null?void 0:y.tagName)&&o.includes(h==null?void 0:h.value)&&n.push(y)}),C.forEach(g=>{var y;if(u!==g.dataset.name||g.dataset.type==="repeater"||(y=g.parentNode)!=null&&y.closest(".acf-repeater"))return"";let h=g.querySelector(`[id^="acf"][name$="[${g.dataset.key}]"]`);if(g.dataset.type==="image"&&(h=g.querySelector(".has-value img")),g.dataset.type==="gallery"&&(h=g.querySelector(".acf-gallery-attachment img")),g.dataset.type==="link"&&(h=Ke(g.dataset.key)||g.querySelector(`[name$="[${g.dataset.key}][url]"]`)||{},h={tagName:"INPUT",type:"url",value:(h==null?void 0:h.url)??(h==null?void 0:h.value)??""}),!h||h.type&&h.type==="hidden")return"";if(g.dataset.type==="wysiwyg"){const E=window.setInterval(()=>{var F,X;(X=(F=window.tinyMCE)==null?void 0:F.activeEditor)!=null&&X.acf&&(window.clearInterval(E),window.tinyMCE.activeEditor.on("keyup",function(){G(500)}),window.tinyMCE.activeEditor.on("PostProcess",function(){oe(()=>{G(500)},10)}))},50),Ae=function(F){F.forEach(X=>{var le;if(X.attributeName==="class"&&g.querySelector(".wp-editor-wrap.tmce-active")&&((le=window.tinyMCE)!=null&&le.activeEditor)){window.tinyMCE.activeEditor.on("keyup",function(){G(500)});const ae=g.querySelector(`[name="acf[${g.dataset.key}]"]`);ae&&(ae.addEventListener("keyup",()=>{G(500)}),ae.addEventListener("paste",()=>{G(500)}))}})},_e=new MutationObserver(Ae),ce=g.querySelector(".wp-editor-wrap");ce&&_e.observe(ce,{attributes:!0})}c.includes(h.tagName)&&n.push(h)})});let i="";return n.forEach(u=>{let l="";if(c.includes(u.tagName)&&typeof(u==null?void 0:u.addEventListener)=="function"&&u.addEventListener("keyup",r),u.value&&(l=u.value),u.tagName==="IMG"&&u.src){const f=u.alt?`alt="${u.alt}"`:"";l=`<img src="${u.src}" ${f}>`}u.value&&u.type&&u.type==="url"&&(l=`<a href="${l}">${l}</a>`),l&&(i+=`${l} `)}),i},je=(e,t=["INPUT","TEXTAREA","IMG"])=>{if(!e)return"";const s=document.getElementById(`${e}`),a=document.querySelectorAll("#the-list > tr"),r=document.querySelectorAll(".acf-field");let o="";if(s&&t.indexOf(s.tagName)!==-1&&(s.closest(".acf-field")||(o=s.tagName==="IMG"?s.getAttribute("src"):s.value)),a.length&&a.forEach(n=>{const c=n.querySelector(`#${n.id}-key`),i=n.querySelector(`#${n.id}-value`);i&&t.indexOf(i.tagName)!==-1&&c.value===e&&(o=i.tagName==="IMG"?i.getAttribute("src"):i.value)}),r.length){const n=[];r.forEach(c=>{var u;if(e!==c.dataset.name||c.dataset.type==="repeater"||(u=c.parentNode)!=null&&u.closest(".acf-repeater"))return;let i;t.forEach(l=>{const f=l.toLowerCase();i=c.querySelector(`[data-key="${c.dataset.key}"] ${f}`)||i}),i&&n.push(i.tagName==="IMG"?i.getAttribute("src"):i.value)}),o=n.join(" ")}return o},We=({separator:e})=>{const t=Re(e);return{parseTags:a=>{const r=S();return!a||!r.tags?a:(r.tags.forEach(o=>{if(o.id==="custom_field"){const u=new RegExp(`#${o.id}-([a-zA-Z0-9_-]+)`,"g"),l=a.match(u);l&&l.forEach(f=>{const C=new RegExp(`#${o.id}-([a-zA-Z0-9_-]+)`),g=f.match(C);g&&g[1]&&(a=a.replace(C,je(g[1])))});return}if(o.id==="tax_name"){const u=new RegExp(`#${o.id}-([a-zA-Z0-9_-]+)`,"g");a=a.replace(u,`[${o.name} - $1]`);return}const n=new RegExp(`#${o.id}(?![a-zA-Z0-9_])`,"g");o.id==="separator_sa"&&t.value!==void 0&&(a=a.replace(n,t.value));const c=a.match(n),i=r.liveTags[o.id]||o.value;c&&(a=a.replace(n,"%|%"+i))}),a=a.replace(/%\|%/g,""),ne(a))},separator:t}},He=()=>{const e=window.elementor.documents.getCurrent(),t=[];return e.$element?(e.$element.find(".elementor-widget-container").each((s,a)=>{const r=a.innerHTML.trim().replaceAll(/<p.*>(<img.*>)<\/p>/g,"$1");se(r)===""&&ie(r).length===0||t.push(r)}),t.join(" ")):""},K=()=>{var s;const{settings:e,config:t}=window.elementor;return{content:He(),title:e.page.model.get("post_title"),excerpt:e.page.model.get("post_excerpt")||"",slug:I(e.page.model.get("post_title")),permalink:t.document.urls.permalink||"",featuredImage:((s=e.page.model.get("post_featured_image"))==null?void 0:s.url)||""}},ze=()=>{const e=T(ET_Builder,"Frames.app.frameElement",document.querySelector("iframe#et-fb-app-frame"));if(!e)return document.createElement("div");let t=e.contentWindow.document.querySelectorAll("#et-fb-app");return 1<t.length&&(t=[...t].filter(s=>s.classList.contains("et-fb-root-ancestor"))),t[0]||document.createElement("div")},Ve=()=>{const e=[],t=ze().querySelectorAll(".et_pb_section"),s=new RegExp(["<style.*?</style>","\\[object Object\\]"].join("|"),"gi");for(const a of t){const r=a.innerHTML.replace(s,"").replaceAll(/<p.*>(<img.*>)<\/p>/g,"$1");se(r)===""&&ie(r).length===0||e.push(r)}return e.join(" ")},Ze=()=>{const e=new URL(T(ETBuilderBackendDynamic,"currentPage.permalink",""));return e.searchParams.delete("PageSpeed"),e.href},Fe=async()=>{const{wp:e}=window,t=T(ETBuilderBackendDynamic,"currentPage.thumbnailId",0);if(!e||t===0)return"";const s=e.media.attachment(t);let a="";return await s.fetch().then(()=>{a=s.get("url"),Ue(ETBuilderBackendDynamic,"currentPage.thumbnailUrl",a)}),a},j=()=>({content:Ve(),title:T(ETBuilderBackendDynamic,"postTitle",""),excerpt:T(ETBuilderBackendDynamic,"postMeta.post_excerpt",""),slug:T(ETBuilderBackendDynamic,"postMeta.post_name",""),permalink:Ze(),featuredImage:Fe()}),Xe=e=>{let t;switch(e.type){case"header":t=document.createElement(e.settings.tag),t.innerHTML=e.settings.headerTxt.trim();break;case"image":const s=document.createElement("img");e.settings.altTxt&&s.setAttribute("alt",e.settings.altTxt),e.settings.src&&s.setAttribute("src",e.settings.src),e.settings.noFollow&&s.setAttribute("rel","nofollow"),t=s,e.settings.link&&(t=document.createElement("a"),t.setAttribute("href",e.settings.link),t.innerHTML=s.outerHTML,e.settings.noFollow&&t.setAttribute("rel","nofollow"),e.settings.openNewWindow&&t.setAttribute("target","_blank"));break;case"video":e.settings.type==="youtube"?(t=document.createElement("iframe"),t.setAttribute("src",e.settings.youtubeUrl)):(t=document.createElement("div"),t.innerHTML=e.settings.code);break;case"text":t=document.createElement("div"),t.innerHTML=e.settings.txt.trim();break;case"button":t=document.createElement("a"),t.appendChild(document.createTextNode(e.settings.btnTxt+" "+e.settings.btnSubTxt)),e.settings.link&&t.setAttribute("href",e.settings.link),e.settings.altTxt&&t.setAttribute("alt",e.settings.altTxt),e.settings.src&&t.setAttribute("src",e.settings.src),e.settings.noFollow&&t.setAttribute("rel","nofollow"),e.settings.openNewWindow&&t.setAttribute("target","_blank");break;case"bullet-list":t=document.createElement("ul"),e.settings.items.forEach(a=>{const r=document.createElement("li");r.innerHTML=a.txt,t.appendChild(r)});break;case"custom-html":t=document.createElement("div"),t.innerHTML=e.settings.code;break}return t},Qe=()=>{const e=[];return JSON.parse(JSON.stringify(T(seedprod_data,"settings.document.sections",[]))).forEach(s=>{s.rows.forEach(a=>{a.cols.forEach(r=>{r.blocks.forEach(o=>{const n=Xe(o);n&&(se(n)===""&&ie(n).length===0||e.push(n.outerHTML))})})})}),e.join(" ")},Ye=()=>{const e=T(seedprod_data,"home_url",""),t=T(seedprod_data,"settings.post_name","");return`${e}/${t}/`},W=()=>({content:Qe(),title:T(seedprod_data,"settings.post_title",""),excerpt:"",slug:T(seedprod_data,"settings.post_name",""),permalink:Ye()}),et=()=>m().currentPost.processedContent,tt=e=>{var t;if(e==="admin_frontend_editor"){const{vc:s}=window;return s.builder.getTitle()}return((t=document.getElementById("#title"))==null?void 0:t.value)||""},st=e=>{var t;if(e==="admin_frontend_editor"){const{vc_iframe_src:s}=window,a=new URL(s).pathname.split("/").filter(r=>r);return a[a.length-1]}return((t=document.querySelector("#post_name"))==null?void 0:t.value)||""},at=e=>{var t;if(e==="admin_frontend_editor"){const{vc_iframe_src:s}=window;return s.replace(new URL(s).search,"")}return((t=document.querySelector("#sample-permalink a"))==null?void 0:t.href)||""},H=()=>{const{vc_mode:e}=window;return{content:et(),title:tt(e),excerpt:"",slug:st(e),permalink:at(e),featuredImage:""}},rt=()=>{var t;return((t=m().currentPost)==null?void 0:t.processedContent)||""},ot=()=>{var t;const{FusionApp:e}=window;return(e==null?void 0:e.getPost("post_title"))||((t=document.getElementById("#title"))==null?void 0:t.value)||""},nt=()=>{var t;const{FusionApp:e}=window;return(e==null?void 0:e.getPost("post_name"))||((t=document.querySelector("#post_name"))==null?void 0:t.value)||""},it=()=>{var t;const{FusionApp:e}=window;return(e==null?void 0:e.getPost("post_permalink").replace("?fb-edit=1",""))||((t=document.querySelector("#sample-permalink a"))==null?void 0:t.href)||""},ct=async()=>{const{wp:e,FusionApp:t}=window;if(!e||!t||!t.getDynamicPost("post_meta")._thumbnail_id)return"";const s=e.media.attachment(t.getDynamicPost("post_meta")._thumbnail_id);let a="";return await s.fetch().then(()=>{a=s.get("url")}),a},z=()=>({content:rt(),title:ot(),excerpt:"",slug:nt(),permalink:it(),featuredImage:ct()}),lt=()=>{let e="";const t=["p","a","img","caption","br","video","iframe","blockquote","cite","em","strong","i","b","q","h1","h2","h3","h4","h5","h6","ul","ol","li","table","tr","th","td"],s=function(r){var n;const o=te(r);if(o.querySelectorAll(".so-panel").length===0)return r;for(const c of o.querySelectorAll("iframe, script, style, link"))c.remove();return o.querySelectorAll("*").forEach(c=>{if(!t.includes(c.tagName.toLowerCase())){const i=Array.from(c.childNodes);c.replaceWith(...i)}}),((n=o.innerHTML)==null?void 0:n.replace(/[\t|\n]/gm," "))||""},{soPanelsBuilderView:a}=window;return a&&(Array.isArray(a)?a.forEach(function(r){e+=s(r.contentPreview)}):e=s(a.contentPreview)),e},V=()=>({content:lt(),title:"",excerpt:"",slug:"",permalink:"",featuredImage:""}),ut=()=>{var e,t;return((t=(e=TVE==null?void 0:TVE.Editor_Page)==null?void 0:e.content_manager)==null?void 0:t.get_clean_content())||""},pt=()=>{var e,t;return((t=(e=TVE==null?void 0:TVE.CONST)==null?void 0:e.post)==null?void 0:t.post_title)||""},dt=()=>{var e,t;return((t=(e=TVE==null?void 0:TVE.CONST)==null?void 0:e.post)==null?void 0:t.post_name)||""},mt=()=>{var e;return((e=TVE==null?void 0:TVE.CONST)==null?void 0:e.post_url)||""},gt=()=>{var t,s,a,r,o;const e=((a=(s=(t=TVE==null?void 0:TVE.CONST)==null?void 0:t.theme)==null?void 0:s.post_featured_image)==null?void 0:a.src)||((o=(r=TVE==null?void 0:TVE.CONST)==null?void 0:r.post_image)==null?void 0:o.featured)||"";return e.includes("inc/assets/images/featured_image.png")?"":e},Z=()=>({content:ut(),title:pt(),excerpt:"",slug:dt(),permalink:mt(),featuredImage:gt()}),ge=()=>{let e="";switch(!0){case M():e=K().slug;break;case J():e=j().slug;break;case U():e=W().slug;break;case R():e=H().slug;break;case B():e=z().slug;break;case L():e=V().slug;break;case D():e=Z().slug;break}return e},ht=()=>{const e=S();if(e.permalinkSlug)return e.permalinkSlug;let t="";if(N()||v()){const s=document.querySelector("#post_name");s&&(t=I(s.value))}return b()&&(t=window.wp.data.select("core/editor").getCurrentPost().slug),t||(t=ge()),t&&e.updatePermalinkSlug(t),t},he=()=>{var t,s;let e="";if(N()||v()){const r=((t=document.querySelector("#post_name"))==null?void 0:t.value)||((s=document.querySelector("#editable-post-name"))==null?void 0:s.textContent)||document.querySelector("#title").value;r&&(e=I(r))}if(b()&&(e=window.wp.data.select("core/editor").getEditedPostSlug()),M()){const a=window.elementor.settings.page.model.get("post_title");a&&(e=I(a))}return e||(e=ge()),e},ft=async(e=!0)=>{let t=ht();const s=he();if(t!==s){t=s;const a=m();if(S().updatePermalinkSlug(t),!e)return;new k().runAnalysis({postId:a.currentPost.id,postData:{...a.currentPost},content:_(),slug:O()})}},fe=()=>{let e="";switch(!0){case M():e=K().permalink;break;case J():e=j().permalink;break;case U():e=W().permalink;break;case R():e=H().permalink;break;case B():e=z().permalink;break;case L():e=V().permalink;break;case D():e=Z().permalink;break}return e},yt=()=>{const e=S();if(e.liveTags.permalink)return e.liveTags.permalink;let t;if(N()||v){const s=document.querySelector("#edit-slug-box a");s&&s.href&&(t=s.href)}return b()&&(t=window.wp.data.select("core/editor").getPermalink()),t||(t=fe()),t&&e.updatePermalink(t),t},O=()=>{let e;if(N()||v){const t=document.querySelector("#edit-slug-box a");t&&t.href&&(e=t.href.search(/preview=true/)?t.textContent:t.href)}if(b()){const t=window.wp.data.select("core/editor").getPermalinkParts();(t==null?void 0:t.postName)==="auto-draft"&&(t.postName=he()),e=`${t==null?void 0:t.prefix}${t==null?void 0:t.postName}${t==null?void 0:t.suffix}`}return e||(e=fe()),e},St=async(e=!0)=>{let t=yt();const s=O();if(t!==s&&(t=s,t)){const a=m();if(S().updatePermalink(t),!e)return;new k().runAnalysis({postId:a.currentPost.id,postData:{...a.currentPost},content:_(),slug:O()})}},wt=e=>{var a;const t=e.getBody()||{},s=(t==null?void 0:t.childNodes)||[];return 1<s.length?!1:s.length===0?!0:1<((a=s[0])==null?void 0:a.childNodes.length)?!1:/^\n?$/.test((t==null?void 0:t.innerText)||(t==null?void 0:t.textContent)||"")},ye=/base64,(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)/g,Se=["acf","aioseo","core"],we=()=>{let e="";switch(!0){case M():e=K().content;break;case J():e=j().content;break;case U():e=W().content;break;case R():e=H().content;break;case B():e=z().content;break;case L():e=V().content;break;case D():e=Z().content;break}return e},be=e=>{var a;if(!e.includes('<!-- wp:block {"ref":'))return e;const t=(a=window.wp.blocks)==null?void 0:a.rawHandler({HTML:e});return Be(t).forEach(r=>{var o,n,c;if(r.name==="core/block"){const i=window.wp.data.select("core").getEntityRecord("postType","wp_block",(o=r.attributes)==null?void 0:o.ref);(n=i==null?void 0:i.content)!=null&&n.raw&&(e=e.replace(`<!-- wp:block {"ref":${(c=r.attributes)==null?void 0:c.ref}} /-->`,i.content.raw))}}),e},Ee=(e,t)=>(window.wp.data.select("core/block-editor").getBlocks().forEach(a=>{const[r,o]=a.name.split("/");if(t.includes(r)){if(r==="core"&&o!=="table")return;const n=document.getElementById("block-"+a.clientId);if(n&&n.innerText){const c=r==="core"?o:a.name,i=`<!-- wp:${c}.*?/wp:${c} -->|<!-- wp:${c}.*?/-->`;e=e.replace(new RegExp(i,"s"),n.innerText)}}}),e),Pe=()=>{const e=S();if(e.liveTags.post_content)return e.liveTags.post_content;let t="";if(N()&&!Q())if(window.tinyMCE||document.querySelector("#wp-content-wrap.html-active"))t=Y();else{const a=window.setInterval(()=>{window.tinyMCE&&(window.clearInterval(a),t=Y())},50)}return b()&&(t=window.wp.data.select("core/editor").getCurrentPost().content||"",t=be(t),t=Ee(t,Se)),Q()&&(t=we()),m().currentPost.descriptionIncludeCustomFields&&(t=t+me()),t=t.replace(ye,""),t&&e.updatePostContent(t),t},_=(e=!1)=>{let t="";if(N()&&!Q())if(window.tinyMCE||document.querySelector("#wp-content-wrap.html-active"))t=Y();else{const a=window.setInterval(()=>{window.tinyMCE&&(window.clearInterval(a),t=Y())},50)}b()&&(t=window.wp.data.select("core/editor").getEditedPostContent(),t=be(t),t=Ee(t,Se)),Q()&&(t=we());const s=m();return!e&&s.currentPost.descriptionIncludeCustomFields&&(t=t+me()),t=t.replace(ye,""),t},bt=async(e=!0)=>{let t=Pe();const s=_();if(t!==s){t=s;const a=m();if(S().updatePostContent(t),!e)return;new k().runAnalysis({postId:a.currentPost.id,postData:{...a.currentPost},content:_(),slug:O()})}},Y=()=>{let e;const t=window.tinyMCE?window.tinyMCE.get("content"):"";if(document.querySelector("#wp-content-wrap.tmce-active")&&t)e=t.getContent({format:wt(t)?"html":"raw"});else{const s=document.querySelector("textarea#content");e=s?s.value:""}return e};function Et(e){return new Worker(""+window.__aioseoDynamicImportPreload__("main-DPlEio9K.js"),{name:e==null?void 0:e.name})}class k{constructor(){P(this,"postId",null);P(this,"postTitle",null);P(this,"postParsedTitle",null);P(this,"postParsedDescription",null);P(this,"postDescription",null);P(this,"keyphrases",null);P(this,"postContent",null);P(this,"postSlug",null);P(this,"isAnalyzing",!1);P(this,"worker",null)}async runAnalysis({postId:t,postData:s,content:a=_(),slug:r=O()}){var y;const o=m(),n=x();if(s=s||{...o.currentPost},!((y=n.options.advanced)!=null&&y.truSeo)||!o.currentPost.page_analysis||this.isAnalyzing)return;this.worker&&this.worker.terminate();const c={separator:ne(n.options.searchAppearance.global.separator)},{parseTags:i}=We({separator:c.separator}),u=ee(),l=S(),f=l.tags.map(E=>l.liveTags[E.id]!==void 0&&E.value!==l.liveTags[E.id]?{...E,value:l.liveTags[E.id]}:E),C={...re(u.aioseo),tags:re(f),currentPost:re(o.currentPost)},g=JSON.parse(JSON.stringify({postId:t,postData:s,content:a,aioseo:C,slug:r,aioseoGlobals:c,postEditedTitle:Ne(),postTitle:s.title||s.metaDefaults.title||"#post_title",postParsedTitle:i(s.title||s.metaDefaults.title||"#post_title"),postDescription:s.description||s.metaDefaults.description,postParsedDescription:i(s.description||s.metaDefaults.description)}));let h=[];this.worker=new Et,this.worker.addEventListener("message",E=>{E.data.event==="tru-seo-analysis-complete"&&(h=E.data.analysis,this.dispatchActions(h,g),this.worker.terminate())}),this.worker.postMessage({event:"tru-seo-analysis",analysisData:g})}setSidebarButtonScore(t){const s=document.getElementById("aioseo-post-settings-sidebar-button"),a=document.getElementById("aioseo-post-score");!s||!a||(s.className=80<t?"score-green":50<t?"score-orange":"score-red",b()||(s.classList.add("aioseo-score-button","classic-editor"),t=`${t}/100`),a.textContent=t)}dispatchActions(t,s){const a=m();t.forEach(r=>{r.action==="updateState"&&s.postEditedTitle&&ke()&&this.setSidebarButtonScore(r.data.seo_score),a[r.action](r.data)})}}const Te=()=>{let e="";switch(!0){case M():e=K().title;break;case J():e=j().title;break;case U():e=W().title;break;case R():e=H().title;break;case B():e=z().title;break;case L():e=V().title;break;case D():e=Z().title;break}return e},Pt=()=>{const e=S();if(e.liveTags.post_title)return e.liveTags.post_title;let t;if(N()||v()){const s=document.querySelector("#post input#title");t=s?s.value:""}return b()&&(t=window.wp.data.select("core/editor").getCurrentPost().title),t||(t=Te()),t&&e.updatePostTitle(t),t},Ne=()=>{let e;if(N()||v()){const t=document.querySelector("#post input#title");e=t?t.value:""}return b()&&(e=window.wp.data.select("core/editor").getEditedPostAttribute("title")),e||(e=Te()),e},Tt=async(e=!0)=>{let t=Pt();const s=Ne();if(t!==s){t=s;const a=m();if(S().updatePostTitle(t),!e)return;new k().runAnalysis({postId:a.currentPost.id,postData:{...a.currentPost},content:_(),slug:O()})}},xe=e=>e?(e=e.replaceAll(/\n\n/g," "),e=se(e,!1,"innerText"),e=e.replace(/\[.*?]/g,""),e.trim()):"",Ce=()=>{let e="";switch(!0){case M():e=K().excerpt;break;case J():e=j().excerpt;break;case U():e=W().excerpt;break;case R():e=H().excerpt;break;case B():e=z().excerpt;break;case L():e=V().excerpt;break;case D():e=Z().excerpt;break}return e},Nt=()=>{const e=S();if(e.liveTags.post_excerpt)return e.liveTags.post_excerpt;let t;return(N()||v())&&(t=ve()),b()&&(t=window.wp.data.select("core/editor").getCurrentPost().excerpt),t||(t=Ce()),t||(t=xe(Pe())),t&&e.updatePostExcerpt(t),t},xt=()=>{let e;return(N()||v())&&(e=ve()),b()&&(e=window.wp.data.select("core/editor").getEditedPostAttribute("excerpt")),e||(e=Ce()),e||(e=xe(_())),e},Ct=async(e=!0)=>{let t=Nt();const s=xt();if(t!==s){t=s;const a=m();if(S().updatePostExcerpt(t),!e)return;new k().runAnalysis({postId:a.currentPost.id,postData:{...a.currentPost},content:_(),slug:O()})}},ve=()=>{let e="";const t=document.querySelector("#postexcerpt textarea#excerpt");if(e=t?t.value:"",document.querySelector("#wp-excerpt-wrap.tmce-active")){const s=window.tinyMCE?window.tinyMCE.get("excerpt"):"";s&&(e=s.getContent({format:"raw"}))}return e};let w="",A="";const vt=(e=!0)=>{var a,r,o,n,c,i,u;const t=S(),s=m();if(N()||v()){const l=document.querySelectorAll('#post input[name="post_category[]"]:checked');if(l.length){if((r=(a=s==null?void 0:s.currentPost)==null?void 0:a.primary_term)!=null&&r.category){const f=document.querySelector(`#categorychecklist input[value="${s.currentPost.primary_term.category}"]`);(o=f==null?void 0:f.parentNode)!=null&&o.innerText&&(w=f.parentNode.innerText,t.updateTaxonomyTitle(w))}else w!==l[0].parentNode.innerText&&(w=l[0].parentNode.innerText,t.updateTaxonomyTitle(l[0].parentNode.innerText));A=Array.from(l).map(f=>f.parentNode.innerText).join(", "),t.updateCategories(A)}else w!==""&&(w=A="",t.updateTaxonomyTitle(w),t.updateCategories(A))}if(b()){let l=[],f=[];const C=ee();if(((n=C.aioseo.user.data.allcaps)!=null&&n.manageCategories||(c=C.aioseo.user.data.allcaps)!=null&&c.manage_categories)&&(l=window.wp.data.select("core").getEntityRecords("taxonomy","category"),f=window.wp.data.select("core/editor").getEditedPostAttribute("categories")),f&&f.length&&l){const g=((u=(i=s==null?void 0:s.currentPost)==null?void 0:i.primary_term)==null?void 0:u.category)||f[0],h=l.find(y=>y.id===g);h&&w!==h.name&&(w=h.name,t.updateTaxonomyTitle(w)),A=l.filter(y=>f.includes(y.id)).map(y=>y.name).join(", "),t.updateCategories(A)}else w!==""&&(w=A="",t.updateTaxonomyTitle(w),t.updateCategories(A))}e&&new k().runAnalysis({postId:s.currentPost.id})},kt=(e=!1)=>{const t=m();if(t.currentPost.context!=="term")return;const s=S(),a=document.querySelector("#edittag input#name");a&&(s.updateTaxonomyTitle(a.value),a.addEventListener("input",()=>{s.updateTaxonomyTitle(a.value)}));const r=document.querySelector("#edittag textarea#description");r&&(s.updateTaxonomyDescription(r.value),r.addEventListener("input",()=>{s.updateTaxonomyDescription(r.value)}));const o=document.querySelector("#edittag input#slug");if(o){const n=I(o.value);s.updatePermalinkSlug(n),s.updatePermalink(t.currentPost.permalink.replace(`/${s.permalinkSlug}`,`/${n.replace(/ /gi,"-").replace(/[^a-z0-9-]/gi,"").toLowerCase()}`)),o.addEventListener("input",()=>{s.updatePermalinkSlug(n),s.updatePermalink(t.currentPost.permalink.replace(`/${s.permalinkSlug}`,`/${n.replace(/ /gi,"-").replace(/[^a-z0-9-]/gi,"").toLowerCase()}`))})}t.savePostState(),e&&k.runAnalysis({postId:t.currentPost.id})},At=(e=!1)=>{const t=m();if(t.currentPost.postType!=="attachment")return;const s=S(),a=document.querySelector("textarea#attachment_caption");a&&(s.updateAttachmentCaption(a.value),a.addEventListener("input",i=>{s.updateAttachmentCaption(i.target.value)}));const r=document.querySelector("textarea#attachment-details-caption");r&&(s.updateAttachmentCaption(r.value),r.addEventListener("input",i=>{s.updateAttachmentCaption(i.target.value)}));const o=document.querySelector("textarea#attachment_content");o&&(s.updateAttachmentDescription(o.value),o.addEventListener("input",i=>{s.updateAttachmentDescription(i.target.value)}));const n=document.querySelector("input#attachment_alt");n&&(s.updateAltTag(n.value),n.addEventListener("input",i=>{s.updateAltTag(i.target.value)}));const c=document.querySelector("input#attachment-details-alt-text");c&&(s.updateAltTag(n.value),c.addEventListener("input",i=>{s.updateAltTag(i.target.value)})),e&&new k().runAnalysis({postId:t.currentPost.id})},ke=()=>{var t,s;const e=m();return(t=e==null?void 0:e.currentPost)!=null&&t.id&&!!((s=e.currentPost)!=null&&s.isTruSeoEligible)||!1},zt=()=>{var a,r,o;const e=ee();if(!((a=e.aioseo.screen)!=null&&a.postType)||((r=e.aioseo.screen)==null?void 0:r.postType)==="web-story")return!1;const t=m();return!!((o=x().options.advanced)!=null&&o.truSeo&&De(e.aioseo.screen.postType)&&!t.currentPost.isStaticPostsPage)},G=async(e=900,t=!0)=>{oe(async()=>{const s=de(),a=m();await Tt(!1),await bt(!1),await Ct(!1),await ft(!1),await St(!1),vt(!1),kt(!1),At(!1),oe(s.updateSchemaOutput,Math.max(e*2,1800)),t&&new k().runAnalysis({postId:a.currentPost.id})},e)},Vt=e=>{const t=e.getRangeAt(0),s=t.cloneRange();return s.collapse(!1),e.removeAllRanges(),e.addRange(s),e.extend(t.startContainer,t.startOffset),e},Zt=e=>{const t=new RegExp(" ","g");return e.replace(/ /g," ").replace(t," ")},Ft=({element:e,property:t,value:s})=>{if(!e)return document.documentElement;let a=e.parentElement;for(;a;){if(a.isEqualNode(document.documentElement)||s===document.defaultView.getComputedStyle(a).getPropertyValue(t))return a;a=a.parentElement}},Xt=()=>{const e=document.createElement("div");return e.classList.add("aioseo-app"),e.style.position="absolute",e.style.zIndex="999",e.style.display="flex",e.setAttribute("tabindex",-1),e};export{Zt as A,Ut as B,Ft as C,Vt as D,Xt as E,Je as F,k as T,We as a,K as b,j as c,z as d,Z as e,je as f,se as g,_ as h,vt as i,ke as j,kt as k,At as l,G as m,Ne as n,Nt as o,Kt as p,H as q,zt as r,Ue as s,Jt as t,de as u,V as v,Wt as w,jt as x,Ht as y,he as z};