Article Line Long1

Lifestyle

`;e.insertAdjacentHTML(i,s)}return document.getElementById(t)}_repeatDynamicAds(t){const i=[],n=this._removeRecipeCapExperiment.result&&t.location===d.Recipe?99:this.locationMaxLazySequence.get(t.location),s=t.lazy?C(n,0):0,o=t.max,r=t.lazyMax,a=0===s&&t.lazy?o+r:Math.min(Math.max(s-t.sequence+1,0),o+r),l=Math.max(o,a);for(let n=0;n=o;i.push(e({},t,{sequence:s,lazy:r}))}}return i}_locationEnabled(e){const t=this._clsOptions.enabledLocations.includes(e.location),i=this._clsOptions.disableAds&&this._clsOptions.disableAds.all||document.body.classList.contains("adthrive-disable-all"),n=!document.body.classList.contains("adthrive-disable-content")&&!this._clsOptions.disableAds.reasons.has("content_plugin");return t&&!i&&n}constructor(e,t){this._clsOptions=e,this._adInjectionMap=t,this._recipeCount=0,this._mainContentHeight=0,this._mainContentDiv=null,this._totalAvailableElements=[],this._minDivHeight=250,this._densityDevice=h.Desktop,this._pubLog={onePerViewport:!1,targetDensity:0,targetDensityUnits:0,combinedMax:0},this._densityMax=.99,this._smallerIncrementAttempts=0,this._absoluteMinimumSpacingByDevice=250,this._usedAbsoluteMinimum=!1,this._infPageEndOffset=0,this.locationMaxLazySequence=new Map([[d.Recipe,5]]),this.locationToMinHeight={Below_Post:Ee,Content:Ee,Recipe:Ee,Sidebar:Ee};const{tablet:i,desktop:n}=this._clsOptions.siteAds.breakpoints;this._device=((e,t)=>{const i=window.innerWidth;return i>=t?"desktop":i>=e?"tablet":"phone"})(i,n),this._config=new ae(e),this._clsOptions.enabledLocations=this._config.enabledLocations,this._clsTargetAdDensitySiteExperiment=this._clsOptions.siteAds.siteExperiments?new xe(this._clsOptions):null,this._stickyContainerAdsExperiment=new Oe,this._stickyContainerRecipeExperiment=new Ae,this._removeRecipeCapExperiment=new ue}}function De(e,t){if(null==e)return{};var i,n,s={},o=Object.keys(e);for(n=0;n=0||(s[i]=e[i]);return s}class ke{get enabled(){return!0}}class Ie extends ke{setPotentialPlayersMap(){const e=this._videoConfig.players||[],t=this._filterPlayerMap(),i=e.filter((e=>"stationaryRelated"===e.type&&e.enabled));return t.stationaryRelated=i,this._potentialPlayerMap=t,this._potentialPlayerMap}_filterPlayerMap(){const e=this._videoConfig.players,t={stickyRelated:[],stickyPlaylist:[],stationaryRelated:[]};return e&&e.length?e.filter((e=>{var t;return null==(t=e.devices)?void 0:t.includes(this._device)})).reduce(((e,t)=>(e[t.type]||(w.event(this._component,"constructor","Unknown Video Player Type detected",t.type),e[t.type]=[]),t.enabled&&e[t.type].push(t),e)),t):t}_checkPlayerSelectorOnPage(e){const t=this._potentialPlayerMap[e].map((e=>({player:e,playerElement:this._getPlacementElement(e)})));return t.length?t[0]:{player:null,playerElement:null}}_getOverrideElement(e,t,i){if(e&&t){const n=document.createElement("div");t.insertAdjacentElement(e.position,n),i=n}else{const{player:e,playerElement:t}=this._checkPlayerSelectorOnPage("stickyPlaylist");if(e&&t){const n=document.createElement("div");t.insertAdjacentElement(e.position,n),i=n}}return i}_shouldOverrideElement(e){const t=e.getAttribute("override-embed");return"true"===t||"false"===t?"true"===t:!!this._videoConfig.relatedSettings&&this._videoConfig.relatedSettings.overrideEmbedLocation}_checkPageSelector(e,t,i=[]){if(e&&t&&0===i.length){return!("/"===window.location.pathname)&&w.event("VideoUtils","getPlacementElement",new Error(`PSNF: ${e} does not exist on the page`)),!1}return!0}_getElementSelector(e,t,i){return t&&t.length>i?t[i]:(w.event("VideoUtils","getPlacementElement",new Error(`ESNF: ${e} does not exist on the page`)),null)}_getPlacementElement(e){const{pageSelector:t,elementSelector:i,skip:n}=e,s=R(t),{valid:o,elements:r}=s,a=De(s,["valid","elements"]),l=I(i),{valid:c,elements:d}=l,h=De(l,["valid","elements"]);if(""!==t&&!o)return w.error("VideoUtils","getPlacementElement",new Error(`${t} is not a valid selector`),a),null;if(!c)return w.error("VideoUtils","getPlacementElement",new Error(`${i} is not a valid selector`),h),null;if(!this._checkPageSelector(t,o,r))return null;return this._getElementSelector(i,d,n)||null}_getEmbeddedPlayerType(e){let t=e.getAttribute("data-player-type");return t&&"default"!==t||(t=this._videoConfig.relatedSettings?this._videoConfig.relatedSettings.defaultPlayerType:"static"),this._stickyRelatedOnPage&&(t="static"),t}_getMediaId(e){const t=e.getAttribute("data-video-id");return!!t&&(this._relatedMediaIds.push(t),t)}_createRelatedPlayer(e,t,i,n){"collapse"===t?this._createCollapsePlayer(e,i):"static"===t&&this._createStaticPlayer(e,i,n)}_createCollapsePlayer(t,i){const{player:n,playerElement:s}=this._checkPlayerSelectorOnPage("stickyRelated"),o=n||this._potentialPlayerMap.stationaryRelated[0];if(o&&o.playerId){this._shouldOverrideElement(i)&&(i=this._getOverrideElement(n,s,i)),i=document.querySelector(`#cls-video-container-${t} > div`)||i,this._createStickyRelatedPlayer(e({},o,{mediaId:t}),i)}else w.error(this._component,"_createCollapsePlayer","No video player found")}_createStaticPlayer(t,i,n){if(this._potentialPlayerMap.stationaryRelated.length&&this._potentialPlayerMap.stationaryRelated[0].playerId){const s=this._potentialPlayerMap.stationaryRelated[0];this._createStationaryRelatedPlayer(e({},s,{mediaOrPlaylistId:t}),i,n)}else w.error(this._component,"_createStaticPlayer","No video player found")}_shouldRunAutoplayPlayers(){return!(!this._isVideoAllowedOnPage()||!this._potentialPlayerMap.stickyRelated.length&&!this._potentialPlayerMap.stickyPlaylist.length)}_determineAutoplayPlayers(){const e=this._component,t="VideoManagerComponent"===e,i=this._context;if(this._stickyRelatedOnPage)return void w.event(e,"stickyRelatedOnPage",t&&{device:i&&i.device,isDesktop:this._device}||{});const{player:n,playerElement:s}=this._checkPlayerSelectorOnPage("stickyPlaylist");n&&n.playerId&&n.playlistId&&s?this._createPlaylistPlayer(n,s):Math.random()<.01&&setTimeout((()=>{w.event(e,"noStickyPlaylist",t&&{vendor:"none",device:i&&i.device,isDesktop:this._device}||{})}),1e3)}_initializeRelatedPlayers(e){const t=new Map;for(let i=0;ie-t))}filterUsed(){this._map=this._map.filter((({dynamicAd:e})=>!e.used))}reset(){this._map=[]}constructor(){this._map=[]}}class Le extends Me{}try{(()=>{const e=new H;e&&e.enabled&&(new Pe(e,new Le).start(),new Re(new F(e),e).init())})()}catch(e){w.error("CLS","pluginsertion-iife",e),window.adthriveCLS&&(window.adthriveCLS.injectedFromPlugin=!1)}}();