UNPKG

@mux/mux-data-google-ima

Version:

Mux Data SDK extension for monitoring Google IMA Ads with mux-embed

1 lines 106 kB
function pt(i){if(Array.isArray(i))return i}function ht(i,e){var t=i==null?null:typeof Symbol!="undefined"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var a=[],r=!0,n=!1,o,s;try{for(t=t.call(i);!(r=(o=t.next()).done)&&(a.push(o.value),!(e&&a.length===e));r=!0);}catch(u){n=!0,s=u}finally{try{!r&&t.return!=null&&t.return()}finally{if(n)throw s}}return a}}function ft(){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 De(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,a=new Array(e);t<e;t++)a[t]=i[t];return a}function Be(i,e){if(i){if(typeof i=="string")return De(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return De(i,e)}}function ce(i,e){return pt(i)||ht(i,e)||Be(i,e)||ft()}function mt(i){if(Array.isArray(i))return De(i)}function yt(i){if(typeof Symbol!="undefined"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function gt(){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 Ae(i){return mt(i)||yt(i)||Be(i)||gt()}var fa=Object.create,St=Object.defineProperty,ma=Object.getOwnPropertyDescriptor,ya=Object.getOwnPropertyNames,ga=Object.getPrototypeOf,ba=Object.prototype.hasOwnProperty,Rt=function(e,t){return function(){return e&&(t=e(e=0)),t}},W=function(e,t){return function(){return t||e((t={exports:{}}).exports,t),t.exports}},Ea=function(e,t,a,r){if(t&&typeof t=="object"||typeof t=="function")for(var n=ya(t),o=0,s=n.length,u;o<s;o++)u=n[o],!ba.call(e,u)&&u!==a&&St(e,u,{get:function(d){return t[d]}.bind(null,u),enumerable:!(r=ma(t,u))||r.enumerable});return e},K=function(e,t,a){return a=e!=null?fa(ga(e)):{},Ea(t||!e||!e.__esModule?St(a,"default",{value:e,enumerable:!0}):a,e)},re=W(function(i,e){var t;typeof window!="undefined"?t=window:typeof global!="undefined"?t=global:typeof self!="undefined"?t=self:t={},e.exports=t});function fe(i,e){return e!=null&&typeof Symbol!="undefined"&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](i):fe(i,e)}var me=Rt(function(){me()});function Ot(i){"@swc/helpers - typeof";return i&&typeof Symbol!="undefined"&&i.constructor===Symbol?"symbol":typeof i}var Pt=Rt(function(){}),Lt=W(function(i,e){var t=Array.prototype.slice;e.exports=a;function a(r,n){for(("length"in r)||(r=[r]),r=t.call(r);r.length;){var o=r.shift(),s=n(o);if(s)return s;o.childNodes&&o.childNodes.length&&(r=t.call(o.childNodes).concat(r))}}}),Ta=W(function(i,e){me(),e.exports=t;function t(a,r){if(!fe(this,t))return new t(a,r);this.data=a,this.nodeValue=a,this.length=a.length,this.ownerDocument=r||null}t.prototype.nodeType=8,t.prototype.nodeName="#comment",t.prototype.toString=function(){return"[object Comment]"}}),wa=W(function(i,e){me(),e.exports=t;function t(a,r){if(!fe(this,t))return new t(a);this.data=a||"",this.length=this.data.length,this.ownerDocument=r||null}t.prototype.type="DOMTextNode",t.prototype.nodeType=3,t.prototype.nodeName="#text",t.prototype.toString=function(){return this.data},t.prototype.replaceData=function(a,r,n){var o=this.data,s=o.substring(0,a),u=o.substring(a+r,o.length);this.data=s+n+u,this.length=this.data.length}}),qt=W(function(i,e){e.exports=t;function t(a){var r=this,n=a.type;a.target||(a.target=r),r.listeners||(r.listeners={});var o=r.listeners[n];if(o)return o.forEach(function(s){a.currentTarget=r,typeof s=="function"?s(a):s.handleEvent(a)});r.parentNode&&r.parentNode.dispatchEvent(a)}}),It=W(function(i,e){e.exports=t;function t(a,r){var n=this;n.listeners||(n.listeners={}),n.listeners[a]||(n.listeners[a]=[]),n.listeners[a].indexOf(r)===-1&&n.listeners[a].push(r)}}),Nt=W(function(i,e){e.exports=t;function t(a,r){var n=this;if(n.listeners&&n.listeners[a]){var o=n.listeners[a],s=o.indexOf(r);s!==-1&&o.splice(s,1)}}}),ka=W(function(i,e){Pt(),e.exports=a;var t=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"];function a(c){switch(c.nodeType){case 3:return _(c.data);case 8:return"<!--"+c.data+"-->";default:return r(c)}}function r(c){var l=[],p=c.tagName;return c.namespaceURI==="http://www.w3.org/1999/xhtml"&&(p=p.toLowerCase()),l.push("<"+p+d(c)+s(c)),t.indexOf(p)>-1?l.push(" />"):(l.push(">"),c.childNodes.length?l.push.apply(l,c.childNodes.map(a)):c.textContent||c.innerText?l.push(_(c.textContent||c.innerText)):c.innerHTML&&l.push(c.innerHTML),l.push("</"+p+">")),l.join("")}function n(c,l){var p=Ot(c[l]);return l==="style"&&Object.keys(c.style).length>0?!0:c.hasOwnProperty(l)&&(p==="string"||p==="boolean"||p==="number")&&l!=="nodeName"&&l!=="className"&&l!=="tagName"&&l!=="textContent"&&l!=="innerText"&&l!=="namespaceURI"&&l!=="innerHTML"}function o(c){if(typeof c=="string")return c;var l="";return Object.keys(c).forEach(function(p){var v=c[p];p=p.replace(/[A-Z]/g,function(w){return"-"+w.toLowerCase()}),l+=p+":"+v+";"}),l}function s(c){var l=c.dataset,p=[];for(var v in l)p.push({name:"data-"+v,value:l[v]});return p.length?u(p):""}function u(c){var l=[];return c.forEach(function(p){var v=p.name,w=p.value;v==="style"&&(w=o(w)),l.push(v+'="'+g(w)+'"')}),l.length?" "+l.join(" "):""}function d(c){var l=[];for(var p in c)n(c,p)&&l.push({name:p,value:c[p]});for(var v in c._attributes)for(var w in c._attributes[v]){var D=c._attributes[v][w],E=(D.prefix?D.prefix+":":"")+w;l.push({name:E,value:D.value})}return c.className&&l.push({name:"class",value:c.className}),l.length?u(l):""}function _(c){var l="";return typeof c=="string"?l=c:c&&(l=c.toString()),l.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function g(c){return _(c).replace(/"/g,"&quot;")}}),Ct=W(function(i,e){me();var t=Lt(),a=qt(),r=It(),n=Nt(),o=ka(),s="http://www.w3.org/1999/xhtml";e.exports=u;function u(d,_,g){if(!fe(this,u))return new u(d);var c=g===void 0?s:g||null;this.tagName=c===s?String(d).toUpperCase():d,this.nodeName=this.tagName,this.className="",this.dataset={},this.childNodes=[],this.parentNode=null,this.style={},this.ownerDocument=_||null,this.namespaceURI=c,this._attributes={},this.tagName==="INPUT"&&(this.type="text")}u.prototype.type="DOMElement",u.prototype.nodeType=1,u.prototype.appendChild=function(d){return d.parentNode&&d.parentNode.removeChild(d),this.childNodes.push(d),d.parentNode=this,d},u.prototype.replaceChild=function(d,_){d.parentNode&&d.parentNode.removeChild(d);var g=this.childNodes.indexOf(_);return _.parentNode=null,this.childNodes[g]=d,d.parentNode=this,_},u.prototype.removeChild=function(d){var _=this.childNodes.indexOf(d);return this.childNodes.splice(_,1),d.parentNode=null,d},u.prototype.insertBefore=function(d,_){d.parentNode&&d.parentNode.removeChild(d);var g=_==null?-1:this.childNodes.indexOf(_);return g>-1?this.childNodes.splice(g,0,d):this.childNodes.push(d),d.parentNode=this,d},u.prototype.setAttributeNS=function(d,_,g){var c=null,l=_,p=_.indexOf(":");if(p>-1&&(c=_.substr(0,p),l=_.substr(p+1)),this.tagName==="INPUT"&&_==="type")this.type=g;else{var v=this._attributes[d]||(this._attributes[d]={});v[l]={value:g,prefix:c}}},u.prototype.getAttributeNS=function(d,_){var g=this._attributes[d],c=g&&g[_]&&g[_].value;return this.tagName==="INPUT"&&_==="type"?this.type:typeof c!="string"?null:c},u.prototype.removeAttributeNS=function(d,_){var g=this._attributes[d];g&&delete g[_]},u.prototype.hasAttributeNS=function(d,_){var g=this._attributes[d];return!!g&&_ in g},u.prototype.setAttribute=function(d,_){return this.setAttributeNS(null,d,_)},u.prototype.getAttribute=function(d){return this.getAttributeNS(null,d)},u.prototype.removeAttribute=function(d){return this.removeAttributeNS(null,d)},u.prototype.hasAttribute=function(d){return this.hasAttributeNS(null,d)},u.prototype.removeEventListener=n,u.prototype.addEventListener=r,u.prototype.dispatchEvent=a,u.prototype.focus=function(){},u.prototype.toString=function(){return o(this)},u.prototype.getElementsByClassName=function(d){var _=d.split(" "),g=[];return t(this,function(c){if(c.nodeType===1){var l=c.className||"",p=l.split(" ");_.every(function(v){return p.indexOf(v)!==-1})&&g.push(c)}}),g},u.prototype.getElementsByTagName=function(d){d=d.toLowerCase();var _=[];return t(this.childNodes,function(g){g.nodeType===1&&(d==="*"||g.tagName.toLowerCase()===d)&&_.push(g)}),_},u.prototype.contains=function(d){return t(this,function(_){return d===_})||!1}}),Da=W(function(i,e){me();var t=Ct();e.exports=a;function a(r){if(!fe(this,a))return new a;this.childNodes=[],this.parentNode=null,this.ownerDocument=r||null}a.prototype.type="DocumentFragment",a.prototype.nodeType=11,a.prototype.nodeName="#document-fragment",a.prototype.appendChild=t.prototype.appendChild,a.prototype.replaceChild=t.prototype.replaceChild,a.prototype.removeChild=t.prototype.removeChild,a.prototype.toString=function(){return this.childNodes.map(function(r){return String(r)}).join("")}}),Aa=W(function(i,e){e.exports=t;function t(a){}t.prototype.initEvent=function(a,r,n){this.type=a,this.bubbles=r,this.cancelable=n},t.prototype.preventDefault=function(){}}),xa=W(function(i,e){me();var t=Lt(),a=Ta(),r=wa(),n=Ct(),o=Da(),s=Aa(),u=qt(),d=It(),_=Nt();e.exports=g;function g(){if(!fe(this,g))return new g;this.head=this.createElement("head"),this.body=this.createElement("body"),this.documentElement=this.createElement("html"),this.documentElement.appendChild(this.head),this.documentElement.appendChild(this.body),this.childNodes=[this.documentElement],this.nodeType=9}var c=g.prototype;c.createTextNode=function(l){return new r(l,this)},c.createElementNS=function(l,p){var v=l===null?null:String(l);return new n(p,this,v)},c.createElement=function(l){return new n(l,this)},c.createDocumentFragment=function(){return new o(this)},c.createEvent=function(l){return new s(l)},c.createComment=function(l){return new a(l,this)},c.getElementById=function(l){l=String(l);var p=t(this.childNodes,function(v){if(String(v.id)===l)return v});return p||null},c.getElementsByClassName=n.prototype.getElementsByClassName,c.getElementsByTagName=n.prototype.getElementsByTagName,c.contains=n.prototype.contains,c.removeEventListener=_,c.addEventListener=d,c.dispatchEvent=u}),Sa=W(function(i,e){var t=xa();e.exports=new t}),jt=W(function(i,e){var t=typeof global!="undefined"?global:typeof window!="undefined"?window:{},a=Sa(),r;typeof document!="undefined"?r=document:(r=t["__GLOBAL_DOCUMENT_CACHE@4"],r||(r=t["__GLOBAL_DOCUMENT_CACHE@4"]=a)),e.exports=r});function Ra(i){if(Array.isArray(i))return i}function Oa(i,e){var t=i==null?null:typeof Symbol!="undefined"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var a=[],r=!0,n=!1,o,s;try{for(t=t.call(i);!(r=(o=t.next()).done)&&(a.push(o.value),!(e&&a.length===e));r=!0);}catch(u){n=!0,s=u}finally{try{!r&&t.return!=null&&t.return()}finally{if(n)throw s}}return a}}function Pa(){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 nt(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,a=new Array(e);t<e;t++)a[t]=i[t];return a}function Mt(i,e){if(i){if(typeof i=="string")return nt(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return nt(i,e)}}function ie(i,e){return Ra(i)||Oa(i,e)||Mt(i,e)||Pa()}var Re=K(re()),bt=K(re()),La=K(re()),qa={now:function(){var e=La.default.performance,t=e&&e.timing,a=t&&t.navigationStart,r=typeof a=="number"&&typeof e.now=="function"?a+e.now():Date.now();return Math.round(r)}},F=qa,Pe=function(){var e,t,a;if(typeof((e=bt.default.crypto)===null||e===void 0?void 0:e.getRandomValues)=="function"){a=new Uint8Array(32),bt.default.crypto.getRandomValues(a);for(var r=0;r<32;r++)a[r]=a[r]%16}else{a=[];for(var n=0;n<32;n++)a[n]=Math.random()*16|0}var o=0;t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(d){var _=d==="x"?a[o]:a[o]&3|8;return o++,_.toString(16)});var s=F.now(),u=s==null?void 0:s.toString(16).substring(3);return u?t.substring(0,28)+u:t},Ht=function(){return("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6)},$=function(e){if(e&&typeof e.nodeName!="undefined")return e.muxId||(e.muxId=Ht()),e.muxId;var t;try{t=document.querySelector(e)}catch(a){}return t&&!t.muxId&&(t.muxId=e),(t==null?void 0:t.muxId)||e},Ge=function(e){var t;e&&typeof e.nodeName!="undefined"?(t=e,e=$(t)):t=document.querySelector(e);var a=t&&t.nodeName?t.nodeName.toLowerCase():"";return[t,e,a]};function Ia(i){if(Array.isArray(i))return nt(i)}function Na(i){if(typeof Symbol!="undefined"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Ca(){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 Z(i){return Ia(i)||Na(i)||Mt(i)||Ca()}var pe={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},ja=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3,a,r,n,o,s,u=e?[console,e]:[console],d=(a=console.trace).bind.apply(a,Z(u)),_=(r=console.info).bind.apply(r,Z(u)),g=(n=console.debug).bind.apply(n,Z(u)),c=(o=console.warn).bind.apply(o,Z(u)),l=(s=console.error).bind.apply(s,Z(u)),p=t;return{trace:function(){for(var w=arguments.length,D=new Array(w),E=0;E<w;E++)D[E]=arguments[E];if(!(p>pe.TRACE))return d.apply(void 0,Z(D))},debug:function(){for(var w=arguments.length,D=new Array(w),E=0;E<w;E++)D[E]=arguments[E];if(!(p>pe.DEBUG))return g.apply(void 0,Z(D))},info:function(){for(var w=arguments.length,D=new Array(w),E=0;E<w;E++)D[E]=arguments[E];if(!(p>pe.INFO))return _.apply(void 0,Z(D))},warn:function(){for(var w=arguments.length,D=new Array(w),E=0;E<w;E++)D[E]=arguments[E];if(!(p>pe.WARN))return c.apply(void 0,Z(D))},error:function(){for(var w=arguments.length,D=new Array(w),E=0;E<w;E++)D[E]=arguments[E];if(!(p>pe.ERROR))return l.apply(void 0,Z(D))},get level(){return p},set level(v){v!==this.level&&(p=v!=null?v:t)}}},N=ja("[mux]"),Ze=K(re());function ot(){var i=Ze.default.doNotTrack||Ze.default.navigator&&Ze.default.navigator.doNotTrack;return i==="1"}function k(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}me();function H(i,e){if(!fe(i,e))throw new TypeError("Cannot call a class as a function")}function Et(i,e){for(var t=0;t<e.length;t++){var a=e[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(i,a.key,a)}}function Y(i,e,t){return e&&Et(i.prototype,e),t&&Et(i,t),i}function m(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Te(i){return Te=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Te(i)}function Ma(i,e){for(;!Object.prototype.hasOwnProperty.call(i,e)&&(i=Te(i),i!==null););return i}function Je(i,e,t){return typeof Reflect!="undefined"&&Reflect.get?Je=Reflect.get:Je=function(r,n,o){var s=Ma(r,n);if(s){var u=Object.getOwnPropertyDescriptor(s,n);return u.get?u.get.call(o||r):u.value}},Je(i,e,t||i)}function st(i,e){return st=Object.setPrototypeOf||function(t,a){return t.__proto__=a,t},st(i,e)}function Ha(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),e&&st(i,e)}function Ua(i,e){if(i==null)return{};var t={},a=Object.keys(i),r,n;for(n=0;n<a.length;n++)r=a[n],!(e.indexOf(r)>=0)&&(t[r]=i[r]);return t}function Ba(i,e){if(i==null)return{};var t=Ua(i,e),a,r;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);for(r=0;r<n.length;r++)a=n[r],!(e.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(t[a]=i[a])}return t}function Fa(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(i){return!1}}Pt();function Ja(i,e){return e&&(Ot(e)==="object"||typeof e=="function")?e:k(i)}function Ga(i){var e=Fa();return function(){var t=Te(i),a;if(e){var r=Te(this).constructor;a=Reflect.construct(t,arguments,r)}else a=t.apply(this,arguments);return Ja(this,a)}}var ee=function(e){return Le(e)[0]},Le=function(e){if(typeof e!="string"||e==="")return["localhost"];var t=/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,a=e.match(t)||[],r=a[4],n;return r&&(n=(r.match(/[^\.]+\.[^\.]+$/)||[])[0]),[r,n]},et=K(re()),Qa={exists:function(){var e=et.default.performance,t=e&&e.timing;return t!==void 0},domContentLoadedEventEnd:function(){var e=et.default.performance,t=e&&e.timing;return t&&t.domContentLoadedEventEnd},navigationStart:function(){var e=et.default.performance,t=e&&e.timing;return t&&t.navigationStart}},Qe=Qa;function B(i,e,t){t=t===void 0?1:t,i[e]=i[e]||0,i[e]+=t}function qe(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{},a=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(a=a.concat(Object.getOwnPropertySymbols(t).filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),a.forEach(function(r){m(i,r,t[r])})}return i}function Wa(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(i);e&&(a=a.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,a)}return t}function dt(i,e){return e=e!=null?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):Wa(Object(e)).forEach(function(t){Object.defineProperty(i,t,Object.getOwnPropertyDescriptor(e,t))}),i}var Va=["x-cdn","content-type"],Ut=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"],za=Va.concat(Ut);function lt(i){i=i||"";var e={},t=i.trim().split(/[\r\n]+/);return t.forEach(function(a){if(a){var r=a.split(": "),n=r.shift();n&&(za.indexOf(n.toLowerCase())>=0||n.toLowerCase().indexOf("x-litix-")===0)&&(e[n]=r.join(": "))}}),e}function We(i){if(i){var e=Ut.find(function(t){return i[t]!==void 0});return e?i[e]:void 0}}var Ka=function(e){var t={};for(var a in e){var r=e[a],n=r["DATA-ID"].search("io.litix.data.");if(n!==-1){var o=r["DATA-ID"].replace("io.litix.data.","");t[o]=r.VALUE}}return t},Bt=Ka,Fe=function(e){if(!e)return{};var t=Qe.navigationStart(),a=e.loading,r=a?a.start:e.trequest,n=a?a.first:e.tfirst,o=a?a.end:e.tload;return{bytesLoaded:e.total,requestStart:Math.round(t+r),responseStart:Math.round(t+n),responseEnd:Math.round(t+o)}},xe=function(e){if(!(!e||typeof e.getAllResponseHeaders!="function"))return lt(e.getAllResponseHeaders())},Ya=function(e,t,a){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},n=arguments.length>4?arguments[4]:void 0,o=e.log,s=e.utils.secondsToMs,u=function(I){var b=parseInt(n.version),h;return b===1&&I.programDateTime!==null&&(h=I.programDateTime),b===0&&I.pdt!==null&&(h=I.pdt),h};if(!Qe.exists()){o.warn("performance timing not supported. Not tracking HLS.js.");return}var d=function(I,b){return e.emit(t,I,b)},_=function(I,b){var h=b.levels,f=b.audioTracks,A=b.url,T=b.stats,x=b.networkDetails,P=b.sessionData,q={},C={};h.forEach(function(Q,te){q[te]={width:Q.width,height:Q.height,bitrate:Q.bitrate,attrs:Q.attrs}}),f.forEach(function(Q,te){C[te]={name:Q.name,language:Q.lang,bitrate:Q.bitrate}});var O=Fe(T),R=O.bytesLoaded,X=O.requestStart,se=O.responseStart,ue=O.responseEnd;d("requestcompleted",dt(qe({},Bt(P)),{request_event_type:I,request_bytes_loaded:R,request_start:X,request_response_start:se,request_response_end:ue,request_type:"manifest",request_hostname:ee(A),request_response_headers:xe(x),request_rendition_lists:{media:q,audio:C,video:{}}}))};a.on(n.Events.MANIFEST_LOADED,_);var g=function(I,b){var h=b.details,f=b.level,A=b.networkDetails,T=b.stats,x=Fe(T),P=x.bytesLoaded,q=x.requestStart,C=x.responseStart,O=x.responseEnd,R=h.fragments[h.fragments.length-1],X=u(R)+s(R.duration);d("requestcompleted",{request_event_type:I,request_bytes_loaded:P,request_start:q,request_response_start:C,request_response_end:O,request_current_level:f,request_type:"manifest",request_hostname:ee(h.url),request_response_headers:xe(A),video_holdback:h.holdBack&&s(h.holdBack),video_part_holdback:h.partHoldBack&&s(h.partHoldBack),video_part_target_duration:h.partTarget&&s(h.partTarget),video_target_duration:h.targetduration&&s(h.targetduration),video_source_is_live:h.live,player_manifest_newest_program_time:isNaN(X)?void 0:X})};a.on(n.Events.LEVEL_LOADED,g);var c=function(I,b){var h=b.details,f=b.networkDetails,A=b.stats,T=Fe(A),x=T.bytesLoaded,P=T.requestStart,q=T.responseStart,C=T.responseEnd;d("requestcompleted",{request_event_type:I,request_bytes_loaded:x,request_start:P,request_response_start:q,request_response_end:C,request_type:"manifest",request_hostname:ee(h.url),request_response_headers:xe(f)})};a.on(n.Events.AUDIO_TRACK_LOADED,c);var l=function(I,b){var h=b.stats,f=b.networkDetails,A=b.frag;h=h||A.stats;var T=Fe(h),x=T.bytesLoaded,P=T.requestStart,q=T.responseStart,C=T.responseEnd,O=f?xe(f):void 0,R={request_event_type:I,request_bytes_loaded:x,request_start:P,request_response_start:q,request_response_end:C,request_hostname:f?ee(f.responseURL):void 0,request_id:O?We(O):void 0,request_response_headers:O,request_media_duration:A.duration,request_url:f==null?void 0:f.responseURL};A.type==="main"?(R.request_type="media",R.request_current_level=A.level,R.request_video_width=(a.levels[A.level]||{}).width,R.request_video_height=(a.levels[A.level]||{}).height,R.request_labeled_bitrate=(a.levels[A.level]||{}).bitrate):R.request_type=A.type,d("requestcompleted",R)};a.on(n.Events.FRAG_LOADED,l);var p=function(I,b){var h=b.frag,f=h.start,A=u(h),T={currentFragmentPDT:A,currentFragmentStart:s(f)};d("fragmentchange",T)};a.on(n.Events.FRAG_CHANGED,p);var v=function(I,b){var h=b.type,f=b.details,A=b.response,T=b.fatal,x=b.frag,P=b.networkDetails,q=(x==null?void 0:x.url)||b.url||"",C=P?xe(P):void 0;if((f===n.ErrorDetails.MANIFEST_LOAD_ERROR||f===n.ErrorDetails.MANIFEST_LOAD_TIMEOUT||f===n.ErrorDetails.FRAG_LOAD_ERROR||f===n.ErrorDetails.FRAG_LOAD_TIMEOUT||f===n.ErrorDetails.LEVEL_LOAD_ERROR||f===n.ErrorDetails.LEVEL_LOAD_TIMEOUT||f===n.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||f===n.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT||f===n.ErrorDetails.SUBTITLE_LOAD_ERROR||f===n.ErrorDetails.SUBTITLE_LOAD_TIMEOUT||f===n.ErrorDetails.KEY_LOAD_ERROR||f===n.ErrorDetails.KEY_LOAD_TIMEOUT)&&d("requestfailed",{request_error:f,request_url:q,request_hostname:ee(q),request_id:C?We(C):void 0,request_type:f===n.ErrorDetails.FRAG_LOAD_ERROR||f===n.ErrorDetails.FRAG_LOAD_TIMEOUT?"media":f===n.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||f===n.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT?"audio":f===n.ErrorDetails.SUBTITLE_LOAD_ERROR||f===n.ErrorDetails.SUBTITLE_LOAD_TIMEOUT?"subtitle":f===n.ErrorDetails.KEY_LOAD_ERROR||f===n.ErrorDetails.KEY_LOAD_TIMEOUT?"encryption":"manifest",request_error_code:A==null?void 0:A.code,request_error_text:A==null?void 0:A.text}),T){var O,R="".concat(q?"url: ".concat(q,"\n"):"")+"".concat(A&&(A.code||A.text)?"response: ".concat(A.code,", ").concat(A.text,"\n"):"")+"".concat(b.reason?"failure reason: ".concat(b.reason,"\n"):"")+"".concat(b.level?"level: ".concat(b.level,"\n"):"")+"".concat(b.parent?"parent stream controller: ".concat(b.parent,"\n"):"")+"".concat(b.buffer?"buffer length: ".concat(b.buffer,"\n"):"")+"".concat(b.error?"error: ".concat(b.error,"\n"):"")+"".concat(b.event?"event: ".concat(b.event,"\n"):"")+"".concat(b.err?"error message: ".concat((O=b.err)===null||O===void 0?void 0:O.message,"\n"):"");d("error",{player_error_code:h,player_error_message:f,player_error_context:R})}};a.on(n.Events.ERROR,v);var w=function(I,b){var h=b.frag,f=h&&h._url||"";d("requestcanceled",{request_event_type:I,request_url:f,request_type:"media",request_hostname:ee(f)})};a.on(n.Events.FRAG_LOAD_EMERGENCY_ABORTED,w);var D=function(I,b){var h=b.level,f=a.levels[h];if(f&&f.attrs&&f.attrs.BANDWIDTH){var A=f.attrs.BANDWIDTH,T,x=parseFloat(f.attrs["FRAME-RATE"]);isNaN(x)||(T=x),A?d("renditionchange",{video_source_fps:T,video_source_bitrate:A,video_source_width:f.width,video_source_height:f.height,video_source_rendition_name:f.name,video_source_codec:f==null?void 0:f.videoCodec}):o.warn("missing BANDWIDTH from HLS manifest parsed by HLS.js")}};a.on(n.Events.LEVEL_SWITCHED,D),a._stopMuxMonitor=function(){a.off(n.Events.MANIFEST_LOADED,_),a.off(n.Events.LEVEL_LOADED,g),a.off(n.Events.AUDIO_TRACK_LOADED,c),a.off(n.Events.FRAG_LOADED,l),a.off(n.Events.FRAG_CHANGED,p),a.off(n.Events.ERROR,v),a.off(n.Events.FRAG_LOAD_EMERGENCY_ABORTED,w),a.off(n.Events.LEVEL_SWITCHED,D),a.off(n.Events.DESTROYING,a._stopMuxMonitor),delete a._stopMuxMonitor},a.on(n.Events.DESTROYING,a._stopMuxMonitor)},Xa=function(e){e&&typeof e._stopMuxMonitor=="function"&&e._stopMuxMonitor()},Tt=function(e,t){if(!e||!e.requestEndDate)return{};var a=ee(e.url),r=e.url,n=e.bytesLoaded,o=new Date(e.requestStartDate).getTime(),s=new Date(e.firstByteDate).getTime(),u=new Date(e.requestEndDate).getTime(),d=isNaN(e.duration)?0:e.duration,_=typeof t.getMetricsFor=="function"?t.getMetricsFor(e.mediaType).HttpList:t.getDashMetrics().getHttpRequests(e.mediaType),g;_.length>0&&(g=lt(_[_.length-1]._responseHeaders||""));var c=g?We(g):void 0;return{requestStart:o,requestResponseStart:s,requestResponseEnd:u,requestBytesLoaded:n,requestResponseHeaders:g,requestMediaDuration:d,requestHostname:a,requestUrl:r,requestId:c}},$a=function(e,t){if(typeof t.getCurrentRepresentationForType=="function"){var a=t.getCurrentRepresentationForType(e);return a?{currentLevel:a.absoluteIndex,renditionWidth:a.width||null,renditionHeight:a.height||null,renditionBitrate:a.bandwidth}:{}}var r=t.getQualityFor(e),n=t.getCurrentTrackFor(e).bitrateList;return n?{currentLevel:r,renditionWidth:n[r].width||null,renditionHeight:n[r].height||null,renditionBitrate:n[r].bandwidth}:{}},Za=function(e){var t;return(t=e.match(/.*codecs\*?="(.*)"/))===null||t===void 0?void 0:t[1]},er=function(e){try{var t,a,r=(a=e.getVersion)===null||a===void 0||(t=a.call(e))===null||t===void 0?void 0:t.split(".").map(function(n){return parseInt(n)})[0];return r}catch(n){return!1}},tr=function(e,t,a){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},n=e.log;if(!a||!a.on){n.warn("Invalid dash.js player reference. Monitoring blocked.");return}var o=er(a),s=function(h,f){return e.emit(t,h,f)},u=function(h){var f=h.type,A=h.data,T=(A||{}).url;s("requestcompleted",{request_event_type:f,request_start:0,request_response_start:0,request_response_end:0,request_bytes_loaded:-1,request_type:"manifest",request_hostname:ee(T),request_url:T})};a.on("manifestLoaded",u);var d={},_=function(h){if(typeof h.getRequests!="function")return null;var f=h.getRequests({state:"executed"});return f.length===0?null:f[f.length-1]},g=function(h){var f=h.type,A=h.fragmentModel,T=h.chunk,x=_(A);c({type:f,request:x,chunk:T})},c=function(h){var f=h.type,A=h.chunk,T=h.request,x=(A||{}).mediaInfo,P=x||{},q=P.type,C=P.bitrateList;C=C||[];var O={};C.forEach(function(de,V){O[V]={},O[V].width=de.width,O[V].height=de.height,O[V].bitrate=de.bandwidth,O[V].attrs={}}),q==="video"?d.video=O:q==="audio"?d.audio=O:d.media=O;var R=Tt(T,a),X=R.requestStart,se=R.requestResponseStart,ue=R.requestResponseEnd,Q=R.requestResponseHeaders,te=R.requestMediaDuration,ye=R.requestHostname,ge=R.requestUrl,be=R.requestId;s("requestcompleted",{request_event_type:f,request_start:X,request_response_start:se,request_response_end:ue,request_bytes_loaded:-1,request_type:q+"_init",request_response_headers:Q,request_hostname:ye,request_id:be,request_url:ge,request_media_duration:te,request_rendition_lists:d})};o>=4?a.on("initFragmentLoaded",c):a.on("initFragmentLoaded",g);var l=function(h){var f=h.type,A=h.fragmentModel,T=h.chunk,x=_(A);p({type:f,request:x,chunk:T})},p=function(h){var f=h.type,A=h.chunk,T=h.request,x=A||{},P=x.mediaInfo,q=x.start,C=P||{},O=C.type,R=Tt(T,a),X=R.requestStart,se=R.requestResponseStart,ue=R.requestResponseEnd,Q=R.requestBytesLoaded,te=R.requestResponseHeaders,ye=R.requestMediaDuration,ge=R.requestHostname,be=R.requestUrl,de=R.requestId,V=$a(O,a),Ie=V.currentLevel,Ne=V.renditionWidth,Ce=V.renditionHeight,je=V.renditionBitrate;s("requestcompleted",{request_event_type:f,request_start:X,request_response_start:se,request_response_end:ue,request_bytes_loaded:Q,request_type:O,request_response_headers:te,request_hostname:ge,request_id:de,request_url:be,request_media_start_time:q,request_media_duration:ye,request_current_level:Ie,request_labeled_bitrate:je,request_video_width:Ne,request_video_height:Ce})};o>=4?a.on("mediaFragmentLoaded",p):a.on("mediaFragmentLoaded",l);var v={video:void 0,audio:void 0,totalBitrate:void 0},w=function(){if(v.video&&typeof v.video.bitrate=="number"){if(!(v.video.width&&v.video.height)){n.warn("have bitrate info for video but missing width/height");return}var h=v.video.bitrate;if(v.audio&&typeof v.audio.bitrate=="number"&&(h+=v.audio.bitrate),h!==v.totalBitrate)return v.totalBitrate=h,{video_source_bitrate:h,video_source_height:v.video.height,video_source_width:v.video.width,video_source_codec:Za(v.video.codec)}}},D=function(h,f,A){var T=h.mediaType;if(T==="audio"||T==="video"){var x;if(typeof a.getRepresentationsByType=="function")if(h.newRepresentation)x={bitrate:h.newRepresentation.bandwidth,width:h.newRepresentation.width,height:h.newRepresentation.height,qualityIndex:h.newRepresentation.absoluteIndex};else{var P=a.getRepresentationsByType(T);if(P&&typeof h.newQuality=="number"){var q=P.find(function(O){return O.absoluteIndex===h.newQuality||O.index===h.newQuality});q&&(x={bitrate:q.bandwidth,width:q.width,height:q.height,qualityIndex:h.newQuality})}}else{if(typeof h.newQuality!="number"){n.warn("missing evt.newQuality in qualityChangeRendered event",h);return}x=a.getBitrateInfoListFor(T).find(function(O){var R=O.qualityIndex;return R===h.newQuality})}if(!(x&&typeof x.bitrate=="number")){n.warn("missing bitrate info for ".concat(T));return}v[T]=dt(qe({},x),{codec:a.getCurrentTrackFor(T).codec});var C=w();C&&s("renditionchange",C)}};a.on("qualityChangeRendered",D);var E=function(h){var f=h.request,A=h.mediaType;f=f||{},s("requestcanceled",{request_event_type:f.type+"_"+f.action,request_url:f.url,request_type:A,request_hostname:ee(f.url)})};a.on("fragmentLoadingAbandoned",E);var I=function(h){var f=h.error,A,T,x=(f==null||(A=f.data)===null||A===void 0?void 0:A.request)||{},P=(f==null||(T=f.data)===null||T===void 0?void 0:T.response)||{};(f==null?void 0:f.code)===27&&s("requestfailed",{request_error:x.type+"_"+x.action,request_url:x.url,request_hostname:ee(x.url),request_type:x.mediaType,request_error_code:P.status,request_error_text:P.statusText});var q="".concat(x!=null&&x.url?"url: ".concat(x.url,"\n"):"")+"".concat(P!=null&&P.status||P!=null&&P.statusText?"response: ".concat(P==null?void 0:P.status,", ").concat(P==null?void 0:P.statusText,"\n"):"");s("error",{player_error_code:f==null?void 0:f.code,player_error_message:f==null?void 0:f.message,player_error_context:q})};a.on("error",I),a._stopMuxMonitor=function(){a.off("manifestLoaded",u),a.off("initFragmentLoaded",c),a.off("mediaFragmentLoaded",p),a.off("qualityChangeRendered",D),a.off("error",I),a.off("fragmentLoadingAbandoned",E),delete a._stopMuxMonitor}},ar=function(e){e&&typeof e._stopMuxMonitor=="function"&&e._stopMuxMonitor()},wt=0,rr=function(){"use strict";function i(){H(this,i),m(this,"_listeners",void 0)}return Y(i,[{key:"on",value:function(t,a,r){return a._eventEmitterGuid=a._eventEmitterGuid||++wt,this._listeners=this._listeners||{},this._listeners[t]=this._listeners[t]||[],r&&(a=a.bind(r)),this._listeners[t].push(a),a}},{key:"off",value:function(t,a){var r=this._listeners&&this._listeners[t];r&&r.forEach(function(n,o){n._eventEmitterGuid===a._eventEmitterGuid&&r.splice(o,1)})}},{key:"one",value:function(t,a,r){var n=this;a._eventEmitterGuid=a._eventEmitterGuid||++wt;var o=function(){n.off(t,o),a.apply(r||this,arguments)};o._eventEmitterGuid=a._eventEmitterGuid,this.on(t,o)}},{key:"emit",value:function(t,a){var r=this;if(this._listeners){a=a||{};var n=this._listeners["before"+t]||[],o=this._listeners["before*"]||[],s=this._listeners[t]||[],u=this._listeners["after"+t]||[],d=function(g,c){g=g.slice(),g.forEach(function(l){l.call(r,{type:t},c)})};d(n,a),d(o,a),d(s,a),d(u,a)}}}]),i}(),ir=rr,tt=K(re()),nr=function(){"use strict";function i(e){var t=this;H(this,i),m(this,"_playbackHeartbeatInterval",void 0),m(this,"_playheadShouldBeProgressing",void 0),m(this,"pm",void 0),this.pm=e,this._playbackHeartbeatInterval=null,this._playheadShouldBeProgressing=!1,e.on("playing",function(){t._playheadShouldBeProgressing=!0}),e.on("play",this._startPlaybackHeartbeatInterval.bind(this)),e.on("playing",this._startPlaybackHeartbeatInterval.bind(this)),e.on("adbreakstart",this._startPlaybackHeartbeatInterval.bind(this)),e.on("adplay",this._startPlaybackHeartbeatInterval.bind(this)),e.on("adplaying",this._startPlaybackHeartbeatInterval.bind(this)),e.on("devicewake",this._startPlaybackHeartbeatInterval.bind(this)),e.on("viewstart",this._startPlaybackHeartbeatInterval.bind(this)),e.on("rebufferstart",this._startPlaybackHeartbeatInterval.bind(this)),e.on("pause",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("ended",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("viewend",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("error",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("aderror",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("adpause",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("adended",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("adbreakend",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("seeked",function(){e.data.player_is_paused?t._stopPlaybackHeartbeatInterval():t._startPlaybackHeartbeatInterval()}),e.on("timeupdate",function(){t._playbackHeartbeatInterval!==null&&e.emit("playbackheartbeat")}),e.on("devicesleep",function(a,r){t._playbackHeartbeatInterval!==null&&(tt.default.clearInterval(t._playbackHeartbeatInterval),e.emit("playbackheartbeatend",{viewer_time:r.viewer_time}),t._playbackHeartbeatInterval=null)})}return Y(i,[{key:"_startPlaybackHeartbeatInterval",value:function(){var t=this;this._playbackHeartbeatInterval===null&&(this.pm.emit("playbackheartbeat"),this._playbackHeartbeatInterval=tt.default.setInterval(function(){t.pm.emit("playbackheartbeat")},this.pm.playbackHeartbeatTime))}},{key:"_stopPlaybackHeartbeatInterval",value:function(){this._playheadShouldBeProgressing=!1,this._playbackHeartbeatInterval!==null&&(tt.default.clearInterval(this._playbackHeartbeatInterval),this.pm.emit("playbackheartbeatend"),this._playbackHeartbeatInterval=null)}}]),i}(),or=nr,sr=function i(e){"use strict";var t=this;H(this,i),m(this,"viewErrored",void 0),e.on("viewinit",function(){t.viewErrored=!1}),e.on("error",function(a,r){try{var n=e.errorTranslator({player_error_code:r.player_error_code,player_error_message:r.player_error_message,player_error_context:r.player_error_context,player_error_severity:r.player_error_severity,player_error_business_exception:r.player_error_business_exception});n&&(e.data.player_error_code=n.player_error_code||r.player_error_code,e.data.player_error_message=n.player_error_message||r.player_error_message,e.data.player_error_context=n.player_error_context||r.player_error_context,e.data.player_error_severity=n.player_error_severity||r.player_error_severity,e.data.player_error_business_exception=n.player_error_business_exception||r.player_error_business_exception,t.viewErrored=!0)}catch(o){e.mux.log.warn("Exception in error translator callback.",o),t.viewErrored=!0}}),e.on("aftererror",function(){var a,r,n,o,s;(a=e.data)===null||a===void 0||delete a.player_error_code,(r=e.data)===null||r===void 0||delete r.player_error_message,(n=e.data)===null||n===void 0||delete n.player_error_context,(o=e.data)===null||o===void 0||delete o.player_error_severity,(s=e.data)===null||s===void 0||delete s.player_error_business_exception})},ur=sr,dr=function(){"use strict";function i(e){H(this,i),m(this,"_watchTimeTrackerLastCheckedTime",void 0),m(this,"pm",void 0),this.pm=e,this._watchTimeTrackerLastCheckedTime=null,e.on("playbackheartbeat",this._updateWatchTime.bind(this)),e.on("playbackheartbeatend",this._clearWatchTimeState.bind(this))}return Y(i,[{key:"_updateWatchTime",value:function(t,a){var r=a.viewer_time;this._watchTimeTrackerLastCheckedTime===null&&(this._watchTimeTrackerLastCheckedTime=r),B(this.pm.data,"view_watch_time",r-this._watchTimeTrackerLastCheckedTime),this._watchTimeTrackerLastCheckedTime=r}},{key:"_clearWatchTimeState",value:function(t,a){this._updateWatchTime(t,a),this._watchTimeTrackerLastCheckedTime=null}}]),i}(),lr=dr,cr=function(){"use strict";function i(e){var t=this;H(this,i),m(this,"_playbackTimeTrackerLastPlayheadPosition",void 0),m(this,"_lastTime",void 0),m(this,"_isAdPlaying",void 0),m(this,"_callbackUpdatePlaybackTime",void 0),m(this,"pm",void 0),this.pm=e,this._playbackTimeTrackerLastPlayheadPosition=-1,this._lastTime=F.now(),this._isAdPlaying=!1,this._callbackUpdatePlaybackTime=null,e.on("viewinit",function(){t.pm.data.view_playing_time_ms_cumulative=0});var a=this._startPlaybackTimeTracking.bind(this);e.on("playing",a),e.on("adplaying",a);var r=function(){t.pm.data.player_is_paused||a()};e.on("seeked",r),e.on("rebufferend",r);var n=this._stopPlaybackTimeTracking.bind(this);e.on("playbackheartbeatend",n),e.on("seeking",n),e.on("rebufferstart",n),e.on("adplaying",function(){t._isAdPlaying=!0}),e.on("adended",function(){t._isAdPlaying=!1}),e.on("adpause",function(){t._isAdPlaying=!1}),e.on("adbreakstart",function(){t._isAdPlaying=!1}),e.on("adbreakend",function(){t._isAdPlaying=!1}),e.on("adplay",function(){t._isAdPlaying=!1}),e.on("viewinit",function(){t._playbackTimeTrackerLastPlayheadPosition=-1,t._lastTime=F.now(),t._isAdPlaying=!1,t._callbackUpdatePlaybackTime=null})}return Y(i,[{key:"_startPlaybackTimeTracking",value:function(){this._callbackUpdatePlaybackTime===null&&(this._callbackUpdatePlaybackTime=this._updatePlaybackTime.bind(this),this._playbackTimeTrackerLastPlayheadPosition=this.pm.data.player_playhead_time,this._lastTime=F.now(),this.pm.on("playbackheartbeat",this._callbackUpdatePlaybackTime))}},{key:"_stopPlaybackTimeTracking",value:function(){this._callbackUpdatePlaybackTime&&(this._updatePlaybackTime(),this.pm.off("playbackheartbeat",this._callbackUpdatePlaybackTime),this._callbackUpdatePlaybackTime=null,this._playbackTimeTrackerLastPlayheadPosition=-1)}},{key:"_updatePlaybackTime",value:function(){var t=this.pm.data.player_playhead_time||0,a=F.now(),r=a-this._lastTime,n=-1;this._playbackTimeTrackerLastPlayheadPosition>=0&&t>this._playbackTimeTrackerLastPlayheadPosition?n=t-this._playbackTimeTrackerLastPlayheadPosition:this._isAdPlaying&&(n=r),n>0&&n<=1e3&&B(this.pm.data,"view_content_playback_time",n),this._callbackUpdatePlaybackTime!==null&&r>0&&r<=1e3&&(this._isAdPlaying&&B(this.pm.data,"ad_playing_time_ms_cumulative",r),B(this.pm.data,"view_playing_time_ms_cumulative",r)),this._playbackTimeTrackerLastPlayheadPosition=t,this._lastTime=a}}]),i}(),_r=cr,vr=function(){"use strict";function i(e){H(this,i),m(this,"pm",void 0),this.pm=e;var t=this._updatePlayheadTime.bind(this);e.on("playbackheartbeat",t),e.on("playbackheartbeatend",t),e.on("timeupdate",t),e.on("destroy",function(){e.off("timeupdate",t)})}return Y(i,[{key:"_updateMaxPlayheadPosition",value:function(){this.pm.data.view_max_playhead_position=typeof this.pm.data.view_max_playhead_position=="undefined"?this.pm.data.player_playhead_time:Math.max(this.pm.data.view_max_playhead_position,this.pm.data.player_playhead_time)}},{key:"_updatePlayheadTime",value:function(t,a){var r=this,n=function(){r.pm.currentFragmentPDT&&r.pm.currentFragmentStart&&(r.pm.data.player_program_time=r.pm.currentFragmentPDT+r.pm.data.player_playhead_time-r.pm.currentFragmentStart)};if(a&&a.player_playhead_time)this.pm.data.player_playhead_time=a.player_playhead_time,n(),this._updateMaxPlayheadPosition();else if(this.pm.getPlayheadTime){var o=this.pm.getPlayheadTime();typeof o!="undefined"&&(this.pm.data.player_playhead_time=o,n(),this._updateMaxPlayheadPosition())}}}]),i}(),pr=vr,kt=5*60*1e3,hr=function i(e){"use strict";if(H(this,i),!e.disableRebufferTracking){var t,a=function(o,s){r(s),t=void 0},r=function(o){if(t){var s=o.viewer_time-t;B(e.data,"view_rebuffer_duration",s),t=o.viewer_time,e.data.view_rebuffer_duration>kt&&(e.emit("viewend"),e.send("viewend"),e.mux.log.warn("Ending view after rebuffering for longer than ".concat(kt,"ms, future events will be ignored unless a programchange or videochange occurs.")))}e.data.view_watch_time>=0&&e.data.view_rebuffer_count>0&&(e.data.view_rebuffer_frequency=e.data.view_rebuffer_count/e.data.view_watch_time,e.data.view_rebuffer_percentage=e.data.view_rebuffer_duration/e.data.view_watch_time)};e.on("playbackheartbeat",function(n,o){return r(o)}),e.on("rebufferstart",function(n,o){t||(B(e.data,"view_rebuffer_count",1),t=o.viewer_time,e.one("rebufferend",a))}),e.on("viewinit",function(){t=void 0,e.off("rebufferend",a)})}},fr=hr,mr=function(){"use strict";function i(e){var t=this;H(this,i),m(this,"_lastCheckedTime",void 0),m(this,"_lastPlayheadTime",void 0),m(this,"_lastPlayheadTimeUpdatedTime",void 0),m(this,"_rebuffering",void 0),m(this,"pm",void 0),this.pm=e,!(e.disableRebufferTracking||e.disablePlayheadRebufferTracking)&&(this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null,e.on("playbackheartbeat",this._checkIfRebuffering.bind(this)),e.on("playbackheartbeatend",this._cleanupRebufferTracker.bind(this)),e.on("seeking",function(){t._cleanupRebufferTracker(null,{viewer_time:F.now()})}))}return Y(i,[{key:"_checkIfRebuffering",value:function(t,a){if(this.pm.seekingTracker.isSeeking||this.pm.adTracker.isAdBreak||!this.pm.playbackHeartbeat._playheadShouldBeProgressing){this._cleanupRebufferTracker(t,a);return}if(this._lastCheckedTime===null){this._prepareRebufferTrackerState(a.viewer_time);return}if(this._lastPlayheadTime!==this.pm.data.player_playhead_time){this._cleanupRebufferTracker(t,a,!0);return}var r=a.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.sustainedRebufferThreshold=="number"&&r>=this.pm.sustainedRebufferThreshold&&(this._rebuffering||(this._rebuffering=!0,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}))),this._lastCheckedTime=a.viewer_time}},{key:"_clearRebufferTrackerState",value:function(){this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null}},{key:"_prepareRebufferTrackerState",value:function(t){this._lastCheckedTime=t,this._lastPlayheadTime=this.pm.data.player_playhead_time,this._lastPlayheadTimeUpdatedTime=t}},{key:"_cleanupRebufferTracker",value:function(t,a){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(this._rebuffering)this._rebuffering=!1,this.pm.emit("rebufferend",{viewer_time:a.viewer_time});else{if(this._lastCheckedTime===null)return;var n=this.pm.data.player_playhead_time-this._lastPlayheadTime,o=a.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.minimumRebufferDuration=="number"&&n>0&&o-n>this.pm.minimumRebufferDuration&&(this._lastCheckedTime=null,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}),this.pm.emit("rebufferend",{viewer_time:this._lastPlayheadTimeUpdatedTime+o-n}))}r?this._prepareRebufferTrackerState(a.viewer_time):this._clearRebufferTrackerState()}}]),i}(),yr=mr,gr=function(){"use strict";function i(e){var t=this;H(this,i),m(this,"pm",void 0),this.pm=e,e.on("viewinit",function(){var a=e.data,r=a.view_id;if(!a.view_program_changed){var n=function(s,u){var d=u.viewer_time;(s.type==="playing"&&typeof e.data.view_time_to_first_frame=="undefined"||s.type==="adplaying"&&(typeof e.data.view_time_to_first_frame=="undefined"||t._inPrerollPosition()))&&t.calculateTimeToFirstFrame(d||F.now(),r)};e.one("playing",n),e.one("adplaying",n),e.one("viewend",function(){e.off("playing",n),e.off("adplaying",n)})}})}return Y(i,[{key:"_inPrerollPosition",value:function(){return typeof this.pm.data.view_content_playback_time=="undefined"||this.pm.data.view_content_playback_time<=1e3}},{key:"calculateTimeToFirstFrame",value:function(t,a){a===this.pm.data.view_id&&(this.pm.watchTimeTracker._updateWatchTime(null,{viewer_time:t}),this.pm.data.view_time_to_first_frame=this.pm.data.view_watch_time,(this.pm.data.player_autoplay_on||this.pm.data.video_is_autoplay)&&this.pm.pageLoadInitTime&&(this.pm.data.view_aggregate_startup_time=this.pm.data.view_start+this.pm.data.view_watch_time-this.pm.pageLoadInitTime))}}]),i}(),br=gr,Er=function i(e){"use strict";var t=this;H(this,i),m(this,"_lastPlayerHeight",void 0),m(this,"_lastPlayerWidth",void 0),m(this,"_lastPlayheadPosition",void 0),m(this,"_lastSourceHeight",void 0),m(this,"_lastSourceWidth",void 0),e.on("viewinit",function(){t._lastPlayheadPosition=-1});var a=["pause","rebufferstart","seeking","error","adbreakstart","hb","renditionchange","orientationchange","viewend","playbackmodechange"],r=["playing","hb","renditionchange","orientationchange","playbackmodechange"];a.forEach(function(n){e.on(n,function(){if(t._lastPlayheadPosition>=0&&e.data.player_playhead_time>=0&&t._lastPlayerWidth>=0&&t._lastSourceWidth>0&&t._lastPlayerHeight>=0&&t._lastSourceHeight>0){var o=e.data.player_playhead_time-t._lastPlayheadPosition;if(o<0){t._lastPlayheadPosition=-1;return}var s=Math.min(t._lastPlayerWidth/t._lastSourceWidth,t._lastPlayerHeight/t._lastSourceHeight),u=Math.max(0,s-1),d=Math.max(0,1-s);e.data.view_max_upscale_percentage=Math.max(e.data.view_max_upscale_percentage||0,u),e.data.view_max_downscale_percentage=Math.max(e.data.view_max_downscale_percentage||0,d),B(e.data,"view_total_content_playback_time",o),B(e.data,"view_total_upscaling",u*o),B(e.data,"view_total_downscaling",d*o)}t._lastPlayheadPosition=-1})}),r.forEach(function(n){e.on(n,function(){t._lastPlayheadPosition=e.data.player_playhead_time,t._lastPlayerWidth=e.data.player_width,t._lastPlayerHeight=e.data.player_height,t._lastSourceWidth=e.data.video_source_width,t._lastSourceHeight=e.data.video_source_height})})},Tr=Er,wr=2e3,kr=function i(e){"use strict";var t=this;H(this,i),m(this,"isSeeking",void 0),this.isSeeking=!1;var a=-1,r=function(){var o=F.now(),s=(e.data.viewer_time||o)-(a||o);B(e.data,"view_seek_duration",s),e.data.view_max_seek_time=Math.max(e.data.view_max_seek_time||0,s),t.isSeeking=!1,a=-1};e.on("seeking",function(n,o){if(Object.assign(e.data,o),t.isSeeking&&o.viewer_time-a<=wr){a=o.viewer_time;return}t.isSeeking&&r(),t.isSeeking=!0,a=o.viewer_time,B(e.data,"view_seek_count",1),e.send("seeking")}),e.on("seeked",function(){r()}),e.on("viewend",function(){t.isSeeking&&(r(),e.send("seeked")),t.isSeeking=!1,a=-1})},Dr=kr,Dt=function(e,t){e.push(t),e.sort(function(a,r){return a.viewer_time-r.viewer_time})},Ar=["adbreakstart","adrequest","adresponse","adplay","adplaying","adpause","adended","adbreakend","aderror","adclicked","adskipped"],xr=function(){"use strict";function i(e){var t=this;H(this,i),m(this,"_adHasPlayed",void 0),m(this,"_adRequests",void 0),m(this,"_adResponses",void 0),m(this,"_currentAdRequestNumber",void 0),m(this,"_currentAdResponseNumber",void 0),m(this,"_prerollPlayTime",void 0),m(this,"_wouldBeNewAdPlay",void 0),m(this,"isAdBreak",void 0),m(this,"pm",void 0),this.pm=e,e.on("viewinit",function(){t.isAdBreak=!1,t._currentAdRequestNumber=0,t._currentAdResponseNumber=0,t._adRequests=[],t._adResponses=[],t._adHasPlayed=!1,t._wouldBeNewAdPlay=!0,t._prerollPlayTime=void 0}),Ar.forEach(function(r){return e.on(r,t._updateAdData.bind(t))});var a=function(){t.isAdBreak=!1};e.on("adbreakstart",function(){t.isAdBreak=!0}),e.on("play",a),e.on("playing",a),e.on("viewend",a),e.on("adrequest",function(r,n){n=Object.assign({ad_request_id:"generatedAdRequestId"+t._currentAdRequestNumber++},n),Dt(t._adRequests,n),B(e.data,"view_ad_request_count"),t.inPrerollPosition()&&(e.data.view_preroll_requested=!0,t._adHasPlayed||B(e.data,"view_preroll_request_count"))}),e.on("adresponse",function(r,n){n=Object.assign({ad_request_id:"generatedAdRequestId"+t._currentAdResponseNumber++},n),Dt(t._adResponses,n);var o=t.findAdRequest(n.ad_request_id);o&&B(e.data,"view_ad_request_time",Math.max(0,n.viewer_time-o.viewer_time))}),e.on("adplay",function(r,n){t._adHasPlayed=!0,t._wouldBeNewAdPlay&&(t._wouldBeNewAdPlay=!1,B(e.data,"view_ad_played_count")),t.inPrerollPosition()&&!e.data.view_preroll_played&&(e.data.view_preroll_played=!0,t._adRequests.length>0&&(e.data.view_preroll_request_time=Math.max(0,n.viewer_time-t._adRequests[0].viewer_time)),e.data.view_start&&(e.data.view_startup_preroll_request_time=Math.max(0,n.viewer_time-e.data.view_start)),t._prerollPlayTime=n.viewer_time)}),e.on("adplaying",function(r,n){t.inPrerollPosition()&&typeof e.data.view_preroll_load_time=="undefined"&&typeof t._prerollPlayTime!="undefined"&&(e.data.view_preroll_load_time=n.viewer_time-t._prerollPlayTime,e.data.view_startup_preroll_load_time=n.viewer_time-t._prerollPlayTime)}),e.on("adclicked",function(r,n){t._wouldBeNewAdPlay||B(e.data,"view_ad_clicked_count")}),e.on("adskipped",function(r,n){t._wouldBeNewAdPlay||B(e.data,"view_ad_skipped_count")}),e.on("adended",function(){t._wouldBeNewAdPlay=!0}),e.on("aderror",function(){t._wouldBeNewAdPlay=!0})}return Y(i,[{key:"inPrerollPosition",value:function(){return typeof this.pm.data.view_content_playback_time=="undefined"||this.pm.data.view_content_playback_time<=1e3}},{key:"findAdRequest",val