{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///../@valtech/utilities/src/utilities/throttle.js","webpack:///../@valtech/utilities/src/utilities/customVhProperty.js","webpack:///../@valtech/utilities/src/index.js","webpack:///./src/js/cookie-consent.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","throttle","func","limit","lastFunc","lastRan","args","context","this","clearTimeout","setTimeout","Date","now","apply","setValue","vh","window","innerHeight","document","documentElement","style","setProperty","customVhProperty","addEventListener","classNames","autoOpen","open","shown","sticky","consentClose","consentOpen","optionsClose","optionsOpen","elements","rootNode","querySelector","options","triggers","querySelectorAll","optionsDisplay","action","classList","toggle","add","remove","optionsTriggersDisplay","contains","display","initCookieConsent","Array","from","forEach","element","displayHandler","optionsTriggersSetup","e","target","readyState"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EA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C,IAChCA,EAAQ7B,iBAAiB,QAAS,IAAMW,EAASO,UAAUG,OAAOjB,MAIlEG,GACFmB,MAAMC,KAAKpB,GAAaqB,QAASC,IAC/BA,EAAQ7B,iBAAiB,QAAS,IAAMW,EAASO,UAAUE,IAAIhB,MAmEjE0B,GAzBJ,WACE,MAAM,aAAEtB,EAAY,YAAEC,GAAgBC,EAASI,SAE1CN,GAAiBC,IAEtBA,EAAYT,iBAAiB,QAAS,KACpCgB,GAAe,GACfM,MAGFd,EAAaR,iBAAiB,QAAS,KACrCgB,GAAe,GACfM,OAcAS,IAKJpC,SAASK,iBAAiB,mBAAqBgC,IACjB,aAAxBA,EAAEC,OAAOC,aACPxB,EAASC,UACXc,IAEF1B","file":"js/cookie-consent.min.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","/**\n * Throttle function: ensures the function is called at most once in the given time interval.\n * @param {Function} func - Function to throttle.\n * @param {number} limit - Time in milliseconds to wait before allowing the next execution.\n * @returns {Function} - Throttled function.\n */\nexport function throttle(func, limit) {\n let lastFunc;\n let lastRan;\n \n return function (...args) {\n const context = this;\n if (!lastRan) {\n func.apply(context, args);\n lastRan = Date.now();\n } else {\n clearTimeout(lastFunc);\n lastFunc = setTimeout(() => {\n if (Date.now() - lastRan >= limit) {\n func.apply(context, args);\n lastRan = Date.now();\n }\n }, limit - (Date.now() - lastRan));\n }\n };\n}","import { throttle } from './throttle';\n\n/**\n * Get the viewport height and multiple it by 1% to get a value for a vh unit\n * Set the value in the --vh custom property to the root of the document\n * @returns {undefined}\n */\nfunction setValue() {\n const vh = window.innerHeight * 0.01;\n document.documentElement.style.setProperty('--vh', `${vh}px`);\n}\n\n/**\n * Sets a CSS Custom Property for actual vh value and updates it on resize\n * @see {https://css-tricks.com/the-trick-to-viewport-units-on-mobile} for detailled explanation\n * @returns {undefined}\n */\nexport default function customVhProperty() {\n setValue();\n\n window.addEventListener('resize', throttle(() => {\n setValue();\n }, 100));\n\n window.addEventListener('scroll', throttle(() => {\n setValue();\n }, 100));\n}\n","import customVhProperty from './utilities/customVhProperty';\nimport { throttle } from './utilities/throttle';\nimport { debounce } from './utilities/debounce';\n\nexport { throttle, debounce };\nexport default customVhProperty;\n","/**\n * Cookie consent functionality\n */\n\nimport customVhProperty from '@valtech/utilities';\n\n// Required classnames\nconst classNames = {\n modifiers: {\n autoOpen: 'js-auto-open',\n open: 'is-open',\n shown: 'is-shown',\n sticky: 'cookie-consent--sticky',\n },\n options: 'cookie-consent__options',\n rootNode: 'cookie-consent',\n triggers: {\n consentClose: 'js-cookie-consent-close',\n consentOpen: 'js-cookie-consent-open',\n optionsClose: 'js-trigger-options-close',\n optionsOpen: 'js-trigger-options-open',\n },\n};\n\n// Required dom nodes\nconst elements = {\n rootNode: document.querySelector(`.${classNames.rootNode}`),\n options: document.querySelector(`.${classNames.options}`),\n triggers: {\n consentClose: document.querySelectorAll(`.${classNames.triggers.consentClose}`),\n consentOpen: document.querySelectorAll(`.${classNames.triggers.consentOpen}`),\n optionsClose: document.querySelector(`.${classNames.triggers.optionsClose}`),\n optionsOpen: document.querySelector(`.${classNames.triggers.optionsOpen}`),\n },\n};\n\n/**\n * Handles control over diplaying sticky message\n * @returns {undefined}\n */\nfunction displayHandler() {\n const { rootNode } = elements;\n const { consentClose, consentOpen } = elements.triggers;\n const { autoOpen, shown } = classNames.modifiers;\n\n if (rootNode && rootNode.classList.contains(autoOpen)) {\n rootNode.classList.add(shown); \n }\n\n if (consentClose) {\n Array.from(consentClose).forEach((element) => {\n element.addEventListener('click', () => rootNode.classList.remove(shown));\n });\n }\n\n if (consentOpen) {\n Array.from(consentOpen).forEach((element) => {\n element.addEventListener('click', () => rootNode.classList.add(shown));\n });\n }\n}\n\n/**\n * Toggles the options panel display\n * @param {boolean} action Open or close\n * @returns {undefined}\n */\nfunction optionsDisplay(action) {\n const { options } = elements;\n const { open } = classNames.modifiers;\n\n if (action === null) options.classList.toggle(open);\n\n if (action) options.classList.add(open);\n else options.classList.remove(open);\n}\n\n/**\n * Handle options buttons display\n * @returns {undefined}\n */\nfunction optionsTriggersDisplay() {\n const { optionsClose, optionsOpen } = elements.triggers;\n const { options } = elements;\n const { open } = classNames.modifiers;\n\n if (options.classList.contains(open)) {\n optionsOpen.style.display = 'none';\n optionsClose.style.display = '';\n } else {\n optionsOpen.style.display = '';\n optionsClose.style.display = 'none';\n }\n}\n\n/**\n * Set up click events for options buttons\n * @returns {undefined}\n */\nfunction optionsTriggersSetup() {\n const { optionsClose, optionsOpen } = elements.triggers;\n\n if (!optionsClose || !optionsOpen) return;\n\n optionsOpen.addEventListener('click', () => {\n optionsDisplay(true);\n optionsTriggersDisplay();\n });\n\n optionsClose.addEventListener('click', () => {\n optionsDisplay(false);\n optionsTriggersDisplay();\n });\n}\n\n/**\n * Kick off component\n * @returns {undefined}\n */\nexport default function initCookieConsent() {\n const { rootNode } = elements;\n const { sticky } = classNames.modifiers;\n\n if (rootNode && rootNode.classList.contains(sticky)) {\n displayHandler();\n optionsTriggersSetup();\n }\n}\n\n// on document ready\ndocument.addEventListener('readystatechange', (e) => {\n if (e.target.readyState === 'complete') {\n if (elements.rootNode) {\n initCookieConsent();\n }\n customVhProperty();\n }\n});\n"],"sourceRoot":""}