# Complex Arithmetic Without Complexities

omplex numbers are widely-used in electrical engineering, simulations, and scientific applications. And yet, many software engineers who have to use complex arithmetic insist on reinventing the wheel when there’s no need?the C++ Standard Library already has a compact, efficient, and portable library for dealing with complex numbers, including support. Learn how to use without any untoward complexities.

Your app requires complex arithmetic but the burden of writing a library from scratch for that purpose is overwhelming.

Familiarize yourself with and learn how it simplifies complex arithmetic.

real and i
Real numbers are represented in C++ as floating point variables (float, double, and long double). The theory of complex numbers defines a superset of real numbers called complex numbers. A complex number is a composite number that consists of two units. The first one is called the real part and is denoted by a lowercase r. The unit part is the imaginary part and is denoted by a lowercase i. Just as the fractional part and the integral part of the number 10.34 make a single real number, the real and imaginary units are construed as a single complex number. A common way of representing a complex number is to pack two floating point variables in a struct. Problems start when you need to perform mathematical operations on such objects. The built-in operators of C++ +,-,/, etc. do not support an arbitrary user-defined complex number. Using complex numbers in C++ presents two problems:

• The representation of a complex number
• Arithmetic operations such as addition, multiplication, and division of complex numbers

The Standard Library header contains a mini-library for manipulating complex numbers easily. It includes the class template std::complex which has three explicit specializations, one for every native floating type:

• std::complex
• std::complex
• std::complex

First, decide which of these three specializations suits your needs best. std::complex is the most compact, occupying eight bytes per one complex number. Alas, it also has the lowest precision and cannot represent real or imaginary values that are higher than numeric_limits::max(). std::complex is a reasonable compromise between space usage (16 bytes per object) and precision. std::complex offers the highest precision but also uses 20 bytes (at least) per complex number.

Creating and Initializing a Complex Number
You instantiate a complex number like this:

``#include using std:complex;int main(){ complex  dc;}``

dc is an object that represents the complex number (0,0). By convention, a complex number is written as two comma-separated floating point numbers enclosed in parentheses. The first number is always the real part and the second is the imaginary part. To display the value of dc, use cout as usual:

``cout<``

`This code will compile because the << manipulator has three overloaded versions?one for each std::complex<> specialization.`

`In a similar vein, use cin to read a complex number from the standard input:`

``cout<<"insert a complex, e.g., (10,-2)"<>val;``

`By design, the constructor of std::complex is not explicit, and thus allows implicit conversions from floating point (and even integral) values to complex:`

``complex  compnum=5.9;complex  anothercompnum=6;``

`After the initialization, compnum has the value (5.9,0) and anothercompnum is (5,0). Remember, when you initialize a complex object with a single initializer, that initializer is taken as the real part whereas the imaginary part defaults to 0. If the initializer is an integral value, it's implicitly converted to the floating point datatype of the specialization. In the example above, 6 is silently converted to double, which then becomes the real part of anothercompnum:`

``cout<cout<``

`Initialize a complex object with both the real and imaginary values like this:`

``complex num2(-10.8,0.8); //(-10.8,0.8)``

`Arithmetic OperationsOne of the advantages of using is the set of built-in operators that it overloads for you. The overloaded unary operators are:`

``//binary + template  complex operator+ (const complex&, const complex&); template  complex operator+ (const complex&, const T&); template  complex operator+ (const T&, const complex&); //..similar overloads for -, *, /, == and !=//unary + and â€“template  complex operator+ (const complex&); template  complex operator- (const complex&); ``

`These overload sets allow you to combine complex objects with native floating point variables in the same expression:`

``complex  val(2,2), val2(-11.2,3);val = val2 + 9.99; //operator+(complex,double)cout<``

`When you add a floating point value to a complex object, that value is added to the real part whereas the imaginary part remains intact.`

`Getting realThe C++ Standard defines at least two methods for accessing the real and imaginary parts of a complex number. The first method uses the member functions real() and imag():`

``complex  compnum(5.9, -2.15);double x=compnum.imag(); //x equals -2.15double y=compnum.real();// y equals 5.9``

`Alternatively, use the template functions std::real() and std::image() extract the real and imaginary parts of a complex object:`

``x=std::imag (compnum); y=std::real(compnum);``

`Here's how you modify the real or imaginary parts:`

``compnum.real(5.5);compnum.imag(-5.59);``

`Simple and EfficientThe library is a classic example of the advantages of a standardized, generic solution to a recurring programming task. It's simple enough to allow users to master it easily and pretty efficient because it makes no use of inheritance or virtual functions.`

` `

## `About Our Editorial Process`

`At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.`

`See our full editorial policy.`

## `About Our Journalist`

` Congress weighs ending Section 230 protections Cameron Wiggins June 13, 2024 11:11 AM `
` OpenText survey highlights AI security growth Johannah Lopez June 13, 2024 8:32 AM `
` Elon Musk diverts Nvidia AI chips from Tesla April Isaacs June 13, 2024 8:32 AM `
` Boeing Starliner faces leaks on first crewed ISS mission April Isaacs June 13, 2024 8:11 AM `
` Microsoft updates Recall amid privacy concerns Johannah Lopez June 13, 2024 7:49 AM `
` Harnessing AI, data, and cloud for growth Cameron Wiggins June 13, 2024 7:35 AM `
` Norway wealth fund opposes Musk’s \$56 billion package Johannah Lopez June 13, 2024 7:32 AM `
` Elon Musk threatens Apple over OpenAI integration Noah Nguyen June 12, 2024 3:57 PM `
` Top Features of CRF Design Software for Businesses Kyle Lewis June 12, 2024 2:22 PM `
` Ads found next to hateful hashtags on X Cameron Wiggins June 12, 2024 11:47 AM `
` CRTC mandates streaming fees for Canadian content Cameron Wiggins June 12, 2024 11:41 AM `
` Internet addiction impacts adolescent brain development Rashan Dixon June 12, 2024 11:17 AM `
` E.D.F. to fund solar radiation research April Isaacs June 12, 2024 8:54 AM `
` Alameda City Council blocks climate experiment Rashan Dixon June 12, 2024 8:39 AM `
` Growing AI risks prompt cybersecurity shift Noah Nguyen June 12, 2024 8:15 AM `
` Antarctic sea ice plummets to record low Noah Nguyen June 12, 2024 8:06 AM `
` SpaceX’s Starship completes fourth test flight Cameron Wiggins June 12, 2024 8:02 AM `
` Marubo tribe struggles with new internet addiction Rashan Dixon June 12, 2024 7:36 AM `
` Demand for AI-led security surges in 2024 Noah Nguyen June 12, 2024 7:24 AM `
` Gartner’s new cybersecurity approach for CISOs Rashan Dixon June 12, 2024 7:19 AM `
` Intel unveils groundbreaking Lunar Lake CPU Johannah Lopez June 11, 2024 5:38 PM `
` New UNESCO report highlights ocean threats Rashan Dixon June 11, 2024 5:31 PM `
` Scientists unveil method to visualize crystals interior Cameron Wiggins June 11, 2024 5:22 PM `
` AT&T leads fiber internet satisfaction rankings Rashan Dixon June 11, 2024 1:59 PM `
` 5 Benefits of Using Time Tracking Software Grace Phillips June 11, 2024 1:51 PM `
` Show More `
` `
``` 'use strict';(function(){function v(c,b){function a(){this.constructor=c}if("function"!==typeof b&&null!==b)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");N(c,b);c.prototype=null===b?Object.create(b):(a.prototype=b.prototype,new a)}function S(c,b){var a={},d;for(d in c)Object.prototype.hasOwnProperty.call(c,d)&&0>b.indexOf(d)&&(a[d]=c[d]);if(null!=c&&"function"===typeof Object.getOwnPropertySymbols){var e=0;for(d=Object.getOwnPropertySymbols(c);e<d.length;e++)0>b.indexOf(d[e])&&Object.prototype.propertyIsEnumerable.call(c,d[e])&&(a[d[e]]=c[d[e]])}return a}function I(c,b,a,d){var e=arguments.length,f=3>e?b:null===d?d=Object.getOwnPropertyDescriptor(b,a):d,g;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)f=Reflect.decorate(c,b,a,d);else for(var h=c.length-1;0<=h;h--)if(g=c[h])f=(3>e?g(f):3<e?g(b,a,f):g(b,a))||f;return 3<e&&f&&Object.defineProperty(b,a,f),f}function B(c,b){if("object"===typeof Reflect&&"function"===typeof Reflect.metadata)return Reflect.metadata(c,b)}function L(c){var b="function"===typeof Symbol&&Symbol.iterator,a=b&&c[b],d=0;if(a)return a.call(c);if(c&&"number"===typeof c.length)return{next:function(){c&&d>=c.length&&(c=void 0);return{value:c&&c[d++],done:!c}}};throw new TypeError(b?"Object is not iterable.":"Symbol.iterator is not defined.");}function r(c,b){var a="function"===typeof Symbol&&c[Symbol.iterator];if(!a)return c;c=a.call(c);var d,e=[];try{for(;(void 0===b||0<b--)&&!(d=c.next()).done;)e.push(d.value)}catch(g){var f={error:g}}finally{try{d&&!d.done&&(a=c["return"])&&a.call(c)}finally{if(f)throw f.error;}}return e}function w(c,b,a){if(a||2===arguments.length)for(var d=0,e=b.length,f;d<e;d++)!f&&d in b||(f||(f=Array.prototype.slice.call(b,0,d)),f[d]=b[d]);return c.concat(f||Array.prototype.slice.call(b))}function T(c,b){void 0===b&&(b={});b=b.insertAt;if(c&&"undefined"!==typeof document){var a=document.head||document.getElementsByTagName("head")[0],d=document.createElement("style");d.type="text/css";"top"===b?a.firstChild?a.insertBefore(d,a.firstChild):a.appendChild(d):a.appendChild(d);d.styleSheet?d.styleSheet.cssText=c:d.appendChild(document.createTextNode(c))}}window.adthriveCLS.buildDate="2024-06-12";var N=function(c,b){N=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,d){a.__proto__=d}||function(a,d){for(var e in d)Object.prototype.hasOwnProperty.call(d,e)&&(a[e]=d[e])};return N(c,b)},y=function(){y=Object.assign||function(c){for(var b,a=1,d=arguments.length;a<d;a++){b=arguments[a];for(var e in b)Object.prototype.hasOwnProperty.call(b,e)&&(c[e]=b[e])}return c};return y.apply(this,arguments)};"function"===typeof SuppressedError?SuppressedError:function(c,b,a){a=Error(a);return a.name="SuppressedError",a.error=c,a.suppressed=b,a};var q=new(function(){function c(){}c.prototype.info=function(b,a){for(var d=[],e=2;e<arguments.length;e++)d[e-2]=arguments[e];this.call.apply(this,w([console.info,b,a],r(d),!1))};c.prototype.warn=function(b,a){for(var d=[],e=2;e<arguments.length;e++)d[e-2]=arguments[e];this.call.apply(this,w([console.warn,b,a],r(d),!1))};c.prototype.error=function(b,a){for(var d=[],e=2;e<arguments.length;e++)d[e-2]=arguments[e];this.call.apply(this,w([console.error,b,a],r(d),!1));this.sendErrorLogToCommandQueue.apply(this,w([b,a],r(d),!1))};c.prototype.event=function(b,a){for(var d,e=2;e<arguments.length;e++);"debug"===(null===(d=window.adthriveCLS)||void 0===d?void 0:d.bucket)&&this.info(b,a)};c.prototype.sendErrorLogToCommandQueue=function(b,a){for(var d=[],e=2;e<arguments.length;e++)d[e-2]=arguments[e];window.adthrive=window.adthrive||{};window.adthrive.cmd=window.adthrive.cmd||[];window.adthrive.cmd.push(function(){void 0!==window.adthrive.logError&&"function"===typeof window.adthrive.logError&&window.adthrive.logError(b,a,d)})};c.prototype.call=function(b,a,d){for(var e=[],f=3;f<arguments.length;f++)e[f-3]=arguments[f];f=["%c".concat(a,"::").concat(d," ")];var g=["color: #999; font-weight: bold;"];0<e.length&&"string"===typeof e[0]&&f.push(e.shift());g.push.apply(g,w([],r(e),!1));try{Function.prototype.apply.call(b,console,w([f.join("")],r(g),!1))}catch(h){console.error(h)}};return c}()),u=function(c,b){return null==c||c!==c?b:c},na=function(c){var b=c.clientWidth;getComputedStyle&&(c=getComputedStyle(c,null),b-=parseFloat(c.paddingLeft||"0")+parseFloat(c.paddingRight||"0"));return b},oa=function(c){var b=c.offsetHeight,a=c.offsetWidth,d=c.getBoundingClientRect(),e=document.body,f=document.documentElement;c=Math.round(d.top+(window.pageYOffset||f.scrollTop||e.scrollTop)-(f.clientTop||e.clientTop||0));d=Math.round(d.left+ (window.pageXOffset||f.scrollLeft||e.scrollLeft)-(f.clientLeft||e.clientLeft||0));return{top:c,left:d,bottom:c+b,right:d+a,width:a,height:b}},pa=function(c){void 0===c&&(c=window.location.search);var b=0===c.indexOf("?")?1:0;return c.slice(b).split("&").reduce(function(a,d){d=r(d.split("="),2);a.set(d[0],d[1]);return a},new Map)},qa=function(c){var b={},a=pa().get(c);if(a)try{var d=decodeURIComponent(a);b=JSON.parse(d);q.event("ExperimentOverridesUtil","getExperimentOverrides",c,b)}catch(e){}return b},E=function(){var c=navigator.userAgent,b=/Tablet|iPad|Playbook|Nook|webOS|Kindle|Android (?!.*Mobile).*Safari|CrOS/i.test(c);return/Mobi|iP(hone|od)|Opera Mini/i.test(c)&&!b},ra=function(c){void 0===c&&(c=document);return(c===document?document.body:c).getBoundingClientRect().top},sa=function(c){return c.includes(",")?c.split(","):[c]},ta=function(c){void 0===c&&(c=document);c=c.querySelectorAll("article");return 0===c.length?null:(c=Array.from(c).reduce(function(b,a){return a.offsetHeight>b.offsetHeight?a:b}))&&c.offsetHeight>1.5*window.innerHeight?c:null},ua=function(c,b,a){void 0===a&&(a=document);var d=ta(a),e=d?[d]:[],f=[];c.forEach(function(h){var k=Array.from(a.querySelectorAll(h.elementSelector)).slice(0,h.skip);sa(h.elementSelector).forEach(function(l){var p=a.querySelectorAll(l);l=function(t){var n=p[t];if(b.map.some(function(x){return x.el.isEqualNode(n)}))return"continue";(t=n&&n.parentElement)&&t!==document.body?e.push(t):e.push(n);-1===k.indexOf(n)&&f.push({dynamicAd:h,element:n})};for(var m=0;m<p.length;m++)l(m)})});var g=ra(a);c=f.sort(function(h,k){return h.element.getBoundingClientRect().top-g-(k.element.getBoundingClientRect().top-g)});return[e,c]},va=function(c,b,a){void 0===a&&(a=document);b=r(ua(c,b,a),2);c=b[0];b=b[1];if(0===c.length)throw Error("No Main Content Elements Found");return[Array.from(c).reduce(function(d,e){return e.offsetHeight>d.offsetHeight?e:d})||document.body,b]},M=new(function(){function c(){var b=this;this.name="StorageHandler";this.disable=!1;this.removeLocalStorageValue=function(a){window.localStorage.removeItem("adthrive_".concat(a.toLowerCase()))};this.getLocalStorageValue=function(a,d,e,f,g){void 0===d&&(d=!0);void 0===e&&(e=!0);if(b.disable)return null;try{var h=window.localStorage.getItem("".concat(d?"adthrive_":"").concat(e?a.toLowerCase():a));if(h){var k=JSON.parse(h),l=void 0!==f&&Date.now()-k.created>=f;if(k&&!l)return g&&b.setLocalStorageValue(a,k.value,d),k.value}}catch(p){}return null};this.setLocalStorageValue=function(a,d,e){void 0===e&&(e=!0);try{e=e?"adthrive_":"";var f={value:d,created:Date.now()};window.localStorage.setItem("".concat(e).concat(a.toLowerCase()),JSON.stringify(f))}catch(g){}};this.isValidABGroupLocalStorageValue=function(a){return void 0!==a&&null!==a&&!("number"===typeof a&&isNaN(a))};this.getOrSetLocalStorageValue=function(a,d,e,f,g,h,k){void 0===f&&(f=!0);void 0===g&&(g=!0);void 0===k&&(k=!0);e=b.getLocalStorageValue(a,k,f,e,g);if(null!==e)return e;d=d();b.setLocalStorageValue(a,d,k);h&&h(d);return d};this.getOrSetABGroupLocalStorageValue=function(a,d,e,f,g){var h;void 0===f&&(f=!0);e=b.getLocalStorageValue("abgroup",!0,!0,e,f);if(null!==e&&(f=e[a],b.isValidABGroupLocalStorageValue(f)))return f;d=d();a=y(y({},e),(h={},h[a]=d,h));b.setLocalStorageValue("abgroup",a);g&&g();return d}}c.prototype.init=function(){};return c}()),z;(function(c){c.amznbid="amznbid";c.amzniid="amzniid";c.amznp="amznp";c.amznsz="amznsz"})(z||(z={}));var D;(function(c){c.ThirtyThreeAcross="33across";c.Adform="adform";c.Aidem="aidem";c.AidemServer="aidem_ss";c.AppNexus="appnexus";c.AmazonTAM="amazon";c.AmazonUAM="AmazonUAM";c.Colossus="colossus";c.ColossusServer="col_ss";c.Conversant="conversant";c.Concert="concert";c.Criteo="criteo";c.GumGum="gumgum";c.ImproveDigital="improvedigital";c.ImproveDigitalServer="improve_ss";c.IndexExchange="ix";c.Kargo="kargo";c.KargoServer="krgo_ss";c.MediaGrid="grid";c.MediaGridVideo="gridvid";c.Nativo="nativo";c.OpenX="openx";c.Ogury="ogury";c.OpenXServer="opnx_ss";c.Ozone="ozone";c.Pubmatic="pubmatic";c.PubmaticServer="pubm_ss";c.ResetDigital="resetdigital";c.Rtbhouse="rtbhouse";c.Rubicon="rubicon";c.RubiconServer="rubi_ss";c.Sharethrough="sharethrough";c.Teads="teads";c.Triplelift="triplelift";c.TripleliftServer="tripl_ss";c.TTD="ttd";c.Undertone="undertone";c.UndertoneServer="under_ss";c.Unruly="unruly";c.YahooSSP="yahoossp";c.YahooSSPServer="yah_ss";c.Verizon="verizon";c.Yieldmo="yieldmo"})(D||(D={}));var U;(function(c){c.Prebid="prebid";c.GAM="gam";c.Amazon="amazon";c.Marmalade="marmalade";c.Floors="floors";c.CMP="cmp";c.Optable="optable"})(U||(U={}));var V;(function(c){c.cm="cm";c.fbrap="fbrap";c.rapml="rapml"})(V||(V={}));var W;(function(c){c.lazy="lazy";c.raptive="raptive";c.refresh="refresh";c.session="session";c.crossDomain="crossdomain";c.highSequence="highsequence";c.lazyBidPool="lazyBidPool"})(W||(W={}));var X;(function(c){c.lazy="l";c.raptive="rapml";c.refresh="r";c.session="s";c.crossdomain="c";c.highsequence="hs";c.lazyBidPool="lbp"})(X||(X={}));var Y;(function(c){c.Version="Version";c.SharingNotice="SharingNotice";c.SaleOptOutNotice="SaleOptOutNotice";c.SharingOptOutNotice="SharingOptOutNotice";c.TargetedAdvertisingOptOutNotice="TargetedAdvertisingOptOutNotice";c.SensitiveDataProcessingOptOutNotice="SensitiveDataProcessingOptOutNotice";c.SensitiveDataLimitUseNotice="SensitiveDataLimitUseNotice";c.SaleOptOut="SaleOptOut";c.SharingOptOut="SharingOptOut";c.TargetedAdvertisingOptOut="TargetedAdvertisingOptOut";c.SensitiveDataProcessing="SensitiveDataProcessing";c.KnownChildSensitiveDataConsents="KnownChildSensitiveDataConsents";c.PersonalDataConsents="PersonalDataConsents";c.MspaCoveredTransaction="MspaCoveredTransaction";c.MspaOptOutOptionMode="MspaOptOutOptionMode";c.MspaServiceProviderMode="MspaServiceProviderMode";c.SubSectionType="SubsectionType";c.Gpc="Gpc"})(Y||(Y={}));var Z;(function(c){c[c.NA=0]="NA";c[c.OptedOut=1]="OptedOut";c[c.OptedIn=2]="OptedIn"})(Z||(Z={}));var C;(function(c){c.AdDensity="addensity";c.AdLayout="adlayout";c.FooterCloseButton="footerclose";c.Interstitial="interstitial";c.RemoveVideoTitleWrapper="removevideotitlewrapper";c.StickyOutstream="stickyoutstream";c.StickyOutstreamOnStickyPlayer="sospp";c.VideoAdvancePlaylistRelatedPlayer="videoadvanceplaylistrp";c.MobileStickyPlayerPosition="mspp"})(C||(C={}));var J;(function(c){c.Desktop="desktop";c.Mobile="mobile"})(J||(J={}));var G;(function(c){c.Video_Collapse_Autoplay_SoundOff="Video_Collapse_Autoplay_SoundOff";c.Video_Individual_Autoplay_SOff="Video_Individual_Autoplay_SOff";c.Video_Coll_SOff_Smartphone="Video_Coll_SOff_Smartphone";c.Video_In_Post_ClicktoPlay_SoundOn="Video_In-Post_ClicktoPlay_SoundOn"})(G||(G={}));var aa;(aa||(aa={})).None="none";var ba;(function(c){c.Default="default";c.AZ_Animals="5daf495ed42c8605cfc74b0b";c.Natashas_Kitchen="55bccc97303edab84afd77e2";c.RecipeTin_Eats="55cb7e3b4bc841bd0c4ea577";c.Sallys_Baking_Recipes="566aefa94856897050ee7303";c.Spend_With_Pennies="541917f5a90318f9194874cf"})(ba||(ba={}));var wa=function(c,b){var a=c.adDensityEnabled;c=c.adDensityLayout.pageOverrides.find(function(d){return!!document.querySelector(d.pageSelector)&&(d[b].onePerViewport||"number"===typeof d[b].adDensity)});return a?!c:!0},ca=function(c){try{return{valid:!0,elements:document.querySelectorAll(c)}}catch(b){return y({valid:!1},b)}},da=function(c){return""===c?{valid:!0}:ca(c)},xa=function(c){var b=c.reduce(function(a,d){return d.weight?d.weight+a:a},0);return 0<c.length&&c.every(function(a){var d=a.value;a=a.weight;return!(void 0===d||null===d||"number"===typeof d&&isNaN(d)||!a)})&&100===b},ya=["siteId","siteName","adOptions","breakpoints","adUnits"];z=function(){function c(){this._timeOrigin=0}c.prototype.resetTimeOrigin=function(){this._timeOrigin=window.performance.now()};c.prototype.now=function(){try{return Math.round(window.performance.now()-this._timeOrigin)}catch(b){return 0}};return c}();window.adthrive.windowPerformance=window.adthrive.windowPerformance||new z;z=window.adthrive.windowPerformance;var O=z.now.bind(z),za=function(c){function b(a){var d=c.call(this)||this;d._featureRollouts=a.enabled?a.siteAds.featureRollouts||{}:{};return d} v(b,c);return b}(function(){function c(){this._featureRollouts={}}Object.defineProperty(c.prototype,"siteFeatureRollouts",{get:function(){return this._featureRollouts},enumerable:!1,configurable:!0});c.prototype.isRolloutEnabled=function(b){return this._featureRollouts&&this._featureRollouts[b]?this._featureRollouts[b].enabled:!1};c.prototype.getSiteRolloutConfig=function(b){var a;return this.isRolloutEnabled(b)?null!==(a=this._featureRollouts[b].data)&&void 0!==a?a:{}:{}};return c}()),ea=function(){function c(){this._clsGlobalData=window.adthriveCLS}Object.defineProperty(c.prototype,"enabled",{get:function(){var b;if(b=!!this._clsGlobalData&&!!this._clsGlobalData.siteAds)a:{b=this._clsGlobalData.siteAds;var a=void 0;void 0===a&&(a=ya);if(b){for(var d=0;d<a.length;d++)if(!b[a[d]]){b=!1;break a}b=!0}else b=!1}return b},enumerable:!1,configurable:!0});Object.defineProperty(c.prototype,"error",{get:function(){return!(!this._clsGlobalData||!this._clsGlobalData.error)},enumerable:!1,configurable:!0});Object.defineProperty(c.prototype,"siteAds",{get:function(){return this._clsGlobalData.siteAds},set:function(b){this._clsGlobalData.siteAds=b},enumerable:!1,configurable:!0});Object.defineProperty(c.prototype,"disableAds",{get:function(){return this._clsGlobalData.disableAds},set:function(b){this._clsGlobalData.disableAds=b},enumerable:!1,configurable:!0});Object.defineProperty(c.prototype,"enabledLocations",{get:function(){return this._clsGlobalData.enabledLocations},set:function(b){this._clsGlobalData.enabledLocations=b},enumerable:!1,configurable:!0});Object.defineProperty(c.prototype,"injectedFromPlugin",{get:function(){return this._clsGlobalData.injectedFromPlugin},set:function(b){this._clsGlobalData.injectedFromPlugin=b},enumerable:!1,configurable:!0});Object.defineProperty(c.prototype,"injectedFromSiteAds",{get:function(){return this._clsGlobalData.injectedFromSiteAds},set:function(b){this._clsGlobalData.injectedFromSiteAds=b},enumerable:!1,configurable:!0});c.prototype.overwriteInjectedSlots=function(b){this._clsGlobalData.injectedSlots=b};c.prototype.setInjectedSlots=function(b){this._clsGlobalData.injectedSlots=this._clsGlobalData.injectedSlots||[];this._clsGlobalData.injectedSlots.push(b)};Object.defineProperty(c.prototype,"injectedSlots",{get:function(){return this._clsGlobalData.injectedSlots},enumerable:!1,configurable:!0});c.prototype.setInjectedVideoSlots=function(b){this._clsGlobalData.injectedVideoSlots=this._clsGlobalData.injectedVideoSlots||[];this._clsGlobalData.injectedVideoSlots.push(b)};Object.defineProperty(c.prototype,"injectedVideoSlots",{get:function(){return this._clsGlobalData.injectedVideoSlots},enumerable:!1,configurable:!0});c.prototype.setInjectedScripts=function(b){this._clsGlobalData.injectedScripts=this._clsGlobalData.injectedScripts||[];this._clsGlobalData.injectedScripts.push(b)};Object.defineProperty(c.prototype,"getInjectedScripts",{get:function(){return this._clsGlobalData.injectedScripts},enumerable:!1,configurable:!0});c.prototype.setExperiment=function(b,a,d){void 0===d&&(d=!1);this._clsGlobalData.experiments=this._clsGlobalData.experiments||{};this._clsGlobalData.siteExperiments=this._clsGlobalData.siteExperiments||{};(d?this._clsGlobalData.siteExperiments:this._clsGlobalData.experiments)[b]=a};c.prototype.getExperiment=function(b,a){void 0===a&&(a=!1);return(a=a?this._clsGlobalData.siteExperiments:this._clsGlobalData.experiments)&&a[b]};c.prototype.setWeightedChoiceExperiment=function(b,a,d){void 0===d&&(d=!1);this._clsGlobalData.experimentsWeightedChoice=this._clsGlobalData.experimentsWeightedChoice||{};this._clsGlobalData.siteExperimentsWeightedChoice=this._clsGlobalData.siteExperimentsWeightedChoice||{};(d?this._clsGlobalData.siteExperimentsWeightedChoice:this._clsGlobalData.experimentsWeightedChoice)[b]=a};c.prototype.getWeightedChoiceExperiment=function(b,a){var d,e;void 0===a&&(a=!1);return(a=a?null===(d=this._clsGlobalData)||void 0===d?void 0:d.siteExperimentsWeightedChoice:null===(e=this._clsGlobalData)||void 0===e?void 0:e.experimentsWeightedChoice)&&a[b]};Object.defineProperty(c.prototype,"branch",{get:function(){return this._clsGlobalData.branch},enumerable:!1,configurable:!0});Object.defineProperty(c.prototype,"bucket",{get:function(){return this._clsGlobalData.bucket},enumerable:!1,configurable:!0});Object.defineProperty(c.prototype,"videoDisabledFromPlugin",{get:function(){return this._clsGlobalData.videoDisabledFromPlugin},set:function(b){this._clsGlobalData.videoDisabledFromPlugin=b},enumerable:!1,configurable:!0});Object.defineProperty(c.prototype,"targetDensityLog",{get:function(){return this._clsGlobalData.targetDensityLog},set:function(b){this._clsGlobalData.targetDensityLog=b},enumerable:!1,configurable:!0});c.prototype.shouldHalveIOSDensity=function(){var b=new za(this),a=void 0;void 0===a&&(a=navigator.userAgent);return/iP(hone|od|ad)/i.test(a)&&b.isRolloutEnabled("iOS-Resolution")};c.prototype.getTargetDensity=function(b){return this.shouldHalveIOSDensity()?b/2:b};Object.defineProperty(c.prototype,"removeVideoTitleWrapper",{get:function(){return this._clsGlobalData.siteAds.adOptions.removeVideoTitleWrapper},enumerable:!1,configurable:!0});return c}(),Aa=function(){function c(){}c.getScrollTop=function(){return(window.pageYOffset||document.documentElement.scrollTop)-(document.documentElement.clientTop||0)};c.getScrollBottom=function(){return this.getScrollTop()+(document.documentElement.clientHeight||0)};c.shufflePlaylist=function(b){for(var a=b.length,d,e;0!==a;)e=Math.floor(Math.random()*b.length),--a,d=b[a],b[a]=b[e],b[e]=d;return b};c.isMobileLandscape=function(){return window.matchMedia("(orientation: landscape) and (max-height: 480px)").matches};c.playerViewable=function(b){b=b.getBoundingClientRect();return this.isMobileLandscape()?window.innerHeight>b.top+b.height/2&&0<b.top+b.height/2:window.innerHeight>b.top+b.height/2};c.createQueryString=function(b){return Object.keys(b).map(function(a){return"".concat(a,"=").concat(b[a])}).join("&")};c.createEncodedQueryString=function(b){return Object.keys(b).map(function(a){return"".concat(a,"=").concat(encodeURIComponent(b[a]))}).join("&")};c.setMobileLocation=function(b){b=b||"bottom-right";"top-left"===b?b="adthrive-collapse-top-left":"top-right"===b?b="adthrive-collapse-top-right":"bottom-left"===b?b="adthrive-collapse-bottom-left":"bottom-right"===b?b="adthrive-collapse-bottom-right":"top-center"===b&&(b=E()?"adthrive-collapse-top-center":"adthrive-collapse-bottom-right");return b};c.addMaxResolutionQueryParam=function(b){var a=E()?"320":"1280";a="max_resolution=".concat(a);var d=r(String(b).split("?"),2);b=d[0];a=(d=d[1])?d+"&".concat(a):a;return"".concat(b,"?").concat(a)};return c}(),Ba=function(){return function(c){this._clsOptions=c;this.removeVideoTitleWrapper=u(this._clsOptions.siteAds.adOptions.removeVideoTitleWrapper,!1);c=this._clsOptions.siteAds.videoPlayers;this.footerSelector=u(c&&c.footerSelector,"");this.players=u(c&&c.players.map(function(b){b.mobileLocation=Aa.setMobileLocation(b.mobileLocation);return b}),[]);this.relatedSettings=c&&c.contextual}}(),Ca=function(){return function(c){this.relatedPlayerAdded=this.playlistPlayerAdded=this.mobileStickyPlayerOnPage=!1;this.footerSelector="";this.removeVideoTitleWrapper=!1;this.videoAdOptions=new Ba(c);this.players=this.videoAdOptions.players;this.relatedSettings=this.videoAdOptions.relatedSettings;this.removeVideoTitleWrapper=this.videoAdOptions.removeVideoTitleWrapper;this.footerSelector=this.videoAdOptions.footerSelector}}();D=function(){return function(){}}();var H=function(c){function b(a){var d=c.call(this)||this;d._probability=a;return d}v(b,c);b.prototype.get=function(){if(0>this._probability||1<this._probability)throw Error("Invalid probability: ".concat(this._probability));return Math.random()<this._probability};return b}(D);z=function(){function c(){this._clsOptions=new ea;this.shouldUseCoreExperimentsConfig=!1}c.prototype.setExperimentKey=function(b){void 0===b&&(b=!1);this._clsOptions.setExperiment(this.abgroup,this.result,b)};return c}();var Da=function(c){function b(){var a=c.call(this)||this;a._result=!1;a._choices=[{choice:!0},{choice:!1}];a.key="RemoveLargeSize";a.abgroup="smhd100";a._result=a.run();a.setExperimentKey();return a}v(b,c);Object.defineProperty(b.prototype,"result",{get:function(){return this._result},enumerable:!1,configurable:!0});b.prototype.run=function(){return(new H(.1)).get()};return b}(z),fa=function(c,b,a,d,e,f){c=Math.round(f-e);b=[];e=[];b.push("(",a.map(function(){return"%o"}).join(", "),")");e.push.apply(e,w([],r(a),!1));void 0!==d&&(b.push(" => %o"),e.push(d));b.push(" %c(".concat(c,"ms)"));e.push("color: #999;")},ha=function(c,b,a){var d=void 0!==a.get?a.get:a.value;return function(){for(var e=[],f=0;f<arguments.length;f++)e[f]=arguments[f];try{var g=O(),h=d.apply(this,e);if(h instanceof Promise)return h.then(function(l){var p=O();fa(c,b,e,l,g,p);return Promise.resolve(l)}).catch(function(l){l.logged||(q.error(c,b,l),l.logged=!0);throw l;});var k=O();fa(c,b,e,h,g,k);return h}catch(l){throw l.logged||(q.error(c,b,l),l.logged=!0),l;}}},P=function(c,b){void 0===b&&(b=!1);return function(a){var d,e=Object.getOwnPropertyNames(a.prototype).filter(function(m){return b||0!==m.indexOf("_")}).map(function(m){return[m,Object.getOwnPropertyDescriptor(a.prototype,m)]});try{for(var f=L(e),g=f.next();!g.done;g=f.next()){var h=r(g.value,2),k=h[0],l=h[1];void 0!==l&&"function"===typeof l.value?a.prototype[k]=ha(c,k,l):void 0!==l&&void 0!==l.get&&"function"===typeof l.get&&Object.defineProperty(a.prototype,k,y(y({},l),{get:ha(c,k,l)}))}}catch(m){var p={error:m}}finally{try{g&&!g.done&&(d=f.return)&&d.call(f)}finally{if(p)throw p.error;}}}},Ea=function(c){function b(a){var d=c.call(this)||this;d._result=!1;d.key="ParallaxAdsExperiment";d.abgroup="parallax";d._choices=[{choice:!0},{choice:!1}];d.weight=.5;E()&&a.largeFormatsMobile&&(d._result=d.run(),d.setExperimentKey());return d}v(b,c);Object.defineProperty(b.prototype,"result",{get:function(){return this._result},enumerable:!1,configurable:!0});b.prototype.run=function(){return(new H(this.weight)).get()};return b=I([P("ParallaxAdsExperiment"),B("design:paramtypes",[Object])],b)}(z),Fa=function(c){function b(){var a=c.call(this)||this;a._result=!1;a._choices=[{choice:!0},{choice:!1}];a.key="mrsf";a.abgroup="mrsf";E()&&(a._result=a.run(),a.setExperimentKey());return a}v(b,c);Object.defineProperty(b.prototype,"result",{get:function(){return this._result},enumerable:!1,configurable:!0});b.prototype.run=function(){return(new H(1)).get()};return b}(z),Ga=[[728,90],[300,250],[300,600],[320,50],[970,250],[160,600],[300,1050],[336,280],[970,90],[300,50],[320,100],[468,60],[250,250],[120,240],[1,1],[300,300],[552,334],[300,420],[728,250],[320,300],[300,390]],Ha=[[300,600],[160,600]],Ia=new Map([["Footer",1],["Header",2],["Sidebar",3],["Content",4],["Recipe",5],["Sidebar_sticky",6],["Below Post",7]]),Ja=function(c){return Ga.filter(function(b){b=r(b,2);var a=b[0],d=b[1];return c.some(function(e){e=r(e,2);var f=e[1];return a===e[0]&&d===f})})},Ka=function(c,b,a,d,e){b=r(b,2);var f=b[0],g=b[1],h=c.location;b=c.sequence;return"Footer"===h?!("phone"===a&&320===f&&100===g):"Header"===h?!(100<g&&d.result):"Recipe"===h?!(e.result&&"phone"===a&&(300===f&&390===g||320===f&&300===g)):"Sidebar"===h?(a=c.adSizes.some(function(k){return 300>=r(k,2)[1]}),(d=300<g)&&!a?!0:9===b?!0:b&&5>=b?d?c.sticky:!0:!d):!0},La=function(c,b){var a=c.location;c=c.sticky;if("Recipe"===a&&b){var d=b.recipeMobile;b=b.recipeDesktop;if(E()&&(null===d||void 0===d?0:d.enabled)||!E()&&(null===b||void 0===b?0:b.enabled))return!0}return"Footer"===a||c},Ma=function(c,b){var a=b.adUnits,d=b.adTypes?(new Ea(b.adTypes)).result:!1,e=new Da,f=new Fa;return a.filter(function(g){return void 0!==g.dynamic&&g.dynamic.enabled}).map(function(g){var h=g.location.replace(/\s+/g,"_"),k="Sidebar"===h?0:2;return{auctionPriority:Ia.get(h)||8,location:h,sequence:u(g.sequence,1),sizes:Ja(g.adSizes).filter(function(l){return Ka(g,l,c,e,f)}).concat(d&&"Content"===g.location?Ha:[]),devices:g.devices,pageSelector:u(g.dynamic.pageSelector,"").trim(),elementSelector:u(g.dynamic.elementSelector,"").trim(),position:u(g.dynamic.position,"beforebegin"),max:Math.floor(u(g.dynamic.max,0)),spacing:u(g.dynamic.spacing,0),skip:Math.floor(u(g.dynamic.skip,0)),every:Math.max(Math.floor(u(g.dynamic.every,1)),1),classNames:g.dynamic.classNames||[],sticky:La(g,b.adOptions.stickyContainerConfig),stickyOverlapSelector:u(g.stickyOverlapSelector,"").trim(),autosize:g.autosize,special:u(g.targeting,[]).filter(function(l){return"special"===l.key}).reduce(function(l,p){return l.concat.apply(l,w([],r(p.value),!1))},[]),lazy:u(g.dynamic.lazy,!1),lazyMax:u(g.dynamic.lazyMax,k),lazyMaxDefaulted:0===g.dynamic.lazyMax?!1:!g.dynamic.lazyMax,name:g.name}})},ia=function(c,b){var a=na(b),d=c.sticky&&"Sidebar"===c.location;return c.sizes.filter(function(e){var f=d?e[1]<=window.innerHeight-100:!0;return(c.autosize?e[0]<=a||320>=e[0]:!0)&&f})},Na=function(){return function(c){this.clsOptions=c;this.enabledLocations=["Below_Post","Content","Recipe","Sidebar"]}}(),Oa=function(c){var b=document.body;c="adthrive-device-".concat(c);if(!b.classList.contains(c))try{b.classList.add(c)}catch(a){q.error("BodyDeviceClassComponent","init",{message:a.message}),b="classList"in document.createElement("_"),q.error("BodyDeviceClassComponent","init.support",{support:b})}},Q=function(c){return"adthrive-".concat(c.location.replace("_","-").toLowerCase())},ja=function(c){return"".concat(Q(c),"-").concat(c.sequence)},Pa=function(c){return T('\n .adthrive-device-phone .adthrive-sticky-content {\n height: 450px !important;\n margin-bottom: 100px !important;\n }\n .adthrive-content.adthrive-sticky {\n position: -webkit-sticky;\n position: sticky !important;\n top: 42px !important;\n margin-top: 42px !important;\n }\n .adthrive-content.adthrive-sticky:after {\n content: "\u2014 Advertisement. Scroll down to continue. \u2014";\n font-size: 10pt;\n margin-top: 5px;\n margin-bottom: 5px;\n display:block;\n color: #888;\n }\n .adthrive-sticky-container {\n position: relative;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: center;\n min-height:'.concat(c?c:400,"px !important;\n margin: 10px 0 10px 0;\n background-color: #FAFAFA;\n padding-bottom:0px;\n }\n "))},ka=function(c){return c.some(function(b){return null!==document.querySelector(b)})},Qa=function(c){function b(){var a=c.call(this)||this;a._result=!1;a._choices=[{choice:!0},{choice:!1}];a.key="RemoveRecipeCap";a.abgroup="rrc";a._result=a.run();a.setExperimentKey();return a}v(b,c);Object.defineProperty(b.prototype,"result",{get:function(){return this._result},enumerable:!1,configurable:!0});b.prototype.run=function(){return(new H(1)).get()};return b}(z),R=function(c){function b(a,d){void 0===a&&(a=[]);var e=c.call(this)||this;e._choices=a;e._default=d;return e}v(b,c);b.fromArray=function(a,d){return new b(a.map(function(e){e=r(e,2);return{choice:e[0],weight:e[1]}}),d)};b.prototype.addChoice=function(a,d){this._choices.push({choice:a,weight:d})};b.prototype.get=function(){var a,d=100*Math.random(),e=0;try{for(var f=L(this._choices),g=f.next();!g.done;g=f.next()){var h=g.value,k=h.choice;e+=h.weight;if(e>=d)return k}}catch(p){var l={error:p}}finally{try{g&&!g.done&&(a=f.return)&&a.call(f)}finally{if(l)throw l.error;}}return this._default};Object.defineProperty(b.prototype,"totalWeight",{get:function(){return this._choices.reduce(function(a,d){return a+d.weight},0)},enumerable:!1,configurable:!0});return b}(D),Ra=function(c){for(var b=5381,a=c.length;a;)b=33*b^c.charCodeAt(--a);return b>>>0},la=function(){return function(c,b,a){var d=a.value;d&&(a.value=function(){for(var e=this,f=[],g=0;g<arguments.length;g++)f[g]=arguments[g];g=Array.isArray(this._choices)?Ra(JSON.stringify(this._choices)).toString(16):null;var h=this._expConfigABGroup?this._expConfigABGroup:this.abgroup;h=h?h.toLowerCase():this.key?this.key.toLowerCase():"";g=g?"".concat(h,"_").concat(g):h;g=this.localStoragePrefix?"".concat(this.localStoragePrefix,"-").concat(g):g;h=M.getLocalStorageValue("branch");!1===(h&&h.enabled)&&M.removeLocalStorageValue(g);return M.getOrSetABGroupLocalStorageValue(g,function(){return d.apply(e,f)},864E5)})}};D=function(c){function b(){var a=c.apply(this,w([],r(arguments),!1))||this;a._resultValidator=function(){return!0};return a}v(b,c);b.prototype._isValidResult=function(a){var d=this;return c.prototype._isValidResult.call(this,a,function(){return d._resultValidator(a)||"control"===a})};b.prototype.run=function(){if(!this.enabled)return q.error("CLSWeightedChoiceSiteExperiment","run","() => %o","No experiment config found. Defaulting to control."),"control";if(!this._mappedChoices||0===this._mappedChoices.length)return q.error("CLSWeightedChoiceSiteExperiment","run","() => %o","No experiment variants found. Defaulting to control."),"control";var a=(new R(this._mappedChoices)).get();if(this._isValidResult(a))return a;q.error("CLSWeightedChoiceSiteExperiment","run","() => %o","Invalid result from experiment choices. Defaulting to control.");return"control"};return b}(function(){function c(){}Object.defineProperty(c.prototype,"enabled",{get:function(){return void 0!==this.experimentConfig},enumerable:!1,configurable:!0});c.prototype._isValidResult=function(b,a){void 0===a&&(a=function(){return!0});return a()&&M.isValidABGroupLocalStorageValue(b)};return c}());var ma=function(){function c(b){var a=this,d,e;this.siteExperiments=[];this._clsOptions=b;this._device=E()?"mobile":"desktop";this.siteExperiments=null!==(e=null===(d=this._clsOptions.siteAds.siteExperiments)||void 0===d?void 0:d.filter(function(f){var g=f.key;var h=a._device;if(f){var k=!!f.enabled,l=null==f.dateStart||Date.now()>=f.dateStart,p=null==f.dateEnd||Date.now()<=f.dateEnd,m=null===f.selector||""!==f.selector&&!!document.querySelector(f.selector),t="mobile"===f.platform&&"mobile"===h;h="desktop"===f.platform&&"desktop"===h;t=null===f.platform||"all"===f.platform||t||h;(h="bernoulliTrial"===f.experimentType?1===f.variants.length:xa(f.variants))||q.error("SiteTest","validateSiteExperiment","experiment presented invalid choices for key:",f.key,f.variants);f=k&&l&&p&&m&&t&&h}else f=!1;a:switch(k=a._clsOptions.siteAds,g){case C.AdDensity:var n=wa(k,a._device);break a;case C.StickyOutstream:var x,A;n=(g=null===(A=null===(x=null===(n=k.videoPlayers)||void 0===n?void 0:n.partners)||void 0===x?void 0:x.stickyOutstream)||void 0===A?void 0:A.blockedPageSelectors)?!document.querySelector(g):!0;break a;case C.Interstitial:n=(n=k.adOptions.interstitialBlockedPageSelectors)?!document.querySelector(n):!0;break a;default:n=!0}return f&&n}))&&void 0!==e?e:[]}c.prototype.getSiteExperimentByKey=function(b){var a=this.siteExperiments.filter(function(f){return f.key.toLowerCase()===b.toLowerCase()})[0],d=qa("at_site_features"),e=typeof((null===a||void 0===a?0:a.variants[1])?null===a||void 0===a?void 0:a.variants[1].value:null===a||void 0===a?void 0:a.variants[0].value)===typeof d[b];a&&d[b]&&e&&(a.variants=[{displayName:"test",value:d[b],weight:100,id:0}]);return a};return c}(),Sa=function(c){function b(a){var d=c.call(this)||this;d._choices=[];d._mappedChoices=[];d._result="";d._resultValidator=function(e){return"string"===typeof e};d.key=C.AdLayout;d.abgroup=C.AdLayout;d._clsSiteExperiments=new ma(a);d.experimentConfig=d._clsSiteExperiments.getSiteExperimentByKey(d.key);d.enabled&&d.experimentConfig&&(d._choices=d.experimentConfig.variants,d._mappedChoices=d._mapChoices(),d._result=d.run(),a.setWeightedChoiceExperiment(d.abgroup,d._result,!0));return d}v(b,c);Object.defineProperty(b.prototype,"result",{get:function(){return this._result},enumerable:!1,configurable:!0});b.prototype.run=function(){if(!this.enabled)return q.error("CLSAdLayoutSiteExperiment","run","() => %o","No experiment config found. Defaulting to empty class name."),"";var a=(new R(this._mappedChoices)).get();if(this._isValidResult(a))return a;q.error("CLSAdLayoutSiteExperiment","run","() => %o","Invalid result from experiment choices. Defaulting to empty class name.");return""};b.prototype._mapChoices=function(){return this._choices.map(function(a){return{weight:a.weight,choice:a.value}})};I([la(),B("design:type",Function),B("design:paramtypes",[]),B("design:returntype",void 0)],b.prototype,"run",null);return b}(D),Ta=function(c){function b(a){var d=c.call(this)||this;d._choices=[];d._mappedChoices=[];d._result="control";d._resultValidator=function(e){return"number"===typeof e};d.key=C.AdDensity;d.abgroup=C.AdDensity;d._clsSiteExperiments=new ma(a);d.experimentConfig=d._clsSiteExperiments.getSiteExperimentByKey(d.key);d.enabled&&d.experimentConfig&&(d._choices=d.experimentConfig.variants,d._mappedChoices=d._mapChoices(),d._result=d.run(),a.setWeightedChoiceExperiment(d.abgroup,d._result,!0));return d}v(b,c);Object.defineProperty(b.prototype,"result",{get:function(){return this._result},enumerable:!1,configurable:!0});b.prototype.run=function(){if(!this.enabled)return q.error("CLSTargetAdDensitySiteExperiment","run","() => %o","No experiment config found. Defaulting to control."),"control";var a=(new R(this._mappedChoices)).get();if(this._isValidResult(a))return a;q.error("CLSTargetAdDensitySiteExperiment","run","() => %o","Invalid result from experiment choices. Defaulting to control.");return"control"};b.prototype._mapChoices=function(){return this._choices.map(function(a){var d=a.value;return{weight:a.weight,choice:"number"===typeof d?(d||0)/100:"control"}})};I([la(),B("design:type",Function),B("design:paramtypes",[]),B("design:returntype",void 0)],b.prototype,"run",null);return b}(D),Ua=function(c){function b(){var a=c.call(this)||this;a._result=!1;a.abgroup="scae";a.key="StickyContainerAds";a._choices=[{choice:!0},{choice:!1}];a.weight=.99;a._result=a.run();a.setExperimentKey();return a}v(b,c);Object.defineProperty(b.prototype,"result",{get:function(){return this._result},enumerable:!1,configurable:!0});b.prototype.run=function(){return(new H(this.weight)).get()};return b=I([P("StickyContainerAdsExperiment"),B("design:paramtypes",[])],b)}(z),Va=function(c){function b(){var a=c.call(this)||this;a._result=!1;a.abgroup="scre";a.key="StickyContainerRecipe";a._choices=[{choice:!0},{choice:!1}];a.weight=.99;a._result=a.run();a.setExperimentKey();return a}v(b,c);Object.defineProperty(b.prototype,"result",{get:function(){return this._result},enumerable:!1,configurable:!0});b.prototype.run=function(){return(new H(this.weight)).get()};return b=I([P("StickyContainerRecipeExperiment"),B("design:paramtypes",[])],b)}(z),Ya=function(){function c(b,a){this._clsOptions=b;this._adInjectionMap=a;this._mainContentHeight=this._recipeCount=0;this._mainContentDiv=null;this._totalAvailableElements=[];this._minDivHeight=250;this._densityDevice=J.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([["Recipe",5]]);this.locationToMinHeight={Below_Post:"250px",Content:"250px",Recipe:"250px",Sidebar:"250px"};a=this._clsOptions.siteAds.breakpoints;var d=a.tablet;var e=window.innerWidth;a=e>=a.desktop?"desktop":e>=d?"tablet":"phone";this._device=a;this._config=new Na(b);this._clsOptions.enabledLocations=this._config.enabledLocations;this._clsTargetAdDensitySiteExperiment=this._clsOptions.siteAds.siteExperiments?new Ta(this._clsOptions):null;this._stickyContainerAdsExperiment=new Ua;this._stickyContainerRecipeExperiment=new Va;this._removeRecipeCapExperiment=new Qa}c.prototype.start=function(){var b=this,a,d,e,f;try{Oa(this._device);var g=new Sa(this._clsOptions);if(g.enabled){var h=g.result,k=h.startsWith(".")?h.substring(1):h;if(/^[-_a-zA-Z]+[-_a-zA-Z0-9]*\$/.test(k))try{document.body.classList.add(k)}catch(m){q.error("ClsDynamicAdsInjector","start","Uncaught CSS Class error: ".concat(m))}else q.error("ClsDynamicAdsInjector","start","Invalid class name: ".concat(k))}var l=Ma(this._device,this._clsOptions.siteAds).filter(function(m){return b._locationEnabled(m)}).filter(function(m){return m.devices.includes(b._device)}).filter(function(m){return 0===m.pageSelector.length||null!==document.querySelector(m.pageSelector)}),p=this.inject(l);(null===(d=null===(a=this._clsOptions.siteAds.adOptions.stickyContainerConfig)||void 0===a?void 0:a.content)||void 0===d?0:d.enabled)&&this._stickyContainerAdsExperiment.result&&!ka(this._clsOptions.siteAds.adOptions.stickyContainerConfig.blockedSelectors||[])&&Pa(null===(f=null===(e=this._clsOptions.siteAds.adOptions.stickyContainerConfig)||void 0===e?void 0:e.content)||void 0===f?void 0:f.minHeight);p.forEach(function(m){return b._clsOptions.setInjectedSlots(m)})}catch(m){q.error("ClsDynamicAdsInjector","start",m)}};c.prototype.inject=function(b,a){void 0===a&&(a=document);this._densityDevice="desktop"===this._device?J.Desktop:J.Mobile;this._overrideDefaultAdDensitySettingsWithSiteExperiment();var d=this._clsOptions.siteAds,e=u(d.adDensityEnabled,!0),f=d.adDensityLayout&&e;d=b.filter(function(g){return f?"Content"!==g.location:g});b=b.filter(function(g){return f?"Content"===g.location:null});return w(w([],r(d.length?this._injectNonDensitySlots(d,a):[]),!1),r(b.length?this._injectDensitySlots(b,a):[]),!1)};c.prototype._injectNonDensitySlots=function(b,a){var d,e=this,f,g,h;void 0===a&&(a=document);var k=[],l=[];this._stickyContainerRecipeExperiment.result&&b.some(function(n){return"Recipe"===n.location&&n.sticky})&&!ka((null===(f=this._clsOptions.siteAds.adOptions.stickyContainerConfig)||void 0===f?void 0:f.blockedSelectors)||[])&&(f=this._clsOptions.siteAds.adOptions.stickyContainerConfig,f="phone"===this._device?null===(g=null===f||void 0===f?void 0:f.recipeMobile)||void 0===g?void 0:g.minHeight:null===(h=null===f||void 0===f?void 0:f.recipeDesktop)||void 0===h?void 0:h.minHeight,T("\n .adthrive-recipe.adthrive-sticky {\n position: -webkit-sticky;\n position: sticky !important;\n top: 42px !important;\n margin-top: 42px !important;\n }\n .adthrive-recipe-sticky-container {\n position: relative;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: center;\n min-height:".concat(f?f:400,"px !important;\n margin: 10px 0 10px 0;\n background-color: #FAFAFA;\n padding-bottom:0px;\n }\n ")));try{for(var p=L(b),m=p.next();!m.done;m=p.next())this._insertNonDensityAds(m.value,k,l,a)}catch(n){var t={error:n}}finally{try{m&&!m.done&&(d=p.return)&&d.call(p)}finally{if(t)throw t.error;}}l.forEach(function(n){n.element.style.minHeight=e.locationToMinHeight[n.location]});return k};c.prototype._injectDensitySlots=function(b,a){void 0===a&&(a=document);try{this._calculateMainContentHeightAndAllElements(b,a)}catch(h){return[]}var d=this._getDensitySettings(b,a);b=d.onePerViewport;var e=d.targetAll,f=d.targetDensityUnits,g=d.combinedMax;d=d.numberOfUnits;this._absoluteMinimumSpacingByDevice=b?window.innerHeight:this._absoluteMinimumSpacingByDevice;if(!d)return[];this._adInjectionMap.filterUsed();this._findElementsForAds(d,b,e,g,f,a);return this._insertAds()};c.prototype._overrideDefaultAdDensitySettingsWithSiteExperiment=function(){var b;if(null===(b=this._clsTargetAdDensitySiteExperiment)||void 0===b?0:b.enabled)b=this._clsTargetAdDensitySiteExperiment.result,"number"===typeof b&&(this._clsOptions.siteAds.adDensityEnabled=!0,this._clsOptions.siteAds.adDensityLayout[this._densityDevice].adDensity=b)};c.prototype._getDensitySettings=function(b,a){void 0===a&&(a=document);var d=this._clsOptions.siteAds.adDensityLayout,e=this._determineOverrides(d.pageOverrides);e=e.length?e[0]:d[this._densityDevice];d=this._clsOptions.getTargetDensity(e.adDensity);e=e.onePerViewport;var f=this._shouldTargetAllEligible(d),g=this._getTargetDensityUnits(d,f);b=this._getCombinedMax(b,a);a=Math.min.apply(Math,w([],r(w([this._totalAvailableElements.length,g],r(0<b?[b]:[]),!1)),!1));this._pubLog={onePerViewport:e,targetDensity:d,targetDensityUnits:g,combinedMax:b};return{onePerViewport:e,targetAll:f,targetDensityUnits:g,combinedMax:b,numberOfUnits:a}};c.prototype._determineOverrides=function(b){var a=this;return b.filter(function(d){var e=da(d.pageSelector);return""===d.pageSelector||e.elements&&e.elements.length}).map(function(d){return d[a._densityDevice]})};c.prototype._shouldTargetAllEligible=function(b){return b===this._densityMax};c.prototype._getTargetDensityUnits=function(b,a){return a?this._totalAvailableElements.length:Math.floor(b*this._mainContentHeight/(1-b)/this._minDivHeight)-this._recipeCount};c.prototype._getCombinedMax=function(b,a){void 0===a&&(a=document);return u(b.filter(function(d){try{var e=a.querySelector(d.elementSelector)}catch(f){}return e}).map(function(d){return Number(d.max)+Number(d.lazyMaxDefaulted?0:d.lazyMax)}).sort(function(d,e){return e-d})[0],0)};c.prototype._elementLargerThanMainContent=function(b){return b.offsetHeight>=this._mainContentHeight&&1<this._totalAvailableElements.length};c.prototype._elementDisplayNone=function(b){var a=window.getComputedStyle(b,null).display;return a&&"none"===a||"none"===b.style.display};c.prototype._isBelowMaxes=function(b,a){return this._adInjectionMap.map.length<b&&this._adInjectionMap.map.length<a};c.prototype._findElementsForAds=function(b,a,d,e,f,g){var h=this;void 0===g&&(g=document);this._clsOptions.targetDensityLog={onePerViewport:a,combinedMax:e,targetDensityUnits:f,targetDensityPercentage:this._pubLog.targetDensity,mainContentHeight:this._mainContentHeight,recipeCount:this._recipeCount,numberOfEls:this._totalAvailableElements.length};var k=function(l){var p;try{for(var m=L(h._totalAvailableElements),t=m.next();!t.done;t=m.next()){var n=t.value,x=n.dynamicAd,A=n.element;h._logDensityInfo(A,x.elementSelector,l);if(!(!d&&h._elementLargerThanMainContent(A)||h._elementDisplayNone(A)))if(h._isBelowMaxes(e,f))h._checkElementSpacing({dynamicAd:x,element:A,insertEvery:l,targetAll:d,target:g});else break}}catch(K){var F={error:K}}finally{try{t&&!t.done&&(p=m.return)&&p.call(m)}finally{if(F)throw F.error;}}!h._usedAbsoluteMinimum&&5>h._smallerIncrementAttempts&&(++h._smallerIncrementAttempts,k(h._getSmallerIncrement(l)))};b=this._getInsertEvery(b,a,f);k(b)};c.prototype._getSmallerIncrement=function(b){b*=.6;b<=this._absoluteMinimumSpacingByDevice&&(b=this._absoluteMinimumSpacingByDevice,this._usedAbsoluteMinimum=!0);return b};c.prototype._insertNonDensityAds=function(b,a,d,e){void 0===e&&(e=document);var f=0,g=0,h=0;0<b.spacing&&(g=f=window.innerHeight*b.spacing);for(var k=this._repeatDynamicAds(b),l=this.getElements(b.elementSelector,e),p=function(n){if(h+1>k.length)return"break";var x=l[n];if(0<f){n=oa(x).bottom;if(n<=g)return"continue";g=n+f}n=k[h];var A="".concat(n.location,"_").concat(n.sequence);a.some(function(Wa){return Wa.name===A})&&(h+=1);var F=m.getDynamicElementId(n),K=Q(b),Xa=ja(b);K=w(["Sidebar"===b.location&&b.sticky&&b.sequence&&5>=b.sequence?"adthrive-sticky-sidebar":"",m._stickyContainerRecipeExperiment.result&&"Recipe"===b.location&&b.sticky?"adthrive-recipe-sticky-container":"",K,Xa],r(b.classNames),!1);if(x=m.addAd(x,F,b.position,K))F=ia(n,x),F.length&&(a.push({clsDynamicAd:b,dynamicAd:n,element:x,sizes:F,name:A,infinite:e!==document}),d.push({location:n.location,element:x}),"Recipe"===b.location&&++m._recipeCount,h+=1)},m=this,t=b.skip;t<l.length&&"break"!==p(t);t+=b.every);};c.prototype._insertAds=function(){var b=this,a=[];this._adInjectionMap.filterUsed();this._adInjectionMap.map.forEach(function(d,e){var f=d.el,g=d.dynamicAd;d=d.target;e=Number(g.sequence)+e;var h=g.max;h=g.lazy&&e>h;g.sequence=e;g.lazy=h;if(f=b._addContentAd(f,g,d))g.used=!0,a.push(f)});return a};c.prototype._getInsertEvery=function(b,a,d){this._moreAvailableElementsThanUnitsToInject(d,b)?(this._usedAbsoluteMinimum=!1,b=this._useWiderSpacing(d,b)):(this._usedAbsoluteMinimum=!0,b=this._useSmallestSpacing(a));return a&&window.innerHeight>b?window.innerHeight:b};c.prototype._useWiderSpacing=function(b,a){return this._mainContentHeight/Math.min(b,a)};c.prototype._useSmallestSpacing=function(b){return b&&window.innerHeight>this._absoluteMinimumSpacingByDevice?window.innerHeight:this._absoluteMinimumSpacingByDevice};c.prototype._moreAvailableElementsThanUnitsToInject=function(b,a){return this._totalAvailableElements.length>b||this._totalAvailableElements.length>a};c.prototype._logDensityInfo=function(b,a,d){b=this._pubLog;b.onePerViewport;b.targetDensity;b.combinedMax};c.prototype._checkElementSpacing=function(b){var a=b.dynamicAd,d=b.element,e=b.insertEvery,f=b.targetAll;b=b.target;b=void 0===b?document:b;(this._isFirstAdInjected()||this._hasProperSpacing(d,a,f,e))&&this._markSpotForContentAd(d,y({},a),b)};c.prototype._isFirstAdInjected=function(){return!this._adInjectionMap.map.length};c.prototype._markSpotForContentAd=function(b,a,d){void 0===d&&(d=document);this._adInjectionMap.add(b,this._getElementCoords(b,"beforebegin"===a.position||"afterbegin"===a.position),a,d);this._adInjectionMap.sort()};c.prototype._hasProperSpacing=function(b,a,d,e){var f="beforebegin"===a.position||"afterbegin"===a.position;a="beforeend"===a.position||"afterbegin"===a.position;d=d||this._isElementFarEnoughFromOtherAdElements(b,e,f);f=a||this._isElementNotInRow(b,f);b=-1===b.id.indexOf("AdThrive_".concat("Below_Post"));return d&&f&&b};c.prototype._isElementFarEnoughFromOtherAdElements=function(b,a,d){b=this._getElementCoords(b,d);var e=!1;for(d=0;d<this._adInjectionMap.map.length&&!(e=this._adInjectionMap.map[d+1]&&this._adInjectionMap.map[d+1].coords,e=b-a>this._adInjectionMap.map[d].coords&&(!e||b+a<e));d++);return e};c.prototype._isElementNotInRow=function(b,a){var d=b.previousElementSibling,e=b.nextElementSibling;return(a=a?!d&&e||d&&b.tagName!==d.tagName?e:d:e)&&0===b.getBoundingClientRect().height?!0:a?b.getBoundingClientRect().top!==a.getBoundingClientRect().top:!0};c.prototype._calculateMainContentHeightAndAllElements=function(b,a){void 0===a&&(a=document);b=r(va(b,this._adInjectionMap,a),2);a=b[1];this._mainContentDiv=b[0];this._totalAvailableElements=a;b=this._mainContentDiv;a=void 0;void 0===a&&(a="div #comments, section .comments");this._mainContentHeight=(a=b.querySelector(a))?b.offsetHeight-a.offsetHeight:b.offsetHeight};c.prototype._getElementCoords=function(b,a){void 0===a&&(a=!1);b=b.getBoundingClientRect();return(a?b.top:b.bottom)+window.scrollY};c.prototype._addContentAd=function(b,a,d){var e,f;void 0===d&&(d=document);var g=null,h=Q(a),k=ja(a),l=(null===(f=null===(e=this._clsOptions.siteAds.adOptions.stickyContainerConfig)||void 0===e?void 0:e.content)||void 0===f?0:f.enabled)&&this._stickyContainerAdsExperiment.result?"adthrive-sticky-container":"";if(b=this.addAd(b,this.getDynamicElementId(a),a.position,w([l,h,k],r(a.classNames),!1)))e=ia(a,b),e.length&&(b.style.minHeight=this.locationToMinHeight[a.location],g="".concat(a.location,"_").concat(a.sequence),g={clsDynamicAd:a,dynamicAd:a,element:b,sizes:e,name:g,infinite:d!==document});return g};c.prototype.getDynamicElementId=function(b){return"".concat("AdThrive","_").concat(b.location,"_").concat(b.sequence,"_").concat(this._device)};c.prototype.getElements=function(b,a){void 0===a&&(a=document);return a.querySelectorAll(b)};c.prototype.addAd=function(b,a,d,e){void 0===e&&(e=[]);document.getElementById(a)||(e='<div id="'.concat(a,'" class="adthrive-ad ').concat(e.join(" "),'"></div>'),b.insertAdjacentHTML(d,e));return document.getElementById(a)};c.prototype._repeatDynamicAds=function(b){var a=[],d=this._removeRecipeCapExperiment.result&&"Recipe"===b.location?99:this.locationMaxLazySequence.get(b.location),e=b.lazy?u(d,0):0;d=b.max;var f=b.lazyMax;e=Math.max(d,0===e&&b.lazy?d+f:Math.min(Math.max(e-b.sequence+1,0),d+f));for(f=0;f<e;f++){var g=Number(b.sequence)+f,h=b.lazy&&f>=d;a.push(y(y({},b),{sequence:g,lazy:h}))}return a};c.prototype._locationEnabled=function(b){b=this._clsOptions.enabledLocations.includes(b.location);var a=this._clsOptions.disableAds&&this._clsOptions.disableAds.all||document.body.classList.contains("adthrive-disable-all"),d=!document.body.classList.contains("adthrive-disable-content")&&!this._clsOptions.disableAds.reasons.has("content_plugin");return b&&!a&&d};return c}(),Za=function(c){function b(a,d){var e=c.call(this,a,"ClsVideoInsertion")||this;e._videoConfig=a;e._clsOptions=d;e._IN_POST_SELECTOR=".adthrive-video-player";e._WRAPPER_BAR_HEIGHT=36;e._playersAddedFromPlugin=[];d.removeVideoTitleWrapper&&(e._WRAPPER_BAR_HEIGHT=0);return e}v(b,c);b.prototype.init=function(){this._initializePlayers()};b.prototype._wrapJWPlayerWithCLS=function(a,d,e){void 0===e&&(e=0);return a.parentNode?(d=this._createGenericCLSWrapper(.5625*a.offsetWidth,d,e),a.parentNode.insertBefore(d,a),d.appendChild(a),d):null};b.prototype._createGenericCLSWrapper=function(a,d,e){var f=document.createElement("div");f.id="cls-video-container-".concat(d);f.className="adthrive";f.style.minHeight="".concat(a+e,"px");return f};b.prototype._getTitleHeight=function(a){a.innerText="Title";a.style.visibility="hidden";document.body.appendChild(a);var d=window.getComputedStyle(a),e=parseInt(d.height,10),f=parseInt(d.marginTop,10);d=parseInt(d.marginBottom,10);document.body.removeChild(a);return Math.min(e+d+f,50)};b.prototype._initializePlayers=function(){var a=document.querySelectorAll(this._IN_POST_SELECTOR);a.length&&this._initializeRelatedPlayers(a);this._shouldRunAutoplayPlayers()&&this._determineAutoplayPlayers()};b.prototype._createStationaryRelatedPlayer=function(a,d,e){var f="mobile"===this._device?[400,225]:[640,360],g=G.Video_In_Post_ClicktoPlay_SoundOn;d&&a.mediaOrPlaylistId&&(e="".concat(a.mediaOrPlaylistId,"_").concat(e),d=this._wrapJWPlayerWithCLS(d,e),this._playersAddedFromPlugin.push(a.mediaOrPlaylistId),d&&this._clsOptions.setInjectedVideoSlots({playerId:a.playerId,playerName:g,playerSize:f,element:d,type:"stationaryRelated"}))};b.prototype._createStickyRelatedPlayer=function(a,d){var e="mobile"===this._device?[400,225]:[640,360],f=G.Video_Individual_Autoplay_SOff;this._stickyRelatedOnPage=!0;this._videoConfig.mobileStickyPlayerOnPage="mobile"===this._device;if(d&&a.position&&a.mediaId){var g=document.createElement("div");d.insertAdjacentElement(a.position,g);d=document.createElement("h3");d.style.margin="10px 0";d=this._getTitleHeight(d);d=this._wrapJWPlayerWithCLS(g,a.mediaId,this._WRAPPER_BAR_HEIGHT+d);this._playersAddedFromPlugin.push(a.mediaId);d&&this._clsOptions.setInjectedVideoSlots({playlistId:a.playlistId,playerId:a.playerId,playerSize:e,playerName:f,element:g,type:"stickyRelated"})}};b.prototype._createPlaylistPlayer=function(a,d){var e=a.playlistId,f="mobile"===this._device?G.Video_Coll_SOff_Smartphone:G.Video_Collapse_Autoplay_SoundOff,g="mobile"===this._device?[400,225]:[640,360];this._videoConfig.mobileStickyPlayerOnPage=!0;var h=document.createElement("div");d.insertAdjacentElement(a.position,h);d=this._wrapJWPlayerWithCLS(h,e,this._WRAPPER_BAR_HEIGHT);this._playersAddedFromPlugin.push("playlist-".concat(e));d&&this._clsOptions.setInjectedVideoSlots({playlistId:a.playlistId,playerId:a.playerId,playerSize:g,playerName:f,element:h,type:"stickyPlaylist"})};b.prototype._isVideoAllowedOnPage=function(){var a=this._clsOptions.disableAds;if(a&&a.video){var d="";a.reasons.has("video_tag")?d="video tag":a.reasons.has("video_plugin")?d="video plugin":a.reasons.has("video_page")&&(d="command queue");q.error(d?"ClsVideoInsertionMigrated":"ClsVideoInsertion","isVideoAllowedOnPage",Error("DBP: Disabled by publisher via ".concat(d||"other")));return!1}return this._clsOptions.videoDisabledFromPlugin?!1:!0};return b}(function(c){function b(a,d){var e=c.call(this)||this;e._videoConfig=a;e._component=d;e._stickyRelatedOnPage=!1;e._relatedMediaIds=[];a=void 0;void 0===a&&(a=navigator.userAgent);a=/Windows NT|Macintosh/i.test(a);e._device=a?"desktop":"mobile";e._potentialPlayerMap=e.setPotentialPlayersMap();return e}v(b,c);b.prototype.setPotentialPlayersMap=function(){var a=this._videoConfig.players||[],d=this._filterPlayerMap();a=a.filter(function(e){return"stationaryRelated"===e.type&&e.enabled});d.stationaryRelated=a;return this._potentialPlayerMap=d};b.prototype._filterPlayerMap=function(){var a=this,d=this._videoConfig.players,e={stickyRelated:[],stickyPlaylist:[],stationaryRelated:[]};return d&&d.length?d.filter(function(f){var g;return null===(g=f.devices)||void 0===g?void 0:g.includes(a._device)}).reduce(function(f,g){f[g.type]||(q.event(a._component,"constructor","Unknown Video Player Type detected",g.type),f[g.type]=[]);g.enabled&&f[g.type].push(g);return f},e):e};b.prototype._checkPlayerSelectorOnPage=function(a){var d=this;a=this._potentialPlayerMap[a].map(function(e){return{player:e,playerElement:d._getPlacementElement(e)}});return a.length?a[0]:{player:null,playerElement:null}};b.prototype._getOverrideElement=function(a,d,e){a&&d?(e=document.createElement("div"),d.insertAdjacentElement(a.position,e)):(d=this._checkPlayerSelectorOnPage("stickyPlaylist"),a=d.player,d=d.playerElement,a&&d&&(e=document.createElement("div"),d.insertAdjacentElement(a.position,e)));return e};b.prototype._shouldOverrideElement=function(a){a=a.getAttribute("override-embed");return"true"===a||"false"===a?"true"===a:this._videoConfig.relatedSettings?this._videoConfig.relatedSettings.overrideEmbedLocation:!1};b.prototype._checkPageSelector=function(a,d,e){void 0===e&&(e=[]);return a&&d&&0===e.length?("/"!==window.location.pathname&&q.event("VideoUtils","getPlacementElement",Error("PSNF: ".concat(a," does not exist on the page"))),!1):!0};b.prototype._getElementSelector=function(a,d,e){if(d&&d.length>e)return d[e];q.event("VideoUtils","getPlacementElement",Error("ESNF: ".concat(a," does not exist on the page")));return null};b.prototype._getPlacementElement=function(a){var d=a.pageSelector,e=a.elementSelector;a=a.skip;var f=da(d),g=f.valid,h=f.elements;f=S(f,["valid","elements"]);var k=ca(e),l=k.valid,p=k.elements;k=S(k,["valid","elements"]);return""===d||g?l?this._checkPageSelector(d,g,h)?this._getElementSelector(e,p,a)||null:null:(q.error("VideoUtils","getPlacementElement",Error("".concat(e," is not a valid selector")),k),null):(q.error("VideoUtils","getPlacementElement",Error("".concat(d," is not a valid selector")),f),null)};b.prototype._getEmbeddedPlayerType=function(a){(a=a.getAttribute("data-player-type"))&&"default"!==a||(a=this._videoConfig.relatedSettings?this._videoConfig.relatedSettings.defaultPlayerType:"static");this._stickyRelatedOnPage&&(a="static");return a};b.prototype._getMediaId=function(a){return(a=a.getAttribute("data-video-id"))?(this._relatedMediaIds.push(a),a):!1};b.prototype._createRelatedPlayer=function(a,d,e,f){"collapse"===d?this._createCollapsePlayer(a,e):"static"===d&&this._createStaticPlayer(a,e,f)};b.prototype._createCollapsePlayer=function(a,d){var e=this._checkPlayerSelectorOnPage("stickyRelated"),f=e.player;e=e.playerElement;var g=f?f:this._potentialPlayerMap.stationaryRelated[0];g&&g.playerId?(this._shouldOverrideElement(d)&&(d=this._getOverrideElement(f,e,d)),d=document.querySelector("#cls-video-container-".concat(a," > div"))||d,this._createStickyRelatedPlayer(y(y({},g),{mediaId:a}),d)):q.error(this._component,"_createCollapsePlayer","No video player found")};b.prototype._createStaticPlayer=function(a,d,e){this._potentialPlayerMap.stationaryRelated.length&&this._potentialPlayerMap.stationaryRelated[0].playerId?this._createStationaryRelatedPlayer(y(y({},this._potentialPlayerMap.stationaryRelated[0]),{mediaOrPlaylistId:a}),d,e):q.error(this._component,"_createStaticPlayer","No video player found")};b.prototype._shouldRunAutoplayPlayers=function(){return this._isVideoAllowedOnPage()&&(this._potentialPlayerMap.stickyRelated.length||this._potentialPlayerMap.stickyPlaylist.length)?!0:!1};b.prototype._determineAutoplayPlayers=function(){var a=this._component,d="VideoManagerComponent"===a,e=this._config;if(this._stickyRelatedOnPage)q.event(a,"stickyRelatedOnPage",d&&{device:e&&e.context.device,isDesktop:this._device}||{});else{var f=this._checkPlayerSelectorOnPage("stickyPlaylist"),g=f.player;f=f.playerElement;g&&g.playerId&&g.playlistId&&f?this._createPlaylistPlayer(g,f):q.event(a,"noStickyPlaylist",d&&{vendor:"none",device:e&&e.context.device,isDesktop:this._device}||{})}};b.prototype._initializeRelatedPlayers=function(a){for(var d=new Map,e=0;e<a.length;e++){var f=a[e],g=f.offsetParent,h=this._getEmbeddedPlayerType(f),k=this._getMediaId(f);g&&k&&(g=(d.get(k)||0)+1,d.set(k,g),this._createRelatedPlayer(k,h,f,g))}};return b}(function(){function c(){}Object.defineProperty(c.prototype,"enabled",{get:function(){return!0},enumerable:!1,configurable:!0});return c}())),\$a=function(c){function b(){return null!==c&&c.apply(this,arguments)||this}v(b,c);return b}(function(){function c(){this._map=[]}c.prototype.add=function(b,a,d,e){void 0===e&&(e=document);this._map.push({el:b,coords:a,dynamicAd:d,target:e})};Object.defineProperty(c.prototype,"map",{get:function(){return this._map},enumerable:!1,configurable:!0});c.prototype.sort=function(){this._map.sort(function(b,a){return b.coords-a.coords})};c.prototype.filterUsed=function(){this._map=this._map.filter(function(b){return!b.dynamicAd.used})};c.prototype.reset=function(){this._map=[]};return c}());try{(function(){var c=new ea;c&&c.enabled&&((new Ya(c,new \$a)).start(),(new Za(new Ca(c),c)).init())})()}catch(c){q.error("CLS","pluginsertion-iife",c),window.adthriveCLS&&(window.adthriveCLS.injectedFromPlugin=!1)}})()(function(){var clsElements=document.querySelectorAll("script[id^='cls-']");window.adthriveCLS&&clsElements&&clsElements.length===0?window.adthriveCLS.injectedFromPlugin=false:"";})(); ```