(()=>{"use strict";function e(e,t){let r=t(".betterdocs-category-grid-inner-wrapper.masonry",e);if(0!=r?.length){var a=window.matchMedia("(max-width: 767px)"),n=window.matchMedia("(max-width: 1024px)");r.each((e,t)=>{var r;let o=0,c=0;switch(!0){case a.matches:o=t.getAttribute("data-column_mobile"),c=t.getAttribute("data-column_space_mobile");break;case n.matches:o=t.getAttribute("data-column_tab"),c=t.getAttribute("data-column_space_tab");break;default:o=t.getAttribute("data-column_desktop"),c=null!==(r=t.getAttribute("data-column_space_desktop"))&&void 0!==r?r:15}c=parseInt(c),o=parseInt(o);let i=t.querySelectorAll(".betterdocs-single-category-wrapper"),s=(o-1)*c;t&&(i.forEach(e=>{e.style.width=`calc((100% - ${s}px) / ${o})`}),new Masonry(t,{itemSelector:".betterdocs-single-category-wrapper",percentPosition:!0,gutter:c}))})}else(t(".betterdocs-single-category-wrapper",e)||[]).each((e,t)=>{t.removeAttribute("style")})}var t;Object.defineProperty(e,"name",{value:"default",configurable:!0}),(t=jQuery)(document).ready(function(){document.querySelectorAll(".betterdocs-category-grid-inner-wrapper.masonry").forEach(r=>{e(r.parentElement,t)}),1!=betterdocsCategoryGridConfig?.is_betterdocs_templates&&(t(".betterdocs-category-grid-inner-wrapper .betterdocs-single-category-wrapper .betterdocs-category-link-btn").on("click",function(e){let r=t(t(t(t(this)?.parent())?.parent())?.parent())?.parent(),a=t(r).attr("data-mkb-slug");if(a?.length>0){var n=new Date,o=n.setDate(n.getDate()+30).toString();document.cookie=`last_knowledge_base=${a}; expires=${o}; path=/;`}}),t(".betterdocs-category-grid-inner-wrapper .betterdocs-single-category-wrapper .betterdocs-body .betterdocs-articles-list li a").on("click",function(e){let r=t(t(t(t(t(t(this).parent()).parent()).parent()).parent()).parent()).parent(),a=t(r).attr("data-mkb-slug");if(a?.length>0){var n=new Date,o=n.setDate(n.getDate()+30).toString();document.cookie=`last_knowledge_base=${a}; expires=${o}; path=/;`}}))})})();