(()=>{"use strict";function e(e){if("1"===e.dataset.mvReady)return;e.dataset.mvReady="1";const t=parseInt(e.dataset.mvBreakpoint,10)||782,n="hover"===e.dataset.mvTrigger,a=window.matchMedia(`(min-width: ${t+1}px)`),r=window.matchMedia("(hover: hover) and (pointer: fine)"),o=new Set,i=()=>n&&a.matches&&r.matches;function d(t,n){const r=t.querySelector(":scope > [data-mv-toggle]"),i=r&&r.getAttribute("aria-controls"),s=i?e.querySelector(`#${CSS.escape(i)}`):null;r&&s&&(r.setAttribute("aria-expanded",n?"true":"false"),s.hidden=!n,t.classList.toggle("is-open",n),n?(o.add(t),function(e){if(!a.matches)return;e.style.marginInlineStart="";const t=e.getBoundingClientRect().right-(window.innerWidth-16);t>0&&(e.style.marginInlineStart=`-${Math.round(t)}px`)}(s)):(o.delete(t),s.style.marginInlineStart="",t.querySelectorAll(".menuverse-nav__item.is-open").forEach(e=>d(e,!1))))}function s(){[...o].forEach(e=>d(e,!1))}e.querySelectorAll(".menuverse-nav__item--parent").forEach(e=>{const t=e.querySelector(":scope > [data-mv-toggle]");t&&(t.addEventListener("click",()=>{const n="true"===t.getAttribute("aria-expanded");(e.parentElement?e.parentElement.querySelectorAll(":scope > .menuverse-nav__item.is-open"):[]).forEach(t=>{t!==e&&d(t,!1)}),d(e,!n)}),e.addEventListener("mouseenter",()=>{i()&&d(e,!0)}),e.addEventListener("mouseleave",()=>{i()&&d(e,!1)}))}),e.addEventListener("keydown",e=>{if("Escape"!==e.key||!o.size)return;const t=[...o].pop(),n=t.querySelector(":scope > [data-mv-toggle]");e.preventDefault(),d(t,!1),n&&n.focus()}),e.addEventListener("focusout",t=>{o.size&&!e.contains(t.relatedTarget)&&s()}),document.addEventListener("click",t=>{o.size&&!e.contains(t.target)&&s()}),a.addEventListener("change",s)}function t(){document.querySelectorAll("[data-menuverse-nav]").forEach(e)}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t(),window.menuverse=window.menuverse||{},window.menuverse.initBlockMenu=t})();