@tidal-music/player
Version:
Player logic for TIDAL
1,259 lines (1,258 loc) • 1.05 MB
JavaScript
import { c as qM, g as XM } from "./_commonjsHelpers-DaMA6jEr.js";
import { e as Uo, p as Hl, l as ki, g as Fl, f as xh, s as Tr, h as dT, i as hT, m as jo, P as KM, d as pT, a as gT, c as WM, w as zM } from "./index-C6ZwgBzI.js";
import { B as YM, c as mT, m as $M } from "./basePlayer-DD7cIuDm.js";
var Eh = {};
/*
@license
Shaka Player
Copyright 2016 Google LLC
SPDX-License-Identifier: Apache-2.0
*/
var vT;
function JM() {
return vT || (vT = 1, function(ce) {
(function() {
var H = typeof window < "u" ? window : qM, z = {};
(function(j, Oe, Ke) {
var h;
function Rt(e) {
var t = 0;
return function() {
return t < e.length ? { done: !1, value: e[t++] } : { done: !0 };
};
}
var Pe = typeof Object.defineProperties == "function" ? Object.defineProperty : function(e, t, n) {
return e == Array.prototype || e == Object.prototype || (e[t] = n.value), e;
};
function Lt(e) {
e = [typeof globalThis == "object" && globalThis, e, typeof j == "object" && j, typeof self == "object" && self, typeof Oe == "object" && Oe];
for (var t = 0; t < e.length; ++t) {
var n = e[t];
if (n && n.Math == Math) return n;
}
throw Error("Cannot find global object");
}
var It = Lt(this);
function Ge(e, t) {
if (t) e: {
var n = It;
e = e.split(".");
for (var i = 0; i < e.length - 1; i++) {
var r = e[i];
if (!(r in n)) break e;
n = n[r];
}
e = e[e.length - 1], i = n[e], t = t(i), t != i && t != null && Pe(n, e, { configurable: !0, writable: !0, value: t });
}
}
Ge("Symbol", function(e) {
function t(o) {
if (this instanceof t) throw new TypeError("Symbol is not a constructor");
return new n(i + (o || "") + "_" + r++, o);
}
function n(o, s) {
this.g = o, Pe(this, "description", { configurable: !0, writable: !0, value: s });
}
if (e) return e;
n.prototype.toString = function() {
return this.g;
};
var i = "jscomp_symbol_" + (1e9 * Math.random() >>> 0) + "_", r = 0;
return t;
}), Ge("Symbol.iterator", function(e) {
if (e) return e;
e = Symbol("Symbol.iterator");
for (var t = "Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "), n = 0; n < t.length; n++) {
var i = It[t[n]];
typeof i == "function" && typeof i.prototype[e] != "function" && Pe(i.prototype, e, { configurable: !0, writable: !0, value: function() {
return Ah(Rt(this));
} });
}
return e;
});
function Ah(e) {
return e = { next: e }, e[Symbol.iterator] = function() {
return this;
}, e;
}
function g(e) {
var t = typeof Symbol < "u" && Symbol.iterator && e[Symbol.iterator];
if (t) return t.call(e);
if (typeof e.length == "number") return { next: Rt(e) };
throw Error(String(e) + " is not an iterable or ArrayLike");
}
function Y(e) {
if (!(e instanceof Array)) {
e = g(e);
for (var t, n = []; !(t = e.next()).done; ) n.push(t.value);
e = n;
}
return e;
}
var yT = typeof Object.create == "function" ? Object.create : function(e) {
function t() {
}
return t.prototype = e, new t();
}, Vl;
if (typeof Object.setPrototypeOf == "function") Vl = Object.setPrototypeOf;
else {
var Gl;
e: {
var TT = { a: !0 }, Ih = {};
try {
Ih.__proto__ = TT, Gl = Ih.a;
break e;
} catch {
}
Gl = !1;
}
Vl = Gl ? function(e, t) {
if (e.__proto__ = t, e.__proto__ !== t) throw new TypeError(e + " is not extensible");
return e;
} : null;
}
var Mh = Vl;
function wt(e, t) {
if (e.prototype = yT(t.prototype), e.prototype.constructor = e, Mh) Mh(e, t);
else for (var n in t) if (n != "prototype") if (Object.defineProperties) {
var i = Object.getOwnPropertyDescriptor(t, n);
i && Object.defineProperty(e, n, i);
} else e[n] = t[n];
e.gk = t.prototype;
}
function lu() {
this.o = !1, this.l = null, this.h = void 0, this.g = 1, this.j = this.m = 0, this.A = this.i = null;
}
function ql(e) {
if (e.o) throw new TypeError("Generator is already running");
e.o = !0;
}
lu.prototype.s = function(e) {
this.h = e;
};
function Xl(e, t) {
e.i = { pg: t, Bg: !0 }, e.g = e.m || e.j;
}
lu.prototype.return = function(e) {
this.i = { return: e }, this.g = this.j;
};
function T(e, t, n) {
return e.g = n, { value: t };
}
lu.prototype.u = function(e) {
this.g = e;
};
function V(e) {
e.g = 0;
}
function ue(e, t, n) {
e.m = t, n != null && (e.j = n);
}
function ni(e, t) {
e.m = 0, e.j = t || 0;
}
function fe(e, t, n) {
e.g = t, e.m = n || 0;
}
function ae(e, t) {
return e.m = t || 0, t = e.i.pg, e.i = null, t;
}
function Zt(e) {
e.A = [e.i], e.m = 0, e.j = 0;
}
function Qt(e, t) {
var n = e.A.splice(0)[0];
(n = e.i = e.i || n) ? n.Bg ? e.g = e.m || e.j : n.u != null && e.j < n.u ? (e.g = n.u, e.i = null) : e.g = e.j : e.g = t;
}
function ST(e) {
this.g = new lu(), this.h = e;
}
function wT(e, t) {
ql(e.g);
var n = e.g.l;
return n ? Kl(e, "return" in n ? n.return : function(i) {
return { value: i, done: !0 };
}, t, e.g.return) : (e.g.return(t), Oo(e));
}
function Kl(e, t, n, i) {
try {
var r = t.call(e.g.l, n);
if (!(r instanceof Object)) throw new TypeError("Iterator result " + r + " is not an object");
if (!r.done) return e.g.o = !1, r;
var o = r.value;
} catch (s) {
return e.g.l = null, Xl(e.g, s), Oo(e);
}
return e.g.l = null, i.call(e.g, o), Oo(e);
}
function Oo(e) {
for (; e.g.g; ) try {
var t = e.h(e.g);
if (t) return e.g.o = !1, { value: t.value, done: !1 };
} catch (n) {
e.g.h = void 0, Xl(e.g, n);
}
if (e.g.o = !1, e.g.i) {
if (t = e.g.i, e.g.i = null, t.Bg) throw t.pg;
return { value: t.return, done: !0 };
}
return { value: void 0, done: !0 };
}
function xT(e) {
this.next = function(t) {
return ql(e.g), e.g.l ? t = Kl(e, e.g.l.next, t, e.g.s) : (e.g.s(t), t = Oo(e)), t;
}, this.throw = function(t) {
return ql(e.g), e.g.l ? t = Kl(e, e.g.l.throw, t, e.g.s) : (Xl(e.g, t), t = Oo(e)), t;
}, this.return = function(t) {
return wT(e, t);
}, this[Symbol.iterator] = function() {
return this;
};
}
function ET(e) {
function t(i) {
return e.next(i);
}
function n(i) {
return e.throw(i);
}
return new Promise(function(i, r) {
function o(s) {
s.done ? i(s.value) : Promise.resolve(s.value).then(t, n).then(o, r);
}
o(e.next());
});
}
function D(e) {
return ET(new xT(new ST(e)));
}
function In() {
for (var e = Number(this), t = [], n = e; n < arguments.length; n++) t[n - e] = arguments[n];
return t;
}
Ge("Promise", function(e) {
function t(s) {
this.h = 0, this.i = void 0, this.g = [], this.o = !1;
var u = this.j();
try {
s(u.resolve, u.reject);
} catch (a) {
u.reject(a);
}
}
function n() {
this.g = null;
}
function i(s) {
return s instanceof t ? s : new t(function(u) {
u(s);
});
}
if (e) return e;
n.prototype.h = function(s) {
if (this.g == null) {
this.g = [];
var u = this;
this.i(function() {
u.l();
});
}
this.g.push(s);
};
var r = It.setTimeout;
n.prototype.i = function(s) {
r(s, 0);
}, n.prototype.l = function() {
for (; this.g && this.g.length; ) {
var s = this.g;
this.g = [];
for (var u = 0; u < s.length; ++u) {
var a = s[u];
s[u] = null;
try {
a();
} catch (l) {
this.j(l);
}
}
}
this.g = null;
}, n.prototype.j = function(s) {
this.i(function() {
throw s;
});
}, t.prototype.j = function() {
function s(l) {
return function(c) {
a || (a = !0, l.call(u, c));
};
}
var u = this, a = !1;
return { resolve: s(this.F), reject: s(this.l) };
}, t.prototype.F = function(s) {
if (s === this) this.l(new TypeError("A Promise cannot resolve to itself"));
else if (s instanceof t) this.H(s);
else {
e: switch (typeof s) {
case "object":
var u = s != null;
break e;
case "function":
u = !0;
break e;
default:
u = !1;
}
u ? this.C(s) : this.m(s);
}
}, t.prototype.C = function(s) {
var u = void 0;
try {
u = s.then;
} catch (a) {
this.l(a);
return;
}
typeof u == "function" ? this.J(u, s) : this.m(s);
}, t.prototype.l = function(s) {
this.s(2, s);
}, t.prototype.m = function(s) {
this.s(1, s);
}, t.prototype.s = function(s, u) {
if (this.h != 0) throw Error("Cannot settle(" + s + ", " + u + "): Promise already settled in state" + this.h);
this.h = s, this.i = u, this.h === 2 && this.G(), this.A();
}, t.prototype.G = function() {
var s = this;
r(function() {
if (s.B()) {
var u = It.console;
typeof u < "u" && u.error(s.i);
}
}, 1);
}, t.prototype.B = function() {
if (this.o) return !1;
var s = It.CustomEvent, u = It.Event, a = It.dispatchEvent;
return typeof a > "u" ? !0 : (typeof s == "function" ? s = new s("unhandledrejection", { cancelable: !0 }) : typeof u == "function" ? s = new u("unhandledrejection", { cancelable: !0 }) : (s = It.document.createEvent("CustomEvent"), s.initCustomEvent("unhandledrejection", !1, !0, s)), s.promise = this, s.reason = this.i, a(s));
}, t.prototype.A = function() {
if (this.g != null) {
for (var s = 0; s < this.g.length; ++s) o.h(this.g[s]);
this.g = null;
}
};
var o = new n();
return t.prototype.H = function(s) {
var u = this.j();
s.Bd(u.resolve, u.reject);
}, t.prototype.J = function(s, u) {
var a = this.j();
try {
s.call(u, a.resolve, a.reject);
} catch (l) {
a.reject(l);
}
}, t.prototype.then = function(s, u) {
function a(d, p) {
return typeof d == "function" ? function(m) {
try {
l(d(m));
} catch (v) {
c(v);
}
} : p;
}
var l, c, f = new t(function(d, p) {
l = d, c = p;
});
return this.Bd(a(s, l), a(u, c)), f;
}, t.prototype.catch = function(s) {
return this.then(void 0, s);
}, t.prototype.Bd = function(s, u) {
function a() {
switch (l.h) {
case 1:
s(l.i);
break;
case 2:
u(l.i);
break;
default:
throw Error("Unexpected state: " + l.h);
}
}
var l = this;
this.g == null ? o.h(a) : this.g.push(a), this.o = !0;
}, t.resolve = i, t.reject = function(s) {
return new t(function(u, a) {
a(s);
});
}, t.race = function(s) {
return new t(function(u, a) {
for (var l = g(s), c = l.next(); !c.done; c = l.next()) i(c.value).Bd(u, a);
});
}, t.all = function(s) {
var u = g(s), a = u.next();
return a.done ? i([]) : new t(function(l, c) {
function f(m) {
return function(v) {
d[m] = v, p--, p == 0 && l(d);
};
}
var d = [], p = 0;
do
d.push(void 0), p++, i(a.value).Bd(f(d.length - 1), c), a = u.next();
while (!a.done);
});
}, t;
});
function jn(e, t) {
return Object.prototype.hasOwnProperty.call(e, t);
}
Ge("WeakMap", function(e) {
function t(a) {
if (this.g = (u += Math.random() + 1).toString(), a) {
a = g(a);
for (var l; !(l = a.next()).done; ) l = l.value, this.set(l[0], l[1]);
}
}
function n() {
}
function i(a) {
var l = typeof a;
return l === "object" && a !== null || l === "function";
}
function r(a) {
if (!jn(a, s)) {
var l = new n();
Pe(a, s, { value: l });
}
}
function o(a) {
var l = Object[a];
l && (Object[a] = function(c) {
return c instanceof n ? c : (Object.isExtensible(c) && r(c), l(c));
});
}
if (function() {
if (!e || !Object.seal) return !1;
try {
var a = Object.seal({}), l = Object.seal({}), c = new e([[a, 2], [l, 3]]);
return c.get(a) != 2 || c.get(l) != 3 ? !1 : (c.delete(a), c.set(l, 4), !c.has(a) && c.get(l) == 4);
} catch {
return !1;
}
}()) return e;
var s = "$jscomp_hidden_" + Math.random();
o("freeze"), o("preventExtensions"), o("seal");
var u = 0;
return t.prototype.set = function(a, l) {
if (!i(a)) throw Error("Invalid WeakMap key");
if (r(a), !jn(a, s)) throw Error("WeakMap key fail: " + a);
return a[s][this.g] = l, this;
}, t.prototype.get = function(a) {
return i(a) && jn(a, s) ? a[s][this.g] : void 0;
}, t.prototype.has = function(a) {
return i(a) && jn(
a,
s
) && jn(a[s], this.g);
}, t.prototype.delete = function(a) {
return i(a) && jn(a, s) && jn(a[s], this.g) ? delete a[s][this.g] : !1;
}, t;
}), Ge("Map", function(e) {
function t() {
var u = {};
return u.Mb = u.next = u.head = u;
}
function n(u, a) {
var l = u[1];
return Ah(function() {
if (l) {
for (; l.head != u[1]; ) l = l.Mb;
for (; l.next != l.head; ) return l = l.next, { done: !1, value: a(l) };
l = null;
}
return { done: !0, value: void 0 };
});
}
function i(u, a) {
var l = a && typeof a;
l == "object" || l == "function" ? o.has(a) ? l = o.get(a) : (l = "" + ++s, o.set(a, l)) : l = "p_" + a;
var c = u[0][l];
if (c && jn(u[0], l)) for (u = 0; u < c.length; u++) {
var f = c[u];
if (a !== a && f.key !== f.key || a === f.key) return { id: l, list: c, index: u, entry: f };
}
return {
id: l,
list: c,
index: -1,
entry: void 0
};
}
function r(u) {
if (this[0] = {}, this[1] = t(), this.size = 0, u) {
u = g(u);
for (var a; !(a = u.next()).done; ) a = a.value, this.set(a[0], a[1]);
}
}
if (function() {
if (!e || typeof e != "function" || !e.prototype.entries || typeof Object.seal != "function") return !1;
try {
var u = Object.seal({ x: 4 }), a = new e(g([[u, "s"]]));
if (a.get(u) != "s" || a.size != 1 || a.get({ x: 4 }) || a.set({ x: 4 }, "t") != a || a.size != 2) return !1;
var l = a.entries(), c = l.next();
return c.done || c.value[0] != u || c.value[1] != "s" ? !1 : (c = l.next(), !(c.done || c.value[0].x != 4 || c.value[1] != "t" || !l.next().done));
} catch {
return !1;
}
}()) return e;
var o = /* @__PURE__ */ new WeakMap();
r.prototype.set = function(u, a) {
u = u === 0 ? 0 : u;
var l = i(this, u);
return l.list || (l.list = this[0][l.id] = []), l.entry ? l.entry.value = a : (l.entry = { next: this[1], Mb: this[1].Mb, head: this[1], key: u, value: a }, l.list.push(l.entry), this[1].Mb.next = l.entry, this[1].Mb = l.entry, this.size++), this;
}, r.prototype.delete = function(u) {
return u = i(this, u), u.entry && u.list ? (u.list.splice(u.index, 1), u.list.length || delete this[0][u.id], u.entry.Mb.next = u.entry.next, u.entry.next.Mb = u.entry.Mb, u.entry.head = null, this.size--, !0) : !1;
}, r.prototype.clear = function() {
this[0] = {}, this[1] = this[1].Mb = t(), this.size = 0;
}, r.prototype.has = function(u) {
return !!i(this, u).entry;
}, r.prototype.get = function(u) {
return (u = i(this, u).entry) && u.value;
}, r.prototype.entries = function() {
return n(this, function(u) {
return [u.key, u.value];
});
}, r.prototype.keys = function() {
return n(this, function(u) {
return u.key;
});
}, r.prototype.values = function() {
return n(this, function(u) {
return u.value;
});
}, r.prototype.forEach = function(u, a) {
for (var l = this.entries(), c; !(c = l.next()).done; ) c = c.value, u.call(a, c[1], c[0], this);
}, r.prototype[Symbol.iterator] = r.prototype.entries;
var s = 0;
return r;
}), Ge("Set", function(e) {
function t(n) {
if (this.g = /* @__PURE__ */ new Map(), n) {
n = g(n);
for (var i; !(i = n.next()).done; ) this.add(i.value);
}
this.size = this.g.size;
}
return function() {
if (!e || typeof e != "function" || !e.prototype.entries || typeof Object.seal != "function") return !1;
try {
var n = Object.seal({ x: 4 }), i = new e(g([n]));
if (!i.has(n) || i.size != 1 || i.add(n) != i || i.size != 1 || i.add({ x: 4 }) != i || i.size != 2) return !1;
var r = i.entries(), o = r.next();
return o.done || o.value[0] != n || o.value[1] != n ? !1 : (o = r.next(), o.done || o.value[0] == n || o.value[0].x != 4 || o.value[1] != o.value[0] ? !1 : r.next().done);
} catch {
return !1;
}
}() ? e : (t.prototype.add = function(n) {
return n = n === 0 ? 0 : n, this.g.set(n, n), this.size = this.g.size, this;
}, t.prototype.delete = function(n) {
return n = this.g.delete(n), this.size = this.g.size, n;
}, t.prototype.clear = function() {
this.g.clear(), this.size = 0;
}, t.prototype.has = function(n) {
return this.g.has(n);
}, t.prototype.entries = function() {
return this.g.entries();
}, t.prototype.values = function() {
return this.g.values();
}, t.prototype.keys = t.prototype.values, t.prototype[Symbol.iterator] = t.prototype.values, t.prototype.forEach = function(n, i) {
var r = this;
this.g.forEach(function(o) {
return n.call(i, o, o, r);
});
}, t);
});
function Wl(e, t) {
e instanceof String && (e += "");
var n = 0, i = !1, r = { next: function() {
if (!i && n < e.length) {
var o = n++;
return { value: t(o, e[o]), done: !1 };
}
return i = !0, { done: !0, value: void 0 };
} };
return r[Symbol.iterator] = function() {
return r;
}, r;
}
Ge("Array.prototype.keys", function(e) {
return e || function() {
return Wl(this, function(t) {
return t;
});
};
});
function Ch(e, t, n) {
e instanceof String && (e = String(e));
for (var i = e.length, r = 0; r < i; r++) {
var o = e[r];
if (t.call(n, o, r, e)) return { zg: r, v: o };
}
return { zg: -1, v: void 0 };
}
Ge("Array.prototype.findIndex", function(e) {
return e || function(t, n) {
return Ch(this, t, n).zg;
};
}), Ge("Array.from", function(e) {
return e || function(t, n, i) {
n = n ?? function(u) {
return u;
};
var r = [], o = typeof Symbol < "u" && Symbol.iterator && t[Symbol.iterator];
if (typeof o == "function") {
t = o.call(t);
for (var s = 0; !(o = t.next()).done; ) r.push(n.call(i, o.value, s++));
} else for (o = t.length, s = 0; s < o; s++) r.push(n.call(i, t[s], s));
return r;
};
}), Ge("Array.prototype.values", function(e) {
return e || function() {
return Wl(this, function(t, n) {
return n;
});
};
}), Ge("Object.is", function(e) {
return e || function(t, n) {
return t === n ? t !== 0 || 1 / t === 1 / n : t !== t && n !== n;
};
}), Ge("Array.prototype.includes", function(e) {
return e || function(t, n) {
var i = this;
i instanceof String && (i = String(i));
var r = i.length;
for (n = n || 0, 0 > n && (n = Math.max(n + r, 0)); n < r; n++) {
var o = i[n];
if (o === t || Object.is(o, t)) return !0;
}
return !1;
};
});
function cu(e, t, n) {
if (e == null) throw new TypeError("The 'this' value for String.prototype." + n + " must not be null or undefined");
if (t instanceof RegExp) throw new TypeError("First argument to String.prototype." + n + " must not be a regular expression");
return e + "";
}
Ge("String.prototype.includes", function(e) {
return e || function(t, n) {
return cu(this, t, "includes").indexOf(t, n || 0) !== -1;
};
}), Ge("String.fromCodePoint", function(e) {
return e || function(t) {
for (var n = "", i = 0; i < arguments.length; i++) {
var r = Number(arguments[i]);
if (0 > r || 1114111 < r || r !== Math.floor(r)) throw new RangeError("invalid_code_point " + r);
65535 >= r ? n += String.fromCharCode(r) : (r -= 65536, n += String.fromCharCode(r >>> 10 & 1023 | 55296), n += String.fromCharCode(r & 1023 | 56320));
}
return n;
};
}), Ge("WeakSet", function(e) {
function t(n) {
if (this.g = /* @__PURE__ */ new WeakMap(), n) {
n = g(n);
for (var i; !(i = n.next()).done; ) this.add(i.value);
}
}
return function() {
if (!e || !Object.seal) return !1;
try {
var n = Object.seal({}), i = Object.seal({}), r = new e([n]);
return !r.has(n) || r.has(i) ? !1 : (r.delete(n), r.add(i), !r.has(n) && r.has(i));
} catch {
return !1;
}
}() ? e : (t.prototype.add = function(n) {
return this.g.set(n, !0), this;
}, t.prototype.has = function(n) {
return this.g.has(n);
}, t.prototype.delete = function(n) {
return this.g.delete(n);
}, t);
}), Ge("Array.prototype.find", function(e) {
return e || function(t, n) {
return Ch(this, t, n).v;
};
}), Ge("String.prototype.startsWith", function(e) {
return e || function(t, n) {
var i = cu(this, t, "startsWith"), r = i.length, o = t.length;
n = Math.max(0, Math.min(n | 0, i.length));
for (var s = 0; s < o && n < r; ) if (i[n++] != t[s++]) return !1;
return s >= o;
};
}), Ge("Object.entries", function(e) {
return e || function(t) {
var n = [], i;
for (i in t) jn(t, i) && n.push([i, t[i]]);
return n;
};
});
var AT = typeof Object.assign == "function" ? Object.assign : function(e, t) {
for (var n = 1; n < arguments.length; n++) {
var i = arguments[n];
if (i) for (var r in i) jn(i, r) && (e[r] = i[r]);
}
return e;
};
Ge("Object.assign", function(e) {
return e || AT;
}), Ge("Promise.prototype.finally", function(e) {
return e || function(t) {
return this.then(function(n) {
return Promise.resolve(t()).then(function() {
return n;
});
}, function(n) {
return Promise.resolve(t()).then(function() {
throw n;
});
});
};
}), Ge("Array.prototype.entries", function(e) {
return e || function() {
return Wl(this, function(t, n) {
return [t, n];
});
};
}), Ge("Number.isNaN", function(e) {
return e || function(t) {
return typeof t == "number" && isNaN(t);
};
}), Ge("String.prototype.repeat", function(e) {
return e || function(t) {
var n = cu(this, null, "repeat");
if (0 > t || 1342177279 < t) throw new RangeError("Invalid count value");
t |= 0;
for (var i = ""; t; ) t & 1 && (i += n), (t >>>= 1) && (n += n);
return i;
};
}), Ge("Number.isFinite", function(e) {
return e || function(t) {
return typeof t != "number" ? !1 : !isNaN(t) && t !== 1 / 0 && t !== -1 / 0;
};
}), Ge("Object.values", function(e) {
return e || function(t) {
var n = [], i;
for (i in t) jn(t, i) && n.push(t[i]);
return n;
};
}), Ge("Math.log2", function(e) {
return e || function(t) {
return Math.log(t) / Math.LN2;
};
}), Ge("Number.MAX_SAFE_INTEGER", function() {
return 9007199254740991;
}), Ge("String.prototype.endsWith", function(e) {
return e || function(t, n) {
var i = cu(this, t, "endsWith");
n === void 0 && (n = i.length), n = Math.max(0, Math.min(n | 0, i.length));
for (var r = t.length; 0 < r && 0 < n; ) if (i[--n] != t[--r]) return !1;
return 0 >= r;
};
}), Ge("Math.trunc", function(e) {
return e || function(t) {
if (t = Number(t), isNaN(t) || t === 1 / 0 || t === -1 / 0 || t === 0) return t;
var n = Math.floor(Math.abs(t));
return 0 > t ? -n : n;
};
});
var IT = this || self;
function K(e, t) {
e = e.split(".");
var n = IT;
e[0] in n || typeof n.execScript > "u" || n.execScript("var " + e[0]);
for (var i; e.length && (i = e.shift()); ) e.length || t === void 0 ? n[i] && n[i] !== Object.prototype[i] ? n = n[i] : n = n[i] = {} : n[i] = t;
}
function MT() {
}
function CT() {
}
function wr(e) {
this.g = Math.exp(Math.log(0.5) / e), this.i = this.h = 0;
}
wr.prototype.sample = function(e, t) {
var n = Math.pow(this.g, e);
t = t * (1 - n) + n * this.h, isNaN(t) || (this.h = t, this.i += e);
};
function fu(e) {
return e.h / (1 - Math.pow(e.g, e.i));
}
function bo() {
this.h = new wr(2), this.j = new wr(5), this.g = 0, this.i = 128e3, this.l = 16e3;
}
bo.prototype.configure = function(e) {
this.i = e.minTotalBytes, this.l = e.minBytes, this.h.g = Math.exp(Math.log(0.5) / e.fastHalfLife), this.j.g = Math.exp(Math.log(0.5) / e.slowHalfLife);
}, bo.prototype.sample = function(e, t) {
if (!(t < this.l)) {
var n = 8e3 * t / e;
e /= 1e3, this.g += t, this.h.sample(e, n), this.j.sample(e, n);
}
}, bo.prototype.getBandwidthEstimate = function(e) {
return this.g < this.i ? e : Math.min(fu(this.h), fu(this.j));
};
function kT() {
}
function ii() {
}
function Te() {
}
function Wi(e) {
var t = In.apply(1, arguments);
kh.has(e) || (kh.add(e), Te.apply(kT, Y(t)));
}
function DT() {
}
function gC() {
}
function mC() {
}
var kh = /* @__PURE__ */ new Set();
j.console && (Te = function() {
return console.warn.apply(console, Y(In.apply(0, arguments)));
}, ii = function() {
console.error.apply(console, Y(In.apply(0, arguments)));
});
function du() {
this.g = {};
}
h = du.prototype, h.push = function(e, t) {
this.g.hasOwnProperty(e) ? this.g[e].push(t) : this.g[e] = [t];
}, h.get = function(e) {
return (e = this.g[e]) ? e.slice() : null;
}, h.remove = function(e, t) {
e in this.g && (this.g[e] = this.g[e].filter(function(n) {
return n != t;
}), this.g[e].length == 0 && delete this.g[e]);
}, h.forEach = function(e) {
for (var t in this.g) e(t, this.g[t]);
}, h.size = function() {
return Object.keys(this.g).length;
}, h.keys = function() {
return Object.keys(this.g);
};
function Ce() {
this.g = new du();
}
h = Ce.prototype, h.release = function() {
this.Qa(), this.g = null;
}, h.D = function(e, t, n, i) {
this.g && (e = new Dh(e, t, n, i), this.g.push(t, e));
}, h.oa = function(e, t, n, i) {
function r(s) {
o.$a(e, t, r), n(s);
}
var o = this;
this.D(e, t, r, i);
}, h.$a = function(e, t, n) {
if (this.g) {
var i = this.g.get(t) || [];
i = g(i);
for (var r = i.next(); !r.done; r = i.next()) r = r.value, r.target != e || n != r.listener && n || (r.$a(), this.g.remove(t, r));
}
}, h.Qa = function() {
if (this.g) {
var e = this.g, t = [], n;
for (n in e.g) t.push.apply(t, Y(e.g[n]));
for (e = g(t), t = e.next(); !t.done; t = e.next()) t.value.$a();
this.g.g = {};
}
}, K("shaka.util.EventManager", Ce), Ce.prototype.removeAll = Ce.prototype.Qa, Ce.prototype.unlisten = Ce.prototype.$a, Ce.prototype.listenOnce = Ce.prototype.oa, Ce.prototype.listen = Ce.prototype.D, Ce.prototype.release = Ce.prototype.release;
function Dh(e, t, n, i) {
this.target = e, this.type = t, this.listener = n, this.g = PT(e, i), this.target.addEventListener(t, n, this.g);
}
Dh.prototype.$a = function() {
this.target.removeEventListener(this.type, this.listener, this.g), this.listener = this.target = null, this.g = !1;
};
function PT(e, t) {
if (t == null) return !1;
if (typeof t == "boolean") return t;
var n = /* @__PURE__ */ new Set(["passive", "capture"]);
return Object.keys(t).filter(function(i) {
return !n.has(i);
}), RT(e) ? t : t.capture || !1;
}
function RT(e) {
var t = Ph;
if (t == null) {
t = !1;
try {
var n = {}, i = { get: function() {
return t = !0, !1;
} };
Object.defineProperty(n, "passive", i), Object.defineProperty(n, "capture", i), i = function() {
}, e.addEventListener("test", i, n), e.removeEventListener("test", i, n);
} catch {
t = !1;
}
Ph = t;
}
return t || !1;
}
var Ph = void 0;
function rt(e) {
if (hu.has(e)) return hu.get(e);
if (j.ManagedMediaSource) {
var t = ManagedMediaSource.isTypeSupported(e);
return hu.set(e, t), t;
}
return j.MediaSource ? (t = MediaSource.isTypeSupported(e), hu.set(e, t), t) : !1;
}
function zi() {
return !!j.SourceBuffer && !!SourceBuffer.prototype && !!SourceBuffer.prototype.changeType;
}
var hu = /* @__PURE__ */ new Map();
function zl(e, t) {
this.g = e, this.h = t;
}
zl.prototype.toString = function() {
return "v" + this.g + "." + this.h;
};
function We(e, t) {
var n = new zl(5, 0), i = Rh, r = i.g, o = n.h - r.h;
(0 < (n.g - r.g || o) ? i.i : i.h)(i.g, n, e, t);
}
function LT(e, t, n, i) {
Te([n, "has been deprecated and will be removed in", t, ". We are currently at version", e, ". Additional information:", i].join(" "));
}
function NT(e, t, n, i) {
ii([n, "has been deprecated and has been removed in", t, ". We are now at version", e, ". Additional information:", i].join(" "));
}
var Rh = null;
function Bo() {
}
Bo.prototype.extract = function() {
}, Bo.prototype.decode = function() {
return [];
}, Bo.prototype.clear = function() {
}, Bo.prototype.getStreams = function() {
return [];
};
function Yl() {
}
Yl.prototype.init = function() {
}, Yl.prototype.parse = function() {
return [];
};
function xr() {
}
function Di(e, t) {
if (!e && !t) return !0;
if (!e || !t || e.byteLength != t.byteLength) return !1;
if ($l(e) == $l(t) && (e.byteOffset || 0) == (t.byteOffset || 0)) return !0;
var n = le(e);
t = le(t);
for (var i = 0; i < e.byteLength; i++) if (n[i] != t[i]) return !1;
return !0;
}
function $l(e) {
return e instanceof ArrayBuffer ? e : e.buffer;
}
function dn(e) {
return e instanceof ArrayBuffer ? e : e.byteOffset == 0 && e.byteLength == e.buffer.byteLength ? e.buffer : new Uint8Array(e).buffer;
}
function le(e, t, n) {
return n = n === void 0 ? 1 / 0 : n, Jl(e, t === void 0 ? 0 : t, n, Uint8Array);
}
function Lh(e, t, n) {
return n = n === void 0 ? 1 / 0 : n, Jl(e, t === void 0 ? 0 : t, n, Uint16Array);
}
function Bt(e, t, n) {
return n = n === void 0 ? 1 / 0 : n, Jl(e, t === void 0 ? 0 : t, n, DataView);
}
function Jl(e, t, n, i) {
var r = $l(e), o = 1;
"BYTES_PER_ELEMENT" in i && (o = i.BYTES_PER_ELEMENT);
var s = ((e.byteOffset || 0) + e.byteLength) / o;
return e = Math.floor(Math.max(0, Math.min(((e.byteOffset || 0) + t) / o, s))), new i(r, e, Math.floor(Math.min(e + Math.max(n, 0), s)) - e);
}
K("shaka.util.BufferUtils", xr), xr.toDataView = Bt, xr.toUint16 = Lh, xr.toUint8 = le, xr.toArrayBuffer = dn, xr.equal = Di;
function Fo() {
}
Fo.prototype.init = function() {
}, Fo.prototype.i = function() {
}, Fo.prototype.g = function() {
}, Fo.prototype.j = function() {
}, K("shaka.media.IClosedCaptionParser", Fo);
function en(e) {
this.l = new Yl(), (e = Er[e.toLowerCase()]) && (this.l = e()), this.h = new Bo(), (e = Ar) && (this.h = e());
}
en.prototype.init = function(e, t) {
t !== void 0 && t || this.g(), this.l.init(e);
}, en.prototype.i = function(e) {
e = this.l.parse(e), e = g(e);
for (var t = e.next(); !t.done; t = e.next()) {
t = t.value;
var n = le(t.packet);
0 < n.length && this.h.extract(n, t.pts);
}
return this.h.decode();
}, en.prototype.g = function() {
this.h.clear();
}, en.prototype.j = function() {
return this.h.getStreams();
}, K("shaka.media.ClosedCaptionParser", en), en.findDecoder = function() {
return Ar;
}, en.unregisterDecoder = function() {
Ar = null;
}, en.registerDecoder = function(e) {
Ar = e;
}, en.findParser = function(e) {
return Er[e];
}, en.unregisterParser = function(e) {
delete Er[e];
}, en.registerParser = function(e, t) {
Er[e] = t;
};
var Er = {}, Ar = null;
function Yi() {
this.id = "", this.regionAnchorY = this.regionAnchorX = this.viewportAnchorY = this.viewportAnchorX = 0, this.height = this.width = 100, this.viewportAnchorUnits = this.widthUnits = this.heightUnits = Ft, this.scroll = Nh;
}
K("shaka.text.CueRegion", Yi);
var Ft = 1;
Yi.units = { PX: 0, PERCENTAGE: Ft, LINES: 2 };
var Nh = "";
Yi.scrollMode = { NONE: Nh, UP: "up" };
function jh(e, t) {
return typeof e == "number" && typeof t == "number" && isNaN(e) && isNaN(t) ? !0 : e === t;
}
function Un(e, t) {
t = e.indexOf(t), -1 < t && e.splice(t, 1);
}
function Uh(e, t, n) {
if (n || (n = jh), e.length != t.length) return !1;
t = t.slice(), e = g(e);
for (var i = e.next(), r = {}; !i.done; r = { Cg: void 0 }, i = e.next()) {
if (r.Cg = i.value, i = t.findIndex(/* @__PURE__ */ function(o) {
return function(s) {
return n(o.Cg, s);
};
}(r)), i == -1) return !1;
t[i] = t[t.length - 1], t.pop();
}
return t.length == 0;
}
function Ho(e, t, n) {
if (n || (n = jh), e.length != t.length) return !1;
for (var i = 0; i < e.length; i++) if (!n(e[i], t[i])) return !1;
return !0;
}
function k(e, t, n) {
var i = In.apply(3, arguments);
this.severity = e, this.category = t, this.code = n, this.data = i, this.handled = !1, this.message = "Shaka Error " + this.code;
try {
throw Error(this.message || "Shaka Error");
} catch (r) {
this.stack = r.stack;
}
}
k.prototype.toString = function() {
return "shaka.util.Error " + JSON.stringify(this, null, " ");
}, K("shaka.util.Error", k), k.Severity = { RECOVERABLE: 1, CRITICAL: 2 }, k.Category = { NETWORK: 1, TEXT: 2, MEDIA: 3, MANIFEST: 4, STREAMING: 5, DRM: 6, PLAYER: 7, CAST: 8, STORAGE: 9, ADS: 10 }, k.Code = {
UNSUPPORTED_SCHEME: 1e3,
BAD_HTTP_STATUS: 1001,
HTTP_ERROR: 1002,
TIMEOUT: 1003,
MALFORMED_DATA_URI: 1004,
REQUEST_FILTER_ERROR: 1006,
RESPONSE_FILTER_ERROR: 1007,
MALFORMED_TEST_URI: 1008,
UNEXPECTED_TEST_REQUEST: 1009,
ATTEMPTS_EXHAUSTED: 1010,
SEGMENT_MISSING: 1011,
INVALID_TEXT_HEADER: 2e3,
INVALID_TEXT_CUE: 2001,
UNABLE_TO_DETECT_ENCODING: 2003,
BAD_ENCODING: 2004,
INVALID_XML: 2005,
INVALID_MP4_TTML: 2007,
INVALID_MP4_VTT: 2008,
UNABLE_TO_EXTRACT_CUE_START_TIME: 2009,
INVALID_MP4_CEA: 2010,
TEXT_COULD_NOT_GUESS_MIME_TYPE: 2011,
CANNOT_ADD_EXTERNAL_TEXT_TO_SRC_EQUALS: 2012,
TEXT_ONLY_WEBVTT_SRC_EQUALS: 2013,
MISSING_TEXT_PLUGIN: 2014,
CHAPTERS_TRACK_FAILED: 2015,
UNSUPPORTED_EXTERNAL_THUMBNAILS_URI: 2017,
BUFFER_READ_OUT_OF_BOUNDS: 3e3,
JS_INTEGER_OVERFLOW: 3001,
EBML_OVERFLOW: 3002,
EBML_BAD_FLOATING_POINT_SIZE: 3003,
MP4_SIDX_WRONG_BOX_TYPE: 3004,
MP4_SIDX_INVALID_TIMESCALE: 3005,
MP4_SIDX_TYPE_NOT_SUPPORTED: 3006,
WEBM_CUES_ELEMENT_MISSING: 3007,
WEBM_EBML_HEADER_ELEMENT_MISSING: 3008,
WEBM_SEGMENT_ELEMENT_MISSING: 3009,
WEBM_INFO_ELEMENT_MISSING: 3010,
WEBM_DURATION_ELEMENT_MISSING: 3011,
WEBM_CUE_TRACK_POSITIONS_ELEMENT_MISSING: 3012,
WEBM_CUE_TIME_ELEMENT_MISSING: 3013,
MEDIA_SOURCE_OPERATION_FAILED: 3014,
MEDIA_SOURCE_OPERATION_THREW: 3015,
VIDEO_ERROR: 3016,
QUOTA_EXCEEDED_ERROR: 3017,
TRANSMUXING_FAILED: 3018,
CONTENT_TRANSFORMATION_FAILED: 3019,
MSS_MISSING_DATA_FOR_TRANSMUXING: 3020,
MSS_TRANSMUXING_FAILED: 3022,
TRANSMUXING_NO_VIDEO_DATA: 3023,
UNABLE_TO_GUESS_MANIFEST_TYPE: 4e3,
DASH_INVALID_XML: 4001,
DASH_NO_SEGMENT_INFO: 4002,
DASH_EMPTY_ADAPTATION_SET: 4003,
DASH_EMPTY_PERIOD: 4004,
DASH_WEBM_MISSING_INIT: 4005,
DASH_UNSUPPORTED_CONTAINER: 4006,
DASH_PSSH_BAD_ENCODING: 4007,
DASH_NO_COMMON_KEY_SYSTEM: 4008,
DASH_MULTIPLE_KEY_IDS_NOT_SUPPORTED: 4009,
DASH_CONFLICTING_KEY_IDS: 4010,
RESTRICTIONS_CANNOT_BE_MET: 4012,
HLS_PLAYLIST_HEADER_MISSING: 4015,
INVALID_HLS_TAG: 4016,
HLS_INVALID_PLAYLIST_HIERARCHY: 4017,
DASH_DUPLICATE_REPRESENTATION_ID: 4018,
HLS_MULTIPLE_MEDIA_INIT_SECTIONS_FOUND: 4020,
HLS_REQUIRED_ATTRIBUTE_MISSING: 4023,
HLS_REQUIRED_TAG_MISSING: 4024,
HLS_COULD_NOT_GUESS_CODECS: 4025,
HLS_KEYFORMATS_NOT_SUPPORTED: 4026,
DASH_UNSUPPORTED_XLINK_ACTUATE: 4027,
DASH_XLINK_DEPTH_LIMIT: 4028,
CONTENT_UNSUPPORTED_BY_BROWSER: 4032,
CANNOT_ADD_EXTERNAL_TEXT_TO_LIVE_STREAM: 4033,
NO_VARIANTS: 4036,
PERIOD_FLATTENING_FAILED: 4037,
INCONSISTENT_DRM_ACROSS_PERIODS: 4038,
HLS_VARIABLE_NOT_FOUND: 4039,
HLS_MSE_ENCRYPTED_MP2T_NOT_SUPPORTED: 4040,
HLS_MSE_ENCRYPTED_LEGACY_APPLE_MEDIA_KEYS_NOT_SUPPORTED: 4041,
NO_WEB_CRYPTO_API: 4042,
CANNOT_ADD_EXTERNAL_THUMBNAILS_TO_LIVE_STREAM: 4045,
MSS_INVALID_XML: 4046,
MSS_LIVE_CONTENT_NOT_SUPPORTED: 4047,
AES_128_INVALID_IV_LENGTH: 4048,
AES_128_INVALID_KEY_LENGTH: 4049,
DASH_CONFLICTING_AES_128: 4050,
DASH_UNSUPPORTED_AES_128: 4051,
DASH_INVALID_PATCH: 4052,
HLS_EMPTY_MEDIA_PLAYLIST: 4053,
STREAMING_ENGINE_STARTUP_INVALID_STATE: 5006,
NO_RECOGNIZED_KEY_SYSTEMS: 6e3,
REQUESTED_KEY_SYSTEM_CONFIG_UNAVAILABLE: 6001,
FAILED_TO_CREATE_CDM: 6002,
FAILED_TO_ATTACH_TO_VIDEO: 6003,
INVALID_SERVER_CERTIFICATE: 6004,
FAILED_TO_CREATE_SESSION: 6005,
FAILED_TO_GENERATE_LICENSE_REQUEST: 6006,
LICENSE_REQUEST_FAILED: 6007,
LICENSE_RESPONSE_REJECTED: 6008,
ENCRYPTED_CONTENT_WITHOUT_DRM_INFO: 6010,
NO_LICENSE_SERVER_GIVEN: 6012,
OFFLINE_SESSION_REMOVED: 6013,
EXPIRED: 6014,
SERVER_CERTIFICATE_REQUIRED: 6015,
INIT_DATA_TRANSFORM_ERROR: 6016,
SERVER_CERTIFICATE_REQUEST_FAILED: 6017,
MIN_HDCP_VERSION_NOT_MATCH: 6018,
ERROR_CHECKING_HDCP_VERSION: 6019,
LOAD_INTERRUPTED: 7e3,
OPERATION_ABORTED: 7001,
NO_VIDEO_ELEMENT: 7002,
OBJECT_DESTROYED: 7003,
CONTENT_NOT_LOADED: 7004,
SRC_EQUALS_PRELOAD_NOT_SUPPORTED: 7005,
CAST_API_UNAVAILABLE: 8e3,
NO_CAST_RECEIVERS: 8001,
ALREADY_CASTING: 8002,
UNEXPECTED_CAST_ERROR: 8003,
CAST_CANCELED_BY_USER: 8004,
CAST_CONNECTION_TIMED_OUT: 8005,
CAST_RECEIVER_APP_UNAVAILABLE: 8006,
STORAGE_NOT_SUPPORTED: 9e3,
INDEXED_DB_ERROR: 9001,
DEPRECATED_OPERATION_ABORTED: 9002,
REQUESTED_ITEM_NOT_FOUND: 9003,
MALFORMED_OFFLINE_URI: 9004,
CANNOT_STORE_LIVE_OFFLINE: 9005,
NO_INIT_DATA_FOR_OFFLINE: 9007,
LOCAL_PLAYER_INSTANCE_REQUIRED: 9008,
NEW_KEY_OPERATION_NOT_SUPPORTED: 9011,
KEY_NOT_FOUND: 9012,
MISSING_STORAGE_CELL: 9013,
STORAGE_LIMIT_REACHED: 9014,
DOWNLOAD_SIZE_CALLBACK_ERROR: 9015,
MODIFY_OPERATION_NOT_SUPPORTED: 9016,
INDEXED_DB_INIT_TIMED_OUT: 9017,
CS_IMA_SDK_MISSING: 1e4,
CS_AD_MANAGER_NOT_INITIALIZED: 10001,
SS_IMA_SDK_MISSING: 10002,
SS_AD_MANAGER_NOT_INITIALIZED: 10003,
CURRENT_DAI_REQUEST_NOT_FINISHED: 10004,
MT_AD_MANAGER_NOT_INITIALIZED: 10005,
INTERSTITIAL_AD_MANAGER_NOT_INITIALIZED: 10006,
VAST_INVALID_XML: 4001
};
function Ir(e) {
this.h = e, this.g = void 0;
}
Ir.prototype.value = function() {
return this.g == null && (this.g = this.h()), this.g;
};
function _h(e, t) {
return e.length && t.length && e !== t ? 0 < Zl(e, t).length : !0;
}
function Zl(e, t) {
if (!e.length) return t;
if (!t.length) return e;
var n = [];
e = g(e);
for (var i = e.next(); !i.done; i = e.next()) {
i = i.value;
for (var r = g(t), o = r.next(); !o.done; o = r.next()) if (o = o.value, i.keySystem == o.keySystem) {
r = /* @__PURE__ */ new Map();
for (var s = g((i.initData || []).concat(o.initData || [])), u = s.next(); !u.done; u = s.next()) u = u.value, r.set(u.keyId, u);
r = Array.from(r.values()), s = i.keyIds && o.keyIds ? new Set([].concat(Y(i.keyIds), Y(o.keyIds))) : i.keyIds || o.keyIds, n.push({ keySystem: i.keySystem, licenseServerUri: i.licenseServerUri || o.licenseServerUri, distinctiveIdentifierRequired: i.distinctiveIdentifierRequired || o.distinctiveIdentifierRequired, persistentStateRequired: i.persistentStateRequired || o.persistentStateRequired, videoRobustness: i.videoRobustness || o.videoRobustness, audioRobustness: i.audioRobustness || o.audioRobustness, serverCertificate: i.serverCertificate || o.serverCertificate, serverCertificateUri: i.serverCertificateUri || o.serverCertificateUri, initData: r, keyIds: s });
break;
}
}
return n;
}
function Ql(e) {
return e ? !!e.match(/^com\.(microsoft|chromecast)\.playready/) : !1;
}
var pu = new Ir(function() {
return dn(new Uint8Array([0]));
}), gu = /* @__PURE__ */ new Map();
function Vo(e) {
this.h = e, this.g = null;
}
Vo.prototype.Z = function(e) {
var t = this;
this.stop();
var n = !0, i = null;
return this.g = function() {
j.clearTimeout(i), n = !1;
}, i = j.setTimeout(function() {
n && t.h();
}, 1e3 * e), this;
}, Vo.prototype.stop = function() {
this.g && (this.g(), this.g = null);
};
function he(e) {
this.h = e, this.g = null;
}
he.prototype.wc = function() {
return this.stop(), this.h(), this;
}, he.prototype.Z = function(e) {