"use strict";(self.blocksyJsonP=self.blocksyJsonP||[]).push([[142],{7142:function(t,e,n){n.r(e),n.d(e,{mountMenuLevel:function(){return h}});var i=n(3846),r=n(9257);const s=function(){return"rtl"===document.querySelector("html").dir},o=function(t){return t.className.includes("animated-submenu")&&(!t.parentNode.classList.contains("menu")||-1===t.className.indexOf("ct-mega-menu")&&t.parentNode.classList.contains("menu"))};const c=function(t,e){const n=[];for(;t.parentNode!==e;)n.push(t.parentNode),t=t.parentNode;return n},a=function(t){return s()?"left"===t?"right":"right"===t?"left":t:t},u=function(t){let e=function(t,e){for(var n=[];t.parentNode;)t.parentNode&&t.parentNode.matches&&t.parentNode.matches(e)&&n.push(t.parentNode),t=t.parentNode;return n[n.length-1]}(t,"li.menu-item");if(!e)return a("right");const n=[...e.querySelectorAll(".sub-menu")].map((function(t){return{el:t,parents:c(t,e)}}));if(0===n.length)return a("right");const i=n.sort((function(t,e){return t.parents.length-e.parents.length})).reverse()[0],r=[...i.parents.filter((function(t){return t.matches(".sub-menu")})),i.el],o=r.reduce((function(t,e,n){const i=getComputedStyle(e);return t+e.getBoundingClientRect().width+(0===n?0:parseFloat(i.getPropertyValue("--dropdown-horizontal-offset")||"5px"))}),0),u=e.getBoundingClientRect();if(s()){return oo;return e.matches(".animated-submenu-inline")&&(l=innerWidth-u.left-u.width>o),l?"right":"left"},l=function(t){const e=t.target.closest("li");e.classList.add("ct-active");let n=[...e.children].find((function(t){return t.matches(".ct-toggle-dropdown-desktop-ghost")}));if(n||(n=e.firstElementChild),n&&(n.setAttribute("aria-expanded","true"),"button"===n.tagName.toLowerCase()&&n.setAttribute("aria-label",ct_localizations.collapse_submenu)),!o(e))return;const i=e.querySelector(".sub-menu");h(i),i.closest('[data-interaction="hover"]')&&i.parentNode.addEventListener("mouseleave",(function(){[...i.children].filter((function(t){return o(t)})).map((function(t){return t.removeAttribute("data-submenu")}))}),{once:!0})},d=function(t){if(!t.target)return;const e=t.target.closest("li");e.classList.remove("ct-active");let n=[...e.children].find((function(t){return t.matches(".ct-toggle-dropdown-desktop-ghost")}));n||(n=e.firstElementChild),n&&(n.setAttribute("aria-expanded","false"),"button"===n.tagName.toLowerCase()&&n.setAttribute("aria-label",ct_localizations.expand_submenu),t.focusOnIndicator&&n.focus({focusVisible:!0})),setTimeout((function(){[...e.querySelectorAll("[data-submenu]")].map((function(t){t.removeAttribute("data-submenu")})),[...e.querySelectorAll(".ct-active")].map((function(t){t.classList.remove("ct-active")}))}),30)},f=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.classList.contains("ct-mega-menu-custom-width")){const e=t.querySelector(".sub-menu"),n=t.getBoundingClientRect(),i=e.getBoundingClientRect();if(!(n.left+n.width/2>i.width/2&&innerWidth-(n.left+n.width/2)>i.width/2)){const r=u(e);let s=0,o=15;"right"===r&&(s=-1*Math.round(n.left-(innerWidth-i.width)+o)+"px",n.left+n.width/2>i.width/2||(s=-1*Math.round(n.left-o)+"px")),"left"===r&&(s=-1*Math.round(innerWidth-n.right-o)+"px"),t.dataset.submenu=r,e.style.setProperty("--theme-submenu-inline-offset",s)}}if(o(t)&&function(t,e){let{startPosition:n="end"}=e;const i=t.querySelector(".sub-menu"),r=u(i),{left:s,width:o,right:c}=i.getBoundingClientRect();let a=r,l=t.getBoundingClientRect();"left"===r&&("end"===n?l.left:l.right)-o<0&&(a="right");"right"===r&&("end"===n?l.right:l.left)+o>innerWidth&&(a="left");t.dataset.submenu=a,t.addEventListener("click",(function(){}))}(t,e),t.hasSubmenuEventListeners)return;t.hasSubmenuEventListeners=!0;let n=t.matches('[data-interaction*="click"] *');if(t.addEventListener("keydown",(function(e){27==e.keyCode&&d({target:t.firstElementChild,focusOnIndicator:!0})})),t.addEventListener("focusout",(function(e){t.contains(e.relatedTarget)||d({target:t.firstElementChild})})),n||(t.addEventListener("mouseenter",(function(e){(0,r.O)()?l({target:t.firstElementChild}):requestAnimationFrame((function(){l({target:t.firstElementChild})})),t.parentNode.classList.contains(".sub-menu")||[...t.parentNode.children].filter((function(e){return e!==t})).map((function(t){d({target:t.firstElementChild})})),e.target.closest("li").addEventListener("mouseleave",(function(){d({target:t.firstElementChild})}),{once:!0})})),(0,i.b)()&&t.addEventListener("click",(function(e){t.classList.contains("ct-active")||e.preventDefault()}))),n){(t.matches('[data-interaction*="item"] *')?t.firstElementChild:t.firstElementChild.querySelector(".ct-toggle-dropdown-desktop")).addEventListener("click",(function(e){e.preventDefault(),e.target.closest("li").classList.contains("ct-active")?d(e):(l(e),(0,r.O)()&&e.target.closest("li").addEventListener("mouseleave",(function(){d({target:t.firstElementChild})}),{once:!0}),e.target.hasDocumentListener||(e.target.hasDocumentListener=!0,setTimeout((function(){document.addEventListener("click",(function(t){e.target.closest("li").contains(t.target)||d(e)}))}))))}))}let s=[...t.children].find((function(t){return t.matches(".ct-toggle-dropdown-desktop-ghost")}));s&&s.addEventListener("click",(function(t){t.target.closest("li").classList.contains("ct-active")?d(t):l(t)}))},h=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};[...t.children].filter((function(t){return t.matches(".menu-item-has-children, .page_item_has_children")})).map((function(t){f(t,e)}))}}}]);