`;e.insertAdjacentHTML(n,i)}return document.getElementById(t)}_repeatDynamicAds(e){let n=[],r=e.location===t.Recipe,i=r?99:this.locationMaxLazySequence.get(e.location),a=e.lazy?x(i,0):0,o=e.max,s=e.lazyMax,c=a===0&&e.lazy?o+s:Math.min(Math.max(a-e.sequence+1,0),o+s),l=Math.max(o,c);for(let t=0;t=o,a=r;e.name===`Recipe_1`&&r>=5&&(a=r+1),n.push(M(M({},e),{},{sequence:a,lazy:i}))}return n}_locationEnabled(e){let t=this._clsOptions.enabledLocations.includes(e.location),n=this._clsOptions.disableAds&&this._clsOptions.disableAds.all||document.body.classList.contains(`adthrive-disable-all`),r=!document.body.classList.contains(`adthrive-disable-content`)&&!this._clsOptions.disableAds.reasons.has(`content_plugin`);return t&&!n&&r}}})),Dn,On=e((()=>{k(),qe(),b(),Dn=()=>{let e=y()?`mobile`:`tablet`;return I(w)?`desktop`:e}})),kn,An=e((()=>{k(),On(),kn=e=>{let t=be(),n=Dn(),r=e.siteAdsProfiles,i=null;if(r&&r.length)for(let e of r){let r=e.targeting.device,a=e.targeting.browserEngine,o=r&&r.length&&r.includes(n),s=a&&a.length&&a.includes(t);o&&s&&(i=e)}return i}})),jn,Mn=e((()=>{An(),jn=e=>{let t=kn(e);if(t){let e=t.profileId;document.body.classList.add(`raptive-profile-${e}`)}}})),Nn,Pn=e((()=>{Z(),Ge(),mn(),h(),Nn=class extends pn{constructor(e,t){super(e,`ClsVideoInsertion`),this._videoConfig=e,this._clsOptions=t,m(this,`_IN_POST_SELECTOR`,`.adthrive-video-player`),m(this,`_WRAPPER_BAR_HEIGHT`,36),m(this,`_playersAddedFromPlugin`,[]),t.removeVideoTitleWrapper&&(this._WRAPPER_BAR_HEIGHT=0)}init(){this._initializePlayers()}_wrapVideoPlayerWithCLS(e,t,n=0){if(e.parentNode){let r=e.offsetWidth,i=r*.5625,a=this._createGenericCLSWrapper(i,t,n);return e.parentNode.insertBefore(a,e),a.appendChild(e),a}return null}_createGenericCLSWrapper(e,t,n){let r=document.createElement(`div`);return r.id=`cls-video-container-${t}`,r.className=`adthrive`,r.style.minHeight=`${e+n}px`,r}_getTitleHeight(){let e=document.createElement(`h3`);e.style.margin=`10px 0`,e.innerText=`Title`,e.style.visibility=`hidden`,document.body.appendChild(e);let t=window.getComputedStyle(e),n=parseInt(t.height,10),r=parseInt(t.marginTop,10),i=parseInt(t.marginBottom,10);return document.body.removeChild(e),Math.min(n+i+r,50)}_initializePlayers(){let e=document.querySelectorAll(this._IN_POST_SELECTOR);e.length&&this._initializeRelatedPlayers(e),this._shouldRunAutoplayPlayers()&&this._determineAutoplayPlayers(e)}_createStationaryRelatedPlayer(e,t,n){let r=this._device===`mobile`?[400,225]:[640,360],i=P.Video_In_Post_ClicktoPlay_SoundOn;if(t&&e.mediaOrPlaylistId){let a=`${e.mediaOrPlaylistId}_${n}`,o=this._wrapVideoPlayerWithCLS(t,a);this._playersAddedFromPlugin.push(e.mediaOrPlaylistId),o&&this._clsOptions.setInjectedVideoSlots({playerId:e.playerId,playerName:i,playerSize:r,element:o,type:`stationaryRelated`})}}_createStickyRelatedPlayer(e,t){let n=this._device===`mobile`?[400,225]:[640,360],r=P.Video_Individual_Autoplay_SOff;if(this._stickyRelatedOnPage=!0,this._videoConfig.mobileStickyPlayerOnPage=this._device===`mobile`,this._videoConfig.collapsiblePlayerOnPage=!0,t&&e.position&&e.mediaId){let i=document.createElement(`div`);t.insertAdjacentElement(e.position,i);let a=this._getTitleHeight(),o=this._wrapVideoPlayerWithCLS(i,e.mediaId,this._WRAPPER_BAR_HEIGHT+a);this._playersAddedFromPlugin.push(e.mediaId),o&&this._clsOptions.setInjectedVideoSlots({playlistId:e.playlistId,playerId:e.playerId,playerSize:n,playerName:r,element:i,type:`stickyRelated`})}}_createPlaylistPlayer(e,t){let n=e.playlistId,r=this._device===`mobile`?P.Video_Coll_SOff_Smartphone:P.Video_Collapse_Autoplay_SoundOff,i=this._device===`mobile`?[400,225]:[640,360];this._videoConfig.mobileStickyPlayerOnPage=!0,this._videoConfig.collapsiblePlayerOnPage=!0;let a=document.createElement(`div`);t.insertAdjacentElement(e.position,a);let o=this._WRAPPER_BAR_HEIGHT;e.title&&(o+=this._getTitleHeight());let s=this._wrapVideoPlayerWithCLS(a,n,o);this._playersAddedFromPlugin.push(`playlist-${n}`),s&&this._clsOptions.setInjectedVideoSlots({playlistId:e.playlistId,playerId:e.playerId,playerSize:i,playerName:r,element:a,type:`stickyPlaylist`})}_isVideoAllowedOnPage(){let e=this._clsOptions.disableAds;if(e&&e.video){let t=“;e.reasons.has(`video_tag`)?t=`video tag`:e.reasons.has(`video_plugin`)?t=`video plugin`:e.reasons.has(`video_page`)&&(t=`command queue`);let n=t?`ClsVideoInsertionMigrated`:`ClsVideoInsertion`;return X.error(n,`isVideoAllowedOnPage`,Error(`DBP: Disabled by publisher via ${t||`other`}`)),!1}return!this._clsOptions.videoDisabledFromPlugin}}})),Fn=e((()=>{ee(),oe(),En(),Z(),Ht(),Mn(),Pn();try{(()=>{let e=new g;!e||!e.enabled||(e.siteAds&&jn(e.siteAds),new Tn(e,new Vt).start(),new Nn(new ae(e),e).init())})()}catch(e){X.error(`CLS`,`pluginsertion-iife`,e),window.adthriveCLS&&(window.adthriveCLS.injectedFromPlugin=!1)}}));Fn()})();