{"version":3,"sources":["accordions.js","carousel.js","navigation.js"],"names":["accordionToggle","accordionClass","accordionBtnClass","closeMenu","accordions","document","querySelectorAll","forEach","accordion","accordionBtn","querySelector","addEventListener","accordionLabel","innerText","getAttribute","otherAccordions","classList","remove","setAttribute","alertStatus","classToggle","hasReducedMotion","window","matchMedia","carouselOptions","Object","assign","autoRotate","rotationSpeed","rotateCarousel","carousel","options","items","controls","currentItem","currentItemIndex","parseInt","length","nextItem","add","item","index","setInterval","selector","contains","target","activeItem","activeControl","innerHTML","Date","getFullYear","elements","elementClass","element","alert","alertMessage","getElementById","maintainFocus","container","focusableElements","firstFocusableElement","lastFocusableElement","navLink","e","key","keyCode","shiftKey","activeElement","focus","preventDefault","menuBtn","nav","overlay"],"mappings":"AAIA,MAAAA,gBAAA,CAAAC,EAAAC,EAAAC,KACA,MAAAC,EAAAC,SAAAC,iBAAAL,GACAG,EAAAG,SAAAC,IACA,MAAAC,EAAAD,EAAAE,cAAAR,GAEAO,EAAAE,iBAAA,SAAA,KACA,IAAAC,EAAA,GAEAH,EAAAI,UACAD,EAAAH,EAAAI,UAEAJ,EAAAK,aAAA,cAKAV,EAAAG,SAAAQ,IACAA,IAAAP,IACAO,EAAAC,UAAAC,OAAA,uBACAF,EACAL,cAAAR,GACAgB,aAAA,gBAAA,SACA,IAMA,SAAAT,EAAAK,aAAA,kBACAL,EAAAS,aAAA,gBAAA,SACAC,YAAA,mBAAA,GAAAP,oBAEAH,EAAAS,aAAA,gBAAA,QACAC,YAAA,mBAAA,GAAAP,kBAGAQ,YAAA,CAAAZ,GAAA,sBAAA,GACA,GACA,EAMAH,SAAAK,cAAA,wBACAV,gBAAA,aAAA,mBC5CA,MAAAqB,iBAAAC,OAAAC,WAAA,oCACAC,gBAAAC,OAAAC,OAAA,CACAC,YAAAN,iBACAO,cAAA,MAGA,SAAAC,eAAAC,EAAAC,GACA,GAAA,GAAAA,EAAAJ,WAAA,CACA,MAAAK,EAAAF,EAAAxB,iBAAA,mBACA2B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AN,UAAA,MAAAO,OACA,EAKA,SAAAE,cAAAC,GACA,MAEAC,EAAAD,EAAApD,iBADA,4DAEAsD,EAAAD,EAAA,GACAE,EAAAF,EAAAA,EAAAtB,OAAA,GACAqB,EAAApD,iBAAA,MAEAC,SAAAuD,IACAA,EAAAnD,iBAAA,SAAAoD,KACA,QAAAA,EAAAC,KAAA,IAAAD,EAAAE,WAKAF,EAAAG,SACA7D,SAAA8D,gBAAAP,IACAvD,SAAAK,cAAA,iBAAA0D,QACAL,EAAAM,kBAIAhE,SAAA8D,gBAAAL,GACAzD,SAAA8D,gBAAAN,IAEAH,EAAA1C,UAAAuB,IAAA,iBACAlC,SAAAK,cAAA,iBAAA0D,QACAL,EAAAM,kBAEA,GACA,GAEA,CAEA,GAAAhE,SAAAK,cAAA,iBAAA,CACA,MAAA4D,EAAAjE,SAAAK,cAAA,iBACA6D,EAAAlE,SAAAK,cAAA,YAEA4D,EAAA3D,iBAAA,SAAA,KACAS,YAAA,CAAAkD,EAAAC,GAAA,iBACAd,cAAAc,GAEAA,EAAAvD,UAAA4B,SAAA,iBACAzB,YAAA,cAAA,gBAEAA,YAAA,cAAA,iBACA,GAEA,CAEA,GAAAd,SAAAK,cAAA,YAAA,CACA,MAAA8D,EAAAnE,SAAAK,cAAA,YACA4D,EAAAjE,SAAAK,cAAA,iBACA6D,EAAAlE,SAAAK,cAAA,YAEA8D,EAAA7D,iBAAA,SAAA,KACAS,YAAA,CAAAkD,EAAAC,GAAA,gBAAA,GAEA","file":"../app.js","sourcesContent":["//===-----------------===\r\n// Accordions\r\n//===-----------------===\r\n\r\nconst accordionToggle = (accordionClass, accordionBtnClass, closeMenu) => {\r\n\tconst accordions = document.querySelectorAll(accordionClass)\r\n\taccordions.forEach(accordion => {\r\n\t\tconst accordionBtn = accordion.querySelector(accordionBtnClass)\r\n\r\n\t\taccordionBtn.addEventListener(\"click\", () => {\r\n\t\t\tlet accordionLabel = \"\"\r\n\r\n\t\t\tif (accordionBtn.innerText) {\r\n\t\t\t\taccordionLabel = accordionBtn.innerText\r\n\t\t\t} else {\r\n\t\t\t\taccordionBtn.getAttribute(\"data-title\")\r\n\t\t\t}\r\n\t\t\t//===-------//\r\n\t\t\t// Removing aria-expanded and class from all other accordions\r\n\t\t\t//-------===//\r\n\t\t\taccordions.forEach(otherAccordions => {\r\n\t\t\t\tif (otherAccordions !== accordion) {\r\n\t\t\t\t\totherAccordions.classList.remove(\"js-accordion-active\")\r\n\t\t\t\t\totherAccordions\r\n\t\t\t\t\t\t.querySelector(accordionBtnClass)\r\n\t\t\t\t\t\t.setAttribute(\"aria-expanded\", \"false\")\r\n\t\t\t\t}\r\n\t\t\t})\r\n\r\n\t\t\t//===-------//\r\n\t\t\t// Ensuring that the aria-expanded will swap if the same accordion that is open is clicked\r\n\t\t\t//-------===//\r\n\t\t\tif (accordionBtn.getAttribute(\"aria-expanded\") === \"true\") {\r\n\t\t\t\taccordionBtn.setAttribute(\"aria-expanded\", \"false\")\r\n\t\t\t\talertStatus(\"accordion-status\", `${accordionLabel} is collapsed`)\r\n\t\t\t} else {\r\n\t\t\t\taccordionBtn.setAttribute(\"aria-expanded\", \"true\")\r\n\t\t\t\talertStatus(\"accordion-status\", `${accordionLabel} is expanded`)\r\n\t\t\t}\r\n\r\n\t\t\tclassToggle([accordion], \"js-accordion-active\")\r\n\t\t})\r\n\t})\r\n}\r\n\r\n//===-----------------===\r\n// Accordion toggles\r\n//===-----------------===\r\nif (document.querySelector(\".accordion__wrapper\")) {\r\n\taccordionToggle(\".accordion\", \".accordion__btn\", false)\r\n}\r\n","//---------------------------------\r\n//===---------------------------===\r\n// Carousels\r\n//===---------------------------===\r\n//---------------------------------\r\nconst hasReducedMotion = window.matchMedia(\"(prefers-reduced-motion: reduce)\"),\r\n\tcarouselOptions = Object.assign({\r\n\t\tautoRotate: hasReducedMotion ? false : true,\r\n\t\trotationSpeed: 10000,\r\n\t})\r\n\r\nfunction rotateCarousel(carousel, options) {\r\n\tif (options.autoRotate != true) {\r\n\t\tconst items = carousel.querySelectorAll(\".carousel__item\"),\r\n\t\t\tcontrols = carousel.querySelectorAll(\".carousel-control\")\r\n\t\tlet currentItem = carousel.querySelector(\r\n\t\t\t\t\".carousel__item.js-carousel-active\"\r\n\t\t\t),\r\n\t\t\tcurrentItemIndex = parseInt(currentItem.getAttribute(\"data-index\"))\r\n\r\n\t\tcontrols[currentItemIndex].classList.remove(\"js-carousel-active\")\r\n\t\tcurrentItemIndex = (currentItemIndex + 1) % items.length\r\n\r\n\t\tconst nextItem = carousel.querySelector(\r\n\t\t\t`.carousel__item[data-index=\"${currentItemIndex}\"]`\r\n\t\t)\r\n\r\n\t\tcurrentItem.classList.remove(\"js-carousel-active\")\r\n\t\tcontrols[currentItemIndex].classList.add(\"js-carousel-active\")\r\n\t\tnextItem.classList.add(\"js-carousel-active\")\r\n\t}\r\n}\r\n\r\nif (document.querySelector(\".carousel\")) {\r\n\tconst carousels = document.querySelectorAll(\".carousel-wrapper\")\r\n\r\n\tcarousels.forEach(carousel => {\r\n\t\tconst items = carousel.querySelectorAll(\".carousel__item\")\r\n\r\n\t\titems.forEach((item, index) => {\r\n\t\t\titem.setAttribute(\"data-index\", index)\r\n\t\t})\r\n\r\n\t\tsetInterval(\r\n\t\t\t() => rotateCarousel(carousel, carouselOptions),\r\n\t\t\tcarouselOptions.rotationSpeed\r\n\t\t)\r\n\r\n\t\tconst imageSelects = carousel.querySelectorAll(\".carousel-control\")\r\n\r\n\t\timageSelects.forEach((selector, index) => {\r\n\t\t\tselector.addEventListener(\"click\", () => {\r\n\t\t\t\tif (!selector.classList.contains(\"js-carousel-active\")) {\r\n\t\t\t\t\tconst target = selector.getAttribute(\"data-target\"),\r\n\t\t\t\t\t\titem = document.querySelector(`#${target}`),\r\n\t\t\t\t\t\tactiveItem = document.querySelector(\r\n\t\t\t\t\t\t\t\".carousel__item.js-carousel-active\"\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t\tactiveControl = document.querySelector(\r\n\t\t\t\t\t\t\t\".carousel-control.js-carousel-active\"\r\n\t\t\t\t\t\t)\r\n\r\n\t\t\t\t\tactiveItem.classList.remove(\"js-carousel-active\")\r\n\t\t\t\t\tactiveControl.classList.remove(\"js-carousel-active\")\r\n\r\n\t\t\t\t\tselector.classList.add(\"js-carousel-active\")\r\n\r\n\t\t\t\t\titem.classList.add(\"js-carousel-active\")\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t})\r\n\t})\r\n}\r\n","//---------------------------------\r\n//===---------------------------===\r\n// Javascript\r\n//===---------------------------===\r\n//---------------------------------\r\n\r\n//===-----------------===\r\n// Reusable functions\r\n//===-----------------===\r\nif (document.querySelector(\"#pf__year\")) {\r\n\tdocument.querySelector(\"#pf__year\").innerHTML = new Date().getFullYear()\r\n}\r\n\r\nconst classToggle = function (elements, elementClass) {\r\n\telements.forEach(element => {\r\n\t\tif (!element.classList.contains(`${elementClass}`)) {\r\n\t\t\telement.classList.add(`${elementClass}`)\r\n\t\t} else {\r\n\t\t\telement.classList.remove(`${elementClass}`)\r\n\t\t}\r\n\t})\r\n}\r\n\r\nconst alertStatus = function (alert, alertMessage) {\r\n\tdocument.getElementById(alert).innerHTML = `

${alertMessage}

`\r\n}\r\n\r\n//===-----------------===\r\n// Navigation\r\n//===-----------------===\r\nfunction maintainFocus(container) {\r\n\tconst focusableElementsSelector =\r\n\t\t\t'[href], [tabindex]:not([tabindex=\"-1\"]), input, a > a, a',\r\n\t\tfocusableElements = container.querySelectorAll(focusableElementsSelector),\r\n\t\tfirstFocusableElement = focusableElements[0],\r\n\t\tlastFocusableElement = focusableElements[focusableElements.length - 1],\r\n\t\tnavLinks = container.querySelectorAll(\"li\")\r\n\r\n\tnavLinks.forEach(navLink => {\r\n\t\tnavLink.addEventListener(\"keyup\", e => {\r\n\t\t\tconst isTabPressed = e.key === \"Tab\" || e.keyCode === 9\r\n\r\n\t\t\tif (!isTabPressed) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t\tif (e.shiftKey) {\r\n\t\t\t\tif (document.activeElement === firstFocusableElement) {\r\n\t\t\t\t\tdocument.querySelector(\".ph__nav__btn\").focus()\r\n\t\t\t\t\te.preventDefault()\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif (\r\n\t\t\t\t\tdocument.activeElement === navLink ||\r\n\t\t\t\t\tdocument.activeElement === lastFocusableElement\r\n\t\t\t\t) {\r\n\t\t\t\t\tcontainer.classList.add(\"js-nav-active\")\r\n\t\t\t\t\tdocument.querySelector(\".ph__nav__btn\").focus()\r\n\t\t\t\t\te.preventDefault()\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t})\r\n\t})\r\n}\r\n\r\nif (document.querySelector(\".ph__nav__btn\")) {\r\n\tconst menuBtn = document.querySelector(\".ph__nav__btn\"),\r\n\t\tnav = document.querySelector(\".ph__nav\")\r\n\r\n\tmenuBtn.addEventListener(\"click\", () => {\r\n\t\tclassToggle([menuBtn, nav], \"js-nav-active\")\r\n\t\tmaintainFocus(nav)\r\n\r\n\t\tif (nav.classList.contains(\"js-nav-active\")) {\r\n\t\t\talertStatus(\"menu-status\", \"Menu is open\")\r\n\t\t} else {\r\n\t\t\talertStatus(\"menu-status\", \"Menu is closed\")\r\n\t\t}\r\n\t})\r\n}\r\n\r\nif (document.querySelector(\".overlay\")) {\r\n\tconst overlay = document.querySelector(\".overlay\"),\r\n\t\tmenuBtn = document.querySelector(\".ph__nav__btn\"),\r\n\t\tnav = document.querySelector(\".ph__nav\")\r\n\r\n\toverlay.addEventListener(\"click\", () => {\r\n\t\tclassToggle([menuBtn, nav], \"js-nav-active\")\r\n\t})\r\n}\r\n"]}