{"version":3,"file":"header.module.js","sources":["../../../.config/config.js","../../../src/core/api.js","../../../src/component/header/script/header/header-selector.js","../../../src/component/header/script/header/header-links.js","../../../src/component/header/script/header/header-modal.js","../../../src/component/header/index.js","../../../src/component/header/main.js"],"sourcesContent":["const config = {\r\n prefix: 'fr',\r\n namespace: 'dsfr',\r\n organisation: '@gouvfr',\r\n version: '1.11.2'\r\n};\r\n\r\nexport default config;\r\n","import config from './config.js';\nconst api = window[config.namespace];\nexport default api;\n","import api from '../../api.js';\n\nexport const HeaderSelector = {\n HEADER: api.internals.ns.selector('header'),\n TOOLS_LINKS: api.internals.ns.selector('header__tools-links'),\n MENU_LINKS: api.internals.ns.selector('header__menu-links'),\n BUTTONS: `${api.internals.ns.selector('header__tools-links')} ${api.internals.ns.selector('btns-group')}, ${api.internals.ns.selector('header__tools-links')} ${api.internals.ns.selector('links-group')}`,\n MODALS: `${api.internals.ns.selector('header__search')}${api.internals.ns.selector('modal')}, ${api.internals.ns.selector('header__menu')}${api.internals.ns.selector('modal')}`\n};\n","import api from '../../api.js';\nimport { HeaderSelector } from './header-selector.js';\n\nclass HeaderLinks extends api.core.Instance {\n static get instanceClassName () {\n return 'HeaderLinks';\n }\n\n init () {\n const header = this.queryParentSelector(HeaderSelector.HEADER);\n this.toolsLinks = header.querySelector(HeaderSelector.TOOLS_LINKS);\n this.menuLinks = header.querySelector(HeaderSelector.MENU_LINKS);\n const copySuffix = '-mobile';\n\n const toolsHtml = this.toolsLinks.innerHTML.replace(/ +/g, ' ');\n const menuHtml = this.menuLinks.innerHTML.replace(/ +/g, ' ');\n // Pour éviter de dupliquer des id, on ajoute un suffixe aux id et aria-controls duppliqués.\n let toolsHtmlIdList = toolsHtml.match(/id=\"(.*?)\"/gm) || [];\n\n // on a besoin d'échapper les backslash dans la chaine de caractère\n // eslint-disable-next-line no-useless-escape\n toolsHtmlIdList = toolsHtmlIdList.map(element => element.replace('id=\\\"', '').replace('\\\"', ''));\n\n const toolsHtmlAriaControlList = toolsHtml.match(/aria-controls=\"(.*?)\"/gm);\n let toolsHtmlDuplicateId = toolsHtml.replace(/id=\"(.*?)\"/gm, 'id=\"$1' + copySuffix + '\"');\n if (toolsHtmlAriaControlList) {\n for (const element of toolsHtmlAriaControlList) {\n const ariaControlsValue = element.replace('aria-controls=\"', '').replace('\"', '');\n if (toolsHtmlIdList.includes(ariaControlsValue)) {\n toolsHtmlDuplicateId = toolsHtmlDuplicateId.replace(`aria-controls=\"${ariaControlsValue}\"`, `aria-controls=\"${ariaControlsValue + copySuffix}\"`);\n };\n }\n }\n\n if (toolsHtmlDuplicateId === menuHtml) return;\n\n switch (api.mode) {\n case api.Modes.ANGULAR:\n case api.Modes.REACT:\n case api.Modes.VUE:\n this.warn(`header__tools-links content is different from header__menu-links content.\nAs you're using a dynamic framework, you should handle duplication of this content yourself, please refer to documentation:\n${api.header.doc}`);\n break;\n\n default:\n this.menuLinks.innerHTML = toolsHtmlDuplicateId;\n }\n }\n}\n\nexport { HeaderLinks };\n","import api from '../../api.js';\n\nclass HeaderModal extends api.core.Instance {\n static get instanceClassName () {\n return 'HeaderModal';\n }\n\n init () {\n this.isResizing = true;\n }\n\n resize () {\n if (this.isBreakpoint(api.core.Breakpoints.LG)) this.deactivateModal();\n else this.activateModal();\n }\n\n activateModal () {\n const modal = this.element.getInstance('Modal');\n if (!modal) return;\n modal.isEnabled = true;\n this.listenClick({ capture: true });\n }\n\n deactivateModal () {\n const modal = this.element.getInstance('Modal');\n if (!modal) return;\n modal.conceal();\n modal.isEnabled = false;\n this.unlistenClick({ capture: true });\n }\n\n handleClick (e) {\n if (e.target.matches('a, button') && !e.target.matches('[aria-controls]') && !e.target.matches(api.core.DisclosureSelector.PREVENT_CONCEAL)) {\n const modal = this.element.getInstance('Modal');\n modal.conceal();\n }\n }\n}\n\nexport { HeaderModal };\n","import api from './api.js';\nimport { HeaderLinks } from './script/header/header-links.js';\nimport { HeaderModal } from './script/header/header-modal.js';\nimport { HeaderSelector } from './script/header/header-selector.js';\n\napi.header = {\n HeaderLinks: HeaderLinks,\n HeaderModal: HeaderModal,\n HeaderSelector: HeaderSelector,\n doc: 'https://www.systeme-de-design.gouv.fr/elements-d-interface/composants/en-tete'\n};\n\nexport default api;\n","import api from './index.js';\n\napi.internals.register(api.header.HeaderSelector.TOOLS_LINKS, api.header.HeaderLinks);\napi.internals.register(api.header.HeaderSelector.MODALS, api.header.HeaderModal);\n\nexport default api;\n"],"names":[],"mappings":";;AAAA,MAAM,MAAM,GAAG;AACf,EAAE,MAAM,EAAE,IAAI;AACd,EAAE,SAAS,EAAE,MAAM;AACnB,EAAE,YAAY,EAAE,SAAS;AACzB,EAAE,OAAO,EAAE,QAAQ;AACnB,CAAC;;ACJD,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;;ACC7B,MAAM,cAAc,GAAG;AAC9B,EAAE,MAAM,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC;AAC7C,EAAE,WAAW,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;AAC/D,EAAE,UAAU,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;AAC7D,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;AAC5M,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC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