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D,eDmBA,6BClB5BhB,GDkByD,CAAC,+BCftC/D,QAAQgF,IAC7B,MAAMC,EAAyBlD,MAAMC,KAAKP,SAAS7C,iBAAiB,IAAIoG,gBACxEjB,EAAgBzD,iBAAiB,oBAAsBC,IACnD,MAAM2E,EAAY3E,EAA8C4E,GAChEF,EAAuBjF,QAAQ,CAACoF,EAAW1E,KACvC0E,EAAU/F,UAAUC,OAAO,SAAUoB,IAAUwE,QAI/D,EDMIG,GAhBJ,MACI,MAAMpD,EAAUR,SAASzC,cAAc,2BACnCiD,GACiB,IAAIqD,qBAAqB,CAACC,EAASC,KAChDD,EAAQvF,QAAQsB,IACRA,EAAMmE,iBACN5D,EAAiB,YACjB2D,EAASE,UAAUzD,OAG5B,CAAC0D,UAAW,KACNnE,QAAQS,EAEzB,EAII2D,GAGA,MAAMC,EAASpE,SAASzC,cAA2B,eAC/C6G,GACA,IAAIxE,eAAe,KACfI,SAASqD,gBAAgBjF,MAAMQ,YAAY,sBAAuB,GAAGwF,EAAO1F,oBAC7EqB,QAAQqE,EAEnB","sources":["webpack://openproject-static-website/webpack/bootstrap","webpack://openproject-static-website/webpack/runtime/concatenation wrap","webpack://openproject-static-website/./webpack/javascripts/src/accordion-tabs.ts","webpack://openproject-static-website/./webpack/javascripts/src/count-up.ts","webpack://openproject-static-website/./webpack/javascripts/src/utils.ts","webpack://openproject-static-website/./webpack/javascripts/src/carousel-images.ts","webpack://openproject-static-website/./webpack/javascripts/home.ts","webpack://openproject-static-website/./webpack/javascripts/src/carousel-outside-indicators.ts"],"sourcesContent":["// The require scope\nconst __webpack_require__ = {};\n\n","// wrap a concatenated module body as a lazy, memoized accessor; mod is\n// set before the body runs so re-entrant calls (require cycles) observe\n// the partial exports like Node.js\n__webpack_require__.cw = (body) => {\n\tvar mod;\n\treturn () => {\n\t\tif (body) {\n\t\t\tvar fn = body;\n\t\t\tbody = 0;\n\t\t\tmod = { exports: {} };\n\t\t\tfn.call(mod.exports, mod, mod.exports);\n\t\t}\n\t\treturn mod.exports;\n\t};\n};","function initAccordionTabs(root: HTMLElement) {\n    const items = root.querySelectorAll<HTMLElement>('[data-accordion-tabs-item]');\n    const media = root.querySelectorAll<HTMLElement>('[data-accordion-tabs-media]');\n\n    let switching = false;\n\n    const activate = (index: string) => {\n        items.forEach(item => {\n            const active = item.dataset.accordionTabsItem === index;\n            item.classList.toggle('is-active', active);\n            // The open item can't be collapsed\n            item.querySelector('[data-bs-toggle=\"collapse\"]')?.setAttribute('aria-disabled', String(active));\n        });\n        media.forEach(image => {\n            const active = image.dataset.accordionTabsMedia === index;\n            image.classList.toggle('is-active', active);\n            image.hidden = !active;\n        });\n    };\n\n    const list = root.querySelector<HTMLElement>('.accordion-tabs__list');\n\n    const setOpen = (item: HTMLElement, open: boolean) => {\n        item.querySelector('.accordion-collapse')?.classList.toggle('show', open);\n        item.querySelector('[data-bs-toggle=\"collapse\"]')?.classList.toggle('collapsed', !open);\n    };\n\n    // Reserving the tallest open state keeps the page below from jumping when items of different height are opened\n    const reserveListHeight = () => {\n        if (!list || switching) return;\n\n        const current = [...items].find(item => item.classList.contains('is-active'));\n        list.classList.add('is-measuring');\n        list.style.removeProperty('--accordion-tabs-list-height');\n\n        let max = 0;\n        items.forEach(candidate => {\n            items.forEach(item => setOpen(item, item === candidate));\n            max = Math.max(max, list.offsetHeight);\n        });\n\n        items.forEach(item => setOpen(item, item === current));\n        // Flush the restored state so removing is-measuring doesn't start a font-size transition\n        void list.offsetHeight;\n        list.classList.remove('is-measuring');\n        list.style.setProperty('--accordion-tabs-list-height', `${max}px`);\n    };\n\n    root.addEventListener('show.bs.collapse', event => {\n        const item = (event.target as HTMLElement).closest<HTMLElement>('[data-accordion-tabs-item]');\n        if (!item) return;\n\n        switching = true;\n        activate(item.dataset.accordionTabsItem ?? '');\n    });\n\n    root.addEventListener('hide.bs.collapse', event => {\n        if (!switching) {\n            event.preventDefault();\n        }\n    });\n\n    root.addEventListener('shown.bs.collapse', () => {\n        switching = false;\n    });\n\n    if (list) {\n        let width = 0;\n        // Only width changes rewrap the text; height changes are caused by the reserved height itself\n        new ResizeObserver(([entry]) => {\n            if (entry.contentRect.width === width) return;\n            width = entry.contentRect.width;\n            reserveListHeight();\n        }).observe(list);\n        void document.fonts.ready.then(reserveListHeight);\n    }\n}\n\ndocument.addEventListener('DOMContentLoaded', () => {\n    document.querySelectorAll<HTMLElement>('[data-accordion-tabs]').forEach(initAccordionTabs);\n});\n","import {getRandomRangeInt} from './utils';\n\nexport function countUpAnimation(selectors: string) {\n    const animateCountUp = (element: HTMLElement) => {\n        const frameDuration = 1000 / 60;\n        const animationDuration = getRandomRangeInt(2000, 3000);\n        const totalFrames = Math.round(animationDuration / frameDuration);\n        // https://easings.net/\n        const easeOutQuad = (t: number) => t * (2 - t);\n        let frame = 0;\n        const countToDataStringArray = (element.dataset.count ?? '').split('');\n        const countToString = countToDataStringArray.filter(c => !Number.isNaN(c)).join('');\n        const countToUnit = countToDataStringArray.filter(c => Number.isNaN(c)).join('');\n        const countTo = Number(countToString) || 0;\n        let lastCount = 0;\n        const counter = setInterval(() => {\n            frame++;\n            const progress = easeOutQuad(frame / totalFrames);\n            const currentCount = Math.round(countTo * progress);\n            if (lastCount !== currentCount) {\n                element.innerHTML = `${currentCount}${countToUnit}`;\n            }\n            lastCount = currentCount;\n            if (frame === totalFrames) {\n                clearInterval(counter);\n            }\n        }, frameDuration);\n    };\n    Array.from(document.querySelectorAll<HTMLElement>(selectors)).forEach((element) => animateCountUp(element));\n}\n","export function loadJS(js: string, callback: () => void) {\n    const scriptElement = document.createElement('script');\n    scriptElement.src = `/assets/javascripts/${js}`;\n    scriptElement.type = 'text/javascript';\n    scriptElement.async = true;\n    scriptElement.addEventListener('load', function () {\n        callback();\n    });\n    document.body.append(scriptElement);\n}\n\nexport function getRandomRangeInt(min: number, max: number): number {\n    return min + Math.floor(Math.random() * max);\n}\n\nexport const formatMoney = (value: number, decPlaces: number, decSeparator: string, thouSeparator: string): string => {\n    decPlaces = Number.isNaN(Math.abs(decPlaces)) ? 2 : decPlaces;\n    decSeparator ??= '.';\n    thouSeparator ??= ',';\n    const sign = value < 0 ? '-' : '';\n    const number = Number.parseInt(Math.abs(value || 0).toFixed(decPlaces));\n    const numberString = String(number);\n    const numberStringLength = numberString.length;\n    let split = 0;\n    if (numberStringLength > 3) {\n        split = numberStringLength === 6 ? 3 : (numberStringLength % 3);\n    }\n    return sign +\n        (split ? numberString.slice(0, split) + thouSeparator : '') +\n        numberString.slice(split).replace(/(\\d{3})(?=\\d)/g, group => group + thouSeparator) +\n        (decPlaces ? decSeparator + Math.abs(value - number).toFixed(decPlaces).slice(2) : '');\n};\n\nexport function selectOption(selectElement: HTMLSelectElement, value: string | null | undefined) {\n    if (value !== undefined && value !== null) {\n        const opt = Array.from(selectElement.options).find(o => o.value === value);\n        if (opt) {\n            opt.selected = true;\n        }\n    }\n}\n\nexport function formatCurrency(value: number, currency: 'eur' | 'usd', country: string) {\n    const money = formatMoney(value, 2, country === 'de' ? ',' : '.', country === 'de' ? '.' : ',');\n    const sign = currency === 'usd' ? '$' : '€';\n    if (country === 'de' && currency === 'eur') {\n        return `${money}${sign}`;\n    }\n    return `${sign}${money}`;\n}\n\nexport function trackMatomoFormConversion(id?: string) {\n    // Matomo form conversion tracking https://developer.matomo.org/guides/form-analytics/reference\n    const paq = window._paq;\n    if (paq && id) {\n        paq.push(['FormAnalytics::trackFormConversion', '', id]);\n    }\n}\n\n","function carouselNormalization(carousels: Element[]) {\n    carousels.forEach((carouselElement) => {\n        // grab all slides for this carousel\n        const items: HTMLElement[] =  Array.from(carouselElement.querySelectorAll('.carousel-item'));\n        const heights: number[] = []; // create empty array to store height values\n        items.forEach(item => { // reset min-height\n            item.style.minHeight = '0';\n        });\n        items.forEach(item => { //add heights to array\n            const before = item.style.display;\n            item.style.display = 'block';\n            const height = Number(getComputedStyle(item, null).height.replace('px', ''));\n            item.style.display = before;\n            heights.push(height);\n        });\n        const minHeight = `${Math.max.apply(null, heights)}px`; // largest value\n        items.forEach(item => { // apply min-height to slides\n            item.style.minHeight = minHeight;\n        });\n    });\n}\n\n// we must wait for images to load, use windows.onload not document.DOMContentLoaded\nwindow.addEventListener('load', () => {\n    const carousels = Array.from(document.querySelectorAll('.carousel'))\n        .filter(carousel => !carousel.classList.contains('static-height'));\n    if (carousels.length > 0) {\n        carouselNormalization(carousels);\n        let previousWidth = window.innerWidth;\n        const resizeObserver = new ResizeObserver(() => {\n            if (window.innerWidth !== previousWidth) {\n                previousWidth = window.innerWidth;\n                carouselNormalization(carousels);\n            }\n        });\n        resizeObserver.observe(document.documentElement);\n        window.addEventListener('orientationchange', () => {\n            previousWidth = 0;\n            carouselNormalization(carousels);\n        });\n    }\n});\n","import './src/carousel-images';\nimport './src/accordion-tabs';\nimport {countUpAnimation} from './src/count-up';\nimport {supportOutsideCarouselIndicators} from './src/carousel-outside-indicators';\n\nfunction registerCountUpAnimation() {\n    const element = document.querySelector('.home-bubbles-container');\n    if (element) {\n        const observer = new IntersectionObserver((entries, observer) => {\n            entries.forEach(entry => {\n                if (entry.isIntersecting) {\n                    countUpAnimation('.countUp');\n                    observer.unobserve(element);\n                }\n            });\n        }, {threshold: 0.1});\n        observer.observe(element);\n    }\n}\n\ndocument.addEventListener('DOMContentLoaded', function () {\n    supportOutsideCarouselIndicators('home-testimonial-carousel', ['home-testimonial-indicators']);\n    registerCountUpAnimation();\n\n    // Keep the banner's height in a CSS variable so the header and hero make room for wrapped text\n    const banner = document.querySelector<HTMLElement>('.top-banner');\n    if (banner) {\n        new ResizeObserver(() => {\n            document.documentElement.style.setProperty('--top-banner-height', `${banner.offsetHeight}px`);\n        }).observe(banner);\n    }\n});\n","export function supportOutsideCarouselIndicators(carouselId: string, carouselIndicatorClasses: string[]): void {\n    // carousel indicators outside of bootstrap carousel node are not set active/inactive\n    const carouselElement = document.getElementById(carouselId);\n    if (!carouselElement) {\n        return;\n    }\n    carouselIndicatorClasses.forEach(carouselIndicatorClass => {\n        const homeCarouselIndicators = Array.from(document.querySelectorAll(`.${carouselIndicatorClass} li button`));\n        carouselElement.addEventListener('slide.bs.carousel', (event) => {\n            const index_to = (event as unknown as bootstrap.Carousel.Event).to;\n            homeCarouselIndicators.forEach((indicator, index) => {\n                indicator.classList.toggle('active', index === index_to);\n            });\n        });\n    });\n}\n"],"names":["__webpack_require__","body","mod","fn","exports","call","initAccordionTabs","root","items","querySelectorAll","media","switching","list","querySelector","setOpen","item","open","_a","classList","toggle","_b","reserveListHeight","current","find","contains","add","style","removeProperty","max","forEach","candidate","Math","offsetHeight","remove","setProperty","addEventListener","event","target","closest","index","dataset","accordionTabsItem","active","setAttribute","String","image","accordionTabsMedia","hidden","preventDefault","width","ResizeObserver","entry","contentRect","observe","document","fonts","ready","then","countUpAnimation","selectors","Array","from","element","frameDuration","animationDuration","floor","random","totalFrames","round","frame","countToDataStringArray","count","split","countToString","filter","c","Number","isNaN","join","countToUnit","countTo","lastCount","counter","setInterval","progress","t","currentCount","innerHTML","clearInterval","animateCountUp","carouselNormalization","carousels","carouselElement","heights","minHeight","before","display","height","getComputedStyle","replace","push","apply","window","carousel","length","previousWidth","innerWidth","documentElement","getElementById","carouselIndicatorClass","homeCarouselIndicators","index_to","to","indicator","supportOutsideCarouselIndicators","IntersectionObserver","entries","observer","isIntersecting","unobserve","threshold","registerCountUpAnimation","banner"],"sourceRoot":""}