@webitel/ui-sdk 24.10.89 → 24.10.90

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2576 @@
1
+ function X(t, e) {
2
+ if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
3
+ }
4
+ function Re(t, e) {
5
+ for (var n = 0; n < e.length; n++) {
6
+ var i = e[n];
7
+ i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(t, i.key, i);
8
+ }
9
+ }
10
+ function J(t, e, n) {
11
+ return e && Re(t.prototype, e), n && Re(t, n), t;
12
+ }
13
+ function Ce(t, e, n) {
14
+ return e in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = n, t;
15
+ }
16
+ function Ve(t, e) {
17
+ var n = Object.keys(t);
18
+ if (Object.getOwnPropertySymbols) {
19
+ var i = Object.getOwnPropertySymbols(t);
20
+ e && (i = i.filter(function(a) {
21
+ return Object.getOwnPropertyDescriptor(t, a).enumerable;
22
+ })), n.push.apply(n, i);
23
+ }
24
+ return n;
25
+ }
26
+ function ee(t) {
27
+ for (var e = 1; e < arguments.length; e++) {
28
+ var n = arguments[e] != null ? arguments[e] : {};
29
+ e % 2 ? Ve(Object(n), !0).forEach(function(i) {
30
+ Ce(t, i, n[i]);
31
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : Ve(Object(n)).forEach(function(i) {
32
+ Object.defineProperty(t, i, Object.getOwnPropertyDescriptor(n, i));
33
+ });
34
+ }
35
+ return t;
36
+ }
37
+ function kt(t, e) {
38
+ if (t == null) return {};
39
+ var n, i, a = {}, s = Object.keys(t);
40
+ for (i = 0; i < s.length; i++) n = s[i], e.indexOf(n) >= 0 || (a[n] = t[n]);
41
+ return a;
42
+ }
43
+ function wt(t, e) {
44
+ if (t == null) return {};
45
+ var n, i, a = kt(t, e);
46
+ if (Object.getOwnPropertySymbols) {
47
+ var s = Object.getOwnPropertySymbols(t);
48
+ for (i = 0; i < s.length; i++) n = s[i], e.indexOf(n) >= 0 || Object.prototype.propertyIsEnumerable.call(t, n) && (a[n] = t[n]);
49
+ }
50
+ return a;
51
+ }
52
+ function O(t, e) {
53
+ return Ct(t) || Et(t, e) || Xe(t, e) || Pt();
54
+ }
55
+ function Ae(t) {
56
+ return Tt(t) || At(t) || Xe(t) || St();
57
+ }
58
+ function Tt(t) {
59
+ if (Array.isArray(t)) return Ee(t);
60
+ }
61
+ function Ct(t) {
62
+ if (Array.isArray(t)) return t;
63
+ }
64
+ function At(t) {
65
+ if (typeof Symbol < "u" && Symbol.iterator in Object(t)) return Array.from(t);
66
+ }
67
+ function Et(t, e) {
68
+ if (typeof Symbol < "u" && Symbol.iterator in Object(t)) {
69
+ var n = [], i = !0, a = !1, s = void 0;
70
+ try {
71
+ for (var o, l = t[Symbol.iterator](); !(i = (o = l.next()).done) && (n.push(o.value), !e || n.length !== e); i = !0) ;
72
+ } catch (c) {
73
+ a = !0, s = c;
74
+ } finally {
75
+ try {
76
+ i || l.return == null || l.return();
77
+ } finally {
78
+ if (a) throw s;
79
+ }
80
+ }
81
+ return n;
82
+ }
83
+ }
84
+ function Xe(t, e) {
85
+ if (t) {
86
+ if (typeof t == "string") return Ee(t, e);
87
+ var n = Object.prototype.toString.call(t).slice(8, -1);
88
+ return n === "Object" && t.constructor && (n = t.constructor.name), n === "Map" || n === "Set" ? Array.from(t) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? Ee(t, e) : void 0;
89
+ }
90
+ }
91
+ function Ee(t, e) {
92
+ (e == null || e > t.length) && (e = t.length);
93
+ for (var n = 0, i = new Array(e); n < e; n++) i[n] = t[n];
94
+ return i;
95
+ }
96
+ function St() {
97
+ throw new TypeError(`Invalid attempt to spread non-iterable instance.
98
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
99
+ }
100
+ function Pt() {
101
+ throw new TypeError(`Invalid attempt to destructure non-iterable instance.
102
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
103
+ }
104
+ function Nt(t, e) {
105
+ if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
106
+ }
107
+ function Ue(t, e) {
108
+ for (var n = 0; n < e.length; n++) {
109
+ var i = e[n];
110
+ i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(t, i.key, i);
111
+ }
112
+ }
113
+ function Mt(t, e, n) {
114
+ return e && Ue(t.prototype, e), n && Ue(t, n), t;
115
+ }
116
+ function xt(t, e, n) {
117
+ return e in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = n, t;
118
+ }
119
+ function Be(t, e) {
120
+ var n = Object.keys(t);
121
+ if (Object.getOwnPropertySymbols) {
122
+ var i = Object.getOwnPropertySymbols(t);
123
+ e && (i = i.filter(function(a) {
124
+ return Object.getOwnPropertyDescriptor(t, a).enumerable;
125
+ })), n.push.apply(n, i);
126
+ }
127
+ return n;
128
+ }
129
+ function We(t) {
130
+ for (var e = 1; e < arguments.length; e++) {
131
+ var n = arguments[e] != null ? arguments[e] : {};
132
+ e % 2 ? Be(Object(n), !0).forEach(function(i) {
133
+ xt(t, i, n[i]);
134
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : Be(Object(n)).forEach(function(i) {
135
+ Object.defineProperty(t, i, Object.getOwnPropertyDescriptor(n, i));
136
+ });
137
+ }
138
+ return t;
139
+ }
140
+ var ze = { addCSS: !0, thumbWidth: 15, watch: !0 };
141
+ function It(t, e) {
142
+ return (function() {
143
+ return Array.from(document.querySelectorAll(e)).includes(this);
144
+ }).call(t, e);
145
+ }
146
+ function Lt(t, e) {
147
+ if (t && e) {
148
+ var n = new Event(e, { bubbles: !0 });
149
+ t.dispatchEvent(n);
150
+ }
151
+ }
152
+ var re = function(t) {
153
+ return t != null ? t.constructor : null;
154
+ }, Oe = function(t, e) {
155
+ return !!(t && e && t instanceof e);
156
+ }, Je = function(t) {
157
+ return t == null;
158
+ }, Ge = function(t) {
159
+ return re(t) === Object;
160
+ }, Ot = function(t) {
161
+ return re(t) === Number && !Number.isNaN(t);
162
+ }, Ze = function(t) {
163
+ return re(t) === String;
164
+ }, _t = function(t) {
165
+ return re(t) === Boolean;
166
+ }, jt = function(t) {
167
+ return re(t) === Function;
168
+ }, et = function(t) {
169
+ return Array.isArray(t);
170
+ }, tt = function(t) {
171
+ return Oe(t, NodeList);
172
+ }, Dt = function(t) {
173
+ return Oe(t, Element);
174
+ }, Ht = function(t) {
175
+ return Oe(t, Event);
176
+ }, qt = function(t) {
177
+ return Je(t) || (Ze(t) || et(t) || tt(t)) && !t.length || Ge(t) && !Object.keys(t).length;
178
+ }, D = { nullOrUndefined: Je, object: Ge, number: Ot, string: Ze, boolean: _t, function: jt, array: et, nodeList: tt, element: Dt, event: Ht, empty: qt };
179
+ function Ft(t) {
180
+ var e = "".concat(t).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
181
+ return e ? Math.max(0, (e[1] ? e[1].length : 0) - (e[2] ? +e[2] : 0)) : 0;
182
+ }
183
+ function Rt(t, e) {
184
+ if (1 > e) {
185
+ var n = Ft(e);
186
+ return parseFloat(t.toFixed(n));
187
+ }
188
+ return Math.round(t / e) * e;
189
+ }
190
+ var Vt = function() {
191
+ function t(e, n) {
192
+ Nt(this, t), D.element(e) ? this.element = e : D.string(e) && (this.element = document.querySelector(e)), D.element(this.element) && D.empty(this.element.rangeTouch) && (this.config = We({}, ze, {}, n), this.init());
193
+ }
194
+ return Mt(t, [{ key: "init", value: function() {
195
+ t.enabled && (this.config.addCSS && (this.element.style.userSelect = "none", this.element.style.webKitUserSelect = "none", this.element.style.touchAction = "manipulation"), this.listeners(!0), this.element.rangeTouch = this);
196
+ } }, { key: "destroy", value: function() {
197
+ t.enabled && (this.config.addCSS && (this.element.style.userSelect = "", this.element.style.webKitUserSelect = "", this.element.style.touchAction = ""), this.listeners(!1), this.element.rangeTouch = null);
198
+ } }, { key: "listeners", value: function(e) {
199
+ var n = this, i = e ? "addEventListener" : "removeEventListener";
200
+ ["touchstart", "touchmove", "touchend"].forEach(function(a) {
201
+ n.element[i](a, function(s) {
202
+ return n.set(s);
203
+ }, !1);
204
+ });
205
+ } }, { key: "get", value: function(e) {
206
+ if (!t.enabled || !D.event(e)) return null;
207
+ var n, i = e.target, a = e.changedTouches[0], s = parseFloat(i.getAttribute("min")) || 0, o = parseFloat(i.getAttribute("max")) || 100, l = parseFloat(i.getAttribute("step")) || 1, c = i.getBoundingClientRect(), d = 100 / c.width * (this.config.thumbWidth / 2) / 100;
208
+ return 0 > (n = 100 / c.width * (a.clientX - c.left)) ? n = 0 : 100 < n && (n = 100), 50 > n ? n -= (100 - 2 * n) * d : 50 < n && (n += 2 * (n - 50) * d), s + Rt(n / 100 * (o - s), l);
209
+ } }, { key: "set", value: function(e) {
210
+ t.enabled && D.event(e) && !e.target.disabled && (e.preventDefault(), e.target.value = this.get(e), Lt(e.target, e.type === "touchend" ? "change" : "input"));
211
+ } }], [{ key: "setup", value: function(e) {
212
+ var n = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : {}, i = null;
213
+ if (D.empty(e) || D.string(e) ? i = Array.from(document.querySelectorAll(D.string(e) ? e : 'input[type="range"]')) : D.element(e) ? i = [e] : D.nodeList(e) ? i = Array.from(e) : D.array(e) && (i = e.filter(D.element)), D.empty(i)) return null;
214
+ var a = We({}, ze, {}, n);
215
+ if (D.string(e) && a.watch) {
216
+ var s = new MutationObserver(function(o) {
217
+ Array.from(o).forEach(function(l) {
218
+ Array.from(l.addedNodes).forEach(function(c) {
219
+ D.element(c) && It(c, e) && new t(c, a);
220
+ });
221
+ });
222
+ });
223
+ s.observe(document.body, { childList: !0, subtree: !0 });
224
+ }
225
+ return i.map(function(o) {
226
+ return new t(o, n);
227
+ });
228
+ } }, { key: "enabled", get: function() {
229
+ return "ontouchstart" in document.documentElement;
230
+ } }]), t;
231
+ }(), te = function(t) {
232
+ return t != null ? t.constructor : null;
233
+ }, V = function(t, e) {
234
+ return !!(t && e && t instanceof e);
235
+ }, _e = function(t) {
236
+ return t == null;
237
+ }, nt = function(t) {
238
+ return te(t) === Object;
239
+ }, Ut = function(t) {
240
+ return te(t) === Number && !Number.isNaN(t);
241
+ }, ge = function(t) {
242
+ return te(t) === String;
243
+ }, Bt = function(t) {
244
+ return te(t) === Boolean;
245
+ }, it = function(t) {
246
+ return te(t) === Function;
247
+ }, at = function(t) {
248
+ return Array.isArray(t);
249
+ }, Wt = function(t) {
250
+ return V(t, WeakMap);
251
+ }, st = function(t) {
252
+ return V(t, NodeList);
253
+ }, zt = function(t) {
254
+ return V(t, Element);
255
+ }, $t = function(t) {
256
+ return te(t) === Text;
257
+ }, Kt = function(t) {
258
+ return V(t, Event);
259
+ }, Yt = function(t) {
260
+ return V(t, KeyboardEvent);
261
+ }, Qt = function(t) {
262
+ return V(t, window.TextTrackCue) || V(t, window.VTTCue);
263
+ }, Xt = function(t) {
264
+ return V(t, TextTrack) || !_e(t) && ge(t.kind);
265
+ }, Jt = function(t) {
266
+ return V(t, Promise) && it(t.then);
267
+ }, rt = function(t) {
268
+ return _e(t) || (ge(t) || at(t) || st(t)) && !t.length || nt(t) && !Object.keys(t).length;
269
+ }, Gt = function(t) {
270
+ if (V(t, window.URL)) return !0;
271
+ if (!ge(t)) return !1;
272
+ var e = t;
273
+ t.startsWith("http://") && t.startsWith("https://") || (e = "http://".concat(t));
274
+ try {
275
+ return !rt(new URL(e).hostname);
276
+ } catch {
277
+ return !1;
278
+ }
279
+ }, r = { nullOrUndefined: _e, object: nt, number: Ut, string: ge, boolean: Bt, function: it, array: at, weakMap: Wt, nodeList: st, element: zt, textNode: $t, event: Kt, keyboardEvent: Yt, cue: Qt, track: Xt, promise: Jt, url: Gt, empty: rt }, Se = function() {
280
+ var t = document.createElement("span"), e = { WebkitTransition: "webkitTransitionEnd", MozTransition: "transitionend", OTransition: "oTransitionEnd otransitionend", transition: "transitionend" }, n = Object.keys(e).find(function(i) {
281
+ return t.style[i] !== void 0;
282
+ });
283
+ return !!r.string(n) && e[n];
284
+ }();
285
+ function Pe(t, e) {
286
+ setTimeout(function() {
287
+ try {
288
+ t.hidden = !0, t.offsetHeight, t.hidden = !1;
289
+ } catch {
290
+ }
291
+ }, e);
292
+ }
293
+ var _ = { isIE: (
294
+ /* @cc_on!@ */
295
+ !!document.documentMode
296
+ ), isEdge: window.navigator.userAgent.includes("Edge"), isWebkit: "WebkitAppearance" in document.documentElement.style && !/Edge/.test(navigator.userAgent), isIPhone: /(iPhone|iPod)/gi.test(navigator.platform), isIos: /(iPad|iPhone|iPod)/gi.test(navigator.platform) };
297
+ function Zt(t) {
298
+ return JSON.parse(JSON.stringify(t));
299
+ }
300
+ function ot(t, e) {
301
+ return e.split(".").reduce(function(n, i) {
302
+ return n && n[i];
303
+ }, t);
304
+ }
305
+ function x() {
306
+ for (var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), i = 1; i < e; i++) n[i - 1] = arguments[i];
307
+ if (!n.length) return t;
308
+ var a = n.shift();
309
+ return r.object(a) ? (Object.keys(a).forEach(function(s) {
310
+ r.object(a[s]) ? (Object.keys(t).includes(s) || Object.assign(t, Ce({}, s, {})), x(t[s], a[s])) : Object.assign(t, Ce({}, s, a[s]));
311
+ }), x.apply(void 0, [t].concat(n))) : t;
312
+ }
313
+ function lt(t, e) {
314
+ var n = t.length ? t : [t];
315
+ Array.from(n).reverse().forEach(function(i, a) {
316
+ var s = a > 0 ? e.cloneNode(!0) : e, o = i.parentNode, l = i.nextSibling;
317
+ s.appendChild(i), l ? o.insertBefore(s, l) : o.appendChild(s);
318
+ });
319
+ }
320
+ function Ne(t, e) {
321
+ r.element(t) && !r.empty(e) && Object.entries(e).filter(function(n) {
322
+ var i = O(n, 2)[1];
323
+ return !r.nullOrUndefined(i);
324
+ }).forEach(function(n) {
325
+ var i = O(n, 2), a = i[0], s = i[1];
326
+ return t.setAttribute(a, s);
327
+ });
328
+ }
329
+ function v(t, e, n) {
330
+ var i = document.createElement(t);
331
+ return r.object(e) && Ne(i, e), r.string(n) && (i.innerText = n), i;
332
+ }
333
+ function en(t, e) {
334
+ r.element(t) && r.element(e) && e.parentNode.insertBefore(t, e.nextSibling);
335
+ }
336
+ function $e(t, e, n, i) {
337
+ r.element(e) && e.appendChild(v(t, n, i));
338
+ }
339
+ function B(t) {
340
+ r.nodeList(t) || r.array(t) ? Array.from(t).forEach(B) : r.element(t) && r.element(t.parentNode) && t.parentNode.removeChild(t);
341
+ }
342
+ function ue(t) {
343
+ if (r.element(t)) for (var e = t.childNodes.length; e > 0; ) t.removeChild(t.lastChild), e -= 1;
344
+ }
345
+ function me(t, e) {
346
+ return r.element(e) && r.element(e.parentNode) && r.element(t) ? (e.parentNode.replaceChild(t, e), t) : null;
347
+ }
348
+ function F(t, e) {
349
+ if (!r.string(t) || r.empty(t)) return {};
350
+ var n = {}, i = x({}, e);
351
+ return t.split(",").forEach(function(a) {
352
+ var s = a.trim(), o = s.replace(".", ""), l = s.replace(/[[\]]/g, "").split("="), c = O(l, 1)[0], d = l.length > 1 ? l[1].replace(/["']/g, "") : "";
353
+ switch (s.charAt(0)) {
354
+ case ".":
355
+ r.string(i.class) ? n.class = "".concat(i.class, " ").concat(o) : n.class = o;
356
+ break;
357
+ case "#":
358
+ n.id = s.replace("#", "");
359
+ break;
360
+ case "[":
361
+ n[c] = d;
362
+ }
363
+ }), x(i, n);
364
+ }
365
+ function Y(t, e) {
366
+ if (r.element(t)) {
367
+ var n = e;
368
+ r.boolean(n) || (n = !t.hidden), t.hidden = n;
369
+ }
370
+ }
371
+ function A(t, e, n) {
372
+ if (r.nodeList(t)) return Array.from(t).map(function(a) {
373
+ return A(a, e, n);
374
+ });
375
+ if (r.element(t)) {
376
+ var i = "toggle";
377
+ return n !== void 0 && (i = n ? "add" : "remove"), t.classList[i](e), t.classList.contains(e);
378
+ }
379
+ return !1;
380
+ }
381
+ function pe(t, e) {
382
+ return r.element(t) && t.classList.contains(e);
383
+ }
384
+ function Q(t, e) {
385
+ var n = Element.prototype;
386
+ return (n.matches || n.webkitMatchesSelector || n.mozMatchesSelector || n.msMatchesSelector || function() {
387
+ return Array.from(document.querySelectorAll(e)).includes(this);
388
+ }).call(t, e);
389
+ }
390
+ function tn(t, e) {
391
+ return (Element.prototype.closest || function() {
392
+ var n = this;
393
+ do {
394
+ if (Q.matches(n, e)) return n;
395
+ n = n.parentElement || n.parentNode;
396
+ } while (n !== null && n.nodeType === 1);
397
+ return null;
398
+ }).call(t, e);
399
+ }
400
+ function G(t) {
401
+ return this.elements.container.querySelectorAll(t);
402
+ }
403
+ function I(t) {
404
+ return this.elements.container.querySelector(t);
405
+ }
406
+ function be() {
407
+ var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null, e = arguments.length > 1 && arguments[1] !== void 0 && arguments[1];
408
+ r.element(t) && (t.focus({ preventScroll: !0 }), e && A(t, this.config.classNames.tabFocus));
409
+ }
410
+ var Ke = { "audio/ogg": "vorbis", "audio/wav": "1", "video/webm": "vp8, vorbis", "video/mp4": "avc1.42E01E, mp4a.40.2", "video/ogg": "theora" }, M = { audio: "canPlayType" in document.createElement("audio"), video: "canPlayType" in document.createElement("video"), check: function(t, e, n) {
411
+ var i = _.isIPhone && n && M.playsinline, a = M[t] || e !== "html5";
412
+ return { api: a, ui: a && M.rangeInput && (t !== "video" || !_.isIPhone || i) };
413
+ }, pip: !(_.isIPhone || !r.function(v("video").webkitSetPresentationMode) && (!document.pictureInPictureEnabled || v("video").disablePictureInPicture)), airplay: r.function(window.WebKitPlaybackTargetAvailabilityEvent), playsinline: "playsInline" in document.createElement("video"), mime: function(t) {
414
+ if (r.empty(t)) return !1;
415
+ var e = O(t.split("/"), 1)[0], n = t;
416
+ if (!this.isHTML5 || e !== this.type) return !1;
417
+ Object.keys(Ke).includes(n) && (n += '; codecs="'.concat(Ke[t], '"'));
418
+ try {
419
+ return !!(n && this.media.canPlayType(n).replace(/no/, ""));
420
+ } catch {
421
+ return !1;
422
+ }
423
+ }, textTracks: "textTracks" in document.createElement("video"), rangeInput: function() {
424
+ var t = document.createElement("input");
425
+ return t.type = "range", t.type === "range";
426
+ }(), touch: "ontouchstart" in document.documentElement, transitions: Se !== !1, reducedMotion: "matchMedia" in window && window.matchMedia("(prefers-reduced-motion)").matches }, nn = function() {
427
+ var t = !1;
428
+ try {
429
+ var e = Object.defineProperty({}, "passive", { get: function() {
430
+ return t = !0, null;
431
+ } });
432
+ window.addEventListener("test", null, e), window.removeEventListener("test", null, e);
433
+ } catch {
434
+ }
435
+ return t;
436
+ }();
437
+ function Z(t, e, n) {
438
+ var i = this, a = arguments.length > 3 && arguments[3] !== void 0 && arguments[3], s = !(arguments.length > 4 && arguments[4] !== void 0) || arguments[4], o = arguments.length > 5 && arguments[5] !== void 0 && arguments[5];
439
+ if (t && "addEventListener" in t && !r.empty(e) && r.function(n)) {
440
+ var l = e.split(" "), c = o;
441
+ nn && (c = { passive: s, capture: o }), l.forEach(function(d) {
442
+ i && i.eventListeners && a && i.eventListeners.push({ element: t, type: d, callback: n, options: c }), t[a ? "addEventListener" : "removeEventListener"](d, n, c);
443
+ });
444
+ }
445
+ }
446
+ function C(t) {
447
+ var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "", n = arguments.length > 2 ? arguments[2] : void 0, i = !(arguments.length > 3 && arguments[3] !== void 0) || arguments[3], a = arguments.length > 4 && arguments[4] !== void 0 && arguments[4];
448
+ Z.call(this, t, e, n, !0, i, a);
449
+ }
450
+ function fe(t) {
451
+ var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "", n = arguments.length > 2 ? arguments[2] : void 0, i = !(arguments.length > 3 && arguments[3] !== void 0) || arguments[3], a = arguments.length > 4 && arguments[4] !== void 0 && arguments[4];
452
+ Z.call(this, t, e, n, !1, i, a);
453
+ }
454
+ function je(t) {
455
+ var e = this, n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "", i = arguments.length > 2 ? arguments[2] : void 0, a = !(arguments.length > 3 && arguments[3] !== void 0) || arguments[3], s = arguments.length > 4 && arguments[4] !== void 0 && arguments[4], o = function l() {
456
+ fe(t, n, l, a, s);
457
+ for (var c = arguments.length, d = new Array(c), p = 0; p < c; p++) d[p] = arguments[p];
458
+ i.apply(e, d);
459
+ };
460
+ Z.call(this, t, n, o, !0, a, s);
461
+ }
462
+ function y(t) {
463
+ var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "", n = arguments.length > 2 && arguments[2] !== void 0 && arguments[2], i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
464
+ if (r.element(t) && !r.empty(e)) {
465
+ var a = new CustomEvent(e, { bubbles: n, detail: ee(ee({}, i), {}, { plyr: this }) });
466
+ t.dispatchEvent(a);
467
+ }
468
+ }
469
+ function an() {
470
+ this && this.eventListeners && (this.eventListeners.forEach(function(t) {
471
+ var e = t.element, n = t.type, i = t.callback, a = t.options;
472
+ e.removeEventListener(n, i, a);
473
+ }), this.eventListeners = []);
474
+ }
475
+ function sn() {
476
+ var t = this;
477
+ return new Promise(function(e) {
478
+ return t.ready ? setTimeout(e, 0) : C.call(t, t.elements.container, "ready", e);
479
+ }).then(function() {
480
+ });
481
+ }
482
+ function R(t) {
483
+ r.promise(t) && t.then(null, function() {
484
+ });
485
+ }
486
+ function ct(t) {
487
+ return !!(r.array(t) || r.string(t) && t.includes(":")) && (r.array(t) ? t : t.split(":")).map(Number).every(r.number);
488
+ }
489
+ function ut(t) {
490
+ if (!r.array(t) || !t.every(r.number)) return null;
491
+ var e = O(t, 2), n = e[0], i = e[1], a = function s(o, l) {
492
+ return l === 0 ? o : s(l, o % l);
493
+ }(n, i);
494
+ return [n / a, i / a];
495
+ }
496
+ function De(t) {
497
+ var e = function(a) {
498
+ return ct(a) ? a.split(":").map(Number) : null;
499
+ }, n = e(t);
500
+ if (n === null && (n = e(this.config.ratio)), n === null && !r.empty(this.embed) && r.array(this.embed.ratio) && (n = this.embed.ratio), n === null && this.isHTML5) {
501
+ var i = this.media;
502
+ n = ut([i.videoWidth, i.videoHeight]);
503
+ }
504
+ return n;
505
+ }
506
+ function $(t) {
507
+ if (!this.isVideo) return {};
508
+ var e = this.elements.wrapper, n = De.call(this, t), i = O(r.array(n) ? n : [0, 0], 2), a = 100 / i[0] * i[1];
509
+ if (e.style.paddingBottom = "".concat(a, "%"), this.isVimeo && !this.config.vimeo.premium && this.supported.ui) {
510
+ var s = 100 / this.media.offsetWidth * parseInt(window.getComputedStyle(this.media).paddingBottom, 10), o = (s - a) / (s / 50);
511
+ this.fullscreen.active ? e.style.paddingBottom = null : this.media.style.transform = "translateY(-".concat(o, "%)");
512
+ } else this.isHTML5 && e.classList.toggle(this.config.classNames.videoFixedRatio, n !== null);
513
+ return { padding: a, ratio: n };
514
+ }
515
+ var z = { getSources: function() {
516
+ var t = this;
517
+ return this.isHTML5 ? Array.from(this.media.querySelectorAll("source")).filter(function(e) {
518
+ var n = e.getAttribute("type");
519
+ return !!r.empty(n) || M.mime.call(t, n);
520
+ }) : [];
521
+ }, getQualityOptions: function() {
522
+ return this.config.quality.forced ? this.config.quality.options : z.getSources.call(this).map(function(t) {
523
+ return Number(t.getAttribute("size"));
524
+ }).filter(Boolean);
525
+ }, setup: function() {
526
+ if (this.isHTML5) {
527
+ var t = this;
528
+ t.options.speed = t.config.speed.options, r.empty(this.config.ratio) || $.call(t), Object.defineProperty(t.media, "quality", { get: function() {
529
+ var e = z.getSources.call(t).find(function(n) {
530
+ return n.getAttribute("src") === t.source;
531
+ });
532
+ return e && Number(e.getAttribute("size"));
533
+ }, set: function(e) {
534
+ if (t.quality !== e) {
535
+ if (t.config.quality.forced && r.function(t.config.quality.onChange)) t.config.quality.onChange(e);
536
+ else {
537
+ var n = z.getSources.call(t).find(function(d) {
538
+ return Number(d.getAttribute("size")) === e;
539
+ });
540
+ if (!n) return;
541
+ var i = t.media, a = i.currentTime, s = i.paused, o = i.preload, l = i.readyState, c = i.playbackRate;
542
+ t.media.src = n.getAttribute("src"), (o !== "none" || l) && (t.once("loadedmetadata", function() {
543
+ t.speed = c, t.currentTime = a, s || R(t.play());
544
+ }), t.media.load());
545
+ }
546
+ y.call(t, t.media, "qualitychange", !1, { quality: e });
547
+ }
548
+ } });
549
+ }
550
+ }, cancelRequests: function() {
551
+ this.isHTML5 && (B(z.getSources.call(this)), this.media.setAttribute("src", this.config.blankVideo), this.media.load(), this.debug.log("Cancelled network requests"));
552
+ } };
553
+ function Me(t) {
554
+ return r.array(t) ? t.filter(function(e, n) {
555
+ return t.indexOf(e) === n;
556
+ }) : t;
557
+ }
558
+ function rn(t, e) {
559
+ return r.array(t) && t.length ? t.reduce(function(n, i) {
560
+ return Math.abs(i - e) < Math.abs(n - e) ? i : n;
561
+ }) : null;
562
+ }
563
+ function on(t) {
564
+ return "".concat(t, "-").concat(Math.floor(1e4 * Math.random()));
565
+ }
566
+ function xe(t) {
567
+ for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), i = 1; i < e; i++) n[i - 1] = arguments[i];
568
+ return r.empty(t) ? t : t.toString().replace(/{(\d+)}/g, function(a, s) {
569
+ return n[s].toString();
570
+ });
571
+ }
572
+ function ln(t, e) {
573
+ return t === 0 || e === 0 || Number.isNaN(t) || Number.isNaN(e) ? 0 : (t / e * 100).toFixed(2);
574
+ }
575
+ var se = function() {
576
+ var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "", n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
577
+ return t.replace(new RegExp(e.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g, "\\$1"), "g"), n.toString());
578
+ }, dt = function() {
579
+ var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
580
+ return t.toString().replace(/\w\S*/g, function(e) {
581
+ return e.charAt(0).toUpperCase() + e.substr(1).toLowerCase();
582
+ });
583
+ };
584
+ function cn() {
585
+ var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", e = t.toString();
586
+ return e = se(e, "-", " "), e = se(e, "_", " "), e = dt(e), se(e, " ", "");
587
+ }
588
+ function un() {
589
+ var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", e = t.toString();
590
+ return (e = cn(e)).charAt(0).toLowerCase() + e.slice(1);
591
+ }
592
+ function dn(t) {
593
+ var e = document.createDocumentFragment(), n = document.createElement("div");
594
+ return e.appendChild(n), n.innerHTML = t, e.firstChild.innerText;
595
+ }
596
+ function hn(t) {
597
+ var e = document.createElement("div");
598
+ return e.appendChild(t), e.innerHTML;
599
+ }
600
+ var Ye = { pip: "PIP", airplay: "AirPlay", html5: "HTML5", vimeo: "Vimeo", youtube: "YouTube" }, L = { get: function() {
601
+ var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
602
+ if (r.empty(t) || r.empty(e)) return "";
603
+ var n = ot(e.i18n, t);
604
+ if (r.empty(n)) return Object.keys(Ye).includes(t) ? Ye[t] : "";
605
+ var i = { "{seektime}": e.seekTime, "{title}": e.title };
606
+ return Object.entries(i).forEach(function(a) {
607
+ var s = O(a, 2), o = s[0], l = s[1];
608
+ n = se(n, o, l);
609
+ }), n;
610
+ } }, ht = function() {
611
+ function t(e) {
612
+ X(this, t), this.enabled = e.config.storage.enabled, this.key = e.config.storage.key;
613
+ }
614
+ return J(t, [{ key: "get", value: function(e) {
615
+ if (!t.supported || !this.enabled) return null;
616
+ var n = window.localStorage.getItem(this.key);
617
+ if (r.empty(n)) return null;
618
+ var i = JSON.parse(n);
619
+ return r.string(e) && e.length ? i[e] : i;
620
+ } }, { key: "set", value: function(e) {
621
+ if (t.supported && this.enabled && r.object(e)) {
622
+ var n = this.get();
623
+ r.empty(n) && (n = {}), x(n, e), window.localStorage.setItem(this.key, JSON.stringify(n));
624
+ }
625
+ } }], [{ key: "supported", get: function() {
626
+ try {
627
+ if (!("localStorage" in window)) return !1;
628
+ var e = "___test";
629
+ return window.localStorage.setItem(e, e), window.localStorage.removeItem(e), !0;
630
+ } catch {
631
+ return !1;
632
+ }
633
+ } }]), t;
634
+ }();
635
+ function oe(t) {
636
+ var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "text";
637
+ return new Promise(function(n, i) {
638
+ try {
639
+ var a = new XMLHttpRequest();
640
+ if (!("withCredentials" in a)) return;
641
+ a.addEventListener("load", function() {
642
+ if (e === "text") try {
643
+ n(JSON.parse(a.responseText));
644
+ } catch {
645
+ n(a.responseText);
646
+ }
647
+ else n(a.response);
648
+ }), a.addEventListener("error", function() {
649
+ throw new Error(a.status);
650
+ }), a.open("GET", t, !0), a.responseType = e, a.send();
651
+ } catch (s) {
652
+ i(s);
653
+ }
654
+ });
655
+ }
656
+ function mt(t, e) {
657
+ if (r.string(t)) {
658
+ var n = "cache", i = r.string(e), a = function() {
659
+ return document.getElementById(e) !== null;
660
+ }, s = function(p, g) {
661
+ p.innerHTML = g, i && a() || document.body.insertAdjacentElement("afterbegin", p);
662
+ };
663
+ if (!i || !a()) {
664
+ var o = ht.supported, l = document.createElement("div");
665
+ if (l.setAttribute("hidden", ""), i && l.setAttribute("id", e), o) {
666
+ var c = window.localStorage.getItem("".concat(n, "-").concat(e));
667
+ if (c !== null) {
668
+ var d = JSON.parse(c);
669
+ s(l, d.content);
670
+ }
671
+ }
672
+ oe(t).then(function(p) {
673
+ r.empty(p) || (o && window.localStorage.setItem("".concat(n, "-").concat(e), JSON.stringify({ content: p })), s(l, p));
674
+ }).catch(function() {
675
+ });
676
+ }
677
+ }
678
+ }
679
+ var pt = function(t) {
680
+ return Math.trunc(t / 60 / 60 % 60, 10);
681
+ }, mn = function(t) {
682
+ return Math.trunc(t / 60 % 60, 10);
683
+ }, pn = function(t) {
684
+ return Math.trunc(t % 60, 10);
685
+ };
686
+ function ye() {
687
+ var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0, e = arguments.length > 1 && arguments[1] !== void 0 && arguments[1], n = arguments.length > 2 && arguments[2] !== void 0 && arguments[2];
688
+ if (!r.number(t)) return ye(void 0, e, n);
689
+ var i = function(l) {
690
+ return "0".concat(l).slice(-2);
691
+ }, a = pt(t), s = mn(t), o = pn(t);
692
+ return a = e || a > 0 ? "".concat(a, ":") : "", "".concat(n && t > 0 ? "-" : "").concat(a).concat(i(s), ":").concat(i(o));
693
+ }
694
+ var h = { getIconUrl: function() {
695
+ var t = new URL(this.config.iconUrl, window.location).host !== window.location.host || _.isIE && !window.svg4everybody;
696
+ return { url: this.config.iconUrl, cors: t };
697
+ }, findElements: function() {
698
+ try {
699
+ return this.elements.controls = I.call(this, this.config.selectors.controls.wrapper), this.elements.buttons = { play: G.call(this, this.config.selectors.buttons.play), pause: I.call(this, this.config.selectors.buttons.pause), restart: I.call(this, this.config.selectors.buttons.restart), rewind: I.call(this, this.config.selectors.buttons.rewind), fastForward: I.call(this, this.config.selectors.buttons.fastForward), mute: I.call(this, this.config.selectors.buttons.mute), pip: I.call(this, this.config.selectors.buttons.pip), airplay: I.call(this, this.config.selectors.buttons.airplay), settings: I.call(this, this.config.selectors.buttons.settings), captions: I.call(this, this.config.selectors.buttons.captions), fullscreen: I.call(this, this.config.selectors.buttons.fullscreen) }, this.elements.progress = I.call(this, this.config.selectors.progress), this.elements.inputs = { seek: I.call(this, this.config.selectors.inputs.seek), volume: I.call(this, this.config.selectors.inputs.volume) }, this.elements.display = { buffer: I.call(this, this.config.selectors.display.buffer), currentTime: I.call(this, this.config.selectors.display.currentTime), duration: I.call(this, this.config.selectors.display.duration) }, r.element(this.elements.progress) && (this.elements.display.seekTooltip = this.elements.progress.querySelector(".".concat(this.config.classNames.tooltip))), !0;
700
+ } catch (t) {
701
+ return this.debug.warn("It looks like there is a problem with your custom controls HTML", t), this.toggleNativeControls(!0), !1;
702
+ }
703
+ }, createIcon: function(t, e) {
704
+ var n = "http://www.w3.org/2000/svg", i = h.getIconUrl.call(this), a = "".concat(i.cors ? "" : i.url, "#").concat(this.config.iconPrefix), s = document.createElementNS(n, "svg");
705
+ Ne(s, x(e, { "aria-hidden": "true", focusable: "false" }));
706
+ var o = document.createElementNS(n, "use"), l = "".concat(a, "-").concat(t);
707
+ return "href" in o && o.setAttributeNS("http://www.w3.org/1999/xlink", "href", l), o.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", l), s.appendChild(o), s;
708
+ }, createLabel: function(t) {
709
+ var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = L.get(t, this.config), i = ee(ee({}, e), {}, { class: [e.class, this.config.classNames.hidden].filter(Boolean).join(" ") });
710
+ return v("span", i, n);
711
+ }, createBadge: function(t) {
712
+ if (r.empty(t)) return null;
713
+ var e = v("span", { class: this.config.classNames.menu.value });
714
+ return e.appendChild(v("span", { class: this.config.classNames.menu.badge }, t)), e;
715
+ }, createButton: function(t, e) {
716
+ var n = this, i = x({}, e), a = un(t), s = { element: "button", toggle: !1, label: null, icon: null, labelPressed: null, iconPressed: null };
717
+ switch (["element", "icon", "label"].forEach(function(l) {
718
+ Object.keys(i).includes(l) && (s[l] = i[l], delete i[l]);
719
+ }), s.element !== "button" || Object.keys(i).includes("type") || (i.type = "button"), Object.keys(i).includes("class") ? i.class.split(" ").some(function(l) {
720
+ return l === n.config.classNames.control;
721
+ }) || x(i, { class: "".concat(i.class, " ").concat(this.config.classNames.control) }) : i.class = this.config.classNames.control, t) {
722
+ case "play":
723
+ s.toggle = !0, s.label = "play", s.labelPressed = "pause", s.icon = "play", s.iconPressed = "pause";
724
+ break;
725
+ case "mute":
726
+ s.toggle = !0, s.label = "mute", s.labelPressed = "unmute", s.icon = "volume", s.iconPressed = "muted";
727
+ break;
728
+ case "captions":
729
+ s.toggle = !0, s.label = "enableCaptions", s.labelPressed = "disableCaptions", s.icon = "captions-off", s.iconPressed = "captions-on";
730
+ break;
731
+ case "fullscreen":
732
+ s.toggle = !0, s.label = "enterFullscreen", s.labelPressed = "exitFullscreen", s.icon = "enter-fullscreen", s.iconPressed = "exit-fullscreen";
733
+ break;
734
+ case "play-large":
735
+ i.class += " ".concat(this.config.classNames.control, "--overlaid"), a = "play", s.label = "play", s.icon = "play";
736
+ break;
737
+ default:
738
+ r.empty(s.label) && (s.label = a), r.empty(s.icon) && (s.icon = t);
739
+ }
740
+ var o = v(s.element);
741
+ return s.toggle ? (o.appendChild(h.createIcon.call(this, s.iconPressed, { class: "icon--pressed" })), o.appendChild(h.createIcon.call(this, s.icon, { class: "icon--not-pressed" })), o.appendChild(h.createLabel.call(this, s.labelPressed, { class: "label--pressed" })), o.appendChild(h.createLabel.call(this, s.label, { class: "label--not-pressed" }))) : (o.appendChild(h.createIcon.call(this, s.icon)), o.appendChild(h.createLabel.call(this, s.label))), x(i, F(this.config.selectors.buttons[a], i)), Ne(o, i), a === "play" ? (r.array(this.elements.buttons[a]) || (this.elements.buttons[a] = []), this.elements.buttons[a].push(o)) : this.elements.buttons[a] = o, o;
742
+ }, createRange: function(t, e) {
743
+ var n = v("input", x(F(this.config.selectors.inputs[t]), { type: "range", min: 0, max: 100, step: 0.01, value: 0, autocomplete: "off", role: "slider", "aria-label": L.get(t, this.config), "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": 0 }, e));
744
+ return this.elements.inputs[t] = n, h.updateRangeFill.call(this, n), Vt.setup(n), n;
745
+ }, createProgress: function(t, e) {
746
+ var n = v("progress", x(F(this.config.selectors.display[t]), { min: 0, max: 100, value: 0, role: "progressbar", "aria-hidden": !0 }, e));
747
+ if (t !== "volume") {
748
+ n.appendChild(v("span", null, "0"));
749
+ var i = { played: "played", buffer: "buffered" }[t], a = i ? L.get(i, this.config) : "";
750
+ n.innerText = "% ".concat(a.toLowerCase());
751
+ }
752
+ return this.elements.display[t] = n, n;
753
+ }, createTime: function(t, e) {
754
+ var n = F(this.config.selectors.display[t], e), i = v("div", x(n, { class: "".concat(n.class ? n.class : "", " ").concat(this.config.classNames.display.time, " ").trim(), "aria-label": L.get(t, this.config) }), "00:00");
755
+ return this.elements.display[t] = i, i;
756
+ }, bindMenuItemShortcuts: function(t, e) {
757
+ var n = this;
758
+ C.call(this, t, "keydown keyup", function(i) {
759
+ if ([32, 38, 39, 40].includes(i.which) && (i.preventDefault(), i.stopPropagation(), i.type !== "keydown")) {
760
+ var a, s = Q(t, '[role="menuitemradio"]');
761
+ !s && [32, 39].includes(i.which) ? h.showMenuPanel.call(n, e, !0) : i.which !== 32 && (i.which === 40 || s && i.which === 39 ? (a = t.nextElementSibling, r.element(a) || (a = t.parentNode.firstElementChild)) : (a = t.previousElementSibling, r.element(a) || (a = t.parentNode.lastElementChild)), be.call(n, a, !0));
762
+ }
763
+ }, !1), C.call(this, t, "keyup", function(i) {
764
+ i.which === 13 && h.focusFirstMenuItem.call(n, null, !0);
765
+ });
766
+ }, createMenuItem: function(t) {
767
+ var e = this, n = t.value, i = t.list, a = t.type, s = t.title, o = t.badge, l = o === void 0 ? null : o, c = t.checked, d = c !== void 0 && c, p = F(this.config.selectors.inputs[a]), g = v("button", x(p, { type: "button", role: "menuitemradio", class: "".concat(this.config.classNames.control, " ").concat(p.class ? p.class : "").trim(), "aria-checked": d, value: n })), u = v("span");
768
+ u.innerHTML = s, r.element(l) && u.appendChild(l), g.appendChild(u), Object.defineProperty(g, "checked", { enumerable: !0, get: function() {
769
+ return g.getAttribute("aria-checked") === "true";
770
+ }, set: function(f) {
771
+ f && Array.from(g.parentNode.children).filter(function(b) {
772
+ return Q(b, '[role="menuitemradio"]');
773
+ }).forEach(function(b) {
774
+ return b.setAttribute("aria-checked", "false");
775
+ }), g.setAttribute("aria-checked", f ? "true" : "false");
776
+ } }), this.listeners.bind(g, "click keyup", function(f) {
777
+ if (!r.keyboardEvent(f) || f.which === 32) {
778
+ switch (f.preventDefault(), f.stopPropagation(), g.checked = !0, a) {
779
+ case "language":
780
+ e.currentTrack = Number(n);
781
+ break;
782
+ case "quality":
783
+ e.quality = n;
784
+ break;
785
+ case "speed":
786
+ e.speed = parseFloat(n);
787
+ }
788
+ h.showMenuPanel.call(e, "home", r.keyboardEvent(f));
789
+ }
790
+ }, a, !1), h.bindMenuItemShortcuts.call(this, g, a), i.appendChild(g);
791
+ }, formatTime: function() {
792
+ var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0, e = arguments.length > 1 && arguments[1] !== void 0 && arguments[1];
793
+ if (!r.number(t)) return t;
794
+ var n = pt(this.duration) > 0;
795
+ return ye(t, n, e);
796
+ }, updateTimeDisplay: function() {
797
+ var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null, e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n = arguments.length > 2 && arguments[2] !== void 0 && arguments[2];
798
+ r.element(t) && r.number(e) && (t.innerText = h.formatTime(e, n));
799
+ }, updateVolume: function() {
800
+ this.supported.ui && (r.element(this.elements.inputs.volume) && h.setRange.call(this, this.elements.inputs.volume, this.muted ? 0 : this.volume), r.element(this.elements.buttons.mute) && (this.elements.buttons.mute.pressed = this.muted || this.volume === 0));
801
+ }, setRange: function(t) {
802
+ var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
803
+ r.element(t) && (t.value = e, h.updateRangeFill.call(this, t));
804
+ }, updateProgress: function(t) {
805
+ var e = this;
806
+ if (this.supported.ui && r.event(t)) {
807
+ var n = 0;
808
+ if (t) switch (t.type) {
809
+ case "timeupdate":
810
+ case "seeking":
811
+ case "seeked":
812
+ n = ln(this.currentTime, this.duration), t.type === "timeupdate" && h.setRange.call(this, this.elements.inputs.seek, n);
813
+ break;
814
+ case "playing":
815
+ case "progress":
816
+ (function(i, a) {
817
+ var s = r.number(a) ? a : 0, o = r.element(i) ? i : e.elements.display.buffer;
818
+ if (r.element(o)) {
819
+ o.value = s;
820
+ var l = o.getElementsByTagName("span")[0];
821
+ r.element(l) && (l.childNodes[0].nodeValue = s);
822
+ }
823
+ })(this.elements.display.buffer, 100 * this.buffered);
824
+ }
825
+ }
826
+ }, updateRangeFill: function(t) {
827
+ var e = r.event(t) ? t.target : t;
828
+ if (r.element(e) && e.getAttribute("type") === "range") {
829
+ if (Q(e, this.config.selectors.inputs.seek)) {
830
+ e.setAttribute("aria-valuenow", this.currentTime);
831
+ var n = h.formatTime(this.currentTime), i = h.formatTime(this.duration), a = L.get("seekLabel", this.config);
832
+ e.setAttribute("aria-valuetext", a.replace("{currentTime}", n).replace("{duration}", i));
833
+ } else if (Q(e, this.config.selectors.inputs.volume)) {
834
+ var s = 100 * e.value;
835
+ e.setAttribute("aria-valuenow", s), e.setAttribute("aria-valuetext", "".concat(s.toFixed(1), "%"));
836
+ } else e.setAttribute("aria-valuenow", e.value);
837
+ _.isWebkit && e.style.setProperty("--value", "".concat(e.value / e.max * 100, "%"));
838
+ }
839
+ }, updateSeekTooltip: function(t) {
840
+ var e = this;
841
+ if (this.config.tooltips.seek && r.element(this.elements.inputs.seek) && r.element(this.elements.display.seekTooltip) && this.duration !== 0) {
842
+ var n = "".concat(this.config.classNames.tooltip, "--visible"), i = function(o) {
843
+ return A(e.elements.display.seekTooltip, n, o);
844
+ };
845
+ if (this.touch) i(!1);
846
+ else {
847
+ var a = 0, s = this.elements.progress.getBoundingClientRect();
848
+ if (r.event(t)) a = 100 / s.width * (t.pageX - s.left);
849
+ else {
850
+ if (!pe(this.elements.display.seekTooltip, n)) return;
851
+ a = parseFloat(this.elements.display.seekTooltip.style.left, 10);
852
+ }
853
+ a < 0 ? a = 0 : a > 100 && (a = 100), h.updateTimeDisplay.call(this, this.elements.display.seekTooltip, this.duration / 100 * a), this.elements.display.seekTooltip.style.left = "".concat(a, "%"), r.event(t) && ["mouseenter", "mouseleave"].includes(t.type) && i(t.type === "mouseenter");
854
+ }
855
+ }
856
+ }, timeUpdate: function(t) {
857
+ var e = !r.element(this.elements.display.duration) && this.config.invertTime;
858
+ h.updateTimeDisplay.call(this, this.elements.display.currentTime, e ? this.duration - this.currentTime : this.currentTime, e), t && t.type === "timeupdate" && this.media.seeking || h.updateProgress.call(this, t);
859
+ }, durationUpdate: function() {
860
+ if (this.supported.ui && (this.config.invertTime || !this.currentTime)) {
861
+ if (this.duration >= Math.pow(2, 32)) return Y(this.elements.display.currentTime, !0), void Y(this.elements.progress, !0);
862
+ r.element(this.elements.inputs.seek) && this.elements.inputs.seek.setAttribute("aria-valuemax", this.duration);
863
+ var t = r.element(this.elements.display.duration);
864
+ !t && this.config.displayDuration && this.paused && h.updateTimeDisplay.call(this, this.elements.display.currentTime, this.duration), t && h.updateTimeDisplay.call(this, this.elements.display.duration, this.duration), h.updateSeekTooltip.call(this);
865
+ }
866
+ }, toggleMenuButton: function(t, e) {
867
+ Y(this.elements.settings.buttons[t], !e);
868
+ }, updateSetting: function(t, e, n) {
869
+ var i = this.elements.settings.panels[t], a = null, s = e;
870
+ if (t === "captions") a = this.currentTrack;
871
+ else {
872
+ if (a = r.empty(n) ? this[t] : n, r.empty(a) && (a = this.config[t].default), !r.empty(this.options[t]) && !this.options[t].includes(a)) return void this.debug.warn("Unsupported value of '".concat(a, "' for ").concat(t));
873
+ if (!this.config[t].options.includes(a)) return void this.debug.warn("Disabled value of '".concat(a, "' for ").concat(t));
874
+ }
875
+ if (r.element(s) || (s = i && i.querySelector('[role="menu"]')), r.element(s)) {
876
+ this.elements.settings.buttons[t].querySelector(".".concat(this.config.classNames.menu.value)).innerHTML = h.getLabel.call(this, t, a);
877
+ var o = s && s.querySelector('[value="'.concat(a, '"]'));
878
+ r.element(o) && (o.checked = !0);
879
+ }
880
+ }, getLabel: function(t, e) {
881
+ switch (t) {
882
+ case "speed":
883
+ return e === 1 ? L.get("normal", this.config) : "".concat(e, "&times;");
884
+ case "quality":
885
+ if (r.number(e)) {
886
+ var n = L.get("qualityLabel.".concat(e), this.config);
887
+ return n.length ? n : "".concat(e, "p");
888
+ }
889
+ return dt(e);
890
+ case "captions":
891
+ return S.getLabel.call(this);
892
+ default:
893
+ return null;
894
+ }
895
+ }, setQualityMenu: function(t) {
896
+ var e = this;
897
+ if (r.element(this.elements.settings.panels.quality)) {
898
+ var n = "quality", i = this.elements.settings.panels.quality.querySelector('[role="menu"]');
899
+ r.array(t) && (this.options.quality = Me(t).filter(function(o) {
900
+ return e.config.quality.options.includes(o);
901
+ }));
902
+ var a = !r.empty(this.options.quality) && this.options.quality.length > 1;
903
+ if (h.toggleMenuButton.call(this, n, a), ue(i), h.checkMenu.call(this), a) {
904
+ var s = function(o) {
905
+ var l = L.get("qualityBadge.".concat(o), e.config);
906
+ return l.length ? h.createBadge.call(e, l) : null;
907
+ };
908
+ this.options.quality.sort(function(o, l) {
909
+ var c = e.config.quality.options;
910
+ return c.indexOf(o) > c.indexOf(l) ? 1 : -1;
911
+ }).forEach(function(o) {
912
+ h.createMenuItem.call(e, { value: o, list: i, type: n, title: h.getLabel.call(e, "quality", o), badge: s(o) });
913
+ }), h.updateSetting.call(this, n, i);
914
+ }
915
+ }
916
+ }, setCaptionsMenu: function() {
917
+ var t = this;
918
+ if (r.element(this.elements.settings.panels.captions)) {
919
+ var e = "captions", n = this.elements.settings.panels.captions.querySelector('[role="menu"]'), i = S.getTracks.call(this), a = !!i.length;
920
+ if (h.toggleMenuButton.call(this, e, a), ue(n), h.checkMenu.call(this), a) {
921
+ var s = i.map(function(o, l) {
922
+ return { value: l, checked: t.captions.toggled && t.currentTrack === l, title: S.getLabel.call(t, o), badge: o.language && h.createBadge.call(t, o.language.toUpperCase()), list: n, type: "language" };
923
+ });
924
+ s.unshift({ value: -1, checked: !this.captions.toggled, title: L.get("disabled", this.config), list: n, type: "language" }), s.forEach(h.createMenuItem.bind(this)), h.updateSetting.call(this, e, n);
925
+ }
926
+ }
927
+ }, setSpeedMenu: function() {
928
+ var t = this;
929
+ if (r.element(this.elements.settings.panels.speed)) {
930
+ var e = "speed", n = this.elements.settings.panels.speed.querySelector('[role="menu"]');
931
+ this.options.speed = this.options.speed.filter(function(a) {
932
+ return a >= t.minimumSpeed && a <= t.maximumSpeed;
933
+ });
934
+ var i = !r.empty(this.options.speed) && this.options.speed.length > 1;
935
+ h.toggleMenuButton.call(this, e, i), ue(n), h.checkMenu.call(this), i && (this.options.speed.forEach(function(a) {
936
+ h.createMenuItem.call(t, { value: a, list: n, type: e, title: h.getLabel.call(t, "speed", a) });
937
+ }), h.updateSetting.call(this, e, n));
938
+ }
939
+ }, checkMenu: function() {
940
+ var t = this.elements.settings.buttons, e = !r.empty(t) && Object.values(t).some(function(n) {
941
+ return !n.hidden;
942
+ });
943
+ Y(this.elements.settings.menu, !e);
944
+ }, focusFirstMenuItem: function(t) {
945
+ var e = arguments.length > 1 && arguments[1] !== void 0 && arguments[1];
946
+ if (!this.elements.settings.popup.hidden) {
947
+ var n = t;
948
+ r.element(n) || (n = Object.values(this.elements.settings.panels).find(function(a) {
949
+ return !a.hidden;
950
+ }));
951
+ var i = n.querySelector('[role^="menuitem"]');
952
+ be.call(this, i, e);
953
+ }
954
+ }, toggleMenu: function(t) {
955
+ var e = this.elements.settings.popup, n = this.elements.buttons.settings;
956
+ if (r.element(e) && r.element(n)) {
957
+ var i = e.hidden, a = i;
958
+ if (r.boolean(t)) a = t;
959
+ else if (r.keyboardEvent(t) && t.which === 27) a = !1;
960
+ else if (r.event(t)) {
961
+ var s = r.function(t.composedPath) ? t.composedPath()[0] : t.target, o = e.contains(s);
962
+ if (o || !o && t.target !== n && a) return;
963
+ }
964
+ n.setAttribute("aria-expanded", a), Y(e, !a), A(this.elements.container, this.config.classNames.menu.open, a), a && r.keyboardEvent(t) ? h.focusFirstMenuItem.call(this, null, !0) : a || i || be.call(this, n, r.keyboardEvent(t));
965
+ }
966
+ }, getMenuSize: function(t) {
967
+ var e = t.cloneNode(!0);
968
+ e.style.position = "absolute", e.style.opacity = 0, e.removeAttribute("hidden"), t.parentNode.appendChild(e);
969
+ var n = e.scrollWidth, i = e.scrollHeight;
970
+ return B(e), { width: n, height: i };
971
+ }, showMenuPanel: function() {
972
+ var t = this, e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", n = arguments.length > 1 && arguments[1] !== void 0 && arguments[1], i = this.elements.container.querySelector("#plyr-settings-".concat(this.id, "-").concat(e));
973
+ if (r.element(i)) {
974
+ var a = i.parentNode, s = Array.from(a.children).find(function(c) {
975
+ return !c.hidden;
976
+ });
977
+ if (M.transitions && !M.reducedMotion) {
978
+ a.style.width = "".concat(s.scrollWidth, "px"), a.style.height = "".concat(s.scrollHeight, "px");
979
+ var o = h.getMenuSize.call(this, i), l = function c(d) {
980
+ d.target === a && ["width", "height"].includes(d.propertyName) && (a.style.width = "", a.style.height = "", fe.call(t, a, Se, c));
981
+ };
982
+ C.call(this, a, Se, l), a.style.width = "".concat(o.width, "px"), a.style.height = "".concat(o.height, "px");
983
+ }
984
+ Y(s, !0), Y(i, !1), h.focusFirstMenuItem.call(this, i, n);
985
+ }
986
+ }, setDownloadUrl: function() {
987
+ var t = this.elements.buttons.download;
988
+ r.element(t) && t.setAttribute("href", this.download);
989
+ }, create: function(t) {
990
+ var e = this, n = h.bindMenuItemShortcuts, i = h.createButton, a = h.createProgress, s = h.createRange, o = h.createTime, l = h.setQualityMenu, c = h.setSpeedMenu, d = h.showMenuPanel;
991
+ this.elements.controls = null, r.array(this.config.controls) && this.config.controls.includes("play-large") && this.elements.container.appendChild(i.call(this, "play-large"));
992
+ var p = v("div", F(this.config.selectors.controls.wrapper));
993
+ this.elements.controls = p;
994
+ var g = { class: "plyr__controls__item" };
995
+ return Me(r.array(this.config.controls) ? this.config.controls : []).forEach(function(u) {
996
+ if (u === "restart" && p.appendChild(i.call(e, "restart", g)), u === "rewind" && p.appendChild(i.call(e, "rewind", g)), u === "play" && p.appendChild(i.call(e, "play", g)), u === "fast-forward" && p.appendChild(i.call(e, "fast-forward", g)), u === "progress") {
997
+ var f = v("div", { class: "".concat(g.class, " plyr__progress__container") }), b = v("div", F(e.config.selectors.progress));
998
+ if (b.appendChild(s.call(e, "seek", { id: "plyr-seek-".concat(t.id) })), b.appendChild(a.call(e, "buffer")), e.config.tooltips.seek) {
999
+ var T = v("span", { class: e.config.classNames.tooltip }, "00:00");
1000
+ b.appendChild(T), e.elements.display.seekTooltip = T;
1001
+ }
1002
+ e.elements.progress = b, f.appendChild(e.elements.progress), p.appendChild(f);
1003
+ }
1004
+ if (u === "current-time" && p.appendChild(o.call(e, "currentTime", g)), u === "duration" && p.appendChild(o.call(e, "duration", g)), u === "mute" || u === "volume") {
1005
+ var E = e.elements.volume;
1006
+ if (r.element(E) && p.contains(E) || (E = v("div", x({}, g, { class: "".concat(g.class, " plyr__volume").trim() })), e.elements.volume = E, p.appendChild(E)), u === "mute" && E.appendChild(i.call(e, "mute")), u === "volume" && !_.isIos) {
1007
+ var w = { max: 1, step: 0.05, value: e.config.volume };
1008
+ E.appendChild(s.call(e, "volume", x(w, { id: "plyr-volume-".concat(t.id) })));
1009
+ }
1010
+ }
1011
+ if (u === "captions" && p.appendChild(i.call(e, "captions", g)), u === "settings" && !r.empty(e.config.settings)) {
1012
+ var m = v("div", x({}, g, { class: "".concat(g.class, " plyr__menu").trim(), hidden: "" }));
1013
+ m.appendChild(i.call(e, "settings", { "aria-haspopup": !0, "aria-controls": "plyr-settings-".concat(t.id), "aria-expanded": !1 }));
1014
+ var k = v("div", { class: "plyr__menu__container", id: "plyr-settings-".concat(t.id), hidden: "" }), N = v("div"), j = v("div", { id: "plyr-settings-".concat(t.id, "-home") }), U = v("div", { role: "menu" });
1015
+ j.appendChild(U), N.appendChild(j), e.elements.settings.panels.home = j, e.config.settings.forEach(function(H) {
1016
+ var K = v("button", x(F(e.config.selectors.buttons.settings), { type: "button", class: "".concat(e.config.classNames.control, " ").concat(e.config.classNames.control, "--forward"), role: "menuitem", "aria-haspopup": !0, hidden: "" }));
1017
+ n.call(e, K, H), C.call(e, K, "click", function() {
1018
+ d.call(e, H, !1);
1019
+ });
1020
+ var qe = v("span", null, L.get(H, e.config)), Fe = v("span", { class: e.config.classNames.menu.value });
1021
+ Fe.innerHTML = t[H], qe.appendChild(Fe), K.appendChild(qe), U.appendChild(K);
1022
+ var ne = v("div", { id: "plyr-settings-".concat(t.id, "-").concat(H), hidden: "" }), ce = v("button", { type: "button", class: "".concat(e.config.classNames.control, " ").concat(e.config.classNames.control, "--back") });
1023
+ ce.appendChild(v("span", { "aria-hidden": !0 }, L.get(H, e.config))), ce.appendChild(v("span", { class: e.config.classNames.hidden }, L.get("menuBack", e.config))), C.call(e, ne, "keydown", function(ve) {
1024
+ ve.which === 37 && (ve.preventDefault(), ve.stopPropagation(), d.call(e, "home", !0));
1025
+ }, !1), C.call(e, ce, "click", function() {
1026
+ d.call(e, "home", !1);
1027
+ }), ne.appendChild(ce), ne.appendChild(v("div", { role: "menu" })), N.appendChild(ne), e.elements.settings.buttons[H] = K, e.elements.settings.panels[H] = ne;
1028
+ }), k.appendChild(N), m.appendChild(k), p.appendChild(m), e.elements.settings.popup = k, e.elements.settings.menu = m;
1029
+ }
1030
+ if (u === "pip" && M.pip && p.appendChild(i.call(e, "pip", g)), u === "airplay" && M.airplay && p.appendChild(i.call(e, "airplay", g)), u === "download") {
1031
+ var q = x({}, g, { element: "a", href: e.download, target: "_blank" });
1032
+ e.isHTML5 && (q.download = "");
1033
+ var le = e.config.urls.download;
1034
+ !r.url(le) && e.isEmbed && x(q, { icon: "logo-".concat(e.provider), label: e.provider }), p.appendChild(i.call(e, "download", q));
1035
+ }
1036
+ u === "fullscreen" && p.appendChild(i.call(e, "fullscreen", g));
1037
+ }), this.isHTML5 && l.call(this, z.getQualityOptions.call(this)), c.call(this), p;
1038
+ }, inject: function() {
1039
+ var t = this;
1040
+ if (this.config.loadSprite) {
1041
+ var e = h.getIconUrl.call(this);
1042
+ e.cors && mt(e.url, "sprite-plyr");
1043
+ }
1044
+ this.id = Math.floor(1e4 * Math.random());
1045
+ var n = null;
1046
+ this.elements.controls = null;
1047
+ var i = { id: this.id, seektime: this.config.seekTime, title: this.config.title }, a = !0;
1048
+ r.function(this.config.controls) && (this.config.controls = this.config.controls.call(this, i)), this.config.controls || (this.config.controls = []), r.element(this.config.controls) || r.string(this.config.controls) ? n = this.config.controls : (n = h.create.call(this, { id: this.id, seektime: this.config.seekTime, speed: this.speed, quality: this.quality, captions: S.getLabel.call(this) }), a = !1);
1049
+ var s, o;
1050
+ if (a && r.string(this.config.controls) && (s = n, Object.entries(i).forEach(function(f) {
1051
+ var b = O(f, 2), T = b[0], E = b[1];
1052
+ s = se(s, "{".concat(T, "}"), E);
1053
+ }), n = s), r.string(this.config.selectors.controls.container) && (o = document.querySelector(this.config.selectors.controls.container)), r.element(o) || (o = this.elements.container), o[r.element(n) ? "insertAdjacentElement" : "insertAdjacentHTML"]("afterbegin", n), r.element(this.elements.controls) || h.findElements.call(this), !r.empty(this.elements.buttons)) {
1054
+ var l = function(f) {
1055
+ var b = t.config.classNames.controlPressed;
1056
+ Object.defineProperty(f, "pressed", { enumerable: !0, get: function() {
1057
+ return pe(f, b);
1058
+ }, set: function() {
1059
+ var T = arguments.length > 0 && arguments[0] !== void 0 && arguments[0];
1060
+ A(f, b, T);
1061
+ } });
1062
+ };
1063
+ Object.values(this.elements.buttons).filter(Boolean).forEach(function(f) {
1064
+ r.array(f) || r.nodeList(f) ? Array.from(f).filter(Boolean).forEach(l) : l(f);
1065
+ });
1066
+ }
1067
+ if (_.isEdge && Pe(o), this.config.tooltips.controls) {
1068
+ var c = this.config, d = c.classNames, p = c.selectors, g = "".concat(p.controls.wrapper, " ").concat(p.labels, " .").concat(d.hidden), u = G.call(this, g);
1069
+ Array.from(u).forEach(function(f) {
1070
+ A(f, t.config.classNames.hidden, !1), A(f, t.config.classNames.tooltip, !0);
1071
+ });
1072
+ }
1073
+ } };
1074
+ function gt(t) {
1075
+ var e = !(arguments.length > 1 && arguments[1] !== void 0) || arguments[1], n = t;
1076
+ if (e) {
1077
+ var i = document.createElement("a");
1078
+ i.href = n, n = i.href;
1079
+ }
1080
+ try {
1081
+ return new URL(n);
1082
+ } catch {
1083
+ return null;
1084
+ }
1085
+ }
1086
+ function ft(t) {
1087
+ var e = new URLSearchParams();
1088
+ return r.object(t) && Object.entries(t).forEach(function(n) {
1089
+ var i = O(n, 2), a = i[0], s = i[1];
1090
+ e.set(a, s);
1091
+ }), e;
1092
+ }
1093
+ var S = { setup: function() {
1094
+ if (this.supported.ui) if (!this.isVideo || this.isYouTube || this.isHTML5 && !M.textTracks) r.array(this.config.controls) && this.config.controls.includes("settings") && this.config.settings.includes("captions") && h.setCaptionsMenu.call(this);
1095
+ else {
1096
+ if (r.element(this.elements.captions) || (this.elements.captions = v("div", F(this.config.selectors.captions)), en(this.elements.captions, this.elements.wrapper)), _.isIE && window.URL) {
1097
+ var t = this.media.querySelectorAll("track");
1098
+ Array.from(t).forEach(function(s) {
1099
+ var o = s.getAttribute("src"), l = gt(o);
1100
+ l !== null && l.hostname !== window.location.href.hostname && ["http:", "https:"].includes(l.protocol) && oe(o, "blob").then(function(c) {
1101
+ s.setAttribute("src", window.URL.createObjectURL(c));
1102
+ }).catch(function() {
1103
+ B(s);
1104
+ });
1105
+ });
1106
+ }
1107
+ var e = Me((navigator.languages || [navigator.language || navigator.userLanguage || "en"]).map(function(s) {
1108
+ return s.split("-")[0];
1109
+ })), n = (this.storage.get("language") || this.config.captions.language || "auto").toLowerCase();
1110
+ n === "auto" && (n = O(e, 1)[0]);
1111
+ var i = this.storage.get("captions");
1112
+ if (r.boolean(i) || (i = this.config.captions.active), Object.assign(this.captions, { toggled: !1, active: i, language: n, languages: e }), this.isHTML5) {
1113
+ var a = this.config.captions.update ? "addtrack removetrack" : "removetrack";
1114
+ C.call(this, this.media.textTracks, a, S.update.bind(this));
1115
+ }
1116
+ setTimeout(S.update.bind(this), 0);
1117
+ }
1118
+ }, update: function() {
1119
+ var t = this, e = S.getTracks.call(this, !0), n = this.captions, i = n.active, a = n.language, s = n.meta, o = n.currentTrackNode, l = !!e.find(function(c) {
1120
+ return c.language === a;
1121
+ });
1122
+ this.isHTML5 && this.isVideo && e.filter(function(c) {
1123
+ return !s.get(c);
1124
+ }).forEach(function(c) {
1125
+ t.debug.log("Track added", c), s.set(c, { default: c.mode === "showing" }), c.mode === "showing" && (c.mode = "hidden"), C.call(t, c, "cuechange", function() {
1126
+ return S.updateCues.call(t);
1127
+ });
1128
+ }), (l && this.language !== a || !e.includes(o)) && (S.setLanguage.call(this, a), S.toggle.call(this, i && l)), A(this.elements.container, this.config.classNames.captions.enabled, !r.empty(e)), r.array(this.config.controls) && this.config.controls.includes("settings") && this.config.settings.includes("captions") && h.setCaptionsMenu.call(this);
1129
+ }, toggle: function(t) {
1130
+ var e = this, n = !(arguments.length > 1 && arguments[1] !== void 0) || arguments[1];
1131
+ if (this.supported.ui) {
1132
+ var i = this.captions.toggled, a = this.config.classNames.captions.active, s = r.nullOrUndefined(t) ? !i : t;
1133
+ if (s !== i) {
1134
+ if (n || (this.captions.active = s, this.storage.set({ captions: s })), !this.language && s && !n) {
1135
+ var o = S.getTracks.call(this), l = S.findTrack.call(this, [this.captions.language].concat(Ae(this.captions.languages)), !0);
1136
+ return this.captions.language = l.language, void S.set.call(this, o.indexOf(l));
1137
+ }
1138
+ this.elements.buttons.captions && (this.elements.buttons.captions.pressed = s), A(this.elements.container, a, s), this.captions.toggled = s, h.updateSetting.call(this, "captions"), y.call(this, this.media, s ? "captionsenabled" : "captionsdisabled");
1139
+ }
1140
+ setTimeout(function() {
1141
+ s && e.captions.toggled && (e.captions.currentTrackNode.mode = "hidden");
1142
+ });
1143
+ }
1144
+ }, set: function(t) {
1145
+ var e = !(arguments.length > 1 && arguments[1] !== void 0) || arguments[1], n = S.getTracks.call(this);
1146
+ if (t !== -1) if (r.number(t)) if (t in n) {
1147
+ if (this.captions.currentTrack !== t) {
1148
+ this.captions.currentTrack = t;
1149
+ var i = n[t], a = i || {}, s = a.language;
1150
+ this.captions.currentTrackNode = i, h.updateSetting.call(this, "captions"), e || (this.captions.language = s, this.storage.set({ language: s })), this.isVimeo && this.embed.enableTextTrack(s), y.call(this, this.media, "languagechange");
1151
+ }
1152
+ S.toggle.call(this, !0, e), this.isHTML5 && this.isVideo && S.updateCues.call(this);
1153
+ } else this.debug.warn("Track not found", t);
1154
+ else this.debug.warn("Invalid caption argument", t);
1155
+ else S.toggle.call(this, !1, e);
1156
+ }, setLanguage: function(t) {
1157
+ var e = !(arguments.length > 1 && arguments[1] !== void 0) || arguments[1];
1158
+ if (r.string(t)) {
1159
+ var n = t.toLowerCase();
1160
+ this.captions.language = n;
1161
+ var i = S.getTracks.call(this), a = S.findTrack.call(this, [n]);
1162
+ S.set.call(this, i.indexOf(a), e);
1163
+ } else this.debug.warn("Invalid language argument", t);
1164
+ }, getTracks: function() {
1165
+ var t = this, e = arguments.length > 0 && arguments[0] !== void 0 && arguments[0], n = Array.from((this.media || {}).textTracks || []);
1166
+ return n.filter(function(i) {
1167
+ return !t.isHTML5 || e || t.captions.meta.has(i);
1168
+ }).filter(function(i) {
1169
+ return ["captions", "subtitles"].includes(i.kind);
1170
+ });
1171
+ }, findTrack: function(t) {
1172
+ var e, n = this, i = arguments.length > 1 && arguments[1] !== void 0 && arguments[1], a = S.getTracks.call(this), s = function(l) {
1173
+ return Number((n.captions.meta.get(l) || {}).default);
1174
+ }, o = Array.from(a).sort(function(l, c) {
1175
+ return s(c) - s(l);
1176
+ });
1177
+ return t.every(function(l) {
1178
+ return !(e = o.find(function(c) {
1179
+ return c.language === l;
1180
+ }));
1181
+ }), e || (i ? o[0] : void 0);
1182
+ }, getCurrentTrack: function() {
1183
+ return S.getTracks.call(this)[this.currentTrack];
1184
+ }, getLabel: function(t) {
1185
+ var e = t;
1186
+ return !r.track(e) && M.textTracks && this.captions.toggled && (e = S.getCurrentTrack.call(this)), r.track(e) ? r.empty(e.label) ? r.empty(e.language) ? L.get("enabled", this.config) : t.language.toUpperCase() : e.label : L.get("disabled", this.config);
1187
+ }, updateCues: function(t) {
1188
+ if (this.supported.ui) if (r.element(this.elements.captions)) if (r.nullOrUndefined(t) || Array.isArray(t)) {
1189
+ var e = t;
1190
+ if (!e) {
1191
+ var n = S.getCurrentTrack.call(this);
1192
+ e = Array.from((n || {}).activeCues || []).map(function(s) {
1193
+ return s.getCueAsHTML();
1194
+ }).map(hn);
1195
+ }
1196
+ var i = e.map(function(s) {
1197
+ return s.trim();
1198
+ }).join(`
1199
+ `);
1200
+ if (i !== this.elements.captions.innerHTML) {
1201
+ ue(this.elements.captions);
1202
+ var a = v("span", F(this.config.selectors.caption));
1203
+ a.innerHTML = i, this.elements.captions.appendChild(a), y.call(this, this.media, "cuechange");
1204
+ }
1205
+ } else this.debug.warn("updateCues: Invalid input", t);
1206
+ else this.debug.warn("No captions element to render to");
1207
+ } }, yt = { enabled: !0, title: "", debug: !1, autoplay: !1, autopause: !0, playsinline: !0, seekTime: 10, volume: 1, muted: !1, duration: null, displayDuration: !0, invertTime: !0, toggleInvert: !0, ratio: null, clickToPlay: !0, hideControls: !0, resetOnEnd: !1, disableContextMenu: !0, loadSprite: !0, iconPrefix: "plyr", iconUrl: "https://cdn.plyr.io/3.6.3/plyr.svg", blankVideo: "https://cdn.plyr.io/static/blank.mp4", quality: { default: 576, options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240], forced: !1, onChange: null }, loop: { active: !1 }, speed: { selected: 1, options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 4] }, keyboard: { focused: !0, global: !1 }, tooltips: { controls: !1, seek: !0 }, captions: { active: !1, language: "auto", update: !1 }, fullscreen: { enabled: !0, fallback: !0, iosNative: !1 }, storage: { enabled: !0, key: "plyr" }, controls: ["play-large", "play", "progress", "current-time", "mute", "volume", "captions", "settings", "pip", "airplay", "fullscreen"], settings: ["captions", "quality", "speed"], i18n: { restart: "Restart", rewind: "Rewind {seektime}s", play: "Play", pause: "Pause", fastForward: "Forward {seektime}s", seek: "Seek", seekLabel: "{currentTime} of {duration}", played: "Played", buffered: "Buffered", currentTime: "Current time", duration: "Duration", volume: "Volume", mute: "Mute", unmute: "Unmute", enableCaptions: "Enable captions", disableCaptions: "Disable captions", download: "Download", enterFullscreen: "Enter fullscreen", exitFullscreen: "Exit fullscreen", frameTitle: "Player for {title}", captions: "Captions", settings: "Settings", pip: "PIP", menuBack: "Go back to previous menu", speed: "Speed", normal: "Normal", quality: "Quality", loop: "Loop", start: "Start", end: "End", all: "All", reset: "Reset", disabled: "Disabled", enabled: "Enabled", advertisement: "Ad", qualityBadge: { 2160: "4K", 1440: "HD", 1080: "HD", 720: "HD", 576: "SD", 480: "SD" } }, urls: { download: null, vimeo: { sdk: "https://player.vimeo.com/api/player.js", iframe: "https://player.vimeo.com/video/{0}?{1}", api: "https://vimeo.com/api/oembed.json?url={0}" }, youtube: { sdk: "https://www.youtube.com/iframe_api", api: "https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}" }, googleIMA: { sdk: "https://imasdk.googleapis.com/js/sdkloader/ima3.js" } }, listeners: { seek: null, play: null, pause: null, restart: null, rewind: null, fastForward: null, mute: null, volume: null, captions: null, download: null, fullscreen: null, pip: null, airplay: null, speed: null, quality: null, loop: null, language: null }, events: ["ended", "progress", "stalled", "playing", "waiting", "canplay", "canplaythrough", "loadstart", "loadeddata", "loadedmetadata", "timeupdate", "volumechange", "play", "pause", "error", "seeking", "seeked", "emptied", "ratechange", "cuechange", "download", "enterfullscreen", "exitfullscreen", "captionsenabled", "captionsdisabled", "languagechange", "controlshidden", "controlsshown", "ready", "statechange", "qualitychange", "adsloaded", "adscontentpause", "adscontentresume", "adstarted", "adsmidpoint", "adscomplete", "adsallcomplete", "adsimpression", "adsclick"], selectors: { editable: "input, textarea, select, [contenteditable]", container: ".plyr", controls: { container: null, wrapper: ".plyr__controls" }, labels: "[data-plyr]", buttons: { play: '[data-plyr="play"]', pause: '[data-plyr="pause"]', restart: '[data-plyr="restart"]', rewind: '[data-plyr="rewind"]', fastForward: '[data-plyr="fast-forward"]', mute: '[data-plyr="mute"]', captions: '[data-plyr="captions"]', download: '[data-plyr="download"]', fullscreen: '[data-plyr="fullscreen"]', pip: '[data-plyr="pip"]', airplay: '[data-plyr="airplay"]', settings: '[data-plyr="settings"]', loop: '[data-plyr="loop"]' }, inputs: { seek: '[data-plyr="seek"]', volume: '[data-plyr="volume"]', speed: '[data-plyr="speed"]', language: '[data-plyr="language"]', quality: '[data-plyr="quality"]' }, display: { currentTime: ".plyr__time--current", duration: ".plyr__time--duration", buffer: ".plyr__progress__buffer", loop: ".plyr__progress__loop", volume: ".plyr__volume--display" }, progress: ".plyr__progress", captions: ".plyr__captions", caption: ".plyr__caption" }, classNames: { type: "plyr--{0}", provider: "plyr--{0}", video: "plyr__video-wrapper", embed: "plyr__video-embed", videoFixedRatio: "plyr__video-wrapper--fixed-ratio", embedContainer: "plyr__video-embed__container", poster: "plyr__poster", posterEnabled: "plyr__poster-enabled", ads: "plyr__ads", control: "plyr__control", controlPressed: "plyr__control--pressed", playing: "plyr--playing", paused: "plyr--paused", stopped: "plyr--stopped", loading: "plyr--loading", hover: "plyr--hover", tooltip: "plyr__tooltip", cues: "plyr__cues", hidden: "plyr__sr-only", hideControls: "plyr--hide-controls", isIos: "plyr--is-ios", isTouch: "plyr--is-touch", uiSupported: "plyr--full-ui", noTransition: "plyr--no-transition", display: { time: "plyr__time" }, menu: { value: "plyr__menu__value", badge: "plyr__badge", open: "plyr--menu-open" }, captions: { enabled: "plyr--captions-enabled", active: "plyr--captions-active" }, fullscreen: { enabled: "plyr--fullscreen-enabled", fallback: "plyr--fullscreen-fallback" }, pip: { supported: "plyr--pip-supported", active: "plyr--pip-active" }, airplay: { supported: "plyr--airplay-supported", active: "plyr--airplay-active" }, tabFocus: "plyr__tab-focus", previewThumbnails: { thumbContainer: "plyr__preview-thumb", thumbContainerShown: "plyr__preview-thumb--is-shown", imageContainer: "plyr__preview-thumb__image-container", timeContainer: "plyr__preview-thumb__time-container", scrubbingContainer: "plyr__preview-scrubbing", scrubbingContainerShown: "plyr__preview-scrubbing--is-shown" } }, attributes: { embed: { provider: "data-plyr-provider", id: "data-plyr-embed-id" } }, ads: { enabled: !1, publisherId: "", tagUrl: "" }, previewThumbnails: { enabled: !1, src: "" }, vimeo: { byline: !1, portrait: !1, title: !1, speed: !0, transparent: !1, customControls: !0, referrerPolicy: null, premium: !1 }, youtube: { rel: 0, showinfo: 0, iv_load_policy: 3, modestbranding: 1, customControls: !0, noCookie: !1 } }, ke = { active: "picture-in-picture", inactive: "inline" }, W = { html5: "html5", youtube: "youtube", vimeo: "vimeo" }, we = { audio: "audio", video: "video" };
1208
+ function gn(t) {
1209
+ return /^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(t) ? W.youtube : /^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(t) ? W.vimeo : null;
1210
+ }
1211
+ var Te = function() {
1212
+ }, fn = function() {
1213
+ function t() {
1214
+ var e = arguments.length > 0 && arguments[0] !== void 0 && arguments[0];
1215
+ X(this, t), this.enabled = window.console && e, this.enabled && this.log("Debugging enabled");
1216
+ }
1217
+ return J(t, [{ key: "log", get: function() {
1218
+ return this.enabled ? Function.prototype.bind.call(console.log, console) : Te;
1219
+ } }, { key: "warn", get: function() {
1220
+ return this.enabled ? Function.prototype.bind.call(console.warn, console) : Te;
1221
+ } }, { key: "error", get: function() {
1222
+ return this.enabled ? Function.prototype.bind.call(console.error, console) : Te;
1223
+ } }]), t;
1224
+ }(), yn = function() {
1225
+ function t(e) {
1226
+ var n = this;
1227
+ X(this, t), this.player = e, this.prefix = t.prefix, this.property = t.property, this.scrollPosition = { x: 0, y: 0 }, this.forceFallback = e.config.fullscreen.fallback === "force", this.player.elements.fullscreen = e.config.fullscreen.container && tn(this.player.elements.container, e.config.fullscreen.container), C.call(this.player, document, this.prefix === "ms" ? "MSFullscreenChange" : "".concat(this.prefix, "fullscreenchange"), function() {
1228
+ n.onChange();
1229
+ }), C.call(this.player, this.player.elements.container, "dblclick", function(i) {
1230
+ r.element(n.player.elements.controls) && n.player.elements.controls.contains(i.target) || n.player.listeners.proxy(i, n.toggle, "fullscreen");
1231
+ }), C.call(this, this.player.elements.container, "keydown", function(i) {
1232
+ return n.trapFocus(i);
1233
+ }), this.update();
1234
+ }
1235
+ return J(t, [{ key: "onChange", value: function() {
1236
+ if (this.enabled) {
1237
+ var e = this.player.elements.buttons.fullscreen;
1238
+ r.element(e) && (e.pressed = this.active);
1239
+ var n = this.target === this.player.media ? this.target : this.player.elements.container;
1240
+ y.call(this.player, n, this.active ? "enterfullscreen" : "exitfullscreen", !0);
1241
+ }
1242
+ } }, { key: "toggleFallback", value: function() {
1243
+ var e = arguments.length > 0 && arguments[0] !== void 0 && arguments[0];
1244
+ if (e ? this.scrollPosition = { x: window.scrollX || 0, y: window.scrollY || 0 } : window.scrollTo(this.scrollPosition.x, this.scrollPosition.y), document.body.style.overflow = e ? "hidden" : "", A(this.target, this.player.config.classNames.fullscreen.fallback, e), _.isIos) {
1245
+ var n = document.head.querySelector('meta[name="viewport"]'), i = "viewport-fit=cover";
1246
+ n || (n = document.createElement("meta")).setAttribute("name", "viewport");
1247
+ var a = r.string(n.content) && n.content.includes(i);
1248
+ e ? (this.cleanupViewport = !a, a || (n.content += ",".concat(i))) : this.cleanupViewport && (n.content = n.content.split(",").filter(function(s) {
1249
+ return s.trim() !== i;
1250
+ }).join(","));
1251
+ }
1252
+ this.onChange();
1253
+ } }, { key: "trapFocus", value: function(e) {
1254
+ if (!_.isIos && this.active && e.key === "Tab" && e.keyCode === 9) {
1255
+ var n = document.activeElement, i = G.call(this.player, "a[href], button:not(:disabled), input:not(:disabled), [tabindex]"), a = O(i, 1)[0], s = i[i.length - 1];
1256
+ n !== s || e.shiftKey ? n === a && e.shiftKey && (s.focus(), e.preventDefault()) : (a.focus(), e.preventDefault());
1257
+ }
1258
+ } }, { key: "update", value: function() {
1259
+ var e;
1260
+ this.enabled ? (e = this.forceFallback ? "Fallback (forced)" : t.native ? "Native" : "Fallback", this.player.debug.log("".concat(e, " fullscreen enabled"))) : this.player.debug.log("Fullscreen not supported and fallback disabled"), A(this.player.elements.container, this.player.config.classNames.fullscreen.enabled, this.enabled);
1261
+ } }, { key: "enter", value: function() {
1262
+ this.enabled && (_.isIos && this.player.config.fullscreen.iosNative ? this.target.webkitEnterFullscreen() : !t.native || this.forceFallback ? this.toggleFallback(!0) : this.prefix ? r.empty(this.prefix) || this.target["".concat(this.prefix, "Request").concat(this.property)]() : this.target.requestFullscreen({ navigationUI: "hide" }));
1263
+ } }, { key: "exit", value: function() {
1264
+ if (this.enabled) if (_.isIos && this.player.config.fullscreen.iosNative) this.target.webkitExitFullscreen(), R(this.player.play());
1265
+ else if (!t.native || this.forceFallback) this.toggleFallback(!1);
1266
+ else if (this.prefix) {
1267
+ if (!r.empty(this.prefix)) {
1268
+ var e = this.prefix === "moz" ? "Cancel" : "Exit";
1269
+ document["".concat(this.prefix).concat(e).concat(this.property)]();
1270
+ }
1271
+ } else (document.cancelFullScreen || document.exitFullscreen).call(document);
1272
+ } }, { key: "toggle", value: function() {
1273
+ this.active ? this.exit() : this.enter();
1274
+ } }, { key: "usingNative", get: function() {
1275
+ return t.native && !this.forceFallback;
1276
+ } }, { key: "enabled", get: function() {
1277
+ return (t.native || this.player.config.fullscreen.fallback) && this.player.config.fullscreen.enabled && this.player.supported.ui && this.player.isVideo;
1278
+ } }, { key: "active", get: function() {
1279
+ if (!this.enabled) return !1;
1280
+ if (!t.native || this.forceFallback) return pe(this.target, this.player.config.classNames.fullscreen.fallback);
1281
+ var e = this.prefix ? document["".concat(this.prefix).concat(this.property, "Element")] : document.fullscreenElement;
1282
+ return e && e.shadowRoot ? e === this.target.getRootNode().host : e === this.target;
1283
+ } }, { key: "target", get: function() {
1284
+ return _.isIos && this.player.config.fullscreen.iosNative ? this.player.media : this.player.elements.fullscreen || this.player.elements.container;
1285
+ } }], [{ key: "native", get: function() {
1286
+ return !!(document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled);
1287
+ } }, { key: "prefix", get: function() {
1288
+ if (r.function(document.exitFullscreen)) return "";
1289
+ var e = "";
1290
+ return ["webkit", "moz", "ms"].some(function(n) {
1291
+ return !(!r.function(document["".concat(n, "ExitFullscreen")]) && !r.function(document["".concat(n, "CancelFullScreen")])) && (e = n, !0);
1292
+ }), e;
1293
+ } }, { key: "property", get: function() {
1294
+ return this.prefix === "moz" ? "FullScreen" : "Fullscreen";
1295
+ } }]), t;
1296
+ }();
1297
+ function de(t) {
1298
+ var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
1299
+ return new Promise(function(n, i) {
1300
+ var a = new Image(), s = function() {
1301
+ delete a.onload, delete a.onerror, (a.naturalWidth >= e ? n : i)(a);
1302
+ };
1303
+ Object.assign(a, { onload: s, onerror: s, src: t });
1304
+ });
1305
+ }
1306
+ var P = { addStyleHook: function() {
1307
+ A(this.elements.container, this.config.selectors.container.replace(".", ""), !0), A(this.elements.container, this.config.classNames.uiSupported, this.supported.ui);
1308
+ }, toggleNativeControls: function() {
1309
+ var t = arguments.length > 0 && arguments[0] !== void 0 && arguments[0];
1310
+ t && this.isHTML5 ? this.media.setAttribute("controls", "") : this.media.removeAttribute("controls");
1311
+ }, build: function() {
1312
+ var t = this;
1313
+ if (this.listeners.media(), !this.supported.ui) return this.debug.warn("Basic support only for ".concat(this.provider, " ").concat(this.type)), void P.toggleNativeControls.call(this, !0);
1314
+ r.element(this.elements.controls) || (h.inject.call(this), this.listeners.controls()), P.toggleNativeControls.call(this), this.isHTML5 && S.setup.call(this), this.volume = null, this.muted = null, this.loop = null, this.quality = null, this.speed = null, h.updateVolume.call(this), h.timeUpdate.call(this), P.checkPlaying.call(this), A(this.elements.container, this.config.classNames.pip.supported, M.pip && this.isHTML5 && this.isVideo), A(this.elements.container, this.config.classNames.airplay.supported, M.airplay && this.isHTML5), A(this.elements.container, this.config.classNames.isIos, _.isIos), A(this.elements.container, this.config.classNames.isTouch, this.touch), this.ready = !0, setTimeout(function() {
1315
+ y.call(t, t.media, "ready");
1316
+ }, 0), P.setTitle.call(this), this.poster && P.setPoster.call(this, this.poster, !1).catch(function() {
1317
+ }), this.config.duration && h.durationUpdate.call(this);
1318
+ }, setTitle: function() {
1319
+ var t = L.get("play", this.config);
1320
+ if (r.string(this.config.title) && !r.empty(this.config.title) && (t += ", ".concat(this.config.title)), Array.from(this.elements.buttons.play || []).forEach(function(a) {
1321
+ a.setAttribute("aria-label", t);
1322
+ }), this.isEmbed) {
1323
+ var e = I.call(this, "iframe");
1324
+ if (!r.element(e)) return;
1325
+ var n = r.empty(this.config.title) ? "video" : this.config.title, i = L.get("frameTitle", this.config);
1326
+ e.setAttribute("title", i.replace("{title}", n));
1327
+ }
1328
+ }, togglePoster: function(t) {
1329
+ A(this.elements.container, this.config.classNames.posterEnabled, t);
1330
+ }, setPoster: function(t) {
1331
+ var e = this, n = !(arguments.length > 1 && arguments[1] !== void 0) || arguments[1];
1332
+ return n && this.poster ? Promise.reject(new Error("Poster already set")) : (this.media.setAttribute("data-poster", t), this.elements.poster.removeAttribute("hidden"), sn.call(this).then(function() {
1333
+ return de(t);
1334
+ }).catch(function(i) {
1335
+ throw t === e.poster && P.togglePoster.call(e, !1), i;
1336
+ }).then(function() {
1337
+ if (t !== e.poster) throw new Error("setPoster cancelled by later call to setPoster");
1338
+ }).then(function() {
1339
+ return Object.assign(e.elements.poster.style, { backgroundImage: "url('".concat(t, "')"), backgroundSize: "" }), P.togglePoster.call(e, !0), t;
1340
+ }));
1341
+ }, checkPlaying: function(t) {
1342
+ var e = this;
1343
+ A(this.elements.container, this.config.classNames.playing, this.playing), A(this.elements.container, this.config.classNames.paused, this.paused), A(this.elements.container, this.config.classNames.stopped, this.stopped), Array.from(this.elements.buttons.play || []).forEach(function(n) {
1344
+ Object.assign(n, { pressed: e.playing }), n.setAttribute("aria-label", L.get(e.playing ? "pause" : "play", e.config));
1345
+ }), r.event(t) && t.type === "timeupdate" || P.toggleControls.call(this);
1346
+ }, checkLoading: function(t) {
1347
+ var e = this;
1348
+ this.loading = ["stalled", "waiting"].includes(t.type), clearTimeout(this.timers.loading), this.timers.loading = setTimeout(function() {
1349
+ A(e.elements.container, e.config.classNames.loading, e.loading), P.toggleControls.call(e);
1350
+ }, this.loading ? 250 : 0);
1351
+ }, toggleControls: function(t) {
1352
+ var e = this.elements.controls;
1353
+ if (e && this.config.hideControls) {
1354
+ var n = this.touch && this.lastSeekTime + 2e3 > Date.now();
1355
+ this.toggleControls(!!(t || this.loading || this.paused || e.pressed || e.hover || n));
1356
+ }
1357
+ }, migrateStyles: function() {
1358
+ var t = this;
1359
+ Object.values(ee({}, this.media.style)).filter(function(e) {
1360
+ return !r.empty(e) && r.string(e) && e.startsWith("--plyr");
1361
+ }).forEach(function(e) {
1362
+ t.elements.container.style.setProperty(e, t.media.style.getPropertyValue(e)), t.media.style.removeProperty(e);
1363
+ }), r.empty(this.media.style) && this.media.removeAttribute("style");
1364
+ } }, vn = function() {
1365
+ function t(e) {
1366
+ X(this, t), this.player = e, this.lastKey = null, this.focusTimer = null, this.lastKeyDown = null, this.handleKey = this.handleKey.bind(this), this.toggleMenu = this.toggleMenu.bind(this), this.setTabFocus = this.setTabFocus.bind(this), this.firstTouch = this.firstTouch.bind(this);
1367
+ }
1368
+ return J(t, [{ key: "handleKey", value: function(e) {
1369
+ var n = this.player, i = n.elements, a = e.keyCode ? e.keyCode : e.which, s = e.type === "keydown", o = s && a === this.lastKey;
1370
+ if (!(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) && r.number(a))
1371
+ if (s) {
1372
+ var l = document.activeElement;
1373
+ if (r.element(l)) {
1374
+ var c = n.config.selectors.editable;
1375
+ if (l !== i.inputs.seek && Q(l, c) || e.which === 32 && Q(l, 'button, [role^="menuitem"]')) return;
1376
+ }
1377
+ switch ([32, 37, 38, 39, 40, 48, 49, 50, 51, 52, 53, 54, 56, 57, 67, 70, 73, 75, 76, 77, 79].includes(a) && (e.preventDefault(), e.stopPropagation()), a) {
1378
+ case 48:
1379
+ case 49:
1380
+ case 50:
1381
+ case 51:
1382
+ case 52:
1383
+ case 53:
1384
+ case 54:
1385
+ case 55:
1386
+ case 56:
1387
+ case 57:
1388
+ o || (n.currentTime = n.duration / 10 * (a - 48));
1389
+ break;
1390
+ case 32:
1391
+ case 75:
1392
+ o || R(n.togglePlay());
1393
+ break;
1394
+ case 38:
1395
+ n.increaseVolume(0.1);
1396
+ break;
1397
+ case 40:
1398
+ n.decreaseVolume(0.1);
1399
+ break;
1400
+ case 77:
1401
+ o || (n.muted = !n.muted);
1402
+ break;
1403
+ case 39:
1404
+ n.forward();
1405
+ break;
1406
+ case 37:
1407
+ n.rewind();
1408
+ break;
1409
+ case 70:
1410
+ n.fullscreen.toggle();
1411
+ break;
1412
+ case 67:
1413
+ o || n.toggleCaptions();
1414
+ break;
1415
+ case 76:
1416
+ n.loop = !n.loop;
1417
+ }
1418
+ a === 27 && !n.fullscreen.usingNative && n.fullscreen.active && n.fullscreen.toggle(), this.lastKey = a;
1419
+ } else this.lastKey = null;
1420
+ } }, { key: "toggleMenu", value: function(e) {
1421
+ h.toggleMenu.call(this.player, e);
1422
+ } }, { key: "firstTouch", value: function() {
1423
+ var e = this.player, n = e.elements;
1424
+ e.touch = !0, A(n.container, e.config.classNames.isTouch, !0);
1425
+ } }, { key: "setTabFocus", value: function(e) {
1426
+ var n = this.player, i = n.elements;
1427
+ if (clearTimeout(this.focusTimer), e.type !== "keydown" || e.which === 9) {
1428
+ e.type === "keydown" && (this.lastKeyDown = e.timeStamp);
1429
+ var a, s = e.timeStamp - this.lastKeyDown <= 20;
1430
+ (e.type !== "focus" || s) && (a = n.config.classNames.tabFocus, A(G.call(n, ".".concat(a)), a, !1), e.type !== "focusout" && (this.focusTimer = setTimeout(function() {
1431
+ var o = document.activeElement;
1432
+ i.container.contains(o) && A(document.activeElement, n.config.classNames.tabFocus, !0);
1433
+ }, 10)));
1434
+ }
1435
+ } }, { key: "global", value: function() {
1436
+ var e = !(arguments.length > 0 && arguments[0] !== void 0) || arguments[0], n = this.player;
1437
+ n.config.keyboard.global && Z.call(n, window, "keydown keyup", this.handleKey, e, !1), Z.call(n, document.body, "click", this.toggleMenu, e), je.call(n, document.body, "touchstart", this.firstTouch), Z.call(n, document.body, "keydown focus blur focusout", this.setTabFocus, e, !1, !0);
1438
+ } }, { key: "container", value: function() {
1439
+ var e = this.player, n = e.config, i = e.elements, a = e.timers;
1440
+ !n.keyboard.global && n.keyboard.focused && C.call(e, i.container, "keydown keyup", this.handleKey, !1), C.call(e, i.container, "mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen", function(l) {
1441
+ var c = i.controls;
1442
+ c && l.type === "enterfullscreen" && (c.pressed = !1, c.hover = !1);
1443
+ var d = 0;
1444
+ ["touchstart", "touchmove", "mousemove"].includes(l.type) && (P.toggleControls.call(e, !0), d = e.touch ? 3e3 : 2e3), clearTimeout(a.controls), a.controls = setTimeout(function() {
1445
+ return P.toggleControls.call(e, !1);
1446
+ }, d);
1447
+ });
1448
+ var s = function(l) {
1449
+ if (!l) return $.call(e);
1450
+ var c = i.container.getBoundingClientRect(), d = c.width, p = c.height;
1451
+ return $.call(e, "".concat(d, ":").concat(p));
1452
+ }, o = function() {
1453
+ clearTimeout(a.resized), a.resized = setTimeout(s, 50);
1454
+ };
1455
+ C.call(e, i.container, "enterfullscreen exitfullscreen", function(l) {
1456
+ var c = e.fullscreen, d = c.target, p = c.usingNative;
1457
+ if (d === i.container && (e.isEmbed || !r.empty(e.config.ratio))) {
1458
+ var g = l.type === "enterfullscreen", u = s(g);
1459
+ u.padding, function(f, b, T) {
1460
+ if (e.isVimeo && !e.config.vimeo.premium) {
1461
+ var E = e.elements.wrapper.firstChild, w = O(f, 2)[1], m = O(De.call(e), 2), k = m[0], N = m[1];
1462
+ E.style.maxWidth = T ? "".concat(w / N * k, "px") : null, E.style.margin = T ? "0 auto" : null;
1463
+ }
1464
+ }(u.ratio, 0, g), g && setTimeout(function() {
1465
+ return Pe(i.container);
1466
+ }, 100), p || (g ? C.call(e, window, "resize", o) : fe.call(e, window, "resize", o));
1467
+ }
1468
+ });
1469
+ } }, { key: "media", value: function() {
1470
+ var e = this, n = this.player, i = n.elements;
1471
+ if (C.call(n, n.media, "timeupdate seeking seeked", function(o) {
1472
+ return h.timeUpdate.call(n, o);
1473
+ }), C.call(n, n.media, "durationchange loadeddata loadedmetadata", function(o) {
1474
+ return h.durationUpdate.call(n, o);
1475
+ }), C.call(n, n.media, "ended", function() {
1476
+ n.isHTML5 && n.isVideo && n.config.resetOnEnd && (n.restart(), n.pause());
1477
+ }), C.call(n, n.media, "progress playing seeking seeked", function(o) {
1478
+ return h.updateProgress.call(n, o);
1479
+ }), C.call(n, n.media, "volumechange", function(o) {
1480
+ return h.updateVolume.call(n, o);
1481
+ }), C.call(n, n.media, "playing play pause ended emptied timeupdate", function(o) {
1482
+ return P.checkPlaying.call(n, o);
1483
+ }), C.call(n, n.media, "waiting canplay seeked playing", function(o) {
1484
+ return P.checkLoading.call(n, o);
1485
+ }), n.supported.ui && n.config.clickToPlay && !n.isAudio) {
1486
+ var a = I.call(n, ".".concat(n.config.classNames.video));
1487
+ if (!r.element(a)) return;
1488
+ C.call(n, i.container, "click", function(o) {
1489
+ ([i.container, a].includes(o.target) || a.contains(o.target)) && (n.touch && n.config.hideControls || (n.ended ? (e.proxy(o, n.restart, "restart"), e.proxy(o, function() {
1490
+ R(n.play());
1491
+ }, "play")) : e.proxy(o, function() {
1492
+ R(n.togglePlay());
1493
+ }, "play")));
1494
+ });
1495
+ }
1496
+ n.supported.ui && n.config.disableContextMenu && C.call(n, i.wrapper, "contextmenu", function(o) {
1497
+ o.preventDefault();
1498
+ }, !1), C.call(n, n.media, "volumechange", function() {
1499
+ n.storage.set({ volume: n.volume, muted: n.muted });
1500
+ }), C.call(n, n.media, "ratechange", function() {
1501
+ h.updateSetting.call(n, "speed"), n.storage.set({ speed: n.speed });
1502
+ }), C.call(n, n.media, "qualitychange", function(o) {
1503
+ h.updateSetting.call(n, "quality", null, o.detail.quality);
1504
+ }), C.call(n, n.media, "ready qualitychange", function() {
1505
+ h.setDownloadUrl.call(n);
1506
+ });
1507
+ var s = n.config.events.concat(["keyup", "keydown"]).join(" ");
1508
+ C.call(n, n.media, s, function(o) {
1509
+ var l = o.detail, c = l === void 0 ? {} : l;
1510
+ o.type === "error" && (c = n.media.error), y.call(n, i.container, o.type, !0, c);
1511
+ });
1512
+ } }, { key: "proxy", value: function(e, n, i) {
1513
+ var a = this.player, s = a.config.listeners[i], o = !0;
1514
+ r.function(s) && (o = s.call(a, e)), o !== !1 && r.function(n) && n.call(a, e);
1515
+ } }, { key: "bind", value: function(e, n, i, a) {
1516
+ var s = this, o = !(arguments.length > 4 && arguments[4] !== void 0) || arguments[4], l = this.player, c = l.config.listeners[a], d = r.function(c);
1517
+ C.call(l, e, n, function(p) {
1518
+ return s.proxy(p, i, a);
1519
+ }, o && !d);
1520
+ } }, { key: "controls", value: function() {
1521
+ var e = this, n = this.player, i = n.elements, a = _.isIE ? "change" : "input";
1522
+ if (i.buttons.play && Array.from(i.buttons.play).forEach(function(o) {
1523
+ e.bind(o, "click", function() {
1524
+ R(n.togglePlay());
1525
+ }, "play");
1526
+ }), this.bind(i.buttons.restart, "click", n.restart, "restart"), this.bind(i.buttons.rewind, "click", function() {
1527
+ n.lastSeekTime = Date.now(), n.rewind();
1528
+ }, "rewind"), this.bind(i.buttons.fastForward, "click", function() {
1529
+ n.lastSeekTime = Date.now(), n.forward();
1530
+ }, "fastForward"), this.bind(i.buttons.mute, "click", function() {
1531
+ n.muted = !n.muted;
1532
+ }, "mute"), this.bind(i.buttons.captions, "click", function() {
1533
+ return n.toggleCaptions();
1534
+ }), this.bind(i.buttons.download, "click", function() {
1535
+ y.call(n, n.media, "download");
1536
+ }, "download"), this.bind(i.buttons.fullscreen, "click", function() {
1537
+ n.fullscreen.toggle();
1538
+ }, "fullscreen"), this.bind(i.buttons.pip, "click", function() {
1539
+ n.pip = "toggle";
1540
+ }, "pip"), this.bind(i.buttons.airplay, "click", n.airplay, "airplay"), this.bind(i.buttons.settings, "click", function(o) {
1541
+ o.stopPropagation(), o.preventDefault(), h.toggleMenu.call(n, o);
1542
+ }, null, !1), this.bind(i.buttons.settings, "keyup", function(o) {
1543
+ var l = o.which;
1544
+ [13, 32].includes(l) && (l !== 13 ? (o.preventDefault(), o.stopPropagation(), h.toggleMenu.call(n, o)) : h.focusFirstMenuItem.call(n, null, !0));
1545
+ }, null, !1), this.bind(i.settings.menu, "keydown", function(o) {
1546
+ o.which === 27 && h.toggleMenu.call(n, o);
1547
+ }), this.bind(i.inputs.seek, "mousedown mousemove", function(o) {
1548
+ var l = i.progress.getBoundingClientRect(), c = 100 / l.width * (o.pageX - l.left);
1549
+ o.currentTarget.setAttribute("seek-value", c);
1550
+ }), this.bind(i.inputs.seek, "mousedown mouseup keydown keyup touchstart touchend", function(o) {
1551
+ var l = o.currentTarget, c = o.keyCode ? o.keyCode : o.which, d = "play-on-seeked";
1552
+ if (!r.keyboardEvent(o) || c === 39 || c === 37) {
1553
+ n.lastSeekTime = Date.now();
1554
+ var p = l.hasAttribute(d), g = ["mouseup", "touchend", "keyup"].includes(o.type);
1555
+ p && g ? (l.removeAttribute(d), R(n.play())) : !g && n.playing && (l.setAttribute(d, ""), n.pause());
1556
+ }
1557
+ }), _.isIos) {
1558
+ var s = G.call(n, 'input[type="range"]');
1559
+ Array.from(s).forEach(function(o) {
1560
+ return e.bind(o, a, function(l) {
1561
+ return Pe(l.target);
1562
+ });
1563
+ });
1564
+ }
1565
+ this.bind(i.inputs.seek, a, function(o) {
1566
+ var l = o.currentTarget, c = l.getAttribute("seek-value");
1567
+ r.empty(c) && (c = l.value), l.removeAttribute("seek-value"), n.currentTime = c / l.max * n.duration;
1568
+ }, "seek"), this.bind(i.progress, "mouseenter mouseleave mousemove", function(o) {
1569
+ return h.updateSeekTooltip.call(n, o);
1570
+ }), this.bind(i.progress, "mousemove touchmove", function(o) {
1571
+ var l = n.previewThumbnails;
1572
+ l && l.loaded && l.startMove(o);
1573
+ }), this.bind(i.progress, "mouseleave touchend click", function() {
1574
+ var o = n.previewThumbnails;
1575
+ o && o.loaded && o.endMove(!1, !0);
1576
+ }), this.bind(i.progress, "mousedown touchstart", function(o) {
1577
+ var l = n.previewThumbnails;
1578
+ l && l.loaded && l.startScrubbing(o);
1579
+ }), this.bind(i.progress, "mouseup touchend", function(o) {
1580
+ var l = n.previewThumbnails;
1581
+ l && l.loaded && l.endScrubbing(o);
1582
+ }), _.isWebkit && Array.from(G.call(n, 'input[type="range"]')).forEach(function(o) {
1583
+ e.bind(o, "input", function(l) {
1584
+ return h.updateRangeFill.call(n, l.target);
1585
+ });
1586
+ }), n.config.toggleInvert && !r.element(i.display.duration) && this.bind(i.display.currentTime, "click", function() {
1587
+ n.currentTime !== 0 && (n.config.invertTime = !n.config.invertTime, h.timeUpdate.call(n));
1588
+ }), this.bind(i.inputs.volume, a, function(o) {
1589
+ n.volume = o.target.value;
1590
+ }, "volume"), this.bind(i.controls, "mouseenter mouseleave", function(o) {
1591
+ i.controls.hover = !n.touch && o.type === "mouseenter";
1592
+ }), i.fullscreen && Array.from(i.fullscreen.children).filter(function(o) {
1593
+ return !o.contains(i.container);
1594
+ }).forEach(function(o) {
1595
+ e.bind(o, "mouseenter mouseleave", function(l) {
1596
+ i.controls.hover = !n.touch && l.type === "mouseenter";
1597
+ });
1598
+ }), this.bind(i.controls, "mousedown mouseup touchstart touchend touchcancel", function(o) {
1599
+ i.controls.pressed = ["mousedown", "touchstart"].includes(o.type);
1600
+ }), this.bind(i.controls, "focusin", function() {
1601
+ var o = n.config, l = n.timers;
1602
+ A(i.controls, o.classNames.noTransition, !0), P.toggleControls.call(n, !0), setTimeout(function() {
1603
+ A(i.controls, o.classNames.noTransition, !1);
1604
+ }, 0);
1605
+ var c = e.touch ? 3e3 : 4e3;
1606
+ clearTimeout(l.controls), l.controls = setTimeout(function() {
1607
+ return P.toggleControls.call(n, !1);
1608
+ }, c);
1609
+ }), this.bind(i.inputs.volume, "wheel", function(o) {
1610
+ var l = o.webkitDirectionInvertedFromDevice, c = O([o.deltaX, -o.deltaY].map(function(f) {
1611
+ return l ? -f : f;
1612
+ }), 2), d = c[0], p = c[1], g = Math.sign(Math.abs(d) > Math.abs(p) ? d : p);
1613
+ n.increaseVolume(g / 50);
1614
+ var u = n.media.volume;
1615
+ (g === 1 && u < 1 || g === -1 && u > 0) && o.preventDefault();
1616
+ }, "volume", !1);
1617
+ } }]), t;
1618
+ }();
1619
+ function bn(t, e) {
1620
+ return t(e = { exports: {} }, e.exports), e.exports;
1621
+ }
1622
+ var kn = bn(function(t, e) {
1623
+ t.exports = function() {
1624
+ var n = function() {
1625
+ }, i = {}, a = {}, s = {};
1626
+ function o(u, f) {
1627
+ u = u.push ? u : [u];
1628
+ var b, T, E, w = [], m = u.length, k = m;
1629
+ for (b = function(N, j) {
1630
+ j.length && w.push(N), --k || f(w);
1631
+ }; m--; ) T = u[m], (E = a[T]) ? b(T, E) : (s[T] = s[T] || []).push(b);
1632
+ }
1633
+ function l(u, f) {
1634
+ if (u) {
1635
+ var b = s[u];
1636
+ if (a[u] = f, b) for (; b.length; ) b[0](u, f), b.splice(0, 1);
1637
+ }
1638
+ }
1639
+ function c(u, f) {
1640
+ u.call && (u = { success: u }), f.length ? (u.error || n)(f) : (u.success || n)(u);
1641
+ }
1642
+ function d(u, f, b, T) {
1643
+ var E, w, m = document, k = b.async, N = (b.numRetries || 0) + 1, j = b.before || n, U = u.replace(/[\?|#].*$/, ""), q = u.replace(/^(css|img)!/, "");
1644
+ T = T || 0, /(^css!|\.css$)/.test(U) ? ((w = m.createElement("link")).rel = "stylesheet", w.href = q, (E = "hideFocus" in w) && w.relList && (E = 0, w.rel = "preload", w.as = "style")) : /(^img!|\.(png|gif|jpg|svg|webp)$)/.test(U) ? (w = m.createElement("img")).src = q : ((w = m.createElement("script")).src = u, w.async = k === void 0 || k), w.onload = w.onerror = w.onbeforeload = function(le) {
1645
+ var H = le.type[0];
1646
+ if (E) try {
1647
+ w.sheet.cssText.length || (H = "e");
1648
+ } catch (K) {
1649
+ K.code != 18 && (H = "e");
1650
+ }
1651
+ if (H == "e") {
1652
+ if ((T += 1) < N) return d(u, f, b, T);
1653
+ } else if (w.rel == "preload" && w.as == "style") return w.rel = "stylesheet";
1654
+ f(u, H, le.defaultPrevented);
1655
+ }, j(u, w) !== !1 && m.head.appendChild(w);
1656
+ }
1657
+ function p(u, f, b) {
1658
+ var T, E, w = (u = u.push ? u : [u]).length, m = w, k = [];
1659
+ for (T = function(N, j, U) {
1660
+ if (j == "e" && k.push(N), j == "b") {
1661
+ if (!U) return;
1662
+ k.push(N);
1663
+ }
1664
+ --w || f(k);
1665
+ }, E = 0; E < m; E++) d(u[E], T, b);
1666
+ }
1667
+ function g(u, f, b) {
1668
+ var T, E;
1669
+ if (f && f.trim && (T = f), E = (T ? b : f) || {}, T) {
1670
+ if (T in i) throw "LoadJS";
1671
+ i[T] = !0;
1672
+ }
1673
+ function w(m, k) {
1674
+ p(u, function(N) {
1675
+ c(E, N), m && c({ success: m, error: k }, N), l(T, N);
1676
+ }, E);
1677
+ }
1678
+ if (E.returnPromise) return new Promise(w);
1679
+ w();
1680
+ }
1681
+ return g.ready = function(u, f) {
1682
+ return o(u, function(b) {
1683
+ c(f, b);
1684
+ }), g;
1685
+ }, g.done = function(u) {
1686
+ l(u, []);
1687
+ }, g.reset = function() {
1688
+ i = {}, a = {}, s = {};
1689
+ }, g.isDefined = function(u) {
1690
+ return u in i;
1691
+ }, g;
1692
+ }();
1693
+ });
1694
+ function He(t) {
1695
+ return new Promise(function(e, n) {
1696
+ kn(t, { success: e, error: n });
1697
+ });
1698
+ }
1699
+ function wn(t) {
1700
+ return r.empty(t) ? null : r.number(Number(t)) ? t : t.match(/^.*(vimeo.com\/|video\/)(\d+).*/) ? RegExp.$2 : t;
1701
+ }
1702
+ function ie(t) {
1703
+ t && !this.embed.hasPlayed && (this.embed.hasPlayed = !0), this.media.paused === t && (this.media.paused = !t, y.call(this, this.media, t ? "play" : "pause"));
1704
+ }
1705
+ var Ie = { setup: function() {
1706
+ var t = this;
1707
+ A(t.elements.wrapper, t.config.classNames.embed, !0), t.options.speed = t.config.speed.options, $.call(t), r.object(window.Vimeo) ? Ie.ready.call(t) : He(t.config.urls.vimeo.sdk).then(function() {
1708
+ Ie.ready.call(t);
1709
+ }).catch(function(e) {
1710
+ t.debug.warn("Vimeo SDK (player.js) failed to load", e);
1711
+ });
1712
+ }, ready: function() {
1713
+ var t = this, e = this, n = e.config.vimeo, i = n.premium, a = n.referrerPolicy, s = wt(n, ["premium", "referrerPolicy"]);
1714
+ i && Object.assign(s, { controls: !1, sidedock: !1 });
1715
+ var o = ft(ee({ loop: e.config.loop.active, autoplay: e.autoplay, muted: e.muted, gesture: "media", playsinline: !this.config.fullscreen.iosNative }, s)), l = e.media.getAttribute("src");
1716
+ r.empty(l) && (l = e.media.getAttribute(e.config.attributes.embed.id));
1717
+ var c = wn(l), d = v("iframe"), p = xe(e.config.urls.vimeo.iframe, c, o);
1718
+ if (d.setAttribute("src", p), d.setAttribute("allowfullscreen", ""), d.setAttribute("allow", "autoplay,fullscreen,picture-in-picture"), r.empty(a) || d.setAttribute("referrerPolicy", a), i || !n.customControls) d.setAttribute("data-poster", e.poster), e.media = me(d, e.media);
1719
+ else {
1720
+ var g = v("div", { class: e.config.classNames.embedContainer, "data-poster": e.poster });
1721
+ g.appendChild(d), e.media = me(g, e.media);
1722
+ }
1723
+ n.customControls || oe(xe(e.config.urls.vimeo.api, p)).then(function(m) {
1724
+ !r.empty(m) && m.thumbnail_url && P.setPoster.call(e, m.thumbnail_url).catch(function() {
1725
+ });
1726
+ }), e.embed = new window.Vimeo.Player(d, { autopause: e.config.autopause, muted: e.muted }), e.media.paused = !0, e.media.currentTime = 0, e.supported.ui && e.embed.disableTextTrack(), e.media.play = function() {
1727
+ return ie.call(e, !0), e.embed.play();
1728
+ }, e.media.pause = function() {
1729
+ return ie.call(e, !1), e.embed.pause();
1730
+ }, e.media.stop = function() {
1731
+ e.pause(), e.currentTime = 0;
1732
+ };
1733
+ var u = e.media.currentTime;
1734
+ Object.defineProperty(e.media, "currentTime", { get: function() {
1735
+ return u;
1736
+ }, set: function(m) {
1737
+ var k = e.embed, N = e.media, j = e.paused, U = e.volume, q = j && !k.hasPlayed;
1738
+ N.seeking = !0, y.call(e, N, "seeking"), Promise.resolve(q && k.setVolume(0)).then(function() {
1739
+ return k.setCurrentTime(m);
1740
+ }).then(function() {
1741
+ return q && k.pause();
1742
+ }).then(function() {
1743
+ return q && k.setVolume(U);
1744
+ }).catch(function() {
1745
+ });
1746
+ } });
1747
+ var f = e.config.speed.selected;
1748
+ Object.defineProperty(e.media, "playbackRate", { get: function() {
1749
+ return f;
1750
+ }, set: function(m) {
1751
+ e.embed.setPlaybackRate(m).then(function() {
1752
+ f = m, y.call(e, e.media, "ratechange");
1753
+ }).catch(function() {
1754
+ e.options.speed = [1];
1755
+ });
1756
+ } });
1757
+ var b = e.config.volume;
1758
+ Object.defineProperty(e.media, "volume", { get: function() {
1759
+ return b;
1760
+ }, set: function(m) {
1761
+ e.embed.setVolume(m).then(function() {
1762
+ b = m, y.call(e, e.media, "volumechange");
1763
+ });
1764
+ } });
1765
+ var T = e.config.muted;
1766
+ Object.defineProperty(e.media, "muted", { get: function() {
1767
+ return T;
1768
+ }, set: function(m) {
1769
+ var k = !!r.boolean(m) && m;
1770
+ e.embed.setVolume(k ? 0 : e.config.volume).then(function() {
1771
+ T = k, y.call(e, e.media, "volumechange");
1772
+ });
1773
+ } });
1774
+ var E, w = e.config.loop;
1775
+ Object.defineProperty(e.media, "loop", { get: function() {
1776
+ return w;
1777
+ }, set: function(m) {
1778
+ var k = r.boolean(m) ? m : e.config.loop.active;
1779
+ e.embed.setLoop(k).then(function() {
1780
+ w = k;
1781
+ });
1782
+ } }), e.embed.getVideoUrl().then(function(m) {
1783
+ E = m, h.setDownloadUrl.call(e);
1784
+ }).catch(function(m) {
1785
+ t.debug.warn(m);
1786
+ }), Object.defineProperty(e.media, "currentSrc", { get: function() {
1787
+ return E;
1788
+ } }), Object.defineProperty(e.media, "ended", { get: function() {
1789
+ return e.currentTime === e.duration;
1790
+ } }), Promise.all([e.embed.getVideoWidth(), e.embed.getVideoHeight()]).then(function(m) {
1791
+ var k = O(m, 2), N = k[0], j = k[1];
1792
+ e.embed.ratio = [N, j], $.call(t);
1793
+ }), e.embed.setAutopause(e.config.autopause).then(function(m) {
1794
+ e.config.autopause = m;
1795
+ }), e.embed.getVideoTitle().then(function(m) {
1796
+ e.config.title = m, P.setTitle.call(t);
1797
+ }), e.embed.getCurrentTime().then(function(m) {
1798
+ u = m, y.call(e, e.media, "timeupdate");
1799
+ }), e.embed.getDuration().then(function(m) {
1800
+ e.media.duration = m, y.call(e, e.media, "durationchange");
1801
+ }), e.embed.getTextTracks().then(function(m) {
1802
+ e.media.textTracks = m, S.setup.call(e);
1803
+ }), e.embed.on("cuechange", function(m) {
1804
+ var k = m.cues, N = (k === void 0 ? [] : k).map(function(j) {
1805
+ return dn(j.text);
1806
+ });
1807
+ S.updateCues.call(e, N);
1808
+ }), e.embed.on("loaded", function() {
1809
+ e.embed.getPaused().then(function(m) {
1810
+ ie.call(e, !m), m || y.call(e, e.media, "playing");
1811
+ }), r.element(e.embed.element) && e.supported.ui && e.embed.element.setAttribute("tabindex", -1);
1812
+ }), e.embed.on("bufferstart", function() {
1813
+ y.call(e, e.media, "waiting");
1814
+ }), e.embed.on("bufferend", function() {
1815
+ y.call(e, e.media, "playing");
1816
+ }), e.embed.on("play", function() {
1817
+ ie.call(e, !0), y.call(e, e.media, "playing");
1818
+ }), e.embed.on("pause", function() {
1819
+ ie.call(e, !1);
1820
+ }), e.embed.on("timeupdate", function(m) {
1821
+ e.media.seeking = !1, u = m.seconds, y.call(e, e.media, "timeupdate");
1822
+ }), e.embed.on("progress", function(m) {
1823
+ e.media.buffered = m.percent, y.call(e, e.media, "progress"), parseInt(m.percent, 10) === 1 && y.call(e, e.media, "canplaythrough"), e.embed.getDuration().then(function(k) {
1824
+ k !== e.media.duration && (e.media.duration = k, y.call(e, e.media, "durationchange"));
1825
+ });
1826
+ }), e.embed.on("seeked", function() {
1827
+ e.media.seeking = !1, y.call(e, e.media, "seeked");
1828
+ }), e.embed.on("ended", function() {
1829
+ e.media.paused = !0, y.call(e, e.media, "ended");
1830
+ }), e.embed.on("error", function(m) {
1831
+ e.media.error = m, y.call(e, e.media, "error");
1832
+ }), n.customControls && setTimeout(function() {
1833
+ return P.build.call(e);
1834
+ }, 0);
1835
+ } };
1836
+ function Tn(t) {
1837
+ return r.empty(t) ? null : t.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/) ? RegExp.$2 : t;
1838
+ }
1839
+ function ae(t) {
1840
+ t && !this.embed.hasPlayed && (this.embed.hasPlayed = !0), this.media.paused === t && (this.media.paused = !t, y.call(this, this.media, t ? "play" : "pause"));
1841
+ }
1842
+ function Cn(t) {
1843
+ return t.noCookie ? "https://www.youtube-nocookie.com" : window.location.protocol === "http:" ? "http://www.youtube.com" : void 0;
1844
+ }
1845
+ var he = { setup: function() {
1846
+ var t = this;
1847
+ if (A(this.elements.wrapper, this.config.classNames.embed, !0), r.object(window.YT) && r.function(window.YT.Player)) he.ready.call(this);
1848
+ else {
1849
+ var e = window.onYouTubeIframeAPIReady;
1850
+ window.onYouTubeIframeAPIReady = function() {
1851
+ r.function(e) && e(), he.ready.call(t);
1852
+ }, He(this.config.urls.youtube.sdk).catch(function(n) {
1853
+ t.debug.warn("YouTube API failed to load", n);
1854
+ });
1855
+ }
1856
+ }, getTitle: function(t) {
1857
+ var e = this;
1858
+ oe(xe(this.config.urls.youtube.api, t)).then(function(n) {
1859
+ if (r.object(n)) {
1860
+ var i = n.title, a = n.height, s = n.width;
1861
+ e.config.title = i, P.setTitle.call(e), e.embed.ratio = [s, a];
1862
+ }
1863
+ $.call(e);
1864
+ }).catch(function() {
1865
+ $.call(e);
1866
+ });
1867
+ }, ready: function() {
1868
+ var t = this, e = t.config.youtube, n = t.media && t.media.getAttribute("id");
1869
+ if (r.empty(n) || !n.startsWith("youtube-")) {
1870
+ var i = t.media.getAttribute("src");
1871
+ r.empty(i) && (i = t.media.getAttribute(this.config.attributes.embed.id));
1872
+ var a = Tn(i), s = v("div", { id: on(t.provider), "data-poster": e.customControls ? t.poster : void 0 });
1873
+ if (t.media = me(s, t.media), e.customControls) {
1874
+ var o = function(l) {
1875
+ return "https://i.ytimg.com/vi/".concat(a, "/").concat(l, "default.jpg");
1876
+ };
1877
+ de(o("maxres"), 121).catch(function() {
1878
+ return de(o("sd"), 121);
1879
+ }).catch(function() {
1880
+ return de(o("hq"));
1881
+ }).then(function(l) {
1882
+ return P.setPoster.call(t, l.src);
1883
+ }).then(function(l) {
1884
+ l.includes("maxres") || (t.elements.poster.style.backgroundSize = "cover");
1885
+ }).catch(function() {
1886
+ });
1887
+ }
1888
+ t.embed = new window.YT.Player(t.media, { videoId: a, host: Cn(e), playerVars: x({}, { autoplay: t.config.autoplay ? 1 : 0, hl: t.config.hl, controls: t.supported.ui && e.customControls ? 0 : 1, disablekb: 1, playsinline: t.config.fullscreen.iosNative ? 0 : 1, cc_load_policy: t.captions.active ? 1 : 0, cc_lang_pref: t.config.captions.language, widget_referrer: window ? window.location.href : null }, e), events: { onError: function(l) {
1889
+ if (!t.media.error) {
1890
+ var c = l.data, d = { 2: "The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.", 5: "The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.", 100: "The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.", 101: "The owner of the requested video does not allow it to be played in embedded players.", 150: "The owner of the requested video does not allow it to be played in embedded players." }[c] || "An unknown error occured";
1891
+ t.media.error = { code: c, message: d }, y.call(t, t.media, "error");
1892
+ }
1893
+ }, onPlaybackRateChange: function(l) {
1894
+ var c = l.target;
1895
+ t.media.playbackRate = c.getPlaybackRate(), y.call(t, t.media, "ratechange");
1896
+ }, onReady: function(l) {
1897
+ if (!r.function(t.media.play)) {
1898
+ var c = l.target;
1899
+ he.getTitle.call(t, a), t.media.play = function() {
1900
+ ae.call(t, !0), c.playVideo();
1901
+ }, t.media.pause = function() {
1902
+ ae.call(t, !1), c.pauseVideo();
1903
+ }, t.media.stop = function() {
1904
+ c.stopVideo();
1905
+ }, t.media.duration = c.getDuration(), t.media.paused = !0, t.media.currentTime = 0, Object.defineProperty(t.media, "currentTime", { get: function() {
1906
+ return Number(c.getCurrentTime());
1907
+ }, set: function(u) {
1908
+ t.paused && !t.embed.hasPlayed && t.embed.mute(), t.media.seeking = !0, y.call(t, t.media, "seeking"), c.seekTo(u);
1909
+ } }), Object.defineProperty(t.media, "playbackRate", { get: function() {
1910
+ return c.getPlaybackRate();
1911
+ }, set: function(u) {
1912
+ c.setPlaybackRate(u);
1913
+ } });
1914
+ var d = t.config.volume;
1915
+ Object.defineProperty(t.media, "volume", { get: function() {
1916
+ return d;
1917
+ }, set: function(u) {
1918
+ d = u, c.setVolume(100 * d), y.call(t, t.media, "volumechange");
1919
+ } });
1920
+ var p = t.config.muted;
1921
+ Object.defineProperty(t.media, "muted", { get: function() {
1922
+ return p;
1923
+ }, set: function(u) {
1924
+ var f = r.boolean(u) ? u : p;
1925
+ p = f, c[f ? "mute" : "unMute"](), c.setVolume(100 * d), y.call(t, t.media, "volumechange");
1926
+ } }), Object.defineProperty(t.media, "currentSrc", { get: function() {
1927
+ return c.getVideoUrl();
1928
+ } }), Object.defineProperty(t.media, "ended", { get: function() {
1929
+ return t.currentTime === t.duration;
1930
+ } });
1931
+ var g = c.getAvailablePlaybackRates();
1932
+ t.options.speed = g.filter(function(u) {
1933
+ return t.config.speed.options.includes(u);
1934
+ }), t.supported.ui && e.customControls && t.media.setAttribute("tabindex", -1), y.call(t, t.media, "timeupdate"), y.call(t, t.media, "durationchange"), clearInterval(t.timers.buffering), t.timers.buffering = setInterval(function() {
1935
+ t.media.buffered = c.getVideoLoadedFraction(), (t.media.lastBuffered === null || t.media.lastBuffered < t.media.buffered) && y.call(t, t.media, "progress"), t.media.lastBuffered = t.media.buffered, t.media.buffered === 1 && (clearInterval(t.timers.buffering), y.call(t, t.media, "canplaythrough"));
1936
+ }, 200), e.customControls && setTimeout(function() {
1937
+ return P.build.call(t);
1938
+ }, 50);
1939
+ }
1940
+ }, onStateChange: function(l) {
1941
+ var c = l.target;
1942
+ switch (clearInterval(t.timers.playing), t.media.seeking && [1, 2].includes(l.data) && (t.media.seeking = !1, y.call(t, t.media, "seeked")), l.data) {
1943
+ case -1:
1944
+ y.call(t, t.media, "timeupdate"), t.media.buffered = c.getVideoLoadedFraction(), y.call(t, t.media, "progress");
1945
+ break;
1946
+ case 0:
1947
+ ae.call(t, !1), t.media.loop ? (c.stopVideo(), c.playVideo()) : y.call(t, t.media, "ended");
1948
+ break;
1949
+ case 1:
1950
+ e.customControls && !t.config.autoplay && t.media.paused && !t.embed.hasPlayed ? t.media.pause() : (ae.call(t, !0), y.call(t, t.media, "playing"), t.timers.playing = setInterval(function() {
1951
+ y.call(t, t.media, "timeupdate");
1952
+ }, 50), t.media.duration !== c.getDuration() && (t.media.duration = c.getDuration(), y.call(t, t.media, "durationchange")));
1953
+ break;
1954
+ case 2:
1955
+ t.muted || t.embed.unMute(), ae.call(t, !1);
1956
+ break;
1957
+ case 3:
1958
+ y.call(t, t.media, "waiting");
1959
+ }
1960
+ y.call(t, t.elements.container, "statechange", !1, { code: l.data });
1961
+ } } });
1962
+ }
1963
+ } }, vt = { setup: function() {
1964
+ this.media ? (A(this.elements.container, this.config.classNames.type.replace("{0}", this.type), !0), A(this.elements.container, this.config.classNames.provider.replace("{0}", this.provider), !0), this.isEmbed && A(this.elements.container, this.config.classNames.type.replace("{0}", "video"), !0), this.isVideo && (this.elements.wrapper = v("div", { class: this.config.classNames.video }), lt(this.media, this.elements.wrapper), this.elements.poster = v("div", { class: this.config.classNames.poster, hidden: "" }), this.elements.wrapper.appendChild(this.elements.poster)), this.isHTML5 ? z.setup.call(this) : this.isYouTube ? he.setup.call(this) : this.isVimeo && Ie.setup.call(this)) : this.debug.warn("No media element found!");
1965
+ } }, An = function(t) {
1966
+ t.manager && t.manager.destroy(), t.elements.displayContainer && t.elements.displayContainer.destroy(), t.elements.container.remove();
1967
+ }, En = function() {
1968
+ function t(e) {
1969
+ var n = this;
1970
+ X(this, t), this.player = e, this.config = e.config.ads, this.playing = !1, this.initialized = !1, this.elements = { container: null, displayContainer: null }, this.manager = null, this.loader = null, this.cuePoints = null, this.events = {}, this.safetyTimer = null, this.countdownTimer = null, this.managerPromise = new Promise(function(i, a) {
1971
+ n.on("loaded", i), n.on("error", a);
1972
+ }), this.load();
1973
+ }
1974
+ return J(t, [{ key: "load", value: function() {
1975
+ var e = this;
1976
+ this.enabled && (r.object(window.google) && r.object(window.google.ima) ? this.ready() : He(this.player.config.urls.googleIMA.sdk).then(function() {
1977
+ e.ready();
1978
+ }).catch(function() {
1979
+ e.trigger("error", new Error("Google IMA SDK failed to load"));
1980
+ }));
1981
+ } }, { key: "ready", value: function() {
1982
+ var e = this;
1983
+ this.enabled || An(this), this.startSafetyTimer(12e3, "ready()"), this.managerPromise.then(function() {
1984
+ e.clearSafetyTimer("onAdsManagerLoaded()");
1985
+ }), this.listeners(), this.setupIMA();
1986
+ } }, { key: "setupIMA", value: function() {
1987
+ var e = this;
1988
+ this.elements.container = v("div", { class: this.player.config.classNames.ads }), this.player.elements.container.appendChild(this.elements.container), google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED), google.ima.settings.setLocale(this.player.config.ads.language), google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.player.config.playsinline), this.elements.displayContainer = new google.ima.AdDisplayContainer(this.elements.container, this.player.media), this.loader = new google.ima.AdsLoader(this.elements.displayContainer), this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED, function(n) {
1989
+ return e.onAdsManagerLoaded(n);
1990
+ }, !1), this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, function(n) {
1991
+ return e.onAdError(n);
1992
+ }, !1), this.requestAds();
1993
+ } }, { key: "requestAds", value: function() {
1994
+ var e = this.player.elements.container;
1995
+ try {
1996
+ var n = new google.ima.AdsRequest();
1997
+ n.adTagUrl = this.tagUrl, n.linearAdSlotWidth = e.offsetWidth, n.linearAdSlotHeight = e.offsetHeight, n.nonLinearAdSlotWidth = e.offsetWidth, n.nonLinearAdSlotHeight = e.offsetHeight, n.forceNonLinearFullSlot = !1, n.setAdWillPlayMuted(!this.player.muted), this.loader.requestAds(n);
1998
+ } catch (i) {
1999
+ this.onAdError(i);
2000
+ }
2001
+ } }, { key: "pollCountdown", value: function() {
2002
+ var e = this, n = arguments.length > 0 && arguments[0] !== void 0 && arguments[0];
2003
+ if (!n) return clearInterval(this.countdownTimer), void this.elements.container.removeAttribute("data-badge-text");
2004
+ var i = function() {
2005
+ var a = ye(Math.max(e.manager.getRemainingTime(), 0)), s = "".concat(L.get("advertisement", e.player.config), " - ").concat(a);
2006
+ e.elements.container.setAttribute("data-badge-text", s);
2007
+ };
2008
+ this.countdownTimer = setInterval(i, 100);
2009
+ } }, { key: "onAdsManagerLoaded", value: function(e) {
2010
+ var n = this;
2011
+ if (this.enabled) {
2012
+ var i = new google.ima.AdsRenderingSettings();
2013
+ i.restoreCustomPlaybackStateOnAdBreakComplete = !0, i.enablePreloading = !0, this.manager = e.getAdsManager(this.player, i), this.cuePoints = this.manager.getCuePoints(), this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, function(a) {
2014
+ return n.onAdError(a);
2015
+ }), Object.keys(google.ima.AdEvent.Type).forEach(function(a) {
2016
+ n.manager.addEventListener(google.ima.AdEvent.Type[a], function(s) {
2017
+ return n.onAdEvent(s);
2018
+ });
2019
+ }), this.trigger("loaded");
2020
+ }
2021
+ } }, { key: "addCuePoints", value: function() {
2022
+ var e = this;
2023
+ r.empty(this.cuePoints) || this.cuePoints.forEach(function(n) {
2024
+ if (n !== 0 && n !== -1 && n < e.player.duration) {
2025
+ var i = e.player.elements.progress;
2026
+ if (r.element(i)) {
2027
+ var a = 100 / e.player.duration * n, s = v("span", { class: e.player.config.classNames.cues });
2028
+ s.style.left = "".concat(a.toString(), "%"), i.appendChild(s);
2029
+ }
2030
+ }
2031
+ });
2032
+ } }, { key: "onAdEvent", value: function(e) {
2033
+ var n, i = this, a = this.player.elements.container, s = e.getAd(), o = e.getAdData();
2034
+ switch (n = e.type, y.call(i.player, i.player.media, "ads".concat(n.replace(/_/g, "").toLowerCase())), e.type) {
2035
+ case google.ima.AdEvent.Type.LOADED:
2036
+ this.trigger("loaded"), this.pollCountdown(!0), s.isLinear() || (s.width = a.offsetWidth, s.height = a.offsetHeight);
2037
+ break;
2038
+ case google.ima.AdEvent.Type.STARTED:
2039
+ this.manager.setVolume(this.player.volume);
2040
+ break;
2041
+ case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:
2042
+ this.player.ended ? this.loadAds() : this.loader.contentComplete();
2043
+ break;
2044
+ case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:
2045
+ this.pauseContent();
2046
+ break;
2047
+ case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:
2048
+ this.pollCountdown(), this.resumeContent();
2049
+ break;
2050
+ case google.ima.AdEvent.Type.LOG:
2051
+ o.adError && this.player.debug.warn("Non-fatal ad error: ".concat(o.adError.getMessage()));
2052
+ }
2053
+ } }, { key: "onAdError", value: function(e) {
2054
+ this.cancel(), this.player.debug.warn("Ads error", e);
2055
+ } }, { key: "listeners", value: function() {
2056
+ var e, n = this, i = this.player.elements.container;
2057
+ this.player.on("canplay", function() {
2058
+ n.addCuePoints();
2059
+ }), this.player.on("ended", function() {
2060
+ n.loader.contentComplete();
2061
+ }), this.player.on("timeupdate", function() {
2062
+ e = n.player.currentTime;
2063
+ }), this.player.on("seeked", function() {
2064
+ var a = n.player.currentTime;
2065
+ r.empty(n.cuePoints) || n.cuePoints.forEach(function(s, o) {
2066
+ e < s && s < a && (n.manager.discardAdBreak(), n.cuePoints.splice(o, 1));
2067
+ });
2068
+ }), window.addEventListener("resize", function() {
2069
+ n.manager && n.manager.resize(i.offsetWidth, i.offsetHeight, google.ima.ViewMode.NORMAL);
2070
+ });
2071
+ } }, { key: "play", value: function() {
2072
+ var e = this, n = this.player.elements.container;
2073
+ this.managerPromise || this.resumeContent(), this.managerPromise.then(function() {
2074
+ e.manager.setVolume(e.player.volume), e.elements.displayContainer.initialize();
2075
+ try {
2076
+ e.initialized || (e.manager.init(n.offsetWidth, n.offsetHeight, google.ima.ViewMode.NORMAL), e.manager.start()), e.initialized = !0;
2077
+ } catch (i) {
2078
+ e.onAdError(i);
2079
+ }
2080
+ }).catch(function() {
2081
+ });
2082
+ } }, { key: "resumeContent", value: function() {
2083
+ this.elements.container.style.zIndex = "", this.playing = !1, R(this.player.media.play());
2084
+ } }, { key: "pauseContent", value: function() {
2085
+ this.elements.container.style.zIndex = 3, this.playing = !0, this.player.media.pause();
2086
+ } }, { key: "cancel", value: function() {
2087
+ this.initialized && this.resumeContent(), this.trigger("error"), this.loadAds();
2088
+ } }, { key: "loadAds", value: function() {
2089
+ var e = this;
2090
+ this.managerPromise.then(function() {
2091
+ e.manager && e.manager.destroy(), e.managerPromise = new Promise(function(n) {
2092
+ e.on("loaded", n), e.player.debug.log(e.manager);
2093
+ }), e.initialized = !1, e.requestAds();
2094
+ }).catch(function() {
2095
+ });
2096
+ } }, { key: "trigger", value: function(e) {
2097
+ for (var n = this, i = arguments.length, a = new Array(i > 1 ? i - 1 : 0), s = 1; s < i; s++) a[s - 1] = arguments[s];
2098
+ var o = this.events[e];
2099
+ r.array(o) && o.forEach(function(l) {
2100
+ r.function(l) && l.apply(n, a);
2101
+ });
2102
+ } }, { key: "on", value: function(e, n) {
2103
+ return r.array(this.events[e]) || (this.events[e] = []), this.events[e].push(n), this;
2104
+ } }, { key: "startSafetyTimer", value: function(e, n) {
2105
+ var i = this;
2106
+ this.player.debug.log("Safety timer invoked from: ".concat(n)), this.safetyTimer = setTimeout(function() {
2107
+ i.cancel(), i.clearSafetyTimer("startSafetyTimer()");
2108
+ }, e);
2109
+ } }, { key: "clearSafetyTimer", value: function(e) {
2110
+ r.nullOrUndefined(this.safetyTimer) || (this.player.debug.log("Safety timer cleared from: ".concat(e)), clearTimeout(this.safetyTimer), this.safetyTimer = null);
2111
+ } }, { key: "enabled", get: function() {
2112
+ var e = this.config;
2113
+ return this.player.isHTML5 && this.player.isVideo && e.enabled && (!r.empty(e.publisherId) || r.url(e.tagUrl));
2114
+ } }, { key: "tagUrl", get: function() {
2115
+ var e = this.config;
2116
+ if (r.url(e.tagUrl)) return e.tagUrl;
2117
+ var n = { AV_PUBLISHERID: "58c25bb0073ef448b1087ad6", AV_CHANNELID: "5a0458dc28a06145e4519d21", AV_URL: window.location.hostname, cb: Date.now(), AV_WIDTH: 640, AV_HEIGHT: 480, AV_CDIM2: e.publisherId };
2118
+ return "".concat("https://go.aniview.com/api/adserver6/vast/", "?").concat(ft(n));
2119
+ } }]), t;
2120
+ }(), Sn = function(t) {
2121
+ var e = [];
2122
+ return t.split(/\r\n\r\n|\n\n|\r\r/).forEach(function(n) {
2123
+ var i = {};
2124
+ n.split(/\r\n|\n|\r/).forEach(function(a) {
2125
+ if (r.number(i.startTime)) {
2126
+ if (!r.empty(a.trim()) && r.empty(i.text)) {
2127
+ var s = a.trim().split("#xywh="), o = O(s, 1);
2128
+ if (i.text = o[0], s[1]) {
2129
+ var l = O(s[1].split(","), 4);
2130
+ i.x = l[0], i.y = l[1], i.w = l[2], i.h = l[3];
2131
+ }
2132
+ }
2133
+ } else {
2134
+ var c = a.match(/([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})( ?--> ?)([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})/);
2135
+ c && (i.startTime = 60 * Number(c[1] || 0) * 60 + 60 * Number(c[2]) + Number(c[3]) + Number("0.".concat(c[4])), i.endTime = 60 * Number(c[6] || 0) * 60 + 60 * Number(c[7]) + Number(c[8]) + Number("0.".concat(c[9])));
2136
+ }
2137
+ }), i.text && e.push(i);
2138
+ }), e;
2139
+ }, Qe = function(t, e) {
2140
+ var n = {};
2141
+ return t > e.width / e.height ? (n.width = e.width, n.height = 1 / t * e.width) : (n.height = e.height, n.width = t * e.height), n;
2142
+ }, bt = function() {
2143
+ function t(e) {
2144
+ X(this, t), this.player = e, this.thumbnails = [], this.loaded = !1, this.lastMouseMoveTime = Date.now(), this.mouseDown = !1, this.loadedImages = [], this.elements = { thumb: {}, scrubbing: {} }, this.load();
2145
+ }
2146
+ return J(t, [{ key: "load", value: function() {
2147
+ var e = this;
2148
+ this.player.elements.display.seekTooltip && (this.player.elements.display.seekTooltip.hidden = this.enabled), this.enabled && this.getThumbnails().then(function() {
2149
+ e.enabled && (e.render(), e.determineContainerAutoSizing(), e.loaded = !0);
2150
+ });
2151
+ } }, { key: "getThumbnails", value: function() {
2152
+ var e = this;
2153
+ return new Promise(function(n) {
2154
+ var i = e.player.config.previewThumbnails.src;
2155
+ if (r.empty(i)) throw new Error("Missing previewThumbnails.src config attribute");
2156
+ var a = function() {
2157
+ e.thumbnails.sort(function(o, l) {
2158
+ return o.height - l.height;
2159
+ }), e.player.debug.log("Preview thumbnails", e.thumbnails), n();
2160
+ };
2161
+ if (r.function(i)) i(function(o) {
2162
+ e.thumbnails = o, a();
2163
+ });
2164
+ else {
2165
+ var s = (r.string(i) ? [i] : i).map(function(o) {
2166
+ return e.getThumbnail(o);
2167
+ });
2168
+ Promise.all(s).then(a);
2169
+ }
2170
+ });
2171
+ } }, { key: "getThumbnail", value: function(e) {
2172
+ var n = this;
2173
+ return new Promise(function(i) {
2174
+ oe(e).then(function(a) {
2175
+ var s = { frames: Sn(a), height: null, urlPrefix: "" };
2176
+ s.frames[0].text.startsWith("/") || s.frames[0].text.startsWith("http://") || s.frames[0].text.startsWith("https://") || (s.urlPrefix = e.substring(0, e.lastIndexOf("/") + 1));
2177
+ var o = new Image();
2178
+ o.onload = function() {
2179
+ s.height = o.naturalHeight, s.width = o.naturalWidth, n.thumbnails.push(s), i();
2180
+ }, o.src = s.urlPrefix + s.frames[0].text;
2181
+ });
2182
+ });
2183
+ } }, { key: "startMove", value: function(e) {
2184
+ if (this.loaded && r.event(e) && ["touchmove", "mousemove"].includes(e.type) && this.player.media.duration) {
2185
+ if (e.type === "touchmove") this.seekTime = this.player.media.duration * (this.player.elements.inputs.seek.value / 100);
2186
+ else {
2187
+ var n = this.player.elements.progress.getBoundingClientRect(), i = 100 / n.width * (e.pageX - n.left);
2188
+ this.seekTime = this.player.media.duration * (i / 100), this.seekTime < 0 && (this.seekTime = 0), this.seekTime > this.player.media.duration - 1 && (this.seekTime = this.player.media.duration - 1), this.mousePosX = e.pageX, this.elements.thumb.time.innerText = ye(this.seekTime);
2189
+ }
2190
+ this.showImageAtCurrentTime();
2191
+ }
2192
+ } }, { key: "endMove", value: function() {
2193
+ this.toggleThumbContainer(!1, !0);
2194
+ } }, { key: "startScrubbing", value: function(e) {
2195
+ (r.nullOrUndefined(e.button) || e.button === !1 || e.button === 0) && (this.mouseDown = !0, this.player.media.duration && (this.toggleScrubbingContainer(!0), this.toggleThumbContainer(!1, !0), this.showImageAtCurrentTime()));
2196
+ } }, { key: "endScrubbing", value: function() {
2197
+ var e = this;
2198
+ this.mouseDown = !1, Math.ceil(this.lastTime) === Math.ceil(this.player.media.currentTime) ? this.toggleScrubbingContainer(!1) : je.call(this.player, this.player.media, "timeupdate", function() {
2199
+ e.mouseDown || e.toggleScrubbingContainer(!1);
2200
+ });
2201
+ } }, { key: "listeners", value: function() {
2202
+ var e = this;
2203
+ this.player.on("play", function() {
2204
+ e.toggleThumbContainer(!1, !0);
2205
+ }), this.player.on("seeked", function() {
2206
+ e.toggleThumbContainer(!1);
2207
+ }), this.player.on("timeupdate", function() {
2208
+ e.lastTime = e.player.media.currentTime;
2209
+ });
2210
+ } }, { key: "render", value: function() {
2211
+ this.elements.thumb.container = v("div", { class: this.player.config.classNames.previewThumbnails.thumbContainer }), this.elements.thumb.imageContainer = v("div", { class: this.player.config.classNames.previewThumbnails.imageContainer }), this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);
2212
+ var e = v("div", { class: this.player.config.classNames.previewThumbnails.timeContainer });
2213
+ this.elements.thumb.time = v("span", {}, "00:00"), e.appendChild(this.elements.thumb.time), this.elements.thumb.container.appendChild(e), r.element(this.player.elements.progress) && this.player.elements.progress.appendChild(this.elements.thumb.container), this.elements.scrubbing.container = v("div", { class: this.player.config.classNames.previewThumbnails.scrubbingContainer }), this.player.elements.wrapper.appendChild(this.elements.scrubbing.container);
2214
+ } }, { key: "destroy", value: function() {
2215
+ this.elements.thumb.container && this.elements.thumb.container.remove(), this.elements.scrubbing.container && this.elements.scrubbing.container.remove();
2216
+ } }, { key: "showImageAtCurrentTime", value: function() {
2217
+ var e = this;
2218
+ this.mouseDown ? this.setScrubbingContainerSize() : this.setThumbContainerSizeAndPos();
2219
+ var n = this.thumbnails[0].frames.findIndex(function(s) {
2220
+ return e.seekTime >= s.startTime && e.seekTime <= s.endTime;
2221
+ }), i = n >= 0, a = 0;
2222
+ this.mouseDown || this.toggleThumbContainer(i), i && (this.thumbnails.forEach(function(s, o) {
2223
+ e.loadedImages.includes(s.frames[n].text) && (a = o);
2224
+ }), n !== this.showingThumb && (this.showingThumb = n, this.loadImage(a)));
2225
+ } }, { key: "loadImage", value: function() {
2226
+ var e = this, n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0, i = this.showingThumb, a = this.thumbnails[n], s = a.urlPrefix, o = a.frames[i], l = a.frames[i].text, c = s + l;
2227
+ if (this.currentImageElement && this.currentImageElement.dataset.filename === l) this.showImage(this.currentImageElement, o, n, i, l, !1), this.currentImageElement.dataset.index = i, this.removeOldImages(this.currentImageElement);
2228
+ else {
2229
+ this.loadingImage && this.usingSprites && (this.loadingImage.onload = null);
2230
+ var d = new Image();
2231
+ d.src = c, d.dataset.index = i, d.dataset.filename = l, this.showingThumbFilename = l, this.player.debug.log("Loading image: ".concat(c)), d.onload = function() {
2232
+ return e.showImage(d, o, n, i, l, !0);
2233
+ }, this.loadingImage = d, this.removeOldImages(d);
2234
+ }
2235
+ } }, { key: "showImage", value: function(e, n, i, a, s) {
2236
+ var o = !(arguments.length > 5 && arguments[5] !== void 0) || arguments[5];
2237
+ this.player.debug.log("Showing thumb: ".concat(s, ". num: ").concat(a, ". qual: ").concat(i, ". newimg: ").concat(o)), this.setImageSizeAndOffset(e, n), o && (this.currentImageContainer.appendChild(e), this.currentImageElement = e, this.loadedImages.includes(s) || this.loadedImages.push(s)), this.preloadNearby(a, !0).then(this.preloadNearby(a, !1)).then(this.getHigherQuality(i, e, n, s));
2238
+ } }, { key: "removeOldImages", value: function(e) {
2239
+ var n = this;
2240
+ Array.from(this.currentImageContainer.children).forEach(function(i) {
2241
+ if (i.tagName.toLowerCase() === "img") {
2242
+ var a = n.usingSprites ? 500 : 1e3;
2243
+ if (i.dataset.index !== e.dataset.index && !i.dataset.deleting) {
2244
+ i.dataset.deleting = !0;
2245
+ var s = n.currentImageContainer;
2246
+ setTimeout(function() {
2247
+ s.removeChild(i), n.player.debug.log("Removing thumb: ".concat(i.dataset.filename));
2248
+ }, a);
2249
+ }
2250
+ }
2251
+ });
2252
+ } }, { key: "preloadNearby", value: function(e) {
2253
+ var n = this, i = !(arguments.length > 1 && arguments[1] !== void 0) || arguments[1];
2254
+ return new Promise(function(a) {
2255
+ setTimeout(function() {
2256
+ var s = n.thumbnails[0].frames[e].text;
2257
+ if (n.showingThumbFilename === s) {
2258
+ var o;
2259
+ o = i ? n.thumbnails[0].frames.slice(e) : n.thumbnails[0].frames.slice(0, e).reverse();
2260
+ var l = !1;
2261
+ o.forEach(function(c) {
2262
+ var d = c.text;
2263
+ if (d !== s && !n.loadedImages.includes(d)) {
2264
+ l = !0, n.player.debug.log("Preloading thumb filename: ".concat(d));
2265
+ var p = n.thumbnails[0].urlPrefix + d, g = new Image();
2266
+ g.src = p, g.onload = function() {
2267
+ n.player.debug.log("Preloaded thumb filename: ".concat(d)), n.loadedImages.includes(d) || n.loadedImages.push(d), a();
2268
+ };
2269
+ }
2270
+ }), l || a();
2271
+ }
2272
+ }, 300);
2273
+ });
2274
+ } }, { key: "getHigherQuality", value: function(e, n, i, a) {
2275
+ var s = this;
2276
+ if (e < this.thumbnails.length - 1) {
2277
+ var o = n.naturalHeight;
2278
+ this.usingSprites && (o = i.h), o < this.thumbContainerHeight && setTimeout(function() {
2279
+ s.showingThumbFilename === a && (s.player.debug.log("Showing higher quality thumb for: ".concat(a)), s.loadImage(e + 1));
2280
+ }, 300);
2281
+ }
2282
+ } }, { key: "toggleThumbContainer", value: function() {
2283
+ var e = arguments.length > 0 && arguments[0] !== void 0 && arguments[0], n = arguments.length > 1 && arguments[1] !== void 0 && arguments[1], i = this.player.config.classNames.previewThumbnails.thumbContainerShown;
2284
+ this.elements.thumb.container.classList.toggle(i, e), !e && n && (this.showingThumb = null, this.showingThumbFilename = null);
2285
+ } }, { key: "toggleScrubbingContainer", value: function() {
2286
+ var e = arguments.length > 0 && arguments[0] !== void 0 && arguments[0], n = this.player.config.classNames.previewThumbnails.scrubbingContainerShown;
2287
+ this.elements.scrubbing.container.classList.toggle(n, e), e || (this.showingThumb = null, this.showingThumbFilename = null);
2288
+ } }, { key: "determineContainerAutoSizing", value: function() {
2289
+ (this.elements.thumb.imageContainer.clientHeight > 20 || this.elements.thumb.imageContainer.clientWidth > 20) && (this.sizeSpecifiedInCSS = !0);
2290
+ } }, { key: "setThumbContainerSizeAndPos", value: function() {
2291
+ if (this.sizeSpecifiedInCSS) {
2292
+ if (this.elements.thumb.imageContainer.clientHeight > 20 && this.elements.thumb.imageContainer.clientWidth < 20) {
2293
+ var e = Math.floor(this.elements.thumb.imageContainer.clientHeight * this.thumbAspectRatio);
2294
+ this.elements.thumb.imageContainer.style.width = "".concat(e, "px");
2295
+ } else if (this.elements.thumb.imageContainer.clientHeight < 20 && this.elements.thumb.imageContainer.clientWidth > 20) {
2296
+ var n = Math.floor(this.elements.thumb.imageContainer.clientWidth / this.thumbAspectRatio);
2297
+ this.elements.thumb.imageContainer.style.height = "".concat(n, "px");
2298
+ }
2299
+ } else {
2300
+ var i = Math.floor(this.thumbContainerHeight * this.thumbAspectRatio);
2301
+ this.elements.thumb.imageContainer.style.height = "".concat(this.thumbContainerHeight, "px"), this.elements.thumb.imageContainer.style.width = "".concat(i, "px");
2302
+ }
2303
+ this.setThumbContainerPos();
2304
+ } }, { key: "setThumbContainerPos", value: function() {
2305
+ var e = this.player.elements.progress.getBoundingClientRect(), n = this.player.elements.container.getBoundingClientRect(), i = this.elements.thumb.container, a = n.left - e.left + 10, s = n.right - e.left - i.clientWidth - 10, o = this.mousePosX - e.left - i.clientWidth / 2;
2306
+ o < a && (o = a), o > s && (o = s), i.style.left = "".concat(o, "px");
2307
+ } }, { key: "setScrubbingContainerSize", value: function() {
2308
+ var e = Qe(this.thumbAspectRatio, { width: this.player.media.clientWidth, height: this.player.media.clientHeight }), n = e.width, i = e.height;
2309
+ this.elements.scrubbing.container.style.width = "".concat(n, "px"), this.elements.scrubbing.container.style.height = "".concat(i, "px");
2310
+ } }, { key: "setImageSizeAndOffset", value: function(e, n) {
2311
+ if (this.usingSprites) {
2312
+ var i = this.thumbContainerHeight / n.h;
2313
+ e.style.height = "".concat(e.naturalHeight * i, "px"), e.style.width = "".concat(e.naturalWidth * i, "px"), e.style.left = "-".concat(n.x * i, "px"), e.style.top = "-".concat(n.y * i, "px");
2314
+ }
2315
+ } }, { key: "enabled", get: function() {
2316
+ return this.player.isHTML5 && this.player.isVideo && this.player.config.previewThumbnails.enabled;
2317
+ } }, { key: "currentImageContainer", get: function() {
2318
+ return this.mouseDown ? this.elements.scrubbing.container : this.elements.thumb.imageContainer;
2319
+ } }, { key: "usingSprites", get: function() {
2320
+ return Object.keys(this.thumbnails[0].frames[0]).includes("w");
2321
+ } }, { key: "thumbAspectRatio", get: function() {
2322
+ return this.usingSprites ? this.thumbnails[0].frames[0].w / this.thumbnails[0].frames[0].h : this.thumbnails[0].width / this.thumbnails[0].height;
2323
+ } }, { key: "thumbContainerHeight", get: function() {
2324
+ return this.mouseDown ? Qe(this.thumbAspectRatio, { width: this.player.media.clientWidth, height: this.player.media.clientHeight }).height : this.sizeSpecifiedInCSS ? this.elements.thumb.imageContainer.clientHeight : Math.floor(this.player.media.clientWidth / this.thumbAspectRatio / 4);
2325
+ } }, { key: "currentImageElement", get: function() {
2326
+ return this.mouseDown ? this.currentScrubbingImageElement : this.currentThumbnailImageElement;
2327
+ }, set: function(e) {
2328
+ this.mouseDown ? this.currentScrubbingImageElement = e : this.currentThumbnailImageElement = e;
2329
+ } }]), t;
2330
+ }(), Le = { insertElements: function(t, e) {
2331
+ var n = this;
2332
+ r.string(e) ? $e(t, this.media, { src: e }) : r.array(e) && e.forEach(function(i) {
2333
+ $e(t, n.media, i);
2334
+ });
2335
+ }, change: function(t) {
2336
+ var e = this;
2337
+ ot(t, "sources.length") ? (z.cancelRequests.call(this), this.destroy.call(this, function() {
2338
+ e.options.quality = [], B(e.media), e.media = null, r.element(e.elements.container) && e.elements.container.removeAttribute("class");
2339
+ var n = t.sources, i = t.type, a = O(n, 1)[0], s = a.provider, o = s === void 0 ? W.html5 : s, l = a.src, c = o === "html5" ? i : "div", d = o === "html5" ? {} : { src: l };
2340
+ Object.assign(e, { provider: o, type: i, supported: M.check(i, o, e.config.playsinline), media: v(c, d) }), e.elements.container.appendChild(e.media), r.boolean(t.autoplay) && (e.config.autoplay = t.autoplay), e.isHTML5 && (e.config.crossorigin && e.media.setAttribute("crossorigin", ""), e.config.autoplay && e.media.setAttribute("autoplay", ""), r.empty(t.poster) || (e.poster = t.poster), e.config.loop.active && e.media.setAttribute("loop", ""), e.config.muted && e.media.setAttribute("muted", ""), e.config.playsinline && e.media.setAttribute("playsinline", "")), P.addStyleHook.call(e), e.isHTML5 && Le.insertElements.call(e, "source", n), e.config.title = t.title, vt.setup.call(e), e.isHTML5 && Object.keys(t).includes("tracks") && Le.insertElements.call(e, "track", t.tracks), (e.isHTML5 || e.isEmbed && !e.supported.ui) && P.build.call(e), e.isHTML5 && e.media.load(), r.empty(t.previewThumbnails) || (Object.assign(e.config.previewThumbnails, t.previewThumbnails), e.previewThumbnails && e.previewThumbnails.loaded && (e.previewThumbnails.destroy(), e.previewThumbnails = null), e.config.previewThumbnails.enabled && (e.previewThumbnails = new bt(e))), e.fullscreen.update();
2341
+ }, !0)) : this.debug.warn("Invalid source format");
2342
+ } };
2343
+ function Pn() {
2344
+ var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0, e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 255;
2345
+ return Math.min(Math.max(t, e), n);
2346
+ }
2347
+ var Nn = function() {
2348
+ function t(e, n) {
2349
+ var i = this;
2350
+ if (X(this, t), this.timers = {}, this.ready = !1, this.loading = !1, this.failed = !1, this.touch = M.touch, this.media = e, r.string(this.media) && (this.media = document.querySelectorAll(this.media)), (window.jQuery && this.media instanceof jQuery || r.nodeList(this.media) || r.array(this.media)) && (this.media = this.media[0]), this.config = x({}, yt, t.defaults, n || {}, function() {
2351
+ try {
2352
+ return JSON.parse(i.media.getAttribute("data-plyr-config"));
2353
+ } catch {
2354
+ return {};
2355
+ }
2356
+ }()), this.elements = { container: null, fullscreen: null, captions: null, buttons: {}, display: {}, progress: {}, inputs: {}, settings: { popup: null, menu: null, panels: {}, buttons: {} } }, this.captions = { active: null, currentTrack: -1, meta: /* @__PURE__ */ new WeakMap() }, this.fullscreen = { active: !1 }, this.options = { speed: [], quality: [] }, this.debug = new fn(this.config.debug), this.debug.log("Config", this.config), this.debug.log("Support", M), !r.nullOrUndefined(this.media) && r.element(this.media)) if (this.media.plyr) this.debug.warn("Target already setup");
2357
+ else if (this.config.enabled) if (M.check().api) {
2358
+ var a = this.media.cloneNode(!0);
2359
+ a.autoplay = !1, this.elements.original = a;
2360
+ var s = this.media.tagName.toLowerCase(), o = null, l = null;
2361
+ switch (s) {
2362
+ case "div":
2363
+ if (o = this.media.querySelector("iframe"), r.element(o)) {
2364
+ if (l = gt(o.getAttribute("src")), this.provider = gn(l.toString()), this.elements.container = this.media, this.media = o, this.elements.container.className = "", l.search.length) {
2365
+ var c = ["1", "true"];
2366
+ c.includes(l.searchParams.get("autoplay")) && (this.config.autoplay = !0), c.includes(l.searchParams.get("loop")) && (this.config.loop.active = !0), this.isYouTube ? (this.config.playsinline = c.includes(l.searchParams.get("playsinline")), this.config.youtube.hl = l.searchParams.get("hl")) : this.config.playsinline = !0;
2367
+ }
2368
+ } else this.provider = this.media.getAttribute(this.config.attributes.embed.provider), this.media.removeAttribute(this.config.attributes.embed.provider);
2369
+ if (r.empty(this.provider) || !Object.keys(W).includes(this.provider)) return void this.debug.error("Setup failed: Invalid provider");
2370
+ this.type = we.video;
2371
+ break;
2372
+ case "video":
2373
+ case "audio":
2374
+ this.type = s, this.provider = W.html5, this.media.hasAttribute("crossorigin") && (this.config.crossorigin = !0), this.media.hasAttribute("autoplay") && (this.config.autoplay = !0), (this.media.hasAttribute("playsinline") || this.media.hasAttribute("webkit-playsinline")) && (this.config.playsinline = !0), this.media.hasAttribute("muted") && (this.config.muted = !0), this.media.hasAttribute("loop") && (this.config.loop.active = !0);
2375
+ break;
2376
+ default:
2377
+ return void this.debug.error("Setup failed: unsupported type");
2378
+ }
2379
+ this.supported = M.check(this.type, this.provider, this.config.playsinline), this.supported.api ? (this.eventListeners = [], this.listeners = new vn(this), this.storage = new ht(this), this.media.plyr = this, r.element(this.elements.container) || (this.elements.container = v("div", { tabindex: 0 }), lt(this.media, this.elements.container)), P.migrateStyles.call(this), P.addStyleHook.call(this), vt.setup.call(this), this.config.debug && C.call(this, this.elements.container, this.config.events.join(" "), function(d) {
2380
+ i.debug.log("event: ".concat(d.type));
2381
+ }), this.fullscreen = new yn(this), (this.isHTML5 || this.isEmbed && !this.supported.ui) && P.build.call(this), this.listeners.container(), this.listeners.global(), this.config.ads.enabled && (this.ads = new En(this)), this.isHTML5 && this.config.autoplay && this.once("canplay", function() {
2382
+ return R(i.play());
2383
+ }), this.lastSeekTime = 0, this.config.previewThumbnails.enabled && (this.previewThumbnails = new bt(this))) : this.debug.error("Setup failed: no support");
2384
+ } else this.debug.error("Setup failed: no support");
2385
+ else this.debug.error("Setup failed: disabled by config");
2386
+ else this.debug.error("Setup failed: no suitable element passed");
2387
+ }
2388
+ return J(t, [{ key: "play", value: function() {
2389
+ var e = this;
2390
+ return r.function(this.media.play) ? (this.ads && this.ads.enabled && this.ads.managerPromise.then(function() {
2391
+ return e.ads.play();
2392
+ }).catch(function() {
2393
+ return R(e.media.play());
2394
+ }), this.media.play()) : null;
2395
+ } }, { key: "pause", value: function() {
2396
+ return this.playing && r.function(this.media.pause) ? this.media.pause() : null;
2397
+ } }, { key: "togglePlay", value: function(e) {
2398
+ return (r.boolean(e) ? e : !this.playing) ? this.play() : this.pause();
2399
+ } }, { key: "stop", value: function() {
2400
+ this.isHTML5 ? (this.pause(), this.restart()) : r.function(this.media.stop) && this.media.stop();
2401
+ } }, { key: "restart", value: function() {
2402
+ this.currentTime = 0;
2403
+ } }, { key: "rewind", value: function(e) {
2404
+ this.currentTime -= r.number(e) ? e : this.config.seekTime;
2405
+ } }, { key: "forward", value: function(e) {
2406
+ this.currentTime += r.number(e) ? e : this.config.seekTime;
2407
+ } }, { key: "increaseVolume", value: function(e) {
2408
+ var n = this.media.muted ? 0 : this.volume;
2409
+ this.volume = n + (r.number(e) ? e : 0);
2410
+ } }, { key: "decreaseVolume", value: function(e) {
2411
+ this.increaseVolume(-e);
2412
+ } }, { key: "toggleCaptions", value: function(e) {
2413
+ S.toggle.call(this, e, !1);
2414
+ } }, { key: "airplay", value: function() {
2415
+ M.airplay && this.media.webkitShowPlaybackTargetPicker();
2416
+ } }, { key: "toggleControls", value: function(e) {
2417
+ if (this.supported.ui && !this.isAudio) {
2418
+ var n = pe(this.elements.container, this.config.classNames.hideControls), i = e === void 0 ? void 0 : !e, a = A(this.elements.container, this.config.classNames.hideControls, i);
2419
+ if (a && r.array(this.config.controls) && this.config.controls.includes("settings") && !r.empty(this.config.settings) && h.toggleMenu.call(this, !1), a !== n) {
2420
+ var s = a ? "controlshidden" : "controlsshown";
2421
+ y.call(this, this.media, s);
2422
+ }
2423
+ return !a;
2424
+ }
2425
+ return !1;
2426
+ } }, { key: "on", value: function(e, n) {
2427
+ C.call(this, this.elements.container, e, n);
2428
+ } }, { key: "once", value: function(e, n) {
2429
+ je.call(this, this.elements.container, e, n);
2430
+ } }, { key: "off", value: function(e, n) {
2431
+ fe(this.elements.container, e, n);
2432
+ } }, { key: "destroy", value: function(e) {
2433
+ var n = this, i = arguments.length > 1 && arguments[1] !== void 0 && arguments[1];
2434
+ if (this.ready) {
2435
+ var a = function() {
2436
+ document.body.style.overflow = "", n.embed = null, i ? (Object.keys(n.elements).length && (B(n.elements.buttons.play), B(n.elements.captions), B(n.elements.controls), B(n.elements.wrapper), n.elements.buttons.play = null, n.elements.captions = null, n.elements.controls = null, n.elements.wrapper = null), r.function(e) && e()) : (an.call(n), z.cancelRequests.call(n), me(n.elements.original, n.elements.container), y.call(n, n.elements.original, "destroyed", !0), r.function(e) && e.call(n.elements.original), n.ready = !1, setTimeout(function() {
2437
+ n.elements = null, n.media = null;
2438
+ }, 200));
2439
+ };
2440
+ this.stop(), clearTimeout(this.timers.loading), clearTimeout(this.timers.controls), clearTimeout(this.timers.resized), this.isHTML5 ? (P.toggleNativeControls.call(this, !0), a()) : this.isYouTube ? (clearInterval(this.timers.buffering), clearInterval(this.timers.playing), this.embed !== null && r.function(this.embed.destroy) && this.embed.destroy(), a()) : this.isVimeo && (this.embed !== null && this.embed.unload().then(a), setTimeout(a, 200));
2441
+ }
2442
+ } }, { key: "supports", value: function(e) {
2443
+ return M.mime.call(this, e);
2444
+ } }, { key: "isHTML5", get: function() {
2445
+ return this.provider === W.html5;
2446
+ } }, { key: "isEmbed", get: function() {
2447
+ return this.isYouTube || this.isVimeo;
2448
+ } }, { key: "isYouTube", get: function() {
2449
+ return this.provider === W.youtube;
2450
+ } }, { key: "isVimeo", get: function() {
2451
+ return this.provider === W.vimeo;
2452
+ } }, { key: "isVideo", get: function() {
2453
+ return this.type === we.video;
2454
+ } }, { key: "isAudio", get: function() {
2455
+ return this.type === we.audio;
2456
+ } }, { key: "playing", get: function() {
2457
+ return !!(this.ready && !this.paused && !this.ended);
2458
+ } }, { key: "paused", get: function() {
2459
+ return !!this.media.paused;
2460
+ } }, { key: "stopped", get: function() {
2461
+ return !!(this.paused && this.currentTime === 0);
2462
+ } }, { key: "ended", get: function() {
2463
+ return !!this.media.ended;
2464
+ } }, { key: "currentTime", set: function(e) {
2465
+ if (this.duration) {
2466
+ var n = r.number(e) && e > 0;
2467
+ this.media.currentTime = n ? Math.min(e, this.duration) : 0, this.debug.log("Seeking to ".concat(this.currentTime, " seconds"));
2468
+ }
2469
+ }, get: function() {
2470
+ return Number(this.media.currentTime);
2471
+ } }, { key: "buffered", get: function() {
2472
+ var e = this.media.buffered;
2473
+ return r.number(e) ? e : e && e.length && this.duration > 0 ? e.end(0) / this.duration : 0;
2474
+ } }, { key: "seeking", get: function() {
2475
+ return !!this.media.seeking;
2476
+ } }, { key: "duration", get: function() {
2477
+ var e = parseFloat(this.config.duration), n = (this.media || {}).duration, i = r.number(n) && n !== 1 / 0 ? n : 0;
2478
+ return e || i;
2479
+ } }, { key: "volume", set: function(e) {
2480
+ var n = e;
2481
+ r.string(n) && (n = Number(n)), r.number(n) || (n = this.storage.get("volume")), r.number(n) || (n = this.config.volume), n > 1 && (n = 1), n < 0 && (n = 0), this.config.volume = n, this.media.volume = n, !r.empty(e) && this.muted && n > 0 && (this.muted = !1);
2482
+ }, get: function() {
2483
+ return Number(this.media.volume);
2484
+ } }, { key: "muted", set: function(e) {
2485
+ var n = e;
2486
+ r.boolean(n) || (n = this.storage.get("muted")), r.boolean(n) || (n = this.config.muted), this.config.muted = n, this.media.muted = n;
2487
+ }, get: function() {
2488
+ return !!this.media.muted;
2489
+ } }, { key: "hasAudio", get: function() {
2490
+ return !this.isHTML5 || !!this.isAudio || !!this.media.mozHasAudio || !!this.media.webkitAudioDecodedByteCount || !!(this.media.audioTracks && this.media.audioTracks.length);
2491
+ } }, { key: "speed", set: function(e) {
2492
+ var n = this, i = null;
2493
+ r.number(e) && (i = e), r.number(i) || (i = this.storage.get("speed")), r.number(i) || (i = this.config.speed.selected);
2494
+ var a = this.minimumSpeed, s = this.maximumSpeed;
2495
+ i = Pn(i, a, s), this.config.speed.selected = i, setTimeout(function() {
2496
+ n.media.playbackRate = i;
2497
+ }, 0);
2498
+ }, get: function() {
2499
+ return Number(this.media.playbackRate);
2500
+ } }, { key: "minimumSpeed", get: function() {
2501
+ return this.isYouTube ? Math.min.apply(Math, Ae(this.options.speed)) : this.isVimeo ? 0.5 : 0.0625;
2502
+ } }, { key: "maximumSpeed", get: function() {
2503
+ return this.isYouTube ? Math.max.apply(Math, Ae(this.options.speed)) : this.isVimeo ? 2 : 16;
2504
+ } }, { key: "quality", set: function(e) {
2505
+ var n = this.config.quality, i = this.options.quality;
2506
+ if (i.length) {
2507
+ var a = [!r.empty(e) && Number(e), this.storage.get("quality"), n.selected, n.default].find(r.number), s = !0;
2508
+ if (!i.includes(a)) {
2509
+ var o = rn(i, a);
2510
+ this.debug.warn("Unsupported quality option: ".concat(a, ", using ").concat(o, " instead")), a = o, s = !1;
2511
+ }
2512
+ n.selected = a, this.media.quality = a, s && this.storage.set({ quality: a });
2513
+ }
2514
+ }, get: function() {
2515
+ return this.media.quality;
2516
+ } }, { key: "loop", set: function(e) {
2517
+ var n = r.boolean(e) ? e : this.config.loop.active;
2518
+ this.config.loop.active = n, this.media.loop = n;
2519
+ }, get: function() {
2520
+ return !!this.media.loop;
2521
+ } }, { key: "source", set: function(e) {
2522
+ Le.change.call(this, e);
2523
+ }, get: function() {
2524
+ return this.media.currentSrc;
2525
+ } }, { key: "download", get: function() {
2526
+ var e = this.config.urls.download;
2527
+ return r.url(e) ? e : this.source;
2528
+ }, set: function(e) {
2529
+ r.url(e) && (this.config.urls.download = e, h.setDownloadUrl.call(this));
2530
+ } }, { key: "poster", set: function(e) {
2531
+ this.isVideo ? P.setPoster.call(this, e, !1).catch(function() {
2532
+ }) : this.debug.warn("Poster can only be set for video");
2533
+ }, get: function() {
2534
+ return this.isVideo ? this.media.getAttribute("poster") || this.media.getAttribute("data-poster") : null;
2535
+ } }, { key: "ratio", get: function() {
2536
+ if (!this.isVideo) return null;
2537
+ var e = ut(De.call(this));
2538
+ return r.array(e) ? e.join(":") : e;
2539
+ }, set: function(e) {
2540
+ this.isVideo ? r.string(e) && ct(e) ? (this.config.ratio = e, $.call(this)) : this.debug.error("Invalid aspect ratio specified (".concat(e, ")")) : this.debug.warn("Aspect ratio can only be set for video");
2541
+ } }, { key: "autoplay", set: function(e) {
2542
+ var n = r.boolean(e) ? e : this.config.autoplay;
2543
+ this.config.autoplay = n;
2544
+ }, get: function() {
2545
+ return !!this.config.autoplay;
2546
+ } }, { key: "currentTrack", set: function(e) {
2547
+ S.set.call(this, e, !1);
2548
+ }, get: function() {
2549
+ var e = this.captions, n = e.toggled, i = e.currentTrack;
2550
+ return n ? i : -1;
2551
+ } }, { key: "language", set: function(e) {
2552
+ S.setLanguage.call(this, e, !1);
2553
+ }, get: function() {
2554
+ return (S.getCurrentTrack.call(this) || {}).language;
2555
+ } }, { key: "pip", set: function(e) {
2556
+ if (M.pip) {
2557
+ var n = r.boolean(e) ? e : !this.pip;
2558
+ r.function(this.media.webkitSetPresentationMode) && this.media.webkitSetPresentationMode(n ? ke.active : ke.inactive), r.function(this.media.requestPictureInPicture) && (!this.pip && n ? this.media.requestPictureInPicture() : this.pip && !n && document.exitPictureInPicture());
2559
+ }
2560
+ }, get: function() {
2561
+ return M.pip ? r.empty(this.media.webkitPresentationMode) ? this.media === document.pictureInPictureElement : this.media.webkitPresentationMode === ke.active : null;
2562
+ } }], [{ key: "supported", value: function(e, n, i) {
2563
+ return M.check(e, n, i);
2564
+ } }, { key: "loadSprite", value: function(e, n) {
2565
+ return mt(e, n);
2566
+ } }, { key: "setup", value: function(e) {
2567
+ var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = null;
2568
+ return r.string(e) ? i = Array.from(document.querySelectorAll(e)) : r.nodeList(e) ? i = Array.from(e) : r.array(e) && (i = e.filter(r.element)), r.empty(i) ? null : i.map(function(a) {
2569
+ return new t(a, n);
2570
+ });
2571
+ } }]), t;
2572
+ }();
2573
+ Nn.defaults = Zt(yt);
2574
+ export {
2575
+ Nn as default
2576
+ };