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.c4caba60.js";import{l as x}from"./js/index.7c01c5f2.js";import{l as E}from"./js/index.f3c7a985.js";import{l as $}from"./js/index.d80c2c2c.js";import{e as k,a as v,i as P,y as b,z as B,l as _}from"./js/index.21ff19c6.js";import{e as A}from"./js/elemLoaded.2921fc72.js";import{s as C}from"./js/metabox.c14c3439.js";import{g as L,t as M,a as H}from"./js/helpers.d88590df.js";import{S as N}from"./js/Information.efebd14c.js";import{b as U}from"./js/Caret.cc16468c.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.a0b389be.js";const u="all-in-one-seo-pack",I={setup(){return{postEditorStore:k()}},components:{SvgCircleInformation:N,SvgClose:U},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"],Y=["innerHTML"];function F(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,Y),c(a,{onClick:g(s.postEditorStore.disablePrimaryTermEducation,["stop"])},null,8,["onClick"])])):T("",!0)}const K=h(I,[["render",F]]),O={components:{PrimaryTerm:K},props:{taxonomy:String}},j={class:"aioseo-app aioseo-primary-term"};function q(o,t,e,s,r,i){const n=m("primary-term");return f(),w("div",j,[c(n,{taxonomy:e.taxonomy},null,8,["taxonomy"])])}const z=h(O,[["render",q]]);if(P()&&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")})}(b()||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({...z,name:"Standalone/PrimaryTerm"},{taxonomy:t});e=x(e),e=E(e),e=$(e),_(e),e.mount(o)};if(C()&&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)),A(".aioseo-primary-term-app","aioseoPrimaryTerm"),document.addEventListener("animationstart",function(t){t.animationName==="aioseoPrimaryTerm"&&y(t.target)},{passive:!0})}
