yoastWebpackJsonp([13],{2156:function(e,r,t){"use strict";var n=t(370);!function(e){function r(r){return 1===e(r).closest("li").children(".wpseo-make-primary-term").length}function t(r){var t;return t=e("#yoast-wpseo-primary-"+r),t.val()}function a(r){var t=e("#category-all").find("#category-"+r+" > label");if(0===t.length)return"";var n=t.clone();return n.children().remove(),e.trim(n.text())}function o(r,t){e("#yoast-wpseo-primary-"+r).val(t).trigger("change");var o=(0,n.dispatch)("yoast-seo/editor");if(o){var i=parseInt(t,10);o.setPrimaryTaxonomyId(r,i),"category"===r&&o.updateReplacementVariable("primary_category",a(i))}}function i(r,t){var n,a;n=e(t).closest("label"),a=y({taxonomy:d[r],term:n.text()}),n.after(a)}function c(n){var a,o,c;a=e("#"+n+'checklist input[type="checkbox"]:checked');var s=e("#"+n+"checklist li");s.removeClass("wpseo-term-unchecked wpseo-primary-term wpseo-non-primary-term"),e(".wpseo-primary-category-label").remove(),s.addClass("wpseo-term-unchecked"),a.length<=1||a.each(function(a,s){s=e(s),o=s.closest("li"),o.removeClass("wpseo-term-unchecked"),r(s)||i(n,s),s.val()===t(n)?(o.addClass("wpseo-primary-term"),c=s.closest("label"),c.find(".wpseo-primary-category-label").remove(),c.append(f({taxonomy:d[n]}))):o.addClass("wpseo-non-primary-term")})}function s(r){o(r,e("#"+r+'checklist input[type="checkbox"]:checked:first').val()),c(r)}function p(e){""===t(e)&&s(e)}function l(r){return function(){!1===e(this).prop("checked")&&e(this).val()===t(r)&&s(r),p(r),c(r)}}function m(e){return function(){p(e),c(e)}}function u(r){return function(t){var n,a;n=e(t.currentTarget),a=n.siblings("label").find("input"),o(r,a.val()),c(r),a.focus()}}var y,f,d=wpseoPrimaryCategoryL10n.taxonomies;e.fn.initYstSEOPrimaryCategory=function(){return this.each(function(r,t){var n=e("#"+t.name+"div");c(t.name),n.on("click",'input[type="checkbox"]',l(t.name)),n.on("wpListAddEnd","#"+t.name+"checklist",m(t.name)),n.on("click",".wpseo-make-primary-term",u(t.name))})},e(function(){y=wp.template("primary-term-ui"),f=wp.template("primary-term-screen-reader"),e(_.values(d)).initYstSEOPrimaryCategory()})}(jQuery)},370:function(e,r){e.exports=window.yoast._wp.data}},[2156]);