
// IE compatibility for Array forEach
if (window.NodeList && !NodeList.prototype.forEach) {
    NodeList.prototype.forEach = Array.prototype.forEach;
}

// Compatibility for atob
// Source: https://github.com/MaxArt2501/base64-js/blob/master/base64.js
(function () {
    if (window.atob) {
        // Some browsers' implementation of atob doesn't support whitespaces
        // in the encoded string (notably, IE). This wraps the native atob
        // in a function that strips the whitespaces.
        // The original function can be retrieved in atob.original
        try {
            window.atob(" ");
        } catch (e) {
            window.atob = (function (atob) {
                var func = function (string) {
                    return atob(String(string).replace(/[\t\n\f\r ]+/g, ""));
                };
                func.original = atob;
                return func;
            })(window.atob);
        }
        return;
    }

    // base64 character set, plus padding character (=)
    var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
        // Regular expression to check formal correctness of base64 encoded strings
        b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;

    window.atob = function (string) {
        // atob can work with strings with whitespaces, even inside the encoded part,
        // but only \t, \n, \f, \r and ' ', which can be stripped.
        string = String(string).replace(/[\t\n\f\r ]+/g, "");
        if (!b64re.test(string))
            throw new TypeError("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");

        // Adding the padding if missing, for semplicity
        string += "==".slice(2 - (string.length & 3));
        var bitmap, result = "",
            r1, r2, i = 0;
        for (; i < string.length;) {
            bitmap = b64.indexOf(string.charAt(i++)) << 18 | b64.indexOf(string.charAt(i++)) << 12 |
                (r1 = b64.indexOf(string.charAt(i++))) << 6 | (r2 = b64.indexOf(string.charAt(i++)));

            result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) :
                r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) :
                    String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255);
        }
        return result;
    };
})();

// IE compatibility for replaceWith
// Source: https://developer.mozilla.org/de/docs/Web/API/ChildNode/replaceWith
function ReplaceWithPolyfill() {
    'use-strict'; // Für safari and IE > 10
    var parent = this.parentNode, i = arguments.length, currentNode;
    if (!parent) return;
    if (!i) // if there are no arguments
        parent.removeChild(this);
    while (i--) { // i-- decrements i and returns the value of i before the decrement
        currentNode = arguments[i];
        if (typeof currentNode !== 'object') {
            currentNode = this.ownerDocument.createTextNode(currentNode);
        } else if (currentNode.parentNode) {
            currentNode.parentNode.removeChild(currentNode);
        }
        // the value of "i" below is after the decrement
        if (!i) // if currentNode is the first argument (currentNode === arguments[0])
            parent.replaceChild(currentNode, this);
        else // if currentNode isn't the first
            parent.insertBefore(currentNode, this.previousSibling);
    }
}

if (!Element.prototype.replaceWith)
    Element.prototype.replaceWith = ReplaceWithPolyfill;
if (!CharacterData.prototype.replaceWith)
    CharacterData.prototype.replaceWith = ReplaceWithPolyfill;
if (!DocumentType.prototype.replaceWith)
    DocumentType.prototype.replaceWith = ReplaceWithPolyfill;

function ConsentManagerUtility(){}ConsentManagerUtility.featureHashCookieName="consentManagerFeatureHash",ConsentManagerUtility.featureHash=null,ConsentManagerUtility.bannerCookieName="consentManagerBanner",ConsentManagerUtility.groups=null,ConsentManagerUtility.features=null,ConsentManagerUtility.listener={bannerActionReady:[],editActionReady:[],accept:[],edit:[],save:[],acceptAll:[],rejectAll:[],close:[],decodePlaceholder:[],decodeFeature:[],featureChanged:[],showDescriptionPage:[],showFeaturesPage:[]},ConsentManagerUtility.bannerAction=null,ConsentManagerUtility.pageUid=!1,ConsentManagerUtility.pagesExcludedFromOverlay=!1,ConsentManagerUtility.triggerReloadAfterSaving=!0,ConsentManagerUtility.rejectAllFeaturesOnClose=!0,ConsentManagerUtility.addEventListener=function(e,t){if(!ConsentManagerUtility.listener.hasOwnProperty(e))throw new Error('Event "'+e+'" does not exist.');ConsentManagerUtility.listener[e].push(t)},ConsentManagerUtility.addEventListener("bannerActionReady",function(e){ConsentManagerUtility.bannerAction=e}),ConsentManagerUtility.dispatchEvent=function(e,t){if(!ConsentManagerUtility.listener.hasOwnProperty(e))throw new Error('Event "'+e+'" does not exist.');ConsentManagerUtility.listener[e].forEach(function(e){e(t)})},ConsentManagerUtility.getPageUid=function(){if(null===ConsentManagerUtility.pageUid)throw new Error("ConsentManagerUtility.pageUid is missing.");return parseInt(ConsentManagerUtility.pageUid)},ConsentManagerUtility.isPageExcludedFromOverlay=function(){return!(!ConsentManagerUtility.pagesExcludedFromOverlay||!Array.isArray(ConsentManagerUtility.pagesExcludedFromOverlay))&&-1!==ConsentManagerUtility.pagesExcludedFromOverlay.indexOf(ConsentManagerUtility.getPageUid())},ConsentManagerUtility.getBannerAction=function(t){null!==ConsentManagerUtility.bannerAction?t(ConsentManagerUtility.bannerAction):ConsentManagerUtility.addEventListener("bannerActionReady",function(e){ConsentManagerUtility.bannerAction=e,t(ConsentManagerUtility.bannerAction)})},ConsentManagerUtility.getBannerCookieName=function(){if(null===ConsentManagerUtility.bannerCookieName)throw new Error("ConsentManagerUtility.bannerCookieName is missing.");return ConsentManagerUtility.bannerCookieName},ConsentManagerUtility.isBannerUsed=function(){return ConsentManagerUtility.existsCookie(ConsentManagerUtility.getBannerCookieName())},ConsentManagerUtility.setBannerUsed=function(e){var e=e?1:0,t=new Date((new Date).setFullYear((new Date).getFullYear()+1));ConsentManagerUtility.setCookie(ConsentManagerUtility.getBannerCookieName(),e,t),ConsentManagerUtility.saveFeatureHash(ConsentManagerUtility.featureHash)},ConsentManagerUtility.getFeatureHashCookieName=function(){if(null===ConsentManagerUtility.featureHashCookieName)throw new Error("ConsentManagerUtility.featureHashCookieName is missing.");return ConsentManagerUtility.featureHashCookieName},ConsentManagerUtility.getLastKnownFeatureHash=function(){return ConsentManagerUtility.getCookie(ConsentManagerUtility.getFeatureHashCookieName())},ConsentManagerUtility.saveFeatureHash=function(e){var t=new Date((new Date).setFullYear((new Date).getFullYear()+1));ConsentManagerUtility.setCookie(ConsentManagerUtility.getFeatureHashCookieName(),e,t)},ConsentManagerUtility.hasFeatureHashChanged=function(){var e=ConsentManagerUtility.getLastKnownFeatureHash();return void 0!==e&&e?e!==ConsentManagerUtility.featureHash:(ConsentManagerUtility.saveFeatureHash(ConsentManagerUtility.featureHash),!1)},ConsentManagerUtility.getGroups=function(){if(null===ConsentManagerUtility.groups)throw new Error("ConsentManagerUtility.groups is missing.");return ConsentManagerUtility.groups},ConsentManagerUtility.getFeatures=function(){if(null===ConsentManagerUtility.features){for(var e=ConsentManagerUtility.getGroups(),n={},t=0;t<e.length;t++){var a=e[t];Object.keys(a.features).forEach(function(e){var t=a.features[e];n[e]=t})}null===ConsentManagerUtility.features&&(ConsentManagerUtility.features=n)}return ConsentManagerUtility.features},ConsentManagerUtility.getFeature=function(e){return null!==ConsentManagerUtility.getFeatures()&&ConsentManagerUtility.getFeatures().hasOwnProperty(e)?ConsentManagerUtility.getFeatures()[e]:null},ConsentManagerUtility.enableFeature=function(e){var t=ConsentManagerUtility.getFeature(e);if(!t)throw new Error('Feature with cookie-name "'+e+'" not found.');ConsentManagerUtility.isBannerUsed()||ConsentManagerUtility.setBannerUsed(!0);e=new Date((new Date).setFullYear((new Date).getFullYear()+1));ConsentManagerUtility.setCookie(t.cookieName,1,e),ConsentManagerUtility.dispatchEvent("featureChanged",{enabled:!0,feature:t})},ConsentManagerUtility.disableFeature=function(e){var t,n=ConsentManagerUtility.getFeature(e);if(!n)throw new Error('Feature with cookie-name "'+e+'" not found.');ConsentManagerUtility.deleteCookie(n.cookieName),void 0!==n.relatedCookieNames&&n.relatedCookieNames&&(t=new RegExp(n.relatedCookieNames,"gi"),Object.keys(ConsentManagerUtility.getCookies()).forEach(function(e){null!==e.match(t)&&ConsentManagerUtility.deleteCookie(e)})),ConsentManagerUtility.dispatchEvent("featureChanged",{enabled:!1,feature:n})},ConsentManagerUtility.disableAllFeatures=function(){Object.keys(ConsentManagerUtility.getFeatures()).forEach(function(e){ConsentManagerUtility.disableFeature(e)})},ConsentManagerUtility.enableAllFeatures=function(){var e=ConsentManagerUtility.getFeatures();Object.keys(e).forEach(function(e){ConsentManagerUtility.enableFeature(e)})},ConsentManagerUtility.isFeatureEnabled=function(e){e=ConsentManagerUtility.getCookie(e);return null!==e&&"1"===e},ConsentManagerUtility.reset=function(){ConsentManagerUtility.deleteCookie(ConsentManagerUtility.getBannerCookieName()),ConsentManagerUtility.disableAllFeatures()},ConsentManagerUtility.decode=function(e){return atob(e)},ConsentManagerUtility.decodeAllFeatures=function(){ConsentManagerUtility.getFeatures();Object.keys(ConsentManagerUtility.features).forEach(function(e){ConsentManagerUtility.isFeatureEnabled(e)&&(ConsentManagerUtility.decodePlaceholders(e),ConsentManagerUtility.decodeFeatures(e))})},ConsentManagerUtility.decodePlaceholders=function(t){ConsentManagerUtility.isFeatureEnabled(t)&&document.querySelectorAll('[data-consentmanager-placeholder="1"][data-consentmanager-cookiename="'+t+'"]').forEach(function(e){ConsentManagerUtility.isFeatureEnabled(t)&&ConsentManagerUtility.decodePlaceholder(t,e)})},ConsentManagerUtility.decodePlaceholder=function(e,t){ConsentManagerUtility.isFeatureEnabled(e)&&(e=t.querySelector("[data-consentmanager-encode]"))&&(null!==(e=ConsentManagerUtility.decodeContainer(e))&&(t.outerHTML=e.innerHTML),ConsentManagerUtility.dispatchEvent("decodePlaceholder",t))},ConsentManagerUtility.decodeFeatures=function(t){ConsentManagerUtility.isFeatureEnabled(t)&&document.querySelectorAll('[data-consentmanager-encode="1"][data-consentmanager-cookiename="'+t+'"]').forEach(function(e){ConsentManagerUtility.isFeatureEnabled(t)&&ConsentManagerUtility.decodeFeature(t,e)})},ConsentManagerUtility.decodeFeature=function(e,t){ConsentManagerUtility.isFeatureEnabled(e)&&(null!==(e=ConsentManagerUtility.decodeContainer(t))&&(t.outerHTML=e.innerHTML),ConsentManagerUtility.dispatchEvent("decodeFeature",t))},ConsentManagerUtility.decodeContainer=function(e){function t(e){return e.innerHTML=i,e.querySelectorAll("script").forEach(function(e){for(var t=document.createElement("script"),n=e.getAttributeNames(),a=0;a<n.length;a++){var i=n[a];e.hasAttribute(i)&&void 0!==e.getAttribute(i)&&t.setAttribute(i,e.getAttribute(i))}void 0!==e.src&&e.src?t.src=e.src:e.innerHTML&&(t.innerHTML=e.innerHTML),e.replaceWith(t)}),e}var n=null,a=(void 0!==e.dataset.consentmanagerInject&&e.dataset.consentmanagerInject&&(n=JSON.parse(e.dataset.consentmanagerInject)),e.innerHTML.trim()),i=ConsentManagerUtility.decode(a);if(!(n&&n.hasOwnProperty("type")&&n.hasOwnProperty("position")&&void 0!==n.type&&n.type&&void 0!==n.position&&n.position))return t(e);switch(n.type){case"script":switch(n.position){case"headStart":return(o=document.createElement("script")).innerHTML=i,document.head.insertAdjacentElement("afterbegin",o),e.parentNode.removeChild(e),null;case"headEnd":return(o=document.createElement("script")).innerHTML=i,document.head.insertAdjacentElement("beforeend",o),e.parentNode.removeChild(e),null;case"bodyStart":return(o=document.createElement("script")).innerHTML=i,document.body.insertAdjacentElement("afterbegin",o),e.parentNode.removeChild(e),null;case"bodyEnd":return(o=document.createElement("script")).innerHTML=i,document.body.insertAdjacentElement("beforeend",o),e.parentNode.removeChild(e),null}break;case"content":switch(n.position){case"headStart":var o=t(e),r=document.createElement("div");return document.head.insertAdjacentElement("afterbegin",r),r.outerHTML=o.innerHTML,null;case"headEnd":o=t(e),r=document.createElement("div");return document.head.insertAdjacentElement("beforeend",r),r.outerHTML=o.innerHTML,null;case"bodyStart":o=t(e),r=document.createElement("div");return document.body.insertAdjacentElement("afterbegin",r),r.outerHTML=o.innerHTML,null;case"bodyEnd":o=t(e),r=document.createElement("div");return document.body.insertAdjacentElement("beforeend",r),r.outerHTML=o.innerHTML,null}}},ConsentManagerUtility.setCookie=function(e,t,n,a){e=e+"="+t;return void 0!==n&&(e+=";expires="+n.toUTCString()),e+=void 0!==a?";path="+a:";path=/","https:"===document.location.protocol&&(e+=";secure"),e+=";SameSite=Strict",document.cookie=e},ConsentManagerUtility.getCookie=function(e){if(ConsentManagerUtility.existsCookie(e)&&document.cookie)for(var t=document.cookie.split(";"),n=0;n<t.length;n++){var a=t[n].split("="),i=a.shift().trim(),a=a.join("=").trim();if(i===e)return a}return null},ConsentManagerUtility.getCookies=function(){var e=document.cookie.split(";");if(!e||0===e.length)return null;for(var t={},n=0;n<e.length;n++){var a=e[n].split("="),i=a.shift().trim(),a=a.join("=").trim();t[i]=a}return t},ConsentManagerUtility.deleteCookie=function(e){return!!ConsentManagerUtility.existsCookie(e)&&(document.cookie=e+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/",!0)},ConsentManagerUtility.existsCookie=function(e){return 0<=document.cookie.indexOf(e+"=")};var ConsentManager=ConsentManager||{};ConsentManager.BannerAction=function(){function e(e){this.container=e,this.groupCheckboxes=this.container.querySelectorAll("[data-consentmanager-group]"),this.featureCheckboxes=this.container.querySelectorAll("[data-consentmanager-cookiename]"),this.acceptButton=this.container.querySelector(".accept"),this.editButton=this.container.querySelector(".edit"),this.acceptAllButtons=this.container.querySelectorAll(".accept-all"),this.rejectAllButtons=this.container.querySelectorAll(".reject-all"),this.saveButton=this.container.querySelector(".save"),this.closeButton=this.container.querySelector(".close"),this.initializeGroupCheckboxes(),this.initializeFeatureCheckboxes(),this.initializeAcceptButton(),this.initializeEditButton(),this.initializeAcceptAllButtons(),this.initializeRejectAllButtons(),this.initializeSaveButton(),this.initializeCloseButton(),ConsentManagerUtility.dispatchEvent("bannerActionReady",this)}return e.prototype.getContainer=function(){return this.container},e.prototype.initializeGroupCheckboxes=function(){var a=this;this.groupCheckboxes.forEach(function(e){var t=e.dataset.consentmanagerGroup,n=document.querySelectorAll('[data-consentmanager-parentgroup="'+t+'"]');e.addEventListener("change",function(){e.checked?a.checkFeatures(n):a.uncheckFeatures(n)})})},e.prototype.initializeFeatureCheckboxes=function(){var t=this;this.featureCheckboxes.forEach(function(e){e.addEventListener("change",function(){t.setGroupCheckboxStates()})})},e.prototype.setGroupCheckboxStates=function(){this.groupCheckboxes.forEach(function(e){var t,n=e.dataset.consentmanagerGroup,n=document.querySelectorAll('[data-consentmanager-parentgroup="'+n+'"]');n&&0!==n.length?(t=[],n.forEach(function(e){e.dataset.consentmanagerCookiename;e.checked&&t.push(e)}),e.checked=t.length===n.length):(e.checked=!0,e.setAttribute("readonly","readonly"),e.setAttribute("disabled","disabled"))})},e.prototype.setFeatureCheckboxStates=function(){this.featureCheckboxes.forEach(function(e){var t=e.dataset.consentmanagerCookiename;e.checked=ConsentManagerUtility.isFeatureEnabled(t)})},e.prototype.checkFeatures=function(e){(e=void 0===e?this.featureCheckboxes:e).forEach(function(e){e.checked=!0})},e.prototype.uncheckFeatures=function(e){(e=void 0===e?this.featureCheckboxes:e).forEach(function(e){e.checked=!1})},e.prototype.initializeAcceptButton=function(){var e;this.acceptButton&&(e=this).acceptButton.addEventListener("click",function(){ConsentManagerUtility.setBannerUsed(!0),ConsentManagerUtility.enableAllFeatures(),e.hide(),ConsentManagerUtility.dispatchEvent("accept",e),ConsentManagerUtility.triggerReloadAfterSaving?location.reload(!0):ConsentManagerUtility.decodeAllFeatures()})},e.prototype.initializeEditButton=function(){var e;this.editButton&&(e=this).editButton.addEventListener("click",function(){e.showFeaturesPage(),ConsentManagerUtility.dispatchEvent("edit",e)})},e.prototype.initializeAcceptAllButtons=function(){var t;0!==this.acceptAllButtons.length&&(t=this).acceptAllButtons.forEach(function(e){e.addEventListener("click",function(){ConsentManagerUtility.setBannerUsed(!0),ConsentManagerUtility.enableAllFeatures(),t.hide(),ConsentManagerUtility.dispatchEvent("acceptAll",t),ConsentManagerUtility.triggerReloadAfterSaving?location.reload(!0):ConsentManagerUtility.decodeAllFeatures()})})},e.prototype.initializeRejectAllButtons=function(){var t;0!==this.rejectAllButtons.length&&(t=this).rejectAllButtons.forEach(function(e){e.addEventListener("click",function(){ConsentManagerUtility.setBannerUsed(!0),ConsentManagerUtility.disableAllFeatures(),t.hide(),ConsentManagerUtility.dispatchEvent("rejectAll",t),ConsentManagerUtility.triggerReloadAfterSaving&&location.reload(!0)})})},e.prototype.initializeSaveButton=function(){var e;this.saveButton&&(e=this).saveButton.addEventListener("click",function(){ConsentManagerUtility.setBannerUsed(!0),e.featureCheckboxes.forEach(function(e){var t=e.dataset.consentmanagerCookiename;e.checked?ConsentManagerUtility.enableFeature(t):ConsentManagerUtility.disableFeature(t)}),ConsentManagerUtility.dispatchEvent("save",e),ConsentManagerUtility.triggerReloadAfterSaving?location.reload(!0):(e.hide(),ConsentManagerUtility.decodeAllFeatures())})},e.prototype.initializeCloseButton=function(){var e;this.closeButton&&(e=this).closeButton.addEventListener("click",function(){if((!ConsentManagerUtility.isBannerUsed()||ConsentManagerUtility.hasFeatureHashChanged())&&ConsentManagerUtility.rejectAllFeaturesOnClose)return ConsentManagerUtility.setBannerUsed(!0),ConsentManagerUtility.disableAllFeatures(),ConsentManagerUtility.triggerReloadAfterSaving?void location.reload(!0):void e.hide();e.hide(),ConsentManagerUtility.dispatchEvent("close",e)})},e.prototype.showDescriptionPage=function(){this.container.classList.remove("show-features"),this.container.classList.add("show-description"),ConsentManagerUtility.dispatchEvent("showDescriptionPage",this)},e.prototype.showFeaturesPage=function(){this.container.classList.remove("show-description"),this.container.classList.add("show-features"),ConsentManagerUtility.dispatchEvent("showFeaturesPage",this)},e.prototype.show=function(){this.container.classList.add("show"),this.setFeatureCheckboxStates(),this.setGroupCheckboxStates()},e.prototype.hide=function(){this.container.classList.remove("show")},e}(),ConsentManager.EditAction=function(){function e(e,t){this.container=e,this.bannerAction=t,this.editButton=this.container.querySelector(".edit"),this.initializeEditButton(),ConsentManagerUtility.dispatchEvent("editActionReady",this)}return e.prototype.initializeEditButton=function(){var e;this.editButton&&(e=this).editButton.addEventListener("click",function(){e.bannerAction.show(),e.bannerAction.showFeaturesPage(),ConsentManagerUtility.dispatchEvent("edit",e)})},e}(),document.addEventListener("DOMContentLoaded",function(e){if(void 0!==ConsentManagerUtility&&void 0!==ConsentManager&&void 0!==ConsentManager.BannerAction){try{ConsentManagerUtility.getGroups(),ConsentManagerUtility.getFeatures()}catch(e){return}ConsentManagerUtility.isBannerUsed()||ConsentManagerUtility.reset(),ConsentManagerUtility.decodeAllFeatures();var t=document.querySelector('[data-extension="consent_manager"] [data-action="banner"]'),n=document.querySelector('[data-extension="consent_manager"] [data-action="edit"]'),a=editAction=null;if(t&&(t&&(a=new ConsentManager.BannerAction(t),ConsentManagerUtility.isBannerUsed()||ConsentManagerUtility.isPageExcludedFromOverlay()||a.show(),ConsentManagerUtility.hasFeatureHashChanged())&&!ConsentManagerUtility.isPageExcludedFromOverlay()&&a.show(),n)){if(null===a)throw new Error("The banner-action of the ConsentManager plugin is missing.");new ConsentManager.EditAction(n,a)}}});
//# sourceMappingURL=consent-manager.min.js.map