{"version":3,"sources":["page-intro.js"],"names":["document","addEventListener","checkInstances","querySelectorAll","forEach","el","updateVisibility","desc","querySelector","descContent","readMore","offsetHeight","classList","add","setTimeout","remove","viewport","resize","Soho","plugins","delegate","e","pageIntro","target","closest"],"mappings":"AAAAA,SAASC,iBAAiB,oBAAoB,WAE1C,IAAMC,EAAiB,WACnBF,SAASG,iBAAiB,eAAeC,SAAQ,SAAAC,GAC7CC,EAAiBD,EACrB,GACJ,EAGMC,EAAmB,SAACD,GACtB,IAAME,EAAOF,EAAGG,cAAc,qBACxBC,EAAcJ,EAAGG,cAAc,6BAC/BE,EAAWL,EAAGG,cAAc,0BAE9BD,GAAQE,GAAeC,IACnBD,EAAYE,aAAeJ,EAAKI,cAChCD,EAASE,UAAUC,IAAI,iCAEvBC,YAAW,WACPJ,EAASE,UAAUC,IAAI,8BAC3B,GAAG,OAEHH,EAASE,UAAUG,OAAO,iCAC1BL,EAASE,UAAUG,OAAO,gCAGtC,EAGAb,IAEAc,SAASC,QAAO,WACZf,GACJ,IAGAgB,KAAKC,QAAQC,SAASpB,SAAU,QAAS,iCAAiC,SAACqB,GACvE,IAAMC,EAAYD,EAAEE,OAAOC,QAAQ,eAC7BjB,EAAOe,aAAS,EAATA,EAAWd,cAAc,8BAChCE,EAAWY,aAAS,EAATA,EAAWd,cAAc,0BAEtCD,GAAQG,IACRH,EAAKK,UAAUG,OAAO,6BACtBL,EAASK,SAEjB,GACJ","file":"../../javascript/page-intro.js","sourcesContent":["document.addEventListener('DOMContentLoaded', () => {\n\n    const checkInstances = () => {\n        document.querySelectorAll('.page-intro').forEach(el => {\n            updateVisibility(el)\n        });\n    }\n\n    // We should only show the button if the height of the description content is greater than that of the description\n    const updateVisibility = (el) => {\n        const desc = el.querySelector('.page-intro__desc');\n        const descContent = el.querySelector('.page-intro__desc-content');\n        const readMore = el.querySelector('.page-intro__read-more');\n\n        if (desc && descContent && readMore) {\n            if (descContent.offsetHeight > desc.offsetHeight) {\n                readMore.classList.add('page-intro__read-more--active');\n\n                setTimeout(() => {\n                    readMore.classList.add('page-intro__read-more--show');\n                }, 100);\n            } else {\n                readMore.classList.remove('page-intro__read-more--active');\n                readMore.classList.remove('page-intro__read-more--show');\n            }\n        }\n    }\n\n    // Check each page-intro to determine if the read more button needs to be shown or not\n    checkInstances();\n\n    viewport.resize(() => {\n        checkInstances();\n    });\n\n    // Listen to click event on the page-intro read more button\n    Soho.plugins.delegate(document, 'click', '.page-intro__read-more button', (e) => {\n        const pageIntro = e.target.closest('.page-intro');\n        const desc = pageIntro?.querySelector('.page-intro__desc--compact');\n        const readMore = pageIntro?.querySelector('.page-intro__read-more');\n\n        if (desc && readMore) {\n            desc.classList.remove('page-intro__desc--compact');\n            readMore.remove();\n        }\n    });\n});\n"],"sourceRoot":"../../../../resources/javascript"}