(()=>{var t={1031:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Engagement=void 0;var s=i(7113);e.Engagement=s.default},7113:function(t,e,i){"use strict";var s=this&&this.__spreadArrays||function(){for(var t=0,e=0,i=arguments.length;e0&&t.domContentLoadedEventStart>0)return Math.floor(Math.abs(t.loadEventEnd-t.domContentLoadedEventStart))}catch(t){}return-1},t.prototype.getScreenLength=function(){return window.screen.availHeight||window.screen.height},t.prototype.initResizeListener=function(){var t=this,e=function(){t._pageHeight=t.getPageHeight(),t._windowHeight=t.getWindowHeight()};this._listeners.push({eventName:"resize",eventHandler:e}),window.addEventListener("resize",e)},t.prototype.initScrollListener=function(){var t=this,e=this.throttle((function(){t._maxScrollDepthPercentage=t.getMaxScrollDepth()}),1e3);this._listeners.push({eventName:"scroll",eventHandler:e}),window.addEventListener("scroll",e)},t.prototype.initVisibilityChangeListener=function(){var t=this,e=function(){"hidden"===window.document.visibilityState?t._hiddenTime=Date.now():t._hiddenTime>0&&(t._outOfFocusTime=t._outOfFocusTime+(Date.now()-t._hiddenTime))};this._listeners.push({eventName:"visibilitychange",eventHandler:e}),window.addEventListener("visibilitychange",e)},t.prototype.initVelocityListener=function(){var t=this;this._velocityInterval||(this._velocityInterval=setInterval((function(){t._velocities.push(t.getMomentVelocity())}),1e3))},t.prototype.getMaxScrollDepth=function(){this._pageHeight=this.getPageHeight(),this._windowHeight=this.getWindowHeight();var t=this.getScrollDepthPercentages(),e=this._maxScrollDepthPercentage||0;return Math.max(e,t)},t.prototype.getScrollDepthPercentages=function(){var t=this.getScrollingDistance(),e=this._pageHeight;return Math.round(t/e*100)},t.prototype.getScrollingDistance=function(){return this.getPageYOffset()+this._windowHeight},t.prototype.getPageYOffset=function(){return window.pageYOffset||window.scrollY},t.prototype.getWindowHeight=function(){return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight},t.prototype.getPageHeight=function(){var t,e;return Math.floor(Math.max(null===(t=window.document.body)||void 0===t?void 0:t.scrollHeight,null===(e=window.document.body)||void 0===e?void 0:e.offsetHeight,window.document.documentElement.clientHeight,window.document.documentElement.scrollHeight,window.document.documentElement.offsetHeight))},t.prototype.getTimeOnPage=function(){var t=(Date.now()-this._timeoffset)/1e3,e=this._outOfFocusTime/1e3;return Number((t-e).toFixed(2))},t.prototype.getAverageVelocity=function(t){var e=s(this._velocities);t===n.VelocityType.EXCLUDE_STATIC_USER&&(e=e.filter(Number));var i=e.reduce((function(t,e){return t+e}),0);return e.length>0?i/e.length:-1},t.prototype.getMomentVelocity=function(){var t=Date.now(),e=this.getScrollingDistance()-this._lastScrollingDistance,i=(t-this._lastVelocityReportTime)/1e3;return this._lastVelocityReportTime=t,this._lastScrollingDistance=this.getScrollingDistance(),!e?0:Math.round(Math.abs(e/i))},t.prototype.getTitlesText=function(){var t=[];return document.querySelectorAll("h1").forEach((function(e){t.push(e.innerText.trim().replace(/_/g,"-"))})),t.length?t.join("_"):void 0},t.prototype.getDescriptionText=function(){var t=[];return document.querySelectorAll("meta[name='description'],meta[property='og:description']").forEach((function(e){t.push(e.content.trim().replace(/_/g,"-"))})),t.length?t.join("_"):void 0},t.prototype.throttle=function(t,e){var i=Date.now();return function(){i+e-Date.now()<0&&(t(),i=Date.now())}},t}();e.default=r},1680:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.VelocityType=void 0,function(t){t.EXCLUDE_STATIC_USER="exclude_static_user",t.INCLUDE_STATIC_USER="include_static_user"}(e.VelocityType||(e.VelocityType={}))},7590:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Moat=void 0;var s=i(7971);e.Moat=s.default},7971:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){this.config=t,this.client={moatClientLevel1:t.layout_id,moatClientLevel2:t.site_key,moatClientLevel3:t.devicePlatform,moatClientLevel4:t.publisher_key}}return t.prototype.getURL=function(){return t.SCRIPT_SRC+"#"+this.toUrlParams(this.client)},t.prototype.toUrlParams=function(t){return Object.keys(t).map((function(e){return e+"="+("object"==typeof t[e]?encodeURIComponent(JSON.stringify(t[e])):encodeURIComponent(t[e]))})).join("&")},t.SCRIPT_SRC="//z.moatads.com/browsidisplay14489870757/moatad.js",t}();e.default=i},5218:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WebVitals=void 0;var s=i(4070);Object.defineProperty(e,"WebVitals",{enumerable:!0,get:function(){return s.WebVitals}})},4070:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WebVitals=void 0;var i=function(){function t(t,e){this.webVitalsData={pv:t,url:e}}return t.prototype.getData=function(){return this.webVitalsData},t.prototype.measure=function(){var t=this;this.getInstance().then((function(e){e.getFID(t.collectWebVitals.bind(t)),e.getLCP(t.collectWebVitals.bind(t)),e.getCLS(t.collectWebVitals.bind(t))}))},t.prototype.collectWebVitals=function(t){var e=this.prepareDataFields(t),i=e.name.toLowerCase();this.webVitalsData[i]=e.value},t.prototype.getInstance=function(){return new Promise((function(t){if(window.top.webVitals)t(window.top.webVitals);else{var e=document.createElement("script");e.src="//cdn.browsiprod.com/web-vitals/web-vitals.iife.3.1.0.js",e.onload=function(){t(window.top.webVitals)},document.head.appendChild(e)}}))},t.prototype.prepareDataFields=function(t){var e=t.name,i=t.value;return{name:e,value:i="number"==typeof i?+i.toFixed(3):i}},t}();e.WebVitals=i},7121:(t,e,i)=>{"use strict";const s=i(1993),n=i(125),r=i(2970),o=i(7730),h=i(2727),a=i(6393),d=i(9394),l=i(7247),c=i(1128);i(6652);const u=i(514),p=i(3034),v=i(4817),f=i(5218),m=i(4941),g=i(1031),b=i(8614),w=i(7254);let y;class S{constructor(){this.logger=new n.Logger("App.ts"),this.profile=o.Profiler.get(),o.Profiler.setLoadTime(y),this.logger.info("profile: ",this.profile),o.Profiler.detectAdBlocker((()=>s.EventsService.get().sendAdBlockerEvent()))}run(){this.logger.info("started"),"bl"===this.profile.runMode?this.blocklistedRun():this.standardRun()}blocklistedRun(){this.logger.custom("Blocklisted mode",h.Utils.getLogStyle(48,"red","#000")),this.setUserEngagedListener(),s.EventsService.get().sendPageviewEvent()}standardRun(){var t;if(!this.profile.layouts.analysisMode&&(new v.DemandTool,this.profile.layouts.fixedSpotsFirst)){this.logger.info("scanning fixed spots first");const t=r.default.instance.findSpots(c.FIXED_TAGS,(()=>{}),!0);a.YieldClient.get().processSpots(t)}if(this.profile.layouts.analysisMode&&this.logger.custom("AnalysisMode ON",h.Utils.getLogStyle(18,"red","#000")),this.setUserEngagedListener(),this.profile.layouts.useWebVitals){const t=new f.WebVitals(this.profile.identity.pageviewId,this.profile.identity.url);t.measure(),b.Focus.get().subscribe((e=>{if(e){const e=t.getData(),{fid:i,lcp:n,cls:r}=e;[i,n,r].some((t=>"number"==typeof t))&&(this.logger.info("Web vital data",e),s.EventsService.get().sendWebVitalsEvent(e))}}))}this.initSummaryEvent();const e=new w.default((null===(t=this.profile.siteInfo.prebidData)||void 0===t?void 0:t.g)||"pbjs",window);u.default.get().addExternalListenerRemoveFunction(e.removeListeners.bind(e)),e.initListeners();const i=h.Utils.getLoaderParams().sec.t;i?(this.logger.info(`waiting ${i}mc`),setTimeout((()=>{this.desktopRunner()}),i)):this.desktopRunner()}initSummaryEvent(){g.Engagement.get(this.profile.identity.timeOffset).subscribe(),b.Focus.get().subscribe((t=>{t&&s.EventsService.get().sendSummaryEvent()}))}initializeRun(){return new Promise((t=>{const e=h.Utils.getExternalFlowHandler("engineInitiator");e?e(h.Utils.getLoaderParams(),t,this.profile):t(!1)}))}desktopRunner(){this.initializeRun().then((t=>{t&&(this.profile=o.Profiler.rebuild(h.Utils.getLoaderParams())),this.runPageView()}))}runPageView(){this.runTriggersHook(),this.profile.domData=o.Profiler.collectDOMData(),p.SpotsUtils.rebuild();const t=this.isProfileValid(this.profile.domData);let e=c.SCAN_SPOT_TAGS.filter((e=>!t.invalidTypes.includes(e.oldType)));this.logger.info("types to scan",e.map((t=>t.oldType))),t.errorMessages.length&&this.logger.warn("invalid profiles: ",t.errorMessages),h.Utils.isStickyActive()&&e.push(c.SPOT_TAGS_MAP[c.SpotType.STICKY]),e.length?this.checkAndHandleDcs(this.profile).catch((t=>this.logger.error("DCS: "+t))).then((t=>{this.profile.layouts.fixedSpotsFirst&&(e=e.filter((t=>!c.FIXED_TAGS.includes(t)))),this.findSpots(r.default.instance,e,t||void 0),d.default.get().scan(!0),h.Utils.buildBrowsiOutput(this.profile)})):(this.profile.state="error",this.logger.warn("Invalid profile",t.errorMessages),s.EventsService.get().sendPageviewEvent(t.errorMessages),this.checkAndHandleDcs(this.profile)),d.default.get().scan(!0),h.Utils.buildBrowsiOutput(this.profile)}checkAndHandleDcs(t){const e=l.DcsFactory.buildDcs(t);return e?e.dcsObj&&"error"===t.state?e.detectUrlChangeOnly():e.prepareAndRunDcs():Promise.resolve()}findSpots(t,e,i){let s=t.findSpots(e,i,!1);s=s.filter((t=>t.type!==c.SpotType.STICKY)),a.YieldClient.get().handleSpots(s)}isProfileValid(t){const e=[];let i=[];return c.SCAN_SPOT_TAGS.forEach((s=>{const n=p.SpotsUtils.getConf(s),r=o.Profiler.validateProfileForBehavior(t,s.oldType,n);!r.length&&p.SpotsUtils.isActive(s)||(e.push(s.oldType),i=i.concat(r.map((t=>s.oldType+"_"+t))))})),{invalidTypes:e,errorMessages:i}}setUserEngagedListener(){if(h.Utils.getScrollPosition().top>0)s.EventsService.get().sendUserEngagementEvent();else{const t=()=>{this.logger.info("detected engagementScroll, send event"),u.default.get().removeListener("scroll",h.Utils.getScrollElement(),t),this.profile.isUserEngaged=!0,s.EventsService.get().sendUserEngagementEvent()};u.default.get().listen("scroll",h.Utils.getScrollElement(),t)}}runTriggersHook(){const t=h.Utils.getExternalFlowHandler("triggers");t&&t({pv:t=>{s.EventsService.get().sendPageviewEvent([],t)},gd:(t,e)=>{s.EventsService.get().sendGeneralDataEvent(t,e)}})}}function _(){if(("interactive"===document.readyState||"complete"===document.readyState)&&!window._middyo.loaded){window._middyo.loaded=!0;(new S).run()}}!function(){var t,e;const i=h.Utils.getLoaderParams(),s=null===(e=null===(t=null==i?void 0:i.sec)||void 0===t?void 0:t.dcs)||void 0===e?void 0:e.su;s&&new m.DcsApi(i,s)}(),s.EventsService.get().sendEngineLoadedEvent(),y=Date.now(),window.document.addEventListener("readystatechange",(()=>_())),_()},7151:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultSpotsStrategy=void 0;const s=i(125),n=i(7730),r=i(2727),o=i(3034),h=i(1128);e.DefaultSpotsStrategy=class{constructor(){var t,e,i;this.logger=new s.Logger("SpotsStrategy"),this.profile=n.Profiler.get(),this.maxItems=(null===(t=o.SpotsUtils.getConf(h.SPOT_TAGS_MAP[h.SpotType.DYNAMIC_MC]))||void 0===t?void 0:t.maxSpots)||0,this.logger.custom("spots strategy: default",r.Utils.getLogStyle(18,"black","green")),this.logger.custom(`Allow narrow ads to break: ${!!(null===(e=this.profile.layouts)||void 0===e?void 0:e.allowNarrowBreak)}, Allow narrow ads wrap: ${!!(null===(i=this.profile.domData)||void 0===i?void 0:i.allowNarrowWrap)} `,r.Utils.getLogStyle(18,"white","blue"))}stopScanning(t){return this.maxItems===this.filterSpotsBy(t,"narrow","wrapped",!1).length}selectSpots(t){let e=this.maxItems,i=[],s=[];const n=this.filterSpotsBy(t,"narrow","wrapped",!0,e);this.logger.debug("selected narrow spots with wrap: ",n),e-=n.length,e>0&&(i=this.filterSpotsBy(t,"narrow","break",!0,e,n),this.logger.debug("selected narrow spots with break: ",i),e-=i.length),e>0&&(s=this.filterSpotsBy(t,"wide","break",!0,e,[...n,...i]),this.logger.debug("selected wide spots with break: ",s));let o=r.Utils.sortSpotsByOffsetTop(...n,...i,...s).slice(0,this.maxItems);return o=this.assignWrappingDirection(o),o.forEach(((t,e)=>{t.initializeTypeIndex(e)})),o}selectEmbeddings(t){return t.forEach((t=>{t.compatibleSizes.forEach((t=>{t.selectedEmbedding=t.optionalEmbeddings.includes("wrapped")?"wrapped":"break"}))})),t}filterSpotsBy(t,e,i,s,n,r){let o=t.filter((t=>(!r||!r.includes(t))&&t.compatibleSizes.filter((t=>t.adSizeType===e&&t.optionalEmbeddings.includes(i))).length>0));return n&&Number.isInteger(n)&&n.5?"left":"right":this.profile.spotEngineConfig.embedType}assignWrappingDirection(t){return t.forEach((t=>{t.compatibleSizes.forEach((t=>{"wrapped"===t.selectedEmbedding&&(t.selectedEmbedding=this.getWrapType())}))})),t}}},5762:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(2362),n=i(5857);class r extends s.Embedder{constructor(t){super(t)}appendAndGetWrapper(t){return new Promise(((e,i)=>{if(t.ref&&t.ref.parentNode){let i;n.InframeManager.get().isProviderInframe(t)&&(i=n.InframeManager.get().getSpotContainers(t.adIndex));const s=(null==i?void 0:i.adWrapper)||document.createElement("div"),r=(null==i?void 0:i.adContainer)||document.createElement("div");s.setAttribute("spotType",t.type),s.setAttribute("typeIndex",""+t.typeIndex),r.id=this.containerId,s.id=this.wrapperId,(null==i?void 0:i.adContainer)||s.appendChild(r),s.style.display="none",this.appendAd(t,s,!!i),t.browsiAd.win=window,t.browsiAd.wrapper=s,t.browsiAd.container=r,t.browsiAd.iframe=null,this.setPlaceholder(t,s,r),e(t.browsiAd)}else i(t.browsiAd)}))}}e.default=r},2362:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Embedder=void 0;const s=i(2727),n=i(7730),r=i(125),o=i(6319),h=i(1128),a=i(8104),d=i(3034),l=i(1993),c=i(4869);let u=(()=>{class t{constructor(e){var i;const s=e.getIdentifier();this.wrapperId=`${t.wrapperIdPrefix}_${s}`,this.containerId=`${t.containerIdPrefix}_${s}`,this.profile=n.Profiler.get();const r=o.DcsUtils.getWindowObject(),h=(null==r?void 0:r.count)||(null===(i=this.profile.dcsState)||void 0===i?void 0:i.count);h&&(this.wrapperId+="_dcs_"+h,this.containerId+="_dcs_"+h),e.setDomId(this.wrapperId)}appendAd(e,i,n){if(e.isRefreshing()||t.removeAdFromDom(e),!n)if(e.type===h.SpotType.STICKY)this.appendStickyAd(i);else if(e.ref.parentNode){if(e.tableConfiguration){const t=e.tableConfiguration.mainTd.cloneNode();t.appendChild(i),e.ref.parentNode.insertBefore(t,e.ref)}else switch(e.targetElementPosition){case"ABOVE":e.ref.insertAdjacentElement("beforebegin",i);break;case"INSIDE":e.ref.insertAdjacentElement("afterbegin",i)}s.Utils.reportNewBrowsiAd(i)}else s.Utils.reportNewBrowsiAd(i);this.runPostEmbedHook(e,i)}runPostEmbedHook(t,e){const i=s.Utils.getExternalFlowHandler("postEmbed");i&&i(t,e)}appendStickyAd(t){var e;const i=window.document.body;(null===(e=d.SpotsUtils.getConf(h.SPOT_TAGS_MAP[h.SpotType.STICKY]))||void 0===e?void 0:e.location)===a.StickyLocation.BOTTOM?i.appendChild(t):i.insertBefore(t,i.firstElementChild),s.Utils.reportNewBrowsiAd(t)}static isEmbeddedByBrowsi(e){const i=Array.from(s.Utils.getCurrentContextElement().querySelectorAll(`div[id^="${t.wrapperIdPrefix}"]`));let n=!1;return i.forEach((t=>{!n&&s.Utils.isPositionContained(t,e)&&(n=!0)})),n}static injectMoat(t){t.browsiAd.wrapper&&s.Utils.injectMoat(t.browsiAd.iframe||t.browsiAd.wrapper,!!t.browsiAd.iframe)}static addStickyCloseButton(e,i){var n;const r=d.SpotsUtils.getConf(h.SPOT_TAGS_MAP[h.SpotType.STICKY]);if(i&&(null==r?void 0:r.closeButton)){const o=r.location,h=document.documentElement.clientWidth||s.Utils.getPageWidth(),d=(null===(n=e.selectedSize)||void 0===n?void 0:n.w)||h,c=document.createElement("c-button");c.id=`close-sticky-${e.getIdentifier()}`,c.innerHTML='',c.setAttribute("style","position: absolute;width: 24px;height: 24px;border:none; background:none;padding:0;cursor:pointer"),c.style.right=h-24<=d?"0px":"-12px",c.style[o===a.StickyLocation.BOTTOM?"top":"bottom"]="-12px",c.onclick=()=>{e.isRefreshing()||(t.removeStickyAd(e),l.EventsService.get().sendStickyClosedEvent(e))},i.appendChild(c)}}static removeStickyAd(e){if("s"!==e.tags.positionTag)return;t.removeAdFromDom(e),e.destroySlot(),c.ViewabilityService.get().unsubscribe(e);const i=window.document.body.style,s=d.SpotsUtils.getConf(h.SPOT_TAGS_MAP[h.SpotType.STICKY]);s&&s.location===a.StickyLocation.TOP?i.paddingTop="":i.paddingBottom=""}static removeAdFromDom(t){var e,i,n,r;if(null===(e=t.placeholder)||void 0===e||e.stopObserving(),(null===(i=t.browsiAd)||void 0===i?void 0:i.externalElement)&&s.Utils.removeElement(t.browsiAd.externalElement),null===(n=t.browsiAd)||void 0===n?void 0:n.wrapper){const e=("getQueryBaseElement"in t?t.getQueryBaseElement():document).querySelector(`#${t.browsiAd.wrapper.id}`);if(!e||!e.parentNode)return!1;if((null===(r=t.browsiAd.admarking)||void 0===r?void 0:r.parentElement)===e&&this.removeAdMarkingFromDom(t.browsiAd),!t.tableConfiguration)return e.parentNode.removeChild(e),!0;{const t=e.parentElement;if(t&&t.parentNode)return t.parentNode.removeChild(t),!0}}return!1}static removeAdMarkingFromDom(t){var e;return!!(null===(e=null==t?void 0:t.admarking)||void 0===e?void 0:e.parentNode)&&(t.admarking.parentNode.removeChild(t.admarking),delete t.admarking,!0)}setPlaceholder(t,e,i){var s;if((null===(s=t.placeholder)||void 0===s?void 0:s.active)&&!t.isRefreshing()){const s=t.placeholder.size;e.style.display="block",i.setAttribute("style",`display:block; width:${s.w}px; min-height:${s.h}px; background-color:transparent;margin:auto;`),t.placeholder.openPlaceholder(t)}}}return t.logger=new r.Logger("Embedder"),t.wrapperIdPrefix="browsi_adWrapper",t.containerIdPrefix="browsi_adContainer",t})();e.Embedder=u},8033:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EmbeddingFactory=void 0;const s=i(5762),n=i(6790);e.EmbeddingFactory=class{static getEmbedder(t,e){if("header_bidding"===t.rt)return t.c.if?new n.default(e):new s.default(e);if("empty_api"===t.rt)return new s.default(e);{const i=t;switch(i.c.p){case"dfp":case"generic_js":return"true"===i.c.a.inIFrame?new n.default(e):new s.default(e);default:return null}}}}},6790:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(2362);class n extends s.Embedder{constructor(t){super(t)}appendAndGetWrapper(t){return new Promise(((e,i)=>{if(t.ref&&t.ref.parentNode){let s=!1;const n=document.createElement("div"),r=document.createElement("iframe");n.setAttribute("spotType",t.type),n.setAttribute("typeIndex",""+t.typeIndex),n.appendChild(r),n.id=this.wrapperId,r.id=this.containerId,r.scrolling="no",r.frameBorder="0",r.marginHeight="0",r.marginWidth="0",r.height="0",r.width="0",r.style.display="none",this.setIframePlaceholderStyle(r,t),r.onload=()=>{if(!s){if(s=!0,r.contentDocument){r.contentDocument.open(),r.contentDocument.close();const e=r.contentDocument.createElement("div");e.setAttribute("id",this.containerId),r.contentDocument.body.appendChild(e),t.browsiAd.win=r.contentWindow||void 0,t.browsiAd.wrapper=n,t.browsiAd.container=e,t.browsiAd.iframe=r,this.setPlaceholder(t,n,e)}r.contentWindow.__cmp=window.__cmp,r.contentWindow.__tcfapi=window.__tcfapi,e(t.browsiAd)}},r.onerror=()=>{i(t.browsiAd)},this.appendAd(t,n,!1)}else i(t.browsiAd)}))}setIframePlaceholderStyle(t,e){var i;if(!(null===(i=e.placeholder)||void 0===i?void 0:i.active))return;const s=e.getPlaceholderSize(e.getCompatibleSizes());t.width=""+s.w,t.height=""+s.h,t.style.display="block"}}e.default=n},6258:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ProviderFactory=void 0;const s=i(2247),n=i(6418),r=i(8008),o=i(1345);e.ProviderFactory=class{static getProvider(t,e){switch(t.rt){case"empty_api":return new s.DFP(e);case"inframe":return new o.Inframe(e,"inframe",t.plk);case"provider":const i=t;switch(i.c.p){case"dfp":return new s.DFP(e);case"generic_js":return new r.GenericJS(e,i);default:return null}case"header_bidding":const h=t;return e.providerName="header_bidding",new n.HeaderBiddingDA(e,h.c.b,h.c.d)}return null}static setSpotProviderName(t,e){var i,s;switch(e.genericParams.displayName=void 0,null==t?void 0:t.rt){case"inframe":e.providerName="inframe";break;case"header_bidding":e.providerName="header_bidding";break;case"empty_api":e.providerName="dfp";break;case"provider":const n=t;switch((null===(i=n.c.a)||void 0===i?void 0:i.template)&&(e.providerName="generic_js",e.genericParams.displayName=null===(s=n.c.a.template)||void 0===s?void 0:s.p),n.c.p){case"dfp":e.providerName="dfp";break;case"generic_js":e.providerName="generic_js"}}}}},2970:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(2727),n=i(125),r=i(1993),o=i(635),h=i(7151),a=i(7730),d=i(9235),l=i(1128),c=i(979),u=i(6319),p=i(9394),v=i(6393),f=i(3034),m=i(4603),g=i(7989),b=i(4510),w=i(5382),y=i(7463),S=-1,_=0,O=600,j=100,A=200,E=300,P=400,I=700,T=800;class x{constructor(){this.firstScanSpots=[],this.adIndexLimit=99,this.logger=new n.Logger("SpotEngine"),this.profile=a.Profiler.get(),this.availableSpots=[],this.spotsFromPreviousPageview=[],this.lastScannedElement=null,this.firstScannedElement=null,this.isMenuPositionFixed=!1,this.spotsStrategy=new h.DefaultSpotsStrategy,this.currentSpotType=l.SpotType.DYNAMIC_MC,this.spotsBeforeDcs=[],this.typesScannedBeforeDcs=[],this.apiSpots=[],this.profile.debugMode&&(this.profile.spotEngineTest={}),this.endlessRails={}}static get instance(){return this._instance||(this._instance=new x),this._instance}findSpots(t,e=this.sendPageViewEvent.bind(this),i,n){const o=u.DcsUtils.getDcsType(),h=!!o;if(h&&(t=t.filter((t=>!f.SpotsUtils.getTypesToDisableOnDcs(o).includes(t.oldType)&&!this.typesScannedBeforeDcs.includes(t.oldType))),"end_less"===o)){const t=u.DcsUtils.getCurrentDcsElement();t&&(this.endlessRails={element:t,top:s.Utils.getElementCoordinates(t).top})}const a=t.filter((t=>f.SpotsUtils.isFixedSpot(t.oldType)));let d=[],c=[],p=[],v=[];a.length&&(d=this.scanFixedSpots(h,a,!i),this.availableSpots.push(...d));const m=t.map((t=>t.oldType));if(m.includes(l.SpotType.DYNAMIC_MC)){c=this.scanDynamicSpots(h),this.availableSpots.push(...c);const t=f.SpotsUtils.getConf(l.SPOT_TAGS_MAP[l.SpotType.DYNAMIC_MC]),e=(null==t?void 0:t.maxItems)||0,i=(null==t?void 0:t.maxSpots)||0;this.logger.custom(`Dynamic spots found: ${c.length}`,s.Utils.getLogStyle(18,"black","green"),c),this.logger.custom(`Dynamic max items: ${e} | potential spots: ${i}`,s.Utils.getLogStyle(16,"black","green"))}const g=t.filter((t=>f.DYNAMIC_RAIL_TYPES.includes(t.oldType)));g.length&&(p=this.scanDynamicRailsSpots(g),this.availableSpots.push(...p)),m.includes(l.SpotType.STICKY)&&(v=this.scanForSticky(h)),this.availableSpots=[];const b=this.setAdIndexesByColumn(c,d,p,v);for(let t in b)b.hasOwnProperty(t)&&this.availableSpots.push(...b[t].spots);this.availableSpots=s.Utils.sortSpotsByPosition(...this.availableSpots);const w=s.Utils.isLazySpotsEnabled(),y=s.Utils.getLazySpotsInstance(),S=this.getPositionTagIndexMap();return this.availableSpots.forEach((t=>{t.type!==l.SpotType.STICKY&&(this.setSpotPositionTagIndex(t,S),w&&(t.isLazyLoading=y.isLazy(t)),r.EventsService.get().sendSpotFoundEvent(t),this.logger.info(`Found ${t.type} spot`,t.ref))})),i?(this.firstScanSpots.push(...d),this.availableSpots=[],d.filter((t=>!this.spotsFromPreviousPageview.includes(t)))):(h&&this.handleSpotsFromPreviousPageview(),n||(e(x._instance),this.profile.debugMode&&(this.buildSpotEngineTest(),this.profile.state="done")),this.availableSpots.filter((t=>!this.spotsFromPreviousPageview.includes(t))))}setSpotPositionTagIndex(t,e){t.positionTagIndex=e[t.tags.positionTag],e[t.tags.positionTag]++}scanDynamicSpots(t,e){const i=!!e;this.logger.info(`Scanning for ${i?"DCS API ":""} dynamic spots...`);let n=[];if(!this.profile.domData)return n;const r=f.SpotsUtils.getConf(l.SPOT_TAGS_MAP[l.SpotType.DYNAMIC_MC]),o=r.allowOverflowContainer,h=this.getStartInFold(r);if(r){const a=e?f.SpotsUtils.getDcsApiElements(e):r.elements;for(let e of a){if(this.isAlreadyWrapped(n,e))continue;if(!i&&this.spotsStrategy.stopScanning(n)){this.lastScannedElement=e.previousElementSibling;break}if(this.isStopInFoldViolated(e,r.stopInFold)){this.lastScannedElement=e.previousElementSibling,this.logger.debug(`SpotEngine Stopped. StopIF = ${r.stopInFold}, reached element at fold ${s.Utils.getElementFoldNumber(e)}: `,e);break}if("invalid"===this.validateSpot(e,h,!1,l.SPOT_TAGS_MAP[l.SpotType.DYNAMIC_MC],r).status)continue;let a=s.Utils.sortByHeight(s.Utils.clone(r.allowedCreativeSizes));o||a.filter((t=>!this.isCompSizeBiggerThanParentSize(t,e)));const d=[],c=this.getNextParagraphsTotalHeight(e,this.profile.spotEngineConfig.wrappingAdditionalElements,a,d),u=this.getCompatibleAdsSizes(e,c,l.SpotType.DYNAMIC_MC,a,void 0);if("invalid"!==this.validateStayAway(e,n,u,!0,l.SPOT_TAGS_MAP[l.SpotType.DYNAMIC_MC]).status)if(this.hasValidDynamicSizes(u)){const i=new g.DynamicSpot(e,l.SpotType.DYNAMIC_MC,n.length,u,c,t);this.logger.info("New dynamic spot found: ",i.ref),i.wrappedElements.push(...d),n.push(i)}else this.logger.debug("invalid dynamic spot [no compatible size found]:",e)}}return e?n:(this.logger.info("Spots found before filtering: ",n),this.spotsStrategy.selectSpots(n))}setAdIndexesByColumn(t,e,i,n){const r={topSpots:{spots:s.Utils.sortSpotsByPosition(...e.filter((t=>t.type===l.SpotType.FIXED_TOP))),startIndex:j},dynamicInContentSpots:{spots:s.Utils.sortSpotsByPosition(...t),startIndex:_},fixedInContentSpots:{spots:s.Utils.sortSpotsByPosition(...e.filter((t=>t.type===l.SpotType.FIXED_MC))),startIndex:O},bottomSpots:{spots:s.Utils.sortSpotsByPosition(...e.filter((t=>t.type===l.SpotType.FIXED_BOTTOM))),startIndex:A},dynamicRightRailSpots:{spots:s.Utils.sortSpotsByPosition(...i.filter((t=>t.type===l.SpotType.DYNAMIC_RIGHT_RAIL))),startIndex:E},dynamicLeftRailSpots:{spots:s.Utils.sortSpotsByPosition(...i.filter((t=>t.type===l.SpotType.DYNAMIC_LEFT_RAIL))),startIndex:P},fixedRightRailSpots:{spots:s.Utils.sortSpotsByPosition(...e.filter((t=>t.type===l.SpotType.FIXED_RIGHT_RAIL))),startIndex:I},fixedLeftRailSpots:{spots:s.Utils.sortSpotsByPosition(...e.filter((t=>t.type===l.SpotType.FIXED_LEFT_RAIL))),startIndex:T},stickySpots:{spots:n,startIndex:S}};for(let t in r)if(r.hasOwnProperty(t)){const e=r[t].spots,i=r[t].startIndex;e.forEach(((t,e)=>{const s=Math.min(e,this.adIndexLimit);t.adIndex=i+s}))}return r}scanBeforeDcs(){let t=f.SpotsUtils.getTagsToScanBeforeDcs();const e=!!this.profile.layouts.fixedSpotsFirst;e&&(t=t.filter((t=>!f.FIXED_TYPES.includes(t.oldType))));const i=t.map((t=>t.oldType));this.logger.info("scan for spots before DCS",i),this.spotsBeforeDcs=this.findSpots(t,(()=>{}),e),this.typesScannedBeforeDcs=i,this.availableSpots=[],v.YieldClient.get().handleSpots(this.spotsBeforeDcs)}sendPageViewEvent(){r.EventsService.get().sendPageviewEvent()}scanFixedSpots(t,e,i){this.logger.info(`Scanning for fixed spots... extra validation: ${i}`);let n=[];return e.forEach((e=>{const o=f.SpotsUtils.getConf(e);if(!o)return;const h=this.getStartInFold(o);let a=o.maxSpots;const d=o.elements,c=o.allowedCreativeSizes,u=o.allowOverflowContainer;this.getFixedElementsBySelector(o.targetElements);for(let p of d){if(this.isPositionInsideAndNotEmpty(o,p)){this.logger.debug("invalid spot [position inside and not empty]:",p),r.EventsService.get().sendErrorEvent("configuration_error","","fixed spot rejected - positioned inside of non empty element");continue}if(i){if(!f.SpotsUtils.getRailsTypes().includes(e.oldType)&&this.isStopInFoldViolated(p,o.stopInFold)){this.logger.debug("invalid spot [below stop in fold]:",p);continue}if("invalid"===this.validateSpot(p,h,!0,e,o).status)continue}let d=s.Utils.clone(c);u||d.filter((t=>!this.isCompSizeBiggerThanParentSize(t,p)));const v=this.getCompatibleAdsSizes(p,0,e.oldType,d,!0);if(!i||"invalid"!==this.validateStayAway(p,n,v,e.oldType===l.SpotType.FIXED_MC,e).status){if(v.length>0){const i=n.filter((t=>t.type===e.oldType)).length,s=this.getSelectorByElement(p),r=new b.FixedSpot(p,i,v,0,e.oldType,t,s);this.logger.info("New",e.oldType," spot found: ",r.ref),n.push(r)}else this.logger.debug("invalid fixed spot [no compatible size found]:",p);if(n.filter((t=>t.type===e.oldType)).length>=a)break}}this.logger.custom(`${e.oldType} spots found: ${n.filter((t=>t.type===e.oldType)).length}`,s.Utils.getLogStyle(18,"black","green")),this.logger.custom(`${e.oldType} max items: ${Math.min(a,o.maxItems)} | potential spots: ${o.maxSpots}`,s.Utils.getLogStyle(16,"black","green"))})),n}getPositionTagIndexMap(){var t,e,i;const s={in:0,b:0},n=null===(i=null===(e=null===(t=this.profile.layouts)||void 0===t?void 0:t.spots)||void 0===e?void 0:e.rails)||void 0===i?void 0:i.railSide,r=n===y.RailsSides.RIGHT?"r":n===y.RailsSides.LEFT?"l":void 0;return r&&Object.assign(s,{[r]:0}),s}scanDynamicRailsSpots(t){if(this.logger.info("Scanning for dynamic rails spots..."),!t.length)return[];let e=[];return t.forEach((t=>{const i=f.SpotsUtils.getConf(t),n=i.maxSpots,r=i.allowOverflowContainer;for(let o of i.elements){if(this.isAlreadyWrapped(e,o))continue;if("invalid"===this.validateSpot(o,0,!1,t,i).status)continue;let h=s.Utils.clone(i.allowedCreativeSizes);r||h.filter((t=>!this.isCompSizeBiggerThanParentSize(t,o)));const a=this.getCompatibleAdsSizes(o,0,t.oldType,h);if("invalid"!==this.validateStayAway(o,e,a,!1,t).status){if(this.hasValidDynamicSizes(a)){const i=new g.DynamicSpot(o,t.oldType,e.filter((e=>e.type===t.oldType)).length,a,0,!1);this.logger.info("New "+t.oldType+" spot found: ",i.ref),e.push(i)}else this.logger.debug(`invalid ${t.oldType} spot [no compatible size found]:`,o);if(e.filter((e=>e.type===t.oldType)).length>=n)break}}this.logger.custom(`${t.oldType} spots found: ${e.filter((e=>e.type===t.oldType)).length}`,s.Utils.getLogStyle(18,"black","green")),this.logger.custom(`${t.oldType} max items: ${Math.min(n,i.maxItems)} | potential spots: ${i.maxSpots}`,s.Utils.getLogStyle(16,"black","green"))})),e}scanForSticky(t){if(!s.Utils.isStickyActive())return[];if(this.isStickyApiIdsConfigured())return this.logger.info("Sticky spot in invalid because Sticky Api spot is already defined"),[];if(this.stickyFoundOnPage())return this.logger.info("Sticky spot in invalid because of publisher sticky ad"),[];let e=new w.StickySpot(this.getStickyCompatibleAdsSizes(),t);return r.EventsService.get().sendSpotFoundEvent(e),this.logger.info(`Found ${l.SpotType.STICKY} spot`),v.YieldClient.get().processSingleSpot(e),[e]}isAlreadyWrapped(t,e){return t.some((t=>t.wrappedElements.map((t=>t.el)).includes(e)))}stickyFoundOnPage(){return p.default.get().foundAds.some((t=>t.positionType.indexOf("sticky")>-1))}hasValidDynamicSizes(t){return t.filter((t=>!s.Utils.is1x1(t))).length>0}isSkippedElement(t){return this.profile.domData&&this.profile.domData.skippedElements.some((e=>s.Utils.isDescendantElement([e],t)&&f.SpotsUtils.isValidHeightForSkipSa(t)))?{status:"invalid",message:"skipped element"}:{status:"valid"}}isBrowsiStayAway(t,e,i,n){if(f.SpotsUtils.isFixedSpot(n.oldType))return{status:"valid"};if(this.hasFoundSpots(e)){const r=this.getSpotsByColumn(e,n.oldType).filter((t=>!s.Utils.isFixed(t.ref)));if(!r.length)return{status:"valid"};return r.some((e=>{if(e.ref===t)return{status:"invalid",message:"stay_away_from_browsi"};const r=s.Utils.calculateDistanceBetween(t,e.ref),o=s.Utils.getHighestElement(t,e.ref),h=t===o?i:e.compatibleSizes,a=s.Utils.getMaxWrapSize(h),d=s.Utils.getWrappingOffset(t,e.ref,n,a);return r+("INSIDE"===e.targetElementPosition||r<=0?0:o.getBoundingClientRect().height)+d<=f.SpotsUtils.getBrowsiAdsStayAwayDistance(n)}))?{status:"invalid",message:"stay_away_from_browsi"}:{status:"valid"}}return{status:"valid"}}isInsideSkippedRef(t,e){var i,s;if("INSIDE"===f.SpotsUtils.getTargetElementPosition(e)){const e=null===(s=null===(i=this.profile)||void 0===i?void 0:i.domData)||void 0===s?void 0:s.skippedElements;return e&&e.includes(t)?{status:"invalid",message:"skipped element"}:{status:"valid"}}return{status:"valid"}}getSpotsByColumn(t,e){let i=t.filter((t=>t.type===e));switch(e){case l.SpotType.DYNAMIC_LEFT_RAIL:i=i.concat(this.getSpotsByType(l.SpotType.FIXED_LEFT_RAIL));break;case l.SpotType.DYNAMIC_RIGHT_RAIL:i=i.concat(this.getSpotsByType(l.SpotType.FIXED_RIGHT_RAIL));break;case l.SpotType.DYNAMIC_MC:i=i.concat(this.getSpotsByType(l.SpotType.FIXED_MC))}return i}hasFoundSpots(t){return!!(t.length>0||this.getAvailableSpots().length>0)}isAboveStartInFold(t,e){let i=s.Utils.getElementFoldNumber(t);return e&&i0)if(e===Math.floor(e)){if(Math.floor(i)>e)return!0}else if(i>e)return!0;return!1}getNextParagraphsTotalHeight(t,e,i,n){let r=0,o=s.Utils.getMaxWrapSize(i),h=0;if(!o)return r;for(;t&&r0&&t.nextSibling&&(t=t.nextSibling)}switch(t.nodeName){case"BR":break;case"P":if(this.hasNonWrappingChildren(t))return r;s.Utils.isEmptyParagraph(t)?h+=t.getBoundingClientRect().height:(r+=t.getBoundingClientRect().height+h,h=0);break;case"#text":t.nodeValue&&t.nodeValue.length>1?(r+=s.Utils.calculateTextNodeHeight(t)+h,h=0):h+=s.Utils.calculateTextNodeHeight(t);break;default:if(e.includes(t.nodeName)&&!this.hasNonWrappingChildren(t)){r+=t.getBoundingClientRect().height+h,h=0;break}return r}const a=i.find((t=>t.h>=r))||o;n.push({el:t,minWrapSize:a}),t=t.nextSibling}return r}hasNonWrappingChildren(t){let e=t.querySelector("img, iframe");return!!e&&(this.logger.info(`stopping height calc because ${t.nodeName} element has special child: `,e),!0)}getCompatibleAdsSizes(t,e,i,n,r){const h=s.Utils.getExternalFlowHandler("compatibleAdSizes");if(h){const s=h(t,e,i,n,o.EmbedTypeMap);if(s)return s}let a=[];if(!this.profile.domData&&!r)return a;const d=i===l.SpotType.DYNAMIC_MC&&this.isAfterOneLine(t),c=t.getBoundingClientRect().height;for(let s of n){const n=i===l.SpotType.DYNAMIC_MC?s.optionalEmbeddings.indexOf("wrapped"):-1;if(n>-1?this.isSizeValidForWrapping(e,c,s)||(this.logger.debug(`${s} is invalid for wrap. height ${c}, available${e}`),s.optionalEmbeddings.splice(n,1)):(f.SpotsUtils.isFixedSpot(i)||f.DYNAMIC_RAIL_TYPES.includes(i))&&(s.selectedEmbedding="break"),d){const e=s.optionalEmbeddings.indexOf("break");e>-1&&(s.optionalEmbeddings.splice(e,1),this.logger.debug(t,"is after one liner, only wrap allowed"))}s.optionalEmbeddings.length&&a.push(s)}return a}getStickyCompatibleAdsSizes(){var t;const e=(null===(t=f.SpotsUtils.getConf(l.SPOT_TAGS_MAP[l.SpotType.STICKY]))||void 0===t?void 0:t.allowedCreativeSizes)||[],i=[];for(let t of e)if(s.Utils.isValidStickySize(t)){let e={w:t.w,h:t.h,selectedEmbedding:"break",optionalEmbeddings:[],adSizeType:"wide",minSizeForWrapping:-1};i.push(e)}return i}isSizeValidForWrapping(t,e,i){return e>=i.minSizeForWrapping&&t>0||t>=i.minSizeForWrapping}buildSpotEngineTest(){if(this.lastScannedElement&&this.firstScannedElement){const t=s.Utils.getElementFoldNumber(this.lastScannedElement),e=s.Utils.getElementFoldNumber(this.firstScannedElement);this.profile.spotEngineTest={firstElementFold:e,lastElementFold:t,spots:this.mapSpotEngineTestSpots(this.availableSpots)}}else this.profile.spotEngineTest={spots:this.mapSpotEngineTestSpots(this.availableSpots)}}mapSpotEngineTestSpots(t){let e=[];return t.forEach((t=>e[t.adIndex]=t.serialize())),e}validateSpot(t,e,i,s,n){const r=!this.shouldIgnoreStartInFold(s.oldType)&&this.isAboveStartInFold(t,e).message||this.endlessRailsInvalid(t,s.oldType).message||(i?this.isInsideSkippedRef(t,s).message:this.isSkippedElement(t).message||this.isEmptyParagraph(t).message||(f.SpotsUtils.isRailSpot(s.oldType)?null:this.isElementWithFloatSibling(t).message||this.isBetweenTitleAndContent(t).message)),o=r?{status:"invalid",message:r}:{status:"valid"};return"invalid"===o.status&&this.logger.debug(`invalid spot [${o.message}]:`,t),o}endlessRailsInvalid(t,e){return this.endlessRails.top&&f.SpotsUtils.getRailsTypes().includes(e)&&s.Utils.getElementCoordinates(t).topn.w&&(i=!0)}return i}validateStayAway(t,e,i,s,n){const r=d.default.instance.isStayAwayForAllEmbedTypes(t,i,s,n.oldType),o=("valid"===r.status?this.isBrowsiStayAway(t,e,i,n):null)||r;if("invalid"===o.status){const e=o.element?{element:t,stayAwayElement:r.element}:"";this.logger.debug(`invalid spot [${o.message}]`,e)}return o}isElementWithFloatSibling(t){return this.profile.domData&&this.profile.domData.foundFloatElements.includes(t)?{status:"invalid",message:"element with float sibling"}:{status:"valid"}}isBetweenTitleAndContent(t){return this.profile.spotEngineConfig.pageLayoutSA&&c.default.get().isBetweenTitleAndContent(t)?{status:"invalid",message:"element is between title and content"}:{status:"valid"}}isAfterOneLine(t){return!!this.profile.spotEngineConfig.pageLayoutSA&&c.default.get().isAfterOneLiner(t)}isStickyApiIdsConfigured(){const t=f.SpotsUtils.getConf({typeTag:m.TypeTag.API,positionTag:"s",oldType:l.SpotType.API});return!(!t||!t.positionIds)}getAvailableSpots(){return this.availableSpots.concat(this.firstScanSpots)}getApiSpots(){return this.apiSpots}getDcsSerializedSpot(t){return Object.assign(Object.assign({browsiAd:t.browsiAd,slot:t.slot},t.selectedSize?{selectedSize:t.selectedSize}:{}),{adIndex:t.adIndex,demandIndex:t.demandIndex,type:t.type,ref:t.ref,compatibleSizes:t.compatibleSizes,positionTypes:t.positionTypes,spotTags:t.tags})}handleSpotsFromPreviousPageview(){const t=u.DcsUtils.getWindowObject(),e=t&&t.spots;e&&e.length&&e.forEach((t=>{this.refreshSpotFromPreviousPv(t)}))}refreshSpotFromPreviousPv(t){this.generateSpotFromSerialized(t).refreshDcsSpotOnNewPv()}generateSpotFromSerialized(t){let e;if("s"===t.spotTags.positionTag)e=new w.StickySpot(t.compatibleSizes,!0);else if(t.spotTags.typeTag===m.TypeTag.FIXED){const i=this.getSelectorByElement(t.ref);e=new b.FixedSpot(t.ref,t.demandIndex,t.compatibleSizes,-1,t.type,!0,i)}else e=new g.DynamicSpot(t.ref,t.type,t.demandIndex,t.compatibleSizes,-1,!0);return e.isLazyLoading=!1,e=Object.assign(e,t),this.logger.info("Found "+e.type+" spot from previous page view: ",e),r.EventsService.get().sendSpotFoundEvent(e),this.availableSpots.push(e),this.spotsFromPreviousPageview.push(e),e}getRightRailsSpotsFound(){return this.getSpotsByType(l.SpotType.DYNAMIC_RIGHT_RAIL).concat(this.getSpotsByType(l.SpotType.FIXED_RIGHT_RAIL))}getLeftRailsSpotsFound(){return this.getSpotsByType(l.SpotType.DYNAMIC_LEFT_RAIL).concat(this.getSpotsByType(l.SpotType.FIXED_LEFT_RAIL))}getSpotsByType(t){return this.availableSpots.filter((e=>e.type===t)).concat(this.firstScanSpots.filter((e=>e.type===t)))}getFoundSpots(){return{fixedFirst:this.firstScanSpots,availableSpots:this.availableSpots}}isPositionInsideAndNotEmpty(t,e){if("INSIDE"===t.targetElementPosition){return Array.from(e.childNodes).filter((t=>this.isExpandableElement(t))).length>0}return!1}isExpandableElement(t){return s.Utils.isElement(t)&&!(t instanceof HTMLScriptElement)}getFixedElementsBySelector(t){this.fixedSelectorsToElementsMap=this.fixedSelectorsToElementsMap||{},t.forEach((t=>{this.fixedSelectorsToElementsMap[t]=s.Utils.querySelectorAll([t],(()=>{}))}))}getSelectorByElement(t){for(let e in this.fixedSelectorsToElementsMap){if(this.fixedSelectorsToElementsMap[e].some((e=>e===t)))return e}return""}}e.default=x},4029:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(125),n=i(7730),r=i(1993);class o{constructor(){this.logger=new s.Logger("activeViewViewability"),this.isActive=!!n.Profiler.get().siteInfo.activeView}static get(){return o.instance||(this.instance=new o),o.instance}waitForPublisherAV(t,e){if(!this.isActive)return;const i=e.refreshCount;window.googletag.pubads().addEventListener("impressionViewable",(s=>{s.slot==t&&i===e.refreshCount&&r.EventsService.get().sendViewedPublisherAdAV(e)}))}waitForBrowsiAV(t,e){if(!this.isActive)return;e.browsiAd.win.googletag.pubads().addEventListener("impressionViewable",(i=>{i.slot==t&&r.EventsService.get().sendViewedImpressionAV(e)}))}}e.default=o},2057:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(125),n=i(2727);class r{constructor(){this.logger=new s.Logger("BptBrowsiFunctions"),this.bptBrowsiFunctions=r.getBptBrowsiService()}static get(){return this._instance||(this._instance=new r),this._instance}static getBptBrowsiService(){const t=n.Utils.getBrowsiTag();return t&&"object"==typeof t.__bbs?t.__bbs:null}getFoundPublisherAdData(t,e,i,s){const n={plid:e};switch(t){case"dfp":case"header_bidding":if(s)return this.invokeBptFunction({p:"dfp",args:{slot:s,rc:i}})||n;break;case"manual_ad":return this.invokeBptFunction({p:"manual_ad",args:{plid:e,rc:i}})||n}return n}invokeBptFunction(t){if(this.bptBrowsiFunctions&&"function"==typeof this.bptBrowsiFunctions.g_fpa_d)try{let e=this.bptBrowsiFunctions.g_fpa_d(t);return e.praw=parseFloat(e.praw),this.logger.info("request: ",t," response: ",e),e}catch(e){this.logger.info("failed to get data from bpt",t)}return null}}e.default=r},3006:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ConsentLocation=e.ConsentType=void 0;const s=i(2727),n=i(7730);!function(t){t.GDPR="gdpr",t.CCPA="ccpa"}(e.ConsentType||(e.ConsentType={})),function(t){t.EUROPE="eu",t.USA="us",t.REST_OF_WORLD="row",t.NA="NA"}(e.ConsentLocation||(e.ConsentLocation={}));e.default=class{static get hasUserConsent(){return this.updateConsentStatus(),this.hasConsent}static get location(){return"string"!=typeof this._location&&null!==this._location&&(this._location=n.Profiler.get().userAnonymousContinent||null),this._location}static updateConsentStatus(){const t=this.getCurrentConsentType();this.hasConsent=!t||this.getConsentStatus(t)}static getConsentStatus(t){const e=s.Utils.getBrowsiTag();return e&&e.__cs&&"function"==typeof e.__cs[t]?e.__cs[t]():this.hasConsent}static get prebidConf(){let t=null;return"eu"===this.location?t={gdpr:{cmpApi:"iab",allowAuctionWithoutConsent:!0,timeout:1e3}}:"us"===this.location&&(t={usp:{cmpApi:"iab",timeout:1e3}}),t?{consentManagement:t}:null}static getCurrentConsentType(){if(this.location){if("eu"===this.location)return"gdpr";if("us"===this.location)return"ccpa"}return null}}},2763:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CustomRefreshRate=void 0;const s=i(125),n=i(7730),r=i(2727),o=i(1528),h=i(1993),a=i(4869);class d{constructor(){this.logger=new s.Logger("RefreshRate"),this.profile=n.Profiler.get()}static get(){return d.instance||(d.instance=new d),d.instance}runCustomRefreshHook(t){const e=r.Utils.getExternalFlowHandler("preCustomRefresh");if(e){const i=e(t);return i&&Array.isArray(i)&&i.length>0?i:(this.logger.debug("disabling refresh for this slots",t),[])}return t}sendCustomRefreshRate(t,e){const i=this.runCustomRefreshHook(e);if(i.length>0){let e="";if(t===o.DemandRequestType.SINGLE)if(i&&1===i.length){const t=i[0];e=this.buildRefreshRateSingleUrl(t)}else this.logger.error(`invalid slots params ${i}`);else i&&t===o.DemandRequestType.SRA&&(e=this.buildRefreshRateSRAUrl(i));e?this.refreshRateXhrRequest(e):this.logger.error("error building get custom refresh rate url")}}refreshRateXhrRequest(t){r.Utils.xhrPromise(t,"GET").then((e=>{if(200===e.status){const t=JSON.parse(e.responseText);Array.isArray(t)?t.map((t=>a.ViewabilityService.get().handleCustomRefreshResponse(t))):a.ViewabilityService.get().handleCustomRefreshResponse(t)}else h.EventsService.get().sendErrorEvent("xhr_promise_error",t,"get refresh rate failed"),this.logger.error(`Error on get refresh rate. url: ${t}`)})).catch((e=>{h.EventsService.get().sendErrorEvent("xhr_promise_error",t,(null==e?void 0:e.message)||"get refresh rate failed"),this.logger.error("error on xhr promise",e)}))}buildRefreshRateSingleUrl(t){let e=Object.assign(Object.assign(Object.assign(Object.assign({pk:this.profile.identity.publisherKey,sk:this.profile.identity.siteKey,t:r.Utils.o()},t.au?{au:t.au}:{}),t.id?{id:t.id}:{}),t.lid?{lid:t.lid}:{}),t.oid?{oid:t.oid}:{});return`//${this.profile.siteInfo.demandHost}/refreshrate/single/desktop?${r.Utils.toUrlParams(e)}`}buildRefreshRateSRAUrl(t){let e=Object.assign({pk:this.profile.identity.publisherKey,sk:this.profile.identity.siteKey,t:r.Utils.o()},this.buildRefreshRateSRAParams(t));return`//${this.profile.siteInfo.demandHost}/refreshrate/sra/desktop?${r.Utils.toUrlParams(e)}`}buildRefreshRateSRAParams(t){let e={};return t.map(((i,s)=>{const n=this.buildRefreshRateSRASpotParams(i);for(let i in n)e[i]=e[i]||[],e[i].push(n[i]),s+1===t.length&&(e[i]=e[i].join("||"))})),e}buildRefreshRateSRASpotParams(t){return Object.assign(Object.assign(Object.assign(Object.assign({},t.au?{au:t.au}:{}),t.id?{id:t.id}:{}),t.lid?{lid:t.lid}:{}),t.oid?{oid:t.oid}:{})}}e.CustomRefreshRate=d},3063:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DCS=void 0;const s=i(7730),n=i(125),r=i(2727),o=i(514),h=i(9790),a=i(8614),d=i(9235),l=i(6319),c=i(1993),u=i(2970),p=i(7631),v=i(1128),f=i(4869),m=i(2362),g=i(1031);e.DCS=class{constructor(t){this.dcsObj=l.DcsUtils.getWindowObject(),this.contextElement=top.document.body,this.steps=[],this.dataFromLastStep=null,this.observers=[],this.listeners=[],this.checkUrlInterval=0,this.timeoutBeforeNewRun=0,this.type=t,this.logger=new n.Logger("DCS_"+this.type),l.DcsUtils.dcsType=this.type,this.mutationConfig={childList:!0,subtree:!0},this.currentURL=window.location&&window.location.href.split("?")[0],this.dcsObj&&this.updateNewPv(this.dcsObj),this.logger.info(`Started ${this.type}`,this.dcsObj?"Object: "+this.dcsObj:"")}detectDcs(t,e=!1){let i;return i=e?Promise.race([this.checkUrl(),this.checkSteps(0,t)]):this.checkSteps(0,t),i.then((()=>{this.handleStepsEnded(this.dataFromLastStep)})).catch((t=>{this.clearDcsListeners(),this.logger.error(t)})),Promise.resolve()}detectUrlChangeOnly(){return this.checkUrl().then((()=>this.handleStepsEnded(this.dataFromLastStep)))}checkUrl(){return this.checkStep(-1,{type:"urlChange",value:""})}checkSteps(t,e,i){return e.length&&e[t]?this.checkStep(t,e[t],i).then((i=>this.checkSteps(++t,e,i))):Promise.resolve()}checkStep(t,e,i){if(this.logger.debug("checking step",t),"function"==typeof e){return e()?Promise.resolve():Promise.reject("step function failed")}return this.listenToEventOrMutation(e,i).then((t=>{if(t)return this.dataFromLastStep=t,t;this.logger.info("listenToEventOrMutation ended",t,this.dataFromLastStep)}))}listenToEventOrMutation(t,e){if(t.container)return this.watch(t);{const i=t;return i.elements=e?[e]:i.elements,this.waitForTrigger(i).then((t=>(this.logger.info("trigger caught",t),t)))}}watch(t){return this.logger.info(`watching for ${t.article} in ${t.container}`),new Promise(((e,i)=>{const s=[],n=this.getElement(t.container);if(!n)return i(`no elements found for selector: ${t.container}`);{const i=new MutationObserver((i=>{this.mutationHandler(i,t,s,e)}));this.observers.push(i),i.observe(n,this.mutationConfig)}}))}waitForTrigger(t){switch(this.logger.info(`waiting for trigger ${t.type} of ${t.value}`,t.elements),t.type){case"distance":return this.distanceTrigger(t);case"buttonClick":return t.value?this.buttonClickTrigger(t):Promise.reject("no selectors");case"urlChange":return this.urlChangeTrigger().then((t=>(this.logger.info("urlChanged",t),t)));default:return Promise.reject("no type")}}mutationHandler(t,e,i,s){t.forEach((t=>{for(let n=0;n{t.elements&&t.elements[0]?this.addListener("scroll",r.Utils.getScrollElement(),r.Utils.throttle((()=>this.distanceHandler(t,e)),500)):i()}))}distanceHandler(t,e){if(t.elements&&t.elements[0]){const i=t.elements[0],s=r.Utils.getPercentageInView(i);if(s>+t.value)return this.logger.info("element in view: ",s,i),e(i)}}buttonClickTrigger(t){return new Promise(((e,i)=>{const s=document.querySelectorAll(t.value);if(s.length)for(let t=0;t{e()}))}else i("no elements found for selector: "+t.value)}))}urlChangeTrigger(){return new Promise(((t,e)=>this.hasUrlChanged()?t():(this.addListener("hashchange",window,(()=>t)),this.addListener("popstate",window,(()=>t)),this.addListener("locationchange",window,(()=>t)),this.checkUrlInterval=window.setInterval((()=>{this.hasUrlChanged()&&(clearInterval(this.checkUrlInterval),t())}),1e3),this.hasUrlChanged()?t():void 0)))}setWindowObject(t,e){const i=this.createPvObject(t);let s=l.DcsUtils.getWindowObject()||this.createDcsObject();return s.count++,s.pvs.push(i),e&&Object.assign(s.ppv,{e}),s}createDcsObject(){const t={count:0,dcsType:this.type,pvs:[],ppv:{pv:s.Profiler.get().identity.pageviewId}};return window[l.DcsUtils.winObjName]=t,t}createPvObject(t){const e=p.PubAdsRefreshService.get();return{pv:void 0,e:t,data:Object.assign(Object.assign({},"end_less"===this.type||"slides"===this.type?{sAE:d.default.instance.getStayAwayElementsList().filter((e=>r.Utils.isPositionedAfter(e.element,t)))}:{}),{pad:e?e.pubAdsData:[]})}}updateNewPv(t){t.pvs[t.count-1].pv=s.Profiler.get().identity.pageviewId}handleStepsEnded(t){this.logger.info("handleStepsEnded"),this.dcsSuccessActions(t)}dcsSuccessActions(t){this.clearListeners(),this.timeoutBeforeNewRun?setTimeout((()=>{this.runNewPv()}),this.timeoutBeforeNewRun):this.runNewPv();const e=this.setWindowObject(t,this.firstArticle);this.keepSpotsReference(),this.sendDcsEvent(this.eventType,{ac:e.count,ppvid:e.ppv.pv})}runNewPv(){this.logger.info("runNewPv"),window.browsi_bootstrap_loaded=!1,window._middyo=null,this.logger.info("injecting bootstrap");const t=r.Utils.cloneAndEmbedBoostrap();t&&t.parentElement&&t.parentElement.removeChild(t)}clearListeners(){c.EventsService.get().flushEventsQue(),o.default.get().removeAll(),this.observers.forEach((t=>t.disconnect())),h.default.setInactive(),g.Engagement.get().unsubscribe(),a.Focus.get().unsubscribe(),clearInterval(this.checkUrlInterval),r.Utils.getLazySpotsInstance().stopService(!0);const t=p.PubAdsRefreshService.get();t&&t.deactivate()}sendDcsEvent(t,e){c.EventsService.get().sendDcs(t,e)}matches(t,e){return t.matches?t.matches(e):t.msMatchesSelector?t.msMatchesSelector(e):!t.webkitMatchesSelector||t.webkitMatchesSelector(e)}getElement(t){return this.contextElement.querySelector(t)}getElements(t){return Array.from(this.contextElement.querySelectorAll(t))}getPreviousElements(){const t=l.DcsUtils.getWindowObject();return t?t.pvs.map((t=>t.e)):null}hasUrlChanged(){const t=window.location&&window.location.href.split("?")[0];return!t||this.currentURL!==t}addListener(t,e,i){this.listeners.push({type:t,listenObj:e,callback:i}),o.default.get().listen(t,e,i)}clearDcsListeners(){this.listeners.forEach((t=>{o.default.get().removeListener(t.type,t.listenObj,t.callback)}))}setSpots(t){this.spots=t}RemoveBrowsiAdsFromDom(){let t=u.default.instance.getAvailableSpots();t=t.concat(u.default.instance.getApiSpots()),t.forEach(this.removeSpot.bind(this))}removeSpot(t){t.destroySlot()||this.logger.debug("could not destroy slot",t);const e=m.Embedder.removeAdFromDom(t);this.logger.debug("Spot removed from DOM",e,t)}keepSpotsReference(){const t=l.DcsUtils.getWindowObject();if(!t)return;const e=u.default.instance.getSpotsByType(v.SpotType.STICKY),i=u.default.instance.getLeftRailsSpotsFound().concat(u.default.instance.getRightRailsSpotsFound()).filter((t=>{if(t.browsiAd&&t.browsiAd.wrapper){const e=t.browsiAd.wrapper;return f.ViewabilityService.get().inViewPercentage({getCoords:()=>r.Utils.getElementPosition(e),getHeight:()=>r.Utils.getElementSize(e).h})>=100}return!1})),s=e.concat(i);if(s.length&&t){let e=[];s.forEach((t=>{e.push(u.default.instance.getDcsSerializedSpot(t))})),t.spots=e}}}},4941:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DcsApi=void 0;const s=i(7730),n=i(2970),r=i(125),o=i(2362),h=i(1993),a=i(514),d=i(9790),l=i(8614),c=i(5310),u=i(7631),p=i(2727),v=i(4869),f=i(6319),m="browsiDcs";e.DcsApi=class{constructor(t,e){this.logger=new r.Logger("dcsAPI"),this.logger.info("started"),this.injectScriptAndDispatchEvent(e,t)}injectScriptAndDispatchEvent(t,e){this.injectDcsScript(t,(()=>{this.logger.info("event fired"),window.dispatchEvent(new CustomEvent("dcsAPI",{detail:this.api(e)}))}))}api(t){return{getSpotsMap:()=>{const t=this.mapSpots();return this.logger.debug("getSpotsMap "+this.getPv(),t),t},removeSpots:t=>{const e=t.map(this.removeSpot.bind(this)).every(Boolean);return this.logger.debug("removeSpots "+this.getPv(),e),e},refreshSpots:t=>{const e=this.refreshSpot(t);return this.logger.debug("refreshedSpots "+this.getPv(),e),e},injectEngine:()=>(this.logger.debug("InjectEngine "+this.getPv()),this.runNewPv()),rebuildProfile:e=>(p.Utils.mergeDeep(t,e),this.logger.debug("rebuildProfile "+this.getPv(),e,t),s.Profiler.rebuild(t),t),getSaObjects:t=>f.DcsUtils.getSaObjects(t),clearListeners:()=>this.clearListeners(),reportError(t){h.EventsService.get().sendErrorEvent("crash",t.filename,t.message)},getPossibleSpots:t=>n.default.instance.scanDynamicSpots(!0,t).map((t=>t.ref)),pageViewId:s.Profiler.get().identity.pageviewId}}injectDcsScript(t,e){if(!window.document.querySelector("#browsiDcs")){this.logger.info("Injecting Browsi Dcs Script");const i=window.document.createElement("script");return i.async=!0,i.setAttribute("crossorigin","anonymous"),i.setAttribute("src",t),i.id=m,i.onload=e,i.addEventListener("error",(()=>{h.EventsService.get().sendErrorEvent("script_load_error",t,"DcsScript")})),window.document.head.appendChild(i),i}e()}getPv(){return s.Profiler.get().identity.pageviewId}getSpots(){const t=n.default.instance.getApiSpots();return n.default.instance.getAvailableSpots().concat(t)}mapSpots(){const t=this.getSpots(),e={};return t.forEach((t=>{const i=n.default.instance.getDcsSerializedSpot(t),s=e[t.tags.positionTag];s?s.push(i):e[t.tags.positionTag]=[i]})),e}removeSpot(t){const e=this.getSpots().find((e=>e.ref===t.ref));e&&(e.destroySlot(),v.ViewabilityService.get().unsubscribe(e));const i=o.Embedder.removeAdFromDom(t);return this.logger.debug(`Spot ${i?"":"not"} removed from DOM`,t),i}refreshSpot(t){const e=t.map(n.default.instance.generateSpotFromSerialized);return e.forEach((t=>t.refreshDcsSpotOnNewPv())),e}clearListeners(){a.default.get().removeAll(),d.default.setInactive(),l.Focus.get().unsubscribe(),c.default.get().stopService(!0);const t=u.PubAdsRefreshService.get();t&&t.deactivate()}runNewPv(){this.logger.info("runNewPv"),window.browsi_bootstrap_loaded=!1,window._middyo=null,this.logger.info("injecting bootstrap");const t=p.Utils.cloneAndEmbedBoostrap();t&&t.parentElement&&t.parentElement.removeChild(t),this.sendDcsEvent()}sendDcsEvent(t){h.EventsService.get().sendDcs("dcs_script",t)}}},2713:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DcsEndless=void 0;const s=i(3063),n=i(6319);class r extends s.DCS{constructor(t,e){super("end_less"),this.eventType="dcs_endlessScroll",this.checkUrlChanges=!1,this.steps=t,this.checkUrlChanges=e.urlChange||this.checkUrlChanges,this.timeoutBeforeNewRun=e.delay}prepareAndRunDcs(){const t=this.steps[0],e=this.steps[1];let i=this.findUnhandledArticles(t);return i.shift(),i.forEach((t=>{this.logger.info("Handling unhandled",t);const i=Object.assign(e,{elements:[t]});this.checkStep(-1,i).then((()=>(this.logger.info("Unhandled element reached distance",i),this.handleStepsEnded(t))))})),this.detectDcs(this.steps,this.checkUrlChanges),Promise.resolve()}findUnhandledArticles(t){const e=n.DcsUtils.getHandledArticles(this.dcsObj),i=[];return Array.from(document.querySelectorAll(t.container)).forEach((s=>{const n=Array.from(s.querySelectorAll(t.article));i.push(...n.filter((t=>!e.includes(t))))})),i}}e.DcsEndless=r},7247:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DcsFactory=void 0;const s=i(2713),n=i(4824),r=i(6504),o=i(7286);e.DcsFactory=class{static buildDcs(t){const e=t.spotEngineConfig.dcs;if(e&&e.steps)switch(e.type){case"read_more":return this.buildReadMore(e);case"end_less":return this.buildEndless(e);case"gallery":return this.buildGallery(e);case"spa":return this.buildSpa(e);default:return}}static buildEndless(t){const e=t.steps[0],i=t.steps.find((t=>"distance"===t.type)),n=t.steps.find((t=>"url"===t.type));if(e&&e.elementSelector&&e.containerSelector&&i&&i.value){let r=[{article:e.elementSelector.join(","),container:e.containerSelector.join(",")},{type:"distance",value:i.value}];if(n&&"true"===n.value){const t={type:"urlChange",value:""};r.push(t)}return new s.DcsEndless(r,t)}}static buildReadMore(t){if(1===t.steps.length){let e=t.steps[0].elementSelector;if(e)return new n.DcsReadMore(e)}}static buildGallery(t){const e=t.steps.find((t=>"button"===t.type)),i=t.steps.find((t=>"selector"===t.type)),s=t.steps.find((t=>"url"===t.type));if(e&&e.elementSelector){const n=[{type:"buttonClick",value:e.elementSelector.join(",")}];if(s&&s.value){const t={type:"urlChange",value:""};n.push(t)}return new r.DcsGallery(n,i&&i.elementSelector||[],t)}}static buildSpa(t){const e=t.steps[0],i=t.steps.find((t=>"url"===t.type));if(e&&e.elementSelector&&e.containerSelector){const s=[{article:e.elementSelector.join(","),container:e.containerSelector.join(",")}];if(i&&i.value){const t={type:"urlChange",value:""};s.push(t)}return new o.DcsSpa(s,t)}}}},6504:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DcsGallery=void 0;const s=i(3063);class n extends s.DCS{constructor(t,e,i){super("gallery"),this.eventType="dcs_gallery",this.checkUrlChanges=!1,this.articleSelectors=[],this.steps=t,this.articleSelectors=e||[],this.checkUrlChanges=i.urlChange||this.checkUrlChanges,this.timeoutBeforeNewRun=i.delay}prepareAndRunDcs(){return this.dcsObj||(this.firstArticle=this.getArticleElement()),this.detectDcs(this.steps,this.checkUrlChanges)}handleStepsEnded(t){this.logger.info("handleStepsEnded");const e=this.getArticleElement()||t;this.RemoveBrowsiAdsFromDom(),this.dcsSuccessActions(e)}getArticleElement(){if(this.articleSelectors.length){const t=this.getElement(this.articleSelectors.join(","));if(t)return t}}}e.DcsGallery=n},4824:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DcsReadMore=void 0;const s=i(3063),n=i(2727),r=i(514),o=i(1993),h=i(6319),a=i(2970),d=i(1128),l=i(3034);class c extends s.DCS{constructor(t){super("read_more"),this.eventType="dcs_readMore",this.checkUrlChanges=!1,this.mutationConfig={},this.clickDetected=!1,this.selectors=t,this.elements=[]}prepareAndRunDcs(){return a.default.instance.scanBeforeDcs(),this.elements=n.Utils.querySelectorAll(this.selectors,(()=>{})),this.elements.length?(h.DcsUtils.isDcs=!0,o.EventsService.get().sendPageviewEvent(),this.buttonClickTrigger().then((()=>(this.handleStepsEnded(),this.onSpotEngineComplete.bind(this))))):Promise.reject(`no elements found for selector: ${this.selectors}`)}buttonClickTrigger(){return new Promise((t=>{const e=()=>{this.clickDetected||(this.clickDetected=!0,this.elements.forEach((t=>{r.default.get().removeListener("click",t,e)})),setTimeout((()=>{l.SpotsUtils.updateMCSpotsElements(),t()}),1e3))};this.elements.forEach((t=>{this.addListener("click",t,e)}))}))}handleStepsEnded(){this.logger.info("handleStepsEnded"),h.DcsUtils.isDcs=!0}onSpotEngineComplete(t){const e=t.getSpotsByType(d.SpotType.FIXED_BOTTOM).length+t.getSpotsByType(d.SpotType.FIXED_TOP).length,i={sf:t.getSpotsByType(d.SpotType.DYNAMIC_MC).length,fsf:t.getSpotsByType(d.SpotType.FIXED_MC).length,rrsf:t.getRightRailsSpotsFound().length,lrsf:t.getLeftRailsSpotsFound().length,ftbsf:e};this.sendDcsEvent(this.eventType,i)}}e.DcsReadMore=c},7286:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DcsSpa=void 0;const s=i(3063);class n extends s.DCS{constructor(t,e){super("spa"),this.eventType="dcs_spa",this.checkUrlChanges=!1,this.steps=t,this.checkUrlChanges=e.urlChange||this.checkUrlChanges,this.timeoutBeforeNewRun=e.delay}prepareAndRunDcs(){return this.detectDcs(this.steps,this.checkUrlChanges)}handleStepsEnded(t){this.logger.info("handleStepsEnded"),this.RemoveBrowsiAdsFromDom(),this.dcsSuccessActions(t)}}e.DcsSpa=n},6319:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DcsUtils=void 0;const s=i(7730),n=i(9235),r=i(2727);let o=(()=>{class t{static get dcsElement(){return t.getCurrentDcsElement()}static getWindowObject(){return window[this.winObjName]}static getDcsType(){if(s.Profiler.get().dcsState)return"script";const t=this.getWindowObject();return t&&t.dcsType}static getIfEndless(){return"end_less"===this.getDcsType()?this.getWindowObject():void 0}static getCurrentPvsObject(){const t=this.getWindowObject();return t&&t.pvs[t.count-1]}static getCurrentDcsElement(){var t;const e=null===(t=s.Profiler.get().dcsState)||void 0===t?void 0:t.mainContentElement;if(e)return e;{const t=this.getDcsActionCounter(),e=this.getWindowObject();return e&&e[t]?e.pvs[t].e:null}}static getDcsActionCounter(){var t;const e=null===(t=s.Profiler.get().dcsState)||void 0===t?void 0:t.count,i=this.getWindowObject(),n=e||(i?i.count:null);return n&&n>0?n:0}static getHandledArticles(t){let e=[];return t&&(t.ppv.e&&e.push(t.ppv.e),t.pvs.forEach((t=>{e.push(t.e)}))),e}static getDemandDcsSuffix(){const t=this.getDcsActionCounter();return t?"_d_"+t:""}static getSaObjects(t){return n.default.instance.getStayAwayElementsList().filter((e=>r.Utils.isPositionedBefore(t,e.element)))}}return t.winObjName="__dcs",t.isDcs=!!t.getWindowObject(),t})();e.DcsUtils=o},8712:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DemandManager=void 0;const s=i(125),n=i(5879),r=i(7730),o=i(1993),h=i(1128),a=i(9235),d=i(2727),l=i(2362),c=i(8033),u=i(6258),p=i(6393),v=i(4949),f=i(3034),m=i(4569),g=i(5857),b=i(9394);class w{constructor(){this.logger=new s.Logger("DemandManager"),this.profile=r.Profiler.get()}static get(){return w.instance||(w.instance=new w),w.instance}processResponse(t,e,i){switch(e.rt){case"provider":case"empty_api":const s=e;this.logger.info(`getDemand returned [${s.c.p}] for spot ${t.adIndex}, attempt ${t.attemptIndex}`,e),t.adUnit="generic_js"===s.c.p?"NA":s.c.aup;break;case"header_bidding":const r=e;this.logger.info(`getDemand returned [${r.c.b}] for spot ${t.adIndex}, attempt ${t.attemptIndex}`,e),t.adUnit="NA";break;case"SRA":if(this.sraManager)0===i.indexOf(t)&&this.sraManager.updateResponse(e);else{const t=e;this.sraManager=new n.SRAResponseManager(t,i)}}t.isLazyLoading&&!t.isRefreshing()?d.Utils.getLazySpotsInstance().subscribe(t,(()=>this.matchResponse(e,t))):this.matchResponse(e,t)}matchResponse(t,e){var i;const s=w.isSRAResponse(t)&&this.sraManager?this.sraManager.peek(e):t;if(s){e.demandCompatibleSizes=e instanceof m.ApiSpot&&(null===(i=e.options)||void 0===i?void 0:i.sizes)||this.getDemandCompatibleSizes(e,s),e.setPlaceholderSize(e.demandCompatibleSizes);const n=this.checkSpotViolations(e,s);if(n.length)this.handleAdRequestBlock(e,n);else{const i=w.isSRAResponse(t)&&this.sraManager?this.sraManager.pop(e,s):s;if(i){if("empty"===i.rt)return this.logger.info(`getDemand returned empty, waterfall ended for spot ${e.adIndex}`),void e.closePlaceholderAndRemove();this.processMatchedResponse(i,e)}}}else this.logger.info(`failed matching candidate response for spot ${e.adIndex}. response: ${t}`)}processMatchedResponse(t,e){e.isSaas=d.Utils.isSaas(t),e.isAutoSize=this.isAutoSizeResponse(t,e);const i=this.getSRADelayConfig(this.isInIframe(t));Promise.race([this.delayTogglePromise(i.shouldDelay),this.delayTimeoutPromise(i.delayTime),this.waitForPubAdRequestPromise()]).then((()=>{this.fetch(t,e)}))}delayTogglePromise(t){return new Promise((e=>{t||e()}))}waitForPubAdRequestPromise(){return new Promise((t=>{b.default.get().waitForFirstAdRequest().then((()=>{t()}))}))}delayTimeoutPromise(t){return new Promise((e=>{setTimeout((()=>{e()}),t)}))}isInIframe(t){if("header_bidding"===t.rt)return t.c.if;if("provider"===t.rt){const e=t;if("generic_js"===e.c.p||"dfp"===e.c.p)return"true"===e.c.a.inIFrame}return!1}getSRADelayConfig(t){var e,i;const s=r.Profiler.get().siteInfo.waitForAdRequest,n=(null===(i=null===(e=googletag.pubads)||void 0===e?void 0:e.call(googletag).getSlots())||void 0===i?void 0:i.length)||0;return{shouldDelay:!(!s||t||!n),delayTime:s||0}}getDemandCompatibleSizes(t,e){return t.compatibleSizes.filter((t=>e.szs.some((e=>e.w===t.w&&e.h===t.h))))}fetch(t,e){const i=g.InframeManager.get(),s=i.shouldFetchDynamicVideo(e.isRefreshing(),e.type)&&i.hasVideoDemand(e),n=u.ProviderFactory.getProvider(s?{rt:"inframe",plk:t.plk}:t,e),o=c.EmbeddingFactory.getEmbedder(t,e);n&&o?(t=e.prepareResponseForFetch(t),this.runPreFetch(e,t,n).then((()=>(e.updateRefreshDetails(t),n.fetch(t,o)))).then((i=>{var s;if(d.Utils.isBrowsiLoggerActive()){const t=this.buildLoggerData(e,i);window.dispatchEvent(new CustomEvent("fetch_end",{detail:t}))}switch(this.logger.logWaterfallDetails(e,t,i.status),i.status){case"failure":case"timeout":case"not_supported":case"generic_snippet_error":e.destroySlot(),e.isRefreshing()&&l.Embedder.removeAdFromDom(e),e.updateBrowsiAdWrapper(),p.YieldClient.get().nextWaterfallStep(e),(null===(s=e.refresh)||void 0===s?void 0:s.noDemandRefresh)?e.subscribeToViewabilityService(i.status):e.stopRefreshing();break;case"success":if(this.logger.info("SUCCESS"),"dfp"!==n.providerName){new v.default(e,e.adUnit||"").waitForSpotMeasurable()}e.type===h.SpotType.API&&d.Utils.dispatchDOMEvent("browsiAdImpression",e.ref),this.shouldInjectMoat(r.Profiler.get().layouts.moatPercentage)&&l.Embedder.injectMoat(e),e.unsetRefDisplay(),this.runPostFetch(e,t)}})).catch((t=>{this.logger.info(`Failed fetching ${e.type} spot ${e.typeIndex}:`,t);const i=[{reason:"pre_fetch_async",message:t}];this.handleAdRequestBlock(e,i)}))):p.YieldClient.get().nextWaterfallStep(e)}shouldInjectMoat(t){return Math.floor(100*Math.random())t.reason)).join(",")}`),o.EventsService.get().sendAdBlockedEvent(t,e)),null===(i=t.placeholder)||void 0===i||i.closePlaceholder(!1,t)}checkSpotViolations(t,e){const i=[],s=t.optimizeViewability&&this.checkViewabilityThreshold(t.tags,e);s&&i.push(s);const n=this.checkCLSViolation(t);if(n&&i.push(n),t.type===h.SpotType.API)return i;if(this.checkDemandSizeViolation(t)&&i.push({reason:"no_compatible_demand_sizes"}),[h.SpotType.DYNAMIC_MC,...f.DYNAMIC_RAIL_TYPES].includes(t.type)&&!t.isRefreshing()){const e=a.default.instance.checkStayAwayViolation(t);e&&i.push(e)}return this.isSpotNotExist(t)&&i.push({reason:"spot_not_exists"}),t.type===h.SpotType.STICKY&&(t.getCompatibleSizes().length||i.push({reason:"no_compatible_sizes"})),i}isSpotNotExist(t){var e;if(t instanceof m.ApiSpot&&(null===(e=t.options)||void 0===e?void 0:e.shadowElement)){const e=t.options.shadowElement,i=d.Utils.getShadowRoot(e);return!i||d.Utils.isPositionedDisconnected(e,i)}return d.Utils.isPositionedDisconnected(t.ref,document.body)}checkViewabilityThreshold(t,e){var i,s;const n=f.SpotsUtils.getViewabilityThreshold(t);if(n){const t=(null===(s=null===(i=null==e?void 0:e.od)||void 0===i?void 0:i[50])||void 0===s?void 0:s.p)&&Number(e.od[50].p);if(t&&t>0&&t(e=d.Utils.convertToOldStyleAdUnit(e),n?void n(t,i,e,s,o):(r&&r(t,i,e),s())))).then((()=>{e=o?d.Utils.convertToNewStyleAdUnit(e,o):e}))}return Promise.resolve()}runPostFetch(t,e){var i;const s=d.Utils.getExternalFlowHandler("postFetch");if(s){const n=null===(i=d.Utils.getDemandConfig(e))||void 0===i?void 0:i.aup;s(t,e=d.Utils.convertToOldStyleAdUnit(e)),e=n?d.Utils.convertToNewStyleAdUnit(e,n):e}}isAutoSizeResponse(t,e){if(e.type===h.SpotType.STICKY)return!1;const i=t.c.d||t.c,s=i.a&&i.a.autoSize||g.InframeManager.get().isProviderInframe(e);return!!s&&"true"===s}buildLoggerData(t,e){var i,s,n,r;const o=d.Utils.getGAMResponseInfo(t.slot);let h=(null===(i=t.slot)||void 0===i?void 0:i.getSizes())||[];const a=null==h?void 0:h.map((t=>{if("string"==typeof t)return t;const e=Object.keys(t);return{w:+t[e[0]],h:+t[e[1]]}}));return Object.assign(Object.assign({demandType:t.providerName,placement:null===(s=t.browsiAd)||void 0===s?void 0:s.container,adUnit:null===(n=t.slot)||void 0===n?void 0:n.getAdUnitPath(),requestedSizes:a,targeting:(null===(r=t.slot)||void 0===r?void 0:r.getTargetingMap())||{},responseSize:t.selectedSize||null,refreshCount:t.refresh.count,orderId:(null==o?void 0:o.oid)||null,lineItemId:(null==o?void 0:o.lid)||null},"dfp"===t.providerName||"generic_js"===t.providerName?{}:{winner:"success"===e.status?"GAM":"NONE"}),"success"!==e.status?{noFill:!0}:{})}}e.DemandManager=w},9790:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(125),n=i(2727),r=i(9394),o=i(7730),h=i(2247),a=i(7631);class d{constructor(){this.logger=new s.Logger("Dfp Detector"),this.googletag=window.googletag||{},this.googletag.cmd=this.googletag.cmd||[],this.isActive=!1,o.Profiler.get().siteInfo.waitForAdRequest&&this.listenToSlotRequested()}static get instance(){return this._instance||(this._instance=new d),this._instance}static start(){if(this.instance.isActive)return this.instance.logger.info("already started");this.instance.logger.info("starting"),this.instance.run()}static setInactive(){this.instance.isActive=!1}run(){this.isActive=!0,this.listenToLazyAds(),this.checkFetchedSlots()}checkFetchedSlots(){this.logger.debug("checkFetchedSlots"),this.checkCurrentSlots(),setTimeout((()=>this.checkCurrentSlots()),1e3)}checkCurrentSlots(){this.logger.debug("checking current slots"),this.googletag.cmd.push((()=>{this.googletag.pubads().getSlots().forEach((t=>{const e=document.getElementById(t.getSlotElementId());if(e){let i=this.resolveInnerMostSingleChild(e),s=n.Utils.getElementSize(i);const o=n.Utils.getDfpAdSize(e);if(o&&(s=o.size,i=o.element),this.validationPassed(e,t)&&t.getResponseInformation())if(this.isRendered(i,s)){const i=this.buildFoundProvider(e,t,!1);r.default.get().addFoundProvider(i,t,s)}else this.handleThirdPartySlowAdRendering(e,t,!1)}}))}))}getProviderType(t){const e=t.getTargetingKeys();return-1!=e.indexOf("hb_pb")&&-1!=e.indexOf("hb_size")?"header_bidding":"dfp"}isRendered(t,e){return n.Utils.isVisible(t)&&h.DFP.isValidSize(e)}listenToSlotRequested(){googletag.pubads().addEventListener("slotRequested",(()=>{r.default.get().onDfpSlotReady()}))}listenToLazyAds(){const t=a.PubAdsRefreshService.get();this.googletag.cmd.push((()=>{this.googletag.pubads().addEventListener("slotRenderEnded",(e=>{const i=t&&t.handleRenderEnded(e);if(this.isActive&&!e.isEmpty){const t=document.getElementById(e.slot.getSlotElementId());if(t){const s=this.resolveInnerMostSingleChild(t),o=this.buildFoundProvider(t,e.slot,!0);this.validationPassed(t,e.slot)?this.isRendered(s,e.size)?r.default.get().addFoundProvider(o,e.slot,n.Utils.getDfpEventSize(e)):this.handleThirdPartySlowAdRendering(t,e.slot,!0):i?r.default.get().addFoundProvider(o,e.slot,n.Utils.getDfpEventSize(e),"browsi"):this.isForcedRefreshed(t,e.slot)&&r.default.get().addFoundProvider(o,e.slot,n.Utils.getDfpEventSize(e),"forced")}}}))}))}handleThirdPartySlowAdRendering(t,e,i){this.waitForDeflating(t).then((s=>{this.logger.debug("deflated to ",s,t);const n=this.buildFoundProvider(t,e,i);r.default.get().addFoundProvider(n,e,s)})).catch((e=>this.logger.debug("did not deflate",e,t)))}validationPassed(t,e){return!this.isBrowsiAd(e)&&!r.default.get().isDetectedAlready(t)&&(n.Utils.isInCurrentArticle(t)||n.Utils.isBetweenArticles(t)||n.Utils.isFixed(t))}isForcedRefreshed(t,e){return!this.isBrowsiAd(e)&&r.default.get().isDetectedAlready(t)&&(n.Utils.isInCurrentArticle(t)||n.Utils.isBetweenArticles(t)||n.Utils.isFixed(t))}isBrowsiAd(t){const e=t.getSlotElementId();return/^browsi_(ad.*)_ai_-?(\d+)_ati_(\d+).*$/.test(e)}resolveAdSize(t){let e,i=t;for(;1===(e=this.getNonScriptChildren(i)).length;)i=e[0];return n.Utils.getElementSize(i)}resolveInnerMostSingleChild(t){let e,i=t;for(;1===(e=this.getNonScriptChildren(i)).length;)i=e[0];return i}getNonScriptChildren(t){return Array.from(t.children).filter((t=>"SCRIPT"!==t.tagName))}waitForDeflating(t){return new Promise(((e,i)=>{let s=10;this.logger.debug("waiting for deflation",t);const n=setInterval((()=>{const r=this.resolveAdSize(t);h.DFP.isValidSize(r)&&(clearInterval(n),e(r)),s--||(clearInterval(n),i(r))}),500)}))}buildFoundProvider(t,e,i){return{element:t,providerName:this.getProviderType(e),placementId:e.getSlotElementId(),adUnit:e.getAdUnitPath(),isLazyLoaded:i,isManualAd:!1}}}e.default=d},1993:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EventsService=void 0;const s=i(7730),n=i(125),r=i(2727),o=i(6319),h=i(3034),a=i(1128),d=i(1031),l=i(8614);let c=(()=>{class t{constructor(){this.eventsQue={},this.browsiImpressionsCount=0,this.commonFields=this.buildCommonFields(),this.eventServerUrl=s.Profiler.get().yieldData.eventServerUrl,this.logger=new n.Logger("Events"),this.profile=s.Profiler.get(),this.sendEventsThrottle=r.Utils.throttle(this.flushEventsQue.bind(this),this.profile.siteInfo.bulkEventsThrottle||0,!1),this.isValidEventServerUrl=this.isValidURL(this.eventServerUrl),this.isValidEventServerUrl||this.logger.error("Invalid event server URL")}static get(){return t._instance||(this._instance=new t),t._instance}sendEngineLoadedEvent(){let t=s.Profiler.get();const e=this.getEngineLoadedEvent(t);this.addToEventsQue("supply",e.et,[e]),this.initBeaconFlushQue()}sendSpotFoundEvent(t){const e=this.getSpotFoundEvent(t);this.addToEventsQue("demand",e.et,[e])}sendPageviewEvent(t,e){this.profile.layouts.analysisMode||"pageview"===this.profile.siteInfo.billableEvents&&r.Utils.dispatchDOMEvent("browsi_pageview",{});const i=t&&t.length>0?{rsn:t.join(";")}:{},s=this.getPageviewEvent(i,e);this.addToEventsQue("supply",s.et,[s])}sendAdBlockerEvent(){const t=this.getAdBlockerEvent();this.addToEventsQue("supply",t.et,[t])}sendAdRequest(t,e,i,s,n,r){const o=this.getAdRequestEvent(t,e,i,s,n,r);this.addToEventsQue("demand",o.et,[o])}sendInframeAdRequest(t,e,i){const s=this.getInframeAdRequestEvent(t,e,i);this.addToEventsQue("demand",s.et,[s])}sendAdMatchedEvent(t,e,i,s,n,r,o){const h=this.getAdMatchedEvent(t,e,i,s,n,r,o);this.addToEventsQue("demand",h.et,[h])}sendInframeAdMatched(t,e,i,s,n){const r=this.getInframeAdMatchedEvent(t,e,i,s,n);this.addToEventsQue("demand",r.et,[r])}sendInframeHasDemandEvent(t,e,i){const s=this.getInframeHasDemandEvent(e,t,i);this.addToEventsQue("inframe","has_demand",[s])}sendAdImpression(t,e,i,s){var n;const o=r.Utils.getSpotCoords(t),h=(null===(n=t.refresh)||void 0===n?void 0:n.count)||0,a=this.getAdImpressionEvent(o,t,e,i,s);0==h&&this.browsiImpressionsCount++,this.addToEventsQue("demand",a.et,[a]),this.sendLoggerEvent(t)}sendInframeAdImpression(t,e,i,s){const n=r.Utils.getSpotCoords(t),o=this.getVideoAdImpressionEvent(n,t,e,i,s);this.addToEventsQue("demand",o.et,[o]),this.sendLoggerEvent(t)}sendViewedImpression(t,e,i){const s=r.Utils.getSpotCoords(t),n=this.getViewedImpressionEvent(s,t,e,i);this.addToEventsQue("demand",n.et,[n])}sendInframeViewedImpression(t,e,i){const s=r.Utils.getSpotCoords(t),n=this.getVideoViewedImpressionEvent(s,t,e,i);this.addToEventsQue("demand",n.et,[n])}sendViewedImpressionAV(t){const e=this.getViewedImpressionEventAV(t);this.addToEventsQue("demand",e.et,[e])}sendViewedPublisherAd(t,e){const i=this.getViewedPublisherAdEvent(t,e);this.addToEventsQue("demand",i.et,[i])}sendUserEngagementEvent(){const t=this.getUserEngagementEvent();this.addToEventsQue("supply",t.et,[t])}sendBidRequest(t,e){const i=this.getBidRequestEvent(t,e);this.addToEventsQue("hb",i.et,[i])}sendBidMatched(t,e){const i=this.getBidMatchedEvent(t,e);this.addToEventsQue("hb",i.et,[i])}sendAdBlockedEvent(t,e){t.adRequestBlockedSent=!0;const i=this.getAdBlockedEvent(t,e);this.addToEventsQue("demand",i.et,[i])}sendApiRequestBlockedEvent(t,e,i){const s=this.getApiBlockEvent(t,e,i);this.addToEventsQue("demand","api_request_blocked",[s])}sendPubAdRefreshBlockedEvent(t,e,i,s){const n=this.getRefreshBlockEvent(t,e,i,s);this.addToEventsQue("demand","parb",[n])}sendFocusChangedEvent(t,e){const i=this.getFocusChangedEvent(t,e);this.addToEventsQue("supply",i.et,[i])}sendPublisherAdFound(t,e){const i=this.getPublisherAdFoundEvent(t,e);this.addToEventsQue("demand",i.et,[i])}sendPubAdRefreshRequest(t,e,i){const s=this.getPubAdRefreshEvent(t,e,i);this.addToEventsQue("demand",s.et,[s])}sendAdInViewport(t,e){const i=this.getAdInViewportEvent(t,e);this.addToEventsQue("demand",i.et,[i])}sendDcs(t,e={}){const i=this.getDcsEvent(t,e);this.addToEventsQue("supply",t,[i])}sendAdMeasurableEvent(t,e,i){const s=this.getAdMeasurableEvent(t,e,i);this.addToEventsQue("demand",s.et,[s])}sendViewedPublisherAdAV(t){const e=this.getViewedPublisherAdAv(t);this.addToEventsQue("demand",e.et,[e])}sendStickyClosedEvent(t){const e=this.getStickyClosedEvent(t);this.addToEventsQue("demand","sticky_closed",[e])}sendErrorEvent(t,e,i,s){const n=this.getErrorEvent(t,i,e,s);this.sendError(t,n)}sendPlaceholderViewed(t){const e=this.getPlaceholderEvent(t,"placeholder_viewed");this.addToEventsQue("demand","placeholder_viewed",[e])}sendPlaceholderClosed(t,e){const i=this.getPlaceholderEvent(t,"placeholder_closed",e);this.addToEventsQue("demand","placeholder_closed",[i])}sendBillableEvent(t){const e=this.getBillableEvent(t);this.addToEventsQue("demand","billable_event",[e])}sendWebVitalsEvent(t){const{sk:e,pk:i,dp:s}=this.commonFields,{pv:n,fid:r,lcp:o,cls:h}=t;let a=Object.assign(Object.assign(Object.assign({},r?{fid:r}:{}),o?{lcp:o}:{}),h?{cls:h}:{}),d={now:Math.floor(Date.now()/1e3),sk:e,pk:i,dp:s,pvid:n};const l=Object.assign({events:[a]},d);this.sendBeacon("web_vitals",[l],!1,"web_vitals")||this.addToEventsQue("web_vitals","web_vitals",[l])}sendGeneralDataEvent(t,e){let i=Object.assign({now:Math.floor(Date.now()/1e3),et:"general_data",to:r.Utils.getTimeOffset(),gd:t});const s=Object.assign({events:[i]},this.commonFields);e&&e.forEach((t=>{delete s[t]}));this.sendBeacon("analytic",[s],!1,"general_data")||this.addToEventsQue("analytic","general_data",[s])}sendSummaryEvent(){const t=d.Engagement.get().getData();let e={et:"summary",to:r.Utils.getTimeOffset(),ads:this.browsiImpressionsCount,dep:t.max_depth_percentage,sl:t.screen_length,plt:t.page_load_time,top:t.time_on_page,v:t.velocity_including_static_time,vest:t.velocity_excluding_static_time,pl:r.Utils.getPageHeight()},i={now:Math.floor(Date.now()/1e3),bpvid:this.commonFields.bpvid,sk:this.commonFields.sk,pk:this.commonFields.pk,pvid:this.commonFields.pvid,dp:this.commonFields.dp,mv:this.commonFields.mv,geo:this.commonFields.geo,ts:this.commonFields.ts,db:this.commonFields.db,dos:this.commonFields.dos,d:this.commonFields.d,sid:this.profile.identity.sessionId,scid:this.profile.identity.supplyConfigId,url:this.commonFields.url};const s=Object.assign({events:[e]},i);this.sendBeacon("engagement",[s],!1,"summary")||this.addToEventsQue("engagement","summary",[s])}sendCustomRefreshRateEvent(t,e){let i=this.getCustomRefreshRateEvent(t,e);this.addToEventsQue("refresh","rule",[i])}getCustomRefreshRateEvent(t,e){return{et:"rule",now:Math.floor(Date.now()/1e3),at:t,rr:e}}getInframeCommonFields(){return{now:Math.floor(Date.now()/1e3),pk:this.commonFields.pk,sk:this.commonFields.sk,dp:this.commonFields.dp,db:this.commonFields.db,pvid:this.commonFields.pvid,geo:this.commonFields.geo,mv:this.commonFields.mv,d:this.commonFields.d,dos:this.profile.deviceDetails.os,scid:this.profile.identity.supplyConfigId,sid:this.profile.identity.sessionId}}getEngineLoadedEvent(t){return Object.assign({now:Math.floor(Date.now()/1e3),et:"engine_loaded",to:this.getTimeOffset()})}getSpotFoundEvent(t){return Object.assign(Object.assign({now:Math.floor(Date.now()/1e3),et:"spot_found",adix:t.adIndex,f:this.getFold(t),pt:t.positionTypeToString(),ot:t.offsetTop,to:this.getTimeOffset(),ill:t.isLazyLoading,st:t.type},this.getDcsEventData(t.isDcs)),this.getSpotTags(t))}static getFiredEvents(){return t.firedEvents}getPageviewEvent(t,e){var i,s,n,o,d;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),{now:Math.floor(Date.now()/1e3),et:"page_view",uid:r.Utils.getUserID(),sid:this.profile.identity.sessionId,pl:r.Utils.getPageHeight(),pw:r.Utils.getPageWidth(),to:this.getTimeOffset(),mcs:this.profile.domData?this.profile.domData.mainContent.start:-1,mcw:this.profile.domData?this.profile.domData.mainContent.width:-1,mch:r.Utils.getMainContentSize(this.profile.domData),sl:this.profile.deviceDetails.screenHeight,mi:(null===(i=h.SpotsUtils.getConf(a.SPOT_TAGS_MAP[a.SpotType.DYNAMIC_MC]))||void 0===i?void 0:i.maxItems)||0,fmi:(null===(s=h.SpotsUtils.getConf(a.SPOT_TAGS_MAP[a.SpotType.FIXED_MC]))||void 0===s?void 0:s.maxItems)||0,ftmi:(null===(n=h.SpotsUtils.getConf(a.SPOT_TAGS_MAP[a.SpotType.FIXED_TOP]))||void 0===n?void 0:n.maxItems)||0,fbmi:(null===(o=h.SpotsUtils.getConf(a.SPOT_TAGS_MAP[a.SpotType.FIXED_BOTTOM]))||void 0===o?void 0:o.maxItems)||0,rmi:(null===(d=this.profile.layouts.spots.rails)||void 0===d?void 0:d.maxItems)||0}),e?{ppvid:this.commonFields.pvid,pvid:e}:{}),this.profile.runMode?{mod:this.profile.runMode}:{}),this.getDcsEventData())}getAdBlockerEvent(){return Object.assign({now:Math.floor(Date.now()/1e3),et:"ad_blocker",to:this.getTimeOffset(),ex:s.Profiler.adBlockerExists})}getUserEngagementEvent(){return Object.assign({now:Math.floor(Date.now()/1e3),et:"user_engaged",to:this.getTimeOffset()})}getAdRequestEvent(t,e,i,s,n,o){var h;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({now:Math.floor(Date.now()/1e3),et:"ad_request",adix:t.adIndex,au:t.adUnit,atix:t.attemptIndex,pr:e,f:this.getFold(t),ot:r.Utils.getSpotCoords(t).top,ill:t.isLazyLoading,rc:t.refresh.count,to:this.getTimeOffset(),ul:r.Utils.getScrollPosition().top,st:t.type,pt:t.positionTypeToString(),di:t.demandIndex,s:this.getSizesByOrder(i),plk:s},t.type===a.SpotType.API?{plid:t.ref.id}:{}),t.type===a.SpotType.API&&(null===(h=t.options)||void 0===h?void 0:h.disableViewabilityOptimization)?{vod:!0}:{}),this.getDcsEventData(t.isDcs)),t.generalData?{gd:t.generalData}:{}),this.getSpotTags(t)),"number"==typeof n?{pi:n}:{}),o?{rsn:o}:{})}getSizesByOrder(t){return Array.isArray(t[0])?t.sort(((t,e)=>{if("fluid"===t[0])return-1;if("fluid"===e[0])return 1;try{const i=t[0],s=e[0];return i===s?t[1]-e[1]:i-s}catch(t){return-1}})).map((t=>"fluid"===t[0]?"fluid":t[0]+"x"+t[1])).join("|"):t.join("x")}getInframeAdRequestEvent(t,e,i){var s;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({now:Math.floor(Date.now()/1e3),et:"ad_request",adix:t.adIndex,pr:e,f:this.getFold(t),ot:r.Utils.getSpotCoords(t).top,ill:t.isLazyLoading,to:this.getTimeOffset(),ul:r.Utils.getScrollPosition().top,st:t.type,pt:t.positionTypeToString(),plk:i},t.type===a.SpotType.API?{plid:t.ref.id}:{}),t.type===a.SpotType.API&&(null===(s=t.options)||void 0===s?void 0:s.disableViewabilityOptimization)?{vod:!0}:{}),this.getDcsEventData(t.isDcs)),t.generalData?{gd:t.generalData}:{}),this.getSpotTags(t))}getAdBlockedEvent(t,e){return Object.assign(Object.assign(Object.assign({now:Math.floor(Date.now()/1e3),et:"ad_request_blocked",adix:t.adIndex,atix:t.attemptIndex,f:this.getFold(t),ot:r.Utils.getSpotCoords(t).top,ill:t.isLazyLoading,rc:t.refresh.count,to:this.getTimeOffset(),rsn:e.map((t=>t.reason)).join(","),msg:e.map((t=>t.message||"")).join(","),ul:r.Utils.getScrollPosition().top,st:t.type,pt:t.positionTypeToString()},this.getDcsEventData(t.isDcs)),t.generalData?{gd:t.generalData}:{}),this.getSpotTags(t))}getApiBlockEvent(t,e,i){return Object.assign({now:Math.floor(Date.now()/1e3),et:"api_request_blocked",rsn:t,msg:e,to:this.getTimeOffset(),plid:i})}getRefreshBlockEvent(t,e,i,s){return Object.assign({now:Math.floor(Date.now()/1e3),et:"parb",to:this.getTimeOffset(),rsn:s,plid:t,rc:e,pt:r.Utils.sortedString(i)},this.getDcsEventData())}getPublisherAdFoundEvent(t,e){return Object.assign(Object.assign(Object.assign(Object.assign({now:Math.floor(Date.now()/1e3),et:"found_publisher_ad",adix:-1,au:t.adUnit,f:t.foldNum,ot:r.Utils.getElementPosition(t.element).top,ol:r.Utils.getElementPosition(t.element).left,to:this.getTimeOffset(),pr:t.providerName,pt:r.Utils.sortedString(t.positionType),h:t.height,w:t.width,plid:t.placementId,ul:r.Utils.getScrollPosition().top,rc:t.refreshCount},e),this.getDcsEventData()),t.refreshType?{rt:t.refreshType}:{}),t.gamResponseInfo)}getPubAdRefreshEvent(t,e,i){return Object.assign({now:Math.floor(Date.now()/1e3),et:"pub_ad_refresh_request",adix:-1,au:t.adUnit,f:t.foldNum,ot:r.Utils.getElementPosition(t.element).top,ol:r.Utils.getElementPosition(t.element).left,to:this.getTimeOffset(),pr:t.providerName,pt:r.Utils.sortedString(t.positionType),h:t.height,w:t.width,plid:t.placementId,ul:r.Utils.getScrollPosition().top,rc:e},i?{rt:i}:{})}getViewedPublisherAdEvent(t,e){return Object.assign(Object.assign(Object.assign({now:Math.floor(Date.now()/1e3),et:"viewed_publisher_ad",adix:-1,au:t.adUnit,f:t.foldNum,ot:r.Utils.getElementPosition(t.element).top,ol:r.Utils.getElementPosition(t.element).left,ill:t.isLazyLoaded,to:this.getTimeOffset(),pr:t.providerName,pt:r.Utils.sortedString(t.positionType),h:t.height,w:t.width,plid:t.placementId,ul:r.Utils.getScrollPosition().top,c:1,tiv:-1,piv:e,rc:t.refreshCount},this.getDcsEventData()),t.refreshType?{rt:t.refreshType}:{}),t.gamResponseInfo)}getAdMatchedEvent(t,e,i,s,n,o,h){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},n?{rsn:n}:{}),{now:Math.floor(Date.now()/1e3),et:"ad_matched",adix:t.adIndex,au:t.adUnit,im:i,atix:t.attemptIndex,w:t.selectedSize?t.selectedSize.w:-1,h:t.selectedSize?t.selectedSize.h:-1,pr:e,emt:t.selectedSize&&t.selectedSize.selectedEmbedding?t.selectedSize.selectedEmbedding:"NA",ot:r.Utils.getSpotCoords(t).top,f:this.getFold(t),ill:t.isLazyLoading,rc:t.refresh.count,to:this.getTimeOffset(),st:t.type,pt:t.positionTypeToString(),di:t.demandIndex,ul:r.Utils.getScrollPosition().top,plk:s}),this.getDcsEventData(t.isDcs)),o?{hb:o}:{}),t.generalData?{gd:t.generalData}:{}),this.getSpotTags(t)),r.Utils.getGAMResponseInfo(t.slot,t)),h?{msg:h}:{})}getInframeAdMatchedEvent(t,e,i,s,n){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},n?{rsn:n}:{}),{now:Math.floor(Date.now()/1e3),et:"ad_matched",adix:t.adIndex,im:i,pr:e,emt:t.selectedSize&&t.selectedSize.selectedEmbedding?t.selectedSize.selectedEmbedding:"NA",ot:r.Utils.getSpotCoords(t).top,f:this.getFold(t),ill:t.isLazyLoading,to:this.getTimeOffset(),st:t.type,pt:t.positionTypeToString(),ul:r.Utils.getScrollPosition().top,plk:s}),this.getDcsEventData(t.isDcs)),t.generalData?{gd:t.generalData}:{}),this.getSpotTags(t)),r.Utils.getGAMResponseInfo(t.slot,t))}getAdImpressionEvent(t,e,i,s,n){var o;return Object.assign(Object.assign(Object.assign(Object.assign({now:Math.floor(Date.now()/1e3),et:"ad_impression",au:(null===(o=e.slot)||void 0===o?void 0:o.getAdUnitPath())||e.adUnit,h:e.browsiAd.h,w:e.browsiAd.w,adix:e.adIndex,emt:n,atix:e.attemptIndex,ol:t.left,ot:t.top,pr:i,f:this.getFold(e),ill:e.isLazyLoading,rc:e.refresh.count,to:this.getTimeOffset(),ul:r.Utils.getScrollPosition().top,st:e.type,pt:e.positionTypeToString(),di:e.demandIndex,plk:s},this.getDcsEventData(e.isDcs)),r.Utils.getGAMResponseInfo(e.slot,e)),e.generalData?{gd:e.generalData}:{}),this.getSpotTags(e))}getVideoAdImpressionEvent(t,e,i,s,n){return Object.assign(Object.assign(Object.assign({now:Math.floor(Date.now()/1e3),et:"ad_impression",h:e.browsiAd.h,w:e.browsiAd.w,adix:e.adIndex,emt:n,ol:t.left,ot:t.top,pr:i,f:this.getFold(e),ill:e.isLazyLoading,to:this.getTimeOffset(),ul:r.Utils.getScrollPosition().top,st:e.type,pt:e.positionTypeToString(),di:e.demandIndex,plk:s},this.getDcsEventData(e.isDcs)),e.generalData?{gd:e.generalData}:{}),this.getSpotTags(e))}getViewedImpressionEvent(t,e,i,s){return Object.assign(Object.assign(Object.assign(Object.assign({now:Math.floor(Date.now()/1e3),et:"viewed_impression",adix:e.adIndex,au:e.adUnit,h:e.browsiAd.h,w:e.browsiAd.w,emt:e.selectedSize&&e.selectedSize.selectedEmbedding?e.selectedSize.selectedEmbedding:"NA",ol:t.left,ot:t.top,atix:e.attemptIndex,c:1,pr:e.genericParams.displayName||e.providerName,f:this.getFold(e),to:this.getTimeOffset(),rc:e.refresh.impressionsEventCount,tiv:s,piv:i,ill:e.isLazyLoading,st:e.type,pt:e.positionTypeToString(),di:e.demandIndex},this.getDcsEventData()),e.generalData?{gd:e.generalData}:{}),this.getSpotTags(e)),r.Utils.getGAMResponseInfo(e.slot,e))}getVideoViewedImpressionEvent(t,e,i,s){return Object.assign(Object.assign(Object.assign({now:Math.floor(Date.now()/1e3),et:"viewed_impression",adix:e.adIndex,emt:e.selectedSize&&e.selectedSize.selectedEmbedding?e.selectedSize.selectedEmbedding:"NA",ol:t.left,ot:t.top,c:1,pr:e.providerName||"NA",f:this.getFold(e),to:this.getTimeOffset(),pw:r.Utils.getPageWidth(),tiv:s,piv:i,ill:e.isLazyLoading,st:e.type,pt:e.positionTypeToString()},this.getDcsEventData()),e.generalData?{gd:e.generalData}:{}),this.getSpotTags(e))}getBidRequestEvent(t,e){const i=r.Utils.getSpotCoords(t);return Object.assign({now:Math.floor(Date.now()/1e3),et:"bid_request",adix:t.adIndex,di:t.demandIndex,atix:t.attemptIndex,ot:i.top,rc:t.refresh.count,to:r.Utils.getTimeOffset(),st:t.type,b:e},this.getSpotTags(t))}getBidMatchedEvent(t,e){const i=r.Utils.getSpotCoords(t);return Object.assign({now:Math.floor(Date.now()/1e3),et:"bid_matched",adix:t.adIndex,di:t.demandIndex,atix:t.attemptIndex,ot:i.top,rc:t.refresh.count,to:r.Utils.getTimeOffset(),st:t.type,b:e},this.getSpotTags(t))}getFocusChangedEvent(t,e){return Object.assign({now:Math.floor(Date.now()/1e3),et:"focus_changed",if:t,to:this.getTimeOffset()},e&&{opl:!0})}getAdInViewportEvent(t,e){return{now:Math.floor(Date.now()/1e3),et:"ad_in_viewport",to:this.getTimeOffset(),rc:t.refresh.count,atix:t.attemptIndex,adix:t.adIndex,ivp:e.toFixed(2)}}getDcsEvent(t,e){var i,s;return Object.assign({now:Math.floor(Date.now()/1e3),et:t,to:this.getTimeOffset(),pl:r.Utils.getPageHeight(),mi:(null===(s=null===(i=this.profile.layouts.spots)||void 0===i?void 0:i.dynamic)||void 0===s?void 0:s.maxItems)||0},e)}sendHBWinner(t,e){const i=this.getHBWinnerEvent(t,e.bidder,e.cpm);this.addToEventsQue("hb","hbw",[i])}sendAPSWinner(t){const e=this.getHBWinnerEvent(t,"aps",-1);this.addToEventsQue("hb","hbw",[e])}getHBWinnerEvent(t,e,i){const s={n:e,s:[{br:i}]};return Object.assign({now:Math.floor(Date.now()/1e3),et:"hbw",to:r.Utils.getTimeOffset(),adix:t.adIndex,di:t.demandIndex,st:t.type,atix:t.attemptIndex,rc:t.refresh.count,b:[s]},this.getSpotTags(t))}getAdMeasurableEvent(t,e,i){return Object.assign(Object.assign({now:Math.floor(Date.now()/1e3),et:"measurable_impression",adix:t.adIndex,di:t.demandIndex,au:e||"NA",atix:t.attemptIndex,pr:t.genericParams.displayName||t.providerName||"NA",w:t.selectedSize?t.selectedSize.w:-1,h:t.selectedSize?t.selectedSize.h:-1,f:this.getFold(t),ot:r.Utils.getSpotCoords(t).top,pt:t.positionTypeToString(),ill:t.isLazyLoading,rc:t.refresh.count||0,to:r.Utils.getTimeOffset(),dcs:t.isDcs,ul:r.Utils.getPageYOffset(),st:t.type},i?{rsn:i}:{}),this.getSpotTags(t))}getStickyClosedEvent(t){return{now:Math.floor(Date.now()/1e3),et:"sticky_closed",adix:t.adIndex,di:t.demandIndex,pr:t.genericParams.displayName||t.providerName||"NA",w:t.selectedSize?t.selectedSize.w:-1,h:t.selectedSize?t.selectedSize.h:-1,ot:r.Utils.getSpotCoords(t).top,pt:t.positionTypeToString(),rc:t.refresh.impressionsEventCount||0,to:r.Utils.getTimeOffset(),ul:r.Utils.getPageYOffset()}}getInframePlacementEvent(t){return{now:Math.floor(Date.now()/1e3),pc:t,to:r.Utils.getTimeOffset(),et:"placements"}}getInframeHasDemandEvent(t,e,i){return{now:Math.floor(Date.now()/1e3),to:this.getTimeOffset(),st:e.type,adix:e.adIndex,et:"has_demand",im:t,ill:e.isLazyLoading,rsn:i}}sendError(t,e){this.profile.debugMode?this.logger.error(e):this.addToEventsQue("engineError",t,[e])}addToEventsQue(e,i,s){this.isValidEventServerUrl&&(this.shouldThrottleEvent(e)?(this.eventsQue[e]=this.eventsQue[e]||[],this.eventsQue[e].push(...s),this.sendEventsThrottle()):this.send(e,this.getBulkEventByTopic(e,s)),t.addToFiredEvents(e,s),this.logger.custom(`${e}/${i}`,"background: #AAFF7F; color: black; font-weight: bold; text-decoration:underline; font-size: 18px;",...s))}shouldThrottleEvent(t){return!!this.profile.siteInfo.bulkEventsThrottle&&!["engineError","supply"].includes(t)}flushEventsQue(t=!1){for(let e in this.eventsQue)if(this.eventsQue.hasOwnProperty(e)){if((this.eventsQue[e]||[]).length){let i=!0;t?i=this.sendBeacon(e,this.getBulkEventByTopic(e,this.eventsQue[e]||[]),!0):this.send(e,this.getBulkEventByTopic(e,this.eventsQue[e]||[])),i&&(this.eventsQue[e]=[])}}}getBulkEventByTopic(t,e){const i={events:e};if("hb"===t)return e.map((t=>Object.assign(Object.assign({},t),this.commonFields)));if("inframe"===t){const t=this.getInframeCommonFields();return[Object.assign(Object.assign({},i),t)]}if("demand"===t)return[Object.assign(Object.assign({},i),this.commonFields)];if("supply"===t){const t=Object.assign(Object.assign({},i),this.commonFields);return e[0].pvid&&(t.pvid=e[0].pvid,delete e[0].pvid),[t]}return"refresh"===t?[Object.assign(i,{pk:this.commonFields.pk})]:[i]}send(t,e){const i=new XMLHttpRequest;i.open("POST",`${this.eventServerUrl}v2/${t}?p=${this.commonFields.pvid}`,!0),i.send(JSON.stringify(e))}getBillableEvent(t){return{now:Math.floor(Date.now()/1e3),to:r.Utils.getTimeOffset(),et:"billable_event",pr:t.type}}initBeaconFlushQue(){l.Focus.get().subscribe((t=>{t&&this.flushEventsQue(!0)}))}static addToFiredEvents(e,i){t.firedEvents.has(e)||t.firedEvents.set(e,new Array);let s=t.firedEvents.get(e);s&&s.push(...i)}buildCommonFields(){let t=s.Profiler.get();return{sk:t.identity.siteKey,pk:t.identity.publisherKey,pvid:t.identity.pageviewId,geo:t.yieldData.countryCode,bpvid:t.identity.bootstrapPageviewId,url:t.identity.url,dos:t.deviceDetails.os,dosv:t.deviceDetails.osVersion,dv:t.deviceDetails.deviceVendor,dbt:t.deviceDetails.browserType,iru:t.yieldData.isReturningUser,ts:t.yieldData.trafficSource,db:t.deviceDetails.browser,d:t.deviceDetails.device,dp:t.deviceDetails.deviceType,mv:t.yieldData.version,scid:t.identity.supplyConfigId,res:`${t.deviceDetails.screenWidth}x${t.deviceDetails.screenHeight}`,aid:t.identity.articleId}}sendBeacon(e,i,s=!1,n,r){try{if(navigator.sendBeacon(`${this.eventServerUrl}v2/${e}?p=${this.commonFields.pvid}`,JSON.stringify(i)))return s?this.logger.debug("flush events beacon",i):(t.addToFiredEvents(e,i),this.logger.custom(`${e}/${n}`,"background: #AAFF7F; color: black; font-weight: bold; text-decoration:underline; font-size: 18px;",...i)),!0}catch(t){return this.logger.debug("failed sending events on beacon",i),!1}return!1}getTimeOffset(){return r.Utils.getCurrentTime(!1)-this.profile.identity.timeOffset}getFold(t){return t.isImpression&&t.browsiAd.container?t.browsiAd.iframe?r.Utils.getElementFoldNumber(t.browsiAd.iframe):r.Utils.getElementFoldNumber(t.browsiAd.container):r.Utils.getElementFoldNumber(t.ref)}getDcsEventData(t=o.DcsUtils.isDcs){const e=o.DcsUtils.getWindowObject();return Object.assign({dcs:t},t&&e?{ac:o.DcsUtils.getDcsActionCounter(),dcst:o.DcsUtils.dcsType}:{})}getViewedImpressionEventAV(t){return Object.assign({now:Math.floor(Date.now()/1e3),et:"viewed_impression_av",adix:t.adIndex,di:t.demandIndex,au:t.adUnit||"NA",atix:t.attemptIndex,pr:t.genericParams.displayName||t.providerName||"",w:t.selectedSize&&t.selectedSize.w?t.selectedSize.w:-1,h:t.selectedSize&&t.selectedSize.h?t.selectedSize.h:-1,f:this.getFold(t),ot:r.Utils.getSpotCoords(t).top,pt:t.positionTypeToString(),ill:t.isLazyLoading,rc:t.refresh.impressionsEventCount||0,to:r.Utils.getTimeOffset(),ul:r.Utils.getScrollPosition().top,st:t.type},this.getSpotTags(t))}getViewedPublisherAdAv(t){return Object.assign({now:Math.floor(Date.now()/1e3),et:"viewed_publisher_ad_av",rc:t.refreshCount,h:t.height,f:t.foldNum,ot:r.Utils.getElementPosition(t.element).top,to:r.Utils.getTimeOffset(),pt:t.positionType,pr:t.providerName,plid:t.placementId,au:t.adUnit,ill:t.isLazyLoaded,ul:r.Utils.getScrollPosition().top})}getErrorEvent(t,e,i,s){return Object.assign({et:t,msg:e,file:i,now:Math.floor(Date.now()/1e3),to:+new Date-this.profile.identity.timeOffset,lineNo:-1,columnNo:-1,url:this.commonFields.url,d:this.commonFields.d,res:this.commonFields.res,bpvid:this.profile.identity.bootstrapPageviewId,sk:this.profile.identity.siteKey,pk:this.profile.identity.publisherKey,uid:r.Utils.getUserID(),sid:this.profile.identity.sessionId,pvid:this.profile.identity.pageviewId,scid:this.profile.identity.supplyConfigId,geo:this.profile.yieldData.countryCode,ts:this.profile.yieldData.trafficSource,mv:this.profile.yieldData.version,iru:this.profile.yieldData.isReturningUser,db:this.profile.deviceDetails.browser,dbt:this.profile.deviceDetails.browserType,dp:this.profile.deviceDetails.deviceType,dv:this.profile.deviceDetails.deviceVendor,dos:this.profile.deviceDetails.os,dosv:this.profile.deviceDetails.osVersion},s?{error:s}:{})}getSpotTags(t){return{ptg:t.tags.positionTag}}getPlaceholderEvent(t,e,i){return Object.assign(Object.assign({now:Math.floor(Date.now()/1e3),et:e,di:t.demandIndex,st:t.type,to:r.Utils.getTimeOffset(),adix:t.adIndex,atix:t.attemptIndex,ul:r.Utils.getScrollPosition().top},this.getSpotTags(t)),i?{rsn:i}:{})}sendLoggerEvent(t){if(r.Utils.isBrowsiLoggerActive()){const e={adUnit:t.adUnit,spot:t};window.dispatchEvent(new CustomEvent("ad_impression",{detail:e}))}}sendInframePlacementEvent(t){const e=this.getInframePlacementEvent(t);this.addToEventsQue("inframe","placements",[e])}isValidURL(t){if(!t)return!1;try{return new URL("https://"+t),!0}catch(t){return!1}}}return t.firedEvents=new Map,t})();e.EventsService=c},9527:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FixedHeaderService=void 0;const s=i(125),n=i(2727),r=i(7730);class o{constructor(){this.observer=null,this.noneFixedHeight=0,this.fixedHeight=0,this.isFixedHeader=!1;const t=r.Profiler.get().spotEngineConfig.fixedHeader;if(this.logger=new s.Logger("FixedHeader"),t&&"function"==typeof window.MutationObserver){const e=t.s,i=n.Utils.getCurrentContextElement().querySelector(e);i&&(this.updateProperties(i),this.noneFixedHeight=t.h,this.observer=new MutationObserver((t=>{this.updateProperties(i)})),this.observer.observe(i,{attributes:!0}),this.logger.info("found header, watching ",i,t))}}updateProperties(t){const e=this.isHeaderFixed(t);this.isFixedHeader!==e&&this.logger.debug(`header fixed: ${e}`),this.isFixedHeader=e,this.fixedHeight=this.isFixedHeader?n.Utils.getElementSize(t).h:0}static get(){return o._instance||(this._instance=new o),o._instance}getFixedHeaderSize(){return this.fixedHeight}getNoneFixedHeaderSize(){return this.isFixedHeader?this.noneFixedHeight:0}isHeaderFixed(t){return t&&n.Utils.isPositionFixed(t)}}e.FixedHeaderService=o},8614:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Focus=void 0;const s=i(125),n=i(1993),r=i(7730),o=i(514);class h{constructor(){this.logger=new s.Logger("Focus"),this.profile=r.Profiler.get(),this.isSubscribed=!0,this.isHidden="hidden"===document.visibilityState,this.isHidden&&n.EventsService.get().sendFocusChangedEvent(!1,!0),this.subscribe((t=>{this.onFocusChanged(t)})),this.waitForFocus=[]}static get(){return this.instance||(this.instance=new h),this.instance}subscribe(t){this.profile.debugMode&&this.listenToDemoVisibilityChange(t),o.default.get().listen("visibilitychange",document,(()=>{t("hidden"===document.visibilityState)}))}unsubscribe(){return this.isSubscribed=!1,!0}waitForUserFocusWithAdBlock(t){return this.profile.spotEngineConfig.blockAdRequestOnOOF?(this.isHidden&&!t.adRequestBlockedSent&&n.EventsService.get().sendAdBlockedEvent(t,[{reason:"out_of_focus"}]),this.waitForUserFocus()):Promise.resolve()}waitForUserFocus(){return new Promise((t=>{if(!this.isHidden)return t();this.waitForFocus.push(t)}))}onFocusChanged(t){setTimeout((()=>{const e="hidden"===document.visibilityState;if(t===e&&this.isHidden!==e){if(this.isHidden=e,!e)for(;this.waitForFocus.length;){const t=this.waitForFocus.shift();"function"==typeof t&&t()}this.logger.info(`focus changed. in focus: ${!this.isHidden}`),n.EventsService.get().sendFocusChangedEvent(!e)}}),1e3)}listenToDemoVisibilityChange(t){o.default.get().listen("demoVisibilityChange",document,(()=>{this.isHidden=!!window._isHidden,t(this.isHidden)}))}}e.Focus=h},9792:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(125),n=i(8614),r=i(2247),o=i(7730);e.default=class{constructor(t,e,i=[1e3],n,r,o,h,a=!0){this.timeouts=[],this.isInView=!1,this.logger=new s.Logger("IntersectionHandler"),this.element=t,this.threshold=e,this.rootMargin=r,i=Array.from(new Set(i)),this.breakpoints=i.sort(((t,e)=>t-e)),this.observer=this.initObserver(),this.callback=n,this.outOfThresholdCallback=o||(()=>{}),this.isContinuousObserver=!!h,this.shouldCheckMinSize=a}initObserver(){let t={threshold:[this.threshold,Math.max(0,this.threshold-.01)],rootMargin:this.rootMargin};return n.Focus.instance.subscribe((t=>{t?this.clearAllTimeouts():this.isInView&&this.setBreakpointsTimeouts()})),new IntersectionObserver(this.observationCallback.bind(this),t)}observe(){return this.logger.debug("observe ",this.element,` for threshold of ${this.threshold} with breakpoint of ${this.breakpoints} and ${this.rootMargin||"no"} rootMargin`),this.observer.observe(this.element),new Promise((t=>{this.resolver=t}))}observationCallback(t){const e=t[0],i=!this.shouldCheckMinSize||e.boundingClientRect.height>=r.MIN_AD_SIZE;e.intersectionRatio>=this.threshold&&i?(this.isInView=!0,this.setBreakpointsTimeouts()):(this.isInView=!1,this.clearAllTimeouts(),this.outOfThresholdCallback())}isAboveMinimumSize(t){return o.Profiler.get().layouts.measureViewabilityForAllSizes||t>=r.MIN_AD_SIZE}setBreakpointsTimeouts(){const t=this.isContinuousObserver?[...this.breakpoints]:this.breakpoints;t.forEach((e=>{this.timeouts.push(setTimeout((()=>{const e=t.shift();this.callback(e),this.breakpoints.length||this.observationDone()}),e))}))}clearAllTimeouts(){this.timeouts.forEach((t=>{clearTimeout(t)}))}observationDone(){this.logger.info("All break points reached for element:",this.element),this.resolver(),this.clearObserver()}clearObserver(){this.logger.info("Stop observing",this.element),this.clearAllTimeouts(),this.observer.unobserve(this.element),this.observer.disconnect()}}},5310:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(125),n=i(2727),r=i(7730),o=i(1993),h=i(514),a=i(3034),d=i(1128);class l{constructor(){this.logger=new s.Logger("Lazy"),this.profile=r.Profiler.get(),this.lazySpots=[],this.lazySpotsLocations=[],this.generalLazyConfig=this.profile.layouts.lazySpots,this.lazyStatus={lastPosition:-1,positionListenerActive:!1,expectedNextPosition:-1,scrollDirection:"up",previousTime:-1},this.lazySpotsListener=n.Utils.throttle((()=>this.checkLocationAndFetch()),100),this.fetchTime=this.buildFetchTime(),this.postMovementTimeoutActive=!1,this.serviceActive=!1,this.userPositionInterval=null}static get(){return l._instance||(this._instance=new l),l._instance}static isSupportedSpotType(t){return a.SpotsUtils.getOptimizeViewabilityTypes().includes(t)}getThresholdMidPoint(t){if(t.isLazyLoading){t.offsetTop=n.Utils.getElementPosition(t.ref).top;const e=this.getThresholdLocation(t);return Math.floor(t.offsetTop-.5*(t.offsetTop-e))}return n.Utils.getScrollingDistance()}isLazy(t){var e;if(t.isEagerFirstFold())return!1;if(!l.isSupportedSpotType(t.type))return!1;const i=null===(e=a.SpotsUtils.getConf(t.tags))||void 0===e?void 0:e.lazyLoading;return!!(this.generalLazyConfig&&i&&this.shouldCheckLazyLoad(t))&&(void 0===i.firstAdIndex||void 0===i.firstFold?(this.logger.error(`${t.type} spot ${t.adIndex} has an illegal configuration`,i),!1):t.typeIndex>=i.firstAdIndex&&n.Utils.getElementFoldNumber(t.ref)>=i.firstFold)}shouldCheckLazyLoad(t){return t.type!==d.SpotType.STICKY&&this.fetchTime>-1}buildFetchTime(){return this.generalLazyConfig?this.generalLazyConfig.avgFetchTime:-1}subscribe(t,e){this.serviceActive||this.startService(),this.isSpotMissed(t)&&this.handleAdRequestBlock(t),t.offsetTop=n.Utils.getElementPosition(t.ref).top;const i=this.getThresholdLocation(t);this.logger.info(`${t.type} spot ${t.typeIndex} at ${t.offsetTop} will start at ${i.toFixed(2)}`),this.lazySpots.push({spot:t,approvalsCount:0,thresholdLocation:i,fetchCallback:e}),this.lazySpotsLocations=this.lazySpots.sort(((t,e)=>t.spot.adIndex-e.spot.adIndex)).map((t=>({t:t.thresholdLocation,l:t.spot.offsetTop}))),this.fetchChecking()}unsubscribe(t){this.serviceActive&&this.lazySpots.length>0&&(this.logger.debug("Stopping subscription for spot: ",t),this.lazySpots=this.lazySpots.filter((e=>e.spot!=t)),this.lazySpots.length||this.stopService())}getThresholdLocation(t){return t.offsetTop-n.Utils.getViewportHeight()*this.generalLazyConfig.threshold}stopService(t){var e;this.logger.info("stopping service"),h.default.get().removeListener("scroll",n.Utils.getScrollElement(),this.lazySpotsListener),this.userPositionInterval&&clearInterval(this.userPositionInterval),null===(e=this.thresholdMonitor)||void 0===e||e.stopMonitoring(),this.serviceActive=!1,t||(this.lazyStatus=this.getLazyStatus(!0),this.fetchChecking())}startService(){var t;this.logger.info("starting service"),this.lazyStatus=this.getLazyStatus(!0),h.default.get().listen("scroll",n.Utils.getScrollElement(),this.lazySpotsListener),this.startUserPositionInterval(),(null===(t=this.profile.layouts.lazySpots)||void 0===t?void 0:t.recalculateThreshold)&&(this.thresholdMonitor=this.ThresholdMonitor(),this.thresholdMonitor.startMonitoring()),this.serviceActive=!0}getLazyStatus(t){const e=n.Utils.getScrollPosition().bottom,i=Date.now(),s=t?0:e-this.lazyStatus.lastPosition,r=t?0:i-this.lazyStatus.previousTime,o=t||this.lazyStatus.lastPosition<=e?"down":"up",h=this.fetchTime/r;return{scrollDirection:o,expectedNextPosition:0===r?e:e+s*h,previousTime:i,lastPosition:e,positionListenerActive:!t&&this.lazyStatus.positionListenerActive}}checkLocationAndFetch(){this.lazyStatus.positionListenerActive||this.startUserPositionInterval(),this.fetchChecking()}startUserPositionInterval(){this.lazyStatus=this.getLazyStatus(),this.lazyStatus.positionListenerActive||(this.userPositionInterval=window.setInterval((()=>{if(this.lazyStatus=this.getLazyStatus(),this.logger.debug("direction: ",this.lazyStatus.scrollDirection.toString(),"at ",n.Utils.getScrollPosition().bottom.toFixed(2),"spots threshold: ",this.lazySpotsLocations),this.noMovement()&&!this.postMovementTimeoutActive){const t=this.lazyStatus.lastPosition;setTimeout((()=>{this.postMovementTimeoutActive=!1,t===this.lazyStatus.lastPosition&&(this.userPositionInterval&&clearInterval(this.userPositionInterval),this.generalLazyConfig.staticUser&&this.fetchChecking(!0),this.lazyStatus.positionListenerActive=!1,this.logger.debug("positionInterval stopped, static user"))}),500),this.postMovementTimeoutActive=!0}}),100)),this.lazyStatus.positionListenerActive=!0,this.logger.debug("positionInterval started")}noMovement(){return this.lazyStatus.lastPosition===this.lazyStatus.expectedNextPosition}fetchChecking(t){if("down"===this.lazyStatus.scrollDirection)for(const e of this.lazySpots)if(this.isSpotMissed(e.spot))this.handleAdRequestBlock(e.spot),this.zeroApprovalsCount(e);else if(this.isUserInThreshold(e)){if(this.logger.debug(`user in threshold of ${e.spot.type} spot ${e.spot.typeIndex}`,this.lazyStatus.lastPosition,e.spot.ref),this.isExpectedNextPositionOk(e)){if(e.approvalsCount++,this.approvalsTargetReached(e)||t){this.logger.info(`${e.spot.type} spot ${e.spot.typeIndex} is good for fetching ,${e.approvalsCount} /${this.generalLazyConfig.approvalCount}`),e.fetchCallback();const t=this.lazySpots.indexOf(e);t>-1&&this.lazySpots.splice(t,1),this.lazySpots.length||this.stopService()}break}this.zeroApprovalsCount(e)}else this.zeroApprovalsCount(e);else this.lazySpots.forEach((t=>this.zeroApprovalsCount(t)))}isSpotMissed(t){return n.Utils.getElementPosition(t.ref).top<=this.lazyStatus.lastPosition}handleAdRequestBlock(t){if(!t.adRequestBlockedSent){this.logger.debug(`${t.type} spot ${t.typeIndex} at position ${n.Utils.getElementPosition(t.ref).top} missed, current position: ${n.Utils.getScrollPosition().bottom}`);const e=[{reason:"lazy_ad_missed",message:`${n.Utils.getCurrentFoldDecimal()}`}];o.EventsService.get().sendAdBlockedEvent(t,e)}}zeroApprovalsCount(t){t.approvalsCount>0&&this.logger.debug("approval count reset"),t.approvalsCount=0}isUserInThreshold(t){const e=n.Utils.getElementPosition(t.spot.ref).top;return this.lazyStatus.lastPositiont.thresholdLocation}isExpectedNextPositionOk(t){return this.lazyStatus.expectedNextPosition=this.generalLazyConfig.approvalCount}ThresholdMonitor(){const t=()=>{const t=document.body,e=document.documentElement;return Math.max(t.scrollHeight,t.offsetHeight,e.clientHeight,e.scrollHeight,e.offsetHeight)};let e,i,s=t();return{startMonitoring:()=>{window.ResizeObserver?(i=new ResizeObserver((()=>{s=this.recalculateLazySpots(t,s)})),i.observe(document.body)):e=window.setInterval((()=>{s=this.recalculateLazySpots(t,s)}),800)},stopMonitoring:()=>{i?i.disconnect():clearInterval(e)}}}recalculateLazySpots(t,e){const i=t();return i!==e&&(e=i,this.lazySpots.forEach((t=>{this.reCalculateSpotThreshold(t)}))),e}reCalculateSpotThreshold(t){const e=n.Utils.getElementPosition(t.spot.ref).top;t.spot.offsetTop=e;const i=this.getThresholdLocation(t.spot);i-t.thresholdLocation>50&&(this.logger.info(`spot ${t.spot.adIndex} moved to ${e}px and will start at ${i}`),t.thresholdLocation=i)}}e.default=l},514:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(125),n=i(7730);class r{constructor(){this.callbackMap={},this.logger=new s.Logger("ListenerService"),this.externalListenersRemovers=[]}static get(){return this.instance||(this.instance=new r),this.instance}listen(t,e,i,s){var r,o;n.Profiler.get().identity.pageviewId===(null===(o=null===(r=window._middyo)||void 0===r?void 0:r.i)||void 0===o?void 0:o.pv)?e&&"function"==typeof e.addEventListener?(this.insert(t,{callback:i,listenObject:e}),e.addEventListener(t,i,s),this.logger.info(`Listening to ${t} on `,e)):this.logger.error("Failed listening to: ",e):this.logger.info(`Pv changed, NOT Listening to ${t} on `,e)}removeListener(t,e,i){if(e&&"function"==typeof e.removeEventListener){const s=this.findListener(t,i);i=s?s.callback:i,this.remove(t,{callback:i,listenObject:e}),e.removeEventListener(t,i),this.logger.info(`Stopped listening to ${t} on `,e)}else this.logger.error("Failed listening to: ",e)}listenToPbjs(t,e,i){var s;const r=window._middyo;n.Profiler.get().identity.pageviewId===(null===(s=null==r?void 0:r.i)||void 0===s?void 0:s.pv)?e&&"function"==typeof e.onEvent?(this.insert(t,{callback:i,listenObject:e}),e.onEvent(t,i),this.logger.info(`Listening to pbjs ${t} on `,e)):this.logger.error("Failed listening to pbjs: ",e):this.logger.info(`Pv changed, NOT Listening to ${t} on `,e)}removePbjsListener(t,e,i){if(e&&"function"==typeof e.offEvent){const s=this.findListener(t,i);i=s?s.callback:i,this.remove(t,{callback:i,listenObject:e}),e.offEvent(t,i),this.logger.info(`Stopped listening to pbjs ${t} on `,e)}else this.logger.error("Failed listening to pbjs: ",e)}removeAll(){var t;for(let t in this.callbackMap)this.callbackMap.hasOwnProperty(t)&&(this.callbackMap[t].forEach((e=>{if("removeEventListener"in e.listenObject){const i=e;i.listenObject.removeEventListener(t,i.callback)}else if("offEvent"in e.listenObject){const i=e;i.listenObject.offEvent(t,i.callback)}else this.logger.debug("could not remove callback",e);this.logger.info(`Stopped listening to ${t} on `,e.listenObject)})),this.callbackMap[t]=[]);null===(t=this.externalListenersRemovers)||void 0===t||t.forEach((t=>t()))}addExternalListenerRemoveFunction(t){this.externalListenersRemovers.push(t)}findListener(t,e){return this.callbackMap[t]&&this.callbackMap[t].find((t=>t.callback===e))}insert(t,e){this.callbackMap.hasOwnProperty(t)||(this.callbackMap[t]=[]),this.callbackMap[t].push(e)}remove(t,e){if(this.callbackMap.hasOwnProperty(t)){let i=this.callbackMap[t].find((t=>t.callback.toString()===e.callback.toString()&&t.listenObject===e.listenObject));if(null!=i){let e=this.callbackMap[t].indexOf(i);e>-1&&this.callbackMap[t].splice(e,1)}}}}e.default=r},4949:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(125),n=i(1993),r=i(2727),o={childList:!0,subtree:!0};e.default=class{constructor(t,e){this.logger=new s.Logger("MeasurableImpressions"),this.spot=t,this.nonFriendlyFound=0,this.rootFrames=[],this.secLevelFrames=[],this.adUnit=e}waitForSpotMeasurable(){if(this.spot.browsiAd&&this.spot.browsiAd.wrapper){if(this.rootFrames=this.scanAllFrames(this.spot.browsiAd.wrapper),this.rootFrames.forEach((t=>{this.secLevelFrames=this.secLevelFrames.concat(this.scanAllFrames(t))})),0==this.nonFriendlyFound&&!this.adFramesFound())return void this.waitForIframe();if(this.nonFriendlyFound>0&&!this.adFramesFound())return void this.sendEvent("non-friendly iframes");this.promiseAll(this.rootFrames.concat(this.secLevelFrames))}}sendEvent(t){this.spot.isMeasurable||(this.spot.isMeasurable=!0,n.EventsService.get().sendAdMeasurableEvent(this.spot,this.adUnit,t))}adFramesFound(){return this.secLevelFrames.length>0||(!this.spot.browsiAd||!this.spot.browsiAd.iframe)&&this.rootFrames.length>0}promiseAll(t){let e=t.map((t=>this.waitForIframeLoad(t)));Promise.all(e).then((t=>{t.filter((t=>!t.status||"complete"!=t.status)).length||(this.logger.debug("send measurable event after frames scan for spot ",this.spot.adIndex," iframes scaned ",t," nonFriendly found ",this.nonFriendlyFound),this.sendEvent("all frames loaded"))})).catch((t=>this.logger.error("measurable no iframe loaded found ",t)))}waitForIframeLoad(t){return new Promise(((e,i)=>{const s=t.contentDocument||t.contentWindow.document;this.isIframeLoaded(s)?e({status:"complete",frame:t}):t.onload=i=>{e({status:"complete",frame:t})}}))}isIframeLoaded(t){return"complete"==t.readyState&&null!=t.querySelector("head")&&t.querySelector("head").childNodes.length>0&&null!=t.querySelector("body")&&t.querySelector("body").childNodes.length>0}scanAllFrames(t){const e=r.Utils.querySelectorOnDocument(t,"iframe"),i=e.filter((t=>r.Utils.isFriendlyIframe(t.element)));return this.nonFriendlyFound+=e.length-i.length,i.map((t=>t.element))}waitForIframe(){this.observer=new MutationObserver((t=>this.handleMutationFound(t))),this.rootFrames.length?this.rootFrames.forEach((t=>{this.observer.observe(t.contentDocument||t.contentWindow.document,o)})):this.spot.browsiAd&&this.spot.browsiAd.wrapper&&this.observer.observe(this.spot.browsiAd.wrapper,o)}handleMutationFound(t){if(t.forEach((t=>{Array.from(t.addedNodes).forEach((t=>{"IFRAME"==t.nodeName&&this.secLevelFrames.push(t)}))})),this.secLevelFrames.length){this.logger.info("Observer destroyed");const t=this.secLevelFrames.filter((t=>r.Utils.isFriendlyIframe(t)));t.length?this.promiseAll(t):this.sendEvent("non-friendly iframes")}}}},6580:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(1128),n=i(7730),r=i(2727),o=i(3034),h=i(9792),a=i(125),d=i(1993);class l{constructor(){this.profile=n.Profiler.get(),this.logger=new a.Logger("NativeLazySpots"),this.lazySpots=[],this.lazySpotsQue=[],this.bucketsMap={}}getFetchCheckResult(t){const{scrollDirection:e}=t.scrollStatus;if("up"===e)return{shouldFetch:!1};if(this.isUserInThreshold(t)){if(this.logger.debug(`user in threshold of spot ${t.spot.adIndex}`),this.isExpectedNextPositionValid(t))return{shouldFetch:!0};t.retestTimeoutId||this.retestExpectedNextPosition(t)}else this.isSpotMissed(t.spot)&&this.handleAdRequestBlock(t);return{shouldFetch:!1}}addToFetchQue(t){var e;clearTimeout(this.fetchTimeoutId),null===(e=t.observer)||void 0===e||e.clearObserver();const i=this.lazySpots.indexOf(t),s={spotIndex:t.spot.adIndex,fetchCallback:this.fetchLazySpot.bind(this,t)};this.lazySpotsQue.push(s);const n=!this.lazySpots[i-1]||this.lazySpots[i-1].spot.adRequestBlockedSent;this.setFetchTimeout(n)}setFetchTimeout(t){t?this.fetchQue():this.fetchTimeoutId=setTimeout((()=>{this.fetchQue()}),50)}fetchQue(){this.lazySpotsQue.sort(((t,e)=>t.spotIndex-e.spotIndex)),this.lazySpotsQue.forEach((t=>{t.fetchCallback()})),this.lazySpotsQue.splice(0,this.lazySpotsQue.length)}fetchLazySpot(t){this.logger.info(`spot ${t.spot.adIndex} is good for fetching`),t.fetchCallback(),this.removeLazySpot(t),this.lazySpots.length||this.stopService()}removeLazySpot(t){this.lazySpots.splice(this.lazySpots.indexOf(t),1)}isExpectedNextPositionValid(t){return t.scrollStatus.expectedNextPosition{e[t.firstAdIndex]=t})),e}getSpotLazyConfig(t){const e=o.SpotsUtils.getLazyBucketsConf(t.tags),i=t.positionTagIndex?t.positionTagIndex:t.typeIndex;if(e&&"number"==typeof i){const s=this.getBucketsMap(e),n=Object.keys(s).map((t=>Number(t))),r=Math.max(...n.filter((t=>t<=i)));if(r>=0){const e=s[r];return this.logger.debug(`${t.type} spot ${t.adIndex} lazy bucket config`,e),this.bucketsMap[t.adIndex]=e,e}}this.logger.debug(`no lazy bucket config found for ${t.type} spot ${t.adIndex}`)}isLazy(t){if(t.isEagerFirstFold())return!1;if(!l.isSupportedSpotType(t.type))return!1;const e=this.getSpotLazyConfig(t);if(!e||!this.shouldCheckLazyLoad(t))return!1;if(void 0===e.firstAdIndex||void 0===e.firstFold)return this.logger.error(`${t.type} spot ${t.adIndex} has an illegal configuration`,e),!1;return(t.positionTagIndex?t.positionTagIndex:t.typeIndex)>=e.firstAdIndex&&r.Utils.getElementFoldNumber(t.ref)>=e.firstFold}static isSupportedSpotType(t){return o.SpotsUtils.getOptimizeViewabilityTypes().includes(t)}shouldCheckLazyLoad(t){return t.type!==s.SpotType.STICKY&&this.bucketsMap[t.adIndex].avgFetchTime>-1}buildLazySpotObserver(t){var e;const i=(null===(e=this.bucketsMap[t.spot.adIndex])||void 0===e?void 0:e.threshold)||0;this.logger.info(`spot ${t.spot.adIndex}, will start ${Math.trunc(i*r.Utils.getWindowHeight())}px before spot.ref: `,t.spot.ref);const s=l.formatRootMargin(i),n=this.outOfThresholdCallback.bind(this,t),o=this.getApprovalBreakpointsArray(t.spot),a=new h.default(t.spot.ref,.01,o,(e=>{this.observerCallback.apply(this,[t,e])}),s,n,!0,!1);return a.observe().then(),a}observerCallback(t,e){if(t.scrollStatus=this.getLazyScrollStatus(t,!e),e){const{shouldFetch:e}=this.getFetchCheckResult(t);e&&this.addToFetchQue(t)}}retestExpectedNextPosition(t){this.observerCallback(t,0);const e=this.getApprovalBreakpointsArray(t.spot)[1];t.retestTimeoutId=setTimeout((()=>{this.observerCallback(t,e)}),e)}subscribe(t,e){const i={spot:t,fetchCallback:e,scrollStatus:{scrollDirection:"down",userLastPosition:r.Utils.getScrollingDistance()}},s=this.buildLazySpotObserver(i);i.observer=s,this.isSpotMissed(t)&&this.handleAdRequestBlock(i),this.lazySpots.push(i)}unsubscribe(t){if(this.lazySpots.length>0){this.logger.debug("Stopping subscription for spot: ",t);const e=this.lazySpots.find((e=>e.spot===t));e&&this.removeLazySpot(e)}}static formatRootMargin(t){return`0% 0% ${Math.trunc(100*t)}% 0%`}isSpotMissed(t){return this.getSpotYLocation(t)<=r.Utils.getScrollingDistance()}outOfThresholdCallback(t){t.scrollStatus.isIntersecting=!1,this.isSpotMissed(t.spot)&&this.handleAdRequestBlock(t)}stopService(){this.logger.info("stopping service"),this.lazySpots.forEach((t=>{this.removeLazySpot(t)}))}isUserInThreshold(t){if(!t.scrollStatus.isIntersecting)return!1;const e=this.getSpotYLocation(t.spot);return r.Utils.getScrollingDistance(){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(125),n=i(2727),r=i(9235),o=i(7730);class h{constructor(){this.titleSelectors=["h1","h2","h3","h4","h5","h6","header"],this.oneLineSelectors=["span","div","p"],this.minDistance=60,this.logger=new s.Logger("ContentTitle"),this.excludeElements=this.getExcludeElements(o.Profiler.get().spotEngineConfig.pageLayoutSA.ex),this.titlesOnPage=this.collectTitles(),this.logger.debug("titles",this.titlesOnPage),this.titlesLocations=this.getLocations(this.titlesOnPage),this.oneLinersOnPage=this.collectOneLiners(),this.logger.debug("one liners",this.oneLinersOnPage),this.oneLinersLocations=this.getLocations(this.oneLinersOnPage)}static get(){return h.instance||(this.instance=new h),h.instance}collectTitles(t){return Array.from((t||document).querySelectorAll(this.titleSelectors.join(","))).filter((t=>n.Utils.isVisible(t)&&r.default.instance.isInMainContent(t)&&!this.isExcluded(t)))}collectOneLiners(){var t;const e=null===(t=o.Profiler.get().domData)||void 0===t?void 0:t.mainContent.inputElements;return(e&&e.length?e:[]).reduce(((t,e)=>{const i=.4*n.Utils.getElementSize(e).w;return t.concat(Array.from(e.querySelectorAll(this.oneLineSelectors.join(","))).filter((t=>this.isOneLine(t,i))))}),[])}isOneLine(t,e){return n.Utils.isVisible(t)&&t.offsetHeight<24&&t.offsetWidth>e&&t.innerText.trim().length>0&&!this.isExcluded(t)}getLocations(t){return t.map((t=>this.getBottomOffset(t))).filter((t=>t>0)).sort(((t,e)=>t-e))}isTitle(t){return-1!=this.titlesOnPage.indexOf(t)}isCollectedOneLine(t){return-1!=this.oneLinersOnPage.indexOf(t)}isBetweenTitleAndContent(t){const e=n.Utils.getElementPosition(t).top;if(e<1)return!1;if(this.isTitle(t)){const i=this.getBottomOffset(t),s=this.titlesLocations.indexOf(i);if(s&&this.titlesLocations[s-1])return e-this.titlesLocations[s-1]=0;t--)if(e>=this.titlesLocations[t])return e-this.titlesLocations[t]=0;t--)if(e>=this.oneLinersLocations[t])return e-this.oneLinersLocations[t]{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(125),n=i(9792),r=i(1128),o=i(2727),h=i(1993),a=i(2362);e.default=class{constructor(){this.logger=new s.Logger("PlaceholderService"),this.isOpen=!1,this.active=!0}openPlaceholder(t){t.browsiAd.container&&(this.isOpen=!0,this.observer=new n.default(t.browsiAd.container,.25,[1e3],(()=>{h.EventsService.get().sendPlaceholderViewed(t)})),this.observer.observe())}stopObserving(){var t;this.active&&(null===(t=this.observer)||void 0===t||t.clearObserver(),this.observer=void 0)}closePlaceholder(t,e){if(this.active){if(!e.browsiAd.container||!this.isOpen)return;const i="none"===e.browsiAd.container.style.display;if(!i&&e.type!==r.SpotType.STICKY&&o.Utils.isChangingViewport(e.browsiAd.wrapper))return void this.logger.debug("placeholder changes viewport, keep open");this.deactivatePlaceholder(),h.EventsService.get().sendPlaceholderClosed(e,i?"other":"browsi"),t&&a.Embedder.removeAdFromDom(e)}}removePlaceholderStyle(t,e){if(this.active){const i=t.container,s=e&&["wrapped","left","right"].includes(e);o.Utils.isChangingViewport(t.wrapper)&&!s||i.style.removeProperty("min-height"),i.style.removeProperty("width"),i.style.removeProperty("margin"),i.style.removeProperty("background-color"),this.deactivatePlaceholder()}}setSize(t){this.size=t}deactivatePlaceholder(){this.isOpen=!1,this.stopObserving(),this.active=!1}}},7254:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(4901),n=i(1993),r=i(7730),o=i(2727),h=i(125),a=i(6319);e.default=class{constructor(t,e){this.involvedSlotsIds=[],this.window=e,this.pbjsInstance=this.getPbjsInstance(t),this.googleTag=this.getGoogleTag(),this.logger=new h.Logger("PrebidListeners"),this.functionBridge={init:t=>{this.onAuctionInit(t)},end:t=>{this.onAuctionEnd(t)},timeout:t=>{this.onBidTimeout(t)},won:t=>{this.onBidWon(t)},billable:t=>{this.onBillableEvent(t)}},this.profile=r.Profiler.get()}getPbjsInstance(t){return this.window[t]=this.window[t]||{},this.window[t].que=this.window[t].que||[],this.window[t]}getGoogleTag(){let t=this.window.googletag||{};return t.cmd=t.cmd||[],this.window.googletag=t,t}initListeners(){this.pbjsInstance.que.push((()=>{this.pbjsInstance.onEvent("bidWon",this.functionBridge.won),this.profile.siteInfo.collectHbEvents&&(this.initSlotRenderEndedListener(),this.initSlotRequestListener(),this.pbjsInstance.onEvent("auctionInit",this.functionBridge.init),this.pbjsInstance.onEvent("auctionEnd",this.functionBridge.end),this.pbjsInstance.onEvent("bidTimeout",this.functionBridge.timeout)),this.profile.layouts.sendPrebidBillableEvents&&this.initBillableEventsListener()}))}removeListeners(){this.pbjsInstance.que.push((()=>{this.pbjsInstance.offEvent("bidWon",this.functionBridge.won),this.profile.siteInfo.collectHbEvents&&(this.pbjsInstance.offEvent("auctionInit",this.functionBridge.init),this.pbjsInstance.offEvent("auctionEnd",this.functionBridge.end),this.pbjsInstance.offEvent("bidTimeout",this.functionBridge.timeout)),this.profile.layouts.sendPrebidBillableEvents&&this.pbjsInstance.offEvent("billableEvent",this.functionBridge.billable);const t=a.DcsUtils.getWindowObject();t&&(t._prebidEventsCount=this.pbjsInstance.getEvents().length)}))}initSlotRenderEndedListener(){this.googleTag.cmd.push((()=>{this.googleTag.pubads().addEventListener("slotRenderEnded",(t=>{const e=t.slot.getSlotElementId();if(!this.involvedSlotsIds.includes(e))return;const i=o.Utils.getDfpEventSize(t);this.sendDfpBidMatched(t.slot.getAdUnitPath(),!t.isEmpty,i,e)}))}))}initSlotRequestListener(){this.googleTag.cmd.push((()=>{this.googleTag.pubads().addEventListener("slotRequested",(t=>{const e=t.slot.getSlotElementId();if(!this.involvedSlotsIds.includes(e))return;const i=o.Utils.getDfpEventSize(t),n=s.AuctionDataCollector.get().getSpotFromAdUnitCode(e);n&&s.AuctionDataCollector.get().collectDFPBidRequest(n,[{dfp:[i]}])}))}))}onBidTimeout(t){if(t){t=Array.isArray(t)?t:[t];const e={im:!1,rsn:"timeout",s:[{w:-1,h:-1}]};t.forEach((t=>{this.isBrowsiAuction(t.auctionId,t.adUnitCode,[t.adUnitCode])&&s.AuctionDataCollector.get().collectBidMatch(t.adUnitCode,t.bidder,e)}))}}onBidWon(t){const e=s.AuctionDataCollector.get().getSpotFromAdUnitCode(t.adUnitCode);if(e&&(this.profile.siteInfo.collectHbEvents&&n.EventsService.get().sendHBWinner(e,t),o.Utils.isBrowsiLoggerActive())){const e={adUnit:t.adUnitCode,winner:t.bidder,size:{w:t.width,h:t.height}};window.dispatchEvent(new CustomEvent("hbw",{detail:e}))}}onAuctionEnd(t){const e=t.adUnitCodes[0],i=t.bidsReceived;this.isBrowsiAuction(t.auctionId,e,t.adUnitCodes)?(this.collectBidMatched(e,i),this.logger.hbLog(i,e,this.getNoBids(e),this.getPrebidWinner(e))):this.logger.debug("not browsi auction",t)}isBrowsiAuction(t,e,i){return t.includes(e)&&t.includes("browsi")||i.some((t=>!!s.AuctionDataCollector.get().getSpotFromAdUnitCode(t)))}initBillableEventsListener(){var t;let e=this.pbjsInstance.getEvents();const i=null===(t=a.DcsUtils.getWindowObject())||void 0===t?void 0:t._prebidEventsCount;i&&(e=e.slice(i));e.filter((t=>"billableEvent"===t.eventType)).forEach((t=>{n.EventsService.get().sendBillableEvent(t.args)})),this.pbjsInstance.onEvent("billableEvent",this.functionBridge.billable)}onBillableEvent(t){n.EventsService.get().sendBillableEvent(t)}onAuctionInit(t){let e=[];const i=t.adUnitCodes;if(!i[0]||!this.isBrowsiAuction(t.auctionId,i[0],i))return;const n={};t.bidderRequests.forEach((t=>{const e=t.bidderCode;t.bids.forEach((t=>{const i=Array.isArray(t.sizes[0])?t.sizes:[t.sizes],s=t.adUnitCode;n[s]=n[s]||{},n[s][e]=n[s][e]||{},n[s][e].sizes=n[s][e].sizes||[],n[s][e].sizes.push(i)}))})),Object.keys(n).forEach((t=>{this.involvedSlotsIds.push(t),Object.keys(n[t]).forEach((i=>{const r=[...new Set(o.Utils.flattenArray(n[t][i].sizes))];e.push({[i]:s.AuctionDataCollector.get().buildSizesFromArray(r)})})),s.AuctionDataCollector.get().collectBidRequest("prebid",t,e),e=[]}))}collectBidMatched(t,e){const i={};s.AuctionDataCollector.get().getSpotFromAdUnitCode(t);e.forEach((e=>{const n={im:Number(e.cpm)>0,s:[{w:e.width,h:e.height}],br:Number(e.cpm)};e.currency&&(n.brc=e.currency),e.requestTimestamp&&e.responseTimestamp&&(n.reqt=e.requestTimestamp,n.rest=e.responseTimestamp),i[e.bidder]=i[e.bidder]||[],i[e.bidder]=i[e.bidder].concat(n.s),s.AuctionDataCollector.get().collectBidMatch(t,e.bidder,n)}));let n=[];this.getNoBids(t).forEach((e=>{if(e.bidderRequestId&&n.includes(e.bidderRequestId))return;const r=i[e.bidder]||[];e.bidderRequestId&&n.push(e.bidderRequestId);const o={im:!1,rsn:"no_bid",s:s.AuctionDataCollector.get().buildSizesFromArray(e.sizes).filter((t=>!r.some((e=>e.w===t.w&&e.h===t.h))))};0!==o.s.length&&s.AuctionDataCollector.get().collectBidMatch(t,e.bidder,o)})),s.AuctionDataCollector.get().sendBidMatches(t)}getNoBids(t){if(this.pbjsInstance&&this.pbjsInstance.getNoBids&&"function"==typeof this.pbjsInstance.getNoBids){const e=this.pbjsInstance.getNoBids()[t];return e?e.bids:[]}return[]}sendDfpBidMatched(t,e,i,n){const r={im:e,s:[i],br:-1,au:t};s.AuctionDataCollector.get().collectBidMatch(n,"dfp",r,!0)}getPrebidWinner(t){return this.pbjsInstance.getHighestCpmBids().find((e=>e.adUnitCode===t))}}},7730:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Profiler=void 0;const s=i(2727),n=i(125),r=i(1128),o=i(3034),h=i(4603),a=i(7463),d=i(5701);let l=(()=>{class t{constructor(t){this._profile=this.buildProfile(t),window._middyo.pvid=this._profile.identity.pageviewId}static rebuild(e){const i=this.instance._profile.externalFlowHandler,s=this.updateRules(e,i);return this.instance=new t(e),this.instance._profile.rules=s,this.instance._profile}static get(){if(!t.instance){const e=s.Utils.getLoaderParams(),i=this.updateRules(e,e.externalFlowHandler);t.instance=new t(e),t.instance._profile.rules=i}return t.instance._profile}static updateRules(e,i){const s=i&&i.preEngine;if(s){try{t.logger.info("initiating rules"),s(e)}catch(e){t.logger.error("failed to initiating rules",e)}return e.externalFlowHandler}return i}static setLoadTime(t){this.get().loadTime=t-this.get().identity.timeOffset}static collectDOMData(){var e,i,n,r,o,h,a,l,c;const u=window._middyo,p=((null===(e=u.sec.mc)||void 0===e?void 0:e.s)?s.Utils.querySelectorAll(u.sec.mc.s,t.errorCallback):[]).filter((t=>s.Utils.isVisible(t)));let v=s.Utils.querySelectorAll((null===(n=null===(i=u.sec.ux)||void 0===i?void 0:i.sk)||void 0===n?void 0:n.c)||[],t.errorCallback);const f=s.Utils.querySelectorInsideElements(["div[style*=float] + p, img[style*=float]+p, iframe[style*=float] + p"],p,t.errorCallback);let m=this.getWidthForEmbed(p[0]),g=u.sec.mc&&u.sec.mc.t?u.sec.mc.t:500,b=!!(t.get().layouts.wrapAroundText&&m>=g);const w=t.get().layouts.allowNarrowBreak,y=(null===(o=null===(r=u.ly)||void 0===r?void 0:r.in)||void 0===o?void 0:o.ds)||[],S=(null===(a=null===(h=t.get().layouts.spots)||void 0===h?void 0:h.dynamic)||void 0===a?void 0:a.wrapperStyle)||d.DEFAULT_SPOT_STYLE,_=null===(c=null===(l=u.ly)||void 0===l?void 0:l.in)||void 0===c?void 0:c.asl;let O=this.buildAdSizes(m,y,w,b,S,void 0,_);return{mainContent:this.buildMainContent(p,m,g,u),stayAwayElements:[],skippedElements:v,dynamicCompatibleSizes:O,foundFloatElements:f,allowNarrowWrap:b}}getUxFixes(t){var e;return{dynamicIframeSize:null===(e=t.uxfx)||void 0===e?void 0:e.dis}}static buildMainContent(t,e,i,n){const r=n.sec.mc,o=r&&r.u;let h={start:-1,width:-1,widthThreshold:i,endPosition:-1,inputElements:[],firstElement:null,lastElement:null,borderElement:null};if(t.length){let n=null;r.e&&(n=s.Utils.querySelector(r.e[0],this.errorCallback));let a=s.Utils.querySelector(o,this.errorCallback)||t[0],d=t[t.length-1];h={start:s.Utils.getElementPosition(a).top,width:e,widthThreshold:i,endPosition:n?s.Utils.getElementPosition(n).top:s.Utils.getElementPosition(d).top+d.getBoundingClientRect().height,inputElements:t,firstElement:a,lastElement:d,borderElement:n}}return h}static buildAdSizes(t,e,i,n,r,o,h){let a=[];const d=s.Utils.getAdMarkingExpectedHeight();return e.forEach((e=>{if(h||t>=e.w||s.Utils.isFluidSize(e)){let s=this.buildCompatibleSize(t,e,d,i,n,r,o);s&&a.push(s)}})),a}static buildCompatibleSize(t,e,i,s,n,r,h){const a=this.getAdSizeType(e);return{w:e.w,h:e.h,adSizeType:a,minSizeForWrapping:r?this.calculateValidHeights(e,t,i,r):-1,optionalEmbeddings:h&&o.SpotsUtils.getRailsTypes().includes(h)?["break"]:this.getEmbedTypes(a,s,n)}}static getAdSizeType(t){return s.Utils.isFluidSize(t)?"wide":t.w<=400?"narrow":"wide"}static getEmbedTypes(t,e,i){const s=[];return"narrow"==t?(e&&s.push("break"),i&&s.push("wrapped")):s.push("break"),s}static calculateValidHeights(t,e,i,n){const r=s.Utils.getWrapFullSize(t,n);return r.h+=i,r.h-r.h*r.w/e}static validateProfileForBehavior(t,e,i){if(!i)return[];const n=t.mainContent.inputElements,o=i.elements,h=i.allowedCreativeSizes;let a=[];if(i.stopInFold&&i.startInFold&&i.startInFold>i.stopInFold&&i.stopInFold>0&&a.push("startIF/stopIF_Violation"),e===r.SpotType.DYNAMIC_MC&&0===n.length)a.push("No_Main_Content_Found");else if(0===o.length&&a.push("No_Elements_For_Scan"),0===h.length&&a.push("No_compatibleSizes"),e===r.SpotType.DYNAMIC_MC){const e=t.skippedElements;let i=!0;n.forEach((t=>{i&&!e.some((e=>e===t||s.Utils.isDescendantElement([e],t)))&&(i=!1)})),i&&a.push("Main_Content_Inside_Skipped")}return a}getAdMarkingConfiguration(t){if(t){let e={text:t.t,expectedHeight:0};return t.c?e.color=t.c:t.s&&(e.customStyle=t.s),e.expectedHeight=s.Utils.calculateAdMarkingHeight(e),e}}static getPotentialSpots(t,e,i){let n=this.collectTargetElements(t,e);return i&&s.Utils.isDescendantElement(e,i)&&(n=s.Utils.removeElementsPositionedAfter(i,n)),n}getDcsConfig(e){if(e&&"script"!==e.t){if(e.t&&e.s&&e.s.length){let t=e.s.reduce(((t,e)=>(e&&t.push({type:e.t,elementSelector:e.s1,containerSelector:e.s2,value:e.v}),t)),[]);return{type:e.t,steps:t,urlChange:e.u,delay:e.d,rescanRails:!!e.r}}t.logger.error("bad DCS configuration",e)}else;}getPubAdsRefreshConfig(e,i){if(e){if(e.c&&e.r&&e.l&&e.t)return{active:!0,adIdType:e.t,adIds:e.l,refreshCount:e.c,refreshRate:e.r,dfpOnly:e.d,sendRefreshKV:e.kv,customPbjsName:i};t.logger.error("bad PubAdsConfig configuration",e)}}static collectTargetElements(t,e){let i=[];t.length&&(i=e.reduce(((e,i)=>e.concat(Array.from(i.querySelectorAll(`${t.toString()}`)).filter((t=>s.Utils.isVisible(t))))),[]));let n=[...e.reduce(((t,e)=>t.concat(Array.from(e.querySelectorAll("p")).filter((t=>s.Utils.isVisible(t)&&!s.Utils.isDescendantElement(i,t))))),[]),...i].sort(((t,e)=>s.Utils.isPositionedAfter(t,e)?1:-1));return s.Utils.toUnique(n)}static detectAdBlocker(e){t.adBlockerExists?e():new Promise(((e,i)=>{function s(){"undefined"===window.adblockDetector?e(!1):window.adblockDetector.init({debug:t.get().debugMode,found:function(){e(!0)},notFound:function(){e(!1)}})}const n=document.createElement("script");n.src=t.get().adBlockerDetectionUrl,n.setAttribute("crossorigin","anonymous"),n.onload=s,n.onerror=s,document.body.appendChild(n)})).then((i=>{t.adBlockerExists=i,t.logger.custom(`Ad Blocker Detected: ${i}`,s.Utils.getLogStyle(18,"black","green")),e()}))}buildProfile(t){var e,i,n,r;let o=s.Utils.getScreenSize();return{debugMode:!!t.debug,runMode:t.m,identity:{siteKey:t.i.sk,publisherKey:t.i.pk,userId:t.i.u,sessionId:t.i.s,pageviewId:t.i.pv,bootstrapPageviewId:t.bpvi,supplyConfigId:t.i.sc,url:encodeURIComponent(`${location.protocol}//${location.host}${location.pathname}`),timeOffset:t.to,articleId:t.i.aid},yieldData:{countryCode:t.r.cc,trafficSource:t.r.ts,isReturningUser:t.r.ru,version:t.ses.v,eventServerUrl:t.r.es,host:t.yhn},deviceDetails:{browser:t.dt.b,device:t.dt.d,deviceType:t.dt.p,os:t.dt.os,osVersion:t.dt.osv,screenWidth:o.w,screenHeight:o.h,browserType:t.dt.bt,deviceVendor:t.dt.v},spotEngineConfig:{embedType:t.sec.et,adMarking:this.getAdMarkingConfiguration(t.sec.adm),publisherAdsMinDistance:t.sec.dad,railsPublisherAdsMinDistance:t.sec.rdad,isLazySAActive:t.sec.lsa,tryInsideTables:!!t.sec.ti,dcs:this.getDcsConfig(t.sec.dcs),useNewStayAwayCalc:!!t.sec.sapc,stayAway:(null===(e=t.sec.ux)||void 0===e?void 0:e.sa)||[],mainContentConfig:t.sec.mc,pageLayoutSA:t.sec.plsa,fixedHeader:t.sec.fh,wrappingAdditionalElements:t.sec.wae||[],blockAdRequestOnOOF:t.sec.barof,targetSelectors:t.sec.ts||[],rails:t.sec.rl},layouts:this.getLayouts(t.ly),siteInfo:{adInViewport:t.si.aiv,activeView:!!t.si.av,blockLineItemIds:t.si.bli,prebidData:t.si.pd,prebidPath:t.si.pd.p,billableEvents:t.si.be,bulkEventsThrottle:t.si.bet,sendBrowsiImpressionDOMEvent:t.si.bi,demandHost:t.si.dh,usingMagnite:!1,collectHbEvents:!!t.si.chbe,waitForAdRequest:t.si.wfar},publisher:{customRefresh:!!(null===(i=t.pi)||void 0===i?void 0:i.crr)},referrer:encodeURIComponent(window.document.referrer),state:"bootstrap_loaded",adBlockerDetectionUrl:t.sec.abd,isUserEngaged:!1,logEngagement:t.ses.le,browsiViewability50Key:t.si.v50,pageKeyValues:t.ly.pgkv,pubAdsRefresh:this.getPubAdsRefreshConfig((null===(n=t.pub)||void 0===n?void 0:n.r)||void 0,(null===(r=t.si.pd)||void 0===r?void 0:r.g)||void 0),userAnonymousContinent:t.r.cl,reportResponseTime:{active:t.si.rrt,timers:t.td},dcsState:t.dcss&&this.getDcsState(t.dcss),sendViewabilityCheckpoints:!!t.ly.vc,externalFlowHandler:t.externalFlowHandler,prebidConfig:this.convertPrebidConfig(t.pc)}}convertPrebidConfig(t){if(t)return JSON.parse(t.pcm)}static getWidthForEmbed(t){let e=t?t.getBoundingClientRect().width:-1;if(s.Utils.isElement(t)){const i=window.getComputedStyle(t);i.paddingLeft&&i.paddingRight&&(e-=parseFloat(i.paddingLeft)+parseFloat(i.paddingRight))}return e}getLayouts(t){var e,i,s;return{analysisMode:!!t.am,lazySpots:this.convertLayoutLazyConfig(t.ll),wrapAroundText:!!(null===(e=t.in)||void 0===e?void 0:e.w),allowNarrowBreak:void 0===(null===(i=t.in)||void 0===i?void 0:i.anb)||!!(null===(s=t.in)||void 0===s?void 0:s.anb),spots:this.getLayoutSpots(t),placeholder:t.ph,eagerFirstFold:t.eff,fixedSpotsFirst:!!t.fsf,uxFixes:this.getUxFixes(t),moatPercentage:t.mp,useWebVitals:t.wv,sendPrebidBillableEvents:!!t.spbe,publisherAdMoat:{browsiIdOnly:!!t.padm.bio,percentage:t.padm.p},inframe:t.inf,measureViewabilityForAllSizes:!!t.mvas}}getLayoutSpots(t){return{dynamic:this.convertLayoutDynamicConfig(t.in),fixedBottom:this.convertLayoutFixedConfig(t.b),fixedMC:this.convertLayoutFixedConfig(t.in),fixedTop:this.convertLayoutFixedConfig(t.t),rails:this.convertRailsLayout(t.r),api:this.convertLayoutApiSpot(t),sticky:this.convertLayoutStickySpot(t.s)}}convertLayoutDynamicConfig(t){var e,i;if(!(null==t?void 0:t.dy))return;const s=t.ps;return Object.assign(Object.assign(Object.assign({},this.convertInContentSpot(t)),this.convertFoldConfig(t)),{distance:this.getDistanceInPixelsByType(t.di),maxItems:t.dy.dmi,maxSpots:Math.max(t.dy.dmi,s||0),additionalSizes:[],elements:[],targetElements:[],viewabilityThreshold:null===(e=t.ov)||void 0===e?void 0:e.vt,startInFoldSelectors:t.sfs,potentialSpots:s,allowOverflowContainer:!!t.asl,avoidCLS:!!(null===(i=t.acls)||void 0===i?void 0:i[h.TypeTag.DYNAMIC])})}getDistanceInPixelsByType(t){if("PIXEL"===t.dt)return t.d;const e=s.Utils.getViewportHeight();return t.d*e}convertLayoutFixedConfig(t){var e,i;if(null==t?void 0:t.fi)return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.convertScannedSpot(t)),this.convertFoldConfig(t)),{maxItems:-1,maxSpots:-1,elements:[],targetElementPosition:t.fi.tep,targetElements:t.fi.ds,viewabilityThreshold:null===(e=t.ov)||void 0===e?void 0:e.vt}),t.sfs?{startInFoldSelectors:t.sfs}:{}),{allowOverflowContainer:!!t.asl,avoidCLS:"acls"in t&&!!(null===(i=t.acls)||void 0===i?void 0:i[h.TypeTag.FIXED])})}convertScannedSpot(t){var e,i;return{allowedCreativeSizes:t.ds||[],engagedUsers:(null===(e=t.ov)||void 0===e?void 0:e.eu)||!1,style:t.st,wrapperStyle:new d.default(t.st).getSize(),lazyLoading:(null===(i=t.ov)||void 0===i?void 0:i.ll)?{firstAdIndex:t.ov.ll.fai,firstFold:t.ov.ll.ff}:void 0,lazyLoadingBuckets:this.converLazyLoadingBucketsConfig(t)}}converLazyLoadingBucketsConfig(t){var e;if(!(null===(e=t.ov)||void 0===e?void 0:e.llb))return;const i=[];return t.ov.llb.map((t=>{i.push({firstAdIndex:t.fai,firstFold:t.ff,threshold:t.t,approvalCount:t.ac,avgFetchTime:t.aft})})),i}convertFoldConfig(t){return{startInFold:t.start||0,stopInFold:t.stop||0}}convertInContentSpot(t){return Object.assign(Object.assign({},this.convertScannedSpot(t)),{startInFold:t.start,stopInFold:t.stop})}convertLayoutStickySpot(t){if(t)return{location:t.l,allowedCreativeSizes:t.ds||[],closeButton:!!t.cb,style:t.st,wrapperStyle:new d.default(t.st).getSize(),useOriginalSizes:!!t.uos,allowOverflowContainer:!!t.asl}}convertLayoutApiSpot(t){if(!t)return;const e={};return["in","t","b","s","r"].forEach((i=>{var s,n,r;const o=t[i];o&&("r"===i&&(i=(null==o?void 0:o.p)===a.RailsSides.RIGHT?"r":"l"),e[i]=Object.assign(Object.assign({sizes:o.ds||[],viewabilityOptimizationBlocklist:(null===(s=o.api)||void 0===s?void 0:s.vob)||[],positionIds:null===(n=o.api)||void 0===n?void 0:n.ids,targetElementPosition:t.atep||"INSIDE",style:o.st,wrapperStyle:new d.default(o.st).getSize()},this.getOptimizationParams(o)),{avoidCLS:"acls"in o&&!!(null===(r=o.acls)||void 0===r?void 0:r[h.TypeTag.API])})),e[i]||(e[i]={sizes:[],targetElementPosition:"INSIDE"})})),e}convertRailsLayout(t){var e,i,s,n,r,o;if(!t)return;const h=t.ps;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.convertInContentSpot(t)),this.convertFoldConfig(t)),{distance:this.getDistanceInPixelsByType(t.di),maxItems:(null===(e=t.dy)||void 0===e?void 0:e.dmi)||0,maxSpots:Math.max((null===(i=t.dy)||void 0===i?void 0:i.dmi)||0,h||0),additionalSizes:[],elements:[],targetElements:(null===(s=t.fi)||void 0===s?void 0:s.ds)||[],viewabilityThreshold:null===(n=t.ov)||void 0===n?void 0:n.vt,railSide:t.p}),(null===(r=t.fi)||void 0===r?void 0:r.tep)?{targetElementPosition:null===(o=t.fi)||void 0===o?void 0:o.tep}:{}),{potentialSpots:h,allowOverflowContainer:!!t.asl})}convertLayoutLazyConfig(t){return{avgFetchTime:t.aft,approvalCount:t.ac,staticUser:t.su,threshold:t.t,recalculateThreshold:t.rct,bucketsConfigured:t.llb}}getOptimizationParams(t){var e;const i=null===(e=t)||void 0===e?void 0:e.ov;if(i)return Object.assign(Object.assign({engagedUsers:i.eu,viewabilityThreshold:i.vt},i.ll?{lazyLoading:{firstAdIndex:i.ll.fai,firstFold:i.ll.ff}}:{}),i.llb&&t?{lazyLoadingBuckets:this.converLazyLoadingBucketsConfig(t)}:{})}getDcsState(t){return{count:t.c,mainContentElement:t.mc,saObjects:t.sao,articleSelectors:t.as,previousSpots:t.pps,parentPageView:t.ppv}}}return t.logger=new n.Logger("Profiler"),t.errorCallback=e=>t.logger.error(e),t})();e.Profiler=l},9394:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(125),n=i(9790),r=i(2727),o=i(7730),h=i(1993),a=i(2362),d=i(9235),l=i(3271),c=i(2057),u=i(7631),p=i(4029),v=i(4647),f=i(4869),m=i(1528),g=i(2763);class b{constructor(){this._foundAds=[],this.adRequested=!1,this.logger=new s.Logger("ProvidersDetector"),this._foundAds=[],this.profile=o.Profiler.get(),this.waitForAdRequest=new Promise((t=>this.adRequestedPromise=t)),this.usingCustomRefresh=r.Utils.isCustomRefreshConfigured(),this.customRefreshBatch=[],this.waitingForCustomRefreshBatch=!0,this.usingCustomRefresh&&this.sendCustomRefreshBatch()}static get(){return this.instance||(this.instance=new b),this.instance}get foundAds(){return this._foundAds}onDfpSlotReady(){this.adRequested=!0,this.adRequestedPromise()}waitForFirstAdRequest(){return new Promise((t=>{if(this.adRequested)return t();this.waitForAdRequest.then(t)}))}shouldInjectMoat(t){return Math.floor(100*Math.random())t.element===n));t&&(u=++t.refreshCount)}let v={providerName:t.providerName,positionType:d,element:n,topPos:o,foldNum:l,width:a.w,height:a.h,placementId:t.placementId,adUnit:t.adUnit,isLazyLoaded:t.isLazyLoaded,refreshCount:u,refreshType:s,gamResponseInfo:r.Utils.getGAMResponseInfo(e),slot:e};const m=c.default.get().getFoundPublisherAdData(v.providerName,"manual_ad"===v.providerName?n.id:t.placementId,v.refreshCount,e);return v=this.updateFoundAdFromBptData(v,m),this.usingCustomRefresh&&e&&this.initRefreshRateRequest(v),this.foundAds.push(v),this.logger.info("Found provider on page: "+t.providerName+"("+a.w+"x"+a.h+")",n),this.injectPublisherAdMoat.apply(this,[v.element,e]),h.EventsService.get().sendPublisherAdFound(v,m),f.ViewabilityService.get().subscribe(this.buildViewabilityServiceObject(v,i,e)),"dfp"===v.providerName&&e&&p.default.get().waitForPublisherAV(e,v),d}}initRefreshRateRequest(t){if(this.waitingForCustomRefreshBatch)this.customRefreshBatch.push(t);else{const e=this.getPublisherAdCustomRefreshParams(t);g.CustomRefreshRate.get().sendCustomRefreshRate(m.DemandRequestType.SINGLE,[e])}}sendCustomRefreshBatch(){setTimeout((()=>{if(this.waitingForCustomRefreshBatch=!1,this.customRefreshBatch.length){let t=this.customRefreshBatch.map((t=>this.getPublisherAdCustomRefreshParams(t)));g.CustomRefreshRate.get().sendCustomRefreshRate(m.DemandRequestType.SRA,t),this.customRefreshBatch=[]}}),1500)}getPublisherAdCustomRefreshParams(t){var e,i,s,n;return Object.assign(Object.assign(Object.assign(Object.assign({},t.adUnit?{au:t.adUnit}:{}),t.placementId?{id:t.placementId}:{}),(null===(e=t.gamResponseInfo)||void 0===e?void 0:e.lid)?{lid:null===(i=t.gamResponseInfo)||void 0===i?void 0:i.lid}:{}),(null===(s=t.gamResponseInfo)||void 0===s?void 0:s.oid)?{oid:null===(n=t.gamResponseInfo)||void 0===n?void 0:n.oid}:{})}sendBrowsiImpressionDOMEvent(t){const e={element:t.element,adUnit:t.adUnit,refreshCount:t.refreshCount};return r.Utils.dispatchDOMEvent(v.BROWSI_IMPRESSION_DOM_EVENT_NAME,e)}updateFoundAdFromBptData(t,e){return t.placementId=e.plid,"manual_ad"===t.providerName&&(t.adUnit=e.plid),t}buildViewabilityServiceObject(t,e,i){const s=e&&e.w*e.h>=242500?30:50,n=this.generateInViewActionsMap(),o={type:1,conf:{minViewInitiator:s,duration:1e3,shouldReportOneTime:!0},getCoords:()=>r.Utils.getElementPosition(t.element),getHeight:()=>r.Utils.getElementSize(t.element).h,refreshInfo:{shouldRefresh:()=>!1,rate:0,doRefresh:()=>{}},sendViewedImpression:e=>h.EventsService.get().sendViewedPublisherAd(t,e),root:()=>t,element:t.element,inViewActionsMap:n},a=u.PubAdsRefreshService.get();if(i&&a){const e=a.getViewabilityRefreshInfo(t,o,i);Object.assign(o,{refreshInfo:e},{inViewActionsMap:this.generateInViewActionsMap(e)})}return o}getAdPositionType(t){let e=[];const i=r.Utils.getElementSize(t),s=r.Utils.getElementPosition(t);if(r.Utils.isPositionFixed(t)&&i.w>.85*this.profile.deviceDetails.screenWidth&&i.h>.85*this.profile.deviceDetails.screenHeight)return e.push("interstitial"),e;if(r.Utils.isPositionFixed(t)&&e.push("sticky"),this.profile.domData&&this.profile.domData.mainContent.inputElements&&this.profile.domData.mainContent.start>-1){const t=this.profile.domData.mainContent,n=t.inputElements[0].getBoundingClientRect().width;let o=r.Utils.getElementPosition(t.inputElements[0]).left,h=0,a=s.left,d=a+i.w,l=s.top;for(let e=0;e=o&&d<=h?e.push("in-line"):(a=h&&e.push("right rail")),-1==e.indexOf("sticky")&&(lt.endPosition&&e.push("bottom")),-1!=e.indexOf("in-line")&&-1==e.indexOf("sticky")&&-1==e.indexOf("bottom")&&-1==e.indexOf("top")&&e.push("within main content"),0===e.length&&l>=t.start&&l<=t.endPosition&&e.push("within main content")}else e.push("out of main content");return e}scan(t){return t&&n.default.start(),this.foundAds}addFoundProvider(t,e,i,s){const n=this.addIfNew(t,e,i,s);if(n){const e=this.buildSaObject(t,n);d.default.instance.upsertStayAwayElement(t.element,e,t.isLazyLoaded)}return!!n}buildSaObject(t,e){var i;const s="dfp"===t.providerName?this.getMinDistance(e):(null===(i=o.Profiler.get().layouts.spots.dynamic)||void 0===i?void 0:i.distance)||0,n="pubAd";return{config:{d:s,v:[n],t:this.buildStayAwayTargetByAdPosition(e)},sa:{element:t.element,distance:s,selector:n}}}getMinDistance(t){const e=t.includes("right rail")||t.includes("left rail"),i=o.Profiler.get().spotEngineConfig.railsPublisherAdsMinDistance;return e&&"number"==typeof i?i:o.Profiler.get().spotEngineConfig.publisherAdsMinDistance}buildStayAwayTargetByAdPosition(t){let e=[];const i=["bottom","top","within main content"];return t.some((t=>i.includes(t)))&&e.push(l.SATargets.TOP,l.SATargets.BOTTOM,l.SATargets.MC),t.includes("right rail")&&e.push(l.SATargets.RIGHT),t.includes("left rail")&&e.push(l.SATargets.LEFT),e}isDetectedAlready(t){return!!this.foundAds.some((e=>e.element===t))||(!!r.Utils.isDescendantElement(this.foundAds.map((t=>t.element)),t)||this.foundAds.some((e=>r.Utils.isDescendantElement([t],e.element))))}resolveElementSize(t,e){if(e)return e;{const e=t.getBoundingClientRect();return{w:e.width,h:e.height}}}generateInViewActionsMap(t){let e={};return e=f.ViewabilityService.get().addActionToMap(["event"],[1e3],e),(null==t?void 0:t.rate)&&!this.usingCustomRefresh&&(e=f.ViewabilityService.get().addActionToMap(["refresh"],[t.rate],e)),this.usingCustomRefresh&&(e=f.ViewabilityService.get().addActionToMap(["custom refresh"],[3e3],e)),e}}e.default=b},7631:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PubAdsRefreshService=void 0;const s=i(125),n=i(7730),r=i(2727),o=i(1993),h=i(6319),a=i(2057);class d{constructor(t){var e,i;this.googletag=r.Utils.getExistsOrNewGoogletag(),this.apstag=window.apstag,this.pubAdsData=[],this.logger=new s.Logger("PubadsRefresh"),this.profile=n.Profiler.get(),this.config=t,this.pbjsInstanceName=this.config.customPbjsName||"pbjs",this.pbjsInstance=d.getPbjs(this.pbjsInstanceName);const o=h.DcsUtils.getCurrentPvsObject();this.pubAdsData=o&&o.data.pad||[],this.vendor=(null===(i=null===(e=n.Profiler.get())||void 0===e?void 0:e.siteInfo)||void 0===i?void 0:i.usingMagnite)?"magnite":"prebid"}static get(){if(d.instance)return d.instance;const t=this.getPubAdsRefreshConfig();return t&&(d.instance=new d(t))}static getPubAdsRefreshConfig(){let t;return t=n.Profiler.get().publisher.customRefresh?this.getCustomRefreshConfig():n.Profiler.get().siteInfo.usingMagnite?this.getMagniteConfig():n.Profiler.get().pubAdsRefresh,t}static getCustomRefreshConfig(){var t;return{active:!0,adIdType:"AD_UNIT",adIds:[],refreshCount:100,refreshRate:3e4,dfpOnly:!1,sendRefreshKV:!0,customPbjsName:(null===(t=n.Profiler.get().pubAdsRefresh)||void 0===t?void 0:t.customPbjsName)||"pbjs"}}static getMagniteConfig(){var t,e,i,s,r,o,h;const a=(null===(t=n.Profiler.get().pubAdsRefresh)||void 0===t?void 0:t.customPbjsName)||"pbjs",l=null===(e=d.getPbjs(a))||void 0===e?void 0:e.getConfig(),c=null===(s=null===(i=null==l?void 0:l.realTimeData)||void 0===i?void 0:i.dataProviders)||void 0===s?void 0:s.find((t=>"browsi"===t.name)),u=null===(o=null===(r=null==c?void 0:c.params)||void 0===r?void 0:r.rp)||void 0===o?void 0:o.nonBrowsiAds,p=this.getMagniteAdIds(u),{refreshRate:v}=u||{};if(p.length>0&&v){return{active:!0,adIdType:"AD_UNIT",adIds:p,refreshCount:(null===(h=n.Profiler.get().pubAdsRefresh)||void 0===h?void 0:h.refreshCount)||100,refreshRate:v,dfpOnly:!1,sendRefreshKV:!0,customPbjsName:a}}}static getMagniteAdIds(t){var e;let i=new Set;return null===(e=null==t?void 0:t.placements)||void 0===e||e.forEach((t=>{this.findMatchedSlots(t).forEach((t=>{i.add(t)}))})),Array.from(i)}static findMatchedSlots(t){var e,i;let s=[];const n=null===(i=null===(e=window.googletag)||void 0===e?void 0:e.pubads)||void 0===i?void 0:i.call(e).getSlots();return null==n||n.forEach((e=>{const i=e.getSlotElementId(),n=e.getAdUnitPath();this.isMatchAdUnitPattern(t,i,n)&&s.push(n)})),s}findMatchAd(t,e,i){if("magnite"===this.vendor){if(this.pbjsInstance&&this.pbjsInstance.rp){this.pbjsInstance.rp.adUnitPatterns.find((i=>d.isMatchAdUnitPattern(i,t,e)))?i.isValidMagnite=!0:(i.isValidMagnite=!1,this.logger.info("Couldn't find valid magnite match"))}}else this.pbjsInstance&&this.pbjsInstance.adUnits&&(i.adUnit=this.pbjsInstance.adUnits.find((i=>[e,t].includes(i.code))))}static isMatchAdUnitPattern(t,e,i){return!(t.divPattern&&!e.match(t.divPattern)||t.slotPattern&&!i.match(t.slotPattern))}preparePubadsRefresh(t,e){const i=this.findExistingAdData(e);i&&i.refreshInfo.active&&this.isAllowedLineItemId(e).then((()=>{this.runPreRefresh(e,i).then((()=>{i.refreshInfo.requested=!0,this.logger.info("preparing refresh for adData",i),this.pbjsInstance=d.getPbjs(this.pbjsInstanceName);const t=e.getAdUnitPath(),s=e.getSlotElementId();this.findMatchAd(s,t,i),this.refreshBid(i)}))})).catch((e=>{this.logger.error("pubadsRefresh rejected slot refresh:",e),"liIdBl"===e&&(i.refreshInfo.active=!1,o.EventsService.get().sendPubAdRefreshBlockedEvent(t.placementId,i.refreshInfo.count,t.positionType,e))}))}runPreRefresh(t,e){return new Promise(((i,s)=>{const n=r.Utils.getExternalFlowHandler("prePubadsRefresh");if(n){t.getSlotElementId(),e.refreshInfo.count;n(t,e,i,s)}else i()}))}refreshBid(t){if(!t.slot||!t.element)return!1;const e=this.getAdSize(t.element);return this.attachSizeMapping(e,t.slot),this.handleKVs(t),t.refreshInfo.count++,this.sendRefreshRequestEvent(t),this.googletag.cmd=this.googletag.cmd||[],this.googletag.cmd.push((()=>{const i=this.createHbPromise(t),s=this.createAmazonPromise(t.slot,e);Promise.all([i,s]).then((e=>{this.logger.debug(`refreshing dfp ${e}`),t.slot.setCollapseEmptyDiv(!1),googletag.pubads().refresh([t.slot])}))})),!0}handleKVs(t){const e=this.getTargeting(t.slot);t.slot.clearTargeting(),Object.keys(e).forEach((i=>{i.indexOf("hb_")+i.indexOf("amzn")===-2&&t.slot&&t.slot.setTargeting(i,e[i])})),this.config.sendRefreshKV&&t.slot.setTargeting("browsiRefresh","pubtrue");const i=n.Profiler.get().identity.supplyConfigId;t.slot.setTargeting("browsiLayout",i)}createHbPromise(t){const e=e=>!(!e||!t.adUnit&&!t.isValidMagnite||this.config.dfpOnly);return new Promise(((i,s)=>{const n=d.getPbjs(this.pbjsInstanceName);e(n)?(this.logger.debug("refreshing with pbjs"),n.que=n.que||[],n.que.push((()=>{"magnite"==this.vendor?n.rp?n.rp.requestBids({callback:()=>{i("magnite")},gptSlotObjects:[t.slot]}):i():t.adUnit&&n.requestBids({adUnitCodes:[t.adUnit.code],bidsBackHandler:()=>{t.slot&&(n.setTargetingForGPTAsync([t.adUnit.code]),i("pbjs"))}})}))):i()}))}createAmazonPromise(t,e){return new Promise((i=>{if(!this.apstag||"function"!=typeof this.apstag.fetchBids||this.config.dfpOnly)return i();{const s=t.getSlotElementId(),n={slotID:s,slotName:t.getAdUnitPath(),sizes:[[e.w,e.h]]};this.apstag.fetchBids({slots:[n]},(t=>{const e=t.find((t=>t.slotID===s));return this.logger.info("amazon bid: ",e),this.logger.apsLog(s,e),this.apstag.setDisplayBids(),i("amazon")}))}}))}handleRenderEnded(t){if(this.config.active){const e=this.findExistingAdData(t.slot);if(e)if(t.isEmpty)this.logger.debug("refresh for adData:",e,"returned empty. disabling refresh for this slot."),e.refreshInfo.active=!1;else{if(e.refreshInfo.requested)return this.logger.debug("refresh for adData:",e,"ended successfully"),e.refreshInfo.requested=!1,!0;this.logger.debug("adData:",e,"was forced refresh. disabling refresh for this slot."),e.refreshInfo.active=!1}}return!1}sendRefreshRequestEvent(t){t.viewabilityObject&&o.EventsService.get().sendPubAdRefreshRequest(t.viewabilityObject.root(),t.refreshInfo.count,"browsi")}findExistingAdData(t){return this.pubAdsData.find((e=>e.slot===t))}getOrCreateAdData(t,e,i){let s=this.findExistingAdData(t);return s||(s=this.createAdData(t,e)),s}getAdData(t,e,i){let s=this.findExistingAdData(t);if(this.checkConditions(t,s))return s||(s=this.createAdData(t,e)),s.viewabilityObject=i,s}createAdData(t,e){const i={slot:t,element:e,refreshInfo:{active:!0,requested:!1,count:0}};return this.pubAdsData.push(i),i}checkConditions(t,e){if(e&&!e.refreshInfo.active)return!1;const i=[];r.Utils.isCustomRefreshConfigured()||!this.isWhitelisted(t)&&i.push("not in whitelist"),e&&e.refreshInfo.count===this.config.refreshCount&&i.push(`refresh count ${e.refreshInfo.count} passed limit ${this.config.refreshCount}`);const s=!i.length;return this.logger.debug("checkConditions for",t.getSlotElementId(),"result ? ",s||i),s}isAllowedLineItemId(t){const e=n.Profiler.get();if(e.siteInfo.blockLineItemIds){const i=r.Utils.getRefreshAPIParams(t);if(0===Object.keys(i).length)return Promise.resolve();const s=Object.assign(Object.assign({},i),{sk:e.identity.siteKey,dt:"desktop"}),n=`//${e.yieldData.host}/bli?${r.Utils.toUrlParams(s)}`;return r.Utils.xhrPromise(n,"GET").then((t=>202===t.status?Promise.reject("liIdBl"):Promise.resolve()))}return Promise.resolve()}getViewabilityRefreshInfo(t,e,i,s){if(this.config&&this.config.active){const n=this.getAdData(i,t.element,e);return{shouldRefresh:()=>!(!n||!n.refreshInfo.active),rate:s||this.config.refreshRate,doRefresh:()=>{this.preparePubadsRefresh(t,i)}}}return e.refreshInfo}isWhitelisted(t){switch(this.config.adIdType){case"AD_UNIT":const e=t.getAdUnitPath();return this.config.adIds.includes(e);case"PLACEMENT":const i=t.getSlotElementId();return this.config.adIds.includes(i);case"MACRO":const s=a.default.get().getFoundPublisherAdData("dfp",t.getSlotElementId(),0,t);if(s&&s.plid)return this.config.adIds.includes(s.plid)}return!1}deactivate(){this.config.active=!1}getAdSize(t){let e=r.Utils.getDfpAdSize(t);return e||(e={size:r.Utils.getElementSize(t),element:t}),e.size}attachSizeMapping(t,e){const i=googletag.sizeMapping().addSize([0,0],r.Utils.isFluidSize(t)?["fluid"]:[t.w,t.h]).build();e.defineSizeMapping(i),this.logger.debug("attachedSizeMapping",i)}getTargeting(t){return t.getTargetingMap?t.getTargetingMap():t.getTargeting()}static getPbjs(t){return window[t]}getSlotWinner(t){const e=t.getHtml();return e.indexOf("renderAd")>-1?"prebid":e.indexOf("renderImp")>-1?"amazon":"dfp"}}e.PubAdsRefreshService=d},4269:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(125),n=i(514);e.default=class{constructor(t){this.resizeRAF=null,this.resizeListeners=[],this.isIE=null!=navigator.userAgent.match(/Trident/),this.resizeElement=t,this.obj=document.createElement("object"),this.logger=new s.Logger("ResizeListener"),this.logger.debug("set resize listener for",t)}resizeListener(t){this.resizeRAF&&window.cancelAnimationFrame(this.resizeRAF),this.resizeRAF=window.requestAnimationFrame((()=>{this.resizeListeners.forEach((e=>{e.call(this.obj,t)}))}))}objectLoad(){var t;const e=(null===(t=this.obj.contentDocument)||void 0===t?void 0:t.defaultView)||null;e&&(n.default.get().listen("resize",e,this.resizeListener.bind(this)),this.resizeListener.bind(this))}addResizeListener(t){this.resizeListeners.length||("static"==getComputedStyle(this.resizeElement).position&&(this.resizeElement.style.position="relative"),this.obj.setAttribute("style","display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -999;"),this.obj.onload=this.objectLoad.bind(this),this.obj.type="text/html",this.isIE&&this.resizeElement.appendChild(this.obj),this.obj.data="about:blank",this.isIE||this.resizeElement.appendChild(this.obj)),this.resizeListeners.push(t)}removeResizeListener(t){var e,i;t?null===(e=this.resizeListeners)||void 0===e||e.splice(this.resizeListeners.indexOf(t),1):this.resizeListeners=[],!this.resizeListeners.length&&(null===(i=this.obj.contentDocument)||void 0===i?void 0:i.defaultView)&&(this.obj.contentDocument.defaultView.removeEventListener("resize",this.resizeListener),this.resizeElement.removeChild(this.obj))}}},9235:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(125),n=i(3271),r=i(2727),o=i(9394),h=i(1128),a=i(7730),d=i(6319),l=i(3034),c=i(4603);class u{constructor(){this.profile=a.Profiler.get(),this.logger=new s.Logger("SAService"),this.spots=[],this.errorCallback=t=>this.logger.error(t),this.mainContentElements=this.profile.spotEngineConfig.mainContentConfig&&this.profile.spotEngineConfig.mainContentConfig.s?r.Utils.querySelectorAll(this.profile.spotEngineConfig.mainContentConfig.s,this.errorCallback):[],this.mainContentEndElement=this.profile.spotEngineConfig.mainContentConfig&&this.profile.spotEngineConfig.mainContentConfig.e?r.Utils.querySelector(this.profile.spotEngineConfig.mainContentConfig.e[0],this.errorCallback):null,this.stayAwayConfigs=this.convertSaConfig(this.profile.spotEngineConfig.stayAway||[]),this.maxSaDistance=this.stayAwayConfigs.reduce(((t,e)=>t.d({element:t.element,distance:t.distance,selector:t.selector,inMainContent:t.inMainContent,target:t.target})))}convertSaConfig(t){return t.length?this.updateSaConfigDistance(t).map((t=>Object.assign({v:t.v,d:t.d,t:t.t},t.iae?{adn:"manual_ad"}:{}))):t}updateSaConfigDistance(t){var e,i;const s=null===(e=this.profile.layouts.spots.dynamic)||void 0===e?void 0:e.distance,r=null===(i=this.profile.layouts.spots.rails)||void 0===i?void 0:i.distance;return t.filter((t=>t.dfl)).forEach((t=>{s&&t.t.includes(n.SATargets.MC)?(t.d=s,this.logger.debug("Selectors group:",t.v,"using layout inline distance:",t.d)):r&&(t.t.includes(n.SATargets.LEFT)||t.t.includes(n.SATargets.RIGHT))&&(t.d=r,this.logger.debug("Selectors group:",t.v,"using layout rails distance:",t.d))})),t}scanDomForSA(){this.logger.info("scanDomForSA"),this.upsertSaFromDcs(),this.stayAwayConfigs.forEach((t=>{t.v.forEach((e=>{const i=r.Utils.querySelectorAll([e],this.errorCallback);this.handleStayAwayConfig(i,t,e)}))}));const t=a.Profiler.get().domData;t&&(t.stayAwayElements=this.getStayAwayElementsList())}upsertSaFromDcs(){var t;let e=null===(t=a.Profiler.get().dcsState)||void 0===t?void 0:t.saObjects;const i=d.DcsUtils.getIfEndless();e=e||(null==i?void 0:i.pvs[i.count-1].data.sAE),e&&e.forEach((t=>{const e="__FROM LAST PV DCS__",i={sa:{element:t.element,distance:t.distance,selector:e},config:{d:0,v:[e],t:t.target}};this.upsertStayAwayElement(t.element,i,!1)}))}scanDomForLazySA(t,e,i){this.logger.info("re-scanning dom for SA");const s=r.Utils.getPositionFallback(t);this.stayAwayConfigs.forEach((t=>{t.v.forEach((n=>{const o=r.Utils.querySelectorAll([n],this.errorCallback).filter((n=>this.shouldStayAwayFrom(n,s,e,i,t.t)));this.handleStayAwayConfig(o,t,n,!0)}))}))}handleStayAwayConfig(t,e,i,s){t.map((t=>({sa:{element:t,distance:e.d,selector:i},config:e}))).forEach((t=>{this.upsertStayAwayElement(t.sa.element,t,!!s)}))}shouldStayAwayFrom(t,e,i,s,n){return-1!==this.mapSATarget(n).indexOf(s)&&(Math.abs(r.Utils.getPositionFallback(t)-e)<=this.maxSaDistance&&(!i||r.Utils.isDescendantElement(this.mainContentElements,t)))}upsertStayAwayElement(t,e,i){if(!["__FROM LAST PV DCS__","pubAd"].includes(e.config.v[0])&&!l.SpotsUtils.isValidHeightForSkipSa(t))return this.logger.debug(t,"is over 80% of page height, ignore it"),null;const s=this.isInMainContent(t);let n=this.stayAwayElements.find((e=>e.element===t));if(n)return this.updateSaElement(t,n,s),null;{const n=this.insertSaElement(t,e,i,s);return this.handleIfManualAd(e,n,i),void 0!==e.config.v?this.logger.debug(i?"Lazy ":"","Added",n,"By Config: ",e):this.logger.debug(i?"Lazy ":"","Added",n),n}}updateSaElement(t,e,i){const s=Object.assign({},e),n=this.isSaValid(t);!e.isValid&&n&&(e.isLazy=!0),e.top=this.getPositionFromTop(t),e.height=t.getBoundingClientRect().height,e.isValid=n,e.inMainContent=i,s.top===e.top&&s.height===e.height&&t.style.display===e.element.style.display||this.logger.debug("Updated: ",s," TO: ",e)}insertSaElement(t,e,i,s){const n=t.getBoundingClientRect(),r={element:t,top:this.getPositionFromTop(t),height:n.height,distance:e.sa.distance,isLazy:i,inMainContent:s,isValid:this.isSaValid(t),isPubAd:"pubAd"===e.config.v[0],target:e.config.t,selector:e.sa.selector};return this.stayAwayElements.push(r),r}mapSATarget(t){let e=[];return t.includes(n.SATargets.MC)&&e.push(h.SpotType.FIXED_MC,h.SpotType.DYNAMIC_MC),t.includes(n.SATargets.TOP)&&e.push(h.SpotType.FIXED_TOP),t.includes(n.SATargets.BOTTOM)&&e.push(h.SpotType.FIXED_BOTTOM),t.includes(n.SATargets.RIGHT)&&e.push(h.SpotType.DYNAMIC_RIGHT_RAIL,h.SpotType.FIXED_RIGHT_RAIL),t.includes(n.SATargets.LEFT)&&e.push(h.SpotType.DYNAMIC_LEFT_RAIL,h.SpotType.FIXED_LEFT_RAIL),e}getPositionFromTop(t){let e=0;return e=this.profile.spotEngineConfig.useNewStayAwayCalc?r.Utils.getPositionFallback(t):r.Utils.getElementPosition(t).top,e}isSaValid(t){return r.Utils.isVisible(t)&&!r.Utils.isPositionFixed(t)}validateSa(t){return!this.profile.spotEngineConfig.useNewStayAwayCalc||t.isValid}isElementContainedInSa(t,e){return!!this.profile.spotEngineConfig.useNewStayAwayCalc&&r.Utils.isPositionContained(t,e)}checkStayAwayViolation(t){if(t.tags.typeTag===c.TypeTag.FIXED&&this.profile.layouts.fixedSpotsFirst)return null;a.Profiler.get().spotEngineConfig.isLazySAActive&&(this.logger.debug("Checking SA from newly added elements (lazy)"),this.scanDomForLazySA(t.ref,t.type===h.SpotType.DYNAMIC_MC,t.type));const e=this.isStayAwayForAllEmbedTypes(t.ref,t.getCompatibleSizes(),t.type===h.SpotType.DYNAMIC_MC,t.type);return"invalid"===e.status?{reason:"stay_away",message:e.message}:null}isStayAwayForAllEmbedTypes(t,e,i,s){const n=r.Utils.getEmbedTypesFromSizes(e),o=n.includes("break"),h=n.includes("wrapped");if(o){let n=this.isStayAwayElement(t,i,s);if("invalid"===n.status)return n;if(h)return this.checkWrapSA(t,e,i,s)}else if(h)return this.checkWrapSA(t,e,i,s);return{status:"valid"}}checkWrapSA(t,e,i,s){let n,r=e.length;for(;r--;)if(n=this.removeViolatingWrappedEmbeddings(t,e[r],i,s),"invalid"===n.status&&e.splice(r,1),0===e.length)return n;return{status:"valid"}}removeViolatingWrappedEmbeddings(t,e,i,s){let n=e.optionalEmbeddings.indexOf("wrapped");if(n>-1){const r=this.isStayAwayElement(t,i,s,e);if("invalid"===r.status)return e.optionalEmbeddings.splice(n,1),e.selectedEmbedding&&(e.selectedEmbedding="break"),e.optionalEmbeddings.length>0?{status:"valid"}:r}return{status:"valid"}}isStayAwayElement(t,e,i,s){const n=this.stayAwayElements.find((n=>{if(n.isPubAd&&l.SpotsUtils.isFixedSpot(i)||-1===this.mapSATarget(n.target).indexOf(i))return!1;if(!this.validateSa(n)||!r.Utils.isElement(n.element))return!1;if(e&&!n.inMainContent)return!1;if(this.isElementContainedInSa(n.element,t))return!0;let o=r.Utils.calculateDistanceBetween(t,n.element);r.Utils.isPositionedAfter(t,n.element)&&(o+=r.Utils.getAdMarkingExpectedHeight());let a=0;r.Utils.isPositionedAfter(n.element,t)&&(a+=r.Utils.getWrappingOffset(t,n.element,h.SPOT_TAGS_MAP[i],s),a+=r.Utils.isPositionContained(t,n.element)?0:t.getBoundingClientRect().height);return o+a<=n.distance}));return this.getViolationStatus(n)}getViolationStatus(t){return t&&t.element?{status:"invalid",message:t.isPubAd?"pub_ad":"stay_away",element:t.element}:{status:"valid"}}isInMainContent(t){return r.Utils.isDescendantElement(this.mainContentElements,t)}handleIfManualAd(t,e,i){if(t.config.adn){if(r.Utils.getElementSize(t.sa.element).h<=25)return void this.logger.info("ignoring sa ad element, height <= 25",t.sa.element);const s=this.getManualAdId(t);e.isPubAd=!0;const n={element:t.sa.element,providerName:t.config.adn,placementId:s,adUnit:s,isLazyLoaded:i,isManualAd:!0};o.default.get().addIfNew(n)}}getManualAdId(t){return t.sa.element.id||t.sa.selector}}e.default=u},5879:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SRAResponseManager=void 0;const s=i(1128),n=i(125),r=i(2727);e.SRAResponseManager=class{constructor(t,e){this.logger=new n.Logger("SRAResponseManager"),this.response=t,this.allowedIndexesByType={}}updateResponse(t){r.Utils.mergeDeep(this.response,t)}pop(t,e){const i=t.selector,s=this.getAllowedIndexes(t.type,i);return s.adIndex<=t.adIndex?(t.demandIndex=s.demandIndex,r.Utils.getLazySpotsInstance().unsubscribe(t),s.demandIndex++,s.adIndex=t.adIndex,this.logger.info(`${t.type} spot ${t.typeIndex} matched demand ${t.demandIndex}`,e),e):(this.logger.info(`Couldn't match ${t.type} spot ${t.typeIndex} to response`,e),null)}peek(t){var e;const i=this.getResponseGroupByType(t.type),s=t.selector,n=this.getAllowedIndexes(t.type,s).demandIndex,r=this.isFixedResponseGroup(i,s)?i[s][n]:i[n];return r?(r.od=this.getPrediction(t),t.adUnit=this.isHBDemandConfig(r.c)?null===(e=r.c.d)||void 0===e?void 0:e.aup:r.c.aup||"NA",r):(this.logger.debug(`No available demand response for ${t.type} spot ${t.typeIndex}`),null)}isHBDemandConfig(t){return!!t.d}getAllowedIndexes(t,e){return this.allowedIndexesByType[t]=this.allowedIndexesByType[t]||{},e=e||"dynamic",this.allowedIndexesByType[t][e]=this.allowedIndexesByType[t][e]||{demandIndex:0,adIndex:0},this.allowedIndexesByType[t][e]}getResponseGroupByType(t){switch(t){case s.SpotType.FIXED_BOTTOM:return this.response.fb;case s.SpotType.FIXED_TOP:return this.response.ft;case s.SpotType.API:return this.response.ac;case s.SpotType.DYNAMIC_LEFT_RAIL:case s.SpotType.DYNAMIC_RIGHT_RAIL:return this.response.dr;case s.SpotType.FIXED_LEFT_RAIL:case s.SpotType.FIXED_RIGHT_RAIL:return this.response.fr;case s.SpotType.DYNAMIC_MC:return this.response.c;case s.SpotType.FIXED_MC:return this.response.fc;default:return{}}}isFixedResponseGroup(t,e){return!!e}getPrediction(t){return this.response.ods&&this.response.ods[t.adIndex]}}},4869:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ViewabilityService=void 0;const s=i(125),n=i(2727),r=i(9792),o=i(7631),h=i(2283),a=i(1993);class d{constructor(){this.logger=new s.Logger("Viewability"),this.isHidden=!1,this.ads=[]}static get(){return d._instance||(this._instance=new d),d._instance}subscribe(t){this.removePublisherAdDuplicate(t),this.insert(t)}insert(t){this.ads.push(t),this.initViewabilityCheck(t)}removePublisherAdDuplicate(t){var e,i;if(1!==t.type)return;const s=t.root(),n=this.ads.findIndex((t=>s&&s.placementId===t.root().placementId));if(-1!=n){const t=this.ads.splice(n,1)[0];null===(e=t.observer)||void 0===e||e.clearObserver(),null===(i=t.observer)||void 0===i||i.clearAllTimeouts()}}initViewabilityCheck(t){const e=t.inViewActionsMap,i=Object.keys(e).map(Number);t.observer=new r.default(t.element,t.conf.minViewInitiator/100,i,(e=>{this.onAdIsInView(t,e)})),t.observer.observe().then((()=>{t.refreshObserver||this.removeFromAdsArray(t)}))}observeCustomRefresh(t,e){t.refreshObserver=new r.default(t.element,t.conf.minViewInitiator/100,[e],(e=>{this.handleRefresh(t,e)})),t.refreshObserver.observe().then((()=>{this.removeFromAdsArray(t)}))}onAdIsInView(t,e){const i=t.inViewActionsMap[e];i.includes("refresh")&&this.handleRefresh(t,e);i.includes("event")&&(this.logger.info(t.element,`with threshold ${t.conf.minViewInitiator}% is in view for ${e} perform "event" action`),t.sendViewedImpression(n.Utils.getPercentageInView(t.element),e/1e3))}handleRefresh(t,e){var i,s,n,r,o,h;(null===(i=t.refreshInfo)||void 0===i?void 0:i.shouldRefresh())&&e>=t.refreshInfo.rate&&(this.logger.info(t.element,"has been in view for",e,"ms. Starting to refresh"),null===(s=t.observer)||void 0===s||s.clearObserver(),null===(n=t.observer)||void 0===n||n.clearAllTimeouts(),null===(r=t.refreshObserver)||void 0===r||r.clearObserver(),null===(o=t.refreshObserver)||void 0===o||o.clearAllTimeouts(),null===(h=t.refreshInfo)||void 0===h||h.doRefresh())}removeFromAdsArray(t){const e=this.ads.indexOf(t);e>-1&&this.ads.splice(e,1)}inViewPercentage(t,e){const i=e||n.Utils.getScrollPosition(),s=t.getCoords().top,r=t.getHeight();if(i.top<=s&&i.bottom>s){const t=i.bottom-s;return 100*Math.min(Number(t/r),1)}if(i.top>s&&i.tope.root()===t));e&&(this.unObserveAd(e),this.removeFromAdsArray(e))}addActionToMap(t,e,i){return e.forEach((e=>{i[e]=i[e]||[],i[e].push(...t)})),i}unObserveAd(t){var e;null===(e=t.observer)||void 0===e||e.clearObserver()}handleCustomRefreshResponse(t){const e=this.getViewabilityAdObject(t.id),i=t.rr,s=1===(null==e?void 0:e.type)?"publisher":"browsi";a.EventsService.get().sendCustomRefreshRateEvent(s,i),e?(this.logger.debug("get refresh rate returned",t,"matched to ad",e),i>0?this.setCustomRefresh(e,i):(0===e.type&&e.root().stopRefreshing(),this.logger.info("get refresh rate returned",t,"disabling refresh for this ad:",h.CUSTOM_REFRESH_RESPONSES_MAP[t.rr]))):this.logger.info("get refresh rate returned",t,"didnt matched to exist ad")}setCustomRefresh(t,e){var i;if(0===t.type){const i=t.root();i.refresh=Object.assign(i.refresh,{active:!0,rate:e,limit:0,noDemandRefresh:!1}),t.refreshInfo=i.getCustomRefreshInfo(e)}else if(1===t.type){const s=t.root();s.slot&&(t.refreshInfo=null===(i=o.PubAdsRefreshService.get())||void 0===i?void 0:i.getViewabilityRefreshInfo(s,t,s.slot,e))}this.observeCustomRefresh(t,e)}getViewabilityAdObject(t){return this.ads.find((e=>e.element.id===t))}}e.ViewabilityService=d},6393:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.YieldClient=void 0;const s=i(125),n=i(7730),r=i(2727),o=i(1128),h=i(1528),a=i(8712),d=i(514),l=i(9235),c=i(1993),u=i(6319),p=i(6258),v=i(5857);class f{constructor(){this.logger=new s.Logger("YieldClient"),this.profile=n.Profiler.get()}static get(){return f.instance||(f.instance=new f),f.instance}handleSpots(t){l.default.instance.setSpots(t);const e=this.profile.layouts.analysisMode;t.length&&!e&&(this.runPreDemand(t),this.processSpots(t))}runPreDemand(t){const e=r.Utils.getExternalFlowHandler("onPreDemand");e&&e(t)}runPostDemand(t,e){const i=r.Utils.getExternalFlowHandler("onPostDemand");i&&i(t,e)}processSpots(t){if(t.length){const e=t.some((t=>t.type===o.SpotType.DYNAMIC_MC)),i=v.InframeManager.get();e&&i.isInframeConfigured()&&(i.addPotentialSpots(t),i.sendPotentialSpots()),this.getDemand(t,h.DemandRequestType.SRA)}}processSingleSpot(t){this.logger.info("attemptIndex",t.attemptIndex),this.getDemand([t],h.DemandRequestType.SINGLE)}getDemandCallback(t,e){t&&this.runPostDemand(t,e),t&&"SRA"===t.rt&&this.logger.info("getDemand returned SRA response ",t),e.forEach((i=>{if(!t&&!(t=i.handleEmptyResponse()))return this.logger.info(`getDemand returned empty, waterfall ended for spot ${i.adIndex}`),void i.closePlaceholderAndRemove();i.attemptIndex>=2&&p.ProviderFactory.setSpotProviderName(t,i),i.shouldWaitForUserEngagement()?this.waitForUserEngagement().then((()=>a.DemandManager.get().processResponse(i,t,e))):a.DemandManager.get().processResponse(i,t,e)}))}nextWaterfallStep(t){if(t.isRefreshing())t.handleRefreshFailed();else{if(t.attemptIndex++,t.attemptIndex>2)return this.getDemandCallback(null,[t]);this.processSingleSpot(t)}}waitForUserEngagement(){return new Promise((t=>{const e=()=>{this.logger.info("detected scroll, fetching"),d.default.get().removeListener("scroll",r.Utils.getScrollElement(),e),this.profile.isUserEngaged=!0,t()};d.default.get().listen("scroll",r.Utils.getScrollElement(),e)}))}getDemand(t,e){let i="";switch(e){case h.DemandRequestType.SRA:i=this.buildGetSRADemandUrl(t);break;case h.DemandRequestType.SINGLE:if(1===t.length){const e=t[0];i=this.buildGetDemandUrl(e)}else this.logger.error("Error while creating getDemand script tag: Invalid spots list",t)}i?this.getDemandXhrRequest(i,t):this.logger.error("error building demand url",t)}getDemandXhrRequest(t,e){this.profile.layouts.analysisMode||r.Utils.xhrPromise(t,"GET").then((i=>{var s,n,r;if(204===i.status)this.getDemandCallback(null,e);else if(202===i.status)this.handleRefreshBlocked(e[0]);else if(200===i.status){const t=JSON.parse(i.responseText),o=this.convertDemand(t);1===e.length&&(null===(s=e[0].refresh)||void 0===s?void 0:s.isGenericRefresh())?null===(r=(n=e[0].genericParams).refresh)||void 0===r||r.call(n,o):(v.InframeManager.get().isInframeConfigured()&&"SRA"===t.rt&&v.InframeManager.get().setTotalVideosToEmbedCount(o),this.getDemandCallback(o,e))}else c.EventsService.get().sendErrorEvent("xhr_promise_error",t,"get demand failed"),this.logger.error(`Error on get demand. url:${t},spots ${e}`)})).catch((e=>{c.EventsService.get().sendErrorEvent("xhr_promise_error",t,(null==e?void 0:e.message)||"get demand failed"),this.logger.error("get demand failed",e)}))}convertDemand(t){return function(t){return"SRA"===t.rt}(t)?this.convertSRADemand(t):this.convertSingleDemand(t)}convertSRADemand(t){const e=t=>{const e={};for(let i in t)e[i]=this.convertSingleDemand(t[i]);return e},i=t=>{const e={};for(let i in t){e[i]={};for(let s in t[i])e[i][s]=this.convertSingleDemand(t[i][s])}return e};return{rt:"SRA",ods:(t=>{const e={};for(let i in t)e[i]={50:t[i]};return e})(t.ps),c:t.c.c?e(t.c.c):{},fc:t.c.fc?i(t.c.fc):{},ft:t.c.ft?i(t.c.ft):{},fb:t.c.fb?i(t.c.fb):{},fr:t.c.fr?i(t.c.fr):{},dr:t.c.dr?e(t.c.dr):{},ac:t.c.ac?e(t.c.ac):{}}}convertSingleDemand(t){var e;let i=Object.assign(Object.assign({rt:"header_bidding"===t.rt?"header_bidding":"provider",plk:t.plk},t.p?{od:{50:t.p}}:{}),{szs:t.c.szs});return"header_bidding"===t.rt?(i.c=Object.assign({if:t.c.if,t:t.c.hb?t.c.hb.t:(null===(e=t.c.tam)||void 0===e?void 0:e.t)||0,ri:{kv:!0,do:!1,r:t.c.rr||-1,l:t.c.mr||0,nd:!!t.c.ndr}},t.c.hb?{b:t.c.hb.b.map((t=>Object.assign(Object.assign({},t.a?{a:t.a}:{}),{bc:{bidder:t.c,params:t.p}})))}:{}),t.c.gam&&(i.c.d=s())):i.c=s(),i;function s(){const e="generic_js"===t.rt;return Object.assign(Object.assign({a:Object.assign(Object.assign({upc:"true",do:"true",autoSize:"true"},e?{url:t.c.u,withCallback:t.c.c?"true":"false",isJS:t.c.js?"true":"false",template:t.c.tm}:{}),{inIFrame:t.c.if?"true":"false"})},t.c.tam?{tam:{adServer:t.c.tam.a,pubID:t.c.tam.p,slotName:t.c.tam.s||t.c.gam.au,timeout:t.c.tam.t,simplerGPT:!!t.c.tam.sgpt}}:{}),e?{p:"generic_js",aup:t.c.au||"",ri:{kv:!0,do:!1,r:t.c.rr||-1,l:t.c.mr||0,nd:!!t.c.ndr},t:t.c.t,pgkv:t.c.slt?n(t.c.slt):{}}:{aup:t.c.gam.au,ri:{kv:!0,do:!1,r:t.c.rr||-1,l:t.c.mr||0,nd:!!t.c.ndr},p:"dfp",pgkv:t.c.gam?n(t.c.gam.t):{}})}function n(t){const e={};return t.forEach((t=>{e[t.k]={v:t.v,j:t.j}})),e}}buildGetSRADemandUrl(t){let e=n.Profiler.get(),i=Object.assign(Object.assign(Object.assign({},this.getRequestGenericData(t[0].isDcs,e)),this.buildPotentialSpotsParams(t)),{ac:u.DcsUtils.getDcsActionCounter()});return`//${e.siteInfo.demandHost}/sra/desktop?${r.Utils.toUrlParams(i)}`}buildGetDemandUrl(t){let e=n.Profiler.get(),i=Object.assign(Object.assign(Object.assign({},this.buildAdData(t)),this.getRequestGenericData(t.isDcs,e)),{ac:u.DcsUtils.getDcsActionCounter()});return`//${e.siteInfo.demandHost}/single/desktop?${r.Utils.toUrlParams(i)}`}getRequestGenericData(t,e){const i=Object.assign({sk:e.identity.siteKey,pk:e.identity.publisherKey,pvid:e.identity.pageviewId,aid:e.identity.articleId,sid:e.identity.sessionId,mch:r.Utils.getMainContentSize(e.domData),uid:r.Utils.getUserID(),pu:r.Utils.getPageUrl(),pl:r.Utils.getPageHeight(),d:t,sh:r.Utils.getScreenSize().h,lid:e.identity.supplyConfigId,ts:e.yieldData.trafficSource,cc:e.yieldData.countryCode,ir:e.yieldData.isReturningUser,ul:r.Utils.getScrollingDistance(),do:e.deviceDetails.os,dd:e.deviceDetails.device,dp:e.deviceDetails.deviceType,dt:e.deviceDetails.deviceType,db:e.deviceDetails.browser},"number"==typeof e.layouts.lazySpots.threshold?{lt:e.layouts.lazySpots.threshold}:{}),s=r.Utils.getUrlQueryParams();return s.length>0&&(i.qp=s),i}buildAdData(t){var e;const i=Object.assign({if:t.attemptIndex>1,ai:t.adIndex,f:r.Utils.getElementFoldNumber(t.ref),rc:t.refresh.count,ll:t.isLazyLoading,st:t.type,et:t.getExpectedEmbedding(),al:r.Utils.getElementPosition(t.ref).top,di:t.demandIndex,pt:t.positionTypeToString()},r.Utils.getRefreshAPIParams(t.slot,t.genericParams.gamInfo));return t.type===o.SpotType.API&&(i.div=t.ref.id,i.au=null===(e=t.options)||void 0===e?void 0:e.adUnit),t.selector&&(i.s=t.selector),i}buildPotentialSpotsParams(t){let e={};return t.map(((i,s)=>{const n=this.buildSRAPotentialSpot(i);for(let i in n)e[i]=e[i]||[],e[i].push(n[i]),s+1===t.length&&(e[i]=e[i].join("||"))})),e}buildSRAPotentialSpot(t){return{ais:t.adIndex,fs:r.Utils.getElementFoldNumber(t.ref),lls:t.isLazyLoading,sts:t.type,ets:t.getExpectedEmbedding(),als:r.Utils.getElementPosition(t.ref).top,pts:t.positionTypeToString(),ss:t.selector,dis:t.demandIndex}}handleRefreshBlocked(t){t.refresh.active=!1,c.EventsService.get().sendAdBlockedEvent(t,[{reason:"liIdBl"}])}}e.YieldClient=f},125:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Logger=e.LogTypes=void 0,function(t){t.DEBUG="debug",t.INFO="info",t.WARN="warn",t.ERROR="error",t.TABLE="table",t.CUSTOM="custom"}(e.LogTypes||(e.LogTypes={}));e.Logger=class{constructor(t){var e,i;this.loggerSubject=t,this.isActive=!!(null===(e=window._middyo)||void 0===e?void 0:e.debug),this.logsToHide=(null===(i=window._middyo)||void 0===i?void 0:i.hideLogs)||[]}debug(...t){this.logMessage("debug",t)}info(...t){this.logMessage("info",t)}error(...t){this.logMessage("error",t)}warn(...t){this.logMessage("warn",t)}table(t){if(this.isActive)try{console.table(t)}catch(e){this.info("Table fallback: ",t)}}custom(t,e,...i){const s=[{msg:t,style:e,args:i}];this.logMessage("custom",s)}logMessage(t,e){this.isActive&&(this.hideLog()||("custom"!==t?console[t](`[${this.loggerSubject}]`,...e):console.info(`%c[${this.loggerSubject}] ${e[0].msg}`,e[0].style,e[0].args)))}logWaterfallDetails(t,e,i){t.waterfall=t.waterfall||[];const s="x:"+t.ref.getBoundingClientRect().left+", y:"+t.offsetTop;let n=t.selectedSize?`${t.selectedSize.w}x${t.selectedSize.h}`:"null";"header_bidding"===e.rt?t.waterfall.push({provider:e.rt,adIndex:t.adIndex,adUnit:"-",size:n,position:s,isLazy:t.isLazyLoading,status:i}):(e.c=e.c,t.waterfall.push({provider:t.genericParams.displayName||t.providerName||e.c.p,adIndex:t.adIndex,adUnit:e.c.aup,size:n,position:s,isLazy:t.isLazyLoading,status:i})),this.info("Waterfall Table:"),this.table(t.waterfall)}hbLog(t,e,i,s){if(this.isActive){this.info(`auction result ${e}, winner: %c${s&&s.bidder||"None"}`,"color:green;font-size:20px");const n=t.map((t=>({bidder:t.bidder,cpm:t.cpm,size:`${t.width}x${t.height}`,currency:t.currency}))),r=i.map((t=>({bidder:t.bidder,cpm:-1,size:"NA",currency:"NA"})));this.table(n.concat(r))}}apsLog(t,e){this.isActive&&(console.group(`${t} result %c[aps]`,"color:green;font-size:20px"),this.table([e]),console.groupEnd())}hideLog(){return this.logsToHide.indexOf(this.loggerSubject)>-1||this.logsToHide.indexOf("*")>-1}}},3034:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SpotsUtils=e.FIXED_TYPES=e.FIXED_RAIL_TYPES=e.DYNAMIC_RAIL_TYPES=void 0;const s=i(2727),n=i(1128),r=i(7730),o=i(125),h=i(7463);e.DYNAMIC_RAIL_TYPES=[n.SpotType.DYNAMIC_LEFT_RAIL,n.SpotType.DYNAMIC_RIGHT_RAIL],e.FIXED_RAIL_TYPES=[n.SpotType.FIXED_LEFT_RAIL,n.SpotType.FIXED_RIGHT_RAIL],e.FIXED_TYPES=[n.SpotType.FIXED_MC,n.SpotType.FIXED_TOP,n.SpotType.FIXED_BOTTOM,...e.FIXED_RAIL_TYPES];let a=(()=>{class t{static getConf(t){if(this.allSpotsConfigs||(this.allSpotsConfigs=this.buildTypesConf()),t.oldType===n.SpotType.API){const e=this.allSpotsConfigs[n.SpotType.API];return e?e[t.positionTag]:void 0}return this.allSpotsConfigs[t.oldType]}static rebuild(){this.allSpotsConfigs=this.buildTypesConf()}static isActive(t){switch(t.oldType){case n.SpotType.DYNAMIC_MC:case n.SpotType.FIXED_MC:case n.SpotType.FIXED_BOTTOM:case n.SpotType.FIXED_TOP:case n.SpotType.DYNAMIC_LEFT_RAIL:case n.SpotType.DYNAMIC_RIGHT_RAIL:case n.SpotType.FIXED_LEFT_RAIL:case n.SpotType.FIXED_RIGHT_RAIL:{const e=this.getConf(t);return!!e&&0!==e.maxSpots}default:return!!this.getConf(t)}}static isFixedSpot(t){return e.FIXED_TYPES.includes(t)}static getElementsByType(i,o){var h,a,d;if(i===n.SpotType.DYNAMIC_MC){const t=r.Profiler.get().domData;return t?r.Profiler.getPotentialSpots(r.Profiler.get().spotEngineConfig.targetSelectors,t.mainContent.inputElements,t.mainContent.borderElement):[]}const l=s.Utils.sortElementsByPosition(...s.Utils.querySelectorAll(o,t.errorCallback,this.isRailSpot(i)));return e.DYNAMIC_RAIL_TYPES.includes(i)?r.Profiler.collectTargetElements((null===(d=null===(a=null===(h=r.Profiler.get().spotEngineConfig.rails)||void 0===h?void 0:h.ts)||void 0===a?void 0:a.ts)||void 0===d?void 0:d.e)||[],l):l}static getDcsApiElements(t){const e=r.Profiler.get().domData;return e?r.Profiler.getPotentialSpots(r.Profiler.get().spotEngineConfig.targetSelectors,t,e.mainContent.borderElement):[]}static updateMCSpotsElements(){[n.SPOT_TAGS_MAP[n.SpotType.DYNAMIC_MC],n.SPOT_TAGS_MAP[n.SpotType.FIXED_MC]].forEach((t=>{const e=this.getConf(t);e&&(e.elements=this.getElementsByType(t.oldType,e.targetElements))}))}static isRailSpot(t){return this.getRailsTypes().includes(t)}static getRailsTypes(){return[...e.DYNAMIC_RAIL_TYPES,...e.FIXED_RAIL_TYPES]}static getAllScanTypes(){return[n.SpotType.DYNAMIC_MC,...e.FIXED_TYPES,...e.DYNAMIC_RAIL_TYPES]}static getAllTypes(){return[n.SpotType.DYNAMIC_MC,n.SpotType.STICKY,n.SpotType.API,...e.FIXED_TYPES,...e.DYNAMIC_RAIL_TYPES]}static getTagsToScanBeforeDcs(){return[n.SPOT_TAGS_MAP[n.SpotType.STICKY],n.SPOT_TAGS_MAP[n.SpotType.FIXED_TOP],...n.RAILS_TAGS].filter((t=>this.isActive(t)))}static getTypesToDisableOnDcs(t){var e,i,o;const h=s.Utils.getLoaderParams(),a=(null===(e=r.Profiler.get().spotEngineConfig.dcs)||void 0===e?void 0:e.rescanRails)||(null===(o=null===(i=null==h?void 0:h.sec)||void 0===i?void 0:i.dcs)||void 0===o?void 0:o.r);return["end_less","script"].includes(t)&&a?[n.SpotType.STICKY]:[n.SpotType.STICKY,...this.getRailsTypes()]}static getOptimizeViewabilityTypes(){return[n.SpotType.DYNAMIC_MC,n.SpotType.API,...e.FIXED_TYPES,...e.DYNAMIC_RAIL_TYPES]}static getCompatibleSizesByType(t,e,i,s){var o,h;let a=[];switch(t){case n.SpotType.FIXED_MC:a=i&&i.length?i:(null===(o=r.Profiler.get().domData)||void 0===o?void 0:o.dynamicCompatibleSizes)||[];break;case n.SpotType.DYNAMIC_MC:return(null===(h=r.Profiler.get().domData)||void 0===h?void 0:h.dynamicCompatibleSizes)||[];default:a=i}return this.buildAdSizes(e,a,t,s)}static buildAdSizes(t,e,i,s){var n;let o=[];const h=!!(null===(n=this.getSpotParams(i))||void 0===n?void 0:n.allowOverflowContainer);return t.forEach((t=>{if(0===e.length)return;const n=r.Profiler.getWidthForEmbed(t),a=r.Profiler.buildAdSizes(n,e,!0,!1,s,i,h);e=e.filter((t=>!a.find((e=>e.h===t.h&&e.w===t.w)))),o=o.concat(a)})),o}static getSpotParams(t){const e=r.Profiler.get();switch(t){case n.SpotType.FIXED_MC:return e.layouts.spots.fixedMC;case n.SpotType.FIXED_BOTTOM:return e.layouts.spots.fixedBottom;case n.SpotType.FIXED_TOP:return e.layouts.spots.fixedTop;case n.SpotType.DYNAMIC_MC:return e.layouts.spots.dynamic;case n.SpotType.STICKY:return e.layouts.spots.sticky;case n.SpotType.FIXED_RIGHT_RAIL:case n.SpotType.FIXED_LEFT_RAIL:case n.SpotType.DYNAMIC_RIGHT_RAIL:case n.SpotType.DYNAMIC_LEFT_RAIL:return e.layouts.spots.rails}}static getBrowsiAdsStayAwayDistance(t){var e;return(null===(e=this.getConf(t))||void 0===e?void 0:e.distance)||0}static buildTypesConf(){return{fixed_mc:this.generateFixedConfig(n.SpotType.FIXED_MC),fixed_top:this.generateFixedConfig(n.SpotType.FIXED_TOP),fixed_bottom:this.generateFixedConfig(n.SpotType.FIXED_BOTTOM),dynamic_mc:this.generateDynamicInContentConfig(),sticky:this.generateStickyConfig(),fixed_right_rail:this.generateFixedRailsConfig(n.SpotType.FIXED_RIGHT_RAIL),fixed_left_rail:this.generateFixedRailsConfig(n.SpotType.FIXED_LEFT_RAIL),dynamic_right_rail:this.generateRailsConfig(n.SpotType.DYNAMIC_RIGHT_RAIL),dynamic_left_rail:this.generateRailsConfig(n.SpotType.DYNAMIC_LEFT_RAIL),api:r.Profiler.get().layouts.spots.api}}static generateDynamicInContentConfig(){const t=r.Profiler.get().layouts.spots.dynamic;if(!t)return;const e=this.getTargetElements(n.SpotType.DYNAMIC_MC),i=this.getElementsByType(n.SpotType.DYNAMIC_MC,e),s=t.maxItems||0;return{targetElements:e,elements:i,allowedCreativeSizes:this.getCompatibleSizesByType(n.SpotType.DYNAMIC_MC,i,t.allowedCreativeSizes,t.wrapperStyle),maxItems:s||0,maxSpots:Math.max(s,t.potentialSpots||0),lazyLoading:t.lazyLoading,lazyLoadingBuckets:t.lazyLoadingBuckets,startInFold:t.startInFold,stopInFold:t.stopInFold,engagedUsers:t.engagedUsers,distance:t.distance||0,viewabilityThreshold:t.viewabilityThreshold,style:t.style,wrapperStyle:t.wrapperStyle,startInFoldSelectors:t.startInFoldSelectors,allowOverflowContainer:t.allowOverflowContainer,avoidCLS:t.avoidCLS}}static generateFixedConfig(t){if(t!=n.SpotType.FIXED_MC&&t!=n.SpotType.FIXED_BOTTOM&&t!=n.SpotType.FIXED_TOP)return;let e;if(e=this.getSpotParams(t),!e)return;const i=this.getTargetElements(t),s=this.getElementsByType(t,i),r=s.length;return{targetElements:i,elements:s,wrapperStyle:e.wrapperStyle,allowedCreativeSizes:this.getCompatibleSizesByType(t,s,e.allowedCreativeSizes,e.wrapperStyle),maxSpots:r,maxItems:r,lazyLoading:e.lazyLoading,lazyLoadingBuckets:e.lazyLoadingBuckets,startInFold:e.startInFold,stopInFold:e.stopInFold,engagedUsers:e.engagedUsers,viewabilityThreshold:e.viewabilityThreshold,targetElementPosition:e.targetElementPosition,style:e.style,startInFoldSelectors:e.startInFoldSelectors,allowOverflowContainer:e.allowOverflowContainer,avoidCLS:e.avoidCLS}}static generateFixedRailsConfig(t){const e=r.Profiler.get().layouts.spots.rails,i=this.generateRailsConfig(t,!0);if(i)return Object.assign({},i,{targetElementPosition:e.targetElementPosition})}static generateRailsConfig(t,e){const i=r.Profiler.get().layouts.spots.rails;if(!i||!this.isValidRailsConf(t))return;const s=this.getTargetElements(t),n=this.getElementsByType(t,s),o=e?n.length:i.maxItems||0;return{targetElements:s,elements:n,allowedCreativeSizes:this.getCompatibleSizesByType(t,n,i.allowedCreativeSizes,i.wrapperStyle),maxSpots:Math.max(o,i.potentialSpots||0),maxItems:o,lazyLoading:i.lazyLoading,lazyLoadingBuckets:i.lazyLoadingBuckets,startInFold:i.startInFold,stopInFold:i.stopInFold,engagedUsers:i.engagedUsers,distance:i.distance,viewabilityThreshold:i.viewabilityThreshold,railSide:i.railSide,style:i.style,wrapperStyle:i.wrapperStyle,allowOverflowContainer:i.allowOverflowContainer}}static generateStickyConfig(){const t=this.getSpotParams(n.SpotType.STICKY);if(t)return{location:t.location,allowedCreativeSizes:t.allowedCreativeSizes,closeButton:t.closeButton,style:t.style,wrapperStyle:t.wrapperStyle,useOriginalSizes:t.useOriginalSizes,allowOverflowContainer:t.allowOverflowContainer}}static getTargetElements(t){var e,i,s,o,a,d,l,c,u,p,v;const f=r.Profiler.get().spotEngineConfig,m=f.rails,g=f.mainContentConfig,b=r.Profiler.get().layouts;let w;switch(t){case n.SpotType.FIXED_BOTTOM:w=null===(e=b.spots.fixedBottom)||void 0===e?void 0:e.targetElements;break;case n.SpotType.FIXED_TOP:w=null===(i=b.spots.fixedTop)||void 0===i?void 0:i.targetElements;break;case n.SpotType.FIXED_MC:w=null===(s=b.spots.fixedMC)||void 0===s?void 0:s.targetElements;break;case n.SpotType.DYNAMIC_LEFT_RAIL:w=null===(a=null===(o=null==m?void 0:m.ts)||void 0===o?void 0:o.ts)||void 0===a?void 0:a.l;break;case n.SpotType.DYNAMIC_RIGHT_RAIL:w=null===(l=null===(d=null==m?void 0:m.ts)||void 0===d?void 0:d.ts)||void 0===l?void 0:l.r;break;case n.SpotType.FIXED_LEFT_RAIL:(null===(c=b.spots.rails)||void 0===c?void 0:c.railSide.includes(h.RailsSides.LEFT))&&(w=null===(u=b.spots.rails)||void 0===u?void 0:u.targetElements);break;case n.SpotType.FIXED_RIGHT_RAIL:(null===(p=b.spots.rails)||void 0===p?void 0:p.railSide.includes(h.RailsSides.RIGHT))&&(w=null===(v=b.spots.rails)||void 0===v?void 0:v.targetElements);break;case n.SpotType.DYNAMIC_MC:w=null==g?void 0:g.s}return w||[]}static getViewabilityThreshold(e){var i;return(null===(i=t.getConf(e))||void 0===i?void 0:i.viewabilityThreshold)||null}static isValidRailsConf(t){const e=r.Profiler.get(),i=e.layouts.spots.rails,s=e.spotEngineConfig.rails;switch(t){case n.SpotType.DYNAMIC_LEFT_RAIL:return!!(i&&(null==s?void 0:s.sd)&&(null==i?void 0:i.railSide.includes(h.RailsSides.LEFT)));case n.SpotType.DYNAMIC_RIGHT_RAIL:return!!(i&&(null==s?void 0:s.sd)&&(null==i?void 0:i.railSide.includes(h.RailsSides.RIGHT)));case n.SpotType.FIXED_LEFT_RAIL:return!!(i&&i.railSide.includes(h.RailsSides.LEFT)&&i.targetElements);case n.SpotType.FIXED_RIGHT_RAIL:return!!(i&&i.railSide.includes(h.RailsSides.RIGHT)&&i.targetElements);default:return!1}}static shouldLazyLoad(t){return t.optimizeViewability&&s.Utils.getLazySpotsInstance().isLazy(t)}static getLazyBucketsConf(t){var e;return null===(e=this.getConf(t))||void 0===e?void 0:e.lazyLoadingBuckets}static getTargetElementPosition(e){var i;return(null===(i=t.getConf(e))||void 0===i?void 0:i.targetElementPosition)||"ABOVE"}static isValidHeightForSkipSa(t){const e=s.Utils.getPageHeight();return s.Utils.getElementSize(t).h<.8*e}}return t.logger=new o.Logger("SpotsUtils"),t.errorCallback=e=>t.logger.error(e),t})();e.SpotsUtils=a},2727:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Utils=void 0;const s=i(1993),n=i(9527),r=i(7730),o=i(9235),h=i(6319),a=i(1128),d=i(3034),l=i(3006),c=i(7590),u=i(125),p=i(6580),v=i(5310);let f=(()=>{class t{static getBrowsiTag(){return window.browsitag||null}static buildBrowsiOutput(e){var i,n;if(e.debugMode){const r=e.identity.pageviewId,h=Object.assign(e||{},{getFiredEvents:s.EventsService.getFiredEvents,f:t,getStayAwayElements:o.default.instance.getStayAwayElementsList});(null===(i=h.domData)||void 0===i?void 0:i.mainContent)&&(h.domData.mainContent.elements=(null===(n=d.SpotsUtils.getConf(a.SPOT_TAGS_MAP[a.SpotType.DYNAMIC_MC]))||void 0===n?void 0:n.elements)||[]),window.browsiOutput=window.browsiOutput?window.browsiOutput:{},window.browsiOutput[r]=window.browsiOutput[r]?Object.assign(window.browsiOutput[r],h):h,window.browsiOutput.state=e.state}}static getBrowsiOutput(t){return t?window.browsiOutput[t]:window.browsiOutput[r.Profiler.get().identity.pageviewId]}static querySelector(e,i){if(e)try{return t.getCurrentContextElement().querySelector(e)}catch(t){i(`Invalid selector [${e}]`)}return null}static getLoaderParams(){return window._middyo}static isEmptyObj(t){return 0===Object.keys(t).length}static querySelectorAll(e,i,s){return e&&e.length?e.reduce(((e,n)=>{let r=[];try{r=Array.from((s?document:t.getCurrentContextElement()).querySelectorAll(n))}catch(t){i(`Invalid selector [${n}]`)}return e.concat(r)}),new Array):[]}static querySelectorInsideElements(e,i,s){return t.querySelectorAll(e,s).filter((e=>i.includes(e)||t.isDescendantElement(i,e)))}static isElement(t){return t&&t instanceof Element}static getPositionFallback(e){if(!e)return 0;const i=t.getElementPosition(e).top;if("none"!==e.style.display&&i>0)return i;let s,n,r=e.previousElementSibling;for(;r;){if(s=t.getElementPosition(r).top,"none"!==r.style.display&&s>0)return n=r.getBoundingClientRect().height,n+s;r=r.previousElementSibling}return this.getPositionFallback(e.parentElement)}static getElementPosition(t,e){let i={top:-1,left:-1};return t&&this.isElement(t)?(i=this.getElementCoordinates(t),i.top=this.getOffsetIfEndless(i.top,t,e),i):i}static getOffsetIfEndless(t,e,i){const s=h.DcsUtils.getIfEndless();if(s){i=i||r.Profiler.get().identity.pageviewId;const n=s.pvs.find((t=>t.pv===i));n&&n.e&&(!e||n.e===e||n.e.contains(e))&&(t-=this.getElementCoordinates(n&&n.e||document.body).top)}return t}static getPercentageInView(t){const e=t.getBoundingClientRect(),i=this.getViewportHeight();return(i-e.top)/i*100}static isDescendantElement(t,e){for(let i of t)if(this.isContainedElement(i,e))return!0;return!1}static isContainedElement(t,e){return!(!t||!e)&&!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY)}static getElementSize(t){const e=t.getBoundingClientRect();return{h:e.height,w:e.width}}static getDfpAdSize(t){let e=t.getElementsByTagName("iframe")[0];if(e)try{return{size:{w:+e.width,h:+e.height},element:e}}catch(t){}return{size:this.getElementSize(t),element:t}}static getViewportHeight(){return window.innerHeight||0}static getViewportWidth(){return Math.max(document.documentElement.clientWidth,window.innerWidth||0)}static getElementFoldNumber(e){const i=(t.getElementPosition(e).top+n.FixedHeaderService.get().getNoneFixedHeaderSize())/t.getViewportHeight()+1;return Number(i.toFixed(2))}static getScreenSize(){return{w:window.screen.availWidth||window.screen.width,h:window.screen.availHeight||window.screen.height}}static getPageWidth(){const t=window.document.body,e=window.document.documentElement;return Math.floor(Math.max(t.scrollWidth,t.offsetWidth,e.clientWidth,e.scrollWidth,e.offsetWidth))}static getPageHeight(){const e=window.document.body,i=window.document.documentElement;let s=Math.floor(Math.max(e.scrollHeight,e.offsetHeight,i.clientHeight,i.scrollHeight,i.offsetHeight));return h.DcsUtils.getIfEndless()?s-t.getElementPosition(h.DcsUtils.dcsElement).top:s}static getElementCoordinates(t){const e=t.getBoundingClientRect(),i=document.body,s=document.documentElement,r=this.getPageYOffset(),o=window.pageXOffset||s.scrollLeft||i.scrollLeft,h=s.clientTop||i.clientTop||0,a=s.clientLeft||i.clientLeft||0,d=e.top+r-h+n.FixedHeaderService.get().getNoneFixedHeaderSize(),l=e.left+o-a;return{top:Math.round(d),left:Math.round(l)}}static isVisible(e){const i=e;return t.isElement(i)&&null!==i.offsetParent&&i.getBoundingClientRect().height>1&&"0"!==window.getComputedStyle(i).opacity}static calculateDistanceBetween(e,i){let s=0;if(e&&i&&e!==i){const n=t.sortElementsByDomOrder(e,i);s=t.getElementPosition(n.lower).top-t.getElementPosition(n.upper).top,t.isDescendantElement([n.upper],n.lower)||(s-=t.getElementSize(n.upper).h)}return s}static calculateTextNodeHeight(e){const i=t.nextVisibleSibling(e),s=t.nextVisibleSibling(e,!0);if(i){if(e.nodeValue&&s)return t.calculateDistanceBetween(s,i)}else if(e.parentElement&&s){let t=e.parentElement.getBoundingClientRect(),i=s.getBoundingClientRect();return t.top+t.height-(i.top+i.height)}return 0}static nextVisibleSibling(e,i){let s=i?e.previousElementSibling:e.nextElementSibling;for(;s&&!t.isVisible(s);)s=i?s.previousElementSibling:s.nextElementSibling;return s}static sortElementsByDomOrder(e,i){return t.getElementPosition(e).topt.optionalEmbeddings.includes("wrapped")));return e.length?e.reduce(((t,e)=>t.h>e.h?t:e)):void 0}static getWrappingOffset(t,e,i,s){return s&&!this.isContainedElement(t,e)?this.getMaxWrappingOffsetDistance(t,s,i):0}static isFloatImage(t){if("IMG"!==t.nodeName)return!1;const e=window.getComputedStyle(t);return"right"===e.getPropertyValue("float")||"left"===e.getPropertyValue("float")}static isParagraphElement(t){return"P"===t.nodeName}static isEmptyParagraph(t){return!(!this.isParagraphElement(t)||this.isNullOrUndefined(t.textContent))&&0===t.textContent.replace(/\s*/,"").length}static isPositionContained(t,e){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY)}static isPositionOrderAs(t,e){return!!e&&!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING)}static isPositionFixed(t){return"fixed"===window.getComputedStyle(t).position||!!t.parentElement&&this.isPositionFixed(t.parentElement)}static removeElementsPositionedAfter(e,i){return this.isNullOrUndefined(e)?i:i.filter((i=>t.isPositionOrderAs(i,e)))}static toUrlParams(t){return Object.keys(t).map((e=>e+"="+("object"==typeof t[e]?encodeURIComponent(JSON.stringify(t[e])):encodeURIComponent(t[e])))).join("&")}static onIframeLoad(t,e){if(t.contentWindow&&"complete"===t.contentWindow.document.readyState)e();else{const i=window.setInterval((()=>{t.contentWindow&&"complete"===t.contentWindow.document.readyState&&(window.clearInterval(i),e())}),100)}}static getMarginTopBySpotStyle(t,e,i){i=i.previousElementSibling&&"break"===e?i.previousElementSibling:t.ref;const s=window.getComputedStyle(i);let n=16,r=s.margin.split(" ");if(s.margin){const t=Number(r[0].replace("px",""));n="break"===e?n-t:t}else if(s.marginTop){const t=Number(s.marginTop.replace("px",""));n="break"===e?n-t:t}return(isNaN(n)||n<0)&&(n=16),n}static getDfpEventSize(t){return t.size?{w:t.size[0],h:t.size[1]}:{w:-1,h:-1}}static appendScript(t,e,i){return new Promise(((s,n)=>{var r;const o=document.createElement("script");o.async=!0,o.setAttribute("src",t),o.addEventListener("load",(()=>{s("success")})),o.addEventListener("error",(()=>{n("error")})),i?null===(r=e.contentDocument)||void 0===r||r.body.appendChild(o):e.appendChild(o)}))}static createClass(t,e,i){let s=i.createElement("style");s.type="text/css",i.getElementsByTagName("head")[0].appendChild(s),(s.sheet||{}).insertRule?s.sheet.insertRule(t+"{"+e+"}",0):(s.styleSheet||s.sheet).addRule(t,e)}static buildAdMarking(e,i){const s=document.createElement("div");s.innerText=i.text,s.id=`browsi_adv_${e.adIndex}`;const n=i.color?`height: 16px !important;\npadding: 0 !important;\nfont-family: Arial, sans-serif !important;\nmargin: auto !important;\nmargin-bottom: 10px !important;\ntext-align: center !important;\nline-height: 16px !important;\nfont-weight: normal !important;\ncolor: ${i.color} !important;\nfont-size: 11px !important;`:i.customStyle?i.customStyle:"";return t.createClass(`.browsi_adv_${e.adIndex}`,n,document),s.setAttribute("class",`browsi_adv_${e.adIndex}`),s}static getAdMarkingExpectedHeight(){const t=r.Profiler.get().spotEngineConfig.adMarking;if(t){if(t.expectedHeight)return t.expectedHeight;const e=this.calculateAdMarkingHeight(t);return t.expectedHeight=e,e}return 0}static calculateAdMarkingHeight(t){const e=document.createElement("div");e.innerText=t.text;const i=t.color?`height: 16px !important;\npadding: 0 !important;\nfont-family: Arial, sans-serif !important;\nmargin: auto !important;\nmargin-bottom: 10px !important;\ntext-align: center !important;\nline-height: 16px !important;\nfont-weight: normal !important;\ncolor: ${t.color} !important;\nfont-size: 11px !important;`:t.customStyle?t.customStyle:"";e.setAttribute("style",i),e.style.visibility="hidden",document.body.appendChild(e);const s=e.style.marginTop&&parseInt(e.style.marginTop)||0,n=e.style.marginBottom&&parseInt(e.style.marginBottom)||0,r=e.clientHeight+s+n;return document.body.removeChild(e),r}static getScrollPosition(){const e=n.FixedHeaderService.get(),i={top:t.getPageYOffset()+e.getNoneFixedHeaderSize()+e.getFixedHeaderSize(),bottom:t.getPageYOffset()+window.innerHeight};return i.top=this.getOffsetIfEndless(i.top),i.bottom=this.getOffsetIfEndless(i.bottom),i}static getLogStyle(t,e,i){return`font-size:${t}px;color:${e};background:${i};`}static sortSpotsByOffsetTop(...t){return t.sort(((t,e)=>t.offsetTop-e.offsetTop))}static sortSpotsByPosition(...e){return e.sort(((e,i)=>t.getPositionFallback(e.ref)-t.getPositionFallback(i.ref)))}static sortElementsByPosition(...e){return e.sort(((e,i)=>t.getPositionFallback(e)-t.getPositionFallback(i)))}static sortByHeight(t){return t.sort(((t,e)=>t.h>e.h?1:-1))}static getCurrentTime(t){const e=Date.now();return t?Math.floor(e/1e3):e}static isInCurrentArticle(t){const e=h.DcsUtils.getCurrentDcsElement();return!(e&&e instanceof Element)||this.isPositionContained(e,t)}static isFixed(t){return!(!t||t===document.body)&&("fixed"===window.getComputedStyle(t).position||!!t.parentElement&&this.isFixed(t.parentElement))}static is1x1(t){return 1===t.w&&1===t.h}static isFluidSize(t){return 0===t.w&&0===t.h}static merge(...t){return Object.assign({},...t)}static getSpotCoords(e){return e.isImpression&&e.browsiAd.container?e.browsiAd.iframe?t.getElementPosition(e.browsiAd.iframe):t.getElementPosition(e.browsiAd.container):t.getElementPosition(e.ref)}static getPageUrl(){return`${window.document.location.protocol}//${window.document.location.host}${window.document.location.pathname}`}static getUrlQueryParams(){let t=window.document.location.search.substring(1).split("&");return 0===t.length?"":(t.length>10&&(t.length=10),t.join("&"))}static findParentElementByType(t,e){const i=Array.from(document.querySelectorAll(t));let s=null;for(let t of i)this.isContainedElement(t,e)&&(s=t);return s}static isObject(t){return t&&"object"==typeof t&&!Array.isArray(t)&&null!==t}static mergeDeep(t,e){return this.isObject(t)&&this.isObject(e)&&Object.keys(e).forEach((i=>{this.isObject(e[i])?(t[i]||Object.assign(t,{[i]:{}}),this.mergeDeep(t[i],e[i])):Object.assign(t,{[i]:e[i]})})),t}static removeSpaces(t){return t.replace(/(\n|\r|\s+)/gm,"")}static getMaxWrappingOffsetDistance(e,i,s){const n=e.parentElement?e.parentElement:e,r=getComputedStyle(n);let o=n.getBoundingClientRect().width;o-=parseFloat(r.paddingLeft||"0")+parseFloat(r.paddingRight||"0");const h=d.SpotsUtils.getConf(s).wrapperStyle,a=t.getWrapFullSize(i,h),l=a.h+this.getAdMarkingExpectedHeight();return a.w*l/o-l}static isPositionedAfter(t,e){return!!e&&!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}static isPositionedDisconnected(t,e){return!!e&&!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_DISCONNECTED)}static isPositionedBefore(t,e){return!!e&&!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}static getShadowRoot(t){let e=t;for(;11!=e.nodeType&&e.parentNode;)e=e.parentNode;return 11===e.nodeType?e:void 0}static getEmbedTypesFromSizes(t){let e=[],i=!1,s=!1;for(let n of t)for(let t of n.optionalEmbeddings)if("break"!==t||s?"wrapped"!==t&&"left"!==t&&"right"!==t||i||(e.push("wrapped"),i=!0):(e.push(t),s=!0),s&&i)return e;return e}static sizeToString(t){return`${t.w}x${t.h}`}static toSize(t=""){const e=/^(\d+)x(\d+)$/.exec(t);return e&&3===e.length?{w:Number(e[1]),h:Number(e[2])}:{w:-1,h:-1}}static isEngagedUser(e){var i;if(!d.SpotsUtils.getOptimizeViewabilityTypes().includes(e.type))return!1;const s=r.Profiler.get();return!(!!(null===(i=d.SpotsUtils.getConf(e.tags))||void 0===i?void 0:i.engagedUsers)&&e.optimizeViewability)||t.getScrollPosition().top>0||s.isUserEngaged}static removeElement(t){return!(!t||!t.parentElement)&&(t.parentElement.removeChild(t),!0)}static throttle(t,e,i=!0){let s=!1;return n=>{s||(i&&t(n),s=!0,setTimeout((()=>{s=!1,t(n)}),e))}}static getCurrentFoldDecimal(){let t=this.getScreenSize();return this.getScrollPosition().top/t.h+1}static getScrollDepthPercentages(){const t=this.getScrollingDistance();return this.getDepthPercentages(t)}static getScrollingDistance(){return this.getPageYOffset()+this.getWindowHeight()}static getDepthPercentages(t){const e=this.getPageHeight()||1;return t=t||0,Math.round(t/e*100)}static getWindowHeight(){return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight}static getPageYOffset(){const t=this.getExternalFlowHandler("getPageYOffset");return t?t():window.pageYOffset||("CSS1Compat"===document.compatMode?document.documentElement.scrollTop:document.body.scrollTop)}static getScrollElement(){let t=this.getExternalFlowHandler("getScrollListenElement");return t?t():window}static getNowInSeconds(){return Math.floor(Date.now()/1e3)}static o(){return Math.floor(Date.now())}static getTimeOffset(){return Date.now()-r.Profiler.get().identity.timeOffset}static getCookie(t){let e=encodeURIComponent(t).replace(/[\-\.\+\*]/g,"\\$&"),i=new RegExp("(?:(?:^|.*;)\\s*"+e+"\\s*\\=\\s*([^;]*).*$)|^.*$"),s=document.cookie.replace(i,"$1");return decodeURIComponent(s)||""}static compareObjectKeys(t,e){return JSON.stringify(Object.keys(t))===JSON.stringify(Object.keys(e))}static getExternalFlowHandler(t){const e=r.Profiler.get().rules;if(e&&e[t]){return(...i)=>{try{return this.logger.debug(`Invoking ${t}`),e[t](...i)}catch(e){s.EventsService.get().sendErrorEvent("crash","ExternalFlowHandler: "+t,e.message)}}}}static toSet(t){const e=new Set;return t.forEach((t=>e.add(t))),e}static toUnique(t){let e=[];return this.toSet(t).forEach((t=>e.push(t))),e}static getMainContentSize(e){if(!e||!e.mainContent.lastElement||!e.mainContent.firstElement)return-1;let i=t.getElementPosition(e.mainContent.firstElement).top,s=e.mainContent.borderElement?t.getElementPosition(e.mainContent.borderElement).top:t.getElementPosition(e.mainContent.lastElement).top+e.mainContent.lastElement.getBoundingClientRect().height;return Math.round(s-i)}static reportNewBrowsiAd(e){t.dispatchDOMEvent("ban",e)}static reportBrowsiAdRemoved(e){t.dispatchDOMEvent("bar",e)}static dispatchDOMEvent(t,e){const i=new CustomEvent(t,{detail:e});return window.dispatchEvent(i),!0}static clone(t){return JSON.parse(JSON.stringify(t))}static getWrapFullSize(t,e){const i=e.l.p.r+e.l.p.l>e.r.p.r+e.r.p.l?e.l.p:e.r.p,s=e.l.m.r+e.l.m.l>e.r.m.r+e.r.m.l?e.l.m:e.r.m;return{w:t.w+i.l+s.l+i.r+s.r,h:t.h+i.b+s.b+i.t+s.t}}static xhrPromise(t,e,i){return new Promise(((s,n)=>{const r=new XMLHttpRequest;r.open(e||"GET",t,!0),r.onreadystatechange=function(){r.readyState==XMLHttpRequest.DONE&&(r.status>=200&&r.status<300?s(r):n(null))},"POST"===e&&i?r.send(i):r.send()}))}static findAllChildrenScripts(t){return Array.from(t.querySelectorAll("SCRIPT"))}static isNullOrUndefined(t){return null==t}static cloneAndEmbedBoostrap(){const t=document.querySelector("#browsi-tag"),e=document.createElement("script");return t?(Array.from(t.attributes).forEach((t=>{t.nodeName&&t.nodeValue&&e.setAttribute(t.nodeName,t.nodeValue)})),e.setAttribute("async",""),document.body.appendChild(e),t):null}static getArticlesList(){const t=h.DcsUtils.getWindowObject();if(t)switch(t.dcsType){case"end_less":case"slides":return[]}return[]}static isBetweenArticles(t){const e=this.getArticlesList();if(!e.length)return!1;const i=h.DcsUtils.getCurrentPvsObject();if(i instanceof HTMLElement&&e){const s=e.indexOf(i),n=e[s+1];if(n instanceof HTMLElement){const e=this.getElementPosition(t).top,s=this.getElementPosition(i).top,r=this.getElementPosition(n).top;return s({element:e,referer:t}))):[]}static getIframeWindow(t){let e;try{e=t.contentWindow&&t.contentWindow.document?t.contentWindow:void 0}catch(t){}return e}static isFriendlyIframe(t){let e=+new Date+""+Math.random();try{let i=t.contentWindow;return!!i&&(i[e]="asd","asd"===i[e])}catch(t){return!1}}static getGAMResponseInfo(t,e){if(!t)return null==e?void 0:e.genericParams.gamInfo;{const e=t.getResponseInformation();if(e){const t=e.sourceAgnosticLineItemId;return{oid:(null==e?void 0:e.campaignId)?Number(e.campaignId):void 0,lid:e.lineItemId||t}}}}static getRefreshAPIParams(t,e){const i={},s=this.getGAMResponseInfo(t);return((null==s?void 0:s.lid)||(null==e?void 0:e.lid))&&(i.li=(null==s?void 0:s.lid)||(null==e?void 0:e.lid)),((null==s?void 0:s.oid)||(null==e?void 0:e.oid))&&(i.oi=(null==s?void 0:s.oid)||(null==e?void 0:e.oid)),i}static isBlacklistedForApiOptimization(t,e){var i,s;const n=(null===(s=null===(i=r.Profiler.get().layouts.spots.api)||void 0===i?void 0:i.s)||void 0===s?void 0:s.viewabilityOptimizationBlocklist)||[];return!!e&&(n.includes(e)||n.includes(t))}static getUserID(){return l.default.hasUserConsent?r.Profiler.get().identity.userId:"anonymous"}static isBrowsiLoggerActive(){return!!this.getLoaderParams().lp}static getExistsOrNewGoogletag(t){const e=t||window,i=e.googletag||(e.googletag={cmd:[]});return i.cmd=i.cmd||[],i}static getDemandConfig(t){var e;return"header_bidding"===t.rt?null===(e=t.c)||void 0===e?void 0:e.d:t.c}static isHbDemand(t){var e;return!!(null===(e=t.c)||void 0===e?void 0:e.d)}static isSraResponse(t){return"SRA"===t.rt}static SplitAdUnit(t){const e=t.split("/");return{pubID:e[1],au:e.slice(2).join("/")}}static convertToOldStyleAdUnit(t){const e=this.getDemandConfig(t);if(!e)return t;const i=this.SplitAdUnit(e.aup);return e.a.pubID=i.pubID,e.au=i.au,t}static convertToNewStyleAdUnit(t,e){const i=this.getDemandConfig(t);return i&&e===i.aup&&(i.aup=`/${i.a.pubID}/${i.au}`),t}static isSaas(t){const e=this.getDemandConfig(t);if(!e)return!1;if("generic_js"===e.p)return!0;const i=this.SplitAdUnit(e.aup);return"57778053"!==(null==i?void 0:i.pubID)}static injectMoat(t,e){if(t){const i=new c.Moat({site_key:r.Profiler.get().identity.siteKey,devicePlatform:r.Profiler.get().deviceDetails.deviceType,layout_id:r.Profiler.get().identity.supplyConfigId,publisher_key:r.Profiler.get().identity.publisherKey}).getURL();this.appendScript(i,t,e).catch((t=>{s.EventsService.get().sendErrorEvent("script_load_error",i,"moat")}))}}static startsWith(t,e){return 0===e.indexOf(t)}static generateUuid(e=""){return e?((Number(e)^16*Math.random())>>Number(e)/4).toString(16):"10000000-1000-4000-8000-100000000000".replace(/[018]/g,t.generateUuid)}static isLazySpotsEnabled(){return!!r.Profiler.get().layouts.lazySpots}static isLazySpotsBucketsEnabled(){var t;return!!(null===(t=r.Profiler.get().layouts.lazySpots)||void 0===t?void 0:t.bucketsConfigured)}static getLazySpotsInstance(){return t.isLazySpotsBucketsEnabled()?p.default.get():v.default.get()}static isCustomRefreshConfigured(){var t;return!!(null===(t=r.Profiler.get().publisher)||void 0===t?void 0:t.customRefresh)}static flattenArray(t){return t.reduce(((t,e)=>t.concat(e)),[])}static isChangingViewport(t){if(!t)return!1;return this.getElementPosition(t).top{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BROWSI_IMPRESSION_DOM_EVENT_NAME=void 0,e.BROWSI_IMPRESSION_DOM_EVENT_NAME="browsiImpression"},2283:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CUSTOM_REFRESH_RESPONSES_MAP=void 0,e.CUSTOM_REFRESH_RESPONSES_MAP={[-1]:"found rule with no refresh",[-2]:"not found rule",[-3]:"refresh blocked by black/white list",[-4]:"not found line item type in cache",[-5]:"missing publisher refresh rates rules",[-6]:"server error"}},1528:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DemandRequestType=void 0,function(t){t.SRA="sra",t.SINGLE="single"}(e.DemandRequestType||(e.DemandRequestType={}))},4817:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DemandTool=void 0;const s=i(125),n=i(2727),r=i(2970),o=i(6393),h=i(7730),a=i(3034),d=i(1128),l=i(4569),c=i(1993),u=i(4603),p={"in-content":"in",top:"t",bottom:"b",adhesive:"s","right-rail":"r","left-rail":"l"};e.DemandTool=class{constructor(){this.logger=new s.Logger("BrowsiDemandTool");const t=n.Utils.getBrowsiTag();if(t){if(t.display=this.display.bind(this),t.insertPlacement=this.insertPlacement.bind(this),t.cmd)for(;t.cmd.length;){const e=t.cmd.shift();"function"==typeof e&&this.execute(e)}else t.cmd=[];t.cmd.push=t=>this.execute(t)}}execute(t){try{t()}catch(t){this.reportFailure(t,"")}}insertPlacement(t,e){this.display(t,{sizes:e})}display(t,e){this.runApiDisplayHook(t,e),this.logger.info(`display('${t}')`,e),this.buildSpot(t,e).then((t=>o.YieldClient.get().processSingleSpot(t))).catch((e=>this.reportFailure(e,t)))}buildSpot(t,e){return t&&"string"==typeof t||(null==e?void 0:e.shadowElement)&&n.Utils.isElement(e.shadowElement)?this.buildOptionsPromise(t,e).then((e=>this.validateElement(t,e.shadowElement).then((t=>this.validateSpot(t,e))))):Promise.reject(`container ID is null or not a string - ${t}`)}buildOptionsPromise(t,e){return e?Promise.all([this.validateSizeArray(e.sizes),this.validateRefresh(e.refresh),this.validateKeyValuesArray(e.keyValues),this.validateAdUnit(e.adUnit),this.validateViewability(e.disableViewabilityOptimization),this.validatePositionType(t,e.positionTag)]).then((t=>{const i={sizes:t[0],refresh:t[1],keyValues:t[2],adUnit:t[3],disableViewabilityOptimization:t[4],positionTag:t[5],shadowElement:null==e?void 0:e.shadowElement};return Object.keys(i).forEach((t=>{void 0===i[t]&&delete i[t]})),i})):Promise.resolve({})}validateSpot(t,e){return new Promise(((i,s)=>{if(this.noSizesDefinedForSpot(e))return s(`No sizes defined for this spot - ${t.id}`);this.logger.info("Processed element and options:",t,e);const n=r.default.instance.getApiSpots(),o=new l.ApiSpot(t,n.length,e);n.push(o),this.logger.info("Found api spot",o.ref),c.EventsService.get().sendSpotFoundEvent(o),this.attachParamsToRef(t,e),i(o)}))}noSizesDefinedForSpot(t){var e;const i={typeTag:u.TypeTag.API,positionTag:t.positionTag||"in",oldType:d.SpotType.API},s=(null===(e=a.SpotsUtils.getConf(i))||void 0===e?void 0:e.sizes)||[];return(!t.sizes||0===t.sizes.length)&&0===s.length}validateElement(t,e){return new Promise(((i,s)=>{if(e&&n.Utils.isElement(e))return i(e);const r=document.getElementById(t);r||s(`no element with such id exists - ${t}`),i(r)}))}validateSizeArray(t){return new Promise(((e,i)=>{t||e(),Array.isArray(t)||i("sizes is not a valid sizes array. Please supply an array of objects: {w: adWidth, h: adHeight}"),(t=this.validateSizes(t)).length||e();e(t.map((t=>({w:t.w,h:t.h,adSizeType:h.Profiler.getAdSizeType(t),minSizeForWrapping:-1,optionalEmbeddings:["break"],selectedEmbedding:"break"}))))}))}validateRefresh(t){return new Promise(((e,i)=>{void 0===t&&e(),"boolean"==typeof t?e({active:!!t}):"object"==typeof t&&"boolean"==typeof t.active?(void 0!==t.refreshSecond&&("number"!=typeof t.refreshSecond||t.refreshSecond<=0)&&i("refresh.refresh.refreshSecond should be positive number"),e(Object.assign({active:!!t.active},t.refreshSecond?{refreshSecond:t.refreshSecond}:{}))):i("refresh is not a valid object. Please supply an object: {active: true/false}")}))}validateKeyValuesArray(t){return new Promise(((e,i)=>{t||e(),!(t=this.removeUnsupportedKeyValues(t))||t.length&&!this.isInvalidKeyValuesArray(t)||i("keyValues is not a valid key-value array. Please supply an array of objects: {key: key, value: value}");e(this.processKeyValuesArray(t))}))}processKeyValuesArray(t){const e=t=>"string"!=typeof t?t.toString():t;return t.forEach((t=>{Array.isArray(t.value)?t.value.forEach(((i,s)=>{t.value[s]=e(i)})):t.value=e(t.value)})),t}validateAdUnit(t){return new Promise(((e,i)=>{t||e(),t&&this.isInvalidAdUnit(t)&&i('adUnit is not in the valid format. Please make sure to send a string in the format: "/pubId/adUnit"'),n.Utils.startsWith("/",t)||(t="/"+t),e(t)}))}validateViewability(t){return new Promise(((e,i)=>{if(t&&"boolean"!=typeof t)return i("optimizeViewability is not in the valid format. Please make sure to send a boolean value (true/false)");e(!!t)}))}validatePositionType(t,e){return new Promise((i=>{if(!e){const e=h.Profiler.get().layouts.spots.api||{};return Object.keys(e).forEach((s=>{var n;const r=null===(n=e[s])||void 0===n?void 0:n.positionIds;if(this.matchRegexOrString(t,r))return i(s)})),i("in")}return i(p[e])}))}matchRegexOrString(t,e){return!!(null==e?void 0:e.some((e=>new RegExp("^/.*/$").test(e)?(e=e.substring(1,e.length-1),new RegExp(e).test(t)):t===e)))}isInvalidSizeArray(t){return!Array.isArray(t)||0===t.length||t.some((t=>isNaN(t.w)||isNaN(t.h)))}validateSizes(t){t=t.map((t=>"string"==typeof t&&"fluid"===t.toLowerCase()?{h:0,w:0}:{h:Number(t.h),w:Number(t.w)}));return t.filter((t=>!(t=>(isNaN(t.w)||isNaN(t.h))&&!("string"==typeof t&&"fluid"!==t.toLowerCase()))(t)))}isInvalidKeyValuesArray(t){return!Array.isArray(t)||0===t.length}isSupportedKeyValType(t){return["string","number","boolean"].includes(typeof t)}removeUnsupportedKeyValues(t){const e=t=>"string"!=typeof t.key||!this.isSupportedKeyValType(t.value)&&(!Array.isArray(t.value)||t.value.some((t=>!this.isSupportedKeyValType(t))));return t.filter((t=>!e(t)))}isInvalidAdUnit(t){return"string"!=typeof t||1===t.split("/").length}reportFailure(t,e){this.logger.error("browsitag execution failed:",t),e="string"==typeof e?e:"",c.EventsService.get().sendApiRequestBlockedEvent("api_failed",t,e)}runApiDisplayHook(t,e){const i=n.Utils.getExternalFlowHandler("apiDisplay");i&&i(t,e)}attachParamsToRef(t,e){n.Utils.isBrowsiLoggerActive()&&(t.spotOptions=e)}}},635:(t,e)=>{"use strict";var i;Object.defineProperty(e,"__esModule",{value:!0}),e.EmbedTypeMap=e.EmbedType=void 0,function(t){t.WRAPPED="wrapped",t.WRAPPED_LEFT="left",t.WRAPPED_RIGHT="right",t.BREAK="break",t.RANDOM="random"}(i=e.EmbedType||(e.EmbedType={}));let s={};Object.keys(i).map((t=>{s[t]=i[t]})),e.EmbedTypeMap=s},1128:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SCAN_SPOT_TAGS=e.RAILS_TAGS=e.FIXED_TAGS=e.FIXED_RAILS_TAGS=e.DYNAMIC_RAILS_TAGS=e.SPOT_TAGS_MAP=e.SpotType=void 0;const s=i(4603);var n;!function(t){t.FIXED_MC="fixed_mc",t.FIXED_TOP="fixed_top",t.FIXED_BOTTOM="fixed_bottom",t.DYNAMIC_MC="dynamic_mc",t.STICKY="sticky",t.FIXED_RIGHT_RAIL="fixed_right_rail",t.FIXED_LEFT_RAIL="fixed_left_rail",t.DYNAMIC_RIGHT_RAIL="dynamic_right_rail",t.DYNAMIC_LEFT_RAIL="dynamic_left_rail",t.API="api"}(n=e.SpotType||(e.SpotType={})),e.SPOT_TAGS_MAP={[n.FIXED_MC]:{oldType:n.FIXED_MC,typeTag:s.TypeTag.FIXED,positionTag:"in"},[n.FIXED_TOP]:{oldType:n.FIXED_TOP,typeTag:s.TypeTag.FIXED,positionTag:"t"},[n.FIXED_BOTTOM]:{oldType:n.FIXED_BOTTOM,typeTag:s.TypeTag.FIXED,positionTag:"b"},[n.DYNAMIC_MC]:{oldType:n.DYNAMIC_MC,typeTag:s.TypeTag.DYNAMIC,positionTag:"in"},[n.STICKY]:{oldType:n.STICKY,typeTag:s.TypeTag.STICKY,positionTag:"s"},[n.FIXED_RIGHT_RAIL]:{oldType:n.FIXED_RIGHT_RAIL,typeTag:s.TypeTag.FIXED,positionTag:"r"},[n.FIXED_LEFT_RAIL]:{oldType:n.FIXED_LEFT_RAIL,typeTag:s.TypeTag.FIXED,positionTag:"l"},[n.DYNAMIC_RIGHT_RAIL]:{oldType:n.DYNAMIC_RIGHT_RAIL,typeTag:s.TypeTag.DYNAMIC,positionTag:"r"},[n.DYNAMIC_LEFT_RAIL]:{oldType:n.DYNAMIC_LEFT_RAIL,typeTag:s.TypeTag.DYNAMIC,positionTag:"l"}},e.DYNAMIC_RAILS_TAGS=[e.SPOT_TAGS_MAP[n.DYNAMIC_LEFT_RAIL],e.SPOT_TAGS_MAP[n.DYNAMIC_RIGHT_RAIL]],e.FIXED_RAILS_TAGS=[e.SPOT_TAGS_MAP[n.FIXED_LEFT_RAIL],e.SPOT_TAGS_MAP[n.FIXED_RIGHT_RAIL]],e.FIXED_TAGS=[e.SPOT_TAGS_MAP[n.FIXED_MC],e.SPOT_TAGS_MAP[n.FIXED_TOP],e.SPOT_TAGS_MAP[n.FIXED_BOTTOM],...e.FIXED_RAILS_TAGS],e.RAILS_TAGS=[...e.DYNAMIC_RAILS_TAGS,...e.FIXED_RAILS_TAGS],e.SCAN_SPOT_TAGS=[e.SPOT_TAGS_MAP[n.DYNAMIC_MC],...e.FIXED_TAGS,...e.DYNAMIC_RAILS_TAGS]},8104:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.StickyConstants=e.StickyLocation=void 0,function(t){t.TOP="TOP",t.BOTTOM="BOTTOM"}(e.StickyLocation||(e.StickyLocation={})),function(t){t.dcsVar="sticky"}(e.StickyConstants||(e.StickyConstants={}))},5701:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_SPOT_STYLE=void 0;const s=i(2727);e.default=class{constructor(t){this.externalStyle=t,this.defaultWrapStyle=`margin-right:${e.DEFAULT_SPOT_STYLE.l.m.r}px;margin-left:${e.DEFAULT_SPOT_STYLE.l.m.l}px;\n margin-top:${e.DEFAULT_SPOT_STYLE.l.m.t}px;margin-bottom:${e.DEFAULT_SPOT_STYLE.l.m.b}px;\n padding-right:${e.DEFAULT_SPOT_STYLE.l.p.r}px;padding-left:${e.DEFAULT_SPOT_STYLE.l.p.l}px;\n padding-top:${e.DEFAULT_SPOT_STYLE.l.p.t}px;padding-bottom:${e.DEFAULT_SPOT_STYLE.l.p.b}px;`,this.defaultBreakStyle=`margin-top:${e.DEFAULT_SPOT_STYLE.b.m.t}px;margin-bottom:${e.DEFAULT_SPOT_STYLE.b.m.b}px;`,this.wrapperSize=s.Utils.clone(e.DEFAULT_SPOT_STYLE),this.tempElement=document.createElement("div"),this.initTempElement()}removeTempElement(){document.body.removeChild(this.tempElement)}initTempElement(){this.tempElement.style.display="none",this.tempElement.id="tempStyleElement",document.body.appendChild(this.tempElement)}getWrapComputedStyle(){const t=getComputedStyle(this.tempElement);return{m:{t:parseInt(t.marginTop),b:parseInt(t.marginBottom),l:parseInt(t.marginLeft),r:parseInt(t.marginRight)},p:{t:parseInt(t.paddingTop),b:parseInt(t.paddingBottom),l:parseInt(t.paddingLeft),r:parseInt(t.paddingRight)}}}getBreakComputedStyle(){return{m:{t:parseInt(getComputedStyle(this.tempElement).marginTop),b:parseInt(getComputedStyle(this.tempElement).marginBottom)}}}getSize(){var t,e,i,s,n,r;if(null===(e=null===(t=this.externalStyle)||void 0===t?void 0:t.l)||void 0===e?void 0:e.w){const t=this.defaultWrapStyle+this.externalStyle.l.w+"; display: none !important";this.tempElement.setAttribute("style",t),this.wrapperSize.l=this.getWrapComputedStyle()}if(null===(s=null===(i=this.externalStyle)||void 0===i?void 0:i.r)||void 0===s?void 0:s.w){const t=this.defaultWrapStyle+this.externalStyle.r.w+"; display: none !important";this.tempElement.setAttribute("style",t),this.wrapperSize.r=this.getWrapComputedStyle()}if(null===(r=null===(n=this.externalStyle)||void 0===n?void 0:n.b)||void 0===r?void 0:r.w){const t=this.defaultWrapStyle+this.externalStyle.b.w+"; display: none !important";this.tempElement.setAttribute("style",t),this.wrapperSize.b=this.getBreakComputedStyle()}return this.removeTempElement(),this.wrapperSize}},e.DEFAULT_SPOT_STYLE={b:{m:{b:16,t:16}},l:{m:{t:-1,r:16,b:16,l:0},p:{t:-1,r:0,b:0,l:0}},r:{m:{t:-1,r:0,b:16,l:16},p:{t:-1,r:0,b:0,l:0}}}},7463:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RailsSides=void 0,function(t){t.RIGHT="RIGHT",t.LEFT="LEFT"}(e.RailsSides||(e.RailsSides={}))},4603:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TypeTag=e.PositionTagLong=e.PositionTag=e.LayoutPositionTag=void 0,function(t){t.TOP="t",t.IN_CONTENT="in",t.BOTTOM="b",t.STICKY="s",t.RAILS="r"}(e.LayoutPositionTag||(e.LayoutPositionTag={})),function(t){t.TOP="t",t.IN_CONTENT="in",t.BOTTOM="b",t.STICKY="s",t.RIGHT_RAIL="r",t.LEFT_RAIL="l"}(e.PositionTag||(e.PositionTag={})),function(t){t.TOP="top",t.BOTTOM="bottom",t.IN_CONTENT="in-content",t.STICKY="adhesive",t.RIGHT_RAIL="right-rail",t.LEFT_RAIL="left-rail"}(e.PositionTagLong||(e.PositionTagLong={})),function(t){t.DYNAMIC="dy",t.FIXED="fi",t.API="api",t.STICKY="s"}(e.TypeTag||(e.TypeTag={}))},3271:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SATargets=void 0,function(t){t.MC="MAIN_CONTENT",t.TOP="TOP",t.BOTTOM="BOTTOM",t.RIGHT="RIGHT_RAILS",t.LEFT="LEFT_RAILS"}(e.SATargets||(e.SATargets={}))},4901:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AuctionDataCollector=void 0;const s=i(125),n=i(1993),r=i(2970),o=i(7730);class h{constructor(){this.logger=new s.Logger("AuctionDataCollector"),this.matches={},this.requestPipes={},this.matchesPipes={},this.profile=o.Profiler.get()}static get(){return h.instance||(this.instance=new h),h.instance}collectBidRequest(t,e,i){if(this.profile.siteInfo.collectHbEvents){const t=this.getSpotFromAdUnitCode(e);t?this.sendBidRequestEvent(t,i):this.logger.info("could not find spot for",e,"not sending bid request")}}collectBidMatch(t,e,i,s){this.profile.siteInfo.collectHbEvents&&(this.matches[t]=this.matches[t]||{},this.matches[t][e]=this.matches[t][e]||[],this.matches[t][e][+i.im]=this.matches[t][e][+i.im]||[],this.matches[t][e][+i.im].push(i),s&&this.sendBidMatches(t))}sendBidMatches(t){const e=this.getSpotFromAdUnitCode(t);if(!e)return void this.logger.info("could not find spot for",t,"not sending bid match");const i=this.bidMatchedParamsToEvent(this.matches[t]);i&&i.length&&n.EventsService.get().sendBidMatched(e,i),this.matches[t]={}}bidMatchedParamsToEvent(t){let e=[];for(let i in t)t.hasOwnProperty(i)&&t[i].forEach((t=>{let s={n:i,im:t[0].im,s:[]};t[0].brc&&(s.brc=t[0].brc),t[0].au&&(s.au=t[0].au),t.forEach((t=>{t.s.forEach((e=>{s.s.push(Object.assign(Object.assign(Object.assign({},e),t.rsn?{rsn:t.rsn}:{}),t.br?{br:t.br}:{}))}))})),e.push(s)}));return e}getSpotFromAdUnitCode(t){let e;const i=r.default.instance.getAvailableSpots().concat(r.default.instance.getApiSpots());if(t.startsWith("browsi")){const s=t.split("_")[3];e=i.find((t=>t.adIndex===+s))}else e=i.find((e=>e.genericParams.adUnitMap===t));return e}collectDFPBidRequest(t,e){this.profile.siteInfo.collectHbEvents&&this.sendBidRequestEvent(t,e)}sendBidRequestEvent(t,e){const i=this.buildRequestParamsToEvent(e);i&&i.length&&n.EventsService.get().sendBidRequest(t,i)}buildRequestParamsToEvent(t){let e=[];return t.forEach((t=>{for(let i in t)t.hasOwnProperty(i)&&e.push({n:i,s:t[i]})})),e}buildSizesFromArray(t){return t.map((t=>({w:t[0],h:t[1]})))}}e.AuctionDataCollector=h},2247:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DFP=e.MIN_AD_SIZE=void 0;const s=i(1727),n=i(1993),r=i(125),o=i(2727),h=i(8614),a=i(4949),d=i(4029);e.MIN_AD_SIZE=5;class l extends s.Provider{constructor(t){super(t,"dfp"),this.logger=new r.Logger("DFP"),this.hasFluidSizeSupport=!0}static isValidSize(t){return Array.isArray(t)?t[0]>e.MIN_AD_SIZE&&t[1]>e.MIN_AD_SIZE:t.w>e.MIN_AD_SIZE&&t.h>e.MIN_AD_SIZE}fetch(t,e){return new Promise((i=>{this.logger.info(`fetching spot ${this.spot.adIndex}`,this.spot),e.appendAndGetWrapper(this.spot).then((t=>this.addGPTScriptTag(t))).then((e=>this.pushGoogleTagCommands(e,t))).then((t=>i(t))).catch((t=>{this.logger.error("fetching failed: ",t),i({status:"error"})}))}))}pushGoogleTagCommands(t,e){return new Promise((i=>{h.Focus.get().waitForUserFocusWithAdBlock(this.spot).then((()=>{const s=this.buildSizes(!0,this.spot);let n=o.Utils.getExistsOrNewGoogletag(t.win);n.cmd.push((()=>{const r=this.getAdSelector(),o=n.defineSlot(e.c.aup,s,r).addService(n.pubads());this.spot.slot=o,this.setGoogleTagPrivacy(n),this.assignKeyValues(o,this.getAllKeyValues(e)),this.logger.info(`spot ${this.spot.adIndex}, definedSlot: ${o.getAdUnitPath()}, sizes:${JSON.stringify(s)}, keyValue: ${JSON.stringify(o.getTargetingMap())}`),n.pubads().addEventListener("slotRenderEnded",(t=>this.slotRenderEndedEvent(t,i,o,e))),n.pubads().addEventListener("slotOnload",(t=>this.slotOnLoadEvent(t,e))),this.runPreGoogletagDisplay(this.spot),this.display(n,o,e,!!t.iframe),n.pubads().addEventListener("slotRequested",(t=>{this.slotRequestedEvent(t,r,s,e)}))}))}))}))}handleAdMatchFalse(t,e,i){n.EventsService.get().sendAdMatchedEvent(this.spot,"dfp",!1,i.plk),this.spot.isRefreshing()||(this.spot.isImpression=!1),e({status:"failure"})}display(t,e,i,s){const n="false"===i.c.a.upc||!i.c.a.upc,r=this.spot.browsiAd.container;s?(t.enableServices(),t.display(r)):(t.enableServices(),t.pubads().isInitialLoadDisabled()?(t.display(r),t.pubads().refresh([e],{changeCorrelator:n})):(n&&t.pubads().updateCorrelator(),t.display(r)))}slotRenderEndedEvent(t,e,i,s){i==t.slot&&this.getAdSelector()===t.slot.getSlotElementId()&&(this.isForcedRefresh()?this.handleForcedRefreshRenderEnded(t,s):this.handleRenderEnded(t,e,s))}handleForcedRefreshRenderEnded(t,e){n.EventsService.get().sendAdMatchedEvent(this.spot,"dfp",!t.isEmpty,e.plk,"forced_refresh"),t.isEmpty||(n.EventsService.get().sendAdImpression(this.spot,this.providerName,e.plk),this.spot.updateInSpotEngineTest())}handleRenderEnded(t,e,i){const s=o.Utils.getDfpEventSize(t);if(this.logger.info(`dfp ${t.isEmpty?"empty":JSON.stringify(s)} for ${this.getAdSelector()}, au: ${t.slot.getAdUnitPath()}`,o.Utils.getSlotTargeting(t.slot)),t.isEmpty)this.handleAdMatchFalse(t.slot,e,i);else{if(this.spot.setSelectedSize(s),!this.spot.selectedSize)return e({status:"error"});this.spot.providerName=this.providerName,n.EventsService.get().sendAdMatchedEvent(this.spot,"dfp",!0,i.plk),o.Utils.isNullOrUndefined(this.spot.selectedSize)?(this.logger.warn("No size match for spot: ",this.spot,t),e({status:"error"})):this.expandAd(this.spot,e,i)}d.default.get().waitForBrowsiAV(t.slot,this.spot)}isForcedRefresh(){return this.spot.spotRequested>this.spot.attemptIndex&&!this.spot.isRefreshing()}slotOnLoadEvent(t,e){if(this.spot.slot!=t.slot)return;new a.default(this.spot,e.c.aup).sendEvent("DFP slot loaded")}slotRequestedEvent(t,e,i,s){if(this.isBrowsiSlot(t,e)){this.logger.debug(`dfp(da) slotRequestedEvent ${e}`),this.spot.spotRequested++;const t=this.isForcedRefresh()?"forced_refresh":void 0;n.EventsService.get().sendAdRequest(this.spot,this.providerName,i,s.plk,void 0,t)}}}e.DFP=l},8008:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.GenericJS=void 0;const s=i(1727),n=i(125),r=i(1993),o=i(2727),h=i(2247),a=i(7730),d=i(5857),l=i(4869);class c extends s.Provider{constructor(t,e){var i;super(t,"generic_js"),this.logger=new n.Logger("GenericJS");const s=e.c.a;this.isJs="true"===s.isJS,this.snippetUrl=s.url,this.isCallback="true"===s.withCallback,this.template=s.template,this.callbackInvoked=!1,this.providerDisplayName=(null===(i=this.template)||void 0===i?void 0:i.p)||"generic_js",this.spot.genericParams.displayName=this.providerDisplayName,this.placementKey=e.plk,this.manualFailureReported=!1}fetch(t,e){return new Promise(((i,s)=>(r.EventsService.get().sendAdRequest(this.spot,this.providerDisplayName,[],this.placementKey),e.appendAndGetWrapper(this.spot).then((e=>o.Utils.xhrPromise(this.snippetUrl).then((t=>t.status&&200===t.status?t.responseText:Promise.reject({status:"generic_snippet_error",msg:"no response. status - "+t.status}))).then((n=>{if(this.isJSONPTemplate())return this.runJSONPSnippet(e,t,i,s);const r=this.prepareSnippet(e,n,t,i);if(n)return this.runSnippet(e,r);{const t="generic_snippet_error";return Promise.reject({status:t})}})).then((s=>this.handleResult(s,e,t,i))).catch((e=>{r.EventsService.get().sendAdMatchedEvent(this.spot,this.providerDisplayName,!1,t.plk,"generic_snippet_error",void 0,(null==e?void 0:e.msg)||""),this.sendGenericError((null==e?void 0:e.msg)||""),i({status:(null==e?void 0:e.status)||"generic_snippet_error",args:{provider:"generic_js",adUnit:"NA"}})})))).catch((e=>{this.logger.error(e),this.sendGenericError(e),r.EventsService.get().sendAdMatchedEvent(this.spot,this.providerDisplayName,!1,t.plk,"generic_snippet_error"),i({status:"generic_snippet_error",args:{provider:"generic_js",adUnit:"NA"}})})))))}isJSONPTemplate(){var t;return!!(null===(t=this.template)||void 0===t?void 0:t.n)}runJSONPSnippet(t,e,i,s){return new Promise(((s,n)=>{var r;const h=null===(r=this.template)||void 0===r?void 0:r.n,a=t.win,d=this.buildTemplateArguments(t,e,i);"function"==typeof a[h]?this.runTemplateFunction(h,a,d,s,n):o.Utils.appendScript(this.snippetUrl,a.document.body,!!t.iframe).then((()=>{this.runTemplateFunction(h,a,d,s,n)}))}))}runTemplateFunction(t,e,i,s,n){try{const n=e[t](i);"function"==typeof(null==n?void 0:n.refresh)&&(this.spot.genericParams.refresh=this.invokeRefreshCallback.bind(this,n.refresh)),s({status:"success"})}catch(t){this.logger.error("Error while running template function",t),n({status:"generic_snippet_error",msg:t.message})}}buildTemplateArguments(t,e,i){var s,n,r,o;const h=this.isCallback?(s,n,r)=>this.browsiCallback(t,e,i,s,n,r):void 0;return Object.assign(Object.assign({divId:null===(s=t.container)||void 0===s?void 0:s.id,spotIndex:this.spot.adIndex,demandIndex:this.spot.demandIndex,viewabilityPrediction:this.getPredictionReplaceValue(e),pageviewID:a.Profiler.get().identity.pageviewId,layoutID:a.Profiler.get().identity.supplyConfigId,spotsSizes:this.buildSizes(!0,this.spot),targeting:this.getAllKeyValues(e),adUnit:e.c.aup,refreshRate:(null===(n=e.c.ri)||void 0===n?void 0:n.r)||-1,templateParams:null===(r=this.template)||void 0===r?void 0:r.pr},e.c.tam?{amznBidConf:{pubID:e.c.tam.pubID,adServer:e.c.tam.adServer,slotName:e.c.tam.slotName,timeout:e.c.tam.timeout,simplerGPT:e.c.tam.simplerGPT}}:{}),{sendActiveViewEvent:()=>this.sendActiveViewEvent(),sendGeneralDataEvent:this.sendGeneralDataEvent,mapAdUnitToSpot:t=>{this.setAdUnitMap(t)},reportManualFailureEvent:t=>{this.reportManualFailureEvent(e,i,t)},callback:h,inframeVideoIdx:d.InframeManager.get().getVideoIndex(this.spot.adIndex),prebidGlobalInstanceName:(null===(o=a.Profiler.get().siteInfo.prebidData)||void 0===o?void 0:o.g)||"pbjs"})}setAdUnitMap(t){this.spot.genericParams.adUnitMap=t}sendActiveViewEvent(){r.EventsService.get().sendViewedImpressionAV(this.spot)}sendGeneralDataEvent(t,e){r.EventsService.get().sendGeneralDataEvent(t,e)}reportManualFailureEvent(t,e,i){this.manualFailureReported||this.callbackInvoked||(this.manualFailureReported=!0,r.EventsService.get().sendAdMatchedEvent(this.spot,this.providerDisplayName,!1,this.placementKey,"generic_manual_failure",void 0,i)),e({status:"failure"})}browsiCallback(t,e,i,s,n,o){this.callbackInvoked=!0;const h=d.InframeManager.get().isProviderInframe(this.spot);this.logger.info("spot: ",this.spot),this.spot.genericParams.gamInfo=(null==o?void 0:o.gamInfo)==={}||null==o?void 0:o.gamInfo,this.spot.genericParams.adUnit=null==o?void 0:o.adUnit,this.manualFailureReported||(s?(r.EventsService.get().sendAdMatchedEvent(this.spot,this.providerDisplayName,!1,e.plk,"empty",void 0,n),h&&d.InframeManager.get().handleVideoWithoutDemand(),i({status:"failure"})):this.handledValidAd(t,i,e))}prepareSnippet(t,e,i,s){if(this.isCallback&&this.assignBrowsiCallbackToWindow(t,s,i),t.container){t.container.className=t.container.id;let n=e.replace(//g,`${t.container.id}`).replace(//g,this.spot.adIndex.toString()).replace(//g,this.spot.demandIndex.toString()).replace(//g,this.getPredictionReplaceValue(i)).replace(//g,this.profile.identity.pageviewId).replace(//g,this.profile.identity.supplyConfigId).replace(/""/g,JSON.stringify(this.buildSizes(!0,this.spot))).replace(/""/g,JSON.stringify(this.getAllKeyValues(i))).replace(//g,JSON.stringify(d.InframeManager.get().getVideoIndex(this.spot.adIndex)));if(this.template)for(let t in this.template.pr){const e=new RegExp(t,"g");n=n.replace(e,this.template.pr[t])}if(this.logger.debug("running snippet",n),this.assignFunctionsToBrowsiTag(i,s),n)return n}return""}assignFunctionsToBrowsiTag(t,e){const i=window.browsitag;i.__gs=i.__gs||{},i.__gs[this.spot.adIndex]={av:()=>this.sendActiveViewEvent(),gd:this.sendGeneralDataEvent,rmf:i=>{this.reportManualFailureEvent(t,e,i)}}}injectNoJs(t,e,i,s){if(t.container){t.container.innerHTML=e;const n=o.Utils.findAllChildrenScripts(t.container);this.copyAndAppendScriptTag(t.container,n,i,s)}}runSnippet(t,e){return new Promise(((i,s)=>{if(!this.isJs)return this.injectNoJs(t,e,i,s);try{return t.win.eval(e),i({status:"success"})}catch(t){return s({status:"generic_snippet_error",msg:t.message})}}))}getPredictionReplaceValue(t){const e=this.getPredictionToSend(t);return e?this.getBrowsiViewability(e):""}copyAndAppendScriptTag(t,e,i,s){Array.from(e).forEach((e=>{let i=document.createElement("script");Array.from(e.attributes).forEach((t=>{i.setAttribute(t.name,t.value)})),e.parentElement&&e.parentElement.removeChild(e),i.text=e.text,t.appendChild(i)})),i({status:"success"})}assignBrowsiCallbackToWindow(t,e,i){window.top[`browsiCallback_${this.spot.adIndex}`]=(s,n)=>this.browsiCallback(t,i,e,s,n)}handleResult(t,e,i,s){if(e.wrapper&&e.container&&"success"===t.status&&(this.isAdInViewport().then((t=>{t&&this.sendAdInViewEvent(this.spot)})),!this.isCallback)){let t=!1;e.wrapper.style.display="block",e.container.style.display="block",this.logger.debug("starting valid size interval");const n=setInterval((()=>{this.manualFailureReported&&clearInterval(n),this.isValidAdSize(e)&&(clearInterval(n),t=!0,this.onSizeMatchWithoutCallback(e,s,i))}),200);setTimeout((()=>{t||this.manualFailureReported||(clearInterval(n),r.EventsService.get().sendAdMatchedEvent(this.spot,this.providerDisplayName,!1,i.plk,"generic_invalid_size"),s({status:"failure"}))}),i.c.t)}}onSizeMatchWithoutCallback(t,e,i){this.callbackInvoked||this.handledValidAd(t,e,i)}handledValidAd(t,e,i){let s=o.Utils.getElementSize(t.container);this.handleSuccess(s,e,i)}handleSuccess(t,e,i){r.EventsService.get().sendAdMatchedEvent(this.spot,this.providerDisplayName,!0,i.plk),this.spot.refresh.requested?(r.EventsService.get().sendAdImpression(this.spot,this.providerDisplayName,this.placementKey),o.Utils.isCustomRefreshConfigured()&&this.spot.initCustomRefreshRate(),l.ViewabilityService.get().subscribe(this.spot.buildViewabilityServiceObject(this.spot.vConf)),this.spot.updateRefreshedSuccessStatus(),this.spot.refresh.impressionsEventCount=this.spot.refresh.count,this.logger.info(`spot #${this.spot.adIndex} refreshed with count ${this.spot.refresh.count}`)):(this.spot.setSelectedSize(t),this.expandAd(this.spot,e,i));d.InframeManager.get().isProviderInframe(this.spot)&&d.InframeManager.get().handleVideoWithDemand(this.spot.adIndex),e({status:"success",args:{adUnit:"NA",provider:"generic_js"}})}getAdSize(t){var e;if(!t.container)return{w:0,h:0};if(!(null===(e=this.spot.placeholder)||void 0===e?void 0:e.active))return o.Utils.getElementSize(t.container);let i={w:0,h:0};return t.container.childNodes.forEach((t=>{if(o.Utils.isElement(t)){let e=o.Utils.getElementSize(t);i.w=Math.max(i.w,e.w),i.h+=e.h}})),i}isValidAdSize(t){const e=o.Utils.getExternalFlowHandler("isValidGenericSize");if(e)return e(t,this.spot);{const e=this.getAdSize(t);return e.w>h.MIN_AD_SIZE&&e.h>h.MIN_AD_SIZE}}invokeRefreshCallback(t,e){t&&(l.ViewabilityService.get().unsubscribe(this.spot),r.EventsService.get().sendAdRequest(this.spot,this.spot.genericParams.displayName||this.spot.providerName||"NA",[],this.placementKey),t(this.getRefreshTemplateValues(e)))}getRefreshTemplateValues(t){return{targeting:this.getAllKeyValues(t)}}sendGenericError(t){r.EventsService.get().sendErrorEvent("generic_error","","generic_error",t)}}e.GenericJS=c},8895:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.HBProvider=void 0;const s=i(1727),n=i(8614),r=i(4901),o=i(1993),h=i(2727),a=i(3006);let d=(()=>{class t extends s.Provider{constructor(t,e,i,s){super(t,e),this.apsSize=null}runHBCommands(t,e,i){return new Promise(((s,r)=>{n.Focus.get().waitForUserFocusWithAdBlock(this.spot).then((()=>{i(t,e,s,r)}))}))}buildAmazonPromise(t,e,i){return this.hasAmazonBidder(t)&&!this.isRefreshDfpOnly()&&a.default.hasUserConsent?new Promise(((s,n)=>{const o=t.c.d;this.appendApsToHead(i,o.tam).then((t=>{var i,n;const a=t.win.apstag,d=this.buildSizes(!1,this.spot),l=(null===(i=o.tam)||void 0===i?void 0:i.slotName)||"",c=Object.assign({slots:[{slotID:e,slotName:l,sizes:d}]},(null===(n=o.tam)||void 0===n?void 0:n.timeout)?{timeout:o.tam.timeout}:{}),u=h.Utils.getExternalFlowHandler("preApsFetchBids");u&&(u(c),this.logger.debug("preApsFetchBids was called, new config",c)),a.fetchBids(c,(t=>{const i=t.find((t=>t.slotID===e));this.logger.info("amazon bid: ",i),this.logger.apsLog(e,i);const n=h.Utils.toSize(i&&i.size);n.w>0&&n.h>0&&(this.apsSize=n);const o={im:!!i&&!!i.amzniid,s:[n],br:-1,au:l};return r.AuctionDataCollector.get().collectBidMatch(e,"aps",o,!0),s()})),r.AuctionDataCollector.get().collectBidRequest("aps",e,[{aps:r.AuctionDataCollector.get().buildSizesFromArray(d)}])}))})):Promise.resolve()}hasDfpBidder(t){return!!t.c.d}hasAmazonBidder(t){return!(!t.c.d||!t.c.d.tam)}appendApsToHead(e,i){if(!i)return Promise.reject("No Config");i=this.updateAmazonBidderConfig(i);const s=e.win;if(e.iframe)return this.injectApsTag(s,i,e);if(t.isApstagInitCalled)return Promise.resolve(e);if(s.apstag&&"function"==typeof s.apstag.fetchBids){try{const e=this.getApsInitConfig(i);s.apstag.init(e),t.isApstagInitCalled=!0}catch(t){this.logger.error("could not init publisher apstag",t)}return Promise.resolve(e)}return t.apsInjectPromise||(t.apsInjectPromise=this.injectApsTag(s,i,e)),t.apsInjectPromise.then((()=>(this.logger.info("Using browsi injected apstag"),e)))}updateAmazonBidderConfig(t){const e=h.Utils.getExternalFlowHandler("preApsInit");return e?e(t):t}getApsInitConfig(t){return{adServer:t.adServer,pubID:t.pubID,simplerGPT:t.simplerGPT}}injectApsTag(t,e,i){return this.logger.info("Injecting apstag"),new Promise(((s,n)=>{const r=t.document.createElement("script");r.async=!0;const h="//c.amazon-adsystem.com/aax2/apstag.js";r.setAttribute("src",h),r.addEventListener("load",(()=>{if("function"==typeof t.apstag.init){const i=this.getApsInitConfig(e);t.apstag.init(i)}s(i)})),r.addEventListener("error",(()=>{o.EventsService.get().sendErrorEvent("script_load_error",h,"apstag"),n(i)})),t.document.head.appendChild(r)}))}isRefreshDfpOnly(){return this.spot.isRefreshing()&&this.spot.refresh.do}isForcedRefresh(){return this.spot.spotRequested>this.spot.attemptIndex&&!this.spot.isRefreshing()}checkApsWin(t){try{const e=t.slot.getHtml();if(e.includes("apstag.renderImp")||e.includes("amzn_win")){if(this.apsSize&&this.spot.setSelectedSize(this.apsSize),h.Utils.isBrowsiLoggerActive()){const e={winner:"aps",size:this.apsSize,adUnit:t.slot.getSlotElementId()};window.dispatchEvent(new CustomEvent("amw",{detail:e}))}this.profile.siteInfo.collectHbEvents&&o.EventsService.get().sendAPSWinner(this.spot)}}catch(t){}}runPreDfpHB(t,e){var i;const s=h.Utils.getExternalFlowHandler("preDfpHB");if(s){const n=null===(i=h.Utils.getDemandConfig(t))||void 0===i?void 0:i.aup;t=h.Utils.convertToOldStyleAdUnit(t),s(this.spot,t,e),t=n?h.Utils.convertToNewStyleAdUnit(t,n):t}}}return t.isApstagInitCalled=!1,t})();e.HBProvider=d},6418:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.HeaderBiddingDA=void 0;const s=i(3881),n=i(125),r=i(1993),o=i(2727),h=i(514),a=i(4949),d=i(4901),l=i(4029),c=i(7254);let u=(()=>{class t extends s.PrebidJs{constructor(t,e,i){super(t,"header_bidding",e,i),this.logger=new n.Logger("HB")}handleHBCommands(t,e,i,s){const n=e.container&&e.container.id||"";this.isRefreshDfpOnly()||(this.adUnit=this.buildAdUnit(n,t)),this.runPreAuction(this.spot,this.adUnit,t);const o=this.usingBrowsiPbjs?0:1;let h=null;this.pbjsInstance&&(this.hasDfpBidder(t)||this.pbjsInstance.que.push((()=>{r.EventsService.get().sendAdRequest(this.spot,this.providerName,this.buildSizes(!0,this.spot),t.plk,o)})),h=this.buildHBPromise(this.pbjsInstance,t,this.adUnit,e,i));const a=this.buildAmazonPromise(t,n,e);Promise.all([h,a]).then((()=>{if(this.hasDfpBidder(t))this.requestDfpBid(e,t,i);else{this.spot.adUnit="NA";const s=this.hasBidders(t)?this.getPrebidWinner(e):null;r.EventsService.get().sendAdMatchedEvent(this.spot,"header_bidding",!!s,t.plk,void 0,this.getHighestBidCpm(this.adUnit&&this.adUnit.code)),s?(this.spot.setSelectedSize({w:s.width,h:s.height}),this.renderAd(e,s,i,t)):i({status:"failure"})}})).catch((t=>{this.logger.error(t),s("failure")}))}buildHBPromise(t,e,i,s,n){return this.isRefreshDfpOnly()||!this.hasBidders(e)?Promise.resolve():new Promise(((s,r)=>{t.que=t.que||[],t.que.push((()=>{if(t.setConfig(this.getConfig(e.c.t)),this.addCustomConfigByProvider(e.c.b),h.default.get().listenToPbjs("bidWon",t,(t=>t&&this.winnerHandler(t,this.spot,n))),t.addAdUnits(i),this.spot.browsiAd.iframe){const t=this.spot.browsiAd;new c.default(this.getInstanceName(t),t.win).initListeners()}t.requestBids(Object.assign({adUnitCodes:[i.code],auctionId:`${i.code}_${o.Utils.generateUuid()}`,bidsBackHandler:t=>{s()}},e.c.t?{timeout:e.c.t}:{}))}))}))}requestDfpBid(t,e,i){this.addGPTScriptTag(t).then((()=>{const s=t.container?t.container.id:"",n=this.buildSizes(!0,this.spot),r=this.usingBrowsiPbjs?0:1;this.pushGPTCommands(n,t,e,s),t.win.googletag.cmd.push((()=>{t.win.googletag.pubads().addEventListener("slotRenderEnded",(n=>this.slotRenderEndedHandler(e,s,t,n,i))),t.win.googletag.pubads().addEventListener("slotOnload",(t=>this.slotOnLoadHandler(t,e))),t.win.googletag.pubads().addEventListener("slotRequested",(t=>{this.slotRequestedHandler(t,s,e,r)}))}))}))}slotRenderEndedHandler(t,e,i,s,n){var h;if(this.isBrowsiSlot(s,e)){if(this.spot.adUnit=s.slot.getAdUnitPath(),this.isForcedRefresh())return this.handleForcedRefreshSlotRenderEnded(t,s,n);const e=o.Utils.getDfpEventSize(s);return t.c.b||this.sendDfpBidMatched(null===(h=t.c.d)||void 0===h?void 0:h.aup,!s.isEmpty,e,s.slot.getSlotElementId()),this.logger.info(`dfp(da) ${s.isEmpty?"empty":JSON.stringify(e)}, au: ${s.slot.getAdUnitPath()}`,o.Utils.getSlotTargeting(s.slot)),s.isEmpty?(r.EventsService.get().sendAdMatchedEvent(this.spot,"header_bidding",!1,t.plk,void 0,this.getHighestBidCpm(this.adUnit&&this.adUnit.code||s.slot.getSlotElementId())),n({status:"failure"})):(this.spot.selectedSize||this.spot.setSelectedSize(e),r.EventsService.get().sendAdMatchedEvent(this.spot,"header_bidding",!0,t.plk,void 0,this.getHighestBidCpm(this.adUnit&&this.adUnit.code||s.slot.getSlotElementId())),this.checkApsWin(s),l.default.get().waitForBrowsiAV(s.slot,this.spot),this.expandAd(this.spot,n,t,{adUnit:"NA",provider:"header_bidding"}))}}winnerHandler(t,e,i){this.adUnit&&this.adUnit.code===t.adUnitCode&&(e.setSelectedSize({w:t.width,h:t.height}),e.selectedSize&&this.spot.expand(e.selectedSize).then((()=>{i({status:"success",highestBidName:t.bidder})})))}sendDfpBidMatched(t,e,i,s){const n={im:e,s:[i],br:-1,au:t};d.AuctionDataCollector.get().collectBidMatch(s,"dfp",n,!0)}pushGPTCommands(t,e,i,s){const n=i.c.d,r=n.a,o="false"===r.upc||!r.upc;let h=e.win.googletag||{};h.cmd=h.cmd||[],this.runPreDfpHB(i,this.adUnit),h.cmd.push((()=>{const r=h.defineSlot(n.aup,t,s);this.logger.info(`spot ${this.spot.adIndex}, definedSlot: ${r.getAdUnitPath()}, sizes:${JSON.stringify(t)}, keyValue: ${JSON.stringify(r.getTargetingMap())}`),r.addService(h.pubads()),this.setGoogleTagPrivacy(h),h.pubads().enableSingleRequest(),h.enableServices(),this.pbjsInstance?(this.pbjsInstance.que.push((()=>{this.pbjsInstance.setTargetingForGPTAsync([s]),this.pushNonHBCommands(r,i,e,h,o)})),this.spot.slot=r):this.pushNonHBCommands(r,i,e,h,o)}))}pushNonHBCommands(t,e,i,s,n){const r=this.spot.selectedSize&&this.spot.selectedSize.h&&this.spot.selectedSize.w?{w:this.spot.selectedSize.w,h:this.spot.selectedSize.h}:{w:-1,h:-1};e.c.b||d.AuctionDataCollector.get().collectDFPBidRequest(this.spot,[{dfp:[r]}]),this.assignKeyValues(t,this.getAllKeyValues(e)),this.hasAmazonBidder(e)&&i.win.apstag&&i.win.apstag.setDisplayBids(),this.runPreGoogletagDisplay(this.spot);const o=this.spot.browsiAd.container;i.iframe?s.display(o):(googletag.enableServices(),googletag.display(o),googletag.pubads().isInitialLoadDisabled()&&googletag.pubads().refresh([t],{changeCorrelator:n}))}handleForcedRefreshSlotRenderEnded(t,e,i){var s;const n={im:!e.isEmpty,s:[o.Utils.getDfpEventSize(e)],br:-1,rsn:"forced_refresh",au:null===(s=t.c.d)||void 0===s?void 0:s.aup};if(d.AuctionDataCollector.get().collectBidMatch(this.spot.browsiAd.container.id,"dfp",n,!0),r.EventsService.get().sendAdMatchedEvent(this.spot,"header_bidding",!e.isEmpty,t.plk,"forced_refresh",this.getHighestBidCpm(this.adUnit&&this.adUnit.code||e.slot.getSlotElementId())),!e.isEmpty){const e=this.spot.selectedSize?this.spot.selectedSize.selectedEmbedding:void 0;r.EventsService.get().sendAdImpression(this.spot,this.spot.providerName||"header_bidding",t.plk,e),this.spot.updateInSpotEngineTest()}i({status:"success",args:{adUnit:"NA",provider:"header_bidding"}})}getHighestBidCpm(t){if(!t||!this.pbjsInstance)return;const e=this.getHighestBidById(this.pbjsInstance.getBidResponses(),t);return e?e.cpm:void 0}slotOnLoadHandler(t,e){var i;if(this.spot.slot!=t.slot)return;new a.default(this.spot,(null===(i=e.c.d)||void 0===i?void 0:i.aup)||"").sendEvent("DFP DA slot loaded")}slotRequestedHandler(t,e,i,s){if(this.isBrowsiSlot(t,e)){this.logger.debug(`dfp(da) slotRequestedEvent ${e}`),this.spot.spotRequested++;const t=this.isForcedRefresh()?"forced_refresh":void 0;r.EventsService.get().sendAdRequest(this.spot,this.providerName,this.buildSizes(!0,this.spot),i.plk,s,t)}}}return t.isBidTimeoutListenerActive=!1,t})();e.HeaderBiddingDA=u},1345:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Inframe=void 0;const s=i(1727),n=i(1993),r=i(5857),o=i(125),h=i(2727);class a extends s.Provider{constructor(t,e,i){super(t,e),this.logger=new o.Logger("Inframe"),t.providerName=e,t.isAutoSize=!0;const s=r.InframeManager.get();this.adImpressionListener=e=>{e.detail.inframeId===s.inframeId&&(this.sendVideoAdImpressionEvent(t,i),window.removeEventListener("video_ad_impression",this.adImpressionListener))},s.shouldFetchDynamicVideo(!1,t.type)&&window.addEventListener("video_ad_impression",this.adImpressionListener)}fetch(t,e){return new Promise(((i,s)=>{n.EventsService.get().sendInframeAdRequest(this.spot,this.providerName,t.plk);let o=!1;try{r.InframeManager.get().activateVideo(this.spot.adIndex),o=!0}catch(t){this.logger.error("video activation failed",t)}const a=o?void 0:"video activation failed";n.EventsService.get().sendInframeAdMatched(this.spot,this.providerName,o,t.plk,a),o?e.appendAndGetWrapper(this.spot).then((e=>{let s=h.Utils.getElementSize(e.container);this.spot.setSelectedSize(s);this.expandAd(this.spot,i,t,{provider:"inframe",adUnit:""})})).catch((t=>{s({status:"error"})})):s({status:"error"})}))}sendVideoAdImpressionEvent(t,e){var i;n.EventsService.get().sendInframeAdImpression(t,t.providerName,e,null===(i=t.selectedSize)||void 0===i?void 0:i.selectedEmbedding)}}e.Inframe=a},5857:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InframeManager=void 0;const s=i(7730),n=i(1993),r=i(125),o=i(1128),h="video";class a{constructor(){var t,e;this.potentialSpots={},this.totalVideosToEmbedCount=0,this.videosHandledCount=0,this.spotToVideoIdxMap={},this.spotsWithDemand={},this.inframeConf=Object.assign({},null===(t=s.Profiler.get().layouts)||void 0===t?void 0:t.inframe),this.inframeId=this.inframeConf.id,this.isDynamicVideoConfigured=!!(null===(e=this.inframeConf)||void 0===e?void 0:e.dv),this.logger=new r.Logger("inframe")}static get(){return a.instance||(this.instance=new a),a.instance}addPotentialSpots(t){t.forEach((t=>{const e=document.createElement("div"),i=document.createElement("div");e.setAttribute("style","display:none"),i.setAttribute("style","display:none"),e.setAttribute("pp",t.adIndex.toString()),i.setAttribute("pp",t.adIndex.toString()),i.appendChild(e),t.ref.insertAdjacentElement("beforebegin",i),this.potentialSpots[t.adIndex.toString()]={adContainer:e,adWrapper:i}}))}sendPotentialSpots(t){const e=window;e.avnts=e.avnts||{hasDemand:t=>!1,placements:[],activation:[]};const i=[];for(let t in this.potentialSpots)i.push({element:this.potentialSpots[t].adContainer,adIndex:t});const s={placements:i};t?(t.slice(1).forEach(((t,i)=>{e.avnts.placements.push({index:i+1,data:s}),this.addVideoIndex(i+1,t)})),n.EventsService.get().sendInframePlacementEvent(i.length)):(e.avnts.placements.push({index:0,data:s}),this.addVideoIndex(0),n.EventsService.get().sendInframePlacementEvent(i.length))}handleVideoWithDemand(t){this.moveSpotToDemandList(t),this.increaseVideosHandledCount()}moveSpotToDemandList(t){this.spotsWithDemand[t]=this.potentialSpots[t],delete this.potentialSpots[t.toString()]}handleVideoWithoutDemand(){this.increaseVideosHandledCount()}getSpotContainers(t){return this.potentialSpots[t]||this.spotsWithDemand[t]}setTotalVideosToEmbedCount(t){if(this.isDynamicVideoConfigured)return void(this.totalVideosToEmbedCount=1);const e=t.c,i=Object.keys(e).filter((t=>{var i;const s=null===(i=e[+t].c.a)||void 0===i?void 0:i.template;return!!s&&s.p===h}));this.totalVideosToEmbedCount=i.length,i.length>1&&this.sendPotentialSpots(i)}increaseVideosHandledCount(){this.videosHandledCount++,this.isHandledAllVideos()&&this.removeAllPotentialSpotsContainers()}isHandledAllVideos(){return this.totalVideosToEmbedCount===this.videosHandledCount}removeAllPotentialSpotsContainers(){Object.keys(this.potentialSpots).forEach((t=>{var e;const i=this.potentialSpots[t];null===(e=i.adWrapper.parentElement)||void 0===e||e.removeChild(i.adWrapper)}))}getVideoIndex(t){const e=this.spotToVideoIdxMap[t.toString()];return void 0===e?0:e}addVideoIndex(t,e){void 0!==e&&(this.spotToVideoIdxMap[e]=t)}isProviderInframe(t){return t.genericParams.displayName===h||"inframe"===t.providerName}isInframeConfigured(){return!!this.inframeId&&this.isDynamicVideoConfigured}shouldFetchDynamicVideo(t,e){return e===o.SpotType.DYNAMIC_MC&&this.isInframeConfigured()&&!this.isHandledAllVideos()&&!t}hasVideoDemand(t){var e;this.logger.debug(`Requesting inframe has demand for adix:${t.adIndex}`,t.ref);const i=t.adIndex,s=window.avnts,r=(null==s?void 0:s.ready)&&"function"==typeof(null==s?void 0:s.hasDemand);let o=!1;const h=null===(e=this.potentialSpots[i])||void 0===e?void 0:e.adContainer;r&&h&&(o=null==s?void 0:s.hasDemand({index:this.videosHandledCount,element:h,adIndex:i}));const a=r?o?"":"no demand":"api not ready";return this.logger.debug(`Response for inframe has demand, adix:${t.adIndex}: isMatched:${!(!r||!o)}, reason: ${a||"none"} `,t.ref),n.EventsService.get().sendInframeHasDemandEvent(t,!(!r||!o),a),!(!r||!o)}activateVideo(t){const e=window.avnts,{adContainer:i}=this.getSpotContainers(t);this.handleVideoWithDemand(t),null==e||e.activation.push({index:this.videosHandledCount-1,data:{element:i,spotIndex:t}})}}e.InframeManager=a},3881:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PrebidJs=void 0;const s=i(125),n=i(7730),r=i(2727),o=i(1993),h=i(8895),a=i(3006);let d=(()=>{class t extends h.HBProvider{constructor(t,e,i,r){super(t,e),this.iframeDoc=null,this.usingBrowsiPbjs=!1,this.adUnit=null,this.logger=new s.Logger("PrebidJs"),this.profile=n.Profiler.get()}hasBidders(t){return!(!t.c.b||!t.c.b.length)}fetch(t,e){return new Promise((i=>{this.logger.info(`fetching spot ${this.spot.adIndex}`,this.spot),e.appendAndGetWrapper(this.spot).then((e=>(this.hasBidders(t)&&this.addPrebidScriptTag(e),e))).then((e=>this.runHBCommands(t,e,this.handleHBCommands.bind(this)))).then((t=>i(t))).catch((t=>{"not_supported"===t?(this.logger.error(`fetching failed: Prebid version ${this.pbjsInstance?this.pbjsInstance.version:""} is not supported`,this.pbjsInstance),o.EventsService.get().sendAdBlockedEvent(this.spot,[{reason:"prebid_version_unsupported",message:`${this.pbjsInstance?this.pbjsInstance.version:""}`}]),i({status:"not_supported"})):(this.logger.error("fetching failed: ",t),i("error"))}))}))}buildIframe(t,e,i){const s=t.document.createElement("iframe");return s.id=e,s.width=`${i.width}`,s.height=`${i.height}`,s.scrolling="no",s.frameBorder="0",s}getHighestBidById(t,e){const i=t[e]&&t[e].bids;return i?i.reduce(((t,e)=>t.cpm>e.cpm?t:e)):null}addPrebidScriptTag(e){if(!e.win)return Promise.reject("error");if(!this.profile.siteInfo.prebidPath)return Promise.reject("no_url");if(e.iframe)return this.injectPbjs(e),Promise.resolve(e);const i=this.getInstanceName(e);return this.pbjsInstance=e.win[i],this.isUnsupportedVersion(this.pbjsInstance)&&Promise.reject("not_supported"),this.pbjsInstance&&(t.isBrowsiPbjs||this.pbjsInstance.version)?t.isBrowsiPbjs?(this.logger.info(`Using browsi existing ${i} ad index ${this.spot.adIndex}`),this.usingBrowsiPbjs=!0,Promise.resolve(e)):new Promise(((t,s)=>{this.pbjsInstance.que=this.pbjsInstance.que||[],this.pbjsInstance.que.push((()=>{this.isUnsupportedVersion(this.pbjsInstance)?s("not_supported"):(this.logger.info(`Using publisher ${i} ad index ${this.spot.adIndex}`),t(e))}))})):(this.injectPbjs(e),t.isBrowsiPbjs=!0,Promise.resolve(e))}isUnsupportedVersion(t){return!!t&&!!t.version&&0===t.version.indexOf("v0")}getInstanceName(t){const e="pbjs";return t.iframe?e:this.profile.siteInfo.prebidData&&this.profile.siteInfo.prebidData.g||e}buildAdUnit(t,e){const i=this.getBidConfig(this.spot,e.c.b,e.c.d),s=e.od;s&&s[50]&&s[50].sp&&i.forEach((t=>{t.params[this.browsiViewability50Key]=s[50].p}));let n={};i.forEach((t=>{"unruly"===t.bidder&&(n=this.buildVideoMediaType(t)),t.browsiSpot=this.spot.adIndex}));const r=this.getGPID(t,e.c.d);return{code:t,mediaTypes:Object.assign({banner:{sizes:this.buildSizes(!1,this.spot)}},n),ortb2Imp:{ext:{gpid:r,data:{pbadslot:r,adserver:{adslot:r}}}},bids:i}}injectPbjs(t){if(t.win){this.logger.info("Injecting Browsi Pbjs"),this.usingBrowsiPbjs=!0,t.win.pbjs=t.win.pbjs||{},this.pbjsInstance=t.win.pbjs,this.pbjsInstance&&(this.pbjsInstance.que=this.pbjsInstance.que||[]);const e=t.win.document.createElement("script");e.async=!0;const i=this.profile.siteInfo.prebidPath;e.setAttribute("src",i),e.addEventListener("error",(()=>{o.EventsService.get().sendErrorEvent("script_load_error",i,"prebid")})),t.win.document.head.appendChild(e)}}getGPID(t,e){return`${e?e.aup+"#":""}${t}`}getConfig(t){let e=Object.assign({enableSendAllBids:!0,debug:this.profile.debugMode},t?{bidderTimeout:t}:{});this.usingBrowsiPbjs&&(e=Object.assign(e,Object.assign(Object.assign({},a.default.prebidConf),this.profile.prebidConfig||{})));let i=r.Utils.getExternalFlowHandler("setPrebidConfig");return i&&i(e),this.logger.info("Using Prebid configuration:",e),e}renderAd(t,e,i,s){var n;if(t.win&&t.container&&t.container.id){const r=this.buildIframe(t.win,t.container.id,e);if(((null===(n=t.iframe)||void 0===n?void 0:n.contentDocument)?t.iframe.contentDocument.body:t.container).appendChild(r),this.pbjsInstance&&e.adId&&r.contentWindow)return this.pbjsInstance.renderAd(r.contentWindow.document,e.adId),this.expandAd(this.spot,i,s);i({status:"failure"})}}getBidResponses(t,e){return e&&e[t]?e[t].bids:[]}getBidConfig(t,e,i){if(!e)return[];return e.reduce(((e,s)=>{switch(s.a&&this.handleBidAlias(s.a,s.bc.bidder),this.getBidName(s)){case"pulsepoint":return e.concat(this.buildPulsepointBids(s,t));case"ix":return e.concat(this.buildIndexExchangeBids(s,t));case"ias":return e.concat(this.buildIASBids(s,i));default:return e.concat([s.bc])}}),[])||[]}handleBidAlias(e,i){const s=this.spot.browsiAd.iframe,n=t.activeBidAlias[e]&&t.activeBidAlias[e]===i,r=s||!n;this.pbjsInstance&&r&&(s||(t.activeBidAlias[e]=i),this.pbjsInstance.que.push((()=>{this.pbjsInstance.aliasBidder(e,i)})))}buildVideoMediaType(t){const e=t.params["video-context"],i=t.params["video-width"],s=t.params["video-height"];return e&&i&&s?{video:{context:e,playerSize:[[i,s]]}}:{}}buildPulsepointBids(t,e){return e.getCompatibleSizes().map((e=>({bidder:t.bc.bidder,params:Object.assign(Object.assign({},t.bc.params),{cf:r.Utils.sizeToString(e)})})))}buildIndexExchangeBids(t,e){return e.getCompatibleSizes().map((e=>({bidder:t.bc.bidder,params:Object.assign(Object.assign({},t.bc.params),{size:[e.w,e.h]})})))}buildIASBids(t,e){return[{bidder:t.bc.bidder,params:Object.assign(t.bc.params,{adUnitPath:e.aup})}]}getBidName(t){return t.a?t.a:t.bc.bidder}addCustomConfigByProvider(t){t&&t.forEach((t=>{if(this.pbjsInstance)switch(this.getBidName(t)){case"pubmatic":case"aardvark":this.pbjsInstance.setConfig({userSync:{filterSettings:{iframe:{bidders:"*",filter:"include"}}}})}}))}getPrebidWinner(t){if(t.container&&t.container.id&&this.pbjsInstance){const e=t.container.id;return this.pbjsInstance&&this.pbjsInstance.getHighestCpmBids().find((t=>t.adUnitCode===e))||null}return null}}return t.isBrowsiPbjs=!1,t.activeBidAlias={},t})();e.PrebidJs=d},1727:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Provider=void 0;const s=i(2727),n=i(1993),r=i(2362),o=i(7730),h=i(4269),a=i(4869),d=i(1128),l=i(8104),c=i(3006),u=i(4647),p=i(3034);e.Provider=class{constructor(t,e){this.spot=t,this.providerName=e,this.spot.providerName=this.providerName,this.hasFluidSizeSupport=!1,this.profile=o.Profiler.get(),this.browsiViewability50Key=this.profile.browsiViewability50Key}getAdUnit(t){return(null==t?void 0:t.aup)||""}addGPTScriptTag(t){var e,i;return(null===(i=null===(e=null==t?void 0:t.win)||void 0===e?void 0:e.googletag)||void 0===i?void 0:i.apiReady)?Promise.resolve(t):new Promise(((e,i)=>{if(t&&t.win){const i=t.win.document.createElement("script");i.async=!0,i.setAttribute("src","//securepubads.g.doubleclick.net/tag/js/gpt.js"),i.addEventListener("load",(()=>{e(t)})),t.win.document.head.appendChild(i)}else this.logger.error("failed to append gpt script tag"),i(t)}))}sendAdImpression(t,e){var i;n.EventsService.get().sendAdImpression(t,t.genericParams.displayName||this.providerName,e,null===(i=t.selectedSize)||void 0===i?void 0:i.selectedEmbedding)}expandAd(t,e,i,s){t.selectedSize?(t.handleRefreshSuccess(),t.expand(t.selectedSize).then((n=>{t.selectedSize?(t.isImpression=!0,this.sendAdImpression(t,i.plk),"s"===t.tags.positionTag&&r.Embedder.addStickyCloseButton(t,t.browsiAd.wrapper),"generic_js"!==this.providerName&&"inframe"!==this.providerName&&this.isAdInViewport().then((e=>{e&&this.sendAdInViewEvent(t)})),t.updateInSpotEngineTest(),this.logger.info(`added [${n.w}X${n.h}]: `,t.browsiAd.wrapper),this.verifyStickySpotSize(n)&&t.subscribeToViewabilityService("success"),e(Object.assign({status:"success"},s||{}))):e({status:"failure"})}))):e({status:"failure"})}sendBrowsiImpressionDOMEvent(){var t,e;const i={element:this.spot.browsiAd.container,adUnit:(null===(t=this.spot.slot)||void 0===t?void 0:t.getAdUnitPath())||"NA",refreshCount:(null===(e=this.spot.refresh)||void 0===e?void 0:e.count)||0};return s.Utils.dispatchDOMEvent(u.BROWSI_IMPRESSION_DOM_EVENT_NAME,i)}isAdInViewport(){if(!this.profile.siteInfo.adInViewport||this.spot.refresh.count>0)return Promise.resolve(!1);const t=50+(this.spot.browsiAd.admarking?s.Utils.getElementSize(this.spot.browsiAd.admarking).h:0),e=this.spot.browsiAd.wrapper;if(!e)return Promise.resolve(!1);return s.Utils.getElementSize(e).h>t?Promise.resolve(!0):new Promise((i=>{const n=new h.default(e);n.addResizeListener((()=>{if(s.Utils.getElementSize(e).h>t)return n.removeResizeListener(),i(!0)}))}))}sendAdInViewEvent(t){if(t.browsiAd&&t.browsiAd.wrapper){const e=t.browsiAd.wrapper,i=a.ViewabilityService.get().inViewPercentage({getCoords:()=>s.Utils.getElementPosition(e),getHeight:()=>s.Utils.getElementSize(e).h});i&&n.EventsService.get().sendAdInViewport(t,i)}}useOriginalSizes(t){if(t.type===d.SpotType.STICKY)return p.SpotsUtils.getConf(t.tags).useOriginalSizes;const e=s.Utils.getExternalFlowHandler("useOriginalSizes");return!!e&&e(Object.assign({},t))}buildSizes(t,e){if(e.isRefreshing()&&e.selectedSize){if(!this.useOriginalSizes(e))return t&&s.Utils.isFluidSize(e.selectedSize)?["fluid"]:[e.selectedSize.w,e.selectedSize.h]}return e.getCompatibleSizes().filter((e=>t||!t&&!s.Utils.isFluidSize(e))).map((e=>t&&s.Utils.isFluidSize(e)?["fluid"]:[e.w,e.h]))}isBrowsiSlot(t,e){return t.slot&&t.slot.getSlotElementId()===e}getAllKeyValues(t){let e=[];Array.isArray(t.kv)&&(e=t.kv.map((t=>({key:t.k||t.key,value:t.v||t.value}))));const i=this.getPredictionToSend(t);i&&e.push({key:this.browsiViewability50Key,value:this.getBrowsiViewability(i)}),this.spot.refresh.requested&&!this.spot.refresh.dcsRefresh&&this.spot.refresh.kv&&e.push({key:"browsiRefresh",value:"True"});const n=t.c.pgkv||t.c&&t.c.d&&t.c.d.pgkv||{},r=Object.assign(s.Utils.clone(this.profile.pageKeyValues||{}),s.Utils.clone(n||{}));if(r)for(let t in r){const i=this.getTargetingValue(r[t],t);i.length&&e.push({key:t,value:i})}return e}assignKeyValues(t,e){e.forEach((e=>{t.setTargeting(e.key,e.value)}))}getTargetingValue(t,e){var i,s,n,r,o,h,a;if(!t.v)return[];if((null===(r=null===(n=null===(s=null===(i=this.spot)||void 0===i?void 0:i.browsiAd)||void 0===s?void 0:s.win)||void 0===n?void 0:n.googletag)||void 0===r?void 0:r.pubads)&&-1!=(null===(a=null===(h=null===(o=this.spot)||void 0===o?void 0:o.browsiAd)||void 0===h?void 0:h.win)||void 0===a?void 0:a.googletag.pubads().getTargetingKeys().indexOf(e)))return[];if(!t.j)return t.v;try{return this.spot.browsiAd.win.eval(t.v&&t.v[0])||[]}catch(t){return[]}}getPredictionToSend(t){var e;const i=null===(e=null==t?void 0:t.od)||void 0===e?void 0:e[50];return(null==i?void 0:i.sp)?i:void 0}getBrowsiViewability(t){return t.p&&t.p>=0?(Math.floor(10*t.p)/10).toFixed(2):"NA"}runPreAuction(t,e,i){const n=s.Utils.getExternalFlowHandler("preAuction");n&&n(t,e,i)}runPreGoogletagDisplay(t){const e=s.Utils.getExternalFlowHandler("preGoogletagDisplay");e&&e(t)}getAdSelector(){return this.spot.browsiAd.container&&this.spot.browsiAd.container.id||""}verifyStickySpotSize(t){return this.spot.type!==d.SpotType.STICKY||(s.Utils.isValidStickyHeight(t.h)?(this.profile.layouts.spots.sticky.location===l.StickyLocation.TOP?window.document.body.style.paddingTop=t.h+"px":window.document.body.style.paddingBottom=t.h+"px",!0):(this.spot.destroySlot(),r.Embedder.removeAdFromDom(this.spot),this.logger.info("sticky ad removed,",t.h," is over 30%"),!1))}setGoogleTagPrivacy(t){if(!c.default.hasUserConsent){const e=c.default.getCurrentConsentType();"ccpa"===e?t.pubads().setPrivacySettings({restrictDataProcessing:!0}):"gdpr"===e&&t.pubads().setRequestNonPersonalizedAds(1)}}}},4569:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ApiSpot=void 0;const s=i(4603),n=i(1128),r=i(3034),o=i(7730),h=i(6319),a=i(9763),d=i(6864);class l extends a.DirectSpot{constructor(t,e,i){const o={positionTag:i.positionTag||"in",typeTag:s.TypeTag.API,oldType:n.SpotType.API},a=Math.min(e,d.AD_INDEX_LIMIT);super(t,o,a,i.sizes||[],0,h.DcsUtils.isDcs);const l=this.getLayoutConfig(o.positionTag);this.adIndex=500+a,this.options=i,this.compatibleSizes=i.sizes||l&&this.buildCompatibleSizes(l.sizes)||[],this.options.sizes=this.compatibleSizes,this.optimizeViewability=this.shouldOptimizeApiViewability(l),this.isLazyLoading=r.SpotsUtils.shouldLazyLoad(this)}getLayoutConfig(t){const e={typeTag:s.TypeTag.API,positionTag:t,oldType:n.SpotType.API};return r.SpotsUtils.getConf(e)}shouldOptimizeApiViewability(t){var e,i,s;if(t){const n=t.viewabilityOptimizationBlocklist,r=n&&(!!(null===(e=this.options)||void 0===e?void 0:e.adUnit)&&n.includes(null===(i=this.options)||void 0===i?void 0:i.adUnit)||n.includes(this.ref.id));return!(null===(s=this.options)||void 0===s?void 0:s.disableViewabilityOptimization)&&!r}return!0}checkSpotOptions(t){const e=this.options,i=t.c.d||t.c,s=this.attemptIndex>1;return this.logger.info("Merging spot options:",e," waterfall ",s),t.c.ri&&void 0!==e.refresh&&(e.refresh.active?e.refresh.refreshSecond&&(t.c.ri.r=1e3*e.refresh.refreshSecond):t.c.ri.r=-1),s||(e.adUnit&&"demo-placement"!==t.plk&&(i.aup=e.adUnit,this.adUnit=e.adUnit),e.keyValues&&(t.kv=t.kv?t.kv.concat(e.keyValues):e.keyValues)),t}prepareResponseForFetch(t){return this.checkSpotOptions(t)}buildCompatibleSizes(t){return t.map((t=>({w:t.w,h:t.h,adSizeType:o.Profiler.getAdSizeType(t),minSizeForWrapping:-1,optionalEmbeddings:["break"],selectedEmbedding:"break"})))}handleEmptyResponse(){return 1==this.attemptIndex&&this.options&&this.options.adUnit&&this.options.sizes?{rt:"empty_api",c:{a:{autoSize:!0,inIframe:!1},aup:this.options.adUnit,p:""},plk:"",szs:this.options.sizes}:null}unsetRefDisplay(){"INSIDE"===this.targetElementPosition&&"none"===this.ref.style.display&&this.ref.style.removeProperty("display")}getQueryBaseElement(){var t;return(null===(t=this.options)||void 0===t?void 0:t.shadowElement)||document}}e.ApiSpot=l},9763:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DirectSpot=void 0;const s=i(6864);class n extends s.Spot{constructor(t,e,i,s,n,r,o){super(t,e,i,s,n,r,o)}}e.DirectSpot=n},7989:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DynamicSpot=void 0;const s=i(6454),n=i(4603),r=i(1128),o=i(7730);class h extends s.ScannedSpot{constructor(t,e,i,s,h,a){super(t,i,s,h,{positionTag:{[r.SpotType.DYNAMIC_MC]:{index:0,positionTag:"in"},[r.SpotType.DYNAMIC_RIGHT_RAIL]:{index:300,positionTag:"r"},[r.SpotType.DYNAMIC_LEFT_RAIL]:{index:400,positionTag:"l"}}[e].positionTag,typeTag:n.TypeTag.DYNAMIC,oldType:e},a,o.Profiler.get().spotEngineConfig.tryInsideTables)}}e.DynamicSpot=h},4510:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FixedSpot=void 0;const s=i(6454),n=i(4603),r=i(1128),o={[r.SpotType.FIXED_MC]:{index:600,positionTag:"in"},[r.SpotType.FIXED_TOP]:{index:100,positionTag:"t"},[r.SpotType.FIXED_BOTTOM]:{index:200,positionTag:"b"},[r.SpotType.FIXED_RIGHT_RAIL]:{index:700,positionTag:"r"},[r.SpotType.FIXED_LEFT_RAIL]:{index:800,positionTag:"l"}};let h=(()=>{class t extends s.ScannedSpot{constructor(e,i,s,r,h,a,d){const l={positionTag:o[h].positionTag,typeTag:n.TypeTag.FIXED,oldType:h};t.typeIndexSelectorMap[d]=t.typeIndexSelectorMap[d]||0,super(e,i,s,r,l,a),this.demandIndex=t.typeIndexSelectorMap[d],t.typeIndexSelectorMap[d]++,this.selector=d}}return t.typeIndexSelectorMap={},t})();e.FixedSpot=h},6454:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ScannedSpot=void 0;const s=i(6864);class n extends s.Spot{constructor(t,e,i,s,n,r,o){super(t,n,e,i,s,r,o)}}e.ScannedSpot=n},6864:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Spot=e.AD_INDEX_LIMIT=void 0;const s=i(2727),n=i(125),r=i(7730),o=i(6393),h=i(1993),a=i(1128),d=i(4869),l=i(3034),c=i(6102),u=i(4269),p=i(5701),v=i(2362),f=i(5857),m=i(2763),g=i(1528);e.AD_INDEX_LIMIT=99;class b{constructor(t,e,i,o,h,d,u){this.demandCompatibleSizes=null,this.wrappedElements=[],this.isAutoSize=!1,this.ref=t,this.adIndex=-1,this.type=e.oldType,this.typeIndex=i,this.demandIndex=i,this.attemptIndex=1,this.isSaas=!1,this.compatibleSizes=o,this.availableHeight=h,this.offsetTop=s.Utils.getElementPosition(t).top,this.browsiAd={h:-1,w:-1},this.isImpression=!1,this.logger=new n.Logger("Spot"),this.refresh={refreshed:!1,requested:!1,active:!1,count:0,impressionsEventCount:0,rate:0,do:!1,kv:!1,blockRefresh:!1,limit:0,noDemandRefresh:!1,isGenericRefresh:()=>!("generic_js"!==this.providerName||!this.isRefreshing()||!this.genericParams.refresh)},this.tableConfiguration=u?this.buildTableConfiguration():void 0,this.adRequestBlockedSent=!1,this.isLazyLoading=!1,this.spotRequested=0,this.positionTypes=b.getPositionType(t),this.isDcs=d,this.profile=r.Profiler.get(),this.isMeasurable=!1,this.optimizeViewability=!0,this.targetElementPosition=l.SpotsUtils.getTargetElementPosition(e),this.tags=e,this.shouldUsePlaceholder()&&(this.placeholder=new c.default),this.vConf={minViewInitiator:50,duration:1e3,shouldReportOneTime:!(this.type!==a.SpotType.STICKY&&"s"!==this.tags.positionTag)},this.genericParams={},this.isCustomRefreshConfigured=s.Utils.isCustomRefreshConfigured()}buildTableConfiguration(){const t=this.getTableIfExists();if(!t)return;const e=t.rows[0].cells.length,i=document.createElement("tr"),s=document.createElement("td");return s.setAttribute("colspan",e.toString()),s.setAttribute("style","width: 100%; display: none;"),i.appendChild(s),{table:t,columns:e,adWrapper:i,mainTd:s}}positionTypeToString(){return s.Utils.sortedString(this.positionTypes)}getExpectedEmbedding(){const t=this.getCompatibleSizes().map((t=>t.selectedEmbedding));if(1!==s.Utils.toSet(t).size)return"na";switch(t[0]){case"break":return"b";case"right":return"r";case"left":return"l";default:return"na"}}expand(t){const e=t=>{var e;const i=null===(e=t.contentWindow)||void 0===e?void 0:e.document.body;if(i){t.style.setProperty("width","100%","important");const e=new u.default(i);e.addResizeListener((()=>{const n=s.Utils.getElementSize(i).h;t.style.setProperty("height",n+"px","important"),setTimeout((()=>{e.removeResizeListener()}),1e3)}))}};return this.getOuterWrapper().then((i=>new Promise(((n,r)=>{var o,h;const a=s.Utils.isFluidSize(t),d=s.Utils.getAdMarkingExpectedHeight(),l=this.getEmbeddingStyle(t);null===(o=this.placeholder)||void 0===o||o.removePlaceholderStyle(this.browsiAd,t.selectedEmbedding),i.setAttribute("height",`${a||this.isAutoSize?"auto":t.h+d}`),i.setAttribute("width",`${a||this.isAutoSize?"100%":t.w}`),i.setAttribute("style",l.w),l.c&&this.browsiAd.container&&this.browsiAd.container.setAttribute("style",l.c);const c=this.tableConfiguration&&i&&i.parentElement?i.parentElement:null;if(c&&c.setAttribute("style","width: 100%;"),this.browsiAd.iframe){let i=`text-align:center;display: block;margin: auto;width: ${t.w}px !important;`;const s=this.getAdMinHeight();i+=s||`min-height: ${t.h}px !important;`,this.browsiAd.iframe.setAttribute("style",i),(a||(null===(h=this.profile.layouts.uxFixes)||void 0===h?void 0:h.dynamicIframeSize))&&e(this.browsiAd.iframe)}const u=s.Utils.getElementPosition(i);a?setTimeout((()=>{const t=i.getBoundingClientRect();this.browsiAd.w=t.width,this.browsiAd.h=t.height,this.browsiAd=s.Utils.merge(this.browsiAd,{offsetTop:u.top,offsetLeft:u.left}),n({w:this.browsiAd.w,h:this.browsiAd.h})}),800):(this.browsiAd=s.Utils.merge(this.browsiAd,{offsetTop:u.top,offsetLeft:u.left}),n({w:this.browsiAd.w,h:this.browsiAd.h}))})))).then((t=>new Promise(((e,i)=>{this.insertAdMarking(),this.setWrappedElementsStyle(),e(t)}))))}getOuterWrapper(){return new Promise(((t,e)=>{if(this.browsiAd.wrapper){const i=this.getQueryBaseElement().querySelector(`#${this.browsiAd.wrapper.id}`);i?t(i):e()}else e()}))}setWrappedElementsStyle(){this.selectedSize&&this.selectedSize.selectedEmbedding&&["left","right"].includes(this.selectedSize.selectedEmbedding)&&this.wrappedElements.forEach((t=>{t.minWrapSize.h<=this.selectedSize.h&&t.el.style&&(t.el.style.wordBreak="break-word")}))}setSelectedSize(t){const e=this.findSize(t);if(e)this.selectedSize=e;else{const e=l.SpotsUtils.getConf(this.tags).wrapperStyle,i=r.Profiler.buildCompatibleSize(r.Profiler.getWidthForEmbed(this.ref),t,s.Utils.getAdMarkingExpectedHeight(),!0,!1,e);i&&(i.optionalEmbeddings.includes("break")&&(i.selectedEmbedding="break"),this.selectedSize=i,this.logger.warn(`unexpected ${JSON.stringify(t)} to`,this.browsiAd.wrapper))}this.browsiAd=Object.assign({},this.browsiAd,t)}isSizeInSpot(t){return!!this.findSize(t)}findSize(t){return this.getCompatibleSizes().find((e=>e.w===+t.w&&e.h===+t.h))}getDomId(){return this.domId||"e"}setDomId(t){this.domId=t}getEmbeddingStyle(t){var e,i,s;if(this.type===a.SpotType.STICKY){let n=`position:fixed!important;${null===(e=r.Profiler.get().layouts.spots.sticky)||void 0===e?void 0:e.location.toLowerCase()}: 0 !important; left: 50%; transform: translateX(-50%); margin:0 auto !important; z-index:9999;text-align:center; width:${t.w}px !important; height:${t.h}px !important;`;const o=this.getExternalStyle();return(null===(i=null==o?void 0:o.b)||void 0===i?void 0:i.w)&&(n+=o.b.w),{w:n,c:(null===(s=null==o?void 0:o.b)||void 0===s?void 0:s.c)||""}}let n={w:"",c:""};return t.selectedEmbedding?n=this.buildStyle(t,p.DEFAULT_SPOT_STYLE):this.logger.error(`no embedding for spot ${this.adIndex}`,this.browsiAd.wrapper),n}buildStyle(t,e){var i,n,r;const o=l.SpotsUtils.getConf(this.tags).style;let h={w:"",c:""};if("break"===t.selectedEmbedding){const r=s.Utils.isFluidSize(t),a=`margin: auto;margin-top:${e.b.m.t}px !important;margin-bottom:${e.b.m.b}px !important`;h.w=`text-align:center;display:block;clear: both !important;${a};width:${r?"100%":"auto"} !important; height: auto !important;`,(null===(i=null==o?void 0:o.b)||void 0===i?void 0:i.w)&&(h.w+=o.b.w),(null===(n=null==o?void 0:o.b)||void 0===n?void 0:n.c)&&(h.c=o.b.c)}else{const i=s.Utils.getAdMarkingExpectedHeight(),n="left"===t.selectedEmbedding?e.l:e.r,r="left"===t.selectedEmbedding?null==o?void 0:o.l:null==o?void 0:o.r,a=getComputedStyle(this.ref),d=`margin-top:${-1===n.m.t?parseInt(a.marginTop||"0"):n.m.t}px !important;\n margin-right:${n.m.r}px !important;\n margin-bottom:${n.m.b}px !important;\n margin-left:${n.m.l}px !important`,l=`padding-top:${-1===n.p.t?parseInt(a.paddingTop||"0"):n.p.t}px !important;\n padding-right:${n.p.r}px !important;\n padding-bottom:${n.p.b}px !important;\n padding-left:${n.p.l}px !important`,c=this.isAutoSize?"width:auto;height:auto;":`width:${t.w}px !important; height:${t.h+i}px !important;`;h.w=`text-align:center;float:${t.selectedEmbedding};position:relative;${s.Utils.removeSpaces(d)};${s.Utils.removeSpaces(l)};${c}`,(null==r?void 0:r.w)&&(h.w+=r.w),(null==r?void 0:r.c)&&(h.c=r.c)}return(null===(r=this.placeholder)||void 0===r?void 0:r.size)&&this.selectedSize&&this.placeholder.size.h>this.selectedSize.h&&(h.c+="display: flex; justify-content: center; align-items: center;"),h.c+=this.getAdMinHeight(),h}insertAdMarking(){const t=r.Profiler.get().spotEngineConfig.adMarking;if(!t||!this.browsiAd.wrapper||this.browsiAd.admarking)return;const e=s.Utils.buildAdMarking(this,t),i=(t,i)=>{i.insertBefore(e,i.firstChild)},n=s.Utils.getExternalFlowHandler("adMarkingHandler");if(n)this.browsiAd.admarking=n(e,this.browsiAd.wrapper,i,this);else if(this.type!==a.SpotType.STICKY)return i(0,this.browsiAd.wrapper),void(this.browsiAd.admarking=e)}spotShouldRefresh(){return this.refresh.active&&!this.refresh.blockRefresh&&(!this.refresh.limit||this.refresh.count<=this.refresh.limit)}getExternalStyle(){return l.SpotsUtils.getConf(this.tags).style}getTableIfExists(){if(this.ref){return s.Utils.findParentElementByType("table",this.ref)}return null}cloneBrowsiAd(t){return Object.assign({},t)}destroySlot(){var t,e;const i=this.slot&&(null===(e=null===(t=this.browsiAd.win)||void 0===t?void 0:t.googletag)||void 0===e?void 0:e.destroySlots([this.slot]));return delete this.slot,!i&&this.logger.debug("could not destroy slot",this),i}updateRefreshDetails(t){this.refresh.requested||this.isAllowedProviderForRefresh(t)&&(this.refresh=Object.assign(this.refresh,{active:t.c.ri&&t.c.ri.r>-1,refreshed:!!this.refresh.refreshed&&this.refresh.refreshed,requested:!!this.refresh.requested&&this.refresh.requested,count:this.refresh.count?this.refresh.count:0,impressionsEventCount:this.refresh.impressionsEventCount?this.refresh.impressionsEventCount:0,rate:t.c.ri&&t.c.ri.r?t.c.ri.r:0,do:!(!t.c.ri||!t.c.ri.do)&&t.c.ri.do,kv:!(!t.c.ri||!t.c.ri.kv)&&t.c.ri.kv,limit:t.c.ri&&t.c.ri.l?t.c.ri.l:0,noDemandRefresh:!(!t.c.ri||!t.c.ri.nd)&&t.c.ri.nd}))}refreshSpot(){var t,e;null===(t=this.placeholder)||void 0===t||t.deactivatePlaceholder(),this.canRefresh()&&("generic_js"!==this.providerName||(null===(e=this.genericParams)||void 0===e?void 0:e.refresh)?(this.logger.info(`Refreshing spot #${this.adIndex}`),d.ViewabilityService.get().unsubscribe(this),this.refresh=Object.assign(this.refresh,{requested:!0,refreshed:!1,dcsRefresh:!1,oldBrowsiAd:this.cloneBrowsiAd(this.browsiAd)}),this.refresh.count++,this.waterfall=[],this.isMeasurable=!1,o.YieldClient.get().processSingleSpot(this)):this.logger.debug("Custom in view refresh failed. no refresh function supplied by template"))}refreshDcsSpotOnNewPv(){this.profile.layouts.analysisMode||(this.logger.info("Refreshing dcs spot"),d.ViewabilityService.get().unsubscribe(this),this.refresh=Object.assign(this.refresh,{active:!0,requested:!0,refreshed:!1,dcsRefresh:!0,oldBrowsiAd:this.cloneBrowsiAd(this.browsiAd)}),this.waterfall=[],o.YieldClient.get().processSingleSpot(this))}canRefresh(){return!this.isRefreshing()&&this.spotShouldRefresh()}stopRefreshing(){this.refresh.blockRefresh=!0}isRefreshing(){return this.refresh.active&&this.refresh.requested&&!this.refresh.refreshed}getAdMinHeight(){var t,e,i;let n="";if(this.placeholder&&s.Utils.isChangingViewport(this.browsiAd.wrapper))if(this.placeholder.active)n+=this.placeholder.size.h?`min-height:${this.placeholder.size.h}px;`:"";else{const s=null===(i=null===(e=null===(t=this.refresh)||void 0===t?void 0:t.oldBrowsiAd)||void 0===e?void 0:e.container)||void 0===i?void 0:i.style.minHeight;n+=s?`min-height:${s};`:""}return n}handleRefreshFailed(){this.refresh.requested=!1,this.refresh.refreshed=!1}handleRefreshSuccess(){if(this.isRefreshing()){if(this.refresh.oldBrowsiAd&&this.refresh.oldBrowsiAd.wrapper){let t;v.Embedder.removeAdMarkingFromDom(this.browsiAd),t=this.tableConfiguration?this.refresh.oldBrowsiAd.wrapper.parentElement:this.refresh.oldBrowsiAd.wrapper,t&&(s.Utils.removeElement(t),s.Utils.reportBrowsiAdRemoved(t)),this.refresh.oldBrowsiAd.externalElement&&s.Utils.removeElement(this.refresh.oldBrowsiAd.externalElement)}this.updateRefreshedSuccessStatus(),this.refresh.impressionsEventCount=this.refresh.count,this.logger.info(`spot #${this.adIndex} refreshed with count ${this.refresh.count}`)}}updateRefreshedSuccessStatus(){this.refresh.requested=!1,this.refresh.refreshed=!0}updateBrowsiAdWrapper(){this.refresh.oldBrowsiAd&&this.refresh.oldBrowsiAd.wrapper&&(this.browsiAd.wrapper=this.refresh.oldBrowsiAd.wrapper,this.domId=this.refresh.oldBrowsiAd.wrapper.id,this.browsiAd.container=document.getElementById(this.refresh.oldBrowsiAd.wrapper.id.replace("adWrapper","adContainer"))||void 0,this.browsiAd.iframe=this.refresh.oldBrowsiAd.iframe)}initializeTypeIndex(t){const i=Math.min(t,e.AD_INDEX_LIMIT);this.typeIndex=i,this.demandIndex=i}isAllowedProviderForRefresh(t){return("header_bidding"!==this.providerName||!!t.c.d)&&"inframe"!==this.providerName}get refreshInfo(){return this.isCustomRefreshConfigured?void 0:{shouldRefresh:this.spotShouldRefresh.bind(this),rate:this.refresh.rate,doRefresh:()=>this.refreshSpot()}}getCustomRefreshInfo(t){return{shouldRefresh:this.spotShouldRefresh.bind(this),rate:t,doRefresh:()=>this.refreshSpot()}}sendViewedImpression(t,e){f.InframeManager.get().isProviderInframe(this)?h.EventsService.get().sendInframeViewedImpression(this,t,e):h.EventsService.get().sendViewedImpression(this,t,e)}static getPositionType(t){const e=r.Profiler.get();let i=[];const n=s.Utils.getElementSize(t),o=s.Utils.getElementPosition(t);if(e.domData&&e.domData.mainContent.inputElements&&e.domData.mainContent.start>-1){const t=e.domData.mainContent,r=t.inputElements[0].getBoundingClientRect().width;let h=s.Utils.getElementPosition(t.inputElements[0]).left,a=0,d=o.left,l=Math.round(d+n.w),c=o.top;for(let e=0;e=h&&l<=a?i.push("in-line"):(d=a&&i.push("right rail")),ct.endPosition&&i.push("bottom"),-1!=i.indexOf("in-line")&&-1==i.indexOf("bottom")&&-1==i.indexOf("top")&&i.push("within main content")}else i.push("out of main content");return 0===i.length&&i.push("unknown"),i}shouldWaitForUserEngagement(){return!s.Utils.isEngagedUser(this)&&!this.isEagerFirstFold()}subscribeToViewabilityService(t){const e="success"!=t?this.buildNoDemandViewabilityServiceObject(this.vConf):this.buildViewabilityServiceObject(this.vConf);this.isCustomRefreshConfigured&&this.initCustomRefreshRate(),d.ViewabilityService.get().subscribe(e)}initCustomRefreshRate(){var t,e,i,n;let r=Object.assign({},(null===(t=this.browsiAd.container)||void 0===t?void 0:t.id)?{id:this.browsiAd.container.id}:{});if("generic_js"===this.providerName)Object.assign(r,Object.assign(Object.assign(Object.assign({},this.genericParams.adUnit?{au:this.genericParams.adUnit}:{}),(null===(e=this.genericParams.gamInfo)||void 0===e?void 0:e.lid)?{lid:this.genericParams.gamInfo.lid}:{}),(null===(i=this.genericParams.gamInfo)||void 0===i?void 0:i.oid)?{oid:this.genericParams.gamInfo.oid}:{}));else{const t=s.Utils.getGAMResponseInfo(this.slot);Object.assign(r,Object.assign(Object.assign(Object.assign({},(null===(n=this.slot)||void 0===n?void 0:n.getAdUnitPath())?{au:this.slot.getAdUnitPath()}:{}),(null==t?void 0:t.lid)?{lid:t.lid}:{}),(null==t?void 0:t.oid)?{oid:t.oid}:{}))}m.CustomRefreshRate.get().sendCustomRefreshRate(g.DemandRequestType.SINGLE,[r])}isEagerFirstFold(){return this.profile.layouts.eagerFirstFold&&s.Utils.getElementFoldNumber(this.ref)<=2}buildViewabilityServiceObject(t){var e;const i=this.sendViewedImpression.bind(this),n=this.generateInViewActionsMap(t,null===(e=this.refreshInfo)||void 0===e?void 0:e.shouldRefresh());return{conf:t,refreshInfo:this.refreshInfo,sendViewedImpression:i,type:0,getCoords:()=>s.Utils.getSpotCoords(this),getHeight:()=>this.browsiAd.h,root:()=>this,element:this.browsiAd.iframe?this.browsiAd.iframe:this.browsiAd.container,inViewActionsMap:n}}buildNoDemandViewabilityServiceObject(t){let e={};return this.spotShouldRefresh()&&this.refresh.rate>0&&!this.isCustomRefreshConfigured&&(e=d.ViewabilityService.get().addActionToMap(["refresh"],[this.refresh.rate],e)),this.isCustomRefreshConfigured&&(e=d.ViewabilityService.get().addActionToMap(["custom refresh"],[3e3],e)),{conf:t,refreshInfo:this.refreshInfo,sendViewedImpression:()=>{},type:0,getCoords:()=>s.Utils.getSpotCoords(this),getHeight:()=>this.browsiAd.h,root:()=>this,element:this.browsiAd.iframe?this.browsiAd.iframe:this.browsiAd.container,inViewActionsMap:e}}updateInSpotEngineTest(){const t=r.Profiler.get();t.debugMode&&t.spotEngineTest&&t.spotEngineTest.spots&&(t.spotEngineTest.spots[this.adIndex]=this.serialize())}serialize(){return{ref:this.ref,adIndex:this.adIndex,attemptIndex:this.attemptIndex,compatibleSizes:this.compatibleSizes,demandCompatibleSizes:this.demandCompatibleSizes,availableHeight:this.availableHeight,selectedSize:this.selectedSize,tableConfiguration:this.tableConfiguration,offsetTop:this.offsetTop,browsiAd:{iframe:this.browsiAd.iframe,wrapper:this.browsiAd.wrapper,container:this.browsiAd.container,admarking:this.browsiAd.admarking,w:this.browsiAd.w,h:this.browsiAd.h},adUnit:this.adUnit,isSaas:this.isSaas,providerName:this.providerName,isImpression:this.isImpression,slot:this.slot,domId:this.domId,logger:this.logger,refresh:this.refresh,adRequestBlockedSent:this.adRequestBlockedSent,isLazyLoading:this.isLazyLoading,spotRequested:this.spotRequested,waterfall:this.waterfall,positionTypes:this.positionTypes,type:this.type,typeIndex:this.typeIndex,placeholder:this.placeholder}}getIdentifier(){return`ai_${this.adIndex}_ati_${this.attemptIndex?this.attemptIndex:1}_rc_${this.refresh.active?this.refresh.count:0}`}prepareResponseForFetch(t){return t}handleEmptyResponse(){return null}shouldUsePlaceholder(){var t;return this.profile.layouts.placeholder&&!!this.compatibleSizes.length&&(this.compatibleSizes.length>1||!this.isOneOnOne(this.compatibleSizes[0]))&&!(null===(t=this.refresh)||void 0===t?void 0:t.requested)}setPlaceholderSize(t){var e;if(null===(e=this.placeholder)||void 0===e?void 0:e.active){let e;const i=this.getPlaceholderSize(t),n=s.Utils.getExternalFlowHandler("changePlaceholderSize");if(n){e=n(Object.assign({},this),Object.assign({},i));!!e.w&&!!e.h||this.placeholder.deactivatePlaceholder()}this.placeholder.setSize(e||i)}}isOneOnOne(t){return 1===t.w&&1===t.h}getMaxSize(t){let e=0,i=0;return t.forEach((t=>{t.w>e&&(e=t.w),t.h>i&&(i=t.h)})),{w:e,h:i}}getPlaceholderSize(t){const e=this.getMaxSize(t);if(s.Utils.isFluidSize(e)||this.isOneOnOne(e))return{w:s.Utils.getElementSize(this.ref).w,h:250};let i=e.w,n=e.h;switch(this.tags.positionTag){case"t":case"b":i=970,n=300;break;case"in":this.hasWrappedEmbedding()?(i=300,n=0):(n=300,i=970)}return{w:Math.min(e.w,i),h:Math.min(e.h,n)}}hasWrappedEmbedding(){return this.getCompatibleSizes().some((t=>t.optionalEmbeddings.includes("wrapped")||t.optionalEmbeddings.includes("left")||t.optionalEmbeddings.includes("right")))}closePlaceholderAndRemove(){var t;(null===(t=this.placeholder)||void 0===t?void 0:t.active)?this.placeholder.closePlaceholder(!0,this):v.Embedder.removeAdFromDom(this)}unsetRefDisplay(){}getCompatibleSizes(){return this.demandCompatibleSizes||this.compatibleSizes}generateInViewActionsMap(t,e){let i={};i=d.ViewabilityService.get().addActionToMap(["event"],[t.duration],i),!t.shouldReportOneTime&&r.Profiler.get().sendViewabilityCheckpoints&&(i=d.ViewabilityService.get().addActionToMap(["event"],[2e3,5e3,1e4,2e4,25e3,3e4],i));return e&&this.spotShouldRefresh()&&this.refresh.rate>0&&!this.isCustomRefreshConfigured&&(i=d.ViewabilityService.get().addActionToMap(["refresh"],[this.refresh.rate],i)),this.isCustomRefreshConfigured&&(i=d.ViewabilityService.get().addActionToMap(["custom refresh"],[3e3],i)),i}getQueryBaseElement(){return document}}e.Spot=b},5382:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.StickySpot=void 0;const s=i(9763),n=i(4603),r=i(1128),o=i(8104),h=i(3034);class a extends s.DirectSpot{constructor(t,e){var i;const s={positionTag:"s",typeTag:n.TypeTag.STICKY,oldType:r.SpotType.STICKY},a=null===(i=h.SpotsUtils.getConf(r.SPOT_TAGS_MAP[r.SpotType.STICKY]))||void 0===i?void 0:i.location;super(window.document.body,s,-1,t,-1,e),this.positionTypes=[a==o.StickyLocation.BOTTOM?"bottom":"top"],this.isLazyLoading=!1}}e.StickySpot=a},6652:()=>{var t,e,i,s;if(Array.prototype.reduce||Object.defineProperty(Array.prototype,"reduce",{value:function(t){if(null===this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof t)throw new TypeError(t+" is not a function");var e,i=Object(this),s=i.length>>>0,n=0;if(arguments.length>=2)e=arguments[1];else{for(;n=s)throw new TypeError("Reduce of empty array with no initial value");e=i[n++]}for(;n>>0;if("function"!=typeof t)throw new TypeError;for(var s=[],n=arguments.length>=2?arguments[1]:void 0,r=0;r>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var s=arguments[1],n=0;n0?1:-1)*Math.floor(Math.abs(e)):e}(t);return Math.min(Math.max(e,0),i)},function(t){var i=this,n=Object(t);if(null==t)throw new TypeError("Array.from requires an array-like object - not null or undefined");var r,o=arguments.length>1?arguments[1]:void 0;if(void 0!==o){if(!e(o))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(r=arguments[2])}for(var h,a=s(n.length),d=e(i)?Object(new i(a)):new Array(a),l=0;l>>0,s=arguments.length>=2?arguments[1]:void 0,n=0;n>>0;if(0===s)return!1;var n,r,o=0|e,h=Math.max(o>=0?o:s-Math.abs(o),0);for(;h>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var s=arguments[1],n=0;n