{"version":3,"sources":["webpack:///./js/components/init-cookie-banner-lightbox.ts","webpack:///./node_modules/js-cookie/src/js.cookie.js"],"names":["COOKIE_DOMAIN","window","location","hostname","wrap","toWrap","wrapper","document","createElement","parent","parentNode","appendChild","unwrap","docFrag","createDocumentFragment","firstChild","child","removeChild","replaceChild","flagClosed","Cookies","set","expires","domain","whenDomReady","then","banner","querySelector","hasBeenClosed","get","innerWidth","contentHolder","className","lightbox","overlay","close","lightboxClose","addEventListener","closeCookieBar","setTimeout","factory","module","exports","OldCookies","api","noConflict","extend","i","result","arguments","length","attributes","key","decode","s","replace","decodeURIComponent","init","converter","value","path","defaults","Date","toUTCString","JSON","stringify","test","e","write","encodeURIComponent","String","escape","stringifiedAttributes","attributeName","split","cookie","json","jar","cookies","parts","slice","join","charAt","name","read","parse","getJSON","remove","withConverter"],"mappings":"2FAAA,oCAEA,MACMA,EAAgBC,OAAOC,SAASC,SAChCC,EAAO,CAACC,EAAQC,KAClBA,EAAUA,GAAWC,SAASC,cAAc,OAC5C,MAAMC,EAASJ,EAAOK,WACjBD,IAELA,EAAOE,YAAYL,GACnBA,EAAQK,YAAYN,KAGlBO,EAAUN,IACZ,MAAMO,EAAUN,SAASO,yBACzB,KAAOR,EAAQS,YAAY,CACvB,MAAMC,EAAQV,EAAQW,YAAYX,EAAQS,YAC1CF,EAAQF,YAAYK,GAExB,MAAMP,EAASH,EAAQI,WAClBD,GAELA,EAAOS,aAAaL,EAASP,IAG3Ba,EAAa,KACfC,IAAQC,IAxBQ,iCAwBS,SAAU,CAAEC,QAAS,IAAKC,OAAQ,IAAMvB,KA+CrEwB,cAAeC,MA7Cf,WACI,MAAMC,EAASnB,SAASoB,cAAc,sBAChCC,EAA8C,WAA7BR,IAAQS,IA5Bf,kCA6BhB,IAAKH,GAAUE,GAAiB3B,OAAO6B,WAAa,IAChD,OAGJ,IADuBvB,SAASoB,cAAc,wCAE1C,OAEJ,MAAMI,EAAgBxB,SAASC,cAAc,OAC7CuB,EAAcC,U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AOf,EAAMyB,EAAIzB,GAAOyB,GAoBzB,OAjBAjC,EAAIvB,IAAMA,EACVuB,EAAIf,IAAM,SAAUuB,GACnB,OAAOvB,EAAIuB,GAAK,IAEjBR,EAAI0C,QAAU,SAAUlC,GACvB,OAAOvB,EAAIuB,GAAK,IAEjBR,EAAI2C,OAAS,SAAUnC,EAAKD,GAC3B9B,EAAI+B,EAAK,GAAIN,EAAOK,EAAY,CAC/B7B,SAAU,MAIZsB,EAAIiB,SAAW,GAEfjB,EAAI4C,cAAgB/B,EAEbb,EAGDa,EAAK","file":"35-1c71f7e4d04ab9a317eb.js","sourcesContent":["import whenDomReady from 'when-dom-ready';\r\nimport Cookies from 'js-cookie';\r\nconst COOKIE_NAME = 'xperience.cookiebannerlightbox';\r\nconst COOKIE_DOMAIN = window.location.hostname;\r\nconst wrap = (toWrap, wrapper) => {\r\n wrapper = wrapper || document.createElement('div');\r\n const parent = toWrap.parentNode;\r\n if (!parent)\r\n return;\r\n parent.appendChild(wrapper);\r\n wrapper.appendChild(toWrap);\r\n return;\r\n};\r\nconst unwrap = (wrapper) => {\r\n const docFrag = document.createDocumentFragment();\r\n while (wrapper.firstChild) {\r\n const child = wrapper.removeChild(wrapper.firstChild);\r\n docFrag.appendChild(child);\r\n }\r\n const parent = wrapper.parentNode;\r\n if (!parent)\r\n return;\r\n parent.replaceChild(docFrag, wrapper);\r\n return;\r\n};\r\nconst flagClosed = () => {\r\n Cookies.set(COOKIE_NAME, 'closed', { expires: 365, domain: '.' + COOKIE_DOMAIN });\r\n};\r\nfunction initialise() {\r\n const banner = document.querySelector('.js-xpcookiebanner');\r\n const hasBeenClosed = (Cookies.get(COOKIE_NAME) === 'closed');\r\n if (!banner || hasBeenClosed || window.innerWidth < 768) {\r\n return;\r\n }\r\n const lightboxActive = document.querySelector('.js-header--xpcookiebanner-is-active');\r\n if (!lightboxActive) {\r\n return;\r\n }\r\n const contentHolder = document.createElement('div');\r\n contentHolder.className = 'lightbox__content-holder';\r\n wrap(banner, contentHolder);\r\n const lightbox = document.createElement('div');\r\n lightbox.className = 'lightbox__content lightbox__content--xpcookiebanner';\r\n wrap(contentHolder, lightbox);\r\n const overlay = document.createElement('div');\r\n overlay.className = 'lightbox__overlay';\r\n lightbox.appendChild(overlay);\r\n const close = document.createElement('div');\r\n close.className = 'lightbox__close';\r\n banner.appendChild(close);\r\n const lightboxClose = document.querySelector('.lightbox__close');\r\n if (lightboxClose) {\r\n lightboxClose.addEventListener('click', () => {\r\n lightbox.removeChild(overlay);\r\n banner.removeChild(close);\r\n unwrap(lightbox);\r\n unwrap(contentHolder);\r\n flagClosed();\r\n });\r\n }\r\n const closeCookieBar = document.querySelector('.js-close-cookie');\r\n if (closeCookieBar) {\r\n closeCookieBar.addEventListener('click', () => {\r\n setTimeout(() => {\r\n const parent = lightbox.parentNode;\r\n if (!parent)\r\n return;\r\n parent.removeChild(lightbox);\r\n flagClosed();\r\n }, 0);\r\n });\r\n }\r\n}\r\nwhenDomReady().then(initialise);\r\n","/*!\n * JavaScript Cookie v2.2.1\n * https://github.com/js-cookie/js-cookie\n *\n * Copyright 2006, 2015 Klaus Hartl & Fagner Brack\n * Released under the MIT license\n */\n;(function (factory) {\n\tvar registeredInModuleLoader;\n\tif (typeof define === 'function' && define.amd) {\n\t\tdefine(factory);\n\t\tregisteredInModuleLoader = true;\n\t}\n\tif (typeof exports === 'object') {\n\t\tmodule.exports = factory();\n\t\tregisteredInModuleLoader = true;\n\t}\n\tif (!registeredInModuleLoader) {\n\t\tvar OldCookies = window.Cookies;\n\t\tvar api = window.Cookies = factory();\n\t\tapi.noConflict = function () {\n\t\t\twindow.Cookies = OldCookies;\n\t\t\treturn api;\n\t\t};\n\t}\n}(function () {\n\tfunction extend () {\n\t\tvar i = 0;\n\t\tvar result = {};\n\t\tfor (; i < arguments.length; i++) {\n\t\t\tvar attributes = arguments[ i ];\n\t\t\tfor (var key in attributes) {\n\t\t\t\tresult[key] = attributes[key];\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tfunction decode (s) {\n\t\treturn s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent);\n\t}\n\n\tfunction init (converter) {\n\t\tfunction api() {}\n\n\t\tfunction set (key, value, attributes) {\n\t\t\tif (typeof document === 'undefined') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tattributes = extend({\n\t\t\t\tpath: '/'\n\t\t\t}, api.defaults, attributes);\n\n\t\t\tif (typeof attributes.expires === 'number') {\n\t\t\t\tattributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5);\n\t\t\t}\n\n\t\t\t// We're using \"expires\" because \"max-age\" is not supported by IE\n\t\t\tattributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';\n\n\t\t\ttry {\n\t\t\t\tvar result = JSON.stringify(value);\n\t\t\t\tif (/^[\\{\\[]/.test(result)) {\n\t\t\t\t\tvalue = result;\n\t\t\t\t}\n\t\t\t} catch (e) {}\n\n\t\t\tvalue = converter.write ?\n\t\t\t\tconverter.write(value, key) :\n\t\t\t\tencodeURIComponent(String(value))\n\t\t\t\t\t.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);\n\n\t\t\tkey = encodeURIComponent(String(key))\n\t\t\t\t.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent)\n\t\t\t\t.replace(/[\\(\\)]/g, escape);\n\n\t\t\tvar stringifiedAttributes = '';\n\t\t\tfor (var attributeName in attributes) {\n\t\t\t\tif (!attributes[attributeName]) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tstringifiedAttributes += '; ' + attributeName;\n\t\t\t\tif (attributes[attributeName] === true) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Considers RFC 6265 section 5.2:\n\t\t\t\t// ...\n\t\t\t\t// 3. If the remaining unparsed-attributes contains a %x3B (\";\")\n\t\t\t\t// character:\n\t\t\t\t// Consume the characters of the unparsed-attributes up to,\n\t\t\t\t// not including, the first %x3B (\";\") character.\n\t\t\t\t// ...\n\t\t\t\tstringifiedAttributes += '=' + attributes[attributeName].split(';')[0];\n\t\t\t}\n\n\t\t\treturn (document.cookie = key + '=' + value + stringifiedAttributes);\n\t\t}\n\n\t\tfunction get (key, json) {\n\t\t\tif (typeof document === 'undefined') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar jar = {};\n\t\t\t// To prevent the for loop in the first place assign an empty array\n\t\t\t// in case there are no cookies at all.\n\t\t\tvar cookies = document.cookie ? document.cookie.split('; ') : [];\n\t\t\tvar i = 0;\n\n\t\t\tfor (; i < cookies.length; i++) {\n\t\t\t\tvar parts = cookies[i].split('=');\n\t\t\t\tvar cookie = parts.slice(1).join('=');\n\n\t\t\t\tif (!json && cookie.charAt(0) === '\"') {\n\t\t\t\t\tcookie = cookie.slice(1, -1);\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tvar name = decode(parts[0]);\n\t\t\t\t\tcookie = (converter.read || converter)(cookie, name) ||\n\t\t\t\t\t\tdecode(cookie);\n\n\t\t\t\t\tif (json) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tcookie = JSON.parse(cookie);\n\t\t\t\t\t\t} catch (e) {}\n\t\t\t\t\t}\n\n\t\t\t\t\tjar[name] = cookie;\n\n\t\t\t\t\tif (key === name) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {}\n\t\t\t}\n\n\t\t\treturn key ? jar[key] : jar;\n\t\t}\n\n\t\tapi.set = set;\n\t\tapi.get = function (key) {\n\t\t\treturn get(key, false /* read as raw */);\n\t\t};\n\t\tapi.getJSON = function (key) {\n\t\t\treturn get(key, true /* read as json */);\n\t\t};\n\t\tapi.remove = function (key, attributes) {\n\t\t\tset(key, '', extend(attributes, {\n\t\t\t\texpires: -1\n\t\t\t}));\n\t\t};\n\n\t\tapi.defaults = {};\n\n\t\tapi.withConverter = init;\n\n\t\treturn api;\n\t}\n\n\treturn init(function () {});\n}));\n"],"sourceRoot":""}