{"version":3,"file":"tabs.mjs","sources":["../../../../src/govuk/components/tabs/tabs.mjs"],"sourcesContent":["import { getBreakpoint, getFragmentFromUrl } from '../../common/index.mjs'\nimport { ElementError } from '../../errors/index.mjs'\nimport { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs'\n\n/**\n * Tabs component\n *\n * @preserve\n */\nexport class Tabs extends GOVUKFrontendComponent {\n /** @private */\n $tabs\n\n /** @private */\n $tabList\n\n /** @private */\n $tabListItems\n\n /** @private */\n jsHiddenClass = 'govuk-tabs__panel--hidden'\n\n /** @private */\n changingHash = false\n\n /** @private */\n boundTabClick\n\n /** @private */\n boundTabKeydown\n\n /** @private */\n boundOnHashChange\n\n /**\n * @private\n * @type {MediaQueryList | null}\n */\n mql = null\n\n /**\n * @param {Element | null} $root - HTML element to use for tabs\n */\n constructor($root) {\n super($root)\n\n const $tabs = this.$root.querySelectorAll('a.govuk-tabs__tab')\n if (!$tabs.length) {\n throw new ElementError({\n component: Tabs,\n identifier: 'Links (``)'\n })\n }\n\n this.$tabs = $tabs\n\n // Save bound functions so we can remove event listeners during teardown\n this.boundTabClick = this.onTabClick.bind(this)\n this.boundTabKeydown = this.onTabKeydown.bind(this)\n this.boundOnHashChange = this.onHashChange.bind(this)\n\n const $tabList = this.$root.querySelector('.govuk-tabs__list')\n const $tabListItems = this.$root.querySelectorAll(\n 'li.govuk-tabs__list-item'\n )\n\n if (!$tabList) {\n throw new ElementError({\n component: Tabs,\n identifier: 'List (`