import{as as m,f,i as w,a0 as c,j as p,T as g,M as T,ap as S}from"./js/vendor-vue-ui.02763c14.js";import{l as x}from"./js/index.01468dbf.js";import{l as E}from"./js/index.aa890c6d.js";import{l as $}from"./js/index.0d80c2c2.js";import{d as k,u as v,j as P,Y as B,Z as b,l as _,an as A,p as C}from"./js/app-core.82d0a9b8.js";import{g as L,t as M,a as N}from"./js/helpers.e70f7eb8.js";import{S as H}from"./js/Information.994a9b26.js";import{S as U}from"./js/Close.ed64f0a2.js";import{_ as h}from"./js/_plugin-vue_export-helper.eefbdd86.js";import{a as d,_ as l}from"./js/vendor-other.2cdd5822.js";import"./js/Button.b03184b6.js";import"./js/Input.07427c66.js";import"./js/Index.ab3a7ebe.js";import"./js/Pencil.b091de6b.js";import"./js/Trash.9c01fca5.js";import"./js/Select.30909b5d.js";import"./js/Caret.1dd03f59.js";import"./js/Toggle.a8bd36f4.js";import"./js/vendor-datetime.430013a3.js";import"./js/vendor-lodash.f9514987.js";const u="all-in-one-seo-pack",I={setup(){return{postEditorStore:v()}},components:{SvgCircleInformation:H,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>',k.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"},j=["innerHTML"],D=["innerHTML"];function Y(o,t,e,r,n,i){const s=m("svg-circle-information"),a=m("svg-close");return i.canShowUpsell?(f(),w("div",V,[c(s,{width:"15",height:"15"}),p("p",{innerHTML:n.strings.didYouKnow},null,8,j),p("p",{innerHTML:n.strings.learnMoreLink},null,8,D),c(a,{onClick:g(r.postEditorStore.disablePrimaryTermEducation,["stop"])},null,8,["onClick"])])):T("",!0)}const F=h(I,[["render",Y]]),K={components:{PrimaryTerm:F},props:{taxonomy:String}},O={class:"aioseo-app aioseo-primary-term"};function q(o,t,e,r,n,i){const s=m("primary-term");return f(),w("div",O,[c(s,{taxonomy:e.taxonomy},null,8,["taxonomy"])])}const Q=h(K,[["render",q]]);if(P()&&window.wp){const{createElement:o,Fragment:t}=window.wp.element,{addFilter:e}=window.wp.hooks,{createHigherOrderComponent:r}=window.wp.compose,{subscribe:n}=window.wp.data;e("editor.PostTaxonomyType","aioseo/primary-term",r(i=>s=>{const{slug:a}=s;return M(a)?o(t,{},o(i,s),o("div",{id:`aioseo-primary-term-${a}`},o("div",{className:"aioseo-primary-term-app",taxonomy:a}))):o(i,s)},"withInspectorControls")),n(()=>{window.aioseoBus.$emit("updateSelectedTerms")})}(B()||b())&&(_(),N().forEach(o=>{const t=document.getElementById(`${o.name}div`)?.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})}
