1'use strict';this.TNC=this.TNC||{}; 2this.TNC.AlertBanner=function(b,n){class k{constructor(){if(window.localeInterstitialShown)b(document).on("hide-localeInterstitial",()=>{this.initialize()});else this.initialize()}initialize(){let d=b(".c-alert-banner").data("componentuniqueid"),g=(new Date(b(`#${d}`).data("start-date-time"))).getTime(),h=(new Date(b(`#${d}`).data("end-date-time"))).getTime(),a=(new Date).getTime(),c=b(".c-button-close"),e="hideAlert-"+d,f=24>Math.round(new Date(h-g)/36E5)?!0:!1;c.on("click",this.hideAlertBanner.bind(this, 3e));c.on("keypress",function(l,m){"Enter"===l.key&&this.hideAlertBanner.bind(this,m)});b(document).on("show-localeInterstitial",()=>{b(`#${d}`).hide()});window.localeInterstitialShown||(a>g&&a<h&&(0!==b(".edit-mode-alert-banner").length||n.getSession(e)&&"closed"!==n.getSession(e))?b(`#${d}`).show():f&&a<h?b(`#${d}`).show():b(`#${d}`).hide());window.log(n.getSession("Alertbanner"))}hideAlertBanner(d){b(".c-alert-banner").css("display","none");n.setSession(d,"closed")}}return new k}($,TNC.BrowserStorage); 4this.TNC=this.TNC||{}; 5this.TNC.FooterColumns=function(b,n){class k{constructor(){this.initialize()}initialize(){b(".c-footer__col_wraper").parent("div").parent(".parsys_column").addClass("c-mobile-footer-columns");const d=b(".c-footer__col .toggle");for(let a=0;a<d.length;a++)d[a].onclick=c=>{c=c.target.parentNode.getElementsByClassName("toggle")[0];b(c).hasClass("toggle-on")?b(c).removeClass("toggle-on"):b(c).addClass("toggle-on")};const g=a=>{const c=(()=>{a.style.display="block";const e=`${a.scrollHeight}px`;a.style.display= 6"";return e})();b(a).addClass("is-visible");b(a).height(c);window.setTimeout(()=>{a.style.height=""},5)},h=a=>{a.style.height=`${a.scrollHeight}px`;window.setTimeout(()=>{a.style.height="0"},1);window.setTimeout(()=>{b(a).removeClass("is-visible")},5)};b(".c-footer__col_wraper .c-footer__heading \x3e a").on("click",function(a){b(a.target).hasClass("toggle")&&(a.preventDefault(),a=document.querySelector(a.target.hash))&&(b(a).hasClass("is-visible")?h(a):g(a))});b(".c-footer__link").on("click",a=>{this.setAnalytics(a)}); 7this.checkFooterHeadingLinks();b(window).resize(this.checkFooterHeadingLinks)}checkFooterHeadingLinks(){var d="0";915<b(window).width()&&(d="-1");b(".c-footer__heading a").attr("tabindex",d)}setAnalytics(d){var g=b(d.target),h=[];d=window.location.hostname;g.hasClass("c-footer__link")&&h.push(g.text());g=g.parents(".c-footer__col-nav").find(".c-footer__heading");g=b(g).children("a");h.push(g.text());h=b.trim(h.reverse().join(".")).toString().toLowerCase();h=h.replace(/[^a-z0-9.]/gi,"");n.setAnalyticsByPage({event_name:"footer_nav_click", 8nav_click_location:d+".fnav."+h},!0)}}return new k}($,TNC.Utility);this.TNC=this.TNC||{}; 9this.TNC.FooterIntlSites=function(b,n){class k{constructor(){this.initialize()}initialize(){b(".c-footer__international--location").find("a").on("click",d=>{this.setAnalytics(d)});b(".portal-nature .c-footer__inner")[0]&&b(".portal-nature .c-footer__inner")[0].classList.add("border-none")}setAnalytics(d){var g=b(d.target);let h=[];for(d=window.location.hostname;!g.hasClass("c-footer__international--locations");){if(g.hasClass("c-footer__international--location")){let a=b(g).children("a");h.push(a.text())}g= 10g.parent()}g=b.trim(h.reverse().join(".")).toString().toLowerCase();g=g.replace(/ /g,"_");n.setAnalyticsByPage({event_name:"footer_nav_click",nav_click_location:d+".fnav."+g},!0)}}return new k}($,TNC.Utility);this.TNC=this.TNC||{};this.TNC.FooterLegal=function(){class b{constructor(){this.initialize()}initialize(){}}return new b}();this.TNC=this.TNC||{}; 11this.TNC.FooterSignup=function(b,n,k){class d{constructor(){this.initialize()}initialize(){this.$emailForm=b(".c-signup-email__footer");this.$textForm=b(".c-signup-mobile__footer");this.componentUniqueId=this.$emailForm.data("componentuniqueid");this.emailInput=this.$emailForm.find(".c-field__input");this.mobileInput=this.$textForm.find(".c-field__input");this.signupSubmit=this.$emailForm.find(".c-button");this.signupMobileSubmit=this.$textForm.find(".c-button");this.email_check_passed=!1;n.checkGeolocation().then(h=> 12{h=h.response["pulse-two-letter-country"];
12if(!h)return!1;h=b.trim(h.toLowerCase());this.checkEmailForm(h);this.checkTextForm(h)});this.emailInput.on("keyup",h=>{"Enter"===h.key&&this.validateEmail.bind(this)});this.signupSubmit.on("click",this.validateEmail.bind(this));this.mobileInput.on("keyup",h=>{"Enter"===h.key&&this.validatePhone.bind(this)});this.signupMobileSubmit.on("click",this.validatePhone.bind(this));k.fetchEngagingNetworksPageDetails(this.$emailForm)}validateEmail(h){h.preventDefault(); 13var a=b(h.target).closest("form");h=a.find(".c-field__error-text:first");const c=a.find(".i-error"),e=a.find(".already-registered-error"),f=a.find(".freshaddress-error");a=a.find(".recaptcha-error");const l=k.getWidgetId(this.componentUniqueId+"-grecaptcha");h.css("display","none");c.css("display","none");e.css("display","none");f.css("display","none");if(/^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/.test(this.emailInput.val()))if(this.email_check_passed)grecaptcha.reset(l),grecaptcha.execute(l); 14else{let m=this;k.checkEmailEngagingNetworks(this.emailInput.val()).then(function(p){"NOT FOUND"===p.result?(m.email_check_passed=!0,m.signupSubmit.trigger("click")):(m.$emailForm.find(".i-error").css("display","block"),"EXISTS"===p.result?(e.css("display","block"),p=e.text().trim()):(k.handleFreshAddressResponse(p,m.$emailForm),p=f.find('[style*\x3d"display: inline"],[style*\x3d"display:inline"]').toArray().map(r=>r.innerText.trim()).join(" ")),p=p.replace(/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b(?=\?)/i, 15"\x3cREDACTED\x3e"),n.setAnalyticsByPage({event_name:"submit_error",form_type:"email_signup",form_name:"footer_sign_up",form_field_error_field:"cons_email",form_field_error_value:p},!0))})}else this.email_check_passed=!1,h.css("display","block"),c.css("display","block"),e.css("display","none"),f.css("display","none"),a.css("display","none"),h={event_name:"submit_error",form_type:"email_signup",form_name:"footer_sign_up",form_field_error_field:"cons_email",form_field_error_value:h.text().trim()},n.setAnalyticsByPage(h, 16!0)}validatePhone(h){/^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/.test(this.mobileInput.val())?(n.setAnalyticsByPage({event_name:"text_signup",event_action:"footer_sign_up",text_signup_location:"footer_sign_up"},!0),this.$textForm.find(".c-field__error-text").css("display","none"),this.$textForm.find(".i-error").css("display","none")):(this.$textForm.find(".c-field__error-text").css("display","block"),this.$textForm.find(".i-error").css("display","block"),h.preventDefault())}checkEmailForm(h){let a= 17b(".geo-email-btns");h=b(`.geo-email-sign-up-btn[data-country-code="${h}"]`);h.length&&(this.$emailForm.hide(),this.$textForm.hide(),h.removeClass("hide"),a.removeClass("hide"))}checkTextForm(h){let a=b(".geo-text-btns");h=b(`.geo-text-sign-up-btn[data-country-code="${h}"]`);h.length&&(this.$emailForm.hide(),this.$textForm.hide(),h.removeClass("hide"),a.removeClass("hide"))}}var g=new d;window.footerSignupCallback=function(h){let a=(new d).$emailForm;k.captchaSubmit(h,a,{event_name:"email_signup", 18form_type:"email_signup",form_name:"footer_sign_up",email_signup_location:"footer_sign_up"})};return g}($,TNC.Utility,TNC.FormUtility);this.TNC=this.TNC||{}; 19this.TNC.FooterSocial=function(b){class n{constructor(){this.initialize()}initialize(){document.querySelectorAll(".social-img-icon").forEach(k=>{k.addEventListener("click",d=>{this.setAnalytics(d)})})}setAnalytics(k){k=k.target;let d;const g=window.location.hostname;k&&(d=k.alt);d=d.toLowerCase();b.setAnalyticsByPage({event_name:"social_follow",social_follow_id:g+".follow."+d,social_follow_platform:d},!0)}}return new n}(TNC.Utility);this.TNC=this.TNC||{}; 20this.TNC.SingleCTA=function(){class b{constructor(){this.initialize()}initialize(){}}return new b}();this.TNC=this.TNC||{}; 21this.TNC.CrossLink=function(b,n){class k{constructor(){document.addEventListener("DOMContentLoaded",()=>{this.initialize()})}getAnalyticsObject(d){return{event_name:"general_link_click",link_text:d}}initialize(){b(".c-cross-link__item").on("click",d=>{d=b(d.currentTarget).find(".c-cross-link__title").first().clone().children().remove().end().text().trim();d=this.getAnalyticsObject(d);
21console.log("Cross Link (Image Tiles) analytics:",d);n.setAnalyticsByPage(d,!0)})}}return new k}($,TNC.Utility); 22this.TNC=this.TNC||{};this.TNC.RichTextEditor=function(b){class n{constructor(){this.initialize()}initialize(){this.adjustDropCap()}adjustDropCap(){var k=b(".rte__text--drop-cap");0<k.length&&"Q"===k.find("p").text()[0].toUpperCase()&&k.addClass("rte__text--drop-cap-q")}}return new n}($);this.TNC=this.TNC||{}; 23this.TNC.HeroCarousel=function(b){class n{constructor(){0!==b(".carousel.c-hero-carousel").length&&this.initialize()}initialize(){"1"===b('input[name\x3d"carouselLength"]').val()&&b(".carousel.c-hero-carousel").addClass("disableNavIcons");b(".default-hero-carousel").find(".c-hero-image.c-hero-carousel").on("click",k=>{b(k.target).hasClass("c-cta-carousel")||(k.preventDefault(),k.stopPropagation())});b(".triggerModal").on("click",k=>{k.preventDefault();k.stopPropagation()})}}return new n}($); 24this.TNC=this.TNC||{}; 25this.TNC.RelatedArticles=function(b,n,k){class d{constructor(){this.componentSelector=".c-related-articles";this.fiveUpWrapper=".c-5-up__marker";this.timer=null;this.flag=!0;b(window).on("load",function(){b(window).trigger("resize")});this.initialize()}initialize(){this.fiveUpWrapper.length&&(this.fiveUpCards=b(".five-up-cards").length,this.checkCharCount(this.fiveUpCards));b(".r2a-normal .c-cards-articles__card, .r2a-normal .c-cards-articles__card-5-up, .r2a-normal.c-text-asset__marker a").on("click",this.relatedStoryClick.bind(this)); 26b(window).on("resize",()=>{1023<b(window).width()?(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.adjustHeight()},100)):b(".c-5up-container-manual").find(".c-5up-featured-image").height("auto")});n&&this.componentSelector?(n.initialize(this.componentSelector),n.showReadTime()):console.log("Related Articles: could not initialize ReadTime")}checkCharCount(g){let h=[],a=[],c=[],e=[];for(let f=0;f<=g;f++)h[f]=b(".five-up-cards").find(".c-cards-articles__title").eq(f),e[f]=b.trim(h[f].text()), 27a[f]=b.trim(h[f].text()).length,82<=a[f]&&(c[f]=e[f].slice(0,82),h[f].text(c[f]).append("..."))}relatedStoryClick(g){var h="undefined"!==typeof utag_data?utag_data.page_name:"";g=b(g.currentTarget).find(".c-cards-articles__title, .c-cards-articles__title-text-asset").text().trim();h="undefined"!==typeof utag_data?h:"";g="undefined"===typeof g||null===g?"":g;k.setAnalyticsByPage({event_name:"related_story_click",event_action:"clicked from "+h,event_category:"clicked to "+g,related_story_title:g},!0)}adjustHeight(){function g(h){var a= 28h.find(".c-5up-right-cards").eq(0).height();let c=parseInt(h.find(".c-articles__separator").eq(1).css("margin-top"),10);a=3*a+2*c;h.find(".c-5up-featured-image").height(a)}b(".c-5up-container-manual").each((h,a)=>{let c=0;h=b(a).find(".c-5up-right-cards").find("img");this.flag?(this.flag=!1,h.each(function(e,f){b("\x3cimg\x3e").on("load",function(){c++;3===c&&g(b(a))}).attr("src",b(f).attr("src"))})):g(b(a))})}}return new d}($,TNC.ReadTime,TNC.Utility);this.TNC=this.TNC||{}; 29this.TNC.Articles=function(b){class n{constructor(){this.initialize()}initialize(){console.log("Articles: initialize");this.breakpoint=this.getBreakpoint();this.adjustInteractiveItems();this.addHandlers();var k;window.addEventListener("resize",()=>{clearTimeout(k);k=setTimeout(()=>{this.breakpoint=this.getBreakpoint();this.adjustInteractiveItems();this.updateEnabledStates()},250)},!1)}getBreakpoint(){return window.getComputedStyle(document.body,":before").content.replace(/"/g,"")}isShownHorizontally(k){let d= 30k.getBoundingClientRect();k=k.parentNode.parentNode.getBoundingClientRect();return d.left+25>=k.left&&d.right<=k.right+55}updateEnabledStates(){document.querySelectorAll(".c-articles__articles").forEach(k=>{k.querySelectorAll(".c-articles__article").forEach(d=>{let g=d.querySelector(".c-articles__article-link");this.isShownHorizontally(d)?(d.classList.remove("c-articles__article--js-disabled"),g.setAttribute("tabindex","0"),g.style.pointerEvents="auto"):(d.classList.add("c-articles__article--js-disabled"), 31g.setAttribute("tabindex","-1"),g.style.pointerEvents="none")})})}adjustInteractiveItems(){document.querySelectorAll(".c-articles").forEach(k=>{var d=k.querySelector(".c-articles__articles");if(d)if("large"===this.breakpoint||"xlarge"===this.breakpoint){d.classList.add("c-articles__articles--js-scrollable");var g=d.querySelectorAll(".c-articles__article");let h=g.length,a=0;g.forEach(c=>{this.isShownHorizontally(c)&&a++});d=d.getAttribute("data-first-shown");g=k.querySelector(".c-articles__scroll-button--next"); 32d<h-a+1?g.classList.add("c-articles__scroll-button--js-visible"):g.classList.remove("c-articles__scroll-button--js-visible");k=k.querySelector(".c-articles__scroll-button--previous");1<d?k.classList.add("c-articles__scroll-button--js-visible"):k.classList.remove("c-articles__scroll-button--js-visible")}else d.classList.remove("c-articles__articles--js-scrollable")})}addHandlers(){document.querySelectorAll(".c-articles").forEach(k=>{var d=k.querySelector(".c-articles__scroll-button--previous");d&& 33d.addEventListener("click",g=>{let h=k.querySelector(".c-articles__articles"),a=h.getAttribute("data-first-shown");1<a&&a--;h.setAttribute("data-first-shown",a);this.adjustInteractiveItems();0===g.detail&&1===a&&h.firstElementChild.firstElementChild.focus({focusVisible:!1})});(d=k.querySelector(".c-articles__scroll-button--next"))&&d.addEventListener("click",g=>{let h=k.querySelector(".c-articles__articles"),a=h.getAttribute("data-first-shown"),c=h.querySelectorAll(".c-articles__article");a<c.length&& 34a++;h.setAttribute("data-first-shown",a);this.adjustInteractiveItems();if(0===g.detail){let e=0;
34c.forEach(f=>{this.isShownHorizontally(f)&&e++});a+e>c.length&&c[c.length-1].firstElementChild.focus({focusVisible:!1})}});d=k.querySelector(".c-articles__articles");this.updateEnabledStates();d&&d.addEventListener("webkitTransitionEnd",()=>{this.updateEnabledStates()},!1)});document.querySelectorAll(".c-articles__article-link").forEach(k=>{let d=k.querySelector(".c-articles__article-title").textContent, 35g=k.dataset.index;k.addEventListener("click",()=>{this.setAnalytics(d,g)})})}setAnalytics(k,d){k={event_name:"related_story_click",related_story_title:k,card_clicked:d};console.log("Articles: about to call setAnalyticsByPage:",k);b.setAnalyticsByPage(k,!0)}}return new n}(TNC.Utility);this.TNC=this.TNC||{}; 36this.TNC.InPageNavigation=function(b,n){class k{constructor(){this.initialize()}getAnalyticsObject(d){return{event_name:"general_link_click",link_text:d}}initialize(){b(".c-in-page-navigation__item").on("click",d=>{d=b(d.currentTarget).find(".c-in-page-navigation__link").text().trim();d=this.getAnalyticsObject(d);console.log("In-Page Navigation (Image Tiles) analytics:",d);n.setAnalyticsByPage(d,!0)});document.querySelectorAll(".c-in-page-navigation__button-link").forEach(d=>{d.addEventListener("click", 37()=>{let g=this.getAnalyticsObject(d.textContent);console.log("In-Page Navigation (Button Tiles) analytics:",g);n.setAnalyticsByPage(g,!0)})})}}return new k}($,TNC.Utility);this.TNC=this.TNC||{}; 38this.TNC.InteractiveTiles=function(b,n,k,d){class g{constructor(){this.initialize()}initialize(){b(".c-interactive-tiles__nav").removeClass("c-interactive-tiles__nav--hidden");b(".c-interactive-tiles__nav").attr("aria-hidden","false");let h=k.defaultConfig;console.log("Interactive Tiles MicroModal config:",h);n.init(h);b(".c-interactive-tiles__nav-button").on("click",function(){let a="";var c=b(this);c&&(c=c.find(".c-interactive-tiles__nav-label"))&&(a=c.text());d.setAnalyticsByPage({event_name:"generic_engagement_click", 39generic_engagement_name:a},!0)})}}return new g}($,MicroModal,TNC.MicroModal,TNC.Utility);this.TNC=this.TNC||{};this.TNC.Text4UpLink=function(){class b{constructor(){this.initialize()}initialize(){}}return new b}();this.TNC=this.TNC||{}; 40this.TNC.TitleTextCta=function(b){class n{constructor(){this.initialize()}initialize(){let k=b("div.title-text-cta.base-component div.cta-container");for(let d=0;d<k.length;d++)if(1<b(k[d]).find("a").length)b(k[d]).find(".primary-cta-btn").addClass("two__btns");else break}}return new n}($);this.TNC=this.TNC||{}; 41this.TNC.HeaderMegamenu=function(b,n){class k{constructor(){let d=document.querySelector("header"),g=1;console.log("header:",d);d&&(void 0!==d.dataset.version&&(g=d.dataset.version),console.log("headerVersion: ",g));1===g&&(b(".cd-primary-nav").removeClass("hide"),this.initialize())}initialize(){console.log("Header Megamenu: initialize (jQuery:)",b);this.registerEventHandler();this.registerEventHandlerMobile();this.getGeolocation()}is_touch_device(){return"ontouchstart"in window||0<navigator.maxTouchPoints}getGeolocation(){if(!b(".cd-main-header").length)return!1; 42"yes"!==b(".cd-main-header").data("disableGeoService")&&n.checkGeolocation().then(d=>{const g=b(".cd-main-header").find(".geolocationdatastr").data("geolocationdatastr");g&&this.renderGeoLocationNav(d,g)})}renderGeoLocationNav(d,g){const h=d.response["pulse-country"].toLowerCase(),a=d.response["pulse-region"].toLowerCase(),c=b(".geoLocationEnabled-true");b.each(g,(e,f)=>{if("usa"===h||"can"===h){if(f.geoLocationStateCode&&-1<f.geoLocationStateCode.indexOf(a))return c.prepend(`<li><a 43 href="${f.geoNavLink}" 44 target="${f.geoNavTarget}" 45 class="current-location icon-locator 46 txt-clr-p4-hover">Local: ${f.geoNavTitle}</a></li>`),b(".current-location").on("click",l=>{this.setAnalytics(l)}),!1}else if(f.geoLocationCountryCode&&-1<f.geoLocationCountryCode.indexOf(h))return c.prepend(`<li><a 47 href="${f.geoNavLink}" 48 target="${f.geoNavTarget}" 49 class="current-location icon-locator 50 txt-clr-p4-hover">Local: ${f.geoNavTitle}</a></li>`),b(".current-location").on("click",l=>{this.setAnalytics(l)}),!1})}setAnalytics(d){var g=b(d.target);let h=[];for(d=window.location.hostname;!g.hasClass("cd-primary-nav");){if(g.is("li")){let a=b(g).children("a");h.push(a.text())}g=g.parent()}g=b.trim(h.reverse().join(".")).toString().toLowerCase();g=g.replace(/ /g,"_");d={event_name:"top_nav_click",nav_click_location:d+".tnav."+g};console.log("Header Megamenu: about to set analytics:", 51d);n.setAnalyticsByPage(d,!0)}hideMenus(){b(".transparentHeader-true .cd-main-header").removeClass("menu-shown");b(".cd-primary-nav \x3e li \x3e a").removeClass("selected");b(".cd-secondary-nav").removeClass("selected").addClass("is-hidden").end().end().parent("ul").removeClass("moves-out");b(".cd-overlay").removeClass("is-visible")}registerEventHandler(){b(".cd-secondary-nav").find("a").on("click",d=>{b(d.target).closest(".cd-secondary-nav").parent().hasClass("language-selector-mobile")||this.setAnalytics(d)}); 52b(document).on("click",d=>{0===b(d.target).closest("#cd-primary-nav").length&&this.hideMenus()});b(document).on("keydown",d=>{"Escape"===d.key&&this.hideMenus()});b(".cd-search-trigger").on("focus",()=>{this.hideMenus()});b(".closeMenu").on("click",()=>{this.hideMenus()});b(".cd-primary-nav").children(".has-children").children("a").on("click",d=>{if(b(d.target).hasClass("link-submenu")&&n.checkWindowWidth()&&!this.is_touch_device()
52){this.setAnalytics(d);if(0<b(d.target).siblings("ul").length)return; 53d.stopPropagation();b(d.target).trigger("click")}else d.preventDefault();const g=b(d.target);b(".has-promo-mobile").hide();n.checkWindowWidth()||(g.addClass("selected").next("ul").removeClass("is-hidden").end().parent(".has-children").parent("ul").addClass("moves-out"),g.parent(".has-children").siblings(".has-children").children("ul").addClass("is-hidden").end().children("a").removeClass("selected"),b(".cd-overlay").addClass("is-visible"));b(d.target).parent().hasClass("language-selector-mobile")|| 54this.setAnalytics(d)});b(".cd-nav .cd-primary-nav \x3e .has-children.mainNav").on("touch click",d=>{var g=b(d.target);let h=null;g.is(".mainNav")?h=g:g.is(".mainNav \x3e a")&&(h=g.parent());n.checkWindowWidth()&&(h?h.children(".cd-secondary-nav").hasClass("is-hidden")?(b(".transparentHeader-true .cd-main-header").addClass("menu-shown"),h.children("a").addClass("selected").next("ul").removeClass("is-hidden").end().end().parent("ul").addClass("moves-out"),h.siblings(".has-children").children("ul").addClass("is-hidden").end().children("a").removeClass("selected"), 55b(".cd-overlay").addClass("is-visible")):this.hideMenus():(g.is("a")||g.parent().is("a")||g.parent().parent().is("a"))&&this.hideMenus(),this.toggleSearch("close"));if(b(d.target).is(".cd-primary-nav \x3e .mainNav \x3e a"))return g=!1,!1===b(d.target).hasClass("link-submenu")&&(g=!0),g&&(window.location.href=b(d.target).attr("href")),g});b(".cd-nav .cd-primary-nav \x3e .has-children.mainNav").on("keypress",d=>{" "===d.key&&(d.preventDefault(),d.stopPropagation(),b(d.target).click())})}registerEventHandlerMobile(){window.addEventListener("pageshow", 56d=>{document.querySelector(".c-header__hamburger .c-header__navIcon--open")&&!document.querySelector(".c-header__nav .link-submenu.selected")&&(this.closeNav(),this.openNav(d))});b(".cd-nav-trigger").on("click",d=>{d.preventDefault();b(".cd-nav-trigger").hasClass("nav-is-visible")?(this.closeNav(),b("header").hasClass("sticky-header")&&b("body").removeClass("sticky-lock")):this.openNav(d)});b(".cd-overlay").on("swiperight",()=>{b(".cd-primary-nav").hasClass("nav-is-visible")&&this.closeNav()});b(".nav-on-left .cd-overlay").on("swipeleft", 57()=>{b(".cd-primary-nav").hasClass("nav-is-visible")&&this.closeNav()});b(".go-back").on("click",d=>{b(".has-promo-mobile").show();b(d.currentTarget).parent("ul").addClass("is-hidden").parent(".has-children").parent("ul").removeClass("moves-out")})}openNav(d){b(".has-promo-mobile").show();b("header").hasClass("sticky-header")&&b("body").addClass("sticky-lock");b(d.currentTarget).addClass("nav-is-visible");b(d.currentTarget).attr("aria-expanded","true");setTimeout(()=>{b(".cd-primary-nav").addClass("nav-is-visible"); 58b(".cd-main-header").addClass("nav-is-visible");b(".cd-main-header.sticky-header").length||b("html, body").addClass("overflow-hidden");b(".cd-nav").addClass("is-visible");b(".cd-overlay").addClass("is-visible");b(".cd-main-content").addClass("nav-is-visible");this.toggleSearch("close")},100)}closeNav(){b(".cd-nav-trigger").removeClass("nav-is-visible");b(".cd-nav-trigger").attr("aria-expanded","false");setTimeout(()=>{b(".cd-main-header").removeClass("nav-is-visible");b(".cd-primary-nav").removeClass("nav-is-visible"); 59b(".cd-overlay").removeClass("is-visible");b(".cd-nav").removeClass("is-visible");b(".has-children ul").addClass("is-hidden");b(".has-children a").removeClass("selected");b(".moves-out").removeClass("moves-out");b("html, body").removeClass("overflow-hidden");b(".cd-main-content").removeClass("nav-is-visible");n.checkWindowWidth()||(b(".cd-primary-nav").scrollTop(0),b(".cd-secondary-nav").scrollTop(0))},100)}toggleSearch(d){b(".cd-search-trigger").hasClass("search-is-visible")&&this.resetSearch(); 60"close"===d||b(".cd-search").hasClass("is-visible")?(b(".cd-search").removeClass("is-visible").find(".searchBoxHeader").removeClass("border-primary"),b(".cd-search-trigger").removeClass("search-is-visible"),b(".cd-search-trigger").attr("aria-expanded","false"),d=b(".cd-search-trigger").attr("data-show-text"),b(".cd-search-trigger").length&&(b(".cd-search-trigger").contents().get(0).textContent=d),b(".cd-overlay").removeClass("search-is-visible"),b(".cd-main-header").removeClass("search-visible")): 61(this.setSearchPosition(),b(".cd-search").addClass("is-visible").show().find(".searchBoxHeader").addClass("border-primary"),b(".cd-search-trigger").addClass("search-is-visible"),b(".cd-search-trigger").attr("aria-expanded","true"),d=b(".cd-search-trigger").attr("data-hide-text"),b(".cd-search-trigger").contents().get(0).textContent=d,b(".cd-overlay").addClass("search-is-visible"),b(".searchBoxHeader").focus(),b(".cd-main-header").addClass("search-visible"))}}return new k}($,TNC.Utility); 62this.TNC=this.TNC||{}; 63this.TNC.Header=function(b,n,k,d){class g{constructor(){}initialize(){console.log("Header2: initialize");this.MAIN_NAV_CLASS="c-header2__main-nav";this.MAIN_MENU_CLASS="c-header2__main-nav-menu";this.MAIN_NAV_SUB_LIST_CLASS="c-header2__main-nav-sub-list";this.EXTRA_NAV_CLASS="c-header2__extra-nav";this.EXTRA_NAV_LIST_CLASS="c-header2__extra-nav-list";this.SEARCH_SUGGEST_CLASS="c-header2__search-suggest";this.windowPosition=window.scrollY;
63this.breakpoint=this.getBreakpoint();this.adjustInteractiveItems(); 64this.addHandlers();this.getGeolocation();var a;window.addEventListener("resize",()=>{clearTimeout(a);a=setTimeout(()=>{this.breakpoint=this.getBreakpoint();this.adjustInteractiveItems()},250)},!1)}addHandlers(){document.querySelectorAll(".c-header2__main-nav-button").forEach(c=>{c.addEventListener("click",e=>{this.mainNavButtonHandler(e)},!1)});document.querySelectorAll(".c-header2__main-nav-menu-back").forEach(c=>{c.addEventListener("click",e=>{this.mainNavBackButtonHandler(e)},!1)});document.querySelectorAll(".c-header2__main-nav-sub-button").forEach(c=> 65{c.addEventListener("click",e=>{this.mainNavSubButtonHandler(e)},!1)});document.querySelectorAll(".c-header2__main-nav-menu-link, .c-header2__main-nav-item-link, .c-header2__main-nav-list-link, .c-header2__main-nav-sub-link").forEach(c=>{c.addEventListener("click",e=>{this.navLinkHandler(e)},!1)});var a=document.querySelector(".c-header2__extra-nav-button");a&&a.addEventListener("click",c=>{this.extraNavButtonHandler(c)},!1);document.querySelectorAll(".c-header2__extra-nav-link").forEach(c=>{c.addEventListener("click", 66e=>{this.navLinkHandler(e)},!1)});document.querySelectorAll(".c-header2__language-link").forEach(c=>{c.addEventListener("click",e=>{this.languageLinkHandler(e)},!1)});(a=document.querySelector(".c-header2__search-input"))&&a.addEventListener("keyup",c=>{this.searchKeyHandler(c)},!1);(a=document.querySelector(".c-header2__show-nav-button"))&&a.addEventListener("click",c=>{this.showNavButtonHandler(c)},!1);window.addEventListener("click",c=>{const e=c.target.closest("."+this.MAIN_MENU_CLASS),f=c.target.closest("."+ 67this.MAIN_NAV_CLASS);e||f||this.hideMenus(this.MAIN_MENU_CLASS);c.target.closest("."+this.EXTRA_NAV_CLASS)||this.hideMenus(this.EXTRA_NAV_LIST_CLASS);c.target.closest("."+this.SEARCH_SUGGEST_CLASS)||this.hideMenus(this.SEARCH_SUGGEST_CLASS)});window.addEventListener("keydown",c=>{"Escape"===c.key&&(this.hideMenus(this.MAIN_MENU_CLASS),this.hideMenus(this.EXTRA_NAV_LIST_CLASS),this.hideMenus(this.SEARCH_SUGGEST_CLASS))});window.addEventListener("scroll",()=>{document.querySelector(".c-header2--sticky")&& 68this.handleScroll()})}handleScroll(){let a=window.scrollY,c=document.querySelector(".c-header2");c&&(131<window.pageYOffset?a>this.windowPosition?(c.classList.remove("c-header2--sticky-up"),c.classList.add("c-header2--sticky-down")):(c.classList.remove("c-header2--sticky-down"),c.classList.add("c-header2--sticky-up")):c.classList.remove("c-header2--sticky-down","c-header2--sticky-up"));this.windowPosition=a}toggleAriaExpanded(a){if(a){let c=a.getAttribute("aria-expanded");a.setAttribute("aria-expanded", 69"true"===c?"false":"true")}}toggleAriaPressed(a){if(a){let c=a.getAttribute("aria-pressed");a.setAttribute("aria-pressed","true"===c?"false":"true")}}hideMenus(a,c=null){const e=a+"--visible";document.querySelectorAll("."+a).forEach(f=>{let l=f.previousElementSibling;c?!1===f.isEqualNode(c)&&(f.classList.remove(e),l&&l.setAttribute("aria-expanded","false")):(f.classList.remove(e),l&&l.setAttribute("aria-expanded","false"))})}hideMenusInCurrentMenu(a,c,e=null){const f=a+"--visible";c.querySelectorAll("."+ 70a).forEach(l=>{let m=l.previousElementSibling;e?!1===l.isEqualNode(e)&&(l.classList.remove(f),m&&m.setAttribute("aria-expanded","false")):(l.classList.remove(f),m&&m.setAttribute("aria-expanded","false"))})}getBreakpoint(){return window.getComputedStyle(document.body,":before").content.replace(/"/g,"")}adjustInteractiveItems(){"large"!==this.breakpoint&&"xlarge"!==this.breakpoint?document.querySelectorAll(".c-header2__main-nav-menu").forEach(a=>{a.style.removeProperty("height")}):document.querySelectorAll(".c-header2__main-nav-sub-list--visible").forEach(a=> 71{this.setDesktopMainMenuHeight(a)})}getGeolocation(){let a=document.querySelector("."+this.MAIN_NAV_CLASS+" .c-header2__main-nav-list--geo");if(a){var c=document.querySelector(".c-header2");if(!c||"yes"!==c.dataset.disableGeoService)if(c=(c=document.querySelector(".geolocationdatastr"))&&c.getAttribute("data-geolocationdatastr")){try{var e=JSON.parse(c)}catch(f){console.error("Header2: could not parse geolocation data:",f);return}k.checkGeolocation().then(f=>{this.renderGeoLocationNav(f,e,a)})}}}renderGeoLocationNav(a, 72c,e){if(a&&a.response&&c){var f=(a.response["pulse-country"]||"").toLowerCase(),l=(a.response["pulse-region"]||"").toLowerCase();a=null;for(const m of c)if("usa"===f||"can"===f){if(m.geoLocationStateCode&&-1<m.geoLocationStateCode.indexOf(l)){a=m;break}}else if(m.geoLocationCountryCode&&-1<m.geoLocationCountryCode.indexOf(f)){a=m;break}a&&(c=document.createElement("li"),c.classList.add("c-header2__main-nav-list-item","c-header2__main-nav-list-item--local"),f=document.createElement("a"),f.classList.add("c-header2__main-nav-list-link", 73"c-header2__main-nav-local-link"),f.setAttribute("href",a.geoNavLink),a.geoNavTarget&&f.setAttribute("target",a.geoNavTarget),f.textContent="Local: "+a.geoNavTitle,f.addEventListener("click",m=>{this.navLinkHandler(m)}
73),c.appendChild(f),e.insertBefore(c,e.firstChild))}}setAnalytics(a){var c=window.location.hostname,e="";if(a&&(e=a.parentElement.classList.contains("c-header2__main-nav-item-link")?a.parentElement.textContent:a.textContent)){var f=e.split("\n");0<f.length&&(e=f[0])}e=[e];if(a.classList.contains("c-header2__main-nav-item-link")|| 74a.classList.contains("c-header2__main-nav-sub-button")||a.classList.contains("c-header2__main-nav-sub-link"))(f=a.parentElement.parentElement.previousElementSibling)&&f.textContent&&e.push(f.textContent),(f=a.parentElement.parentElement.parentElement.parentElement.previousElementSibling)&&f.textContent&&e.push(f.textContent);a.parentElement.classList.contains("c-header2__main-nav-item-link")&&(f=a.parentElement.parentElement.parentElement.previousElementSibling)&&f.textContent&&e.push(f.textContent); 75a.classList.contains("c-header2__extra-nav-link")&&(f=a.parentElement.parentElement.previousElementSibling)&&f.textContent&&e.push(f.textContent);a.classList.contains("c-header2__main-nav-list-link")&&(f=a.parentElement.parentElement.parentElement.parentElement.previousElementSibling)&&f.textContent&&e.push(f.textContent);a.classList.contains("c-header2__main-nav-sub-link")&&(f=a.parentElement.parentElement.parentElement.parentElement.parentElement.previousElementSibling)&&f.firstElementChild&&(a= 76"",(f=f.firstElementChild.textContent.split("\n"))&&0<f.length&&(a=f[0]),e.push(a));e=e.reverse().join(".").trim().toLowerCase();e=e.replace(/ /g,"_");c={event_name:"top_nav_click",nav_click_location:c+".tnav."+e};console.log("Header2: setAnalytics:",c);k.setAnalyticsByPage(c,!0)}setAnalyticsForLanguageLink(a){a&&(a={event_name:"select_language",selected_language:a.dataset.code},console.log("Header2: setAnalyticsForLanguageLink:",a),k.setAnalyticsByPage(a,!0))}mainNavButtonHandler(a){if(a=a.target){this.toggleAriaExpanded(a); 77let c=a.nextElementSibling;c&&c.classList.contains(this.MAIN_MENU_CLASS)&&(c.classList.toggle(this.MAIN_MENU_CLASS+"--visible"),this.hideMenus(this.MAIN_MENU_CLASS,c),this.hideMenus(this.EXTRA_NAV_LIST_CLASS),this.hideMenus(this.SEARCH_SUGGEST_CLASS));this.adjustInteractiveItems();this.setAnalytics(a)}}mainNavBackButtonHandler(a){(a=a.target)&&(a=a.closest("."+this.MAIN_MENU_CLASS))&&a.classList.remove(this.MAIN_MENU_CLASS+"--visible")}setDesktopMainMenuHeight(a){if("large"===this.breakpoint||"xlarge"=== 78this.breakpoint){var c=a.closest("."+this.MAIN_MENU_CLASS),e=a.closest(".c-header2__main-nav-list");if(c&&e){e=e.clientHeight+40;let f="auto";a=a.clientHeight;0<a&&a>e&&(f=a+"px");c.style.height=f}}}mainNavSubButtonHandler(a){if(a=a.target){this.toggleAriaExpanded(a);let c=a.nextElementSibling;if(c&&c.classList.contains(this.MAIN_NAV_SUB_LIST_CLASS)){c.classList.toggle(this.MAIN_NAV_SUB_LIST_CLASS+"--visible");this.hideMenus(this.EXTRA_NAV_LIST_CLASS);let e=c.closest("."+this.MAIN_MENU_CLASS);this.hideMenusInCurrentMenu(this.MAIN_NAV_SUB_LIST_CLASS, 79e,c);this.setDesktopMainMenuHeight(c)}this.setAnalytics(a)}}extraNavButtonHandler(a){if(a=a.target){this.toggleAriaExpanded(a);let c=document.querySelector("."+this.EXTRA_NAV_LIST_CLASS);c&&(c.classList.toggle(this.EXTRA_NAV_LIST_CLASS+"--visible"),this.hideMenus(this.MAIN_MENU_CLASS))}this.setAnalytics(a)}navLinkHandler(a){(a=a.target)&&this.setAnalytics(a);this.hideMenus(this.MAIN_MENU_CLASS);this.hideMenus(this.EXTRA_NAV_LIST_CLASS)}languageLinkHandler(a){(a=a.target)&&this.setAnalyticsForLanguageLink(a)}handleSuggestionsResponse(a, 80c){if(a=JSON.parse(a)){var e=a.hits.hit;a=[];c=c.toLowerCase();for(const m of e)if(e=m.fields.title,e.toLowerCase().startsWith(c)&&a.push(e),6<=a.length)break;let f=document.querySelector(".c-header2__search-suggestion-list");document.querySelectorAll(".c-header2__search-suggestion-item").forEach(m=>{f.removeChild(m)});const l=document.querySelector(".c-header2__search-form").getAttribute("action");a.forEach(m=>{let p=l;p=0<p.indexOf("?")?p+"\x26":p+"?";p+="q\x3d"+encodeURIComponent(m);let r=document.createElement("a"); 81r.classList.add("c-header2__search-suggestion-link");r.setAttribute("href",p);r.textContent=m;r.addEventListener("keydown",q=>{this.searchSuggestionKeyHandler(q)});r.addEventListener("click",q=>{this.searchSuggestionLinkHandler(q)});m=document.createElement("li");m.classList.add("c-header2__search-suggestion-item");m.appendChild(r);f.appendChild(m)})}}searchKeyHandler(a){var c=document.querySelector("."+this.SEARCH_SUGGEST_CLASS),e=this.SEARCH_SUGGEST_CLASS+"--visible";if(c){let m=a.target;0<m.value.length? 82c.classList.add(e):c.classList.remove(e);let p=a.key;if("ArrowDown"===p)a.preventDefault(),a=document.querySelectorAll(".c-header2__search-suggestion-link"),0<a.length&&a[0].focus({focusVisible:!0});else if("Enter"===p)c.classList.remove(e);else if("Meta"===p||"Escape"===p)c.classList.remove(e);else{a=m.getAttribute("data-suggestion-api");c=m.getAttribute("data-search-by-domain");const r=new XMLHttpRequest;r.onreadystatechange=()=>{r.readyState===XMLHttpRequest.DONE&&200===r.status&&this.handleSuggestionsResponse(r.response, 83m.value)};if(e=m.value){var f="";
83e.split(/[^a-z0-9]/i).forEach(q=>{q=q.trim();0<q.length&&(f+=`(prefix field='suggester' '${q}')`)});var l={q:`(and ${f})`,"q.parser":"structured",fq:`search_by_domain:'${c}'`,return:"title",size:250,sort:"title asc"};c=Object.keys(l).map(function(q){return encodeURIComponent(q)+"\x3d"+encodeURIComponent(l[q])}).join("\x26");r.open("GET",a+("?"+c),!0);r.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset\x3dUTF-8");r.send()}}}}searchSuggestionKeyHandler(a){let c= 84a.key;if("ArrowDown"===c)a.preventDefault(),(a=a.target.parentNode)&&(a=a.nextElementSibling)&&(a=a.querySelector(".c-header2__search-suggestion-link"))&&a.focus({focusVisible:!0});else if("ArrowUp"===c){if(a.preventDefault(),a=a.target.parentNode)(a=a.previousElementSibling)?(a=a.querySelector(".c-header2__search-suggestion-link"))&&a.focus({focusVisible:!0}):(a=document.querySelector(".c-header2__search-input"))&&a.focus()}else"Escape"===c&&(a=document.querySelector(".c-header2__search-input"))&& 85a.focus()}searchSuggestionLinkHandler(a){if(a.target){a=document.querySelector("."+this.SEARCH_SUGGEST_CLASS);const c=this.SEARCH_SUGGEST_CLASS+"--visible";a&&a.classList.remove(c)}}showNavButtonHandler(a){if(a=a.target)this.toggleAriaExpanded(a),this.toggleAriaPressed(a);(a=document.querySelector(".c-header2__search"))&&a.classList.toggle("c-header2__search--visible");(a=document.querySelector(".c-header2__nav"))&&a.classList.toggle("c-header2__nav--visible")}}class h{constructor(){document.querySelector(".c-header2")? 86(console.log("New header: about to initialize"),(new g).initialize()):(console.log("Header: about to set variables and initialize"),this.suggestionQueue=null,this.locationFlag=!0,this.searchByDomain=b(".searchBoxHeader").data("searchByDomain"),this.windowPosition=b(window).scrollTop(),b(".cd-primary-nav").removeClass("hide"),this.initialize())}initialize(){this.readBtnsCookies();this.registerEventHandler();this.getGeolocation();this.getBrowserLocale();"sticky-header"===b(".cd-main-header").attr("data-sticky-header")&& 87(b("body").hasClass("transparentHeader-true")||b(".header.section").outerHeight(b(".cd-main-header").outerHeight()),1024>b(window).width()&&(b(".cd-main-header").hasClass("sticky-language")?b(".header.section").outerHeight(b(".cd-main-header").outerHeight()+33):b(".header.section").outerHeight(b(".cd-main-header").outerHeight())),b(".alert-banner").length&&0===window.pageYOffset&&b(".cd-search").addClass("sticky-banner-offset"),b(".cd-main-header").addClass("sticky-header"),this.stickyHeaderEventHandler())}getGeolocation(){if(!b(".cd-main-header").length)return!1; 88"yes"!==b(".cd-main-header").data("disableGeoService")&&k.checkGeolocation().then(a=>{this.personalizeMembershipBtns(a)})}stickyHeaderEventHandler(){b(window).scroll(function(){b(".alert-banner").length&&0===window.pageYOffset&&b(".cd-search").addClass("sticky-banner-offset");if(window.pageYOffset>b(".cd-main-header").outerHeight()){b(".cd-search").removeClass("sticky-banner-offset");var a=b(window).scrollTop();a>this.windowPosition?(b(".cd-main-header").removeClass("_sticky-up"),b(".cd-main-header").addClass("_sticky-down")): 89(b(".cd-main-header").removeClass("_sticky-down"),b(".cd-main-header").addClass("_sticky-up"))}else b(".cd-main-header").removeClass("_sticky-down, _sticky-up");this.windowPosition=a})}personalizeMembershipBtns(a){const c=a.response["pulse-two-letter-country"]?b.trim(a.response["pulse-two-letter-country"].toLowerCase()):"";b(".cd-main-header [data-country-blacklist]").each(function(){var e=b(this).data("countryBlacklist");e=e?e.split(","):[];let f=!0;for(let l=0;l<e.length;l++)if(b.trim(e[l])===c){f= 90!1;break}f||b(this).remove()})}setAnalyticsByLng(a){k.setAnalyticsByPage({event_name:"select_language",selected_language:a},!0)}registerEventHandler(){var a=this;b(".search-form").on("submit",e=>{e.preventDefault();b(".search-button-header").trigger("click")});b(window).on("resize",()=>{this.setSearchPosition()});b(".cd-search-trigger").on("click",e=>{e.preventDefault();this.toggleSearch();this.closeNav()});b(".cd-overlay").on("click",()=>{this.closeNav();this.toggleSearch("close")});b(".searchBoxHeader").on("input", 91e=>{3<=e.target.value.length?this.triggerAutoSuggest(e.target):this.abortAutoSuggestion()});b(".srchSuggestionsHeader").on("click",".suggestionItemsHeader",e=>{this.acceptSuggestion(e)});b(".search-button-header").on("click",e=>{e.preventDefault();const f=b(".searchBoxHeader").val();if(!b.trim(f))return!1;e=b(e.target).data("search-page");this.locationFlag&&(window.location.href=e+"?q\x3d"+f)});b(".searchBoxHeader").on("keydown",this.searchFieldKeyPress.bind(this));let c=b(".language-selector ul.ls-list-options"); 92b("#js-language-selected").on("click",function(e){e.stopPropagation();c.toggleClass("hide")});c.on("click","a",function(){c.addClass("hide")});b("body").click(function(){c.addClass("hide")});b(".language-selector .ls-list-options a, .language-selector-mobile .cd-secondary-nav a").on("click touchend",function(){let e=b(this).attr("data-code");a.setAnalyticsByLng(e?e:"undefined")})}acceptSuggestion(a){a=b(a.target).text();b(".searchBoxHeader").val(a);b(".srchSuggestionsHeader").hide();b(".search-button-header").trigger("click")}searchFieldKeyPress(a){var c= 93a.key;let e=b(".srchSuggestionsHeader li");if(0<e.length&&b(".srchSuggestionsHeader").is(":visible"))for(let f=0;f<e.length;f++)b(e[f]).on("keydown",this.searchSuggestionKeyPress.bind(this));"ArrowDown"===c&&(a.preventDefault(),0<e.length&&b(".srchSuggestionsHeader").is(":visible")&&e.first().focus())}searchSuggestionKeyPress(a){var c=a.key,e=a.target;"ArrowDown"===c?(a.preventDefault(),(a=b(e).next())&&a.focus()):"ArrowUp"===c?(a.preventDefault(),a=b(e).prev(),0<a.length?a.focus():b(".searchBoxHeader").focus()): 94"Enter"===c&&this.acceptSuggestion(a)}readBtnsCookies(){"true"===(n?n.getCookie("per_monthlybutton"):!1)?b(".membershipBtns.membershipBtns3").removeClass("membershipBtns3"):b(".membershipBtns.membershipBtns2").removeClass("membershipBtns2")}closeNav(){b(".cd-nav-trigger").removeClass("nav-is-visible");
94b(".cd-nav-trigger").attr("aria-expanded","false");setTimeout(()=>{b(".cd-main-header").removeClass("nav-is-visible");b(".cd-primary-nav").removeClass("nav-is-visible");b(".cd-overlay").removeClass("is-visible"); 95b(".cd-nav").removeClass("is-visible");b(".has-children ul").addClass("is-hidden");b(".has-children a").removeClass("selected");b(".moves-out").removeClass("moves-out");b("html, body").removeClass("overflow-hidden");b(".cd-main-content").removeClass("nav-is-visible");k.checkWindowWidth()||(b(".cd-primary-nav").scrollTop(0),b(".cd-secondary-nav").scrollTop(0))},100)}toggleSearch(a){b(".cd-search-trigger").hasClass("search-is-visible")&&this.resetSearch();"close"===a||b(".cd-search").hasClass("is-visible")? 96(b(".cd-search").removeClass("is-visible").find(".searchBoxHeader").removeClass("border-primary"),b(".cd-search-trigger").removeClass("search-is-visible"),b(".cd-search-trigger").attr("aria-expanded","false"),a=b(".cd-search-trigger").attr("data-show-text"),b(".cd-search-trigger").length&&(b(".cd-search-trigger").contents().get(0).textContent=a),b(".cd-overlay").removeClass("search-is-visible"),b(".cd-main-header").removeClass("search-visible")):(this.setSearchPosition(),b(".cd-search").addClass("is-visible").show().find(".searchBoxHeader").addClass("border-primary"), 97b(".cd-search-trigger").addClass("search-is-visible"),b(".cd-search-trigger").attr("aria-expanded","true"),a=b(".cd-search-trigger").attr("data-hide-text"),b(".cd-search-trigger").contents().get(0).textContent=a,b(".cd-overlay").addClass("search-is-visible"),b(".searchBoxHeader").focus(),b(".cd-main-header").addClass("search-visible"))}setSearchPosition(){var a=b(".c-alert-banner").css("display");if("none"===a||void 0===a){a=b(".cd-main-header").outerHeight();var c=b(".cd-main-header").css("margin-top"); 98void 0!==c?(c=c.split("px"),c=parseInt(c[0]),b(".cd-search").css("top",a+c)):b(".cd-search").css("top",a)}}resetSearch(){b(".search-form .c-field__input").val("");b(".auto-complete").hide()}triggerAutoSuggest(a){const c=b.trim(b(a).val());var e="";c.split(/[^a-z0-9]/i).forEach(f=>{f=f.trim();0<f.length&&(e+=`(prefix field='suggester' '${f}')`)});a={contentType:"application/x-www-form-urlencoded; charset\x3dUTF-8",url:b(a).data("suggestionApi"),data:{q:`(and ${e})`,"q.parser":"structured",fq:`search_by_domain:'${this.searchByDomain}'`, 99size:1E3,return:"title",sort:"title asc"}};this.abortAutoSuggestion();d.initXHR(a).then((f,l,m)=>this.renderAutoSuggest(f,m,c))}abortAutoSuggestion(){null!==this.suggestionQueue&&(this.suggestionQueue.abort(),this.suggestionQueue=null,b(".srchSuggestionsHeader").hide())}renderAutoSuggest(a,c,e){this.suggestionQueue=c;a.hits.found&&(a=a.hits.hit.filter(function(f){f=f.fields.title;return 6>this.limit&&f&&f.toLowerCase().startsWith(e.toLowerCase())?(this.limit++,!0):!1},{limit:0}),console.log(JSON.stringify(a)), 100a=Handlebars.compile('{{#each this}}\n \x3cli class\x3d"c-field__input fz-v6 suggestionItemsHeader"\n tabindex\x3d"0"\x3e{{this.fields.title}}\x3c/li\x3e\n {{/each}}')(a),b(".srchSuggestionsHeader").html(a).show())}getBrowserLocale(){k.checkBrowserLocale()}}return new h}($,TNC.BrowserStorage,TNC.Utility,TNC.XHR);this.TNC=this.TNC||{}; 101this.TNC.CgRelatedResources=function(b,n){class k{constructor(){this.ajaxConfig={url:"",contentType:"application/json; charset\x3dutf-8",dataType:"json",method:"GET",data:null,async:!0,headers:{},beforeSend(){},complete(){},statusCode:{401:function(){}}}}makeConfigObj(a){b.extend(this.ajaxConfig,a);return this.ajaxConfig}initXHR(a){a=this.makeConfigObj(a);return a.url?b.ajax(a).catch(function(c,e,f){window.log(c,e,f);throw Error(e);}):!1}}var d=new k;const g="JANUARY FEBRUARY MARCH APRIL MAY JUNE JULY AUGUST SEPTEMBER OCTOBER NOVEMBER DECEMBER".split(" "); 102class h{constructor(){this.componentSelector=".c-cg-related-resources";this.cardSelector=".c-cg-related-resources__card";this.autoResultsSelector=".c-cg-related-resources__auto-results";this.initialize()}initialize(){b(this.componentSelector).length&&(this.initAutoMode(),this.bindEvents())}initAutoMode(){let a=this;b(this.autoResultsSelector).each(function(){let c=b(this),e=c.data("service-url");var f=c.data("search-domain");let l=c.attr("data-filter-tags"),m=c.data("max-results")||2;if(e&&l){try{var p= 103JSON.parse(l)}catch(r){return}p&&0!==p.length&&(f=a.buildSearchQuery(p,f,m),a.fetchResults(e,f,c))}})}buildSearchQuery(a,c,e){a=this.buildFilterExpression(a);let f="q\x3d*\x26q.parser\x3dlucene",l=["template_name:'resourcedetailpage'"];c&&l.push("search_by_domain:'"+c+"'");a&&l.push(a);f+="\x26fq\x3d(and "+l.join(" ")+")";return encodeURI(f+"\x26sort\x3dpublication_date desc\x26size\x3d"+e+"\x26return\x3dtitle,description,link,resource_type_title,geographic_location,subject_tag_titles,publication_date")}
103buildFilterExpression(a){if(!a|| 1040===a.length)return"";let c=a.map(function(l){var m=l.tagId.split("/");m=m[m.length-1].replace(/-/g,"_");return l.category+":'"+m+"'"}),e=[],f=[c[0]];for(let l=1;l<a.length;l++)"OR"===a[l].operator?(e.push(f),f=[c[l]]):f.push(c[l]);e.push(f);a=e.map(function(l){return 1===l.length?l[0]:"(and "+l.join(" ")+")"});return 1===a.length?a[0]:"(or "+a.join(" ")+")"}fetchResults(a,c,e){let f=this;d.initXHR({url:a,type:"GET",data:c,dataType:"json"}).then(function(l){l&&l.hits&&0<l.hits.found&&l.hits.hit?f.renderCards(l.hits.hit, 105e):f.hideIfPublish(e)},function(){f.hideIfPublish(e)})}hideIfPublish(a){let c=document.body;c.classList.contains("cq-wcm-edit")||c.classList.contains("cq-wcm-design")||a.closest("section.c-cg-related-resources").hide()}renderCards(a,c){let e=this,f="";b.each(a,function(l,m){f+=e.buildCardHtml(m)});c.html(f);this.bindEvents()}buildCardHtml(a){var c=a.fields;a=this.getField(c,"link");let e=this.getField(c,"title"),f=this.truncateDescription(this.getField(c,"description"),330),l=this.getField(c,"resource_type_title"), 106m=this.formatDate(this.getField(c,"publication_date")),p=(c.subject_tag_titles||[]).filter(function(t){t=t.toLowerCase();return"subject tags"!==t&&"subject_tags"!==t&&"focus areas"!==t&&"focus_areas"!==t&&"resource type"!==t&&"resource_type"!==t&&"geographic location"!==t&&"geographic_location"!==t});var r=(c.geographic_location||[]).filter(function(t){return"geographic_location"!==t});c="";1<r.length?c="Multiple Locations":1===r.length&&(c=r[0].replace(/_/g," ").replace(/\b\w/g,function(t){return t.toUpperCase()})); 107r='{ "event_name": "related_resource_card_click", "related_content_type": "'+l.replace(/"/g,'\\"')+'" }';let q='\x3ca href\x3d"'+a+'" class\x3d"c-cg-related-resources__card" data-analytics\x3d\''+r+"'\x3e";if(l||c)q+='\x3cdiv class\x3d"c-cg-related-resources__card-meta"\x3e',l&&(q+='\x3cspan class\x3d"c-cg-related-resources__resource-type"\x3e'+l+"\x3c/span\x3e"),c&&(q+='\x3cspan class\x3d"c-cg-related-resources__location"\x3e',q+='\x3cspan class\x3d"c-cg-related-resources__location-icon" aria-hidden\x3d"true"\x3e\x3csvg width\x3d"14" height\x3d"18" viewBox\x3d"0 0 14 18" style\x3d"fill: none;" fill\x3d"none" xmlns\x3d"http://www.w3.org/2000/svg"\x3e\x3cpath fill-rule\x3d"evenodd" clip-rule\x3d"evenodd" d\x3d"M9.14732 7.63616C9.14732 8.8935 8.12787 9.91295 6.87054 9.91295C5.6132 9.91295 4.59375 8.8935 4.59375 7.63616C4.59375 6.37883 5.6132 5.35938 6.87054 5.35938C8.12787 5.35938 9.14732
1076.37883 9.14732 7.63616Z" stroke\x3d"#949494" stroke-width\x3d"1.5"/\x3e\x3cpath fill-rule\x3d"evenodd" clip-rule\x3d"evenodd" d\x3d"M3.19489 12.135C2.62329 11.4678 2.10918 10.7538 1.68755 9.98736C1.41924 9.49887 1.17967 8.97435 1.10062 8.54622C1.09103 8.52751 1.09103 8.50411 1.08624 8.48539C1.02875 8.16722 1 7.83501 1 7.49812C1 4.30235 3.64959 1.71484 6.91725 1.71484C10.1897 1.71484 12.8393 4.30235 12.8393 7.49812C12.8393 7.83501 12.8105 8.16722 12.753 8.48539C12.7483 8.50411 12.7483 8.52751 12.7435 8.54622C12.5072 9.80628 10.9204 11.757 10.9204 11.757L6.97666 16.224C6.90287 16.3078 6.76968 16.3069 6.69733 16.2222L3.19489 12.135Z" stroke\x3d"#949494" stroke-width\x3d"1.5"/\x3e\x3c/svg\x3e\x3c/span\x3e', 108q+=c,q+="\x3c/span\x3e"),q+="\x3c/div\x3e";q+='\x3ch3 class\x3d"c-cg-related-resources__card-title"\x3e'+e+"\x3c/h3\x3e";m&&(q+='\x3cp class\x3d"c-cg-related-resources__card-date"\x3e'+m+"\x3c/p\x3e");f&&(q+='\x3cp class\x3d"c-cg-related-resources__card-description"\x3e'+f+"\x3c/p\x3e");0<p.length&&(q+='\x3cdiv class\x3d"c-cg-related-resources__card-tags"\x3e',p.forEach(function(t){q+='\x3cspan class\x3d"c-cg-related-resources__tag"\x3e'+t+"\x3c/span\x3e"}),q+="\x3c/div\x3e");return q+="\x3c/a\x3e"}getField(a, 109c){if(!a||!a[c])return"";a=a[c];return Array.isArray(a)?a[0]||"":a}formatDate(a){if(!a)return"";try{let c=new Date(a);return isNaN(c.getTime())?"":g[c.getUTCMonth()]+" "+c.getUTCDate()+", "+c.getUTCFullYear()}catch(c){return""}}truncateDescription(a,c){if(!a||a.length<=c)return a;a=a.substring(0,c);c=a.lastIndexOf(" ");0<c&&(a=a.substring(0,c));return a+"..."}bindEvents(){b(this.componentSelector).find(this.cardSelector).each(function(){var a=b(this);a.attr("href")&&!a.attr("role")&&a.attr("role", 110"link");a.off("click.cgAnalytics").on("click.cgAnalytics",function(){var c=a.attr("data-analytics");if(c)try{var e=JSON.parse(c),f="undefined"!==typeof utag_data&&utag_data.page_name?utag_data.page_name:"",l=(a.find(".c-cg-related-resources__card-title").text()||"").trim();e.event_action="clicked from "+f;e.event_category="clicked to "+l;n.setAnalyticsByPage(e,!0)}catch(m){}})})}}return new h}($,TNC.Utility);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.