{"version":3,"file":"main.min.js","sources":["../../../Frontend/js/utils/onReady.js","../../../Frontend/js/utils/scroll.js","../../../Frontend/js/utils/lazyImage.js","../../../Frontend/js/utils/helpers.js","../../../Frontend/js/utils/scrollTo.js","../../../Frontend/js/utils/elementProperties.js","../../../Frontend/js/components/anchors.js","../../../Frontend/js/main.js"],"sourcesContent":["/**\r\n * Handler to trigger callbacks once the browser is ready for them.\r\n *\r\n * You can keep adding references using onReady() even after the page is loaded. In that case they will be\r\n * run at once.\r\n *\r\n * @example\r\n * import { onReady } from './utils/events/onReady';\r\n *\r\n * onReady(yourFunctionHere);\r\n *\r\n */\r\n\r\nlet functionReferences = [];\r\n\r\n// Set the initial readyState based on the browser's current state. If the script has been loaded\r\n// asynchronously, the DOM might be ready for us already, in which case there's no reason to delay\r\n// any further processing. The following will evaluate as true if the DOM is ready, or the page is\r\n// complete.\r\nlet readyState = document.readyState === 'interactive' || document.readyState === 'complete';\r\n\r\n// Defines whether or not the window.onReady event has been bound, so we won't do it twice. That\r\n// would just be stupid.\r\nlet readyEventBound = false;\r\n\r\n/**\r\n * Run the given array of callback functions.\r\n *\r\n * @private\r\n * @param {Array} funcArray\r\n */\r\nfunction runFunctionArray(funcArray) {\r\n funcArray.forEach(funcRef => funcRef());\r\n}\r\n\r\n/**\r\n * Empty the callback arrays\r\n *\r\n * @private\r\n */\r\nfunction emptyCallbackArrays() {\r\n // Keep iterating through the function references until there are none left.\r\n while (functionReferences.length) {\r\n // Set up a temporary array that mirrors the list of callbacks, and empty the real one.\r\n const tempArray = functionReferences.slice(0);\r\n functionReferences = [];\r\n\r\n // Run the callbacks. The callbacks themselves may set up more callbacks, which\r\n // is why we keep looping the array until we're done.\r\n runFunctionArray(tempArray);\r\n }\r\n\r\n // At this point we'll assume we're ready for anything!\r\n readyState = true;\r\n}\r\n\r\n/**\r\n * Make sure the \"ready\"-event is set.\r\n *\r\n * @private\r\n */\r\nfunction bindReadyEvent() {\r\n if (!readyEventBound) {\r\n if (document.readyState === 'loading') {\r\n // loading yet, wait for the event\r\n document.addEventListener('DOMContentLoaded', emptyCallbackArrays);\r\n } else {\r\n // DOM is ready!\r\n emptyCallbackArrays();\r\n }\r\n\r\n readyEventBound = true;\r\n }\r\n}\r\n\r\n/**\r\n * Register a function to run when the page is ready.\r\n *\r\n * @param {Function} functionReference - The function you want to run.\r\n */\r\nexport function onReady(functionReference) {\r\n if (typeof functionReference === 'function') {\r\n if (readyState) {\r\n functionReference();\r\n } else {\r\n bindReadyEvent();\r\n\r\n functionReferences.push(functionReference);\r\n }\r\n }\r\n}\r\n","export let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;\r\n\r\nlet ticking = false;\r\nconst scrollFunctions = [];\r\n\r\nfunction animate() {\r\n scrollFunctions.forEach(funcRef => funcRef());\r\n\r\n ticking = false;\r\n}\r\n\r\nfunction requestTick() {\r\n if (!ticking) {\r\n requestAnimationFrame(animate);\r\n ticking = true;\r\n }\r\n}\r\n\r\nfunction scrollHandler() {\r\n scrollTop = document.documentElement.scrollTop || document.body.scrollTop;\r\n requestTick();\r\n}\r\n/**\r\n * Adds a function to a function array, executed on a single scroll-event set on window.\r\n * This avoids the memory load and possible hickups of setting multiple eventlisteners for the same event.\r\n * Also this optimizes rendering by utilising the requestAnimationFrame for these scroll-events.\r\n * \r\n * @param {Function} handler - function to be called on scroll \r\n * @param {boolean} triggerNow - Should the function be called at once\r\n */\r\nexport function onScroll(handler, triggerNow = false) {\r\n // if first call: setup eventlistener on window\r\n !scrollFunctions.length ? initScroll() : null;\r\n\r\n // Trigger function\r\n triggerNow ? handler() : null;\r\n\r\n scrollFunctions.push(handler); \r\n}\r\n\r\nexport function initScroll() {\r\n window.addEventListener('scroll', scrollHandler);\r\n}\r\n","import { breakpointKeys, currentBreakpointIndex } from '../utils/windowResize';\r\nimport { onWindowResize } from './windowResize';\r\nimport { onScroll } from './scroll';\r\n//import \"objectFitPolyfill\";\r\n\r\nexport const isBot = (!('onscroll' in window)) || (typeof navigator !== 'undefined' && /(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent));\r\n\r\nlet lastUsedScreenWidth;\r\nlet lazyArray = [];\r\n\r\nlet options = {\r\n className: 'lazy',\r\n loadedClass: 'lazy--loaded',\r\n loadClass: 'lazy--loading',\r\n decodeImg: true, // This option requires promises support (incl. via polyfill.io)\r\n oldIe11Fit: false, // This option requires objectFit support\r\n offset: 0\r\n};\r\n\r\nexport function setupLazyLoading(customOptions = {}) {\r\n lastUsedScreenWidth = -1;\r\n options = { ...options, ...customOptions };\r\n lazyArray = document.body.getElementsByClassName(options.className);\r\n\r\n // onWindowsResize set before first lazyLoad, to insure currentBreakPoint is set\r\n onWindowResize(lazyLoad);\r\n\r\n onScroll(lazyLoad, true);\r\n}\r\n\r\nfunction lazyLoad() {\r\n // If our current screen mode does not match the one we used the last time we made an image lookup,\r\n // perform a new one now. Otherwise, what would be the point?\r\n\r\n if (isBot || lastUsedScreenWidth < currentBreakpointIndex) {\r\n\r\n for (let i = 0; i < lazyArray.length; i++) {\r\n const lazyElem = lazyArray[i];\r\n\r\n if (isBot || isInViewport(lazyElem)) {\r\n lazyElem.classList.add(options.loadClass);\r\n if (lazyElem.classList.contains('lazy--bg')) {\r\n loadBgImage(lazyElem);\r\n } else {\r\n loadLazyImage(lazyElem);\r\n }\r\n }\r\n }\r\n\r\n cleanLazy();\r\n }\r\n}\r\n\r\nfunction cleanLazy() {\r\n lazyArray = Array.prototype.filter.call(lazyArray, l => !l.classList.contains(options.loadClass));\r\n}\r\n\r\nfunction isInViewport(el) {\r\n const rect = el.getBoundingClientRect();\r\n\r\n return (\r\n rect.bottom >= 0 &&\r\n rect.right >= 0 &&\r\n rect.top - options.offset <= (window.innerHeight || document.documentElement.clientHeight) &&\r\n rect.left - options.offset <= (window.innerWidth || document.documentElement.clientWidth)\r\n );\r\n}\r\n\r\n/**\r\n * This function gets the image wrapper data attributes src and alt text\r\n * and creates an new image tag to download the image.\r\n * It then uses the src as a background-image.\r\n *\r\n * @param {HTMLElement} bgContainer - Image wrapper element\r\n */\r\nexport function loadBgImage(bgContainer) {\r\n const src = getImageSrc(bgContainer);\r\n const handleLoadedBg = () => {\r\n bgContainer.style.backgroundImage = formattedSrc;\r\n bgContainer.classList.add(options.loadedClass);\r\n bgContainer.classList.remove(options.loadClass);\r\n };\r\n\r\n // If no usable source was returned, abort at once.\r\n if (!src) {\r\n return;\r\n }\r\n\r\n const formattedSrc = `url(${src})`;\r\n\r\n if (bgContainer.style.backgroundImage === formattedSrc) {\r\n return;\r\n }\r\n\r\n if (options.decodeImg) {\r\n // Start loading the new image.\r\n loadImage(src).then(handleLoadedBg);\r\n } else {\r\n handleLoadedBg();\r\n }\r\n}\r\n\r\n/**\r\n * This function gets the container data attributes src.\r\n * If the container is an image it sets the src of it.\r\n * If the container is not an image it creates a new image tag and inserts it into the given container.\r\n *\r\n * @param {HTMLElement} container - Image wrapper element\r\n */\r\nexport function loadLazyImage(container) {\r\n const src = getImageSrc(container);\r\n\r\n // If no usable source was returned, abort mission.\r\n if (!src) {\r\n return;\r\n }\r\n\r\n if (options.decodeImg) {\r\n // We don't want to start processing if the new URL matches the old one.\r\n const oldImage = container.querySelector('img');\r\n if (oldImage && container.classList.contains(options.loadedClass)) {\r\n if (oldImage.getAttribute('src') === src) {\r\n if (options.oldIe11Fit) {\r\n window.objectFitPolyfill(oldImage);\r\n }\r\n return;\r\n } else {\r\n container.removeChild(oldImage);\r\n }\r\n }\r\n\r\n // Start loading the new image.\r\n loadImage(src).then(newImageTag => {\r\n // Set src and ALT text if defined.\r\n if (container.tagName === 'IMG') {\r\n container.src = src;\r\n } else {\r\n const altText = container.getAttribute('data-alt') || '';\r\n newImageTag.setAttribute('alt', altText);\r\n\r\n container.appendChild(newImageTag);\r\n }\r\n\r\n container.classList.add(options.loadedClass);\r\n container.classList.remove(options.loadClass);\r\n\r\n // oldIE object-fit polyfill placed here to take resize into account\r\n if (options.oldIe11Fit) {\r\n window.objectFitPolyfill(newImageTag);\r\n }\r\n });\r\n } else {\r\n container.src = src;\r\n container.classList.add(options.loadedClass);\r\n container.classList.remove(options.loadClass);\r\n }\r\n}\r\n\r\n/**\r\n * Try to decode the image, after it's loaded, and resolve the Promise.\r\n *\r\n * @param {Element} newImage\r\n * @returns {Promise}\r\n */\r\nfunction decodeImage(newImage) {\r\n return 'decode' in newImage ? newImage.decode().then(() => newImage) : Promise.resolve(newImage);\r\n}\r\n\r\n/**\r\n * Load an image, and return a Promise that resolves once the image is loaded.\r\n *\r\n * @param {string} path\r\n * @returns {Promise} Promise that will resolve with the loaded image once it's ready.\r\n */\r\nexport function loadImage(path) {\r\n const newImage = new Image();\r\n\r\n return new Promise(resolve => {\r\n newImage.addEventListener('load', () => decodeImage(newImage).then(image => resolve(image)), false);\r\n newImage.src = path;\r\n });\r\n}\r\n\r\n/**\r\n * This function gets the data-src from the image wrapper, based on width of the browser window.\r\n *\r\n * @param {HTMLElement} container - Image wrapper element\r\n * @returns {string}\r\n */\r\nfunction getImageSrc(container) {\r\n let src = '';\r\n let largestBreakpointFound = 0;\r\n\r\n if (container.getAttribute('data-src')) {\r\n src = container.getAttribute('data-src');\r\n container.removeAttribute('data-src');\r\n } else {\r\n breakpointKeys.forEach((breakpointName, index) => {\r\n if (currentBreakpointIndex >= index) {\r\n if (index === 0 || index > largestBreakpointFound) {\r\n const srcAttribute = `data-src-${breakpointName}`;\r\n src = container.getAttribute(srcAttribute) || src;\r\n\r\n container.removeAttribute(srcAttribute);\r\n\r\n // Make sure we won't set the size to a smaller breakpoint later, in case they're not properly ordered.\r\n largestBreakpointFound = index;\r\n }\r\n }\r\n });\r\n }\r\n\r\n return src;\r\n}\r\n","export const body = document.body;\r\nexport const qs = (s, o = body) => o.querySelector(s);\r\nexport const qsa = (s, o = body) => o.querySelectorAll(s);\r\n\r\nexport const allowStatCookies = window.CookieInformation && CookieInformation.getConsentGivenFor('cookie_cat_statistic');\r\n\r\n/**\r\n * Sets a custom CSS variable to ensure precise vh unit mesuarment\r\n *\r\n */\r\n\r\nexport function setVhProp() {\r\n // First we get the viewport height and we multiple it by 1% to get a value for a vh unit\r\n const vh = window.innerHeight * 0.01;\r\n // Then we set the value in the --vh custom property to the root of the document\r\n document.documentElement.style.setProperty('--vh', `${vh}px`);\r\n}\r\n\r\nexport function initVhUnitOverwrite() {\r\n setVhProp();\r\n window.addEventListener('resize', setVhProp);\r\n}\r\n\r\nexport function canUseWebP() {\r\n const elem = document.createElement('canvas');\r\n\r\n if (elem.getContext && elem.getContext('2d')) {\r\n // was able or not to get WebP representation\r\n return elem.toDataURL('image/webp').indexOf('data:image/webp') === 0;\r\n }\r\n\r\n // very old browser like IE 8, canvas not supported\r\n return false;\r\n}\r\n\r\n/**\r\n * Add a to the head\r\n */\r\nexport function addPrefetch(kind, url, as) {\r\n const linkElem = document.createElement('link');\r\n linkElem.rel = kind;\r\n linkElem.href = url;\r\n if (as) {\r\n linkElem.as = as;\r\n }\r\n linkElem.crossorigin = true;\r\n document.head.append(linkElem);\r\n}\r\n\r\n/**\r\n * Format number sparated with commas per thousand.\r\n *\r\n * @param {Number} num - Number you want to format\r\n *\r\n * @returns {string} - Returns the number formatet with commas\r\n *\r\n * @example:\r\n * console.info(formatNumber(2665)) // 2,665\r\n * console.info(formatNumber(102665)) // 102,665\r\n * console.info(formatNumber(1240.5)) // 1,240.5\r\n */\r\n\r\nexport function formatNumber(num, seperator = '.') {\r\n return num.toString().replace(/(\\d)(?=(\\d{3})+(?!\\d))/g, `$1${seperator}`);\r\n}\r\n\r\n/**\r\n * Prevent function from being executed as long as it is invoked, while given delay hasn't passed.\r\n *\r\n * @param {Function} callback Callback\r\n * @param {String} delay Delay\r\n * @return {Function} Callback\r\n */\r\nexport function debounce(callback, delay) {\r\n let timer = null;\r\n\r\n return function () {\r\n const context = this,\r\n args = arguments;\r\n\r\n clearTimeout(timer);\r\n\r\n timer = setTimeout(function () {\r\n callback.apply(context, args);\r\n }, delay);\r\n };\r\n}\r\n\r\n/*\r\n* Load JavsScript asynchronously when needed\r\n* @param {String} source The path to the file\r\n* @param {Function} callback The callback to excecute upon load\r\n* @return {Element} Element to attach\r\n*/\r\nexport function loadJS (source, callback) {\r\n const reference = document.getElementsByTagName('script')[0];\r\n const script = document.createElement('script');\r\n\r\n script.src = source;\r\n script.async = true;\r\n reference.parentNode.insertBefore(script, reference);\r\n\r\n if (callback && typeof(callback) === 'function') {\r\n script.onload = callback;\r\n }\r\n\r\n return script;\r\n}\r\n\r\n/**\r\n * Get the thumbnail dimensions to use for a given player size.\r\n *\r\n * @param {Object} options\r\n * @param {number} options.width The width of the player\r\n * @param {number} options.height The height of the player\r\n * @return {Object} The width and height\r\n */\r\nexport function getRoundedDimensions({ width, height }) {\r\n let roundedWidth = width;\r\n let roundedHeight = height;\r\n\r\n // If the original width is a multiple of 320 then we should\r\n // not round up. This is to keep the native image dimensions\r\n // so that they match up with the actual frames from the video.\r\n //\r\n // For example 640x360, 960x540, 1280x720, 1920x1080\r\n //\r\n // Round up to nearest 100 px to improve cacheability at the\r\n // CDN. For example, any width between 601 pixels and 699\r\n // pixels will render the thumbnail at 700 pixels width.\r\n if (roundedWidth % 320 !== 0) {\r\n roundedWidth = Math.ceil(width / 100) * 100;\r\n roundedHeight = Math.round((roundedWidth / width) * height);\r\n }\r\n\r\n return {\r\n width: roundedWidth,\r\n height: roundedHeight\r\n };\r\n}\r\n\r\n/**\r\n * Detect if a device as touch support\r\n *\r\n * 'ontouchstart' in window - works on most browsers\r\n * navigator.maxTouchPoints - works on IE10/11 and Surface\r\n */\r\nexport function isTouchDevice() {\r\n return !!('ontouchstart' in window || navigator.maxTouchPoints);\r\n}\r\n","import { getElementPosition } from './elementProperties';\r\n\r\nconst easeInOutQuad = function(currentTime, start, change, duration) {\r\n let time = currentTime;\r\n time /= duration / 2;\r\n if (time < 1) {\r\n return (change / 2) * time * time + start;\r\n }\r\n time--;\r\n return (-change / 2) * (time * (time - 2) - 1) + start;\r\n};\r\n\r\nconst easeInOutQuintic = function(currentTime, start, change, duration) {\r\n let time = currentTime;\r\n const ts = (time /= duration) * time,\r\n tc = ts * time;\r\n return start + change * (6 * tc * ts + -15 * ts * ts + 10 * tc);\r\n};\r\n\r\nexport function scrollTo(to, duration = 1500, callback) {\r\n function move(amount) {\r\n if (document.scrollingElement) {\r\n document.scrollingElement.scrollTop = amount;\r\n } else {\r\n document.documentElement.scrollTop = amount;\r\n document.body.parentNode.scrollTop = amount;\r\n document.body.scrollTop = amount;\r\n }\r\n }\r\n function position() {\r\n return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop;\r\n }\r\n\r\n const start = position(),\r\n change = to instanceof Element ? getElementPosition(to).top - start : to - start,\r\n increment = 20;\r\n\r\n\r\n let currentTime = 0;\r\n\r\n const animate = function() {\r\n // increment the time\r\n currentTime += increment;\r\n // find the value with the quadratic in-out easing function\r\n const val = easeInOutQuintic(currentTime, start, change, duration);\r\n // move the document.body\r\n move(val);\r\n // do the animation unless its over\r\n if (currentTime < duration) {\r\n requestAnimationFrame(animate);\r\n } else {\r\n if (callback && typeof callback === 'function') {\r\n // the animation is done so lets callback\r\n if (typeof callback === 'function') {\r\n callback();\r\n }\r\n }\r\n }\r\n };\r\n animate();\r\n}\r\n","/**\r\n * Utilities for checking properties and states of elements.\r\n */\r\n\r\n/**\r\n * Check if an element is empty.\r\n *\r\n * @param {Node} element - Check if this element is empty.\r\n * @param {boolean} [strict=true] - Set this to **false** to ignore nodes with whitespace.\r\n * @returns {boolean} **True** if the element is empty.\r\n */\r\nexport function elementIsEmpty(element, strict = true) {\r\n return strict ? !element.childNodes.length : !element.innerHTML.trim().length;\r\n}\r\n\r\n/**\r\n * Check if an element is hidden in the DOM with `display: none;`\r\n *\r\n * @param {HTMLElement} element - The element to check.\r\n * @returns {boolean} **True** if element is hidden, otherwise **false**.\r\n */\r\nexport function elementIsHidden(element) {\r\n return element.offsetParent === null;\r\n}\r\n\r\n/**\r\n * Check if an element is in the viewport\r\n * \r\n * @param {HTMLElement} elem - The element to check \r\n */\r\nexport function isVisible(elem) {\r\n return !!elem && !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);\r\n}\r\n\r\n/**\r\n * Find out whether or not the given argument is an element that would react somewhat normally to DOM-manipulations.\r\n *\r\n * @param {*} element - The element to check.\r\n * @returns {boolean} `true` if the given argument is an element (or document, or window), and `false` otherwise.\r\n */\r\nexport function isElement(element) {\r\n return element instanceof Element || element instanceof Document || element instanceof Window;\r\n}\r\n\r\n/**\r\n * Return the position of an element\r\n *\r\n * @param {Element|String} element - The HTML element to work with or its ID\r\n * @param {Element|String|Window} [relativeTo=window] - The HTML element to return the position relative to or its ID\r\n * @returns {{top: Number, left: Number}} An object with top and left positions in pixels\r\n *\r\n *\r\n * @example Basic usage:\r\n * import { getElementPosition } from './utils/dom/elementProperties';\r\n *\r\n * const element = document.querySelector('.anElement');\r\n * getElementPosition(element);\r\n *\r\n *\r\n * @example Perform a search for an element with an ID equal to the string, i.e. 'elementId', and get the position of that:\r\n * import { getElementPosition } from './utils/dom/elementProperties';\r\n *\r\n * getElementPosition('elementId');\r\n */\r\nexport function getElementPosition(element, relativeTo = window) {\r\n const useElement = typeof element === 'string' ? document.getElementById(element) : element;\r\n\r\n // Throw error if element wasn't found\r\n if (!useElement) {\r\n throw 'getElementPosition did not find an element.';\r\n }\r\n\r\n const useRelativeTo = typeof relativeTo === 'string' ? document.getElementById(relativeTo) : relativeTo;\r\n\r\n // Throw error if relative element wasn't found\r\n if (!useRelativeTo) {\r\n throw 'getElementPosition did not find an element to show the position relative to.';\r\n }\r\n\r\n if (relativeTo === window) {\r\n // Return position relative to window\r\n const rect = useElement.getBoundingClientRect();\r\n return {\r\n top: rect.top + (window.pageYOffset || document.documentElement.scrollTop),\r\n left: rect.left + (window.pageXOffset || document.documentElement.scrollLeft)\r\n };\r\n } else {\r\n // Return position relative to declared element\r\n return {\r\n top: useElement.offsetTop - relativeTo.offsetTop,\r\n left: useElement.offsetLeft - relativeTo.offsetLeft\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * Get the current scroll values of the given element (or window). Will return an object containing\r\n * \"left\" and \"top\" properties, which are set to the scroll values, or false if no compatible element\r\n * was given.\r\n *\r\n * @param {Element|Window} [element=window]\r\n * @returns {{ left: number, top: number } | boolean}\r\n */\r\nexport function getElementScroll(element = window) {\r\n if (isElement(element)) {\r\n if (element instanceof Window) {\r\n return {\r\n left: element.pageXOffset || document.documentElement.scrollLeft,\r\n top: element.pageYOffset || document.documentElement.scrollTop\r\n };\r\n } else {\r\n return {\r\n left: element.scrollX || element.scrollLeft,\r\n top: element.scrollY || element.scrollTop\r\n };\r\n }\r\n } else {\r\n console.warn('Can\\'t get scroll-position or given argument type.');\r\n return false;\r\n }\r\n}\r\n\r\n/**\r\n * Get both width and height of element\r\n *\r\n * @param {Element} element - The HTML element to work with\r\n * @param {Object} [options={}] - Object of options\r\n * @param {boolean} [options.includePadding=false] - Get size including padding (defaults to true)\r\n * @param {boolean} [options.includeBorder=false] - Get size including border (defaults to true)\r\n * @param {boolean} [options.includeMargin=true] - Get size including margin (defaults to false)\r\n * @param {null|':before'|':after'} [options.pseudoElement=null] - Get size of pseudo element ':before' or ':after'\r\n * @returns {{width: number, height: number}} An object with the width and height as numbers\r\n */\r\nexport function getElementSize(element, options = {}) {\r\n // Get styles\r\n const elementStyle = window.getComputedStyle(element, options.pseudoElement);\r\n\r\n return {\r\n width: getElementWidth(element, options, elementStyle),\r\n height: getElementHeight(element, options, elementStyle)\r\n };\r\n}\r\n\r\n/**\r\n * Get width of element\r\n *\r\n * @param {Element} element - The HTML element to work with\r\n * @param {Object} [options={}] - Object of options\r\n * @param {boolean} [options.includeMargin=false] - Get width including margin (defaults to false)\r\n * @param {boolean} [options.includeBorder=true] - Get width including border (defaults to true)\r\n * @param {boolean} [options.includePadding=true] - Get width including padding (defaults to true)\r\n * @param {null|':before'|':after'} [options.pseudoElement=null] - Get width of pseudo element ':before' or ':after'\r\n * @param {CSSStyleDeclaration} [elementStyle] - Style declaration of element (in case you already have called .getComputedStyle(), pass its returned value here)\r\n * @returns {number} The width as a number\r\n */\r\nexport function getElementWidth(element, options = {}, elementStyle = null) {\r\n // Keep supplied values or set to defaults\r\n options.includeMargin = options.includeMargin === true;\r\n options.includeBorder = options.includeBorder !== false;\r\n options.includePadding = options.includePadding !== false;\r\n\r\n // Get styles\r\n const style = elementStyle || window.getComputedStyle(element, options.pseudoElement);\r\n\r\n // Get width including border and padding\r\n let width = element.offsetWidth;\r\n\r\n // Calculate width with margin\r\n if (options.includeMargin) {\r\n width += parseFloat(style.marginLeft) + parseFloat(style.marginRight);\r\n }\r\n\r\n // Calculate width without border\r\n if (!options.includeBorder) {\r\n width -= parseFloat(style.borderLeftWidth) + parseFloat(style.borderRightWidth);\r\n }\r\n\r\n // Calculate width without padding\r\n if (!options.includePadding) {\r\n width -= parseFloat(style.paddingLeft) + parseFloat(style.paddingRight);\r\n }\r\n\r\n return width;\r\n}\r\n\r\n/**\r\n * Get height of element\r\n *\r\n * @param {Element} element - The HTML element to work with\r\n * @param {Object} [options={}] - Object of options\r\n * @param {boolean} [options.includeMargin=false] - Get height including margin (defaults to false)\r\n * @param {boolean} [options.includeBorder=true] - Get height including border (defaults to true)\r\n * @param {boolean} [options.includePadding=true] - Get height including padding (defaults to true)\r\n * @param {null|':before'|':after'} [options.pseudoElement=null] - Get height of pseudo element ':before' or ':after'\r\n * @param {CSSStyleDeclaration} [elementStyle] - Style declaration of element (in case you already have called .getComputedStyle(), pass its returned value here)\r\n * @returns {number} The height as a number\r\n */\r\nexport function getElementHeight(element, options = {}, elementStyle = null) {\r\n // Keep supplied values or set to defaults\r\n options.includeMargin = options.includeMargin === true;\r\n options.includeBorder = options.includeBorder !== false;\r\n options.includePadding = options.includePadding !== false;\r\n\r\n // Get styles\r\n const style = elementStyle || window.getComputedStyle(element, options.pseudoElement);\r\n\r\n // Get height including border and padding\r\n let height = element.offsetHeight;\r\n\r\n // Calculate height with margin\r\n if (options.includeMargin) {\r\n height += parseFloat(style.marginTop) + parseFloat(style.marginBottom);\r\n }\r\n\r\n // Calculate height without border\r\n if (!options.includeBorder) {\r\n height -= parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);\r\n }\r\n\r\n // Calculate height without padding\r\n if (!options.includePadding) {\r\n height -= parseFloat(style.paddingTop) + parseFloat(style.paddingBottom);\r\n }\r\n\r\n return height;\r\n}\r\n","import { scrollTo } from '../utils/scrollTo';\r\n\r\n/**\r\n * This function strips relative site path from hashlink \r\n * \r\n * @param {string} hashLink \r\n * \r\n * @returns {HTMLElement}\r\n */\r\nfunction returnHashElement(hashLink) {\r\n if (hashLink.indexOf(window.location.pathname) !== -1) {\r\n return document.getElementById(hashLink.replace(window.location.pathname, '').replace('#', ''));\r\n } else {\r\n return document.getElementById(hashLink.replace('#', ''));\r\n }\r\n}\r\n\r\n/**\r\n * Scrolls the viewport to an hash-id\r\n * if found in querystring\r\n */\r\nexport function scrollToUrlHash() {\r\n if (window.location.hash) {\r\n const element = document.getElementById(window.location.hash.replace('#', ''));\r\n\r\n if (element) {\r\n scrollTo(element);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Activate Anchor Link Scroll with this function\r\n * Will only run if given selector elements are found in DOM\r\n * \r\n * @param {string} triggerSelector \r\n */\r\n\r\nexport function setupAnchorLinkScroll(triggerSelector = '[data-action*=\"anchor\"], a[href^=\"#\"]:not([href=\"#\"]):not([role=\"tab\"]):not([data-action*=\"accordion\"])') {\r\n\r\n const triggers = document.querySelectorAll(triggerSelector);\r\n\r\n for (let i = 0; i < triggers.length; i++) {\r\n const trigger = triggers[i];\r\n const hashLink = trigger.getAttribute('href') || trigger.getAttribute('data-target');\r\n\r\n if (hashLink) {\r\n const element = returnHashElement(hashLink);\r\n\r\n trigger.addEventListener('click', e => {\r\n e.preventDefault();\r\n scrollTo(element);\r\n });\r\n }\r\n }\r\n}\r\n","import { onReady } from './utils/onReady';\r\nimport { setupLazyLoading } from './utils/lazyImage';\r\nimport { initVhUnitOverwrite, debounce } from './utils/helpers';\r\nimport { setupAnchorLinkScroll } from './components/anchors';\r\nimport { watchFormFields } from './components/form';\r\n\r\n// Below are example of how to use import libraries installed via npm.\r\n// import sal from 'sal.js';\r\n\r\nfunction init() {\r\n document.body.classList.remove('standby');\r\n\r\n setupAnchorLinkScroll();\r\n\r\n onReady(() => {\r\n initVhUnitOverwrite();\r\n });\r\n\r\n window.addEventListener('load', () => {\r\n // Polyfill for using svg spritesheet in oldIE\r\n svg4everybody();\r\n });\r\n}\r\n\r\ninit();\r\n"],"names":["functionReferences","readyState","document","readyEventBound","emptyCallbackArrays","length","tempArray","slice","forEach","funcRef","onReady","functionReference","addEventListener","push","documentElement","scrollTop","body","window","navigator","test","userAgent","CookieInformation","getConsentGivenFor","setVhProp","vh","innerHeight","style","setProperty","easeInOutQuintic","currentTime","start","change","duration","time","ts","tc","scrollTo","to","callback","parentNode","Element","element","relativeTo","useElement","getElementById","top","offsetTop","left","offsetLeft","rect","getBoundingClientRect","pageYOffset","pageXOffset","scrollLeft","getElementPosition","animate","amount","val","scrollingElement","requestAnimationFrame","setupAnchorLinkScroll","triggerSelector","triggers","querySelectorAll","i","trigger","hashLink","getAttribute","indexOf","location","pathname","replace","e","preventDefault","classList","remove","svg4everybody"],"mappings":"yBAaA,IAAIA,EAAqB,GAMrBC,EAAqC,gBAAxBC,SAASD,YAAwD,aAAxBC,SAASD,WAI/DE,GAAkB,EAiBtB,SAASC,SAEEJ,EAAmBK,QAAQ,KAExBC,EAAYN,EAAmBO,MAAM,GAC3CP,EAAqB,GAIJM,EAjBXE,QAAQ,SAAAC,UAAWA,MAqB7BR,GAAa,EA2BV,SAASS,EAAQC,GACa,mBAAtBA,IACHV,EACAU,KArBHR,IAC2B,YAAxBD,SAASD,WAETC,SAASU,iBAAiB,mBAAoBR,GAG9CA,IAGJD,GAAkB,GAgBdH,EAAmBa,KAAKF,KCvFbT,SAASY,gBAAgBC,WAAab,SAASc,KAAKD,UCKnD,aAAcE,QAAkC,oBAAdC,WAA6B,g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