!function(){"use strict";window.AccessibilityNavigation=class{constructor(t){if(this.options=this.#t({selector:".navigation-main",toggle:".nav-burger",minWidth:1024,classes:{submenuButton:"btn-toggle-submenu",expand:"nav-expanded",active:"is-active",bodyOpen:"navigation-open",boundsRight:"bounds-right",boundsLeft:"bounds-left"},ariaLabels:{expand:"Expand menu: ",collapse:"Collapse menu: "},showMobileTrail:!0},t||{}),this.navigation=document.querySelector(this.options.selector),this.toggle=document.querySelector(this.options.toggle),this.navigation){this.state=!1,this.dropdowns=[],this.active=[],this.listeners=new WeakMap,this.#e();for(const t of this.dropdowns)this.#s(t);new ResizeObserver(()=>{const t=this.#i();for(const e of this.dropdowns)t?this.#o(e):this.#n(e)}).observe(document.body)}}focusTrapEvent(t){"Tab"!==t.key&&9!==t.keyCode||(document.activeElement!==this.lastFocus||t.shiftKey||(t.preventDefault(),this.firstFocus?.focus()),document.activeElement===this.firstFocus&&t.shiftKey&&(t.preventDefault(),this.lastFocus?.focus()))}#t(t,e){return[...new Set([...Object.keys(t),...Object.keys(e)])].reduce((s,i)=>({...s,[i]:"object"==typeof t[i]?Object.assign({},t[i],e[i]):e[i]?e[i]:t[i]}),{})}#a(){this.btn=document.createElement("button"),this.btn.classList.add(this.options.classes.submenuButton),this.btn.ariaHasPopup="true",this.btn.ariaExpanded="false"}#r(){const t=[this.navigation.closest("#header")?.querySelector("a[href].logo"),...this.navigation.querySelectorAll("a[href]:not([disabled]), button:not([disabled])")];this.firstFocus=t[0]??this.toggle,this.lastFocus=t[t.length-1]??[]}#h(){for(const t of this.navigation.querySelectorAll("li.submenu.trail"))this.#l(t)}#c(){this.options.showMobileTrail&&this.#h(),this.toggle.ariaExpanded=this.state?"false":"true",this.toggle.classList.toggle(this.options.classes.active,!this.state),this.navigation.classList.toggle(this.options.classes.active,!this.state),document.body.classList.toggle(this.options.classes.bodyOpen,!this.state),this.state=!this.state}#u(){this.state?document.addEventListener("keydown",this.focusTrapEvent,!1):document.removeEventListener("keydown",this.focusTrapEvent,!1)}#e(){this.#a(),this.#d(),this.#p(),this.navigation.querySelectorAll("li").forEach(t=>{t.classList.contains("submenu")&&this.dropdowns.push(t);const e=t.firstElementChild;e.classList.contains("active")&&(e.ariaCurrent="page"),!e.ariaLabel&&e.title&&(e.ariaLabel=e.title,e.removeAttribute("title"))}),document.addEventListener("keyup",t=>{this.#i()&&"Escape"===t.key&&this.#g()})}#b(t,e){t.btn.ariaLabel=(e?this.options.ariaLabels.collapse:this.options.ariaLabels.expand)+t.btn.dataset.label,t.btn.ariaExpanded=e?"true":"false"}#v(t){t.classList.remove(this.options.classes.expand),t.querySelector(":scope > ul")?.classList.remove(this.options.classes.boundsLeft,this.options.classes.boundsRight),this.#b(t,!1)}#g(t=null){0!==this.active.length&&(this.active.includes(t)?(this.#v(t),this.active=this.active.filter(e=>e!==t)):null===t||this.active[0]!==t&&!this.active[0].contains(t)?(this.active.forEach(t=>this.#v(t)),this.active=[]):this.active=this.active.filter(e=>!!e.contains(t)||(this.#v(e),!1)))}#f(t){const e=t.querySelector(":scope > ul");null!==e&&(e.getBoundingClientRect().right>=window.innerWidth?e.classList.add(this.options.classes.boundsRight):e.getBoundingClientRect().left<0&&e.classList.add(this.options.classes.boundsLeft))}#l(t){this.#g(t),t.classList.add(this.options.classes.expand),this.#i()&&this.#f(t),this.#b(t,!0),this.active.includes(t)||this.active.push(t)}#m(t,e){e?this.#l(t):this.#g(t)}#s(t){const e=t.firstElementChild,s=this.btn.cloneNode();t.btn=s,s.dataset.label=e.textContent,s.ariaLabel=this.options.ariaLabels.expand+e.textContent,s.addEventListener("click",()=>{const e="false"===s.ariaExpanded??!0;this.#m(t,e)}),e.after(s)}#w(t,e){this.#m(e,!0)}#L(t,e){this.#g(e)}#E(t,e){t.relatedTarget&&this.active.length>0&&!e.contains(t.relatedTarget)&&this.#g(e)}#i(){return window.innerWidth>=this.options.minWidth}#S(t){const e=new URL(t.href,location.href);return e.hash&&e.pathname===location.pathname}#d(){this.#r(),this.focusTrapEvent=this.focusTrapEvent.bind(this),this.toggle?.addEventListener("click",()=>{this.#i()||(this.#c(),this.#u())})}#p(){for(const t of this.navigation.querySelectorAll('a[href*="#"]'))t.addEventListener("click",()=>{this.#i()||this.#S(t)&&this.#c()})}#o(t){if(this.listeners.has(t))return;const e={mouseenter:e=>this.#w(e,t),mouseleave:e=>this.#L(e,t),focusout:e=>this.#E(e,t)};for(const[s,i]of Object.entries(e))t.addEventListener(s,i);this.listeners.set(t,e)}#n(t){const e=this.listeners.get(t);if(e){for(const[s,i]of Object.entries(e))t.removeEventListener(s,i);this.listeners.delete(t)}}}}();