Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

accessible-menu-bootstrap-5

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

accessible-menu-bootstrap-5 - npm Package Compare versions

Comparing version 2.0.0-beta.3 to 2.0.0

dist/accessible-menu-bs5.cjs.js

4

dist/accessible-menu-bs5.iife.js

@@ -1,3 +0,3 @@

var AccessibleMenuBootstrap5=function(){"use strict";var he=Object.defineProperty;var ae=(c,d,T)=>d in c?he(c,d,{enumerable:!0,configurable:!0,writable:!0,value:T}):c[d]=T;var l=(c,d,T)=>(ae(c,typeof d!="symbol"?d+"":d,T),T);function c(r,s){typeof r=="string"?s.classList.add(r):s.classList.add(...r)}function d(r,s){typeof r=="string"?s.classList.remove(r):s.classList.remove(...r)}function T(r,s){try{if(typeof s!="object"){const e=typeof s;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${e}" given.`)}for(const e in s)if(!(s[e]instanceof r)){const t=typeof s[e];throw new TypeError(`${e} must be an instance of ${r.name}. "${t}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function b(r,s){try{if(typeof s!="object"){const e=typeof s;throw new TypeError(`Values given to isValidType() must be inside of an object. "${e}" given.`)}for(const e in s){const t=typeof s[e];if(t!==r)throw new TypeError(`${e} must be a ${r}. "${t}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function z(r){try{if(typeof r!="object"){const s=typeof r;throw new TypeError(`Values given to isCSSSelector() must be inside of an object. "${s}" given.`)}for(const s in r)try{if(r[s]===null)throw new Error;document.querySelector(r[s])}catch{throw new TypeError(`${s} must be a valid CSS selector. "${r[s]}" given.`)}return{status:!0,error:null}}catch(s){return{status:!1,error:s}}}function D(r){try{if(typeof r!="object"||Array.isArray(r)){const s=typeof r;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${s}" given.`)}for(const s in r){const e=typeof r[s];if(e!=="string")if(Array.isArray(r[s]))r[s].forEach(t=>{if(typeof t!="string")throw new TypeError(`${s} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${s} must be a string or an array of strings. "${e}" given.`);else{const t={};t[s]=r[s],z(t)}}return{status:!0,error:null}}catch(s){return{status:!1,error:s}}}function Q(r){try{if(typeof r!="object"){const e=typeof r;throw new TypeError(`Values given to isValidState() must be inside of an object. "${e}" given.`)}const s=["none","self","child"];for(const e in r)if(!s.includes(r[e]))throw new TypeError(`${e} must be one of the following values: ${s.join(", ")}. "${r[e]}" given.`);return{status:!0,error:null}}catch(s){return{status:!1,error:s}}}function X(r){try{if(typeof r!="object"){const e=typeof r;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${e}" given.`)}const s=["none","mouse","keyboard","character"];for(const e in r)if(!s.includes(r[e]))throw new TypeError(`${e} must be one of the following values: ${s.join(", ")}. "${r[e]}" given.`);return{status:!0,error:null}}catch(s){return{status:!1,error:s}}}function N(r){try{if(typeof r!="object"){const e=typeof r;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${e}" given.`)}const s=["off","on","dynamic"];for(const e in r)if(!s.includes(r[e]))throw new TypeError(`${e} must be one of the following values: ${s.join(", ")}. "${r[e]}" given.`);return{status:!0,error:null}}catch(s){return{status:!1,error:s}}}function Y(r,s){if(b("string",{tagName:r}).status&&T(HTMLElement,s).status){const e=r.toLowerCase();let t=!0;for(const n in s)s[n].tagName.toLowerCase()!==e&&(t=!1);return t}else return!1}class L{constructor({menuToggleElement:s,parentElement:e,controlledMenu:t,parentMenu:n=null}){l(this,"_dom",{toggle:null,parent:null});l(this,"_elements",{controlledMenu:null,parentMenu:null});l(this,"_open",!1);l(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}}));l(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}}));this._dom.toggle=s,this._dom.parent=e,this._elements.controlledMenu=t,this._elements.parentMenu=n}initialize(){var s;if(this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),Y("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,10);let t=((s=this.dom.toggle.innerText)==null?void 0:s.replace(/[^a-zA-Z0-9\s]/g,""))||"",n=e;!t.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(t=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),t.replace(/\s/g,"").length>0&&(t=t.toLowerCase().replace(/\s+/g,"-"),t.startsWith("-")&&(t=t.substring(1)),t.endsWith("-")&&(t=t.slice(0,-1)),n=`${t}-${n}`),this.dom.toggle.id=this.dom.toggle.id||`${n}-menu-button`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`${n}-menu`}this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(s){b("boolean",{value:s}),this._open=s}_expand(s=!0){const{closeClass:e,openClass:t,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(c(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{e!==""&&d(e,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&c(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{d(n,this.elements.controlledMenu.dom.menu)})})})):(t!==""&&c(t,this.elements.controlledMenu.dom.menu),e!==""&&d(e,this.elements.controlledMenu.dom.menu)),s&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(s=!0){const{closeClass:e,openClass:t,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),n!==""?(c(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&d(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{e!==""&&c(e,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{d(n,this.elements.controlledMenu.dom.menu)})})})):(e!==""&&c(e,this.elements.controlledMenu.dom.menu),t!==""&&d(t,this.elements.controlledMenu.dom.menu)),s&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this._expand(),this.isOpen=!0}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._expand(),this.isOpen=!0}close(){this.isOpen&&(this.elements.controlledMenu.blur(),this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._collapse(),this.isOpen=!1)}toggle(){this.isOpen?this.close():this.open()}closeSiblings(){this.elements.parentMenu&&this.elements.parentMenu.elements.submenuToggles.forEach(s=>{s!==this&&s.close()})}closeChildren(){this.elements.controlledMenu.elements.submenuToggles.forEach(s=>s.close())}}class A{constructor({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n=!1,childMenu:i=null,toggle:o=null}){l(this,"_dom",{item:null,link:null});l(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});l(this,"_submenu",!1);this._dom.item=s,this._dom.link=e,this._elements.parentMenu=t,this._elements.childMenu=i,this._elements.toggle=o,this._submenu=n}initialize(){}get dom(){return this._dom}get elements(){return this._elements}get isSubmenuItem(){return this._submenu}focus(){this.elements.parentMenu.shouldFocus&&this.dom.link.focus()}blur(){this.elements.parentMenu.shouldFocus&&this.dom.link.blur()}}function S(r){try{const s=r.key||r.keyCode,e={Enter:s==="Enter"||s===13,Space:s===" "||s==="Spacebar"||s===32,Escape:s==="Escape"||s==="Esc"||s===27,ArrowUp:s==="ArrowUp"||s==="Up"||s===38,ArrowRight:s==="ArrowRight"||s==="Right"||s===39,ArrowDown:s==="ArrowDown"||s==="Down"||s===40,ArrowLeft:s==="ArrowLeft"||s==="Left"||s===37,Home:s==="Home"||s===36,End:s==="End"||s===35,Character:isNaN(s)&&!!s.match(/^[a-zA-Z]{1}$/),Tab:s==="Tab"||s===9,Asterisk:s==="*"||s===56};return Object.keys(e).find(t=>e[t]===!0)||""}catch{return""}}function u(r){r.preventDefault(),r.stopPropagation()}class k{constructor({menuElement:s,menuItemSelector:e="li",menuLinkSelector:t="a",submenuItemSelector:n="",submenuToggleSelector:i="a",submenuSelector:o="ul",controllerElement:h=null,containerElement:a=null,openClass:m="show",closeClass:p="hide",transitionClass:f="transitioning",isTopLevel:g=!0,parentMenu:_=null,hoverType:M="off",hoverDelay:y=250,enterDelay:C=-1,leaveDelay:E=-1}){l(this,"_MenuType",k);l(this,"_MenuItemType",A);l(this,"_MenuToggleType",L);l(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});l(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});l(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});l(this,"_openClass","show");l(this,"_closeClass","hide");l(this,"_transitionClass","transitioning");l(this,"_root",!0);l(this,"_currentChild",0);l(this,"_focusState","none");l(this,"_currentEvent","none");l(this,"_hoverType","off");l(this,"_hoverDelay",250);l(this,"_enterDelay",-1);l(this,"_leaveDelay",-1);l(this,"_hoverTimeout",null);l(this,"_errors",[]);this._dom.menu=s,this._dom.controller=h,this._dom.container=a,this._selectors.menuItems=e,this._selectors.menuLinks=t,this._selectors.submenuItems=n,this._selectors.submenuToggles=i,this._selectors.submenus=o,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=_,this._elements.rootMenu=g?this:null,this._openClass=m||"",this._closeClass=p||"",this._transitionClass=f||"",this._root=g,this._hoverType=M,this._hoverDelay=y,this._enterDelay=C,this._leaveDelay=E}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found:
var AccessibleMenuBootstrap5=function(){"use strict";var he=Object.defineProperty;var ae=(c,d,T)=>d in c?he(c,d,{enumerable:!0,configurable:!0,writable:!0,value:T}):c[d]=T;var l=(c,d,T)=>(ae(c,typeof d!="symbol"?d+"":d,T),T);function c(r,s){typeof r=="string"?s.classList.add(r):s.classList.add(...r)}function d(r,s){typeof r=="string"?s.classList.remove(r):s.classList.remove(...r)}function T(r,s){try{if(typeof s!="object"){const e=typeof s;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${e}" given.`)}for(const e in s)if(!(s[e]instanceof r)){const t=typeof s[e];throw new TypeError(`${e} must be an instance of ${r.name}. "${t}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function b(r,s){try{if(typeof s!="object"){const e=typeof s;throw new TypeError(`Values given to isValidType() must be inside of an object. "${e}" given.`)}for(const e in s){const t=typeof s[e];if(t!==r)throw new TypeError(`${e} must be a ${r}. "${t}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function z(r){try{if(typeof r!="object"){const s=typeof r;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${s}" given.`)}for(const s in r)try{if(r[s]===null)throw new Error;document.querySelector(r[s])}catch{throw new TypeError(`${s} must be a valid query selector. "${r[s]}" given.`)}return{status:!0,error:null}}catch(s){return{status:!1,error:s}}}function D(r){try{if(typeof r!="object"||Array.isArray(r)){const s=typeof r;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${s}" given.`)}for(const s in r){const e=typeof r[s];if(e!=="string")if(Array.isArray(r[s]))r[s].forEach(t=>{if(typeof t!="string")throw new TypeError(`${s} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${s} must be a string or an array of strings. "${e}" given.`);else{const t={};t[s]=r[s],z(t)}}return{status:!0,error:null}}catch(s){return{status:!1,error:s}}}function J(r){try{if(typeof r!="object"){const e=typeof r;throw new TypeError(`Values given to isValidState() must be inside of an object. "${e}" given.`)}const s=["none","self","child"];for(const e in r)if(!s.includes(r[e]))throw new TypeError(`${e} must be one of the following values: ${s.join(", ")}. "${r[e]}" given.`);return{status:!0,error:null}}catch(s){return{status:!1,error:s}}}function X(r){try{if(typeof r!="object"){const e=typeof r;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${e}" given.`)}const s=["none","mouse","keyboard","character"];for(const e in r)if(!s.includes(r[e]))throw new TypeError(`${e} must be one of the following values: ${s.join(", ")}. "${r[e]}" given.`);return{status:!0,error:null}}catch(s){return{status:!1,error:s}}}function N(r){try{if(typeof r!="object"){const e=typeof r;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${e}" given.`)}const s=["off","on","dynamic"];for(const e in r)if(!s.includes(r[e]))throw new TypeError(`${e} must be one of the following values: ${s.join(", ")}. "${r[e]}" given.`);return{status:!0,error:null}}catch(s){return{status:!1,error:s}}}function Y(r,s){if(b("string",{tagName:r}).status&&T(HTMLElement,s).status){const e=r.toLowerCase();let t=!0;for(const n in s)s[n].tagName.toLowerCase()!==e&&(t=!1);return t}else return!1}class A{constructor({menuToggleElement:s,parentElement:e,controlledMenu:t,parentMenu:n=null}){l(this,"_dom",{toggle:null,parent:null});l(this,"_elements",{controlledMenu:null,parentMenu:null});l(this,"_open",!1);l(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}}));l(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}}));this._dom.toggle=s,this._dom.parent=e,this._elements.controlledMenu=t,this._elements.parentMenu=n}initialize(){this._setIds(),this._setAriaAttributes(),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(s){b("boolean",{value:s}),this._open=s}_setIds(){var s;if(this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,10);let t=((s=this.dom.toggle.innerText)==null?void 0:s.replace(/[^a-zA-Z0-9\s]/g,""))||"",n=e;!t.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(t=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),t.replace(/\s/g,"").length>0&&(t=t.toLowerCase().replace(/\s+/g,"-"),t.startsWith("-")&&(t=t.substring(1)),t.endsWith("-")&&(t=t.slice(0,-1)),n=`${t}-${n}`),this.dom.toggle.id=this.dom.toggle.id||`menu-button-${n}`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`menu-${n}`}}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),Y("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}_expand(s=!0){const{closeClass:e,openClass:t,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(c(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{e!==""&&d(e,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&c(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{d(n,this.elements.controlledMenu.dom.menu)})})})):(t!==""&&c(t,this.elements.controlledMenu.dom.menu),e!==""&&d(e,this.elements.controlledMenu.dom.menu)),s&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(s=!0){const{closeClass:e,openClass:t,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),n!==""?(c(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&d(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{e!==""&&c(e,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{d(n,this.elements.controlledMenu.dom.menu)})})})):(e!==""&&c(e,this.elements.controlledMenu.dom.menu),t!==""&&d(t,this.elements.controlledMenu.dom.menu)),s&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this._expand(),this.isOpen=!0}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._expand(),this.isOpen=!0}close(){this.isOpen&&(this.elements.controlledMenu.blur(),this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._collapse(),this.isOpen=!1)}toggle(){this.isOpen?this.close():this.open()}closeSiblings(){this.elements.parentMenu&&this.elements.parentMenu.elements.submenuToggles.forEach(s=>{s!==this&&s.close()})}closeChildren(){this.elements.controlledMenu.elements.submenuToggles.forEach(s=>s.close())}}class L{constructor({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n=!1,childMenu:i=null,toggle:o=null}){l(this,"_dom",{item:null,link:null});l(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});l(this,"_submenu",!1);this._dom.item=s,this._dom.link=e,this._elements.parentMenu=t,this._elements.childMenu=i,this._elements.toggle=o,this._submenu=n}initialize(){}get dom(){return this._dom}get elements(){return this._elements}get isSubmenuItem(){return this._submenu}focus(){this.elements.parentMenu.shouldFocus&&this.dom.link.focus()}blur(){this.elements.parentMenu.shouldFocus&&this.dom.link.blur()}}function k(r){try{const s=r.key||r.keyCode,e={Enter:s==="Enter"||s===13,Space:s===" "||s==="Spacebar"||s===32,Escape:s==="Escape"||s==="Esc"||s===27,ArrowUp:s==="ArrowUp"||s==="Up"||s===38,ArrowRight:s==="ArrowRight"||s==="Right"||s===39,ArrowDown:s==="ArrowDown"||s==="Down"||s===40,ArrowLeft:s==="ArrowLeft"||s==="Left"||s===37,Home:s==="Home"||s===36,End:s==="End"||s===35,Character:isNaN(s)&&!!s.match(/^[a-zA-Z]{1}$/),Tab:s==="Tab"||s===9,Asterisk:s==="*"||s===56};return Object.keys(e).find(t=>e[t]===!0)||""}catch{return""}}function u(r){r.preventDefault(),r.stopPropagation()}class S{constructor({menuElement:s,menuItemSelector:e="li",menuLinkSelector:t="a",submenuItemSelector:n="",submenuToggleSelector:i="a",submenuSelector:o="ul",controllerElement:h=null,containerElement:a=null,openClass:m="show",closeClass:p="hide",transitionClass:f="transitioning",isTopLevel:g=!0,parentMenu:_=null,hoverType:y="off",hoverDelay:M=250,enterDelay:C=-1,leaveDelay:E=-1}){l(this,"_MenuType",S);l(this,"_MenuItemType",L);l(this,"_MenuToggleType",A);l(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});l(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});l(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});l(this,"_openClass","show");l(this,"_closeClass","hide");l(this,"_transitionClass","transitioning");l(this,"_root",!0);l(this,"_currentChild",0);l(this,"_focusState","none");l(this,"_currentEvent","none");l(this,"_hoverType","off");l(this,"_hoverDelay",250);l(this,"_enterDelay",-1);l(this,"_leaveDelay",-1);l(this,"_hoverTimeout",null);l(this,"_errors",[]);this._dom.menu=s,this._dom.controller=h,this._dom.container=a,this._selectors.menuItems=e,this._selectors.menuLinks=t,this._selectors.submenuItems=n,this._selectors.submenuToggles=i,this._selectors.submenus=o,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=_,this._elements.rootMenu=g?this:null,this._openClass=m||"",this._closeClass=p||"",this._transitionClass=f||"",this._root=g,this._hoverType=y,this._hoverDelay=M,this._enterDelay=C,this._leaveDelay=E}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found:
- ${this.errors.join(`
- `)}`);if(this.elements.rootMenu===null&&this._findRootMenu(this),this._setDOMElements(),this.isTopLevel&&this.dom.controller&&this.dom.container){const s=new this._MenuToggleType({menuToggleElement:this.dom.controller,parentElement:this.dom.container,controlledMenu:this});this._elements.controller=s}this._createChildElements()}get dom(){return this._dom}get selectors(){return this._selectors}get elements(){return this._elements}get isTopLevel(){return this._root}get openClass(){return this.isTopLevel?this._openClass:this.elements.rootMenu.openClass}get closeClass(){return this.isTopLevel?this._closeClass:this.elements.rootMenu.closeClass}get transitionClass(){return this.isTopLevel?this._transitionClass:this.elements.rootMenu.transitionClass}get currentChild(){return this._currentChild}get focusState(){return this._focusState}get currentEvent(){return this._currentEvent}get currentMenuItem(){return this.elements.menuItems[this.currentChild]}get hoverType(){return this._root?this._hoverType:this.elements.rootMenu.hoverType}get hoverDelay(){return this._root?this._hoverDelay:this.elements.rootMenu.hoverDelay}get enterDelay(){return this._enterDelay===-1?this.hoverDelay:this._root?this._enterDelay:this.elements.rootMenu.enterDelay}get leaveDelay(){return this._leaveDelay===-1?this.hoverDelay:this._root?this._leaveDelay:this.elements.rootMenu.leaveDelay}get shouldFocus(){let s=!1;return(this.currentEvent==="keyboard"||this.currentEvent==="character")&&(s=!0),this.currentEvent==="mouse"&&this.hoverType==="dynamic"&&(s=!0),s}get errors(){return this._errors}set openClass(s){D({openClass:s}),this._openClass!==s&&(this._openClass=s)}set closeClass(s){D({closeClass:s}),this._closeClass!==s&&(this._closeClass=s)}set transitionClass(s){D({transitionClass:s}),this._transitionClass!==s&&(this._transitionClass=s)}set currentChild(s){b("number",{value:s});function e(t){if(["mouse","character"].includes(t.currentEvent)&&t.elements.parentMenu){let i=0,o=!1;for(;!o&&i<t.elements.parentMenu.elements.menuItems.length;){const h=t.elements.parentMenu.elements.menuItems[i];h.isSubmenuItem&&h.elements.toggle.elements.controlledMenu===t&&(o=!0,t.elements.parentMenu.currentEvent=t.currentEvent,t.elements.parentMenu.currentChild=i),i++}}}s<-1?(this._currentChild=-1,e(this)):s>=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,e(this)):this.focusChild!==s&&(this._currentChild=s,e(this))}set focusState(s){Q({value:s}),this._focusState!==s&&(this._focusState=s),this.elements.submenuToggles.length>0&&(s==="self"||s==="none")&&this.elements.submenuToggles.forEach(e=>{e.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(s==="self"||s==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(s){X({value:s}),this._currentEvent!==s&&(this._currentEvent=s,this.elements.submenuToggles.length>0&&this.elements.submenuToggles.forEach(e=>{e.elements.controlledMenu.currentEvent=s}))}set hoverType(s){N({value:s}),this._hoverType!==s&&(this._hoverType=s)}set hoverDelay(s){b("number",{value:s}),this._hoverDelay!==s&&(this._hoverDelay=s)}set enterDelay(s){b("number",{value:s}),this._enterDelay!==s&&(this._enterDelay=s)}set leaveDelay(s){b("number",{value:s}),this._leaveDelay!==s&&(this._leaveDelay=s)}_validate(){let s=!0,e;this._dom.container!==null||this._dom.controller!==null?e=T(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):e=T(HTMLElement,{menuElement:this._dom.menu}),e.status||(this._errors.push(e.error.message),s=!1);let t;if(this._selectors.submenuItems!==""?t=z({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):t=z({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),t.status||(this._errors.push(t.error.message),s=!1),this._openClass!==""){const m=D({openClass:this._openClass});m.status||(this._errors.push(m.error.message),s=!1)}if(this._closeClass!==""){const m=D({closeClass:this._closeClass});m.status||(this._errors.push(m.error.message),s=!1)}if(this._transitionClass!==""){const m=D({transitionClass:this._transitionClass});m.status||(this._errors.push(m.error.message),s=!1)}const n=b("boolean",{isTopLevel:this._root});if(n.status||(this._errors.push(n.error.message),s=!1),this._elements.parentMenu!==null){const m=T(k,{parentMenu:this._elements.parentMenu});m.status||(this._errors.push(m.error.message),s=!1)}const i=N({hoverType:this._hoverType});i.status||(this._errors.push(i.error.message),s=!1);const o=b("number",{hoverDelay:this._hoverDelay});o.status||(this._errors.push(o.error.message),s=!1);const h=b("number",{enterDelay:this._enterDelay});h.status||(this._errors.push(h.error.message),s=!1);const a=b("number",{leaveDelay:this._leaveDelay});return a.status||(this._errors.push(a.error.message),s=!1),s}_setDOMElementType(s,e=this.dom.menu,t=!0){if(typeof this.selectors[s]=="string"){if(!Array.isArray(this.dom[s]))throw new Error(`AccessibleMenu: The "${s}" element cannot be set through _setDOMElementType.`);e!==this.dom.menu&&T(HTMLElement,{base:e});const i=Array.from(e.querySelectorAll(this.selectors[s])).filter(o=>o.parentElement===e);t?this._dom[s]=i:this._dom[s]=[...this._dom[s],...i]}else throw new Error(`AccessibleMenu: "${s}" is not a valid element type within the menu.`)}_resetDOMElementType(s){if(typeof this.dom[s]<"u"){if(!Array.isArray(this.dom[s]))throw new Error(`AccessibleMenu: The "${s}" element cannot be reset through _resetDOMElementType.`);this._dom[s]=[]}else throw new Error(`AccessibleMenu: "${s}" is not a valid element type within the menu.`)}_setDOMElements(){this._setDOMElementType("menuItems"),this.selectors.submenuItems!==""&&(this._setDOMElementType("submenuItems"),this._resetDOMElementType("submenuToggles"),this._resetDOMElementType("submenus"),this.dom.submenuItems.forEach(s=>{this._setDOMElementType("submenuToggles",s,!1),this._setDOMElementType("submenus",s,!1)}))}_findRootMenu(s){if(s.isTopLevel)this._elements.rootMenu=s;else if(s.elements.parentMenu!==null)this._findRootMenu(s.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(s=>{let e;if(this.dom.submenuItems.includes(s)){const t=s.querySelector(this.selectors.submenuToggles),n=s.querySelector(this.selectors.submenus),i=new this._MenuType({menuElement:n,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuToggles,submenuSelector:this.selectors.submenus,openClass:this.openClass,closeClass:this.closeClass,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),o=new this._MenuToggleType({menuToggleElement:t,parentElement:s,controlledMenu:i,parentMenu:this});this._elements.submenuToggles.push(o),e=new this._MenuItemType({menuItemElement:s,menuLinkElement:t,parentMenu:this,isSubmenuItem:!0,childMenu:i,toggle:o})}else{const t=s.querySelector(this.selectors.menuLinks);e=new this._MenuItemType({menuItemElement:s,menuLinkElement:t,parentMenu:this})}this._elements.menuItems.push(e)})}_handleFocus(){this.elements.menuItems.forEach((s,e)=>{s.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=e})})}_handleClick(){function s(e,t,n){u(n),t.toggle(),t.isOpen&&(e.focusState="self",t.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t)},{passive:!0}),e.isSubmenuItem&&e.elements.toggle.dom.toggle.addEventListener("pointerup",n=>{this.currentEvent="mouse",s(this,e.elements.toggle,n)})}),this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("pointerup",e=>{this.currentEvent="mouse",s(this,this.elements.controller,e)})}_handleHover(){this.elements.menuItems.forEach((s,e)=>{s.dom.link.addEventListener("pointerenter",t=>{if(!(t.pointerType==="pen"||t.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(e),s.isSubmenuItem&&(this.enterDelay>0?this._hoverTimeout=setTimeout(()=>{s.elements.toggle.preview()},this.enterDelay):s.elements.toggle.preview());else if(this.hoverType==="dynamic"){const n=this.elements.submenuToggles.some(i=>i.isOpen);this.currentChild=e,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),s.isSubmenuItem&&(!this.isTopLevel||n)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?this._hoverTimeout=setTimeout(()=>{s.elements.toggle.preview()},this.enterDelay):s.elements.toggle.preview())}}}),s.isSubmenuItem&&s.dom.item.addEventListener("pointerleave",t=>{t.pointerType==="pen"||t.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",s.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",s.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",s.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",s.elements.toggle.close(),this.focusCurrentChild()))))})})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",s=>{this.currentEvent="keyboard";const e=S(s);(e==="Space"||e==="Enter")&&u(s)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",s=>{this.currentEvent="keyboard";const e=S(s);(e==="Space"||e==="Enter")&&(u(s),this.elements.controller.toggle(),this.elements.controller.isOpen&&this.focusFirstChild())})}focus(){this.focusState="self",this.shouldFocus&&this.dom.menu.focus()}blur(){this.focusState="none",this.shouldFocus&&this.dom.menu.blur()}focusCurrentChild(){this.focusState="self",this.currentChild!==-1&&this.currentMenuItem.focus()}focusChild(s){this.blurCurrentChild(),this.currentChild=s,this.focusCurrentChild()}focusFirstChild(){this.focusChild(0)}focusLastChild(){this.focusChild(this.elements.menuItems.length-1)}focusNextChild(){this.currentChild<this.elements.menuItems.length-1?this.focusChild(this.currentChild+1):this.focusCurrentChild()}focusPreviousChild(){this.currentChild>0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&this.currentMenuItem.blur()}focusController(){this.dom.controller&&(this.shouldFocus&&this.dom.controller.focus(),this.focusState="none")}focusContainer(){this.dom.container&&(this.shouldFocus&&this.dom.container.focus(),this.focusState="none")}closeChildren(){this.elements.submenuToggles.forEach(s=>s.close())}blurChildren(){this.elements.menuItems.forEach(s=>{s.blur(),s.isSubmenuItem&&s.elements.childMenu.blurChildren()})}}class j extends A{constructor({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n=!1,childMenu:i=null,toggle:o=null,initialize:h=!0}){super({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n,childMenu:i,toggle:o}),h&&this.initialize()}}class V extends L{constructor({menuToggleElement:s,parentElement:e,controlledMenu:t,parentMenu:n=null,initialize:i=!0}){super({menuToggleElement:s,parentElement:e,controlledMenu:t,parentMenu:n}),i&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&this.closeChildren(),super.close()}}class O extends k{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:n="a",submenuItemSelector:i="",submenuToggleSelector:o="a",submenuSelector:h="ul",controllerElement:a=null,containerElement:m=null,openClass:p="show",closeClass:f="hide",transitionClass:g="transitioning",isTopLevel:_=!0,parentMenu:M=null,hoverType:y="off",hoverDelay:C=250,enterDelay:E=-1,leaveDelay:w=-1,optionalKeySupport:v=!1,initialize:I=!0}){super({menuElement:e,menuItemSelector:t,menuLinkSelector:n,submenuItemSelector:i,submenuToggleSelector:o,submenuSelector:h,controllerElement:a,containerElement:m,openClass:p,closeClass:f,transitionClass:g,isTopLevel:_,parentMenu:M,hoverType:y,hoverDelay:C,enterDelay:E,leaveDelay:w});l(this,"_MenuType",O);l(this,"_MenuItemType",j);l(this,"_MenuToggleType",V);l(this,"_currentChild",-1);l(this,"_optionalSupport",!1);this._optionalSupport=v,I&&this.initialize()}initialize(){try{super.initialize(),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(e){console.error(e)}}get optionalKeySupport(){return this.isTopLevel?this._optionalSupport:this.elements.rootMenu.optionalKeySupport}set optionalKeySupport(e){b("boolean",{optionalKeySupport:e}),this._optionalSupport=e}_validate(){let e=super._validate();const t=b("boolean",{optionalKeySupport:this._optionalSupport});return t.status||(this._errors.push(t.error.message),e=!1),e}_handleClick(){super._handleClick(),document.addEventListener("pointerup",e=>{this.focusState!=="none"&&(this.currentEvent="mouse",!this.dom.menu.contains(e.target)&&!this.dom.menu!==e.target&&(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=S(e);if(this.focusState==="self"){const n=["Space","Enter"],i=["Escape"],o=["Escape"];this.optionalKeySupport?["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(t)&&u(e):(this.currentMenuItem.isSubmenuItem&&n.includes(t)||this.elements.controller&&i.includes(t)||this.elements.parentMenu&&o.includes(t))&&u(e)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=S(e);this.focusState==="self"&&(t==="Space"||t==="Enter"?this.currentMenuItem.isSubmenuItem?(u(e),this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview()):this.currentMenuItem.dom.link.click():t==="Escape"?this.elements.submenuToggles.some(i=>i.isOpen)?(u(e),this.closeChildren()):this.elements.parentMenu?(u(e),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.closeChildren(),this.elements.parentMenu.focusCurrentChild()):this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(this.elements.controller.close(),this.focusController()):this.optionalKeySupport&&(t==="ArrowDown"||t==="ArrowRight"?(u(e),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.childMenu.focusFirstChild()):this.focusNextChild()):t==="ArrowUp"||t==="ArrowLeft"?(u(e),this.focusPreviousChild()):t==="Home"?(u(e),this.focusFirstChild()):t==="End"&&(u(e),this.focusLastChild())))})}}class ee extends j{constructor({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n=!1,childMenu:i=null,toggle:o=null,initialize:h=!0}){super({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n,childMenu:i,toggle:o,initialize:!1}),h&&this.initialize()}}class te extends V{constructor({menuToggleElement:e,parentElement:t,controlledMenu:n,parentMenu:i=null,initialize:o=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:n,parentMenu:i,initialize:!1});l(this,"_dom",{toggle:null,parent:null,container:null});this._dom.toggle=e,this._dom.parent=t,this._dom.container=n.isTopLevel?n.dom.container:n.dom.menu,o&&this.initialize()}_expand(e=!0){const{openClass:t,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(c(n,this.dom.container),requestAnimationFrame(()=>{c(t,this.dom.container),requestAnimationFrame(()=>{d(n,this.dom.container)})})):t!==""&&c(t,this.dom.container),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:n,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),i!==""?(c(i,this.dom.container),requestAnimationFrame(()=>{n!==""&&d(n,this.dom.container),requestAnimationFrame(()=>{t!==""&&c(t,this.dom.container),requestAnimationFrame(()=>{d(i,this.dom.container)})})})):(t!==""&&c(t,this.dom.container),n!==""&&d(n,this.dom.container)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}class F extends O{constructor({menuElement:e,menuItemSelector:t=".nav-item,li",menuLinkSelector:n=".nav-link,.dropdown-item",submenuItemSelector:i=".dropdown",submenuToggleSelector:o=".dropdown-toggle",submenuSelector:h=".dropdown-menu",controllerElement:a=null,containerElement:m=null,openClass:p="show",closeClass:f="collapse",transitionClass:g="transitioning",isTopLevel:_=!0,parentMenu:M=null,hoverType:y="off",hoverDelay:C=250,enterDelay:E=-1,leaveDelay:w=-1,optionalKeySupport:v=!1,disableBootstrap:I=!0,initialize:x=!0}){super({menuElement:e,menuItemSelector:t,menuLinkSelector:n,submenuItemSelector:i,submenuToggleSelector:o,submenuSelector:h,controllerElement:a,containerElement:m,openClass:p,closeClass:f,transitionClass:g,isTopLevel:_,parentMenu:M,hoverType:y,hoverDelay:C,enterDelay:E,leaveDelay:w,optionalKeySupport:v,initialize:!1});l(this,"_MenuType",F);l(this,"_MenuItemType",ee);l(this,"_MenuToggleType",te);l(this,"_disableBootstrap",!0);l(this,"_pseudoDropdownElement",document.createElement("div"));l(this,"_bootstrapEvents",["show.bs.dropdown","shown.bs.dropdown","hide.bs.dropdown","hidden.bs.dropdown"]);this._disableBootstrap=I,x&&this.initialize()}initialize(){super.initialize(),this.bootstrapDisabled&&this._disableBootstrapDropdownBehaviour()}get bootstrapDisabled(){return this._disableBootstrap}get bootstrapPseudoDropdownElement(){return this._pseudoDropdownElement}get bootstrapEvents(){return this._bootstrapEvents}_validate(){let e=super._validate();const t=b("boolean",{disableBootstrap:this._disableBootstrap});return t.status||(this._errors.push(t.error.message),e=!1),e}_disableBootstrapDropdownBehaviour(){this.elements.submenuToggles.forEach(e=>{this.bootstrapEvents.forEach(t=>{e.dom.toggle.addEventListener(t,n=>{u(n);const i=bootstrap.Dropdown.getInstance(n.target);i&&i._menu!==this.bootstrapPseudoDropdownElement&&(i._menu=this.bootstrapPseudoDropdownElement)},{once:!0})})})}}class R extends A{constructor({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n=!1,childMenu:i=null,toggle:o=null,initialize:h=!0}){super({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n,childMenu:i,toggle:o}),h&&this.initialize()}initialize(){super.initialize(),this.dom.item.setAttribute("role","none"),this.dom.link.setAttribute("role","menuitem"),this.dom.link.tabIndex=-1}focus(){super.focus(),this.elements.parentMenu.isTopLevel&&(this.dom.link.tabIndex=0)}blur(){super.blur(),this.elements.parentMenu.isTopLevel&&(this.dom.link.tabIndex=-1)}}class U extends L{constructor({menuToggleElement:s,parentElement:e,controlledMenu:t,parentMenu:n=null,initialize:i=!0}){super({menuToggleElement:s,parentElement:e,controlledMenu:t,parentMenu:n}),i&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&(this.closeChildren(),this.elements.parentMenu&&this.elements.parentMenu.focusCurrentChild()),super.close()}}class K extends k{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:n="a",submenuItemSelector:i="",submenuToggleSelector:o="a",submenuSelector:h="ul",controllerElement:a=null,containerElement:m=null,openClass:p="show",closeClass:f="hide",transitionClass:g="transitioning",isTopLevel:_=!0,parentMenu:M=null,hoverType:y="off",hoverDelay:C=250,enterDelay:E=-1,leaveDelay:w=-1,initialize:v=!0}){super({menuElement:e,menuItemSelector:t,menuLinkSelector:n,submenuItemSelector:i,submenuToggleSelector:o,submenuSelector:h,controllerElement:a,containerElement:m,openClass:p,closeClass:f,transitionClass:g,isTopLevel:_,parentMenu:M,hoverType:y,hoverDelay:C,enterDelay:E,leaveDelay:w});l(this,"_MenuType",K);l(this,"_MenuItemType",R);l(this,"_MenuToggleType",U);v&&this.initialize()}initialize(){try{super.initialize(),this.isTopLevel?this.dom.menu.setAttribute("role","menubar"):this.dom.menu.setAttribute("role","menu"),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup(),this.isTopLevel&&(this.elements.menuItems[0].dom.link.tabIndex=0)}catch(e){console.error(e)}}_handleClick(){super._handleClick(),document.addEventListener("pointerup",e=>{this.focusState!=="none"&&(this.currentEvent="mouse",!this.dom.menu.contains(e.target)&&!this.dom.menu!==e.target&&(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=S(e);if(t==="Tab"&&(this.elements.rootMenu.focusState!=="none"?(this.elements.rootMenu.blur(),this.elements.rootMenu.closeChildren()):this.elements.rootMenu.focus()),t==="Character")u(e);else if(this.isTopLevel){if(this.focusState==="self"){const n=["ArrowRight","ArrowLeft","Home","End"],i=["Space","Enter","ArrowDown","ArrowUp"],o=["Escape"];(n.includes(t)||this.currentMenuItem.isSubmenuItem&&i.includes(t)||this.elements.controller&&o.includes(t))&&u(e)}}else{const n=["Escape","ArrowRight","ArrowLeft","ArrowDown","ArrowUp","Home","End"],i=["Space","Enter"];(n.includes(t)||this.currentMenuItem.isSubmenuItem&&i.includes(t))&&u(e)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=S(e),{altKey:n,crtlKey:i,metaKey:o}=e;if(t==="Character"&&!(n||i||o))u(e),this.elements.rootMenu.currentEvent="character",this.focusNextChildWithCharacter(e.key);else if(this.isTopLevel){if(this.focusState==="self")if(t==="Space"||t==="Enter")this.currentMenuItem.isSubmenuItem?(u(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):this.currentMenuItem.dom.link.click();else if(t==="ArrowRight"){u(e);const a=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusNextChild(),a&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else if(t==="ArrowLeft"){u(e);const a=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusPreviousChild(),a&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else t==="ArrowDown"?this.currentMenuItem.isSubmenuItem&&(u(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):t==="ArrowUp"?this.currentMenuItem.isSubmenuItem&&(u(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusLastChild()})):t==="Home"?(u(e),this.focusFirstChild()):t==="End"?(u(e),this.focusLastChild()):t==="Escape"&&(this.elements.submenuToggles.some(m=>m.isOpen)?(u(e),this.closeChildren()):this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(u(e),this.elements.controller.close(),this.focusController()))}else t==="Space"||t==="Enter"?this.currentMenuItem.isSubmenuItem?(u(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):this.currentMenuItem.dom.link.click():t==="Escape"?(u(e),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusCurrentChild()):t==="ArrowRight"?this.currentMenuItem.isSubmenuItem?(u(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):(u(e),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusNextChild(),this.elements.rootMenu.currentMenuItem.isSubmenuItem&&this.elements.rootMenu.currentMenuItem.elements.toggle.preview()):t==="ArrowLeft"?this.elements.parentMenu.currentMenuItem.isSubmenuItem&&(u(e),this.elements.parentMenu.currentMenuItem.elements.toggle.close(),this.elements.parentMenu.focusCurrentChild(),this.elements.parentMenu===this.elements.rootMenu&&(this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusPreviousChild(),this.elements.rootMenu.currentMenuItem.isSubmenuItem&&(this.elements.rootMenu.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.elements.rootMenu.currentMenuItem.elements.toggle.preview()))):t==="ArrowDown"?(u(e),this.focusNextChild()):t==="ArrowUp"?(u(e),this.focusPreviousChild()):t==="Home"?(u(e),this.focusFirstChild()):t==="End"&&(u(e),this.focusLastChild())})}focusNextChild(){this.currentChild===this.elements.menuItems.length-1?this.focusFirstChild():this.focusChild(this.currentChild+1)}focusPreviousChild(){this.currentChild===0?this.focusLastChild():this.focusChild(this.currentChild-1)}focusNextChildWithCharacter(e){const t=e.toLowerCase();let n=this.currentChild+1,i=!1;for(;!i&&n<this.elements.menuItems.length;){let o="";this.elements.menuItems[n].dom.item.innerText?o=this.elements.menuItems[n].dom.item.innerText:o=this.elements.menuItems[n].dom.item.textContent,o=o.replace(/[\s]/g,"").toLowerCase().charAt(0),o===t&&(i=!0,this.focusChild(n)),n++}}}class se extends R{constructor({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n=!1,childMenu:i=null,toggle:o=null,initialize:h=!0}){super({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n,childMenu:i,toggle:o,initialize:!1}),h&&this.initialize()}}class ne extends U{constructor({menuToggleElement:e,parentElement:t,controlledMenu:n,parentMenu:i=null,initialize:o=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:n,parentMenu:i,initialize:!1});l(this,"_dom",{toggle:null,parent:null,container:null});this._dom.toggle=e,this._dom.parent=t,this._dom.container=n.isTopLevel?n.dom.container:n.dom.menu,o&&this.initialize()}_expand(e=!0){const{openClass:t,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(c(n,this.dom.container),requestAnimationFrame(()=>{c(t,this.dom.container),requestAnimationFrame(()=>{d(n,this.dom.container)})})):t!==""&&c(t,this.dom.container),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:n,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),i!==""?(c(i,this.dom.container),requestAnimationFrame(()=>{n!==""&&d(n,this.dom.container),requestAnimationFrame(()=>{t!==""&&c(t,this.dom.container),requestAnimationFrame(()=>{d(i,this.dom.container)})})})):(t!==""&&c(t,this.dom.container),n!==""&&d(n,this.dom.container)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}class B extends K{constructor({menuElement:e,menuItemSelector:t=".nav-item,li",menuLinkSelector:n=".nav-link,.dropdown-item",submenuItemSelector:i=".dropdown",submenuToggleSelector:o=".dropdown-toggle",submenuSelector:h=".dropdown-menu",controllerElement:a=null,containerElement:m=null,openClass:p="show",closeClass:f="collapse",transitionClass:g="transitioning",isTopLevel:_=!0,parentMenu:M=null,hoverType:y="off",hoverDelay:C=250,enterDelay:E=-1,leaveDelay:w=-1,disableBootstrap:v=!0,initialize:I=!0}){super({menuElement:e,menuItemSelector:t,menuLinkSelector:n,submenuItemSelector:i,submenuToggleSelector:o,submenuSelector:h,controllerElement:a,containerElement:m,openClass:p,closeClass:f,transitionClass:g,isTopLevel:_,parentMenu:M,hoverType:y,hoverDelay:C,enterDelay:E,leaveDelay:w,initialize:!1});l(this,"_MenuType",B);l(this,"_MenuItemType",se);l(this,"_MenuToggleType",ne);l(this,"_disableBootstrap",!0);l(this,"_pseudoDropdownElement",document.createElement("div"));l(this,"_bootstrapEvents",["show.bs.dropdown","shown.bs.dropdown","hide.bs.dropdown","hidden.bs.dropdown"]);this._disableBootstrap=v,I&&this.initialize()}initialize(){super.initialize(),this.bootstrapDisabled&&this._disableBootstrapDropdownBehaviour()}get bootstrapDisabled(){return this._disableBootstrap}get bootstrapPseudoDropdownElement(){return this._pseudoDropdownElement}get bootstrapEvents(){return this._bootstrapEvents}_validate(){let e=super._validate();const t=b("boolean",{disableBootstrap:this._disableBootstrap});return t.status||(this._errors.push(t.error.message),e=!1),e}_disableBootstrapDropdownBehaviour(){this.elements.submenuToggles.forEach(e=>{this.bootstrapEvents.forEach(t=>{e.dom.toggle.addEventListener(t,n=>{u(n);const i=bootstrap.Dropdown.getInstance(n.target);i&&i._menu!==this.bootstrapPseudoDropdownElement&&(i._menu=this.bootstrapPseudoDropdownElement)},{once:!0})})})}}class W extends A{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:n,isSubmenuItem:i=!1,childMenu:o=null,toggle:h=null,initialize:a=!0,submenuSibling:m=null}){super({menuItemElement:e,menuLinkElement:t,parentMenu:n,isSubmenuItem:i,childMenu:o,toggle:h});l(this,"_elements",{parentMenu:null,childMenu:null,toggle:null,sibling:null});this._elements.parentMenu=n,this._elements.childMenu=o,this._elements.toggle=h,this._elements.sibling=m,a&&this.initialize()}}class Z extends L{constructor({menuToggleElement:s,parentElement:e,controlledMenu:t,parentMenu:n=null,initialize:i=!0}){super({menuToggleElement:s,parentElement:e,controlledMenu:t,parentMenu:n}),i&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&this.closeChildren(),super.close()}}class q extends k{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:n="a",submenuItemSelector:i="",submenuToggleSelector:o="button",submenuSelector:h="ul",submenuSubtoggleSelector:a="a",controllerElement:m=null,containerElement:p=null,openClass:f="show",closeClass:g="hide",transitionClass:_="transitioning",isTopLevel:M=!0,parentMenu:y=null,hoverType:C="off",hoverDelay:E=250,enterDelay:w=-1,leaveDelay:v=-1,optionalKeySupport:I=!1,initialize:x=!0}){super({menuElement:e,menuItemSelector:t,menuLinkSelector:n,submenuItemSelector:i,submenuSelector:h,submenuToggleSelector:o,controllerElement:m,containerElement:p,openClass:f,closeClass:g,transitionClass:_,isTopLevel:M,parentMenu:y,hoverType:C,hoverDelay:E,enterDelay:w,leaveDelay:v});l(this,"_MenuType",q);l(this,"_MenuItemType",W);l(this,"_MenuToggleType",Z);l(this,"_currentChild",-1);l(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:"",submenuSubtoggles:""});l(this,"_optionalSupport",!1);this._optionalSupport=I,this._selectors.menuItems=t,this._selectors.submenuItems=i,this._selectors.submenuToggles=o,this._selectors.submenus=h,this._selectors.submenuSubtoggles=a,this._selectors.menuLinks=[...new Set([n,o])].join(","),x&&this.initialize()}initialize(){try{super.initialize(),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(e){console.error(e)}}get optionalKeySupport(){return this.isTopLevel?this._optionalSupport:this.elements.rootMenu.optionalKeySupport}set optionalKeySupport(e){b("boolean",{optionalKeySupport:e}),this._optionalSupport=e}_createChildElements(){this.dom.menuItems.forEach(e=>{let t,n;const i=e.querySelector(this.selectors.menuLinks);if(this.dom.submenuItems.includes(e)){const o=e.querySelector(this.selectors.submenuToggles),h=e.querySelector(this.selectors.submenus),a=new this._MenuType({menuElement:h,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuSubtoggles,submenuSelector:this.selectors.submenus,submenuSubtoggleSelector:this.selectors.submenuSubtoggles,openClass:this.openClass,closeClass:this.closeClass,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),m=new this._MenuToggleType({menuToggleElement:o,parentElement:e,controlledMenu:a,parentMenu:this});this._elements.submenuToggles.push(m),o!==i?(n=new this._MenuItemType({menuItemElement:e,menuLinkElement:o,parentMenu:this,isSubmenuItem:!0,childMenu:a,toggle:m}),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:i,parentMenu:this,submenuSibling:n})):t=new this._MenuItemType({menuItemElement:e,menuLinkElement:i,parentMenu:this,isSubmenuItem:!0,childMenu:a,toggle:m})}else t=new this._MenuItemType({menuItemElement:e,menuLinkElement:i,parentMenu:this});this._elements.menuItems.push(t),typeof n<"u"&&this._elements.menuItems.push(n)})}_validate(){let e=super._validate();const t=z({submenuSubtoggleSelector:this._selectors.submenuSubtoggles});t.status||(this._errors.push(t.error.message),e=!1);const n=b("boolean",{optionalKeySupport:this._optionalSupport});return n.status||(this._errors.push(n.error.message),e=!1),e}_handleClick(){super._handleClick(),document.addEventListener("pointerup",e=>{this.focusState!=="none"&&(this.currentEvent="mouse",!this.dom.menu.contains(e.target)&&!this.dom.menu!==e.target&&(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))})}_handleHover(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("pointerenter",n=>{if(!(n.pointerType==="pen"||n.pointerType==="touch")){if(this.hoverType==="on"){this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t);let i=e.isSubmenuItem?e.elements.toggle:null;if(e.elements.sibling!==null&&(i=e.elements.sibling.elements.toggle),i===null)return;this.enterDelay>0?(clearTimeout(this._hoverTimeout),this._hoverTimeout=setTimeout(()=>{i.preview()},this.enterDelay)):i.preview()}else if(this.hoverType==="dynamic"){const i=this.elements.submenuToggles.some(o=>o.isOpen);if(this.currentChild=t,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),!this.isTopLevel||i){this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild();let o=e.isSubmenuItem?e.elements.toggle:null;if(e.elements.sibling!==null&&(o=e.elements.sibling.elements.toggle),o===null)return;this.enterDelay>0?(clearTimeout(this._hoverTimeout),this._hoverTimeout=setTimeout(()=>{o.preview()},this.enterDelay)):o.preview()}}}}),e.isSubmenuItem&&e.dom.item.addEventListener("pointerleave",n=>{n.pointerType==="pen"||n.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))})})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=S(e);if(this.focusState==="self"){const n=["Space","Enter"],i=["Escape"],o=["Escape"];this.optionalKeySupport?["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(t)&&u(e):(this.currentMenuItem.isSubmenuItem&&n.includes(t)||this.elements.controller&&i.includes(t)||this.elements.parentMenu&&o.includes(t))&&u(e)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=S(e);this.focusState==="self"&&(t==="Space"||t==="Enter"?this.currentMenuItem.isSubmenuItem?(u(e),this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview()):this.currentMenuItem.dom.link.click():t==="Escape"?this.elements.submenuToggles.some(i=>i.isOpen)?(u(e),this.closeChildren()):this.elements.parentMenu?(u(e),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.closeChildren(),this.elements.parentMenu.focusCurrentChild()):this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(this.elements.controller.close(),this.focusController()):this.optionalKeySupport&&(t==="ArrowDown"||t==="ArrowRight"?(u(e),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.childMenu.focusFirstChild()):this.focusNextChild()):t==="ArrowUp"||t==="ArrowLeft"?(u(e),this.focusPreviousChild()):t==="Home"?(u(e),this.focusFirstChild()):t==="End"&&(u(e),this.focusLastChild())))})}}class ie extends W{constructor({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n=!1,childMenu:i=null,toggle:o=null,initialize:h=!0,submenuSibling:a=null}){super({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n,childMenu:i,toggle:o,initialize:!1,submenuSibling:a}),h&&this.initialize()}}class oe extends Z{constructor({menuToggleElement:e,parentElement:t,controlledMenu:n,parentMenu:i=null,initialize:o=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:n,parentMenu:i,initialize:!1});l(this,"_dom",{toggle:null,parent:null,container:null});this._dom.toggle=e,this._dom.parent=t,this._dom.container=n.isTopLevel?n.dom.container:n.dom.menu,o&&this.initialize()}_expand(e=!0){const{openClass:t,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(c(n,this.dom.container),requestAnimationFrame(()=>{c(t,this.dom.container),requestAnimationFrame(()=>{d(n,this.dom.container)})})):t!==""&&c(t,this.dom.container),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:n,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),i!==""?(c(i,this.dom.container),requestAnimationFrame(()=>{n!==""&&d(n,this.dom.container),requestAnimationFrame(()=>{t!==""&&c(t,this.dom.container),requestAnimationFrame(()=>{d(i,this.dom.container)})})})):(t!==""&&c(t,this.dom.container),n!==""&&d(n,this.dom.container)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}class $ extends q{constructor({menuElement:e,menuItemSelector:t=".nav-item,li",menuLinkSelector:n=".nav-link,.dropdown-item",submenuItemSelector:i=".dropdown",submenuToggleSelector:o=".dropdown-toggle",submenuSelector:h=".dropdown-menu",submenuSubtoggleSelector:a=".dropdown-toggle",controllerElement:m=null,containerElement:p=null,openClass:f="show",closeClass:g="collapse",transitionClass:_="transitioning",isTopLevel:M=!0,parentMenu:y=null,hoverType:C="off",hoverDelay:E=250,enterDelay:w=-1,leaveDelay:v=-1,optionalKeySupport:I=!1,disableBootstrap:x=!0,initialize:ue=!0}){super({menuElement:e,menuItemSelector:t,menuLinkSelector:n,submenuItemSelector:i,submenuToggleSelector:o,submenuSelector:h,submenuSubtoggleSelector:a,controllerElement:m,containerElement:p,openClass:f,closeClass:g,transitionClass:_,isTopLevel:M,parentMenu:y,hoverType:C,hoverDelay:E,enterDelay:w,leaveDelay:v,optionalKeySupport:I,initialize:!1});l(this,"_MenuType",$);l(this,"_MenuItemType",ie);l(this,"_MenuToggleType",oe);l(this,"_disableBootstrap",!0);l(this,"_pseudoDropdownElement",document.createElement("div"));l(this,"_bootstrapEvents",["show.bs.dropdown","shown.bs.dropdown","hide.bs.dropdown","hidden.bs.dropdown"]);this._disableBootstrap=x,ue&&this.initialize()}initialize(){super.initialize(),this.bootstrapDisabled&&this._disableBootstrapDropdownBehaviour()}get bootstrapDisabled(){return this._disableBootstrap}get bootstrapPseudoDropdownElement(){return this._pseudoDropdownElement}get bootstrapEvents(){return this._bootstrapEvents}_validate(){let e=super._validate();const t=b("boolean",{disableBootstrap:this._disableBootstrap});return t.status||(this._errors.push(t.error.message),e=!1),e}_disableBootstrapDropdownBehaviour(){this.elements.submenuToggles.forEach(e=>{this.bootstrapEvents.forEach(t=>{e.dom.toggle.addEventListener(t,n=>{u(n);const i=bootstrap.Dropdown.getInstance(n.target);i&&i._menu!==this.bootstrapPseudoDropdownElement&&(i._menu=this.bootstrapPseudoDropdownElement)},{once:!0})})})}}class G extends A{constructor({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n=!1,childMenu:i=null,toggle:o=null,initialize:h=!0}){super({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n,childMenu:i,toggle:o}),h&&this.initialize()}initialize(){super.initialize(),this.dom.item.setAttribute("role","none"),this.dom.link.setAttribute("role","treeitem"),this.dom.link.tabIndex=-1}focus(){super.focus(),this.dom.link.tabIndex=0}blur(){super.blur(),this.dom.link.tabIndex=-1}}class J extends L{constructor({menuToggleElement:s,parentElement:e,controlledMenu:t,parentMenu:n=null,initialize:i=!0}){super({menuToggleElement:s,parentElement:e,controlledMenu:t,parentMenu:n}),i&&this.initialize()}}class P extends k{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:n="a",submenuItemSelector:i="",submenuToggleSelector:o="a",submenuSelector:h="ul",controllerElement:a=null,containerElement:m=null,openClass:p="show",closeClass:f="hide",transitionClass:g="transitioning",isTopLevel:_=!0,parentMenu:M=null,hoverType:y="off",hoverDelay:C=250,enterDelay:E=-1,leaveDelay:w=-1,initialize:v=!0}){super({menuElement:e,menuItemSelector:t,menuLinkSelector:n,submenuItemSelector:i,submenuToggleSelector:o,submenuSelector:h,controllerElement:a,containerElement:m,openClass:p,closeClass:f,transitionClass:g,isTopLevel:_,parentMenu:M,hoverType:y,hoverDelay:C,enterDelay:E,leaveDelay:w});l(this,"_MenuType",P);l(this,"_MenuItemType",G);l(this,"_MenuToggleType",J);v&&this.initialize()}initialize(){try{super.initialize(),this.isTopLevel?(this.dom.menu.setAttribute("role","tree"),this.elements.menuItems[0].dom.link.tabIndex=0):this.dom.menu.setAttribute("role","group"),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(e){console.error(e)}}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=S(e);if(t==="Tab"&&(this.elements.rootMenu.focusState!=="none"?this.elements.rootMenu.blur():this.elements.rootMenu.focus()),this.focusState==="self"){const n=["Space","ArrowUp","ArrowDown","ArrowLeft","Asterisk","Home","End"],i=["Enter","ArrowRight"],o=["Escape"];(n.includes(t)||this.currentMenuItem.isSubmenuItem&&i.includes(t)||this.elements.controller&&o.includes(t))&&u(e)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=S(e),{altKey:n,crtlKey:i,metaKey:o}=e;if(t==="Character"&&!(n||i||o))u(e),this.elements.rootMenu.currentEvent="character",this.focusNextNodeWithCharacter(e.key);else if(this.focusState==="self")if(t==="Enter"||t==="Space")u(e),this.currentMenuItem.isSubmenuItem?this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview():this.currentMenuItem.dom.link.click();else if(t==="Escape")this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(this.elements.controller.close(),this.focusController());else if(t==="ArrowDown")u(e),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.currentMenuItem.elements.childMenu.focusFirstChild()):!this.isTopLevel&&this.currentChild===this.elements.menuItems.length-1?this.focusParentsNextChild():this.focusNextChild();else if(t==="ArrowUp"){u(e);const a=this.elements.menuItems[this.currentChild-1];a&&a.isSubmenuItem&&a.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentChild=this.currentChild-1,this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.focusChildsLastNode()):!this.isTopLevel&&this.currentChild===0?(this.blurCurrentChild(),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.focusCurrentChild()):this.focusPreviousChild()}else t==="ArrowRight"?this.currentMenuItem.isSubmenuItem&&(u(e),this.currentMenuItem.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.currentMenuItem.elements.childMenu.focusFirstChild()):this.currentMenuItem.elements.toggle.preview()):t==="ArrowLeft"?(u(e),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.blurCurrentChild(),this.currentMenuItem.elements.toggle.close()):this.isTopLevel||(this.blurCurrentChild(),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.focusCurrentChild())):t==="Home"?(u(e),this.blurCurrentChild(),this.elements.rootMenu.focusFirstChild()):t==="End"?(u(e),this.blurCurrentChild(),this.elements.rootMenu.focusLastNode()):t==="Asterisk"&&(u(e),this.openChildren())})}focusLastNode(){const e=this.elements.menuItems.length-1,t=this.elements.menuItems[e];t.isSubmenuItem&&t.elements.toggle.isOpen?(this.currentChild=e,t.elements.childMenu.currentEvent=this.currentEvent,t.elements.childMenu.focusLastNode()):this.focusLastChild()}openChildren(){this.elements.submenuToggles.forEach(e=>e.preview())}focusNextNodeWithCharacter(e){function t(p){let f=[];return p.elements.menuItems.forEach(g=>{f.push(g),g.isSubmenuItem&&g.elements.toggle.isOpen&&(f=[...f,...t(g.elements.toggle.elements.controlledMenu)])}),f}const n=e.toLowerCase(),i=t(this.elements.rootMenu),o=i.indexOf(this.currentMenuItem)+1,h=[...i.slice(o),...i.slice(0,o)];let a=0,m=!1;for(;!m&&a<h.length;){let p="";if(h[a].dom.item.innerText?p=h[a].dom.item.innerText:p=h[a].dom.item.textContent,p=p.replace(/[\s]/g,"").toLowerCase().charAt(0),p===n){m=!0;const f=h[a].elements.parentMenu,g=f.elements.menuItems.indexOf(h[a]);this.elements.rootMenu.blurChildren(),f.focusChild(g)}a++}}focusParentsNextChild(){this.elements.parentMenu&&(this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.currentChild===this.elements.parentMenu.elements.menuItems.length-1?(this.elements.parentMenu.blurCurrentChild(),this.elements.parentMenu.focusParentsNextChild()):(this.blurChildren(),this.elements.parentMenu.focusNextChild()))}focusChildsLastNode(){this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.currentMenuItem.elements.childMenu.focusLastChild(),this.currentMenuItem.elements.childMenu.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.childMenu.currentMenuItem.elements.toggle.isOpen&&(this.currentMenuItem.elements.childMenu.blurCurrentChild(),this.currentMenuItem.elements.childMenu.focusChildsLastNode())}}class re extends G{constructor({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n=!1,childMenu:i=null,toggle:o=null,initialize:h=!0}){super({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n,childMenu:i,toggle:o,initialize:!1}),h&&this.initialize()}}class le extends J{constructor({menuToggleElement:e,parentElement:t,controlledMenu:n,parentMenu:i=null,initialize:o=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:n,parentMenu:i,initialize:!1});l(this,"_dom",{toggle:null,parent:null,container:null});this._dom.toggle=e,this._dom.parent=t,this._dom.container=n.isTopLevel?n.dom.container:n.dom.menu,o&&this.initialize()}_expand(e=!0){const{openClass:t,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(c(n,this.dom.container),requestAnimationFrame(()=>{c(t,this.dom.container),requestAnimationFrame(()=>{d(n,this.dom.container)})})):t!==""&&c(t,this.dom.container),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:n,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),i!==""?(c(i,this.dom.container),requestAnimationFrame(()=>{n!==""&&d(n,this.dom.container),requestAnimationFrame(()=>{t!==""&&c(t,this.dom.container),requestAnimationFrame(()=>{d(i,this.dom.container)})})})):(t!==""&&c(t,this.dom.container),n!==""&&d(n,this.dom.container)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}class H extends P{constructor({menuElement:e,menuItemSelector:t=".nav-item,li",menuLinkSelector:n=".nav-link,.dropdown-item",submenuItemSelector:i=".dropdown",submenuToggleSelector:o=".dropdown-toggle",submenuSelector:h=".dropdown-menu",controllerElement:a=null,containerElement:m=null,openClass:p="show",closeClass:f="collapse",transitionClass:g="transitioning",isTopLevel:_=!0,parentMenu:M=null,hoverType:y="off",hoverDelay:C=250,enterDelay:E=-1,leaveDelay:w=-1,disableBootstrap:v=!0,initialize:I=!0}){super({menuElement:e,menuItemSelector:t,menuLinkSelector:n,submenuItemSelector:i,submenuToggleSelector:o,submenuSelector:h,controllerElement:a,containerElement:m,openClass:p,closeClass:f,transitionClass:g,isTopLevel:_,parentMenu:M,hoverType:y,hoverDelay:C,enterDelay:E,leaveDelay:w,initialize:!1});l(this,"_MenuType",H);l(this,"_MenuItemType",re);l(this,"_MenuToggleType",le);l(this,"_disableBootstrap",!0);l(this,"_pseudoDropdownElement",document.createElement("div"));l(this,"_bootstrapEvents",["show.bs.dropdown","shown.bs.dropdown","hide.bs.dropdown","hidden.bs.dropdown"]);this._disableBootstrap=v,I&&this.initialize()}initialize(){super.initialize(),this.bootstrapDisabled&&this._disableBootstrapDropdownBehaviour()}get bootstrapDisabled(){return this._disableBootstrap}get bootstrapPseudoDropdownElement(){return this._pseudoDropdownElement}get bootstrapEvents(){return this._bootstrapEvents}_validate(){let e=super._validate();const t=b("boolean",{disableBootstrap:this._disableBootstrap});return t.status||(this._errors.push(t.error.message),e=!1),e}_disableBootstrapDropdownBehaviour(){this.elements.submenuToggles.forEach(e=>{this.bootstrapEvents.forEach(t=>{e.dom.toggle.addEventListener(t,n=>{u(n);const i=bootstrap.Dropdown.getInstance(n.target);i&&i._menu!==this.bootstrapPseudoDropdownElement&&(i._menu=this.bootstrapPseudoDropdownElement)},{once:!0})})})}}return{Bootstrap5DisclosureMenu:F,Bootstrap5Menubar:B,Bootstrap5TopLinkDisclosureMenu:$,Bootstrap5Treeview:H}}();
- `)}`);if(this.elements.rootMenu===null&&this._findRootMenu(this),this._setDOMElements(),this.isTopLevel&&this.dom.controller&&this.dom.container){const s=new this._MenuToggleType({menuToggleElement:this.dom.controller,parentElement:this.dom.container,controlledMenu:this});this._elements.controller=s}this._createChildElements()}get dom(){return this._dom}get selectors(){return this._selectors}get elements(){return this._elements}get isTopLevel(){return this._root}get openClass(){return this.isTopLevel?this._openClass:this.elements.rootMenu.openClass}get closeClass(){return this.isTopLevel?this._closeClass:this.elements.rootMenu.closeClass}get transitionClass(){return this.isTopLevel?this._transitionClass:this.elements.rootMenu.transitionClass}get currentChild(){return this._currentChild}get focusState(){return this._focusState}get currentEvent(){return this._currentEvent}get currentMenuItem(){return this.elements.menuItems[this.currentChild]}get hoverType(){return this._root?this._hoverType:this.elements.rootMenu.hoverType}get hoverDelay(){return this._root?this._hoverDelay:this.elements.rootMenu.hoverDelay}get enterDelay(){return this._enterDelay===-1?this.hoverDelay:this._root?this._enterDelay:this.elements.rootMenu.enterDelay}get leaveDelay(){return this._leaveDelay===-1?this.hoverDelay:this._root?this._leaveDelay:this.elements.rootMenu.leaveDelay}get shouldFocus(){let s=!1;return(this.currentEvent==="keyboard"||this.currentEvent==="character")&&(s=!0),this.currentEvent==="mouse"&&this.hoverType==="dynamic"&&(s=!0),s}get errors(){return this._errors}set openClass(s){D({openClass:s}),this._openClass!==s&&(this._openClass=s)}set closeClass(s){D({closeClass:s}),this._closeClass!==s&&(this._closeClass=s)}set transitionClass(s){D({transitionClass:s}),this._transitionClass!==s&&(this._transitionClass=s)}set currentChild(s){b("number",{value:s});function e(t){if(["mouse","character"].includes(t.currentEvent)&&t.elements.parentMenu){let i=0,o=!1;for(;!o&&i<t.elements.parentMenu.elements.menuItems.length;){const h=t.elements.parentMenu.elements.menuItems[i];h.isSubmenuItem&&h.elements.toggle.elements.controlledMenu===t&&(o=!0,t.elements.parentMenu.currentEvent=t.currentEvent,t.elements.parentMenu.currentChild=i),i++}}}s<-1?(this._currentChild=-1,e(this)):s>=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,e(this)):this.focusChild!==s&&(this._currentChild=s,e(this))}set focusState(s){J({value:s}),this._focusState!==s&&(this._focusState=s),this.elements.submenuToggles.length>0&&(s==="self"||s==="none")&&this.elements.submenuToggles.forEach(e=>{e.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(s==="self"||s==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(s){X({value:s}),this._currentEvent!==s&&(this._currentEvent=s,this.elements.submenuToggles.length>0&&this.elements.submenuToggles.forEach(e=>{e.elements.controlledMenu.currentEvent=s}))}set hoverType(s){N({value:s}),this._hoverType!==s&&(this._hoverType=s)}set hoverDelay(s){b("number",{value:s}),this._hoverDelay!==s&&(this._hoverDelay=s)}set enterDelay(s){b("number",{value:s}),this._enterDelay!==s&&(this._enterDelay=s)}set leaveDelay(s){b("number",{value:s}),this._leaveDelay!==s&&(this._leaveDelay=s)}_validate(){let s=!0,e;this._dom.container!==null||this._dom.controller!==null?e=T(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):e=T(HTMLElement,{menuElement:this._dom.menu}),e.status||(this._errors.push(e.error.message),s=!1);let t;if(this._selectors.submenuItems!==""?t=z({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):t=z({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),t.status||(this._errors.push(t.error.message),s=!1),this._openClass!==""){const m=D({openClass:this._openClass});m.status||(this._errors.push(m.error.message),s=!1)}if(this._closeClass!==""){const m=D({closeClass:this._closeClass});m.status||(this._errors.push(m.error.message),s=!1)}if(this._transitionClass!==""){const m=D({transitionClass:this._transitionClass});m.status||(this._errors.push(m.error.message),s=!1)}const n=b("boolean",{isTopLevel:this._root});if(n.status||(this._errors.push(n.error.message),s=!1),this._elements.parentMenu!==null){const m=T(S,{parentMenu:this._elements.parentMenu});m.status||(this._errors.push(m.error.message),s=!1)}const i=N({hoverType:this._hoverType});i.status||(this._errors.push(i.error.message),s=!1);const o=b("number",{hoverDelay:this._hoverDelay});o.status||(this._errors.push(o.error.message),s=!1);const h=b("number",{enterDelay:this._enterDelay});h.status||(this._errors.push(h.error.message),s=!1);const a=b("number",{leaveDelay:this._leaveDelay});return a.status||(this._errors.push(a.error.message),s=!1),s}_setDOMElementType(s,e=this.dom.menu,t=!0){if(typeof this.selectors[s]=="string"){if(!Array.isArray(this.dom[s]))throw new Error(`AccessibleMenu: The "${s}" element cannot be set through _setDOMElementType.`);e!==this.dom.menu&&T(HTMLElement,{base:e});const i=Array.from(e.querySelectorAll(this.selectors[s])).filter(o=>o.parentElement===e);t?this._dom[s]=i:this._dom[s]=[...this._dom[s],...i]}else throw new Error(`AccessibleMenu: "${s}" is not a valid element type within the menu.`)}_resetDOMElementType(s){if(typeof this.dom[s]<"u"){if(!Array.isArray(this.dom[s]))throw new Error(`AccessibleMenu: The "${s}" element cannot be reset through _resetDOMElementType.`);this._dom[s]=[]}else throw new Error(`AccessibleMenu: "${s}" is not a valid element type within the menu.`)}_setDOMElements(){this._setDOMElementType("menuItems"),this.selectors.submenuItems!==""&&(this._setDOMElementType("submenuItems"),this._resetDOMElementType("submenuToggles"),this._resetDOMElementType("submenus"),this.dom.submenuItems.forEach(s=>{this._setDOMElementType("submenuToggles",s,!1),this._setDOMElementType("submenus",s,!1)}))}_findRootMenu(s){if(s.isTopLevel)this._elements.rootMenu=s;else if(s.elements.parentMenu!==null)this._findRootMenu(s.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(s=>{let e;if(this.dom.submenuItems.includes(s)){const t=s.querySelector(this.selectors.submenuToggles),n=s.querySelector(this.selectors.submenus),i=new this._MenuType({menuElement:n,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuToggles,submenuSelector:this.selectors.submenus,openClass:this.openClass,closeClass:this.closeClass,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),o=new this._MenuToggleType({menuToggleElement:t,parentElement:s,controlledMenu:i,parentMenu:this});this._elements.submenuToggles.push(o),e=new this._MenuItemType({menuItemElement:s,menuLinkElement:t,parentMenu:this,isSubmenuItem:!0,childMenu:i,toggle:o})}else{const t=s.querySelector(this.selectors.menuLinks);e=new this._MenuItemType({menuItemElement:s,menuLinkElement:t,parentMenu:this})}this._elements.menuItems.push(e)})}_handleFocus(){this.elements.menuItems.forEach((s,e)=>{s.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=e})})}_handleClick(){function s(e,t,n){u(n),t.toggle(),t.isOpen&&(e.focusState="self",t.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t)},{passive:!0}),e.isSubmenuItem&&e.elements.toggle.dom.toggle.addEventListener("pointerup",n=>{this.currentEvent="mouse",s(this,e.elements.toggle,n)})}),this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("pointerup",e=>{this.currentEvent="mouse",s(this,this.elements.controller,e)})}_handleHover(){this.elements.menuItems.forEach((s,e)=>{s.dom.link.addEventListener("pointerenter",t=>{if(!(t.pointerType==="pen"||t.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(e),s.isSubmenuItem&&(this.enterDelay>0?this._hoverTimeout=setTimeout(()=>{s.elements.toggle.preview()},this.enterDelay):s.elements.toggle.preview());else if(this.hoverType==="dynamic"){const n=this.elements.submenuToggles.some(i=>i.isOpen);this.currentChild=e,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),s.isSubmenuItem&&(!this.isTopLevel||n)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?this._hoverTimeout=setTimeout(()=>{s.elements.toggle.preview()},this.enterDelay):s.elements.toggle.preview())}}}),s.isSubmenuItem&&s.dom.item.addEventListener("pointerleave",t=>{t.pointerType==="pen"||t.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",s.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",s.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",s.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",s.elements.toggle.close(),this.focusCurrentChild()))))})})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",s=>{this.currentEvent="keyboard";const e=k(s);(e==="Space"||e==="Enter")&&u(s)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",s=>{this.currentEvent="keyboard";const e=k(s);(e==="Space"||e==="Enter")&&(u(s),this.elements.controller.toggle(),this.elements.controller.isOpen&&this.focusFirstChild())})}focus(){this.focusState="self",this.shouldFocus&&this.dom.menu.focus()}blur(){this.focusState="none",this.shouldFocus&&this.dom.menu.blur()}focusCurrentChild(){this.focusState="self",this.currentChild!==-1&&this.currentMenuItem.focus()}focusChild(s){this.blurCurrentChild(),this.currentChild=s,this.focusCurrentChild()}focusFirstChild(){this.focusChild(0)}focusLastChild(){this.focusChild(this.elements.menuItems.length-1)}focusNextChild(){this.currentChild<this.elements.menuItems.length-1?this.focusChild(this.currentChild+1):this.focusCurrentChild()}focusPreviousChild(){this.currentChild>0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&this.currentMenuItem.blur()}focusController(){this.dom.controller&&(this.shouldFocus&&this.dom.controller.focus(),this.focusState="none")}focusContainer(){this.dom.container&&(this.shouldFocus&&this.dom.container.focus(),this.focusState="none")}closeChildren(){this.elements.submenuToggles.forEach(s=>s.close())}blurChildren(){this.elements.menuItems.forEach(s=>{s.blur(),s.isSubmenuItem&&s.elements.childMenu.blurChildren()})}}class j extends L{constructor({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n=!1,childMenu:i=null,toggle:o=null,initialize:h=!0}){super({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n,childMenu:i,toggle:o}),h&&this.initialize()}}class V extends A{constructor({menuToggleElement:s,parentElement:e,controlledMenu:t,parentMenu:n=null,initialize:i=!0}){super({menuToggleElement:s,parentElement:e,controlledMenu:t,parentMenu:n}),i&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&this.closeChildren(),super.close()}}class O extends S{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:n="a",submenuItemSelector:i="",submenuToggleSelector:o="button",submenuSelector:h="ul",controllerElement:a=null,containerElement:m=null,openClass:p="show",closeClass:f="hide",transitionClass:g="transitioning",isTopLevel:_=!0,parentMenu:y=null,hoverType:M="off",hoverDelay:C=250,enterDelay:E=-1,leaveDelay:w=-1,optionalKeySupport:v=!1,initialize:I=!0}){super({menuElement:e,menuItemSelector:t,menuLinkSelector:n,submenuItemSelector:i,submenuToggleSelector:o,submenuSelector:h,controllerElement:a,containerElement:m,openClass:p,closeClass:f,transitionClass:g,isTopLevel:_,parentMenu:y,hoverType:M,hoverDelay:C,enterDelay:E,leaveDelay:w});l(this,"_MenuType",O);l(this,"_MenuItemType",j);l(this,"_MenuToggleType",V);l(this,"_currentChild",-1);l(this,"_optionalSupport",!1);this._optionalSupport=v,I&&this.initialize()}initialize(){try{super.initialize(),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(e){console.error(e)}}get optionalKeySupport(){return this.isTopLevel?this._optionalSupport:this.elements.rootMenu.optionalKeySupport}set optionalKeySupport(e){b("boolean",{optionalKeySupport:e}),this._optionalSupport=e}_validate(){let e=super._validate();const t=b("boolean",{optionalKeySupport:this._optionalSupport});return t.status||(this._errors.push(t.error.message),e=!1),e}_handleClick(){super._handleClick(),document.addEventListener("pointerup",e=>{this.focusState!=="none"&&(this.currentEvent="mouse",!this.dom.menu.contains(e.target)&&!this.dom.menu!==e.target&&(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=k(e);if(this.focusState==="self"){const n=["Space","Enter"],i=["Escape"],o=["Escape"];this.optionalKeySupport?["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(t)&&u(e):(this.currentMenuItem.isSubmenuItem&&n.includes(t)||this.elements.controller&&i.includes(t)||this.elements.parentMenu&&o.includes(t))&&u(e)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=k(e);this.focusState==="self"&&(t==="Space"||t==="Enter"?this.currentMenuItem.isSubmenuItem?(u(e),this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview()):this.currentMenuItem.dom.link.click():t==="Escape"?this.elements.submenuToggles.some(i=>i.isOpen)?(u(e),this.closeChildren()):this.elements.parentMenu?(u(e),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.closeChildren(),this.elements.parentMenu.focusCurrentChild()):this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(this.elements.controller.close(),this.focusController()):this.optionalKeySupport&&(t==="ArrowDown"||t==="ArrowRight"?(u(e),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.childMenu.focusFirstChild()):this.focusNextChild()):t==="ArrowUp"||t==="ArrowLeft"?(u(e),this.focusPreviousChild()):t==="Home"?(u(e),this.focusFirstChild()):t==="End"&&(u(e),this.focusLastChild())))})}}class ee extends j{constructor({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n=!1,childMenu:i=null,toggle:o=null,initialize:h=!0}){super({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n,childMenu:i,toggle:o,initialize:!1}),h&&this.initialize()}}class te extends V{constructor({menuToggleElement:e,parentElement:t,controlledMenu:n,parentMenu:i=null,initialize:o=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:n,parentMenu:i,initialize:!1});l(this,"_dom",{toggle:null,parent:null,container:null});this._dom.toggle=e,this._dom.parent=t,this._dom.container=n.isTopLevel?n.dom.container:n.dom.menu,o&&this.initialize()}_expand(e=!0){const{openClass:t,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(c(n,this.dom.container),requestAnimationFrame(()=>{c(t,this.dom.container),requestAnimationFrame(()=>{d(n,this.dom.container)})})):t!==""&&c(t,this.dom.container),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:n,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),i!==""?(c(i,this.dom.container),requestAnimationFrame(()=>{n!==""&&d(n,this.dom.container),requestAnimationFrame(()=>{t!==""&&c(t,this.dom.container),requestAnimationFrame(()=>{d(i,this.dom.container)})})})):(t!==""&&c(t,this.dom.container),n!==""&&d(n,this.dom.container)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}class F extends O{constructor({menuElement:e,menuItemSelector:t=".nav-item,li",menuLinkSelector:n=".nav-link,.dropdown-item",submenuItemSelector:i=".dropdown",submenuToggleSelector:o=".dropdown-toggle",submenuSelector:h=".dropdown-menu",controllerElement:a=null,containerElement:m=null,openClass:p="show",closeClass:f="collapse",transitionClass:g="transitioning",isTopLevel:_=!0,parentMenu:y=null,hoverType:M="off",hoverDelay:C=250,enterDelay:E=-1,leaveDelay:w=-1,optionalKeySupport:v=!1,disableBootstrap:I=!0,initialize:x=!0}){super({menuElement:e,menuItemSelector:t,menuLinkSelector:n,submenuItemSelector:i,submenuToggleSelector:o,submenuSelector:h,controllerElement:a,containerElement:m,openClass:p,closeClass:f,transitionClass:g,isTopLevel:_,parentMenu:y,hoverType:M,hoverDelay:C,enterDelay:E,leaveDelay:w,optionalKeySupport:v,initialize:!1});l(this,"_MenuType",F);l(this,"_MenuItemType",ee);l(this,"_MenuToggleType",te);l(this,"_disableBootstrap",!0);l(this,"_pseudoDropdownElement",document.createElement("div"));l(this,"_bootstrapEvents",["show.bs.dropdown","shown.bs.dropdown","hide.bs.dropdown","hidden.bs.dropdown"]);this._disableBootstrap=I,x&&this.initialize()}initialize(){super.initialize(),this.bootstrapDisabled&&this._disableBootstrapDropdownBehaviour()}get bootstrapDisabled(){return this._disableBootstrap}get bootstrapPseudoDropdownElement(){return this._pseudoDropdownElement}get bootstrapEvents(){return this._bootstrapEvents}_validate(){let e=super._validate();const t=b("boolean",{disableBootstrap:this._disableBootstrap});return t.status||(this._errors.push(t.error.message),e=!1),e}_disableBootstrapDropdownBehaviour(){this.elements.submenuToggles.forEach(e=>{this.bootstrapEvents.forEach(t=>{e.dom.toggle.addEventListener(t,n=>{u(n);const i=bootstrap.Dropdown.getInstance(n.target);i&&i._menu!==this.bootstrapPseudoDropdownElement&&(i._menu=this.bootstrapPseudoDropdownElement)},{once:!0})})})}}class R extends L{constructor({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n=!1,childMenu:i=null,toggle:o=null,initialize:h=!0}){super({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n,childMenu:i,toggle:o}),h&&this.initialize()}initialize(){super.initialize(),this.dom.item.setAttribute("role","none"),this.dom.link.setAttribute("role","menuitem"),this.dom.link.tabIndex=-1}focus(){super.focus(),this.elements.parentMenu.isTopLevel&&(this.dom.link.tabIndex=0)}blur(){super.blur(),this.elements.parentMenu.isTopLevel&&(this.dom.link.tabIndex=-1)}}class U extends A{constructor({menuToggleElement:s,parentElement:e,controlledMenu:t,parentMenu:n=null,initialize:i=!0}){super({menuToggleElement:s,parentElement:e,controlledMenu:t,parentMenu:n}),i&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&(this.closeChildren(),this.elements.parentMenu&&this.elements.parentMenu.focusCurrentChild()),super.close()}}class K extends S{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:n="a",submenuItemSelector:i="",submenuToggleSelector:o="a",submenuSelector:h="ul",controllerElement:a=null,containerElement:m=null,openClass:p="show",closeClass:f="hide",transitionClass:g="transitioning",isTopLevel:_=!0,parentMenu:y=null,hoverType:M="off",hoverDelay:C=250,enterDelay:E=-1,leaveDelay:w=-1,initialize:v=!0}){super({menuElement:e,menuItemSelector:t,menuLinkSelector:n,submenuItemSelector:i,submenuToggleSelector:o,submenuSelector:h,controllerElement:a,containerElement:m,openClass:p,closeClass:f,transitionClass:g,isTopLevel:_,parentMenu:y,hoverType:M,hoverDelay:C,enterDelay:E,leaveDelay:w});l(this,"_MenuType",K);l(this,"_MenuItemType",R);l(this,"_MenuToggleType",U);v&&this.initialize()}initialize(){try{super.initialize(),this.isTopLevel?this.dom.menu.setAttribute("role","menubar"):this.dom.menu.setAttribute("role","menu"),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup(),this.isTopLevel&&(this.elements.menuItems[0].dom.link.tabIndex=0)}catch(e){console.error(e)}}_handleClick(){super._handleClick(),document.addEventListener("pointerup",e=>{this.focusState!=="none"&&(this.currentEvent="mouse",!this.dom.menu.contains(e.target)&&!this.dom.menu!==e.target&&(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=k(e);if(t==="Tab"&&(this.elements.rootMenu.focusState!=="none"?(this.elements.rootMenu.blur(),this.elements.rootMenu.closeChildren()):this.elements.rootMenu.focus()),t==="Character")u(e);else if(this.isTopLevel){if(this.focusState==="self"){const n=["ArrowRight","ArrowLeft","Home","End"],i=["Space","Enter","ArrowDown","ArrowUp"],o=["Escape"];(n.includes(t)||this.currentMenuItem.isSubmenuItem&&i.includes(t)||this.elements.controller&&o.includes(t))&&u(e)}}else{const n=["Escape","ArrowRight","ArrowLeft","ArrowDown","ArrowUp","Home","End"],i=["Space","Enter"];(n.includes(t)||this.currentMenuItem.isSubmenuItem&&i.includes(t))&&u(e)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=k(e),{altKey:n,crtlKey:i,metaKey:o}=e;if(t==="Character"&&!(n||i||o))u(e),this.elements.rootMenu.currentEvent="character",this.focusNextChildWithCharacter(e.key);else if(this.isTopLevel){if(this.focusState==="self")if(t==="Space"||t==="Enter")this.currentMenuItem.isSubmenuItem?(u(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):this.currentMenuItem.dom.link.click();else if(t==="ArrowRight"){u(e);const a=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusNextChild(),a&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else if(t==="ArrowLeft"){u(e);const a=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusPreviousChild(),a&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else t==="ArrowDown"?this.currentMenuItem.isSubmenuItem&&(u(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):t==="ArrowUp"?this.currentMenuItem.isSubmenuItem&&(u(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusLastChild()})):t==="Home"?(u(e),this.focusFirstChild()):t==="End"?(u(e),this.focusLastChild()):t==="Escape"&&(this.elements.submenuToggles.some(m=>m.isOpen)?(u(e),this.closeChildren()):this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(u(e),this.elements.controller.close(),this.focusController()))}else t==="Space"||t==="Enter"?this.currentMenuItem.isSubmenuItem?(u(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):this.currentMenuItem.dom.link.click():t==="Escape"?(u(e),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusCurrentChild()):t==="ArrowRight"?this.currentMenuItem.isSubmenuItem?(u(e),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):(u(e),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusNextChild(),this.elements.rootMenu.currentMenuItem.isSubmenuItem&&this.elements.rootMenu.currentMenuItem.elements.toggle.preview()):t==="ArrowLeft"?this.elements.parentMenu.currentMenuItem.isSubmenuItem&&(u(e),this.elements.parentMenu.currentMenuItem.elements.toggle.close(),this.elements.parentMenu.focusCurrentChild(),this.elements.parentMenu===this.elements.rootMenu&&(this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusPreviousChild(),this.elements.rootMenu.currentMenuItem.isSubmenuItem&&(this.elements.rootMenu.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.elements.rootMenu.currentMenuItem.elements.toggle.preview()))):t==="ArrowDown"?(u(e),this.focusNextChild()):t==="ArrowUp"?(u(e),this.focusPreviousChild()):t==="Home"?(u(e),this.focusFirstChild()):t==="End"&&(u(e),this.focusLastChild())})}focusNextChild(){this.currentChild===this.elements.menuItems.length-1?this.focusFirstChild():this.focusChild(this.currentChild+1)}focusPreviousChild(){this.currentChild===0?this.focusLastChild():this.focusChild(this.currentChild-1)}focusNextChildWithCharacter(e){const t=e.toLowerCase();let n=this.currentChild+1,i=!1;for(;!i&&n<this.elements.menuItems.length;){let o="";this.elements.menuItems[n].dom.item.innerText?o=this.elements.menuItems[n].dom.item.innerText:o=this.elements.menuItems[n].dom.item.textContent,o=o.replace(/[\s]/g,"").toLowerCase().charAt(0),o===t&&(i=!0,this.focusChild(n)),n++}}}class se extends R{constructor({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n=!1,childMenu:i=null,toggle:o=null,initialize:h=!0}){super({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n,childMenu:i,toggle:o,initialize:!1}),h&&this.initialize()}}class ne extends U{constructor({menuToggleElement:e,parentElement:t,controlledMenu:n,parentMenu:i=null,initialize:o=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:n,parentMenu:i,initialize:!1});l(this,"_dom",{toggle:null,parent:null,container:null});this._dom.toggle=e,this._dom.parent=t,this._dom.container=n.isTopLevel?n.dom.container:n.dom.menu,o&&this.initialize()}_expand(e=!0){const{openClass:t,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(c(n,this.dom.container),requestAnimationFrame(()=>{c(t,this.dom.container),requestAnimationFrame(()=>{d(n,this.dom.container)})})):t!==""&&c(t,this.dom.container),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:n,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),i!==""?(c(i,this.dom.container),requestAnimationFrame(()=>{n!==""&&d(n,this.dom.container),requestAnimationFrame(()=>{t!==""&&c(t,this.dom.container),requestAnimationFrame(()=>{d(i,this.dom.container)})})})):(t!==""&&c(t,this.dom.container),n!==""&&d(n,this.dom.container)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}class B extends K{constructor({menuElement:e,menuItemSelector:t=".nav-item,li",menuLinkSelector:n=".nav-link,.dropdown-item",submenuItemSelector:i=".dropdown",submenuToggleSelector:o=".dropdown-toggle",submenuSelector:h=".dropdown-menu",controllerElement:a=null,containerElement:m=null,openClass:p="show",closeClass:f="collapse",transitionClass:g="transitioning",isTopLevel:_=!0,parentMenu:y=null,hoverType:M="off",hoverDelay:C=250,enterDelay:E=-1,leaveDelay:w=-1,disableBootstrap:v=!0,initialize:I=!0}){super({menuElement:e,menuItemSelector:t,menuLinkSelector:n,submenuItemSelector:i,submenuToggleSelector:o,submenuSelector:h,controllerElement:a,containerElement:m,openClass:p,closeClass:f,transitionClass:g,isTopLevel:_,parentMenu:y,hoverType:M,hoverDelay:C,enterDelay:E,leaveDelay:w,initialize:!1});l(this,"_MenuType",B);l(this,"_MenuItemType",se);l(this,"_MenuToggleType",ne);l(this,"_disableBootstrap",!0);l(this,"_pseudoDropdownElement",document.createElement("div"));l(this,"_bootstrapEvents",["show.bs.dropdown","shown.bs.dropdown","hide.bs.dropdown","hidden.bs.dropdown"]);this._disableBootstrap=v,I&&this.initialize()}initialize(){super.initialize(),this.bootstrapDisabled&&this._disableBootstrapDropdownBehaviour()}get bootstrapDisabled(){return this._disableBootstrap}get bootstrapPseudoDropdownElement(){return this._pseudoDropdownElement}get bootstrapEvents(){return this._bootstrapEvents}_validate(){let e=super._validate();const t=b("boolean",{disableBootstrap:this._disableBootstrap});return t.status||(this._errors.push(t.error.message),e=!1),e}_disableBootstrapDropdownBehaviour(){this.elements.submenuToggles.forEach(e=>{this.bootstrapEvents.forEach(t=>{e.dom.toggle.addEventListener(t,n=>{u(n);const i=bootstrap.Dropdown.getInstance(n.target);i&&i._menu!==this.bootstrapPseudoDropdownElement&&(i._menu=this.bootstrapPseudoDropdownElement)},{once:!0})})})}}class W extends L{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:n,isSubmenuItem:i=!1,childMenu:o=null,toggle:h=null,initialize:a=!0,submenuSibling:m=null}){super({menuItemElement:e,menuLinkElement:t,parentMenu:n,isSubmenuItem:i,childMenu:o,toggle:h});l(this,"_elements",{parentMenu:null,childMenu:null,toggle:null,sibling:null});this._elements.parentMenu=n,this._elements.childMenu=o,this._elements.toggle=h,this._elements.sibling=m,a&&this.initialize()}}class Z extends A{constructor({menuToggleElement:s,parentElement:e,controlledMenu:t,parentMenu:n=null,initialize:i=!0}){super({menuToggleElement:s,parentElement:e,controlledMenu:t,parentMenu:n}),i&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&this.closeChildren(),super.close()}}class q extends S{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:n="a",submenuItemSelector:i="",submenuToggleSelector:o="button",submenuSelector:h="ul",submenuSubtoggleSelector:a="a",controllerElement:m=null,containerElement:p=null,openClass:f="show",closeClass:g="hide",transitionClass:_="transitioning",isTopLevel:y=!0,parentMenu:M=null,hoverType:C="off",hoverDelay:E=250,enterDelay:w=-1,leaveDelay:v=-1,optionalKeySupport:I=!1,initialize:x=!0}){super({menuElement:e,menuItemSelector:t,menuLinkSelector:n,submenuItemSelector:i,submenuSelector:h,submenuToggleSelector:o,controllerElement:m,containerElement:p,openClass:f,closeClass:g,transitionClass:_,isTopLevel:y,parentMenu:M,hoverType:C,hoverDelay:E,enterDelay:w,leaveDelay:v});l(this,"_MenuType",q);l(this,"_MenuItemType",W);l(this,"_MenuToggleType",Z);l(this,"_currentChild",-1);l(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:"",submenuSubtoggles:""});l(this,"_optionalSupport",!1);this._optionalSupport=I,this._selectors.menuItems=t,this._selectors.submenuItems=i,this._selectors.submenuToggles=o,this._selectors.submenus=h,this._selectors.submenuSubtoggles=a,this._selectors.menuLinks=[...new Set([n,o])].join(","),x&&this.initialize()}initialize(){try{super.initialize(),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(e){console.error(e)}}get optionalKeySupport(){return this.isTopLevel?this._optionalSupport:this.elements.rootMenu.optionalKeySupport}set optionalKeySupport(e){b("boolean",{optionalKeySupport:e}),this._optionalSupport=e}_createChildElements(){this.dom.menuItems.forEach(e=>{let t,n;const i=e.querySelector(this.selectors.menuLinks);if(this.dom.submenuItems.includes(e)){const o=e.querySelector(this.selectors.submenuToggles),h=e.querySelector(this.selectors.submenus),a=new this._MenuType({menuElement:h,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuSubtoggles,submenuSelector:this.selectors.submenus,submenuSubtoggleSelector:this.selectors.submenuSubtoggles,openClass:this.openClass,closeClass:this.closeClass,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),m=new this._MenuToggleType({menuToggleElement:o,parentElement:e,controlledMenu:a,parentMenu:this});this._elements.submenuToggles.push(m),o!==i?(n=new this._MenuItemType({menuItemElement:e,menuLinkElement:o,parentMenu:this,isSubmenuItem:!0,childMenu:a,toggle:m}),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:i,parentMenu:this,submenuSibling:n})):t=new this._MenuItemType({menuItemElement:e,menuLinkElement:i,parentMenu:this,isSubmenuItem:!0,childMenu:a,toggle:m})}else t=new this._MenuItemType({menuItemElement:e,menuLinkElement:i,parentMenu:this});this._elements.menuItems.push(t),typeof n<"u"&&this._elements.menuItems.push(n)})}_validate(){let e=super._validate();const t=z({submenuSubtoggleSelector:this._selectors.submenuSubtoggles});t.status||(this._errors.push(t.error.message),e=!1);const n=b("boolean",{optionalKeySupport:this._optionalSupport});return n.status||(this._errors.push(n.error.message),e=!1),e}_handleClick(){super._handleClick(),document.addEventListener("pointerup",e=>{this.focusState!=="none"&&(this.currentEvent="mouse",!this.dom.menu.contains(e.target)&&!this.dom.menu!==e.target&&(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))})}_handleHover(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("pointerenter",n=>{if(!(n.pointerType==="pen"||n.pointerType==="touch")){if(this.hoverType==="on"){this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t);let i=e.isSubmenuItem?e.elements.toggle:null;if(e.elements.sibling!==null&&(i=e.elements.sibling.elements.toggle),i===null)return;this.enterDelay>0?(clearTimeout(this._hoverTimeout),this._hoverTimeout=setTimeout(()=>{i.preview()},this.enterDelay)):i.preview()}else if(this.hoverType==="dynamic"){const i=this.elements.submenuToggles.some(o=>o.isOpen);if(this.currentChild=t,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),!this.isTopLevel||i){this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild();let o=e.isSubmenuItem?e.elements.toggle:null;if(e.elements.sibling!==null&&(o=e.elements.sibling.elements.toggle),o===null)return;this.enterDelay>0?(clearTimeout(this._hoverTimeout),this._hoverTimeout=setTimeout(()=>{o.preview()},this.enterDelay)):o.preview()}}}}),e.isSubmenuItem&&e.dom.item.addEventListener("pointerleave",n=>{n.pointerType==="pen"||n.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))})})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=k(e);if(this.focusState==="self"){const n=["Space","Enter"],i=["Escape"],o=["Escape"];this.optionalKeySupport?["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(t)&&u(e):(this.currentMenuItem.isSubmenuItem&&n.includes(t)||this.elements.controller&&i.includes(t)||this.elements.parentMenu&&o.includes(t))&&u(e)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=k(e);this.focusState==="self"&&(t==="Space"||t==="Enter"?this.currentMenuItem.isSubmenuItem?(u(e),this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview()):this.currentMenuItem.dom.link.click():t==="Escape"?this.elements.submenuToggles.some(i=>i.isOpen)?(u(e),this.closeChildren()):this.elements.parentMenu?(u(e),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.closeChildren(),this.elements.parentMenu.focusCurrentChild()):this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(this.elements.controller.close(),this.focusController()):this.optionalKeySupport&&(t==="ArrowDown"||t==="ArrowRight"?(u(e),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.childMenu.focusFirstChild()):this.focusNextChild()):t==="ArrowUp"||t==="ArrowLeft"?(u(e),this.focusPreviousChild()):t==="Home"?(u(e),this.focusFirstChild()):t==="End"&&(u(e),this.focusLastChild())))})}}class ie extends W{constructor({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n=!1,childMenu:i=null,toggle:o=null,initialize:h=!0,submenuSibling:a=null}){super({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n,childMenu:i,toggle:o,initialize:!1,submenuSibling:a}),h&&this.initialize()}}class oe extends Z{constructor({menuToggleElement:e,parentElement:t,controlledMenu:n,parentMenu:i=null,initialize:o=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:n,parentMenu:i,initialize:!1});l(this,"_dom",{toggle:null,parent:null,container:null});this._dom.toggle=e,this._dom.parent=t,this._dom.container=n.isTopLevel?n.dom.container:n.dom.menu,o&&this.initialize()}_expand(e=!0){const{openClass:t,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(c(n,this.dom.container),requestAnimationFrame(()=>{c(t,this.dom.container),requestAnimationFrame(()=>{d(n,this.dom.container)})})):t!==""&&c(t,this.dom.container),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:n,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),i!==""?(c(i,this.dom.container),requestAnimationFrame(()=>{n!==""&&d(n,this.dom.container),requestAnimationFrame(()=>{t!==""&&c(t,this.dom.container),requestAnimationFrame(()=>{d(i,this.dom.container)})})})):(t!==""&&c(t,this.dom.container),n!==""&&d(n,this.dom.container)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}class $ extends q{constructor({menuElement:e,menuItemSelector:t=".nav-item,li",menuLinkSelector:n=".nav-link,.dropdown-item",submenuItemSelector:i=".dropdown",submenuToggleSelector:o=".dropdown-toggle",submenuSelector:h=".dropdown-menu",submenuSubtoggleSelector:a=".dropdown-toggle",controllerElement:m=null,containerElement:p=null,openClass:f="show",closeClass:g="collapse",transitionClass:_="transitioning",isTopLevel:y=!0,parentMenu:M=null,hoverType:C="off",hoverDelay:E=250,enterDelay:w=-1,leaveDelay:v=-1,optionalKeySupport:I=!1,disableBootstrap:x=!0,initialize:ue=!0}){super({menuElement:e,menuItemSelector:t,menuLinkSelector:n,submenuItemSelector:i,submenuToggleSelector:o,submenuSelector:h,submenuSubtoggleSelector:a,controllerElement:m,containerElement:p,openClass:f,closeClass:g,transitionClass:_,isTopLevel:y,parentMenu:M,hoverType:C,hoverDelay:E,enterDelay:w,leaveDelay:v,optionalKeySupport:I,initialize:!1});l(this,"_MenuType",$);l(this,"_MenuItemType",ie);l(this,"_MenuToggleType",oe);l(this,"_disableBootstrap",!0);l(this,"_pseudoDropdownElement",document.createElement("div"));l(this,"_bootstrapEvents",["show.bs.dropdown","shown.bs.dropdown","hide.bs.dropdown","hidden.bs.dropdown"]);this._disableBootstrap=x,ue&&this.initialize()}initialize(){super.initialize(),this.bootstrapDisabled&&this._disableBootstrapDropdownBehaviour()}get bootstrapDisabled(){return this._disableBootstrap}get bootstrapPseudoDropdownElement(){return this._pseudoDropdownElement}get bootstrapEvents(){return this._bootstrapEvents}_validate(){let e=super._validate();const t=b("boolean",{disableBootstrap:this._disableBootstrap});return t.status||(this._errors.push(t.error.message),e=!1),e}_disableBootstrapDropdownBehaviour(){this.elements.submenuToggles.forEach(e=>{this.bootstrapEvents.forEach(t=>{e.dom.toggle.addEventListener(t,n=>{u(n);const i=bootstrap.Dropdown.getInstance(n.target);i&&i._menu!==this.bootstrapPseudoDropdownElement&&(i._menu=this.bootstrapPseudoDropdownElement)},{once:!0})})})}}class Q extends L{constructor({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n=!1,childMenu:i=null,toggle:o=null,initialize:h=!0}){super({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n,childMenu:i,toggle:o}),h&&this.initialize()}initialize(){super.initialize(),this.dom.item.setAttribute("role","none"),this.dom.link.setAttribute("role","treeitem"),this.dom.link.tabIndex=-1}focus(){super.focus(),this.dom.link.tabIndex=0}blur(){super.blur(),this.dom.link.tabIndex=-1}}class G extends A{constructor({menuToggleElement:s,parentElement:e,controlledMenu:t,parentMenu:n=null,initialize:i=!0}){super({menuToggleElement:s,parentElement:e,controlledMenu:t,parentMenu:n}),i&&this.initialize()}}class P extends S{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:n="a",submenuItemSelector:i="",submenuToggleSelector:o="a",submenuSelector:h="ul",controllerElement:a=null,containerElement:m=null,openClass:p="show",closeClass:f="hide",transitionClass:g="transitioning",isTopLevel:_=!0,parentMenu:y=null,hoverType:M="off",hoverDelay:C=250,enterDelay:E=-1,leaveDelay:w=-1,initialize:v=!0}){super({menuElement:e,menuItemSelector:t,menuLinkSelector:n,submenuItemSelector:i,submenuToggleSelector:o,submenuSelector:h,controllerElement:a,containerElement:m,openClass:p,closeClass:f,transitionClass:g,isTopLevel:_,parentMenu:y,hoverType:M,hoverDelay:C,enterDelay:E,leaveDelay:w});l(this,"_MenuType",P);l(this,"_MenuItemType",Q);l(this,"_MenuToggleType",G);v&&this.initialize()}initialize(){try{super.initialize(),this.isTopLevel?(this.dom.menu.setAttribute("role","tree"),this.elements.menuItems[0].dom.link.tabIndex=0):this.dom.menu.setAttribute("role","group"),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(e){console.error(e)}}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=k(e);if(t==="Tab"&&(this.elements.rootMenu.focusState!=="none"?this.elements.rootMenu.blur():this.elements.rootMenu.focus()),this.focusState==="self"){const n=["Space","ArrowUp","ArrowDown","ArrowLeft","Asterisk","Home","End"],i=["Enter","ArrowRight"],o=["Escape"];(n.includes(t)||this.currentMenuItem.isSubmenuItem&&i.includes(t)||this.elements.controller&&o.includes(t))&&u(e)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=k(e),{altKey:n,crtlKey:i,metaKey:o}=e;if(t==="Character"&&!(n||i||o))u(e),this.elements.rootMenu.currentEvent="character",this.focusNextNodeWithCharacter(e.key);else if(this.focusState==="self")if(t==="Enter"||t==="Space")u(e),this.currentMenuItem.isSubmenuItem?this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview():this.currentMenuItem.dom.link.click();else if(t==="Escape")this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(this.elements.controller.close(),this.focusController());else if(t==="ArrowDown")u(e),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.currentMenuItem.elements.childMenu.focusFirstChild()):!this.isTopLevel&&this.currentChild===this.elements.menuItems.length-1?this.focusParentsNextChild():this.focusNextChild();else if(t==="ArrowUp"){u(e);const a=this.elements.menuItems[this.currentChild-1];a&&a.isSubmenuItem&&a.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentChild=this.currentChild-1,this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.focusChildsLastNode()):!this.isTopLevel&&this.currentChild===0?(this.blurCurrentChild(),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.focusCurrentChild()):this.focusPreviousChild()}else t==="ArrowRight"?this.currentMenuItem.isSubmenuItem&&(u(e),this.currentMenuItem.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.currentMenuItem.elements.childMenu.focusFirstChild()):this.currentMenuItem.elements.toggle.preview()):t==="ArrowLeft"?(u(e),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.blurCurrentChild(),this.currentMenuItem.elements.toggle.close()):this.isTopLevel||(this.blurCurrentChild(),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.focusCurrentChild())):t==="Home"?(u(e),this.blurCurrentChild(),this.elements.rootMenu.focusFirstChild()):t==="End"?(u(e),this.blurCurrentChild(),this.elements.rootMenu.focusLastNode()):t==="Asterisk"&&(u(e),this.openChildren())})}focusLastNode(){const e=this.elements.menuItems.length-1,t=this.elements.menuItems[e];t.isSubmenuItem&&t.elements.toggle.isOpen?(this.currentChild=e,t.elements.childMenu.currentEvent=this.currentEvent,t.elements.childMenu.focusLastNode()):this.focusLastChild()}openChildren(){this.elements.submenuToggles.forEach(e=>e.preview())}focusNextNodeWithCharacter(e){function t(p){let f=[];return p.elements.menuItems.forEach(g=>{f.push(g),g.isSubmenuItem&&g.elements.toggle.isOpen&&(f=[...f,...t(g.elements.toggle.elements.controlledMenu)])}),f}const n=e.toLowerCase(),i=t(this.elements.rootMenu),o=i.indexOf(this.currentMenuItem)+1,h=[...i.slice(o),...i.slice(0,o)];let a=0,m=!1;for(;!m&&a<h.length;){let p="";if(h[a].dom.item.innerText?p=h[a].dom.item.innerText:p=h[a].dom.item.textContent,p=p.replace(/[\s]/g,"").toLowerCase().charAt(0),p===n){m=!0;const f=h[a].elements.parentMenu,g=f.elements.menuItems.indexOf(h[a]);this.elements.rootMenu.blurChildren(),f.focusChild(g)}a++}}focusParentsNextChild(){this.elements.parentMenu&&(this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.currentChild===this.elements.parentMenu.elements.menuItems.length-1?(this.elements.parentMenu.blurCurrentChild(),this.elements.parentMenu.focusParentsNextChild()):(this.blurChildren(),this.elements.parentMenu.focusNextChild()))}focusChildsLastNode(){this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.currentMenuItem.elements.childMenu.focusLastChild(),this.currentMenuItem.elements.childMenu.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.childMenu.currentMenuItem.elements.toggle.isOpen&&(this.currentMenuItem.elements.childMenu.blurCurrentChild(),this.currentMenuItem.elements.childMenu.focusChildsLastNode())}}class re extends Q{constructor({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n=!1,childMenu:i=null,toggle:o=null,initialize:h=!0}){super({menuItemElement:s,menuLinkElement:e,parentMenu:t,isSubmenuItem:n,childMenu:i,toggle:o,initialize:!1}),h&&this.initialize()}}class le extends G{constructor({menuToggleElement:e,parentElement:t,controlledMenu:n,parentMenu:i=null,initialize:o=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:n,parentMenu:i,initialize:!1});l(this,"_dom",{toggle:null,parent:null,container:null});this._dom.toggle=e,this._dom.parent=t,this._dom.container=n.isTopLevel?n.dom.container:n.dom.menu,o&&this.initialize()}_expand(e=!0){const{openClass:t,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(c(n,this.dom.container),requestAnimationFrame(()=>{c(t,this.dom.container),requestAnimationFrame(()=>{d(n,this.dom.container)})})):t!==""&&c(t,this.dom.container),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:n,transitionClass:i}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),i!==""?(c(i,this.dom.container),requestAnimationFrame(()=>{n!==""&&d(n,this.dom.container),requestAnimationFrame(()=>{t!==""&&c(t,this.dom.container),requestAnimationFrame(()=>{d(i,this.dom.container)})})})):(t!==""&&c(t,this.dom.container),n!==""&&d(n,this.dom.container)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}class H extends P{constructor({menuElement:e,menuItemSelector:t=".nav-item,li",menuLinkSelector:n=".nav-link,.dropdown-item",submenuItemSelector:i=".dropdown",submenuToggleSelector:o=".dropdown-toggle",submenuSelector:h=".dropdown-menu",controllerElement:a=null,containerElement:m=null,openClass:p="show",closeClass:f="collapse",transitionClass:g="transitioning",isTopLevel:_=!0,parentMenu:y=null,hoverType:M="off",hoverDelay:C=250,enterDelay:E=-1,leaveDelay:w=-1,disableBootstrap:v=!0,initialize:I=!0}){super({menuElement:e,menuItemSelector:t,menuLinkSelector:n,submenuItemSelector:i,submenuToggleSelector:o,submenuSelector:h,controllerElement:a,containerElement:m,openClass:p,closeClass:f,transitionClass:g,isTopLevel:_,parentMenu:y,hoverType:M,hoverDelay:C,enterDelay:E,leaveDelay:w,initialize:!1});l(this,"_MenuType",H);l(this,"_MenuItemType",re);l(this,"_MenuToggleType",le);l(this,"_disableBootstrap",!0);l(this,"_pseudoDropdownElement",document.createElement("div"));l(this,"_bootstrapEvents",["show.bs.dropdown","shown.bs.dropdown","hide.bs.dropdown","hidden.bs.dropdown"]);this._disableBootstrap=v,I&&this.initialize()}initialize(){super.initialize(),this.bootstrapDisabled&&this._disableBootstrapDropdownBehaviour()}get bootstrapDisabled(){return this._disableBootstrap}get bootstrapPseudoDropdownElement(){return this._pseudoDropdownElement}get bootstrapEvents(){return this._bootstrapEvents}_validate(){let e=super._validate();const t=b("boolean",{disableBootstrap:this._disableBootstrap});return t.status||(this._errors.push(t.error.message),e=!1),e}_disableBootstrapDropdownBehaviour(){this.elements.submenuToggles.forEach(e=>{this.bootstrapEvents.forEach(t=>{e.dom.toggle.addEventListener(t,n=>{u(n);const i=bootstrap.Dropdown.getInstance(n.target);i&&i._menu!==this.bootstrapPseudoDropdownElement&&(i._menu=this.bootstrapPseudoDropdownElement)},{once:!0})})})}}return{Bootstrap5DisclosureMenu:F,Bootstrap5Menubar:B,Bootstrap5TopLinkDisclosureMenu:$,Bootstrap5Treeview:H}}();

@@ -1,3 +0,3 @@

var Bootstrap5DisclosureMenu=function(){"use strict";var R=Object.defineProperty;var U=(u,h,f)=>h in u?R(u,h,{enumerable:!0,configurable:!0,writable:!0,value:f}):u[h]=f;var r=(u,h,f)=>(U(u,typeof h!="symbol"?h+"":h,f),f);function u(i,e){typeof i=="string"?e.classList.add(i):e.classList.add(...i)}function h(i,e){typeof i=="string"?e.classList.remove(i):e.classList.remove(...i)}function f(i,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${t}" given.`)}for(const t in e)if(!(e[t]instanceof i)){const s=typeof e[t];throw new TypeError(`${t} must be an instance of ${i.name}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function d(i,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${t}" given.`)}for(const t in e){const s=typeof e[t];if(s!==i)throw new TypeError(`${t} must be a ${i}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function D(i){try{if(typeof i!="object"){const e=typeof i;throw new TypeError(`Values given to isCSSSelector() must be inside of an object. "${e}" given.`)}for(const e in i)try{if(i[e]===null)throw new Error;document.querySelector(i[e])}catch{throw new TypeError(`${e} must be a valid CSS selector. "${i[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function g(i){try{if(typeof i!="object"||Array.isArray(i)){const e=typeof i;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in i){const t=typeof i[e];if(t!=="string")if(Array.isArray(i[e]))i[e].forEach(s=>{if(typeof s!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${t}" given.`);else{const s={};s[e]=i[e],D(s)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function K(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidState() must be inside of an object. "${t}" given.`)}const e=["none","self","child"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function V(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${t}" given.`)}const e=["none","mouse","keyboard","character"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function O(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${t}" given.`)}const e=["off","on","dynamic"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function q(i,e){if(d("string",{tagName:i}).status&&f(HTMLElement,e).status){const t=i.toLowerCase();let s=!0;for(const n in e)e[n].tagName.toLowerCase()!==t&&(s=!1);return s}else return!1}class F{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n=null}){r(this,"_dom",{toggle:null,parent:null});r(this,"_elements",{controlledMenu:null,parentMenu:null});r(this,"_open",!1);r(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}}));r(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}}));this._dom.toggle=e,this._dom.parent=t,this._elements.controlledMenu=s,this._elements.parentMenu=n}initialize(){var e;if(this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),q("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const t=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,10);let s=((e=this.dom.toggle.innerText)==null?void 0:e.replace(/[^a-zA-Z0-9\s]/g,""))||"",n=t;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),n=`${s}-${n}`),this.dom.toggle.id=this.dom.toggle.id||`${n}-menu-button`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`${n}-menu`}this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){d("boolean",{value:e}),this._open=e}_expand(e=!0){const{closeClass:t,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(u(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&h(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&u(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{h(n,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&u(s,this.elements.controlledMenu.dom.menu),t!==""&&h(t,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),n!==""?(u(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&h(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&u(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{h(n,this.elements.controlledMenu.dom.menu)})})})):(t!==""&&u(t,this.elements.controlledMenu.dom.menu),s!==""&&h(s,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this._expand(),this.isOpen=!0}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._expand(),this.isOpen=!0}close(){this.isOpen&&(this.elements.controlledMenu.blur(),this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._collapse(),this.isOpen=!1)}toggle(){this.isOpen?this.close():this.open()}closeSiblings(){this.elements.parentMenu&&this.elements.parentMenu.elements.submenuToggles.forEach(e=>{e!==this&&e.close()})}closeChildren(){this.elements.controlledMenu.elements.submenuToggles.forEach(e=>e.close())}}class x{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n=!1,childMenu:o=null,toggle:l=null}){r(this,"_dom",{item:null,link:null});r(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});r(this,"_submenu",!1);this._dom.item=e,this._dom.link=t,this._elements.parentMenu=s,this._elements.childMenu=o,this._elements.toggle=l,this._submenu=n}initialize(){}get dom(){return this._dom}get elements(){return this._elements}get isSubmenuItem(){return this._submenu}focus(){this.elements.parentMenu.shouldFocus&&this.dom.link.focus()}blur(){this.elements.parentMenu.shouldFocus&&this.dom.link.blur()}}function w(i){try{const e=i.key||i.keyCode,t={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Character:isNaN(e)&&!!e.match(/^[a-zA-Z]{1}$/),Tab:e==="Tab"||e===9,Asterisk:e==="*"||e===56};return Object.keys(t).find(s=>t[s]===!0)||""}catch{return""}}function m(i){i.preventDefault(),i.stopPropagation()}class S{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:s="a",submenuItemSelector:n="",submenuToggleSelector:o="a",submenuSelector:l="ul",controllerElement:c=null,containerElement:p=null,openClass:a="show",closeClass:y="hide",transitionClass:b="transitioning",isTopLevel:_=!0,parentMenu:C=null,hoverType:E="off",hoverDelay:M=250,enterDelay:v=-1,leaveDelay:T=-1}){r(this,"_MenuType",S);r(this,"_MenuItemType",x);r(this,"_MenuToggleType",F);r(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});r(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});r(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});r(this,"_openClass","show");r(this,"_closeClass","hide");r(this,"_transitionClass","transitioning");r(this,"_root",!0);r(this,"_currentChild",0);r(this,"_focusState","none");r(this,"_currentEvent","none");r(this,"_hoverType","off");r(this,"_hoverDelay",250);r(this,"_enterDelay",-1);r(this,"_leaveDelay",-1);r(this,"_hoverTimeout",null);r(this,"_errors",[]);this._dom.menu=e,this._dom.controller=c,this._dom.container=p,this._selectors.menuItems=t,this._selectors.menuLinks=s,this._selectors.submenuItems=n,this._selectors.submenuToggles=o,this._selectors.submenus=l,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=C,this._elements.rootMenu=_?this:null,this._openClass=a||"",this._closeClass=y||"",this._transitionClass=b||"",this._root=_,this._hoverType=E,this._hoverDelay=M,this._enterDelay=v,this._leaveDelay=T}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found:
var Bootstrap5DisclosureMenu=function(){"use strict";var R=Object.defineProperty;var U=(u,h,f)=>h in u?R(u,h,{enumerable:!0,configurable:!0,writable:!0,value:f}):u[h]=f;var r=(u,h,f)=>(U(u,typeof h!="symbol"?h+"":h,f),f);function u(i,e){typeof i=="string"?e.classList.add(i):e.classList.add(...i)}function h(i,e){typeof i=="string"?e.classList.remove(i):e.classList.remove(...i)}function f(i,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${t}" given.`)}for(const t in e)if(!(e[t]instanceof i)){const s=typeof e[t];throw new TypeError(`${t} must be an instance of ${i.name}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function d(i,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${t}" given.`)}for(const t in e){const s=typeof e[t];if(s!==i)throw new TypeError(`${t} must be a ${i}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function S(i){try{if(typeof i!="object"){const e=typeof i;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${e}" given.`)}for(const e in i)try{if(i[e]===null)throw new Error;document.querySelector(i[e])}catch{throw new TypeError(`${e} must be a valid query selector. "${i[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function g(i){try{if(typeof i!="object"||Array.isArray(i)){const e=typeof i;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in i){const t=typeof i[e];if(t!=="string")if(Array.isArray(i[e]))i[e].forEach(s=>{if(typeof s!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${t}" given.`);else{const s={};s[e]=i[e],S(s)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function q(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidState() must be inside of an object. "${t}" given.`)}const e=["none","self","child"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function K(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${t}" given.`)}const e=["none","mouse","keyboard","character"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function O(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${t}" given.`)}const e=["off","on","dynamic"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function V(i,e){if(d("string",{tagName:i}).status&&f(HTMLElement,e).status){const t=i.toLowerCase();let s=!0;for(const n in e)e[n].tagName.toLowerCase()!==t&&(s=!1);return s}else return!1}class F{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n=null}){r(this,"_dom",{toggle:null,parent:null});r(this,"_elements",{controlledMenu:null,parentMenu:null});r(this,"_open",!1);r(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}}));r(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}}));this._dom.toggle=e,this._dom.parent=t,this._elements.controlledMenu=s,this._elements.parentMenu=n}initialize(){this._setIds(),this._setAriaAttributes(),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){d("boolean",{value:e}),this._open=e}_setIds(){var e;if(this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const t=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,10);let s=((e=this.dom.toggle.innerText)==null?void 0:e.replace(/[^a-zA-Z0-9\s]/g,""))||"",n=t;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),n=`${s}-${n}`),this.dom.toggle.id=this.dom.toggle.id||`menu-button-${n}`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`menu-${n}`}}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),V("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}_expand(e=!0){const{closeClass:t,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(u(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&h(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&u(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{h(n,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&u(s,this.elements.controlledMenu.dom.menu),t!==""&&h(t,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),n!==""?(u(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&h(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&u(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{h(n,this.elements.controlledMenu.dom.menu)})})})):(t!==""&&u(t,this.elements.controlledMenu.dom.menu),s!==""&&h(s,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this._expand(),this.isOpen=!0}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._expand(),this.isOpen=!0}close(){this.isOpen&&(this.elements.controlledMenu.blur(),this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._collapse(),this.isOpen=!1)}toggle(){this.isOpen?this.close():this.open()}closeSiblings(){this.elements.parentMenu&&this.elements.parentMenu.elements.submenuToggles.forEach(e=>{e!==this&&e.close()})}closeChildren(){this.elements.controlledMenu.elements.submenuToggles.forEach(e=>e.close())}}class x{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n=!1,childMenu:o=null,toggle:l=null}){r(this,"_dom",{item:null,link:null});r(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});r(this,"_submenu",!1);this._dom.item=e,this._dom.link=t,this._elements.parentMenu=s,this._elements.childMenu=o,this._elements.toggle=l,this._submenu=n}initialize(){}get dom(){return this._dom}get elements(){return this._elements}get isSubmenuItem(){return this._submenu}focus(){this.elements.parentMenu.shouldFocus&&this.dom.link.focus()}blur(){this.elements.parentMenu.shouldFocus&&this.dom.link.blur()}}function w(i){try{const e=i.key||i.keyCode,t={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Character:isNaN(e)&&!!e.match(/^[a-zA-Z]{1}$/),Tab:e==="Tab"||e===9,Asterisk:e==="*"||e===56};return Object.keys(t).find(s=>t[s]===!0)||""}catch{return""}}function m(i){i.preventDefault(),i.stopPropagation()}class D{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:s="a",submenuItemSelector:n="",submenuToggleSelector:o="a",submenuSelector:l="ul",controllerElement:c=null,containerElement:p=null,openClass:a="show",closeClass:y="hide",transitionClass:b="transitioning",isTopLevel:_=!0,parentMenu:C=null,hoverType:E="off",hoverDelay:M=250,enterDelay:v=-1,leaveDelay:T=-1}){r(this,"_MenuType",D);r(this,"_MenuItemType",x);r(this,"_MenuToggleType",F);r(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});r(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});r(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});r(this,"_openClass","show");r(this,"_closeClass","hide");r(this,"_transitionClass","transitioning");r(this,"_root",!0);r(this,"_currentChild",0);r(this,"_focusState","none");r(this,"_currentEvent","none");r(this,"_hoverType","off");r(this,"_hoverDelay",250);r(this,"_enterDelay",-1);r(this,"_leaveDelay",-1);r(this,"_hoverTimeout",null);r(this,"_errors",[]);this._dom.menu=e,this._dom.controller=c,this._dom.container=p,this._selectors.menuItems=t,this._selectors.menuLinks=s,this._selectors.submenuItems=n,this._selectors.submenuToggles=o,this._selectors.submenus=l,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=C,this._elements.rootMenu=_?this:null,this._openClass=a||"",this._closeClass=y||"",this._transitionClass=b||"",this._root=_,this._hoverType=E,this._hoverDelay=M,this._enterDelay=v,this._leaveDelay=T}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found:
- ${this.errors.join(`
- `)}`);if(this.elements.rootMenu===null&&this._findRootMenu(this),this._setDOMElements(),this.isTopLevel&&this.dom.controller&&this.dom.container){const e=new this._MenuToggleType({menuToggleElement:this.dom.controller,parentElement:this.dom.container,controlledMenu:this});this._elements.controller=e}this._createChildElements()}get dom(){return this._dom}get selectors(){return this._selectors}get elements(){return this._elements}get isTopLevel(){return this._root}get openClass(){return this.isTopLevel?this._openClass:this.elements.rootMenu.openClass}get closeClass(){return this.isTopLevel?this._closeClass:this.elements.rootMenu.closeClass}get transitionClass(){return this.isTopLevel?this._transitionClass:this.elements.rootMenu.transitionClass}get currentChild(){return this._currentChild}get focusState(){return this._focusState}get currentEvent(){return this._currentEvent}get currentMenuItem(){return this.elements.menuItems[this.currentChild]}get hoverType(){return this._root?this._hoverType:this.elements.rootMenu.hoverType}get hoverDelay(){return this._root?this._hoverDelay:this.elements.rootMenu.hoverDelay}get enterDelay(){return this._enterDelay===-1?this.hoverDelay:this._root?this._enterDelay:this.elements.rootMenu.enterDelay}get leaveDelay(){return this._leaveDelay===-1?this.hoverDelay:this._root?this._leaveDelay:this.elements.rootMenu.leaveDelay}get shouldFocus(){let e=!1;return(this.currentEvent==="keyboard"||this.currentEvent==="character")&&(e=!0),this.currentEvent==="mouse"&&this.hoverType==="dynamic"&&(e=!0),e}get errors(){return this._errors}set openClass(e){g({openClass:e}),this._openClass!==e&&(this._openClass=e)}set closeClass(e){g({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}set transitionClass(e){g({transitionClass:e}),this._transitionClass!==e&&(this._transitionClass=e)}set currentChild(e){d("number",{value:e});function t(s){if(["mouse","character"].includes(s.currentEvent)&&s.elements.parentMenu){let o=0,l=!1;for(;!l&&o<s.elements.parentMenu.elements.menuItems.length;){const c=s.elements.parentMenu.elements.menuItems[o];c.isSubmenuItem&&c.elements.toggle.elements.controlledMenu===s&&(l=!0,s.elements.parentMenu.currentEvent=s.currentEvent,s.elements.parentMenu.currentChild=o),o++}}}e<-1?(this._currentChild=-1,t(this)):e>=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}set focusState(e){K({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&(e==="self"||e==="none")&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(e==="self"||e==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(e){V({value:e}),this._currentEvent!==e&&(this._currentEvent=e,this.elements.submenuToggles.length>0&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.currentEvent=e}))}set hoverType(e){O({value:e}),this._hoverType!==e&&(this._hoverType=e)}set hoverDelay(e){d("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}set enterDelay(e){d("number",{value:e}),this._enterDelay!==e&&(this._enterDelay=e)}set leaveDelay(e){d("number",{value:e}),this._leaveDelay!==e&&(this._leaveDelay=e)}_validate(){let e=!0,t;this._dom.container!==null||this._dom.controller!==null?t=f(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):t=f(HTMLElement,{menuElement:this._dom.menu}),t.status||(this._errors.push(t.error.message),e=!1);let s;if(this._selectors.submenuItems!==""?s=D({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=D({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),e=!1),this._openClass!==""){const a=g({openClass:this._openClass});a.status||(this._errors.push(a.error.message),e=!1)}if(this._closeClass!==""){const a=g({closeClass:this._closeClass});a.status||(this._errors.push(a.error.message),e=!1)}if(this._transitionClass!==""){const a=g({transitionClass:this._transitionClass});a.status||(this._errors.push(a.error.message),e=!1)}const n=d("boolean",{isTopLevel:this._root});if(n.status||(this._errors.push(n.error.message),e=!1),this._elements.parentMenu!==null){const a=f(S,{parentMenu:this._elements.parentMenu});a.status||(this._errors.push(a.error.message),e=!1)}const o=O({hoverType:this._hoverType});o.status||(this._errors.push(o.error.message),e=!1);const l=d("number",{hoverDelay:this._hoverDelay});l.status||(this._errors.push(l.error.message),e=!1);const c=d("number",{enterDelay:this._enterDelay});c.status||(this._errors.push(c.error.message),e=!1);const p=d("number",{leaveDelay:this._leaveDelay});return p.status||(this._errors.push(p.error.message),e=!1),e}_setDOMElementType(e,t=this.dom.menu,s=!0){if(typeof this.selectors[e]=="string"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be set through _setDOMElementType.`);t!==this.dom.menu&&f(HTMLElement,{base:t});const o=Array.from(t.querySelectorAll(this.selectors[e])).filter(l=>l.parentElement===t);s?this._dom[e]=o:this._dom[e]=[...this._dom[e],...o]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_resetDOMElementType(e){if(typeof this.dom[e]<"u"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_setDOMElements(){this._setDOMElementType("menuItems"),this.selectors.submenuItems!==""&&(this._setDOMElementType("submenuItems"),this._resetDOMElementType("submenuToggles"),this._resetDOMElementType("submenus"),this.dom.submenuItems.forEach(e=>{this._setDOMElementType("submenuToggles",e,!1),this._setDOMElementType("submenus",e,!1)}))}_findRootMenu(e){if(e.isTopLevel)this._elements.rootMenu=e;else if(e.elements.parentMenu!==null)this._findRootMenu(e.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(e=>{let t;if(this.dom.submenuItems.includes(e)){const s=e.querySelector(this.selectors.submenuToggles),n=e.querySelector(this.selectors.submenus),o=new this._MenuType({menuElement:n,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuToggles,submenuSelector:this.selectors.submenus,openClass:this.openClass,closeClass:this.closeClass,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),l=new this._MenuToggleType({menuToggleElement:s,parentElement:e,controlledMenu:o,parentMenu:this});this._elements.submenuToggles.push(l),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:o,toggle:l})}else{const s=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(t)})}_handleFocus(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=t})})}_handleClick(){function e(t,s,n){m(n),s.toggle(),s.isOpen&&(t.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(s)},{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",n=>{this.currentEvent="mouse",e(this,t.elements.toggle,n)})}),this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("pointerup",t=>{this.currentEvent="mouse",e(this,this.elements.controller,t)})}_handleHover(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("pointerenter",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t),e.isSubmenuItem&&(this.enterDelay>0?this._hoverTimeout=setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay):e.elements.toggle.preview());else if(this.hoverType==="dynamic"){const n=this.elements.submenuToggles.some(o=>o.isOpen);this.currentChild=t,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),e.isSubmenuItem&&(!this.isTopLevel||n)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?this._hoverTimeout=setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay):e.elements.toggle.preview())}}}),e.isSubmenuItem&&e.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))})})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=w(e);(t==="Space"||t==="Enter")&&m(e)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=w(e);(t==="Space"||t==="Enter")&&(m(e),this.elements.controller.toggle(),this.elements.controller.isOpen&&this.focusFirstChild())})}focus(){this.focusState="self",this.shouldFocus&&this.dom.menu.focus()}blur(){this.focusState="none",this.shouldFocus&&this.dom.menu.blur()}focusCurrentChild(){this.focusState="self",this.currentChild!==-1&&this.currentMenuItem.focus()}focusChild(e){this.blurCurrentChild(),this.currentChild=e,this.focusCurrentChild()}focusFirstChild(){this.focusChild(0)}focusLastChild(){this.focusChild(this.elements.menuItems.length-1)}focusNextChild(){this.currentChild<this.elements.menuItems.length-1?this.focusChild(this.currentChild+1):this.focusCurrentChild()}focusPreviousChild(){this.currentChild>0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&this.currentMenuItem.blur()}focusController(){this.dom.controller&&(this.shouldFocus&&this.dom.controller.focus(),this.focusState="none")}focusContainer(){this.dom.container&&(this.shouldFocus&&this.dom.container.focus(),this.focusState="none")}closeChildren(){this.elements.submenuToggles.forEach(e=>e.close())}blurChildren(){this.elements.menuItems.forEach(e=>{e.blur(),e.isSubmenuItem&&e.elements.childMenu.blurChildren()})}}class z extends x{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n=!1,childMenu:o=null,toggle:l=null,initialize:c=!0}){super({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n,childMenu:o,toggle:l}),c&&this.initialize()}}class j extends F{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n=null,initialize:o=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n}),o&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&this.closeChildren(),super.close()}}class k extends S{constructor({menuElement:t,menuItemSelector:s="li",menuLinkSelector:n="a",submenuItemSelector:o="",submenuToggleSelector:l="a",submenuSelector:c="ul",controllerElement:p=null,containerElement:a=null,openClass:y="show",closeClass:b="hide",transitionClass:_="transitioning",isTopLevel:C=!0,parentMenu:E=null,hoverType:M="off",hoverDelay:v=250,enterDelay:T=-1,leaveDelay:L=-1,optionalKeySupport:A=!1,initialize:$=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:o,submenuToggleSelector:l,submenuSelector:c,controllerElement:p,containerElement:a,openClass:y,closeClass:b,transitionClass:_,isTopLevel:C,parentMenu:E,hoverType:M,hoverDelay:v,enterDelay:T,leaveDelay:L});r(this,"_MenuType",k);r(this,"_MenuItemType",z);r(this,"_MenuToggleType",j);r(this,"_currentChild",-1);r(this,"_optionalSupport",!1);this._optionalSupport=A,$&&this.initialize()}initialize(){try{super.initialize(),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(t){console.error(t)}}get optionalKeySupport(){return this.isTopLevel?this._optionalSupport:this.elements.rootMenu.optionalKeySupport}set optionalKeySupport(t){d("boolean",{optionalKeySupport:t}),this._optionalSupport=t}_validate(){let t=super._validate();const s=d("boolean",{optionalKeySupport:this._optionalSupport});return s.status||(this._errors.push(s.error.message),t=!1),t}_handleClick(){super._handleClick(),document.addEventListener("pointerup",t=>{this.focusState!=="none"&&(this.currentEvent="mouse",!this.dom.menu.contains(t.target)&&!this.dom.menu!==t.target&&(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",t=>{this.currentEvent="keyboard";const s=w(t);if(this.focusState==="self"){const n=["Space","Enter"],o=["Escape"],l=["Escape"];this.optionalKeySupport?["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(s)&&m(t):(this.currentMenuItem.isSubmenuItem&&n.includes(s)||this.elements.controller&&o.includes(s)||this.elements.parentMenu&&l.includes(s))&&m(t)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",t=>{this.currentEvent="keyboard";const s=w(t);this.focusState==="self"&&(s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(m(t),this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview()):this.currentMenuItem.dom.link.click():s==="Escape"?this.elements.submenuToggles.some(o=>o.isOpen)?(m(t),this.closeChildren()):this.elements.parentMenu?(m(t),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.closeChildren(),this.elements.parentMenu.focusCurrentChild()):this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(this.elements.controller.close(),this.focusController()):this.optionalKeySupport&&(s==="ArrowDown"||s==="ArrowRight"?(m(t),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.childMenu.focusFirstChild()):this.focusNextChild()):s==="ArrowUp"||s==="ArrowLeft"?(m(t),this.focusPreviousChild()):s==="Home"?(m(t),this.focusFirstChild()):s==="End"&&(m(t),this.focusLastChild())))})}}class B extends z{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n=!1,childMenu:o=null,toggle:l=null,initialize:c=!0}){super({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n,childMenu:o,toggle:l,initialize:!1}),c&&this.initialize()}}class H extends j{constructor({menuToggleElement:t,parentElement:s,controlledMenu:n,parentMenu:o=null,initialize:l=!0}){super({menuToggleElement:t,parentElement:s,controlledMenu:n,parentMenu:o,initialize:!1});r(this,"_dom",{toggle:null,parent:null,container:null});this._dom.toggle=t,this._dom.parent=s,this._dom.container=n.isTopLevel?n.dom.container:n.dom.menu,l&&this.initialize()}_expand(t=!0){const{openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(u(n,this.dom.container),requestAnimationFrame(()=>{u(s,this.dom.container),requestAnimationFrame(()=>{h(n,this.dom.container)})})):s!==""&&u(s,this.dom.container),t&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(t=!0){const{closeClass:s,openClass:n,transitionClass:o}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),o!==""?(u(o,this.dom.container),requestAnimationFrame(()=>{n!==""&&h(n,this.dom.container),requestAnimationFrame(()=>{s!==""&&u(s,this.dom.container),requestAnimationFrame(()=>{h(o,this.dom.container)})})})):(s!==""&&u(s,this.dom.container),n!==""&&h(n,this.dom.container)),t&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}class I extends k{constructor({menuElement:t,menuItemSelector:s=".nav-item,li",menuLinkSelector:n=".nav-link,.dropdown-item",submenuItemSelector:o=".dropdown",submenuToggleSelector:l=".dropdown-toggle",submenuSelector:c=".dropdown-menu",controllerElement:p=null,containerElement:a=null,openClass:y="show",closeClass:b="collapse",transitionClass:_="transitioning",isTopLevel:C=!0,parentMenu:E=null,hoverType:M="off",hoverDelay:v=250,enterDelay:T=-1,leaveDelay:L=-1,optionalKeySupport:A=!1,disableBootstrap:$=!0,initialize:P=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:o,submenuToggleSelector:l,submenuSelector:c,controllerElement:p,containerElement:a,openClass:y,closeClass:b,transitionClass:_,isTopLevel:C,parentMenu:E,hoverType:M,hoverDelay:v,enterDelay:T,leaveDelay:L,optionalKeySupport:A,initialize:!1});r(this,"_MenuType",I);r(this,"_MenuItemType",B);r(this,"_MenuToggleType",H);r(this,"_disableBootstrap",!0);r(this,"_pseudoDropdownElement",document.createElement("div"));r(this,"_bootstrapEvents",["show.bs.dropdown","shown.bs.dropdown","hide.bs.dropdown","hidden.bs.dropdown"]);this._disableBootstrap=$,P&&this.initialize()}initialize(){super.initialize(),this.bootstrapDisabled&&this._disableBootstrapDropdownBehaviour()}get bootstrapDisabled(){return this._disableBootstrap}get bootstrapPseudoDropdownElement(){return this._pseudoDropdownElement}get bootstrapEvents(){return this._bootstrapEvents}_validate(){let t=super._validate();const s=d("boolean",{disableBootstrap:this._disableBootstrap});return s.status||(this._errors.push(s.error.message),t=!1),t}_disableBootstrapDropdownBehaviour(){this.elements.submenuToggles.forEach(t=>{this.bootstrapEvents.forEach(s=>{t.dom.toggle.addEventListener(s,n=>{m(n);const o=bootstrap.Dropdown.getInstance(n.target);o&&o._menu!==this.bootstrapPseudoDropdownElement&&(o._menu=this.bootstrapPseudoDropdownElement)},{once:!0})})})}}return I}();
- `)}`);if(this.elements.rootMenu===null&&this._findRootMenu(this),this._setDOMElements(),this.isTopLevel&&this.dom.controller&&this.dom.container){const e=new this._MenuToggleType({menuToggleElement:this.dom.controller,parentElement:this.dom.container,controlledMenu:this});this._elements.controller=e}this._createChildElements()}get dom(){return this._dom}get selectors(){return this._selectors}get elements(){return this._elements}get isTopLevel(){return this._root}get openClass(){return this.isTopLevel?this._openClass:this.elements.rootMenu.openClass}get closeClass(){return this.isTopLevel?this._closeClass:this.elements.rootMenu.closeClass}get transitionClass(){return this.isTopLevel?this._transitionClass:this.elements.rootMenu.transitionClass}get currentChild(){return this._currentChild}get focusState(){return this._focusState}get currentEvent(){return this._currentEvent}get currentMenuItem(){return this.elements.menuItems[this.currentChild]}get hoverType(){return this._root?this._hoverType:this.elements.rootMenu.hoverType}get hoverDelay(){return this._root?this._hoverDelay:this.elements.rootMenu.hoverDelay}get enterDelay(){return this._enterDelay===-1?this.hoverDelay:this._root?this._enterDelay:this.elements.rootMenu.enterDelay}get leaveDelay(){return this._leaveDelay===-1?this.hoverDelay:this._root?this._leaveDelay:this.elements.rootMenu.leaveDelay}get shouldFocus(){let e=!1;return(this.currentEvent==="keyboard"||this.currentEvent==="character")&&(e=!0),this.currentEvent==="mouse"&&this.hoverType==="dynamic"&&(e=!0),e}get errors(){return this._errors}set openClass(e){g({openClass:e}),this._openClass!==e&&(this._openClass=e)}set closeClass(e){g({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}set transitionClass(e){g({transitionClass:e}),this._transitionClass!==e&&(this._transitionClass=e)}set currentChild(e){d("number",{value:e});function t(s){if(["mouse","character"].includes(s.currentEvent)&&s.elements.parentMenu){let o=0,l=!1;for(;!l&&o<s.elements.parentMenu.elements.menuItems.length;){const c=s.elements.parentMenu.elements.menuItems[o];c.isSubmenuItem&&c.elements.toggle.elements.controlledMenu===s&&(l=!0,s.elements.parentMenu.currentEvent=s.currentEvent,s.elements.parentMenu.currentChild=o),o++}}}e<-1?(this._currentChild=-1,t(this)):e>=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}set focusState(e){q({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&(e==="self"||e==="none")&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(e==="self"||e==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(e){K({value:e}),this._currentEvent!==e&&(this._currentEvent=e,this.elements.submenuToggles.length>0&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.currentEvent=e}))}set hoverType(e){O({value:e}),this._hoverType!==e&&(this._hoverType=e)}set hoverDelay(e){d("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}set enterDelay(e){d("number",{value:e}),this._enterDelay!==e&&(this._enterDelay=e)}set leaveDelay(e){d("number",{value:e}),this._leaveDelay!==e&&(this._leaveDelay=e)}_validate(){let e=!0,t;this._dom.container!==null||this._dom.controller!==null?t=f(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):t=f(HTMLElement,{menuElement:this._dom.menu}),t.status||(this._errors.push(t.error.message),e=!1);let s;if(this._selectors.submenuItems!==""?s=S({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=S({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),e=!1),this._openClass!==""){const a=g({openClass:this._openClass});a.status||(this._errors.push(a.error.message),e=!1)}if(this._closeClass!==""){const a=g({closeClass:this._closeClass});a.status||(this._errors.push(a.error.message),e=!1)}if(this._transitionClass!==""){const a=g({transitionClass:this._transitionClass});a.status||(this._errors.push(a.error.message),e=!1)}const n=d("boolean",{isTopLevel:this._root});if(n.status||(this._errors.push(n.error.message),e=!1),this._elements.parentMenu!==null){const a=f(D,{parentMenu:this._elements.parentMenu});a.status||(this._errors.push(a.error.message),e=!1)}const o=O({hoverType:this._hoverType});o.status||(this._errors.push(o.error.message),e=!1);const l=d("number",{hoverDelay:this._hoverDelay});l.status||(this._errors.push(l.error.message),e=!1);const c=d("number",{enterDelay:this._enterDelay});c.status||(this._errors.push(c.error.message),e=!1);const p=d("number",{leaveDelay:this._leaveDelay});return p.status||(this._errors.push(p.error.message),e=!1),e}_setDOMElementType(e,t=this.dom.menu,s=!0){if(typeof this.selectors[e]=="string"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be set through _setDOMElementType.`);t!==this.dom.menu&&f(HTMLElement,{base:t});const o=Array.from(t.querySelectorAll(this.selectors[e])).filter(l=>l.parentElement===t);s?this._dom[e]=o:this._dom[e]=[...this._dom[e],...o]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_resetDOMElementType(e){if(typeof this.dom[e]<"u"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_setDOMElements(){this._setDOMElementType("menuItems"),this.selectors.submenuItems!==""&&(this._setDOMElementType("submenuItems"),this._resetDOMElementType("submenuToggles"),this._resetDOMElementType("submenus"),this.dom.submenuItems.forEach(e=>{this._setDOMElementType("submenuToggles",e,!1),this._setDOMElementType("submenus",e,!1)}))}_findRootMenu(e){if(e.isTopLevel)this._elements.rootMenu=e;else if(e.elements.parentMenu!==null)this._findRootMenu(e.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(e=>{let t;if(this.dom.submenuItems.includes(e)){const s=e.querySelector(this.selectors.submenuToggles),n=e.querySelector(this.selectors.submenus),o=new this._MenuType({menuElement:n,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuToggles,submenuSelector:this.selectors.submenus,openClass:this.openClass,closeClass:this.closeClass,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),l=new this._MenuToggleType({menuToggleElement:s,parentElement:e,controlledMenu:o,parentMenu:this});this._elements.submenuToggles.push(l),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:o,toggle:l})}else{const s=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(t)})}_handleFocus(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=t})})}_handleClick(){function e(t,s,n){m(n),s.toggle(),s.isOpen&&(t.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(s)},{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",n=>{this.currentEvent="mouse",e(this,t.elements.toggle,n)})}),this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("pointerup",t=>{this.currentEvent="mouse",e(this,this.elements.controller,t)})}_handleHover(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("pointerenter",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t),e.isSubmenuItem&&(this.enterDelay>0?this._hoverTimeout=setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay):e.elements.toggle.preview());else if(this.hoverType==="dynamic"){const n=this.elements.submenuToggles.some(o=>o.isOpen);this.currentChild=t,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),e.isSubmenuItem&&(!this.isTopLevel||n)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?this._hoverTimeout=setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay):e.elements.toggle.preview())}}}),e.isSubmenuItem&&e.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))})})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=w(e);(t==="Space"||t==="Enter")&&m(e)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=w(e);(t==="Space"||t==="Enter")&&(m(e),this.elements.controller.toggle(),this.elements.controller.isOpen&&this.focusFirstChild())})}focus(){this.focusState="self",this.shouldFocus&&this.dom.menu.focus()}blur(){this.focusState="none",this.shouldFocus&&this.dom.menu.blur()}focusCurrentChild(){this.focusState="self",this.currentChild!==-1&&this.currentMenuItem.focus()}focusChild(e){this.blurCurrentChild(),this.currentChild=e,this.focusCurrentChild()}focusFirstChild(){this.focusChild(0)}focusLastChild(){this.focusChild(this.elements.menuItems.length-1)}focusNextChild(){this.currentChild<this.elements.menuItems.length-1?this.focusChild(this.currentChild+1):this.focusCurrentChild()}focusPreviousChild(){this.currentChild>0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&this.currentMenuItem.blur()}focusController(){this.dom.controller&&(this.shouldFocus&&this.dom.controller.focus(),this.focusState="none")}focusContainer(){this.dom.container&&(this.shouldFocus&&this.dom.container.focus(),this.focusState="none")}closeChildren(){this.elements.submenuToggles.forEach(e=>e.close())}blurChildren(){this.elements.menuItems.forEach(e=>{e.blur(),e.isSubmenuItem&&e.elements.childMenu.blurChildren()})}}class z extends x{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n=!1,childMenu:o=null,toggle:l=null,initialize:c=!0}){super({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n,childMenu:o,toggle:l}),c&&this.initialize()}}class j extends F{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n=null,initialize:o=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n}),o&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&this.closeChildren(),super.close()}}class k extends D{constructor({menuElement:t,menuItemSelector:s="li",menuLinkSelector:n="a",submenuItemSelector:o="",submenuToggleSelector:l="button",submenuSelector:c="ul",controllerElement:p=null,containerElement:a=null,openClass:y="show",closeClass:b="hide",transitionClass:_="transitioning",isTopLevel:C=!0,parentMenu:E=null,hoverType:M="off",hoverDelay:v=250,enterDelay:T=-1,leaveDelay:A=-1,optionalKeySupport:L=!1,initialize:$=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:o,submenuToggleSelector:l,submenuSelector:c,controllerElement:p,containerElement:a,openClass:y,closeClass:b,transitionClass:_,isTopLevel:C,parentMenu:E,hoverType:M,hoverDelay:v,enterDelay:T,leaveDelay:A});r(this,"_MenuType",k);r(this,"_MenuItemType",z);r(this,"_MenuToggleType",j);r(this,"_currentChild",-1);r(this,"_optionalSupport",!1);this._optionalSupport=L,$&&this.initialize()}initialize(){try{super.initialize(),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(t){console.error(t)}}get optionalKeySupport(){return this.isTopLevel?this._optionalSupport:this.elements.rootMenu.optionalKeySupport}set optionalKeySupport(t){d("boolean",{optionalKeySupport:t}),this._optionalSupport=t}_validate(){let t=super._validate();const s=d("boolean",{optionalKeySupport:this._optionalSupport});return s.status||(this._errors.push(s.error.message),t=!1),t}_handleClick(){super._handleClick(),document.addEventListener("pointerup",t=>{this.focusState!=="none"&&(this.currentEvent="mouse",!this.dom.menu.contains(t.target)&&!this.dom.menu!==t.target&&(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",t=>{this.currentEvent="keyboard";const s=w(t);if(this.focusState==="self"){const n=["Space","Enter"],o=["Escape"],l=["Escape"];this.optionalKeySupport?["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(s)&&m(t):(this.currentMenuItem.isSubmenuItem&&n.includes(s)||this.elements.controller&&o.includes(s)||this.elements.parentMenu&&l.includes(s))&&m(t)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",t=>{this.currentEvent="keyboard";const s=w(t);this.focusState==="self"&&(s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(m(t),this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview()):this.currentMenuItem.dom.link.click():s==="Escape"?this.elements.submenuToggles.some(o=>o.isOpen)?(m(t),this.closeChildren()):this.elements.parentMenu?(m(t),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.closeChildren(),this.elements.parentMenu.focusCurrentChild()):this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(this.elements.controller.close(),this.focusController()):this.optionalKeySupport&&(s==="ArrowDown"||s==="ArrowRight"?(m(t),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.childMenu.focusFirstChild()):this.focusNextChild()):s==="ArrowUp"||s==="ArrowLeft"?(m(t),this.focusPreviousChild()):s==="Home"?(m(t),this.focusFirstChild()):s==="End"&&(m(t),this.focusLastChild())))})}}class B extends z{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n=!1,childMenu:o=null,toggle:l=null,initialize:c=!0}){super({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n,childMenu:o,toggle:l,initialize:!1}),c&&this.initialize()}}class H extends j{constructor({menuToggleElement:t,parentElement:s,controlledMenu:n,parentMenu:o=null,initialize:l=!0}){super({menuToggleElement:t,parentElement:s,controlledMenu:n,parentMenu:o,initialize:!1});r(this,"_dom",{toggle:null,parent:null,container:null});this._dom.toggle=t,this._dom.parent=s,this._dom.container=n.isTopLevel?n.dom.container:n.dom.menu,l&&this.initialize()}_expand(t=!0){const{openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(u(n,this.dom.container),requestAnimationFrame(()=>{u(s,this.dom.container),requestAnimationFrame(()=>{h(n,this.dom.container)})})):s!==""&&u(s,this.dom.container),t&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(t=!0){const{closeClass:s,openClass:n,transitionClass:o}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),o!==""?(u(o,this.dom.container),requestAnimationFrame(()=>{n!==""&&h(n,this.dom.container),requestAnimationFrame(()=>{s!==""&&u(s,this.dom.container),requestAnimationFrame(()=>{h(o,this.dom.container)})})})):(s!==""&&u(s,this.dom.container),n!==""&&h(n,this.dom.container)),t&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}class I extends k{constructor({menuElement:t,menuItemSelector:s=".nav-item,li",menuLinkSelector:n=".nav-link,.dropdown-item",submenuItemSelector:o=".dropdown",submenuToggleSelector:l=".dropdown-toggle",submenuSelector:c=".dropdown-menu",controllerElement:p=null,containerElement:a=null,openClass:y="show",closeClass:b="collapse",transitionClass:_="transitioning",isTopLevel:C=!0,parentMenu:E=null,hoverType:M="off",hoverDelay:v=250,enterDelay:T=-1,leaveDelay:A=-1,optionalKeySupport:L=!1,disableBootstrap:$=!0,initialize:P=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:o,submenuToggleSelector:l,submenuSelector:c,controllerElement:p,containerElement:a,openClass:y,closeClass:b,transitionClass:_,isTopLevel:C,parentMenu:E,hoverType:M,hoverDelay:v,enterDelay:T,leaveDelay:A,optionalKeySupport:L,initialize:!1});r(this,"_MenuType",I);r(this,"_MenuItemType",B);r(this,"_MenuToggleType",H);r(this,"_disableBootstrap",!0);r(this,"_pseudoDropdownElement",document.createElement("div"));r(this,"_bootstrapEvents",["show.bs.dropdown","shown.bs.dropdown","hide.bs.dropdown","hidden.bs.dropdown"]);this._disableBootstrap=$,P&&this.initialize()}initialize(){super.initialize(),this.bootstrapDisabled&&this._disableBootstrapDropdownBehaviour()}get bootstrapDisabled(){return this._disableBootstrap}get bootstrapPseudoDropdownElement(){return this._pseudoDropdownElement}get bootstrapEvents(){return this._bootstrapEvents}_validate(){let t=super._validate();const s=d("boolean",{disableBootstrap:this._disableBootstrap});return s.status||(this._errors.push(s.error.message),t=!1),t}_disableBootstrapDropdownBehaviour(){this.elements.submenuToggles.forEach(t=>{this.bootstrapEvents.forEach(s=>{t.dom.toggle.addEventListener(s,n=>{m(n);const o=bootstrap.Dropdown.getInstance(n.target);o&&o._menu!==this.bootstrapPseudoDropdownElement&&(o._menu=this.bootstrapPseudoDropdownElement)},{once:!0})})})}}return I}();

@@ -1,3 +0,3 @@

var Bootstrap5Menubar=function(){"use strict";var P=Object.defineProperty;var R=(m,c,f)=>c in m?P(m,c,{enumerable:!0,configurable:!0,writable:!0,value:f}):m[c]=f;var o=(m,c,f)=>(R(m,typeof c!="symbol"?c+"":c,f),f);function m(i,e){typeof i=="string"?e.classList.add(i):e.classList.add(...i)}function c(i,e){typeof i=="string"?e.classList.remove(i):e.classList.remove(...i)}function f(i,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${t}" given.`)}for(const t in e)if(!(e[t]instanceof i)){const s=typeof e[t];throw new TypeError(`${t} must be an instance of ${i.name}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function p(i,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${t}" given.`)}for(const t in e){const s=typeof e[t];if(s!==i)throw new TypeError(`${t} must be a ${i}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function k(i){try{if(typeof i!="object"){const e=typeof i;throw new TypeError(`Values given to isCSSSelector() must be inside of an object. "${e}" given.`)}for(const e in i)try{if(i[e]===null)throw new Error;document.querySelector(i[e])}catch{throw new TypeError(`${e} must be a valid CSS selector. "${i[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function g(i){try{if(typeof i!="object"||Array.isArray(i)){const e=typeof i;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in i){const t=typeof i[e];if(t!=="string")if(Array.isArray(i[e]))i[e].forEach(s=>{if(typeof s!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${t}" given.`);else{const s={};s[e]=i[e],k(s)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function q(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidState() must be inside of an object. "${t}" given.`)}const e=["none","self","child"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function j(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${t}" given.`)}const e=["none","mouse","keyboard","character"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function $(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${t}" given.`)}const e=["off","on","dynamic"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function V(i,e){if(p("string",{tagName:i}).status&&f(HTMLElement,e).status){const t=i.toLowerCase();let s=!0;for(const n in e)e[n].tagName.toLowerCase()!==t&&(s=!1);return s}else return!1}class x{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n=null}){o(this,"_dom",{toggle:null,parent:null});o(this,"_elements",{controlledMenu:null,parentMenu:null});o(this,"_open",!1);o(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}}));o(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}}));this._dom.toggle=e,this._dom.parent=t,this._elements.controlledMenu=s,this._elements.parentMenu=n}initialize(){var e;if(this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),V("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const t=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,10);let s=((e=this.dom.toggle.innerText)==null?void 0:e.replace(/[^a-zA-Z0-9\s]/g,""))||"",n=t;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),n=`${s}-${n}`),this.dom.toggle.id=this.dom.toggle.id||`${n}-menu-button`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`${n}-menu`}this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){p("boolean",{value:e}),this._open=e}_expand(e=!0){const{closeClass:t,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(m(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&c(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&m(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{c(n,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&m(s,this.elements.controlledMenu.dom.menu),t!==""&&c(t,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),n!==""?(m(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&c(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&m(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{c(n,this.elements.controlledMenu.dom.menu)})})})):(t!==""&&m(t,this.elements.controlledMenu.dom.menu),s!==""&&c(s,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this._expand(),this.isOpen=!0}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._expand(),this.isOpen=!0}close(){this.isOpen&&(this.elements.controlledMenu.blur(),this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._collapse(),this.isOpen=!1)}toggle(){this.isOpen?this.close():this.open()}closeSiblings(){this.elements.parentMenu&&this.elements.parentMenu.elements.submenuToggles.forEach(e=>{e!==this&&e.close()})}closeChildren(){this.elements.controlledMenu.elements.submenuToggles.forEach(e=>e.close())}}class F{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n=!1,childMenu:r=null,toggle:l=null}){o(this,"_dom",{item:null,link:null});o(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});o(this,"_submenu",!1);this._dom.item=e,this._dom.link=t,this._elements.parentMenu=s,this._elements.childMenu=r,this._elements.toggle=l,this._submenu=n}initialize(){}get dom(){return this._dom}get elements(){return this._elements}get isSubmenuItem(){return this._submenu}focus(){this.elements.parentMenu.shouldFocus&&this.dom.link.focus()}blur(){this.elements.parentMenu.shouldFocus&&this.dom.link.blur()}}function v(i){try{const e=i.key||i.keyCode,t={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Character:isNaN(e)&&!!e.match(/^[a-zA-Z]{1}$/),Tab:e==="Tab"||e===9,Asterisk:e==="*"||e===56};return Object.keys(t).find(s=>t[s]===!0)||""}catch{return""}}function u(i){i.preventDefault(),i.stopPropagation()}class I{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:s="a",submenuItemSelector:n="",submenuToggleSelector:r="a",submenuSelector:l="ul",controllerElement:a=null,containerElement:d=null,openClass:h="show",closeClass:b="hide",transitionClass:y="transitioning",isTopLevel:_=!0,parentMenu:C=null,hoverType:M="off",hoverDelay:E=250,enterDelay:T=-1,leaveDelay:w=-1}){o(this,"_MenuType",I);o(this,"_MenuItemType",F);o(this,"_MenuToggleType",x);o(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});o(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});o(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});o(this,"_openClass","show");o(this,"_closeClass","hide");o(this,"_transitionClass","transitioning");o(this,"_root",!0);o(this,"_currentChild",0);o(this,"_focusState","none");o(this,"_currentEvent","none");o(this,"_hoverType","off");o(this,"_hoverDelay",250);o(this,"_enterDelay",-1);o(this,"_leaveDelay",-1);o(this,"_hoverTimeout",null);o(this,"_errors",[]);this._dom.menu=e,this._dom.controller=a,this._dom.container=d,this._selectors.menuItems=t,this._selectors.menuLinks=s,this._selectors.submenuItems=n,this._selectors.submenuToggles=r,this._selectors.submenus=l,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=C,this._elements.rootMenu=_?this:null,this._openClass=h||"",this._closeClass=b||"",this._transitionClass=y||"",this._root=_,this._hoverType=M,this._hoverDelay=E,this._enterDelay=T,this._leaveDelay=w}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found:
var Bootstrap5Menubar=function(){"use strict";var P=Object.defineProperty;var R=(m,c,f)=>c in m?P(m,c,{enumerable:!0,configurable:!0,writable:!0,value:f}):m[c]=f;var o=(m,c,f)=>(R(m,typeof c!="symbol"?c+"":c,f),f);function m(i,e){typeof i=="string"?e.classList.add(i):e.classList.add(...i)}function c(i,e){typeof i=="string"?e.classList.remove(i):e.classList.remove(...i)}function f(i,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${t}" given.`)}for(const t in e)if(!(e[t]instanceof i)){const s=typeof e[t];throw new TypeError(`${t} must be an instance of ${i.name}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function p(i,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${t}" given.`)}for(const t in e){const s=typeof e[t];if(s!==i)throw new TypeError(`${t} must be a ${i}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function k(i){try{if(typeof i!="object"){const e=typeof i;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${e}" given.`)}for(const e in i)try{if(i[e]===null)throw new Error;document.querySelector(i[e])}catch{throw new TypeError(`${e} must be a valid query selector. "${i[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function g(i){try{if(typeof i!="object"||Array.isArray(i)){const e=typeof i;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in i){const t=typeof i[e];if(t!=="string")if(Array.isArray(i[e]))i[e].forEach(s=>{if(typeof s!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${t}" given.`);else{const s={};s[e]=i[e],k(s)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function z(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidState() must be inside of an object. "${t}" given.`)}const e=["none","self","child"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function j(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${t}" given.`)}const e=["none","mouse","keyboard","character"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function $(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${t}" given.`)}const e=["off","on","dynamic"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function V(i,e){if(p("string",{tagName:i}).status&&f(HTMLElement,e).status){const t=i.toLowerCase();let s=!0;for(const n in e)e[n].tagName.toLowerCase()!==t&&(s=!1);return s}else return!1}class x{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n=null}){o(this,"_dom",{toggle:null,parent:null});o(this,"_elements",{controlledMenu:null,parentMenu:null});o(this,"_open",!1);o(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}}));o(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}}));this._dom.toggle=e,this._dom.parent=t,this._elements.controlledMenu=s,this._elements.parentMenu=n}initialize(){this._setIds(),this._setAriaAttributes(),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){p("boolean",{value:e}),this._open=e}_setIds(){var e;if(this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const t=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,10);let s=((e=this.dom.toggle.innerText)==null?void 0:e.replace(/[^a-zA-Z0-9\s]/g,""))||"",n=t;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),n=`${s}-${n}`),this.dom.toggle.id=this.dom.toggle.id||`menu-button-${n}`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`menu-${n}`}}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),V("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}_expand(e=!0){const{closeClass:t,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(m(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&c(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&m(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{c(n,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&m(s,this.elements.controlledMenu.dom.menu),t!==""&&c(t,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),n!==""?(m(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&c(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&m(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{c(n,this.elements.controlledMenu.dom.menu)})})})):(t!==""&&m(t,this.elements.controlledMenu.dom.menu),s!==""&&c(s,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this._expand(),this.isOpen=!0}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._expand(),this.isOpen=!0}close(){this.isOpen&&(this.elements.controlledMenu.blur(),this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._collapse(),this.isOpen=!1)}toggle(){this.isOpen?this.close():this.open()}closeSiblings(){this.elements.parentMenu&&this.elements.parentMenu.elements.submenuToggles.forEach(e=>{e!==this&&e.close()})}closeChildren(){this.elements.controlledMenu.elements.submenuToggles.forEach(e=>e.close())}}class F{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n=!1,childMenu:r=null,toggle:l=null}){o(this,"_dom",{item:null,link:null});o(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});o(this,"_submenu",!1);this._dom.item=e,this._dom.link=t,this._elements.parentMenu=s,this._elements.childMenu=r,this._elements.toggle=l,this._submenu=n}initialize(){}get dom(){return this._dom}get elements(){return this._elements}get isSubmenuItem(){return this._submenu}focus(){this.elements.parentMenu.shouldFocus&&this.dom.link.focus()}blur(){this.elements.parentMenu.shouldFocus&&this.dom.link.blur()}}function v(i){try{const e=i.key||i.keyCode,t={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Character:isNaN(e)&&!!e.match(/^[a-zA-Z]{1}$/),Tab:e==="Tab"||e===9,Asterisk:e==="*"||e===56};return Object.keys(t).find(s=>t[s]===!0)||""}catch{return""}}function u(i){i.preventDefault(),i.stopPropagation()}class I{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:s="a",submenuItemSelector:n="",submenuToggleSelector:r="a",submenuSelector:l="ul",controllerElement:a=null,containerElement:d=null,openClass:h="show",closeClass:b="hide",transitionClass:y="transitioning",isTopLevel:_=!0,parentMenu:M=null,hoverType:C="off",hoverDelay:E=250,enterDelay:T=-1,leaveDelay:w=-1}){o(this,"_MenuType",I);o(this,"_MenuItemType",F);o(this,"_MenuToggleType",x);o(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});o(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});o(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});o(this,"_openClass","show");o(this,"_closeClass","hide");o(this,"_transitionClass","transitioning");o(this,"_root",!0);o(this,"_currentChild",0);o(this,"_focusState","none");o(this,"_currentEvent","none");o(this,"_hoverType","off");o(this,"_hoverDelay",250);o(this,"_enterDelay",-1);o(this,"_leaveDelay",-1);o(this,"_hoverTimeout",null);o(this,"_errors",[]);this._dom.menu=e,this._dom.controller=a,this._dom.container=d,this._selectors.menuItems=t,this._selectors.menuLinks=s,this._selectors.submenuItems=n,this._selectors.submenuToggles=r,this._selectors.submenus=l,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=M,this._elements.rootMenu=_?this:null,this._openClass=h||"",this._closeClass=b||"",this._transitionClass=y||"",this._root=_,this._hoverType=C,this._hoverDelay=E,this._enterDelay=T,this._leaveDelay=w}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found:
- ${this.errors.join(`
- `)}`);if(this.elements.rootMenu===null&&this._findRootMenu(this),this._setDOMElements(),this.isTopLevel&&this.dom.controller&&this.dom.container){const e=new this._MenuToggleType({menuToggleElement:this.dom.controller,parentElement:this.dom.container,controlledMenu:this});this._elements.controller=e}this._createChildElements()}get dom(){return this._dom}get selectors(){return this._selectors}get elements(){return this._elements}get isTopLevel(){return this._root}get openClass(){return this.isTopLevel?this._openClass:this.elements.rootMenu.openClass}get closeClass(){return this.isTopLevel?this._closeClass:this.elements.rootMenu.closeClass}get transitionClass(){return this.isTopLevel?this._transitionClass:this.elements.rootMenu.transitionClass}get currentChild(){return this._currentChild}get focusState(){return this._focusState}get currentEvent(){return this._currentEvent}get currentMenuItem(){return this.elements.menuItems[this.currentChild]}get hoverType(){return this._root?this._hoverType:this.elements.rootMenu.hoverType}get hoverDelay(){return this._root?this._hoverDelay:this.elements.rootMenu.hoverDelay}get enterDelay(){return this._enterDelay===-1?this.hoverDelay:this._root?this._enterDelay:this.elements.rootMenu.enterDelay}get leaveDelay(){return this._leaveDelay===-1?this.hoverDelay:this._root?this._leaveDelay:this.elements.rootMenu.leaveDelay}get shouldFocus(){let e=!1;return(this.currentEvent==="keyboard"||this.currentEvent==="character")&&(e=!0),this.currentEvent==="mouse"&&this.hoverType==="dynamic"&&(e=!0),e}get errors(){return this._errors}set openClass(e){g({openClass:e}),this._openClass!==e&&(this._openClass=e)}set closeClass(e){g({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}set transitionClass(e){g({transitionClass:e}),this._transitionClass!==e&&(this._transitionClass=e)}set currentChild(e){p("number",{value:e});function t(s){if(["mouse","character"].includes(s.currentEvent)&&s.elements.parentMenu){let r=0,l=!1;for(;!l&&r<s.elements.parentMenu.elements.menuItems.length;){const a=s.elements.parentMenu.elements.menuItems[r];a.isSubmenuItem&&a.elements.toggle.elements.controlledMenu===s&&(l=!0,s.elements.parentMenu.currentEvent=s.currentEvent,s.elements.parentMenu.currentChild=r),r++}}}e<-1?(this._currentChild=-1,t(this)):e>=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}set focusState(e){q({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&(e==="self"||e==="none")&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(e==="self"||e==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(e){j({value:e}),this._currentEvent!==e&&(this._currentEvent=e,this.elements.submenuToggles.length>0&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.currentEvent=e}))}set hoverType(e){$({value:e}),this._hoverType!==e&&(this._hoverType=e)}set hoverDelay(e){p("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}set enterDelay(e){p("number",{value:e}),this._enterDelay!==e&&(this._enterDelay=e)}set leaveDelay(e){p("number",{value:e}),this._leaveDelay!==e&&(this._leaveDelay=e)}_validate(){let e=!0,t;this._dom.container!==null||this._dom.controller!==null?t=f(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):t=f(HTMLElement,{menuElement:this._dom.menu}),t.status||(this._errors.push(t.error.message),e=!1);let s;if(this._selectors.submenuItems!==""?s=k({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=k({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),e=!1),this._openClass!==""){const h=g({openClass:this._openClass});h.status||(this._errors.push(h.error.message),e=!1)}if(this._closeClass!==""){const h=g({closeClass:this._closeClass});h.status||(this._errors.push(h.error.message),e=!1)}if(this._transitionClass!==""){const h=g({transitionClass:this._transitionClass});h.status||(this._errors.push(h.error.message),e=!1)}const n=p("boolean",{isTopLevel:this._root});if(n.status||(this._errors.push(n.error.message),e=!1),this._elements.parentMenu!==null){const h=f(I,{parentMenu:this._elements.parentMenu});h.status||(this._errors.push(h.error.message),e=!1)}const r=$({hoverType:this._hoverType});r.status||(this._errors.push(r.error.message),e=!1);const l=p("number",{hoverDelay:this._hoverDelay});l.status||(this._errors.push(l.error.message),e=!1);const a=p("number",{enterDelay:this._enterDelay});a.status||(this._errors.push(a.error.message),e=!1);const d=p("number",{leaveDelay:this._leaveDelay});return d.status||(this._errors.push(d.error.message),e=!1),e}_setDOMElementType(e,t=this.dom.menu,s=!0){if(typeof this.selectors[e]=="string"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be set through _setDOMElementType.`);t!==this.dom.menu&&f(HTMLElement,{base:t});const r=Array.from(t.querySelectorAll(this.selectors[e])).filter(l=>l.parentElement===t);s?this._dom[e]=r:this._dom[e]=[...this._dom[e],...r]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_resetDOMElementType(e){if(typeof this.dom[e]<"u"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_setDOMElements(){this._setDOMElementType("menuItems"),this.selectors.submenuItems!==""&&(this._setDOMElementType("submenuItems"),this._resetDOMElementType("submenuToggles"),this._resetDOMElementType("submenus"),this.dom.submenuItems.forEach(e=>{this._setDOMElementType("submenuToggles",e,!1),this._setDOMElementType("submenus",e,!1)}))}_findRootMenu(e){if(e.isTopLevel)this._elements.rootMenu=e;else if(e.elements.parentMenu!==null)this._findRootMenu(e.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(e=>{let t;if(this.dom.submenuItems.includes(e)){const s=e.querySelector(this.selectors.submenuToggles),n=e.querySelector(this.selectors.submenus),r=new this._MenuType({menuElement:n,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuToggles,submenuSelector:this.selectors.submenus,openClass:this.openClass,closeClass:this.closeClass,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),l=new this._MenuToggleType({menuToggleElement:s,parentElement:e,controlledMenu:r,parentMenu:this});this._elements.submenuToggles.push(l),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:r,toggle:l})}else{const s=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(t)})}_handleFocus(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=t})})}_handleClick(){function e(t,s,n){u(n),s.toggle(),s.isOpen&&(t.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(s)},{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",n=>{this.currentEvent="mouse",e(this,t.elements.toggle,n)})}),this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("pointerup",t=>{this.currentEvent="mouse",e(this,this.elements.controller,t)})}_handleHover(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("pointerenter",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t),e.isSubmenuItem&&(this.enterDelay>0?this._hoverTimeout=setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay):e.elements.toggle.preview());else if(this.hoverType==="dynamic"){const n=this.elements.submenuToggles.some(r=>r.isOpen);this.currentChild=t,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),e.isSubmenuItem&&(!this.isTopLevel||n)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?this._hoverTimeout=setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay):e.elements.toggle.preview())}}}),e.isSubmenuItem&&e.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))})})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=v(e);(t==="Space"||t==="Enter")&&u(e)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=v(e);(t==="Space"||t==="Enter")&&(u(e),this.elements.controller.toggle(),this.elements.controller.isOpen&&this.focusFirstChild())})}focus(){this.focusState="self",this.shouldFocus&&this.dom.menu.focus()}blur(){this.focusState="none",this.shouldFocus&&this.dom.menu.blur()}focusCurrentChild(){this.focusState="self",this.currentChild!==-1&&this.currentMenuItem.focus()}focusChild(e){this.blurCurrentChild(),this.currentChild=e,this.focusCurrentChild()}focusFirstChild(){this.focusChild(0)}focusLastChild(){this.focusChild(this.elements.menuItems.length-1)}focusNextChild(){this.currentChild<this.elements.menuItems.length-1?this.focusChild(this.currentChild+1):this.focusCurrentChild()}focusPreviousChild(){this.currentChild>0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&this.currentMenuItem.blur()}focusController(){this.dom.controller&&(this.shouldFocus&&this.dom.controller.focus(),this.focusState="none")}focusContainer(){this.dom.container&&(this.shouldFocus&&this.dom.container.focus(),this.focusState="none")}closeChildren(){this.elements.submenuToggles.forEach(e=>e.close())}blurChildren(){this.elements.menuItems.forEach(e=>{e.blur(),e.isSubmenuItem&&e.elements.childMenu.blurChildren()})}}class O extends F{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n=!1,childMenu:r=null,toggle:l=null,initialize:a=!0}){super({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n,childMenu:r,toggle:l}),a&&this.initialize()}initialize(){super.initialize(),this.dom.item.setAttribute("role","none"),this.dom.link.setAttribute("role","menuitem"),this.dom.link.tabIndex=-1}focus(){super.focus(),this.elements.parentMenu.isTopLevel&&(this.dom.link.tabIndex=0)}blur(){super.blur(),this.elements.parentMenu.isTopLevel&&(this.dom.link.tabIndex=-1)}}class z extends x{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n=null,initialize:r=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n}),r&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&(this.closeChildren(),this.elements.parentMenu&&this.elements.parentMenu.focusCurrentChild()),super.close()}}class S extends I{constructor({menuElement:t,menuItemSelector:s="li",menuLinkSelector:n="a",submenuItemSelector:r="",submenuToggleSelector:l="a",submenuSelector:a="ul",controllerElement:d=null,containerElement:h=null,openClass:b="show",closeClass:y="hide",transitionClass:_="transitioning",isTopLevel:C=!0,parentMenu:M=null,hoverType:E="off",hoverDelay:T=250,enterDelay:w=-1,leaveDelay:A=-1,initialize:L=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:r,submenuToggleSelector:l,submenuSelector:a,controllerElement:d,containerElement:h,openClass:b,closeClass:y,transitionClass:_,isTopLevel:C,parentMenu:M,hoverType:E,hoverDelay:T,enterDelay:w,leaveDelay:A});o(this,"_MenuType",S);o(this,"_MenuItemType",O);o(this,"_MenuToggleType",z);L&&this.initialize()}initialize(){try{super.initialize(),this.isTopLevel?this.dom.menu.setAttribute("role","menubar"):this.dom.menu.setAttribute("role","menu"),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup(),this.isTopLevel&&(this.elements.menuItems[0].dom.link.tabIndex=0)}catch(t){console.error(t)}}_handleClick(){super._handleClick(),document.addEventListener("pointerup",t=>{this.focusState!=="none"&&(this.currentEvent="mouse",!this.dom.menu.contains(t.target)&&!this.dom.menu!==t.target&&(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",t=>{this.currentEvent="keyboard";const s=v(t);if(s==="Tab"&&(this.elements.rootMenu.focusState!=="none"?(this.elements.rootMenu.blur(),this.elements.rootMenu.closeChildren()):this.elements.rootMenu.focus()),s==="Character")u(t);else if(this.isTopLevel){if(this.focusState==="self"){const n=["ArrowRight","ArrowLeft","Home","End"],r=["Space","Enter","ArrowDown","ArrowUp"],l=["Escape"];(n.includes(s)||this.currentMenuItem.isSubmenuItem&&r.includes(s)||this.elements.controller&&l.includes(s))&&u(t)}}else{const n=["Escape","ArrowRight","ArrowLeft","ArrowDown","ArrowUp","Home","End"],r=["Space","Enter"];(n.includes(s)||this.currentMenuItem.isSubmenuItem&&r.includes(s))&&u(t)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",t=>{this.currentEvent="keyboard";const s=v(t),{altKey:n,crtlKey:r,metaKey:l}=t;if(s==="Character"&&!(n||r||l))u(t),this.elements.rootMenu.currentEvent="character",this.focusNextChildWithCharacter(t.key);else if(this.isTopLevel){if(this.focusState==="self")if(s==="Space"||s==="Enter")this.currentMenuItem.isSubmenuItem?(u(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):this.currentMenuItem.dom.link.click();else if(s==="ArrowRight"){u(t);const d=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusNextChild(),d&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else if(s==="ArrowLeft"){u(t);const d=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusPreviousChild(),d&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else s==="ArrowDown"?this.currentMenuItem.isSubmenuItem&&(u(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):s==="ArrowUp"?this.currentMenuItem.isSubmenuItem&&(u(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusLastChild()})):s==="Home"?(u(t),this.focusFirstChild()):s==="End"?(u(t),this.focusLastChild()):s==="Escape"&&(this.elements.submenuToggles.some(h=>h.isOpen)?(u(t),this.closeChildren()):this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(u(t),this.elements.controller.close(),this.focusController()))}else s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(u(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):this.currentMenuItem.dom.link.click():s==="Escape"?(u(t),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusCurrentChild()):s==="ArrowRight"?this.currentMenuItem.isSubmenuItem?(u(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):(u(t),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusNextChild(),this.elements.rootMenu.currentMenuItem.isSubmenuItem&&this.elements.rootMenu.currentMenuItem.elements.toggle.preview()):s==="ArrowLeft"?this.elements.parentMenu.currentMenuItem.isSubmenuItem&&(u(t),this.elements.parentMenu.currentMenuItem.elements.toggle.close(),this.elements.parentMenu.focusCurrentChild(),this.elements.parentMenu===this.elements.rootMenu&&(this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusPreviousChild(),this.elements.rootMenu.currentMenuItem.isSubmenuItem&&(this.elements.rootMenu.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.elements.rootMenu.currentMenuItem.elements.toggle.preview()))):s==="ArrowDown"?(u(t),this.focusNextChild()):s==="ArrowUp"?(u(t),this.focusPreviousChild()):s==="Home"?(u(t),this.focusFirstChild()):s==="End"&&(u(t),this.focusLastChild())})}focusNextChild(){this.currentChild===this.elements.menuItems.length-1?this.focusFirstChild():this.focusChild(this.currentChild+1)}focusPreviousChild(){this.currentChild===0?this.focusLastChild():this.focusChild(this.currentChild-1)}focusNextChildWithCharacter(t){const s=t.toLowerCase();let n=this.currentChild+1,r=!1;for(;!r&&n<this.elements.menuItems.length;){let l="";this.elements.menuItems[n].dom.item.innerText?l=this.elements.menuItems[n].dom.item.innerText:l=this.elements.menuItems[n].dom.item.textContent,l=l.replace(/[\s]/g,"").toLowerCase().charAt(0),l===s&&(r=!0,this.focusChild(n)),n++}}}class H extends O{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n=!1,childMenu:r=null,toggle:l=null,initialize:a=!0}){super({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n,childMenu:r,toggle:l,initialize:!1}),a&&this.initialize()}}class K extends z{constructor({menuToggleElement:t,parentElement:s,controlledMenu:n,parentMenu:r=null,initialize:l=!0}){super({menuToggleElement:t,parentElement:s,controlledMenu:n,parentMenu:r,initialize:!1});o(this,"_dom",{toggle:null,parent:null,container:null});this._dom.toggle=t,this._dom.parent=s,this._dom.container=n.isTopLevel?n.dom.container:n.dom.menu,l&&this.initialize()}_expand(t=!0){const{openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(m(n,this.dom.container),requestAnimationFrame(()=>{m(s,this.dom.container),requestAnimationFrame(()=>{c(n,this.dom.container)})})):s!==""&&m(s,this.dom.container),t&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(t=!0){const{closeClass:s,openClass:n,transitionClass:r}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),r!==""?(m(r,this.dom.container),requestAnimationFrame(()=>{n!==""&&c(n,this.dom.container),requestAnimationFrame(()=>{s!==""&&m(s,this.dom.container),requestAnimationFrame(()=>{c(r,this.dom.container)})})})):(s!==""&&m(s,this.dom.container),n!==""&&c(n,this.dom.container)),t&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}class D extends S{constructor({menuElement:t,menuItemSelector:s=".nav-item,li",menuLinkSelector:n=".nav-link,.dropdown-item",submenuItemSelector:r=".dropdown",submenuToggleSelector:l=".dropdown-toggle",submenuSelector:a=".dropdown-menu",controllerElement:d=null,containerElement:h=null,openClass:b="show",closeClass:y="collapse",transitionClass:_="transitioning",isTopLevel:C=!0,parentMenu:M=null,hoverType:E="off",hoverDelay:T=250,enterDelay:w=-1,leaveDelay:A=-1,disableBootstrap:L=!0,initialize:B=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:r,submenuToggleSelector:l,submenuSelector:a,controllerElement:d,containerElement:h,openClass:b,closeClass:y,transitionClass:_,isTopLevel:C,parentMenu:M,hoverType:E,hoverDelay:T,enterDelay:w,leaveDelay:A,initialize:!1});o(this,"_MenuType",D);o(this,"_MenuItemType",H);o(this,"_MenuToggleType",K);o(this,"_disableBootstrap",!0);o(this,"_pseudoDropdownElement",document.createElement("div"));o(this,"_bootstrapEvents",["show.bs.dropdown","shown.bs.dropdown","hide.bs.dropdown","hidden.bs.dropdown"]);this._disableBootstrap=L,B&&this.initialize()}initialize(){super.initialize(),this.bootstrapDisabled&&this._disableBootstrapDropdownBehaviour()}get bootstrapDisabled(){return this._disableBootstrap}get bootstrapPseudoDropdownElement(){return this._pseudoDropdownElement}get bootstrapEvents(){return this._bootstrapEvents}_validate(){let t=super._validate();const s=p("boolean",{disableBootstrap:this._disableBootstrap});return s.status||(this._errors.push(s.error.message),t=!1),t}_disableBootstrapDropdownBehaviour(){this.elements.submenuToggles.forEach(t=>{this.bootstrapEvents.forEach(s=>{t.dom.toggle.addEventListener(s,n=>{u(n);const r=bootstrap.Dropdown.getInstance(n.target);r&&r._menu!==this.bootstrapPseudoDropdownElement&&(r._menu=this.bootstrapPseudoDropdownElement)},{once:!0})})})}}return D}();
- `)}`);if(this.elements.rootMenu===null&&this._findRootMenu(this),this._setDOMElements(),this.isTopLevel&&this.dom.controller&&this.dom.container){const e=new this._MenuToggleType({menuToggleElement:this.dom.controller,parentElement:this.dom.container,controlledMenu:this});this._elements.controller=e}this._createChildElements()}get dom(){return this._dom}get selectors(){return this._selectors}get elements(){return this._elements}get isTopLevel(){return this._root}get openClass(){return this.isTopLevel?this._openClass:this.elements.rootMenu.openClass}get closeClass(){return this.isTopLevel?this._closeClass:this.elements.rootMenu.closeClass}get transitionClass(){return this.isTopLevel?this._transitionClass:this.elements.rootMenu.transitionClass}get currentChild(){return this._currentChild}get focusState(){return this._focusState}get currentEvent(){return this._currentEvent}get currentMenuItem(){return this.elements.menuItems[this.currentChild]}get hoverType(){return this._root?this._hoverType:this.elements.rootMenu.hoverType}get hoverDelay(){return this._root?this._hoverDelay:this.elements.rootMenu.hoverDelay}get enterDelay(){return this._enterDelay===-1?this.hoverDelay:this._root?this._enterDelay:this.elements.rootMenu.enterDelay}get leaveDelay(){return this._leaveDelay===-1?this.hoverDelay:this._root?this._leaveDelay:this.elements.rootMenu.leaveDelay}get shouldFocus(){let e=!1;return(this.currentEvent==="keyboard"||this.currentEvent==="character")&&(e=!0),this.currentEvent==="mouse"&&this.hoverType==="dynamic"&&(e=!0),e}get errors(){return this._errors}set openClass(e){g({openClass:e}),this._openClass!==e&&(this._openClass=e)}set closeClass(e){g({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}set transitionClass(e){g({transitionClass:e}),this._transitionClass!==e&&(this._transitionClass=e)}set currentChild(e){p("number",{value:e});function t(s){if(["mouse","character"].includes(s.currentEvent)&&s.elements.parentMenu){let r=0,l=!1;for(;!l&&r<s.elements.parentMenu.elements.menuItems.length;){const a=s.elements.parentMenu.elements.menuItems[r];a.isSubmenuItem&&a.elements.toggle.elements.controlledMenu===s&&(l=!0,s.elements.parentMenu.currentEvent=s.currentEvent,s.elements.parentMenu.currentChild=r),r++}}}e<-1?(this._currentChild=-1,t(this)):e>=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}set focusState(e){z({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&(e==="self"||e==="none")&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(e==="self"||e==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(e){j({value:e}),this._currentEvent!==e&&(this._currentEvent=e,this.elements.submenuToggles.length>0&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.currentEvent=e}))}set hoverType(e){$({value:e}),this._hoverType!==e&&(this._hoverType=e)}set hoverDelay(e){p("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}set enterDelay(e){p("number",{value:e}),this._enterDelay!==e&&(this._enterDelay=e)}set leaveDelay(e){p("number",{value:e}),this._leaveDelay!==e&&(this._leaveDelay=e)}_validate(){let e=!0,t;this._dom.container!==null||this._dom.controller!==null?t=f(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):t=f(HTMLElement,{menuElement:this._dom.menu}),t.status||(this._errors.push(t.error.message),e=!1);let s;if(this._selectors.submenuItems!==""?s=k({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=k({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),e=!1),this._openClass!==""){const h=g({openClass:this._openClass});h.status||(this._errors.push(h.error.message),e=!1)}if(this._closeClass!==""){const h=g({closeClass:this._closeClass});h.status||(this._errors.push(h.error.message),e=!1)}if(this._transitionClass!==""){const h=g({transitionClass:this._transitionClass});h.status||(this._errors.push(h.error.message),e=!1)}const n=p("boolean",{isTopLevel:this._root});if(n.status||(this._errors.push(n.error.message),e=!1),this._elements.parentMenu!==null){const h=f(I,{parentMenu:this._elements.parentMenu});h.status||(this._errors.push(h.error.message),e=!1)}const r=$({hoverType:this._hoverType});r.status||(this._errors.push(r.error.message),e=!1);const l=p("number",{hoverDelay:this._hoverDelay});l.status||(this._errors.push(l.error.message),e=!1);const a=p("number",{enterDelay:this._enterDelay});a.status||(this._errors.push(a.error.message),e=!1);const d=p("number",{leaveDelay:this._leaveDelay});return d.status||(this._errors.push(d.error.message),e=!1),e}_setDOMElementType(e,t=this.dom.menu,s=!0){if(typeof this.selectors[e]=="string"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be set through _setDOMElementType.`);t!==this.dom.menu&&f(HTMLElement,{base:t});const r=Array.from(t.querySelectorAll(this.selectors[e])).filter(l=>l.parentElement===t);s?this._dom[e]=r:this._dom[e]=[...this._dom[e],...r]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_resetDOMElementType(e){if(typeof this.dom[e]<"u"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_setDOMElements(){this._setDOMElementType("menuItems"),this.selectors.submenuItems!==""&&(this._setDOMElementType("submenuItems"),this._resetDOMElementType("submenuToggles"),this._resetDOMElementType("submenus"),this.dom.submenuItems.forEach(e=>{this._setDOMElementType("submenuToggles",e,!1),this._setDOMElementType("submenus",e,!1)}))}_findRootMenu(e){if(e.isTopLevel)this._elements.rootMenu=e;else if(e.elements.parentMenu!==null)this._findRootMenu(e.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(e=>{let t;if(this.dom.submenuItems.includes(e)){const s=e.querySelector(this.selectors.submenuToggles),n=e.querySelector(this.selectors.submenus),r=new this._MenuType({menuElement:n,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuToggles,submenuSelector:this.selectors.submenus,openClass:this.openClass,closeClass:this.closeClass,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),l=new this._MenuToggleType({menuToggleElement:s,parentElement:e,controlledMenu:r,parentMenu:this});this._elements.submenuToggles.push(l),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:r,toggle:l})}else{const s=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(t)})}_handleFocus(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=t})})}_handleClick(){function e(t,s,n){u(n),s.toggle(),s.isOpen&&(t.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(s)},{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",n=>{this.currentEvent="mouse",e(this,t.elements.toggle,n)})}),this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("pointerup",t=>{this.currentEvent="mouse",e(this,this.elements.controller,t)})}_handleHover(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("pointerenter",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t),e.isSubmenuItem&&(this.enterDelay>0?this._hoverTimeout=setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay):e.elements.toggle.preview());else if(this.hoverType==="dynamic"){const n=this.elements.submenuToggles.some(r=>r.isOpen);this.currentChild=t,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),e.isSubmenuItem&&(!this.isTopLevel||n)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?this._hoverTimeout=setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay):e.elements.toggle.preview())}}}),e.isSubmenuItem&&e.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))})})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=v(e);(t==="Space"||t==="Enter")&&u(e)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=v(e);(t==="Space"||t==="Enter")&&(u(e),this.elements.controller.toggle(),this.elements.controller.isOpen&&this.focusFirstChild())})}focus(){this.focusState="self",this.shouldFocus&&this.dom.menu.focus()}blur(){this.focusState="none",this.shouldFocus&&this.dom.menu.blur()}focusCurrentChild(){this.focusState="self",this.currentChild!==-1&&this.currentMenuItem.focus()}focusChild(e){this.blurCurrentChild(),this.currentChild=e,this.focusCurrentChild()}focusFirstChild(){this.focusChild(0)}focusLastChild(){this.focusChild(this.elements.menuItems.length-1)}focusNextChild(){this.currentChild<this.elements.menuItems.length-1?this.focusChild(this.currentChild+1):this.focusCurrentChild()}focusPreviousChild(){this.currentChild>0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&this.currentMenuItem.blur()}focusController(){this.dom.controller&&(this.shouldFocus&&this.dom.controller.focus(),this.focusState="none")}focusContainer(){this.dom.container&&(this.shouldFocus&&this.dom.container.focus(),this.focusState="none")}closeChildren(){this.elements.submenuToggles.forEach(e=>e.close())}blurChildren(){this.elements.menuItems.forEach(e=>{e.blur(),e.isSubmenuItem&&e.elements.childMenu.blurChildren()})}}class O extends F{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n=!1,childMenu:r=null,toggle:l=null,initialize:a=!0}){super({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n,childMenu:r,toggle:l}),a&&this.initialize()}initialize(){super.initialize(),this.dom.item.setAttribute("role","none"),this.dom.link.setAttribute("role","menuitem"),this.dom.link.tabIndex=-1}focus(){super.focus(),this.elements.parentMenu.isTopLevel&&(this.dom.link.tabIndex=0)}blur(){super.blur(),this.elements.parentMenu.isTopLevel&&(this.dom.link.tabIndex=-1)}}class q extends x{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n=null,initialize:r=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n}),r&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&(this.closeChildren(),this.elements.parentMenu&&this.elements.parentMenu.focusCurrentChild()),super.close()}}class D extends I{constructor({menuElement:t,menuItemSelector:s="li",menuLinkSelector:n="a",submenuItemSelector:r="",submenuToggleSelector:l="a",submenuSelector:a="ul",controllerElement:d=null,containerElement:h=null,openClass:b="show",closeClass:y="hide",transitionClass:_="transitioning",isTopLevel:M=!0,parentMenu:C=null,hoverType:E="off",hoverDelay:T=250,enterDelay:w=-1,leaveDelay:A=-1,initialize:L=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:r,submenuToggleSelector:l,submenuSelector:a,controllerElement:d,containerElement:h,openClass:b,closeClass:y,transitionClass:_,isTopLevel:M,parentMenu:C,hoverType:E,hoverDelay:T,enterDelay:w,leaveDelay:A});o(this,"_MenuType",D);o(this,"_MenuItemType",O);o(this,"_MenuToggleType",q);L&&this.initialize()}initialize(){try{super.initialize(),this.isTopLevel?this.dom.menu.setAttribute("role","menubar"):this.dom.menu.setAttribute("role","menu"),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup(),this.isTopLevel&&(this.elements.menuItems[0].dom.link.tabIndex=0)}catch(t){console.error(t)}}_handleClick(){super._handleClick(),document.addEventListener("pointerup",t=>{this.focusState!=="none"&&(this.currentEvent="mouse",!this.dom.menu.contains(t.target)&&!this.dom.menu!==t.target&&(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",t=>{this.currentEvent="keyboard";const s=v(t);if(s==="Tab"&&(this.elements.rootMenu.focusState!=="none"?(this.elements.rootMenu.blur(),this.elements.rootMenu.closeChildren()):this.elements.rootMenu.focus()),s==="Character")u(t);else if(this.isTopLevel){if(this.focusState==="self"){const n=["ArrowRight","ArrowLeft","Home","End"],r=["Space","Enter","ArrowDown","ArrowUp"],l=["Escape"];(n.includes(s)||this.currentMenuItem.isSubmenuItem&&r.includes(s)||this.elements.controller&&l.includes(s))&&u(t)}}else{const n=["Escape","ArrowRight","ArrowLeft","ArrowDown","ArrowUp","Home","End"],r=["Space","Enter"];(n.includes(s)||this.currentMenuItem.isSubmenuItem&&r.includes(s))&&u(t)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",t=>{this.currentEvent="keyboard";const s=v(t),{altKey:n,crtlKey:r,metaKey:l}=t;if(s==="Character"&&!(n||r||l))u(t),this.elements.rootMenu.currentEvent="character",this.focusNextChildWithCharacter(t.key);else if(this.isTopLevel){if(this.focusState==="self")if(s==="Space"||s==="Enter")this.currentMenuItem.isSubmenuItem?(u(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):this.currentMenuItem.dom.link.click();else if(s==="ArrowRight"){u(t);const d=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusNextChild(),d&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else if(s==="ArrowLeft"){u(t);const d=this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen;this.focusPreviousChild(),d&&(this.currentMenuItem.isSubmenuItem?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.preview()):this.closeChildren())}else s==="ArrowDown"?this.currentMenuItem.isSubmenuItem&&(u(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):s==="ArrowUp"?this.currentMenuItem.isSubmenuItem&&(u(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusLastChild()})):s==="Home"?(u(t),this.focusFirstChild()):s==="End"?(u(t),this.focusLastChild()):s==="Escape"&&(this.elements.submenuToggles.some(h=>h.isOpen)?(u(t),this.closeChildren()):this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(u(t),this.elements.controller.close(),this.focusController()))}else s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(u(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):this.currentMenuItem.dom.link.click():s==="Escape"?(u(t),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusCurrentChild()):s==="ArrowRight"?this.currentMenuItem.isSubmenuItem?(u(t),this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.toggle.open(),requestAnimationFrame(()=>{this.currentMenuItem.elements.childMenu.focusFirstChild()})):(u(t),this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusNextChild(),this.elements.rootMenu.currentMenuItem.isSubmenuItem&&this.elements.rootMenu.currentMenuItem.elements.toggle.preview()):s==="ArrowLeft"?this.elements.parentMenu.currentMenuItem.isSubmenuItem&&(u(t),this.elements.parentMenu.currentMenuItem.elements.toggle.close(),this.elements.parentMenu.focusCurrentChild(),this.elements.parentMenu===this.elements.rootMenu&&(this.elements.rootMenu.closeChildren(),this.elements.rootMenu.focusPreviousChild(),this.elements.rootMenu.currentMenuItem.isSubmenuItem&&(this.elements.rootMenu.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.elements.rootMenu.currentMenuItem.elements.toggle.preview()))):s==="ArrowDown"?(u(t),this.focusNextChild()):s==="ArrowUp"?(u(t),this.focusPreviousChild()):s==="Home"?(u(t),this.focusFirstChild()):s==="End"&&(u(t),this.focusLastChild())})}focusNextChild(){this.currentChild===this.elements.menuItems.length-1?this.focusFirstChild():this.focusChild(this.currentChild+1)}focusPreviousChild(){this.currentChild===0?this.focusLastChild():this.focusChild(this.currentChild-1)}focusNextChildWithCharacter(t){const s=t.toLowerCase();let n=this.currentChild+1,r=!1;for(;!r&&n<this.elements.menuItems.length;){let l="";this.elements.menuItems[n].dom.item.innerText?l=this.elements.menuItems[n].dom.item.innerText:l=this.elements.menuItems[n].dom.item.textContent,l=l.replace(/[\s]/g,"").toLowerCase().charAt(0),l===s&&(r=!0,this.focusChild(n)),n++}}}class H extends O{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n=!1,childMenu:r=null,toggle:l=null,initialize:a=!0}){super({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n,childMenu:r,toggle:l,initialize:!1}),a&&this.initialize()}}class K extends q{constructor({menuToggleElement:t,parentElement:s,controlledMenu:n,parentMenu:r=null,initialize:l=!0}){super({menuToggleElement:t,parentElement:s,controlledMenu:n,parentMenu:r,initialize:!1});o(this,"_dom",{toggle:null,parent:null,container:null});this._dom.toggle=t,this._dom.parent=s,this._dom.container=n.isTopLevel?n.dom.container:n.dom.menu,l&&this.initialize()}_expand(t=!0){const{openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(m(n,this.dom.container),requestAnimationFrame(()=>{m(s,this.dom.container),requestAnimationFrame(()=>{c(n,this.dom.container)})})):s!==""&&m(s,this.dom.container),t&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(t=!0){const{closeClass:s,openClass:n,transitionClass:r}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),r!==""?(m(r,this.dom.container),requestAnimationFrame(()=>{n!==""&&c(n,this.dom.container),requestAnimationFrame(()=>{s!==""&&m(s,this.dom.container),requestAnimationFrame(()=>{c(r,this.dom.container)})})})):(s!==""&&m(s,this.dom.container),n!==""&&c(n,this.dom.container)),t&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}class S extends D{constructor({menuElement:t,menuItemSelector:s=".nav-item,li",menuLinkSelector:n=".nav-link,.dropdown-item",submenuItemSelector:r=".dropdown",submenuToggleSelector:l=".dropdown-toggle",submenuSelector:a=".dropdown-menu",controllerElement:d=null,containerElement:h=null,openClass:b="show",closeClass:y="collapse",transitionClass:_="transitioning",isTopLevel:M=!0,parentMenu:C=null,hoverType:E="off",hoverDelay:T=250,enterDelay:w=-1,leaveDelay:A=-1,disableBootstrap:L=!0,initialize:B=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:r,submenuToggleSelector:l,submenuSelector:a,controllerElement:d,containerElement:h,openClass:b,closeClass:y,transitionClass:_,isTopLevel:M,parentMenu:C,hoverType:E,hoverDelay:T,enterDelay:w,leaveDelay:A,initialize:!1});o(this,"_MenuType",S);o(this,"_MenuItemType",H);o(this,"_MenuToggleType",K);o(this,"_disableBootstrap",!0);o(this,"_pseudoDropdownElement",document.createElement("div"));o(this,"_bootstrapEvents",["show.bs.dropdown","shown.bs.dropdown","hide.bs.dropdown","hidden.bs.dropdown"]);this._disableBootstrap=L,B&&this.initialize()}initialize(){super.initialize(),this.bootstrapDisabled&&this._disableBootstrapDropdownBehaviour()}get bootstrapDisabled(){return this._disableBootstrap}get bootstrapPseudoDropdownElement(){return this._pseudoDropdownElement}get bootstrapEvents(){return this._bootstrapEvents}_validate(){let t=super._validate();const s=p("boolean",{disableBootstrap:this._disableBootstrap});return s.status||(this._errors.push(s.error.message),t=!1),t}_disableBootstrapDropdownBehaviour(){this.elements.submenuToggles.forEach(t=>{this.bootstrapEvents.forEach(s=>{t.dom.toggle.addEventListener(s,n=>{u(n);const r=bootstrap.Dropdown.getInstance(n.target);r&&r._menu!==this.bootstrapPseudoDropdownElement&&(r._menu=this.bootstrapPseudoDropdownElement)},{once:!0})})})}}return S}();

@@ -1,3 +0,3 @@

var Bootstrap5TopLinkDisclosureMenu=function(){"use strict";var U=Object.defineProperty;var Z=(a,m,f)=>m in a?U(a,m,{enumerable:!0,configurable:!0,writable:!0,value:f}):a[m]=f;var r=(a,m,f)=>(Z(a,typeof m!="symbol"?m+"":m,f),f);function a(i,e){typeof i=="string"?e.classList.add(i):e.classList.add(...i)}function m(i,e){typeof i=="string"?e.classList.remove(i):e.classList.remove(...i)}function f(i,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${t}" given.`)}for(const t in e)if(!(e[t]instanceof i)){const s=typeof e[t];throw new TypeError(`${t} must be an instance of ${i.name}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function p(i,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${t}" given.`)}for(const t in e){const s=typeof e[t];if(s!==i)throw new TypeError(`${t} must be a ${i}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function w(i){try{if(typeof i!="object"){const e=typeof i;throw new TypeError(`Values given to isCSSSelector() must be inside of an object. "${e}" given.`)}for(const e in i)try{if(i[e]===null)throw new Error;document.querySelector(i[e])}catch{throw new TypeError(`${e} must be a valid CSS selector. "${i[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function g(i){try{if(typeof i!="object"||Array.isArray(i)){const e=typeof i;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in i){const t=typeof i[e];if(t!=="string")if(Array.isArray(i[e]))i[e].forEach(s=>{if(typeof s!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${t}" given.`);else{const s={};s[e]=i[e],w(s)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function K(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidState() must be inside of an object. "${t}" given.`)}const e=["none","self","child"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function V(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${t}" given.`)}const e=["none","mouse","keyboard","character"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function F(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${t}" given.`)}const e=["off","on","dynamic"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function B(i,e){if(p("string",{tagName:i}).status&&f(HTMLElement,e).status){const t=i.toLowerCase();let s=!0;for(const n in e)e[n].tagName.toLowerCase()!==t&&(s=!1);return s}else return!1}class j{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n=null}){r(this,"_dom",{toggle:null,parent:null});r(this,"_elements",{controlledMenu:null,parentMenu:null});r(this,"_open",!1);r(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}}));r(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}}));this._dom.toggle=e,this._dom.parent=t,this._elements.controlledMenu=s,this._elements.parentMenu=n}initialize(){var e;if(this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),B("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const t=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,10);let s=((e=this.dom.toggle.innerText)==null?void 0:e.replace(/[^a-zA-Z0-9\s]/g,""))||"",n=t;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),n=`${s}-${n}`),this.dom.toggle.id=this.dom.toggle.id||`${n}-menu-button`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`${n}-menu`}this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){p("boolean",{value:e}),this._open=e}_expand(e=!0){const{closeClass:t,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(a(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&m(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&a(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{m(n,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&a(s,this.elements.controlledMenu.dom.menu),t!==""&&m(t,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),n!==""?(a(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&m(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&a(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{m(n,this.elements.controlledMenu.dom.menu)})})})):(t!==""&&a(t,this.elements.controlledMenu.dom.menu),s!==""&&m(s,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this._expand(),this.isOpen=!0}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._expand(),this.isOpen=!0}close(){this.isOpen&&(this.elements.controlledMenu.blur(),this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._collapse(),this.isOpen=!1)}toggle(){this.isOpen?this.close():this.open()}closeSiblings(){this.elements.parentMenu&&this.elements.parentMenu.elements.submenuToggles.forEach(e=>{e!==this&&e.close()})}closeChildren(){this.elements.controlledMenu.elements.submenuToggles.forEach(e=>e.close())}}class x{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n=!1,childMenu:o=null,toggle:l=null}){r(this,"_dom",{item:null,link:null});r(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});r(this,"_submenu",!1);this._dom.item=e,this._dom.link=t,this._elements.parentMenu=s,this._elements.childMenu=o,this._elements.toggle=l,this._submenu=n}initialize(){}get dom(){return this._dom}get elements(){return this._elements}get isSubmenuItem(){return this._submenu}focus(){this.elements.parentMenu.shouldFocus&&this.dom.link.focus()}blur(){this.elements.parentMenu.shouldFocus&&this.dom.link.blur()}}function S(i){try{const e=i.key||i.keyCode,t={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Character:isNaN(e)&&!!e.match(/^[a-zA-Z]{1}$/),Tab:e==="Tab"||e===9,Asterisk:e==="*"||e===56};return Object.keys(t).find(s=>t[s]===!0)||""}catch{return""}}function d(i){i.preventDefault(),i.stopPropagation()}class D{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:s="a",submenuItemSelector:n="",submenuToggleSelector:o="a",submenuSelector:l="ul",controllerElement:h=null,containerElement:c=null,openClass:u="show",closeClass:y="hide",transitionClass:b="transitioning",isTopLevel:_=!0,parentMenu:C=null,hoverType:E="off",hoverDelay:T=250,enterDelay:v=-1,leaveDelay:M=-1}){r(this,"_MenuType",D);r(this,"_MenuItemType",x);r(this,"_MenuToggleType",j);r(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});r(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});r(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});r(this,"_openClass","show");r(this,"_closeClass","hide");r(this,"_transitionClass","transitioning");r(this,"_root",!0);r(this,"_currentChild",0);r(this,"_focusState","none");r(this,"_currentEvent","none");r(this,"_hoverType","off");r(this,"_hoverDelay",250);r(this,"_enterDelay",-1);r(this,"_leaveDelay",-1);r(this,"_hoverTimeout",null);r(this,"_errors",[]);this._dom.menu=e,this._dom.controller=h,this._dom.container=c,this._selectors.menuItems=t,this._selectors.menuLinks=s,this._selectors.submenuItems=n,this._selectors.submenuToggles=o,this._selectors.submenus=l,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=C,this._elements.rootMenu=_?this:null,this._openClass=u||"",this._closeClass=y||"",this._transitionClass=b||"",this._root=_,this._hoverType=E,this._hoverDelay=T,this._enterDelay=v,this._leaveDelay=M}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found:
var Bootstrap5TopLinkDisclosureMenu=function(){"use strict";var U=Object.defineProperty;var Z=(a,m,f)=>m in a?U(a,m,{enumerable:!0,configurable:!0,writable:!0,value:f}):a[m]=f;var r=(a,m,f)=>(Z(a,typeof m!="symbol"?m+"":m,f),f);function a(i,e){typeof i=="string"?e.classList.add(i):e.classList.add(...i)}function m(i,e){typeof i=="string"?e.classList.remove(i):e.classList.remove(...i)}function f(i,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${t}" given.`)}for(const t in e)if(!(e[t]instanceof i)){const s=typeof e[t];throw new TypeError(`${t} must be an instance of ${i.name}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function p(i,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${t}" given.`)}for(const t in e){const s=typeof e[t];if(s!==i)throw new TypeError(`${t} must be a ${i}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function w(i){try{if(typeof i!="object"){const e=typeof i;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${e}" given.`)}for(const e in i)try{if(i[e]===null)throw new Error;document.querySelector(i[e])}catch{throw new TypeError(`${e} must be a valid query selector. "${i[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function g(i){try{if(typeof i!="object"||Array.isArray(i)){const e=typeof i;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in i){const t=typeof i[e];if(t!=="string")if(Array.isArray(i[e]))i[e].forEach(s=>{if(typeof s!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${t}" given.`);else{const s={};s[e]=i[e],w(s)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function K(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidState() must be inside of an object. "${t}" given.`)}const e=["none","self","child"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function V(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${t}" given.`)}const e=["none","mouse","keyboard","character"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function F(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${t}" given.`)}const e=["off","on","dynamic"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function B(i,e){if(p("string",{tagName:i}).status&&f(HTMLElement,e).status){const t=i.toLowerCase();let s=!0;for(const n in e)e[n].tagName.toLowerCase()!==t&&(s=!1);return s}else return!1}class j{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n=null}){r(this,"_dom",{toggle:null,parent:null});r(this,"_elements",{controlledMenu:null,parentMenu:null});r(this,"_open",!1);r(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}}));r(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}}));this._dom.toggle=e,this._dom.parent=t,this._elements.controlledMenu=s,this._elements.parentMenu=n}initialize(){this._setIds(),this._setAriaAttributes(),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){p("boolean",{value:e}),this._open=e}_setIds(){var e;if(this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const t=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,10);let s=((e=this.dom.toggle.innerText)==null?void 0:e.replace(/[^a-zA-Z0-9\s]/g,""))||"",n=t;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),n=`${s}-${n}`),this.dom.toggle.id=this.dom.toggle.id||`menu-button-${n}`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`menu-${n}`}}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),B("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}_expand(e=!0){const{closeClass:t,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(a(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&m(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&a(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{m(n,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&a(s,this.elements.controlledMenu.dom.menu),t!==""&&m(t,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),n!==""?(a(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&m(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&a(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{m(n,this.elements.controlledMenu.dom.menu)})})})):(t!==""&&a(t,this.elements.controlledMenu.dom.menu),s!==""&&m(s,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this._expand(),this.isOpen=!0}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._expand(),this.isOpen=!0}close(){this.isOpen&&(this.elements.controlledMenu.blur(),this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._collapse(),this.isOpen=!1)}toggle(){this.isOpen?this.close():this.open()}closeSiblings(){this.elements.parentMenu&&this.elements.parentMenu.elements.submenuToggles.forEach(e=>{e!==this&&e.close()})}closeChildren(){this.elements.controlledMenu.elements.submenuToggles.forEach(e=>e.close())}}class q{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n=!1,childMenu:o=null,toggle:l=null}){r(this,"_dom",{item:null,link:null});r(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});r(this,"_submenu",!1);this._dom.item=e,this._dom.link=t,this._elements.parentMenu=s,this._elements.childMenu=o,this._elements.toggle=l,this._submenu=n}initialize(){}get dom(){return this._dom}get elements(){return this._elements}get isSubmenuItem(){return this._submenu}focus(){this.elements.parentMenu.shouldFocus&&this.dom.link.focus()}blur(){this.elements.parentMenu.shouldFocus&&this.dom.link.blur()}}function S(i){try{const e=i.key||i.keyCode,t={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Character:isNaN(e)&&!!e.match(/^[a-zA-Z]{1}$/),Tab:e==="Tab"||e===9,Asterisk:e==="*"||e===56};return Object.keys(t).find(s=>t[s]===!0)||""}catch{return""}}function d(i){i.preventDefault(),i.stopPropagation()}class D{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:s="a",submenuItemSelector:n="",submenuToggleSelector:o="a",submenuSelector:l="ul",controllerElement:h=null,containerElement:c=null,openClass:u="show",closeClass:y="hide",transitionClass:b="transitioning",isTopLevel:_=!0,parentMenu:C=null,hoverType:E="off",hoverDelay:T=250,enterDelay:v=-1,leaveDelay:M=-1}){r(this,"_MenuType",D);r(this,"_MenuItemType",q);r(this,"_MenuToggleType",j);r(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});r(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});r(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});r(this,"_openClass","show");r(this,"_closeClass","hide");r(this,"_transitionClass","transitioning");r(this,"_root",!0);r(this,"_currentChild",0);r(this,"_focusState","none");r(this,"_currentEvent","none");r(this,"_hoverType","off");r(this,"_hoverDelay",250);r(this,"_enterDelay",-1);r(this,"_leaveDelay",-1);r(this,"_hoverTimeout",null);r(this,"_errors",[]);this._dom.menu=e,this._dom.controller=h,this._dom.container=c,this._selectors.menuItems=t,this._selectors.menuLinks=s,this._selectors.submenuItems=n,this._selectors.submenuToggles=o,this._selectors.submenus=l,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=C,this._elements.rootMenu=_?this:null,this._openClass=u||"",this._closeClass=y||"",this._transitionClass=b||"",this._root=_,this._hoverType=E,this._hoverDelay=T,this._enterDelay=v,this._leaveDelay=M}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found:
- ${this.errors.join(`
- `)}`);if(this.elements.rootMenu===null&&this._findRootMenu(this),this._setDOMElements(),this.isTopLevel&&this.dom.controller&&this.dom.container){const e=new this._MenuToggleType({menuToggleElement:this.dom.controller,parentElement:this.dom.container,controlledMenu:this});this._elements.controller=e}this._createChildElements()}get dom(){return this._dom}get selectors(){return this._selectors}get elements(){return this._elements}get isTopLevel(){return this._root}get openClass(){return this.isTopLevel?this._openClass:this.elements.rootMenu.openClass}get closeClass(){return this.isTopLevel?this._closeClass:this.elements.rootMenu.closeClass}get transitionClass(){return this.isTopLevel?this._transitionClass:this.elements.rootMenu.transitionClass}get currentChild(){return this._currentChild}get focusState(){return this._focusState}get currentEvent(){return this._currentEvent}get currentMenuItem(){return this.elements.menuItems[this.currentChild]}get hoverType(){return this._root?this._hoverType:this.elements.rootMenu.hoverType}get hoverDelay(){return this._root?this._hoverDelay:this.elements.rootMenu.hoverDelay}get enterDelay(){return this._enterDelay===-1?this.hoverDelay:this._root?this._enterDelay:this.elements.rootMenu.enterDelay}get leaveDelay(){return this._leaveDelay===-1?this.hoverDelay:this._root?this._leaveDelay:this.elements.rootMenu.leaveDelay}get shouldFocus(){let e=!1;return(this.currentEvent==="keyboard"||this.currentEvent==="character")&&(e=!0),this.currentEvent==="mouse"&&this.hoverType==="dynamic"&&(e=!0),e}get errors(){return this._errors}set openClass(e){g({openClass:e}),this._openClass!==e&&(this._openClass=e)}set closeClass(e){g({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}set transitionClass(e){g({transitionClass:e}),this._transitionClass!==e&&(this._transitionClass=e)}set currentChild(e){p("number",{value:e});function t(s){if(["mouse","character"].includes(s.currentEvent)&&s.elements.parentMenu){let o=0,l=!1;for(;!l&&o<s.elements.parentMenu.elements.menuItems.length;){const h=s.elements.parentMenu.elements.menuItems[o];h.isSubmenuItem&&h.elements.toggle.elements.controlledMenu===s&&(l=!0,s.elements.parentMenu.currentEvent=s.currentEvent,s.elements.parentMenu.currentChild=o),o++}}}e<-1?(this._currentChild=-1,t(this)):e>=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}set focusState(e){K({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&(e==="self"||e==="none")&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(e==="self"||e==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(e){V({value:e}),this._currentEvent!==e&&(this._currentEvent=e,this.elements.submenuToggles.length>0&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.currentEvent=e}))}set hoverType(e){F({value:e}),this._hoverType!==e&&(this._hoverType=e)}set hoverDelay(e){p("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}set enterDelay(e){p("number",{value:e}),this._enterDelay!==e&&(this._enterDelay=e)}set leaveDelay(e){p("number",{value:e}),this._leaveDelay!==e&&(this._leaveDelay=e)}_validate(){let e=!0,t;this._dom.container!==null||this._dom.controller!==null?t=f(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):t=f(HTMLElement,{menuElement:this._dom.menu}),t.status||(this._errors.push(t.error.message),e=!1);let s;if(this._selectors.submenuItems!==""?s=w({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=w({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),e=!1),this._openClass!==""){const u=g({openClass:this._openClass});u.status||(this._errors.push(u.error.message),e=!1)}if(this._closeClass!==""){const u=g({closeClass:this._closeClass});u.status||(this._errors.push(u.error.message),e=!1)}if(this._transitionClass!==""){const u=g({transitionClass:this._transitionClass});u.status||(this._errors.push(u.error.message),e=!1)}const n=p("boolean",{isTopLevel:this._root});if(n.status||(this._errors.push(n.error.message),e=!1),this._elements.parentMenu!==null){const u=f(D,{parentMenu:this._elements.parentMenu});u.status||(this._errors.push(u.error.message),e=!1)}const o=F({hoverType:this._hoverType});o.status||(this._errors.push(o.error.message),e=!1);const l=p("number",{hoverDelay:this._hoverDelay});l.status||(this._errors.push(l.error.message),e=!1);const h=p("number",{enterDelay:this._enterDelay});h.status||(this._errors.push(h.error.message),e=!1);const c=p("number",{leaveDelay:this._leaveDelay});return c.status||(this._errors.push(c.error.message),e=!1),e}_setDOMElementType(e,t=this.dom.menu,s=!0){if(typeof this.selectors[e]=="string"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be set through _setDOMElementType.`);t!==this.dom.menu&&f(HTMLElement,{base:t});const o=Array.from(t.querySelectorAll(this.selectors[e])).filter(l=>l.parentElement===t);s?this._dom[e]=o:this._dom[e]=[...this._dom[e],...o]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_resetDOMElementType(e){if(typeof this.dom[e]<"u"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_setDOMElements(){this._setDOMElementType("menuItems"),this.selectors.submenuItems!==""&&(this._setDOMElementType("submenuItems"),this._resetDOMElementType("submenuToggles"),this._resetDOMElementType("submenus"),this.dom.submenuItems.forEach(e=>{this._setDOMElementType("submenuToggles",e,!1),this._setDOMElementType("submenus",e,!1)}))}_findRootMenu(e){if(e.isTopLevel)this._elements.rootMenu=e;else if(e.elements.parentMenu!==null)this._findRootMenu(e.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(e=>{let t;if(this.dom.submenuItems.includes(e)){const s=e.querySelector(this.selectors.submenuToggles),n=e.querySelector(this.selectors.submenus),o=new this._MenuType({menuElement:n,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuToggles,submenuSelector:this.selectors.submenus,openClass:this.openClass,closeClass:this.closeClass,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),l=new this._MenuToggleType({menuToggleElement:s,parentElement:e,controlledMenu:o,parentMenu:this});this._elements.submenuToggles.push(l),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:o,toggle:l})}else{const s=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(t)})}_handleFocus(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=t})})}_handleClick(){function e(t,s,n){d(n),s.toggle(),s.isOpen&&(t.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(s)},{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",n=>{this.currentEvent="mouse",e(this,t.elements.toggle,n)})}),this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("pointerup",t=>{this.currentEvent="mouse",e(this,this.elements.controller,t)})}_handleHover(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("pointerenter",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t),e.isSubmenuItem&&(this.enterDelay>0?this._hoverTimeout=setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay):e.elements.toggle.preview());else if(this.hoverType==="dynamic"){const n=this.elements.submenuToggles.some(o=>o.isOpen);this.currentChild=t,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),e.isSubmenuItem&&(!this.isTopLevel||n)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?this._hoverTimeout=setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay):e.elements.toggle.preview())}}}),e.isSubmenuItem&&e.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))})})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=S(e);(t==="Space"||t==="Enter")&&d(e)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=S(e);(t==="Space"||t==="Enter")&&(d(e),this.elements.controller.toggle(),this.elements.controller.isOpen&&this.focusFirstChild())})}focus(){this.focusState="self",this.shouldFocus&&this.dom.menu.focus()}blur(){this.focusState="none",this.shouldFocus&&this.dom.menu.blur()}focusCurrentChild(){this.focusState="self",this.currentChild!==-1&&this.currentMenuItem.focus()}focusChild(e){this.blurCurrentChild(),this.currentChild=e,this.focusCurrentChild()}focusFirstChild(){this.focusChild(0)}focusLastChild(){this.focusChild(this.elements.menuItems.length-1)}focusNextChild(){this.currentChild<this.elements.menuItems.length-1?this.focusChild(this.currentChild+1):this.focusCurrentChild()}focusPreviousChild(){this.currentChild>0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&this.currentMenuItem.blur()}focusController(){this.dom.controller&&(this.shouldFocus&&this.dom.controller.focus(),this.focusState="none")}focusContainer(){this.dom.container&&(this.shouldFocus&&this.dom.container.focus(),this.focusState="none")}closeChildren(){this.elements.submenuToggles.forEach(e=>e.close())}blurChildren(){this.elements.menuItems.forEach(e=>{e.blur(),e.isSubmenuItem&&e.elements.childMenu.blurChildren()})}}class z extends x{constructor({menuItemElement:t,menuLinkElement:s,parentMenu:n,isSubmenuItem:o=!1,childMenu:l=null,toggle:h=null,initialize:c=!0,submenuSibling:u=null}){super({menuItemElement:t,menuLinkElement:s,parentMenu:n,isSubmenuItem:o,childMenu:l,toggle:h});r(this,"_elements",{parentMenu:null,childMenu:null,toggle:null,sibling:null});this._elements.parentMenu=n,this._elements.childMenu=l,this._elements.toggle=h,this._elements.sibling=u,c&&this.initialize()}}class q extends j{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n=null,initialize:o=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n}),o&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&this.closeChildren(),super.close()}}class k extends D{constructor({menuElement:t,menuItemSelector:s="li",menuLinkSelector:n="a",submenuItemSelector:o="",submenuToggleSelector:l="button",submenuSelector:h="ul",submenuSubtoggleSelector:c="a",controllerElement:u=null,containerElement:y=null,openClass:b="show",closeClass:_="hide",transitionClass:C="transitioning",isTopLevel:E=!0,parentMenu:T=null,hoverType:v="off",hoverDelay:M=250,enterDelay:I=-1,leaveDelay:A=-1,optionalKeySupport:$=!1,initialize:O=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:o,submenuSelector:h,submenuToggleSelector:l,controllerElement:u,containerElement:y,openClass:b,closeClass:_,transitionClass:C,isTopLevel:E,parentMenu:T,hoverType:v,hoverDelay:M,enterDelay:I,leaveDelay:A});r(this,"_MenuType",k);r(this,"_MenuItemType",z);r(this,"_MenuToggleType",q);r(this,"_currentChild",-1);r(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:"",submenuSubtoggles:""});r(this,"_optionalSupport",!1);this._optionalSupport=$,this._selectors.menuItems=s,this._selectors.submenuItems=o,this._selectors.submenuToggles=l,this._selectors.submenus=h,this._selectors.submenuSubtoggles=c,this._selectors.menuLinks=[...new Set([n,l])].join(","),O&&this.initialize()}initialize(){try{super.initialize(),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(t){console.error(t)}}get optionalKeySupport(){return this.isTopLevel?this._optionalSupport:this.elements.rootMenu.optionalKeySupport}set optionalKeySupport(t){p("boolean",{optionalKeySupport:t}),this._optionalSupport=t}_createChildElements(){this.dom.menuItems.forEach(t=>{let s,n;const o=t.querySelector(this.selectors.menuLinks);if(this.dom.submenuItems.includes(t)){const l=t.querySelector(this.selectors.submenuToggles),h=t.querySelector(this.selectors.submenus),c=new this._MenuType({menuElement:h,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuSubtoggles,submenuSelector:this.selectors.submenus,submenuSubtoggleSelector:this.selectors.submenuSubtoggles,openClass:this.openClass,closeClass:this.closeClass,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),u=new this._MenuToggleType({menuToggleElement:l,parentElement:t,controlledMenu:c,parentMenu:this});this._elements.submenuToggles.push(u),l!==o?(n=new this._MenuItemType({menuItemElement:t,menuLinkElement:l,parentMenu:this,isSubmenuItem:!0,childMenu:c,toggle:u}),s=new this._MenuItemType({menuItemElement:t,menuLinkElement:o,parentMenu:this,submenuSibling:n})):s=new this._MenuItemType({menuItemElement:t,menuLinkElement:o,parentMenu:this,isSubmenuItem:!0,childMenu:c,toggle:u})}else s=new this._MenuItemType({menuItemElement:t,menuLinkElement:o,parentMenu:this});this._elements.menuItems.push(s),typeof n<"u"&&this._elements.menuItems.push(n)})}_validate(){let t=super._validate();const s=w({submenuSubtoggleSelector:this._selectors.submenuSubtoggles});s.status||(this._errors.push(s.error.message),t=!1);const n=p("boolean",{optionalKeySupport:this._optionalSupport});return n.status||(this._errors.push(n.error.message),t=!1),t}_handleClick(){super._handleClick(),document.addEventListener("pointerup",t=>{this.focusState!=="none"&&(this.currentEvent="mouse",!this.dom.menu.contains(t.target)&&!this.dom.menu!==t.target&&(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))})}_handleHover(){this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerenter",n=>{if(!(n.pointerType==="pen"||n.pointerType==="touch")){if(this.hoverType==="on"){this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(s);let o=t.isSubmenuItem?t.elements.toggle:null;if(t.elements.sibling!==null&&(o=t.elements.sibling.elements.toggle),o===null)return;this.enterDelay>0?(clearTimeout(this._hoverTimeout),this._hoverTimeout=setTimeout(()=>{o.preview()},this.enterDelay)):o.preview()}else if(this.hoverType==="dynamic"){const o=this.elements.submenuToggles.some(l=>l.isOpen);if(this.currentChild=s,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),!this.isTopLevel||o){this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild();let l=t.isSubmenuItem?t.elements.toggle:null;if(t.elements.sibling!==null&&(l=t.elements.sibling.elements.toggle),l===null)return;this.enterDelay>0?(clearTimeout(this._hoverTimeout),this._hoverTimeout=setTimeout(()=>{l.preview()},this.enterDelay)):l.preview()}}}}),t.isSubmenuItem&&t.dom.item.addEventListener("pointerleave",n=>{n.pointerType==="pen"||n.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",t.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",t.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",t.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",t.elements.toggle.close(),this.focusCurrentChild()))))})})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",t=>{this.currentEvent="keyboard";const s=S(t);if(this.focusState==="self"){const n=["Space","Enter"],o=["Escape"],l=["Escape"];this.optionalKeySupport?["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(s)&&d(t):(this.currentMenuItem.isSubmenuItem&&n.includes(s)||this.elements.controller&&o.includes(s)||this.elements.parentMenu&&l.includes(s))&&d(t)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",t=>{this.currentEvent="keyboard";const s=S(t);this.focusState==="self"&&(s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(d(t),this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview()):this.currentMenuItem.dom.link.click():s==="Escape"?this.elements.submenuToggles.some(o=>o.isOpen)?(d(t),this.closeChildren()):this.elements.parentMenu?(d(t),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.closeChildren(),this.elements.parentMenu.focusCurrentChild()):this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(this.elements.controller.close(),this.focusController()):this.optionalKeySupport&&(s==="ArrowDown"||s==="ArrowRight"?(d(t),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.childMenu.focusFirstChild()):this.focusNextChild()):s==="ArrowUp"||s==="ArrowLeft"?(d(t),this.focusPreviousChild()):s==="Home"?(d(t),this.focusFirstChild()):s==="End"&&(d(t),this.focusLastChild())))})}}class H extends z{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n=!1,childMenu:o=null,toggle:l=null,initialize:h=!0,submenuSibling:c=null}){super({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n,childMenu:o,toggle:l,initialize:!1,submenuSibling:c}),h&&this.initialize()}}class P extends q{constructor({menuToggleElement:t,parentElement:s,controlledMenu:n,parentMenu:o=null,initialize:l=!0}){super({menuToggleElement:t,parentElement:s,controlledMenu:n,parentMenu:o,initialize:!1});r(this,"_dom",{toggle:null,parent:null,container:null});this._dom.toggle=t,this._dom.parent=s,this._dom.container=n.isTopLevel?n.dom.container:n.dom.menu,l&&this.initialize()}_expand(t=!0){const{openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(a(n,this.dom.container),requestAnimationFrame(()=>{a(s,this.dom.container),requestAnimationFrame(()=>{m(n,this.dom.container)})})):s!==""&&a(s,this.dom.container),t&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(t=!0){const{closeClass:s,openClass:n,transitionClass:o}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),o!==""?(a(o,this.dom.container),requestAnimationFrame(()=>{n!==""&&m(n,this.dom.container),requestAnimationFrame(()=>{s!==""&&a(s,this.dom.container),requestAnimationFrame(()=>{m(o,this.dom.container)})})})):(s!==""&&a(s,this.dom.container),n!==""&&m(n,this.dom.container)),t&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}class L extends k{constructor({menuElement:t,menuItemSelector:s=".nav-item,li",menuLinkSelector:n=".nav-link,.dropdown-item",submenuItemSelector:o=".dropdown",submenuToggleSelector:l=".dropdown-toggle",submenuSelector:h=".dropdown-menu",submenuSubtoggleSelector:c=".dropdown-toggle",controllerElement:u=null,containerElement:y=null,openClass:b="show",closeClass:_="collapse",transitionClass:C="transitioning",isTopLevel:E=!0,parentMenu:T=null,hoverType:v="off",hoverDelay:M=250,enterDelay:I=-1,leaveDelay:A=-1,optionalKeySupport:$=!1,disableBootstrap:O=!0,initialize:R=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:o,submenuToggleSelector:l,submenuSelector:h,submenuSubtoggleSelector:c,controllerElement:u,containerElement:y,openClass:b,closeClass:_,transitionClass:C,isTopLevel:E,parentMenu:T,hoverType:v,hoverDelay:M,enterDelay:I,leaveDelay:A,optionalKeySupport:$,initialize:!1});r(this,"_MenuType",L);r(this,"_MenuItemType",H);r(this,"_MenuToggleType",P);r(this,"_disableBootstrap",!0);r(this,"_pseudoDropdownElement",document.createElement("div"));r(this,"_bootstrapEvents",["show.bs.dropdown","shown.bs.dropdown","hide.bs.dropdown","hidden.bs.dropdown"]);this._disableBootstrap=O,R&&this.initialize()}initialize(){super.initialize(),this.bootstrapDisabled&&this._disableBootstrapDropdownBehaviour()}get bootstrapDisabled(){return this._disableBootstrap}get bootstrapPseudoDropdownElement(){return this._pseudoDropdownElement}get bootstrapEvents(){return this._bootstrapEvents}_validate(){let t=super._validate();const s=p("boolean",{disableBootstrap:this._disableBootstrap});return s.status||(this._errors.push(s.error.message),t=!1),t}_disableBootstrapDropdownBehaviour(){this.elements.submenuToggles.forEach(t=>{this.bootstrapEvents.forEach(s=>{t.dom.toggle.addEventListener(s,n=>{d(n);const o=bootstrap.Dropdown.getInstance(n.target);o&&o._menu!==this.bootstrapPseudoDropdownElement&&(o._menu=this.bootstrapPseudoDropdownElement)},{once:!0})})})}}return L}();
- `)}`);if(this.elements.rootMenu===null&&this._findRootMenu(this),this._setDOMElements(),this.isTopLevel&&this.dom.controller&&this.dom.container){const e=new this._MenuToggleType({menuToggleElement:this.dom.controller,parentElement:this.dom.container,controlledMenu:this});this._elements.controller=e}this._createChildElements()}get dom(){return this._dom}get selectors(){return this._selectors}get elements(){return this._elements}get isTopLevel(){return this._root}get openClass(){return this.isTopLevel?this._openClass:this.elements.rootMenu.openClass}get closeClass(){return this.isTopLevel?this._closeClass:this.elements.rootMenu.closeClass}get transitionClass(){return this.isTopLevel?this._transitionClass:this.elements.rootMenu.transitionClass}get currentChild(){return this._currentChild}get focusState(){return this._focusState}get currentEvent(){return this._currentEvent}get currentMenuItem(){return this.elements.menuItems[this.currentChild]}get hoverType(){return this._root?this._hoverType:this.elements.rootMenu.hoverType}get hoverDelay(){return this._root?this._hoverDelay:this.elements.rootMenu.hoverDelay}get enterDelay(){return this._enterDelay===-1?this.hoverDelay:this._root?this._enterDelay:this.elements.rootMenu.enterDelay}get leaveDelay(){return this._leaveDelay===-1?this.hoverDelay:this._root?this._leaveDelay:this.elements.rootMenu.leaveDelay}get shouldFocus(){let e=!1;return(this.currentEvent==="keyboard"||this.currentEvent==="character")&&(e=!0),this.currentEvent==="mouse"&&this.hoverType==="dynamic"&&(e=!0),e}get errors(){return this._errors}set openClass(e){g({openClass:e}),this._openClass!==e&&(this._openClass=e)}set closeClass(e){g({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}set transitionClass(e){g({transitionClass:e}),this._transitionClass!==e&&(this._transitionClass=e)}set currentChild(e){p("number",{value:e});function t(s){if(["mouse","character"].includes(s.currentEvent)&&s.elements.parentMenu){let o=0,l=!1;for(;!l&&o<s.elements.parentMenu.elements.menuItems.length;){const h=s.elements.parentMenu.elements.menuItems[o];h.isSubmenuItem&&h.elements.toggle.elements.controlledMenu===s&&(l=!0,s.elements.parentMenu.currentEvent=s.currentEvent,s.elements.parentMenu.currentChild=o),o++}}}e<-1?(this._currentChild=-1,t(this)):e>=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}set focusState(e){K({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&(e==="self"||e==="none")&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(e==="self"||e==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(e){V({value:e}),this._currentEvent!==e&&(this._currentEvent=e,this.elements.submenuToggles.length>0&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.currentEvent=e}))}set hoverType(e){F({value:e}),this._hoverType!==e&&(this._hoverType=e)}set hoverDelay(e){p("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}set enterDelay(e){p("number",{value:e}),this._enterDelay!==e&&(this._enterDelay=e)}set leaveDelay(e){p("number",{value:e}),this._leaveDelay!==e&&(this._leaveDelay=e)}_validate(){let e=!0,t;this._dom.container!==null||this._dom.controller!==null?t=f(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):t=f(HTMLElement,{menuElement:this._dom.menu}),t.status||(this._errors.push(t.error.message),e=!1);let s;if(this._selectors.submenuItems!==""?s=w({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=w({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),e=!1),this._openClass!==""){const u=g({openClass:this._openClass});u.status||(this._errors.push(u.error.message),e=!1)}if(this._closeClass!==""){const u=g({closeClass:this._closeClass});u.status||(this._errors.push(u.error.message),e=!1)}if(this._transitionClass!==""){const u=g({transitionClass:this._transitionClass});u.status||(this._errors.push(u.error.message),e=!1)}const n=p("boolean",{isTopLevel:this._root});if(n.status||(this._errors.push(n.error.message),e=!1),this._elements.parentMenu!==null){const u=f(D,{parentMenu:this._elements.parentMenu});u.status||(this._errors.push(u.error.message),e=!1)}const o=F({hoverType:this._hoverType});o.status||(this._errors.push(o.error.message),e=!1);const l=p("number",{hoverDelay:this._hoverDelay});l.status||(this._errors.push(l.error.message),e=!1);const h=p("number",{enterDelay:this._enterDelay});h.status||(this._errors.push(h.error.message),e=!1);const c=p("number",{leaveDelay:this._leaveDelay});return c.status||(this._errors.push(c.error.message),e=!1),e}_setDOMElementType(e,t=this.dom.menu,s=!0){if(typeof this.selectors[e]=="string"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be set through _setDOMElementType.`);t!==this.dom.menu&&f(HTMLElement,{base:t});const o=Array.from(t.querySelectorAll(this.selectors[e])).filter(l=>l.parentElement===t);s?this._dom[e]=o:this._dom[e]=[...this._dom[e],...o]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_resetDOMElementType(e){if(typeof this.dom[e]<"u"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_setDOMElements(){this._setDOMElementType("menuItems"),this.selectors.submenuItems!==""&&(this._setDOMElementType("submenuItems"),this._resetDOMElementType("submenuToggles"),this._resetDOMElementType("submenus"),this.dom.submenuItems.forEach(e=>{this._setDOMElementType("submenuToggles",e,!1),this._setDOMElementType("submenus",e,!1)}))}_findRootMenu(e){if(e.isTopLevel)this._elements.rootMenu=e;else if(e.elements.parentMenu!==null)this._findRootMenu(e.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(e=>{let t;if(this.dom.submenuItems.includes(e)){const s=e.querySelector(this.selectors.submenuToggles),n=e.querySelector(this.selectors.submenus),o=new this._MenuType({menuElement:n,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuToggles,submenuSelector:this.selectors.submenus,openClass:this.openClass,closeClass:this.closeClass,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),l=new this._MenuToggleType({menuToggleElement:s,parentElement:e,controlledMenu:o,parentMenu:this});this._elements.submenuToggles.push(l),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:o,toggle:l})}else{const s=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(t)})}_handleFocus(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=t})})}_handleClick(){function e(t,s,n){d(n),s.toggle(),s.isOpen&&(t.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(s)},{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",n=>{this.currentEvent="mouse",e(this,t.elements.toggle,n)})}),this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("pointerup",t=>{this.currentEvent="mouse",e(this,this.elements.controller,t)})}_handleHover(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("pointerenter",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t),e.isSubmenuItem&&(this.enterDelay>0?this._hoverTimeout=setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay):e.elements.toggle.preview());else if(this.hoverType==="dynamic"){const n=this.elements.submenuToggles.some(o=>o.isOpen);this.currentChild=t,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),e.isSubmenuItem&&(!this.isTopLevel||n)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?this._hoverTimeout=setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay):e.elements.toggle.preview())}}}),e.isSubmenuItem&&e.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))})})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=S(e);(t==="Space"||t==="Enter")&&d(e)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=S(e);(t==="Space"||t==="Enter")&&(d(e),this.elements.controller.toggle(),this.elements.controller.isOpen&&this.focusFirstChild())})}focus(){this.focusState="self",this.shouldFocus&&this.dom.menu.focus()}blur(){this.focusState="none",this.shouldFocus&&this.dom.menu.blur()}focusCurrentChild(){this.focusState="self",this.currentChild!==-1&&this.currentMenuItem.focus()}focusChild(e){this.blurCurrentChild(),this.currentChild=e,this.focusCurrentChild()}focusFirstChild(){this.focusChild(0)}focusLastChild(){this.focusChild(this.elements.menuItems.length-1)}focusNextChild(){this.currentChild<this.elements.menuItems.length-1?this.focusChild(this.currentChild+1):this.focusCurrentChild()}focusPreviousChild(){this.currentChild>0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&this.currentMenuItem.blur()}focusController(){this.dom.controller&&(this.shouldFocus&&this.dom.controller.focus(),this.focusState="none")}focusContainer(){this.dom.container&&(this.shouldFocus&&this.dom.container.focus(),this.focusState="none")}closeChildren(){this.elements.submenuToggles.forEach(e=>e.close())}blurChildren(){this.elements.menuItems.forEach(e=>{e.blur(),e.isSubmenuItem&&e.elements.childMenu.blurChildren()})}}class x extends q{constructor({menuItemElement:t,menuLinkElement:s,parentMenu:n,isSubmenuItem:o=!1,childMenu:l=null,toggle:h=null,initialize:c=!0,submenuSibling:u=null}){super({menuItemElement:t,menuLinkElement:s,parentMenu:n,isSubmenuItem:o,childMenu:l,toggle:h});r(this,"_elements",{parentMenu:null,childMenu:null,toggle:null,sibling:null});this._elements.parentMenu=n,this._elements.childMenu=l,this._elements.toggle=h,this._elements.sibling=u,c&&this.initialize()}}class z extends j{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n=null,initialize:o=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n}),o&&this.initialize()}open(){this.closeSiblings(),super.open()}preview(){this.closeSiblings(),super.preview()}close(){this.isOpen&&this.closeChildren(),super.close()}}class k extends D{constructor({menuElement:t,menuItemSelector:s="li",menuLinkSelector:n="a",submenuItemSelector:o="",submenuToggleSelector:l="button",submenuSelector:h="ul",submenuSubtoggleSelector:c="a",controllerElement:u=null,containerElement:y=null,openClass:b="show",closeClass:_="hide",transitionClass:C="transitioning",isTopLevel:E=!0,parentMenu:T=null,hoverType:v="off",hoverDelay:M=250,enterDelay:I=-1,leaveDelay:A=-1,optionalKeySupport:$=!1,initialize:O=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:o,submenuSelector:h,submenuToggleSelector:l,controllerElement:u,containerElement:y,openClass:b,closeClass:_,transitionClass:C,isTopLevel:E,parentMenu:T,hoverType:v,hoverDelay:M,enterDelay:I,leaveDelay:A});r(this,"_MenuType",k);r(this,"_MenuItemType",x);r(this,"_MenuToggleType",z);r(this,"_currentChild",-1);r(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:"",submenuSubtoggles:""});r(this,"_optionalSupport",!1);this._optionalSupport=$,this._selectors.menuItems=s,this._selectors.submenuItems=o,this._selectors.submenuToggles=l,this._selectors.submenus=h,this._selectors.submenuSubtoggles=c,this._selectors.menuLinks=[...new Set([n,l])].join(","),O&&this.initialize()}initialize(){try{super.initialize(),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(t){console.error(t)}}get optionalKeySupport(){return this.isTopLevel?this._optionalSupport:this.elements.rootMenu.optionalKeySupport}set optionalKeySupport(t){p("boolean",{optionalKeySupport:t}),this._optionalSupport=t}_createChildElements(){this.dom.menuItems.forEach(t=>{let s,n;const o=t.querySelector(this.selectors.menuLinks);if(this.dom.submenuItems.includes(t)){const l=t.querySelector(this.selectors.submenuToggles),h=t.querySelector(this.selectors.submenus),c=new this._MenuType({menuElement:h,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuSubtoggles,submenuSelector:this.selectors.submenus,submenuSubtoggleSelector:this.selectors.submenuSubtoggles,openClass:this.openClass,closeClass:this.closeClass,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),u=new this._MenuToggleType({menuToggleElement:l,parentElement:t,controlledMenu:c,parentMenu:this});this._elements.submenuToggles.push(u),l!==o?(n=new this._MenuItemType({menuItemElement:t,menuLinkElement:l,parentMenu:this,isSubmenuItem:!0,childMenu:c,toggle:u}),s=new this._MenuItemType({menuItemElement:t,menuLinkElement:o,parentMenu:this,submenuSibling:n})):s=new this._MenuItemType({menuItemElement:t,menuLinkElement:o,parentMenu:this,isSubmenuItem:!0,childMenu:c,toggle:u})}else s=new this._MenuItemType({menuItemElement:t,menuLinkElement:o,parentMenu:this});this._elements.menuItems.push(s),typeof n<"u"&&this._elements.menuItems.push(n)})}_validate(){let t=super._validate();const s=w({submenuSubtoggleSelector:this._selectors.submenuSubtoggles});s.status||(this._errors.push(s.error.message),t=!1);const n=p("boolean",{optionalKeySupport:this._optionalSupport});return n.status||(this._errors.push(n.error.message),t=!1),t}_handleClick(){super._handleClick(),document.addEventListener("pointerup",t=>{this.focusState!=="none"&&(this.currentEvent="mouse",!this.dom.menu.contains(t.target)&&!this.dom.menu!==t.target&&(this.closeChildren(),this.blur(),this.elements.controller&&this.elements.controller.close()))})}_handleHover(){this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerenter",n=>{if(!(n.pointerType==="pen"||n.pointerType==="touch")){if(this.hoverType==="on"){this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(s);let o=t.isSubmenuItem?t.elements.toggle:null;if(t.elements.sibling!==null&&(o=t.elements.sibling.elements.toggle),o===null)return;this.enterDelay>0?(clearTimeout(this._hoverTimeout),this._hoverTimeout=setTimeout(()=>{o.preview()},this.enterDelay)):o.preview()}else if(this.hoverType==="dynamic"){const o=this.elements.submenuToggles.some(l=>l.isOpen);if(this.currentChild=s,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),!this.isTopLevel||o){this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild();let l=t.isSubmenuItem?t.elements.toggle:null;if(t.elements.sibling!==null&&(l=t.elements.sibling.elements.toggle),l===null)return;this.enterDelay>0?(clearTimeout(this._hoverTimeout),this._hoverTimeout=setTimeout(()=>{l.preview()},this.enterDelay)):l.preview()}}}}),t.isSubmenuItem&&t.dom.item.addEventListener("pointerleave",n=>{n.pointerType==="pen"||n.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",t.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",t.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",t.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",t.elements.toggle.close(),this.focusCurrentChild()))))})})}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",t=>{this.currentEvent="keyboard";const s=S(t);if(this.focusState==="self"){const n=["Space","Enter"],o=["Escape"],l=["Escape"];this.optionalKeySupport?["ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End"].includes(s)&&d(t):(this.currentMenuItem.isSubmenuItem&&n.includes(s)||this.elements.controller&&o.includes(s)||this.elements.parentMenu&&l.includes(s))&&d(t)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",t=>{this.currentEvent="keyboard";const s=S(t);this.focusState==="self"&&(s==="Space"||s==="Enter"?this.currentMenuItem.isSubmenuItem?(d(t),this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview()):this.currentMenuItem.dom.link.click():s==="Escape"?this.elements.submenuToggles.some(o=>o.isOpen)?(d(t),this.closeChildren()):this.elements.parentMenu?(d(t),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.closeChildren(),this.elements.parentMenu.focusCurrentChild()):this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(this.elements.controller.close(),this.focusController()):this.optionalKeySupport&&(s==="ArrowDown"||s==="ArrowRight"?(d(t),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.currentEvent="keyboard",this.currentMenuItem.elements.childMenu.focusFirstChild()):this.focusNextChild()):s==="ArrowUp"||s==="ArrowLeft"?(d(t),this.focusPreviousChild()):s==="Home"?(d(t),this.focusFirstChild()):s==="End"&&(d(t),this.focusLastChild())))})}}class H extends x{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n=!1,childMenu:o=null,toggle:l=null,initialize:h=!0,submenuSibling:c=null}){super({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n,childMenu:o,toggle:l,initialize:!1,submenuSibling:c}),h&&this.initialize()}}class P extends z{constructor({menuToggleElement:t,parentElement:s,controlledMenu:n,parentMenu:o=null,initialize:l=!0}){super({menuToggleElement:t,parentElement:s,controlledMenu:n,parentMenu:o,initialize:!1});r(this,"_dom",{toggle:null,parent:null,container:null});this._dom.toggle=t,this._dom.parent=s,this._dom.container=n.isTopLevel?n.dom.container:n.dom.menu,l&&this.initialize()}_expand(t=!0){const{openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(a(n,this.dom.container),requestAnimationFrame(()=>{a(s,this.dom.container),requestAnimationFrame(()=>{m(n,this.dom.container)})})):s!==""&&a(s,this.dom.container),t&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(t=!0){const{closeClass:s,openClass:n,transitionClass:o}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),o!==""?(a(o,this.dom.container),requestAnimationFrame(()=>{n!==""&&m(n,this.dom.container),requestAnimationFrame(()=>{s!==""&&a(s,this.dom.container),requestAnimationFrame(()=>{m(o,this.dom.container)})})})):(s!==""&&a(s,this.dom.container),n!==""&&m(n,this.dom.container)),t&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}class L extends k{constructor({menuElement:t,menuItemSelector:s=".nav-item,li",menuLinkSelector:n=".nav-link,.dropdown-item",submenuItemSelector:o=".dropdown",submenuToggleSelector:l=".dropdown-toggle",submenuSelector:h=".dropdown-menu",submenuSubtoggleSelector:c=".dropdown-toggle",controllerElement:u=null,containerElement:y=null,openClass:b="show",closeClass:_="collapse",transitionClass:C="transitioning",isTopLevel:E=!0,parentMenu:T=null,hoverType:v="off",hoverDelay:M=250,enterDelay:I=-1,leaveDelay:A=-1,optionalKeySupport:$=!1,disableBootstrap:O=!0,initialize:R=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:o,submenuToggleSelector:l,submenuSelector:h,submenuSubtoggleSelector:c,controllerElement:u,containerElement:y,openClass:b,closeClass:_,transitionClass:C,isTopLevel:E,parentMenu:T,hoverType:v,hoverDelay:M,enterDelay:I,leaveDelay:A,optionalKeySupport:$,initialize:!1});r(this,"_MenuType",L);r(this,"_MenuItemType",H);r(this,"_MenuToggleType",P);r(this,"_disableBootstrap",!0);r(this,"_pseudoDropdownElement",document.createElement("div"));r(this,"_bootstrapEvents",["show.bs.dropdown","shown.bs.dropdown","hide.bs.dropdown","hidden.bs.dropdown"]);this._disableBootstrap=O,R&&this.initialize()}initialize(){super.initialize(),this.bootstrapDisabled&&this._disableBootstrapDropdownBehaviour()}get bootstrapDisabled(){return this._disableBootstrap}get bootstrapPseudoDropdownElement(){return this._pseudoDropdownElement}get bootstrapEvents(){return this._bootstrapEvents}_validate(){let t=super._validate();const s=p("boolean",{disableBootstrap:this._disableBootstrap});return s.status||(this._errors.push(s.error.message),t=!1),t}_disableBootstrapDropdownBehaviour(){this.elements.submenuToggles.forEach(t=>{this.bootstrapEvents.forEach(s=>{t.dom.toggle.addEventListener(s,n=>{d(n);const o=bootstrap.Dropdown.getInstance(n.target);o&&o._menu!==this.bootstrapPseudoDropdownElement&&(o._menu=this.bootstrapPseudoDropdownElement)},{once:!0})})})}}return L}();

@@ -1,3 +0,3 @@

var Bootstrap5Treeview=function(){"use strict";var H=Object.defineProperty;var P=(c,a,_)=>a in c?H(c,a,{enumerable:!0,configurable:!0,writable:!0,value:_}):c[a]=_;var o=(c,a,_)=>(P(c,typeof a!="symbol"?a+"":a,_),_);function c(i,e){typeof i=="string"?e.classList.add(i):e.classList.add(...i)}function a(i,e){typeof i=="string"?e.classList.remove(i):e.classList.remove(...i)}function _(i,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${t}" given.`)}for(const t in e)if(!(e[t]instanceof i)){const s=typeof e[t];throw new TypeError(`${t} must be an instance of ${i.name}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function b(i,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${t}" given.`)}for(const t in e){const s=typeof e[t];if(s!==i)throw new TypeError(`${t} must be a ${i}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function D(i){try{if(typeof i!="object"){const e=typeof i;throw new TypeError(`Values given to isCSSSelector() must be inside of an object. "${e}" given.`)}for(const e in i)try{if(i[e]===null)throw new Error;document.querySelector(i[e])}catch{throw new TypeError(`${e} must be a valid CSS selector. "${i[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function y(i){try{if(typeof i!="object"||Array.isArray(i)){const e=typeof i;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in i){const t=typeof i[e];if(t!=="string")if(Array.isArray(i[e]))i[e].forEach(s=>{if(typeof s!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${t}" given.`);else{const s={};s[e]=i[e],D(s)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function j(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidState() must be inside of an object. "${t}" given.`)}const e=["none","self","child"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function V(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${t}" given.`)}const e=["none","mouse","keyboard","character"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function x(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${t}" given.`)}const e=["off","on","dynamic"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function q(i,e){if(b("string",{tagName:i}).status&&_(HTMLElement,e).status){const t=i.toLowerCase();let s=!0;for(const n in e)e[n].tagName.toLowerCase()!==t&&(s=!1);return s}else return!1}class O{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n=null}){o(this,"_dom",{toggle:null,parent:null});o(this,"_elements",{controlledMenu:null,parentMenu:null});o(this,"_open",!1);o(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}}));o(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}}));this._dom.toggle=e,this._dom.parent=t,this._elements.controlledMenu=s,this._elements.parentMenu=n}initialize(){var e;if(this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),q("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const t=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,10);let s=((e=this.dom.toggle.innerText)==null?void 0:e.replace(/[^a-zA-Z0-9\s]/g,""))||"",n=t;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),n=`${s}-${n}`),this.dom.toggle.id=this.dom.toggle.id||`${n}-menu-button`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`${n}-menu`}this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){b("boolean",{value:e}),this._open=e}_expand(e=!0){const{closeClass:t,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(c(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&a(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&c(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{a(n,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&c(s,this.elements.controlledMenu.dom.menu),t!==""&&a(t,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),n!==""?(c(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&a(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&c(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{a(n,this.elements.controlledMenu.dom.menu)})})})):(t!==""&&c(t,this.elements.controlledMenu.dom.menu),s!==""&&a(s,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this._expand(),this.isOpen=!0}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._expand(),this.isOpen=!0}close(){this.isOpen&&(this.elements.controlledMenu.blur(),this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._collapse(),this.isOpen=!1)}toggle(){this.isOpen?this.close():this.open()}closeSiblings(){this.elements.parentMenu&&this.elements.parentMenu.elements.submenuToggles.forEach(e=>{e!==this&&e.close()})}closeChildren(){this.elements.controlledMenu.elements.submenuToggles.forEach(e=>e.close())}}class ${constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n=!1,childMenu:r=null,toggle:l=null}){o(this,"_dom",{item:null,link:null});o(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});o(this,"_submenu",!1);this._dom.item=e,this._dom.link=t,this._elements.parentMenu=s,this._elements.childMenu=r,this._elements.toggle=l,this._submenu=n}initialize(){}get dom(){return this._dom}get elements(){return this._elements}get isSubmenuItem(){return this._submenu}focus(){this.elements.parentMenu.shouldFocus&&this.dom.link.focus()}blur(){this.elements.parentMenu.shouldFocus&&this.dom.link.blur()}}function w(i){try{const e=i.key||i.keyCode,t={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Character:isNaN(e)&&!!e.match(/^[a-zA-Z]{1}$/),Tab:e==="Tab"||e===9,Asterisk:e==="*"||e===56};return Object.keys(t).find(s=>t[s]===!0)||""}catch{return""}}function d(i){i.preventDefault(),i.stopPropagation()}class I{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:s="a",submenuItemSelector:n="",submenuToggleSelector:r="a",submenuSelector:l="ul",controllerElement:u=null,containerElement:h=null,openClass:m="show",closeClass:f="hide",transitionClass:p="transitioning",isTopLevel:g=!0,parentMenu:C=null,hoverType:M="off",hoverDelay:E=250,enterDelay:v=-1,leaveDelay:T=-1}){o(this,"_MenuType",I);o(this,"_MenuItemType",$);o(this,"_MenuToggleType",O);o(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});o(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});o(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});o(this,"_openClass","show");o(this,"_closeClass","hide");o(this,"_transitionClass","transitioning");o(this,"_root",!0);o(this,"_currentChild",0);o(this,"_focusState","none");o(this,"_currentEvent","none");o(this,"_hoverType","off");o(this,"_hoverDelay",250);o(this,"_enterDelay",-1);o(this,"_leaveDelay",-1);o(this,"_hoverTimeout",null);o(this,"_errors",[]);this._dom.menu=e,this._dom.controller=u,this._dom.container=h,this._selectors.menuItems=t,this._selectors.menuLinks=s,this._selectors.submenuItems=n,this._selectors.submenuToggles=r,this._selectors.submenus=l,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=C,this._elements.rootMenu=g?this:null,this._openClass=m||"",this._closeClass=f||"",this._transitionClass=p||"",this._root=g,this._hoverType=M,this._hoverDelay=E,this._enterDelay=v,this._leaveDelay=T}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found:
var Bootstrap5Treeview=function(){"use strict";var H=Object.defineProperty;var P=(c,a,_)=>a in c?H(c,a,{enumerable:!0,configurable:!0,writable:!0,value:_}):c[a]=_;var o=(c,a,_)=>(P(c,typeof a!="symbol"?a+"":a,_),_);function c(i,e){typeof i=="string"?e.classList.add(i):e.classList.add(...i)}function a(i,e){typeof i=="string"?e.classList.remove(i):e.classList.remove(...i)}function _(i,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${t}" given.`)}for(const t in e)if(!(e[t]instanceof i)){const s=typeof e[t];throw new TypeError(`${t} must be an instance of ${i.name}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function b(i,e){try{if(typeof e!="object"){const t=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${t}" given.`)}for(const t in e){const s=typeof e[t];if(s!==i)throw new TypeError(`${t} must be a ${i}. "${s}" given.`)}return{status:!0,error:null}}catch(t){return{status:!1,error:t}}}function D(i){try{if(typeof i!="object"){const e=typeof i;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${e}" given.`)}for(const e in i)try{if(i[e]===null)throw new Error;document.querySelector(i[e])}catch{throw new TypeError(`${e} must be a valid query selector. "${i[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function y(i){try{if(typeof i!="object"||Array.isArray(i)){const e=typeof i;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in i){const t=typeof i[e];if(t!=="string")if(Array.isArray(i[e]))i[e].forEach(s=>{if(typeof s!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${t}" given.`);else{const s={};s[e]=i[e],D(s)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function j(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidState() must be inside of an object. "${t}" given.`)}const e=["none","self","child"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function q(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${t}" given.`)}const e=["none","mouse","keyboard","character"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function x(i){try{if(typeof i!="object"){const t=typeof i;throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${t}" given.`)}const e=["off","on","dynamic"];for(const t in i)if(!e.includes(i[t]))throw new TypeError(`${t} must be one of the following values: ${e.join(", ")}. "${i[t]}" given.`);return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function V(i,e){if(b("string",{tagName:i}).status&&_(HTMLElement,e).status){const t=i.toLowerCase();let s=!0;for(const n in e)e[n].tagName.toLowerCase()!==t&&(s=!1);return s}else return!1}class O{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n=null}){o(this,"_dom",{toggle:null,parent:null});o(this,"_elements",{controlledMenu:null,parentMenu:null});o(this,"_open",!1);o(this,"_expandEvent",new CustomEvent("accessibleMenuExpand",{bubbles:!0,detail:{toggle:this}}));o(this,"_collapseEvent",new CustomEvent("accessibleMenuCollapse",{bubbles:!0,detail:{toggle:this}}));this._dom.toggle=e,this._dom.parent=t,this._elements.controlledMenu=s,this._elements.parentMenu=n}initialize(){this._setIds(),this._setAriaAttributes(),this._collapse(!1)}get dom(){return this._dom}get elements(){return this._elements}get isOpen(){return this._open}set isOpen(e){b("boolean",{value:e}),this._open=e}_setIds(){var e;if(this.dom.toggle.id===""||this.elements.controlledMenu.dom.menu.id===""){const t=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,10);let s=((e=this.dom.toggle.innerText)==null?void 0:e.replace(/[^a-zA-Z0-9\s]/g,""))||"",n=t;!s.replace(/\s/g,"").length&&this.dom.toggle.getAttribute("aria-label")&&(s=this.dom.toggle.getAttribute("aria-label").replace(/[^a-zA-Z0-9\s]/g,"")),s.replace(/\s/g,"").length>0&&(s=s.toLowerCase().replace(/\s+/g,"-"),s.startsWith("-")&&(s=s.substring(1)),s.endsWith("-")&&(s=s.slice(0,-1)),n=`${s}-${n}`),this.dom.toggle.id=this.dom.toggle.id||`menu-button-${n}`,this.elements.controlledMenu.dom.menu.id=this.elements.controlledMenu.dom.menu.id||`menu-${n}`}}_setAriaAttributes(){this.dom.toggle.setAttribute("aria-haspopup","true"),this.dom.toggle.setAttribute("aria-expanded","false"),V("button",{toggle:this.dom.toggle})||this.dom.toggle.setAttribute("role","button"),this.elements.controlledMenu.dom.menu.setAttribute("aria-labelledby",this.dom.toggle.id),this.dom.toggle.setAttribute("aria-controls",this.elements.controlledMenu.dom.menu.id)}_expand(e=!0){const{closeClass:t,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(c(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&a(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&c(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{a(n,this.elements.controlledMenu.dom.menu)})})})):(s!==""&&c(s,this.elements.controlledMenu.dom.menu),t!==""&&a(t,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(e=!0){const{closeClass:t,openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),n!==""?(c(n,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{s!==""&&a(s,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{t!==""&&c(t,this.elements.controlledMenu.dom.menu),requestAnimationFrame(()=>{a(n,this.elements.controlledMenu.dom.menu)})})})):(t!==""&&c(t,this.elements.controlledMenu.dom.menu),s!==""&&a(s,this.elements.controlledMenu.dom.menu)),e&&this.dom.toggle.dispatchEvent(this._collapseEvent)}open(){this.elements.controlledMenu.focusState="self",this._expand(),this.isOpen=!0}preview(){this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._expand(),this.isOpen=!0}close(){this.isOpen&&(this.elements.controlledMenu.blur(),this.elements.parentMenu&&(this.elements.parentMenu.focusState="self"),this._collapse(),this.isOpen=!1)}toggle(){this.isOpen?this.close():this.open()}closeSiblings(){this.elements.parentMenu&&this.elements.parentMenu.elements.submenuToggles.forEach(e=>{e!==this&&e.close()})}closeChildren(){this.elements.controlledMenu.elements.submenuToggles.forEach(e=>e.close())}}class ${constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n=!1,childMenu:r=null,toggle:l=null}){o(this,"_dom",{item:null,link:null});o(this,"_elements",{parentMenu:null,childMenu:null,toggle:null});o(this,"_submenu",!1);this._dom.item=e,this._dom.link=t,this._elements.parentMenu=s,this._elements.childMenu=r,this._elements.toggle=l,this._submenu=n}initialize(){}get dom(){return this._dom}get elements(){return this._elements}get isSubmenuItem(){return this._submenu}focus(){this.elements.parentMenu.shouldFocus&&this.dom.link.focus()}blur(){this.elements.parentMenu.shouldFocus&&this.dom.link.blur()}}function w(i){try{const e=i.key||i.keyCode,t={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Character:isNaN(e)&&!!e.match(/^[a-zA-Z]{1}$/),Tab:e==="Tab"||e===9,Asterisk:e==="*"||e===56};return Object.keys(t).find(s=>t[s]===!0)||""}catch{return""}}function d(i){i.preventDefault(),i.stopPropagation()}class I{constructor({menuElement:e,menuItemSelector:t="li",menuLinkSelector:s="a",submenuItemSelector:n="",submenuToggleSelector:r="a",submenuSelector:l="ul",controllerElement:u=null,containerElement:h=null,openClass:m="show",closeClass:f="hide",transitionClass:p="transitioning",isTopLevel:g=!0,parentMenu:C=null,hoverType:M="off",hoverDelay:E=250,enterDelay:v=-1,leaveDelay:T=-1}){o(this,"_MenuType",I);o(this,"_MenuItemType",$);o(this,"_MenuToggleType",O);o(this,"_dom",{menu:null,menuItems:[],submenuItems:[],submenuToggles:[],submenus:[],controller:null,container:null});o(this,"_selectors",{menuItems:"",menuLinks:"",submenuItems:"",submenuToggles:"",submenus:""});o(this,"_elements",{menuItems:[],submenuToggles:[],controller:null,parentMenu:null,rootMenu:null});o(this,"_openClass","show");o(this,"_closeClass","hide");o(this,"_transitionClass","transitioning");o(this,"_root",!0);o(this,"_currentChild",0);o(this,"_focusState","none");o(this,"_currentEvent","none");o(this,"_hoverType","off");o(this,"_hoverDelay",250);o(this,"_enterDelay",-1);o(this,"_leaveDelay",-1);o(this,"_hoverTimeout",null);o(this,"_errors",[]);this._dom.menu=e,this._dom.controller=u,this._dom.container=h,this._selectors.menuItems=t,this._selectors.menuLinks=s,this._selectors.submenuItems=n,this._selectors.submenuToggles=r,this._selectors.submenus=l,this._elements.menuItems=[],this._elements.submenuToggles=[],this._elements.controller=null,this._elements.parentMenu=C,this._elements.rootMenu=g?this:null,this._openClass=m||"",this._closeClass=f||"",this._transitionClass=p||"",this._root=g,this._hoverType=M,this._hoverDelay=E,this._enterDelay=v,this._leaveDelay=T}initialize(){if(!this._validate())throw new Error(`AccesibleMenu: cannot initialize menu. The following errors have been found:
- ${this.errors.join(`
- `)}`);if(this.elements.rootMenu===null&&this._findRootMenu(this),this._setDOMElements(),this.isTopLevel&&this.dom.controller&&this.dom.container){const e=new this._MenuToggleType({menuToggleElement:this.dom.controller,parentElement:this.dom.container,controlledMenu:this});this._elements.controller=e}this._createChildElements()}get dom(){return this._dom}get selectors(){return this._selectors}get elements(){return this._elements}get isTopLevel(){return this._root}get openClass(){return this.isTopLevel?this._openClass:this.elements.rootMenu.openClass}get closeClass(){return this.isTopLevel?this._closeClass:this.elements.rootMenu.closeClass}get transitionClass(){return this.isTopLevel?this._transitionClass:this.elements.rootMenu.transitionClass}get currentChild(){return this._currentChild}get focusState(){return this._focusState}get currentEvent(){return this._currentEvent}get currentMenuItem(){return this.elements.menuItems[this.currentChild]}get hoverType(){return this._root?this._hoverType:this.elements.rootMenu.hoverType}get hoverDelay(){return this._root?this._hoverDelay:this.elements.rootMenu.hoverDelay}get enterDelay(){return this._enterDelay===-1?this.hoverDelay:this._root?this._enterDelay:this.elements.rootMenu.enterDelay}get leaveDelay(){return this._leaveDelay===-1?this.hoverDelay:this._root?this._leaveDelay:this.elements.rootMenu.leaveDelay}get shouldFocus(){let e=!1;return(this.currentEvent==="keyboard"||this.currentEvent==="character")&&(e=!0),this.currentEvent==="mouse"&&this.hoverType==="dynamic"&&(e=!0),e}get errors(){return this._errors}set openClass(e){y({openClass:e}),this._openClass!==e&&(this._openClass=e)}set closeClass(e){y({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}set transitionClass(e){y({transitionClass:e}),this._transitionClass!==e&&(this._transitionClass=e)}set currentChild(e){b("number",{value:e});function t(s){if(["mouse","character"].includes(s.currentEvent)&&s.elements.parentMenu){let r=0,l=!1;for(;!l&&r<s.elements.parentMenu.elements.menuItems.length;){const u=s.elements.parentMenu.elements.menuItems[r];u.isSubmenuItem&&u.elements.toggle.elements.controlledMenu===s&&(l=!0,s.elements.parentMenu.currentEvent=s.currentEvent,s.elements.parentMenu.currentChild=r),r++}}}e<-1?(this._currentChild=-1,t(this)):e>=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}set focusState(e){j({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&(e==="self"||e==="none")&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(e==="self"||e==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(e){V({value:e}),this._currentEvent!==e&&(this._currentEvent=e,this.elements.submenuToggles.length>0&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.currentEvent=e}))}set hoverType(e){x({value:e}),this._hoverType!==e&&(this._hoverType=e)}set hoverDelay(e){b("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}set enterDelay(e){b("number",{value:e}),this._enterDelay!==e&&(this._enterDelay=e)}set leaveDelay(e){b("number",{value:e}),this._leaveDelay!==e&&(this._leaveDelay=e)}_validate(){let e=!0,t;this._dom.container!==null||this._dom.controller!==null?t=_(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):t=_(HTMLElement,{menuElement:this._dom.menu}),t.status||(this._errors.push(t.error.message),e=!1);let s;if(this._selectors.submenuItems!==""?s=D({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=D({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),e=!1),this._openClass!==""){const m=y({openClass:this._openClass});m.status||(this._errors.push(m.error.message),e=!1)}if(this._closeClass!==""){const m=y({closeClass:this._closeClass});m.status||(this._errors.push(m.error.message),e=!1)}if(this._transitionClass!==""){const m=y({transitionClass:this._transitionClass});m.status||(this._errors.push(m.error.message),e=!1)}const n=b("boolean",{isTopLevel:this._root});if(n.status||(this._errors.push(n.error.message),e=!1),this._elements.parentMenu!==null){const m=_(I,{parentMenu:this._elements.parentMenu});m.status||(this._errors.push(m.error.message),e=!1)}const r=x({hoverType:this._hoverType});r.status||(this._errors.push(r.error.message),e=!1);const l=b("number",{hoverDelay:this._hoverDelay});l.status||(this._errors.push(l.error.message),e=!1);const u=b("number",{enterDelay:this._enterDelay});u.status||(this._errors.push(u.error.message),e=!1);const h=b("number",{leaveDelay:this._leaveDelay});return h.status||(this._errors.push(h.error.message),e=!1),e}_setDOMElementType(e,t=this.dom.menu,s=!0){if(typeof this.selectors[e]=="string"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be set through _setDOMElementType.`);t!==this.dom.menu&&_(HTMLElement,{base:t});const r=Array.from(t.querySelectorAll(this.selectors[e])).filter(l=>l.parentElement===t);s?this._dom[e]=r:this._dom[e]=[...this._dom[e],...r]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_resetDOMElementType(e){if(typeof this.dom[e]<"u"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_setDOMElements(){this._setDOMElementType("menuItems"),this.selectors.submenuItems!==""&&(this._setDOMElementType("submenuItems"),this._resetDOMElementType("submenuToggles"),this._resetDOMElementType("submenus"),this.dom.submenuItems.forEach(e=>{this._setDOMElementType("submenuToggles",e,!1),this._setDOMElementType("submenus",e,!1)}))}_findRootMenu(e){if(e.isTopLevel)this._elements.rootMenu=e;else if(e.elements.parentMenu!==null)this._findRootMenu(e.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(e=>{let t;if(this.dom.submenuItems.includes(e)){const s=e.querySelector(this.selectors.submenuToggles),n=e.querySelector(this.selectors.submenus),r=new this._MenuType({menuElement:n,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuToggles,submenuSelector:this.selectors.submenus,openClass:this.openClass,closeClass:this.closeClass,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),l=new this._MenuToggleType({menuToggleElement:s,parentElement:e,controlledMenu:r,parentMenu:this});this._elements.submenuToggles.push(l),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:r,toggle:l})}else{const s=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(t)})}_handleFocus(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=t})})}_handleClick(){function e(t,s,n){d(n),s.toggle(),s.isOpen&&(t.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(s)},{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",n=>{this.currentEvent="mouse",e(this,t.elements.toggle,n)})}),this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("pointerup",t=>{this.currentEvent="mouse",e(this,this.elements.controller,t)})}_handleHover(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("pointerenter",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t),e.isSubmenuItem&&(this.enterDelay>0?this._hoverTimeout=setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay):e.elements.toggle.preview());else if(this.hoverType==="dynamic"){const n=this.elements.submenuToggles.some(r=>r.isOpen);this.currentChild=t,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),e.isSubmenuItem&&(!this.isTopLevel||n)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?this._hoverTimeout=setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay):e.elements.toggle.preview())}}}),e.isSubmenuItem&&e.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))})})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=w(e);(t==="Space"||t==="Enter")&&d(e)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=w(e);(t==="Space"||t==="Enter")&&(d(e),this.elements.controller.toggle(),this.elements.controller.isOpen&&this.focusFirstChild())})}focus(){this.focusState="self",this.shouldFocus&&this.dom.menu.focus()}blur(){this.focusState="none",this.shouldFocus&&this.dom.menu.blur()}focusCurrentChild(){this.focusState="self",this.currentChild!==-1&&this.currentMenuItem.focus()}focusChild(e){this.blurCurrentChild(),this.currentChild=e,this.focusCurrentChild()}focusFirstChild(){this.focusChild(0)}focusLastChild(){this.focusChild(this.elements.menuItems.length-1)}focusNextChild(){this.currentChild<this.elements.menuItems.length-1?this.focusChild(this.currentChild+1):this.focusCurrentChild()}focusPreviousChild(){this.currentChild>0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&this.currentMenuItem.blur()}focusController(){this.dom.controller&&(this.shouldFocus&&this.dom.controller.focus(),this.focusState="none")}focusContainer(){this.dom.container&&(this.shouldFocus&&this.dom.container.focus(),this.focusState="none")}closeChildren(){this.elements.submenuToggles.forEach(e=>e.close())}blurChildren(){this.elements.menuItems.forEach(e=>{e.blur(),e.isSubmenuItem&&e.elements.childMenu.blurChildren()})}}class F extends ${constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n=!1,childMenu:r=null,toggle:l=null,initialize:u=!0}){super({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n,childMenu:r,toggle:l}),u&&this.initialize()}initialize(){super.initialize(),this.dom.item.setAttribute("role","none"),this.dom.link.setAttribute("role","treeitem"),this.dom.link.tabIndex=-1}focus(){super.focus(),this.dom.link.tabIndex=0}blur(){super.blur(),this.dom.link.tabIndex=-1}}class z extends O{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n=null,initialize:r=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n}),r&&this.initialize()}}class S extends I{constructor({menuElement:t,menuItemSelector:s="li",menuLinkSelector:n="a",submenuItemSelector:r="",submenuToggleSelector:l="a",submenuSelector:u="ul",controllerElement:h=null,containerElement:m=null,openClass:f="show",closeClass:p="hide",transitionClass:g="transitioning",isTopLevel:C=!0,parentMenu:M=null,hoverType:E="off",hoverDelay:v=250,enterDelay:T=-1,leaveDelay:L=-1,initialize:A=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:r,submenuToggleSelector:l,submenuSelector:u,controllerElement:h,containerElement:m,openClass:f,closeClass:p,transitionClass:g,isTopLevel:C,parentMenu:M,hoverType:E,hoverDelay:v,enterDelay:T,leaveDelay:L});o(this,"_MenuType",S);o(this,"_MenuItemType",F);o(this,"_MenuToggleType",z);A&&this.initialize()}initialize(){try{super.initialize(),this.isTopLevel?(this.dom.menu.setAttribute("role","tree"),this.elements.menuItems[0].dom.link.tabIndex=0):this.dom.menu.setAttribute("role","group"),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(t){console.error(t)}}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",t=>{this.currentEvent="keyboard";const s=w(t);if(s==="Tab"&&(this.elements.rootMenu.focusState!=="none"?this.elements.rootMenu.blur():this.elements.rootMenu.focus()),this.focusState==="self"){const n=["Space","ArrowUp","ArrowDown","ArrowLeft","Asterisk","Home","End"],r=["Enter","ArrowRight"],l=["Escape"];(n.includes(s)||this.currentMenuItem.isSubmenuItem&&r.includes(s)||this.elements.controller&&l.includes(s))&&d(t)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",t=>{this.currentEvent="keyboard";const s=w(t),{altKey:n,crtlKey:r,metaKey:l}=t;if(s==="Character"&&!(n||r||l))d(t),this.elements.rootMenu.currentEvent="character",this.focusNextNodeWithCharacter(t.key);else if(this.focusState==="self")if(s==="Enter"||s==="Space")d(t),this.currentMenuItem.isSubmenuItem?this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview():this.currentMenuItem.dom.link.click();else if(s==="Escape")this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(this.elements.controller.close(),this.focusController());else if(s==="ArrowDown")d(t),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.currentMenuItem.elements.childMenu.focusFirstChild()):!this.isTopLevel&&this.currentChild===this.elements.menuItems.length-1?this.focusParentsNextChild():this.focusNextChild();else if(s==="ArrowUp"){d(t);const h=this.elements.menuItems[this.currentChild-1];h&&h.isSubmenuItem&&h.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentChild=this.currentChild-1,this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.focusChildsLastNode()):!this.isTopLevel&&this.currentChild===0?(this.blurCurrentChild(),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.focusCurrentChild()):this.focusPreviousChild()}else s==="ArrowRight"?this.currentMenuItem.isSubmenuItem&&(d(t),this.currentMenuItem.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.currentMenuItem.elements.childMenu.focusFirstChild()):this.currentMenuItem.elements.toggle.preview()):s==="ArrowLeft"?(d(t),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.blurCurrentChild(),this.currentMenuItem.elements.toggle.close()):this.isTopLevel||(this.blurCurrentChild(),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.focusCurrentChild())):s==="Home"?(d(t),this.blurCurrentChild(),this.elements.rootMenu.focusFirstChild()):s==="End"?(d(t),this.blurCurrentChild(),this.elements.rootMenu.focusLastNode()):s==="Asterisk"&&(d(t),this.openChildren())})}focusLastNode(){const t=this.elements.menuItems.length-1,s=this.elements.menuItems[t];s.isSubmenuItem&&s.elements.toggle.isOpen?(this.currentChild=t,s.elements.childMenu.currentEvent=this.currentEvent,s.elements.childMenu.focusLastNode()):this.focusLastChild()}openChildren(){this.elements.submenuToggles.forEach(t=>t.preview())}focusNextNodeWithCharacter(t){function s(f){let p=[];return f.elements.menuItems.forEach(g=>{p.push(g),g.isSubmenuItem&&g.elements.toggle.isOpen&&(p=[...p,...s(g.elements.toggle.elements.controlledMenu)])}),p}const n=t.toLowerCase(),r=s(this.elements.rootMenu),l=r.indexOf(this.currentMenuItem)+1,u=[...r.slice(l),...r.slice(0,l)];let h=0,m=!1;for(;!m&&h<u.length;){let f="";if(u[h].dom.item.innerText?f=u[h].dom.item.innerText:f=u[h].dom.item.textContent,f=f.replace(/[\s]/g,"").toLowerCase().charAt(0),f===n){m=!0;const p=u[h].elements.parentMenu,g=p.elements.menuItems.indexOf(u[h]);this.elements.rootMenu.blurChildren(),p.focusChild(g)}h++}}focusParentsNextChild(){this.elements.parentMenu&&(this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.currentChild===this.elements.parentMenu.elements.menuItems.length-1?(this.elements.parentMenu.blurCurrentChild(),this.elements.parentMenu.focusParentsNextChild()):(this.blurChildren(),this.elements.parentMenu.focusNextChild()))}focusChildsLastNode(){this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.currentMenuItem.elements.childMenu.focusLastChild(),this.currentMenuItem.elements.childMenu.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.childMenu.currentMenuItem.elements.toggle.isOpen&&(this.currentMenuItem.elements.childMenu.blurCurrentChild(),this.currentMenuItem.elements.childMenu.focusChildsLastNode())}}class N extends F{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n=!1,childMenu:r=null,toggle:l=null,initialize:u=!0}){super({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n,childMenu:r,toggle:l,initialize:!1}),u&&this.initialize()}}class B extends z{constructor({menuToggleElement:t,parentElement:s,controlledMenu:n,parentMenu:r=null,initialize:l=!0}){super({menuToggleElement:t,parentElement:s,controlledMenu:n,parentMenu:r,initialize:!1});o(this,"_dom",{toggle:null,parent:null,container:null});this._dom.toggle=t,this._dom.parent=s,this._dom.container=n.isTopLevel?n.dom.container:n.dom.menu,l&&this.initialize()}_expand(t=!0){const{openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(c(n,this.dom.container),requestAnimationFrame(()=>{c(s,this.dom.container),requestAnimationFrame(()=>{a(n,this.dom.container)})})):s!==""&&c(s,this.dom.container),t&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(t=!0){const{closeClass:s,openClass:n,transitionClass:r}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),r!==""?(c(r,this.dom.container),requestAnimationFrame(()=>{n!==""&&a(n,this.dom.container),requestAnimationFrame(()=>{s!==""&&c(s,this.dom.container),requestAnimationFrame(()=>{a(r,this.dom.container)})})})):(s!==""&&c(s,this.dom.container),n!==""&&a(n,this.dom.container)),t&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}class k extends S{constructor({menuElement:t,menuItemSelector:s=".nav-item,li",menuLinkSelector:n=".nav-link,.dropdown-item",submenuItemSelector:r=".dropdown",submenuToggleSelector:l=".dropdown-toggle",submenuSelector:u=".dropdown-menu",controllerElement:h=null,containerElement:m=null,openClass:f="show",closeClass:p="collapse",transitionClass:g="transitioning",isTopLevel:C=!0,parentMenu:M=null,hoverType:E="off",hoverDelay:v=250,enterDelay:T=-1,leaveDelay:L=-1,disableBootstrap:A=!0,initialize:K=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:r,submenuToggleSelector:l,submenuSelector:u,controllerElement:h,containerElement:m,openClass:f,closeClass:p,transitionClass:g,isTopLevel:C,parentMenu:M,hoverType:E,hoverDelay:v,enterDelay:T,leaveDelay:L,initialize:!1});o(this,"_MenuType",k);o(this,"_MenuItemType",N);o(this,"_MenuToggleType",B);o(this,"_disableBootstrap",!0);o(this,"_pseudoDropdownElement",document.createElement("div"));o(this,"_bootstrapEvents",["show.bs.dropdown","shown.bs.dropdown","hide.bs.dropdown","hidden.bs.dropdown"]);this._disableBootstrap=A,K&&this.initialize()}initialize(){super.initialize(),this.bootstrapDisabled&&this._disableBootstrapDropdownBehaviour()}get bootstrapDisabled(){return this._disableBootstrap}get bootstrapPseudoDropdownElement(){return this._pseudoDropdownElement}get bootstrapEvents(){return this._bootstrapEvents}_validate(){let t=super._validate();const s=b("boolean",{disableBootstrap:this._disableBootstrap});return s.status||(this._errors.push(s.error.message),t=!1),t}_disableBootstrapDropdownBehaviour(){this.elements.submenuToggles.forEach(t=>{this.bootstrapEvents.forEach(s=>{t.dom.toggle.addEventListener(s,n=>{d(n);const r=bootstrap.Dropdown.getInstance(n.target);r&&r._menu!==this.bootstrapPseudoDropdownElement&&(r._menu=this.bootstrapPseudoDropdownElement)},{once:!0})})})}}return k}();
- `)}`);if(this.elements.rootMenu===null&&this._findRootMenu(this),this._setDOMElements(),this.isTopLevel&&this.dom.controller&&this.dom.container){const e=new this._MenuToggleType({menuToggleElement:this.dom.controller,parentElement:this.dom.container,controlledMenu:this});this._elements.controller=e}this._createChildElements()}get dom(){return this._dom}get selectors(){return this._selectors}get elements(){return this._elements}get isTopLevel(){return this._root}get openClass(){return this.isTopLevel?this._openClass:this.elements.rootMenu.openClass}get closeClass(){return this.isTopLevel?this._closeClass:this.elements.rootMenu.closeClass}get transitionClass(){return this.isTopLevel?this._transitionClass:this.elements.rootMenu.transitionClass}get currentChild(){return this._currentChild}get focusState(){return this._focusState}get currentEvent(){return this._currentEvent}get currentMenuItem(){return this.elements.menuItems[this.currentChild]}get hoverType(){return this._root?this._hoverType:this.elements.rootMenu.hoverType}get hoverDelay(){return this._root?this._hoverDelay:this.elements.rootMenu.hoverDelay}get enterDelay(){return this._enterDelay===-1?this.hoverDelay:this._root?this._enterDelay:this.elements.rootMenu.enterDelay}get leaveDelay(){return this._leaveDelay===-1?this.hoverDelay:this._root?this._leaveDelay:this.elements.rootMenu.leaveDelay}get shouldFocus(){let e=!1;return(this.currentEvent==="keyboard"||this.currentEvent==="character")&&(e=!0),this.currentEvent==="mouse"&&this.hoverType==="dynamic"&&(e=!0),e}get errors(){return this._errors}set openClass(e){y({openClass:e}),this._openClass!==e&&(this._openClass=e)}set closeClass(e){y({closeClass:e}),this._closeClass!==e&&(this._closeClass=e)}set transitionClass(e){y({transitionClass:e}),this._transitionClass!==e&&(this._transitionClass=e)}set currentChild(e){b("number",{value:e});function t(s){if(["mouse","character"].includes(s.currentEvent)&&s.elements.parentMenu){let r=0,l=!1;for(;!l&&r<s.elements.parentMenu.elements.menuItems.length;){const u=s.elements.parentMenu.elements.menuItems[r];u.isSubmenuItem&&u.elements.toggle.elements.controlledMenu===s&&(l=!0,s.elements.parentMenu.currentEvent=s.currentEvent,s.elements.parentMenu.currentChild=r),r++}}}e<-1?(this._currentChild=-1,t(this)):e>=this.elements.menuItems.length?(this._currentChild=this.elements.menuItems.length-1,t(this)):this.focusChild!==e&&(this._currentChild=e,t(this))}set focusState(e){j({value:e}),this._focusState!==e&&(this._focusState=e),this.elements.submenuToggles.length>0&&(e==="self"||e==="none")&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.focusState="none"}),this.elements.parentMenu&&(e==="self"||e==="child")&&(this.elements.parentMenu.focusState="child")}set currentEvent(e){q({value:e}),this._currentEvent!==e&&(this._currentEvent=e,this.elements.submenuToggles.length>0&&this.elements.submenuToggles.forEach(t=>{t.elements.controlledMenu.currentEvent=e}))}set hoverType(e){x({value:e}),this._hoverType!==e&&(this._hoverType=e)}set hoverDelay(e){b("number",{value:e}),this._hoverDelay!==e&&(this._hoverDelay=e)}set enterDelay(e){b("number",{value:e}),this._enterDelay!==e&&(this._enterDelay=e)}set leaveDelay(e){b("number",{value:e}),this._leaveDelay!==e&&(this._leaveDelay=e)}_validate(){let e=!0,t;this._dom.container!==null||this._dom.controller!==null?t=_(HTMLElement,{menuElement:this._dom.menu,controllerElement:this._dom.controller,containerElement:this._dom.container}):t=_(HTMLElement,{menuElement:this._dom.menu}),t.status||(this._errors.push(t.error.message),e=!1);let s;if(this._selectors.submenuItems!==""?s=D({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks,submenuItemSelector:this._selectors.submenuItems,submenuToggleSelector:this._selectors.submenuToggles,submenuSelector:this._selectors.submenus}):s=D({menuItemSelector:this._selectors.menuItems,menuLinkSelector:this._selectors.menuLinks}),s.status||(this._errors.push(s.error.message),e=!1),this._openClass!==""){const m=y({openClass:this._openClass});m.status||(this._errors.push(m.error.message),e=!1)}if(this._closeClass!==""){const m=y({closeClass:this._closeClass});m.status||(this._errors.push(m.error.message),e=!1)}if(this._transitionClass!==""){const m=y({transitionClass:this._transitionClass});m.status||(this._errors.push(m.error.message),e=!1)}const n=b("boolean",{isTopLevel:this._root});if(n.status||(this._errors.push(n.error.message),e=!1),this._elements.parentMenu!==null){const m=_(I,{parentMenu:this._elements.parentMenu});m.status||(this._errors.push(m.error.message),e=!1)}const r=x({hoverType:this._hoverType});r.status||(this._errors.push(r.error.message),e=!1);const l=b("number",{hoverDelay:this._hoverDelay});l.status||(this._errors.push(l.error.message),e=!1);const u=b("number",{enterDelay:this._enterDelay});u.status||(this._errors.push(u.error.message),e=!1);const h=b("number",{leaveDelay:this._leaveDelay});return h.status||(this._errors.push(h.error.message),e=!1),e}_setDOMElementType(e,t=this.dom.menu,s=!0){if(typeof this.selectors[e]=="string"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be set through _setDOMElementType.`);t!==this.dom.menu&&_(HTMLElement,{base:t});const r=Array.from(t.querySelectorAll(this.selectors[e])).filter(l=>l.parentElement===t);s?this._dom[e]=r:this._dom[e]=[...this._dom[e],...r]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_resetDOMElementType(e){if(typeof this.dom[e]<"u"){if(!Array.isArray(this.dom[e]))throw new Error(`AccessibleMenu: The "${e}" element cannot be reset through _resetDOMElementType.`);this._dom[e]=[]}else throw new Error(`AccessibleMenu: "${e}" is not a valid element type within the menu.`)}_setDOMElements(){this._setDOMElementType("menuItems"),this.selectors.submenuItems!==""&&(this._setDOMElementType("submenuItems"),this._resetDOMElementType("submenuToggles"),this._resetDOMElementType("submenus"),this.dom.submenuItems.forEach(e=>{this._setDOMElementType("submenuToggles",e,!1),this._setDOMElementType("submenus",e,!1)}))}_findRootMenu(e){if(e.isTopLevel)this._elements.rootMenu=e;else if(e.elements.parentMenu!==null)this._findRootMenu(e.elements.parentMenu);else throw new Error("Cannot find root menu.")}_createChildElements(){this.dom.menuItems.forEach(e=>{let t;if(this.dom.submenuItems.includes(e)){const s=e.querySelector(this.selectors.submenuToggles),n=e.querySelector(this.selectors.submenus),r=new this._MenuType({menuElement:n,menuItemSelector:this.selectors.menuItems,menuLinkSelector:this.selectors.menuLinks,submenuItemSelector:this.selectors.submenuItems,submenuToggleSelector:this.selectors.submenuToggles,submenuSelector:this.selectors.submenus,openClass:this.openClass,closeClass:this.closeClass,transitionClass:this.transitionClass,isTopLevel:!1,parentMenu:this,hoverType:this.hoverType,hoverDelay:this.hoverDelay,enterDelay:this.enterDelay,leaveDelay:this.leaveDelay}),l=new this._MenuToggleType({menuToggleElement:s,parentElement:e,controlledMenu:r,parentMenu:this});this._elements.submenuToggles.push(l),t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this,isSubmenuItem:!0,childMenu:r,toggle:l})}else{const s=e.querySelector(this.selectors.menuLinks);t=new this._MenuItemType({menuItemElement:e,menuLinkElement:s,parentMenu:this})}this._elements.menuItems.push(t)})}_handleFocus(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("focus",()=>{this.focusState="self",this.currentChild=t})})}_handleClick(){function e(t,s,n){d(n),s.toggle(),s.isOpen&&(t.focusState="self",s.elements.controlledMenu.focusState="none")}this.elements.menuItems.forEach((t,s)=>{t.dom.link.addEventListener("pointerdown",()=>{this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(s)},{passive:!0}),t.isSubmenuItem&&t.elements.toggle.dom.toggle.addEventListener("pointerup",n=>{this.currentEvent="mouse",e(this,t.elements.toggle,n)})}),this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("pointerup",t=>{this.currentEvent="mouse",e(this,this.elements.controller,t)})}_handleHover(){this.elements.menuItems.forEach((e,t)=>{e.dom.link.addEventListener("pointerenter",s=>{if(!(s.pointerType==="pen"||s.pointerType==="touch")){if(this.hoverType==="on")this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusChild(t),e.isSubmenuItem&&(this.enterDelay>0?this._hoverTimeout=setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay):e.elements.toggle.preview());else if(this.hoverType==="dynamic"){const n=this.elements.submenuToggles.some(r=>r.isOpen);this.currentChild=t,(!this.isTopLevel||this.focusState!=="none")&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild()),e.isSubmenuItem&&(!this.isTopLevel||n)&&(this.currentEvent="mouse",this.elements.rootMenu.blurChildren(),this.focusCurrentChild(),this.enterDelay>0?this._hoverTimeout=setTimeout(()=>{e.elements.toggle.preview()},this.enterDelay):e.elements.toggle.preview())}}}),e.isSubmenuItem&&e.dom.item.addEventListener("pointerleave",s=>{s.pointerType==="pen"||s.pointerType==="touch"||(this.hoverType==="on"?this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close()):this.hoverType==="dynamic"&&(this.isTopLevel||(this.leaveDelay>0?(clearTimeout(this._hoverTimeout),setTimeout(()=>{this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()},this.leaveDelay)):(this.currentEvent="mouse",e.elements.toggle.close(),this.focusCurrentChild()))))})})}_handleKeydown(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keydown",e=>{this.currentEvent="keyboard";const t=w(e);(t==="Space"||t==="Enter")&&d(e)})}_handleKeyup(){this.isTopLevel&&this.elements.controller&&this.elements.controller.dom.toggle.addEventListener("keyup",e=>{this.currentEvent="keyboard";const t=w(e);(t==="Space"||t==="Enter")&&(d(e),this.elements.controller.toggle(),this.elements.controller.isOpen&&this.focusFirstChild())})}focus(){this.focusState="self",this.shouldFocus&&this.dom.menu.focus()}blur(){this.focusState="none",this.shouldFocus&&this.dom.menu.blur()}focusCurrentChild(){this.focusState="self",this.currentChild!==-1&&this.currentMenuItem.focus()}focusChild(e){this.blurCurrentChild(),this.currentChild=e,this.focusCurrentChild()}focusFirstChild(){this.focusChild(0)}focusLastChild(){this.focusChild(this.elements.menuItems.length-1)}focusNextChild(){this.currentChild<this.elements.menuItems.length-1?this.focusChild(this.currentChild+1):this.focusCurrentChild()}focusPreviousChild(){this.currentChild>0?this.focusChild(this.currentChild-1):this.focusCurrentChild()}blurCurrentChild(){this.focusState="none",this.currentChild!==-1&&this.currentMenuItem.blur()}focusController(){this.dom.controller&&(this.shouldFocus&&this.dom.controller.focus(),this.focusState="none")}focusContainer(){this.dom.container&&(this.shouldFocus&&this.dom.container.focus(),this.focusState="none")}closeChildren(){this.elements.submenuToggles.forEach(e=>e.close())}blurChildren(){this.elements.menuItems.forEach(e=>{e.blur(),e.isSubmenuItem&&e.elements.childMenu.blurChildren()})}}class F extends ${constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n=!1,childMenu:r=null,toggle:l=null,initialize:u=!0}){super({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n,childMenu:r,toggle:l}),u&&this.initialize()}initialize(){super.initialize(),this.dom.item.setAttribute("role","none"),this.dom.link.setAttribute("role","treeitem"),this.dom.link.tabIndex=-1}focus(){super.focus(),this.dom.link.tabIndex=0}blur(){super.blur(),this.dom.link.tabIndex=-1}}class z extends O{constructor({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n=null,initialize:r=!0}){super({menuToggleElement:e,parentElement:t,controlledMenu:s,parentMenu:n}),r&&this.initialize()}}class k extends I{constructor({menuElement:t,menuItemSelector:s="li",menuLinkSelector:n="a",submenuItemSelector:r="",submenuToggleSelector:l="a",submenuSelector:u="ul",controllerElement:h=null,containerElement:m=null,openClass:f="show",closeClass:p="hide",transitionClass:g="transitioning",isTopLevel:C=!0,parentMenu:M=null,hoverType:E="off",hoverDelay:v=250,enterDelay:T=-1,leaveDelay:L=-1,initialize:A=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:r,submenuToggleSelector:l,submenuSelector:u,controllerElement:h,containerElement:m,openClass:f,closeClass:p,transitionClass:g,isTopLevel:C,parentMenu:M,hoverType:E,hoverDelay:v,enterDelay:T,leaveDelay:L});o(this,"_MenuType",k);o(this,"_MenuItemType",F);o(this,"_MenuToggleType",z);A&&this.initialize()}initialize(){try{super.initialize(),this.isTopLevel?(this.dom.menu.setAttribute("role","tree"),this.elements.menuItems[0].dom.link.tabIndex=0):this.dom.menu.setAttribute("role","group"),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup()}catch(t){console.error(t)}}_handleKeydown(){super._handleKeydown(),this.dom.menu.addEventListener("keydown",t=>{this.currentEvent="keyboard";const s=w(t);if(s==="Tab"&&(this.elements.rootMenu.focusState!=="none"?this.elements.rootMenu.blur():this.elements.rootMenu.focus()),this.focusState==="self"){const n=["Space","ArrowUp","ArrowDown","ArrowLeft","Asterisk","Home","End"],r=["Enter","ArrowRight"],l=["Escape"];(n.includes(s)||this.currentMenuItem.isSubmenuItem&&r.includes(s)||this.elements.controller&&l.includes(s))&&d(t)}})}_handleKeyup(){super._handleKeyup(),this.dom.menu.addEventListener("keyup",t=>{this.currentEvent="keyboard";const s=w(t),{altKey:n,crtlKey:r,metaKey:l}=t;if(s==="Character"&&!(n||r||l))d(t),this.elements.rootMenu.currentEvent="character",this.focusNextNodeWithCharacter(t.key);else if(this.focusState==="self")if(s==="Enter"||s==="Space")d(t),this.currentMenuItem.isSubmenuItem?this.currentMenuItem.elements.toggle.isOpen?this.currentMenuItem.elements.toggle.close():this.currentMenuItem.elements.toggle.preview():this.currentMenuItem.dom.link.click();else if(s==="Escape")this.isTopLevel&&this.elements.controller&&this.elements.controller.isOpen&&(this.elements.controller.close(),this.focusController());else if(s==="ArrowDown")d(t),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.currentMenuItem.elements.childMenu.focusFirstChild()):!this.isTopLevel&&this.currentChild===this.elements.menuItems.length-1?this.focusParentsNextChild():this.focusNextChild();else if(s==="ArrowUp"){d(t);const h=this.elements.menuItems[this.currentChild-1];h&&h.isSubmenuItem&&h.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentChild=this.currentChild-1,this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.focusChildsLastNode()):!this.isTopLevel&&this.currentChild===0?(this.blurCurrentChild(),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.focusCurrentChild()):this.focusPreviousChild()}else s==="ArrowRight"?this.currentMenuItem.isSubmenuItem&&(d(t),this.currentMenuItem.elements.toggle.isOpen?(this.blurCurrentChild(),this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.currentMenuItem.elements.childMenu.focusFirstChild()):this.currentMenuItem.elements.toggle.preview()):s==="ArrowLeft"?(d(t),this.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.toggle.isOpen?(this.currentMenuItem.elements.childMenu.blurCurrentChild(),this.currentMenuItem.elements.toggle.close()):this.isTopLevel||(this.blurCurrentChild(),this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.focusCurrentChild())):s==="Home"?(d(t),this.blurCurrentChild(),this.elements.rootMenu.focusFirstChild()):s==="End"?(d(t),this.blurCurrentChild(),this.elements.rootMenu.focusLastNode()):s==="Asterisk"&&(d(t),this.openChildren())})}focusLastNode(){const t=this.elements.menuItems.length-1,s=this.elements.menuItems[t];s.isSubmenuItem&&s.elements.toggle.isOpen?(this.currentChild=t,s.elements.childMenu.currentEvent=this.currentEvent,s.elements.childMenu.focusLastNode()):this.focusLastChild()}openChildren(){this.elements.submenuToggles.forEach(t=>t.preview())}focusNextNodeWithCharacter(t){function s(f){let p=[];return f.elements.menuItems.forEach(g=>{p.push(g),g.isSubmenuItem&&g.elements.toggle.isOpen&&(p=[...p,...s(g.elements.toggle.elements.controlledMenu)])}),p}const n=t.toLowerCase(),r=s(this.elements.rootMenu),l=r.indexOf(this.currentMenuItem)+1,u=[...r.slice(l),...r.slice(0,l)];let h=0,m=!1;for(;!m&&h<u.length;){let f="";if(u[h].dom.item.innerText?f=u[h].dom.item.innerText:f=u[h].dom.item.textContent,f=f.replace(/[\s]/g,"").toLowerCase().charAt(0),f===n){m=!0;const p=u[h].elements.parentMenu,g=p.elements.menuItems.indexOf(u[h]);this.elements.rootMenu.blurChildren(),p.focusChild(g)}h++}}focusParentsNextChild(){this.elements.parentMenu&&(this.elements.parentMenu.currentEvent=this.currentEvent,this.elements.parentMenu.currentChild===this.elements.parentMenu.elements.menuItems.length-1?(this.elements.parentMenu.blurCurrentChild(),this.elements.parentMenu.focusParentsNextChild()):(this.blurChildren(),this.elements.parentMenu.focusNextChild()))}focusChildsLastNode(){this.currentMenuItem.elements.childMenu.currentEvent=this.currentEvent,this.currentMenuItem.elements.childMenu.focusLastChild(),this.currentMenuItem.elements.childMenu.currentMenuItem.isSubmenuItem&&this.currentMenuItem.elements.childMenu.currentMenuItem.elements.toggle.isOpen&&(this.currentMenuItem.elements.childMenu.blurCurrentChild(),this.currentMenuItem.elements.childMenu.focusChildsLastNode())}}class N extends F{constructor({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n=!1,childMenu:r=null,toggle:l=null,initialize:u=!0}){super({menuItemElement:e,menuLinkElement:t,parentMenu:s,isSubmenuItem:n,childMenu:r,toggle:l,initialize:!1}),u&&this.initialize()}}class B extends z{constructor({menuToggleElement:t,parentElement:s,controlledMenu:n,parentMenu:r=null,initialize:l=!0}){super({menuToggleElement:t,parentElement:s,controlledMenu:n,parentMenu:r,initialize:!1});o(this,"_dom",{toggle:null,parent:null,container:null});this._dom.toggle=t,this._dom.parent=s,this._dom.container=n.isTopLevel?n.dom.container:n.dom.menu,l&&this.initialize()}_expand(t=!0){const{openClass:s,transitionClass:n}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","true"),n!==""?(c(n,this.dom.container),requestAnimationFrame(()=>{c(s,this.dom.container),requestAnimationFrame(()=>{a(n,this.dom.container)})})):s!==""&&c(s,this.dom.container),t&&this.dom.toggle.dispatchEvent(this._expandEvent)}_collapse(t=!0){const{closeClass:s,openClass:n,transitionClass:r}=this.elements.controlledMenu;this.dom.toggle.setAttribute("aria-expanded","false"),r!==""?(c(r,this.dom.container),requestAnimationFrame(()=>{n!==""&&a(n,this.dom.container),requestAnimationFrame(()=>{s!==""&&c(s,this.dom.container),requestAnimationFrame(()=>{a(r,this.dom.container)})})})):(s!==""&&c(s,this.dom.container),n!==""&&a(n,this.dom.container)),t&&this.dom.toggle.dispatchEvent(this._collapseEvent)}}class S extends k{constructor({menuElement:t,menuItemSelector:s=".nav-item,li",menuLinkSelector:n=".nav-link,.dropdown-item",submenuItemSelector:r=".dropdown",submenuToggleSelector:l=".dropdown-toggle",submenuSelector:u=".dropdown-menu",controllerElement:h=null,containerElement:m=null,openClass:f="show",closeClass:p="collapse",transitionClass:g="transitioning",isTopLevel:C=!0,parentMenu:M=null,hoverType:E="off",hoverDelay:v=250,enterDelay:T=-1,leaveDelay:L=-1,disableBootstrap:A=!0,initialize:K=!0}){super({menuElement:t,menuItemSelector:s,menuLinkSelector:n,submenuItemSelector:r,submenuToggleSelector:l,submenuSelector:u,controllerElement:h,containerElement:m,openClass:f,closeClass:p,transitionClass:g,isTopLevel:C,parentMenu:M,hoverType:E,hoverDelay:v,enterDelay:T,leaveDelay:L,initialize:!1});o(this,"_MenuType",S);o(this,"_MenuItemType",N);o(this,"_MenuToggleType",B);o(this,"_disableBootstrap",!0);o(this,"_pseudoDropdownElement",document.createElement("div"));o(this,"_bootstrapEvents",["show.bs.dropdown","shown.bs.dropdown","hide.bs.dropdown","hidden.bs.dropdown"]);this._disableBootstrap=A,K&&this.initialize()}initialize(){super.initialize(),this.bootstrapDisabled&&this._disableBootstrapDropdownBehaviour()}get bootstrapDisabled(){return this._disableBootstrap}get bootstrapPseudoDropdownElement(){return this._pseudoDropdownElement}get bootstrapEvents(){return this._bootstrapEvents}_validate(){let t=super._validate();const s=b("boolean",{disableBootstrap:this._disableBootstrap});return s.status||(this._errors.push(s.error.message),t=!1),t}_disableBootstrapDropdownBehaviour(){this.elements.submenuToggles.forEach(t=>{this.bootstrapEvents.forEach(s=>{t.dom.toggle.addEventListener(s,n=>{d(n);const r=bootstrap.Dropdown.getInstance(n.target);r&&r._menu!==this.bootstrapPseudoDropdownElement&&(r._menu=this.bootstrapPseudoDropdownElement)},{once:!0})})})}}return S}();
{
"name": "accessible-menu-bootstrap-5",
"version": "2.0.0-beta.3",
"version": "2.0.0",
"description": "A JavaScript library to help you generate WAI-ARIA accessible menus with in the DOM using Bootstrap 5.",
"main": "index.js",
"type": "module",
"sponsor": {
"url": "https://github.com/nickdjm/accessible-menu?sponsor=1"
},
"jsdelivr": "dist/accessible-menu-bs5.iife.js",
"unpkg": "dist/accessible-menu-bs5.iife.js",
"browser": "dist/accessible-menu-bs5.iife.js",
"main": "dist/accessible-menu-bs5.cjs.js",
"module": "dist/accessible-menu-bs5.es.js",
"files": [

@@ -11,2 +19,60 @@ "index.js",

],
"exports": {
".": {
"import": "./dist/accessible-menu-bs5.es.js",
"require": "./dist/accessible-menu-bs5.cjs.js"
},
"./disclosure-menu": {
"import": "./dist/disclosure-menu-bs5.es.js",
"require": "./dist/disclosure-menu-bs5.cjs.js"
},
"./menubar": {
"import": "./dist/menubar-bs5.es.js",
"require": "./dist/menubar-bs5.cjs.js"
},
"./top-link-disclosure-menu": {
"import": "./dist/top-link-disclosure-menu-bs5.es.js",
"require": "./dist/top-link-disclosure-menu-bs5.cjs.js"
},
"./treeview": {
"import": "./dist/treeview-bs5.es.js",
"require": "./dist/treeview-bs5.cjs.js"
},
"./src/bootstrap5DisclosureMenu.js": {
"import": "./src/bootstrap5DisclosureMenu.js"
},
"./src/bootstrap5DisclosureMenuItem.js": {
"import": "./src/bootstrap5DisclosureMenuItem.js"
},
"./src/bootstrap5DisclosureMenuToggle.js": {
"import": "./src/bootstrap5DisclosureMenuToggle.js"
},
"./src/bootstrap5Menubar.js": {
"import": "./src/bootstrap5Menubar.js"
},
"./src/bootstrap5MenubarItem.js": {
"import": "./src/bootstrap5MenubarItem.js"
},
"./src/bootstrap5MenubarToggle.js": {
"import": "./src/bootstrap5MenubarToggle.js"
},
"./src/bootstrap5TopLinkDisclosureMenu.js": {
"import": "./src/bootstrap5TopLinkDisclosureMenu.js"
},
"./src/bootstrap5TopLinkDisclosureMenuItem.js": {
"import": "./src/bootstrap5TopLinkDisclosureMenuItem.js"
},
"./src/bootstrap5TopLinkDisclosureMenuToggle.js": {
"import": "./src/bootstrap5TopLinkDisclosureMenuToggle.js"
},
"./src/bootstrap5Treeview.js": {
"import": "./src/bootstrap5Treeview.js"
},
"./src/bootstrap5TreeviewItem.js": {
"import": "./src/bootstrap5TreeviewItem.js"
},
"./src/bootstrap5TreeviewToggle.js": {
"import": "./src/bootstrap5TreeviewToggle.js"
}
},
"scripts": {

@@ -16,9 +82,7 @@ "prepare": "husky install",

"lint": "npm run eslint -- --fix && npm run prettier -- --write",
"eslint": "eslint --ext .js .",
"prettier": "prettier '**/*.js' --ignore-path .eslintignore",
"eslint": "eslint .",
"prettier": "prettier **/*.{js,cjs}",
"prerelease": "npm run lint && npm run build && npm run test:run",
"release": "git add dist/. && standard-version -a",
"prebuild": "npm run build:docs",
"build": "npm run build:default; npm run build:disclosure-menu; npm run build:menubar; npm run build:top-link-disclosure-menu; npm run build:treeview",
"build:docs": "jsdoc -c jsdoc.config.js",
"build:default": "BUILD_TYPE=default vite build",

@@ -58,29 +122,31 @@ "build:disclosure-menu": "BUILD_TYPE=DisclosureMenu vite build",

"dependencies": {
"accessible-menu": "^4.0.0-beta.4"
"accessible-menu": "^4.0.1"
},
"devDependencies": {
"@babel/core": "^7.12.3",
"@babel/eslint-parser": "^7.14.7",
"@babel/preset-env": "^7.12.1",
"@commitlint/cli": "^17.0.0",
"@commitlint/config-conventional": "^17.0.0",
"@vitest/ui": "^0.32.2",
"commitizen": "^4.2.2",
"@babel/core": "^7.22.5",
"@babel/eslint-parser": "^7.22.5",
"@babel/preset-env": "^7.22.5",
"@commitlint/cli": "^19.0.3",
"@commitlint/config-conventional": "^19.0.3",
"@eslint/js": "^8.50.0",
"@vitest/ui": "^1.2.2",
"commitizen": "^4.3.0",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^7.12.1",
"eslint-config-prettier": "^8.1.0",
"eslint-config-standard": "^16.0.1",
"eslint-plugin-jsdoc": "^43.0.0",
"husky": "^8.0.1",
"jsdoc": "^4.0.0",
"eslint": "^8.43.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-jsdoc": "^48.1.0",
"globals": "^14.0.0",
"husky": "^9.0.11",
"jsdoc": "^4.0.2",
"jsdoc-typeof-plugin": "^1.0.0",
"jsdom": "^21.1.0",
"lint-staged": "^13.0.1",
"prettier": "^2.1.2",
"sass": "^1.58.2",
"standard-version": "^9.0.0",
"vite": "^4.1.2",
"vite-plugin-browser-sync": "^1.0.2",
"vitest": "^0.32.2"
"jsdom": "^24.0.0",
"lint-staged": "^15.2.0",
"prettier": "^3.0.3",
"standard-version": "^9.5.0",
"vite": "^5.1.3",
"vite-plugin-browser-sync": "^3.0.0",
"vitest": "^1.2.2",
"vitest-axe": "^0.1.0"
}
}

@@ -19,17 +19,11 @@ # accessible-menu-bootstrap-5

## Browser Support
## Getting Started
| <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/chrome/chrome.svg" role="presentation" width="32px" height="32px" /><br />Chrome | <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/firefox/firefox.svg" role="presentation" width="32px" height="32px" /><br />Firefox | <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/safari/safari_32x32.png" role="presentation" width="32px" height="32px" /><br />Safari | <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/edge/edge.svg" role="presentation" width="32px" height="32px" /><br />Edge | <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/chromium/chromium.svg" role="presentation" width="32px" height="32px" /><br />Chromium | <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/webkit/webkit.svg" role="presentation" width="32px" height="32px" /><br />Webkit |
| --- | --- | --- | --- | --- | --- |
| last 2 versions | last 2 versions | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
Please follow the main project's [documentation](https://accessible-menu.dev/).
Found something that doesn't work the way it should in one of the listed browsers above? [Open an issue](https://github.com/NickDJM/accessible-menu-bootstrap-5/issues/new?assignees=&labels=bug&template=bug_report.md&title=Bug%3A+%5BBrief+Description%5D)!
### Installation
## Installation
You can install Accessible Menu Bootstrap 5 into your project using NPM.
### NPM
NPM is recommended for large-scale development, since it works well with bundlers like [Webpack](https://webpack.js.org/) or [Rollup](https://rollupjs.org/guide/en/).
```shell
```bash
# latest stable

@@ -39,161 +33,29 @@ npm install accessible-menu-bootstrap-5

### CDN
### Using Accessible Menu from a CDN
For learning/prototyping purposes you can use the latest version with:
You can use Accessible Menu Bootstrap 5 directly from a CDN via a script tag.
```html
<script src="https://cdn.jsdelivr.net/npm/accessible-menu-bootstrap-5/dist/accessible-menu-bs5.js"></script>
<script src="https://cdn.jsdelivr.net/npm/accessible-menu-bootstrap-5/dist/accessible-menu-bs5.iife.js"></script>
```
For production environments, it is recommend to use a specific version to avoid unforseen breaking changes:
We use [jsdelivr](https://www.jsdelivr.com/package/npm/accessible-menu-bootstrap-5) as the example, but you can use any cdn you prefer, such as [unpkg](https://unpkg.com). You can also download the files listed in the CDN and host them yourself if preferred.
```html
<script src="https://cdn.jsdelivr.net/npm/accessible-menu-bootstrap-5@2.0.0-beta.3/dist/accessible-menu-bs5.min.js"></script>
```
## Examples
## Usage
The following codepens are available as examples of how to use `accessible-menu`:
To use **accessible-menu-bootstrap-5**, you first need to make sure your menu matches the following structure:
- [Disclosure Navigation Menu](https://codepen.io/nickdjm/pen/MWRaEoV)
- [Disclosure Navigation Menu with Top-Level Links](https://codepen.io/nickdjm/pen/XWQmezx)
- [Navigation Menubar](https://codepen.io/nickdjm/pen/YzMyraX)
- [Navigation Treeview](https://codepen.io/nickdjm/pen/zYXvEWy)
```html
<ul id="example-menu" class="navbar-nav">
<li class="nav-item"><a href="/about" class="nav-link">About</a></li>
<li class="nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle">Projects ▼</a>
<ul class="dropdown-menu">
<li class="nav-item"><a href="/projects/awesome" class="dropdown-item">Awesome project</a></li>
<li class="nav-item"><a href="/projects/not-so-awesome" class="dropdown-item">Not-so-awesome project</a></li>
</ul>
</li>
<li class="nav-item"><a href="/contact" class="nav-link">Contact me</a></li>
</ul>
```
## Sponsors
Include **accessible-menu-bootstrap-5** through import or bundled library in your project:
<p align="center">
<a href="https://coldfrontlabs.ca">
<img src="https://coldfrontlabs.ca/themes/custom/frosty/images/coldfrontlabs-flakkon-logo.png" alt="Coldfront Labs Inc." width="300px"/>
</a>
</p>
```js
import AccessibleMenu from "accessible-menu-bootstrap-5";
```
or
```html
<script src="https://cdn.jsdelivr.net/npm/accessible-menu-bootstrap-5@2.0.0-beta.3/dist/accessible-menu-bs5.min.js"></script>
```
Once you have **accessible-menu-bootstrap-5** loaded, declare a new menu object.
`menuElement` is required for all menus. Unlike accessible-menu, **accessible-menu-bootstrap-5** will automatically find dropdown menus since the classes `.dropdown`, `.dropdown-menu`, and `.dropdown-item` are included in the Bootstrap 5 framework.
```js
const menu = new AccessibleMenu.DisclosureMenu({
menuElement: document.querySelector("#example-menu"),
});
```
### Only need one type of menu class?
Bundled versions of each menu are provided in the dist and individual exports are provided in the index.
There are also compiled ES Module versions if you don't want to use an iife!
#### Bootstrap5DisclosureMenu usage
```js
import { Bootstrap5DisclosureMenu } from "accessible-menu-bootstrap-5";
```
or
```html
<script src="https://cdn.jsdelivr.net/npm/accessible-menu-bootstrap-5@2.0.0-beta.3/dist/disclosure-menu-bs5.min.js"></script>
```
then
```js
const menu = new Bootstrap5DisclosureMenu({
menuElement: document.querySelector("#example-menu"),
});
```
#### Bootstrap5Menubar usage
```js
import { Bootstrap5Menubar } from "accessible-menu-bootstrap-5";
```
or
```html
<script src="https://cdn.jsdelivr.net/npm/accessible-menu-bootstrap-5@2.0.0-beta.3/dist/menubar-bs5.min.js"></script>
```
then
```js
const menu = new Bootstrap5Menubar({
menuElement: document.querySelector("#example-menu"),
});
```
#### Bootstrap5TopLinkDisclosureMenu usage
```js
import { Bootstrap5TopLinkDisclosureMenu } from "accessible-menu";
```
or
```html
<script src="https://cdn.jsdelivr.net/npm/accessible-menu@4.0.0-beta.0/dist/top-link-disclosure-menu-bs5.min.js"></script>
```
then
```js
const menu = new Bootstrap5TopLinkDisclosureMenu({
menuElement: document.querySelector("#example-menu"),
});
```
#### Bootstrap5Treeview usage
```js
import { Bootstrap5Treeview } from "accessible-menu-bootstrap-5";
```
or
```html
<script src="https://cdn.jsdelivr.net/npm/accessible-menu-bootstrap-5@2.0.0-beta.3/dist/treeview-bs5.min.js"></script>
```
then
```js
const menu = new Bootstrap5Treeview({
menuElement: document.querySelector("#example-menu"),
});
```
### Documentation
- [accessible-menu API Documentation](https://accessible-menu.netlify.app/)
- Basics
- [Single-level menu](docs/basics/single-level-menu.md)
- [Single-level menu with toggle](docs/basics/single-level-menu-with-toggle.md)
- [Two-level menu with toggle](docs/basics/two-level-menu-with-toggle.md)
- [Live examples](https://mandrasch.github.io/accessible-menu-bootstrap-examples/)
### Conflict with Bootstrap's own navbar toggle
Bootstrap 5 has it's own implementation of expanding/collapsing menus using the `data-bs-toggle` attribute on navbar togglers and dropdown toggles which would cause both **accessible-menu-bootstrap-5** _and_ Bootstrap's own toggler to open/close menus at the same time. To resolve this issue, **accessible-menu-bootstrap-5** removed the `data-bs-toggle` attributes from menu toggles that it controls.
### Other versions of Bootstrap
This project isn't designed to work with other versions of Bootstrap other than v4, however you _could_ probably get it to work with Bootstrap 3 by customizing the selectors and open/close classes when declaring the menu.
You also _might_ be able to get this to work with Bootstrap 5, however v5 changed the `data-bs-toggle` value on dropdowns to `data-bs-toggle` which won't be handled by this project. A Bootstrap 5 specific project may be created if there is enough interest in it.
## Versioning

@@ -208,9 +70,1 @@

If you're interested in contributing to the project, please read the [Contribution Guidelines](.github/CONTRIBUTING.md). Any and all contributions _must_ follow these guidelines or they will not be accepted.
## Sponsors
<p align="center">
<a href="https://coldfrontlabs.ca">
<img src="https://coldfrontlabs.ca/themes/custom/frosty/images/coldfrontlabs-flakkon-logo.png" alt="Coldfront Labs Inc." width="300px"/>
</a>
</p>

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc