(()=>{"use strict";const e=window;e.blogherads=e.blogherads||{adq:[]};const t=()=>e.blogherads,i=window,n=()=>{const e=t();void 0!==e&&e.adq.push((()=>{if((!i.pmcadm_options?.suppress_option||Array.isArray(i.pmcadm_options?.suppress_option)||(e.disableAds("PMC Ads Suppression",i.pmcadm_options.suppress_option),!i.pmcadm_options?.suppress_option?.all))&&i.pmcadm_options?.suppress_entries?.query_string)for(const t of i.pmcadm_options.suppress_entries.query_string){if(!t.entry||!t.suppress_option)return;for(const i of t.entry.filter((e=>e)))if((window.location.search&&window.location.search.includes(i)||window.location.hash&&window.location.hash.includes(i))&&(e.disableAds("PMC Ads Suppression - Query String",t.suppress_option),t.suppress_option.all))return}}))},a={player_main_div:".pmc-contextual-player",message_pattern:"pmcadm:dfp:isdirect=true",init:function(){this.bind_events()},bind_events:function(){var e=this;e.pause_triggered=!1,jQuery(window).on("message",(function(t){var i=t.originalEvent;if("string"==typeof i.data)if(i.data.substring(0,e.message_pattern.length)===e.message_pattern)"object"==typeof pmcadm_options&&"string"==typeof pmcadm_options.contextual.directSold&&"show"===pmcadm_options.contextual.directSold||e.remove_contextual_player();else if("pmc_show_interrupt_ads"===i.data){if(window.contextual_player)try{if("playing"!==window.contextual_player.getState()){var n=window.contextual_player.getConfig();"viewable"===n.autostart&&n.viewable&&(e.pause_triggered=!0)}else e.pause_triggered=!0;e.pause_triggered&&window.contextual_player.pause()}catch(e){}}else"pmc_hide_interrupt_ads"===i.data&&e.pause_triggered&&(window.contextual_player.play(),e.pause_triggered=!1)})),"object"==typeof contextual_player&&(contextual_player.on("play",e.current_playing),contextual_player.on("adPlay",e.current_playing),contextual_player.on("relatedReady",(function(){var t=contextual_player.getPlugin("related");"object"==typeof t&&t.on("feedShown",(function(){e.create_playlist_nav(),jQuery(".pmc-contextual-player .jw-related-control").on("click",e.current_playing)}))})),contextual_player.on("ready",(function(){var t=contextual_player.getPlugin("related");"object"==typeof t&&t.on("feedShown",(function(){e.create_playlist_nav(),jQuery(".pmc-contextual-player .jw-related-control").on("click",e.current_playing)}))})))},remove_contextual_player:function(){var e=jQuery(this.player_main_div);0VIEWING'),"object"==typeof t&&1===t.length&&t.addClass("is-active"),0===jQuery(".jw-related-shelf-item[data-jw-index="+e+"] .contextual-self-now-playing").length&&t.find(".jw-related-shelf-item-image").append(i)},create_playlist_nav:function(){if(0===jQuery(".pmc-contextual-player .l-adm-contextual-video__shadow").length){var e=jQuery('
'),t=jQuery('
');jQuery(".pmc-contextual-player .jw-related-control-left").prepend(e),jQuery(".pmc-contextual-player .jw-related-control-right").prepend(t)}}},o=window;function r(){const e=document.querySelector("#pmc-adm-ad-interrupts div.pmc-adm-boomerang-pub-div div");let t="";return e&&(t=e.id),t}const l=(e,t)=>{const i=document.getElementById(e);i?.style&&(i.style.display=t)},s=(()=>{let e=1;return{send:function(t,i,n){const a={type:"SKMBoomerangMessageRequest",requestId:e++,data:n,method:i};t.postMessage(a,"*")}}})(),d=window,c=d.document;class p{constructor(e){e.forEach((e=>this.push(e)))}push(e){try{e.call(null)}catch(e){}}attachConnatix(e){if(c.documentElement.classList.contains("floatingplayer-nofloat"))e.disableFloatingMode();else{d.addEventListener("message",(({data:t})=>{"pmcadm:floatingplayer=nofloat"===t&&e.disableFloatingMode()}),!1);const i=t();i.adq.push((()=>{i.trackVideoPlayerFloatingState&&i.trackVideoPlayerFloatingState(e)}))}}sendAtlasMessage(e,t){s.send(d,e,t)}}const _=window;if(_.pmc=_.pmc||{adm:[]},_.pmc.adm=_.pmc.adm||[],Array.isArray(_.pmc.adm)){const e=_.pmc.adm;_.pmc.adm=new p(e)}const u=()=>_.pmc,m=window,f=m.document,h=window,y=document,g=window,v=g.document;function w(e,t,i){const n=v.createElement(e);return n.className=t,i&&(n.textContent=i),n}function b(e){const t=w("div","floating-preroll-ad-header live"),i=w("div","floating-preroll-ad-live-tag","Live"),n=w("div","floating-preroll-ad-title",e),a=w("button","floating-preroll-ad-close");a.textContent="×";const o=w("span","visually-hidden","Close Player");return a.appendChild(o),"object"==typeof g.pmc_harmony_event_data&&"true"===g.pmc_harmony_event_data.is_live_campaign&&t.appendChild(i),t.appendChild(n),t.appendChild(a),t}function j(e){v.querySelectorAll(e).forEach((e=>{e.remove()}))}const k=window,C=k.document,Q=window,x=()=>Q.pmcadm_floating_preroll_data||{},S=()=>Q.pmcFloatingVideoOptions||{},E=e=>{const t=u();t.adm.push((()=>{t.adm.sendAtlasMessage("FloatingVideoStateChange",e)}))},I=window,M=u();I.pmc_admanager=new function(){const e=t();this.settings={interrupts_hide_container:"#container",redirect_interval:0,interrupt_counter:m.pmc_intertitial_ad_timer||0},this.show_interrupt_ads=function(){if(void 0!==navigator.userAgent&&/googlebot|googlebot-news/i.test(navigator.userAgent))return;const t=f.referrer,i=this;let n="",a=null;if(void 0!==t&&""!==t&&(n=t.match(/:\/\/(.[^/]+)/)[1],"flipboard.com"===n))return;if(o.pmc_is_adblocked)return;if(!i.apply_filters("pmc-adm-show-interrupt-ads",!0))return;i.settings.interrupt_counter=m.pmc_intertitial_ad_timer||0,this.settings.redirect_interval&&clearInterval(this.settings.redirect_interval);const s=e.getSlotById(r()),d=u();if(a=d.cookie?.get(d.pmc_adm_interstitial_ck),null!=a&&""!==a||"object"!=typeof s)this.hide_interrupt_ads();else{d.cookie?.set(d.pmc_adm_interstitial_ck,1,d.pmc_adm_interstitial_interval,"/","strictly-necessary"),i.settings.redirect_interval=setInterval((function(){i.interrupt_timer()}),1e3),f.body.classList.add("interrupt-ads"),l("pmc-adm-interrupts-container","block");try{m.postMessage("pmc_show_interrupt_ads","*"),d.hooks?.do_action("show_interrupt_ads")}catch(e){}s.display(),i.interrupt_timer()}}.bind(this),this.hide_interrupt_ads=function(){clearInterval(this.settings.redirect_interval),this.settings.redirect_interval=0,f.body.classList.remove("interrupt-ads"),m.dispatchEvent(new Event("resize")),l("pmc-adm-interrupts-container","none");const t=r(),i=new CustomEvent("pmc-hide-interrupt-ads",{detail:"Fires when the interrupt ads are done."});f.dispatchEvent(i),e.getSlots().forEach((function(i){t!==i.domId?i.display():e.destroySlots([i.domId])}));try{m.postMessage("pmc_hide_interrupt_ads","*"),u().hooks?.do_action("hide_interrupt_ads")}catch(e){}}.bind(this),this.hide_interrupt=function(){this.hide_interrupt_ads()}.bind(this),this.interrupt_timer=function(){0===this.settings.interrupt_counter?this.hide_interrupt_ads():(this.settings.redirect_interval&&this.settings.interrupt_counter--,f.getElementById("pmc_ads_interrupts_timer")&&(f.getElementById("pmc_ads_interrupts_timer").innerHTML=this.settings.interrupt_counter))}.bind(this),this.apply_filters=function(e,t,i){const n=u();return n.hooks?.apply_filters?n.hooks.apply_filters(e,t,i):t}.bind(this)},M.prerollPlayer=new function(){this.player_instance={},this.pmc_floating_ad_main_div=".floating-preroll-ad",this.pmc_floating_ad_docked_div="footer.footer",this.is_floating_ad_showed=!1,this.time_gap=0,this.cookie="",this.interval_id="",this.direct_slold=!1,this.init=function(){const e=this,t=x();if(void 0===t||!t||void 0===t.time_gap||"undefined"==typeof pmc)return!1;if(e.cookie=t.cookie_name,""===e.cookie||!e.cookie)return!1;const i=pmc.cookie.get(e.cookie);if(null!=i&&""!==i&&0!==parseInt(t.time_gap))return e.remove_floating_player(),!1;document.body.classList.contains("interrupt-ads")?e.interval_id=setInterval((function(){0===pmc_admanager.settings.redirect_interval&&e.show_floating_preroll_ad()}),1e3):e.show_floating_preroll_ad(),pmc.hooks.add_action("pmc_adm_dfp_direct_sold",(function(){e.direct_slold=!0,e.remove_floating_player()})),Q.addEventListener("message",(({data:t})=>{"pmcadm:floatingplayer=nofloat"===t&&jQuery(e.pmc_floating_ad_main_div).hide()}),!1),Q.blogherads.addEventListener("noFloat",(function(){jQuery(e.pmc_floating_ad_main_div).hide()})),Q.blogherads.addEventListener("noFloatUnload",(function(t){void 0!==t.noFloatCount&&t.noFloatCount<=0&&jQuery(e.pmc_floating_ad_main_div).show()}))}.bind(this),this.apply_title=function(e){if("string"==typeof e&&""!==e){const t=jQuery(".floating-preroll-ad-title");t.empty();const i=jQuery("").text(e);t.append(i)}}.bind(this),this.apply_connatix_video_title=function(){jQuery("#connatix_floating_preroll_ad_div").on("cnxReady",function(e){if(e.detail&&e.detail.playerInstance){const t=e.detail.playerInstance.getVideoDetails();t&&t.title&&this.apply_title(t.title)}}.bind(this))}.bind(this),this.show_floating_preroll_ad=function(){if(window.pmc&&window.pmc.no_ads)return;const e=this,t=x(),i="connatix"===t.player_name,n=t.media_id,a=t.playlist_id;let o=!1;if(a?o="https://cdn.jwplayer.com/v2/playlists/"+a:n&&(o="https://cdn.jwplayer.com/v2/media/"+n),!o&&!i)return;let r=400,l=225;const s=t.backup_channel_id,d=t.channel_id,c=jQuery("[id ^=jwplayer_][id $=_div]"),p=t.player_id,_=jQuery(".l-pvm-video [id ^=jwplayer_][id $=_div]"),u=t.time_gap;if(""!==u&&(e.timegap=u),clearInterval(e.interval_id),1200>jQuery(window).width()&&(l=190,r=300,jQuery(".floating-preroll-ad-container").css("width","314px"),jQuery(".floating-preroll-ad-container").css("height","204px")),i&&jQuery("#connatix_floating_preroll_ad").children().length>0)this.apply_connatix_video_title(),this.show_floating_player(),jQuery(document).on("click",".floating-preroll-ad-close",(function(){e.remove_floating_player()}));else if(i||0!=c.length-_.length||"function"!=typeof window.pmc_jwplayer)jQuery(this.pmc_floating_ad_main_div).remove();else{const t={backupChannelId:s,channelId:d,playlist:o,autostart:!0,mute:!0,floating:!0,height:l,width:r},i=function(t){e.player_instance=t,!0===jQuery(e.pmc_floating_ad_main_div).hasClass("live-stream")&&e.show_floating_player(),e.player_instance.on("beforePlay",(function(){if(1===parseInt(S().jwplayer_style_v2)){const t=e.player_instance.getPlaylistItem().title;e.apply_title(t)}})),e.player_instance.on("firstFrame",(function(){e.show_floating_player()})),e.player_instance.on("adImpression",(function(){pmc.cookie.set(e.cookie,1,e.time_gap,"/","functional"),e.is_floating_ad_showed=!0,e.show_floating_player()})),e.player_instance.on("adError",(function(){!0!==e.is_floating_ad_showed&&(1===parseInt(S().preroll_not_required)?e.show_floating_player():e.remove_floating_player())}))}.bind(this),n=function(){jQuery(e.pmc_floating_ad_main_div).length&&jQuery(e.pmc_floating_ad_docked_div).length&&!jQuery(".floating-preroll-ad-container").hasClass("no-float")&&!jQuery(e.pmc_floating_ad_main_div).hasClass("live-stream")&&(jQuery(e.pmc_floating_ad_main_div).insertBefore(jQuery(e.pmc_floating_ad_docked_div)),jQuery(".floating-preroll-ad-container").addClass("no-float"))};window.pmc_jwplayer("jwplayer_floating_preroll_ad",p).setup(t).whenReady(i).whenNoFloat(n),jQuery(document).on("click",".floating-preroll-ad-close",(function(){e.remove_floating_player()}))}}.bind(this),this.show_floating_player=function(){!0!==this.is_floating_ad_showed&&(this.is_floating_ad_showed=!0,setTimeout((function(){jQuery(".floating-preroll-ad-close").show()}),5e3),jQuery(this.pmc_floating_ad_main_div).show(),E("float"))}.bind(this),this.remove_floating_player=function(){"function"==typeof this.player_instance.remove&&this.player_instance.remove(),jQuery(this.pmc_floating_ad_main_div).remove(),!0===this.is_floating_ad_showed&&E("close"),this.is_floating_ad_showed=!1}.bind(this)},M.harmony=new function(){!function(e,...t){console.debug.bind(null,e)(...t)}("pmcHarmony instance created."),this.init=function(){this.init_DOM()},this.init_DOM=function(){const e=C.querySelector(k.pmc_harmony_player_settings?k.pmc_harmony_player_settings.target_container:"body"),t=C.querySelector(".live-stream");if(!t||!e)return;e.prepend(t);"object"==typeof k.pmc_meta&&"mobile"!==k.pmc_meta.env||(null!==C.querySelector(".floating-preroll-ad-container")?k.addEventListener("scroll",(()=>{const e=C.querySelector(".jw-float-bar.jw-reset");e&&e.remove(),C.body.scrollTop>150||C.documentElement.scrollTop>150?(C.querySelector(".live-stream").classList.add("harmony-floating-player"),C.querySelector(".live-stream .floating-preroll-ad-container").style.top=k.pmc_harmony_player_settings?.top_offset||"50px"):(C.querySelector(".live-stream").classList.remove("harmony-floating-player"),C.querySelector(".live-stream .floating-preroll-ad-container").style.top="0px")}).bind(this)):null!==C.querySelector(".cbs-et-floating-player-container")&&k.addEventListener("scroll",(()=>{let e=C.querySelector(".csb-et-sticky-placeholder");const t=C.querySelector(".cbs-et-floating-player-container");e||t||(e=C.createElement("div"),e.classList.add("csb-et-sticky-placeholder"),t.parentNode.insertBefore(e,t)),k.scrollY>=300||C.documentElement.scrollTop>=300?(C.querySelector(".live-stream")?.classList.add("harmony-floating-player"),C.querySelector(".cbs-et-floating-player-container.live-stream").style.top=k.pmc_harmony_player_settings?.top_offset||"50px"):(k.scrollY<=10||C.documentElement.scrollTop<=10)&&(C.querySelector(".live-stream")?.classList.remove("harmony-floating-player"),C.querySelector(".cbs-et-floating-player-container.live-stream").style.top="0px")}).bind(this)));const i=C.querySelector(".live-stream .floating-preroll-ad-close");i&&i.addEventListener("click",(()=>{const e=C.querySelector(".live-stream");e&&e.remove()}).bind(this))},this.isEventAdScheduledTime=function(){if("object"==typeof k.pmcadm_options?.scheduled_ads?.floating_video_preroll_ad&&"number"==typeof k.pmcadm_options.scheduled_ads.floating_video_preroll_ad.start_timestamp&&"number"==typeof k.pmcadm_options.scheduled_ads.floating_video_preroll_ad.end_timestamp){const e=k.pmcadm_options.scheduled_ads.floating_video_preroll_ad.start_timestamp,t=k.pmcadm_options.scheduled_ads.floating_video_preroll_ad.end_timestamp,i=Math.floor(Date.now()/1e3);if(i>e&&t>i||window.location.hash.includes("debug-harmony"))return!0}return!1},this.switchToHarmonyPlayer=function(){if("object"==typeof k.pmc_harmony_event_data){const e=parseInt(k.pmc_harmony_event_data.start_time),t=parseInt(k.pmc_harmony_event_data.end_time),i=Math.floor(Date.now()/1e3);(i>e&&"off"!==k.pmc_harmony_event_data.is_enabled&&i{const e=e=>!e||!e.left||!e.right;return t?e(a)?n:a:e(n)?a:n})(),r=e.properties.viewUrlTracked?o.left:e.properties.dfpCreativeParameters.viewURLPrefix+o.left,l=e.properties.dfpCreativeParameters.bodyBackgroundColor&&jQuery.trim(e.properties.dfpCreativeParameters.bodyBackgroundColor)||null;jQuery("body").css("background-color",l),e.properties.viewUrlTracked=!0,e.dom.leftRailContainer.css("background-image",'url("'+r+'")'),e.dom.rightRailContainer.css("background-image",'url("'+o.right+'")');const s=o.right;jQuery('').on("load",(function(){const t=this.width,i=e.get_content_DOM();e.dom.leftRailContainer.width(t).offset({left:i.offset().left-t}),e.dom.rightRailContainer.width(t).offset({left:i.offset().left+i.outerWidth()})}))}.bind(this),this.compute_old_and_new_break_obj=function(e){const t={LARGE:1900,MEDIUM:1350,SMALL:1260},i=this.compute_rail_size(t),n=this.compute_rail_size({LARGE:1900,MEDIUM:1420,SMALL:1340});return{oldBreakObj:e[t[i]],newBreakObj:e[n.toLowerCase()]}}.bind(this),this.compute_rail_size=function(e){const t=jQuery(window).width();let i=0;return i=t=e.MEDIUM?"MEDIUM":"LARGE",i}.bind(this),this.get_content_DOM=function(){let e=["main-wrapper"];const t=document.querySelector("#skin-ad-section");void 0!==t&&void 0!==t.dataset.contentContainer&&(e=t.dataset.contentContainer.split(",")),e=this.apply_filters("pmc-adm-dfp-skin-main-content",e);for(let t=0;t{const{message:i,iframeId:n}=e,a=t();if("pmcadm:disableCls=true"===i){const e=y.getElementById(n),i=(e=>{if(!e||"object"!=typeof e||!e.contentWindow)return!1;let i=e.parentNode;for(;i&&i!==document.body;){const e=t(),n=e.getSlotById?.(i.id);if(n)return n.domId;i=i.parentNode}return!1})(e);if("string"==typeof i){const e=y.getElementById(i)?.parentNode;e instanceof HTMLElement&&(e.style.setProperty("min-width",""),e.style.setProperty("min-height",""))}"function"==typeof t().reloadAds&&a?.disableClsOptimization&&a.disableClsOptimization(e)}}),!1)}},a.init(),t().adq.push((()=>{n(),M.skinAds.init(),M.prerollPlayer.init(),M.harmony.init(),M.clsOptimization.init()}))})();