import{x as m,o as f,c as w,H as c,a as p,J as g,b as T,Y as S}from"./js/runtime-dom.esm-bundler.5d5e6b71.js";import{l as x}from"./js/index.7c01c5f2.js";import{l as E}from"./js/index.eb92a2a8.js";import{l as $}from"./js/index.d80c2c2c.js";import{F as k,b as v,i as b,I as P,J as B,l as _,X as A}from"./js/index.bd66e758.js";import{e as C}from"./js/elemLoaded.2921fc72.js";import{g as L,t as M,a as H}from"./js/helpers.1c7f32fa.js";import{S as N}from"./js/Information.3b2ed489.js";import{b as I}from"./js/Caret.382b7591.js";import"./js/translations.d159963e.js";import{_ as h}from"./js/_plugin-vue_export-helper.eefbdd86.js";import{s as d,_ as l}from"./js/default-i18n.20001971.js";import"./js/helpers.bf0d86e6.js";const u="all-in-one-seo-pack",U={setup(){return{postEditorStore:k()}},components:{SvgCircleInformation:N,SvgClose:I},props:{taxonomy:String},data(){return{selectedTerms:[],strings:{didYouKnow:d(l("Did you know that %1$s Pro allows you to choose a %2$sprimary category%3$s for your posts? This feature works hand in hand with our powerful Breadcrumbs template to give you full navigational control to help improve your search rankings!",u),"AIOSEO","<strong>","</strong>"),learnMoreLink:d('<a href="%1$s" target="_blank" rel="noreferrer nofollow">%2$s<span class="link-right-arrow">&nbsp;&rarr;</span></a>',v.getDocUrl("primaryTerm"),l("Learn more",u))}}},computed:{canShowUpsell(){const{options:o}=this.postEditorStore.currentPost;return!o.primaryTerm.productEducationDismissed&&1<this.selectedTerms.length}},methods:{updateSelectedTerms(){this.selectedTerms=L(this.taxonomy)}},mounted(){this.updateSelectedTerms(),window.aioseoBus.$on("updateSelectedTerms",this.updateSelectedTerms)},beforeUnmount(){window.aioseoBus.$off("updateSelectedTerms",this.updateSelectedTerms)}},V={key:0,class:"aioseo-primary-term-cta"},D=["innerHTML"],F=["innerHTML"];function Y(o,t,e,s,r,i){const n=m("svg-circle-information"),a=m("svg-close");return i.canShowUpsell?(f(),w("div",V,[c(n,{width:"15",height:"15"}),p("p",{innerHTML:r.strings.didYouKnow},null,8,D),p("p",{innerHTML:r.strings.learnMoreLink},null,8,F),c(a,{onClick:g(s.postEditorStore.disablePrimaryTermEducation,["stop"])},null,8,["onClick"])])):T("",!0)}const J=h(U,[["render",Y]]),K={components:{PrimaryTerm:J},props:{taxonomy:String}},O={class:"aioseo-app aioseo-primary-term"};function j(o,t,e,s,r,i){const n=m("primary-term");return f(),w("div",O,[c(n,{taxonomy:e.taxonomy},null,8,["taxonomy"])])}const q=h(K,[["render",j]]);if(b()&&window.wp){const{createElement:o,Fragment:t}=window.wp.element,{addFilter:e}=window.wp.hooks,{createHigherOrderComponent:s}=window.wp.compose,{subscribe:r}=window.wp.data;e("editor.PostTaxonomyType","aioseo/primary-term",s(i=>n=>{const{slug:a}=n;return M(a)?o(t,{},o(i,n),o("div",{id:`aioseo-primary-term-${a}`},o("div",{className:"aioseo-primary-term-app",taxonomy:a}))):o(i,n)},"withInspectorControls")),r(()=>{window.aioseoBus.$emit("updateSelectedTerms")})}(P()||B())&&(_(),H().forEach(o=>{var s;const t=(s=document.getElementById(`${o.name}div`))==null?void 0:s.querySelector(".inside");if(!t)return;const e=document.createElement("div");e.setAttribute("id",`aioseo-primary-term-${o.name}`),e.setAttribute("class","aioseo-primary-term-app"),e.setAttribute("taxonomy",o.name),t.append(e),function(r){r(`#${o.name}checklist`).on("change",'input[type="checkbox"]',()=>{window.aioseoBus.$emit("updateSelectedTerms")}),r(`#${o.name}checklist`).on("wpListAddEnd",()=>{window.aioseoBus.$emit("updateSelectedTerms")})}(window.jQuery)}));const y=o=>{if(!o)return;const t=o.getAttribute("taxonomy");let e=S({...q,name:"Standalone/PrimaryTerm"},{taxonomy:t});e=x(e),e=E(e),e=$(e),_(e),e.mount(o)};if(A()&&window.aioseo&&window.aioseo.currentPost&&window.aioseo.currentPost.context==="post"){const o=document.getElementsByClassName("aioseo-primary-term-app");Array.prototype.forEach.call(o,t=>y(t)),C(".aioseo-primary-term-app","aioseoPrimaryTerm"),document.addEventListener("animationstart",function(t){t.animationName==="aioseoPrimaryTerm"&&y(t.target)},{passive:!0})}
