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