Healthy

Carrot Cake Baked Oatmeal Cups




[]

What’s your favorite kind of cake? Mine happens to be carrot cake. Speaking of which, have you tried my healthy carrot cake recipe yet?!

Well, last year I couldn’t stop thinking about how I could transform carrot cake into a healthy version you could enjoy for breakfast. After making my almond butter apple oatmeal cups, peanut butter banana oatmeal cups and pumpkin oatmeal cups, I thought it would be fun to try out a carrot cake baked oatmeal version.

AND OH MY FREAKING ZAC EFRON. These carrot cake oatmeal cups are my new favorite breakfast! They’re hearty, perfectly spiced with cinnamon, include plenty of carrots, applesauce and maple syrup for sweetness, and nuts, raisins and shredded coconut for texture and true carrot cake flavor. Great for kids, too!

carrot cake baked oatmeal cup on a plate

What you’ll need to make carrot cake baked oatmeal cups

You’re going to LOVE the simple, delicious ingredients in these carrot cake oatmeal cups. They’re the perfect breakfast for kids and adults! Not only are they naturally sweetened, but they’re also great for customizing with fun add-ins. First, here’s what you’ll need:

  • Shredded carrots: you’ll need to shred about 2 medium carrots to get all of the carrot cake goodness, but make sure you measure 1 cup of shredded carrots!
  • Unsweetened applesauce: a bit of unsweetened applesauce adds the perfect amount of moisture to the oatmeal cups. If you don’t have applesauce, then 1 ripe mashed banana should do the trick.
  • Eggs: for some extra protein and help these oatmeal cups stay together. I haven’t tried flax eggs, but let me know if you do in the comments.
  • Dairy free milk: I used almond milk, but coconut milk would also be delicious. Just know you can use any milk you’d like.
  • Maple syrup: for a delicious, natural sweetness.
  • Coconut oil: you’ll just need a couple of tablespoons of coconut oil for some additional moisture in these baked oatmeal cups.
  • Rolled oats: because these are oatmeal cups, of course! Feel free to use gluten free rolled oats if you’d like.
  • Baking powder: to help these oatmeal cups rise a bit.
  • Cinnamon: adds a cozy flavor to these oatmeal cups and gives them that carrot cake goodness.
  • Salt: to bring the flavors all together.
  • Shredded coconut: is there anything better than carrot cake with coconut? YUM.
  • Yummy mix-ins: I used raisins and chopped pecans in these, but feel free to use walnuts or other dried fruit.
  • For the glaze: cream cheese, powdered sugar, vanilla and a splash of almond or coconut milk.

baked carrot cake oatmeal cups in a muffin tin

Easy ingredient swaps

Here are a few ingredient substitutions I can recommend for these carrot cake baked oatmeal cups:

  • Swap the applesauce. If you’re out of applesauce you can actually use 1 ripe mashed banana instead. YUM.
  • Choose the oil. If you don’t have coconut oil, butter, vegan butter, olive oil and avocado oil will all work well in the recipe. You can also choose an oil like walnut or hazelnut oil.
  • Use any milk. I like to use almond or coconut milk in this recipe, but feel free to use any milk you’d like.
  • Keep them dairy free. Simply use your favorite dairy free cream cheese for the glaze, or omit the glaze entirely. They will still be delicious!

healthy carrot cake oatmeal cups on a wire rack

Can I use steel cut or quick oats?

I would not recommend using steel cut or quick oats in these carrot cake baked oatmeal cups because it will change the texture.

Can I make these vegan?

I think a flax egg or a chia egg will work well in this recipe but haven’t tested it to be sure. Learn how to make a flax egg here and let me know in the comments if you give it a try.

easy carrot cake baked oatmeal cups on a wooden tray

How to make carrot cake oatmeal cups

The best part about these oatmeal cups is that they’re easily made in just one bowl. So easy! Here’s how to make them:

  1. Prep your pan. Preheat the oven and line a muffin tin with muffin liners. I recommend spraying your liners with cooking spray to prevent sticking. See notes to make it in a 9×9 inch pan instead!
  2. Mix the wet ingredients. Mix together the carrots, applesauce, eggs, almond milk, maple syrup and melted coconut oil.
  3. Stir in the dry. Then add in the oats, baking powder, cinnamon and salt. Finally, gently fold in your shredded coconut, pecans and raisins.
  4. Baking them up. Evenly distribute your carrot cake oatmeal mixture into the lined muffin tray and bake for 25-30 minutes until they’re set and longer look “wet.”
  5. Add the glaze and enjoy! Make your glaze by mixing the cream cheese, powdered sugar, vanilla and almond milk, and then drizzle or pipe it onto each baked oatmeal cup.

Want to make regular carrot cake baked oatmeal?

It’s easy! Make this a carrot cake oatmeal bake by pouring the batter into a 9×9 inch pan and baking for 40-50 minutes until slightly golden brown on the edges and the center is set.

Tips for storing & reheating baked oatmeal cups

  1. In the fridge: bake these carrot cake baked oatmeal cups ahead of time and keep them in an airtight container in the fridge for up to 5 days. Once ready to eat, just reheat them in the microwave for 20-30 seconds.
  2. Freezer-friendly carrot cake baked oatmeal cups: allow them to cool completely after baking, then place them in an airtight container or reusable bag and freeze for up to 3 months. When you’re ready to eat them, you can microwave them for 45 seconds-1 minute or until warm. I suggest freezing them without the the glaze and simply adding the glaze when you’re ready to enjoy them.

gluten free carrot cake baked oatmeal cup on a plate

Recommended tools

Don’t forget to check out all of our favorite kitchen essentials.

More carrot cake recipes you’ll love

Get all of our amazing carrot cake inspired recipes here!

I hope you love these delicious, easy carrot cake baked oatmeal cups! If you make them I’d love for you to leave a comment and a rating letting me know how you liked them. I greatly appreciate it – xoxo!

Carrot Cake Baked Oatmeal Cups

carrot cake baked oatmeal cups on a wire rack

Delicious, healthy carrot cake baked oatmeal cups with raisins, pecans and shredded coconut. These easy carrot cake baked oatmeal cups are naturally sweetened with a touch of maple syrup and topped with a light cream cheese glaze. A wonderful on-the-go or meal prep breakfast for your week!

  • Wet ingredients:
  • 1 cup shredded carrots (2 medium carrots)
  • 2/3 cup unsweetened applesauce
  • 2 eggs, at room temperature
  • 1 cup unsweetened almond milk or coconut milk
  • ¼ cup pure maple syrup
  • 1 tablespoon melted and cooled coconut oil
  • Dry ingredients:
  • 2 cups old fashioned rolled oats, gluten free if desired
  • 1 teaspoon baking powder
  • 1 ½ teaspoons cinnamon
  • ¼ teaspoon salt
  • ½ cup unsweetened shredded coconut
  • ½ cup raisins
  • ⅓ cup chopped pecans
  • For the cream cheese glaze:
  • 2 tablespoons cream cheese, softened
  • 2 tablespoons powdered sugar
  • ½ teaspoon vanilla extract
  • 1-2 teaspoons unsweetened almond milk or coconut milk, to thin
  1. Preheat oven to 350 degrees F. Line a 12 cup muffin pan with muffin liners and spray with nonstick cooking spray to prevent oatmeal cups from sticking.

  2. In a medium bowl, mix together the shredded carrots, applesauce, eggs, almond milk, maple syrup and coconut oil until smooth and well combined.

  3. Next stir in dry ingredients: oats, baking powder, cinnamon and salt; stir well to combine. Fold in shredded coconut, chopped pecans and raisins.

  4. Evenly distribute oatmeal batter between muffin liners and bake for 25-30 minutes or until oatmeal cups are set.

  5. To make the cream cheese glaze: in a small bowl, mix together the cream cheese, powdered sugar, vanilla extract and almond milk. Drizzle or pipe over the oatmeal cups. Makes 12 oatmeal cups.

Oatmeal cups should be stored in the fridge and will stay good for 4-5 days.

Even better: freezing baked oatmeal cups is easy. Just allow them to cool completely after baking, then place them in an airtight container or reusable bag and freeze for up to 3 months. When you’re ready to eat them, you can microwave them for 45 seconds-1 minute or until warm.

If you don’t have applesauce, then 1 large ripe mashed banana should do the trick.

Check out the full post to see how to turn these oatmeal cups into regular baked oatmeal in a pan!

Nutrition

Servings: 12 oatmeal cups

Serving size: 1 oatmeal cup (with glaze)

Calories: 171kcal

Fat: 9.7g

Saturated fat: 5g

Carbohydrates: 19.5g

Fiber: 3g

Sugar: 7.5g

Protein: 3.8g

Recipe by: Monique Volz // Ambitious Kitchen | Photography by: Eat Love Eats

This post was originally published on March 25th, 2020, republished on April 1st, 2021, and republished on April 5th, 2022.

Shop This Post

Turn on your JavaScript to view content

Download My FREE 7-Day Meal Plan

Download My FREE 7-Day Meal Plan

Join the AK email list and get my brand new, FREE Simple & Nourishing 7-day Meal Plan delivered to your inbox.

3 && r && Object.defineProperty(target, key, r), r; } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator[“throw”](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), “throw”: verb(1), “return”: verb(2) }, typeof Symbol === “function” && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError(“Generator is already executing.”); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y[“return”] : op[0] ? y[“throw”] || ((t = y[“return”]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length – 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label = o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read$1(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i[“return”])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread$1() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$1(arguments[i])); return ar; } var Operation = (function () { function Operation() { } return Operation; }()); var BernoulliTrial = (function (_super) { __extends$1(BernoulliTrial, _super); function BernoulliTrial(_probability) { var _this = _super.call(this) || this; _this._probability = _probability; return _this; } BernoulliTrial.prototype.get = function () { if (this._probability 1) { throw new Error('Invalid probability'); } return Math.random() = desktop) { return 'desktop'; } if (width >= tablet) { return ‘tablet’; } return ‘phone’; }; var elementInnerWidth = function (element) { var width = element.clientWidth; if (getComputedStyle) { var cs = getComputedStyle(element, null); width -= parseFloat(cs.paddingLeft || ‘0’) + parseFloat(cs.paddingRight || ‘0’); } return width; }; var elementOffset = function (element) { var height = element.offsetHeight; var width = element.offsetWidth; var boundingClientRectangle = element.getBoundingClientRect(); var bodyEl = document.body; var docEl = document.documentElement; var scrollTop = window.pageYOffset || docEl.scrollTop || bodyEl.scrollTop; var scrollLeft = window.pageXOffset || docEl.scrollLeft || bodyEl.scrollLeft; var clientTop = docEl.clientTop || bodyEl.clientTop || 0; var clientLeft = docEl.clientLeft || bodyEl.clientLeft || 0; var top = Math.round(boundingClientRectangle.top + scrollTop – clientTop); var left = Math.round(boundingClientRectangle.left + scrollLeft – clientLeft); return { top: top, left: left, bottom: top + height, right: left + width, width: width, height: height, }; }; var getClsGlobal = function () { return window.adthriveCLS; }; var isDesktop = function () { return /Windows NT|Macintosh/i.test(navigator.userAgent); }; var validCssSelector = function (selector) { try { return { valid: true, elements: document.querySelectorAll(selector) }; } catch (err) { return __assign({ valid: false }, err); } }; var allowablePageSelector = function (selector) { if (selector === ”) { return { valid: true }; } return validCssSelector(selector); }; var ClsOptions = (function () { function ClsOptions() { this._clsGlobalData = getClsGlobal(); } Object.defineProperty(ClsOptions.prototype, “enabled”, { get: function () { return this._clsGlobalData && this._clsGlobalData.siteAds; }, enumerable: false, configurable: true }); Object.defineProperty(ClsOptions.prototype, “siteAds”, { get: function () { return this._clsGlobalData.siteAds; }, set: function (data) { this._clsGlobalData.siteAds = data; }, enumerable: false, configurable: true }); Object.defineProperty(ClsOptions.prototype, “disableAds”, { get: function () { return this._clsGlobalData.disableAds; }, set: function (data) { this._clsGlobalData.disableAds = data; }, enumerable: false, configurable: true }); Object.defineProperty(ClsOptions.prototype, “enabledLocations”, { get: function () { return this._clsGlobalData.enabledLocations; }, set: function (data) { this._clsGlobalData.enabledLocations = data; }, enumerable: false, configurable: true }); Object.defineProperty(ClsOptions.prototype, “injectedFromPlugin”, { get: function () { return this._clsGlobalData.injectedFromPlugin; }, set: function (status) { this._clsGlobalData.injectedFromPlugin = status; }, enumerable: false, configurable: true }); Object.defineProperty(ClsOptions.prototype, “injectedFromSiteAds”, { get: function () { return this._clsGlobalData.injectedFromSiteAds; }, set: function (status) { this._clsGlobalData.injectedFromSiteAds = status; }, enumerable: false, configurable: true }); ClsOptions.prototype.setInjectedSlots = function (slot) { this._clsGlobalData.injectedSlots.push(slot); }; Object.defineProperty(ClsOptions.prototype, “injectedSlots”, { get: function () { return this._clsGlobalData.injectedSlots; }, enumerable: false, configurable: true }); ClsOptions.prototype.setInjectedScripts = function (script) { this._clsGlobalData.injectedScripts = this._clsGlobalData.injectedScripts || []; this._clsGlobalData.injectedScripts.push(script); }; Object.defineProperty(ClsOptions.prototype, “getInjectedScripts”, { get: function () { return this._clsGlobalData.injectedScripts; }, enumerable: false, configurable: true }); ClsOptions.prototype.setExperiment = function (key, val) { this._clsGlobalData.experiments = this._clsGlobalData.experiments || []; this._clsGlobalData.experiments[key] = val; }; ClsOptions.prototype.getExperiment = function (key) { return this._clsGlobalData.experiments && this._clsGlobalData.experiments[key]; }; Object.defineProperty(ClsOptions.prototype, “branch”, { get: function () { return this._clsGlobalData.branch; }, enumerable: false, configurable: true }); Object.defineProperty(ClsOptions.prototype, “bucket”, { get: function () { return this._clsGlobalData.bucket; }, enumerable: false, configurable: true }); Object.defineProperty(ClsOptions.prototype, “videoDisabledFromPlugin”, { get: function () { return this._clsGlobalData.videoDisabledFromPlugin; }, set: function (status) { this._clsGlobalData.videoDisabledFromPlugin = status; }, enumerable: false, configurable: true }); Object.defineProperty(ClsOptions.prototype, “targetDensityLog”, { get: function () { return this._clsGlobalData.targetDensityLog; }, set: function (data) { this._clsGlobalData.targetDensityLog = data; }, enumerable: false, configurable: true }); return ClsOptions; }()); var PluginExperiment = (function () { function PluginExperiment() { this._clsOptions = new ClsOptions(); } PluginExperiment.prototype.setExperimentKey = function () { this._clsOptions.setExperiment(this.key, this.result); }; return PluginExperiment; }()); var LightLogger = (function () { function LightLogger() { } LightLogger.prototype.info = function (className, methodName) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.call.apply(this, __spread$1([console.info, className, methodName], args)); }; LightLogger.prototype.warn = function (className, methodName) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.call.apply(this, __spread$1([console.warn, className, methodName], args)); }; LightLogger.prototype.error = function (className, methodName) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.call.apply(this, __spread$1([console.error, className, methodName], args)); this.sendErrorLogToCommandQueue.apply(this, __spread$1([className, methodName], args)); }; LightLogger.prototype.event = function (className, methodName) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.info(className, methodName); }; LightLogger.prototype.sendErrorLogToCommandQueue = function (className, methodName) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } window.adthrive = window.adthrive || {}; window.adthrive.cmd = window.adthrive.cmd || []; window.adthrive.cmd.push((function () { if (window.adthrive.logError !== undefined && typeof window.adthrive.logError === 'function') { window.adthrive.logError(className, methodName, args); } }).bind(className, methodName, args)); }; LightLogger.prototype.call = function (logFunction, className, methodName) { var args = []; for (var _i = 3; _i 0 && typeof args[0] === 'string') { message.push(args.shift()); } params.push.apply(params, __spread$1(args)); try { Function.prototype.apply.call(logFunction, console, __spread$1([message.join('')], params)); } catch (err) { console.error(err); return; } }; return LightLogger; }()); var logger$1 = new LightLogger(); var TargetDensityExperiment = (function (_super) { __extends$1(TargetDensityExperiment, _super); function TargetDensityExperiment() { var _this = _super.call(this) || this; _this._result = false; _this._choices = [{ choice: true }, { choice: false }]; _this.key = 'adsp7'; logger$1.info('CLSTargetDensityExperiment', 'result siteAds.adDensityLayout', _this._clsOptions, _this._clsOptions.siteAds, _this._clsOptions.siteAds.adDensityLayout); var adthriveCLSSiteAds = _this._clsOptions.siteAds; var adDensityEnabled = defaultTo(adthriveCLSSiteAds.adDensityEnabled, true); if (adthriveCLSSiteAds.adDensityLayout && adDensityEnabled) { logger$1.info('CLSTargetDensityExperiment', '_result', 'Setting Experiment Value'); _this._result = _this.run(); _this.setExperimentKey(); } logger$1.info('CLSTargetDensityExperiment ', 'result', _this._result); return _this; } Object.defineProperty(TargetDensityExperiment.prototype, "result", { get: function () { return this._result; }, enumerable: false, configurable: true }); TargetDensityExperiment.prototype.run = function () { return new BernoulliTrial(1).get(); }; return TargetDensityExperiment; }(PluginExperiment)); var VideoUtils = (function () { function VideoUtils() { } VideoUtils.getScrollTop = function () { return (window.pageYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0); }; VideoUtils.shufflePlaylist = function (playlist) { var currentIndex = playlist.length; var tempValue; var randomIndex; while (0 !== currentIndex) { randomIndex = Math.floor(Math.random() * playlist.length); currentIndex -= 1; tempValue = playlist[currentIndex]; playlist[currentIndex] = playlist[randomIndex]; playlist[randomIndex] = tempValue; } return playlist; }; VideoUtils.playerInView = function (playerElement) { var boundingRect = playerElement.getBoundingClientRect(); return window.innerHeight > boundingRect.top + boundingRect.height / 2; }; VideoUtils.createQueryString = function (params) { return Object.keys(params) .map(function (key) { return key + “=” + params[key]; }) .join(‘&’); }; VideoUtils.createEncodedQueryString = function (params) { return Object.keys(params) .map(function (key) { return key + “=” + encodeURIComponent(params[key]); }) .join(‘&’); }; VideoUtils.setMobileLocation = function (mobileLocation) { mobileLocation = mobileLocation || ‘bottom-right’; if (mobileLocation === ‘top-left’) { mobileLocation = “adthrive-collapse-top-left” ; } else if (mobileLocation === ‘top-right’) { mobileLocation = “adthrive-collapse-top-right” ; } else if (mobileLocation === ‘bottom-left’) { mobileLocation = “adthrive-collapse-bottom-left” ; } else if (mobileLocation === ‘bottom-right’) { mobileLocation = “adthrive-collapse-bottom-right” ; } return mobileLocation; }; return VideoUtils; }()); var VideoAdOptions = (function () { function VideoAdOptions(_clsOptions) { this._clsOptions = _clsOptions; this.removeVideoTitleWrapper = defaultTo(this._clsOptions.siteAds.adOptions.removeVideoTitleWrapper, false); var videoPlayers = this._clsOptions.siteAds.videoPlayers; this.footerSelector = defaultTo(videoPlayers && videoPlayers.footerSelector, ”); this.players = defaultTo(videoPlayers && videoPlayers.players.map(function (player) { player.mobileLocation = VideoUtils.setMobileLocation(player.mobileLocation); return player; }), []); this.contextualSettings = videoPlayers && videoPlayers.contextual; } return VideoAdOptions; }()); var Video = (function () { function Video(clsOptions) { this.mobileStickyPlayerOnPage = false; this.playlistPlayerAdded = false; this.contextualPlayerAdded = false; this.sekindoPlayerAdded = false; this.footerSelector = ”; this.removeVideoTitleWrapper = false; this.videoAdOptions = new VideoAdOptions(clsOptions); this.players = this.videoAdOptions.players; this.contextualSettings = this.videoAdOptions.contextualSettings; this.removeVideoTitleWrapper = this.videoAdOptions.removeVideoTitleWrapper; this.footerSelector = this.videoAdOptions.footerSelector; } return Video; }()); var Config = (function () { function Config(clsOptions) { this.clsOptions = clsOptions; this.enabledLocations = [‘Below_Post’, ‘Content’, ‘Recipe’, ‘Sidebar’]; } return Config; }()); var commonjsGlobal = typeof globalThis !== ‘undefined’ ? globalThis : typeof window !== ‘undefined’ ? window : typeof global !== ‘undefined’ ? global : typeof self !== ‘undefined’ ? self : {}; var Reflect$1; (function (Reflect) { (function (factory) { var root = typeof commonjsGlobal === “object” ? commonjsGlobal : typeof self === “object” ? self : typeof this === “object” ? this : Function(“return this;”)(); var exporter = makeExporter(Reflect); if (typeof root.Reflect === “undefined”) { root.Reflect = Reflect; } else { exporter = makeExporter(root.Reflect, exporter); } factory(exporter); function makeExporter(target, previous) { return function (key, value) { if (typeof target[key] !== “function”) { Object.defineProperty(target, key, { configurable: true, writable: true, value: value }); } if (previous) previous(key, value); }; } })(function (exporter) { var hasOwn = Object.prototype.hasOwnProperty; var supportsSymbol = typeof Symbol === “function”; var toPrimitiveSymbol = supportsSymbol && typeof Symbol.toPrimitive !== “undefined” ? Symbol.toPrimitive : “@@toPrimitive”; var iteratorSymbol = supportsSymbol && typeof Symbol.iterator !== “undefined” ? Symbol.iterator : “@@iterator”; var supportsCreate = typeof Object.create === “function”; var supportsProto = { __proto__: [] } instanceof Array; var downLevel = !supportsCreate && !supportsProto; var HashMap = { create: supportsCreate ? function () { return MakeDictionary(Object.create(null)); } : supportsProto ? function () { return MakeDictionary({ __proto__: null }); } : function () { return MakeDictionary({}); }, has: downLevel ? function (map, key) { return hasOwn.call(map, key); } : function (map, key) { return key in map; }, get: downLevel ? function (map, key) { return hasOwn.call(map, key) ? map[key] : undefined; } : function (map, key) { return map[key]; }, }; var functionPrototype = Object.getPrototypeOf(Function); var usePolyfill = typeof process === “object” && process.env && process.env[“REFLECT_METADATA_USE_MAP_POLYFILL”] === “true”; var _Map = !usePolyfill && typeof Map === “function” && typeof Map.prototype.entries === “function” ? Map : CreateMapPolyfill(); var _Set = !usePolyfill && typeof Set === “function” && typeof Set.prototype.entries === “function” ? Set : CreateSetPolyfill(); var _WeakMap = !usePolyfill && typeof WeakMap === “function” ? WeakMap : CreateWeakMapPolyfill(); var Metadata = new _WeakMap(); function decorate(decorators, target, propertyKey, attributes) { if (!IsUndefined(propertyKey)) { if (!IsArray(decorators)) throw new TypeError(); if (!IsObject(target)) throw new TypeError(); if (!IsObject(attributes) && !IsUndefined(attributes) && !IsNull(attributes)) throw new TypeError(); if (IsNull(attributes)) attributes = undefined; propertyKey = ToPropertyKey(propertyKey); return DecorateProperty(decorators, target, propertyKey, attributes); } else { if (!IsArray(decorators)) throw new TypeError(); if (!IsConstructor(target)) throw new TypeError(); return DecorateConstructor(decorators, target); } } exporter(“decorate”, decorate); function metadata(metadataKey, metadataValue) { function decorator(target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey) && !IsPropertyKey(propertyKey)) throw new TypeError(); OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey); } return decorator; } exporter(“metadata”, metadata); function defineMetadata(metadataKey, metadataValue, target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey); } exporter(“defineMetadata”, defineMetadata); function hasMetadata(metadataKey, target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); return OrdinaryHasMetadata(metadataKey, target, propertyKey); } exporter(“hasMetadata”, hasMetadata); function hasOwnMetadata(metadataKey, target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); return OrdinaryHasOwnMetadata(metadataKey, target, propertyKey); } exporter(“hasOwnMetadata”, hasOwnMetadata); function getMetadata(metadataKey, target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); return OrdinaryGetMetadata(metadataKey, target, propertyKey); } exporter(“getMetadata”, getMetadata); function getOwnMetadata(metadataKey, target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); return OrdinaryGetOwnMetadata(metadataKey, target, propertyKey); } exporter(“getOwnMetadata”, getOwnMetadata); function getMetadataKeys(target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); return OrdinaryMetadataKeys(target, propertyKey); } exporter(“getMetadataKeys”, getMetadataKeys); function getOwnMetadataKeys(target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); return OrdinaryOwnMetadataKeys(target, propertyKey); } exporter(“getOwnMetadataKeys”, getOwnMetadataKeys); function deleteMetadata(metadataKey, target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); var metadataMap = GetOrCreateMetadataMap(target, propertyKey, false); if (IsUndefined(metadataMap)) return false; if (!metadataMap.delete(metadataKey)) return false; if (metadataMap.size > 0) return true; var targetMetadata = Metadata.get(target); targetMetadata.delete(propertyKey); if (targetMetadata.size > 0) return true; Metadata.delete(target); return true; } exporter(“deleteMetadata”, deleteMetadata); function DecorateConstructor(decorators, target) { for (var i = decorators.length – 1; i >= 0; –i) { var decorator = decorators[i]; var decorated = decorator(target); if (!IsUndefined(decorated) && !IsNull(decorated)) { if (!IsConstructor(decorated)) throw new TypeError(); target = decorated; } } return target; } function DecorateProperty(decorators, target, propertyKey, descriptor) { for (var i = decorators.length – 1; i >= 0; –i) { var decorator = decorators[i]; var decorated = decorator(target, propertyKey, descriptor); if (!IsUndefined(decorated) && !IsNull(decorated)) { if (!IsObject(decorated)) throw new TypeError(); descriptor = decorated; } } return descriptor; } function GetOrCreateMetadataMap(O, P, Create) { var targetMetadata = Metadata.get(O); if (IsUndefined(targetMetadata)) { if (!Create) return undefined; targetMetadata = new _Map(); Metadata.set(O, targetMetadata); } var metadataMap = targetMetadata.get(P); if (IsUndefined(metadataMap)) { if (!Create) return undefined; metadataMap = new _Map(); targetMetadata.set(P, metadataMap); } return metadataMap; } function OrdinaryHasMetadata(MetadataKey, O, P) { var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); if (hasOwn) return true; var parent = OrdinaryGetPrototypeOf(O); if (!IsNull(parent)) return OrdinaryHasMetadata(MetadataKey, parent, P); return false; } function OrdinaryHasOwnMetadata(MetadataKey, O, P) { var metadataMap = GetOrCreateMetadataMap(O, P, false); if (IsUndefined(metadataMap)) return false; return ToBoolean(metadataMap.has(MetadataKey)); } function OrdinaryGetMetadata(MetadataKey, O, P) { var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); if (hasOwn) return OrdinaryGetOwnMetadata(MetadataKey, O, P); var parent = OrdinaryGetPrototypeOf(O); if (!IsNull(parent)) return OrdinaryGetMetadata(MetadataKey, parent, P); return undefined; } function OrdinaryGetOwnMetadata(MetadataKey, O, P) { var metadataMap = GetOrCreateMetadataMap(O, P, false); if (IsUndefined(metadataMap)) return undefined; return metadataMap.get(MetadataKey); } function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) { var metadataMap = GetOrCreateMetadataMap(O, P, true); metadataMap.set(MetadataKey, MetadataValue); } function OrdinaryMetadataKeys(O, P) { var ownKeys = OrdinaryOwnMetadataKeys(O, P); var parent = OrdinaryGetPrototypeOf(O); if (parent === null) return ownKeys; var parentKeys = OrdinaryMetadataKeys(parent, P); if (parentKeys.length <= 0) return ownKeys; if (ownKeys.length <= 0) return parentKeys; var set = new _Set(); var keys = []; for (var _i = 0, ownKeys_1 = ownKeys; _i < ownKeys_1.length; _i++) { var key = ownKeys_1[_i]; var hasKey = set.has(key); if (!hasKey) { set.add(key); keys.push(key); } } for (var _a = 0, parentKeys_1 = parentKeys; _a = 0 && index = this._keys.length) { this._index = -1; this._keys = arraySentinel; this._values = arraySentinel; } else { this._index++; } return { value: result, done: false }; } return { value: undefined, done: true }; }; MapIterator.prototype.throw = function (error) { if (this._index >= 0) { this._index = -1; this._keys = arraySentinel; this._values = arraySentinel; } throw error; }; MapIterator.prototype.return = function (value) { if (this._index >= 0) { this._index = -1; this._keys = arraySentinel; this._values = arraySentinel; } return { value: value, done: true }; }; return MapIterator; }()); return (function () { function Map() { this._keys = []; this._values = []; this._cacheKey = cacheSentinel; this._cacheIndex = -2; } Object.defineProperty(Map.prototype, “size”, { get: function () { return this._keys.length; }, enumerable: true, configurable: true }); Map.prototype.has = function (key) { return this._find(key, false) >= 0; }; Map.prototype.get = function (key) { var index = this._find(key, false); return index >= 0 ? this._values[index] : undefined; }; Map.prototype.set = function (key, value) { var index = this._find(key, true); this._values[index] = value; return this; }; Map.prototype.delete = function (key) { var index = this._find(key, false); if (index >= 0) { var size = this._keys.length; for (var i = index + 1; i < size; i++) { this._keys[i - 1] = this._keys[i]; this._values[i - 1] = this._values[i]; } this._keys.length--; this._values.length--; if (key === this._cacheKey) { this._cacheKey = cacheSentinel; this._cacheIndex = -2; } return true; } return false; }; Map.prototype.clear = function () { this._keys.length = 0; this._values.length = 0; this._cacheKey = cacheSentinel; this._cacheIndex = -2; }; Map.prototype.keys = function () { return new MapIterator(this._keys, this._values, getKey); }; Map.prototype.values = function () { return new MapIterator(this._keys, this._values, getValue); }; Map.prototype.entries = function () { return new MapIterator(this._keys, this._values, getEntry); }; Map.prototype["@@iterator"] = function () { return this.entries(); }; Map.prototype[iteratorSymbol] = function () { return this.entries(); }; Map.prototype._find = function (key, insert) { if (this._cacheKey !== key) { this._cacheIndex = this._keys.indexOf(this._cacheKey = key); } if (this._cacheIndex < 0 && insert) { this._cacheIndex = this._keys.length; this._keys.push(key); this._values.push(undefined); } return this._cacheIndex; }; return Map; }()); function getKey(key, _) { return key; } function getValue(_, value) { return value; } function getEntry(key, value) { return [key, value]; } } function CreateSetPolyfill() { return (function () { function Set() { this._map = new _Map(); } Object.defineProperty(Set.prototype, "size", { get: function () { return this._map.size; }, enumerable: true, configurable: true }); Set.prototype.has = function (value) { return this._map.has(value); }; Set.prototype.add = function (value) { return this._map.set(value, value), this; }; Set.prototype.delete = function (value) { return this._map.delete(value); }; Set.prototype.clear = function () { this._map.clear(); }; Set.prototype.keys = function () { return this._map.keys(); }; Set.prototype.values = function () { return this._map.values(); }; Set.prototype.entries = function () { return this._map.entries(); }; Set.prototype["@@iterator"] = function () { return this.keys(); }; Set.prototype[iteratorSymbol] = function () { return this.keys(); }; return Set; }()); } function CreateWeakMapPolyfill() { var UUID_SIZE = 16; var keys = HashMap.create(); var rootKey = CreateUniqueKey(); return (function () { function WeakMap() { this._key = CreateUniqueKey(); } WeakMap.prototype.has = function (target) { var table = GetOrCreateWeakMapTable(target, false); return table !== undefined ? HashMap.has(table, this._key) : false; }; WeakMap.prototype.get = function (target) { var table = GetOrCreateWeakMapTable(target, false); return table !== undefined ? HashMap.get(table, this._key) : undefined; }; WeakMap.prototype.set = function (target, value) { var table = GetOrCreateWeakMapTable(target, true); table[this._key] = value; return this; }; WeakMap.prototype.delete = function (target) { var table = GetOrCreateWeakMapTable(target, false); return table !== undefined ? delete table[this._key] : false; }; WeakMap.prototype.clear = function () { this._key = CreateUniqueKey(); }; return WeakMap; }()); function CreateUniqueKey() { var key; do key = "@@[email protected]@" + CreateUUID(); while (HashMap.has(keys, key)); keys[key] = true; return key; } function GetOrCreateWeakMapTable(target, create) { if (!hasOwn.call(target, rootKey)) { if (!create) return undefined; Object.defineProperty(target, rootKey, { value: HashMap.create() }); } return target[rootKey]; } function FillRandomBytes(buffer, size) { for (var i = 0; i < size; ++i) buffer[i] = Math.random() * 0xff | 0; return buffer; } function GenRandomBytes(size) { if (typeof Uint8Array === "function") { if (typeof crypto !== "undefined") return crypto.getRandomValues(new Uint8Array(size)); if (typeof msCrypto !== "undefined") return msCrypto.getRandomValues(new Uint8Array(size)); return FillRandomBytes(new Uint8Array(size), size); } return FillRandomBytes(new Array(size), size); } function CreateUUID() { var data = GenRandomBytes(UUID_SIZE); data[6] = data[6] & 0x4f | 0x40; data[8] = data[8] & 0xbf | 0x80; var result = ""; for (var offset = 0; offset < UUID_SIZE; ++offset) { var byte = data[offset]; if (offset === 4 || offset === 6 || offset === 8) result += "-"; if (byte = o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i[“return”])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } var INJECTION_TOKEN_METADATA_KEY = "injectionTokens"; function getParamInfo(target) { var params = Reflect.getMetadata("design:paramtypes", target) || []; var injectionTokens = Reflect.getOwnMetadata(INJECTION_TOKEN_METADATA_KEY, target) || {}; Object.keys(injectionTokens).forEach(function (key) { params[+key] = injectionTokens[key]; }); return params; } function isClassProvider(provider) { return !!provider.useClass; } function isFactoryProvider(provider) { return !!provider.useFactory; } var DelayedConstructor = (function () { function DelayedConstructor(wrap) { this.wrap = wrap; this.reflectMethods = [ "get", "getPrototypeOf", "setPrototypeOf", "getOwnPropertyDescriptor", "defineProperty", "has", "set", "deleteProperty", "apply", "construct" ]; } DelayedConstructor.prototype.createProxy = function (createObject) { var _this = this; var target = {}; var init = false; var value; var delayedObject = function () { if (!init) { value = createObject(_this.wrap()); init = true; } return value; }; return new Proxy(target, this.createHandler(delayedObject)); }; DelayedConstructor.prototype.createHandler = function (delayedObject) { var handler = {}; var install = function (name) { handler[name] = function () { var args = []; for (var _i = 0; _i 0; }; RegistryBase.prototype.clear = function () { this._registryMap.clear(); }; RegistryBase.prototype.ensure = function (key) { if (!this._registryMap.has(key)) { this._registryMap.set(key, []); } }; return RegistryBase; }()); var Registry = (function (_super) { __extends(Registry, _super); function Registry() { return _super !== null && _super.apply(this, arguments) || this; } return Registry; }(RegistryBase)); var ResolutionContext = (function () { function ResolutionContext() { this.scopedResolutions = new Map(); } return ResolutionContext; }()); function formatDependency(params, idx) { if (params === null) { return "at position #" + idx; } var argName = params.split(",")[idx].trim(); return """ + argName + "" at position #" + idx; } function composeErrorMessage(msg, e, indent) { if (indent === void 0) { indent = " "; } return __spread([msg], e.message.split("n").map(function (l) { return indent + l; })).join("n"); } function formatErrorCtor(ctor, paramIdx, error) { var _a = __read(ctor.toString().match(/constructor(([w, ]+))/) || [], 2), _b = _a[1], params = _b === void 0 ? null : _b; var dep = formatDependency(params, paramIdx); return composeErrorMessage("Cannot inject the dependency " + dep + " of "" + ctor.name + "" constructor. Reason:", error); } var PreResolutionInterceptors = (function (_super) { __extends(PreResolutionInterceptors, _super); function PreResolutionInterceptors() { return _super !== null && _super.apply(this, arguments) || this; } return PreResolutionInterceptors; }(RegistryBase)); var PostResolutionInterceptors = (function (_super) { __extends(PostResolutionInterceptors, _super); function PostResolutionInterceptors() { return _super !== null && _super.apply(this, arguments) || this; } return PostResolutionInterceptors; }(RegistryBase)); var Interceptors = (function () { function Interceptors() { this.preResolution = new PreResolutionInterceptors(); this.postResolution = new PostResolutionInterceptors(); } return Interceptors; }()); var typeInfo = new Map(); var InternalDependencyContainer = (function () { function InternalDependencyContainer(parent) { this.parent = parent; this._registry = new Registry(); this.interceptors = new Interceptors(); } InternalDependencyContainer.prototype.register = function (token, providerOrConstructor, options) { if (options === void 0) { options = { lifecycle: Lifecycle$1.Transient }; } var provider; if (!isProvider(providerOrConstructor)) { provider = { useClass: providerOrConstructor }; } else { provider = providerOrConstructor; } if (isTokenProvider(provider)) { var path = [token]; var tokenProvider = provider; while (tokenProvider != null) { var currentToken = tokenProvider.useToken; if (path.includes(currentToken)) { throw new Error("Token registration cycle detected! " + __spread(path, [currentToken]).join(" -> “)); } path.push(currentToken); var registration = this._registry.get(currentToken); if (registration && isTokenProvider(registration.provider)) { tokenProvider = registration.provider; } else { tokenProvider = null; } } } if (options.lifecycle === Lifecycle$1.Singleton || options.lifecycle == Lifecycle$1.ContainerScoped || options.lifecycle == Lifecycle$1.ResolutionScoped) { if (isValueProvider(provider) || isFactoryProvider(provider)) { throw new Error(“Cannot use lifecycle “” + Lifecycle$1[options.lifecycle] + “” with ValueProviders or FactoryProviders”); } } this._registry.set(token, { provider: provider, options: options }); return this; }; InternalDependencyContainer.prototype.registerType = function (from, to) { if (isNormalToken(to)) { return this.register(from, { useToken: to }); } return this.register(from, { useClass: to }); }; InternalDependencyContainer.prototype.registerInstance = function (token, instance) { return this.register(token, { useValue: instance }); }; InternalDependencyContainer.prototype.registerSingleton = function (from, to) { if (isNormalToken(from)) { if (isNormalToken(to)) { return this.register(from, { useToken: to }, { lifecycle: Lifecycle$1.Singleton }); } else if (to) { return this.register(from, { useClass: to }, { lifecycle: Lifecycle$1.Singleton }); } throw new Error(‘Cannot register a type name as a singleton without a “to” token’); } var useClass = from; if (to && !isNormalToken(to)) { useClass = to; } return this.register(from, { useClass: useClass }, { lifecycle: Lifecycle$1.Singleton }); }; InternalDependencyContainer.prototype.resolve = function (token, context) { if (context === void 0) { context = new ResolutionContext(); } var registration = this.getRegistration(token); if (!registration && isNormalToken(token)) { throw new Error(“Attempted to resolve unregistered dependency token: “” + token.toString() + “””); } this.executePreResolutionInterceptor(token, “Single”); if (registration) { var result = this.resolveRegistration(registration, context); this.executePostResolutionInterceptor(token, result, “Single”); return result; } if (isConstructorToken(token)) { var result = this.construct(token, context); this.executePostResolutionInterceptor(token, result, “Single”); return result; } throw new Error(“Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.”); }; InternalDependencyContainer.prototype.executePreResolutionInterceptor = function (token, resolutionType) { var e_1, _a; if (this.interceptors.preResolution.has(token)) { var remainingInterceptors = []; try { for (var _b = __values(this.interceptors.preResolution.getAll(token)), _c = _b.next(); !_c.done; _c = _b.next()) { var interceptor = _c.value; if (interceptor.options.frequency != “Once”) { remainingInterceptors.push(interceptor); } interceptor.callback(token, resolutionType); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } this.interceptors.preResolution.setAll(token, remainingInterceptors); } }; InternalDependencyContainer.prototype.executePostResolutionInterceptor = function (token, result, resolutionType) { var e_2, _a; if (this.interceptors.postResolution.has(token)) { var remainingInterceptors = []; try { for (var _b = __values(this.interceptors.postResolution.getAll(token)), _c = _b.next(); !_c.done; _c = _b.next()) { var interceptor = _c.value; if (interceptor.options.frequency != “Once”) { remainingInterceptors.push(interceptor); } interceptor.callback(token, result, resolutionType); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_2) throw e_2.error; } } this.interceptors.postResolution.setAll(token, remainingInterceptors); } }; InternalDependencyContainer.prototype.resolveRegistration = function (registration, context) { if (registration.options.lifecycle === Lifecycle$1.ResolutionScoped && context.scopedResolutions.has(registration)) { return context.scopedResolutions.get(registration); } var isSingleton = registration.options.lifecycle === Lifecycle$1.Singleton; var isContainerScoped = registration.options.lifecycle === Lifecycle$1.ContainerScoped; var returnInstance = isSingleton || isContainerScoped; var resolved; if (isValueProvider(registration.provider)) { resolved = registration.provider.useValue; } else if (isTokenProvider(registration.provider)) { resolved = returnInstance ? registration.instance || (registration.instance = this.resolve(registration.provider.useToken, context)) : this.resolve(registration.provider.useToken, context); } else if (isClassProvider(registration.provider)) { resolved = returnInstance ? registration.instance || (registration.instance = this.construct(registration.provider.useClass, context)) : this.construct(registration.provider.useClass, context); } else if (isFactoryProvider(registration.provider)) { resolved = registration.provider.useFactory(this); } else { resolved = this.construct(registration.provider, context); } if (registration.options.lifecycle === Lifecycle$1.ResolutionScoped) { context.scopedResolutions.set(registration, resolved); } return resolved; }; InternalDependencyContainer.prototype.resolveAll = function (token, context) { var _this = this; if (context === void 0) { context = new ResolutionContext(); } var registrations = this.getAllRegistrations(token); if (!registrations && isNormalToken(token)) { throw new Error(“Attempted to resolve unregistered dependency token: “” + token.toString() + “””); } this.executePreResolutionInterceptor(token, “All”); if (registrations) { var result_1 = registrations.map(function (item) { return _this.resolveRegistration(item, context); }); this.executePostResolutionInterceptor(token, result_1, “All”); return result_1; } var result = [this.construct(token, context)]; this.executePostResolutionInterceptor(token, result, “All”); return result; }; InternalDependencyContainer.prototype.isRegistered = function (token, recursive) { if (recursive === void 0) { recursive = false; } return (this._registry.has(token) || (recursive && (this.parent || false) && this.parent.isRegistered(token, true))); }; InternalDependencyContainer.prototype.reset = function () { this._registry.clear(); this.interceptors.preResolution.clear(); this.interceptors.postResolution.clear(); }; InternalDependencyContainer.prototype.clearInstances = function () { var e_3, _a; try { for (var _b = __values(this._registry.entries()), _c = _b.next(); !_c.done; _c = _b.next()) { var _d = __read(_c.value, 2), token = _d[0], registrations = _d[1]; this._registry.setAll(token, registrations .filter(function (registration) { return !isValueProvider(registration.provider); }) .map(function (registration) { registration.instance = undefined; return registration; })); } } catch (e_3_1) { e_3 = { error: e_3_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_3) throw e_3.error; } } }; InternalDependencyContainer.prototype.createChildContainer = function () { var e_4, _a; var childContainer = new InternalDependencyContainer(this); try { for (var _b = __values(this._registry.entries()), _c = _b.next(); !_c.done; _c = _b.next()) { var _d = __read(_c.value, 2), token = _d[0], registrations = _d[1]; if (registrations.some(function (_a) { var options = _a.options; return options.lifecycle === Lifecycle$1.ContainerScoped; })) { childContainer._registry.setAll(token, registrations.map(function (registration) { if (registration.options.lifecycle === Lifecycle$1.ContainerScoped) { return { provider: registration.provider, options: registration.options }; } return registration; })); } } } catch (e_4_1) { e_4 = { error: e_4_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_4) throw e_4.error; } } return childContainer; }; InternalDependencyContainer.prototype.beforeResolution = function (token, callback, options) { if (options === void 0) { options = { frequency: “Always” }; } this.interceptors.preResolution.set(token, { callback: callback, options: options }); }; InternalDependencyContainer.prototype.afterResolution = function (token, callback, options) { if (options === void 0) { options = { frequency: “Always” }; } this.interceptors.postResolution.set(token, { callback: callback, options: options }); }; InternalDependencyContainer.prototype.getRegistration = function (token) { if (this.isRegistered(token)) { return this._registry.get(token); } if (this.parent) { return this.parent.getRegistration(token); } return null; }; InternalDependencyContainer.prototype.getAllRegistrations = function (token) { if (this.isRegistered(token)) { return this._registry.getAll(token); } if (this.parent) { return this.parent.getAllRegistrations(token); } return null; }; InternalDependencyContainer.prototype.construct = function (ctor, context) { var _this = this; if (ctor instanceof DelayedConstructor) { return ctor.createProxy(function (target) { return _this.resolve(target, context); }); } var paramInfo = typeInfo.get(ctor); if (!paramInfo || paramInfo.length === 0) { if (ctor.length === 0) { return new ctor(); } else { throw new Error(“TypeInfo not known for “” + ctor.name + “””); } } var params = paramInfo.map(this.resolveParams(context, ctor)); return new (ctor.bind.apply(ctor, __spread([void 0], params)))(); }; InternalDependencyContainer.prototype.resolveParams = function (context, ctor) { var _this = this; return function (param, idx) { var _a, _b, _c; try { if (isTokenDescriptor(param)) { if (isTransformDescriptor(param)) { return param.multiple ? (_a = _this.resolve(param.transform)).transform.apply(_a, __spread([_this.resolveAll(param.token)], param.transformArgs)) : (_b = _this.resolve(param.transform)).transform.apply(_b, __spread([_this.resolve(param.token, context)], param.transformArgs)); } else { return param.multiple ? _this.resolveAll(param.token) : _this.resolve(param.token, context); } } else if (isTransformDescriptor(param)) { return (_c = _this.resolve(param.transform, context)).transform.apply(_c, __spread([_this.resolve(param.token, context)], param.transformArgs)); } return _this.resolve(param, context); } catch (e) { throw new Error(formatErrorCtor(ctor, idx, e)); } }; }; return InternalDependencyContainer; }()); new InternalDependencyContainer(); function injectable() { return function (target) { typeInfo.set(target, getParamInfo(target)); }; } if (typeof Reflect === “undefined” || !Reflect.getMetadata) { throw new Error(“tsyringe requires a reflect polyfill. Please add ‘import “reflect-metadata”‘ to the top of your entry point.”); } var Emitter = (function () { function Emitter() { this._listeners = new Set(); this._emitted = 0; } Emitter.prototype.on = function (listener) { var _this = this; this._listeners.add(listener); return function () { _this.off(listener); }; }; Emitter.prototype.off = function (listener) { this._listeners.delete(listener); }; Emitter.prototype.once = function () { var _this = this; return new Promise(function (resolve) { var off = _this.on(function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } off(); return resolve(args); }); }); }; Emitter.prototype.emit = function (value) { return __awaiter(this, void 0, void 0, function () { var _this = this; return __generator(this, function (_a) { return [2 , Promise.all(__spread$1(this._listeners).map(function (listener) { return listener(value); })).then(function (result) { _this._emitted++; return result; })]; }); }); }; Emitter.prototype.clear = function () { this._listeners.clear(); }; Object.defineProperty(Emitter.prototype, "count", { get: function () { return this._listeners.size; }, enumerable: false, configurable: true }); Object.defineProperty(Emitter.prototype, "emitted", { get: function () { return this._emitted; }, enumerable: false, configurable: true }); return Emitter; }()); var Logger = (function () { function Logger() { this.sending = new Emitter(); this.logQueue = []; this.supressedEventLogNames = new Map([['SlotRenderEnded', 'adImpression']]); this.disableLogging = false; this.queueLogs = false; } Logger.prototype.init = function (adthrive) { this.logFilter = adthrive.loggerFilters || []; this.siteId = adthrive.siteAds.siteId; this.siteName = adthrive.siteAds.siteName; this.bucket = adthrive.bucket; this.branch = adthrive.branch; this.deployment = adthrive.deployment; this.debug = adthrive.debug; }; Logger.prototype.log = function (className, methodName) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.call.apply(this, __spread$1([console.log, className, methodName], args)); }; Logger.prototype.info = function (className, methodName) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.call.apply(this, __spread$1([console.info, className, methodName], args)); }; Logger.prototype.warn = function (className, methodName) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.call.apply(this, __spread$1([console.warn, className, methodName], args)); }; Logger.prototype.error = function (className, methodName) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.call.apply(this, __spread$1([console.error, className, methodName], args)); this.makeRequest.apply(this, __spread$1(['send', 'error', className, methodName], args)).catch(function (err) { console.error(err); }); }; Logger.prototype.event = function (className, methodName) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } var shouldLog = this.debug || !this.supressedEventLogNames.has(className) || this.supressedEventLogNames.get(className) !== methodName; if (shouldLog) { this.call.apply(this, __spread$1([console.log, className, methodName], args)); } this.makeRequest.apply(this, __spread$1(['send', 'event', className, methodName], args)).catch(function (err) { console.error(err); }); }; Logger.prototype.fetchEvent = function (className, methodName) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.call.apply(this, __spread$1([console.log, className, methodName], args)); this.makeRequest.apply(this, __spread$1(['fetch', 'event', className, methodName], args)).catch(function (err) { console.error(err); }); }; Logger.prototype.call = function (logFunction, className, methodName) { var args = []; for (var _i = 3; _i -1) { return; } var message = ["%c" + className + "::" + methodName + " "]; var params = ['color: #999; font-weight: bold;']; if (args.length > 0 && typeof args[0] === ‘string’) { message.push(args.shift()); } params.push.apply(params, __spread$1(args)); try { Function.prototype.apply.call(logFunction, console, __spread$1([message.join(”)], params)); } catch (err) { console.error(err); return; } }; Logger.prototype.buildRequestUrl = function (type, className, methodName, args) { var baseUrl = “https://logger.adthrive.com/” + type; var message = [className + “::” + methodName + ” “]; if (args.length > 0 && typeof args[0] === ‘string’) { message.push(args.shift()); } var body = args.map(function (arg) { if (arg && arg.error) { arg = arg.error; } if (arg instanceof Error) { arg = { name: arg.name, message: arg.message, stack: arg.stack, }; } return arg; }); if (this.data) { body.push(this.data); } var payload = [ “siteId=” + encodeURIComponent(this.siteId || ”), “siteName=” + encodeURIComponent(this.siteName || ”), “bucket=” + encodeURIComponent(this.bucket || ”), “branch=” + encodeURIComponent(this.branch || ”), “deployment=” + encodeURIComponent(this.deployment || ”), “message=” + encodeURIComponent(message.join(”).trim()), “pageurl=” + encodeURIComponent(window.location.origin + window.location.pathname), “body=” + encodeURIComponent(JSON.stringify(body)), ]; return baseUrl + “?” + payload.join(‘&’); }; Logger.prototype.clearLogQueue = function (sendLogs) { var _this = this; this.info(‘Logger’, ‘gdprEnforcement’, ‘clearLogQueue’, sendLogs); if (sendLogs) { this.logQueue.forEach(function (log) { if (log.action === ‘send’) { _this.sendRequest.apply(_this, __spread$1([log.type, log.className, log.methodName], log.args)).catch(function () { }); } if (log.action === ‘fetch’) { _this.fetchRequest.apply(_this, __spread$1([log.type, log.className, log.methodName], log.args)).catch(function () { }); } }); } this.logQueue = []; this.queueLogs = false; }; Logger.prototype.makeRequest = function (action, type, className, methodName) { var args = []; for (var _i = 4; _i < arguments.length; _i++) { args[_i - 4] = arguments[_i]; } return __awaiter(this, void 0, void 0, function () { var log; return __generator(this, function (_a) { if (this.disableLogging) { this.info('Logger', 'gdprEnforcement', 'logging disabled'); return [2 , Promise.resolve(false)]; } if (this.queueLogs) { log = { action: action, type: type, className: className, methodName: methodName, args: args }; this.logQueue.push(log); this.info('Logger', 'gdprEnforcement', 'log queued'); return [2 , Promise.resolve(true)]; } if (action === 'send') { return [2 , this.sendRequest.apply(this, __spread$1([type, className, methodName], args))]; } else { return [2 , this.fetchRequest.apply(this, __spread$1([type, className, methodName], args))]; } }); }); }; Logger.prototype.sendRequest = function (type, className, methodName) { var args = []; for (var _i = 3; _i maxCloudFrontUrlSize) { return [2 , this.sendRequest(type, className, methodName, 'Error query too large').catch(function (err) { console.error(err); })]; } return [2 , new Promise(function (resolve, reject) { var request = new XMLHttpRequest(); request.open('get', requestUrl); request.addEventListener('load', function () { if (request.status !== 200) { return reject(new Error("Logger send request failed " + request.status)); } return resolve(request.responseText); }); request.addEventListener('error', function () { return reject(new Error('Logger send request failed')); }); request.send(); })]; }); }); }; Logger.prototype.fetchRequest = function (type, className, methodName) { var args = []; for (var _i = 3; _i < arguments.length; _i++) { args[_i - 3] = arguments[_i]; } return __awaiter(this, void 0, void 0, function () { var requestUrl; return __generator(this, function (_a) { this.sending.emit().catch(function () { }); requestUrl = this.buildRequestUrl(type, className, methodName, args); return [2 , fetch(requestUrl, { method: 'GET', keepalive: true, referrerPolicy: 'no-referrer-when-downgrade' })]; }); }); }; Logger = __decorate([ injectable() ], Logger); return Logger; }()); var logger = new Logger(); var addBodyClass = function (device) { var body = document.body; var className = "adthrive-device-" + device; if (!body.classList.contains(className)) { try { body.classList.add(className); } catch (err) { logger.error('BodyDeviceClassComponent', 'init', { message: err.message }); var support = 'classList' in document.createElement('_'); logger.error('BodyDeviceClassComponent', 'init.support', { support: support }); } } }; var DensityDevice; (function (DensityDevice) { DensityDevice["Desktop"] = "desktop"; DensityDevice["Mobile"] = "mobile"; })(DensityDevice || (DensityDevice = {})); var RemoveLargeSizeExperiment = (function (_super) { __extends$1(RemoveLargeSizeExperiment, _super); function RemoveLargeSizeExperiment() { var _this = _super.call(this) || this; _this._result = false; _this._choices = [{ choice: true }, { choice: false }]; _this.key = 'smhd100'; _this._result = _this.run(); _this.setExperimentKey(); logger$1.info('CLSRemoveLargeSizeExperiment', 'result', _this._result); return _this; } Object.defineProperty(RemoveLargeSizeExperiment.prototype, "result", { get: function () { return this._result; }, enumerable: false, configurable: true }); RemoveLargeSizeExperiment.prototype.run = function () { return new BernoulliTrial(0.1).get(); }; return RemoveLargeSizeExperiment; }(PluginExperiment)); var supportedSizes = [ [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], ]; var adUnitAuctionPriorityMap = new Map([ ['Footer', 1], ['Header', 2], ['Sidebar', 3], ['Content', 4], ['Recipe', 5], ['Sidebar_sticky', 6], ['Below Post', 7], ]); var getDynamicAds = function (device, adUnits) { var removeLargeSizeExperiment = new RemoveLargeSizeExperiment(); return adUnits .filter(function (adUnit) { return adUnit.dynamic !== undefined && adUnit.dynamic.enabled; }) .map(function (adUnit) { var location = adUnit.location.replace(/s+/g, '_'); return { auctionPriority: adUnitAuctionPriorityMap.get(location) || 8, location: location, sequence: defaultTo(adUnit.sequence, 1), sizes: onlySupportedAdSizes(adUnit.adSizes).filter(function (size) { return excludeTallSizeFromHeaderFooter(adUnit.location, size, device, removeLargeSizeExperiment); }), devices: adUnit.devices, pageSelector: defaultTo(adUnit.dynamic.pageSelector, '').trim(), elementSelector: defaultTo(adUnit.dynamic.elementSelector, '').trim(), position: defaultTo(adUnit.dynamic.position, 'beforebegin'), min: Math.floor(defaultTo(adUnit.dynamic.min, 0)), max: Math.floor(defaultTo(adUnit.dynamic.max, 0)), spacing: defaultTo(adUnit.dynamic.spacing, 0), skip: Math.floor(defaultTo(adUnit.dynamic.skip, 0)), every: Math.max(Math.floor(defaultTo(adUnit.dynamic.every, 1)), 1), classNames: adUnit.dynamic.classNames || [], sticky: adUnit.location === 'Footer' ? true : adUnit.sticky, stickyOverlapSelector: defaultTo(adUnit.stickyOverlapSelector, '').trim(), autosize: adUnit.autosize, special: defaultTo(adUnit.targeting, []) .filter(function (targeting) { return targeting.key === 'special'; }) .reduce(function (values, targeting) { return values.concat.apply(values, __spread$1(targeting.value)); }, []), lazy: defaultTo(adUnit.dynamic.lazy, false), lazyMax: defaultTo(adUnit.dynamic.lazyMax, 2), lazyMaxDefaulted: adUnit.dynamic.lazyMax === 0 ? false : !adUnit.dynamic.lazyMax, }; }); }; var filterAdUnitSizes = function (dynamicAd, element) { var width = elementInnerWidth(element); var stickySidebar = dynamicAd.sticky && dynamicAd.location === 'Sidebar'; return dynamicAd.sizes.filter(function (size) { var autosize = dynamicAd.autosize ? size[0] <= width || size[0] <= 320 : true; var stickyFit = stickySidebar ? size[1] 100 && removeLargeSizeExperiment.result)); }; var slotMinHeight = '250px'; var ClsDynamicAdsInjector = (function () { function ClsDynamicAdsInjector(_clsOptions, targetDensityExperiment) { this._clsOptions = _clsOptions; this.targetDensityExperiment = targetDensityExperiment; this._totalContentInserted = 0; this._recipeCount = 0; this._mainContentHeight = 0; this._mainContentDiv = null; this._firstContentDiv = null; this._totalAvailableElements = 0; this._minDivHeight = 250; this._densityDevice = DensityDevice.Desktop; this._pubLog = { onePerViewport: false, targetDensity: 0, targetDensityUnits: 0, combinedMax: 0 }; this._densityMax = 0.99; this._infPageEndOffset = 0; this.locationMaxLazySequence = new Map([ ['Recipe', 5], ['Below_Post', 1], ]); this.locationToMinHeight = { Below_Post: slotMinHeight, Content: slotMinHeight, Recipe: slotMinHeight, Sidebar: slotMinHeight, }; var _a = this._clsOptions.siteAds.breakpoints, tablet = _a.tablet, desktop = _a.desktop; this._device = deviceByBreakpoint(tablet, desktop); this._config = new Config(_clsOptions); this._clsOptions.enabledLocations = this._config.enabledLocations; } ClsDynamicAdsInjector.prototype.start = function () { var _this = this; try { addBodyClass(this._device); var dynamicAds = getDynamicAds(this._device, this._clsOptions.siteAds.adUnits) .filter(function (dynamicAd) { return _this._locationEnabled(dynamicAd); }) .filter(function (dynamicAd) { return forDevice(dynamicAd, _this._device); }) .filter(function (dynamicAd) { return forPage(dynamicAd); }); var dynamicSlots = this.inject(dynamicAds); dynamicSlots.forEach(function (slot) { return _this._clsOptions.setInjectedSlots(slot); }); } catch (error) { logger$1.error('ClsDynamicAdsInjector', 'start', error); } }; ClsDynamicAdsInjector.prototype.inject = function (dynamicAds, target) { if (target === void 0) { target = document; } var targetDensityEnabled = this.targetDensityExperiment.result; var nonDensitySlots = dynamicAds.filter(function (dynamicAd) { return (targetDensityEnabled ? dynamicAd.location !== 'Content' : dynamicAd); }); var densitySlots = dynamicAds.filter(function (dynamicAd) { return (targetDensityEnabled ? dynamicAd.location === 'Content' : null); }); return __spread$1((nonDensitySlots.length ? this._injectNonDensitySlots(nonDensitySlots, target) : []), (densitySlots.length ? this._injectDensitySlots(densitySlots, target) : [])); }; ClsDynamicAdsInjector.prototype._injectNonDensitySlots = function (dynamicAds, target) { var e_1, _a; var _this = this; if (target === void 0) { target = document; } var slots = []; var insertedElements = []; try { for (var dynamicAds_1 = __values$1(dynamicAds), dynamicAds_1_1 = dynamicAds_1.next(); !dynamicAds_1_1.done; dynamicAds_1_1 = dynamicAds_1.next()) { var dynamicAd = dynamicAds_1_1.value; var spacing = 0; var nextAfter = 0; var totalAds = 0; if (dynamicAd.spacing > 0) { spacing = window.innerHeight * dynamicAd.spacing; nextAfter = spacing; } var repeatedDynamicAds = this._repeatDynamicAds(dynamicAd); var elements = this.getElements(dynamicAd.elementSelector, target); logger$1.info(‘ClsDynamicAdsInjector’, ‘injectNonDensitySlots’, dynamicAd.location + ” – Found ” + elements.length + ” elements for selector ” + dynamicAd.pageSelector + ” ” + dynamicAd.elementSelector, dynamicAd); if (dynamicAd.skip > 0) { logger$1.info(‘ClsDynamicAdsInjector’, ‘injectNonDensitySlots’, ‘Skipping %d element(s)’, dynamicAd.skip); } for (var elementIndex = dynamicAd.skip; elementIndex repeatedDynamicAds.length) { logger$1.info(‘ClsDynamicAdsInjector’, ‘injectNonDensitySlots’, ‘Max ads displayed %d’, totalAds); break; } var element = elements[elementIndex]; if (spacing > 0) { var bottom = elementOffset(element).bottom; if (bottom %d)’, bottom, nextAfter); nextAfter = bottom + spacing; } var min = elementIndex 1) { logger$1.info(‘ClsDynamicAdsInjector’, ‘injectNonDensitySlots’, ‘Attempting to add %d extra to satisfy the minimum’, min – 1); spacing = 0; } var _loop_1 = function () { var repeatedDynamicAd = repeatedDynamicAds[totalAds]; var name_1 = repeatedDynamicAd.location + “_” + repeatedDynamicAd.sequence; if (slots.some(function (slot) { return slot.name === name_1; })) { totalAds += 1; logger$1.warn(‘ClsDynamicAdsInjector’, ‘injectNonDensitySlots’, “Skipping duplicate slot ” + name_1); return “continue”; } var dynamicElementId = this_1.getDynamicElementId(repeatedDynamicAd); var locationClassName = “adthrive-” + dynamicAd.location.replace(‘_’, ‘-‘).toLowerCase(); var locationSequenceClassName = locationClassName + “-” + dynamicAd.sequence; var classNames = __spread$1([locationClassName, locationSequenceClassName], dynamicAd.classNames); var dynamicElement = this_1.addAd(element, dynamicElementId, dynamicAd.position, classNames); if (dynamicElement) { var sizes = filterAdUnitSizes(repeatedDynamicAd, dynamicElement); if (sizes.length) { var slotDataObj = { clsDynamicAd: dynamicAd, dynamicAd: repeatedDynamicAd, element: dynamicElement, sizes: sizes, name: name_1, infinite: target !== document, }; slots.push(slotDataObj); insertedElements.push({ location: repeatedDynamicAd.location, element: dynamicElement }); if (dynamicAd.location === ‘Recipe’) { ++this_1._recipeCount; } totalAds += 1; } else { logger$1.info(‘ClsDynamicAdsInjector’, ‘injectNonDensitySlots’, “Skipped ad unit ” + repeatedDynamicAd.location + “_” + repeatedDynamicAd.sequence + “. It does not fit in the element.”); } element = dynamicElement; } }; var this_1 = this; for (; min > 0; min–) { _loop_1(); } } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (dynamicAds_1_1 && !dynamicAds_1_1.done && (_a = dynamicAds_1.return)) _a.call(dynamicAds_1); } finally { if (e_1) throw e_1.error; } } insertedElements.forEach(function (_a) { var location = _a.location, element = _a.element; element.style.minHeight = _this.locationToMinHeight[location]; }); return slots; }; ClsDynamicAdsInjector.prototype._shouldTargetAllElgibile = function (density) { return density === this._densityMax; }; ClsDynamicAdsInjector.prototype._injectDensitySlots = function (dynamicAds, target) { var e_2, _a; var _this = this; if (target === void 0) { target = document; } try { this._calculateMainContentHeightAndAllElements(dynamicAds); } catch (e) { logger$1.warn(‘ClsDynamicAdsInjector’, ‘injectDensitySlots’, e); return []; } this._densityDevice = this._device === ‘desktop’ ? DensityDevice.Desktop : DensityDevice.Mobile; var slots = []; var _b = this._getDensitySettings(), targetDensity = _b.adDensity, onePerViewport = _b.onePerViewport; var targetAll = this._shouldTargetAllElgibile(targetDensity); var targetDensityUnits = this._getTargetDensityUnits(targetDensity); var combinedMax = this._getCombinedMax(dynamicAds); var numberOfUnits = Math.min.apply(Math, __spread$1([this._totalAvailableElements, targetDensityUnits], (combinedMax > 0 ? [combinedMax] : []))); this._pubLog = { onePerViewport: onePerViewport, targetDensity: targetDensity, targetDensityUnits: targetDensityUnits, combinedMax: combinedMax }; if (!numberOfUnits) { logger$1.warn(‘ClsDynamicAdsInjector’, ‘injectDensitySlots’, ‘No Content Units To Inject’, __assign(__assign({}, this._pubLog), { mainContentDiv: this._mainContentDiv, mainContentHeight: this._mainContentHeight, totalAvailableElements: this._totalAvailableElements })); return []; } var contentInsertedThisPage = 0; var insertNext = 0; var _loop_2 = function (dynamicAd) { var elements = this_2.getElements(dynamicAd.elementSelector, target); var insertEvery = this_2._getInsertEvery(numberOfUnits, onePerViewport); this_2._logDensityInfo(elements, dynamicAd.elementSelector, insertEvery); var dynamicInsertion = function (element) { var _a; var slot = null; var adElement = null; (_a = _this._attemptInsertion({ dynamicAd: dynamicAd, element: element, insertNext: insertNext, onePerViewport: onePerViewport, contentInsertedThisPage: contentInsertedThisPage, target: target, insertEvery: insertEvery, targetAll: targetAll, }), insertNext = _a.insertNext, slot = _a.slot, adElement = _a.adElement); if (slot && adElement) { slots.push(slot); ++contentInsertedThisPage; adElement.style.minHeight = _this.locationToMinHeight[dynamicAd.location]; } }; if (dynamicAd.skip > 0) { logger$1.info(‘ClsDynamicAdsInjector’, ‘_injectDensitySlots’, ‘Skipping %d element(s)’, dynamicAd.skip); } for (var t = dynamicAd.skip; t = this_2._mainContentHeight && this_2._totalAvailableElements > 1) { continue; } else if (contentInsertedThisPage < combinedMax && contentInsertedThisPage = Number of Units to Inject, breaking'); break; } } }; var this_2 = this; try { for (var dynamicAds_2 = __values$1(dynamicAds), dynamicAds_2_1 = dynamicAds_2.next(); !dynamicAds_2_1.done; dynamicAds_2_1 = dynamicAds_2.next()) { var dynamicAd = dynamicAds_2_1.value; _loop_2(dynamicAd); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (dynamicAds_2_1 && !dynamicAds_2_1.done && (_a = dynamicAds_2.return)) _a.call(dynamicAds_2); } finally { if (e_2) throw e_2.error; } } logger$1.info('ClsDynamicAdsInjector', '_injectDensitySlots', 'Ad Density: contentInsertedThisPage', contentInsertedThisPage); return slots; }; ClsDynamicAdsInjector.prototype._getInsertEvery = function (numberOfUnits, onePerViewport) { var trimContentFraction = 0.43; var insert = (this._mainContentHeight * trimContentFraction) / numberOfUnits; return onePerViewport && window.innerHeight > insert ? window.innerHeight : insert; }; ClsDynamicAdsInjector.prototype._getDensitySettings = function () { var densitySettings = this._clsOptions.siteAds.adDensityLayout; var overrides = this._determineOverrides(densitySettings.pageOverrides); return overrides.length ? overrides[0] : densitySettings[this._densityDevice]; }; ClsDynamicAdsInjector.prototype._determineOverrides = function (pageOverrides) { var _this = this; return pageOverrides .filter(function (pageOverride) { var selector = allowablePageSelector(pageOverride.pageSelector); return pageOverride.pageSelector === ” || (selector.elements && selector.elements.length); }) .map(function (pageOverride) { return pageOverride[_this._densityDevice]; }); }; ClsDynamicAdsInjector.prototype._getTargetDensityUnits = function (targetDensity) { return Math.floor((targetDensity * this._mainContentHeight) / (1 – targetDensity) / this._minDivHeight) – this._recipeCount; }; ClsDynamicAdsInjector.prototype._getCombinedMax = function (dynamicAds) { return defaultTo(dynamicAds .filter(function (dynamicAd) { var el; try { el = document.querySelector(dynamicAd.elementSelector); } catch (err) { logger$1.info(‘ClsDynamicAdsInjector’, ‘_getCombinedMax’, ‘Invalid Query Selector: ‘, dynamicAd.elementSelector); } return el; }) .map(function (dynamicAd) { return dynamicAd.max + (dynamicAd.lazyMaxDefaulted ? 0 : dynamicAd.lazyMax); }) .sort(function (a, b) { return b – a; })[0], 0); }; ClsDynamicAdsInjector.prototype._logDensityInfo = function (elements, elementSelector, insertEvery) { var _a = this._pubLog, onePerViewport = _a.onePerViewport, targetDensity = _a.targetDensity, targetDensityUnits = _a.targetDensityUnits, combinedMax = _a.combinedMax; logger$1.info(‘ClsDynamicAdsInjector’, ‘_logDensityInfo’, ‘Ad Density: Top Level Report’, “nOnePerViewport: ” + onePerViewport, “nTarget Density: ” + targetDensity, “nMain Content Height ” + this._mainContentHeight + “px”, “nRecipe Units: ” + this._recipeCount, “nAvailable Elements based on Selectors: ” + elements.length, “nNumber of Units to Hit Density: ” + targetDensityUnits, “nNumber of pixels between each ad (relevant for onePerViewport setting): ” + insertEvery + “px”, “nCombined max calculated from Admin Dash: ” + combinedMax, ‘nElement Selector: ‘, elementSelector, ‘nActual elements we are working with: ‘, elements); if (this._totalAvailableElements = Math.max(dynamicAd.min, dynamicAd.max) }); (_b = this._addContentAd(element, dynamicAd, newDynamicAd, target, insertEvery), slot = _b.insertedSlot, insertNext = _b.insertNext, adElement = _b.adElement); } return { insertNext: insertNext, slot: slot, adElement: adElement }; }; ClsDynamicAdsInjector.prototype._isElementSpacedCorrectly = function (element, insertNext, onePerViewport, dynamicAd, targetAll, insertEvery) { var shouldInsertAtTop = dynamicAd.position === ‘beforebegin’ || dynamicAd.position === ‘afterbegin’; var isFarEnoughFromPreviousInjection = targetAll || this._isElementFarEnough(onePerViewport, element, insertNext, shouldInsertAtTop, insertEvery); var isNotInSameRowAsNextElement = this._isElementNotInRow(element, shouldInsertAtTop); var isElementSpacedCorrectly = isFarEnoughFromPreviousInjection && isNotInSameRowAsNextElement; if (isElementSpacedCorrectly) { this._lastElement = element; this._lastAdPosition = dynamicAd.position === ‘beforebegin’ || dynamicAd.position === ‘afterbegin’ ? ‘top’ : ‘bottom’; } logger$1.info(‘ClsDynamicAdsInjector’, ‘_isElementSpacedCorrectly’, ‘Ad Density: _isElementSpacedCorrectly’, element, isElementSpacedCorrectly); return isElementSpacedCorrectly; }; ClsDynamicAdsInjector.prototype._getMinimumSpacingByLastInjection = function (insertEvery) { return this._lastAdPosition && this._lastAdPosition === ‘bottom’ && insertEvery insertNext && (lastOffset === 0 || elementEdge – lastOffset >= insertEvery + spacing); if (!onePerViewport && !isFarEnough) { logger$1.info(‘ClsDynamicAdsInjector’, ‘_isElementFarEnough’, “Ad Density: The onePerViewport setting is false, and the element edge at ” + elementEdge + “px is less than our next minimum insertion point located at ” + insertNext + “.”, element); } return isFarEnough; }; ClsDynamicAdsInjector.prototype._isElementNotInRow = function (element, shouldInsertAtTop) { var prevSibling = element.previousElementSibling; var nextSibling = element.nextElementSibling; var sibling = shouldInsertAtTop ? (!prevSibling && nextSibling) || (prevSibling && element.tagName !== prevSibling.tagName) ? nextSibling : prevSibling : nextSibling; return sibling && element.getBoundingClientRect().height === 0 ? true : sibling ? element.getBoundingClientRect().top !== sibling.getBoundingClientRect().top : true; }; ClsDynamicAdsInjector.prototype._calculateMainContentHeightAndAllElements = function (dynamicAds) { var _a = this._setMainContentAndElements(dynamicAds), mainContentDiv = _a.mainContentDiv, firstContentDiv = _a.firstContentDiv; this._mainContentDiv = mainContentDiv; this._firstContentDiv = firstContentDiv; var commentElem = this._mainContentDiv.querySelector(‘div #comments, section .comments’); this._mainContentHeight = commentElem ? this._mainContentDiv.offsetHeight – commentElem.offsetHeight : this._mainContentDiv.offsetHeight; }; ClsDynamicAdsInjector.prototype._setMainContentAndElements = function (dynamicAds) { var potentialMainContentElements = this._getPotentialElements(dynamicAds); if (potentialMainContentElements.length === 0) { throw Error(‘No Main Content Elements Found’); } var mainContentDiv = Array.from(potentialMainContentElements).reduce(function (previous, current) { return (current.offsetHeight > previous.offsetHeight ? current : previous); }) || document.body; var firstContentDiv = Array.from(potentialMainContentElements).reduce(function (previous, current) { return elementOffset(current).top < elementOffset(previous).top ? current : previous; }); return { mainContentDiv: mainContentDiv, firstContentDiv: firstContentDiv }; }; ClsDynamicAdsInjector.prototype._getPotentialElements = function (dynamicAds) { var _this = this; var article = this._attemptArticleLookup(); var potentialMainContentElements = article ? [article] : []; dynamicAds.forEach(function (dynamicAd) { return _this._getSelectors(dynamicAd.elementSelector).forEach(function (selector) { var els = document.querySelectorAll(selector); for (var k = 0; k previous.offsetHeight ? current : previous); }); var oneAndAHalfViewports = 1.5; if (content && content.offsetHeight > window.innerHeight * oneAndAHalfViewports) { logger$1.info(‘ClsDynamicAdsInjector’, ‘_attemptArticleLookup’, ‘mainContent’, content.offsetHeight, content); return content; } return null; }; ClsDynamicAdsInjector.prototype._getSelectors = function (elementSelector) { return elementSelector.indexOf(‘,’) > -1 ? elementSelector.split(‘,’) : [elementSelector]; }; ClsDynamicAdsInjector.prototype._addContentAd = function (element, dynamicAd, newDynamicAd, target, insertEvery) { if (target === void 0) { target = document; } var insertedSlot = null; var locationClassName = “adthrive-” + dynamicAd.location.replace(‘_’, ‘-‘).toLowerCase(); var locationSequenceClassName = locationClassName + “-” + dynamicAd.sequence; var adElement = this.addAd(element, this.getDynamicElementId(newDynamicAd), newDynamicAd.position, __spread$1([ locationClassName, locationSequenceClassName ], dynamicAd.classNames)); var insertNext = this._getNextInsertPosition(newDynamicAd.position, adElement, insertEvery); if (adElement) { var sizes = filterAdUnitSizes(newDynamicAd, adElement); if (sizes.length) { var name_2 = newDynamicAd.location + “_” + newDynamicAd.sequence; insertedSlot = { clsDynamicAd: dynamicAd, dynamicAd: newDynamicAd, element: adElement, sizes: sizes, name: name_2, infinite: target !== document, }; ++this._totalContentInserted; } else { logger$1.info(‘ClsDynamicAdsInjector’, ‘_addContentAd’, ‘Skipped ad unit….. It does not fit in the element.’); } } return { insertedSlot: insertedSlot, insertNext: insertNext, adElement: adElement }; }; ClsDynamicAdsInjector.prototype._getNextInsertPosition = function (position, element, insertEvery) { var rect = element.getBoundingClientRect(); var pageHeight = window.pageYOffset; var pos = (position === ‘beforebegin’ || position === ‘afterbegin’ ? rect.top : rect.bottom) + pageHeight; return pos + insertEvery + this._minDivHeight; }; ClsDynamicAdsInjector.prototype.getDynamicElementId = function (dynamicAd) { var gamPrefix = ‘AdThrive’; return gamPrefix + “_” + dynamicAd.location + “_” + dynamicAd.sequence + “_” + this._device; }; ClsDynamicAdsInjector.prototype.getElements = function (selector, target) { if (target === void 0) { target = document; } return target.querySelectorAll(selector); }; ClsDynamicAdsInjector.prototype.addAd = function (element, id, position, classNames) { if (classNames === void 0) { classNames = []; } if (!document.getElementById(id)) { var tag = “]]>”; element.insertAdjacentHTML(position, tag); } return document.getElementById(id); }; ClsDynamicAdsInjector.prototype._repeatDynamicAds = function (dynamicAd) { var repeatedDynamicAds = []; var maxLazySequence = dynamicAd.lazy ? defaultTo(this.locationMaxLazySequence.get(dynamicAd.location), 0) : 0; var initialMax = Math.max(dynamicAd.min, dynamicAd.max); var lazyMax = maxLazySequence === 0 && dynamicAd.lazy ? initialMax + dynamicAd.lazyMax : Math.min(Math.max(maxLazySequence – dynamicAd.sequence + 1, 0), initialMax + dynamicAd.lazyMax); var max = Math.max(initialMax, lazyMax); for (var dynamicSequence = 0; dynamicSequence = initialMax; repeatedDynamicAds.push(__assign(__assign({}, dynamicAd), { sequence: sequence, lazy: lazy })); } return repeatedDynamicAds; }; ClsDynamicAdsInjector.prototype._locationEnabled = function (dynamicAdUnit) { var clsEnabledLocation = this._clsOptions.enabledLocations.indexOf(dynamicAdUnit.location) !== -1; var allLocationsDisabled = (this._clsOptions.disableAds && this._clsOptions.disableAds.all) || document.body.classList.contains(‘adthrive-disable-all’); var contentEnabled = !document.body.classList.contains(‘adthrive-disable-content’) && !this._clsOptions.disableAds.reasons.has(‘content_plugin’); return clsEnabledLocation && !allLocationsDisabled && contentEnabled; }; return ClsDynamicAdsInjector; }()); var VideoAdUnit; (function (VideoAdUnit) { VideoAdUnit[“Video_Collapse_Autoplay_SoundOff”] = “Video_Collapse_Autoplay_SoundOff”; VideoAdUnit[“Video_Individual_Autoplay_SOff”] = “Video_Individual_Autoplay_SOff”; VideoAdUnit[“Video_Coll_SOff_Smartphone”] = “Video_Coll_SOff_Smartphone”; VideoAdUnit[“Video_In_Post_ClicktoPlay_SoundOn”] = “Video_In-Post_ClicktoPlay_SoundOn”; })(VideoAdUnit || (VideoAdUnit = {})); var PinterestReplacedPlayer; (function (PinterestReplacedPlayer) { PinterestReplacedPlayer[“StickySekindo”] = “stickySekindo”; PinterestReplacedPlayer[“StaticSekindo”] = “staticSekindo”; PinterestReplacedPlayer[“None”] = “none”; })(PinterestReplacedPlayer || (PinterestReplacedPlayer = {})); var SekindoHoldoutExperiment = (function (_super) { __extends$1(SekindoHoldoutExperiment, _super); function SekindoHoldoutExperiment() { var _this = _super.call(this) || this; _this.key = ‘sekho’; _this._result = false; _this._choices = [{ choice: true }, { choice: false }]; _this._result = _this.run(); _this.setExperimentKey(); logger$1.info(‘ClsSekindoHoldoutExperiment’, ‘result’, _this._result); return _this; } Object.defineProperty(SekindoHoldoutExperiment.prototype, “result”, { get: function () { return this._result; }, enumerable: false, configurable: true }); SekindoHoldoutExperiment.prototype.run = function () { return new BernoulliTrial(0.05).get(); }; return SekindoHoldoutExperiment; }(PluginExperiment)); var Component = (function () { function Component() { } Object.defineProperty(Component.prototype, “enabled”, { get: function () { return true; }, enumerable: false, configurable: true }); return Component; }()); var VideoBase = (function (_super) { __extends$1(VideoBase, _super); function VideoBase(_videoConfig, sekindoHoldoutExperimentResult, _component) { var _this = _super.call(this) || this; _this._videoConfig = _videoConfig; _this._component = _component; _this._stickyRelatedOnPage = false; _this._contextualMediaIds = []; var players = _this._videoConfig.players || []; _this._device = isDesktop() ? ‘desktop’ : ‘mobile’; _this._potentialPlayerMap = _this._setPotentialPlayerMap(sekindoHoldoutExperimentResult); var stationaryRelated = players.filter(function (player) { return player.type === “stationaryRelated” && player.enabled; }); _this._potentialPlayerMap.stationaryRelated = stationaryRelated; return _this; } VideoBase.prototype._setPotentialPlayerMap = function (sekindoHoldoutExperimentResult) { var _this = this; var players = this._videoConfig.players; var defaultMap = { stickyRelated: [], stickyPlaylist: [], sekindo: [], stationaryRelated: [], }; return players && players.length ? players .filter(function (player) { var _a; return ((_a = player.devices) === null || _a === void 0 ? void 0 : _a.indexOf(_this._device)) > -1; }) .reduce(function (accumulator, player) { if (!accumulator[player.type]) { logger.event(_this._component, ‘constructor’, ‘Unknown Video Player Type detected’, player.type); accumulator[player.type] = []; } if (player.enabled) { if (!sekindoHoldoutExperimentResult || player.type !== “sekindo” ) { accumulator[player.type].push(player); } } return accumulator; }, defaultMap) : defaultMap; }; VideoBase.prototype._checkPlayerSelectorOnPage = function (playerType) { var _this = this; var players = this._potentialPlayerMap[playerType].map(function (player) { return { player: player, playerElement: _this._getPlacementElement(player), }; }); if (!players.length) { return { player: null, playerElement: null }; } return players[0]; }; VideoBase.prototype._getOverrideElement = function (player, playerElement, publisherPageElement) { if (player && playerElement) { var div = document.createElement(‘div’); playerElement.insertAdjacentElement(player.position, div); publisherPageElement = div; logger.info(this._component, ‘_initializeRelatedPlayers’, ‘Changing injection element’, publisherPageElement); } else { var _a = this._checkPlayerSelectorOnPage(“stickyPlaylist” ), stickyPlaylistPlayer = _a.player, stickyPlaylistElement = _a.playerElement; if (stickyPlaylistPlayer && stickyPlaylistElement) { var div = document.createElement(‘div’); stickyPlaylistElement.insertAdjacentElement(stickyPlaylistPlayer.position, div); publisherPageElement = div; logger.info(this._component, ‘_initializeRelatedPlayers’, ‘Changing injection element’, publisherPageElement); } } return publisherPageElement; }; VideoBase.prototype._shouldOverrideElement = function (element) { var overrideEmbed = element.getAttribute(‘override-embed’); if (overrideEmbed === ‘true’ || overrideEmbed === ‘false’) { return overrideEmbed === ‘true’; } return this._videoConfig.contextualSettings ? this._videoConfig.contextualSettings.overrideEmbedLocation : false; }; VideoBase.prototype._getPlacementElement = function (settings) { var pageSelectorEl = allowablePageSelector(settings.pageSelector); var elementSelectorEl = validCssSelector(settings.elementSelector); if (!pageSelectorEl.valid) { logger.error(‘VideoUtils’, ‘getPlacementElement’, new Error(settings.pageSelector + ” is not a valid selector”)); return null; } if (settings.pageSelector && !pageSelectorEl.elements.length) { logger.error(‘VideoUtils’, ‘getPlacementElement’, new Error(“PSNF: ” + settings.pageSelector + ” does not exist on the page”)); return null; } if (!elementSelectorEl.valid) { logger.error(‘VideoUtils’, ‘getPlacementElement’, new Error(settings.elementSelector + ” is not a valid selector”)); return null; } if (elementSelectorEl.elements.length > settings.skip) { return elementSelectorEl.elements[settings.skip]; } else { logger.error(‘VideoUtils’, ‘getPlacementElement’, new Error(“ESNF: ” + settings.elementSelector + ” does not exist on the page”)); return null; } }; VideoBase.prototype._getEmbeddedPlayerType = function (element) { var embeddedPlayerType = element.getAttribute(‘data-player-type’); if (!embeddedPlayerType || embeddedPlayerType === ‘default’) { embeddedPlayerType = this._videoConfig.contextualSettings ? this._videoConfig.contextualSettings.defaultPlayerType : ‘static’; } if (this._stickyRelatedOnPage) { embeddedPlayerType = ‘static’; } return embeddedPlayerType; }; VideoBase.prototype._getUnusedMediaId = function (publisherPageElement) { var mediaId = publisherPageElement.getAttribute(‘data-video-id’); if (mediaId && this._contextualMediaIds.indexOf(mediaId) === -1) { this._contextualMediaIds.push(mediaId); return mediaId; } else { logger.info(this._component, ‘_getUnusedMediaId’, ‘No Unique MediaId’); return false; } }; VideoBase.prototype._createRelatedPlayer = function (mediaId, embeddedPlayerType, publisherPageElement) { if (embeddedPlayerType === ‘collapse’) { this._createCollapsePlayer(mediaId, publisherPageElement); } else if (embeddedPlayerType === ‘static’) { this._createStaticPlayer(mediaId, publisherPageElement); } }; VideoBase.prototype._createCollapsePlayer = function (mediaId, publisherPageElement) { var _a = this._checkPlayerSelectorOnPage(“stickyRelated” ), stickyRelatedPlayer = _a.player, stickyRelatedElement = _a.playerElement; var player = stickyRelatedPlayer ? stickyRelatedPlayer : this._potentialPlayerMap[“stationaryRelated” ][0]; if (player && player.playerId) { var shouldOverrideElement = this._shouldOverrideElement(publisherPageElement); if (shouldOverrideElement) { publisherPageElement = this._getOverrideElement(stickyRelatedPlayer, stickyRelatedElement, publisherPageElement); } publisherPageElement = document.querySelector(“#cls-video-container-” + mediaId + ” > div”) || publisherPageElement; this._createStickyRelatedPlayer(__assign(__assign({}, player), { mediaId: mediaId }), publisherPageElement); } else { logger.error(this._component, ‘_createCollapsePlayer’, ‘No video player found’); } }; VideoBase.prototype._createStaticPlayer = function (mediaId, publisherPageElement) { if (this._potentialPlayerMap[“stationaryRelated” ].length && this._potentialPlayerMap[“stationaryRelated” ][0].playerId) { var player = this._potentialPlayerMap[“stationaryRelated” ][0]; this._createStationaryRelatedPlayer(__assign(__assign({}, player), { mediaId: mediaId }), publisherPageElement); } else { logger.error(this._component, ‘_createStaticPlayer’, ‘No video player found’); } }; VideoBase.prototype._shouldRunAutoplayPlayers = function () { if (this._isVideoAllowedOnPage()) { if (this._potentialPlayerMap[“stickyRelated” ].length || this._potentialPlayerMap[“stickyPlaylist” ].length || this._potentialPlayerMap[“sekindo” ].length) { return true; } } return false; }; VideoBase.prototype._determineAutoplayPlayers = function () { var componentName = this._component; var isVideoManagerComponent = componentName === ‘VideoManagerComponent’; var config = this._config; if (this._stickyRelatedOnPage) { logger.event(componentName, ‘stickyRelatedOnPage’, (isVideoManagerComponent && { device: config && config.context.device, isDesktop: this._device, }) || {}); return; } var _a = this._checkPlayerSelectorOnPage(“stickyPlaylist” ), stickyPlaylistPlayer = _a.player, stickyPlaylistElement = _a.playerElement; var _b = this._checkPlayerSelectorOnPage(“sekindo” ), sekindoPlayer = _b.player, sekindoElement = _b.playerElement; if (stickyPlaylistPlayer && stickyPlaylistPlayer.playerId && stickyPlaylistPlayer.playlistId && stickyPlaylistElement) { this._createPlaylistPlayer(stickyPlaylistPlayer, stickyPlaylistElement); } else if (sekindoPlayer && sekindoPlayer.playlistId && sekindoElement) { this._createSekindoPlayer(sekindoPlayer, sekindoElement); } else { logger.event(componentName, ‘noStickyPlaylistOrSekindo’, (isVideoManagerComponent && { vendor: ‘none’, device: config && config.context.device, isDesktop: this._device, }) || {}); } }; VideoBase.prototype._initializeRelatedPlayers = function (publisherPageElements) { for (var t = 0; t Adding Stationary Related Player Container”); this._wrapJWPlayerWithCLS(element, player.mediaId); this._playersAddedFromPlugin.push(player.mediaId); } }; ClsVideoInsertion.prototype._createStickyRelatedPlayer = function (player, element) { this._device === ‘mobile’ ? [400, 225] : [640, 360]; VideoAdUnit.Video_Individual_Autoplay_SOff; this._stickyRelatedOnPage = true; this._videoConfig.mobileStickyPlayerOnPage = this._device === ‘mobile’; if (element && player.position && player.mediaId) { logger$1.info(‘ClsVideoInsertion’, ‘_createStickyRelatedPlayer’, “Video > Adding Sticky Related OnPage Player Container”); var playerContainer = document.createElement(‘div’); element.insertAdjacentElement(player.position, playerContainer); var title = document.createElement(‘h3′); title.style.margin = ’10px 0’; var titleHeight = this._getTitleHeight(title); this._wrapJWPlayerWithCLS(playerContainer, player.mediaId, this._WRAPPER_BAR_HEIGHT + titleHeight); this._playersAddedFromPlugin.push(player.mediaId); } }; ClsVideoInsertion.prototype._createSekindoPlayer = function (player, element) { var playlistId = player.playlistId; __assign(__assign({}, player), { classNames: [] }); var playerSize = this._device === ‘mobile’ ? { width: 340, height: 260 } : { width: 320, height: 250 }; logger$1.info(‘ClsVideoInsertion’, ‘_createSekindoPlayer’, “Video > Adding Sekindo Player Container”); var clsWrapper = this._createSekindoCLSWrapper(playerSize.height, playlistId); element.insertAdjacentElement(player.position, clsWrapper); this._playersAddedFromPlugin.push(playlistId); }; ClsVideoInsertion.prototype._createPlaylistPlayer = function (player, element) { var playlistId = player.playlistId; this._videoConfig.mobileStickyPlayerOnPage = true; var playerContainer = document.createElement(‘div’); element.insertAdjacentElement(player.position, playerContainer); logger$1.info(‘ClsVideoInsertion’, ‘_createPlaylistPlayer’, “Video > Adding Playlist Player Container”); this._wrapJWPlayerWithCLS(playerContainer, playlistId, this._WRAPPER_BAR_HEIGHT); this._playersAddedFromPlugin.push(“playlist-” + playlistId); }; ClsVideoInsertion.prototype._isVideoAllowedOnPage = function () { var disableAds = this._clsOptions.disableAds; if (disableAds && disableAds.video) { logger$1.info(‘ClsVideoInsertionMigrated’, ‘isVideoAllowedOnPage’, ‘Video > Non in post players are disabled on page’); var disableAdsReason = ”; if (disableAds.reasons.has(‘video_tag’)) { disableAdsReason = ‘video tag’; } else if (disableAds.reasons.has(‘video_plugin’)) { disableAdsReason = ‘video plugin’; } else if (disableAds.reasons.has(‘video_page’)) { disableAdsReason = ‘command queue’; } var loggedClassName = disableAdsReason ? ‘ClsVideoInsertionMigrated’ : ‘ClsVideoInsertion’; logger$1.error(loggedClassName, ‘isVideoAllowedOnPage’, new Error(“DBP: Disabled by publisher via ” + (disableAdsReason || ‘other’))); return false; } if (this._clsOptions.videoDisabledFromPlugin) { return false; } return true; }; return ClsVideoInsertion; }(VideoBase)); (function () { var clsOptions = new ClsOptions(); if (!clsOptions || !clsOptions.enabled) { return; } new ClsDynamicAdsInjector(clsOptions, new TargetDensityExperiment()).start(); new ClsVideoInsertion(new Video(clsOptions), clsOptions).init(); })(); })();

View Original Source Here






Unique Breakfast Recipe | Egg & Bread Sandwich
Zero Carbs Scrambled Eggs Breakfast Recipe
Friday Food Bites: Joya’s Cafe tests open hours, 92 Chicken
Pasta Recipe|Indian style pasta recipes|easy breakfast recipes|dinner recipes|Macaroni pasta recipe
Monday to friday simple & healthy school lunch + recipe
Breakfast to Lunch Routine|weightloss tea|Easy Chicken Masala recipe|Very Busy Routine
5 Tiffin Recipes | School LUNCH BOX Ideas
Trying tiktok famous food #shorts
Beth’s Mixed Grill Dinner Party!
How to host the perfect Italian dinner party
Let’s make traditional Korean kimchi! #shorts
5 Classic Thanksgiving Side Dishes For The Perfect Turkey Day
7 Day Healthy Meal Plan (July 25-31)
Easy Quinoa Salad
Giant Zucchini Parmesan
10 Lunch Box Recipes For Kids
Fish Grilling Tips & Cedar Planked Salmon Recipe
Rib Tips!
Crockpot BBQ Ribs | Slow Cooker Ribs
Blue Cross Blue Shield offers healthy grilling tips
4 Incredible Strawberry Dessert Recipes For Valentine’s Day
Top Indulgent Rainbow Chocolate Cake Recipes
12 Quick & Easy Dessert Recipes with Less than 5
10 Swaps for Healthier Desserts
The Coolers of San Marcos
DIY Boba / Bubble Tea! Healthy Recipes
ABV Cocktails
Easy Quick summer drinks to make at home
%d bloggers like this: