{"version":3,"sources":["CookieModalFocus.js","CookieManager.js","CookiePolicyWidget.js","cookiePopupInit.js"],"names":["w","d","Confused","CookieModalFocus","init","cookieModalLink","cookieModalBtn1","cookieModalBtn2","cookieWallDetails","cookieWall","querySelector","setFocus","element","focus","classList","contains","addEventListener","event","activeElem","target","key","shiftKey","preventDefault","hasAttribute","onTabPress","window","document","CookieManagerV2","prototype","getItem","sKey","decodeURIComponent","cookie","replace","RegExp","encodeURIComponent","setItem","sValue","vEnd","sPath","sDomain","bSecure","test","sExpires","constructor","Number","Infinity","String","Date","toUTCString","removeItem","this","hasItem","keys","aKeys","split","nIdx","length","CookiePolicyWidget","cookieManager","gtmContainerID","dataLayer","GTMContainer","cookieName","ConsentCookieName","parent","location","hostname","miListener","CONFUSEDCORE","MI","MiListener","cookiePopupShown","parts","shift","join","hidePopup","cookieValue","eventName","remove","updateCookieChoiceRadios","setTimeout","cookieEvent","CustomEvent","detail","dispatchEvent","insertGTMScript","postEvent","checked","add","updateCookieValue","s","createElement","type","async","src","x","getElementsByTagName","parentNode","insertBefore","run","push","getTime","buttons","querySelectorAll","inputs","Array","forEach","call","button","btn","closest","questionBlock","selectedRadio","value","validateCookieSelection","input","e","toggle","wasCookiePopupShown","pageUrl","href","cookiePolicyWidget","postPageView","page","referer","referrer"],"mappings":"CAAA,SAAAA,EAAAC,GACAD,EAAAE,SAAAF,EAAAE,UAAA,CAAA,EACAF,EAAAE,SAAAC,iBAAA,WAAA,EAEAH,EAAAE,SAAAC,iBAAAC,KAAA,WAEA,IACAC,EACAC,EACAC,EACAC,EAJAC,EAAAR,EAAAS,cAAA,4BAaA,SAAAC,EAAAC,GACAA,GACAA,EAAAC,OAEA,CAXAJ,IACAJ,EAAAI,EAAAC,cAAA,mCACAJ,EAAAG,EAAAC,cAAA,oBACAH,EAAAE,EAAAC,cAAA,kCACAF,EAAAC,EAAAC,cAAA,YA6BAL,GAAAI,EAAAK,UAAAC,SAAA,sBAGAJ,EAAAN,GAEAJ,EAAAe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B,cAAA,sCAAAI,UAAAiE,OAAA,gBAEA+B,EAAAhG,UAAA2E,IAAA,wBAEAR,YAAA,WACA,QAAAgC,GACAvB,EAAA,QAGA,OAAAuB,GACAvB,EAAA,SAGAJ,GACA,GAAA,GAGAL,YAAA,WACAvD,SAAAhB,cAAA,sCAAAI,UAAA2E,IAAA,eACA,GAAA,KAEA,CAEA,MACA/D,SAAAhB,cAAA,6BACAkE,EAAA,OAAA,sCAGA,CAyFAuC,CADAlG,EAAAE,OACAF,EACA,GACA,IAEAyF,MAAA9E,UAAA+E,QAAAC,KAAAH,GAAA,SAAAW,GAEAA,EAAApG,iBAAA,UAAA,SAAAqG,GA3FA3F,SAAAhB,cAAA,4BAAAI,UAAAiE,OAAA,qBA8FA,OADAsC,EAAAlG,OACA4F,QAAA,8CAAApD,EAAAP,QAAAW,IACArC,SAAA8E,iBAAA,sCAAAG,SAAA,SAAAE,GACAA,EAAA/F,UAAAwG,OAAA,uBACA,GAEA,GACA,GAGA,EAQAC,oBANA,WACA,OAAA/C,CACA,EAMA,CApMA,CAoMA,IAAAxE,EAAAE,SAAAyB,gBACA,CA3MA,CA2MAF,QCpNA,IAAA4C,aAAAA,cAAA,CAAA,EAMA3C,SAAAV,iBAAA,oBAAA,WAEA,IAAAwG,EAAA/F,OAAAyC,SAAAuD,KAEAC,EAAAjG,OAAAvB,SAAAwD,mBACAgE,EAAAtB,MAGA,IAAAhC,EAAAC,aAAAC,GAAAC,WACAH,EAAAuD,aAAA,cAAA,CAAAC,KAAAJ,EAAAK,QAAAnG,SAAAoG,WAAA,WACAJ,EAAAH,uBACAnD,EAAAmB,UAAA,mBAEA,GACA","file":"cms2-cookies.min.js","sourcesContent":["(function(w, d) {\r\n w.Confused = w.Confused || {};\r\n w.Confused.CookieModalFocus = function () {};\r\n \r\n w.Confused.CookieModalFocus.init = function () {\r\n\r\n var cookieWall = d.querySelector(\".cnf-cookies_cookie-wall\");\r\n var cookieModalLink;\r\n var cookieModalBtn1;\r\n var cookieModalBtn2;\r\n var cookieWallDetails;\r\n\r\n if (cookieWall) {\r\n cookieModalLink = cookieWall.querySelector(\".cnf-cookies_cookie-policy-link\");\r\n cookieModalBtn1 = cookieWall.querySelector(\"#button-save-all\");\r\n cookieModalBtn2 = cookieWall.querySelector(\".cnf-cookies_save-cookie-prefs\");\r\n cookieWallDetails = cookieWall.querySelector(\"details\");\r\n }\r\n\r\n function setFocus(element) {\r\n if (element) {\r\n element.focus();\r\n }\r\n }\r\n\r\n function onTabPress(event) {\r\n if (!cookieWall.classList.contains(\"cnf-cookies_open\")) {\r\n return;\r\n }\r\n \r\n var activeElem = event.target;\r\n \r\n if (event.key === \"Tab\") {\r\n if (!event.shiftKey) {\r\n if (activeElem === cookieModalBtn1 || activeElem === cookieModalBtn2) {\r\n event.preventDefault();\r\n setFocus(cookieModalLink);\r\n }\r\n } else if (activeElem === cookieModalLink) {\r\n event.preventDefault();\r\n setFocus(cookieWallDetails.hasAttribute(\"open\") ? cookieModalBtn2 : cookieModalBtn1);\r\n }\r\n }\r\n }\r\n\r\n if (!cookieModalLink || !cookieWall.classList.contains(\"cnf-cookies_open\")) {\r\n return;\r\n }\r\n setFocus(cookieModalLink);\r\n\r\n d.addEventListener(\"keydown\", event => onTabPress(event));\r\n }\r\n\r\n})(window, document);","/**\r\n * Adds a Confused.CookieManagerV2 class to the Confused namespace.\r\n * Implemented as IIFE.\r\n **/\r\n(function (w, d) {\r\n\t'use strict';\r\n\r\n\tw.Confused = w.Confused || {};\r\n\r\n\t/**\r\n\t * Helper for working with cookies. 95% of this code was written by Mozilla.\r\n\t * https://developer.mozilla.org/en-US/docs/Web/API/d.cookie\r\n\t *\r\n\t * @Constructor\r\n\t */\r\n\tw.Confused.CookieManagerV2 = function () {};\r\n\r\n\t/**\r\n\t * Gets a cookie item. e.g.\r\n\t * cookieManagerV2.getItem(name)\r\n\t *\r\n\t * @param {string} sKey. The name of the cookie.\r\n\t */\r\n\tw.Confused.CookieManagerV2.prototype.getItem = function (sKey) {\r\n\t\treturn (\r\n\t\t\tdecodeURIComponent(\r\n\t\t\t\td.cookie.replace(\r\n\t\t\t\t\tnew RegExp(\r\n\t\t\t\t\t\t'(?:(?:^|.*;)\\\\s*' +\r\n\t\t\t\t\t\t\t// eslint-disable-next-line \r\n\t\t\t\t\t\t\tencodeURIComponent(sKey).replace(/[\\-\\.\\+\\*]/g, '\\\\$&') +\r\n\t\t\t\t\t\t\t'\\\\s*\\\\=\\\\s*([^;]*).*$)|^.*$'\r\n\t\t\t\t\t),\r\n\t\t\t\t\t'$1'\r\n\t\t\t\t)\r\n\t\t\t) || null\r\n\t\t);\r\n\t};\r\n\r\n\t/**\r\n\t * Sets a cookie item. e.g.\r\n\t * cookieManagerV2.setItem(\"test0\", \"Hello world!\");\r\n\t * cookieManagerV2.setItem(\"test1\", \"Unicode test: \\u00E0\\u00E8\\u00EC\\u00F2\\u00F9\", Infinity);\r\n\t * cookieManagerV2.setItem(\"test2\", \"Hello world!\", new Date(2020, 5, 12));\r\n\t * cookieManagerV2.setItem(\"test3\", \"Hello world!\", new Date(2027, 2, 3), \"/blog\");\r\n\t * cookieManagerV2.setItem(\"test4\", \"Hello world!\", \"Sun, 06 Nov 2022 21:43:15 GMT\");\r\n\t * cookieManagerV2.setItem(\"test5\", \"Hello world!\", \"Tue, 06 Dec 2022 13:11:07 GMT\", \"/home\");\r\n\t * cookieManagerV2.setItem(\"test6\", \"Hello world!\", 150);\r\n\t * cookieManagerV2.setItem(\"test7\", \"Hello world!\", 245, \"/content\");\r\n\t * cookieManagerV2.setItem(\"test8\", \"Hello world!\", null, null, \"example.com\");\r\n\t * cookieManagerV2.setItem(\"test9\", \"Hello world!\", null, null, null, true);\r\n\t * cookieManagerV2.setItem(\"test1;=\", \"Safe character test;=\", Infinity);\r\n\t *\r\n\t * @param {string} sKey. The name of the cookie.\r\n\t * @param {string} sValue. The value of the cookie.\r\n\t * @param {variant} vEnd. The expiry date of the cookie.\r\n\t * @param {string} sPath. The path of the cookie.\r\n\t * @param {string} sDomain. The domain of the cookie.\r\n\t * @param {bool} bSecure. Specifies if the cookie is secure or not.\r\n\t */\r\n\tw.Confused.CookieManagerV2.prototype.setItem = function (sKey, sValue, vEnd, sPath, sDomain, bSecure) {\r\n // eslint-disable-next-line\r\n\t\tif (!sKey || /^(?:expires|max\\-age|path|domain|secure)$/i.test(sKey)) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tvar sExpires = '';\r\n\r\n\t\tif (vEnd) {\r\n\t\t\tswitch (vEnd.constructor) {\r\n\t\t\t\tcase Number:\r\n\t\t\t\t\tsExpires = vEnd === Infinity ? '; expires=Fri, 31 Dec 9999 23:59:59 GMT' : '; max-age=' + vEnd;\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase String:\r\n\t\t\t\t\tsExpires = '; expires=' + vEnd;\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase Date:\r\n\t\t\t\t\tsExpires = '; expires=' + vEnd.toUTCString();\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\td.cookie =\r\n\t\t\tencodeURIComponent(sKey) +\r\n\t\t\t'=' +\r\n\t\t\tencodeURIComponent(sValue) +\r\n\t\t\tsExpires +\r\n\t\t\t(sDomain ? '; domain=' + sDomain : '') +\r\n\t\t\t(sPath ? '; path=' + sPath : '') +\r\n\t\t\t(bSecure ? '; secure' : '');\r\n\r\n\t\treturn true;\r\n\t};\r\n\r\n\t/**\r\n\t * Removes a cookie item. e.g.\r\n\t * cookieManagerV2.removeItem(name, path, domain)\r\n\t *\r\n\t * @param {string} sKey. The name of the cookie.\r\n\t * @param {string} sPath. The path of the cookie: eg, \"/\" : defaults to path of current d.\r\n\t * @param {string} sDomain. The domain of the cookie - eg, confused.com, .confused.com (all subdomains), www.confused.com\r\n\t */\r\n\tw.Confused.CookieManagerV2.prototype.removeItem = function (sKey, sPath, sDomain) {\r\n\t\tif (!sKey || !this.hasItem(sKey)) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\td.cookie =\r\n\t\t\tencodeURIComponent(sKey) +\r\n\t\t\t'=; expires=Thu, 01 Jan 1970 00:00:00 GMT' +\r\n\t\t\t(sDomain ? '; domain=' + sDomain : '') +\r\n\t\t\t(sPath ? '; path=' + sPath : '');\r\n\r\n\t\treturn true;\r\n\t};\r\n\r\n\t/**\r\n\t * Tests if a cookie item exists. e.g.\r\n\t * cookieManagerV2.hasItem(name)\r\n\t *\r\n\t * @param {string} sKey. The name of the cookie.\r\n\t */\r\n\tw.Confused.CookieManagerV2.prototype.hasItem = function (sKey) {\r\n\t\t// eslint-disable-next-line\r\n\t\treturn new RegExp('(?:^|;\\\\s*)' + encodeURIComponent(sKey).replace(/[\\-\\.\\+\\*]/g, '\\\\$&') + '\\\\s*\\\\=').test(\r\n\t\t\td.cookie\r\n\t\t);\r\n\t};\r\n\r\n\t/**\r\n\t * Returns the keys for all cookie items. e.g.\r\n\t * cookieManager.keys(name)\r\n\t */\r\n\tw.Confused.CookieManagerV2.prototype.keys = function () {\r\n\t\tvar aKeys = d.cookie\r\n\t\t\t// eslint-disable-next-line\r\n\t\t\t.replace(/((?:^|\\s*;)[^\\=]+)(?=;|$)|^\\s*|\\s*(?:\\=[^;]*)?(?:\\1|$)/g, '')\r\n\t\t\t// eslint-disable-next-line\r\n\t\t\t.split(/\\s*(?:\\=[^;]*)?;\\s*/);\r\n\r\n\t\tfor (var nIdx = 0; nIdx < aKeys.length; nIdx++) {\r\n\t\t\taKeys[nIdx] = decodeURIComponent(aKeys[nIdx]);\r\n\t\t}\r\n\r\n\t\treturn aKeys;\r\n\t};\r\n})(window, document);\r\n","/*\r\n * Adds a CookiePolicyWidget class to the Confused namespace.\r\n * Implemented as IIFE so we can pass in references to the global window and document objects.\r\n * Note: Depends on _partials/Common/v2.0/CookieManager.js being setup at Confused.CookieManagerV2 and _core/mi/v1.1/miListener.js (or above) being supported server-side.\r\n * Adds/ removes '.open' to '.cookie-wall depending on the presence of a CookieConsent cookie, logging the interaction as an MI event and in a cookie\r\n * Triggers the function triggerGTM() which wraps around the GTM script on page to stop it firing and dropping cookies if CookieConsent cookie is not present\r\n * Cookie consent cookie name is retrieved from dataLAyer on page and defaults to CookieConsent is dataLayer doesn't have the entry\r\n */\r\n\r\n(function (w) {\r\n\t'use strict';\r\n\r\n\tw.Confused = w.Confused || {};\r\n\tw.Confused.CookieManagerV2 = w.Confused.CookieManagerV2 || {};\r\n\r\n\tw.Confused.CookiePolicyWidget = (function (cookieManager) {\r\n\t\t// GET COOKIE & GTM ID NAME FROM DATALAYER\r\n\t\tvar gtmContainerID = window.dataLayer[0].GTMContainer;\r\n\t\tvar cookieName = window.dataLayer[0].ConsentCookieName;\r\n\t\tvar parent = location.hostname;\r\n\t\tvar domainRegex =\r\n\t\t\t// eslint-disable-next-line\r\n\t\t\t/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])(\\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9]))*$/i;\r\n\t\tvar miListener = CONFUSEDCORE.MI.MiListener;\r\n\t\tvar cookiePopupShown = false;\r\n\r\n\t\tif (domainRegex.test(parent)) {\r\n\t\t\tvar parts = parent.split('.');\r\n\t\t\tparts.shift();\r\n\t\t\tparent = parts.join('.');\r\n\t\t}\r\n\r\n\t\t/* Show widget */\r\n\t\tfunction showPopup() {\r\n\t\t\tif (document.querySelector('.cnf-cookies_cookie-wall')) {\r\n\t\t\t\tdocument.querySelector('.cnf-cookies_cookie-wall').classList.add('cnf-cookies_open');\r\n\t\t\t\tcookiePopupShown = true;\r\n\t\t\t\t//miListener.postEvent('CookiePopupShown');\r\n window.Confused.CookieModalFocus.init();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// VALIDATE ON BUTTON CLICK THAT THE A CHOICE HAS BEEN MADE\r\n\t\tfunction validateCookieSelection(btn, event) {\r\n\t\t\tif (btn.closest('.cnf-cookies_field-group') !== null) {\r\n\t\t\t\tvar questionBlock = btn.closest('.cnf-cookies_field-group');\r\n\r\n\t\t\t\tif (document.querySelectorAll('.cnf-cookies_field-group .cnf-cookies_radio-input:checked').length === 0) {\r\n\t\t\t\t\tevent.preventDefault();\r\n\t\t\t\t\tquestionBlock.classList.add('cnf-cookies_error');\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar selectedRadio = document.querySelector('.cnf-cookies_field-group .cnf-cookies_radio-input:checked').value;\r\n\t\t\t\t\t// IF WE ARE VALIDATING THE COOKIE WALL POPUP\r\n\t\t\t\t\tif (btn.classList.contains('cnf-cookies_cookie-wall__button')) {\r\n\t\t\t\t\t\tif (selectedRadio === 'yes') {\r\n\t\t\t\t\t\t\thidePopup('true', 'CookiePopupDismissed:ConsentGranted');\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (selectedRadio === 'no') {\r\n\t\t\t\t\t\t\thidePopup('false', 'CookiePopupDismissed:ConsentDeclined');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// IF WE ARE VALIDATING THE COOKIE POLICY PAGE\r\n\t\t\t\t\tif (btn.classList.contains('cnf-cookies_cookie-choice__button')) {\r\n\t\t\t\t\t\t// SHOW SUCCESS MESSAGE\r\n\t\t\t\t\t\tdocument.querySelector('.cnf-cookies_save-changess-success').classList.remove('display-none');\r\n\t\t\t\t\t\t// DISABLE BUTTON AS ACTION COMPLETE\r\n btn.classList.add('cnf-cookies_disabled');\r\n\r\n\t\t\t\t\t\tsetTimeout(function(){\r\n\t\t\t\t\t\t\tif (selectedRadio === 'yes') {\r\n\t\t\t\t\t\t\t\tupdateCookieValue('true');\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tif (selectedRadio === 'no') {\r\n\t\t\t\t\t\t\t\tupdateCookieValue('false');\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tinsertGTMScript();\r\n\t\t\t\t\t\t}, 0);\r\n\r\n\t\t\t\t\t\t// HIDE SUCCESS MESSAGE AFTER 5 SECONDS\r\n\t\t\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\t\t\tdocument.querySelector('.cnf-cookies_save-changess-success').classList.add('display-none');\r\n\t\t\t\t\t\t}, 5000);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// IF COOKIE WALL POPUP ACCEPT ALL BUTTON IS PRESSED\r\n\t\t\t} else {\r\n\t\t\t\tif (document.querySelector('.cnf-cookies_cookie-wall')) {\r\n\t\t\t\t\thidePopup('true', 'CookiePopupDismissed:ConsentGranted');\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// REMOVES ERROR CLASS ON FIELDSET HIDING ERROR MESSAGE\r\n\t\tfunction removeErrorClass() {\r\n\t\t\tdocument.querySelector('.cnf-cookies_field-group').classList.remove('cnf-cookies_error');\r\n\t\t}\r\n\r\n\t\t// CLOSES MODAL\r\n\t\tfunction closeCookieModal() {\r\n\t\t\tdocument.querySelector('.cnf-cookies_cookie-wall').classList.remove('cnf-cookies_open');\r\n\t\t}\r\n\r\n\t\t/* Hide widget */\r\n\t\tfunction hidePopup(cookieValue, eventName) {\r\n\t\t\tcloseCookieModal();\r\n\t\t\tupdateCookieChoiceRadios();\r\n\r\n\t\t\tsetTimeout(function(){\r\n\t\t\t\tcookieManager.setItem(cookieName, cookieValue, 2147483647, '/', parent);\r\n var cookieEvent = new CustomEvent('CookieConsentSet', { detail: cookieValue });\r\n document.dispatchEvent(cookieEvent);\r\n\t\t\t\t// INSERT THE GOOGLE TAG MANAGER SCRIPTS TO THE PAGE\r\n\t\t\t\tinsertGTMScript();\r\n\t\t\t\tmiListener.postEvent(eventName);\r\n\t\t\t}, 0);\r\n\t\t\t\r\n\t\t}\r\n\r\n\t\t// SET THE VALUE OF THE EDIT COOKIE PREFERENCES RADIOS ON COOKIE POLICY PAGE\r\n\t\t// BASED ON COOKIE VALUE SELECTED IN POPUP\r\n\t\tfunction updateCookieChoiceRadios() {\r\n\t\t\tif (cookieManager.hasItem(cookieName)) {\r\n\t\t\t\tif (document.querySelector('.cnf-cookies_cookie-choice__options')) {\r\n\t\t\t\t\tif (cookieManager.getItem(cookieName) === 'true') {\r\n\t\t\t\t\t\tdocument.querySelector('#cookie-choice__input--yes').checked = true;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tdocument.querySelector('#cookie-choice__input--no').checked = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdocument.querySelector('.cnf-cookies_cookie-choice__button').classList.add('cnf-cookies_disabled');\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// UPDATE THE VALUE OF THE COOKIE FROM THE CHOICE MADE ON COOKIE POLICY PAGE\r\n\t\tfunction updateCookieValue(cookieValue) {\r\n\t\t\tcookieManager.setItem(cookieName, cookieValue, 2147483647, '/', parent);\r\n\t\t}\r\n\r\n\t\t//\r\n\t\tfunction insertGTMScript() {\r\n\t\t\tvar s = document.createElement('script');\r\n\t\t\ts.type = 'text/javascript';\r\n\t\t\ts.async = 'true';\r\n\t\t\t// CHANGEING THE URL FROM GOOGLE TO OUR SERVERSIDE TAG\r\n\t\t\t/*s.src = 'https://www.googletagmanager.com/gtm.js?id=' + gtmContainerID;*/\r\n\t\t\ts.src = 'https://sst.confused.com/push?node=' + gtmContainerID;\r\n\t\t\tvar x = document.getElementsByTagName('script')[0];\r\n\t\t\tx.parentNode.insertBefore(s, x);\r\n\t\t}\r\n\r\n\t\tfunction run() {\r\n\t\t\t// REGISTER GTM WITH DATALAYER ON LOAD\r\n\t\t\t// IDEA FOR PROCESS WAS FROM HERE:\r\n\t\t\t// https://stackoverflow.com/questions/60173853/how-to-set-the-google-analytics-cookie-only-after-another-consent-cookie-is-set/60223798#60223798\r\n\r\n\t\t\twindow.dataLayer = window.dataLayer || [];\r\n\t\t\twindow.dataLayer.push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' });\r\n\r\n\t\t\tif (cookieManager.hasItem(cookieName)) {\r\n\t\t\t\t// INSERT THE GOOGLE TAG MANAGER SCRIPTS TO THE PAGE\r\n\t\t\t\tinsertGTMScript();\r\n\r\n\t\t\t\t// IF WE ARE ON COOKIE POLICY PAGE AND COOKIE EXISTS WE NEED TO SET THE RADIOS\r\n\t\t\t\t// TO THE VALUE OF THE COOKIE\r\n\t\t\t\tupdateCookieChoiceRadios();\r\n\t\t\t} else {\r\n\t\t\t\tshowPopup();\r\n\t\t\t}\r\n\r\n\t\t\t// SETUP EVENT HANDLERS ON RADIOS & BUTTONS IN COOKIE WALL MODAL\r\n\t\t\tvar buttons = document.querySelectorAll('.cnf-cookies_save-cookie-prefs');\r\n\t\t\tvar inputs = document.querySelectorAll('.cnf-cookies_cookie-option-holder .cnf-cookies_radio-input');\r\n\r\n\t\t\tArray.prototype.forEach.call(buttons, function (button) {\r\n\t\t\t\t//buttons.forEach(function (button) {\r\n\t\t\t\tbutton.addEventListener('click', function (event) {\r\n\t\t\t\t\tvar btn = event.target;\r\n\t\t\t\t\tvalidateCookieSelection(btn, event);\r\n\t\t\t\t});\r\n\t\t\t});\r\n\r\n\t\t\tArray.prototype.forEach.call(inputs, function (input) {\r\n\t\t\t\t//inputs.forEach(function(input) {\r\n\t\t\t\tinput.addEventListener('change', function (e) {\r\n\t\t\t\t\tremoveErrorClass();\r\n\t\t\t\t\tvar radio = e.target;\r\n\t\t\t\t\tif (radio.closest('.cnf-cookies_cookie-choice__input-wrapper') !== null && cookieManager.hasItem(cookieName)) {\r\n\t\t\t\t\t\tdocument.querySelectorAll('.cnf-cookies_cookie-choice__button').forEach(function(button) {\r\n button.classList.toggle('cnf-cookies_disabled');\r\n });\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t});\r\n\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tfunction wasCookiePopupShown() {\r\n\t\t\treturn cookiePopupShown;\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\trun: run,\r\n\t\t\twasCookiePopupShown: wasCookiePopupShown,\r\n\t\t};\r\n\t})(new w.Confused.CookieManagerV2());\r\n})(window);\r\n","var CONFUSEDCORE = CONFUSEDCORE || {};\r\n\r\n//// THIS IS TO INITIALISE COOKIE POP UP & TRIGGER MI EVENTS IN STANDALONE COOKIE POP UP SCRIPT\r\n//// TO MAINLY BE USED ON STANDALONE PIECES TO BE HOSETED IN CMS\r\n\r\n// This function runs when the page is loaded\r\ndocument.addEventListener('DOMContentLoaded', function() {\r\n\r\n\tvar pageUrl = window.location.href;\r\n\r\n var cookiePolicyWidget = window.Confused.CookiePolicyWidget;\r\n cookiePolicyWidget.run();\r\n\r\n\t// TRIGGER NEW SESSION CALL IN MI - WAIT FOR CALLBACK FROM SESSION CALL THEN TRIGGER COOKIE POPUP SHOWN EVENT\r\n\tvar miListener = CONFUSEDCORE.MI.MiListener;\r\n\tmiListener.postPageView('LogPageView', { page: pageUrl, referer: document.referrer }, function () {\r\n if (cookiePolicyWidget.wasCookiePopupShown()) {\r\n\t\t\tmiListener.postEvent('CookiePopupShown');\r\n\t\t}\r\n\t});\r\n});"]}