"use strict";(()=>{var m=Object.defineProperty;var b=(n,e,t)=>e in n?m(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var r=(n,e)=>m(n,"name",{value:e,configurable:!0});var i=(n,e,t)=>(b(n,typeof e!="symbol"?e+"":e,t),t);var g="ad_refresh_count",c="refreshable",u="true";var a=window;var f=class f{constructor(){i(this,"googletag");i(this,"isEventListenersApplied",!1);i(this,"slotMap",{});i(this,"inViewTime");i(this,"inViewPercent");i(this,"maxRefreshes");i(this,"onlyValidTraffic");i(this,"refreshKey");i(this,"refreshValue");i(this,"isValidTraffic",r(()=>{if(this.onlyValidTraffic){let e=this.googletag.pubads().getTargeting("IDS");return(e==null?void 0:e[0])!=="1"}return!0},"isValidTraffic"));i(this,"isSlotRefreshable",r(e=>e.getTargeting(this.refreshKey).indexOf(this.refreshValue)>-1,"isSlotRefreshable"));i(this,"incrementRefreshCounter",r(e=>{let t=e.getTargeting(g),o=t==null?void 0:t[0],s=o?Number(o)+1:1;e.setTargeting(g,String(s))},"incrementRefreshCounter"));i(this,"startRefreshTimer",r((e,t)=>setTimeout(()=>{t.refreshes<this.maxRefreshes&&this.isValidTraffic()?(this.incrementRefreshCounter(e),t.refreshes+=1,this.googletag.pubads().refresh([e]),t.viewable=!1,t.timer=null):this.stop()},this.inViewTime*1e3),"startRefreshTimer"));i(this,"applyRefreshTimer",r((e,t)=>{t.viewable&&!t.timer&&(t.timer=this.startRefreshTimer(e,t))},"applyRefreshTimer"));i(this,"clearAllTimers",r(()=>{for(let e of Object.keys(this.slotMap)){let t=this.slotMap[e];t.timer&&(clearTimeout(t.timer),t.timer=null)}},"clearAllTimers"));i(this,"impressionViewableListener",r(e=>{let{slot:t}=e;if(!this.isSlotRefreshable(t))return;let o=t.getSlotElementId(),s=this.slotMap[o];if(s){s.viewable=!0;let l=s.inViewPercentage>this.inViewPercent;s.refreshes<this.maxRefreshes&&l&&this.applyRefreshTimer(t,s)}else this.slotMap[o]={refreshes:0,viewable:!0}},"impressionViewableListener"));i(this,"slotVisibilityListener",r(e=>{let{slot:t}=e;if(!this.isSlotRefreshable(t))return;let o=t.getSlotElementId(),s=this.slotMap[o];if(s){s.inViewPercentage=e.inViewPercentage;let l=s.inViewPercentage>this.inViewPercent;s.refreshes<this.maxRefreshes&&l?this.applyRefreshTimer(t,s):s.timer&&(clearTimeout(this.slotMap[o].timer),s.timer=null)}else this.slotMap[o]={refreshes:0,inViewPercentage:e.inViewPercentage}},"slotVisibilityListener"))}apply({inViewTime:e=30,inViewPercent:t=70,maxRefreshes:o=1,onlyValidTraffic:s=!1,refreshKey:l=c,refreshValue:E=u}){this.googletag=a.googletag,Object.assign(this,{inViewTime:e,inViewPercent:t,maxRefreshes:o,onlyValidTraffic:s,refreshKey:l,refreshValue:E}),this.isEventListenersApplied||(this.isEventListenersApplied=!0,googletag.pubads().addEventListener("impressionViewable",this.impressionViewableListener),googletag.pubads().addEventListener("slotVisibilityChanged",this.slotVisibilityListener))}stop(){this.isEventListenersApplied&&(this.isEventListenersApplied=!1,googletag.pubads().removeEventListener("impressionViewable",this.impressionViewableListener),googletag.pubads().removeEventListener("slotVisibilityChanged",this.slotVisibilityListener),this.clearAllTimers())}};r(f,"AdRefreshService");var p=f,h=new p;var d=r(n=>{a.googletag.cmd.push(()=>{h.apply(n)})},"apply"),v=r(()=>{a.googletag.cmd.push(()=>{h.stop()})},"stop");a.AdRefresh={apply:d,stop:v};})();
