{"version":3,"file":"breadcrumb.module.min.js","sources":["../../../.config/config.js","../../../src/core/api.js","../../../src/component/breadcrumb/script/breadcrumb/breadcrumb-selector.js","../../../src/component/breadcrumb/script/breadcrumb/breadcrumb.js","../../../src/component/breadcrumb/index.js","../../../src/component/breadcrumb/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 BreadcrumbSelector = {\n BREADCRUMB: api.internals.ns.selector('breadcrumb'),\n BUTTON: api.internals.ns.selector('breadcrumb__button')\n};\n","import api from '../../api.js';\nimport { BreadcrumbSelector } from './breadcrumb-selector.js';\n\nclass Breadcrumb extends api.core.Instance {\n constructor () {\n super();\n this.count = 0;\n this.focusing = this.focus.bind(this);\n }\n\n static get instanceClassName () {\n return 'Breadcrumb';\n }\n\n init () {\n this.getCollapse();\n this.isResizing = true;\n }\n\n get proxy () {\n const scope = this;\n return Object.assign(super.proxy, {\n focus: scope.focus.bind(scope),\n disclose: scope.collapse.disclose.bind(scope.collapse)\n });\n }\n\n getCollapse () {\n const collapse = this.collapse;\n if (collapse) {\n collapse.listen(api.core.DisclosureEvent.DISCLOSE, this.focusing);\n } else {\n this.addAscent(api.core.DisclosureEmission.ADDED, this.getCollapse.bind(this));\n }\n }\n\n resize () {\n const collapse = this.collapse;\n const links = this.links;\n if (!collapse || !links.length) return;\n\n if (this.isBreakpoint(api.core.Breakpoints.MD)) {\n if (collapse.buttonHasFocus) links[0].focus();\n } else {\n if (links.indexOf(document.activeElement) > -1) collapse.focus();\n }\n }\n\n get links () {\n return [...this.querySelectorAll('a[href]')];\n }\n\n get collapse () {\n return this.element.getDescendantInstances(api.core.Collapse.instanceClassName, null, true)[0];\n }\n\n focus () {\n this.count = 0;\n this._focus();\n }\n\n _focus () {\n const link = this.links[0];\n if (!link) return;\n link.focus();\n this.request(this.verify.bind(this));\n }\n\n verify () {\n this.count++;\n if (this.count > 100) return;\n const link = this.links[0];\n if (!link) return;\n if (document.activeElement !== link) this._focus();\n }\n\n get collapsePrimary () {\n const buttons = this.element.children.map(child => child.getInstance('CollapseButton')).filter(button => button !== null && button.hasClass(BreadcrumbSelector.BUTTON));\n return buttons[0];\n }\n}\n\nexport { Breadcrumb };\n","import api from './api.js';\nimport { Breadcrumb } from './script/breadcrumb/breadcrumb.js';\nimport { BreadcrumbSelector } from './script/breadcrumb/breadcrumb-selector.js';\n\napi.breadcrumb = {\n BreadcrumbSelector: BreadcrumbSelector,\n Breadcrumb: Breadcrumb\n};\n\nexport default api;\n","import api from './index.js';\n\napi.internals.register(api.breadcrumb.BreadcrumbSelector.BREADCRUMB, api.breadcrumb.Breadcrumb);\n\nexport default api;\n"],"names":["api","window","BreadcrumbSelector","BREADCRUMB","internals","ns","selector","BUTTON","Breadcrumb","core","Instance","constructor","super","this","count","focusing","focus","bind","instanceClassName","init","getCollapse","isResizing","proxy","scope","Object","assign","disclose","collapse","listen","DisclosureEvent","DISCLOSE","addAscent","DisclosureEmission","ADDED","resize","links","length","isBreakpoint","Breakpoints","MD","buttonHasFocus","indexOf","document","activeElement","querySelectorAll","element","getDescendantInstances","Collapse","_focus","link","request","verify","collapsePrimary","children","map","child","getInstance","filter","button","hasClass","breadcrumb","register"],"mappings":";AAAA,MCCMA,EAAMC,OAAuB,KCCtBC,EAAqB,CAChCC,WAAYH,EAAII,UAAUC,GAAGC,SAAS,cACtCC,OAAQP,EAAII,UAAUC,GAAGC,SAAS,uBCDpC,MAAME,UAAmBR,EAAIS,KAAKC,SAChCC,cACEC,QACAC,KAAKC,MAAQ,EACbD,KAAKE,SAAWF,KAAKG,MAAMC,KAAKJ,MAGvBK,+BACT,MAAO,aAGTC,OACEN,KAAKO,cACLP,KAAKQ,YAAa,EAGhBC,YACF,MAAMC,EAAQV,KACd,OAAOW,OAAOC,OAAOb,MAAMU,MAAO,C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