{"version":3,"file":"link-list-with-mobile-dropdown.js","sources":["../../../../src/assets/scripts/link-list-with-mobile-dropdown.entry.js"],"sourcesContent":["window.arjoLinkListWithMobileDropdownModule =\n window.arjoLinkListWithMobileDropdownModule ||\n (() => {\n const state = {\n isInitialized: false,\n elements: {},\n };\n\n const selector = '.arjo-m-link-list-mobile-dropdown';\n const customEventName = 'linkListMobileDropdownExpanded';\n\n const setUp = () => {\n const els = [...document.querySelectorAll(selector)];\n els.forEach((el) => {\n const id = el.dataset.dropdownId;\n if (!id) return;\n const dropdown = el.querySelector(`${selector}__list`);\n state.elements[id] = (() => {\n const collapse = () => {\n dropdown.removeAttribute('expanded');\n };\n const clickHandler = () => {\n dropdown.toggleAttribute('expanded');\n if (dropdown.hasAttribute('expanded')) {\n const customEvent = new CustomEvent(customEventName, {\n detail: {\n dropdownId: id,\n },\n });\n window.dispatchEvent(customEvent);\n }\n };\n el.querySelector(`${selector}__toggle`).addEventListener('click', clickHandler);\n\n return { collapse };\n })();\n });\n\n const customEventHandler = (e) => {\n Object.keys(state.elements).forEach((key) => {\n if (state.elements[key] && key != e.detail.dropdownId) state.elements[key].collapse();\n });\n };\n window.addEventListener(customEventName, customEventHandler);\n };\n const init = () => {\n if (state.isInitialized) return;\n setUp();\n state.isInitialized = true;\n };\n return { init };\n })();\n\nwindow.addEventListener('load', window.arjoLinkListWithMobileDropdownModule.init);\n"],"names":["state","selector","customEventName","setUp","el","id","dropdown","collapse","clickHandler","customEvent","customEventHandler","e","key"],"mappings":"AAAA,OAAO,qCACL,OAAO,uCACN,IAAM,CACL,MAAMA,EAAQ,CACZ,cAAe,GACf,SAAU,CAAE,CAClB,EAEUC,EAAW,oCACXC,EAAkB,iCAElBC,EAAQ,IAAM,CACN,CAAC,GAAG,SAAS,iBAAiBF,CAAQ,CAAC,EAC/C,QAASG,GAAO,CAClB,MAAMC,EAAKD,EAAG,QAAQ,WACtB,GAAI,CAACC,EAAI,OACT,MAAMC,EAAWF,EAAG,cAAc,GAAGH,CAAQ,QAAQ,EACrDD,EAAM,SAASK,CAAE,GAAK,IAAM,CAC1B,MAAME,EAAW,IAAM,CACrBD,EAAS,gBAAgB,UAAU,CAC/C,EACgBE,EAAe,IAAM,CAEzB,GADAF,EAAS,gBAAgB,UAAU,EAC/BA,EAAS,aAAa,UAAU,EAAG,CACrC,MAAMG,EAAc,IAAI,YAAYP,EAAiB,CACnD,OAAQ,CACN,WAAYG,CACb,CACjB,CAAe,EACD,OAAO,cAAcI,CAAW,CACjC,CACb,EACU,OAAAL,EAAG,cAAc,GAAGH,CAAQ,UAAU,EAAE,iBAAiB,QAASO,CAAY,EAEvE,CAAE,SAAAD,CAAQ,CAC3B,IACA,CAAO,EAED,MAAMG,EAAsBC,GAAM,CAChC,OAAO,KAAKX,EAAM,QAAQ,EAAE,QAASY,GAAQ,CACvCZ,EAAM,SAASY,CAAG,GAAKA,GAAOD,EAAE,OAAO,YAAYX,EAAM,SAASY,CAAG,EAAE,SAAQ,CAC7F,CAAS,CACT,EACM,OAAO,iBAAiBV,EAAiBQ,CAAkB,CACjE,EAMI,MAAO,CAAE,KALI,IAAM,CACbV,EAAM,gBACVG,IACAH,EAAM,cAAgB,GAC5B,CACiB,CACjB,KAEA,OAAO,iBAAiB,OAAQ,OAAO,qCAAqC,IAAI"}