(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4042],{4042:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return D}});var i=n(52322),a=n(12524),d=n.n(a),o=n(2784),s=n(64055),l=n(33792);let r={"hm-ad-container":"adContainerClass_acvudum","global-css":"adContainerGlobals_apqxrir"};n(70375);let c=(0,o.lazy)(()=>n.e(8544).then(n.bind(n,67361)).then(e=>{let{default:t}=e;return{default:t}})),g=(0,o.lazy)(()=>n.e(9151).then(n.bind(n,62662)).then(e=>{let{default:t}=e;return{default:t}})),u=e=>(e.position=[e.position],e),f=(0,o.forwardRef)((e,t)=>{let{isAmp:n,brandName:a}=(0,s.Z)()||!1,{adId:f,adUnit:p,targeting:h,ampConfig:m,variation:v,height:w,className:b,refreshCount:T,stickyMegabanner:y,style:A}=e,[I,S]=(0,o.useState)(!1),[E,C]=(0,o.useState)(!1),[k,R]=(0,o.useState)(""),B=(0,o.useRef)(null),q=null,j=null,x=null;if((0,o.useEffect)(()=>{let e=window.innerHeight;if(y){let t=document.querySelectorAll("[data-count]"),n=Array.from(t).reduce((e,t)=>e+t.getBoundingClientRect().height,0),i=document.getElementsByClassName("-variation-megabanner")[0],a=window.pageYOffset+i.getBoundingClientRect().top|0;t.length>1?(j=a-n+100,q=(a-n)*1.1+100):(j=a-n,q=(a-n)*1.1);let d=setTimeout(()=>{S(!1),B.current.dataset.stickyMegabanner="false",document.documentElement.scrollTop>=j+e/2&&C(!0),clearTimeout(d),R(""),setTimeout(()=>{C(!1)},400),x&&window.removeEventListener("scroll",x)},Number("6000")),o=0;return x=function(e,t){let n;for(var i=arguments.length,a=Array(i>2?i-2:0),d=2;dn=!1,t))}}(()=>{let t=window.pageYOffset||document.documentElement.scrollTop;t>o&&R("-is-scrolling-down"),t>q&&(S(!0),R("-is-scrolling-down sticky-megabanner")),t<=j&&(S(!1),R("")),t<=j+e&&C(!1),o=t<=0?0:t},5),window.addEventListener("scroll",x),()=>window.removeEventListener("scroll",x)}},[y,h]),n){let e=u(h),t=(0,i.jsx)(c,{adId:f,dataSlot:p,targeting:e,ampConfig:m,variation:v,style:A}),n=(0,i.jsx)(g,{adId:f,dataSlot:p,targeting:e,ampConfig:m,variation:v,style:A});if(e.position[0]===l.R.bannerinferior)return null;if(e.position[0]!==l.R.outofpage1X1)return v===l.R.sticky?n:t}return h.position===l.R.outofpage1X1?(0,i.jsx)("div",{className:b,ref:t,id:f,"data-position":"outofpage","data-refresh-count":T}):(0,i.jsx)("div",{ref:B,className:d()(["-variation-".concat(v),"-".concat(A),"hello"!==a?r["".concat(a,"-css")]:""]),style:{height:w||null},"data-sticky-megabanner":y,children:(0,i.jsx)("div",{className:d()([b,r["hm-ad-container"],{"-sticky":I},{"-hide-sticky":E},k]),children:(0,i.jsx)("div",{ref:t,id:f,"data-refresh-count":T})})})});f.defaultProps={variation:l.R.megabanner,className:null,adId:null,refreshCount:0,height:null,adUnit:"",targeting:{},stickyMegabanner:!1,ampConfig:{rtcConfig:{urls:[],vendors:{},timeoutMillis:0},multiSize:"",ampParams:{width:0,height:0,layout:"fixed",type:"doubleclick"}},style:"style-1"};var p=n(33043),h=n(20360),m=n(91709),v=n(86165),w=n(82674),b=n(25395),T=n(92582);let y=e=>document.getElementById(e),A=e=>document.createElement(e),I=e=>document.getElementsByClassName(e)[0],S={},E=(e,t,n,i,a,d,o,s)=>{let{position:r,sequence:c,place:g}=n,u={},f=A("script");if(r===l.R.interstitial?f.text="window.googletag.cmd.push(() => {\n window.adConfig.ads['".concat(e,"'] = googletag\n .defineOutOfPageSlot('").concat(a,"', window.googletag.enums.OutOfPageFormat.INTERSTITIAL)\n .setTargeting('position', '").concat(r,"')\n .addService(googletag.pubads());\n });"):r===l.R.outofpage1X1?f.text="window.googletag.cmd.push(() => {\n window.adConfig.ads['".concat(e,"'] = googletag\n .defineOutOfPageSlot('").concat(a,"', '").concat(t,"')\n .setTargeting('position', '").concat(r,"')\n .setTargeting('sequence', '").concat(c,"')\n .setCollapseEmptyDiv(").concat(o,")\n .addService(googletag.pubads());\n });"):f.text="window.googletag.cmd.push(() => {\n window.adConfig.ads['".concat(e,"'] = googletag\n .defineSlot('").concat(a,"', ").concat(d,", '").concat(t,"')\n .setTargeting('position', '").concat(r,"')\n .setTargeting('place', '").concat(g,"')\n .setTargeting('sequence', '").concat(c,"')\n .setCollapseEmptyDiv(").concat(o,")\n .addService(googletag.pubads());\n \n if ('").concat(r,"' === '").concat(l.R.megabanner,"') {\n window.adConfig.ads['").concat(e,"'].defineSizeMapping(window.mappings.mapping1);\n }\n });"),s.insertAdjacentElement("beforebegin",f),i.enabled&&i.sra){var p;null===(p=window.adConfig.sraIds)||void 0===p||p.push(e)}return u.slotDefined=!0,S[e]={aps:!1,prebid:!1},u},C=e=>{let{googletag:t}=window;t.cmd.push(function(){var n;t.pubads().addEventListener("slotRequested",e=>{let{slot:t}=e;performance.mark("[Ads] - ".concat(t.getSlotElementId()," slotRequested"))}),t.pubads().addEventListener("slotResponseReceived",e=>{let{slot:t}=e;b.T.hidden("ad","slotResponseReceived","[Ads] - ".concat(t.getSlotElementId()," slotResponseReceived"))}),t.pubads().addEventListener("impressionViewable",e=>{b.T.hidden("ad","impressionViewable","TEST [Ads] - impressionViewable slot ".concat(e.slot.getSlotElementId()," ")),document.querySelector("#".concat(e.slot.getSlotElementId()," iframe")).contentWindow.document.body.onclick=function(){var t,n;b.T.hidden("ad","impressionViewable","TEST [Ads] - ".concat(e.slot.getSlotElementId()," Clicked with campignId ").concat(e.slot.getResponseInformation().campaignId)),window.dataLayer.push({event:"ad_click",data:{campaignId:null==e?void 0:null===(t=e.slot)||void 0===t?void 0:t.getResponseInformation().campaignId,slotId:null==e?void 0:null===(n=e.slot)||void 0===n?void 0:n.getSlotElementId()}})}}),t.pubads().addEventListener("slotRenderEnded",e=>{let{slot:t}=e,{permutive:n}=window;if(t.getOutOfPage()){let i=t.getSlotElementId(),{advertiserId:a,campaignId:d}=e,o=document.getElementById("horizon-skin");o&&n&&o.addEventListener("click",function(){n.ready(function(){n.track("SlotClicked",{advertiser_id:a,campaign_id:d,slot:{slot_element_id:i}}),b.T.hidden("permutive","SlotClicked event","fired with slotId: ".concat(i))},"initialised")})}performance.mark("[Ads] - ".concat(t.getSlotElementId()," slotRenderEnded"))}),t.pubads().addEventListener("slotOnload",e=>{let{slot:t}=e;b.T.hidden("ad","slotResponseReceived","[Ads] - ".concat(t.getSlotElementId()," slotOnload"))}),t.pubads().setTargeting("environment",e.environment).setTargeting("edition",e.edition).setTargeting("pageID",e.pageID.toString()).setTargeting("articleheader",e.articleheader).setTargeting("pageType",e.pageType),(null===(n=e.taxonomy)||void 0===n?void 0:n.length)>0&&t.pubads().setTargeting("taxonomy",e.taxonomy)}),window.pageLevelTargeting=!0},k=(e,t)=>{try{let{googletag:n}=window;n.cmd.push(()=>{n.pubads().refresh([e]),b.T.hidden("ad","callAdserver","showing ad: ".concat(t)),performance.mark("[Ads] callAdserver showing ad: ".concat(t))}),b.T.hidden("ad","callAdserver","reset flags (aps/prebid) on slot ".concat(t)),S[t].aps=!1,S[t].prebid=!1}catch(e){console.error("Error in callAdserver for ".concat(t,":"),e)}},R=e=>{if(S[e].aps&&S[e].prebid){var t;b.T.hidden("ad","biddersBack","all bidders backs - currentSlotId: ".concat(e)),k([(null===(t=window.adConfig)||void 0===t?void 0:t.ads)[e]],e)}},B=e=>{S[e].aps=!0,b.T.hidden("ad","biddersBackAPS","biddersBackAPS - ".concat(e)),R(e)},q=e=>{let{pbjs:t}=window;b.T.hidden("ad","biddersBackPBJS","biddersBackPBJS - ".concat(e)),S[e].prebid=!0,t.que.push(function(){t.setTargetingForGPTAsync()}),R(e)},j=(e,t)=>{let{googletag:n,apstag:i,pbjs:a}=window,d=(0,v.L6)(e,t);b.T.hidden("ad","makeAutoRefreshCall","autorefresh slotAPS",d),void 0!==i&&"function"==typeof i.fetchBids&&void 0!==n&&void 0!==n.cmd&&void 0!==n.cmd.push&&d.length>0?i.fetchBids({slots:d},function(e){e&&0!==e.length?(b.T.hidden("ad","adInit","Autorefresh apstag.fetchBids slotAPS ",d),n.cmd.push(function(){b.T.hidden("ad","adInit","bids",e),i.setDisplayBids(),B(t)})):(b.T.hidden("ad","makeAutoRefreshCall","No TAM bids",d),B(t))}):(b.T.hidden("ad","makeAutoRefreshCall","apstag or googletag.cmd.push is undefined or slotAPS is empty!"),B(t)),void 0!==a&&void 0!==a.que?(b.T.hidden("ad","makeAutoRefreshCall","pbjs request ".concat(t)),a.que.push(()=>{a.rp.requestBids({callback:q(t),sizeMappings:w.dm_mapping,gptSlotObjects:[e],data:(0,T.F)(window.location.pathname)})})):(S[t].prebid=!0,R(t),b.T.hidden("ad","makeAutoRefreshCall","pbjs or pbjs.que is undefined!"))},x=(e,t,n,i,a,d)=>{let o={};try{if(e&&""!==e&&"desktop"===d){let d=y(e),s=0;if(n){let e=I("js-dwi-sidebar-top"),t=d.offsetTop+d.offsetHeight,n=e.offsetHeight;t>n?o.sideBarHeight=t:(s=n-t,o.sideBarHeight=n)}if(t&&""!==t){let e=y(t),n=e.offsetTop+e.offsetHeight-(d.offsetHeight+d.offsetTop);n&&n>0&&(o.height=n-s)}else if(!t||""===t){let e;if(a.enabled)(e=i.current-(d.offsetTop+d.offsetHeight))&&e>0&&(o.height=e);else{let t=d.parentElement.lastChild;(e=t.offsetTop?t.offsetTop-d.offsetTop+t.offsetHeight:i.current-d.offsetTop)&&e>0&&(o.height=e-s)}}}}catch(e){console.error("Ad Component",e)}return o},P=(e,t,n)=>{let{googletag:i,pbjs:a,apstag:d}=window,o=setInterval(()=>{var s,l;if(null===(s=window.adConfig)||void 0===s?void 0:s.ads[e]){if(!t.enabled&&(null==i?void 0:i.pubadsReady))b.T.hidden("ad","adInit","Normal Ad first impression: ".concat(e)),i.cmd.push(()=>{performance.mark("[Ads] - ".concat(e," ad request")),i.pubads().refresh([window.adConfig.ads[e]])});else if(t.enabled){b.T.hidden("ad","adInit","NO-SRA Ad first impression: ".concat(e));let t=(0,v.L6)(null===(l=window.adConfig)||void 0===l?void 0:l.ads[e],e);b.T.hidden("ad","adInit","slotAPS",t),void 0!==d&&void 0!==i&&void 0!==i.cmd&&void 0!==i.cmd.push&&"function"==typeof i.cmd.push&&t&&Array.isArray(t)&&t.length>0?(b.T.hidden("ad","adInit","slotAPS",t),d.fetchBids({slots:t},function(n){n&&0!==n.length?(b.T.hidden("ad","adInit","First call noSRA apstag.fetchBids slotAPS ",t),i.cmd.push(function(){b.T.hidden("ad","adInit","bids",n),d.setDisplayBids(),B(e)})):(b.T.hidden("ad","adInit","No TAM bids",t),B(e))})):(b.T.hidden("ad","adInit","apstag or googletag.cmd.push is undefined or slotAPS is empty!"),B(e)),void 0!==a&&void 0!==a.que?a.que.push(()=>{var t;b.T.hidden("ad","adInit","".concat(e," pbjs bid request")),a.rp.requestBids({callback:q(e),sizeMappings:w.dm_mapping,gptSlotObjects:[null===(t=window.adConfig)||void 0===t?void 0:t.ads[e]],data:(0,T.F)(window.location.pathname)})}):b.T.hidden("ad","adInit","pbjs or pbjs.que is undefined!")}clearInterval(o),n(!0)}},10)},_=(e,t,n,i,a,d,o)=>{let{googletag:s}=window;s.cmd.push(()=>{var l,r,c;if(null===(l=window.adConfig.ads)||void 0===l?void 0:l[e]){let l=null===(c=window.adConfig)||void 0===c?void 0:null===(r=c.ads[e].getResponseInformation())||void 0===r?void 0:r.lineItemId;l&&i.includes(l.toString())?(b.T.hidden("ad","refreshAd","The ad ".concat(e," is not refreshable due line item exclusion.")),d(!0)):(b.T.hidden("ad","refreshAd","Refreshing AD: ".concat(e," (refresh #").concat(n,")")),performance.mark("[Ads] refreshAd - Refreshing AD: ".concat(e," (refresh #").concat(n,")")),window.adConfig.ads[e].setTargeting("refreshed","".concat(n)),performance.mark("[Ads] - ".concat(e," loading")),a.enabled?(b.T.hidden("ad","refreshAd","autorefresh HB ad: ".concat(e)),j(window.adConfig.ads[e],e)):(b.T.hidden("ad","refreshAd","autorefresh normal ad: ".concat(e)),s.pubads().refresh([window.adConfig.ads[e]])),o(n+1),n===t.limit&&(b.T.hidden("ad","refreshAd","The AD: ".concat(e," won't refresh anymore because it reached the limit of ").concat(t.limit)),d(!0)))}})};var D=(0,o.memo)(e=>{let{data:t,widgetLocation:n}=e,{isGptEnabled:a,gptScriptNode:d,isPrebidDMLoaded:s}=(0,o.useContext)(p.k),{adUnit:l,targeting:r,sizes:c,device:g,first:u,autoRefresh:v,headerBidding:w,ampConfig:b,lineItemsExcluded:T,htmlData:y,stickyMegabanner:A,sequenceOverwrite:S,style:k}=t,{positionBySubComponent:R}=n;S||(r.sequence=R-1);let B=w.enabled?"HB-".concat(r.position,"-").concat(r.sequence):"AD-".concat(r.position,"-").concat(r.sequence),q="div-".concat(r.position,"_").concat(r.sequence),[j,D]=(0,o.useState)(!1),[O,H]=(0,o.useState)(!1),[L,N]=(0,o.useState)(1),[M,z]=(0,o.useState)(0),[F,Y]=(0,o.useState)(!1);(0,o.useEffect)(()=>{if(d&&!j&&a){let e=E(B,q,r,w,l,c,y.collapseEmptyDiv,d);(null==e?void 0:e.slotDefined)&&(D(e.slotDefined),window.pageLevelTargeting||C(r))}},[d,j,a]);let V=(0,o.useRef)(0);y.topElementId&&""!==y.topElementId&&I("hm-grid__content--article")&&(V.current=I("hm-grid__content--article").offsetHeight),(0,o.useEffect)(()=>{let e=x(y.topElementId,y.bottomElementId,u,V,w,g);(null==e?void 0:e.height)&&z(e.height),(null==e?void 0:e.sideBarHeight)&&(I("js-dwi-sidebar-top").style.minHeight="".concat(e.sideBarHeight,"px"))},[V.current]);let X=w.sra?{rootMargin:y.rootMarginFirstImpression,initialInView:!0}:{rootMargin:y.rootMarginFirstImpression,triggerOnce:!0},[G,J]=(0,h.YD)(X),[U,W]=(0,h.YD)({threshold:.5});(0,o.useEffect)(()=>{J&&j&&!O&&s&&w.enabled&&!w.sra?P(B,w,e=>{H(e)}):J&&j&&!O&&!w.enabled&&P(B,w,e=>{H(e)})},[J,O,j,B,s]),(0,m.Yz)(()=>{W&&v.enabled&&O&&!F&&!w.sra&&"visible"===window.document.visibilityState&&_(B,v,L,T,w,e=>{Y(e)},e=>{N(e)})},W&&v.enabled&&O&&!F?v.interval:null),(0,m.Yz)(()=>{W&&v.enabled&&w.enabled&&w.sra&&!F&&"visible"===window.document.visibilityState&&_(B,v,L,T,w,e=>{Y(e)},e=>{N(e)})},W&&v.enabled&&!F?v.interval:null);let Z={"data-refresh-count":L};return w.enabled&&(Z={}),(0,i.jsx)(f,{adId:q,className:g,ref:e=>{G(e),U(e)},variation:r.position,...Z,height:M,adUnit:l,targeting:r,ampConfig:b,stickyMegabanner:A,style:k})},()=>!0)},70375:function(){}}]);