{"version":3,"sources":["webpack://wweebpack/./src/js/util/delay.js","webpack://wweebpack/./src/js/classes/menuClass.ts","webpack://wweebpack/./src/js/classes/mobileMenuClass.ts"],"names":["ms","Promise","resolve","setTimeout","MenuConfiguration","BodyNoScrollClass","BodyClassOpen","OpenClass","OpeningClass","DropDownSelector","InnerDropDownSelector","InnerOpenClass","InnerOpeningClass","mobileToggleSelector","mobileButtonOpenClass","mobileNavOpenClass","mobileNavSelector","mobileHeaderSelector","mobileHeaderOpenClass","ButtonOpenClass","ButtonSelector","InnerButtonOpenClass","InnerButtonSelector","this","mobileToggle","document","querySelectorAll","menuButtons","innerMenuButtons","menuTabs","innerMenuTabs","mobileNav","innerMenu","forEach","button","buttonId","getAttribute","addEventListener","Open","mobileButton","mobileButtonId","mobileOpen","event","key","Close","mobilePanelId","classList","toggle","setAttribute","mobileTab","querySelector","mobileHeader","body","panelId","contains","add","tab","e","escapeKey","then","catch","ListenOutside","removeEventListener","remove","container","target","includes","MobileMenuConfiguration","hamburgerBtn","headerContainer","linksContainer","clickableLink","innerLink","icon","hamburgerButton","navIcon","link"],"mappings":";yIAIE,UAJY,SAACA,GAAD,OACV,IAAIC,SAAQ,SAACC,GAAD,OAAaC,WAAWD,EAASF,Q,sGCAjD,MAAMI,GAGNA,EAAkBC,kBAAoB,YACtCD,EAAkBE,cAAgB,YAElCF,EAAkBG,UAAY,4BAC9BH,EAAkBI,aAAe,+BACjCJ,EAAkBK,iBAAmB,oBACrCL,EAAkBM,sBAAwB,0BAC1CN,EAAkBO,eAAiB,yBACnCP,EAAkBQ,kBAAoB,4BAEtCR,EAAkBS,qBAAuB,+BACzCT,EAAkBU,sBAAwB,iCAC1CV,EAAkBW,mBAAqB,uBACvCX,EAAkBY,kBAAoB,2BACtCZ,EAAkBa,qBAAuB,+BACzCb,EAAkBc,sBAAwB,kCAE1Cd,EAAkBe,gBAAkB,0BACpCf,EAAkBgB,eAAiB,+BACnChB,EAAkBiB,qBAAuB,uBACzCjB,EAAkBkB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OAAO,gCACtByB,GAAW1B,UAAUC,OAAO,iBAC5B4B,GAAS7B,UAAUC,OAAO,gCAG9B2B,GACAA,EAAgBrC,iBAAiB,SAAS,KACtCgC,GAAiBvB,UAAUC,OAAO,aAClCtB,SAAS2B,KAAKN,UAAUC,OAAO,aAC/BuB,GAAgBxB,UAAUC,OAAO,oBAI7C,cACA,QACA","file":"menu.js","sourcesContent":["const delay = (ms) => (\r\n new Promise((resolve) => setTimeout(resolve, ms))\r\n );\r\n \r\n export default delay;\r\n ","import delay from \"./../util/delay\";\r\nclass MenuConfiguration {\r\n}\r\n//Body Classes\r\nMenuConfiguration.BodyNoScrollClass = 'no-scroll';\r\nMenuConfiguration.BodyClassOpen = 'nav--open';\r\n//Dropdown\r\nMenuConfiguration.OpenClass = 'cp-header__dropdown--open';\r\nMenuConfiguration.OpeningClass = 'cp-header__dropdown--opening';\r\nMenuConfiguration.DropDownSelector = '*[data-parent-id]';\r\nMenuConfiguration.InnerDropDownSelector = '*[data-inner-parent-id]';\r\nMenuConfiguration.InnerOpenClass = 'cp-nav__dropdown--open';\r\nMenuConfiguration.InnerOpeningClass = 'cp-nav__dropdown--opening';\r\n//Mobile Toggle Button\r\nMenuConfiguration.mobileToggleSelector = '*[data-name=\"mobile-toggle\"]';\r\nMenuConfiguration.mobileButtonOpenClass = 'cp-header__mobile-toggle--open';\r\nMenuConfiguration.mobileNavOpenClass = 'cp-header__nav--open';\r\nMenuConfiguration.mobileNavSelector = '*[data-mobile-parent-id]';\r\nMenuConfiguration.mobileHeaderSelector = '*[data-name=\"mobile-header\"]';\r\nMenuConfiguration.mobileHeaderOpenClass = 'cp-header__mobile-top-bar--open';\r\n//Buttons\r\nMenuConfiguration.ButtonOpenClass = 'cp-header__button--open';\r\nMenuConfiguration.ButtonSelector = '*[data-name=\"menu-dropdown\"]';\r\nMenuConfiguration.InnerButtonOpenClass = 'cp-nav__button--open';\r\nMenuConfiguration.InnerButtonSelector = '*[data-name=\"inner-menu-dropdown\"]';\r\nclass Menu {\r\n constructor() {\r\n this.mobileToggle = [...document.querySelectorAll(MenuConfiguration.mobileToggleSelector)];\r\n this.menuButtons = [...document.querySelectorAll(MenuConfiguration.ButtonSelector)];\r\n this.innerMenuButtons = [...document.querySelectorAll(MenuConfiguration.InnerButtonSelector)];\r\n this.menuTabs = [...document.querySelectorAll(MenuConfiguration.DropDownSelector)];\r\n this.innerMenuTabs = [...document.querySelectorAll(MenuConfiguration.InnerDropDownSelector)];\r\n this.mobileNav = false;\r\n this.innerMenu = false;\r\n this.menuButtons.forEach(button => {\r\n const buttonId = button.getAttribute('data-id');\r\n if (!buttonId)\r\n return;\r\n button.addEventListener('click', () => {\r\n this.innerMenu = false;\r\n this.Open(buttonId, button);\r\n });\r\n });\r\n this.innerMenuButtons.forEach(button => {\r\n const buttonId = button.getAttribute('data-id');\r\n if (!buttonId)\r\n return;\r\n button.addEventListener('click', () => {\r\n this.innerMenu = true;\r\n this.Open(buttonId, button);\r\n });\r\n });\r\n this.mobileToggle.forEach(mobileButton => {\r\n const mobileButtonId = mobileButton.getAttribute('data-id');\r\n if (!mobileButtonId)\r\n return;\r\n mobileButton.addEventListener('click', () => {\r\n this.mobileOpen(mobileButtonId, mobileButton);\r\n });\r\n });\r\n }\r\n escapeKey(event) {\r\n if (event.key === \"Escape\") {\r\n this.Close();\r\n }\r\n }\r\n mobileOpen(mobilePanelId, mobileButton) {\r\n this.mobileNav = !this.mobileNav;\r\n mobileButton.classList.toggle(MenuConfiguration.mobileButtonOpenClass);\r\n let x = mobileButton.getAttribute(\"aria-expanded\");\r\n if (x == 'true') {\r\n mobileButton.setAttribute('aria-expanded', 'false');\r\n }\r\n else {\r\n mobileButton.setAttribute('aria-expanded', 'true');\r\n }\r\n const mobileTab = document.querySelector(`*[data-mobile-parent-id='${mobilePanelId}']`);\r\n const mobileHeader = document.querySelector(MenuConfiguration.mobileHeaderSelector);\r\n document.body.classList.toggle(MenuConfiguration.BodyNoScrollClass);\r\n document.body.classList.toggle(MenuConfiguration.BodyClassOpen);\r\n mobileHeader?.classList.toggle(MenuConfiguration.mobileHeaderOpenClass);\r\n mobileTab?.classList.toggle(MenuConfiguration.mobileNavOpenClass);\r\n }\r\n Open(panelId, button) {\r\n if (button.classList.contains(MenuConfiguration.ButtonOpenClass) || button.classList.contains(MenuConfiguration.InnerButtonOpenClass)) {\r\n this.Close();\r\n return;\r\n }\r\n else {\r\n this.Close();\r\n if (!this.mobileNav) {\r\n document.body.classList.add(MenuConfiguration.BodyClassOpen);\r\n }\r\n let tab = document.querySelector(`*[data-parent-id='${panelId}']`);\r\n if (this.innerMenu) {\r\n tab = document.querySelector(`*[data-inner-parent-id='${panelId}']`);\r\n button.classList.add(MenuConfiguration.InnerButtonOpenClass);\r\n button.setAttribute('aria-expanded', 'true');\r\n button.setAttribute('aria-pressed', 'true');\r\n tab?.classList.add(MenuConfiguration.InnerOpeningClass);\r\n document.addEventListener('keydown', e => this.escapeKey(e));\r\n tab?.classList.add(MenuConfiguration.InnerOpenClass);\r\n tab.setAttribute('aria-hidden', 'false');\r\n }\r\n else {\r\n button.classList.add(MenuConfiguration.ButtonOpenClass);\r\n button.setAttribute('aria-expanded', 'true');\r\n button.setAttribute('aria-pressed', 'true');\r\n tab?.classList.add(MenuConfiguration.OpeningClass);\r\n document.addEventListener('keydown', e => this.escapeKey(e));\r\n delay(1).then(() => {\r\n tab?.classList.add(MenuConfiguration.OpenClass);\r\n tab.setAttribute('aria-hidden', 'false');\r\n }).catch(() => {\r\n \"An error occurred\";\r\n });\r\n document.addEventListener('click', e => this.ListenOutside(e, tab));\r\n }\r\n }\r\n }\r\n Close() {\r\n document.removeEventListener('keydown', e => this.escapeKey(e));\r\n this.menuTabs.forEach(tab => {\r\n tab.classList.remove(MenuConfiguration.OpeningClass);\r\n tab.classList.remove(MenuConfiguration.OpenClass);\r\n tab.setAttribute('aria-hidden', 'true');\r\n document.removeEventListener('click', e => this.ListenOutside(e, tab));\r\n });\r\n this.innerMenuTabs.forEach(tab => {\r\n tab.classList.remove(MenuConfiguration.InnerOpeningClass);\r\n tab.classList.remove(MenuConfiguration.InnerOpenClass);\r\n tab.setAttribute('aria-hidden', 'true');\r\n document.removeEventListener('click', e => this.ListenOutside(e, tab));\r\n });\r\n if (!this.mobileNav && !this.innerMenu) {\r\n document.body.classList.remove(MenuConfiguration.BodyNoScrollClass);\r\n document.body.classList.remove(MenuConfiguration.BodyClassOpen);\r\n }\r\n this.menuButtons.forEach(button => {\r\n button.classList.remove(MenuConfiguration.ButtonOpenClass);\r\n button.setAttribute('aria-expanded', 'false');\r\n button.setAttribute('aria-pressed', 'false');\r\n });\r\n this.innerMenuButtons.forEach(button => {\r\n button.classList.remove(MenuConfiguration.InnerButtonOpenClass);\r\n button.setAttribute('aria-expanded', 'false');\r\n button.setAttribute('aria-pressed', 'false');\r\n });\r\n }\r\n ListenOutside(e, container) {\r\n const target = e.target;\r\n if (!container.contains(target) && !this.menuButtons.includes(target))\r\n this.Close();\r\n }\r\n}\r\nexport default Menu;\r\n","class MobileMenuConfiguration {\r\n}\r\nMobileMenuConfiguration.hamburgerBtn = \"*[header-hamburger]\";\r\nMobileMenuConfiguration.headerContainer = \"*[mobile-nav]\";\r\nMobileMenuConfiguration.linksContainer = \"*[mobile-links]\";\r\nMobileMenuConfiguration.clickableLink = \"*[clickable-link]\";\r\nMobileMenuConfiguration.innerLink = \"*[inner-link]\";\r\nMobileMenuConfiguration.icon = \"*[nav-icon]\";\r\nclass MobileMenu {\r\n constructor() {\r\n var hamburgerButton = document.querySelector(MobileMenuConfiguration.hamburgerBtn);\r\n var headerContainer = document.querySelector(MobileMenuConfiguration.headerContainer);\r\n var linksContainer = document.querySelector(MobileMenuConfiguration.linksContainer);\r\n var clickableLink = document.querySelectorAll(MobileMenuConfiguration.clickableLink);\r\n var innerLink = document.querySelector(MobileMenuConfiguration.innerLink);\r\n var navIcon = document.querySelector(MobileMenuConfiguration.icon);\r\n clickableLink.forEach(link => {\r\n link.addEventListener(\"click\", () => {\r\n link.classList.toggle(\"cp-header__button-menu__open\");\r\n innerLink?.classList.toggle(\"header-hidden\");\r\n navIcon?.classList.toggle(\"cp-header-chevron-down\");\r\n });\r\n });\r\n if (hamburgerButton) {\r\n hamburgerButton.addEventListener(\"click\", () => {\r\n headerContainer?.classList.toggle(\"full-body\");\r\n document.body.classList.toggle(\"no-scroll\");\r\n linksContainer?.classList.toggle(\"header-hidden\");\r\n });\r\n }\r\n }\r\n mobileOpen() { }\r\n Open() { }\r\n Close() { }\r\n}\r\nexport default MobileMenu;\r\n"],"sourceRoot":""}