(()=>{var t={usedDataAttributes:["text","touchpoint-id","cta-type","component","position","total-positions","supplier","instance","anr","anr-id"],eventAttributes:["eventcategory","eventaction","eventlabel"],inlineLinkInstance:0,inlineChameleonLinkInstance:0,isChameleonOverlayOnPage:!1,init:function(){window.dataLayer=window.dataLayer||[],this.isChameleonOverlayOnPage=document.querySelector(".js-chameleon-overlay"),this.setInstanceAttribute(),this.addDynamicOverlayEventListener(),this.setNodeLinkAttributes(document),this.observeBodyChanges(),this.observeBodyAnr(),this.addUpdateEventListener(),window.flexiDataLayerTracking&&this.addTrackEventListener()},addUpdateEventListener:function(){var t=this;document.addEventListener("flexiTrackingUpdate",(function(e){e.detail&&e.detail.link?t.setLinkAttributes(e.detail.link):t.updateAllLinks()}))},addDynamicOverlayEventListener:function(){var t=this;document.addEventListener("chameleonOverlayOpen",(function(e){if(e.detail&&e.detail.link){var n=new URL(e.detail.link.getAttribute("href")),a=new URL(window.location);t.usedDataAttributes.forEach((function(e){var i=t.camelCase(e);n.searchParams.get(i)?a.searchParams.set(i,n.searchParams.get(i)):a.searchParams.delete(i)})),window.history.pushState({},"",a.toString())}}))},observeBodyChanges:function(){var t=this,e=window.MutationObserver||window.WebKitMutationObserver;e&&new e((function(e){return t.checkAddedContent(e)})).observe(document.querySelector("body"),{childList:!0})},checkAddedContent:function(t){var e=this;t.forEach((function(t){t.addedNodes.length&&t.addedNodes.forEach((function(t){return e.setNodeLinkAttributes(t)}))}))},setNodeLinkAttributes:function(t){var e=this;"function"==typeof t.querySelectorAll&&t.querySelectorAll('a[href^="http"]').forEach((function(t){return e.setLinkAttributes(t)}))},setInstanceAttribute:function(){var t={};document.querySelectorAll("[data-component]").forEach((function(e){t[e.dataset.component]="number"==typeof t[e.dataset.component]?t[e.dataset.component]+1:1,e.dataset.instance=t[e.dataset.component]}))},setLinkAttributes:function(t){var e,n=this,a=t.getAttribute("href"),i=t.textContent.trim().slice(0,20),r={},o=function(){try{return new URL(a)}catch(t){return console.warn("Bad URL: ".concat(a)),""}}();if(""!==o&&(a.includes("/go/")||t.dataset.overlayId||this.isChameleonOverlayOnPage)){if(t.dataset.ctaType)r.ctaType=t.dataset.ctaType;else{if(!t.dataset.overlayId)return;r.ctaType="chameleon-overlay-link",t.dataset.ctaType="chameleon-overlay-link"}t.dataset.instance||("inline-link"===t.dataset.ctaType?(this.inlineLinkInstance+=1,t.dataset.instance=this.inlineLinkInstance):"chameleon-overlay-link"===r.ctaType&&(this.inlineChameleonLinkInstance+=1,t.dataset.instance=this.inlineChameleonLinkInstance)),i.length&&(r.text=i),r.touchpointId=crypto.randomUUID(),this.usedDataAttributes.forEach((function(a){var i=n.camelCase(a);void 0===r[i]&&(t.dataset[i]?r[i]=t.dataset[i]:(e=t.closest("[data-".concat(a,"]")),r[i]=e?e.dataset[i]:""))})),Object.keys(r).forEach((function(t){r[t].length&&o.searchParams.set(t,r[t])})),t.setAttribute("href",o.toString()),r.event="touchpointEvent",t._trackingListener&&t.removeEventListener("click",t._trackingListener);var c=function e(){window.dataLayer.push(r),t.removeEventListener("click",e),setTimeout((function(){return n.setLinkAttributes(t)}),0)};t._trackingListener=c,t.addEventListener("click",c)}},camelCase:function(t){return t.toLowerCase().replace(/-(.)/g,(function(t,e){return e.toUpperCase()}))},observeBodyAnr:function(){var t=this;new MutationObserver((function(e){e.forEach((function(e){if("attributes"===e.type&&"data-anr"===e.attributeName){var n=document.body.dataset.anr;t.updateAllLinks(n)}}))})).observe(document.body,{attributes:!0,attributeFilter:["data-anr"]})},updateAllLinks:function(){var t=this;document.querySelectorAll("a").forEach((function(e){t.setLinkAttributes(e)}))},addTrackEventListener:function(){document.addEventListener("click",this.dataLayerTrackEvent.bind(this))},dataLayerTrackEvent:function(t){var e=t.target.closest("a, button");if(e){var n="content-element",a="intext-cta",i="table-mcta",r={event:"_trackEvent",eventCategory:"",eventAction:"",eventLabel:""};e.closest('[data-eventcategory="'.concat(n,'"]'))&&n===this.getDataEventAttribute("category",e)?(r.eventCategory=n,this.getDataEventAttribute("action",e)?r.eventAction=this.getDataEventAttribute("action",e):e.querySelectorAll("img").length?r.eventAction="image":r.eventAction="text-link"):e.closest('[data-eventcategory="'.concat(a,'"]'))&&a===this.getDataEventAttribute("category",e)?(r.eventCategory=a,r.eventAction=e.innerText):e.closest('[data-eventcategory="'.concat(i,'"]'))&&i===this.getDataEventAttribute("category",e)?(r.eventCategory=i,this.getDataEventAttribute("action",e)?r.eventAction=this.getDataEventAttribute("action",e):r.eventAction=e.innerText):this.getDataEventAttribute("category",e)?(r.eventCategory=this.getDataEventAttribute("category",e),this.getDataEventAttribute("action",e)?r.eventAction=this.getDataEventAttribute("action",e):r.eventAction=window.location.href):(r.eventCategory="Unknown",r.eventAction=window.location.href);var o,c=e.getAttribute("href")||"";if(e.matches("button"))r.eventCategory="Interaction_".concat(r.eventCategory),(o=this.getDataEventAttribute("label",e))||(o=e.innerText.toLowerCase().replace(" ","-").replace(/\s/g,"")),0===o.trim().length&&(e.hasAttribute("title")?o=e.getAttribute("title").toLowerCase().replace(" ","-").replace(/\s/g,""):e.hasAttribute("aria-label")&&(o=e.getAttribute("aria-label").toLowerCase().replace(" ","-").replace(/\s/g,""))),r.eventLabel=o;else if("#"===c.substring(0,1))r.eventCategory="Interaction_".concat(r.eventCategory),r.eventLabel=c;else if(c.match(/\/go\//g)){r.eventCategory="Conversion_".concat(r.eventCategory);var s=c.match(/\/go\/([a-zA-z\-_0-9]*)/)[1]||"",d=s.match(/([a-zA-Z0-9_]*)-/)||!1;d&&(s=d[1]),r.eventLabel=s}else r.eventCategory="Navigation_".concat(r.eventCategory),r.eventLabel=c;!0===window.debugGa360?console.log(r):window.dataLayer.push(r)}},getDataEventAttribute:function(t,e){var n=e.closest("[data-event".concat(t,"]")),a=n?n.dataset.eventcategory:void 0;return"string"==typeof a?a:""}};document.addEventListener("DOMContentLoaded",(function(){return t.init()}))})();