{"version":3,"sources":["webpack:///./app/components/m/accordion/index.js"],"names":["open","id","$","removeClass","collapse","collapsible","doTrack","action","Error","headerId","getAttribute","header","document","querySelector","label","eventTrackingData","eventtype","accordionitemtitle","innerText","accordioninteraction","track","on","e","target","closest","$panel","top","offset","anchorNav","length","height","animate","scrollTop","handleAnchor","window","location","hash","validHash","test","console","error","el"],"mappings":";;;;;;;;;;;AAAA;AAAA;AAA8D;;AAE9D;AACA;AACA;AACA;AACA;AACA,MAAMA,IAAI,GAAIC,EAAE,IAAK;EACnBC,CAAC,CAAC,gBAAgB,CAAC,CAACC,WAAW,CAAC,MAAM,CAAC;EACvCD,CAAC,CAACD,EAAE,CAAC,CAACG,QAAQ,CAAC,MAAM,CAAC;AACxB,CAAC;;AAED;AACA,MAAMC,WAAW,GAAGH,CAAC,CAAC,WAAW,CAAC;;AAElC;AACA;AACA;AACA;AACA;AACA,MAAMI,OAAO,GAAGA,CAACC,MAAM,EAAEF,WAAW,KAAK;EACvC;EACA,IAAIE,MAAM,KAAK,MAAM,IAAIA,MAAM,KAAK,OAAO,EAAE;IAC3C,MAAM,IAAIC,KAAK,CAAE,mBAAkBD,MAAO,gCAA+B,CAAC;EAC5E;EACA;EACA,MAAME,QAAQ,GAAGJ,WAAW,CAACK,YAAY,CAAC,iBAAiB,CAAC;EAC5D,MAAMC,MAAM,GAAGC,QAAQ,CAACC,aAAa,CAAE,IAAGJ,QAAS,EAAC,CAAC;EACrD,IAAIE,MAAM,KAAK,IAAI,EAAE;IACnB,MAAM,IAAIH,KAAK,CAAE,mBAAkBC,QAAS,aAAY,CAAC;EAC3D;;EAEA;EACA,MAAMK,KAAK,GAAGH,MAAM,CAACE,aAAa,CAAC,oBAAoB,CAAC;EACxD,IAAIC,KAAK,KAAK,IAAI,EAAE;IAClB,MAAM,IAAIN,KAAK,CAAE,6BAA4BC,QAAS,aAAY,CAAC;EACrE;;EAEA;EACA,MAAMM,iBAAiB,GAAG;IACxBC,SAAS,EAAE,sBAAsB;IAC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AC;;IAEvC;IACA,IAAIK,EAAE,KAAK,IAAI,EAAE;MACf;MACAzC,IAAI,CAACoC,IAAI,CAAC;IACZ;EACF;AACF;AACAH,YAAY,EAAE,C","file":"accordion.chunk.js","sourcesContent":["import { track } from '../../../core/js/libs/TrackingService';\r\n\r\n/**\r\n * Try to open the panel with the given id. This\r\n * will also close all other opened panels.\r\n * @param id\r\n */\r\nconst open = (id) => {\r\n $('.collapse.show').removeClass('show');\r\n $(id).collapse('show');\r\n};\r\n\r\n//\r\nconst collapsible = $('.collapse');\r\n\r\n/**\r\n *\r\n * @param action open | close\r\n * @param collapsible The collapsible HTMLElement\r\n */\r\nconst doTrack = (action, collapsible) => {\r\n // check if we received a valid action literal\r\n if (action !== 'open' && action !== 'close') {\r\n throw new Error(`Invalid action '${action}! Please use 'open' or 'close'`);\r\n }\r\n // try getting the header of the collapsible\r\n const headerId = collapsible.getAttribute('aria-labelledby');\r\n const header = document.querySelector(`#${headerId}`);\r\n if (header === null) {\r\n throw new Error(`Header with id '${headerId}' not found`);\r\n }\r\n\r\n // try getting the label of the collapsible\r\n const label = header.querySelector('.hdl-group .hdl--4');\r\n if (label === null) {\r\n throw new Error(`Label for header with id '${headerId}' not found`);\r\n }\r\n\r\n // create the data for the tracking event\r\n const eventTrackingData = {\r\n eventtype: 'accordionInteraction',\r\n accordionitemtitle: label.innerText,\r\n accordioninteraction: action,\r\n };\r\n\r\n // track it\r\n track(eventTrackingData);\r\n};\r\n\r\n/**\r\n *\r\n */\r\ncollapsible.on('shown.bs.collapse', function (e) {\r\n // profile-tile__card is card inside card and doesn't need scrolling animation\r\n if (!e.target.closest('.profile-tile__card')) {\r\n const $panel = $(this).closest('.card');\r\n let top = $panel.offset().top;\r\n const anchorNav = $('.anchor-nav');\r\n\r\n // if a anchor navigation are available on the page\r\n // add the height to the scroll position. So the header\r\n // of the accordion are not overlapped\r\n if (anchorNav.length > 0) {\r\n top -= $(anchorNav).height();\r\n }\r\n\r\n if (anchorNav)\r\n $('html,body').animate(\r\n {\r\n scrollTop: top,\r\n },\r\n 300\r\n );\r\n }\r\n\r\n // track that the collapsible was opened\r\n doTrack('open', this);\r\n});\r\n\r\n// check whether we have to handle an anchor\r\n// eg. do we have to scroll to an element on\r\n// this page?\r\nfunction handleAnchor() {\r\n if (window.location.hash.length > 0) {\r\n // get hash from url\r\n const hash = window.location.hash;\r\n const validHash = /^#[\\w\\-:]+$/.test(hash);\r\n\r\n if (!validHash) {\r\n console.error('Invalid hash:', hash);\r\n return;\r\n }\r\n\r\n // try getting the element we have to scroll to\r\n const el = document.querySelector(hash);\r\n\r\n // does the element exist?\r\n if (el !== null) {\r\n // ..open it\r\n open(hash);\r\n }\r\n }\r\n}\r\nhandleAnchor();\r\n"],"sourceRoot":""}