{"version":3,"sources":["webpack:///./Scripts/Components/Vanilla/ExpandableContainer.js"],"names":["expandableContainerElem","document","getElementById","parentWrapperElem","closest","buttonText","translate","isExpanded","MAX_HEIGHT","setElemMaxHeight","elem","style","maxHeight","classList","toggle","clientHeight","add","readMoreButton","createElement","addEventListener","textContent","parentNode","insertBefore","nextSibling"],"mappings":"wGAEA,MAAMA,EAA0BC,SAASC,eAAe,wBACxD,GAAIF,EAAyB,CAC3B,MAAMG,EAAoBH,EAAwBI,QAChD,uBAEF,IAAIC,GAAaC,OAAU,2BACvBC,GAAa,EACjB,MAAMC,EAAa,IAQnB,SAASC,EAAiBC,GACxBA,EAAKC,MAAMC,UAAa,GAAEJ,MAC1BE,EAAKG,UAAUC,OAAO,gCACtBJ,EAAKG,UAAUC,OAAO,kCACtBX,EAAkBU,UAAUC,OAAO,6BACnCP,GAAa,CACd,CAED,GAAIP,EAAwBe,cAAgBP,EAAY,CACtDD,GAAa,EACbP,EAAwBa,UAAUG,IAAI,gCACtC,MAAMC,EAAiBhB,SAASiB,cAAc,UAC9CD,EAAeJ,UAAUG,IAAI,iBAC7BC,EAAeE,iBAAiB,SAAS,KApB3C,IAA4BT,EAqBnBH,GAKHE,EAAiBT,GACjBK,GAAaC,OAAU,2BACvBW,EAAeG,YAAcf,KA5BPK,EAsBHV,GArBlBW,MAAMC,UAAY,QACvBF,EAAKG,UAAUC,OAAO,kCACtBJ,EAAKG,UAAUC,OAAO,gCACtBX,EAAkBU,UAAUC,OAAO,6BACnCP,GAAa,EAkBTF,GAAaC,OAAU,2BACvBW,EAAeG,YAAcf,EAK9B,IAEHY,EAAeG,YAAcf,EAE7BL,EAAwBqB,WAAWC,aACjCL,EACAjB,EAAwBuB,YAE3B,CACF,C","file":"282.76721ec4.js","sourcesContent":["import { translate } from '../../Services/translation';\n\nconst expandableContainerElem = document.getElementById('expandable-container');\nif (expandableContainerElem) {\n const parentWrapperElem = expandableContainerElem.closest(\n 'div.category-header'\n );\n let buttonText = translate('category-page.read-more');\n let isExpanded = true;\n const MAX_HEIGHT = 108;\n function unsetElemMaxHeight(elem) {\n elem.style.maxHeight = 'unset';\n elem.classList.toggle('expandable-container--expanded');\n elem.classList.toggle('expandable-container--hidden');\n parentWrapperElem.classList.toggle('category-header--expanded');\n isExpanded = true;\n }\n function setElemMaxHeight(elem) {\n elem.style.maxHeight = `${MAX_HEIGHT}px`;\n elem.classList.toggle('expandable-container--hidden');\n elem.classList.toggle('expandable-container--expanded');\n parentWrapperElem.classList.toggle('category-header--expanded');\n isExpanded = false;\n }\n\n if (expandableContainerElem.clientHeight >= MAX_HEIGHT) {\n isExpanded = false;\n expandableContainerElem.classList.add('expandable-container--hidden');\n const readMoreButton = document.createElement('button');\n readMoreButton.classList.add('expand-button');\n readMoreButton.addEventListener('click', () => {\n if (!isExpanded) {\n unsetElemMaxHeight(expandableContainerElem);\n buttonText = translate('category-page.read-less');\n readMoreButton.textContent = buttonText;\n } else {\n setElemMaxHeight(expandableContainerElem);\n buttonText = translate('category-page.read-more');\n readMoreButton.textContent = buttonText;\n }\n });\n readMoreButton.textContent = buttonText;\n\n expandableContainerElem.parentNode.insertBefore(\n readMoreButton,\n expandableContainerElem.nextSibling\n );\n }\n}\n"],"sourceRoot":""}