@eluvio/elv-player-js 2.0.42 → 2.0.44

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.
@@ -0,0 +1,1815 @@
1
+ var ht = Object.create, Be = Object.defineProperty, pt = Object.getOwnPropertyDescriptor, ft = Object.getOwnPropertyNames, vt = Object.getPrototypeOf, mt = Object.prototype.hasOwnProperty, Ue = function(a, e) {
2
+ return function() {
3
+ return a && (e = a(a = 0)), e;
4
+ };
5
+ }, L = function(a, e) {
6
+ return function() {
7
+ return e || a((e = { exports: {} }).exports, e), e.exports;
8
+ };
9
+ }, yt = function(a, e, t, r) {
10
+ if (e && typeof e == "object" || typeof e == "function") for (var i = ft(e), n = 0, o = i.length, u; n < o; n++) u = i[n], !mt.call(a, u) && u !== t && Be(a, u, { get: (function(l) {
11
+ return e[l];
12
+ }).bind(null, u), enumerable: !(r = pt(e, u)) || r.enumerable });
13
+ return a;
14
+ }, C = function(a, e, t) {
15
+ return t = a != null ? ht(vt(a)) : {}, yt(!a || !a.__esModule ? Be(t, "default", { value: a, enumerable: !0 }) : t, a);
16
+ }, U = L(function(a, e) {
17
+ var t;
18
+ typeof window < "u" ? t = window : typeof global < "u" ? t = global : typeof self < "u" ? t = self : t = {}, e.exports = t;
19
+ });
20
+ function Z(a, e) {
21
+ return e != null && typeof Symbol < "u" && e[Symbol.hasInstance] ? !!e[Symbol.hasInstance](a) : Z(a, e);
22
+ }
23
+ var $ = Ue(function() {
24
+ $();
25
+ });
26
+ function Fe(a) {
27
+ "@swc/helpers - typeof";
28
+ return a && typeof Symbol < "u" && a.constructor === Symbol ? "symbol" : typeof a;
29
+ }
30
+ var Ve = Ue(function() {
31
+ }), Ge = L(function(a, e) {
32
+ var t = Array.prototype.slice;
33
+ e.exports = r;
34
+ function r(i, n) {
35
+ for (("length" in i) || (i = [i]), i = t.call(i); i.length; ) {
36
+ var o = i.shift(), u = n(o);
37
+ if (u) return u;
38
+ o.childNodes && o.childNodes.length && (i = t.call(o.childNodes).concat(i));
39
+ }
40
+ }
41
+ }), gt = L(function(a, e) {
42
+ $(), e.exports = t;
43
+ function t(r, i) {
44
+ if (!Z(this, t)) return new t(r, i);
45
+ this.data = r, this.nodeValue = r, this.length = r.length, this.ownerDocument = i || null;
46
+ }
47
+ t.prototype.nodeType = 8, t.prototype.nodeName = "#comment", t.prototype.toString = function() {
48
+ return "[object Comment]";
49
+ };
50
+ }), bt = L(function(a, e) {
51
+ $(), e.exports = t;
52
+ function t(r, i) {
53
+ if (!Z(this, t)) return new t(r);
54
+ this.data = r || "", this.length = this.data.length, this.ownerDocument = i || null;
55
+ }
56
+ t.prototype.type = "DOMTextNode", t.prototype.nodeType = 3, t.prototype.nodeName = "#text", t.prototype.toString = function() {
57
+ return this.data;
58
+ }, t.prototype.replaceData = function(r, i, n) {
59
+ var o = this.data, u = o.substring(0, r), l = o.substring(r + i, o.length);
60
+ this.data = u + n + l, this.length = this.data.length;
61
+ };
62
+ }), We = L(function(a, e) {
63
+ e.exports = t;
64
+ function t(r) {
65
+ var i = this, n = r.type;
66
+ r.target || (r.target = i), i.listeners || (i.listeners = {});
67
+ var o = i.listeners[n];
68
+ if (o) return o.forEach(function(u) {
69
+ r.currentTarget = i, typeof u == "function" ? u(r) : u.handleEvent(r);
70
+ });
71
+ i.parentNode && i.parentNode.dispatchEvent(r);
72
+ }
73
+ }), Qe = L(function(a, e) {
74
+ e.exports = t;
75
+ function t(r, i) {
76
+ var n = this;
77
+ n.listeners || (n.listeners = {}), n.listeners[r] || (n.listeners[r] = []), n.listeners[r].indexOf(i) === -1 && n.listeners[r].push(i);
78
+ }
79
+ }), Je = L(function(a, e) {
80
+ e.exports = t;
81
+ function t(r, i) {
82
+ var n = this;
83
+ if (n.listeners && n.listeners[r]) {
84
+ var o = n.listeners[r], u = o.indexOf(i);
85
+ u !== -1 && o.splice(u, 1);
86
+ }
87
+ }
88
+ }), wt = L(function(a, e) {
89
+ Ve(), e.exports = r;
90
+ var t = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "menuitem", "meta", "param", "source", "track", "wbr"];
91
+ function r(d) {
92
+ switch (d.nodeType) {
93
+ case 3:
94
+ return v(d.data);
95
+ case 8:
96
+ return "<!--" + d.data + "-->";
97
+ default:
98
+ return i(d);
99
+ }
100
+ }
101
+ function i(d) {
102
+ var s = [], _ = d.tagName;
103
+ return d.namespaceURI === "http://www.w3.org/1999/xhtml" && (_ = _.toLowerCase()), s.push("<" + _ + c(d) + u(d)), t.indexOf(_) > -1 ? s.push(" />") : (s.push(">"), d.childNodes.length ? s.push.apply(s, d.childNodes.map(r)) : d.textContent || d.innerText ? s.push(v(d.textContent || d.innerText)) : d.innerHTML && s.push(d.innerHTML), s.push("</" + _ + ">")), s.join("");
104
+ }
105
+ function n(d, s) {
106
+ var _ = Fe(d[s]);
107
+ return s === "style" && Object.keys(d.style).length > 0 ? !0 : d.hasOwnProperty(s) && (_ === "string" || _ === "boolean" || _ === "number") && s !== "nodeName" && s !== "className" && s !== "tagName" && s !== "textContent" && s !== "innerText" && s !== "namespaceURI" && s !== "innerHTML";
108
+ }
109
+ function o(d) {
110
+ if (typeof d == "string") return d;
111
+ var s = "";
112
+ return Object.keys(d).forEach(function(_) {
113
+ var y = d[_];
114
+ _ = _.replace(/[A-Z]/g, function(f) {
115
+ return "-" + f.toLowerCase();
116
+ }), s += _ + ":" + y + ";";
117
+ }), s;
118
+ }
119
+ function u(d) {
120
+ var s = d.dataset, _ = [];
121
+ for (var y in s) _.push({ name: "data-" + y, value: s[y] });
122
+ return _.length ? l(_) : "";
123
+ }
124
+ function l(d) {
125
+ var s = [];
126
+ return d.forEach(function(_) {
127
+ var y = _.name, f = _.value;
128
+ y === "style" && (f = o(f)), s.push(y + '="' + b(f) + '"');
129
+ }), s.length ? " " + s.join(" ") : "";
130
+ }
131
+ function c(d) {
132
+ var s = [];
133
+ for (var _ in d) n(d, _) && s.push({ name: _, value: d[_] });
134
+ for (var y in d._attributes) for (var f in d._attributes[y]) {
135
+ var g = d._attributes[y][f], p = (g.prefix ? g.prefix + ":" : "") + f;
136
+ s.push({ name: p, value: g.value });
137
+ }
138
+ return d.className && s.push({ name: "class", value: d.className }), s.length ? l(s) : "";
139
+ }
140
+ function v(d) {
141
+ var s = "";
142
+ return typeof d == "string" ? s = d : d && (s = d.toString()), s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
143
+ }
144
+ function b(d) {
145
+ return v(d).replace(/"/g, "&quot;");
146
+ }
147
+ }), ze = L(function(a, e) {
148
+ $();
149
+ var t = Ge(), r = We(), i = Qe(), n = Je(), o = wt(), u = "http://www.w3.org/1999/xhtml";
150
+ e.exports = l;
151
+ function l(c, v, b) {
152
+ if (!Z(this, l)) return new l(c);
153
+ var d = b === void 0 ? u : b || null;
154
+ this.tagName = d === u ? String(c).toUpperCase() : c, this.nodeName = this.tagName, this.className = "", this.dataset = {}, this.childNodes = [], this.parentNode = null, this.style = {}, this.ownerDocument = v || null, this.namespaceURI = d, this._attributes = {}, this.tagName === "INPUT" && (this.type = "text");
155
+ }
156
+ l.prototype.type = "DOMElement", l.prototype.nodeType = 1, l.prototype.appendChild = function(c) {
157
+ return c.parentNode && c.parentNode.removeChild(c), this.childNodes.push(c), c.parentNode = this, c;
158
+ }, l.prototype.replaceChild = function(c, v) {
159
+ c.parentNode && c.parentNode.removeChild(c);
160
+ var b = this.childNodes.indexOf(v);
161
+ return v.parentNode = null, this.childNodes[b] = c, c.parentNode = this, v;
162
+ }, l.prototype.removeChild = function(c) {
163
+ var v = this.childNodes.indexOf(c);
164
+ return this.childNodes.splice(v, 1), c.parentNode = null, c;
165
+ }, l.prototype.insertBefore = function(c, v) {
166
+ c.parentNode && c.parentNode.removeChild(c);
167
+ var b = v == null ? -1 : this.childNodes.indexOf(v);
168
+ return b > -1 ? this.childNodes.splice(b, 0, c) : this.childNodes.push(c), c.parentNode = this, c;
169
+ }, l.prototype.setAttributeNS = function(c, v, b) {
170
+ var d = null, s = v, _ = v.indexOf(":");
171
+ if (_ > -1 && (d = v.substr(0, _), s = v.substr(_ + 1)), this.tagName === "INPUT" && v === "type") this.type = b;
172
+ else {
173
+ var y = this._attributes[c] || (this._attributes[c] = {});
174
+ y[s] = { value: b, prefix: d };
175
+ }
176
+ }, l.prototype.getAttributeNS = function(c, v) {
177
+ var b = this._attributes[c], d = b && b[v] && b[v].value;
178
+ return this.tagName === "INPUT" && v === "type" ? this.type : typeof d != "string" ? null : d;
179
+ }, l.prototype.removeAttributeNS = function(c, v) {
180
+ var b = this._attributes[c];
181
+ b && delete b[v];
182
+ }, l.prototype.hasAttributeNS = function(c, v) {
183
+ var b = this._attributes[c];
184
+ return !!b && v in b;
185
+ }, l.prototype.setAttribute = function(c, v) {
186
+ return this.setAttributeNS(null, c, v);
187
+ }, l.prototype.getAttribute = function(c) {
188
+ return this.getAttributeNS(null, c);
189
+ }, l.prototype.removeAttribute = function(c) {
190
+ return this.removeAttributeNS(null, c);
191
+ }, l.prototype.hasAttribute = function(c) {
192
+ return this.hasAttributeNS(null, c);
193
+ }, l.prototype.removeEventListener = n, l.prototype.addEventListener = i, l.prototype.dispatchEvent = r, l.prototype.focus = function() {
194
+ }, l.prototype.toString = function() {
195
+ return o(this);
196
+ }, l.prototype.getElementsByClassName = function(c) {
197
+ var v = c.split(" "), b = [];
198
+ return t(this, function(d) {
199
+ if (d.nodeType === 1) {
200
+ var s = d.className || "", _ = s.split(" ");
201
+ v.every(function(y) {
202
+ return _.indexOf(y) !== -1;
203
+ }) && b.push(d);
204
+ }
205
+ }), b;
206
+ }, l.prototype.getElementsByTagName = function(c) {
207
+ c = c.toLowerCase();
208
+ var v = [];
209
+ return t(this.childNodes, function(b) {
210
+ b.nodeType === 1 && (c === "*" || b.tagName.toLowerCase() === c) && v.push(b);
211
+ }), v;
212
+ }, l.prototype.contains = function(c) {
213
+ return t(this, function(v) {
214
+ return c === v;
215
+ }) || !1;
216
+ };
217
+ }), Tt = L(function(a, e) {
218
+ $();
219
+ var t = ze();
220
+ e.exports = r;
221
+ function r(i) {
222
+ if (!Z(this, r)) return new r();
223
+ this.childNodes = [], this.parentNode = null, this.ownerDocument = i || null;
224
+ }
225
+ r.prototype.type = "DocumentFragment", r.prototype.nodeType = 11, r.prototype.nodeName = "#document-fragment", r.prototype.appendChild = t.prototype.appendChild, r.prototype.replaceChild = t.prototype.replaceChild, r.prototype.removeChild = t.prototype.removeChild, r.prototype.toString = function() {
226
+ return this.childNodes.map(function(i) {
227
+ return String(i);
228
+ }).join("");
229
+ };
230
+ }), kt = L(function(a, e) {
231
+ e.exports = t;
232
+ function t(r) {
233
+ }
234
+ t.prototype.initEvent = function(r, i, n) {
235
+ this.type = r, this.bubbles = i, this.cancelable = n;
236
+ }, t.prototype.preventDefault = function() {
237
+ };
238
+ }), Et = L(function(a, e) {
239
+ $();
240
+ var t = Ge(), r = gt(), i = bt(), n = ze(), o = Tt(), u = kt(), l = We(), c = Qe(), v = Je();
241
+ e.exports = b;
242
+ function b() {
243
+ if (!Z(this, b)) return new b();
244
+ 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;
245
+ }
246
+ var d = b.prototype;
247
+ d.createTextNode = function(s) {
248
+ return new i(s, this);
249
+ }, d.createElementNS = function(s, _) {
250
+ var y = s === null ? null : String(s);
251
+ return new n(_, this, y);
252
+ }, d.createElement = function(s) {
253
+ return new n(s, this);
254
+ }, d.createDocumentFragment = function() {
255
+ return new o(this);
256
+ }, d.createEvent = function(s) {
257
+ return new u(s);
258
+ }, d.createComment = function(s) {
259
+ return new r(s, this);
260
+ }, d.getElementById = function(s) {
261
+ s = String(s);
262
+ var _ = t(this.childNodes, function(y) {
263
+ if (String(y.id) === s) return y;
264
+ });
265
+ return _ || null;
266
+ }, d.getElementsByClassName = n.prototype.getElementsByClassName, d.getElementsByTagName = n.prototype.getElementsByTagName, d.contains = n.prototype.contains, d.removeEventListener = v, d.addEventListener = c, d.dispatchEvent = l;
267
+ }), xt = L(function(a, e) {
268
+ var t = Et();
269
+ e.exports = new t();
270
+ }), Ke = L(function(a, e) {
271
+ var t = typeof global < "u" ? global : typeof window < "u" ? window : {}, r = xt(), i;
272
+ typeof document < "u" ? i = document : (i = t["__GLOBAL_DOCUMENT_CACHE@4"], i || (i = t["__GLOBAL_DOCUMENT_CACHE@4"] = r)), e.exports = i;
273
+ });
274
+ function Dt(a) {
275
+ if (Array.isArray(a)) return a;
276
+ }
277
+ function At(a, e) {
278
+ var t = a == null ? null : typeof Symbol < "u" && a[Symbol.iterator] || a["@@iterator"];
279
+ if (t != null) {
280
+ var r = [], i = !0, n = !1, o, u;
281
+ try {
282
+ for (t = t.call(a); !(i = (o = t.next()).done) && (r.push(o.value), !(e && r.length === e)); i = !0) ;
283
+ } catch (l) {
284
+ n = !0, u = l;
285
+ } finally {
286
+ try {
287
+ !i && t.return != null && t.return();
288
+ } finally {
289
+ if (n) throw u;
290
+ }
291
+ }
292
+ return r;
293
+ }
294
+ }
295
+ function Rt() {
296
+ throw new TypeError(`Invalid attempt to destructure non-iterable instance.
297
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
298
+ }
299
+ function De(a, e) {
300
+ (e == null || e > a.length) && (e = a.length);
301
+ for (var t = 0, r = new Array(e); t < e; t++) r[t] = a[t];
302
+ return r;
303
+ }
304
+ function Ye(a, e) {
305
+ if (a) {
306
+ if (typeof a == "string") return De(a, e);
307
+ var t = Object.prototype.toString.call(a).slice(8, -1);
308
+ if (t === "Object" && a.constructor && (t = a.constructor.name), t === "Map" || t === "Set") return Array.from(t);
309
+ if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)) return De(a, e);
310
+ }
311
+ }
312
+ function G(a, e) {
313
+ return Dt(a) || At(a, e) || Ye(a, e) || Rt();
314
+ }
315
+ var se = C(U()), Pe = C(U()), Ot = C(U()), St = { now: function() {
316
+ var a = Ot.default.performance, e = a && a.timing, t = e && e.navigationStart, r = typeof t == "number" && typeof a.now == "function" ? t + a.now() : Date.now();
317
+ return Math.round(r);
318
+ } }, N = St, de = function() {
319
+ var a, e, t;
320
+ if (typeof ((a = Pe.default.crypto) === null || a === void 0 ? void 0 : a.getRandomValues) == "function") {
321
+ t = new Uint8Array(32), Pe.default.crypto.getRandomValues(t);
322
+ for (var r = 0; r < 32; r++) t[r] = t[r] % 16;
323
+ } else {
324
+ t = [];
325
+ for (var i = 0; i < 32; i++) t[i] = Math.random() * 16 | 0;
326
+ }
327
+ var n = 0;
328
+ e = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(l) {
329
+ var c = l === "x" ? t[n] : t[n] & 3 | 8;
330
+ return n++, c.toString(16);
331
+ });
332
+ var o = N.now(), u = o == null ? void 0 : o.toString(16).substring(3);
333
+ return u ? e.substring(0, 28) + u : e;
334
+ }, Xe = function() {
335
+ return ("000000" + (Math.random() * Math.pow(36, 6) << 0).toString(36)).slice(-6);
336
+ }, H = function(a) {
337
+ if (a && typeof a.nodeName < "u") return a.muxId || (a.muxId = Xe()), a.muxId;
338
+ var e;
339
+ try {
340
+ e = document.querySelector(a);
341
+ } catch {
342
+ }
343
+ return e && !e.muxId && (e.muxId = a), (e == null ? void 0 : e.muxId) || a;
344
+ }, he = function(a) {
345
+ var e;
346
+ a && typeof a.nodeName < "u" ? (e = a, a = H(e)) : e = document.querySelector(a);
347
+ var t = e && e.nodeName ? e.nodeName.toLowerCase() : "";
348
+ return [e, a, t];
349
+ };
350
+ function qt(a) {
351
+ if (Array.isArray(a)) return De(a);
352
+ }
353
+ function Nt(a) {
354
+ if (typeof Symbol < "u" && a[Symbol.iterator] != null || a["@@iterator"] != null) return Array.from(a);
355
+ }
356
+ function Pt() {
357
+ throw new TypeError(`Invalid attempt to spread non-iterable instance.
358
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
359
+ }
360
+ function M(a) {
361
+ return qt(a) || Nt(a) || Ye(a) || Pt();
362
+ }
363
+ var Y = { TRACE: 0, DEBUG: 1, INFO: 2, WARN: 3, ERROR: 4, SILENT: 5 }, It = function(a) {
364
+ var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 3, t, r, i, n, o, u = [console, a], l = (t = console.trace).bind.apply(t, M(u)), c = (r = console.info).bind.apply(r, M(u)), v = (i = console.debug).bind.apply(i, M(u)), b = (n = console.warn).bind.apply(n, M(u)), d = (o = console.error).bind.apply(o, M(u)), s = e;
365
+ return { trace: function() {
366
+ for (var _ = arguments.length, y = new Array(_), f = 0; f < _; f++) y[f] = arguments[f];
367
+ if (!(s > Y.TRACE)) return l.apply(void 0, M(y));
368
+ }, debug: function() {
369
+ for (var _ = arguments.length, y = new Array(_), f = 0; f < _; f++) y[f] = arguments[f];
370
+ if (!(s > Y.DEBUG)) return v.apply(void 0, M(y));
371
+ }, info: function() {
372
+ for (var _ = arguments.length, y = new Array(_), f = 0; f < _; f++) y[f] = arguments[f];
373
+ if (!(s > Y.INFO)) return c.apply(void 0, M(y));
374
+ }, warn: function() {
375
+ for (var _ = arguments.length, y = new Array(_), f = 0; f < _; f++) y[f] = arguments[f];
376
+ if (!(s > Y.WARN)) return b.apply(void 0, M(y));
377
+ }, error: function() {
378
+ for (var _ = arguments.length, y = new Array(_), f = 0; f < _; f++) y[f] = arguments[f];
379
+ if (!(s > Y.ERROR)) return d.apply(void 0, M(y));
380
+ }, get level() {
381
+ return s;
382
+ }, set level(_) {
383
+ _ !== this.level && (s = _ ?? e);
384
+ } };
385
+ }, A = It("[mux]"), we = C(U());
386
+ function Ae() {
387
+ var a = we.default.doNotTrack || we.default.navigator && we.default.navigator.doNotTrack;
388
+ return a === "1";
389
+ }
390
+ function T(a) {
391
+ if (a === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
392
+ return a;
393
+ }
394
+ $();
395
+ function I(a, e) {
396
+ if (!Z(a, e)) throw new TypeError("Cannot call a class as a function");
397
+ }
398
+ function Lt(a, e) {
399
+ for (var t = 0; t < e.length; t++) {
400
+ var r = e[t];
401
+ r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(a, r.key, r);
402
+ }
403
+ }
404
+ function V(a, e, t) {
405
+ return e && Lt(a.prototype, e), a;
406
+ }
407
+ function m(a, e, t) {
408
+ return e in a ? Object.defineProperty(a, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : a[e] = t, a;
409
+ }
410
+ function te(a) {
411
+ return te = Object.setPrototypeOf ? Object.getPrototypeOf : function(e) {
412
+ return e.__proto__ || Object.getPrototypeOf(e);
413
+ }, te(a);
414
+ }
415
+ function Ct(a, e) {
416
+ for (; !Object.prototype.hasOwnProperty.call(a, e) && (a = te(a), a !== null); ) ;
417
+ return a;
418
+ }
419
+ function _e(a, e, t) {
420
+ return typeof Reflect < "u" && Reflect.get ? _e = Reflect.get : _e = function(r, i, n) {
421
+ var o = Ct(r, i);
422
+ if (o) {
423
+ var u = Object.getOwnPropertyDescriptor(o, i);
424
+ return u.get ? u.get.call(n || r) : u.value;
425
+ }
426
+ }, _e(a, e, t || a);
427
+ }
428
+ function Re(a, e) {
429
+ return Re = Object.setPrototypeOf || function(t, r) {
430
+ return t.__proto__ = r, t;
431
+ }, Re(a, e);
432
+ }
433
+ function jt(a, e) {
434
+ if (typeof e != "function" && e !== null) throw new TypeError("Super expression must either be null or a function");
435
+ a.prototype = Object.create(e && e.prototype, { constructor: { value: a, writable: !0, configurable: !0 } }), e && Re(a, e);
436
+ }
437
+ function Ht() {
438
+ if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
439
+ if (typeof Proxy == "function") return !0;
440
+ try {
441
+ return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
442
+ })), !0;
443
+ } catch {
444
+ return !1;
445
+ }
446
+ }
447
+ Ve();
448
+ function Mt(a, e) {
449
+ return e && (Fe(e) === "object" || typeof e == "function") ? e : T(a);
450
+ }
451
+ function Bt(a) {
452
+ var e = Ht();
453
+ return function() {
454
+ var t = te(a), r;
455
+ if (e) {
456
+ var i = te(this).constructor;
457
+ r = Reflect.construct(t, arguments, i);
458
+ } else r = t.apply(this, arguments);
459
+ return Mt(this, r);
460
+ };
461
+ }
462
+ var B = function(a) {
463
+ return le(a)[0];
464
+ }, le = function(a) {
465
+ if (typeof a != "string" || a === "") return ["localhost"];
466
+ var e = /^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/, t = a.match(e) || [], r = t[4], i;
467
+ return r && (i = (r.match(/[^\.]+\.[^\.]+$/) || [])[0]), [r, i];
468
+ }, Te = C(U()), Ut = { exists: function() {
469
+ var a = Te.default.performance, e = a && a.timing;
470
+ return e !== void 0;
471
+ }, domContentLoadedEventEnd: function() {
472
+ var a = Te.default.performance, e = a && a.timing;
473
+ return e && e.domContentLoadedEventEnd;
474
+ }, navigationStart: function() {
475
+ var a = Te.default.performance, e = a && a.timing;
476
+ return e && e.navigationStart;
477
+ } }, pe = Ut;
478
+ function q(a, e, t) {
479
+ t = t === void 0 ? 1 : t, a[e] = a[e] || 0, a[e] += t;
480
+ }
481
+ function fe(a) {
482
+ for (var e = 1; e < arguments.length; e++) {
483
+ var t = arguments[e] != null ? arguments[e] : {}, r = Object.keys(t);
484
+ typeof Object.getOwnPropertySymbols == "function" && (r = r.concat(Object.getOwnPropertySymbols(t).filter(function(i) {
485
+ return Object.getOwnPropertyDescriptor(t, i).enumerable;
486
+ }))), r.forEach(function(i) {
487
+ m(a, i, t[i]);
488
+ });
489
+ }
490
+ return a;
491
+ }
492
+ function Ft(a, e) {
493
+ var t = Object.keys(a);
494
+ if (Object.getOwnPropertySymbols) {
495
+ var r = Object.getOwnPropertySymbols(a);
496
+ t.push.apply(t, r);
497
+ }
498
+ return t;
499
+ }
500
+ function Se(a, e) {
501
+ return e = e ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(a, Object.getOwnPropertyDescriptors(e)) : Ft(Object(e)).forEach(function(t) {
502
+ Object.defineProperty(a, t, Object.getOwnPropertyDescriptor(e, t));
503
+ }), a;
504
+ }
505
+ var Vt = ["x-cdn", "content-type"], Ze = ["x-request-id", "cf-ray", "x-amz-cf-id", "x-akamai-request-id"], Gt = Vt.concat(Ze);
506
+ function qe(a) {
507
+ a = a || "";
508
+ var e = {}, t = a.trim().split(/[\r\n]+/);
509
+ return t.forEach(function(r) {
510
+ if (r) {
511
+ var i = r.split(": "), n = i.shift();
512
+ n && (Gt.indexOf(n.toLowerCase()) >= 0 || n.toLowerCase().indexOf("x-litix-") === 0) && (e[n] = i.join(": "));
513
+ }
514
+ }), e;
515
+ }
516
+ function ve(a) {
517
+ if (a) {
518
+ var e = Ze.find(function(t) {
519
+ return a[t] !== void 0;
520
+ });
521
+ return e ? a[e] : void 0;
522
+ }
523
+ }
524
+ var Wt = function(a) {
525
+ var e = {};
526
+ for (var t in a) {
527
+ var r = a[t], i = r["DATA-ID"].search("io.litix.data.");
528
+ if (i !== -1) {
529
+ var n = r["DATA-ID"].replace("io.litix.data.", "");
530
+ e[n] = r.VALUE;
531
+ }
532
+ }
533
+ return e;
534
+ }, $e = Wt, ce = function(a) {
535
+ if (!a) return {};
536
+ var e = pe.navigationStart(), t = a.loading, r = t ? t.start : a.trequest, i = t ? t.first : a.tfirst, n = t ? t.end : a.tload;
537
+ return { bytesLoaded: a.total, requestStart: Math.round(e + r), responseStart: Math.round(e + i), responseEnd: Math.round(e + n) };
538
+ }, ne = function(a) {
539
+ if (!(!a || typeof a.getAllResponseHeaders != "function")) return qe(a.getAllResponseHeaders());
540
+ }, Qt = function(a, e, t) {
541
+ var r = arguments.length > 4 ? arguments[4] : void 0, i = a.log, n = a.utils.secondsToMs, o = function(f) {
542
+ var g = parseInt(r.version), p;
543
+ return g === 1 && f.programDateTime !== null && (p = f.programDateTime), g === 0 && f.pdt !== null && (p = f.pdt), p;
544
+ };
545
+ if (!pe.exists()) {
546
+ i.warn("performance timing not supported. Not tracking HLS.js.");
547
+ return;
548
+ }
549
+ var u = function(f, g) {
550
+ return a.emit(e, f, g);
551
+ }, l = function(f, g) {
552
+ var p = g.levels, h = g.audioTracks, w = g.url, k = g.stats, E = g.networkDetails, D = g.sessionData, O = {}, P = {};
553
+ p.forEach(function(j, z) {
554
+ O[z] = { width: j.width, height: j.height, bitrate: j.bitrate, attrs: j.attrs };
555
+ }), h.forEach(function(j, z) {
556
+ P[z] = { name: j.name, language: j.lang, bitrate: j.bitrate };
557
+ });
558
+ var R = ce(k), x = R.bytesLoaded, Q = R.requestStart, ae = R.responseStart, re = R.responseEnd;
559
+ u("requestcompleted", Se(fe({}, $e(D)), { request_event_type: f, request_bytes_loaded: x, request_start: Q, request_response_start: ae, request_response_end: re, request_type: "manifest", request_hostname: B(w), request_response_headers: ne(E), request_rendition_lists: { media: O, audio: P, video: {} } }));
560
+ };
561
+ t.on(r.Events.MANIFEST_LOADED, l);
562
+ var c = function(f, g) {
563
+ var p = g.details, h = g.level, w = g.networkDetails, k = g.stats, E = ce(k), D = E.bytesLoaded, O = E.requestStart, P = E.responseStart, R = E.responseEnd, x = p.fragments[p.fragments.length - 1], Q = o(x) + n(x.duration);
564
+ u("requestcompleted", { request_event_type: f, request_bytes_loaded: D, request_start: O, request_response_start: P, request_response_end: R, request_current_level: h, request_type: "manifest", request_hostname: B(p.url), request_response_headers: ne(w), video_holdback: p.holdBack && n(p.holdBack), video_part_holdback: p.partHoldBack && n(p.partHoldBack), video_part_target_duration: p.partTarget && n(p.partTarget), video_target_duration: p.targetduration && n(p.targetduration), video_source_is_live: p.live, player_manifest_newest_program_time: isNaN(Q) ? void 0 : Q });
565
+ };
566
+ t.on(r.Events.LEVEL_LOADED, c);
567
+ var v = function(f, g) {
568
+ var p = g.details, h = g.networkDetails, w = g.stats, k = ce(w), E = k.bytesLoaded, D = k.requestStart, O = k.responseStart, P = k.responseEnd;
569
+ u("requestcompleted", { request_event_type: f, request_bytes_loaded: E, request_start: D, request_response_start: O, request_response_end: P, request_type: "manifest", request_hostname: B(p.url), request_response_headers: ne(h) });
570
+ };
571
+ t.on(r.Events.AUDIO_TRACK_LOADED, v);
572
+ var b = function(f, g) {
573
+ var p = g.stats, h = g.networkDetails, w = g.frag;
574
+ p = p || w.stats;
575
+ var k = ce(p), E = k.bytesLoaded, D = k.requestStart, O = k.responseStart, P = k.responseEnd, R = h ? ne(h) : void 0, x = { request_event_type: f, request_bytes_loaded: E, request_start: D, request_response_start: O, request_response_end: P, request_hostname: h ? B(h.responseURL) : void 0, request_id: R ? ve(R) : void 0, request_response_headers: R, request_media_duration: w.duration, request_url: h == null ? void 0 : h.responseURL };
576
+ w.type === "main" ? (x.request_type = "media", x.request_current_level = w.level, x.request_video_width = (t.levels[w.level] || {}).width, x.request_video_height = (t.levels[w.level] || {}).height, x.request_labeled_bitrate = (t.levels[w.level] || {}).bitrate) : x.request_type = w.type, u("requestcompleted", x);
577
+ };
578
+ t.on(r.Events.FRAG_LOADED, b);
579
+ var d = function(f, g) {
580
+ var p = g.frag, h = p.start, w = o(p), k = { currentFragmentPDT: w, currentFragmentStart: n(h) };
581
+ u("fragmentchange", k);
582
+ };
583
+ t.on(r.Events.FRAG_CHANGED, d);
584
+ var s = function(f, g) {
585
+ var p = g.type, h = g.details, w = g.response, k = g.fatal, E = g.frag, D = g.networkDetails, O = (E == null ? void 0 : E.url) || g.url || "", P = D ? ne(D) : void 0;
586
+ if ((h === r.ErrorDetails.MANIFEST_LOAD_ERROR || h === r.ErrorDetails.MANIFEST_LOAD_TIMEOUT || h === r.ErrorDetails.FRAG_LOAD_ERROR || h === r.ErrorDetails.FRAG_LOAD_TIMEOUT || h === r.ErrorDetails.LEVEL_LOAD_ERROR || h === r.ErrorDetails.LEVEL_LOAD_TIMEOUT || h === r.ErrorDetails.AUDIO_TRACK_LOAD_ERROR || h === r.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT || h === r.ErrorDetails.SUBTITLE_LOAD_ERROR || h === r.ErrorDetails.SUBTITLE_LOAD_TIMEOUT || h === r.ErrorDetails.KEY_LOAD_ERROR || h === r.ErrorDetails.KEY_LOAD_TIMEOUT) && u("requestfailed", { request_error: h, request_url: O, request_hostname: B(O), request_id: P ? ve(P) : void 0, request_type: h === r.ErrorDetails.FRAG_LOAD_ERROR || h === r.ErrorDetails.FRAG_LOAD_TIMEOUT ? "media" : h === r.ErrorDetails.AUDIO_TRACK_LOAD_ERROR || h === r.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT ? "audio" : h === r.ErrorDetails.SUBTITLE_LOAD_ERROR || h === r.ErrorDetails.SUBTITLE_LOAD_TIMEOUT ? "subtitle" : h === r.ErrorDetails.KEY_LOAD_ERROR || h === r.ErrorDetails.KEY_LOAD_TIMEOUT ? "encryption" : "manifest", request_error_code: w == null ? void 0 : w.code, request_error_text: w == null ? void 0 : w.text }), k) {
587
+ var R, x = "".concat(O ? "url: ".concat(O, `
588
+ `) : "") + "".concat(w && (w.code || w.text) ? "response: ".concat(w.code, ", ").concat(w.text, `
589
+ `) : "") + "".concat(g.reason ? "failure reason: ".concat(g.reason, `
590
+ `) : "") + "".concat(g.level ? "level: ".concat(g.level, `
591
+ `) : "") + "".concat(g.parent ? "parent stream controller: ".concat(g.parent, `
592
+ `) : "") + "".concat(g.buffer ? "buffer length: ".concat(g.buffer, `
593
+ `) : "") + "".concat(g.error ? "error: ".concat(g.error, `
594
+ `) : "") + "".concat(g.event ? "event: ".concat(g.event, `
595
+ `) : "") + "".concat(g.err ? "error message: ".concat((R = g.err) === null || R === void 0 ? void 0 : R.message, `
596
+ `) : "");
597
+ u("error", { player_error_code: p, player_error_message: h, player_error_context: x });
598
+ }
599
+ };
600
+ t.on(r.Events.ERROR, s);
601
+ var _ = function(f, g) {
602
+ var p = g.frag, h = p && p._url || "";
603
+ u("requestcanceled", { request_event_type: f, request_url: h, request_type: "media", request_hostname: B(h) });
604
+ };
605
+ t.on(r.Events.FRAG_LOAD_EMERGENCY_ABORTED, _);
606
+ var y = function(f, g) {
607
+ var p = g.level, h = t.levels[p];
608
+ if (h && h.attrs && h.attrs.BANDWIDTH) {
609
+ var w = h.attrs.BANDWIDTH, k, E = parseFloat(h.attrs["FRAME-RATE"]);
610
+ isNaN(E) || (k = E), w ? u("renditionchange", { video_source_fps: k, video_source_bitrate: w, video_source_width: h.width, video_source_height: h.height, video_source_rendition_name: h.name, video_source_codec: h == null ? void 0 : h.videoCodec }) : i.warn("missing BANDWIDTH from HLS manifest parsed by HLS.js");
611
+ }
612
+ };
613
+ t.on(r.Events.LEVEL_SWITCHED, y), t._stopMuxMonitor = function() {
614
+ t.off(r.Events.MANIFEST_LOADED, l), t.off(r.Events.LEVEL_LOADED, c), t.off(r.Events.AUDIO_TRACK_LOADED, v), t.off(r.Events.FRAG_LOADED, b), t.off(r.Events.FRAG_CHANGED, d), t.off(r.Events.ERROR, s), t.off(r.Events.FRAG_LOAD_EMERGENCY_ABORTED, _), t.off(r.Events.LEVEL_SWITCHED, y), t.off(r.Events.DESTROYING, t._stopMuxMonitor), delete t._stopMuxMonitor;
615
+ }, t.on(r.Events.DESTROYING, t._stopMuxMonitor);
616
+ }, Jt = function(a) {
617
+ a && typeof a._stopMuxMonitor == "function" && a._stopMuxMonitor();
618
+ }, Ie = function(a, e) {
619
+ if (!a || !a.requestEndDate) return {};
620
+ var t = B(a.url), r = a.url, i = a.bytesLoaded, n = new Date(a.requestStartDate).getTime(), o = new Date(a.firstByteDate).getTime(), u = new Date(a.requestEndDate).getTime(), l = isNaN(a.duration) ? 0 : a.duration, c = typeof e.getMetricsFor == "function" ? e.getMetricsFor(a.mediaType).HttpList : e.getDashMetrics().getHttpRequests(a.mediaType), v;
621
+ c.length > 0 && (v = qe(c[c.length - 1]._responseHeaders || ""));
622
+ var b = v ? ve(v) : void 0;
623
+ return { requestStart: n, requestResponseStart: o, requestResponseEnd: u, requestBytesLoaded: i, requestResponseHeaders: v, requestMediaDuration: l, requestHostname: t, requestUrl: r, requestId: b };
624
+ }, zt = function(a, e) {
625
+ var t = e.getQualityFor(a), r = e.getCurrentTrackFor(a).bitrateList;
626
+ return r ? { currentLevel: t, renditionWidth: r[t].width || null, renditionHeight: r[t].height || null, renditionBitrate: r[t].bandwidth } : {};
627
+ }, Kt = function(a) {
628
+ var e;
629
+ return (e = a.match(/.*codecs\*?="(.*)"/)) === null || e === void 0 ? void 0 : e[1];
630
+ }, Yt = function(a) {
631
+ try {
632
+ var e, t, r = (t = a.getVersion) === null || t === void 0 || (e = t.call(a)) === null || e === void 0 ? void 0 : e.split(".").map(function(i) {
633
+ return parseInt(i);
634
+ })[0];
635
+ return r;
636
+ } catch {
637
+ return !1;
638
+ }
639
+ }, Xt = function(a, e, t) {
640
+ var r = a.log;
641
+ if (!t || !t.on) {
642
+ r.warn("Invalid dash.js player reference. Monitoring blocked.");
643
+ return;
644
+ }
645
+ var i = Yt(t), n = function(p, h) {
646
+ return a.emit(e, p, h);
647
+ }, o = function(p) {
648
+ var h = p.type, w = p.data, k = (w || {}).url;
649
+ n("requestcompleted", { request_event_type: h, request_start: 0, request_response_start: 0, request_response_end: 0, request_bytes_loaded: -1, request_type: "manifest", request_hostname: B(k), request_url: k });
650
+ };
651
+ t.on("manifestLoaded", o);
652
+ var u = {}, l = function(p) {
653
+ if (typeof p.getRequests != "function") return null;
654
+ var h = p.getRequests({ state: "executed" });
655
+ return h.length === 0 ? null : h[h.length - 1];
656
+ }, c = function(p) {
657
+ var h = p.type, w = p.fragmentModel, k = p.chunk, E = l(w);
658
+ v({ type: h, request: E, chunk: k });
659
+ }, v = function(p) {
660
+ var h = p.type, w = p.chunk, k = p.request, E = (w || {}).mediaInfo, D = E || {}, O = D.type, P = D.bitrateList;
661
+ P = P || [];
662
+ var R = {};
663
+ P.forEach(function(ie, F) {
664
+ R[F] = {}, R[F].width = ie.width, R[F].height = ie.height, R[F].bitrate = ie.bandwidth, R[F].attrs = {};
665
+ }), O === "video" ? u.video = R : O === "audio" ? u.audio = R : u.media = R;
666
+ var x = Ie(k, t), Q = x.requestStart, ae = x.requestResponseStart, re = x.requestResponseEnd, j = x.requestResponseHeaders, z = x.requestMediaDuration, ye = x.requestHostname, ge = x.requestUrl, be = x.requestId;
667
+ n("requestcompleted", { request_event_type: h, request_start: Q, request_response_start: ae, request_response_end: re, request_bytes_loaded: -1, request_type: O + "_init", request_response_headers: j, request_hostname: ye, request_id: be, request_url: ge, request_media_duration: z, request_rendition_lists: u });
668
+ };
669
+ i >= 4 ? t.on("initFragmentLoaded", v) : t.on("initFragmentLoaded", c);
670
+ var b = function(p) {
671
+ var h = p.type, w = p.fragmentModel, k = p.chunk, E = l(w);
672
+ d({ type: h, request: E, chunk: k });
673
+ }, d = function(p) {
674
+ var h = p.type, w = p.chunk, k = p.request, E = w || {}, D = E.mediaInfo, O = E.start, P = D || {}, R = P.type, x = Ie(k, t), Q = x.requestStart, ae = x.requestResponseStart, re = x.requestResponseEnd, j = x.requestBytesLoaded, z = x.requestResponseHeaders, ye = x.requestMediaDuration, ge = x.requestHostname, be = x.requestUrl, ie = x.requestId, F = zt(R, t), dt = F.currentLevel, lt = F.renditionWidth, ct = F.renditionHeight, _t = F.renditionBitrate;
675
+ n("requestcompleted", { request_event_type: h, request_start: Q, request_response_start: ae, request_response_end: re, request_bytes_loaded: j, request_type: R, request_response_headers: z, request_hostname: ge, request_id: ie, request_url: be, request_media_start_time: O, request_media_duration: ye, request_current_level: dt, request_labeled_bitrate: _t, request_video_width: lt, request_video_height: ct });
676
+ };
677
+ i >= 4 ? t.on("mediaFragmentLoaded", d) : t.on("mediaFragmentLoaded", b);
678
+ var s = { video: void 0, audio: void 0, totalBitrate: void 0 }, _ = function() {
679
+ if (s.video && typeof s.video.bitrate == "number") {
680
+ if (!(s.video.width && s.video.height)) {
681
+ r.warn("have bitrate info for video but missing width/height");
682
+ return;
683
+ }
684
+ var p = s.video.bitrate;
685
+ if (s.audio && typeof s.audio.bitrate == "number" && (p += s.audio.bitrate), p !== s.totalBitrate) return s.totalBitrate = p, { video_source_bitrate: p, video_source_height: s.video.height, video_source_width: s.video.width, video_source_codec: Kt(s.video.codec) };
686
+ }
687
+ }, y = function(p, h, w) {
688
+ if (typeof p.newQuality != "number") {
689
+ r.warn("missing evt.newQuality in qualityChangeRendered event", p);
690
+ return;
691
+ }
692
+ var k = p.mediaType;
693
+ if (k === "audio" || k === "video") {
694
+ var E = t.getBitrateInfoListFor(k).find(function(O) {
695
+ var P = O.qualityIndex;
696
+ return P === p.newQuality;
697
+ });
698
+ if (!(E && typeof E.bitrate == "number")) {
699
+ r.warn("missing bitrate info for ".concat(k));
700
+ return;
701
+ }
702
+ s[k] = Se(fe({}, E), { codec: t.getCurrentTrackFor(k).codec });
703
+ var D = _();
704
+ D && n("renditionchange", D);
705
+ }
706
+ };
707
+ t.on("qualityChangeRendered", y);
708
+ var f = function(p) {
709
+ var h = p.request, w = p.mediaType;
710
+ h = h || {}, n("requestcanceled", { request_event_type: h.type + "_" + h.action, request_url: h.url, request_type: w, request_hostname: B(h.url) });
711
+ };
712
+ t.on("fragmentLoadingAbandoned", f);
713
+ var g = function(p) {
714
+ var h = p.error, w, k, E = (h == null || (w = h.data) === null || w === void 0 ? void 0 : w.request) || {}, D = (h == null || (k = h.data) === null || k === void 0 ? void 0 : k.response) || {};
715
+ (h == null ? void 0 : h.code) === 27 && n("requestfailed", { request_error: E.type + "_" + E.action, request_url: E.url, request_hostname: B(E.url), request_type: E.mediaType, request_error_code: D.status, request_error_text: D.statusText });
716
+ var O = "".concat(E != null && E.url ? "url: ".concat(E.url, `
717
+ `) : "") + "".concat(D != null && D.status || D != null && D.statusText ? "response: ".concat(D == null ? void 0 : D.status, ", ").concat(D == null ? void 0 : D.statusText, `
718
+ `) : "");
719
+ n("error", { player_error_code: h == null ? void 0 : h.code, player_error_message: h == null ? void 0 : h.message, player_error_context: O });
720
+ };
721
+ t.on("error", g), t._stopMuxMonitor = function() {
722
+ t.off("manifestLoaded", o), t.off("initFragmentLoaded", v), t.off("mediaFragmentLoaded", d), t.off("qualityChangeRendered", y), t.off("error", g), t.off("fragmentLoadingAbandoned", f), delete t._stopMuxMonitor;
723
+ };
724
+ }, Zt = function(a) {
725
+ a && typeof a._stopMuxMonitor == "function" && a._stopMuxMonitor();
726
+ }, Le = 0, $t = function() {
727
+ function a() {
728
+ I(this, a), m(this, "_listeners", void 0);
729
+ }
730
+ return V(a, [{ key: "on", value: function(e, t, r) {
731
+ return t._eventEmitterGuid = t._eventEmitterGuid || ++Le, this._listeners = this._listeners || {}, this._listeners[e] = this._listeners[e] || [], r && (t = t.bind(r)), this._listeners[e].push(t), t;
732
+ } }, { key: "off", value: function(e, t) {
733
+ var r = this._listeners && this._listeners[e];
734
+ r && r.forEach(function(i, n) {
735
+ i._eventEmitterGuid === t._eventEmitterGuid && r.splice(n, 1);
736
+ });
737
+ } }, { key: "one", value: function(e, t, r) {
738
+ var i = this;
739
+ t._eventEmitterGuid = t._eventEmitterGuid || ++Le;
740
+ var n = function() {
741
+ i.off(e, n), t.apply(r || this, arguments);
742
+ };
743
+ n._eventEmitterGuid = t._eventEmitterGuid, this.on(e, n);
744
+ } }, { key: "emit", value: function(e, t) {
745
+ var r = this;
746
+ if (this._listeners) {
747
+ t = t || {};
748
+ var i = this._listeners["before*"] || [], n = this._listeners[e] || [], o = this._listeners["after" + e] || [], u = function(l, c) {
749
+ l = l.slice(), l.forEach(function(v) {
750
+ v.call(r, { type: e }, c);
751
+ });
752
+ };
753
+ u(i, t), u(n, t), u(o, t);
754
+ }
755
+ } }]), a;
756
+ }(), ea = $t, ke = C(U()), ta = function() {
757
+ function a(e) {
758
+ var t = this;
759
+ I(this, a), 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() {
760
+ t._playheadShouldBeProgressing = !0;
761
+ }), 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() {
762
+ e.data.player_is_paused ? t._stopPlaybackHeartbeatInterval() : t._startPlaybackHeartbeatInterval();
763
+ }), e.on("timeupdate", function() {
764
+ t._playbackHeartbeatInterval !== null && e.emit("playbackheartbeat");
765
+ }), e.on("devicesleep", function(r, i) {
766
+ t._playbackHeartbeatInterval !== null && (ke.default.clearInterval(t._playbackHeartbeatInterval), e.emit("playbackheartbeatend", { viewer_time: i.viewer_time }), t._playbackHeartbeatInterval = null);
767
+ });
768
+ }
769
+ return V(a, [{ key: "_startPlaybackHeartbeatInterval", value: function() {
770
+ var e = this;
771
+ this._playbackHeartbeatInterval === null && (this.pm.emit("playbackheartbeat"), this._playbackHeartbeatInterval = ke.default.setInterval(function() {
772
+ e.pm.emit("playbackheartbeat");
773
+ }, this.pm.playbackHeartbeatTime));
774
+ } }, { key: "_stopPlaybackHeartbeatInterval", value: function() {
775
+ this._playheadShouldBeProgressing = !1, this._playbackHeartbeatInterval !== null && (ke.default.clearInterval(this._playbackHeartbeatInterval), this.pm.emit("playbackheartbeatend"), this._playbackHeartbeatInterval = null);
776
+ } }]), a;
777
+ }(), aa = ta, ra = function a(e) {
778
+ var t = this;
779
+ I(this, a), m(this, "viewErrored", void 0), e.on("viewinit", function() {
780
+ t.viewErrored = !1;
781
+ }), e.on("error", function(r, i) {
782
+ try {
783
+ var n = e.errorTranslator({ player_error_code: i.player_error_code, player_error_message: i.player_error_message, player_error_context: i.player_error_context, player_error_severity: i.player_error_severity, player_error_business_exception: i.player_error_business_exception });
784
+ n && (e.data.player_error_code = n.player_error_code || i.player_error_code, e.data.player_error_message = n.player_error_message || i.player_error_message, e.data.player_error_context = n.player_error_context || i.player_error_context, e.data.player_error_severity = n.player_error_severity || i.player_error_severity, e.data.player_error_business_exception = n.player_error_business_exception || i.player_error_business_exception, t.viewErrored = !0);
785
+ } catch (o) {
786
+ e.mux.log.warn("Exception in error translator callback.", o), t.viewErrored = !0;
787
+ }
788
+ }), e.on("aftererror", function() {
789
+ var r, i, n, o, u;
790
+ (r = e.data) === null || r === void 0 || delete r.player_error_code, (i = e.data) === null || i === void 0 || delete i.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, (u = e.data) === null || u === void 0 || delete u.player_error_business_exception;
791
+ });
792
+ }, ia = ra, na = function() {
793
+ function a(e) {
794
+ I(this, a), 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));
795
+ }
796
+ return V(a, [{ key: "_updateWatchTime", value: function(e, t) {
797
+ var r = t.viewer_time;
798
+ this._watchTimeTrackerLastCheckedTime === null && (this._watchTimeTrackerLastCheckedTime = r), q(this.pm.data, "view_watch_time", r - this._watchTimeTrackerLastCheckedTime), this._watchTimeTrackerLastCheckedTime = r;
799
+ } }, { key: "_clearWatchTimeState", value: function(e, t) {
800
+ this._updateWatchTime(e, t), this._watchTimeTrackerLastCheckedTime = null;
801
+ } }]), a;
802
+ }(), oa = na, sa = function() {
803
+ function a(e) {
804
+ var t = this;
805
+ I(this, a), 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 = N.now(), this._isAdPlaying = !1, this._callbackUpdatePlaybackTime = null;
806
+ var r = this._startPlaybackTimeTracking.bind(this);
807
+ e.on("playing", r), e.on("adplaying", r), e.on("seeked", r);
808
+ var i = this._stopPlaybackTimeTracking.bind(this);
809
+ e.on("playbackheartbeatend", i), e.on("seeking", i), e.on("adplaying", function() {
810
+ t._isAdPlaying = !0;
811
+ }), e.on("adended", function() {
812
+ t._isAdPlaying = !1;
813
+ }), e.on("adpause", function() {
814
+ t._isAdPlaying = !1;
815
+ }), e.on("adbreakstart", function() {
816
+ t._isAdPlaying = !1;
817
+ }), e.on("adbreakend", function() {
818
+ t._isAdPlaying = !1;
819
+ }), e.on("adplay", function() {
820
+ t._isAdPlaying = !1;
821
+ }), e.on("viewinit", function() {
822
+ t._playbackTimeTrackerLastPlayheadPosition = -1, t._lastTime = N.now(), t._isAdPlaying = !1, t._callbackUpdatePlaybackTime = null;
823
+ });
824
+ }
825
+ return V(a, [{ key: "_startPlaybackTimeTracking", value: function() {
826
+ this._callbackUpdatePlaybackTime === null && (this._callbackUpdatePlaybackTime = this._updatePlaybackTime.bind(this), this._playbackTimeTrackerLastPlayheadPosition = this.pm.data.player_playhead_time, this.pm.on("playbackheartbeat", this._callbackUpdatePlaybackTime));
827
+ } }, { key: "_stopPlaybackTimeTracking", value: function() {
828
+ this._callbackUpdatePlaybackTime && (this._updatePlaybackTime(), this.pm.off("playbackheartbeat", this._callbackUpdatePlaybackTime), this._callbackUpdatePlaybackTime = null, this._playbackTimeTrackerLastPlayheadPosition = -1);
829
+ } }, { key: "_updatePlaybackTime", value: function() {
830
+ var e = this.pm.data.player_playhead_time, t = N.now(), r = -1;
831
+ this._playbackTimeTrackerLastPlayheadPosition >= 0 && e > this._playbackTimeTrackerLastPlayheadPosition ? r = e - this._playbackTimeTrackerLastPlayheadPosition : this._isAdPlaying && (r = t - this._lastTime), r > 0 && r <= 1e3 && q(this.pm.data, "view_content_playback_time", r), this._playbackTimeTrackerLastPlayheadPosition = e, this._lastTime = t;
832
+ } }]), a;
833
+ }(), ua = sa, da = function() {
834
+ function a(e) {
835
+ I(this, a), m(this, "pm", void 0), this.pm = e;
836
+ var t = this._updatePlayheadTime.bind(this);
837
+ e.on("playbackheartbeat", t), e.on("playbackheartbeatend", t), e.on("timeupdate", t), e.on("destroy", function() {
838
+ e.off("timeupdate", t);
839
+ });
840
+ }
841
+ return V(a, [{ key: "_updateMaxPlayheadPosition", value: function() {
842
+ this.pm.data.view_max_playhead_position = typeof this.pm.data.view_max_playhead_position > "u" ? this.pm.data.player_playhead_time : Math.max(this.pm.data.view_max_playhead_position, this.pm.data.player_playhead_time);
843
+ } }, { key: "_updatePlayheadTime", value: function(e, t) {
844
+ var r = this, i = function() {
845
+ r.pm.currentFragmentPDT && r.pm.currentFragmentStart && (r.pm.data.player_program_time = r.pm.currentFragmentPDT + r.pm.data.player_playhead_time - r.pm.currentFragmentStart);
846
+ };
847
+ if (t && t.player_playhead_time) this.pm.data.player_playhead_time = t.player_playhead_time, i(), this._updateMaxPlayheadPosition();
848
+ else if (this.pm.getPlayheadTime) {
849
+ var n = this.pm.getPlayheadTime();
850
+ typeof n < "u" && (this.pm.data.player_playhead_time = n, i(), this._updateMaxPlayheadPosition());
851
+ }
852
+ } }]), a;
853
+ }(), la = da, Ce = 5 * 60 * 1e3, ca = function a(e) {
854
+ if (I(this, a), !e.disableRebufferTracking) {
855
+ var t, r = function(n, o) {
856
+ i(o), t = void 0;
857
+ }, i = function(n) {
858
+ if (t) {
859
+ var o = n.viewer_time - t;
860
+ q(e.data, "view_rebuffer_duration", o), t = n.viewer_time, e.data.view_rebuffer_duration > Ce && (e.emit("viewend"), e.send("viewend"), e.mux.log.warn("Ending view after rebuffering for longer than ".concat(Ce, "ms, future events will be ignored unless a programchange or videochange occurs.")));
861
+ }
862
+ 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);
863
+ };
864
+ e.on("playbackheartbeat", function(n, o) {
865
+ return i(o);
866
+ }), e.on("rebufferstart", function(n, o) {
867
+ t || (q(e.data, "view_rebuffer_count", 1), t = o.viewer_time, e.one("rebufferend", r));
868
+ }), e.on("viewinit", function() {
869
+ t = void 0, e.off("rebufferend", r);
870
+ });
871
+ }
872
+ }, _a = ca, ha = function() {
873
+ function a(e) {
874
+ var t = this;
875
+ I(this, a), 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() {
876
+ t._cleanupRebufferTracker(null, { viewer_time: N.now() });
877
+ }));
878
+ }
879
+ return V(a, [{ key: "_checkIfRebuffering", value: function(e, t) {
880
+ if (this.pm.seekingTracker.isSeeking || this.pm.adTracker.isAdBreak || !this.pm.playbackHeartbeat._playheadShouldBeProgressing) {
881
+ this._cleanupRebufferTracker(e, t);
882
+ return;
883
+ }
884
+ if (this._lastCheckedTime === null) {
885
+ this._prepareRebufferTrackerState(t.viewer_time);
886
+ return;
887
+ }
888
+ if (this._lastPlayheadTime !== this.pm.data.player_playhead_time) {
889
+ this._cleanupRebufferTracker(e, t, !0);
890
+ return;
891
+ }
892
+ var r = t.viewer_time - this._lastPlayheadTimeUpdatedTime;
893
+ typeof this.pm.sustainedRebufferThreshold == "number" && r >= this.pm.sustainedRebufferThreshold && (this._rebuffering || (this._rebuffering = !0, this.pm.emit("rebufferstart", { viewer_time: this._lastPlayheadTimeUpdatedTime }))), this._lastCheckedTime = t.viewer_time;
894
+ } }, { key: "_clearRebufferTrackerState", value: function() {
895
+ this._lastCheckedTime = null, this._lastPlayheadTime = null, this._lastPlayheadTimeUpdatedTime = null;
896
+ } }, { key: "_prepareRebufferTrackerState", value: function(e) {
897
+ this._lastCheckedTime = e, this._lastPlayheadTime = this.pm.data.player_playhead_time, this._lastPlayheadTimeUpdatedTime = e;
898
+ } }, { key: "_cleanupRebufferTracker", value: function(e, t) {
899
+ var r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
900
+ if (this._rebuffering) this._rebuffering = !1, this.pm.emit("rebufferend", { viewer_time: t.viewer_time });
901
+ else {
902
+ if (this._lastCheckedTime === null) return;
903
+ var i = this.pm.data.player_playhead_time - this._lastPlayheadTime, n = t.viewer_time - this._lastPlayheadTimeUpdatedTime;
904
+ typeof this.pm.minimumRebufferDuration == "number" && i > 0 && n - i > this.pm.minimumRebufferDuration && (this._lastCheckedTime = null, this.pm.emit("rebufferstart", { viewer_time: this._lastPlayheadTimeUpdatedTime }), this.pm.emit("rebufferend", { viewer_time: this._lastPlayheadTimeUpdatedTime + n - i }));
905
+ }
906
+ r ? this._prepareRebufferTrackerState(t.viewer_time) : this._clearRebufferTrackerState();
907
+ } }]), a;
908
+ }(), pa = ha, fa = function() {
909
+ function a(e) {
910
+ var t = this;
911
+ I(this, a), m(this, "NAVIGATION_START", void 0), m(this, "pm", void 0), this.pm = e, e.on("viewinit", function() {
912
+ var r = e.data, i = r.view_id;
913
+ if (!r.view_program_changed) {
914
+ var n = function(o, u) {
915
+ var l = u.viewer_time;
916
+ (o.type === "playing" && typeof e.data.view_time_to_first_frame > "u" || o.type === "adplaying" && (typeof e.data.view_time_to_first_frame > "u" || t._inPrerollPosition())) && t.calculateTimeToFirstFrame(l || N.now(), i);
917
+ };
918
+ e.one("playing", n), e.one("adplaying", n), e.one("viewend", function() {
919
+ e.off("playing", n), e.off("adplaying", n);
920
+ });
921
+ }
922
+ });
923
+ }
924
+ return V(a, [{ key: "_inPrerollPosition", value: function() {
925
+ return typeof this.pm.data.view_content_playback_time > "u" || this.pm.data.view_content_playback_time <= 1e3;
926
+ } }, { key: "calculateTimeToFirstFrame", value: function(e, t) {
927
+ t === this.pm.data.view_id && (this.pm.watchTimeTracker._updateWatchTime(null, { viewer_time: e }), 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.NAVIGATION_START && (this.pm.data.view_aggregate_startup_time = this.pm.data.view_start + this.pm.data.view_watch_time - this.NAVIGATION_START));
928
+ } }]), a;
929
+ }(), va = fa, ma = function a(e) {
930
+ var t = this;
931
+ I(this, a), 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() {
932
+ t._lastPlayheadPosition = -1;
933
+ });
934
+ var r = ["pause", "rebufferstart", "seeking", "error", "adbreakstart", "hb", "renditionchange", "orientationchange", "viewend"], i = ["playing", "hb", "renditionchange", "orientationchange"];
935
+ r.forEach(function(n) {
936
+ e.on(n, function() {
937
+ if (t._lastPlayheadPosition >= 0 && e.data.player_playhead_time >= 0 && t._lastPlayerWidth >= 0 && t._lastSourceWidth > 0 && t._lastPlayerHeight >= 0 && t._lastSourceHeight > 0) {
938
+ var o = e.data.player_playhead_time - t._lastPlayheadPosition;
939
+ if (o < 0) {
940
+ t._lastPlayheadPosition = -1;
941
+ return;
942
+ }
943
+ var u = Math.min(t._lastPlayerWidth / t._lastSourceWidth, t._lastPlayerHeight / t._lastSourceHeight), l = Math.max(0, u - 1), c = Math.max(0, 1 - u);
944
+ e.data.view_max_upscale_percentage = Math.max(e.data.view_max_upscale_percentage || 0, l), e.data.view_max_downscale_percentage = Math.max(e.data.view_max_downscale_percentage || 0, c), q(e.data, "view_total_content_playback_time", o), q(e.data, "view_total_upscaling", l * o), q(e.data, "view_total_downscaling", c * o);
945
+ }
946
+ t._lastPlayheadPosition = -1;
947
+ });
948
+ }), i.forEach(function(n) {
949
+ e.on(n, function() {
950
+ 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;
951
+ });
952
+ });
953
+ }, ya = ma, ga = 2e3, ba = function a(e) {
954
+ var t = this;
955
+ I(this, a), m(this, "isSeeking", void 0), this.isSeeking = !1;
956
+ var r = -1, i = function() {
957
+ var n = N.now(), o = (e.data.viewer_time || n) - (r || n);
958
+ q(e.data, "view_seek_duration", o), e.data.view_max_seek_time = Math.max(e.data.view_max_seek_time || 0, o), t.isSeeking = !1, r = -1;
959
+ };
960
+ e.on("seeking", function(n, o) {
961
+ if (Object.assign(e.data, o), t.isSeeking && o.viewer_time - r <= ga) {
962
+ r = o.viewer_time;
963
+ return;
964
+ }
965
+ t.isSeeking && i(), t.isSeeking = !0, r = o.viewer_time, q(e.data, "view_seek_count", 1), e.send("seeking");
966
+ }), e.on("seeked", function() {
967
+ i();
968
+ }), e.on("viewend", function() {
969
+ t.isSeeking && (i(), e.send("seeked")), t.isSeeking = !1, r = -1;
970
+ });
971
+ }, wa = ba, je = function(a, e) {
972
+ a.push(e), a.sort(function(t, r) {
973
+ return t.viewer_time - r.viewer_time;
974
+ });
975
+ }, Ta = ["adbreakstart", "adrequest", "adresponse", "adplay", "adplaying", "adpause", "adended", "adbreakend", "aderror", "adclicked", "adskipped"], ka = function() {
976
+ function a(e) {
977
+ var t = this;
978
+ I(this, a), 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() {
979
+ t.isAdBreak = !1, t._currentAdRequestNumber = 0, t._currentAdResponseNumber = 0, t._adRequests = [], t._adResponses = [], t._adHasPlayed = !1, t._wouldBeNewAdPlay = !0, t._prerollPlayTime = void 0;
980
+ }), Ta.forEach(function(i) {
981
+ return e.on(i, t._updateAdData.bind(t));
982
+ });
983
+ var r = function() {
984
+ t.isAdBreak = !1;
985
+ };
986
+ e.on("adbreakstart", function() {
987
+ t.isAdBreak = !0;
988
+ }), e.on("play", r), e.on("playing", r), e.on("viewend", r), e.on("adrequest", function(i, n) {
989
+ n = Object.assign({ ad_request_id: "generatedAdRequestId" + t._currentAdRequestNumber++ }, n), je(t._adRequests, n), q(e.data, "view_ad_request_count"), t.inPrerollPosition() && (e.data.view_preroll_requested = !0, t._adHasPlayed || q(e.data, "view_preroll_request_count"));
990
+ }), e.on("adresponse", function(i, n) {
991
+ n = Object.assign({ ad_request_id: "generatedAdRequestId" + t._currentAdResponseNumber++ }, n), je(t._adResponses, n);
992
+ var o = t.findAdRequest(n.ad_request_id);
993
+ o && q(e.data, "view_ad_request_time", Math.max(0, n.viewer_time - o.viewer_time));
994
+ }), e.on("adplay", function(i, n) {
995
+ t._adHasPlayed = !0, t._wouldBeNewAdPlay && (t._wouldBeNewAdPlay = !1, q(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);
996
+ }), e.on("adplaying", function(i, n) {
997
+ t.inPrerollPosition() && typeof e.data.view_preroll_load_time > "u" && typeof t._prerollPlayTime < "u" && (e.data.view_preroll_load_time = n.viewer_time - t._prerollPlayTime, e.data.view_startup_preroll_load_time = n.viewer_time - t._prerollPlayTime);
998
+ }), e.on("adclicked", function(i, n) {
999
+ t._wouldBeNewAdPlay || q(e.data, "view_ad_clicked_count");
1000
+ }), e.on("adskipped", function(i, n) {
1001
+ t._wouldBeNewAdPlay || q(e.data, "view_ad_skipped_count");
1002
+ }), e.on("adended", function() {
1003
+ t._wouldBeNewAdPlay = !0;
1004
+ }), e.on("aderror", function() {
1005
+ t._wouldBeNewAdPlay = !0;
1006
+ });
1007
+ }
1008
+ return V(a, [{ key: "inPrerollPosition", value: function() {
1009
+ return typeof this.pm.data.view_content_playback_time > "u" || this.pm.data.view_content_playback_time <= 1e3;
1010
+ } }, { key: "findAdRequest", value: function(e) {
1011
+ for (var t = 0; t < this._adRequests.length; t++) if (this._adRequests[t].ad_request_id === e) return this._adRequests[t];
1012
+ } }, { key: "_updateAdData", value: function(e, t) {
1013
+ if (this.inPrerollPosition()) {
1014
+ if (!this.pm.data.view_preroll_ad_tag_hostname && t.ad_tag_url) {
1015
+ var r = G(le(t.ad_tag_url), 2), i = r[0], n = r[1];
1016
+ this.pm.data.view_preroll_ad_tag_domain = n, this.pm.data.view_preroll_ad_tag_hostname = i;
1017
+ }
1018
+ if (!this.pm.data.view_preroll_ad_asset_hostname && t.ad_asset_url) {
1019
+ var o = G(le(t.ad_asset_url), 2), u = o[0], l = o[1];
1020
+ this.pm.data.view_preroll_ad_asset_domain = l, this.pm.data.view_preroll_ad_asset_hostname = u;
1021
+ }
1022
+ }
1023
+ this.pm.data.ad_asset_url = t == null ? void 0 : t.ad_asset_url, this.pm.data.ad_tag_url = t == null ? void 0 : t.ad_tag_url, this.pm.data.ad_creative_id = t == null ? void 0 : t.ad_creative_id, this.pm.data.ad_id = t == null ? void 0 : t.ad_id, this.pm.data.ad_universal_id = t == null ? void 0 : t.ad_universal_id;
1024
+ } }]), a;
1025
+ }(), Ea = ka, He = C(U()), xa = function a(e) {
1026
+ I(this, a);
1027
+ var t, r, i = function() {
1028
+ e.disableRebufferTracking || (q(e.data, "view_waiting_rebuffer_count", 1), t = N.now(), r = He.default.setInterval(function() {
1029
+ if (t) {
1030
+ var c = N.now();
1031
+ q(e.data, "view_waiting_rebuffer_duration", c - t), t = c;
1032
+ }
1033
+ }, 250));
1034
+ }, n = function() {
1035
+ e.disableRebufferTracking || t && (q(e.data, "view_waiting_rebuffer_duration", N.now() - t), t = !1, He.default.clearInterval(r));
1036
+ }, o = !1, u = function() {
1037
+ o = !0;
1038
+ }, l = function() {
1039
+ o = !1, n();
1040
+ };
1041
+ e.on("waiting", function() {
1042
+ o && i();
1043
+ }), e.on("playing", function() {
1044
+ n(), u();
1045
+ }), e.on("pause", l), e.on("seeking", l);
1046
+ }, Da = xa, Aa = function a(e) {
1047
+ var t = this;
1048
+ I(this, a), m(this, "lastWallClockTime", void 0);
1049
+ var r = function() {
1050
+ t.lastWallClockTime = N.now(), e.on("before*", i);
1051
+ }, i = function(n) {
1052
+ var o = N.now(), u = t.lastWallClockTime;
1053
+ t.lastWallClockTime = o, o - u > 3e4 && (e.emit("devicesleep", { viewer_time: u }), Object.assign(e.data, { viewer_time: u }), e.send("devicesleep"), e.emit("devicewake", { viewer_time: o }), Object.assign(e.data, { viewer_time: o }), e.send("devicewake"));
1054
+ };
1055
+ e.one("playbackheartbeat", r), e.on("playbackheartbeatend", function() {
1056
+ e.off("before*", i), e.one("playbackheartbeat", r);
1057
+ });
1058
+ }, Ra = Aa, Ee = C(U()), et = function(a) {
1059
+ return a();
1060
+ }(function() {
1061
+ var a = function() {
1062
+ for (var t = 0, r = {}; t < arguments.length; t++) {
1063
+ var i = arguments[t];
1064
+ for (var n in i) r[n] = i[n];
1065
+ }
1066
+ return r;
1067
+ };
1068
+ function e(t) {
1069
+ function r(i, n, o) {
1070
+ var u;
1071
+ if (typeof document < "u") {
1072
+ if (arguments.length > 1) {
1073
+ if (o = a({ path: "/" }, r.defaults, o), typeof o.expires == "number") {
1074
+ var l = /* @__PURE__ */ new Date();
1075
+ l.setMilliseconds(l.getMilliseconds() + o.expires * 864e5), o.expires = l;
1076
+ }
1077
+ try {
1078
+ u = JSON.stringify(n), /^[\{\[]/.test(u) && (n = u);
1079
+ } catch {
1080
+ }
1081
+ return t.write ? n = t.write(n, i) : n = encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent), i = encodeURIComponent(String(i)), i = i.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent), i = i.replace(/[\(\)]/g, escape), document.cookie = [i, "=", n, o.expires ? "; expires=" + o.expires.toUTCString() : "", o.path ? "; path=" + o.path : "", o.domain ? "; domain=" + o.domain : "", o.secure ? "; secure" : ""].join("");
1082
+ }
1083
+ i || (u = {});
1084
+ for (var c = document.cookie ? document.cookie.split("; ") : [], v = /(%[0-9A-Z]{2})+/g, b = 0; b < c.length; b++) {
1085
+ var d = c[b].split("="), s = d.slice(1).join("=");
1086
+ s.charAt(0) === '"' && (s = s.slice(1, -1));
1087
+ try {
1088
+ var _ = d[0].replace(v, decodeURIComponent);
1089
+ if (s = t.read ? t.read(s, _) : t(s, _) || s.replace(v, decodeURIComponent), this.json) try {
1090
+ s = JSON.parse(s);
1091
+ } catch {
1092
+ }
1093
+ if (i === _) {
1094
+ u = s;
1095
+ break;
1096
+ }
1097
+ i || (u[_] = s);
1098
+ } catch {
1099
+ }
1100
+ }
1101
+ return u;
1102
+ }
1103
+ }
1104
+ return r.set = r, r.get = function(i) {
1105
+ return r.call(r, i);
1106
+ }, r.getJSON = function() {
1107
+ return r.apply({ json: !0 }, [].slice.call(arguments));
1108
+ }, r.defaults = {}, r.remove = function(i, n) {
1109
+ r(i, "", a(n, { expires: -1 }));
1110
+ }, r.withConverter = e, r;
1111
+ }
1112
+ return e(function() {
1113
+ });
1114
+ }), tt = "muxData", Oa = function(a) {
1115
+ return Object.entries(a).map(function(e) {
1116
+ var t = G(e, 2), r = t[0], i = t[1];
1117
+ return "".concat(r, "=").concat(i);
1118
+ }).join("&");
1119
+ }, Sa = function(a) {
1120
+ return a.split("&").reduce(function(e, t) {
1121
+ var r = G(t.split("="), 2), i = r[0], n = r[1], o = +n, u = n && o == n ? o : n;
1122
+ return e[i] = u, e;
1123
+ }, {});
1124
+ }, at = function() {
1125
+ var a;
1126
+ try {
1127
+ a = Sa(et.get(tt) || "");
1128
+ } catch {
1129
+ a = {};
1130
+ }
1131
+ return a;
1132
+ }, rt = function(a) {
1133
+ try {
1134
+ et.set(tt, Oa(a), { expires: 365 });
1135
+ } catch {
1136
+ }
1137
+ }, qa = function() {
1138
+ var a = at();
1139
+ return a.mux_viewer_id = a.mux_viewer_id || de(), a.msn = a.msn || Math.random(), rt(a), { mux_viewer_id: a.mux_viewer_id, mux_sample_number: a.msn };
1140
+ }, Na = function() {
1141
+ var a = at(), e = N.now();
1142
+ return a.session_start && (a.sst = a.session_start, delete a.session_start), a.session_id && (a.sid = a.session_id, delete a.session_id), a.session_expires && (a.sex = a.session_expires, delete a.session_expires), (!a.sex || a.sex < e) && (a.sid = de(), a.sst = e), a.sex = e + 25 * 60 * 1e3, rt(a), { session_id: a.sid, session_start: a.sst, session_expires: a.sex };
1143
+ };
1144
+ function Pa(a, e) {
1145
+ var t = e.beaconCollectionDomain, r = e.beaconDomain;
1146
+ if (t) return "https://" + t;
1147
+ a = a || "inferred";
1148
+ var i = r || "litix.io";
1149
+ return a.match(/^[a-z0-9]+$/) ? "https://" + a + "." + i : "https://img.litix.io/a.gif";
1150
+ }
1151
+ var Ia = C(U()), it = function() {
1152
+ var a;
1153
+ switch (nt()) {
1154
+ case "cellular":
1155
+ a = "cellular";
1156
+ break;
1157
+ case "ethernet":
1158
+ a = "wired";
1159
+ break;
1160
+ case "wifi":
1161
+ a = "wifi";
1162
+ break;
1163
+ case void 0:
1164
+ break;
1165
+ default:
1166
+ a = "other";
1167
+ }
1168
+ return a;
1169
+ }, nt = function() {
1170
+ var a = Ia.default.navigator, e = a && (a.connection || a.mozConnection || a.webkitConnection);
1171
+ return e && e.type;
1172
+ };
1173
+ it.getConnectionFromAPI = nt;
1174
+ var La = it, Ca = { a: "env", b: "beacon", c: "custom", d: "ad", e: "event", f: "experiment", i: "internal", m: "mux", n: "response", p: "player", q: "request", r: "retry", s: "session", t: "timestamp", u: "viewer", v: "video", w: "page", x: "view", y: "sub" }, ja = ot(Ca), Ha = { ad: "ad", af: "affiliate", ag: "aggregate", ap: "api", al: "application", ao: "audio", ar: "architecture", as: "asset", au: "autoplay", av: "average", bi: "bitrate", bn: "brand", br: "break", bw: "browser", by: "bytes", bz: "business", ca: "cached", cb: "cancel", cc: "codec", cd: "code", cg: "category", ch: "changed", ci: "client", ck: "clicked", cl: "canceled", cn: "config", co: "count", ce: "counter", cp: "complete", cq: "creator", cr: "creative", cs: "captions", ct: "content", cu: "current", cx: "connection", cz: "context", dg: "downscaling", dm: "domain", dn: "cdn", do: "downscale", dr: "drm", dp: "dropped", du: "duration", dv: "device", dy: "dynamic", eb: "enabled", ec: "encoding", ed: "edge", en: "end", eg: "engine", em: "embed", er: "error", ep: "experiments", es: "errorcode", et: "errortext", ee: "event", ev: "events", ex: "expires", ez: "exception", fa: "failed", fi: "first", fm: "family", ft: "format", fp: "fps", fq: "frequency", fr: "frame", fs: "fullscreen", ha: "has", hb: "holdback", he: "headers", ho: "host", hn: "hostname", ht: "height", id: "id", ii: "init", in: "instance", ip: "ip", is: "is", ke: "key", la: "language", lb: "labeled", le: "level", li: "live", ld: "loaded", lo: "load", ls: "lists", lt: "latency", ma: "max", md: "media", me: "message", mf: "manifest", mi: "mime", ml: "midroll", mm: "min", mn: "manufacturer", mo: "model", mx: "mux", ne: "newest", nm: "name", no: "number", on: "on", or: "origin", os: "os", pa: "paused", pb: "playback", pd: "producer", pe: "percentage", pf: "played", pg: "program", ph: "playhead", pi: "plugin", pl: "preroll", pn: "playing", po: "poster", pp: "pip", pr: "preload", ps: "position", pt: "part", py: "property", px: "pop", pz: "plan", ra: "rate", rd: "requested", re: "rebuffer", rf: "rendition", rg: "range", rm: "remote", ro: "ratio", rp: "response", rq: "request", rs: "requests", sa: "sample", sd: "skipped", se: "session", sh: "shift", sk: "seek", sm: "stream", so: "source", sq: "sequence", sr: "series", ss: "status", st: "start", su: "startup", sv: "server", sw: "software", sy: "severity", ta: "tag", tc: "tech", te: "text", tg: "target", th: "throughput", ti: "time", tl: "total", to: "to", tt: "title", ty: "type", ug: "upscaling", un: "universal", up: "upscale", ur: "url", us: "user", va: "variant", vd: "viewed", vi: "video", ve: "version", vw: "view", vr: "viewer", wd: "width", wa: "watch", wt: "waiting" }, Me = ot(Ha);
1175
+ function ot(a) {
1176
+ var e = {};
1177
+ for (var t in a) a.hasOwnProperty(t) && (e[a[t]] = t);
1178
+ return e;
1179
+ }
1180
+ function Oe(a) {
1181
+ var e = {}, t = {};
1182
+ return Object.keys(a).forEach(function(r) {
1183
+ var i = !1;
1184
+ if (a.hasOwnProperty(r) && a[r] !== void 0) {
1185
+ var n = r.split("_"), o = n[0], u = ja[o];
1186
+ u || (A.info("Data key word `" + n[0] + "` not expected in " + r), u = o + "_"), n.splice(1).forEach(function(l) {
1187
+ l === "url" && (i = !0), Me[l] ? u += Me[l] : Number.isInteger(Number(l)) ? u += l : (A.info("Data key word `" + l + "` not expected in " + r), u += "_" + l + "_");
1188
+ }), i ? t[u] = a[r] : e[u] = a[r];
1189
+ }
1190
+ }), Object.assign(e, t);
1191
+ }
1192
+ var X = C(U()), Ma = C(Ke()), Ba = { maxBeaconSize: 300, maxQueueLength: 3600, baseTimeBetweenBeacons: 1e4, maxPayloadKBSize: 500 }, Ua = 56 * 1024, Fa = ["hb", "requestcompleted", "requestfailed", "requestcanceled"], Va = "https://img.litix.io", W = function(a) {
1193
+ var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1194
+ this._beaconUrl = a || Va, this._eventQueue = [], this._postInFlight = !1, this._resendAfterPost = !1, this._failureCount = 0, this._sendTimeout = !1, this._options = Object.assign({}, Ba, e);
1195
+ };
1196
+ W.prototype.queueEvent = function(a, e) {
1197
+ var t = Object.assign({}, e);
1198
+ return this._eventQueue.length <= this._options.maxQueueLength || a === "eventrateexceeded" ? (this._eventQueue.push(t), this._sendTimeout || this._startBeaconSending(), this._eventQueue.length <= this._options.maxQueueLength) : !1;
1199
+ };
1200
+ W.prototype.flushEvents = function() {
1201
+ var a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1;
1202
+ if (a && this._eventQueue.length === 1) {
1203
+ this._eventQueue.pop();
1204
+ return;
1205
+ }
1206
+ this._eventQueue.length && this._sendBeaconQueue(), this._startBeaconSending();
1207
+ };
1208
+ W.prototype.destroy = function() {
1209
+ var a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1;
1210
+ this.destroyed = !0, a ? this._clearBeaconQueue() : this.flushEvents(), X.default.clearTimeout(this._sendTimeout);
1211
+ };
1212
+ W.prototype._clearBeaconQueue = function() {
1213
+ var a = this._eventQueue.length > this._options.maxBeaconSize ? this._eventQueue.length - this._options.maxBeaconSize : 0, e = this._eventQueue.slice(a);
1214
+ a > 0 && Object.assign(e[e.length - 1], Oe({ mux_view_message: "event queue truncated" }));
1215
+ var t = this._createPayload(e);
1216
+ st(this._beaconUrl, t, !0, function() {
1217
+ });
1218
+ };
1219
+ W.prototype._sendBeaconQueue = function() {
1220
+ var a = this;
1221
+ if (this._postInFlight) {
1222
+ this._resendAfterPost = !0;
1223
+ return;
1224
+ }
1225
+ var e = this._eventQueue.slice(0, this._options.maxBeaconSize);
1226
+ this._eventQueue = this._eventQueue.slice(this._options.maxBeaconSize), this._postInFlight = !0;
1227
+ var t = this._createPayload(e), r = N.now();
1228
+ st(this._beaconUrl, t, !1, function(i, n) {
1229
+ n ? (a._eventQueue = e.concat(a._eventQueue), a._failureCount += 1, A.info("Error sending beacon: " + n)) : a._failureCount = 0, a._roundTripTime = N.now() - r, a._postInFlight = !1, a._resendAfterPost && (a._resendAfterPost = !1, a._eventQueue.length > 0 && a._sendBeaconQueue());
1230
+ });
1231
+ };
1232
+ W.prototype._getNextBeaconTime = function() {
1233
+ if (!this._failureCount) return this._options.baseTimeBetweenBeacons;
1234
+ var a = Math.pow(2, this._failureCount - 1);
1235
+ return a = a * Math.random(), (1 + a) * this._options.baseTimeBetweenBeacons;
1236
+ };
1237
+ W.prototype._startBeaconSending = function() {
1238
+ var a = this;
1239
+ X.default.clearTimeout(this._sendTimeout), !this.destroyed && (this._sendTimeout = X.default.setTimeout(function() {
1240
+ a._eventQueue.length && a._sendBeaconQueue(), a._startBeaconSending();
1241
+ }, this._getNextBeaconTime()));
1242
+ };
1243
+ W.prototype._createPayload = function(a) {
1244
+ var e = this, t = { transmission_timestamp: Math.round(N.now()) };
1245
+ this._roundTripTime && (t.rtt_ms = Math.round(this._roundTripTime));
1246
+ var r, i, n, o = function() {
1247
+ r = JSON.stringify({ metadata: t, events: i || a }), n = r.length / 1024;
1248
+ }, u = function() {
1249
+ return n <= e._options.maxPayloadKBSize;
1250
+ };
1251
+ return o(), u() || (A.info("Payload size is too big (" + n + " kb). Removing unnecessary events."), i = a.filter(function(l) {
1252
+ return Fa.indexOf(l.e) === -1;
1253
+ }), o()), u() || (A.info("Payload size still too big (" + n + " kb). Cropping fields.."), i.forEach(function(l) {
1254
+ for (var c in l) {
1255
+ var v = l[c], b = 50 * 1024;
1256
+ typeof v == "string" && v.length > b && (l[c] = v.substring(0, b));
1257
+ }
1258
+ }), o()), r;
1259
+ };
1260
+ var Ga = typeof Ma.default.exitPictureInPicture == "function" ? function(a) {
1261
+ return a.length <= Ua;
1262
+ } : function(a) {
1263
+ return !1;
1264
+ }, st = function(a, e, t, r) {
1265
+ if (t && navigator && navigator.sendBeacon && navigator.sendBeacon(a, e)) {
1266
+ r();
1267
+ return;
1268
+ }
1269
+ if (X.default.fetch) {
1270
+ X.default.fetch(a, { method: "POST", body: e, headers: { "Content-Type": "text/plain" }, keepalive: Ga(e) }).then(function(n) {
1271
+ return r(null, n.ok ? null : "Error");
1272
+ }).catch(function(n) {
1273
+ return r(null, n);
1274
+ });
1275
+ return;
1276
+ }
1277
+ if (X.default.XMLHttpRequest) {
1278
+ var i = new X.default.XMLHttpRequest();
1279
+ i.onreadystatechange = function() {
1280
+ if (i.readyState === 4) return r(null, i.status !== 200 ? "error" : void 0);
1281
+ }, i.open("POST", a), i.setRequestHeader("Content-Type", "text/plain"), i.send(e);
1282
+ return;
1283
+ }
1284
+ r();
1285
+ }, Wa = W, Qa = ["env_key", "view_id", "view_sequence_number", "player_sequence_number", "beacon_domain", "player_playhead_time", "viewer_time", "mux_api_version", "event", "video_id", "player_instance_id", "player_error_code", "player_error_message", "player_error_context", "player_error_severity", "player_error_business_exception"], Ja = ["adplay", "adplaying", "adpause", "adfirstquartile", "admidpoint", "adthirdquartile", "adended", "adresponse", "adrequest"], za = ["ad_id", "ad_creative_id", "ad_universal_id"], Ka = ["viewstart", "error", "ended", "viewend"], Ya = 10 * 60 * 1e3, Xa = function() {
1286
+ function a(e, t) {
1287
+ var r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
1288
+ I(this, a);
1289
+ var i, n, o, u, l, c, v, b, d, s, _, y;
1290
+ m(this, "mux", void 0), m(this, "envKey", void 0), m(this, "options", void 0), m(this, "eventQueue", void 0), m(this, "sampleRate", void 0), m(this, "disableCookies", void 0), m(this, "respectDoNotTrack", void 0), m(this, "previousBeaconData", void 0), m(this, "lastEventTime", void 0), m(this, "rateLimited", void 0), m(this, "pageLevelData", void 0), m(this, "viewerData", void 0), this.mux = e, this.envKey = t, this.options = r, this.previousBeaconData = null, this.lastEventTime = 0, this.rateLimited = !1, this.eventQueue = new Wa(Pa(this.envKey, this.options));
1291
+ var f;
1292
+ this.sampleRate = (f = this.options.sampleRate) !== null && f !== void 0 ? f : 1;
1293
+ var g;
1294
+ this.disableCookies = (g = this.options.disableCookies) !== null && g !== void 0 ? g : !1;
1295
+ var p;
1296
+ this.respectDoNotTrack = (p = this.options.respectDoNotTrack) !== null && p !== void 0 ? p : !1, this.previousBeaconData = null, this.lastEventTime = 0, this.rateLimited = !1, this.pageLevelData = { mux_api_version: this.mux.API_VERSION, mux_embed: this.mux.NAME, mux_embed_version: this.mux.VERSION, viewer_application_name: (i = this.options.platform) === null || i === void 0 ? void 0 : i.name, viewer_application_version: (n = this.options.platform) === null || n === void 0 ? void 0 : n.version, viewer_application_engine: (o = this.options.platform) === null || o === void 0 ? void 0 : o.layout, viewer_device_name: (u = this.options.platform) === null || u === void 0 ? void 0 : u.product, viewer_device_category: "", viewer_device_manufacturer: (l = this.options.platform) === null || l === void 0 ? void 0 : l.manufacturer, viewer_os_family: (v = this.options.platform) === null || v === void 0 || (c = v.os) === null || c === void 0 ? void 0 : c.family, viewer_os_architecture: (d = this.options.platform) === null || d === void 0 || (b = d.os) === null || b === void 0 ? void 0 : b.architecture, viewer_os_version: (_ = this.options.platform) === null || _ === void 0 || (s = _.os) === null || s === void 0 ? void 0 : s.version, viewer_connection_type: La(), page_url: Ee.default === null || Ee.default === void 0 || (y = Ee.default.location) === null || y === void 0 ? void 0 : y.href }, this.viewerData = this.disableCookies ? {} : qa();
1297
+ }
1298
+ return V(a, [{ key: "send", value: function(e, t) {
1299
+ if (!(!e || !(t != null && t.view_id))) {
1300
+ if (this.respectDoNotTrack && Ae()) return A.info("Not sending `" + e + "` because Do Not Track is enabled");
1301
+ if (!t || typeof t != "object") return A.error("A data object was expected in send() but was not provided");
1302
+ var r = this.disableCookies ? {} : Na(), i = Se(fe({}, this.pageLevelData, t, r, this.viewerData), { event: e, env_key: this.envKey });
1303
+ i.user_id && (i.viewer_user_id = i.user_id, delete i.user_id);
1304
+ var n, o = ((n = i.mux_sample_number) !== null && n !== void 0 ? n : 0) >= this.sampleRate, u = this._deduplicateBeaconData(e, i), l = Oe(u);
1305
+ if (this.lastEventTime = this.mux.utils.now(), o) return A.info("Not sending event due to sample rate restriction", e, i, l);
1306
+ if (this.envKey || A.info("Missing environment key (envKey) - beacons will be dropped if the video source is not a valid mux video URL", e, i, l), !this.rateLimited) {
1307
+ if (A.info("Sending event", e, i, l), this.rateLimited = !this.eventQueue.queueEvent(e, l), this.mux.WINDOW_UNLOADING && e === "viewend") this.eventQueue.destroy(!0);
1308
+ else if (this.mux.WINDOW_HIDDEN && e === "hb" ? this.eventQueue.flushEvents(!0) : Ka.indexOf(e) >= 0 && this.eventQueue.flushEvents(), this.rateLimited) return i.event = "eventrateexceeded", l = Oe(i), this.eventQueue.queueEvent(i.event, l), A.error("Beaconing disabled due to rate limit.");
1309
+ }
1310
+ }
1311
+ } }, { key: "destroy", value: function() {
1312
+ this.eventQueue.destroy(!1);
1313
+ } }, { key: "_deduplicateBeaconData", value: function(e, t) {
1314
+ var r = this, i = {}, n = t.view_id;
1315
+ if (n === "-1" || e === "viewstart" || e === "viewend" || !this.previousBeaconData || this.mux.utils.now() - this.lastEventTime >= Ya) i = fe({}, t), n && (this.previousBeaconData = i), n && e === "viewend" && (this.previousBeaconData = null);
1316
+ else {
1317
+ var o = e.indexOf("request") === 0;
1318
+ Object.entries(t).forEach(function(u) {
1319
+ var l = G(u, 2), c = l[0], v = l[1];
1320
+ r.previousBeaconData && (v !== r.previousBeaconData[c] || Qa.indexOf(c) > -1 || r.objectHasChanged(o, c, v, r.previousBeaconData[c]) || r.eventRequiresKey(e, c)) && (i[c] = v, r.previousBeaconData[c] = v);
1321
+ });
1322
+ }
1323
+ return i;
1324
+ } }, { key: "objectHasChanged", value: function(e, t, r, i) {
1325
+ return !e || t.indexOf("request_") !== 0 ? !1 : t === "request_response_headers" || typeof r != "object" || typeof i != "object" ? !0 : Object.keys(r || {}).length !== Object.keys(i || {}).length;
1326
+ } }, { key: "eventRequiresKey", value: function(e, t) {
1327
+ return !!(e === "renditionchange" && t.indexOf("video_source_") === 0 || za.includes(t) && Ja.includes(e));
1328
+ } }]), a;
1329
+ }(), Za = function a(e) {
1330
+ I(this, a);
1331
+ var t = 0, r = 0, i = 0, n = 0, o = 0, u = 0, l = 0, c = function(d, s) {
1332
+ var _ = s.request_start, y = s.request_response_start, f = s.request_response_end, g = s.request_bytes_loaded;
1333
+ n++;
1334
+ var p, h;
1335
+ if (y ? (p = y - (_ ?? 0), h = (f ?? 0) - y) : h = (f ?? 0) - (_ ?? 0), h > 0 && g && g > 0) {
1336
+ var w = g / h * 8e3;
1337
+ o++, r += g, i += h, e.data.view_min_request_throughput = Math.min(e.data.view_min_request_throughput || 1 / 0, w), e.data.view_average_request_throughput = r / i * 8e3, e.data.view_request_count = n, p > 0 && (t += p, e.data.view_max_request_latency = Math.max(e.data.view_max_request_latency || 0, p), e.data.view_average_request_latency = t / o);
1338
+ }
1339
+ }, v = function(d, s) {
1340
+ n++, u++, e.data.view_request_count = n, e.data.view_request_failed_count = u;
1341
+ }, b = function(d, s) {
1342
+ n++, l++, e.data.view_request_count = n, e.data.view_request_canceled_count = l;
1343
+ };
1344
+ e.on("requestcompleted", c), e.on("requestfailed", v), e.on("requestcanceled", b);
1345
+ }, $a = Za, er = 60 * 60 * 1e3, tr = function a(e) {
1346
+ var t = this;
1347
+ I(this, a), m(this, "_lastEventTime", void 0), e.on("before*", function(r, i) {
1348
+ var n = i.viewer_time, o = N.now(), u = t._lastEventTime;
1349
+ if (t._lastEventTime = o, u && o - u > er) {
1350
+ var l = Object.keys(e.data).reduce(function(v, b) {
1351
+ return b.indexOf("video_") === 0 ? Object.assign(v, m({}, b, e.data[b])) : v;
1352
+ }, {});
1353
+ e.mux.log.info("Received event after at least an hour inactivity, creating a new view");
1354
+ var c = e.playbackHeartbeat._playheadShouldBeProgressing;
1355
+ e._resetView(Object.assign({ viewer_time: n }, l)), e.playbackHeartbeat._playheadShouldBeProgressing = c, e.playbackHeartbeat._playheadShouldBeProgressing && r.type !== "play" && r.type !== "adbreakstart" && (e.emit("play", { viewer_time: n }), r.type !== "playing" && e.emit("playing", { viewer_time: n }));
1356
+ }
1357
+ });
1358
+ }, ar = tr, rr = ["viewstart", "ended", "loadstart", "pause", "play", "playing", "ratechange", "waiting", "adplay", "adpause", "adended", "aderror", "adplaying", "adrequest", "adresponse", "adbreakstart", "adbreakend", "adfirstquartile", "admidpoint", "adthirdquartile", "rebufferstart", "rebufferend", "seeked", "error", "hb", "requestcompleted", "requestfailed", "requestcanceled", "renditionchange"], ir = /* @__PURE__ */ new Set(["requestcompleted", "requestfailed", "requestcanceled"]), nr = function(a) {
1359
+ jt(t, a);
1360
+ var e = Bt(t);
1361
+ function t(r, i, n) {
1362
+ I(this, t);
1363
+ var o;
1364
+ o = e.call(this), m(T(o), "DOM_CONTENT_LOADED_EVENT_END", void 0), m(T(o), "NAVIGATION_START", void 0), m(T(o), "_destroyed", void 0), m(T(o), "_heartBeatTimeout", void 0), m(T(o), "adTracker", void 0), m(T(o), "dashjs", void 0), m(T(o), "data", void 0), m(T(o), "disablePlayheadRebufferTracking", void 0), m(T(o), "disableRebufferTracking", void 0), m(T(o), "errorTracker", void 0), m(T(o), "errorTranslator", void 0), m(T(o), "emitTranslator", void 0), m(T(o), "getAdData", void 0), m(T(o), "getPlayheadTime", void 0), m(T(o), "getStateData", void 0), m(T(o), "stateDataTranslator", void 0), m(T(o), "hlsjs", void 0), m(T(o), "id", void 0), m(T(o), "longResumeTracker", void 0), m(T(o), "minimumRebufferDuration", void 0), m(T(o), "mux", void 0), m(T(o), "playbackEventDispatcher", void 0), m(T(o), "playbackHeartbeat", void 0), m(T(o), "playbackHeartbeatTime", void 0), m(T(o), "playheadTime", void 0), m(T(o), "seekingTracker", void 0), m(T(o), "sustainedRebufferThreshold", void 0), m(T(o), "watchTimeTracker", void 0), m(T(o), "currentFragmentPDT", void 0), m(T(o), "currentFragmentStart", void 0), o.DOM_CONTENT_LOADED_EVENT_END = pe.domContentLoadedEventEnd(), o.NAVIGATION_START = pe.navigationStart();
1365
+ var u = { debug: !1, minimumRebufferDuration: 250, sustainedRebufferThreshold: 1e3, playbackHeartbeatTime: 25, beaconDomain: "litix.io", sampleRate: 1, disableCookies: !1, respectDoNotTrack: !1, disableRebufferTracking: !1, disablePlayheadRebufferTracking: !1, errorTranslator: function(d) {
1366
+ return d;
1367
+ }, emitTranslator: function() {
1368
+ for (var d = arguments.length, s = new Array(d), _ = 0; _ < d; _++) s[_] = arguments[_];
1369
+ return s;
1370
+ }, stateDataTranslator: function(d) {
1371
+ return d;
1372
+ } };
1373
+ o.mux = r, o.id = i, n != null && n.beaconDomain && o.mux.log.warn("The `beaconDomain` setting has been deprecated in favor of `beaconCollectionDomain`. Please change your integration to use `beaconCollectionDomain` instead of `beaconDomain`."), n = Object.assign(u, n), n.data = n.data || {}, n.data.property_key && (n.data.env_key = n.data.property_key, delete n.data.property_key), A.level = n.debug ? Y.DEBUG : Y.WARN, o.getPlayheadTime = n.getPlayheadTime, o.getStateData = n.getStateData || function() {
1374
+ return {};
1375
+ }, o.getAdData = n.getAdData || function() {
1376
+ }, o.minimumRebufferDuration = n.minimumRebufferDuration, o.sustainedRebufferThreshold = n.sustainedRebufferThreshold, o.playbackHeartbeatTime = n.playbackHeartbeatTime, o.disableRebufferTracking = n.disableRebufferTracking, o.disableRebufferTracking && o.mux.log.warn("Disabling rebuffer tracking. This should only be used in specific circumstances as a last resort when your player is known to unreliably track rebuffering."), o.disablePlayheadRebufferTracking = n.disablePlayheadRebufferTracking, o.errorTranslator = n.errorTranslator, o.emitTranslator = n.emitTranslator, o.stateDataTranslator = n.stateDataTranslator, o.playbackEventDispatcher = new Xa(r, n.data.env_key, n), o.data = { player_instance_id: de(), mux_sample_rate: n.sampleRate, beacon_domain: n.beaconCollectionDomain || n.beaconDomain }, o.data.view_sequence_number = 1, o.data.player_sequence_number = 1;
1377
+ var l = (function() {
1378
+ typeof this.data.view_start > "u" && (this.data.view_start = this.mux.utils.now(), this.emit("viewstart"));
1379
+ }).bind(T(o));
1380
+ if (o.on("viewinit", function(d, s) {
1381
+ this._resetVideoData(), this._resetViewData(), this._resetErrorData(), this._updateStateData(), Object.assign(this.data, s), this._initializeViewData(), this.one("play", l), this.one("adbreakstart", l);
1382
+ }), o.on("videochange", function(d, s) {
1383
+ this._resetView(s);
1384
+ }), o.on("programchange", function(d, s) {
1385
+ this.data.player_is_paused && this.mux.log.warn("The `programchange` event is intended to be used when the content changes mid playback without the video source changing, however the video is not currently playing. If the video source is changing please use the videochange event otherwise you will lose startup time information."), this._resetView(Object.assign(s, { view_program_changed: !0 })), l(), this.emit("play"), this.emit("playing");
1386
+ }), o.on("fragmentchange", function(d, s) {
1387
+ this.currentFragmentPDT = s.currentFragmentPDT, this.currentFragmentStart = s.currentFragmentStart;
1388
+ }), o.on("destroy", o.destroy), typeof window < "u" && typeof window.addEventListener == "function" && typeof window.removeEventListener == "function") {
1389
+ var c = function() {
1390
+ var d = typeof o.data.view_start < "u";
1391
+ o.mux.WINDOW_HIDDEN = document.visibilityState === "hidden", d && o.mux.WINDOW_HIDDEN && (o.data.player_is_paused || o.emit("hb"));
1392
+ };
1393
+ window.addEventListener("visibilitychange", c, !1);
1394
+ var v = function(d) {
1395
+ d.persisted || o.destroy();
1396
+ };
1397
+ window.addEventListener("pagehide", v, !1), o.on("destroy", function() {
1398
+ window.removeEventListener("visibilitychange", c), window.removeEventListener("pagehide", v);
1399
+ });
1400
+ }
1401
+ o.on("playerready", function(d, s) {
1402
+ Object.assign(this.data, s);
1403
+ }), rr.forEach(function(d) {
1404
+ o.on(d, function(s, _) {
1405
+ d.indexOf("ad") !== 0 && this._updateStateData(), Object.assign(this.data, _), this._sanitizeData();
1406
+ }), o.on("after" + d, function() {
1407
+ (d !== "error" || this.errorTracker.viewErrored) && this.send(d);
1408
+ });
1409
+ }), o.on("viewend", function(d, s) {
1410
+ Object.assign(o.data, s);
1411
+ });
1412
+ var b = function(d) {
1413
+ var s = this.mux.utils.now();
1414
+ this.data.player_init_time && (this.data.player_startup_time = s - this.data.player_init_time), !this.mux.PLAYER_TRACKED && this.NAVIGATION_START && (this.mux.PLAYER_TRACKED = !0, (this.data.player_init_time || this.DOM_CONTENT_LOADED_EVENT_END) && (this.data.page_load_time = Math.min(this.data.player_init_time || 1 / 0, this.DOM_CONTENT_LOADED_EVENT_END || 1 / 0) - this.NAVIGATION_START)), this.send("playerready"), delete this.data.player_startup_time, delete this.data.page_load_time;
1415
+ };
1416
+ return o.one("playerready", b), o.longResumeTracker = new ar(T(o)), o.errorTracker = new ia(T(o)), new Ra(T(o)), o.seekingTracker = new wa(T(o)), o.playheadTime = new la(T(o)), o.playbackHeartbeat = new aa(T(o)), new ya(T(o)), o.watchTimeTracker = new oa(T(o)), new ua(T(o)), o.adTracker = new Ea(T(o)), new pa(T(o)), new _a(T(o)), new va(T(o)), new Da(T(o)), new $a(T(o)), n.hlsjs && o.addHLSJS(n), n.dashjs && o.addDashJS(n), o.emit("viewinit", n.data), o;
1417
+ }
1418
+ return V(t, [{ key: "emit", value: function(r, i) {
1419
+ var n, o = Object.assign({ viewer_time: this.mux.utils.now() }, i), u = [r, o];
1420
+ if (this.emitTranslator) try {
1421
+ u = this.emitTranslator(r, o);
1422
+ } catch (l) {
1423
+ this.mux.log.warn("Exception in emit translator callback.", l);
1424
+ }
1425
+ u != null && u.length && (n = _e(te(t.prototype), "emit", this)).call.apply(n, [this].concat(M(u)));
1426
+ } }, { key: "destroy", value: function() {
1427
+ this._destroyed || (this._destroyed = !0, typeof this.data.view_start < "u" && (this.emit("viewend"), this.send("viewend")), this.playbackEventDispatcher.destroy(), this.removeHLSJS(), this.removeDashJS(), window.clearTimeout(this._heartBeatTimeout));
1428
+ } }, { key: "send", value: function(r) {
1429
+ if (this.data.view_id) {
1430
+ var i = Object.assign({}, this.data), n = ["player_program_time", "player_manifest_newest_program_time", "player_live_edge_program_time", "player_program_time", "video_holdback", "video_part_holdback", "video_target_duration", "video_part_target_duration"];
1431
+ if (i.video_source_is_live === void 0 && (i.player_source_duration === 1 / 0 || i.video_source_duration === 1 / 0 ? i.video_source_is_live = !0 : (i.player_source_duration > 0 || i.video_source_duration > 0) && (i.video_source_is_live = !1)), i.video_source_is_live || n.forEach(function(c) {
1432
+ i[c] = void 0;
1433
+ }), i.video_source_url = i.video_source_url || i.player_source_url, i.video_source_url) {
1434
+ var o = G(le(i.video_source_url), 2), u = o[0], l = o[1];
1435
+ i.video_source_domain = l, i.video_source_hostname = u;
1436
+ }
1437
+ delete i.ad_request_id, this.playbackEventDispatcher.send(r, i), this.data.view_sequence_number++, this.data.player_sequence_number++, ir.has(r) || this._restartHeartBeat(), r === "viewend" && delete this.data.view_id;
1438
+ }
1439
+ } }, { key: "_resetView", value: function(r) {
1440
+ this.emit("viewend"), this.send("viewend"), this.emit("viewinit", r);
1441
+ } }, { key: "_updateStateData", value: function() {
1442
+ var r = this.getStateData();
1443
+ if (typeof this.stateDataTranslator == "function") try {
1444
+ r = this.stateDataTranslator(r);
1445
+ } catch (i) {
1446
+ this.mux.log.warn("Exception in stateDataTranslator translator callback.", i);
1447
+ }
1448
+ Object.assign(this.data, r), this.playheadTime._updatePlayheadTime(), this._sanitizeData();
1449
+ } }, { key: "_sanitizeData", value: function() {
1450
+ var r = this, i = ["player_width", "player_height", "video_source_width", "video_source_height", "player_playhead_time", "video_source_bitrate"];
1451
+ i.forEach(function(o) {
1452
+ var u = parseInt(r.data[o], 10);
1453
+ r.data[o] = isNaN(u) ? void 0 : u;
1454
+ });
1455
+ var n = ["player_source_url", "video_source_url"];
1456
+ n.forEach(function(o) {
1457
+ if (r.data[o]) {
1458
+ var u = r.data[o].toLowerCase();
1459
+ (u.indexOf("data:") === 0 || u.indexOf("blob:") === 0) && (r.data[o] = "MSE style URL");
1460
+ }
1461
+ });
1462
+ } }, { key: "_resetVideoData", value: function() {
1463
+ var r = this;
1464
+ Object.keys(this.data).forEach(function(i) {
1465
+ i.indexOf("video_") === 0 && delete r.data[i];
1466
+ });
1467
+ } }, { key: "_resetViewData", value: function() {
1468
+ var r = this;
1469
+ Object.keys(this.data).forEach(function(i) {
1470
+ i.indexOf("view_") === 0 && delete r.data[i];
1471
+ }), this.data.view_sequence_number = 1;
1472
+ } }, { key: "_resetErrorData", value: function() {
1473
+ delete this.data.player_error_code, delete this.data.player_error_message, delete this.data.player_error_context, delete this.data.player_error_severity, delete this.data.player_error_business_exception;
1474
+ } }, { key: "_initializeViewData", value: function() {
1475
+ var r = this, i = this.data.view_id = de(), n = function() {
1476
+ i === r.data.view_id && q(r.data, "player_view_count", 1);
1477
+ };
1478
+ this.data.player_is_paused ? this.one("play", n) : n();
1479
+ } }, { key: "_restartHeartBeat", value: function() {
1480
+ var r = this;
1481
+ window.clearTimeout(this._heartBeatTimeout), this._heartBeatTimeout = window.setTimeout(function() {
1482
+ r.data.player_is_paused || r.emit("hb");
1483
+ }, 1e4);
1484
+ } }, { key: "addHLSJS", value: function(r) {
1485
+ if (!r.hlsjs) {
1486
+ this.mux.log.warn("You must pass a valid hlsjs instance in order to track it.");
1487
+ return;
1488
+ }
1489
+ if (this.hlsjs) {
1490
+ this.mux.log.warn("An instance of HLS.js is already being monitored for this player.");
1491
+ return;
1492
+ }
1493
+ this.hlsjs = r.hlsjs, Qt(this.mux, this.id, r.hlsjs, {}, r.Hls || window.Hls);
1494
+ } }, { key: "removeHLSJS", value: function() {
1495
+ this.hlsjs && (Jt(this.hlsjs), this.hlsjs = void 0);
1496
+ } }, { key: "addDashJS", value: function(r) {
1497
+ if (!r.dashjs) {
1498
+ this.mux.log.warn("You must pass a valid dashjs instance in order to track it.");
1499
+ return;
1500
+ }
1501
+ if (this.dashjs) {
1502
+ this.mux.log.warn("An instance of Dash.js is already being monitored for this player.");
1503
+ return;
1504
+ }
1505
+ this.dashjs = r.dashjs, Xt(this.mux, this.id, r.dashjs);
1506
+ } }, { key: "removeDashJS", value: function() {
1507
+ this.dashjs && (Zt(this.dashjs), this.dashjs = void 0);
1508
+ } }]), t;
1509
+ }(ea), or = nr, oe = C(Ke());
1510
+ function sr() {
1511
+ return oe.default && !!(oe.default.fullscreenElement || oe.default.webkitFullscreenElement || oe.default.mozFullScreenElement || oe.default.msFullscreenElement);
1512
+ }
1513
+ var ur = ["loadstart", "pause", "play", "playing", "seeking", "seeked", "timeupdate", "ratechange", "stalled", "waiting", "error", "ended"], dr = { 1: "MEDIA_ERR_ABORTED", 2: "MEDIA_ERR_NETWORK", 3: "MEDIA_ERR_DECODE", 4: "MEDIA_ERR_SRC_NOT_SUPPORTED" };
1514
+ function lr(a, e, t) {
1515
+ var r = G(he(e), 3), i = r[0], n = r[1], o = r[2], u = a.log, l = a.utils.getComputedStyle, c = a.utils.secondsToMs, v = { automaticErrorTracking: !0 };
1516
+ if (i) {
1517
+ if (o !== "video" && o !== "audio") return u.error("The element of `" + n + "` was not a media element.");
1518
+ } else return u.error("No element was found with the `" + n + "` query selector.");
1519
+ i.mux && (i.mux.destroy(), delete i.mux, u.warn("Already monitoring this video element, replacing existing event listeners"));
1520
+ var b = { getPlayheadTime: function() {
1521
+ return c(i.currentTime);
1522
+ }, getStateData: function() {
1523
+ var s, _, y, f = ((s = (_ = this).getPlayheadTime) === null || s === void 0 ? void 0 : s.call(_)) || c(i.currentTime), g = this.hlsjs && this.hlsjs.url, p = this.dashjs && typeof this.dashjs.getSource == "function" && this.dashjs.getSource(), h = { player_is_paused: i.paused, player_width: parseInt(l(i, "width")), player_height: parseInt(l(i, "height")), player_autoplay_on: i.autoplay, player_preload_on: i.preload, player_language_code: i.lang, player_is_fullscreen: sr(), video_poster_url: i.poster, video_source_url: g || p || i.currentSrc, video_source_duration: c(i.duration), video_source_height: i.videoHeight, video_source_width: i.videoWidth, view_dropped_frame_count: i == null || (y = i.getVideoPlaybackQuality) === null || y === void 0 ? void 0 : y.call(i).droppedVideoFrames };
1524
+ if (i.getStartDate && f > 0) {
1525
+ var w = i.getStartDate();
1526
+ if (w && typeof w.getTime == "function" && w.getTime()) {
1527
+ var k = w.getTime();
1528
+ if (h.player_program_time = k + f, i.seekable.length > 0) {
1529
+ var E = k + i.seekable.end(i.seekable.length - 1);
1530
+ h.player_live_edge_program_time = E;
1531
+ }
1532
+ }
1533
+ }
1534
+ return h;
1535
+ } };
1536
+ t = Object.assign(v, t, b), t.data = Object.assign({ player_software: "HTML5 Video Element", player_mux_plugin_name: "VideoElementMonitor", player_mux_plugin_version: a.VERSION }, t.data), i.mux = i.mux || {}, i.mux.deleted = !1, i.mux.emit = function(s, _) {
1537
+ a.emit(n, s, _);
1538
+ }, i.mux.updateData = function(s) {
1539
+ i.mux.emit("hb", s);
1540
+ };
1541
+ var d = function() {
1542
+ u.error("The monitor for this video element has already been destroyed.");
1543
+ };
1544
+ i.mux.destroy = function() {
1545
+ Object.keys(i.mux.listeners).forEach(function(s) {
1546
+ i.removeEventListener(s, i.mux.listeners[s], !1);
1547
+ }), delete i.mux.listeners, i.mux.destroy = d, i.mux.swapElement = d, i.mux.emit = d, i.mux.addHLSJS = d, i.mux.addDashJS = d, i.mux.removeHLSJS = d, i.mux.removeDashJS = d, i.mux.updateData = d, i.mux.setEmitTranslator = d, i.mux.setStateDataTranslator = d, i.mux.setGetPlayheadTime = d, i.mux.deleted = !0, a.emit(n, "destroy");
1548
+ }, i.mux.swapElement = function(s) {
1549
+ var _ = G(he(s), 3), y = _[0], f = _[1], g = _[2];
1550
+ if (y) {
1551
+ if (g !== "video" && g !== "audio") return a.log.error("The element of `" + f + "` was not a media element.");
1552
+ } else return a.log.error("No element was found with the `" + f + "` query selector.");
1553
+ y.muxId = i.muxId, delete i.muxId, y.mux = y.mux || {}, y.mux.listeners = Object.assign({}, i.mux.listeners), delete i.mux.listeners, Object.keys(y.mux.listeners).forEach(function(p) {
1554
+ i.removeEventListener(p, y.mux.listeners[p], !1), y.addEventListener(p, y.mux.listeners[p], !1);
1555
+ }), y.mux.swapElement = i.mux.swapElement, y.mux.destroy = i.mux.destroy, delete i.mux, i = y;
1556
+ }, i.mux.addHLSJS = function(s) {
1557
+ a.addHLSJS(n, s);
1558
+ }, i.mux.addDashJS = function(s) {
1559
+ a.addDashJS(n, s);
1560
+ }, i.mux.removeHLSJS = function() {
1561
+ a.removeHLSJS(n);
1562
+ }, i.mux.removeDashJS = function() {
1563
+ a.removeDashJS(n);
1564
+ }, i.mux.setEmitTranslator = function(s) {
1565
+ a.setEmitTranslator(n, s);
1566
+ }, i.mux.setStateDataTranslator = function(s) {
1567
+ a.setStateDataTranslator(n, s);
1568
+ }, i.mux.setGetPlayheadTime = function(s) {
1569
+ s || (s = t.getPlayheadTime), a.setGetPlayheadTime(n, s);
1570
+ }, a.init(n, t), a.emit(n, "playerready"), i.paused || (a.emit(n, "play"), i.readyState > 2 && a.emit(n, "playing")), i.mux.listeners = {}, ur.forEach(function(s) {
1571
+ s === "error" && !t.automaticErrorTracking || (i.mux.listeners[s] = function() {
1572
+ var _ = {};
1573
+ if (s === "error") {
1574
+ if (!i.error || i.error.code === 1) return;
1575
+ _.player_error_code = i.error.code, _.player_error_message = dr[i.error.code] || i.error.message;
1576
+ }
1577
+ a.emit(n, s, _);
1578
+ }, i.addEventListener(s, i.mux.listeners[s], !1));
1579
+ });
1580
+ }
1581
+ function cr(a, e, t, r) {
1582
+ var i = r;
1583
+ if (a && typeof a[e] == "function") try {
1584
+ i = a[e].apply(a, t);
1585
+ } catch (n) {
1586
+ A.info("safeCall error", n);
1587
+ }
1588
+ return i;
1589
+ }
1590
+ var ue = C(U()), ee;
1591
+ ue.default && ue.default.WeakMap && (ee = /* @__PURE__ */ new WeakMap());
1592
+ function _r(a, e) {
1593
+ if (!a || !e || !ue.default || typeof ue.default.getComputedStyle != "function") return "";
1594
+ var t;
1595
+ return ee && ee.has(a) && (t = ee.get(a)), t || (t = ue.default.getComputedStyle(a, null), ee && ee.set(a, t)), t.getPropertyValue(e);
1596
+ }
1597
+ function hr(a) {
1598
+ return Math.floor(a * 1e3);
1599
+ }
1600
+ var K = { TARGET_DURATION: "#EXT-X-TARGETDURATION", PART_INF: "#EXT-X-PART-INF", SERVER_CONTROL: "#EXT-X-SERVER-CONTROL", INF: "#EXTINF", PROGRAM_DATE_TIME: "#EXT-X-PROGRAM-DATE-TIME", VERSION: "#EXT-X-VERSION", SESSION_DATA: "#EXT-X-SESSION-DATA" }, me = function(a) {
1601
+ return this.buffer = "", this.manifest = { segments: [], serverControl: {}, sessionData: {} }, this.currentUri = {}, this.process(a), this.manifest;
1602
+ };
1603
+ me.prototype.process = function(a) {
1604
+ var e;
1605
+ for (this.buffer += a, e = this.buffer.indexOf(`
1606
+ `); e > -1; e = this.buffer.indexOf(`
1607
+ `)) this.processLine(this.buffer.substring(0, e)), this.buffer = this.buffer.substring(e + 1);
1608
+ };
1609
+ me.prototype.processLine = function(a) {
1610
+ var e = a.indexOf(":"), t = mr(a, e), r = t[0], i = t.length === 2 ? Ne(t[1]) : void 0;
1611
+ if (r[0] !== "#") this.currentUri.uri = r, this.manifest.segments.push(this.currentUri), this.manifest.targetDuration && !("duration" in this.currentUri) && (this.currentUri.duration = this.manifest.targetDuration), this.currentUri = {};
1612
+ else switch (r) {
1613
+ case K.TARGET_DURATION: {
1614
+ if (!isFinite(i) || i < 0) return;
1615
+ this.manifest.targetDuration = i, this.setHoldBack();
1616
+ break;
1617
+ }
1618
+ case K.PART_INF: {
1619
+ xe(this.manifest, t), this.manifest.partInf.partTarget && (this.manifest.partTargetDuration = this.manifest.partInf.partTarget), this.setHoldBack();
1620
+ break;
1621
+ }
1622
+ case K.SERVER_CONTROL: {
1623
+ xe(this.manifest, t), this.setHoldBack();
1624
+ break;
1625
+ }
1626
+ case K.INF: {
1627
+ i === 0 ? this.currentUri.duration = 0.01 : i > 0 && (this.currentUri.duration = i);
1628
+ break;
1629
+ }
1630
+ case K.PROGRAM_DATE_TIME: {
1631
+ var n = i, o = new Date(n);
1632
+ this.manifest.dateTimeString || (this.manifest.dateTimeString = n, this.manifest.dateTimeObject = o), this.currentUri.dateTimeString = n, this.currentUri.dateTimeObject = o;
1633
+ break;
1634
+ }
1635
+ case K.VERSION: {
1636
+ xe(this.manifest, t);
1637
+ break;
1638
+ }
1639
+ case K.SESSION_DATA: {
1640
+ var u = yr(t[1]), l = $e(u);
1641
+ Object.assign(this.manifest.sessionData, l);
1642
+ }
1643
+ }
1644
+ };
1645
+ me.prototype.setHoldBack = function() {
1646
+ var a = this.manifest, e = a.serverControl, t = a.targetDuration, r = a.partTargetDuration;
1647
+ if (e) {
1648
+ var i = "holdBack", n = "partHoldBack", o = t && t * 3, u = r && r * 2;
1649
+ t && !e.hasOwnProperty(i) && (e[i] = o), o && e[i] < o && (e[i] = o), r && !e.hasOwnProperty(n) && (e[n] = r * 3), r && e[n] < u && (e[n] = u);
1650
+ }
1651
+ };
1652
+ var xe = function(a, e) {
1653
+ var t = ut(e[0].replace("#EXT-X-", "")), r;
1654
+ vr(e[1]) ? (r = {}, r = Object.assign(fr(e[1]), r)) : r = Ne(e[1]), a[t] = r;
1655
+ }, ut = function(a) {
1656
+ return a.toLowerCase().replace(/-(\w)/g, function(e) {
1657
+ return e[1].toUpperCase();
1658
+ });
1659
+ }, Ne = function(a) {
1660
+ if (a.toLowerCase() === "yes" || a.toLowerCase() === "no") return a.toLowerCase() === "yes";
1661
+ var e = a.indexOf(":") !== -1 ? a : parseFloat(a);
1662
+ return isNaN(e) ? a : e;
1663
+ }, pr = function(a) {
1664
+ var e = {}, t = a.split("=");
1665
+ if (t.length > 1) {
1666
+ var r = ut(t[0]);
1667
+ e[r] = Ne(t[1]);
1668
+ }
1669
+ return e;
1670
+ }, fr = function(a) {
1671
+ for (var e = a.split(","), t = {}, r = 0; e.length > r; r++) {
1672
+ var i = e[r], n = pr(i);
1673
+ t = Object.assign(n, t);
1674
+ }
1675
+ return t;
1676
+ }, vr = function(a) {
1677
+ return a.indexOf("=") > -1;
1678
+ }, mr = function(a, e) {
1679
+ return e === -1 ? [a] : [a.substring(0, e), a.substring(e + 1)];
1680
+ }, yr = function(a) {
1681
+ var e = {};
1682
+ if (a) {
1683
+ var t = a.search(","), r = a.slice(0, t), i = a.slice(t + 1), n = [r, i];
1684
+ return n.forEach(function(o, u) {
1685
+ for (var l = o.replace(/['"]+/g, "").split("="), c = 0; c < l.length; c++) l[c] === "DATA-ID" && (e["DATA-ID"] = l[1 - c]), l[c] === "VALUE" && (e.VALUE = l[1 - c]);
1686
+ }), { data: e };
1687
+ }
1688
+ }, gr = me, br = { safeCall: cr, safeIncrement: q, getComputedStyle: _r, secondsToMs: hr, assign: Object.assign, headersStringToObject: qe, cdnHeadersToRequestId: ve, extractHostnameAndDomain: le, extractHostname: B, manifestParser: gr, generateShortID: Xe, generateUUID: de, now: N.now, findMediaElement: he }, wr = br, Tr = { PLAYER_READY: "playerready", VIEW_INIT: "viewinit", VIDEO_CHANGE: "videochange", PLAY: "play", PAUSE: "pause", PLAYING: "playing", TIME_UPDATE: "timeupdate", SEEKING: "seeking", SEEKED: "seeked", REBUFFER_START: "rebufferstart", REBUFFER_END: "rebufferend", ERROR: "error", ENDED: "ended", RENDITION_CHANGE: "renditionchange", ORIENTATION_CHANGE: "orientationchange", AD_REQUEST: "adrequest", AD_RESPONSE: "adresponse", AD_BREAK_START: "adbreakstart", AD_PLAY: "adplay", AD_PLAYING: "adplaying", AD_PAUSE: "adpause", AD_FIRST_QUARTILE: "adfirstquartile", AD_MID_POINT: "admidpoint", AD_THIRD_QUARTILE: "adthirdquartile", AD_ENDED: "adended", AD_BREAK_END: "adbreakend", AD_ERROR: "aderror", REQUEST_COMPLETED: "requestcompleted", REQUEST_FAILED: "requestfailed", REQUEST_CANCELLED: "requestcanceled", HEARTBEAT: "hb", DESTROY: "destroy" }, kr = Tr, Er = "mux-embed", xr = "5.9.0", Dr = "2.1", S = {}, J = function(a) {
1689
+ var e = arguments;
1690
+ typeof a == "string" ? J.hasOwnProperty(a) ? se.default.setTimeout(function() {
1691
+ e = Array.prototype.splice.call(e, 1), J[a].apply(null, e);
1692
+ }, 0) : A.warn("`" + a + "` is an unknown task") : typeof a == "function" ? se.default.setTimeout(function() {
1693
+ a(J);
1694
+ }, 0) : A.warn("`" + a + "` is invalid.");
1695
+ }, Ar = { loaded: N.now(), NAME: Er, VERSION: xr, API_VERSION: Dr, PLAYER_TRACKED: !1, monitor: function(a, e) {
1696
+ return lr(J, a, e);
1697
+ }, destroyMonitor: function(a) {
1698
+ var e = G(he(a), 1), t = e[0];
1699
+ t && t.mux && typeof t.mux.destroy == "function" ? t.mux.destroy() : A.error("A video element monitor for `" + a + "` has not been initialized via `mux.monitor`.");
1700
+ }, addHLSJS: function(a, e) {
1701
+ var t = H(a);
1702
+ S[t] ? S[t].addHLSJS(e) : A.error("A monitor for `" + t + "` has not been initialized.");
1703
+ }, addDashJS: function(a, e) {
1704
+ var t = H(a);
1705
+ S[t] ? S[t].addDashJS(e) : A.error("A monitor for `" + t + "` has not been initialized.");
1706
+ }, removeHLSJS: function(a) {
1707
+ var e = H(a);
1708
+ S[e] ? S[e].removeHLSJS() : A.error("A monitor for `" + e + "` has not been initialized.");
1709
+ }, removeDashJS: function(a) {
1710
+ var e = H(a);
1711
+ S[e] ? S[e].removeDashJS() : A.error("A monitor for `" + e + "` has not been initialized.");
1712
+ }, init: function(a, e) {
1713
+ Ae() && e && e.respectDoNotTrack && A.info("The browser's Do Not Track flag is enabled - Mux beaconing is disabled.");
1714
+ var t = H(a);
1715
+ S[t] = new or(J, t, e);
1716
+ }, emit: function(a, e, t) {
1717
+ var r = H(a);
1718
+ S[r] ? (S[r].emit(e, t), e === "destroy" && delete S[r]) : A.error("A monitor for `" + r + "` has not been initialized.");
1719
+ }, updateData: function(a, e) {
1720
+ var t = H(a);
1721
+ S[t] ? S[t].emit("hb", e) : A.error("A monitor for `" + t + "` has not been initialized.");
1722
+ }, setEmitTranslator: function(a, e) {
1723
+ var t = H(a);
1724
+ S[t] ? S[t].emitTranslator = e : A.error("A monitor for `" + t + "` has not been initialized.");
1725
+ }, setStateDataTranslator: function(a, e) {
1726
+ var t = H(a);
1727
+ S[t] ? S[t].stateDataTranslator = e : A.error("A monitor for `" + t + "` has not been initialized.");
1728
+ }, setGetPlayheadTime: function(a, e) {
1729
+ var t = H(a);
1730
+ S[t] ? S[t].getPlayheadTime = e : A.error("A monitor for `" + t + "` has not been initialized.");
1731
+ }, checkDoNotTrack: Ae, log: A, utils: wr, events: kr, WINDOW_HIDDEN: !1, WINDOW_UNLOADING: !1 };
1732
+ Object.assign(J, Ar);
1733
+ typeof se.default < "u" && typeof se.default.addEventListener == "function" && se.default.addEventListener("pagehide", function(a) {
1734
+ a.persisted || (J.WINDOW_UNLOADING = !0);
1735
+ }, !1);
1736
+ var Rr = J;
1737
+ /*!
1738
+ * JavaScript Cookie v2.1.3
1739
+ * https://github.com/js-cookie/js-cookie
1740
+ *
1741
+ * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
1742
+ * Released under the MIT license
1743
+ */
1744
+ const Or = async ({
1745
+ appName: a = "elv-player-js",
1746
+ elvPlayer: e,
1747
+ playoutUrl: t,
1748
+ authorizationToken: r,
1749
+ disableCookies: i
1750
+ }) => {
1751
+ t = new URL(t);
1752
+ const n = await e.__Client(), o = (await n.NetworkInfo()).name === "main" ? "aq4mdjn7qo5sbkf89pkvfv93j" : "2i5480sms8vdgj0sv9bv6lpk5", u = t.pathname.split("/").find((f) => f.startsWith("hq__")), l = n.utils.DecodeVersionHash(u).objectId, c = (t.toString().match(/\/rep\/playout|channel\/([^/]+)/) || [])[1] || "default", v = t.searchParams.get("sid");
1753
+ let b = u;
1754
+ try {
1755
+ const f = await n.ContentObjectMetadata({
1756
+ versionHash: u,
1757
+ metadataSubtree: "/public",
1758
+ select: [
1759
+ "name",
1760
+ "asset_metadata/display_title",
1761
+ "asset_metadata/title"
1762
+ ],
1763
+ authorizationToken: r
1764
+ }) || {};
1765
+ b = (f.asset_metadata || {}).display_title || (f.asset_metadata || {}).title || f.name || u;
1766
+ } catch {
1767
+ }
1768
+ let d;
1769
+ try {
1770
+ d = await n.ContentObjectTenantId({ versionHash: u });
1771
+ } catch {
1772
+ }
1773
+ let s = await n.CurrentAccountAddress();
1774
+ if (r || n.staticToken)
1775
+ try {
1776
+ const { payload: f } = n.utils.DecodeSignedToken(r);
1777
+ s = f.adr || s;
1778
+ } catch {
1779
+ }
1780
+ let _ = s;
1781
+ if (typeof crypto < "u")
1782
+ try {
1783
+ const f = new TextEncoder();
1784
+ _ = Buffer.from(
1785
+ await crypto.subtle.digest("SHA-256", f.encode(s))
1786
+ ).toString("hex");
1787
+ } catch {
1788
+ }
1789
+ const y = {
1790
+ debug: !1,
1791
+ disableCookies: i,
1792
+ data: {
1793
+ env_key: o,
1794
+ video_id: l,
1795
+ video_variant_id: u,
1796
+ video_variant_name: c,
1797
+ video_title: b,
1798
+ video_cdn: t.hostname,
1799
+ viewer_user_id: _,
1800
+ sub_property_id: d,
1801
+ player_name: a,
1802
+ //player_version: version,
1803
+ player_init_time: e.initTime
1804
+ }
1805
+ };
1806
+ v && (y.data.view_session_id = v), e.player && (e.HLS ? (y.hlsjs = e.player, y.Hls = e.HLS) : e.Dash && (y.dashjs = e.player));
1807
+ try {
1808
+ Rr.monitor(e.video, y), e.Log("elv-player-js: Mux monitoring initialized"), e.Log(JSON.stringify({ ...y, hlsjs: {} }));
1809
+ } catch (f) {
1810
+ e.Log("elv-player-js: Failed to initialize mux monitoring:", !0), e.Log(JSON.stringify(y, null, 2), !0), e.Log(f, !0);
1811
+ }
1812
+ };
1813
+ export {
1814
+ Or as InitializeMuxMonitoring
1815
+ };