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AU,aAIdN,OAAOC,uBAAsB,IAAMD,OAAOO,SAAS,CAC/CJ,IAAKL,EAAQM,wBAAwBD,IAAMH,OAAOK,QAAU,GAC5DC,SAAU,YAElB,GACD,IAAI,EAGX7B,EAAiBF,SAASK,IACHA,EAAgBG,cAAc,qCACtCyB,iBAAiB,SAAS,KACjC7B,EAAgBC,EAAgB,GAClC,GACJ,GACJ,C","sources":["webpack:///./wwwroot/js/extensionCard.ts"],"sourcesContent":["import { isLargeScreen, isMediumScreen } from './utils';\n/**\n * Function to handle extension card behavior.\n *\n * @param {ExtensionCardConfig} config - The configuration object for extension card behavior.\n */\nexport const extensionCard = (config) => {\n const cardContainers = document.querySelectorAll('.extension-card__container');\n const cardDescriptionsCollection = document.querySelectorAll('.extension__card-description');\n cardContainers.forEach((cardContainer) => {\n const cardDescriptions = cardContainer.querySelectorAll('.extension__card-description');\n // this is used to add sticky class to cards on larger screens\n const cards = cardContainer.querySelectorAll('.extension__card');\n /**\n * Closes all the cards by reducing the height of the card description and changing the show more button text.\n */\n const closeCards = () => {\n cardDescriptionsCollection.forEach((cardDescription) => {\n const textContent = cardDescription.querySelector('.extension-card__description-text');\n const showMoreButton = cardDescription.querySelector('.extension-card__description-more');\n if (!textContent.classList.contains(config.twMaxHClass)) {\n // Close the card\n textContent.classList.add(config.twMaxHClass);\n textContent.style.maxHeight = config.maxHeight;\n cardDescription.classList.remove('active');\n }\n showMoreButton.textContent = config.showMoreText;\n });\n };\n /**\n * Handle the accordion behavior of extension cards.\n * @param {HTMLDivElement} cardDescription - The card description that gonna be opened as accordion. Mainly used in the homepage Estensioni: aggiungi? section. where the card description is partially visible of two lines and when the user clicks on \"Read More\" button, the card description will be opened as accordion. The readmore button will be changed to \"Show Less\" and the card description will be fully visible.\n */\n const handleAccordion = (cardDescription) => {\n if (cardDescription.classList.contains('active')) {\n // If the card is active, close it\n const showMoreButton = cardDescription.querySelector('.extension-card__description-more');\n showMoreButton.textContent = config.showMoreText;\n const cardDescriptionText = cardDescription.querySelector('.extension-card__description-text');\n cardDescriptionText.style.maxHeight = config.maxHeight;\n cardDescriptionText.classList.add(config.twMaxHClass);\n cardDescription.classList.remove('active');\n }\n else {\n // If the card is not active, close other cards and open the selected one\n closeCards();\n const showMoreButton = cardDescription.querySelector('.extension-card__description-more');\n showMoreButton.textContent = config.showLessText;\n const cardDescriptionText = cardDescription.querySelector('.extension-card__description-text');\n const cardContentHeight = cardDescriptionText.scrollHeight;\n cardDescriptionText.style.maxHeight = `${cardContentHeight + 32}px`;\n cardDescriptionText.classList.remove(config.twMaxHClass);\n // Add sticky class to cards on larger screens\n if (isMediumScreen()) {\n cards.forEach((card) => {\n card.classList.add('lg:sticky', 'top-28');\n });\n }\n cardDescription.classList.add('active');\n }\n // Scroll to the active card\n setTimeout(() => {\n const element = cardDescription.closest('.extension__card');\n const headerHeight = 150;\n if (isLargeScreen()) {\n window.requestAnimationFrame(() => window.scroll({\n top: element.getBoundingClientRect().top +\n window.scrollY -\n headerHeight,\n behavior: 'smooth',\n }));\n }\n else {\n window.requestAnimationFrame(() => window.scrollTo({\n top: element.getBoundingClientRect().top + window.scrollY - 10,\n behavior: 'smooth',\n }));\n }\n }, 251);\n };\n // Attach click event listeners to \"Read More\" buttons\n cardDescriptions.forEach((cardDescription) => {\n const moreButton = cardDescription.querySelector('.extension-card__description-more');\n moreButton.addEventListener('click', () => {\n handleAccordion(cardDescription);\n });\n });\n });\n};\n"],"names":["extensionCard","config","cardContainers","document","querySelectorAll","cardDescriptionsCollection","forEach","cardContainer","cardDescriptions","cards","handleAccordion","cardDescription","classList","contains","querySelector","textContent","showMoreText","cardDescriptionText","style","maxHeight","add","twMaxHClass","remove","showMoreButton","showLessText","cardContentHeight","scrollHeight","card","setTimeout","element","closest","window","requestAnimationFrame","scroll","top","getBoundingClientRect","scrollY","behavior","scrollTo","addEventListener"],"sourceRoot":""}