s.yimg.com Open in urlscan Pro
2a00:1288:80:800::7001  Public Scan

URL: https://s.yimg.com/oa/build/js/site-b55c408f.js
Submission: On February 05 via api from US — Scanned from GB

Form analysis 0 forms found in the DOM

Text Content

(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
'use strict';

/**
 * algorithm specification
 */
var keyType = {
    name: 'ECDSA',
    namedCurve: 'P-256',
    hash: { name: 'SHA-256' }
};

var agentAuthUrlParts = {
    registrationUrl: '/device/cookies',
    verificationUrl: '/device/cookies/validate',
    beacon: '/beacon',
}

var cryptoTag = 'crypto-not-supported';

var localStorageKeys = {
    prvKey:'VM_AGENTAUTH_PRV_KEY',
    publicKey: 'VM_AGENTAUTH_PUB_KEY',
    accessToken: 'VM_AGENTAUTH_TOKEN'
}

var sessionKey = {
        /**
         * Browser do not support crypto flow
         */
        NotSupported : 0,
        /**
         * User is eligible for agentAuth and registered.
         */
        Registered : 1,
        /**
         * User is not eligible for agentAuth
         */
        NotEligible : 2
}

var daysBeforeTokenRefresh = 7;

/**
 * convert str to uint8 format
 * @param str - String to be encoded
 * @return Array
 */
function strToUint8(str) {
    return new TextEncoder().encode(str);
}

/**
 * convert string to base64 format
 * @param str - String to be converted to base64
 * @return String
 */
function strToUrlBase64(str) {
    return binaryToUrlBase64(utf8ToBinaryString(str));
}

/**
 * convert binary to base64 format
 * @param bin - String to be converted to base64
 * @return String
 */
function binaryToUrlBase64(bin) {
    return btoa(bin)
        .replace(/\+/g, '-')
        .replace(/\//g, '_')
        .replace(/=+/g, '');
}

/**
 * convert utf8 to binary string format
 * @param str - String to be converted to binary string
 * @return String
 */
function utf8ToBinaryString(str) {
    var escstr = encodeURIComponent(str);
    var binstr = escstr.replace(/%([0-9A-F]{2})/g, function (match, p1) {
        return String.fromCharCode(parseInt(p1, 16));
    });

    return binstr;
}

/**
 * convert uint8 to base64 format
 * @param uint8 - Array buffer to be converted to base64
 * @return String
 */
function uint8ToUrlBase64(uint8) {
    var binary = '';
    uint8.forEach(function (code) {
        binary += String.fromCharCode(code);
    });
    return binaryToUrlBase64(binary);
}

/**
 * create signature and jwt from payload and header
 * @param publicKey - String
 * @param prvKey - String
 * @param payload - Object
 * @return String
 */
function signAndGenerateJWT(publicKey, prvKey, payload) {
    var headers = {
        typ: 'dpop+jwt',
        alg: 'ES256',
        jwk: publicKey
    };
    var jws = {
        headers: strToUrlBase64(JSON.stringify(headers)),
        payload: strToUrlBase64(JSON.stringify(payload))
    };
    var privileges = ['sign'];
    return window.crypto.subtle
        .importKey('jwk', prvKey, keyType, true, privileges)
        .then(function (prvKey) {
            var data = strToUint8(jws.headers + '.' + jws.payload);
            var sigType = { name: keyType.name, hash: keyType.hash };

            return window.crypto.subtle.sign(sigType, prvKey, data).then(function (signature) {
                jws.signature = uint8ToUrlBase64(new Uint8Array(signature));
                return jws.headers + '.' + jws.payload + '.' + jws.signature;
            });
        });
}

/**
 * generate crypto key pair via subtle crypto
 * @return Promise
 */
function generateKey() {
    var privileges = ['sign', 'verify'];
    return window.crypto.subtle.generateKey(keyType, true, privileges).then(function (key) {
        return window.crypto.subtle.exportKey('jwk', key.privateKey);
    });
}

/**
 * generate public key
 * @param jwk - Object
 * @return Object
 */
function generatePublicKey(jwk) {
    var cloneKey = Object.assign({}, jwk);
    delete cloneKey.d;
    cloneKey.key_ops = ['verify'];
    return cloneKey;
}


/**
 * get Item from Local storage
 * @param key - string
 * @return Object
 */
function getItemFromLS(key) {
    var valueString = localStorage.getItem(key);
    return valueString ? valueString : '';
}


/**
 * store value in localstorage
 * @param key - string
 * @param value - string
 * @return Object
 */
function setItemInLS(key, value) {
    return localStorage.setItem(key, value);
}


/**
 * get Item from Local storage
 * @param key - string
 * @return Object
 */
function getCrytoKeyFromLS(key) {
    var valueString = getItemFromLS(key);
    return valueString ? JSON.parse(valueString) : null;
}

/**
 * store value in localstorage
 * @param key - string
 * @param value - crypto key
 * @return Object
 */
function setCryptoKeyInLS(key, value) {
    var valueString = JSON.stringify(value);
    return setItemInLS(key, valueString);
}

/**
 * dispatch agent auth event to update parent from iframe with session detail
 * @param data - Object
 */
function dispatchAgentAuthRegistrationEvent (sessionKey){
    var data = {sessionKey: sessionKey};
    var event = new CustomEvent("agentAuthRegistrationSuccess", {detail: data});
    window.dispatchEvent(event);
}

/**
 * store access token in local storage and update parent from iframe
 * @param data - Object
 */
function processCookieApiResponse(data) {
    var accessToken = JSON.parse(data.response).access_token;
    setItemInLS(localStorageKeys.accessToken, accessToken);
    dispatchAgentAuthRegistrationEvent(sessionKey.Registered);
}


/**
 * check string value for true
 * @param key - string
 * @param value - crypto key
 * @return Object
 */
function checkStringToBoolean(value) {
    return value === 'true';
}

/**
 * fetch access token abd cookie with agentid from cookie issuance api
 * @param jwt - String
 */
function getAccessToken(jwt, accessToken) {
    var xhr = new XMLHttpRequest();
    var params = JSON.stringify({
        "src": "js",
        "srcv": "1.2.1"
    });

    xhr.open('POST', agentAuthUrlParts.registrationUrl, true);
    xhr.withCredentials = true;
    xhr.setRequestHeader('DPoP', jwt);
    xhr.setRequestHeader('Authorization', accessToken);
    xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
    xhr.onreadystatechange = function () {
        if (this.readyState == 4 && this.status == 200)
            processCookieApiResponse(this);
    };
    xhr.send(params);
}

/**
 * redirect to identity with amr token
 * @param data - Object
 */
function redirectToIdentity(data) {
    var parsedData = data && data.response ? JSON.parse(data.response): {};
    var event = new CustomEvent("agentAuthVerificationComplete", {detail: data && data.status == 200 ? parsedData.device_id_token : ''});
    window.dispatchEvent(event);
}

/**
 * fetch identity token and validate cookie for agent id
 * @param data - Object
 */
function getAccessTokenVerify(jwt, accessToken, nonce) {
    var xhr = new XMLHttpRequest();
    var params = JSON.stringify({
        "nonce": nonce,
        "src": "js",
        "srcv": "1.2.1"
    });

    xhr.open('POST', agentAuthUrlParts.verificationUrl, true);
    xhr.withCredentials = true;
    xhr.setRequestHeader('DPoP', jwt);
    xhr.setRequestHeader('Authorization','DPoP' +" "+ accessToken);
    xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
    xhr.onreadystatechange = function () {
        if (this.readyState == 4)
            redirectToIdentity(this);
    };
    xhr.send(params);
}

/**
 * event listener for authRegistration event to initiate flow
 * @param urlparts - String
 * @param method - String
 * @return Object
 */
function createPayload(urlparts, method) {
    return {
        "jti": Math.random().toString(16).slice(2,9),
        "htm": method,
        "htu": location.protocol + '//' + location.host + urlparts,
        "iat": Math.round(Date.now()/1000)
    };
}

/**
 * check for ie and update crypto
 */
 function addCryptoIESupport() {
    if((/Edge/.test(navigator.userAgent))||document.documentMode) {
        window.crypto = window.msCrypto;
    };
}

/**
 * log user agent detail using beacon api
 * @param userAgent - string
 */
function logAgentAuthEvents(tag, step, userType) {
    var params = '?tag='+ tag + '&step='+ step + '&userType=' + userType;
    var xhr = new XMLHttpRequest();
    var url = agentAuthUrlParts.beacon + params;
    xhr.open("GET", url, true);
    xhr.setRequestHeader('Content-Type', 'application/json');
    xhr.send(null);
}

/**
 * check for crypto support
 */
function isCryptoSupported() {
    if(window.crypto && window.crypto.subtle && window.crypto.subtle.sign && window.crypto.subtle.generateKey && window.crypto.subtle.exportKey) {
        return true;
    }
    return false;
}

/**
 * check for access token refresh
 */
function isTokenRefresh(accessToken) {
    if (accessToken) {
        var encodedPayload = accessToken.split('.')[1];
        var decodePayload = JSON.parse(atob(encodedPayload));
        var todayDateInSeconds = Math.round(Date.now() / 1000);

        return (
            decodePayload.exp <
            todayDateInSeconds + (daysBeforeTokenRefresh * 3600 * 24)
        );
    } else {
        return false;
    }
}

/**
 * Initiate agent Authentication registration flow
 */
function initiateRegistrationFlow() {
    return generateKey().then(function (jwk) {
        var payload = createPayload(agentAuthUrlParts.registrationUrl, 'POST');
        var publicKey = generatePublicKey(jwk);

        setCryptoKeyInLS(localStorageKeys.publicKey, publicKey);
        setCryptoKeyInLS(localStorageKeys.prvKey, jwk);
        return signAndGenerateJWT(publicKey, jwk, payload).then(function (jwt) {
            getAccessToken(jwt, '');
        });
    });
}

/**
 * Initiate agent Authentication registration flow
 */
function initiateTokenRefreshFlow() {
    var accessToken = getItemFromLS(localStorageKeys.accessToken);
    if(accessToken && isTokenRefresh(accessToken)) {
        var payload = createPayload(agentAuthUrlParts.registrationUrl, 'POST');
        var publicKeyLocalStorage = getCrytoKeyFromLS(localStorageKeys.publicKey);
        var prvKeyLocalStorage = getCrytoKeyFromLS(localStorageKeys.prvKey);
        return signAndGenerateJWT(publicKeyLocalStorage, prvKeyLocalStorage, payload).then(function (jwt) {
            getAccessToken(jwt, accessToken);
        });
    } else {
        dispatchAgentAuthRegistrationEvent();
        return ;
    }
}

/**
 * Initiate agent Authentication verification flow
 */
function initiateVerificationFlow(nonce) {
    var payload = createPayload(agentAuthUrlParts.verificationUrl, 'POST');
    var publicKeyLocalStorage = getCrytoKeyFromLS(localStorageKeys.publicKey);
    var prvKeyLocalStorage = getCrytoKeyFromLS(localStorageKeys.prvKey);
    var accessToken = getItemFromLS(localStorageKeys.accessToken)
    return signAndGenerateJWT(publicKeyLocalStorage, prvKeyLocalStorage, payload).then(function (jwt) {
        getAccessTokenVerify(jwt, accessToken, nonce);
    });
}


/**
 * event listener for authRegistration event to initiate flow
 */
window.addEventListener('agentAuthRegistration', function (e) {
    // check for ie and update crypto
    addCryptoIESupport();
    if(isCryptoSupported()){
        if(checkStringToBoolean(e.detail.isAgentIdCookie)) {
            return initiateTokenRefreshFlow();
        } else {
            return initiateRegistrationFlow();
        }
    } else {
        // log user agent details when crypto is not supported
        logAgentAuthEvents(cryptoTag, 'agentAuthRegistration',  window.navigator.userAgent);
        dispatchAgentAuthRegistrationEvent(sessionKey.NotSupported);
    }
});

/**
 * event listener for agentAuthVerification event to initiate flow
 */
window.addEventListener('agentAuthVerification', function (e) {
    // check for ie and update crypto
    addCryptoIESupport();
    if(isCryptoSupported()){
        if(checkStringToBoolean(e.detail.isAgentIdCookie)) {
            return initiateVerificationFlow(e.detail.nonce);
        } else {
            redirectToIdentity(null);
        }
    } else {
        // log user agent details when crypto is not supported
        logAgentAuthEvents(cryptoTag, 'agentAuthVerification', window.navigator.userAgent);
        redirectToIdentity(null);
    }
});

},{}],2:[function(require,module,exports){
'use strict';

/**
 * Checks if the element contains the specified class name.
 */
function containsClass(element, className) {
    if (!element || typeof className !== 'string') {
        throw TypeError('containsClass: Invalid argument type');
    }
    return element.className.trim().split(/\s+/gi).indexOf(className) > -1 ;
}

function updateQueryStringParameter(uri, key, value) {
    var re = new RegExp('([?&])' + key + '=.*?(&|$)', 'i');
    var separator = uri.indexOf('?') !== -1 ? '&' : '?';
    if (uri.match(re)) {
        return uri.replace(re, '$1' + key + '=' + value + '$2');
    }
    else {
        return uri + separator + key + '=' + value;
    }
}

function onLanguageChange(event) {
    var newLang = event.target.value;
    window.location.href = updateQueryStringParameter(window.location.href, 'lang', newLang);
}

function disableFormButtons() {
    var agreeButton = document.querySelector('.agree'),
        disagreeButton = document.querySelector('.disagree');

    if (agreeButton) {
        agreeButton.disabled = true;
    }
    if (disagreeButton) {
        disagreeButton.disabled = true;
    }

}

function handleDoubleSubmit(event) {
    var formElement = event.currentTarget,
        altSubmitField = formElement.querySelectorAll('input[data-name="alt-submit"]')[0];

    /* This creates another submit input in the DOM and sets it's name and value
        to the button that was clicked
     */
    if (!altSubmitField) {
        altSubmitField = document.createElement('input');
        altSubmitField.setAttribute('type', 'hidden');
        altSubmitField.setAttribute('data-name', 'alt-submit');
        formElement.appendChild(altSubmitField);
    }

    if ((event.type === 'click' || event.type === 'touchstart') && event.target.type === 'submit') {
        altSubmitField.setAttribute('name', event.target.name);
        altSubmitField.setAttribute('value', event.target.value);
    }

    if (event.type === 'submit') {
        disableFormButtons();
    }

    return true;
}

function addClass(element, name) {
    if (!containsClass(element, name)) {
        if ('classList' in element) {
            element.classList.add(name);
        } else {
            var c = element.className;
            element.className = c ? [c, name].join(' ') : name;
        }
    }
}

function removeClass(element, name) {
    if (containsClass(element, name)) {
        if ('classList' in element) {
            element.classList.remove(name);
        } else {
            var c = element.className;
            element.className = c.replace(new RegExp('(?:^|\\s+)' + name + '(?:\\s+|$)', 'g'), '');
        }
    }
}

function setupEUMoreOptionsToggle(tapEventName) {
    var toggleButtons = document.querySelectorAll('.boxed-content input[type="checkbox"]');
    var isTouchStart = tapEventName === 'touchstart';

    if(!toggleButtons) {
        return;
    }

    Array.prototype.forEach.call(toggleButtons, function(toggleButton) {

        var toolTipElement = toggleButton.parentElement;
        var errorElement = toolTipElement.nextElementSibling;
        var changeCount = 0;

        if (isTouchStart) {
            document.body.addEventListener('touchstart', function() {
                removeClass(toolTipElement, 'touched-once');
            });
        }
        toggleButton.addEventListener('change', function() {
            var tooltipText = '';

            if (isTouchStart && changeCount < 1) {
                this.checked = true;
                addClass(toolTipElement, 'checked-active');
                removeClass(errorElement, 'active');
                changeCount++;
                addClass(toolTipElement, 'touched-once');
                return;
            }

            removeClass(toolTipElement, 'touched-once');
            if (toggleButton.checked) {
                changeCount = 0;
                tooltipText = toolTipElement.getAttribute('data-tooltip-on');
                addClass(toolTipElement, 'checked-active');
                removeClass(errorElement, 'active');
            } else {
                tooltipText = toolTipElement.getAttribute('data-tooltip-off');
                removeClass(toolTipElement, 'checked-active');
                addClass(errorElement, 'active');
            }
            if (tooltipText) {
                toolTipElement.setAttribute('data-tooltip', tooltipText);
            }
        });
    });
}

function displayScrollToContinue(tapEvent) {

    var footer = document.querySelector('.footer');
    var scrollContainer = document.querySelector('.scroll-container');
    var readMoreTip = document.querySelector('.read-more-tip');
    var bodyElement = document.querySelector('body');
    var parkPage = document.querySelector('.park-page-body');
    var tppPage = document.querySelector('.tpp');
    var EUBtnGroup = document.querySelector('.eu .btn-group');
    var singlePage = document.querySelector('.eu-single-page');
    var manageOptionsPage = document.querySelector('.manage-options');

    if (parkPage) {
        return;
    }

    if (tppPage && EUBtnGroup) {
        addClass(EUBtnGroup, 'active');
        return;
    }

    var isBodyScrolling;

    var scrollBox;
    if (bodyElement.clientHeight > window.innerHeight + 100 && !(window.innerHeight + window.pageYOffset + 50 > document.body.scrollHeight)) {
        isBodyScrolling = true;
        scrollBox = bodyElement;
    }

    if (scrollBox) {
        if(scrollContainer && footer) {

            if (manageOptionsPage) {
                addClass(manageOptionsPage, 'active');
            } else if(!singlePage) {
                addClass(footer, 'active');
                addClass(scrollContainer, 'active');
            }

            readMoreTip.addEventListener(tapEvent, function() {
                isBodyScrolling ? window.scrollBy(0, window.innerHeight) : scrollBox.scrollTop += scrollBox.clientHeight;
                if (isBodyScrolling) {
                    if (window.innerHeight + window.pageYOffset + 50 > document.body.scrollHeight) {
                        removeClass(scrollContainer, 'active');
                        removeClass(footer, 'active');
                    }
                } else {
                    if (scrollBox.offsetHeight + scrollBox.scrollTop + 50 >= scrollBox.scrollHeight) {
                        removeClass(scrollContainer, 'active');
                        removeClass(footer, 'active');
                    }
                }
            });
        }
        if (EUBtnGroup) {
            EUBtnGroup.style.display = 'block';
        }
    } else if (EUBtnGroup && !singlePage) {
        if ((window.innerHeight - 50 > bodyElement.clientHeight)) {
            var paddingValue = (window.innerHeight - bodyElement.clientHeight - 50);
            paddingValue = paddingValue > 0 ? paddingValue : 0;
            if (window.innerWidth > 1000) {
                paddingValue = 0;
            }
            addClass(EUBtnGroup, 'active');
            EUBtnGroup.style.paddingTop = paddingValue + 'px';
        } else {
            EUBtnGroup.style.display = 'block';
        }
    }

}

function showCookieFail() {
    var cookieAlert = document.getElementById('cookieWarning');
    addClass(cookieAlert, 'active');
}

function checkCookie(){
    var cookieEnabled = navigator.cookieEnabled;
    if (!cookieEnabled){
        document.cookie = 'testcookie';
        cookieEnabled = document.cookie.indexOf('testcookie')!= -1;
    }
    return cookieEnabled || showCookieFail();
}

function detectIE(scrollContainer, footer) {

    var IEInterval;

    var IEScrollHandler = function() {
        if (scrollContainer && footer) {
            if (window.innerHeight + window.pageYOffset + 50 > document.body.scrollHeight) {
                removeClass(scrollContainer, 'active');
                removeClass(footer, 'active');
                window.clearInterval(IEInterval);
            }
        }
    };

    if (/Edge/.test(navigator.userAgent)) {
        addClass(document.body, 'edge');
    }

    if (document.documentMode) {
        addClass(document.body, 'ie');
        IEInterval = window.setInterval(IEScrollHandler, 200);
    }
}

function fireBeacon(element, tag) {
    var xhr = new XMLHttpRequest();
    var url = '/beacon';
    var consentForm = document.querySelector('.consent-form');
    var sessionId;
    var isSDK;
    var tos;
    var userType;
    var brandBid;
    var step;
    var country;

    if (consentForm) {
        sessionId = document.querySelector('[name="sessionId"]');
        isSDK = document.querySelector('[name="isSDK"]');
        tos = document.querySelector('[name="tosId"]');
        brandBid = document.querySelector('[name="brandBid"]');
        userType = document.querySelector('[name="userType"]');
        step = document.querySelector('[name="consentCollectionStep"]');
        country = document.querySelector('[name="country"]');
    }

    url = url + '?sessionId=' + (sessionId ? sessionId.value : '');
    url = url + '&sdk=' + (isSDK ? isSDK.value : '');
    url = url + '&tag=' + tag;
    url = url + '&tos=' + (tos ? tos.value : '');
    url = url + '&brandBid=' + (brandBid ? brandBid.value : '');
    url = url + '&userType=' + (userType ? userType.value : '');
    url = url + '&step=' + (step ? step.value : '');
    url = url + '&country=' + (country ? country.value : '');

    if (consentForm) {
        xhr.open('GET', url, true);
        xhr.setRequestHeader('Content-Type', 'application/json');
        xhr.send(null);
    }

}

function setupBeacon() {
    var mailMoreOptionsToggle = document.getElementById('mail-checkbox');
    var purposeListToggle = document.querySelectorAll('input[id^="purpose-"]');
    var vendorListToggle = document.querySelectorAll('input[id^="vendor-"]');
    if (mailMoreOptionsToggle) {
        mailMoreOptionsToggle.addEventListener('change', function() {
            fireBeacon(mailMoreOptionsToggle, 'mail');
        });
    }
    if (purposeListToggle) {
        Array.prototype.forEach.call(purposeListToggle, function(purpose) {
            purpose.addEventListener('change', function() {
                fireBeacon(purpose, purpose.id);
            });
        });
    }
    if (vendorListToggle) {
        Array.prototype.forEach.call(vendorListToggle, function(vendor) {
            vendor.addEventListener('change', function() {
                fireBeacon(vendor, vendor.id);
            });
        });
    }
}

function setupSinglePageExpand(tapEvent) {
    var expandLearnMoreLink = document.querySelector('.expand-learn-more-link');
    var agreeBtnGroup = document.querySelector('.eu .eu-single-page .agree-button-group');
    var manageOptionsBtnGroup = document.querySelector('.eu .eu-single-page .more-options-button-group');
    var singlePageDataSection = document.getElementById('single-page-data');
    var singlePagePartnersSection = document.getElementById('single-page-partners');
    var singlePageMailSection = document.getElementById('single-page-mail');
    var consentStepBody = document.querySelector('.consent-step-body.scrollbox');

    if (expandLearnMoreLink) {
        addClass(expandLearnMoreLink, 'active');
        expandLearnMoreLink.addEventListener(tapEvent, function() {

            if (!containsClass(agreeBtnGroup, 'active')) {
                fireBeacon(expandLearnMoreLink, 'singlePageExpanded');
            }

            removeClass(expandLearnMoreLink, 'active');

            if (agreeBtnGroup) {
                addClass(agreeBtnGroup, 'active');
            }

            if (manageOptionsBtnGroup) {
                addClass(manageOptionsBtnGroup, 'active');
            }

            if (singlePageDataSection) {
                addClass(singlePageDataSection, 'active');
            }

            if (singlePagePartnersSection) {
                addClass(singlePagePartnersSection, 'active');
            }

            if (singlePageMailSection) {
                addClass(singlePageMailSection, 'active');
            }

            if (consentStepBody) {
                addClass(consentStepBody, 'expanded');
            }
        });
    }
}

function setupExperimentalPage(tapEvent) {
    var expandLearnMoreLink = document.querySelector('.experimental-expand-learn-more');
    var learnMoreSection = document.querySelector('.experimental-learn-more');
    if (expandLearnMoreLink && learnMoreSection) {
        expandLearnMoreLink.addEventListener(tapEvent, function() {
            addClass(expandLearnMoreLink, 'plain-text');
            removeClass(learnMoreSection, 'hidden');
        });
    }
}
function setupFakeBgPage(tapEvent) {
    var expandLearnMoreLink = document.querySelector('.expand-learn-more');
    var learnMoreSection = document.querySelector('.learn-more-content');
    if (expandLearnMoreLink && learnMoreSection) {
        expandLearnMoreLink.addEventListener(tapEvent, function() {
            addClass(expandLearnMoreLink, 'plain-text');
            removeClass(learnMoreSection, 'hidden');
        });
    }
}

/* consent 1.8 */
function setupOptinAll(tapEvent) {
    var contianerElm = document.querySelector('#consent-page .enable-optin-all');
    var ctaSelectAll;
    var selectElments;
    var ctaSelectAllToggle;
    if (contianerElm) {
        ctaSelectAll = contianerElm.querySelector('.optin-all');
        ctaSelectAllToggle = ctaSelectAll.querySelector('.toggle-control');
        selectElments = contianerElm.querySelectorAll('.optin');
        if (ctaSelectAll && selectElments) {
            contianerElm.querySelector('.optin-all').style.display = 'inline-block';
            ctaSelectAll.addEventListener(tapEvent, function() {
                var newState = !ctaSelectAllToggle.checked;
                for (var i = 0; i < selectElments.length; i++) {
                    selectElments[i].checked = newState;
                }
                ctaSelectAllToggle.checked = newState;
            });
        }
    }
}

/* consent 2.0 */
function selectAllConsentAndLegitAll(tapEvent) {
    setIABToggleAllBtnState();
    var legitimateInterestToggles,
        consentToggles;
    var purposeConsentAllElm = document.querySelector('#consent-page #select-consent-all-purpose');
    var purposeLegitAllElm = document.querySelector('#consent-page #select-legit-all-purpose');
    var partnerConsentAllElm = document.querySelector('#consent-page #select-consent-all-partner');
    var partnerLegitAllElm = document.querySelector('#consent-page #select-legit-all-partner');
    var IABData = document.querySelector('#consent-page .iab-data');

    if (IABData) {
        legitimateInterestToggles = IABData.querySelectorAll('.legit .optin');
        consentToggles = IABData.querySelectorAll('.consent .optin');
    }

    if (purposeLegitAllElm && partnerLegitAllElm && legitimateInterestToggles.length > 0) {
        var purposeLegitAllInputElm = purposeLegitAllElm.querySelector('input[type="checkbox"]');
        var partnerLegitAllInputElm = partnerLegitAllElm.querySelector('input[type="checkbox"]');

        purposeLegitAllElm.addEventListener(tapEvent, function(event) {
            event.preventDefault();
            var purposeLegitToggleState = !purposeLegitAllInputElm.checked;
            if (event.target.classList.contains('slider') || event.target.classList.contains('toggleAll')) {
                partnerLegitAllInputElm.checked = purposeLegitToggleState;
                for (var i = 0; i < legitimateInterestToggles.length; i++) {
                    legitimateInterestToggles[i].checked = purposeLegitToggleState;
                }
            }
            purposeLegitAllInputElm.checked = purposeLegitToggleState;
        });

        partnerLegitAllElm.addEventListener(tapEvent, function(event) {
            event.preventDefault();
            var partnerLegitToggleState = !partnerLegitAllInputElm.checked;
            if (event.target.classList.contains('slider') || event.target.classList.contains('toggleAll')) {
                purposeLegitAllInputElm.checked = partnerLegitToggleState;
                for (var i = 0; i < legitimateInterestToggles.length; i++) {
                    legitimateInterestToggles[i].checked = partnerLegitToggleState;
                }
            }
            partnerLegitAllInputElm.checked = partnerLegitToggleState;
        });
    }

   if (purposeConsentAllElm && partnerConsentAllElm && consentToggles.length > 0) {
        var purposeConsentAllInputElm = purposeConsentAllElm.querySelector('input[type="checkbox"]');
        var partnerConsentAllInputElm = partnerConsentAllElm.querySelector('input[type="checkbox"]');

        purposeConsentAllElm.addEventListener(tapEvent, function(event) {
            event.preventDefault();
            var purposeConsentToggleState = !purposeConsentAllInputElm.checked;
            if (event.target.classList.contains('slider') || event.target.classList.contains('toggleAll')) {
                partnerConsentAllInputElm.checked = purposeConsentToggleState;
                for (var i = 0; i < consentToggles.length; i++) {
                    consentToggles[i].checked = purposeConsentToggleState;
                }
            }
            purposeConsentAllInputElm.checked = purposeConsentToggleState
        });

        partnerConsentAllElm.addEventListener(tapEvent, function(event) {
            event.preventDefault();
            var partnerConsentToggleState = !partnerConsentAllInputElm.checked;
            if (event.target.classList.contains('slider') || event.target.classList.contains('toggleAll')) {
                purposeConsentAllInputElm.checked = partnerConsentToggleState;
                for (var i = 0; i < consentToggles.length; i++) {
                    consentToggles[i].checked = partnerConsentToggleState;
                }
            }
            partnerConsentAllInputElm.checked = partnerConsentToggleState
        });
    }
}

function setToggleAllBtnState(container, toggleType){
    var toggleAllButtonState = false;
    var allToggles = container.querySelectorAll('.switch.' + toggleType + ' input[type="checkbox"].optin').length;
    var allTogglesChecked = container.querySelectorAll('.switch.' + toggleType + ' input[type="checkbox"]:checked.optin').length;
    if (allToggles > 0 && allTogglesChecked === allToggles) {
        toggleAllButtonState = true;
    }

    var selectAllBtn = container.querySelector('#select-' + toggleType + '-all-purpose input[type="checkbox"].optin');
    if (selectAllBtn) {
        selectAllBtn.checked = toggleAllButtonState;
    }
}

function setIABToggleAllBtnState() {
    var iabDataContainer = document.querySelector('#iab-partners .iab-data');
    if (iabDataContainer) {
        setToggleAllBtnState(iabDataContainer, "legit");
        setToggleAllBtnState(iabDataContainer, "consent");
    }
}

function selectAllFirstPartyDataAll(tapEvent) {
    var consentAllElm = document.querySelector('#consent-page #first-party-toggle-all');
    var consentToggles = document.querySelectorAll('#consent-page .first-party .table-list .consent .optin');

    if (consentAllElm && consentToggles.length > 0) {
        var consentAllInputElm = consentAllElm.querySelector('input[type="checkbox"]');
        consentAllElm.addEventListener(tapEvent, function(event) {
            event.preventDefault();
            var consentAllElmToggleState = !consentAllInputElm.checked;
            for (var i = 0; i < consentToggles.length; i++) {
                consentToggles[i].checked = consentAllElmToggleState
            }
            consentAllInputElm.checked = consentAllElmToggleState;
        });
    }
}

/**
 * toggleOnRelatedPartners
 * @param partnerListElements - partner Elements associated with the selected purpose
 * @param toggleType  -  legit or consent
 */

function toggleOnRelatedPartners(partnerListElements, toggleType) {
    for (var i = 0; i < partnerListElements.length; i++) {
        var partnerToggleElement = document.querySelector('#' + partnerListElements[i].dataset.partnerId + ' [data-toggle-type=' + toggleType + ']');
        if (partnerToggleElement) {
            partnerToggleElement.checked = true;
        }
    }
}

/**
 * toggleOffRelatedPartners
 * @param partnerListElements - partner Elements associated with the selected purpose
 * @param toggleType  - legit or consent
 */
function toggleOffRelatedPartners(partnerListElements, toggleType) {
    for (var i = 0; i < partnerListElements.length; i++) {
        var partnerElement = document.getElementById(partnerListElements[i].dataset.partnerId);
        var partnerToggleElement = partnerElement.querySelector('[data-toggle-type=' + toggleType + '][type="checkbox"]:checked');
        if (partnerToggleElement) {
            var purposeListElements = partnerElement.querySelectorAll('.more-details .details-list .values .value');
            var purposeSelected = false;
            for (var j = 0; j < purposeListElements.length; j++) {
                var checkedElement = document.querySelector('#' + purposeListElements[j].dataset.purposeId + ' [data-toggle-type=' + toggleType + '][type="checkbox"]:checked');
                if (checkedElement) {
                    purposeSelected = true;
                    break;
                }
            }
            if (!purposeSelected) {
                partnerToggleElement.checked = false;
            }
        }
    }
}
/*
 * Toggle partners for consent 2.0 workflow
 *
 * 1. toggleOnPurpose legitimateInterest or Consent on Purpose Tab
 *    - All corresponding partners list for each purpose should be selected in partner tab
 *
 * 2. toggleOffPurpose legitimateInterest or Consent on Purpose Tab
 *    - Ensure all the purposes of the partners associated are turned off, only then toggle off
 *      partner list for the corresponding purpose
 *
 * @param tapEvent -- click event
 */
function togglePurposeAndPartners(tapEvent) {
    var IABData = document.querySelector('#consent-page .iab-data');
    if (!IABData) {
        return;
    }
    IABData.addEventListener(tapEvent, function(event) {
        if (!event.target.hasAttribute('data-toggle-type')) {
            return;
        }
        var toggleElement = event.target;
        if (!IABData.contains(toggleElement)) {
            return;
        }
        if (toggleElement.name.includes("data-iab-partner")) {
            return;
        }
        var toggleType = toggleElement.dataset.toggleType;
        var purposeElement = document.getElementById(toggleElement.dataset.purposeId);
        if (purposeElement) {
            var partnerListElements = purposeElement.querySelectorAll('.iab-partners .purpose-partners .list-item');
            if (toggleElement.checked) {
                toggleOnRelatedPartners(partnerListElements, toggleType);
            } else {
                toggleOffRelatedPartners(partnerListElements, toggleType);
            }
        }
    });
}

function setupTppSelectAll(tapEvent) {
    var tppVendors = document.querySelector('.tpp.tpp-vendors');

    if (!tppVendors) {
        return;
    }

    var iabVendors = document.querySelectorAll('#iabVendors input[type="checkbox"]');
    var checkediabVendors = document.querySelectorAll('#iabVendors input[type="checkbox"]:checked');
    var otherVendors = document.querySelectorAll('#otherVendors input[type="checkbox"]');
    var checkedOtherVendors = document.querySelectorAll('#otherVendors input[type="checkbox"]:checked');
    var IABtppSelectAll = document.querySelector('#iabVendors .tpp-select-all');
    var IABtppDeslectAll = document.querySelector('#iabVendors .tpp-deselect-all');
    var otherstppSelectAll = document.querySelector('#otherVendors .tpp-select-all');
    var otherstppDeselectAll = document.querySelector('#otherVendors .tpp-deselect-all');

    function setRightLabel(selectAll, deselectAll, vendors, className) {
        checkediabVendors = document.querySelectorAll(className + ' input[type="checkbox"]:checked');
        if (checkediabVendors.length <= (vendors.length * 0.25)) {
            removeClass(deselectAll, 'active');
            addClass(selectAll, 'active');
        } else {
            removeClass(selectAll, 'active');
            addClass(deselectAll, 'active');
        }
    }

    if (IABtppSelectAll && IABtppDeslectAll && iabVendors) {

        setRightLabel(IABtppSelectAll, IABtppDeslectAll, iabVendors, '#iabVendors');

        IABtppSelectAll.addEventListener(tapEvent, function() {
            for (var i = 0; i < iabVendors.length; i++) {
                iabVendors[i].checked = true;
            }
            removeClass(IABtppSelectAll, 'active');
            addClass(IABtppDeslectAll, 'active');
        });

        IABtppDeslectAll.addEventListener(tapEvent, function () {
            for (var i = 0; i < iabVendors.length; i++) {
                iabVendors[i].checked = false;
            }
            removeClass(IABtppDeslectAll, 'active');
            addClass(IABtppSelectAll, 'active');
        });

        Array.prototype.forEach.call(iabVendors, function(vendor) {
            vendor.addEventListener('change', function() {
                setRightLabel(IABtppSelectAll, IABtppDeslectAll, iabVendors, '#iabVendors');
            });
        });
    }

    if (otherstppSelectAll && otherstppDeselectAll && otherVendors) {

        setRightLabel(otherstppSelectAll, otherstppDeselectAll, otherVendors, '#otherVendors');

        otherstppSelectAll.addEventListener(tapEvent, function() {
            for (var i = 0; i < otherVendors.length; i++) {
                otherVendors[i].checked = true;
            }
            removeClass(otherstppSelectAll, 'active');
            addClass(otherstppDeselectAll, 'active');
        });

        otherstppDeselectAll.addEventListener(tapEvent, function () {
            for (var i = 0; i < otherVendors.length; i++) {
                otherVendors[i].checked = false;
            }
            removeClass(otherstppDeselectAll, 'active');
            addClass(otherstppSelectAll, 'active');
        });

        Array.prototype.forEach.call(checkedOtherVendors, function(vendor) {
            vendor.addEventListener('change', function() {
                checkedOtherVendors = document.querySelectorAll('#otherVendors input[type="checkbox"]:checked');
                setRightLabel(otherstppSelectAll, otherstppDeselectAll, otherVendors, '#otherVendors');
            });
        });
    }
}

/* EECC mail consent */
function enableMailConsentDoneButton(tapEvent) {
    var mailConsentElem = document.querySelector('.theme-2.mail-consent .mailbox-consent-type');
    var mailFeaturesOptin = document.getElementById('generalAnalysisConsent-consent-toggle-on');
    var mailFeaturesOptout = document.getElementById('generalAnalysisConsent-consent-toggle-off');
    var personalizedAdsOptin = document.getElementById('analysisOfCommunications-consent-toggle-on');
    var personalizedAdsOptout = document.getElementById('analysisOfCommunications-consent-toggle-off');
    var insightsCommOptin = document.getElementById('insightsFromCommunications-consent-toggle-on');
    var insightsCommOptout = document.getElementById('insightsFromCommunications-consent-toggle-off');
    var doneBtnElm = document.querySelector('.mail-consent .btn');
    var doneBtnDisabledClassName = 'done-btn-disabled';

    if (mailConsentElem) {
        doneBtnElm.classList.add(doneBtnDisabledClassName);
        doneBtnElm.disabled = true;
        document.body.addEventListener(tapEvent, function() {
            if ((mailFeaturesOptin.checked || mailFeaturesOptout.checked) &&
                (personalizedAdsOptin.checked || personalizedAdsOptout.checked) &&
                (insightsCommOptin.checked || insightsCommOptout.checked)) {
                doneBtnElm.classList.remove(doneBtnDisabledClassName);
                doneBtnElm.disabled = false;
            }
        });
    }
}

/* Yahoo connect mail consent*/
function checkEmailValidationYahooConnectID(tapEvent) {
    var emailInputElem = document.querySelector('.nai-form .txtEmail');
    var nextBtnElm = document.querySelector('.nai-form .btnNext');
    var errorMsgElm = document.querySelector('.nai-form .error-msg');
    var doneBtnDisabledClassName = 'done-btn-disabled';
    var hiddenClassName = 'hidden';
    var emailFormat = /^([0-9a-zA-Z_\-\.])+\@([0-9a-zA-Z_\-\.])+\.([a-zA-Z]{2,4})$/;
    if (emailInputElem) {
        nextBtnElm.classList.add(doneBtnDisabledClassName);
        nextBtnElm.disabled = true;
        emailInputElem.addEventListener('input', function() {
            var emailValue = emailInputElem.value;
            if (emailValue && emailValue.match(emailFormat)) {
                errorMsgElm.classList.add(hiddenClassName);
                nextBtnElm.classList.remove(doneBtnDisabledClassName);
                nextBtnElm.disabled = false;
            }
        });
        nextBtnElm.addEventListener(tapEvent, function() {
            var emailValue = emailInputElem.value;
            if (!(emailValue && emailValue.match(emailFormat))) {
                errorMsgElm.classList.remove(hiddenClassName);
                nextBtnElm.classList.add(doneBtnDisabledClassName);
                nextBtnElm.disabled = true;
            }
        });
    }
}

window.addEventListener( 'pageshow', function ( event ) {
    var historyTraversal = event.persisted ||
        ( typeof window.performance != 'undefined' &&
            window.performance.navigation.type === 2 );
    if ( historyTraversal ) {
        // Handle page restore.
        window.location.reload();
    }
});

window.addEventListener('DOMContentLoaded', function() {
    var langPicker = document.getElementById('consent-lang-picker');
    var consentForm = document.querySelector('.consent-form');
    var footer = document.querySelector('.footer');
    var scrollContainer = document.querySelector('.scroll-container');
    var bodyElement = document.querySelector('body');
    var agreeButton = document.querySelector('.agree');
    var disagreeButton = document.querySelector('.disagree');
    var tapEvent = ('ontouchstart' in document.documentElement) ? 'touchstart' : 'click';
    var isEnterPressed = false;
    var tppToolTipIcons = document.querySelectorAll('.tpp .tool-tip .info-icon');
    var activeTppTollTipElement;
    var singlePageAgreeForm = document.querySelector('.single-page-agree-form');
    var singlePageDisagreeForm = document.querySelector('.single-page-disagree-form');
    var singlePageMoreOptionsForm = document.querySelector('.single-page-more-options-form');
    var isSinglePageFormsPresent = false;
    var scrollDownWrapper = document.querySelector('.scroll-down-wrapper');
    var scrollDownButton = document.getElementById('scroll-down-btn');
    var wizardBody = document.querySelector('.wizard-body');
    var frameworkPartnersWrapper = document.querySelector('.inner-box.tab-controls .tabs');	
    var frameworkPartnersScrollIndicator = document.querySelector('.tab-controls .chevron.scroll-indicator');

    if (agreeButton) {
        agreeButton.disabled = false;
    }

    if (disagreeButton) {
        disagreeButton.disabled = false;
    }

    checkCookie();

    setupBeacon();
    setupTppSelectAll(tapEvent);
    setupOptinAll(tapEvent);
    selectAllConsentAndLegitAll(tapEvent);
    setupSinglePageExpand(tapEvent);
    setupExperimentalPage(tapEvent);
    setupFakeBgPage(tapEvent);
    togglePurposeAndPartners(tapEvent);
    selectAllFirstPartyDataAll(tapEvent);
    enableMailConsentDoneButton(tapEvent);
    checkEmailValidationYahooConnectID(tapEvent);

    removeClass(document.body, 'no-js');
    addClass(document.body, 'js');

    detectIE(scrollContainer, footer);

    var scrollHandler = function() {
        if (window.innerHeight + window.pageYOffset + 50 > document.body.scrollHeight) {
            removeClass(scrollContainer, 'active');
            removeClass(footer, 'active');
            window.removeEventListener('scroll', scrollHandler);
        }
    };

    if (bodyElement.clientHeight > window.innerHeight + 100) {
        window.addEventListener('scroll', scrollHandler);
    }

    if (tapEvent === 'click') {
        var tooltipElement = document.querySelector('#consent-text .info.hover');
        if (tooltipElement) {
            tooltipElement.classList.add('touched-once');
        }
    }

    if (tapEvent === 'touchstart') {
        removeClass(document.body, 'no-touch');
        addClass(document.body, 'touch');

        if (tppToolTipIcons) {
            document.body.addEventListener(tapEvent, function(e) {
                if (e.target && Array.prototype.indexOf.call(tppToolTipIcons, e.target) > -1) {
                    if (activeTppTollTipElement) {
                        removeClass(activeTppTollTipElement, 'touch-active');
                    }
                    activeTppTollTipElement = e.target && e.target.parentElement;
                    addClass(activeTppTollTipElement, 'touch-active');
                    return;
                }
                if (activeTppTollTipElement) {
                    removeClass(activeTppTollTipElement, 'touch-active');
                }
            });
        }
    }

    displayScrollToContinue(tapEvent);
    setupEUMoreOptionsToggle(tapEvent);

    if (singlePageAgreeForm) {
        isSinglePageFormsPresent = true;
        singlePageAgreeForm.addEventListener(tapEvent, handleDoubleSubmit);
        singlePageAgreeForm.addEventListener('submit', handleDoubleSubmit);
        singlePageAgreeForm.addEventListener('keydown', function() {
            if (isEnterPressed) {
                event.preventDefault();
                event.stopPropagation();
            }
            if (event.keyCode === 13 || event.keyCode === 10 /* some browser would come with 10 instead of 13 */ ) {
                isEnterPressed = true;
            }
        });
    }

    if (singlePageDisagreeForm) {
        isSinglePageFormsPresent = true;
        singlePageDisagreeForm.addEventListener(tapEvent, handleDoubleSubmit);
        singlePageDisagreeForm.addEventListener('submit', handleDoubleSubmit);
        singlePageDisagreeForm.addEventListener('keydown', function() {
            if (isEnterPressed) {
                event.preventDefault();
                event.stopPropagation();
            }
            if (event.keyCode === 13 || event.keyCode === 10 /* some browser would come with 10 instead of 13 */ ) {
                isEnterPressed = true;
            }
        });
    }

    if (singlePageMoreOptionsForm) {
        isSinglePageFormsPresent = true;
        singlePageMoreOptionsForm.addEventListener(tapEvent, handleDoubleSubmit);
        singlePageMoreOptionsForm.addEventListener('submit', handleDoubleSubmit);
        singlePageMoreOptionsForm.addEventListener('keydown', function() {
            if (isEnterPressed) {
                event.preventDefault();
                event.stopPropagation();
            }
            if (event.keyCode === 13 || event.keyCode === 10 /* some browser would come with 10 instead of 13 */ ) {
                isEnterPressed = true;
            }
        });
    }

    if (consentForm && !isSinglePageFormsPresent) {
        consentForm.addEventListener(tapEvent, handleDoubleSubmit);
        consentForm.addEventListener('submit', handleDoubleSubmit);
        consentForm.addEventListener('keydown', function() {
            if (isEnterPressed) {
                event.preventDefault();
                event.stopPropagation();
            }
            if (event.keyCode === 13 || event.keyCode === 10 /* some browser would come with 10 instead of 13 */ ) {
                isEnterPressed = true;
            }
        });
    }

    if (langPicker) {
        langPicker.addEventListener('change', onLanguageChange);
    }

    if (scrollDownWrapper && scrollDownButton && wizardBody && consentForm) {
        function scrollDownButtonShouldAppear() {
            if((wizardBody.scrollHeight > wizardBody.clientHeight)
                && (wizardBody.scrollTop === 0)) {
                addClass(scrollDownWrapper, 'show');
            } else {
                removeClass(scrollDownWrapper, 'show');
            }
        }
        scrollDownButtonShouldAppear();
        window.addEventListener('resize', scrollDownButtonShouldAppear);
        scrollDownButton.addEventListener('click', function handleScrollDown() {
            if('scrollBehavior' in document.documentElement.style) {
                wizardBody.scrollTo({
                    top:  wizardBody.scrollHeight,
                    behavior: 'smooth'
                 });
            } else {
                wizardBody.scrollTo(0,  wizardBody.scrollHeight);
            }
            removeClass(scrollDownWrapper, 'show');
            window.removeEventListener('resize', scrollDownButtonShouldAppear);
        });
        var wizardBodyScrollDown = function() {
            removeClass(scrollDownWrapper, 'show');
            wizardBody.removeEventListener('scroll', wizardBodyScrollDown);
            window.removeEventListener('resize', scrollDownButtonShouldAppear);
        }
        wizardBody.addEventListener('scroll', wizardBodyScrollDown)
    }

    if(frameworkPartnersWrapper && frameworkPartnersScrollIndicator) {	
        var hasHorizontalScrollbar = frameworkPartnersWrapper.scrollWidth > frameworkPartnersWrapper.clientWidth;

        if (hasHorizontalScrollbar) {
            removeClass(frameworkPartnersScrollIndicator, 'hide');	
            var tabScroll = function() {	
                addClass(frameworkPartnersScrollIndicator, 'hide');	
                frameworkPartnersWrapper.removeEventListener('scroll', tabScroll);	
            }	
            frameworkPartnersWrapper.addEventListener('scroll', tabScroll)
        }
    }
});

},{}],3:[function(require,module,exports){
'use strict';

window.addEventListener('DOMContentLoaded', function() {
    var editConsentToggleSwitch = document.querySelector('.edit-radio-toggle-switch'),
        editButtonGoBack = document.querySelector('.modal-btn-go-back'),
        editCoreConsentModal = document.querySelector('.core-consent-modal'),
        editCoreConsentRemoveLink = document.querySelector('.edit-core-consent-remove-link'),
        editConsentWizardForms = document.querySelectorAll('.edit-consent-wizard-form');

    if (editConsentWizardForms.length === 1) {
        editConsentToggleSwitch.addEventListener('change', function() {
            var editConsentWizardForm = document.querySelector('.edit-consent-wizard-form'),
                editConsentEventType = document.getElementById('consent-type-event');
            if (editConsentEventType.value === 'coreConsent' && this.checked === false) {
                //Show core consent modal
                if(editCoreConsentModal) {
                    editCoreConsentModal.style.display = 'block';
                }
            } else {
                if (editConsentWizardForm) {
                    addProcessingSpinner();
                    editConsentWizardForm.submit();
                }
            }
        });
    } else {
        var editConsentGroup = document.querySelector(".edit-consent-wizard.edit-consent-group");
        if (editConsentGroup) {
            editConsentGroup.addEventListener('change', function() {
                var toggleButton = event.target;
                if (!toggleButton.hasAttribute('data-event-type')) {
                    return;
                }
                addProcessingSpinner();
                var eventType = toggleButton.getAttribute("data-event-type");
                var form = document.querySelector(".edit-consent-wizard-form." + eventType);
                form.submit();

            });
        }
    }

    if (editCoreConsentRemoveLink) {
        editCoreConsentRemoveLink.addEventListener('click', function() {
            var editCoreConsentRemoveForm = document.querySelector('.edit-core-consent-remove-form');
            if(editCoreConsentRemoveForm) {
                addProcessingSpinner();
                editCoreConsentRemoveForm.submit();
            }
        });
    }
    var editButtonAnchor = document.querySelector('.core-consent-modal-anchor'),
        editModalCloseSpan = document.querySelector('.modal-close');
    if (editButtonAnchor) {
        editButtonAnchor.addEventListener('click', function() {
            if(editCoreConsentModal) {
                editCoreConsentModal.style.display = 'block';
            }
        });
    }
    if (editModalCloseSpan) {
        editModalCloseSpan.addEventListener('click', function() {
            if(editCoreConsentModal) {
                editCoreConsentModal.style.display = 'none';
            }
        });
    }
    window.onclick = function(event) {
        if (event.target == editCoreConsentModal || event.target == editButtonGoBack) {
            editConsentToggleSwitch.checked = true;
            editCoreConsentModal.style.display = 'none';
        }
    };
});

function addProcessingSpinner() {
    var throbberSection = document.getElementById('throbber-section'),
        editSection = document.getElementById('edit-section'),
        editBackHeaderBox = document.getElementById('edit-back-header-box');

    if (throbberSection) { throbberSection.classList.remove('hidden'); }
    if (editSection) { editSection.classList.add('hidden'); }
    if (editBackHeaderBox) { editBackHeaderBox.classList.add('hidden'); }
}
},{}]},{},[1,2,3]);