!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).Navbar=n()}(this,(function(){"use strict";function e(e,n){const t=[HTMLElement,Element,Node],o=n&&t.some(e=>n instanceof e)?n:document;return t.some(n=>e instanceof n)?e:o.querySelector(e)}const n=new Map,t=(t,o,r,i)=>{const s=e(t);if(s)if(i&&i.length){n.has(s)||n.set(s,new Map);n.get(s).set(i,setTimeout(o,r))}else n.set(s,setTimeout(o,r))},o=(t,o)=>{const r=e(t);if(!r)return null;if(o&&o.length){n.has(r)||n.set(r,new Map);const e=n.get(r);if(e.has(o))return e.get(o)}else if(n.has(r))return n.get(r);return null},r=(t,o)=>{const r=e(t),i=r&&n.get(r);i&&(o&&o.length?i.has(o)&&(clearTimeout(i.get(o)),i.delete(o)):(clearTimeout(i),n.delete(r)))};function i(e,n){const t=getComputedStyle(e);return n in t?t[n]:""}function s(e,n){let t=0;const o=new Event("transitionend"),r=function(e){const n=i(e,"transitionProperty"),t=i(e,"transitionDuration"),o=t.includes("ms")?1:1e3,r=n&&"none"!==n?parseFloat(t)*o:0;return Number.isNaN(r)?0:r}(e),s=function(e){const n=i(e,"transitionProperty"),t=i(e,"transitionDelay"),o=t.includes("ms")?1:1e3,r=n&&"none"!==n?parseFloat(t)*o:0;return Number.isNaN(r)?0:r}(e);if(r){const i=o=>{o.target===e&&(n.apply(e,[o]),e.removeEventListener("transitionend",i),t=1)};e.addEventListener("transitionend",i),setTimeout(()=>{t||e.dispatchEvent(o)},r+s+17)}else n.apply(e,[o])}const a=!!(()=>{let e=!1;try{const i=Object.defineProperty({},"passive",{get:()=>(e=!0,e)});n=document,o=()=>{},function(e,n,t,o){const r=o||!1;e.addEventListener(n,t,r)}(n,t="DOMContentLoaded",(function e(i){i.target===n&&(o.apply(n,[i]),function(e,n,t,o){const r=o||!1;e.removeEventListener(n,t,r)}(n,t,e,r))}),r=i)}catch(e){throw Error("Passive events are not supported")}var n,t,o,r;return e})()&&{passive:!0};function c(e){return"true"===e||"false"!==e&&(Number.isNaN(+e)?""===e||"null"===e?null:e:+e)}const u=e=>Object.keys(e);function l(e,n){e.classList.add(n)}function d(e,n){return e.classList.contains(n)}function f(e,n){e.classList.remove(n)}const p=new Map,m={set:(n,t,o)=>{const r=e(n);if(!r)return;p.has(t)||p.set(t,new Map);p.get(t).set(r,o)},getAllFor:e=>{const n=p.get(e);return n||null},get:(n,t)=>{const o=e(n),r=m.getAllFor(t),i=o&&r&&r.get(o);return i||null},remove:(n,t)=>{const o=e(n),r=p.get(t);r&&o&&(r.delete(o),0===r.size&&p.delete(t))}};function v(e){return(e=>e instanceof Node)(e)?e.ownerDocument:function(e){return e instanceof Window}(e)?e.document:window.document}const g=e=>"rtl"===function(e){return v(e).documentElement}(e).dir,b=e=>Array.from(e),h=(e,n,t)=>e.setAttribute(n,t),E=e=>e instanceof HTMLElement;function w(e,n){return(n&&E(n)?n:document).getElementsByClassName(e)}function y(e,n){return(n&&E(n)?n:document).getElementsByTagName(e)}function L(e,n){return e&&n?e.closest(n):null}const A='[data-function="navbar"]',N={breakpoint:768,toggleSiblings:!0,delay:500},C={cancelable:!0,bubbles:!0},T=new CustomEvent("show.navbar",C),x=new CustomEvent("shown.navbar",C),S=new CustomEvent("hide.navbar",C),D=new CustomEvent("hidden.navbar",C),M=e=>{return n=e,t="Navbar",m.get(n,t);var n,t};function P(e){const n=e?"addEventListener":"removeEventListener";document.querySelector("li.open-mobile")||window[n]("resize",k,a)}function k(){q(w("open-mobile")),P()}function I(e){const{options:n,menu:t}=e,[o]=w("subnav-toggle",t);return o&&"none"!==i(o,"display")||window.innerWidth<n.breakpoint}function O(e,n){const t=n?"addEventListener":"removeEventListener",{items:o,navbarToggle:r,menu:i}=e;b(o).forEach(e=>{d(e.lastElementChild,"subnav")&&(e[t]("mouseenter",z),e[t]("mouseleave",B));const[n]=w("subnav-toggle",e);n&&n[t]("click",U)}),i[t]("keydown",R),r&&r[t]("click",U)}function j(e,n){return b(e.children).find(e=>n===e.tagName||d(e,n))}function F(e,n){const t=j(e,"subnav"),o=j(e,"A"),i=j(e,"subnav-toggle"),a=()=>{f(e,"open-position"),r(e,"out"),o&&(o.dispatchEvent(D),h(o,"aria-expanded","false"))};if(d(e,"open")){if(o&&(o.dispatchEvent(S),S.defaultPrevented))return;f(e,"open"),n&&t?s(t,a):a()}if(d(e,"open-mobile")){if(o&&o.dispatchEvent(S),S.defaultPrevented)return;f(e,"open-mobile"),[i,o].forEach(e=>{e&&h(e,"aria-expanded","false")}),o&&o.dispatchEvent(D)}}function q(e){b(e).forEach(e=>F(e))}function R(e){const{code:n}=e,{activeElement:t}=document,o=M(this);if(!o||!t||!this.contains(t))return;const r=L(t,"LI");if(!r)return;const s=I(o),{previousElementSibling:a,nextElementSibling:c}=r,u=L(r,".open"),l=L(r,"UL"),[f]=w("subnav",r),p=["Space","ArrowDown","ArrowLeft","ArrowRight","ArrowUp"],m=l&&"column"===i(l,"flex-direction"),v=g(),b=l&&a&&("ArrowUp"===n&&m||n===(v?"ArrowRight":"ArrowLeft")&&!m),h=l&&c&&("ArrowDown"===n&&m||n===(v?"ArrowLeft":"ArrowRight")&&!m);let E=null;"Escape"===n&&u?(B.call(u),E=u):!s&&f&&"Space"===n&&(d(r,"open")?B.call(r):z.call(r)),b&&r!==l.firstElementChild?E=a:h&&r!==l.lastElementChild&&(E=c),E&&E.firstElementChild.focus(),!s&&p.includes(n)&&e.preventDefault()}function U(e){e.preventDefault();const{target:n}=e,t=this,o=L(t,A+",.navbar"),r=o&&M(o),{options:i,navbarToggle:s}=r;if(r&&(n===t||t.contains(n))){const e=L(t,"LI")||o,n=L(t,".navbar-toggle")===s?s:j(e,"subnav-toggle"),r=n===s?null:j(e,"A"),a=w("open-mobile",e);if(d(e,"open-mobile")){if(r&&r.dispatchEvent(S),S.defaultPrevented)return;q(a),f(e,"open-mobile"),n&&(h(n,"aria-expanded","false"),P()),r&&(h(r,"aria-expanded","false"),r.dispatchEvent(D))}else{if(r&&r.dispatchEvent(T),T.defaultPrevented)return;if(n!==s&&P(!0),n!==s){q(i.toggleSiblings?w("open-mobile",e.parentElement):a)}l(e,"open-mobile"),n&&h(n,"aria-expanded","true"),r&&(h(r,"aria-expanded","true"),r.dispatchEvent(x))}}}function z(){const e=this,n=L(e,A+",.navbar"),i=n&&M(n),a=o(e,"out");if(i&&!I(i)&&(r(e,"out"),!d(e,"open")&&!a)){t(e,()=>function(e){const n=j(e,"subnav"),t=j(e,"A"),o=()=>{r(e,"in"),t&&(t.dispatchEvent(x),h(t,"aria-expanded","true"))};if(t&&(t.dispatchEvent(T),T.defaultPrevented))return;l(e,"open-position"),l(e,"open");const i=y("LI",e.parentElement);q(b(i).filter(n=>n!==e)),n?s(n,o):o()}(e),17,"in")}}function B(){const e=this,n=L(e,A+",.navbar"),o=n&&M(n);if(o&&!I(o)&&d(e,"open")){r(e,"in");t(e,()=>F(e,!0),o.options.delay,"out")}}class H{constructor(n,t){const o=this;o.menu=e(n);const{menu:r}=o;if(!r)return;const i=M(r);i&&i.dispose(),o.options=function(e,n,t,o){const r={...e.dataset},i={},s={};return u(r).forEach(e=>{const n=o&&e.includes(o)?e.replace(o,"").replace(/[A-Z]/,e=>e.toLowerCase()):e;s[n]=c(r[e])}),u(t).forEach(e=>{t[e]=c(t[e])}),u(n).forEach(e=>{i[e]=e in t?t[e]:e in s?s[e]:n[e]}),i}(r,N,t||{},""),o.items=y("LI",r),o.navbarToggle=null,[o.navbarToggle]=w("navbar-toggle",r),O(o,!0),m.set(r,"Navbar",o)}get defaults(){return N}get version(){return"3.0.6"}get name(){return"Navbar"}dispose(){q(this.items),O(this),P(),m.remove(this.menu,"Navbar")}}var W,Z;function G(e){const n=e instanceof Element?e:document,{selector:t,init:o}=H,r=n.querySelectorAll(t);Array.from(r).map(e=>o(e))}return W=H,Z={selector:A,init:e=>new H(e),getInstance:M},Object.assign(W,Z),document.body?G():document.addEventListener("DOMContentLoaded",G,{once:!0}),H}));