!function(){"use strict";function e(){document.querySelectorAll(".eryndo-responsive-nav-menu").forEach(t)}function t(e){const t=e.querySelector(".menu-title"),i=e.querySelector(".menu-toggle"),a=e.querySelector(".menu-items");if(!t||!a)return;const d="true"===e.dataset.enableAccordion,o=(e.dataset.togglePosition,e.dataset.desktopDirection||"horizontal"),r=e.dataset.tabletDirection||"vertical",s=e.dataset.mobileDirection||"vertical",u=e.id||`nav-menu-${Date.now()}-${Math.floor(1e3*Math.random())}`;e.id=u;const c=`menu-${u}`;a.id=c,t.setAttribute("aria-expanded","false"),t.setAttribute("aria-controls",c),a.setAttribute("aria-hidden","true"),a.classList.remove("expanded"),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.addEventListener("keydown",(function(e){"Enter"===e.key||" "===e.key?(e.preventDefault(),p()&&b()):"Escape"===e.key&&v()})),t.addEventListener("click",(function(e){e.preventDefault(),p()&&b()}));let l,m=0;function p(){return d&&window.innerWidth<1024}function f(){(function(){const t=window.innerWidth<1024?"mobile":"desktop";e.setAttribute("data-mobile-direction",s),e.setAttribute("data-tablet-direction",r),e.setAttribute("data-desktop-direction",o),e.setAttribute("data-current-breakpoint",t)})(),e.setAttribute("data-enable-accordion",d.toString()),p()?(e.classList.add("accordion-mode"),i&&(i.style.display="block"),a.setAttribute("aria-hidden","true"),a.classList.remove("expanded"),t.setAttribute("aria-expanded","false")):(e.classList.remove("accordion-mode"),i&&(i.style.display="none"),a.setAttribute("aria-hidden","false"),a.classList.add("expanded"),t.setAttribute("aria-expanded","true"))}function b(){p()&&("true"===t.getAttribute("aria-expanded")?v():function(){t.setAttribute("aria-expanded","true"),a.setAttribute("aria-hidden","false"),a.classList.add("expanded"),e.classList.add("menu-expanded"),i&&(i.classList.add("expanded"),i.setAttribute("aria-expanded","true")),n("Menu expanded");const d=a.querySelector(".menu-item a, .menu-item button");d&&setTimeout((()=>{d.focus()}),300)}())}function v(){t.setAttribute("aria-expanded","false"),a.setAttribute("aria-hidden","true"),a.classList.remove("expanded"),e.classList.remove("menu-expanded"),i&&(i.classList.remove("expanded"),i.setAttribute("aria-expanded","false")),n("Menu collapsed")}t.addEventListener("touchstart",(function(e){m=e.touches[0].clientY}),{passive:!0}),t.addEventListener("touchend",(function(e){const t=e.changedTouches[0].clientY;Math.abs(t-m)<10&&p()&&(e.preventDefault(),b())}),{passive:!1}),window.addEventListener("resize",(function(){clearTimeout(l),l=setTimeout((function(){f()}),250)})),f();const A=a.querySelectorAll(".menu-item a, .menu-item button");A.forEach(((e,n)=>{e.addEventListener("keydown",(function(e){if("Escape"===e.key&&p())v(),t.focus();else if(p()&&"ArrowDown"===e.key){e.preventDefault();const t=A[n+1];t&&t.focus()}else if(p()&&"ArrowUp"===e.key){e.preventDefault();const i=A[n-1];i?i.focus():t.focus()}}))}))}function n(e){const t=document.createElement("div");t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.style.position="absolute",t.style.left="-10000px",t.style.width="1px",t.style.height="1px",t.style.overflow="hidden",t.textContent=e,document.body.appendChild(t),setTimeout((()=>{document.body.removeChild(t)}),1e3)}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e(),document.addEventListener("click",(function(e){document.querySelectorAll(".eryndo-responsive-nav-menu").forEach((function(t){const n=t.querySelector(".menu-title"),i=t.querySelector(".menu-items"),a="true"===t.dataset.enableAccordion;if(!t.contains(e.target)&&a&&window.innerWidth<=1023&&n&&i){n.setAttribute("aria-expanded","false"),i.setAttribute("aria-hidden","true"),i.classList.remove("expanded"),t.classList.remove("menu-expanded");const e=t.querySelector(".menu-toggle");e&&(e.classList.remove("expanded"),e.setAttribute("aria-expanded","false"))}}))}))}();