@newrelic/video-core 4.1.5 → 4.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +487 -89
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.LICENSE.txt +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.LICENSE.txt +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/umd/nrvideo.min.js +1 -1
- package/dist/umd/nrvideo.min.js.LICENSE.txt +1 -1
- package/package.json +9 -2
package/dist/umd/nrvideo.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see nrvideo.min.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.nrvideo=t():e.nrvideo=t()}(self,()=>(()=>{"use strict";var e={487(e,t,r){r.r(t),r.d(t,{videoAnalyticsHarvester:()=>v});var n=r(374),i=r(431),a=r(51),o=r(144),s=r(302);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function f(e,t,r){return(t=d(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,d(n.key),n)}}function d(e){var t=function(e){if("object"!=u(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==u(t)?t:t+""}var y=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.isInitialized=!1,this.harvestScheduler=null,this.eventBuffer=null},t=[{key:"initialize",value:function(){if(this.isInitialized)o.A.warn("Video analytics agent already initialized");else try{this.eventBuffer=new i.t,this.harvestScheduler=new n.n(this.eventBuffer),this.harvestScheduler.startScheduler(),this.isInitialized=!0,o.A.notice("Video analytics agent initialized successfully")}catch(e){o.A.error("Failed to initialize video analytics agent:",e.message)}}},{key:"addEvent",value:function(e){this.isInitialized||(o.A.warn("Video analytics agent not initialized, initializing now"),this.initialize());try{return e.actionName&&e.actionName===s.A.Events.QOE_AGGREGATE?e.viewId?this.eventBuffer.addOrReplaceByActionNameAndViewId(s.A.Events.QOE_AGGREGATE,e.viewId,e):this.eventBuffer.addOrReplaceByActionName(s.A.Events.QOE_AGGREGATE,e):this.eventBuffer.add(e)}catch(e){return o.A.error("Failed to add event to harvesting system:",e.message),!1}}},{key:"setHarvestInterval",value:function(e){this.isInitialized||this.initialize(),this.harvestScheduler.updateHarvestInterval(e)}},{key:"forceNextQoeCycle",value:function(){this.harvestScheduler&&(this.harvestScheduler.forceNextQoeCycle=!0)}},{key:"setBeforeDrainCallback",value:function(e){this.harvestScheduler&&(this.harvestScheduler.beforeDrainCallback=e)}},{key:"refreshQoeKpis",value:function(e,t){if(this.eventBuffer&&e){var r=t?this.eventBuffer.findByActionNameAndViewId(s.A.Events.QOE_AGGREGATE,t):this.eventBuffer.findByActionName(s.A.Events.QOE_AGGREGATE);if(r){var n,i=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach(function(t){f(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},r),o=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return c(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}(a.A.QOE_KPI_KEYS);try{for(o.s();!(n=o.n()).done;){var u=n.value;u in e&&(i[u]=e[u])}}catch(e){o.e(e)}finally{o.f()}t?this.eventBuffer.addOrReplaceByActionNameAndViewId(s.A.Events.QOE_AGGREGATE,t,i):this.eventBuffer.addOrReplaceByActionName(s.A.Events.QOE_AGGREGATE,i)}}}}],t&&h(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),v=new y},455(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(e){var t=function(e){if("object"!=n(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}r.d(t,{A:()=>s});var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.reset()}return t=e,r=[{key:"reset",value:function(){this.startTime=0,this.stopTime=0,this.accumulator=0,this.offset=0}},{key:"getDeltaTime",value:function(){return this.startTime?this.offset+((new Date).getTime()-this.startTime):null}},{key:"start",value:function(){this.startTime=(new Date).getTime(),this.stopTime=0}},{key:"stop",value:function(){return this.stopTime=(new Date).getTime(),this.startTime<this.stopTime&&(this.accumulator+=this.stopTime-this.startTime),this.getDeltaTime()}},{key:"getDuration",value:function(){return this.stopTime?this.accumulator+this.offset:this.accumulator+(null!==(e=this.getDeltaTime())&&void 0!==e?e:0);var e}},{key:"clone",value:function(){var t=new e;return t.startTime=this.startTime,t.stopTime=this.stopTime,t.offset=this.offset,t.accumulator=this.accumulator,t}}],r&&i(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r}();const s=o},51(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}function a(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(e){var t=function(e){if("object"!=n(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}r.d(t,{A:()=>u});var s=a(function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)});s.AdPositions={PRE:"pre",MID:"mid",POST:"post"},s.COLLECTOR={US:["bam.nr-data.net","bam-cell.nr-data.net"],EU:"bam.eu01.nr-data.net",Staging:"staging-bam-cell.nr-data.net",GOV:"gov-bam.nr-data.net"},s.VALID_EVENT_TYPES=["VideoAction","VideoAdAction","VideoErrorAction","VideoCustomAction"],s.MAX_PAYLOAD_SIZE=1048576,s.MAX_BEACON_SIZE=61440,s.MAX_EVENTS_PER_BATCH=1e3,s.INTERVAL=1e4,s.QOE_KPI_KEYS=["startupTime","peakBitrate","averageBitrate","totalPlaytime","totalRebufferingTime","rebufferingRatio","hadStartupError","hadPlaybackError","numberOfErrors"],s.QOE_AGGREGATE_KEYS=["coreVersion","instrumentation.name","instrumentation.provider","instrumentation.version","isBackgroundEvent","playerName","playerVersion","src","viewId","viewSession","contentIsAutoplayed","contentIsMuted","contentRenditionHeight","contentRenditionWidth","contentSrc","numberOfVideos","pageUrl","trackerName","trackerVersion","contentDuration","contentPlayrate","contentPlayhead","contentPreload","elapsedTime","contentTitle","contentId","contentIsLive","deviceType","deviceGroup","deviceManufacturer","deviceModel","deviceName","deviceSize","deviceUuid","contentRenditionName","contentIsFullscreen","contentCdn","contentFps","asnOrganization","asnLongitude","asnLatitude","asn","timeSinceRequested","timeSinceStarted"];const u=s},568(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(e){var t=function(e){if("object"!=n(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}r.d(t,{A:()=>o});const o=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},(t=[{key:"on",value:function(e,t){if(this._listeners=this._listeners||{},"function"==typeof t)return this._listeners[e]=this._listeners[e]||[],this._listeners[e].push(t),this}},{key:"off",value:function(e,t){if(this._listeners=this._listeners||{},this._listeners[e]){var r=this._listeners[e].indexOf(t);-1!==r&&this._listeners[e].splice(r,1)}return this}},{key:"emit",value:function(e,t,r){var n=this;return this._listeners=this._listeners||{},r=r||{},Array.isArray(this._listeners[t])&&this._listeners[t].forEach(function(i){i.call(n,{eventType:e,type:t,data:r,target:n})}),Array.isArray(this._listeners["*"])&&this._listeners["*"].forEach(function(i){i.call(n,{eventType:e,type:t,data:r,target:n})}),this}}])&&i(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}()},431(e,t,r){r.d(t,{t:()=>f});var n=r(144),i=r(51),a=r(347);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,u(n.key),n)}}function u(e){var t=function(e){if("object"!=o(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==o(t)?t:t+""}var c=i.A.MAX_PAYLOAD_SIZE,l=i.A.MAX_EVENTS_PER_BATCH,f=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.buffer=[],this.maxPayloadSize=c,this.maxEventsPerBatch=l,this.currentPayloadSize=0,this.totalEvents=0,this.smartHarvestPayloadThreshold=Math.floor(.6*this.maxPayloadSize),this.overflowPayloadThreshold=Math.floor(.9*this.maxPayloadSize),this.smartHarvestEventThreshold=Math.floor(.6*this.maxEventsPerBatch),this.overflowEventThreshold=Math.floor(.9*this.maxEventsPerBatch),this.onSmartHarvestTrigger=null},t=[{key:"addOrReplaceByActionName",value:function(e,t){var r=this.buffer.findIndex(function(t){return t.actionName===e});try{return-1===r?this.add(t):this.add(t,r),!0}catch(e){return n.A.error("Failed to set or replace the event to buffer:",e.message),!1}}},{key:"addOrReplaceByActionNameAndViewId",value:function(e,t,r){var i=this.buffer.findIndex(function(r){return r.actionName===e&&r.viewId===t});try{return-1===i?this.add(r):this.add(r,i),!0}catch(e){return n.A.error("Failed to set or replace the event to buffer:",e.message),!1}}},{key:"findByActionNameAndViewId",value:function(e,t){return this.buffer.find(function(r){return r.actionName===e&&r.viewId===t})||null}},{key:"findByActionName",value:function(e){return this.buffer.find(function(t){return t.actionName===e})||null}},{key:"add",value:function(e,t){try{var r=(0,a.Q3)(e),i=this.currentPayloadSize+r>=this.maxPayloadSize,o=this.totalEvents+1>=this.maxEventsPerBatch;if((i||o)&&this.makeRoom(r),null!=t&&t>-1){var s=(0,a.Q3)(this.buffer[t]);this.buffer[t]=e,this.currentPayloadSize+=r-s}else this.buffer.push(e),this.totalEvents++,this.currentPayloadSize+=r;return this.checkSmartHarvestTrigger(),!0}catch(e){return n.A.error("Failed to add event to buffer:",e.message),!1}}},{key:"checkSmartHarvestTrigger",value:function(){var e=this.currentPayloadSize/this.maxPayloadSize,t=this.totalEvents/this.maxEventsPerBatch,r=this.currentPayloadSize>=this.overflowPayloadThreshold,i=this.totalEvents>=this.overflowEventThreshold;if(r||i){var a=r?"payload ".concat(this.currentPayloadSize,"/").concat(this.maxPayloadSize," bytes (").concat(Math.round(100*e),"%)"):"events ".concat(this.totalEvents,"/").concat(this.maxEventsPerBatch," (").concat(Math.round(100*t),"%)");n.A.warn("OVERFLOW PREVENTION: ".concat(a," - Emergency harvest triggered")),this.onSmartHarvestTrigger&&"function"==typeof this.onSmartHarvestTrigger&&this.onSmartHarvestTrigger("overflow",90)}else{var o=this.currentPayloadSize>=this.smartHarvestPayloadThreshold,s=this.totalEvents>=this.smartHarvestEventThreshold;(o||s)&&this.onSmartHarvestTrigger&&"function"==typeof this.onSmartHarvestTrigger&&this.onSmartHarvestTrigger("smart",60)}}},{key:"setSmartHarvestCallback",value:function(e){this.onSmartHarvestTrigger=e}},{key:"drain",value:function(){try{var e=this.buffer.splice(0);return this.totalEvents=0,this.currentPayloadSize=0,e}catch(e){return n.A.error("Failed to drain events from buffer:",e.message),[]}}},{key:"isEmpty",value:function(){return 0===this.totalEvents}},{key:"size",value:function(){return this.totalEvents}},{key:"clear",value:function(){this.buffer=[],this.totalEvents=0}},{key:"makeRoom",value:function(e){if(e>this.maxPayloadSize)n.A.error("Event dropped: Event size exceeds maximum payload size.");else for(;(this.totalEvents>=this.maxEventsPerBatch||this.currentPayloadSize+e>=this.maxPayloadSize)&&this.buffer.length>0;){var t=this.buffer.shift(),r=(0,a.Q3)(t);this.totalEvents--,this.currentPayloadSize-=r,n.A.warn("Event buffer full, oldest event removed.")}}}],t&&s(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}()},374(e,t,r){r.d(t,{n:()=>k});var n=r(431),i=r(413),a=r(481),o=r(347),s=r(51),u=r(302),c=r(144);function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function h(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach(function(t){d(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function d(e,t,r){return(t=T(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||p(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=p(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function p(e,t){if(e){if("string"==typeof e)return m(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?m(e,t):void 0}}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function b(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function a(r,n,i,a){var u=n&&n.prototype instanceof s?n:s,c=Object.create(u.prototype);return g(c,"_invoke",function(r,n,i){var a,s,u,c=0,l=i||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return a=t,s=0,u=e,h.n=r,o}};function d(r,n){for(s=r,u=n,t=0;!f&&c&&!i&&t<l.length;t++){var i,a=l[t],d=h.p,y=a[2];r>3?(i=y===n)&&(u=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=d&&((i=r<2&&d<a[1])?(s=0,h.v=n,h.n=a[1]):d<y&&(i=r<3||a[0]>n||n>y)&&(a[4]=r,a[5]=n,h.n=y,s=0))}if(i||r>1)return o;throw f=!0,n}return function(i,l,y){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,y),s=l,u=y;(t=s<2?e:u)||!f;){a||(s?s<3?(s>1&&(h.n=-1),d(s,u)):h.n=u:h.v=u);try{if(c=2,a){if(s||(i="next"),t=a[i]){if(!(t=t.call(a,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(u=TypeError("The iterator does not provide a '"+i+"' method"),s=1);a=e}else if((t=(f=h.n<0)?u:r.call(n,h))!==o)break}catch(t){a=e,s=1,u=t}finally{c=1}}return{value:t,done:f}}}(r,i,a),!0),c}var o={};function s(){}function u(){}function c(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(g(t={},n,function(){return this}),t),f=c.prototype=s.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,g(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,g(f,"constructor",c),g(c,"constructor",u),u.displayName="GeneratorFunction",g(c,i,"GeneratorFunction"),g(f),g(f,i,"Generator"),g(f,n,function(){return this}),g(f,"toString",function(){return"[object Generator]"}),(b=function(){return{w:a,m:h}})()}function g(e,t,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}g=function(e,t,r,n){function a(t,r){g(e,t,function(e){return this._invoke(t,r,e)})}t?i?i(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},g(e,t,r,n)}function A(e,t,r,n,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function S(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var a=e.apply(t,r);function o(e){A(a,n,i,o,s,"next",e)}function s(e){A(a,n,i,o,s,"throw",e)}o(void 0)})}}function E(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,T(n.key),n)}}function T(e){var t=function(e){if("object"!=l(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=l(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==l(t)?t:t+""}var k=function(){return e=function e(t){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.eventBuffer=t,this.retryQueueHandler=new i.u,this.httpClient=new a.X,this.fallBackUrl="",this.retryCount=0,this.eventBuffer instanceof n.t&&this.eventBuffer.setSmartHarvestCallback(function(e,t){return r.triggerSmartHarvest(e,t)}),this.isStarted=!1,this.currentTimerId=null,this.harvestCycle=s.A.INTERVAL,this.isHarvesting=!1,this.qoeCycleCount=1,this.forceNextQoeCycle=!1,this.beforeDrainCallback=null,this._lastSentQoeKpis={},this.setupPageLifecycleHandlers()},t=[{key:"startScheduler",value:function(){this.isStarted?c.A.warn("Harvest scheduler is already started"):(this.isStarted=!0,c.A.notice("Starting harvest scheduler",{harvestCycle:this.harvestCycle,eventBufferSize:this.eventBuffer?this.eventBuffer.size():0}),this.scheduleNextHarvest())}},{key:"stopScheduler",value:function(){this.isStarted&&(this.isStarted=!1,this.currentTimerId&&(clearTimeout(this.currentTimerId),this.currentTimerId=null),c.A.notice("Harvest scheduler stopped"))}},{key:"triggerSmartHarvest",value:(d=S(b().m(function e(t,r){var n;return b().w(function(e){for(;;)switch(e.p=e.n){case 0:if(c.A.notice("".concat(t," harvest triggered at ").concat(r,"% threshold"),{type:t,threshold:r}),this.eventBuffer&&!this.eventBuffer.isEmpty()){e.n=1;break}return e.a(2);case 1:return this.currentTimerId&&(clearTimeout(this.currentTimerId),this.currentTimerId=null),e.p=2,e.n=3,this.triggerHarvest({});case 3:e.n=5;break;case 4:e.p=4,n=e.v,c.A.error("".concat(t," harvest failed:"),n.message);case 5:return e.p=5,this.isStarted&&this.scheduleNextHarvest(),e.f(5);case 6:return e.a(2)}},e,this,[[2,4,5,6]])})),function(e,t){return d.apply(this,arguments)})},{key:"scheduleNextHarvest",value:function(){var e=this;if(this.isStarted){var t=this.harvestCycle;this.currentTimerId=setTimeout(function(){return e.onHarvestInterval()},t)}}},{key:"onHarvestInterval",value:(f=S(b().m(function e(){var t,r,n;return b().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,t=this.eventBuffer&&!this.eventBuffer.isEmpty(),r=this.retryQueueHandler&&this.retryQueueHandler.getQueueSize()>0,t||r){e.n=1;break}return e.a(2);case 1:return e.n=2,this.triggerHarvest({});case 2:e.n=4;break;case 3:e.p=3,n=e.v,c.A.error("Error during scheduled harvest:",n.message);case 4:return e.p=4,this.scheduleNextHarvest(),e.f(4);case 5:return e.a(2)}},e,this,[[0,3,4,5]])})),function(){return f.apply(this,arguments)})},{key:"triggerHarvest",value:(l=S(b().m(function e(){var t,r,n,i,a,u=arguments;return b().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t=u.length>0&&void 0!==u[0]?u[0]:{},!this.isHarvesting){e.n=1;break}return e.a(2,{success:!1,reason:"harvest_in_progress"});case 1:return this.isHarvesting=!0,e.p=2,r=this.drainEvents(t),t.isFinalHarvest&&(n=s.A.MAX_BEACON_SIZE,(0,o.Q3)(r)>n&&(r=this.trimEventsToFit(r,n))),e.n=3,this.sendChunk(r,t,!0);case 3:return i=e.v,e.a(2,{success:i.success,totalChunks:1,results:[i]});case 4:return e.p=4,a=e.v,c.A.error("Harvest cycle failed:",a.message),this.handleHarvestFailure(a),e.a(2,{success:!1,error:a.message,consecutiveFailures:this.consecutiveFailures});case 5:return e.p=5,this.isHarvesting=!1,e.f(5);case 6:return e.a(2)}},e,this,[[2,4,5,6]])})),function(){return l.apply(this,arguments)})},{key:"trimEventsToFit",value:function(e,t){if(0===e.length)return e;for(var r=[],n=0,i=e.length-1;i>=0;i--){var a=e[i],s=(0,o.Q3)({ins:[a].concat(r)});s>t||(r.unshift(a),n=s)}var u=e.length-r.length;if(u>0){var l=e.slice(0,u);c.A.warn("Discarded ".concat(u," events to fit beacon size limit"),{originalCount:e.length,trimmedCount:r.length,finalSize:n,maxSize:t}),this.retryQueueHandler&&this.retryQueueHandler.addFailedEvents(l)}return r}},{key:"drainEvents",value:function(){var e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=null!==(e=null===(t=window.NRVIDEO)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.qoeIntervalFactor)&&void 0!==e?e:1,i=!!r.isFinalHarvest||this.forceNextQoeCycle,a=(this.qoeCycleCount-1)%n==0||i;if(this.forceNextQoeCycle&&(this.forceNextQoeCycle=!1),this.beforeDrainCallback&&"function"==typeof this.beforeDrainCallback)try{this.beforeDrainCallback()}catch(p){c.A.error("Before drain callback failed:",p.message)}var l,f=this.eventBuffer.drain();if(a)l=f;else{l=[];var h,d=v(f);try{for(d.s();!(h=d.n()).done;){var p=h.value;p.actionName===u.A.Events.QOE_AGGREGATE?this.eventBuffer.add(p):l.push(p)}}catch(e){d.e(e)}finally{d.f()}}this.qoeCycleCount++;for(var m=l.length-1;m>=0;m--){var b=l[m];b.actionName===u.A.Events.QOE_AGGREGATE&&(!i&&this._qoeKpisUnchanged(b)?l.splice(m,1):this._saveQoeKpis(b))}var g=y(l),A=(0,o.Q3)(l);if(this.retryQueueHandler&&this.retryQueueHandler.getQueueSize()>0){var S=s.A.MAX_PAYLOAD_SIZE-A,E=s.A.MAX_EVENTS_PER_BATCH-g.length;if(S>0&&E>0){var T=this.retryQueueHandler.getRetryEventsToFit(S,E);T.length>0&&(g=[].concat(y(T),y(g)))}}return g}},{key:"sendChunk",value:(r=S(b().m(function e(t,r,n){var i,a,s=this;return b().w(function(e){for(;;)if(0===e.n)return i=(0,o.c$)(this.fallBackUrl),a={url:i,payload:{body:{ins:t}},options:h(h({},r),{},{isLastChunk:n})},e.a(2,new Promise(function(e){s.httpClient.send(a,function(r){r.retry?s.handleRequestFailure(t):(s.retryCount=0,s.fallBackUrl=""),e({success:!r.retry,status:r.status,error:r.error,chunk:t,eventCount:t.length})})}))},e,this)})),function(e,t,n){return r.apply(this,arguments)})},{key:"handleRequestFailure",value:function(e){var t;this.retryQueueHandler.addFailedEvents(e),"US"===(null===(t=window.NRVIDEO)||void 0===t||null===(t=t.info)||void 0===t?void 0:t.region)&&(this.retryCount++,this.retryCount>5?(this.retryCount=0,this.fallBackUrl=""):this.retryCount>=2&&(this.fallBackUrl=s.A.COLLECTOR.US[1]))}},{key:"handleHarvestFailure",value:function(e){this.consecutiveFailures++,c.A.warn("Harvest failure handled",{error:e.message,consecutiveFailures:this.consecutiveFailures})}},{key:"updateHarvestInterval",value:function(e){"number"!=typeof e&&isNaN(e)?c.A.warn("Invalid newInterval provided to updateHarvestInterval"):e<1e3||e>3e5?c.A.warn("newInterval out of bounds (1000-300000), ignoring"):this.harvestCycle!==e&&(this.harvestCycle=e,c.A.notice("Updated harvestCycle:",this.harvestCycle),this.currentTimerId&&(clearTimeout(this.currentTimerId),this.currentTimerId=null),this.isStarted&&this.scheduleNextHarvest())}},{key:"setupPageLifecycleHandlers",value:function(){var e=this,t=!1,r=function(){t||(t=!0,e.triggerHarvest({isFinalHarvest:!0,force:!0}))};document.addEventListener("visibilitychange",function(){document.hidden&&r()}),window.addEventListener("pagehide",function(){r()}),window.addEventListener("beforeunload",function(){r()})}},{key:"_qoeKpisUnchanged",value:function(e){var t=this._lastSentQoeKpis[e.viewId];if(!t)return!1;var r,n=v(s.A.QOE_KPI_KEYS);try{for(n.s();!(r=n.n()).done;){var i=r.value;if(e[i]!==t[i])return!1}}catch(e){n.e(e)}finally{n.f()}return!0}},{key:"_saveQoeKpis",value:function(e){var t,r={},n=v(s.A.QOE_KPI_KEYS);try{for(n.s();!(t=n.n()).done;){var i=t.value;r[i]=e[i]}}catch(e){n.e(e)}finally{n.f()}this._lastSentQoeKpis[e.viewId]=r}}],t&&E(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r,l,f,d}()},144(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(e){var t=function(e){if("object"!=n(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}r.d(t,{A:()=>l});var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,r=[{key:"error",value:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];s(r,e.Levels.ERROR,"darkred")}},{key:"warn",value:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];s(r,e.Levels.WARNING,"darkorange")}},{key:"notice",value:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];s([].slice.call(arguments),e.Levels.NOTICE,"darkcyan")}},{key:"debug",value:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];s(r,e.Levels.DEBUG,"indigo")}},{key:"debugCommonVideoEvents",value:function(t,r,n){try{if(e.level<=e.Levels.DEBUG){n=n||function(t){e.debug("Event: "+t.type)};var i=["canplay","buffering","waiting","ended","play","playing","pause","resume","error","abort","seek","seeking","seeked","stalled","dispose","loadeddata","loadstart","loadedmetadata"];r&&(null===r[0]?(r.shift(),i=r):i=i.concat(r));for(var a=0;a<i.length;a++)"function"==typeof t?t.call(window,i[a],n):t.on?t.on(i[a],n):t.addEventListener?t.addEventListener(i[a],n):t.addEventHandler?t.addEventHandler(i[a],n):e.warn("debugCommonVideoEvents: No common listener function found for ",t)}}catch(t){e.warn(t)}}}],null&&i(t.prototype,null),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r}();function s(e,t,r){t=t||o.Levels.NOTICE,r=r||"darkcyan";var n,i,a=o.prefix;o.includeTime&&(a+="["+("0"+(n=new Date).getDate()).slice(-2)+":"+("0"+n.getMinutes()).slice(-2)+":"+("0"+n.getSeconds()).slice(-2)+"."+("00"+n.getMilliseconds()).slice(-3)+"] "),a+=function(e){return c[e]}(t)+":",o.level<=t&&t!==o.Levels.SILENT&&(!o.colorful||"undefined"!=typeof document&&document.documentMode?u(e,a):(i=t===o.Levels.ERROR&&console.error?console.error:t===o.Levels.WARNING&&console.warn?console.warn:t===o.Levels.DEBUG&&console.debug&&null==window.cast?console.debug:console.log,a="%c"+a,e.splice(0,0,a,"color: "+r),i.apply(console,e)))}function u(e,t){if(e instanceof Array)for(var r in e)u(e[r],t);else"string"==typeof e?console.log(t+" "+e):(console.log(t+"↵"),console.log(e))}o.Levels={SILENT:5,ERROR:4,WARNING:3,NOTICE:2,DEBUG:1,ALL:0},o.level=o.Levels.ERROR,o.colorful=!0,o.includeTime=!0,o.prefix="[nrvideo]";var c={4:"e",3:"w",2:"n",1:"d"};!function(){if("undefined"!=typeof window&&window.location&&window.location.search){var e=/\?.*&*nrvideo-debug=(.+)/i.exec(window.location.search);null!==e&&("true"===e[1]?o.level=o.Levels.ALL:o.level=e[1]),null!==/\?.*&*nrvideo-colors=false/i.exec(window.location.search)&&(o.colorful=!1)}}();const l=o},481(e,t,r){r.d(t,{X:()=>p});var n=r(347),i=r(144);function a(e,t){return t&&0!==t.length?t.reduce(function(e,t){var r;try{if(t.regex instanceof RegExp){var n=t.regex.flags.includes("g")?t.regex.flags:t.regex.flags+"g";r=new RegExp(t.regex.source,n)}else r=new RegExp(t.regex,"g")}catch(r){return i.A.warn("applyObfuscationRules: invalid regex, skipping rule:",t.regex,r.message),e}return e.replace(r,t.replacement)},e):e}function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach(function(t){c(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function c(e,t,r){return(t=v(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function a(r,n,i,a){var u=n&&n.prototype instanceof s?n:s,c=Object.create(u.prototype);return f(c,"_invoke",function(r,n,i){var a,s,u,c=0,l=i||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return a=t,s=0,u=e,h.n=r,o}};function d(r,n){for(s=r,u=n,t=0;!f&&c&&!i&&t<l.length;t++){var i,a=l[t],d=h.p,y=a[2];r>3?(i=y===n)&&(u=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=d&&((i=r<2&&d<a[1])?(s=0,h.v=n,h.n=a[1]):d<y&&(i=r<3||a[0]>n||n>y)&&(a[4]=r,a[5]=n,h.n=y,s=0))}if(i||r>1)return o;throw f=!0,n}return function(i,l,y){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,y),s=l,u=y;(t=s<2?e:u)||!f;){a||(s?s<3?(s>1&&(h.n=-1),d(s,u)):h.n=u:h.v=u);try{if(c=2,a){if(s||(i="next"),t=a[i]){if(!(t=t.call(a,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(u=TypeError("The iterator does not provide a '"+i+"' method"),s=1);a=e}else if((t=(f=h.n<0)?u:r.call(n,h))!==o)break}catch(t){a=e,s=1,u=t}finally{c=1}}return{value:t,done:f}}}(r,i,a),!0),c}var o={};function s(){}function u(){}function c(){}t=Object.getPrototypeOf;var h=[][n]?t(t([][n]())):(f(t={},n,function(){return this}),t),d=c.prototype=s.prototype=Object.create(h);function y(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,f(e,i,"GeneratorFunction")),e.prototype=Object.create(d),e}return u.prototype=c,f(d,"constructor",c),f(c,"constructor",u),u.displayName="GeneratorFunction",f(c,i,"GeneratorFunction"),f(d),f(d,i,"Generator"),f(d,n,function(){return this}),f(d,"toString",function(){return"[object Generator]"}),(l=function(){return{w:a,m:y}})()}function f(e,t,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}f=function(e,t,r,n){function a(t,r){f(e,t,function(e){return this._invoke(t,r,e)})}t?i?i(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},f(e,t,r,n)}function h(e,t,r,n,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function d(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var a=e.apply(t,r);function o(e){h(a,n,i,o,s,"next",e)}function s(e){h(a,n,i,o,s,"throw",e)}o(void 0)})}}function y(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,v(n.key),n)}}function v(e){var t=function(e){if("object"!=o(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==o(t)?t:t+""}var p=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},t=[{key:"send",value:(c=d(l().m(function e(t,r){var n,a,o,s,u,c;return l().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n=t.url,a=t.payload,o=t.options,s=void 0===o?{}:o,e.p=1,n&&a){e.n=2;break}throw new Error("URL and payload are required");case 2:return u={url:n,payload:a,options:s,callback:r},e.n=3,this.executeRequest(u);case 3:e.n=5;break;case 4:e.p=4,c=e.v,i.A.error("Failed to send request:",c.message),r({retry:!1,status:0,error:c.message});case 5:return e.a(2)}},e,this,[[1,4]])})),function(e,t){return c.apply(this,arguments)})},{key:"executeRequest",value:(s=d(l().m(function e(t){var r,n,i,o,s,u,c,f,h,d,y,v;return l().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=t.url,n=t.payload,i=t.options,t.callback,o=Date.now(),e.p=1,u=a(JSON.stringify(n.body),null===(s=window.NRVIDEO)||void 0===s||null===(s=s.config)||void 0===s?void 0:s.obfuscate),!i.isFinalHarvest||!navigator.sendBeacon){e.n=3;break}return e.n=2,this.sendWithBeacon(r,u);case 2:return c=e.v,f={success:c,status:c?204:0},this.handleRequestComplete(t,f,o),e.a(2);case 3:return e.n=4,this.fetchWithTimeout(r,{method:"POST",body:u,headers:{"Content-Type":"application/json"},keepalive:i.isFinalHarvest},1e4);case 4:h=e.v,d={success:h.ok,status:h.status,statusText:h.statusText},this.handleRequestComplete(t,d,o),e.n=6;break;case 5:e.p=5,v=e.v,y={success:!1,status:0,error:v.message},this.handleRequestComplete(t,y,o);case 6:return e.a(2)}},e,this,[[1,5]])})),function(e){return s.apply(this,arguments)})},{key:"handleRequestComplete",value:function(e,t){(0,e.callback)({retry:!t.success&&(0===t.status||(0,n.Sc)(t.status)),status:t.status,error:t.error})}},{key:"sendWithBeacon",value:(o=d(l().m(function e(t,r){var n;return l().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.a(2,navigator.sendBeacon(t,r));case 1:return e.p=1,n=e.v,i.A.warn("sendBeacon failed, falling back to fetch:",n.message),e.a(2,!1)}},e,null,[[0,1]])})),function(e,t){return o.apply(this,arguments)})},{key:"fetchWithTimeout",value:(r=d(l().m(function e(t,r,n){var i,a,o,s;return l().w(function(e){for(;;)switch(e.p=e.n){case 0:return i=new AbortController,a=setTimeout(function(){return i.abort()},n),e.p=1,e.n=2,fetch(t,u(u({},r),{},{signal:i.signal}));case 2:return o=e.v,clearTimeout(a),e.a(2,o);case 3:if(e.p=3,s=e.v,clearTimeout(a),"AbortError"!==s.name){e.n=4;break}throw new Error("Request timeout after ".concat(n,"ms"));case 4:throw s;case 5:return e.a(2)}},e,null,[[1,3]])})),function(e,t,n){return r.apply(this,arguments)})}],t&&y(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r,o,s,c}()},413(e,t,r){r.d(t,{u:()=>v});var n=r(144),i=r(347),a=r(51);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach(function(t){c(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function c(e,t,r){return(t=h(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,h(n.key),n)}}function h(e){var t=function(e){if("object"!=o(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==o(t)?t:t+""}var d=a.A.MAX_PAYLOAD_SIZE,y=a.A.MAX_EVENTS_PER_BATCH,v=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.retryQueue=[],this.maxQueueSize=y,this.maxQueueSizeBytes=d},(t=[{key:"addFailedEvents",value:function(e){try{var t=Array.isArray(e)?e:[e];n.A.notice("Adding ".concat(t.length," failed events to retry queue"),{queueSizeBefore:this.retryQueue.length});var r,a=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return l(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}(t);try{for(a.s();!(r=a.n()).done;){var o=r.value;this.retryQueue.length>=this.maxQueueSize&&this.evictOldestEvent();for(var s=(0,i.Q3)(o);(0,i.Q3)(this.retryQueue)+s>this.maxQueueSizeBytes;)this.evictOldestEvent();this.retryQueue.push(u({},o))}}catch(e){a.e(e)}finally{a.f()}}catch(e){n.A.error("Failed to add events to retry queue:",e.message)}}},{key:"discardEvent",value:function(e,t){n.A.warn("Discarded event",{reason:t,eventType:e.eventType})}},{key:"evictOldestEvent",value:function(){if(this.retryQueue.length>0){var e=this.retryQueue.shift();this.discardEvent(e,"Queue full - evicted oldest")}}},{key:"getRetryEventsToFit",value:function(e,t){for(var r=[],n=0,a=0,o=this.retryQueue.length-1;o>=0;o--){var s=this.retryQueue[o];if(a>=t)break;var u=(0,i.Q3)(s);if(n+u>e)break;r.unshift(s),n+=u,a++,this.retryQueue.splice(o,1)}return r}},{key:"getQueueSize",value:function(){return this.retryQueue.length}},{key:"clear",value:function(){this.retryQueue=[]}}])&&f(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}()},302(e,t,r){r.d(t,{A:()=>m});var n=r(330),i=r(568),a=r(455),o=r(51),s=r(487),u=r(144);function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,f(n.key),n)}}function f(e){var t=function(e){if("object"!=c(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:t+""}function h(e,t,r){return t=y(t),function(e,t){if(t&&("object"==c(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,d()?Reflect.construct(t,r||[],y(e).constructor):t.apply(e,r))}function d(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(d=function(){return!!e})()}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}var p=function(e){function t(e){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=h(this,t)).customData={},r.heartbeat=null,r.parentTracker=null,r._trackerReadyChrono=new a.A,r._trackerReadyChrono.start(),r._actionTable=o.A.ACTION_TABLE,r._actionAdTable=o.A.ACTION_AD_TABLE,e=e||{},r.setOptions(e),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}(t,e),r=t,(i=[{key:"setOptions",value:function(e){e&&(e.parentTracker&&(this.parentTracker=e.parentTracker),e.customData&&(this.customData=e.customData),e.heartbeat&&(this.heartbeat=e.heartbeat))}},{key:"dispose",value:function(){this.unregisterListeners()}},{key:"registerListeners",value:function(){}},{key:"unregisterListeners",value:function(){}},{key:"getHeartbeat",value:function(){return this.state._isAd?2e3:this.heartbeat?this.heartbeat:this.parentTracker&&this.parentTracker.heartbeat?this.parentTracker.heartbeat:3e4}},{key:"startHeartbeat",value:function(){this._heartbeatInterval=setInterval(this.sendHeartbeat.bind(this),Math.max(this.getHeartbeat(),2e3))}},{key:"stopHeartbeat",value:function(){this._heartbeatInterval&&clearInterval(this._heartbeatInterval)}},{key:"sendHeartbeat",value:function(e){this.sendVideoAction(t.Events.HEARTBEAT,e)}},{key:"getAttributes",value:function(e,t){for(var r in(e=e||{}).trackerName=this.getTrackerName(),e.trackerVersion=this.getTrackerVersion(),e.coreVersion=n.rE,e.timeSinceTrackerReady=this._trackerReadyChrono.getDeltaTime(),this.customData)e[r]=this.customData[r];return null!=document.hidden&&(e.isBackgroundEvent=document.hidden),e}},{key:"getTrackerVersion",value:function(){return n.rE}},{key:"getTrackerName",value:function(){return"base-tracker"}},{key:"sendVideoAction",value:function(e,t){this.emit("VideoAction",e,this.getAttributes(t))}},{key:"sendVideoAdAction",value:function(e,t){this.emit("VideoAdAction",e,this.getAttributes(t))}},{key:"sendVideoErrorAction",value:function(e,t){var r=this.isAd()?"adError":"videoError";this.emit("VideoErrorAction",e,this.getAttributes(t,r))}},{key:"sendVideoCustomAction",value:function(e,t){this.emit("VideoCustomAction",e,this.getAttributes(t,"customAction"))}},{key:"setHarvestInterval",value:function(e){if(s.videoAnalyticsHarvester)try{s.videoAnalyticsHarvester.setHarvestInterval(e)}catch(e){return void u.A.error("Failed to set harvest interval:",e.message)}else u.A.error("VideoAnalyticsHarvester is not available")}}])&&l(r.prototype,i),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,i}(i.A);p.Events={HEARTBEAT:"HEARTBEAT",QOE_AGGREGATE:"QOE_AGGREGATE"};const m=p},347(e,t,r){r.d(t,{Q3:()=>s,Sc:()=>u,c$:()=>o,z8:()=>c});var n=r(330),i=r(144);function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function o(e){try{if(!window.NRVIDEO||!window.NRVIDEO.info)throw new Error("NRVIDEO info is not available.");var t=window.NRVIDEO.info,r=t.beacon,i=t.licenseKey,a=t.applicationID;if(!r||!i)throw new Error("Options object provided by New Relic is not correctly initialized");return a?"https://".concat(e||r,"/ins/1/").concat(i,"?a=").concat(a,"&v=").concat(n.rE,"&ref=").concat(window.location.href,"&ca=VA"):"https://".concat(e||r,"/ins/1/").concat(i,"?&v=").concat(n.rE,"&ref=").concat(window.location.href,"&ca=VA")}catch(e){return console.error(e.message),null}}function s(e){if("string"==typeof e&&e.length)return e.length;if("object"===a(e)){if("undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer&&e.byteLength)return e.byteLength;if("undefined"!=typeof Blob&&e instanceof Blob&&e.size)return e.size;if(!("undefined"!=typeof FormData&&e instanceof FormData))try{return function(e){try{var t;return null!==(t=JSON.stringify(e,(r=new WeakSet,function(e,t){if("object"===a(t)&&null!==t){if(r.has(t))return;r.add(t)}return t})))&&void 0!==t?t:""}catch(e){return i.A.error("Error stringifying value:",e.message),""}var r}(e).length}catch(e){return}}}function u(e){switch(e){case 408:case 429:case 500:return!0;case 401:case 403:case 404:return!1}return e>=502&&e<=504||e>=512&&e<=530}function c(e,t){return e&&Array.isArray(e)&&0!==e.length?t&&"object"===a(t)?e.reduce(function(e,r){return r in t&&(e[r]=t[r]),e},{}):{}:t}},330(e){e.exports={rE:"4.1.5"}}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,r),a.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.d(n,{default:()=>se});var i=r(144),a=r(487),o=r(51),s=r(302),u=r(347);function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}var l=["qoe"];function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function h(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach(function(t){d(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function d(e,t,r){return(t=function(e){var t=function(e){if("object"!=c(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{var r,n;if(!o.A.VALID_EVENT_TYPES.includes(e))return i.A.warn("Invalid event type provided to recordEvent",{eventType:e}),!1;if(null===(r=window)||void 0===r||null===(r=r.NRVIDEO)||void 0===r||!r.info)return;var c=window.NRVIDEO.info,f=c.appName,d=c.applicationID,y=t.qoe,v=function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],-1===t.indexOf(r)&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(t,l),p=y?h({},y):{},m=h(h({},d?{}:{appName:f}),{},{timestamp:Date.now(),timeSinceLoad:window.performance?window.performance.now()/1e3:null}),b=h(h({},v),{},{eventType:e},m),g=(0,u.z8)(o.A.QOE_AGGREGATE_KEYS,t),A=null;"VideoAction"===e&&(A=h(h(h({eventType:"VideoAction",actionName:s.A.Events.QOE_AGGREGATE,qoeAggregateVersion:"1.0.0"},p),g),m));var S=a.videoAnalyticsHarvester.addEvent(b);if(A&&null!==(n=window)&&void 0!==n&&null!==(n=n.NRVIDEO)&&void 0!==n&&null!==(n=n.config)&&void 0!==n&&n.qoeAggregate){var E=a.videoAnalyticsHarvester.addEvent(A);return S&&E}return S}catch(e){return i.A.error("Failed to record event:",e.message),!1}}function v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v(Object(r),!0).forEach(function(t){m(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function m(e,t,r){return(t=A(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(e){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b(e)}function g(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,A(n.key),n)}}function A(e){var t=function(e){if("object"!=b(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==b(t)?t:t+""}var S=o.A.COLLECTOR,E=new(function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},(t=[{key:"setConfiguration",value:function(e,t){return!!this.validateRequiredFields(e)&&!!this.validateConfigFields(t)&&(this.initializeGlobalConfig(e,t),i.A.notice("Video analytics configuration initialized successfully"),!0)}},{key:"validateRequiredFields",value:function(e){if(!e||"object"!==b(e))return i.A.error("Configuration must be an object"),!1;var t=e.licenseKey,r=e.appName,n=e.region,a=e.applicationID,o=e.beacon;if(!t)return i.A.error("licenseKey is required"),!1;if(a){if(!o)return i.A.error("beacon is required when applicationID is provided"),!1;if(!Object.values(S).flatMap(function(e){return e}).includes(o))return i.A.error("Invalid beacon: ".concat(o)),!1}else{if(!r||!n)return i.A.error("appName and region are required when applicationID is not provided"),!1;if(!S[n])return i.A.error("Invalid region: ".concat(n,". Valid regions are: ").concat(Object.keys(S).join(", "))),!1}return!0}},{key:"validateConfigFields",value:function(e){if(null==e)return!0;if("object"!==b(e)||Array.isArray(e))return i.A.error("config must be an object"),!1;var t=e.qoeAggregate,r=e.obfuscate;return void 0!==t&&"boolean"!=typeof t?(i.A.error("qoeAggregate must be a boolean"),!1):!(void 0!==r&&!Array.isArray(r)&&(i.A.error("obfuscate must be an array"),1))}},{key:"filterObfuscateRules",value:function(e){return e?e.filter(function(e){var t=void 0!==e.regex&&("string"==typeof e.regex||e.regex instanceof RegExp),r=void 0!==e.replacement&&"string"==typeof e.replacement;return!(!t||!r)||(i.A.warn("obfuscate rule missing required 'regex' (string|RegExp) and/or 'replacement' (string), skipping:",e),!1)}):[]}},{key:"sanitizeQoeIntervalFactor",value:function(e){return null==e?1:"number"==typeof e&&Number.isInteger(e)&&e>=1?e:(console.warn('[nrvideo] Invalid qoeIntervalFactor "'.concat(e,'" — must be a positive integer. Defaulting to 1.')),1)}},{key:"initializeGlobalConfig",value:function(e,t){var r,n=e.licenseKey,i=e.appName,a=e.region,s=e.beacon,u=e.applicationID;s="US"===a?o.A.COLLECTOR.US[0]:s||S[a],window.NRVIDEO={info:p(p({},a?{region:a}:{}),{},{beacon:s,licenseKey:n,applicationID:u},u?{}:{appName:i}),config:{qoeAggregate:null!==(r=null==t?void 0:t.qoeAggregate)&&void 0!==r&&r,qoeIntervalFactor:this.sanitizeQoeIntervalFactor(null==t?void 0:t.qoeIntervalFactor),obfuscate:this.filterObfuscateRules(null==t?void 0:t.obfuscate)}}}}])&&g(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}());function T(e){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},T(e)}function k(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function a(r,n,i,a){var u=n&&n.prototype instanceof s?n:s,c=Object.create(u.prototype);return w(c,"_invoke",function(r,n,i){var a,s,u,c=0,l=i||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return a=t,s=0,u=e,h.n=r,o}};function d(r,n){for(s=r,u=n,t=0;!f&&c&&!i&&t<l.length;t++){var i,a=l[t],d=h.p,y=a[2];r>3?(i=y===n)&&(u=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=d&&((i=r<2&&d<a[1])?(s=0,h.v=n,h.n=a[1]):d<y&&(i=r<3||a[0]>n||n>y)&&(a[4]=r,a[5]=n,h.n=y,s=0))}if(i||r>1)return o;throw f=!0,n}return function(i,l,y){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,y),s=l,u=y;(t=s<2?e:u)||!f;){a||(s?s<3?(s>1&&(h.n=-1),d(s,u)):h.n=u:h.v=u);try{if(c=2,a){if(s||(i="next"),t=a[i]){if(!(t=t.call(a,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(u=TypeError("The iterator does not provide a '"+i+"' method"),s=1);a=e}else if((t=(f=h.n<0)?u:r.call(n,h))!==o)break}catch(t){a=e,s=1,u=t}finally{c=1}}return{value:t,done:f}}}(r,i,a),!0),c}var o={};function s(){}function u(){}function c(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(w(t={},n,function(){return this}),t),f=c.prototype=s.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,w(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,w(f,"constructor",c),w(c,"constructor",u),u.displayName="GeneratorFunction",w(c,i,"GeneratorFunction"),w(f),w(f,i,"Generator"),w(f,n,function(){return this}),w(f,"toString",function(){return"[object Generator]"}),(k=function(){return{w:a,m:h}})()}function w(e,t,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}w=function(e,t,r,n){function a(t,r){w(e,t,function(e){return this._invoke(t,r,e)})}t?i?i(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},w(e,t,r,n)}function O(e,t,r,n,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function P(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?P(Object(r),!0).forEach(function(t){R(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):P(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function R(e,t,r){return(t=D(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function B(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,D(n.key),n)}}function D(e){var t=function(e){if("object"!=T(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=T(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==T(t)?t:t+""}var j=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},t=[{key:"addTracker",value:function(e,t){var r,n;null!=t&&t.info&&(r=t.info,n=null==t?void 0:t.config,E.setConfiguration(r,n)),e.on&&e.emit?(N.push(e),e.on("*",C),"function"==typeof e.trackerInit&&e.trackerInit()):i.A.error("Tried to load a non-tracker.",e)}},{key:"removeTracker",value:function(e){e.off("*",C),e.dispose();var t=N.indexOf(e);-1!==t&&N.splice(t,1)}},{key:"getTrackers",value:function(){return N}},{key:"send",value:function(e,t,r){return y(e,_({actionName:t},r))}},{key:"sendError",value:function(e){return y("VideoErrorAction",_({actionName:"ERROR"},e))}},{key:"forceHarvest",value:(n=k().m(function e(){var t,n,a;return k().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,t=r(487),n=t.videoAnalyticsHarvester,e.n=1,n.forceHarvest();case 1:return e.a(2,e.v);case 2:return e.p=2,a=e.v,i.A.error("Failed to force harvest:",a.message),e.a(2,{success:!1,error:a.message})}},e,null,[[0,2]])}),a=function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(e){O(a,r,i,o,s,"next",e)}function s(e){O(a,r,i,o,s,"throw",e)}o(void 0)})},function(){return a.apply(this,arguments)})}],t&&B(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,a}(),N=[];function C(e){try{var t=function(e){var t={};for(var r in e)null!==e[r]&&void 0!==e[r]&&(t[r]=e[r]);return t}(e.data);i.A.level<=i.A.Levels.DEBUG?i.A.notice("Sent",e.type,t):i.A.notice("Sent",e.type),j.send(e.eventType,e.type,t)}catch(e){i.A.error("Error in event handler:",e.message)}}const I=j;var V=r(455),H=r(568);function L(e){return L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},L(e)}function x(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a,o,s=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Q(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Q(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Q(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function F(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,G(n.key),n)}}function G(e){var t=function(e){if("object"!=L(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=L(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==L(t)?t:t+""}const q=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.reset(),this._createdAt=Date.now(),this._hb=!0,this._acc=0,this._bufferAcc=0},(t=[{key:"reset",value:function(){this._viewSession=null,this._viewCount=0,this._isAd=!1,this.numberOfErrors=0,this.numberOfAds=0,this.numberOfVideos=0,this.totalPlaytime=0,this.weightedAverageBitrate=0,this.totalAdPlaytime=0,this.isAdBreak=!1,this.initialBufferingHappened=!1,this.startupTime=null,this.peakBitrate=0,this._lastBitrate=null,this._lastBitrateChangeTimestamp=null,this.partialAverageBitrate=0,this._totalBitrateDuration=0,this.hadStartupError=!1,this.hadPlaybackError=!1,this.totalRebufferingTime=0,this.resetFlags(),this.resetChronos()}},{key:"resetFlags",value:function(){this.isPlayerReady=!1,this.isRequested=!1,this.isStarted=!1,this.isPaused=!1,this.isSeeking=!1,this.isBuffering=!1,this.isPlaying=!1}},{key:"resetChronos",value:function(){this.timeSinceRequested=new V.A,this.timeSinceStarted=new V.A,this.timeSincePaused=new V.A,this.timeSinceSeekBegin=new V.A,this.timeSinceBufferBegin=new V.A,this.timeSinceAdBreakStart=new V.A,this.timeSinceLastDownload=new V.A,this.timeSinceLastHeartbeat=new V.A,this.timeSinceLastRenditionChange=new V.A,this.timeSinceLastAdQuartile=new V.A,this.timeSinceLastAd=new V.A,this.timeSinceLastError=new V.A,this.timeSinceLastAdError=new V.A,this.timeSinceResumed=new V.A,this.timeSinceSeekEnd=new V.A,this.playtimeSinceLastEvent=new V.A,this.customTimeSinceAttributes={},this.elapsedTime=new V.A,this.bufferElapsedTime=new V.A,this._totalAdPlaytime=new V.A}},{key:"isAd",value:function(){return this._isAd}},{key:"setIsAd",value:function(e){this._isAd=e}},{key:"setTimeSinceAttribute",value:function(e){this.customTimeSinceAttributes[e]=new V.A,this.customTimeSinceAttributes[e].start()}},{key:"removeTimeSinceAttribute",value:function(e){delete this.customTimeSinceAttributes[e]}},{key:"getViewSession",value:function(){if(!this._viewSession){var e=(new Date).getTime(),t=Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2);this._viewSession=e+"-"+t}return this._viewSession}},{key:"getViewId",value:function(){return this.getViewSession()+"-"+this._viewCount}},{key:"getStateAttributes",value:function(e){e=e||{},this.isAd()?(this.isRequested&&(e.timeSinceAdRequested=this.timeSinceRequested.getDeltaTime(),e.timeSinceLastAdHeartbeat=this.timeSinceLastHeartbeat.getDeltaTime()),this.isStarted&&(e.timeSinceAdStarted=this.timeSinceStarted.getDeltaTime()),this.isPaused&&(e.timeSinceAdPaused=this.timeSincePaused.getDeltaTime()),this.isBuffering&&(e.timeSinceAdBufferBegin=this.timeSinceBufferBegin.getDeltaTime()),this.isSeeking&&(e.timeSinceAdSeekBegin=this.timeSinceSeekBegin.getDeltaTime()),this.isAdBreak&&(e.timeSinceAdBreakBegin=this.timeSinceAdBreakStart.getDeltaTime()),this.numberOfErrors>0&&this.timeSinceLastAdError.startTime>0&&(e.timeSinceLastAdError=this.timeSinceLastAdError.getDeltaTime()),e.numberOfAds=this.numberOfAds):(this.isRequested&&(e.timeSinceRequested=this.timeSinceRequested.getDeltaTime(),e.timeSinceLastHeartbeat=this.timeSinceLastHeartbeat.getDeltaTime()),this.isStarted&&(e.timeSinceStarted=this.timeSinceStarted.getDeltaTime()),this.isPaused&&(e.timeSincePaused=this.timeSincePaused.getDeltaTime()),this.isBuffering&&(e.timeSinceBufferBegin=this.timeSinceBufferBegin.getDeltaTime()),this.isSeeking&&(e.timeSinceSeekBegin=this.timeSinceSeekBegin.getDeltaTime()),e.timeSinceLastAd=this.timeSinceLastAd.getDeltaTime(),this.numberOfErrors>0&&this.timeSinceLastError.startTime>0&&(e.timeSinceLastError=this.timeSinceLastError.getDeltaTime()),e.numberOfVideos=this.numberOfVideos),e.numberOfErrors=this.numberOfErrors,this.isAd()||(this.playtimeSinceLastEvent.startTime>0?e.playtimeSinceLastEvent=this.playtimeSinceLastEvent.getDeltaTime():e.playtimeSinceLastEvent=0,this.isPlaying?this.playtimeSinceLastEvent.start():this.playtimeSinceLastEvent.reset(),this.totalPlaytime+=e.playtimeSinceLastEvent,e.totalPlaytime=this.totalPlaytime);for(var t=0,r=Object.entries(this.customTimeSinceAttributes);t<r.length;t++){var n=x(r[t],2),i=n[0],a=n[1];e[i]=a.getDeltaTime()}return e}},{key:"getQoeAttributes",value:function(e){e=e||{};var t={};try{null!==this.startupTime&&(t.startupTime=this.startupTime),this.peakBitrate>0&&(t.peakBitrate=this.peakBitrate),t.hadStartupError=this.hadStartupError,t.hadPlaybackError=this.hadPlaybackError,t.totalRebufferingTime=this.totalRebufferingTime,t.rebufferingRatio=this.totalPlaytime>0?this.totalRebufferingTime/this.totalPlaytime*100:0,t.totalPlaytime=this.totalPlaytime,t.averageBitrate=this.weightedBitrate,t.numberOfErrors=this.numberOfErrors}catch(e){i.A.error("Failed to add attributes for QOE KPIs",e.message)}return e.qoe=t,e}},{key:"calculateBufferType",value:function(e){var t;return t=e?"initial":this.isSeeking?"seek":this.isPaused?"pause":"connection",i.A.debug("Buffer Type = "+t),t}},{key:"goViewCountUp",value:function(){this._viewCount++}},{key:"goPlayerReady",value:function(){return!this.isPlayerReady&&(this.isPlayerReady=!0,!0)}},{key:"goRequest",value:function(){return!this.isRequested&&(this.isRequested=!0,this.timeSinceLastAd.reset(),this.timeSinceRequested.start(),!0)}},{key:"goStart",value:function(){return!(!this.isRequested||this.isStarted||(this.isAd()?this.numberOfAds++:this.numberOfVideos++,this.isStarted=!0,this.isPlaying=!0,this.timeSinceStarted.start(),this.playtimeSinceLastEvent.start(),0))}},{key:"goEnd",value:function(){return!!this.isRequested&&(this.numberOfErrors=0,this.resetFlags(),this.timeSinceRequested.stop(),this.timeSinceStarted.stop(),this.playtimeSinceLastEvent.stop(),this.isPlaying=!1,!0)}},{key:"goPause",value:function(){return!(!this.isStarted||this.isPaused||(this.isPaused=!0,this.isPlaying=!1,this.timeSincePaused.start(),this.playtimeSinceLastEvent.stop(),this.timeSinceResumed.reset(),this.isBuffering&&(this._bufferAcc+=this.bufferElapsedTime.getDeltaTime()),this.elapsedTime.start(),0))}},{key:"goResume",value:function(){return!(!this.isStarted||!this.isPaused||(this.isPaused=!1,this.isPlaying=!0,this.timeSincePaused.stop(),this.timeSinceResumed.start(),this._hb?(this._acc=this.elapsedTime.getDeltaTime(),this._hb=!1):(this.isBuffering&&this.bufferElapsedTime.start(),this._acc+=this.elapsedTime.getDeltaTime()),0))}},{key:"goBufferStart",value:function(){return!(!this.isRequested||this.isBuffering||(this.isBuffering=!0,this.isPlaying=!1,this.timeSinceBufferBegin.start(),this.bufferElapsedTime.start(),0))}},{key:"goBufferEnd",value:function(){return!(!this.isRequested||!this.isBuffering||(this.isBuffering=!1,this.isPlaying=!0,this.timeSinceBufferBegin.stop(),this._hb?(this._bufferAcc=this.bufferElapsedTime.getDeltaTime(),this._hb=!1):this._bufferAcc+=this.bufferElapsedTime.getDeltaTime(),!this.isAd()&&this.initialBufferingHappened&&(this.totalRebufferingTime+=this.timeSinceBufferBegin.stopTime-this.timeSinceBufferBegin.startTime),0))}},{key:"goSeekStart",value:function(){return!(!this.isStarted||this.isSeeking||(this.isSeeking=!0,this.isPlaying=!1,this.timeSinceSeekBegin.start(),this.timeSinceSeekEnd.reset(),0))}},{key:"goSeekEnd",value:function(){return!(!this.isStarted||!this.isSeeking||(this.isSeeking=!1,this.isPlaying=!0,this.timeSinceSeekBegin.stop(),this.timeSinceSeekEnd.start(),0))}},{key:"goAdBreakStart",value:function(){return!this.isAdBreak&&(this.isAdBreak=!0,this.timeSinceAdBreakStart.start(),!0)}},{key:"goAdBreakEnd",value:function(){return!!this.isAdBreak&&(this.isRequested=!1,this.isAdBreak=!1,this.totalAdPlaytime=this.timeSinceAdBreakStart.getDeltaTime(),this.timeSinceAdBreakStart.stop(),!0)}},{key:"goDownload",value:function(){this.timeSinceLastDownload.start()}},{key:"goHeartbeat",value:function(){this.timeSinceLastHeartbeat.start()}},{key:"goRenditionChange",value:function(){this.timeSinceLastRenditionChange.start()}},{key:"goAdQuartile",value:function(){this.timeSinceLastAdQuartile.start()}},{key:"goError",value:function(){this.isError=!0,this.numberOfErrors++,this.isAd()?this.timeSinceLastAdError.start():(this.timeSinceLastError.start(),this.isStarted?this.hadPlaybackError=!0:this.hadStartupError=!0)}},{key:"goLastAd",value:function(){this.timeSinceLastAd.start()}},{key:"trackContentBitrateState",value:function(e){if(e&&"number"==typeof e){this.peakBitrate=Math.max(this.peakBitrate,e);var t=Date.now();if(!this.isPlaying){if(null!==this._lastBitrate&&null!==this._lastBitrateChangeTimestamp){var r=t-this._lastBitrateChangeTimestamp;r>0&&(this.partialAverageBitrate+=this._lastBitrate*r,this._totalBitrateDuration+=r),this._lastBitrateChangeTimestamp=null}return void(this._lastBitrate=e)}if(null===this._lastBitrateChangeTimestamp&&null!==this._lastBitrate&&(this._lastBitrateChangeTimestamp=t),null!==this._lastBitrate&&this._lastBitrate!==e&&null!==this._lastBitrateChangeTimestamp){var n=t-this._lastBitrateChangeTimestamp;n>0&&(this.partialAverageBitrate+=this._lastBitrate*n,this._totalBitrateDuration+=n),this._lastBitrateChangeTimestamp=t}null===this._lastBitrateChangeTimestamp&&(this._lastBitrateChangeTimestamp=t),this._lastBitrate=e;var i=this.partialAverageBitrate,a=this._totalBitrateDuration,o=t-this._lastBitrateChangeTimestamp;o>0&&(i+=e*o,a+=o),this.weightedBitrate=a>0?Math.round(i/a):e}}},{key:"resetViewIdTrackedState",value:function(){this.peakBitrate=0,this.partialAverageBitrate=0,this._totalBitrateDuration=0,this.startupTime=null,this._lastBitrate=null,this._lastBitrateChangeTimestamp=null}},{key:"clearTotalAdsTime",value:function(){i.A.debug("clear total ads time",this.totalAdTime),this._totalAdPlaytime.reset()}},{key:"totalAdTime",value:function(){return this._totalAdPlaytime.getDuration()}},{key:"startAdsTime",value:function(){return i.A.debug("startAdsTime"),this._totalAdPlaytime.start()}},{key:"stopAdsTime",value:function(){return i.A.debug("stopAdsTime"),this._totalAdPlaytime.stop()}},{key:"setStartupTime",value:function(e){null===this.startupTime&&(this.startupTime=Math.max(this.timeSinceRequested.getDeltaTime()-e,0))}}])&&F(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();var U=r(330);function z(e){return z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},z(e)}function M(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function K(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?M(Object(r),!0).forEach(function(t){W(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):M(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function W(e,t,r){return(t=X(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Y(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,X(n.key),n)}}function X(e){var t=function(e){if("object"!=z(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=z(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==z(t)?t:t+""}function Z(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Z=function(){return!!e})()}function $(e){return $=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},$(e)}function J(e,t){return J=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},J(e,t)}var ee=function(e){function t(e,r){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t,r){return t=$(t),function(e,t){if(t&&("object"==z(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Z()?Reflect.construct(t,r||[],$(e).constructor):t.apply(e,r))}(this,t)).state=new q,n.adsTracker=null,n._lastBufferType=null,n._userId=null,r=r||{},n.setOptions(r),e&&n.setPlayer(e,r.tag),i.A.notice("Tracker "+n.getTrackerName()+" v"+n.getTrackerVersion()+" is ready."),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&J(e,t)}(t,e),r=t,n=[{key:"setUserId",value:function(e){this._userId=e}},{key:"setOptions",value:function(e){e&&(e.adsTracker&&this.setAdsTracker(e.adsTracker),"boolean"==typeof e.isAd&&this.setIsAd(e.isAd),s.A.prototype.setOptions.apply(this,arguments))}},{key:"setPlayer",value:function(e,t){(this.player||this.tag)&&this.dispose(),"undefined"!=typeof document&&document.getElementById&&("string"==typeof e&&(e=document.getElementById(e)),"string"==typeof t&&(t=document.getElementById(t))),t=t||e,this.player=e,this.tag=t,this.registerListeners()}},{key:"isAd",value:function(){return this.state.isAd()}},{key:"setIsAd",value:function(e){this.state.setIsAd(e)}},{key:"setAdsTracker",value:function(e){this.disposeAdsTracker(),e&&(this.adsTracker=e,this.adsTracker.setIsAd(!0),this.adsTracker.parentTracker=this,this.adsTracker.on("*",te.bind(this)))}},{key:"disposeAdsTracker",value:function(){this.adsTracker&&(this.adsTracker.off("*",te),this.adsTracker.dispose())}},{key:"dispose",value:function(){this.stopHeartbeat(),this.disposeAdsTracker(),this.unregisterListeners(),this.player=null,this.tag=null}},{key:"registerListeners",value:function(){}},{key:"unregisterListeners",value:function(){}},{key:"getViewId",value:function(){return this.parentTracker?this.parentTracker.getViewId():this.state.getViewId()}},{key:"getViewSession",value:function(){return this.parentTracker?this.parentTracker.getViewSession():this.state.getViewSession()}},{key:"getVideoId",value:function(){return null}},{key:"getTitle",value:function(){return null}},{key:"isLive",value:function(){return null}},{key:"getBitrate",value:function(){return null}},{key:"getManifestBitrate",value:function(){return null}},{key:"getSegmentDownloadBitrate",value:function(){return null}},{key:"getNetworkDownloadBitrate",value:function(){return null}},{key:"getWebkitBitrate",value:function(){if(this.tag&&this.tag.webkitVideoDecodedByteCount){var e;if(this._lastWebkitBitrate){var t=(e=this.tag.webkitVideoDecodedByteCount)-this._lastWebkitBitrate,r=this.getHeartbeat()/1e3;e=Math.round(t/r*8)}return this._lastWebkitBitrate=this.tag.webkitVideoDecodedByteCount,e||null}}},{key:"getRenditionName",value:function(){return null}},{key:"getRenditionBitrate",value:function(){return null}},{key:"getRenditionShift",value:function(e){var t,r=this.getRenditionBitrate();return this.isAd()?(t=this._lastAdRendition,e&&(this._lastAdRendition=r)):(t=this._lastRendition,e&&(this._lastRendition=r)),r&&t?r>t?"up":r<t?"down":null:null}},{key:"getRenditionHeight",value:function(){return this.tag?this.tag.videoHeight:null}},{key:"getRenditionWidth",value:function(){return this.tag?this.tag.videoWidth:null}},{key:"getDuration",value:function(){return this.tag?this.tag.duration:null}},{key:"getPlayhead",value:function(){return this.tag?this.tag.currentTime:null}},{key:"getLanguage",value:function(){return null}},{key:"getSrc",value:function(){return this.tag?this.tag.currentSrc:null}},{key:"getPlayrate",value:function(){return this.tag?this.tag.playbackRate:null}},{key:"isMuted",value:function(){return this.tag?this.tag.muted:null}},{key:"isFullscreen",value:function(){return null}},{key:"getCdn",value:function(){return null}},{key:"getPlayerName",value:function(){return this.getTrackerName()}},{key:"getPlayerVersion",value:function(){return U.rE}},{key:"getFps",value:function(){return null}},{key:"isAutoplayed",value:function(){return this.tag?this.tag.autoplay:null}},{key:"getPreload",value:function(){return this.tag?this.tag.preload:null}},{key:"getAdQuartile",value:function(){return null}},{key:"getAdPosition",value:function(){return this.parentTracker?this.parentTracker.state.isStarted?"mid":"pre":null}},{key:"getAdPartner",value:function(){return null}},{key:"getAdCreativeId",value:function(){return null}},{key:"getInstrumentationProvider",value:function(){return null}},{key:"getInstrumentationName",value:function(){return null}},{key:"getInstrumentationVersion",value:function(){return null}},{key:"getAttributes",value:function(e,t){if(void 0===(e=s.A.prototype.getAttributes.apply(this,arguments)).isAd&&(e.isAd=this.isAd()),e.viewSession=this.getViewSession(),e.viewId=this.getViewId(),e.playerName=this.getPlayerName(),e.playerVersion=this.getPlayerVersion(),e["instrumentation.provider"]=this.getInstrumentationProvider(),e["instrumentation.name"]=this.getInstrumentationName(),e["instrumentation.version"]=this.getInstrumentationVersion(),e["enduser.id"]=this._userId,e.src="Browser","customAction"===t)return e;try{e.pageUrl=window.location.href}catch(e){}for(var r in this.isAd()?(e.adId=this.getVideoId(),e.adTitle=this.getTitle(),e.adSrc=this.getSrc(),e.adCdn=this.getCdn(),this.state.isStarted&&(e.adBitrate=this.getBitrate()||0),e.adRenditionName=this.getRenditionName(),e.adRenditionHeight=this.getRenditionHeight(),e.adRenditionWidth=this.getRenditionWidth(),e.adDuration=this.getDuration(),e.adPlayhead=this.getPlayhead(),e.adLanguage=this.getLanguage(),e.adIsMuted=this.isMuted(),e.adFps=this.getFps(),e.adPosition=this.getAdPosition(),e.adCreativeId=this.getAdCreativeId(),e.adPartner=this.getAdPartner()):(e.contentId=this.getVideoId(),e.contentTitle=this.getTitle(),e.contentSrc=this.getSrc(),e.contentCdn=this.getCdn(),e.contentPlayhead=this.getPlayhead(),e.contentIsLive=this.isLive(),this.state.isStarted&&(e.contentBitrate=this.getBitrate()||0,e.contentManifestBitrate=this.getManifestBitrate()||0,e.contentSegmentDownloadBitrate=this.getSegmentDownloadBitrate()||0,e.contentNetworkDownloadBitrate=this.getNetworkDownloadBitrate()||0),e.contentRenditionName=this.getRenditionName(),e.contentRenditionHeight=this.getRenditionHeight(),e.contentRenditionWidth=this.getRenditionWidth(),e.contentDuration=this.getDuration(),e.contentLanguage=this.getLanguage(),e.contentPlayrate=this.getPlayrate(),e.contentIsFullscreen=this.isFullscreen(),e.contentIsMuted=this.isMuted(),e.contentIsAutoplayed=this.isAutoplayed(),e.contentPreload=this.getPreload(),e.contentFps=this.getFps(),null!=this.adsTracker&&this.adsTracker.state.totalAdPlaytime>0&&(e.totalAdPlaytime=this.adsTracker.state.totalAdPlaytime)),this.state.getStateAttributes(e),this.state.isStarted&&!this.isAd()&&this.state.trackContentBitrateState(e.contentBitrate),this.customData)e[r]=this.customData[r];return this.addQoeAttributes(e),e}},{key:"addQoeAttributes",value:function(e){var t=(e=this.state.getQoeAttributes(e)).qoe;for(var r in this.customData)t[r]=this.customData[r]}},{key:"sendCustom",value:function(e,t,r){r=r||{},this.sendVideoCustomAction(e,r),this.state.setTimeSinceAttribute(t)}},{key:"sendPlayerReady",value:function(e){this.state.goPlayerReady()&&(e=e||{},this.sendVideoAction(t.Events.PLAYER_READY,e))}},{key:"sendRequest",value:function(e){var r;this.state.goRequest()&&(this.isAd()?(r=t.Events.AD_REQUEST,this.sendVideoAdAction(r,e)):(r=t.Events.CONTENT_REQUEST,this.sendVideoAction(r,e)))}},{key:"sendStart",value:function(e){var r=this;if(this.state.goStart()){var n;if(this.isAd())n=t.Events.AD_START,this.parentTracker&&(this.parentTracker.state.isPlaying=!1),this.sendVideoAdAction(n,e),this.state.startAdsTime();else{n=t.Events.CONTENT_START;var i,o=0;this.adsTracker&&((this.adsTracker.state.isPlaying||this.adsTracker.state.isBuffering)&&(this.adsTracker.state.stopAdsTime(),this.adsTracker.state.isPlaying=!1,this.adsTracker.state.isBuffering=!1),o=null!==(i=this.adsTracker.state.totalAdTime())&&void 0!==i?i:0),this.state.setStartupTime(o),this.sendVideoAction(n,e),a.videoAnalyticsHarvester.setBeforeDrainCallback(function(){if(r.state){var e=r.state.getQoeAttributes({}).qoe;a.videoAnalyticsHarvester.refreshQoeKpis(e,r.getViewId())}})}this.startHeartbeat(),this.state.goHeartbeat()}}},{key:"sendEnd",value:function(e){var r;this.state.goEnd()&&(e=e||{},this.isAd()?(r=t.Events.AD_END,e.timeSinceAdRequested=this.state.timeSinceRequested.getDeltaTime(),e.timeSinceAdStarted=this.state.timeSinceStarted.getDeltaTime(),this.parentTracker&&(this.parentTracker.state.isPlaying=!0),this.state.stopAdsTime()):(r=t.Events.CONTENT_END,e.timeSinceRequested=this.state.timeSinceRequested.getDeltaTime(),e.timeSinceStarted=this.state.timeSinceStarted.getDeltaTime()),this.stopHeartbeat(),this.isAd()?this.sendVideoAdAction(r,e):this.sendVideoAction(r,e),this.parentTracker&&this.isAd()&&this.parentTracker.state.goLastAd(),this.state.goViewCountUp(),this.state.totalPlaytime=0,this.isAd()||(a.videoAnalyticsHarvester.forceNextQoeCycle(),a.videoAnalyticsHarvester.setBeforeDrainCallback(null),this.adsTracker&&this.adsTracker.state.clearTotalAdsTime(),this.state.resetViewIdTrackedState()))}},{key:"sendPause",value:function(e){if(this.state.goPause()){var r=this.isAd()?t.Events.AD_PAUSE:t.Events.CONTENT_PAUSE;this.isAd()?this.sendVideoAdAction(r,e):this.sendVideoAction(r,e)}}},{key:"sendResume",value:function(e){var r;this.state.goResume()&&(e=e||{},this.isAd()?(r=t.Events.AD_RESUME,e.timeSinceAdPaused=this.state.timeSincePaused.getDeltaTime()):(r=t.Events.CONTENT_RESUME,e.timeSincePaused=this.state.timeSincePaused.getDeltaTime()),this.isAd()?this.sendVideoAdAction(r,e):this.sendVideoAction(r,e))}},{key:"sendBufferStart",value:function(e){var r;this.state.goBufferStart()&&(e=e||{},r=this.isAd()?t.Events.AD_BUFFER_START:t.Events.CONTENT_BUFFER_START,e=this.buildBufferAttributes(e),this._lastBufferType=e.bufferType,this.isAd()?this.sendVideoAdAction(r,e):this.sendVideoAction(r,e))}},{key:"sendBufferEnd",value:function(e){var r;this.state.goBufferEnd()&&(e=e||{},this.isAd()?(r=t.Events.AD_BUFFER_END,e.timeSinceAdBufferBegin=this.state.timeSinceBufferBegin.getDeltaTime()):(r=t.Events.CONTENT_BUFFER_END,e.timeSinceBufferBegin=this.state.timeSinceBufferBegin.getDeltaTime()),e=this.buildBufferAttributes(e),null!=this._lastBufferType&&(e.bufferType=this._lastBufferType),this.isAd()?this.sendVideoAdAction(r,e):this.sendVideoAction(r,e),this.state.initialBufferingHappened=!0)}},{key:"buildBufferAttributes",value:function(e){return null==e.timeSinceStarted||e.timeSinceStarted<100?e.isInitialBuffering=!this.state.initialBufferingHappened:e.isInitialBuffering=!1,e.bufferType=this.state.calculateBufferType(e.isInitialBuffering),e.timeSinceResumed=this.state.timeSinceResumed.getDeltaTime(),e.timeSinceSeekEnd=this.state.timeSinceSeekEnd.getDeltaTime(),e}},{key:"sendSeekStart",value:function(e){var r;this.state.goSeekStart()&&(r=this.isAd()?t.Events.AD_SEEK_START:t.Events.CONTENT_SEEK_START,this.isAd()?this.sendVideoAdAction(r,e):this.sendVideoAction(r,e))}},{key:"sendSeekEnd",value:function(e){var r;this.state.goSeekEnd()&&(e=e||{},this.isAd()?(r=t.Events.AD_SEEK_END,e.timeSinceAdSeekBegin=this.state.timeSinceSeekBegin.getDeltaTime()):(r=t.Events.CONTENT_SEEK_END,e.timeSinceSeekBegin=this.state.timeSinceSeekBegin.getDeltaTime()),this.isAd()?this.sendVideoAdAction(r,e):this.sendVideoAction(r,e))}},{key:"sendDownload",value:function(e){(e=e||{}).state||i.A.warn("Called sendDownload without { state: xxxxx }."),this.sendVideoAction(t.Events.DOWNLOAD,e),this.state.goDownload()}},{key:"sendError",value:function(e){(e=e||{}).isAd=this.isAd(),this.state.goError();var r=this.isAd()?t.Events.AD_ERROR:t.Events.CONTENT_ERROR;this.sendVideoErrorAction(r,e)}},{key:"sendRenditionChanged",value:function(e){var r;(e=e||{}).timeSinceLastRenditionChange=this.state.timeSinceLastRenditionChange.getDeltaTime(),e.shift=this.getRenditionShift(!0),r=this.isAd()?t.Events.AD_RENDITION_CHANGE:t.Events.CONTENT_RENDITION_CHANGE,this.isAd()?this.sendVideoAdAction(r,e):this.sendVideoAction(r,e),this.state.goRenditionChange()}},{key:"sendHeartbeat",value:function(e){if(this.state.isRequested){var r,n=this.getHeartbeat();this.state._hb=!0,n=this.adjustElapsedTimeForPause(n),this.isAd()?(r=t.Events.AD_HEARTBEAT,"bitmovin-ads"===this.getPlayerName()?this.sendVideoAdAction(r,e):this.sendVideoAdAction(r,K({elapsedTime:n},e))):(r=t.Events.CONTENT_HEARTBEAT,this.sendVideoAction(r,K({elapsedTime:n},e))),this.state.goHeartbeat()}}},{key:"adjustElapsedTimeForPause",value:function(e){return this.state._acc&&(e-=this.state._acc,this.state._acc=0),this.state.isPaused&&((e-=this.state.elapsedTime.getDeltaTime())<10&&(e=0),this.state.elapsedTime.start()),this.state._bufferAcc?(e-=this.state._bufferAcc,this.state._bufferAcc=0):this.state.isBuffering&&((e-=this.state.bufferElapsedTime.getDeltaTime())<5&&(e=0),this.state.bufferElapsedTime.start()),Math.max(0,e)}},{key:"sendAdBreakStart",value:function(e){this.isAd()&&this.state.goAdBreakStart()&&(this.state.totalAdPlaytime=0,this.parentTracker&&(this.parentTracker.state.isPlaying=!1),this.sendVideoAdAction(t.Events.AD_BREAK_START,e))}},{key:"sendAdBreakEnd",value:function(e){this.isAd()&&this.state.goAdBreakEnd()&&((e=e||{}).timeSinceAdBreakBegin=this.state.timeSinceAdBreakStart.getDeltaTime(),this.sendVideoAdAction(t.Events.AD_BREAK_END,e),this.parentTracker&&(this.parentTracker.state.isPlaying=!0),this.stopHeartbeat(),this.parentTracker&&this.isAd()&&this.parentTracker.state.goLastAd())}},{key:"sendAdQuartile",value:function(e){this.isAd()&&((e=e||{}).quartile||i.A.warn("Called sendAdQuartile without { quartile: xxxxx }."),e.timeSinceLastAdQuartile=this.state.timeSinceLastAdQuartile.getDeltaTime(),this.sendVideoAdAction(t.Events.AD_QUARTILE,e),this.state.goAdQuartile())}},{key:"sendAdClick",value:function(e){this.isAd()&&((e=e||{}).url||i.A.warn("Called sendAdClick without { url: xxxxx }."),this.sendVideoAdAction(t.Events.AD_CLICK,e))}}],n&&Y(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(s.A);function te(e){e.type!==ee.Events.AD_ERROR?this.sendVideoAdAction(e.type,e.data):this.sendVideoErrorAction(e.type,e.data)}ee.Events={PLAYER_READY:"PLAYER_READY",DOWNLOAD:"DOWNLOAD",ERROR:"ERROR",CONTENT_REQUEST:"CONTENT_REQUEST",CONTENT_START:"CONTENT_START",CONTENT_END:"CONTENT_END",CONTENT_PAUSE:"CONTENT_PAUSE",CONTENT_RESUME:"CONTENT_RESUME",CONTENT_SEEK_START:"CONTENT_SEEK_START",CONTENT_SEEK_END:"CONTENT_SEEK_END",CONTENT_BUFFER_START:"CONTENT_BUFFER_START",CONTENT_BUFFER_END:"CONTENT_BUFFER_END",CONTENT_HEARTBEAT:"CONTENT_HEARTBEAT",CONTENT_RENDITION_CHANGE:"CONTENT_RENDITION_CHANGE",CONTENT_ERROR:"CONTENT_ERROR",AD_REQUEST:"AD_REQUEST",AD_START:"AD_START",AD_END:"AD_END",AD_PAUSE:"AD_PAUSE",AD_RESUME:"AD_RESUME",AD_SEEK_START:"AD_SEEK_START",AD_SEEK_END:"AD_SEEK_END",AD_BUFFER_START:"AD_BUFFER_START",AD_BUFFER_END:"AD_BUFFER_END",AD_HEARTBEAT:"AD_HEARTBEAT",AD_RENDITION_CHANGE:"AD_RENDITION_CHANGE",AD_ERROR:"AD_ERROR",AD_BREAK_START:"AD_BREAK_START",AD_BREAK_END:"AD_BREAK_END",AD_QUARTILE:"AD_QUARTILE",AD_CLICK:"AD_CLICK"};const re=ee;var ne=r(431),ie=r(413),ae=r(481),oe=r(374);const se={Constants:o.A,Chrono:V.A,Log:i.A,Emitter:H.A,Tracker:s.A,VideoTracker:re,VideoTrackerState:q,Core:I,version:U.rE,NrVideoEventAggregator:ne.t,RetryQueueHandler:ie.u,OptimizedHttpClient:ae.X,HarvestScheduler:oe.n,recordEvent:y};return n.default})());
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.nrvideo=t():e.nrvideo=t()}(self,()=>(()=>{"use strict";var e={487(e,t,r){r.r(t),r.d(t,{videoAnalyticsHarvester:()=>v});var n=r(374),i=r(431),a=r(51),o=r(144),s=r(302);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function f(e,t,r){return(t=d(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,d(n.key),n)}}function d(e){var t=function(e){if("object"!=u(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==u(t)?t:t+""}var y=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.isInitialized=!1,this.harvestScheduler=null,this.eventBuffer=null},t=[{key:"initialize",value:function(){if(this.isInitialized)o.A.warn("Video analytics agent already initialized");else try{this.eventBuffer=new i.t,this.harvestScheduler=new n.n(this.eventBuffer),this.harvestScheduler.startScheduler(),this.isInitialized=!0,o.A.notice("Video analytics agent initialized successfully")}catch(e){o.A.error("Failed to initialize video analytics agent:",e.message)}}},{key:"addEvent",value:function(e){this.isInitialized||(o.A.warn("Video analytics agent not initialized, initializing now"),this.initialize());try{return e.actionName&&e.actionName===s.A.Events.QOE_AGGREGATE?e.viewId?this.eventBuffer.addOrReplaceByActionNameAndViewId(s.A.Events.QOE_AGGREGATE,e.viewId,e):this.eventBuffer.addOrReplaceByActionName(s.A.Events.QOE_AGGREGATE,e):this.eventBuffer.add(e)}catch(e){return o.A.error("Failed to add event to harvesting system:",e.message),!1}}},{key:"setHarvestInterval",value:function(e){this.isInitialized||this.initialize(),this.harvestScheduler.updateHarvestInterval(e)}},{key:"forceNextQoeCycle",value:function(){this.harvestScheduler&&(this.harvestScheduler.forceNextQoeCycle=!0)}},{key:"setBeforeDrainCallback",value:function(e){this.harvestScheduler&&(this.harvestScheduler.beforeDrainCallback=e)}},{key:"refreshQoeKpis",value:function(e,t){if(this.eventBuffer&&e){var r=t?this.eventBuffer.findByActionNameAndViewId(s.A.Events.QOE_AGGREGATE,t):this.eventBuffer.findByActionName(s.A.Events.QOE_AGGREGATE);if(r){var n,i=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach(function(t){f(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},r),o=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return c(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}(a.A.QOE_KPI_KEYS);try{for(o.s();!(n=o.n()).done;){var u=n.value;u in e&&(i[u]=e[u])}}catch(e){o.e(e)}finally{o.f()}t?this.eventBuffer.addOrReplaceByActionNameAndViewId(s.A.Events.QOE_AGGREGATE,t,i):this.eventBuffer.addOrReplaceByActionName(s.A.Events.QOE_AGGREGATE,i)}}}}],t&&h(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),v=new y},455(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(e){var t=function(e){if("object"!=n(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}r.d(t,{A:()=>s});var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.reset()}return t=e,r=[{key:"reset",value:function(){this.startTime=0,this.stopTime=0,this.accumulator=0,this.offset=0}},{key:"getDeltaTime",value:function(){return this.startTime?this.offset+((new Date).getTime()-this.startTime):null}},{key:"start",value:function(){this.startTime=(new Date).getTime(),this.stopTime=0}},{key:"stop",value:function(){return this.stopTime=(new Date).getTime(),this.startTime<this.stopTime&&(this.accumulator+=this.stopTime-this.startTime),this.getDeltaTime()}},{key:"getDuration",value:function(){return this.stopTime?this.accumulator+this.offset:this.accumulator+(null!==(e=this.getDeltaTime())&&void 0!==e?e:0);var e}},{key:"clone",value:function(){var t=new e;return t.startTime=this.startTime,t.stopTime=this.stopTime,t.offset=this.offset,t.accumulator=this.accumulator,t}}],r&&i(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r}();const s=o},51(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}function a(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(e){var t=function(e){if("object"!=n(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}r.d(t,{A:()=>u});var s=a(function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)});s.AdPositions={PRE:"pre",MID:"mid",POST:"post"},s.COLLECTOR={US:["bam.nr-data.net","bam-cell.nr-data.net"],EU:"bam.eu01.nr-data.net",Staging:"staging-bam-cell.nr-data.net",GOV:"gov-bam.nr-data.net"},s.VALID_EVENT_TYPES=["VideoAction","VideoAdAction","VideoErrorAction","VideoCustomAction"],s.MAX_PAYLOAD_SIZE=1048576,s.MAX_BEACON_SIZE=61440,s.MAX_EVENTS_PER_BATCH=1e3,s.INTERVAL=1e4,s.QOE_KPI_KEYS=["startupTime","peakBitrate","averageBitrate","totalPlaytime","totalRebufferingTime","rebufferingRatio","hadStartupError","hadPlaybackError","numberOfErrors"],s.QOE_AGGREGATE_KEYS=["coreVersion","instrumentation.name","instrumentation.provider","instrumentation.version","isBackgroundEvent","playerName","playerVersion","src","viewId","viewSession","contentIsAutoplayed","contentIsMuted","contentRenditionHeight","contentRenditionWidth","contentSrc","numberOfVideos","pageUrl","trackerName","trackerVersion","contentDuration","contentPlayrate","contentPlayhead","contentPreload","elapsedTime","contentTitle","contentId","contentIsLive","deviceType","deviceGroup","deviceManufacturer","deviceModel","deviceName","deviceSize","deviceUuid","contentRenditionName","contentIsFullscreen","contentCdn","contentFps","asnOrganization","asnLongitude","asnLatitude","asn","timeSinceRequested","timeSinceStarted"];const u=s},568(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(e){var t=function(e){if("object"!=n(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}r.d(t,{A:()=>o});const o=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},(t=[{key:"on",value:function(e,t){if(this._listeners=this._listeners||{},"function"==typeof t)return this._listeners[e]=this._listeners[e]||[],this._listeners[e].push(t),this}},{key:"off",value:function(e,t){if(this._listeners=this._listeners||{},this._listeners[e]){var r=this._listeners[e].indexOf(t);-1!==r&&this._listeners[e].splice(r,1)}return this}},{key:"emit",value:function(e,t,r){var n=this;return this._listeners=this._listeners||{},r=r||{},Array.isArray(this._listeners[t])&&this._listeners[t].forEach(function(i){i.call(n,{eventType:e,type:t,data:r,target:n})}),Array.isArray(this._listeners["*"])&&this._listeners["*"].forEach(function(i){i.call(n,{eventType:e,type:t,data:r,target:n})}),this}}])&&i(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}()},431(e,t,r){r.d(t,{t:()=>f});var n=r(144),i=r(51),a=r(347);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,u(n.key),n)}}function u(e){var t=function(e){if("object"!=o(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==o(t)?t:t+""}var c=i.A.MAX_PAYLOAD_SIZE,l=i.A.MAX_EVENTS_PER_BATCH,f=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.buffer=[],this.maxPayloadSize=c,this.maxEventsPerBatch=l,this.currentPayloadSize=0,this.totalEvents=0,this.smartHarvestPayloadThreshold=Math.floor(.6*this.maxPayloadSize),this.overflowPayloadThreshold=Math.floor(.9*this.maxPayloadSize),this.smartHarvestEventThreshold=Math.floor(.6*this.maxEventsPerBatch),this.overflowEventThreshold=Math.floor(.9*this.maxEventsPerBatch),this.onSmartHarvestTrigger=null},t=[{key:"addOrReplaceByActionName",value:function(e,t){var r=this.buffer.findIndex(function(t){return t.actionName===e});try{return-1===r?this.add(t):this.add(t,r),!0}catch(e){return n.A.error("Failed to set or replace the event to buffer:",e.message),!1}}},{key:"addOrReplaceByActionNameAndViewId",value:function(e,t,r){var i=this.buffer.findIndex(function(r){return r.actionName===e&&r.viewId===t});try{return-1===i?this.add(r):this.add(r,i),!0}catch(e){return n.A.error("Failed to set or replace the event to buffer:",e.message),!1}}},{key:"findByActionNameAndViewId",value:function(e,t){return this.buffer.find(function(r){return r.actionName===e&&r.viewId===t})||null}},{key:"findByActionName",value:function(e){return this.buffer.find(function(t){return t.actionName===e})||null}},{key:"add",value:function(e,t){try{var r=(0,a.Q3)(e),i=this.currentPayloadSize+r>=this.maxPayloadSize,o=this.totalEvents+1>=this.maxEventsPerBatch;if((i||o)&&this.makeRoom(r),null!=t&&t>-1){var s=(0,a.Q3)(this.buffer[t]);this.buffer[t]=e,this.currentPayloadSize+=r-s}else this.buffer.push(e),this.totalEvents++,this.currentPayloadSize+=r;return this.checkSmartHarvestTrigger(),!0}catch(e){return n.A.error("Failed to add event to buffer:",e.message),!1}}},{key:"checkSmartHarvestTrigger",value:function(){var e=this.currentPayloadSize/this.maxPayloadSize,t=this.totalEvents/this.maxEventsPerBatch,r=this.currentPayloadSize>=this.overflowPayloadThreshold,i=this.totalEvents>=this.overflowEventThreshold;if(r||i){var a=r?"payload ".concat(this.currentPayloadSize,"/").concat(this.maxPayloadSize," bytes (").concat(Math.round(100*e),"%)"):"events ".concat(this.totalEvents,"/").concat(this.maxEventsPerBatch," (").concat(Math.round(100*t),"%)");n.A.warn("OVERFLOW PREVENTION: ".concat(a," - Emergency harvest triggered")),this.onSmartHarvestTrigger&&"function"==typeof this.onSmartHarvestTrigger&&this.onSmartHarvestTrigger("overflow",90)}else{var o=this.currentPayloadSize>=this.smartHarvestPayloadThreshold,s=this.totalEvents>=this.smartHarvestEventThreshold;(o||s)&&this.onSmartHarvestTrigger&&"function"==typeof this.onSmartHarvestTrigger&&this.onSmartHarvestTrigger("smart",60)}}},{key:"setSmartHarvestCallback",value:function(e){this.onSmartHarvestTrigger=e}},{key:"drain",value:function(){try{var e=this.buffer.splice(0);return this.totalEvents=0,this.currentPayloadSize=0,e}catch(e){return n.A.error("Failed to drain events from buffer:",e.message),[]}}},{key:"isEmpty",value:function(){return 0===this.totalEvents}},{key:"size",value:function(){return this.totalEvents}},{key:"clear",value:function(){this.buffer=[],this.totalEvents=0}},{key:"makeRoom",value:function(e){if(e>this.maxPayloadSize)n.A.error("Event dropped: Event size exceeds maximum payload size.");else for(;(this.totalEvents>=this.maxEventsPerBatch||this.currentPayloadSize+e>=this.maxPayloadSize)&&this.buffer.length>0;){var t=this.buffer.shift(),r=(0,a.Q3)(t);this.totalEvents--,this.currentPayloadSize-=r,n.A.warn("Event buffer full, oldest event removed.")}}}],t&&s(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}()},374(e,t,r){r.d(t,{n:()=>k});var n=r(431),i=r(413),a=r(481),o=r(347),s=r(51),u=r(302),c=r(144);function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function h(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach(function(t){d(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function d(e,t,r){return(t=T(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||p(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=p(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function p(e,t){if(e){if("string"==typeof e)return m(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?m(e,t):void 0}}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function b(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function a(r,n,i,a){var u=n&&n.prototype instanceof s?n:s,c=Object.create(u.prototype);return g(c,"_invoke",function(r,n,i){var a,s,u,c=0,l=i||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return a=t,s=0,u=e,h.n=r,o}};function d(r,n){for(s=r,u=n,t=0;!f&&c&&!i&&t<l.length;t++){var i,a=l[t],d=h.p,y=a[2];r>3?(i=y===n)&&(u=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=d&&((i=r<2&&d<a[1])?(s=0,h.v=n,h.n=a[1]):d<y&&(i=r<3||a[0]>n||n>y)&&(a[4]=r,a[5]=n,h.n=y,s=0))}if(i||r>1)return o;throw f=!0,n}return function(i,l,y){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,y),s=l,u=y;(t=s<2?e:u)||!f;){a||(s?s<3?(s>1&&(h.n=-1),d(s,u)):h.n=u:h.v=u);try{if(c=2,a){if(s||(i="next"),t=a[i]){if(!(t=t.call(a,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(u=TypeError("The iterator does not provide a '"+i+"' method"),s=1);a=e}else if((t=(f=h.n<0)?u:r.call(n,h))!==o)break}catch(t){a=e,s=1,u=t}finally{c=1}}return{value:t,done:f}}}(r,i,a),!0),c}var o={};function s(){}function u(){}function c(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(g(t={},n,function(){return this}),t),f=c.prototype=s.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,g(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,g(f,"constructor",c),g(c,"constructor",u),u.displayName="GeneratorFunction",g(c,i,"GeneratorFunction"),g(f),g(f,i,"Generator"),g(f,n,function(){return this}),g(f,"toString",function(){return"[object Generator]"}),(b=function(){return{w:a,m:h}})()}function g(e,t,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}g=function(e,t,r,n){function a(t,r){g(e,t,function(e){return this._invoke(t,r,e)})}t?i?i(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},g(e,t,r,n)}function A(e,t,r,n,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function S(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var a=e.apply(t,r);function o(e){A(a,n,i,o,s,"next",e)}function s(e){A(a,n,i,o,s,"throw",e)}o(void 0)})}}function E(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,T(n.key),n)}}function T(e){var t=function(e){if("object"!=l(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=l(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==l(t)?t:t+""}var k=function(){return e=function e(t){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.eventBuffer=t,this.retryQueueHandler=new i.u,this.httpClient=new a.X,this.fallBackUrl="",this.retryCount=0,this.eventBuffer instanceof n.t&&this.eventBuffer.setSmartHarvestCallback(function(e,t){return r.triggerSmartHarvest(e,t)}),this.isStarted=!1,this.currentTimerId=null,this.harvestCycle=s.A.INTERVAL,this.isHarvesting=!1,this.qoeCycleCount=1,this.forceNextQoeCycle=!1,this.beforeDrainCallback=null,this._lastSentQoeKpis={},this.setupPageLifecycleHandlers()},t=[{key:"startScheduler",value:function(){this.isStarted?c.A.warn("Harvest scheduler is already started"):(this.isStarted=!0,c.A.notice("Starting harvest scheduler",{harvestCycle:this.harvestCycle,eventBufferSize:this.eventBuffer?this.eventBuffer.size():0}),this.scheduleNextHarvest())}},{key:"stopScheduler",value:function(){this.isStarted&&(this.isStarted=!1,this.currentTimerId&&(clearTimeout(this.currentTimerId),this.currentTimerId=null),c.A.notice("Harvest scheduler stopped"))}},{key:"triggerSmartHarvest",value:(d=S(b().m(function e(t,r){var n;return b().w(function(e){for(;;)switch(e.p=e.n){case 0:if(c.A.notice("".concat(t," harvest triggered at ").concat(r,"% threshold"),{type:t,threshold:r}),this.eventBuffer&&!this.eventBuffer.isEmpty()){e.n=1;break}return e.a(2);case 1:return this.currentTimerId&&(clearTimeout(this.currentTimerId),this.currentTimerId=null),e.p=2,e.n=3,this.triggerHarvest({});case 3:e.n=5;break;case 4:e.p=4,n=e.v,c.A.error("".concat(t," harvest failed:"),n.message);case 5:return e.p=5,this.isStarted&&this.scheduleNextHarvest(),e.f(5);case 6:return e.a(2)}},e,this,[[2,4,5,6]])})),function(e,t){return d.apply(this,arguments)})},{key:"scheduleNextHarvest",value:function(){var e=this;if(this.isStarted){var t=this.harvestCycle;this.currentTimerId=setTimeout(function(){return e.onHarvestInterval()},t)}}},{key:"onHarvestInterval",value:(f=S(b().m(function e(){var t,r,n;return b().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,t=this.eventBuffer&&!this.eventBuffer.isEmpty(),r=this.retryQueueHandler&&this.retryQueueHandler.getQueueSize()>0,t||r){e.n=1;break}return e.a(2);case 1:return e.n=2,this.triggerHarvest({});case 2:e.n=4;break;case 3:e.p=3,n=e.v,c.A.error("Error during scheduled harvest:",n.message);case 4:return e.p=4,this.scheduleNextHarvest(),e.f(4);case 5:return e.a(2)}},e,this,[[0,3,4,5]])})),function(){return f.apply(this,arguments)})},{key:"triggerHarvest",value:(l=S(b().m(function e(){var t,r,n,i,a,u=arguments;return b().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t=u.length>0&&void 0!==u[0]?u[0]:{},!this.isHarvesting){e.n=1;break}return e.a(2,{success:!1,reason:"harvest_in_progress"});case 1:return this.isHarvesting=!0,e.p=2,r=this.drainEvents(t),t.isFinalHarvest&&(n=s.A.MAX_BEACON_SIZE,(0,o.Q3)(r)>n&&(r=this.trimEventsToFit(r,n))),e.n=3,this.sendChunk(r,t,!0);case 3:return i=e.v,e.a(2,{success:i.success,totalChunks:1,results:[i]});case 4:return e.p=4,a=e.v,c.A.error("Harvest cycle failed:",a.message),this.handleHarvestFailure(a),e.a(2,{success:!1,error:a.message,consecutiveFailures:this.consecutiveFailures});case 5:return e.p=5,this.isHarvesting=!1,e.f(5);case 6:return e.a(2)}},e,this,[[2,4,5,6]])})),function(){return l.apply(this,arguments)})},{key:"trimEventsToFit",value:function(e,t){if(0===e.length)return e;for(var r=[],n=0,i=e.length-1;i>=0;i--){var a=e[i],s=(0,o.Q3)({ins:[a].concat(r)});s>t||(r.unshift(a),n=s)}var u=e.length-r.length;if(u>0){var l=e.slice(0,u);c.A.warn("Discarded ".concat(u," events to fit beacon size limit"),{originalCount:e.length,trimmedCount:r.length,finalSize:n,maxSize:t}),this.retryQueueHandler&&this.retryQueueHandler.addFailedEvents(l)}return r}},{key:"drainEvents",value:function(){var e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=null!==(e=null===(t=window.NRVIDEO)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.qoeIntervalFactor)&&void 0!==e?e:1,i=!!r.isFinalHarvest||this.forceNextQoeCycle,a=(this.qoeCycleCount-1)%n==0||i;if(this.forceNextQoeCycle&&(this.forceNextQoeCycle=!1),this.beforeDrainCallback&&"function"==typeof this.beforeDrainCallback)try{this.beforeDrainCallback()}catch(p){c.A.error("Before drain callback failed:",p.message)}var l,f=this.eventBuffer.drain();if(a)l=f;else{l=[];var h,d=v(f);try{for(d.s();!(h=d.n()).done;){var p=h.value;p.actionName===u.A.Events.QOE_AGGREGATE?this.eventBuffer.add(p):l.push(p)}}catch(e){d.e(e)}finally{d.f()}}this.qoeCycleCount++;for(var m=l.length-1;m>=0;m--){var b=l[m];b.actionName===u.A.Events.QOE_AGGREGATE&&(!i&&this._qoeKpisUnchanged(b)?l.splice(m,1):this._saveQoeKpis(b))}var g=y(l),A=(0,o.Q3)(l);if(this.retryQueueHandler&&this.retryQueueHandler.getQueueSize()>0){var S=s.A.MAX_PAYLOAD_SIZE-A,E=s.A.MAX_EVENTS_PER_BATCH-g.length;if(S>0&&E>0){var T=this.retryQueueHandler.getRetryEventsToFit(S,E);T.length>0&&(g=[].concat(y(T),y(g)))}}return g}},{key:"sendChunk",value:(r=S(b().m(function e(t,r,n){var i,a,s=this;return b().w(function(e){for(;;)if(0===e.n)return i=(0,o.c$)(this.fallBackUrl),a={url:i,payload:{body:{ins:t}},options:h(h({},r),{},{isLastChunk:n})},e.a(2,new Promise(function(e){s.httpClient.send(a,function(r){r.retry?s.handleRequestFailure(t):(s.retryCount=0,s.fallBackUrl=""),e({success:!r.retry,status:r.status,error:r.error,chunk:t,eventCount:t.length})})}))},e,this)})),function(e,t,n){return r.apply(this,arguments)})},{key:"handleRequestFailure",value:function(e){var t;this.retryQueueHandler.addFailedEvents(e),"US"===(null===(t=window.NRVIDEO)||void 0===t||null===(t=t.info)||void 0===t?void 0:t.region)&&(this.retryCount++,this.retryCount>5?(this.retryCount=0,this.fallBackUrl=""):this.retryCount>=2&&(this.fallBackUrl=s.A.COLLECTOR.US[1]))}},{key:"handleHarvestFailure",value:function(e){this.consecutiveFailures++,c.A.warn("Harvest failure handled",{error:e.message,consecutiveFailures:this.consecutiveFailures})}},{key:"updateHarvestInterval",value:function(e){"number"!=typeof e&&isNaN(e)?c.A.warn("Invalid newInterval provided to updateHarvestInterval"):e<1e3||e>3e5?c.A.warn("newInterval out of bounds (1000-300000), ignoring"):this.harvestCycle!==e&&(this.harvestCycle=e,c.A.notice("Updated harvestCycle:",this.harvestCycle),this.currentTimerId&&(clearTimeout(this.currentTimerId),this.currentTimerId=null),this.isStarted&&this.scheduleNextHarvest())}},{key:"setupPageLifecycleHandlers",value:function(){var e=this,t=!1,r=function(){t||(t=!0,e.triggerHarvest({isFinalHarvest:!0,force:!0}))};document.addEventListener("visibilitychange",function(){document.hidden&&r()}),window.addEventListener("pagehide",function(){r()}),window.addEventListener("beforeunload",function(){r()})}},{key:"_qoeKpisUnchanged",value:function(e){var t=this._lastSentQoeKpis[e.viewId];if(!t)return!1;var r,n=v(s.A.QOE_KPI_KEYS);try{for(n.s();!(r=n.n()).done;){var i=r.value;if(e[i]!==t[i])return!1}}catch(e){n.e(e)}finally{n.f()}return!0}},{key:"_saveQoeKpis",value:function(e){var t,r={},n=v(s.A.QOE_KPI_KEYS);try{for(n.s();!(t=n.n()).done;){var i=t.value;r[i]=e[i]}}catch(e){n.e(e)}finally{n.f()}this._lastSentQoeKpis[e.viewId]=r}}],t&&E(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r,l,f,d}()},144(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(e){var t=function(e){if("object"!=n(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}r.d(t,{A:()=>l});var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,r=[{key:"error",value:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];s(r,e.Levels.ERROR,"darkred")}},{key:"warn",value:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];s(r,e.Levels.WARNING,"darkorange")}},{key:"notice",value:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];s([].slice.call(arguments),e.Levels.NOTICE,"darkcyan")}},{key:"debug",value:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];s(r,e.Levels.DEBUG,"indigo")}},{key:"debugCommonVideoEvents",value:function(t,r,n){try{if(e.level<=e.Levels.DEBUG){n=n||function(t){e.debug("Event: "+t.type)};var i=["canplay","buffering","waiting","ended","play","playing","pause","resume","error","abort","seek","seeking","seeked","stalled","dispose","loadeddata","loadstart","loadedmetadata"];r&&(null===r[0]?(r.shift(),i=r):i=i.concat(r));for(var a=0;a<i.length;a++)"function"==typeof t?t.call(window,i[a],n):t.on?t.on(i[a],n):t.addEventListener?t.addEventListener(i[a],n):t.addEventHandler?t.addEventHandler(i[a],n):e.warn("debugCommonVideoEvents: No common listener function found for ",t)}}catch(t){e.warn(t)}}}],null&&i(t.prototype,null),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r}();function s(e,t,r){t=t||o.Levels.NOTICE,r=r||"darkcyan";var n,i,a=o.prefix;o.includeTime&&(a+="["+("0"+(n=new Date).getDate()).slice(-2)+":"+("0"+n.getMinutes()).slice(-2)+":"+("0"+n.getSeconds()).slice(-2)+"."+("00"+n.getMilliseconds()).slice(-3)+"] "),a+=function(e){return c[e]}(t)+":",o.level<=t&&t!==o.Levels.SILENT&&(!o.colorful||"undefined"!=typeof document&&document.documentMode?u(e,a):(i=t===o.Levels.ERROR&&console.error?console.error:t===o.Levels.WARNING&&console.warn?console.warn:t===o.Levels.DEBUG&&console.debug&&null==window.cast?console.debug:console.log,a="%c"+a,e.splice(0,0,a,"color: "+r),i.apply(console,e)))}function u(e,t){if(e instanceof Array)for(var r in e)u(e[r],t);else"string"==typeof e?console.log(t+" "+e):(console.log(t+"↵"),console.log(e))}o.Levels={SILENT:5,ERROR:4,WARNING:3,NOTICE:2,DEBUG:1,ALL:0},o.level=o.Levels.ERROR,o.colorful=!0,o.includeTime=!0,o.prefix="[nrvideo]";var c={4:"e",3:"w",2:"n",1:"d"};!function(){if("undefined"!=typeof window&&window.location&&window.location.search){var e=/\?.*&*nrvideo-debug=(.+)/i.exec(window.location.search);null!==e&&("true"===e[1]?o.level=o.Levels.ALL:o.level=e[1]),null!==/\?.*&*nrvideo-colors=false/i.exec(window.location.search)&&(o.colorful=!1)}}();const l=o},481(e,t,r){r.d(t,{X:()=>p});var n=r(347),i=r(144);function a(e,t){return t&&0!==t.length?t.reduce(function(e,t){var r;try{if(t.regex instanceof RegExp){var n=t.regex.flags.includes("g")?t.regex.flags:t.regex.flags+"g";r=new RegExp(t.regex.source,n)}else r=new RegExp(t.regex,"g")}catch(r){return i.A.warn("applyObfuscationRules: invalid regex, skipping rule:",t.regex,r.message),e}return e.replace(r,t.replacement)},e):e}function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach(function(t){c(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function c(e,t,r){return(t=v(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function a(r,n,i,a){var u=n&&n.prototype instanceof s?n:s,c=Object.create(u.prototype);return f(c,"_invoke",function(r,n,i){var a,s,u,c=0,l=i||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return a=t,s=0,u=e,h.n=r,o}};function d(r,n){for(s=r,u=n,t=0;!f&&c&&!i&&t<l.length;t++){var i,a=l[t],d=h.p,y=a[2];r>3?(i=y===n)&&(u=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=d&&((i=r<2&&d<a[1])?(s=0,h.v=n,h.n=a[1]):d<y&&(i=r<3||a[0]>n||n>y)&&(a[4]=r,a[5]=n,h.n=y,s=0))}if(i||r>1)return o;throw f=!0,n}return function(i,l,y){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,y),s=l,u=y;(t=s<2?e:u)||!f;){a||(s?s<3?(s>1&&(h.n=-1),d(s,u)):h.n=u:h.v=u);try{if(c=2,a){if(s||(i="next"),t=a[i]){if(!(t=t.call(a,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(u=TypeError("The iterator does not provide a '"+i+"' method"),s=1);a=e}else if((t=(f=h.n<0)?u:r.call(n,h))!==o)break}catch(t){a=e,s=1,u=t}finally{c=1}}return{value:t,done:f}}}(r,i,a),!0),c}var o={};function s(){}function u(){}function c(){}t=Object.getPrototypeOf;var h=[][n]?t(t([][n]())):(f(t={},n,function(){return this}),t),d=c.prototype=s.prototype=Object.create(h);function y(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,f(e,i,"GeneratorFunction")),e.prototype=Object.create(d),e}return u.prototype=c,f(d,"constructor",c),f(c,"constructor",u),u.displayName="GeneratorFunction",f(c,i,"GeneratorFunction"),f(d),f(d,i,"Generator"),f(d,n,function(){return this}),f(d,"toString",function(){return"[object Generator]"}),(l=function(){return{w:a,m:y}})()}function f(e,t,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}f=function(e,t,r,n){function a(t,r){f(e,t,function(e){return this._invoke(t,r,e)})}t?i?i(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},f(e,t,r,n)}function h(e,t,r,n,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function d(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var a=e.apply(t,r);function o(e){h(a,n,i,o,s,"next",e)}function s(e){h(a,n,i,o,s,"throw",e)}o(void 0)})}}function y(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,v(n.key),n)}}function v(e){var t=function(e){if("object"!=o(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==o(t)?t:t+""}var p=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},t=[{key:"send",value:(c=d(l().m(function e(t,r){var n,a,o,s,u,c;return l().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n=t.url,a=t.payload,o=t.options,s=void 0===o?{}:o,e.p=1,n&&a){e.n=2;break}throw new Error("URL and payload are required");case 2:return u={url:n,payload:a,options:s,callback:r},e.n=3,this.executeRequest(u);case 3:e.n=5;break;case 4:e.p=4,c=e.v,i.A.error("Failed to send request:",c.message),r({retry:!1,status:0,error:c.message});case 5:return e.a(2)}},e,this,[[1,4]])})),function(e,t){return c.apply(this,arguments)})},{key:"executeRequest",value:(s=d(l().m(function e(t){var r,n,i,o,s,u,c,f,h,d,y,v;return l().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=t.url,n=t.payload,i=t.options,t.callback,o=Date.now(),e.p=1,u=a(JSON.stringify(n.body),null===(s=window.NRVIDEO)||void 0===s||null===(s=s.config)||void 0===s?void 0:s.obfuscate),!i.isFinalHarvest||!navigator.sendBeacon){e.n=3;break}return e.n=2,this.sendWithBeacon(r,u);case 2:return c=e.v,f={success:c,status:c?204:0},this.handleRequestComplete(t,f,o),e.a(2);case 3:return e.n=4,this.fetchWithTimeout(r,{method:"POST",body:u,headers:{"Content-Type":"application/json"},keepalive:i.isFinalHarvest},1e4);case 4:h=e.v,d={success:h.ok,status:h.status,statusText:h.statusText},this.handleRequestComplete(t,d,o),e.n=6;break;case 5:e.p=5,v=e.v,y={success:!1,status:0,error:v.message},this.handleRequestComplete(t,y,o);case 6:return e.a(2)}},e,this,[[1,5]])})),function(e){return s.apply(this,arguments)})},{key:"handleRequestComplete",value:function(e,t){(0,e.callback)({retry:!t.success&&(0===t.status||(0,n.Sc)(t.status)),status:t.status,error:t.error})}},{key:"sendWithBeacon",value:(o=d(l().m(function e(t,r){var n;return l().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.a(2,navigator.sendBeacon(t,r));case 1:return e.p=1,n=e.v,i.A.warn("sendBeacon failed, falling back to fetch:",n.message),e.a(2,!1)}},e,null,[[0,1]])})),function(e,t){return o.apply(this,arguments)})},{key:"fetchWithTimeout",value:(r=d(l().m(function e(t,r,n){var i,a,o,s;return l().w(function(e){for(;;)switch(e.p=e.n){case 0:return i=new AbortController,a=setTimeout(function(){return i.abort()},n),e.p=1,e.n=2,fetch(t,u(u({},r),{},{signal:i.signal}));case 2:return o=e.v,clearTimeout(a),e.a(2,o);case 3:if(e.p=3,s=e.v,clearTimeout(a),"AbortError"!==s.name){e.n=4;break}throw new Error("Request timeout after ".concat(n,"ms"));case 4:throw s;case 5:return e.a(2)}},e,null,[[1,3]])})),function(e,t,n){return r.apply(this,arguments)})}],t&&y(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r,o,s,c}()},413(e,t,r){r.d(t,{u:()=>v});var n=r(144),i=r(347),a=r(51);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach(function(t){c(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function c(e,t,r){return(t=h(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,h(n.key),n)}}function h(e){var t=function(e){if("object"!=o(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==o(t)?t:t+""}var d=a.A.MAX_PAYLOAD_SIZE,y=a.A.MAX_EVENTS_PER_BATCH,v=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.retryQueue=[],this.maxQueueSize=y,this.maxQueueSizeBytes=d},(t=[{key:"addFailedEvents",value:function(e){try{var t=Array.isArray(e)?e:[e];n.A.notice("Adding ".concat(t.length," failed events to retry queue"),{queueSizeBefore:this.retryQueue.length});var r,a=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return l(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}(t);try{for(a.s();!(r=a.n()).done;){var o=r.value;this.retryQueue.length>=this.maxQueueSize&&this.evictOldestEvent();for(var s=(0,i.Q3)(o);(0,i.Q3)(this.retryQueue)+s>this.maxQueueSizeBytes;)this.evictOldestEvent();this.retryQueue.push(u({},o))}}catch(e){a.e(e)}finally{a.f()}}catch(e){n.A.error("Failed to add events to retry queue:",e.message)}}},{key:"discardEvent",value:function(e,t){n.A.warn("Discarded event",{reason:t,eventType:e.eventType})}},{key:"evictOldestEvent",value:function(){if(this.retryQueue.length>0){var e=this.retryQueue.shift();this.discardEvent(e,"Queue full - evicted oldest")}}},{key:"getRetryEventsToFit",value:function(e,t){for(var r=[],n=0,a=0,o=this.retryQueue.length-1;o>=0;o--){var s=this.retryQueue[o];if(a>=t)break;var u=(0,i.Q3)(s);if(n+u>e)break;r.unshift(s),n+=u,a++,this.retryQueue.splice(o,1)}return r}},{key:"getQueueSize",value:function(){return this.retryQueue.length}},{key:"clear",value:function(){this.retryQueue=[]}}])&&f(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}()},302(e,t,r){r.d(t,{A:()=>m});var n=r(330),i=r(568),a=r(455),o=r(51),s=r(487),u=r(144);function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,f(n.key),n)}}function f(e){var t=function(e){if("object"!=c(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:t+""}function h(e,t,r){return t=y(t),function(e,t){if(t&&("object"==c(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,d()?Reflect.construct(t,r||[],y(e).constructor):t.apply(e,r))}function d(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(d=function(){return!!e})()}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}var p=function(e){function t(e){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=h(this,t)).customData={},r.heartbeat=null,r.parentTracker=null,r._trackerReadyChrono=new a.A,r._trackerReadyChrono.start(),r._actionTable=o.A.ACTION_TABLE,r._actionAdTable=o.A.ACTION_AD_TABLE,e=e||{},r.setOptions(e),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}(t,e),r=t,(i=[{key:"setOptions",value:function(e){e&&(e.parentTracker&&(this.parentTracker=e.parentTracker),e.customData&&(this.customData=e.customData),e.heartbeat&&(this.heartbeat=e.heartbeat))}},{key:"dispose",value:function(){this.unregisterListeners()}},{key:"registerListeners",value:function(){}},{key:"unregisterListeners",value:function(){}},{key:"getHeartbeat",value:function(){return this.state._isAd?2e3:this.heartbeat?this.heartbeat:this.parentTracker&&this.parentTracker.heartbeat?this.parentTracker.heartbeat:3e4}},{key:"startHeartbeat",value:function(){this._heartbeatInterval=setInterval(this.sendHeartbeat.bind(this),Math.max(this.getHeartbeat(),2e3))}},{key:"stopHeartbeat",value:function(){this._heartbeatInterval&&clearInterval(this._heartbeatInterval)}},{key:"sendHeartbeat",value:function(e){this.sendVideoAction(t.Events.HEARTBEAT,e)}},{key:"getAttributes",value:function(e,t){for(var r in(e=e||{}).trackerName=this.getTrackerName(),e.trackerVersion=this.getTrackerVersion(),e.coreVersion=n.rE,e.timeSinceTrackerReady=this._trackerReadyChrono.getDeltaTime(),this.customData)e[r]=this.customData[r];return null!=document.hidden&&(e.isBackgroundEvent=document.hidden),e}},{key:"getTrackerVersion",value:function(){return n.rE}},{key:"getTrackerName",value:function(){return"base-tracker"}},{key:"sendVideoAction",value:function(e,t){this.emit("VideoAction",e,this.getAttributes(t))}},{key:"sendVideoAdAction",value:function(e,t){this.emit("VideoAdAction",e,this.getAttributes(t))}},{key:"sendVideoErrorAction",value:function(e,t){var r=this.isAd()?"adError":"videoError";this.emit("VideoErrorAction",e,this.getAttributes(t,r))}},{key:"sendVideoCustomAction",value:function(e,t){this.emit("VideoCustomAction",e,this.getAttributes(t,"customAction"))}},{key:"setHarvestInterval",value:function(e){if(s.videoAnalyticsHarvester)try{s.videoAnalyticsHarvester.setHarvestInterval(e)}catch(e){return void u.A.error("Failed to set harvest interval:",e.message)}else u.A.error("VideoAnalyticsHarvester is not available")}}])&&l(r.prototype,i),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,i}(i.A);p.Events={HEARTBEAT:"HEARTBEAT",QOE_AGGREGATE:"QOE_AGGREGATE"};const m=p},347(e,t,r){r.d(t,{Q3:()=>s,Sc:()=>u,c$:()=>o,z8:()=>c});var n=r(330),i=r(144);function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function o(e){try{if(!window.NRVIDEO||!window.NRVIDEO.info)throw new Error("NRVIDEO info is not available.");var t=window.NRVIDEO.info,r=t.beacon,i=t.licenseKey,a=t.applicationID;if(!r||!i)throw new Error("Options object provided by New Relic is not correctly initialized");return a?"https://".concat(e||r,"/ins/1/").concat(i,"?a=").concat(a,"&v=").concat(n.rE,"&ref=").concat(window.location.href,"&ca=VA"):"https://".concat(e||r,"/ins/1/").concat(i,"?&v=").concat(n.rE,"&ref=").concat(window.location.href,"&ca=VA")}catch(e){return console.error(e.message),null}}function s(e){if("string"==typeof e&&e.length)return e.length;if("object"===a(e)){if("undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer&&e.byteLength)return e.byteLength;if("undefined"!=typeof Blob&&e instanceof Blob&&e.size)return e.size;if(!("undefined"!=typeof FormData&&e instanceof FormData))try{return function(e){try{var t;return null!==(t=JSON.stringify(e,(r=new WeakSet,function(e,t){if("object"===a(t)&&null!==t){if(r.has(t))return;r.add(t)}return t})))&&void 0!==t?t:""}catch(e){return i.A.error("Error stringifying value:",e.message),""}var r}(e).length}catch(e){return}}}function u(e){switch(e){case 408:case 429:case 500:return!0;case 401:case 403:case 404:return!1}return e>=502&&e<=504||e>=512&&e<=530}function c(e,t){return e&&Array.isArray(e)&&0!==e.length?t&&"object"===a(t)?e.reduce(function(e,r){return r in t&&(e[r]=t[r]),e},{}):{}:t}},330(e){e.exports={rE:"4.1.6"}}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,r),a.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.d(n,{default:()=>se});var i=r(144),a=r(487),o=r(51),s=r(302),u=r(347);function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}var l=["qoe"];function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function h(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach(function(t){d(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function d(e,t,r){return(t=function(e){var t=function(e){if("object"!=c(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{var r,n;if(!o.A.VALID_EVENT_TYPES.includes(e))return i.A.warn("Invalid event type provided to recordEvent",{eventType:e}),!1;if(null===(r=window)||void 0===r||null===(r=r.NRVIDEO)||void 0===r||!r.info)return;var c=window.NRVIDEO.info,f=c.appName,d=c.applicationID,y=t.qoe,v=function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],-1===t.indexOf(r)&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(t,l),p=y?h({},y):{},m=h(h({},d?{}:{appName:f}),{},{timestamp:Date.now(),timeSinceLoad:window.performance?window.performance.now()/1e3:null}),b=h(h({},v),{},{eventType:e},m),g=(0,u.z8)(o.A.QOE_AGGREGATE_KEYS,t),A=null;"VideoAction"===e&&(A=h(h(h({eventType:"VideoAction",actionName:s.A.Events.QOE_AGGREGATE,qoeAggregateVersion:"1.0.0"},p),g),m));var S=a.videoAnalyticsHarvester.addEvent(b);if(A&&null!==(n=window)&&void 0!==n&&null!==(n=n.NRVIDEO)&&void 0!==n&&null!==(n=n.config)&&void 0!==n&&n.qoeAggregate){var E=a.videoAnalyticsHarvester.addEvent(A);return S&&E}return S}catch(e){return i.A.error("Failed to record event:",e.message),!1}}function v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v(Object(r),!0).forEach(function(t){m(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function m(e,t,r){return(t=A(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(e){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b(e)}function g(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,A(n.key),n)}}function A(e){var t=function(e){if("object"!=b(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==b(t)?t:t+""}var S=o.A.COLLECTOR,E=new(function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},(t=[{key:"setConfiguration",value:function(e,t){return!!this.validateRequiredFields(e)&&!!this.validateConfigFields(t)&&(this.initializeGlobalConfig(e,t),i.A.notice("Video analytics configuration initialized successfully"),!0)}},{key:"validateRequiredFields",value:function(e){if(!e||"object"!==b(e))return i.A.error("Configuration must be an object"),!1;var t=e.licenseKey,r=e.appName,n=e.region,a=e.applicationID,o=e.beacon;if(!t)return i.A.error("licenseKey is required"),!1;if(a){if(!o)return i.A.error("beacon is required when applicationID is provided"),!1;if(!Object.values(S).flatMap(function(e){return e}).includes(o))return i.A.error("Invalid beacon: ".concat(o)),!1}else{if(!r||!n)return i.A.error("appName and region are required when applicationID is not provided"),!1;if(!S[n])return i.A.error("Invalid region: ".concat(n,". Valid regions are: ").concat(Object.keys(S).join(", "))),!1}return!0}},{key:"validateConfigFields",value:function(e){if(null==e)return!0;if("object"!==b(e)||Array.isArray(e))return i.A.error("config must be an object"),!1;var t=e.qoeAggregate,r=e.obfuscate;return void 0!==t&&"boolean"!=typeof t?(i.A.error("qoeAggregate must be a boolean"),!1):!(void 0!==r&&!Array.isArray(r)&&(i.A.error("obfuscate must be an array"),1))}},{key:"filterObfuscateRules",value:function(e){return e?e.filter(function(e){var t=void 0!==e.regex&&("string"==typeof e.regex||e.regex instanceof RegExp),r=void 0!==e.replacement&&"string"==typeof e.replacement;return!(!t||!r)||(i.A.warn("obfuscate rule missing required 'regex' (string|RegExp) and/or 'replacement' (string), skipping:",e),!1)}):[]}},{key:"sanitizeQoeIntervalFactor",value:function(e){return null==e?1:"number"==typeof e&&Number.isInteger(e)&&e>=1?e:(console.warn('[nrvideo] Invalid qoeIntervalFactor "'.concat(e,'" — must be a positive integer. Defaulting to 1.')),1)}},{key:"initializeGlobalConfig",value:function(e,t){var r,n=e.licenseKey,i=e.appName,a=e.region,s=e.beacon,u=e.applicationID;s="US"===a?o.A.COLLECTOR.US[0]:s||S[a],window.NRVIDEO={info:p(p({},a?{region:a}:{}),{},{beacon:s,licenseKey:n,applicationID:u},u?{}:{appName:i}),config:{qoeAggregate:null!==(r=null==t?void 0:t.qoeAggregate)&&void 0!==r&&r,qoeIntervalFactor:this.sanitizeQoeIntervalFactor(null==t?void 0:t.qoeIntervalFactor),obfuscate:this.filterObfuscateRules(null==t?void 0:t.obfuscate)}}}}])&&g(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}());function T(e){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},T(e)}function k(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function a(r,n,i,a){var u=n&&n.prototype instanceof s?n:s,c=Object.create(u.prototype);return w(c,"_invoke",function(r,n,i){var a,s,u,c=0,l=i||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return a=t,s=0,u=e,h.n=r,o}};function d(r,n){for(s=r,u=n,t=0;!f&&c&&!i&&t<l.length;t++){var i,a=l[t],d=h.p,y=a[2];r>3?(i=y===n)&&(u=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=d&&((i=r<2&&d<a[1])?(s=0,h.v=n,h.n=a[1]):d<y&&(i=r<3||a[0]>n||n>y)&&(a[4]=r,a[5]=n,h.n=y,s=0))}if(i||r>1)return o;throw f=!0,n}return function(i,l,y){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,y),s=l,u=y;(t=s<2?e:u)||!f;){a||(s?s<3?(s>1&&(h.n=-1),d(s,u)):h.n=u:h.v=u);try{if(c=2,a){if(s||(i="next"),t=a[i]){if(!(t=t.call(a,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(u=TypeError("The iterator does not provide a '"+i+"' method"),s=1);a=e}else if((t=(f=h.n<0)?u:r.call(n,h))!==o)break}catch(t){a=e,s=1,u=t}finally{c=1}}return{value:t,done:f}}}(r,i,a),!0),c}var o={};function s(){}function u(){}function c(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(w(t={},n,function(){return this}),t),f=c.prototype=s.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,w(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,w(f,"constructor",c),w(c,"constructor",u),u.displayName="GeneratorFunction",w(c,i,"GeneratorFunction"),w(f),w(f,i,"Generator"),w(f,n,function(){return this}),w(f,"toString",function(){return"[object Generator]"}),(k=function(){return{w:a,m:h}})()}function w(e,t,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}w=function(e,t,r,n){function a(t,r){w(e,t,function(e){return this._invoke(t,r,e)})}t?i?i(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},w(e,t,r,n)}function O(e,t,r,n,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function P(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?P(Object(r),!0).forEach(function(t){R(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):P(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function R(e,t,r){return(t=D(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function B(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,D(n.key),n)}}function D(e){var t=function(e){if("object"!=T(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=T(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==T(t)?t:t+""}var j=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},t=[{key:"addTracker",value:function(e,t){var r,n;null!=t&&t.info&&(r=t.info,n=null==t?void 0:t.config,E.setConfiguration(r,n)),e.on&&e.emit?(N.push(e),e.on("*",C),"function"==typeof e.trackerInit&&e.trackerInit()):i.A.error("Tried to load a non-tracker.",e)}},{key:"removeTracker",value:function(e){e.off("*",C),e.dispose();var t=N.indexOf(e);-1!==t&&N.splice(t,1)}},{key:"getTrackers",value:function(){return N}},{key:"send",value:function(e,t,r){return y(e,_({actionName:t},r))}},{key:"sendError",value:function(e){return y("VideoErrorAction",_({actionName:"ERROR"},e))}},{key:"forceHarvest",value:(n=k().m(function e(){var t,n,a;return k().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,t=r(487),n=t.videoAnalyticsHarvester,e.n=1,n.forceHarvest();case 1:return e.a(2,e.v);case 2:return e.p=2,a=e.v,i.A.error("Failed to force harvest:",a.message),e.a(2,{success:!1,error:a.message})}},e,null,[[0,2]])}),a=function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(e){O(a,r,i,o,s,"next",e)}function s(e){O(a,r,i,o,s,"throw",e)}o(void 0)})},function(){return a.apply(this,arguments)})}],t&&B(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,a}(),N=[];function C(e){try{var t=function(e){var t={};for(var r in e)null!==e[r]&&void 0!==e[r]&&(t[r]=e[r]);return t}(e.data);i.A.level<=i.A.Levels.DEBUG?i.A.notice("Sent",e.type,t):i.A.notice("Sent",e.type),j.send(e.eventType,e.type,t)}catch(e){i.A.error("Error in event handler:",e.message)}}const I=j;var V=r(455),H=r(568);function L(e){return L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},L(e)}function x(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a,o,s=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Q(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Q(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Q(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function F(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,G(n.key),n)}}function G(e){var t=function(e){if("object"!=L(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=L(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==L(t)?t:t+""}const q=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.reset(),this._createdAt=Date.now(),this._hb=!0,this._acc=0,this._bufferAcc=0},(t=[{key:"reset",value:function(){this._viewSession=null,this._viewCount=0,this._isAd=!1,this.numberOfErrors=0,this.numberOfAds=0,this.numberOfVideos=0,this.totalPlaytime=0,this.weightedAverageBitrate=0,this.totalAdPlaytime=0,this.isAdBreak=!1,this.initialBufferingHappened=!1,this.startupTime=null,this.peakBitrate=0,this._lastBitrate=null,this._lastBitrateChangeTimestamp=null,this.partialAverageBitrate=0,this._totalBitrateDuration=0,this.hadStartupError=!1,this.hadPlaybackError=!1,this.totalRebufferingTime=0,this.resetFlags(),this.resetChronos()}},{key:"resetFlags",value:function(){this.isPlayerReady=!1,this.isRequested=!1,this.isStarted=!1,this.isPaused=!1,this.isSeeking=!1,this.isBuffering=!1,this.isPlaying=!1}},{key:"resetChronos",value:function(){this.timeSinceRequested=new V.A,this.timeSinceStarted=new V.A,this.timeSincePaused=new V.A,this.timeSinceSeekBegin=new V.A,this.timeSinceBufferBegin=new V.A,this.timeSinceAdBreakStart=new V.A,this.timeSinceLastDownload=new V.A,this.timeSinceLastHeartbeat=new V.A,this.timeSinceLastRenditionChange=new V.A,this.timeSinceLastAdQuartile=new V.A,this.timeSinceLastAd=new V.A,this.timeSinceLastError=new V.A,this.timeSinceLastAdError=new V.A,this.timeSinceResumed=new V.A,this.timeSinceSeekEnd=new V.A,this.playtimeSinceLastEvent=new V.A,this.customTimeSinceAttributes={},this.elapsedTime=new V.A,this.bufferElapsedTime=new V.A,this._totalAdPlaytime=new V.A}},{key:"isAd",value:function(){return this._isAd}},{key:"setIsAd",value:function(e){this._isAd=e}},{key:"setTimeSinceAttribute",value:function(e){this.customTimeSinceAttributes[e]=new V.A,this.customTimeSinceAttributes[e].start()}},{key:"removeTimeSinceAttribute",value:function(e){delete this.customTimeSinceAttributes[e]}},{key:"getViewSession",value:function(){if(!this._viewSession){var e=(new Date).getTime(),t=Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2);this._viewSession=e+"-"+t}return this._viewSession}},{key:"getViewId",value:function(){return this.getViewSession()+"-"+this._viewCount}},{key:"getStateAttributes",value:function(e){e=e||{},this.isAd()?(this.isRequested&&(e.timeSinceAdRequested=this.timeSinceRequested.getDeltaTime(),e.timeSinceLastAdHeartbeat=this.timeSinceLastHeartbeat.getDeltaTime()),this.isStarted&&(e.timeSinceAdStarted=this.timeSinceStarted.getDeltaTime()),this.isPaused&&(e.timeSinceAdPaused=this.timeSincePaused.getDeltaTime()),this.isBuffering&&(e.timeSinceAdBufferBegin=this.timeSinceBufferBegin.getDeltaTime()),this.isSeeking&&(e.timeSinceAdSeekBegin=this.timeSinceSeekBegin.getDeltaTime()),this.isAdBreak&&(e.timeSinceAdBreakBegin=this.timeSinceAdBreakStart.getDeltaTime()),this.numberOfErrors>0&&this.timeSinceLastAdError.startTime>0&&(e.timeSinceLastAdError=this.timeSinceLastAdError.getDeltaTime()),e.numberOfAds=this.numberOfAds):(this.isRequested&&(e.timeSinceRequested=this.timeSinceRequested.getDeltaTime(),e.timeSinceLastHeartbeat=this.timeSinceLastHeartbeat.getDeltaTime()),this.isStarted&&(e.timeSinceStarted=this.timeSinceStarted.getDeltaTime()),this.isPaused&&(e.timeSincePaused=this.timeSincePaused.getDeltaTime()),this.isBuffering&&(e.timeSinceBufferBegin=this.timeSinceBufferBegin.getDeltaTime()),this.isSeeking&&(e.timeSinceSeekBegin=this.timeSinceSeekBegin.getDeltaTime()),e.timeSinceLastAd=this.timeSinceLastAd.getDeltaTime(),this.numberOfErrors>0&&this.timeSinceLastError.startTime>0&&(e.timeSinceLastError=this.timeSinceLastError.getDeltaTime()),e.numberOfVideos=this.numberOfVideos),e.numberOfErrors=this.numberOfErrors,this.isAd()||(this.playtimeSinceLastEvent.startTime>0?e.playtimeSinceLastEvent=this.playtimeSinceLastEvent.getDeltaTime():e.playtimeSinceLastEvent=0,this.isPlaying?this.playtimeSinceLastEvent.start():this.playtimeSinceLastEvent.reset(),this.totalPlaytime+=e.playtimeSinceLastEvent,e.totalPlaytime=this.totalPlaytime);for(var t=0,r=Object.entries(this.customTimeSinceAttributes);t<r.length;t++){var n=x(r[t],2),i=n[0],a=n[1];e[i]=a.getDeltaTime()}return e}},{key:"getQoeAttributes",value:function(e){e=e||{};var t={};try{null!==this.startupTime&&(t.startupTime=this.startupTime),this.peakBitrate>0&&(t.peakBitrate=this.peakBitrate),t.hadStartupError=this.hadStartupError,t.hadPlaybackError=this.hadPlaybackError,t.totalRebufferingTime=this.totalRebufferingTime,t.rebufferingRatio=this.totalPlaytime>0?this.totalRebufferingTime/this.totalPlaytime*100:0,t.totalPlaytime=this.totalPlaytime,t.averageBitrate=this.weightedBitrate,t.numberOfErrors=this.numberOfErrors}catch(e){i.A.error("Failed to add attributes for QOE KPIs",e.message)}return e.qoe=t,e}},{key:"calculateBufferType",value:function(e){var t;return t=e?"initial":this.isSeeking?"seek":this.isPaused?"pause":"connection",i.A.debug("Buffer Type = "+t),t}},{key:"goViewCountUp",value:function(){this._viewCount++}},{key:"goPlayerReady",value:function(){return!this.isPlayerReady&&(this.isPlayerReady=!0,!0)}},{key:"goRequest",value:function(){return!this.isRequested&&(this.isRequested=!0,this.timeSinceLastAd.reset(),this.timeSinceRequested.start(),!0)}},{key:"goStart",value:function(){return!(!this.isRequested||this.isStarted||(this.isAd()?this.numberOfAds++:this.numberOfVideos++,this.isStarted=!0,this.isPlaying=!0,this.timeSinceStarted.start(),this.playtimeSinceLastEvent.start(),0))}},{key:"goEnd",value:function(){return!!this.isRequested&&(this.numberOfErrors=0,this.resetFlags(),this.timeSinceRequested.stop(),this.timeSinceStarted.stop(),this.playtimeSinceLastEvent.stop(),this.isPlaying=!1,!0)}},{key:"goPause",value:function(){return!(!this.isStarted||this.isPaused||(this.isPaused=!0,this.isPlaying=!1,this.timeSincePaused.start(),this.playtimeSinceLastEvent.stop(),this.timeSinceResumed.reset(),this.isBuffering&&(this._bufferAcc+=this.bufferElapsedTime.getDeltaTime()),this.elapsedTime.start(),0))}},{key:"goResume",value:function(){return!(!this.isStarted||!this.isPaused||(this.isPaused=!1,this.isPlaying=!0,this.timeSincePaused.stop(),this.timeSinceResumed.start(),this._hb?(this._acc=this.elapsedTime.getDeltaTime(),this._hb=!1):(this.isBuffering&&this.bufferElapsedTime.start(),this._acc+=this.elapsedTime.getDeltaTime()),0))}},{key:"goBufferStart",value:function(){return!(!this.isRequested||this.isBuffering||(this.isBuffering=!0,this.isPlaying=!1,this.timeSinceBufferBegin.start(),this.bufferElapsedTime.start(),0))}},{key:"goBufferEnd",value:function(){return!(!this.isRequested||!this.isBuffering||(this.isBuffering=!1,this.isPlaying=!0,this.timeSinceBufferBegin.stop(),this._hb?(this._bufferAcc=this.bufferElapsedTime.getDeltaTime(),this._hb=!1):this._bufferAcc+=this.bufferElapsedTime.getDeltaTime(),!this.isAd()&&this.initialBufferingHappened&&(this.totalRebufferingTime+=this.timeSinceBufferBegin.stopTime-this.timeSinceBufferBegin.startTime),0))}},{key:"goSeekStart",value:function(){return!(!this.isStarted||this.isSeeking||(this.isSeeking=!0,this.isPlaying=!1,this.timeSinceSeekBegin.start(),this.timeSinceSeekEnd.reset(),0))}},{key:"goSeekEnd",value:function(){return!(!this.isStarted||!this.isSeeking||(this.isSeeking=!1,this.isPlaying=!0,this.timeSinceSeekBegin.stop(),this.timeSinceSeekEnd.start(),0))}},{key:"goAdBreakStart",value:function(){return!this.isAdBreak&&(this.isAdBreak=!0,this.timeSinceAdBreakStart.start(),!0)}},{key:"goAdBreakEnd",value:function(){return!!this.isAdBreak&&(this.isRequested=!1,this.isAdBreak=!1,this.totalAdPlaytime=this.timeSinceAdBreakStart.getDeltaTime(),this.timeSinceAdBreakStart.stop(),!0)}},{key:"goDownload",value:function(){this.timeSinceLastDownload.start()}},{key:"goHeartbeat",value:function(){this.timeSinceLastHeartbeat.start()}},{key:"goRenditionChange",value:function(){this.timeSinceLastRenditionChange.start()}},{key:"goAdQuartile",value:function(){this.timeSinceLastAdQuartile.start()}},{key:"goError",value:function(){this.isError=!0,this.numberOfErrors++,this.isAd()?this.timeSinceLastAdError.start():(this.timeSinceLastError.start(),this.isStarted?this.hadPlaybackError=!0:this.hadStartupError=!0)}},{key:"goLastAd",value:function(){this.timeSinceLastAd.start()}},{key:"trackContentBitrateState",value:function(e){if(e&&"number"==typeof e){this.peakBitrate=Math.max(this.peakBitrate,e);var t=Date.now();if(!this.isPlaying){if(null!==this._lastBitrate&&null!==this._lastBitrateChangeTimestamp){var r=t-this._lastBitrateChangeTimestamp;r>0&&(this.partialAverageBitrate+=this._lastBitrate*r,this._totalBitrateDuration+=r),this._lastBitrateChangeTimestamp=null}return void(this._lastBitrate=e)}if(null===this._lastBitrateChangeTimestamp&&null!==this._lastBitrate&&(this._lastBitrateChangeTimestamp=t),null!==this._lastBitrate&&this._lastBitrate!==e&&null!==this._lastBitrateChangeTimestamp){var n=t-this._lastBitrateChangeTimestamp;n>0&&(this.partialAverageBitrate+=this._lastBitrate*n,this._totalBitrateDuration+=n),this._lastBitrateChangeTimestamp=t}null===this._lastBitrateChangeTimestamp&&(this._lastBitrateChangeTimestamp=t),this._lastBitrate=e;var i=this.partialAverageBitrate,a=this._totalBitrateDuration,o=t-this._lastBitrateChangeTimestamp;o>0&&(i+=e*o,a+=o),this.weightedBitrate=a>0?Math.round(i/a):e}}},{key:"resetViewIdTrackedState",value:function(){this.peakBitrate=0,this.partialAverageBitrate=0,this._totalBitrateDuration=0,this.startupTime=null,this._lastBitrate=null,this._lastBitrateChangeTimestamp=null}},{key:"clearTotalAdsTime",value:function(){i.A.debug("clear total ads time",this.totalAdTime),this._totalAdPlaytime.reset()}},{key:"totalAdTime",value:function(){return this._totalAdPlaytime.getDuration()}},{key:"startAdsTime",value:function(){return i.A.debug("startAdsTime"),this._totalAdPlaytime.start()}},{key:"stopAdsTime",value:function(){return i.A.debug("stopAdsTime"),this._totalAdPlaytime.stop()}},{key:"setStartupTime",value:function(e){null===this.startupTime&&(this.startupTime=Math.max(this.timeSinceRequested.getDeltaTime()-e,0))}}])&&F(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();var U=r(330);function z(e){return z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},z(e)}function M(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function K(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?M(Object(r),!0).forEach(function(t){W(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):M(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function W(e,t,r){return(t=X(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Y(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,X(n.key),n)}}function X(e){var t=function(e){if("object"!=z(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=z(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==z(t)?t:t+""}function Z(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Z=function(){return!!e})()}function $(e){return $=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},$(e)}function J(e,t){return J=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},J(e,t)}var ee=function(e){function t(e,r){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t,r){return t=$(t),function(e,t){if(t&&("object"==z(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Z()?Reflect.construct(t,r||[],$(e).constructor):t.apply(e,r))}(this,t)).state=new q,n.adsTracker=null,n._lastBufferType=null,n._userId=null,r=r||{},n.setOptions(r),e&&n.setPlayer(e,r.tag),i.A.notice("Tracker "+n.getTrackerName()+" v"+n.getTrackerVersion()+" is ready."),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&J(e,t)}(t,e),r=t,n=[{key:"setUserId",value:function(e){this._userId=e}},{key:"setOptions",value:function(e){e&&(e.adsTracker&&this.setAdsTracker(e.adsTracker),"boolean"==typeof e.isAd&&this.setIsAd(e.isAd),s.A.prototype.setOptions.apply(this,arguments))}},{key:"setPlayer",value:function(e,t){(this.player||this.tag)&&this.dispose(),"undefined"!=typeof document&&document.getElementById&&("string"==typeof e&&(e=document.getElementById(e)),"string"==typeof t&&(t=document.getElementById(t))),t=t||e,this.player=e,this.tag=t,this.registerListeners()}},{key:"isAd",value:function(){return this.state.isAd()}},{key:"setIsAd",value:function(e){this.state.setIsAd(e)}},{key:"setAdsTracker",value:function(e){this.disposeAdsTracker(),e&&(this.adsTracker=e,this.adsTracker.setIsAd(!0),this.adsTracker.parentTracker=this,this.adsTracker.on("*",te.bind(this)))}},{key:"disposeAdsTracker",value:function(){this.adsTracker&&(this.adsTracker.off("*",te),this.adsTracker.dispose())}},{key:"dispose",value:function(){this.stopHeartbeat(),this.disposeAdsTracker(),this.unregisterListeners(),this.player=null,this.tag=null}},{key:"registerListeners",value:function(){}},{key:"unregisterListeners",value:function(){}},{key:"getViewId",value:function(){return this.parentTracker?this.parentTracker.getViewId():this.state.getViewId()}},{key:"getViewSession",value:function(){return this.parentTracker?this.parentTracker.getViewSession():this.state.getViewSession()}},{key:"getVideoId",value:function(){return null}},{key:"getTitle",value:function(){return null}},{key:"isLive",value:function(){return null}},{key:"getBitrate",value:function(){return null}},{key:"getManifestBitrate",value:function(){return null}},{key:"getSegmentDownloadBitrate",value:function(){return null}},{key:"getNetworkDownloadBitrate",value:function(){return null}},{key:"getWebkitBitrate",value:function(){if(this.tag&&this.tag.webkitVideoDecodedByteCount){var e;if(this._lastWebkitBitrate){var t=(e=this.tag.webkitVideoDecodedByteCount)-this._lastWebkitBitrate,r=this.getHeartbeat()/1e3;e=Math.round(t/r*8)}return this._lastWebkitBitrate=this.tag.webkitVideoDecodedByteCount,e||null}}},{key:"getRenditionName",value:function(){return null}},{key:"getRenditionBitrate",value:function(){return null}},{key:"getRenditionShift",value:function(e){var t,r=this.getRenditionBitrate();return this.isAd()?(t=this._lastAdRendition,e&&(this._lastAdRendition=r)):(t=this._lastRendition,e&&(this._lastRendition=r)),r&&t?r>t?"up":r<t?"down":null:null}},{key:"getRenditionHeight",value:function(){return this.tag?this.tag.videoHeight:null}},{key:"getRenditionWidth",value:function(){return this.tag?this.tag.videoWidth:null}},{key:"getDuration",value:function(){return this.tag?this.tag.duration:null}},{key:"getPlayhead",value:function(){return this.tag?this.tag.currentTime:null}},{key:"getLanguage",value:function(){return null}},{key:"getSrc",value:function(){return this.tag?this.tag.currentSrc:null}},{key:"getPlayrate",value:function(){return this.tag?this.tag.playbackRate:null}},{key:"isMuted",value:function(){return this.tag?this.tag.muted:null}},{key:"isFullscreen",value:function(){return null}},{key:"getCdn",value:function(){return null}},{key:"getPlayerName",value:function(){return this.getTrackerName()}},{key:"getPlayerVersion",value:function(){return U.rE}},{key:"getFps",value:function(){return null}},{key:"isAutoplayed",value:function(){return this.tag?this.tag.autoplay:null}},{key:"getPreload",value:function(){return this.tag?this.tag.preload:null}},{key:"getAdQuartile",value:function(){return null}},{key:"getAdPosition",value:function(){return this.parentTracker?this.parentTracker.state.isStarted?"mid":"pre":null}},{key:"getAdPartner",value:function(){return null}},{key:"getAdCreativeId",value:function(){return null}},{key:"getInstrumentationProvider",value:function(){return null}},{key:"getInstrumentationName",value:function(){return null}},{key:"getInstrumentationVersion",value:function(){return null}},{key:"getAttributes",value:function(e,t){if(void 0===(e=s.A.prototype.getAttributes.apply(this,arguments)).isAd&&(e.isAd=this.isAd()),e.viewSession=this.getViewSession(),e.viewId=this.getViewId(),e.playerName=this.getPlayerName(),e.playerVersion=this.getPlayerVersion(),e["instrumentation.provider"]=this.getInstrumentationProvider(),e["instrumentation.name"]=this.getInstrumentationName(),e["instrumentation.version"]=this.getInstrumentationVersion(),e["enduser.id"]=this._userId,e.src="Browser","customAction"===t)return e;try{e.pageUrl=window.location.href}catch(e){}for(var r in this.isAd()?(e.adId=this.getVideoId(),e.adTitle=this.getTitle(),e.adSrc=this.getSrc(),e.adCdn=this.getCdn(),this.state.isStarted&&(e.adBitrate=this.getBitrate()||0),e.adRenditionName=this.getRenditionName(),e.adRenditionHeight=this.getRenditionHeight(),e.adRenditionWidth=this.getRenditionWidth(),e.adDuration=this.getDuration(),e.adPlayhead=this.getPlayhead(),e.adLanguage=this.getLanguage(),e.adIsMuted=this.isMuted(),e.adFps=this.getFps(),e.adPosition=this.getAdPosition(),e.adCreativeId=this.getAdCreativeId(),e.adPartner=this.getAdPartner()):(e.contentId=this.getVideoId(),e.contentTitle=this.getTitle(),e.contentSrc=this.getSrc(),e.contentCdn=this.getCdn(),e.contentPlayhead=this.getPlayhead(),e.contentIsLive=this.isLive(),this.state.isStarted&&(e.contentBitrate=this.getBitrate()||0,e.contentManifestBitrate=this.getManifestBitrate()||0,e.contentSegmentDownloadBitrate=this.getSegmentDownloadBitrate()||0,e.contentNetworkDownloadBitrate=this.getNetworkDownloadBitrate()||0),e.contentRenditionName=this.getRenditionName(),e.contentRenditionHeight=this.getRenditionHeight(),e.contentRenditionWidth=this.getRenditionWidth(),e.contentDuration=this.getDuration(),e.contentLanguage=this.getLanguage(),e.contentPlayrate=this.getPlayrate(),e.contentIsFullscreen=this.isFullscreen(),e.contentIsMuted=this.isMuted(),e.contentIsAutoplayed=this.isAutoplayed(),e.contentPreload=this.getPreload(),e.contentFps=this.getFps(),null!=this.adsTracker&&this.adsTracker.state.totalAdPlaytime>0&&(e.totalAdPlaytime=this.adsTracker.state.totalAdPlaytime)),this.state.getStateAttributes(e),this.state.isStarted&&!this.isAd()&&this.state.trackContentBitrateState(e.contentBitrate),this.customData)e[r]=this.customData[r];return this.addQoeAttributes(e),e}},{key:"addQoeAttributes",value:function(e){var t=(e=this.state.getQoeAttributes(e)).qoe;for(var r in this.customData)t[r]=this.customData[r]}},{key:"sendCustom",value:function(e,t,r){r=r||{},this.sendVideoCustomAction(e,r),this.state.setTimeSinceAttribute(t)}},{key:"sendPlayerReady",value:function(e){this.state.goPlayerReady()&&(e=e||{},this.sendVideoAction(t.Events.PLAYER_READY,e))}},{key:"sendRequest",value:function(e){var r;this.state.goRequest()&&(this.isAd()?(r=t.Events.AD_REQUEST,this.sendVideoAdAction(r,e)):(r=t.Events.CONTENT_REQUEST,this.sendVideoAction(r,e)))}},{key:"sendStart",value:function(e){var r=this;if(this.state.goStart()){var n;if(this.isAd())n=t.Events.AD_START,this.parentTracker&&(this.parentTracker.state.isPlaying=!1),this.sendVideoAdAction(n,e),this.state.startAdsTime();else{n=t.Events.CONTENT_START;var i,o=0;this.adsTracker&&((this.adsTracker.state.isPlaying||this.adsTracker.state.isBuffering)&&(this.adsTracker.state.stopAdsTime(),this.adsTracker.state.isPlaying=!1,this.adsTracker.state.isBuffering=!1),o=null!==(i=this.adsTracker.state.totalAdTime())&&void 0!==i?i:0),this.state.setStartupTime(o),this.sendVideoAction(n,e),a.videoAnalyticsHarvester.setBeforeDrainCallback(function(){if(r.state){var e=r.state.getQoeAttributes({}).qoe;a.videoAnalyticsHarvester.refreshQoeKpis(e,r.getViewId())}})}this.startHeartbeat(),this.state.goHeartbeat()}}},{key:"sendEnd",value:function(e){var r;this.state.goEnd()&&(e=e||{},this.isAd()?(r=t.Events.AD_END,e.timeSinceAdRequested=this.state.timeSinceRequested.getDeltaTime(),e.timeSinceAdStarted=this.state.timeSinceStarted.getDeltaTime(),this.parentTracker&&(this.parentTracker.state.isPlaying=!0),this.state.stopAdsTime()):(r=t.Events.CONTENT_END,e.timeSinceRequested=this.state.timeSinceRequested.getDeltaTime(),e.timeSinceStarted=this.state.timeSinceStarted.getDeltaTime()),this.stopHeartbeat(),this.isAd()?this.sendVideoAdAction(r,e):this.sendVideoAction(r,e),this.parentTracker&&this.isAd()&&this.parentTracker.state.goLastAd(),this.state.goViewCountUp(),this.state.totalPlaytime=0,this.isAd()||(a.videoAnalyticsHarvester.forceNextQoeCycle(),a.videoAnalyticsHarvester.setBeforeDrainCallback(null),this.adsTracker&&this.adsTracker.state.clearTotalAdsTime(),this.state.resetViewIdTrackedState()))}},{key:"sendPause",value:function(e){if(this.state.goPause()){var r=this.isAd()?t.Events.AD_PAUSE:t.Events.CONTENT_PAUSE;this.isAd()?this.sendVideoAdAction(r,e):this.sendVideoAction(r,e)}}},{key:"sendResume",value:function(e){var r;this.state.goResume()&&(e=e||{},this.isAd()?(r=t.Events.AD_RESUME,e.timeSinceAdPaused=this.state.timeSincePaused.getDeltaTime()):(r=t.Events.CONTENT_RESUME,e.timeSincePaused=this.state.timeSincePaused.getDeltaTime()),this.isAd()?this.sendVideoAdAction(r,e):this.sendVideoAction(r,e))}},{key:"sendBufferStart",value:function(e){var r;this.state.goBufferStart()&&(e=e||{},r=this.isAd()?t.Events.AD_BUFFER_START:t.Events.CONTENT_BUFFER_START,e=this.buildBufferAttributes(e),this._lastBufferType=e.bufferType,this.isAd()?this.sendVideoAdAction(r,e):this.sendVideoAction(r,e))}},{key:"sendBufferEnd",value:function(e){var r;this.state.goBufferEnd()&&(e=e||{},this.isAd()?(r=t.Events.AD_BUFFER_END,e.timeSinceAdBufferBegin=this.state.timeSinceBufferBegin.getDeltaTime()):(r=t.Events.CONTENT_BUFFER_END,e.timeSinceBufferBegin=this.state.timeSinceBufferBegin.getDeltaTime()),e=this.buildBufferAttributes(e),null!=this._lastBufferType&&(e.bufferType=this._lastBufferType),this.isAd()?this.sendVideoAdAction(r,e):this.sendVideoAction(r,e),this.state.initialBufferingHappened=!0)}},{key:"buildBufferAttributes",value:function(e){return null==e.timeSinceStarted||e.timeSinceStarted<100?e.isInitialBuffering=!this.state.initialBufferingHappened:e.isInitialBuffering=!1,e.bufferType=this.state.calculateBufferType(e.isInitialBuffering),e.timeSinceResumed=this.state.timeSinceResumed.getDeltaTime(),e.timeSinceSeekEnd=this.state.timeSinceSeekEnd.getDeltaTime(),e}},{key:"sendSeekStart",value:function(e){var r;this.state.goSeekStart()&&(r=this.isAd()?t.Events.AD_SEEK_START:t.Events.CONTENT_SEEK_START,this.isAd()?this.sendVideoAdAction(r,e):this.sendVideoAction(r,e))}},{key:"sendSeekEnd",value:function(e){var r;this.state.goSeekEnd()&&(e=e||{},this.isAd()?(r=t.Events.AD_SEEK_END,e.timeSinceAdSeekBegin=this.state.timeSinceSeekBegin.getDeltaTime()):(r=t.Events.CONTENT_SEEK_END,e.timeSinceSeekBegin=this.state.timeSinceSeekBegin.getDeltaTime()),this.isAd()?this.sendVideoAdAction(r,e):this.sendVideoAction(r,e))}},{key:"sendDownload",value:function(e){(e=e||{}).state||i.A.warn("Called sendDownload without { state: xxxxx }."),this.sendVideoAction(t.Events.DOWNLOAD,e),this.state.goDownload()}},{key:"sendError",value:function(e){(e=e||{}).isAd=this.isAd(),this.state.goError();var r=this.isAd()?t.Events.AD_ERROR:t.Events.CONTENT_ERROR;this.sendVideoErrorAction(r,e)}},{key:"sendRenditionChanged",value:function(e){var r;(e=e||{}).timeSinceLastRenditionChange=this.state.timeSinceLastRenditionChange.getDeltaTime(),e.shift=this.getRenditionShift(!0),r=this.isAd()?t.Events.AD_RENDITION_CHANGE:t.Events.CONTENT_RENDITION_CHANGE,this.isAd()?this.sendVideoAdAction(r,e):this.sendVideoAction(r,e),this.state.goRenditionChange()}},{key:"sendHeartbeat",value:function(e){if(this.state.isRequested){var r,n=this.getHeartbeat();this.state._hb=!0,n=this.adjustElapsedTimeForPause(n),this.isAd()?(r=t.Events.AD_HEARTBEAT,"bitmovin-ads"===this.getPlayerName()?this.sendVideoAdAction(r,e):this.sendVideoAdAction(r,K({elapsedTime:n},e))):(r=t.Events.CONTENT_HEARTBEAT,this.sendVideoAction(r,K({elapsedTime:n},e))),this.state.goHeartbeat()}}},{key:"adjustElapsedTimeForPause",value:function(e){return this.state._acc&&(e-=this.state._acc,this.state._acc=0),this.state.isPaused&&((e-=this.state.elapsedTime.getDeltaTime())<10&&(e=0),this.state.elapsedTime.start()),this.state._bufferAcc?(e-=this.state._bufferAcc,this.state._bufferAcc=0):this.state.isBuffering&&((e-=this.state.bufferElapsedTime.getDeltaTime())<5&&(e=0),this.state.bufferElapsedTime.start()),Math.max(0,e)}},{key:"sendAdBreakStart",value:function(e){this.isAd()&&this.state.goAdBreakStart()&&(this.state.totalAdPlaytime=0,this.parentTracker&&(this.parentTracker.state.isPlaying=!1),this.sendVideoAdAction(t.Events.AD_BREAK_START,e))}},{key:"sendAdBreakEnd",value:function(e){this.isAd()&&this.state.goAdBreakEnd()&&((e=e||{}).timeSinceAdBreakBegin=this.state.timeSinceAdBreakStart.getDeltaTime(),this.sendVideoAdAction(t.Events.AD_BREAK_END,e),this.parentTracker&&(this.parentTracker.state.isPlaying=!0),this.stopHeartbeat(),this.parentTracker&&this.isAd()&&this.parentTracker.state.goLastAd())}},{key:"sendAdQuartile",value:function(e){this.isAd()&&((e=e||{}).quartile||i.A.warn("Called sendAdQuartile without { quartile: xxxxx }."),e.timeSinceLastAdQuartile=this.state.timeSinceLastAdQuartile.getDeltaTime(),this.sendVideoAdAction(t.Events.AD_QUARTILE,e),this.state.goAdQuartile())}},{key:"sendAdClick",value:function(e){this.isAd()&&((e=e||{}).url||i.A.warn("Called sendAdClick without { url: xxxxx }."),this.sendVideoAdAction(t.Events.AD_CLICK,e))}}],n&&Y(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(s.A);function te(e){e.type!==ee.Events.AD_ERROR?this.sendVideoAdAction(e.type,e.data):this.sendVideoErrorAction(e.type,e.data)}ee.Events={PLAYER_READY:"PLAYER_READY",DOWNLOAD:"DOWNLOAD",ERROR:"ERROR",CONTENT_REQUEST:"CONTENT_REQUEST",CONTENT_START:"CONTENT_START",CONTENT_END:"CONTENT_END",CONTENT_PAUSE:"CONTENT_PAUSE",CONTENT_RESUME:"CONTENT_RESUME",CONTENT_SEEK_START:"CONTENT_SEEK_START",CONTENT_SEEK_END:"CONTENT_SEEK_END",CONTENT_BUFFER_START:"CONTENT_BUFFER_START",CONTENT_BUFFER_END:"CONTENT_BUFFER_END",CONTENT_HEARTBEAT:"CONTENT_HEARTBEAT",CONTENT_RENDITION_CHANGE:"CONTENT_RENDITION_CHANGE",CONTENT_ERROR:"CONTENT_ERROR",AD_REQUEST:"AD_REQUEST",AD_START:"AD_START",AD_END:"AD_END",AD_PAUSE:"AD_PAUSE",AD_RESUME:"AD_RESUME",AD_SEEK_START:"AD_SEEK_START",AD_SEEK_END:"AD_SEEK_END",AD_BUFFER_START:"AD_BUFFER_START",AD_BUFFER_END:"AD_BUFFER_END",AD_HEARTBEAT:"AD_HEARTBEAT",AD_RENDITION_CHANGE:"AD_RENDITION_CHANGE",AD_ERROR:"AD_ERROR",AD_BREAK_START:"AD_BREAK_START",AD_BREAK_END:"AD_BREAK_END",AD_QUARTILE:"AD_QUARTILE",AD_CLICK:"AD_CLICK"};const re=ee;var ne=r(431),ie=r(413),ae=r(481),oe=r(374);const se={Constants:o.A,Chrono:V.A,Log:i.A,Emitter:H.A,Tracker:s.A,VideoTracker:re,VideoTrackerState:q,Core:I,version:U.rE,NrVideoEventAggregator:ne.t,RetryQueueHandler:ie.u,OptimizedHttpClient:ae.X,HarvestScheduler:oe.n,recordEvent:y};return n.default})());
|
|
3
3
|
//# sourceMappingURL=nrvideo.min.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newrelic/video-core",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.6",
|
|
4
4
|
"description": "New Relic video tracking core library",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -29,9 +29,15 @@
|
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@babel/core": "^7.24.5",
|
|
31
31
|
"@babel/plugin-transform-modules-commonjs": "^7.24.1",
|
|
32
|
-
"@newrelic/newrelic-oss-cli": "^0.1.2",
|
|
33
32
|
"@babel/preset-env": "^7.24.5",
|
|
34
33
|
"@babel/register": "^7.24.6",
|
|
34
|
+
"@newrelic/newrelic-oss-cli": "^0.1.2",
|
|
35
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
36
|
+
"@semantic-release/commit-analyzer": "^12.0.0",
|
|
37
|
+
"@semantic-release/git": "^10.0.1",
|
|
38
|
+
"@semantic-release/github": "^10.0.3",
|
|
39
|
+
"@semantic-release/npm": "^12.0.0",
|
|
40
|
+
"@semantic-release/release-notes-generator": "^13.0.0",
|
|
35
41
|
"aws-sdk": "^2.920.0",
|
|
36
42
|
"babel-jest": "^30.2.0",
|
|
37
43
|
"babel-loader": "^9.1.3",
|
|
@@ -41,6 +47,7 @@
|
|
|
41
47
|
"jsdom": "^25.0.1",
|
|
42
48
|
"mocha": "^10.4.0",
|
|
43
49
|
"nyc": "^15.1.0",
|
|
50
|
+
"semantic-release": "^23.0.8",
|
|
44
51
|
"sinon": "^2.4.1",
|
|
45
52
|
"webpack": "^5.91.0",
|
|
46
53
|
"webpack-cli": "^4.9.2"
|