@tidal-music/player
Version:
Player logic for TIDAL
1,234 lines • 1.15 MB
JavaScript
import { c as tk, g as nk } from "./_commonjsHelpers-DaMA6jEr.js";
import { e as ns, p as lc, l as Bi, g as ac, f as oh, s as Kr, h as eT, i as tT, m as ts, P as ik, d as nT, a as iT, c as rk, w as ok } from "./index-CDrZVEhq.js";
import { B as sk, c as rT, m as uk } from "./basePlayer-BZinBKOA.js";
var sh = {};
/*
@license
Shaka Player
Copyright 2016 Google LLC
SPDX-License-Identifier: Apache-2.0
*/
var oT;
function ak() {
return oT || (oT = 1, function(ve) {
(function() {
var H = typeof window < "u" ? window : tk, Y = {};
(function(_, We, Je) {
var h;
function Wt(e) {
var t = 0;
return function() {
return t < e.length ? { done: !1, value: e[t++] } : { done: !0 };
};
}
var Ve = typeof Object.defineProperties == "function" ? Object.defineProperty : function(e, t, n) {
return e == Array.prototype || e == Object.prototype || (e[t] = n.value), e;
};
function zt(e) {
e = [typeof globalThis == "object" && globalThis, e, typeof _ == "object" && _, typeof self == "object" && self, typeof We == "object" && We];
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 Bt = zt(this);
function Ye(e, t) {
if (t) e: {
var n = Bt;
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 && Ve(n, e, { configurable: !0, writable: !0, value: t });
}
}
Ye("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, Ve(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;
}), Ye("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 = Bt[t[n]];
typeof i == "function" && typeof i.prototype[e] != "function" && Ve(i.prototype, e, { configurable: !0, writable: !0, value: function() {
return uh(Wt(this));
} });
}
return e;
});
function uh(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: Wt(e) };
throw Error(String(e) + " is not an iterable or ArrayLike");
}
function X(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 sT = typeof Object.create == "function" ? Object.create : function(e) {
function t() {
}
return t.prototype = e, new t();
}, cc;
if (typeof Object.setPrototypeOf == "function") cc = Object.setPrototypeOf;
else {
var dc;
e: {
var uT = { a: !0 }, ah = {};
try {
ah.__proto__ = uT, dc = ah.a;
break e;
} catch {
}
dc = !1;
}
cc = dc ? function(e, t) {
if (e.__proto__ = t, e.__proto__ !== t) throw new TypeError(e + " is not extensible");
return e;
} : null;
}
var lh = cc;
function Mt(e, t) {
if (e.prototype = sT(t.prototype), e.prototype.constructor = e, lh) lh(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.Tk = t.prototype;
}
function Ru() {
this.o = !1, this.l = null, this.h = void 0, this.g = 1, this.j = this.m = 0, this.A = this.i = null;
}
function fc(e) {
if (e.o) throw new TypeError("Generator is already running");
e.o = !0;
}
Ru.prototype.u = function(e) {
this.h = e;
};
function pc(e, t) {
e.i = { Ng: t, Yg: !0 }, e.g = e.m || e.j;
}
Ru.prototype.return = function(e) {
this.i = { return: e }, this.g = this.j;
};
function S(e, t, n) {
return e.g = n, { value: t };
}
Ru.prototype.s = function(e) {
this.g = e;
};
function K(e) {
e.g = 0;
}
function le(e, t, n) {
e.m = t, n != null && (e.j = n);
}
function ci(e, t) {
e.m = 0, e.j = t || 0;
}
function ye(e, t, n) {
e.g = t, e.m = n || 0;
}
function ce(e, t) {
return e.m = t || 0, t = e.i.Ng, e.i = null, t;
}
function fn(e) {
e.A = [e.i], e.m = 0, e.j = 0;
}
function pn(e, t) {
var n = e.A.splice(0)[0];
(n = e.i = e.i || n) ? n.Yg ? e.g = e.m || e.j : n.s != null && e.j < n.s ? (e.g = n.s, e.i = null) : e.g = e.j : e.g = t;
}
function aT(e) {
this.g = new Ru(), this.h = e;
}
function lT(e, t) {
fc(e.g);
var n = e.g.l;
return n ? hc(e, "return" in n ? n.return : function(i) {
return { value: i, done: !0 };
}, t, e.g.return) : (e.g.return(t), rs(e));
}
function hc(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, pc(e.g, s), rs(e);
}
return e.g.l = null, i.call(e.g, o), rs(e);
}
function rs(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, pc(e.g, n);
}
if (e.g.o = !1, e.g.i) {
if (t = e.g.i, e.g.i = null, t.Yg) throw t.Ng;
return { value: t.return, done: !0 };
}
return { value: void 0, done: !0 };
}
function cT(e) {
this.next = function(t) {
return fc(e.g), e.g.l ? t = hc(e, e.g.l.next, t, e.g.u) : (e.g.u(t), t = rs(e)), t;
}, this.throw = function(t) {
return fc(e.g), e.g.l ? t = hc(e, e.g.l.throw, t, e.g.u) : (pc(e.g, t), t = rs(e)), t;
}, this.return = function(t) {
return lT(e, t);
}, this[Symbol.iterator] = function() {
return this;
};
}
function dT(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 P(e) {
return dT(new cT(new aT(e)));
}
function Ct() {
for (var e = Number(this), t = [], n = e; n < arguments.length; n++) t[n - e] = arguments[n];
return t;
}
Ye("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 = Bt.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.I(u, s) : this.m(s);
}, t.prototype.l = function(s) {
this.u(2, s);
}, t.prototype.m = function(s) {
this.u(1, s);
}, t.prototype.u = 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 = Bt.console;
typeof u < "u" && u.error(s.i);
}
}, 1);
}, t.prototype.B = function() {
if (this.o) return !1;
var s = Bt.CustomEvent, u = Bt.Event, a = Bt.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 = Bt.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.Td(u.resolve, u.reject);
}, t.prototype.I = 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(f, p) {
return typeof f == "function" ? function(m) {
try {
l(f(m));
} catch (y) {
c(y);
}
} : p;
}
var l, c, d = new t(function(f, p) {
l = f, c = p;
});
return this.Td(a(s, l), a(u, c)), d;
}, t.prototype.catch = function(s) {
return this.then(void 0, s);
}, t.prototype.Td = 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).Td(u, a);
});
}, t.all = function(s) {
var u = g(s), a = u.next();
return a.done ? i([]) : new t(function(l, c) {
function d(m) {
return function(y) {
f[m] = y, p--, p == 0 && l(f);
};
}
var f = [], p = 0;
do
f.push(void 0), p++, i(a.value).Td(d(f.length - 1), c), a = u.next();
while (!a.done);
});
}, t;
});
function Xn(e, t) {
return Object.prototype.hasOwnProperty.call(e, t);
}
Ye("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 (!Xn(a, s)) {
var l = new n();
Ve(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), !Xn(a, s)) throw Error("WeakMap key fail: " + a);
return a[s][this.g] = l, this;
}, t.prototype.get = function(a) {
return i(a) && Xn(a, s) ? a[s][this.g] : void 0;
}, t.prototype.has = function(a) {
return i(a) && Xn(
a,
s
) && Xn(a[s], this.g);
}, t.prototype.delete = function(a) {
return i(a) && Xn(a, s) && Xn(a[s], this.g) ? delete a[s][this.g] : !1;
}, t;
}), Ye("Map", function(e) {
function t() {
var u = {};
return u.Wb = u.next = u.head = u;
}
function n(u, a) {
var l = u[1];
return uh(function() {
if (l) {
for (; l.head != u[1]; ) l = l.Wb;
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 && Xn(u[0], l)) for (u = 0; u < c.length; u++) {
var d = c[u];
if (a !== a && d.key !== d.key || a === d.key) return { id: l, list: c, index: u, entry: d };
}
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], Wb: this[1].Wb, head: this[1], key: u, value: a }, l.list.push(l.entry), this[1].Wb.next = l.entry, this[1].Wb = 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.Wb.next = u.entry.next, u.entry.next.Wb = u.entry.Wb, u.entry.head = null, this.size--, !0) : !1;
}, r.prototype.clear = function() {
this[0] = {}, this[1] = this[1].Wb = 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;
}), Ye("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 gc(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;
}
Ye("Array.prototype.values", function(e) {
return e || function() {
return gc(this, function(t, n) {
return n;
});
};
}), Ye("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;
};
}), Ye("Array.prototype.keys", function(e) {
return e || function() {
return gc(this, function(t) {
return t;
});
};
}), Ye("Object.is", function(e) {
return e || function(t, n) {
return t === n ? t !== 0 || 1 / t === 1 / n : t !== t && n !== n;
};
}), Ye("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 Lu(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 + "";
}
Ye("String.prototype.includes", function(e) {
return e || function(t, n) {
return Lu(this, t, "includes").indexOf(t, n || 0) !== -1;
};
}), Ye("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;
};
});
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 { Wg: r, v: o };
}
return { Wg: -1, v: void 0 };
}
Ye("Array.prototype.findIndex", function(e) {
return e || function(t, n) {
return ch(this, t, n).Wg;
};
}), Ye("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);
}), Ye("Array.prototype.find", function(e) {
return e || function(t, n) {
return ch(this, t, n).v;
};
}), Ye("String.prototype.startsWith", function(e) {
return e || function(t, n) {
var i = Lu(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;
};
}), Ye("Object.entries", function(e) {
return e || function(t) {
var n = [], i;
for (i in t) Xn(t, i) && n.push([i, t[i]]);
return n;
};
});
var fT = 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) Xn(i, r) && (e[r] = i[r]);
}
return e;
};
Ye("Object.assign", function(e) {
return e || fT;
}), Ye("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;
});
});
};
}), Ye("Array.prototype.entries", function(e) {
return e || function() {
return gc(this, function(t, n) {
return [t, n];
});
};
}), Ye("Number.isNaN", function(e) {
return e || function(t) {
return typeof t == "number" && isNaN(t);
};
}), Ye("String.prototype.repeat", function(e) {
return e || function(t) {
var n = Lu(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;
};
}), Ye("Number.EPSILON", function() {
return Math.pow(2, -52);
}), Ye("Number.MAX_SAFE_INTEGER", function() {
return 9007199254740991;
}), Ye("Number.isFinite", function(e) {
return e || function(t) {
return typeof t != "number" ? !1 : !isNaN(t) && t !== 1 / 0 && t !== -1 / 0;
};
}), Ye("Object.values", function(e) {
return e || function(t) {
var n = [], i;
for (i in t) Xn(t, i) && n.push(t[i]);
return n;
};
}), Ye("Math.log2", function(e) {
return e || function(t) {
return Math.log(t) / Math.LN2;
};
}), Ye("String.prototype.endsWith", function(e) {
return e || function(t, n) {
var i = Lu(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;
};
}), Ye("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 pT = this || self;
function W(e, t) {
e = e.split(".");
var n = pT;
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 hT() {
}
function gT() {
}
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 Nu(e) {
return e.h / (1 - Math.pow(e.g, e.i));
}
function os() {
this.h = new Wr(2), this.j = new Wr(5), this.g = 0, this.i = 128e3, this.l = 16e3;
}
os.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);
}, os.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);
}
}, os.prototype.getBandwidthEstimate = function(e) {
return this.g < this.i ? e : Math.min(Nu(this.h), Nu(this.j));
};
function mT() {
}
function ei() {
}
function Me() {
}
function lr(e) {
var t = Ct.apply(1, arguments);
dh.has(e) || (dh.add(e), Me.apply(mT, X(t)));
}
function vT() {
}
function Mk() {
}
function Ck() {
}
var dh = /* @__PURE__ */ new Set();
_.console && ((/* @__PURE__ */ new Map()).set(1, function() {
return console.error.apply(console, X(Ct.apply(0, arguments)));
}).set(2, function() {
return console.warn.apply(console, X(Ct.apply(0, arguments)));
}).set(3, function() {
return console.info.apply(console, X(Ct.apply(0, arguments)));
}).set(4, function() {
return console.log.apply(console, X(Ct.apply(0, arguments)));
}).set(5, function() {
return console.debug.apply(console, X(Ct.apply(0, arguments)));
}).set(6, function() {
return console.debug.apply(console, X(Ct.apply(0, arguments)));
}), Me = function() {
return console.warn.apply(console, X(Ct.apply(0, arguments)));
}, ei = function() {
console.error.apply(console, X(Ct.apply(0, arguments)));
});
function ju() {
this.g = /* @__PURE__ */ new Map();
}
h = ju.prototype, h.push = function(e, t) {
this.g.has(e) ? this.g.get(e).push(t) : this.g.set(e, [t]);
}, h.get = function(e) {
return this.g.has(e) ? this.g.get(e).slice() : null;
}, h.remove = function(e, t) {
if (this.g.has(e)) {
var n = this.g.get(e).filter(function(i) {
return i != t;
});
this.g.set(e, n), n.length || this.g.delete(e);
}
}, h.forEach = function(e) {
this.g.forEach(function(t, n) {
e(n, t);
});
}, h.size = function() {
return this.g.size;
}, h.keys = function() {
return Array.from(this.g.keys());
};
function Ne() {
this.g = new ju();
}
h = Ne.prototype, h.release = function() {
this.Pa(), this.g = null;
}, h.D = function(e, t, n, i) {
this.g && (e = new fh(e, t, n, i), this.g.push(t, e));
}, h.qa = function(e, t, n, i) {
function r(s) {
o.Ia(e, t, r), n(s);
}
var o = this;
this.D(e, t, r, i);
}, h.Ia = 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.Ia(), this.g.remove(t, r));
}
}, h.Pa = function() {
if (this.g) {
for (var e = [], t = g(this.g.g.values()), n = t.next(); !n.done; n = t.next()) e.push.apply(e, X(n.value));
for (e = g(e), t = e.next(); !t.done; t = e.next()) t.value.Ia();
this.g.g.clear();
}
}, W("shaka.util.EventManager", Ne), Ne.prototype.removeAll = Ne.prototype.Pa, Ne.prototype.unlisten = Ne.prototype.Ia, Ne.prototype.listenOnce = Ne.prototype.qa, Ne.prototype.listen = Ne.prototype.D, Ne.prototype.release = Ne.prototype.release;
function fh(e, t, n, i) {
this.target = e, this.type = t, this.listener = n, this.g = yT(e, i), this.target.addEventListener(t, n, this.g);
}
fh.prototype.Ia = function() {
this.target.removeEventListener(this.type, this.listener, this.g), this.listener = this.target = null, this.g = !1;
};
function yT(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);
}), ST(e) ? t : t.capture || !1;
}
function ST(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;
W("shaka.config.AutoShowText", { NEVER: 0, ALWAYS: 1, IF_PREFERRED_TEXT_LANGUAGE: 2, IF_SUBTITLES_MAY_BE_NEEDED: 3 });
function mc(e, t) {
this.g = e, this.h = t;
}
mc.prototype.toString = function() {
return "v" + this.g + "." + this.h;
};
function Pe(e, t) {
var n = new mc(5, 0), i = hh, r = i.g, o = n.h - r.h;
(0 < (n.g - r.g || o) ? i.i : i.h)(i.g, n, e, t);
}
function TT(e, t, n, i) {
Me([n, "has been deprecated and will be removed in", t, ". We are currently at version", e, ". Additional information:", i].join(" "));
}
function xT(e, t, n, i) {
ei([n, "has been deprecated and has been removed in", t, ". We are now at version", e, ". Additional information:", i].join(" "));
}
var hh = null;
/*
@license
Copyright 2008 The Closure Library Authors
SPDX-License-Identifier: Apache-2.0
*/
var wT = RegExp("^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#(.*))?$");
/*
@license
Copyright 2006 The Closure Library Authors
SPDX-License-Identifier: Apache-2.0
*/
function it(e) {
var t;
e instanceof it ? (Uu(this, e.Ib), this.Fc = e.Fc, _u(this, e.lb), vc(this, e.Yc), this.Za = e.Za, cr(this, e.g.clone()), this.qc = e.qc) : e && (t = String(e).match(wT)) ? (Uu(this, t[1] || "", !0), this.Fc = zr(t[2] || ""), _u(this, t[3] || "", !0), vc(this, t[4]), this.Za = zr(t[5] || "", !0), cr(this, t[6] || "", !0), this.qc = zr(t[7] || "")) : this.g = new qr(null);
}
h = it.prototype, h.Ib = "", h.Fc = "", h.lb = "", h.Yc = null, h.Za = "", h.qc = "", h.toString = function() {
var e = [], t = this.Ib;
if (t && e.push(ss(t, gh, !0), ":"), t = this.lb) {
e.push("//");
var n = this.Fc;
n && e.push(ss(n, gh, !0), "@"), e.push(encodeURIComponent(t).replace(/%25([0-9a-fA-F]{2})/g, "%$1")), t = this.Yc, t != null && e.push(":", String(t));
}
return (t = this.Za) && (this.lb && t.charAt(0) != "/" && e.push("/"), e.push(ss(t, t.charAt(0) == "/" ? IT : AT, !0))), (t = this.g.toString()) && e.push("?", t), (t = this.qc) && e.push("#", ss(t, CT)), e.join("");
}, h.resolve = function(e) {
var t = this.clone();
t.Ib === "data" && (t = new it());
var n = !!e.Ib;
n ? Uu(t, e.Ib) : n = !!e.Fc, n ? t.Fc = e.Fc : n = !!e.lb, n ? _u(t, e.lb) : n = e.Yc != null;
var i = e.Za;
if (n) vc(t, e.Yc);
else if (n = !!e.Za) {
if (i.charAt(0) != "/") if (this.lb && !this.Za) i = "/" + i;
else {
var r = t.Za.lastIndexOf("/");
r != -1 && (i = t.Za.substr(0, r + 1) + i);
}
if (i == ".." || i == ".") i = "";
else if (i.indexOf("./") != -1 || i.indexOf("/.") != -1) {
r = i.lastIndexOf("/", 0) == 0, i = i.split("/");
for (var o = [], s = 0; s < i.length; ) {
var u = i[s++];
u == "." ? r && s == i.length && o.push("") : u == ".." ? ((1 < o.length || o.length == 1 && o[0] != "") && o.pop(), r && s == i.length && o.push("")) : (o.push(u), r = !0);
}
i = o.join("/");
}
}
return n ? t.Za = i : n = e.g.toString() !== "", n ? cr(t, e.g.clone()) : n = !!e.qc, n && (t.qc = e.qc), t;
}, h.clone = function() {
return new it(this);
};
function Uu(e, t, n) {
e.Ib = n ? zr(t, !0) : t, e.Ib && (e.Ib = e.Ib.replace(/:$/, ""));
}
function _u(e, t, n) {
e.lb = n ? zr(t, !0) : t;
}
function vc(e, t) {
if (t) {
if (t = Number(t), isNaN(t) || 0 > t) throw Error("Bad port number " + t);
e.Yc = t;
} else e.Yc = null;
}
function cr(e, t, n) {
t instanceof qr ? e.g = t : (n || (t = ss(t, MT)), e.g = new qr(t));
}
function zr(e, t) {
return e ? t ? decodeURI(e) : decodeURIComponent(e) : "";
}
function ss(e, t, n) {
return e != null ? (e = encodeURI(e).replace(t, ET), n && (e = e.replace(/%25([0-9a-fA-F]{2})/g, "%$1")), e) : null;
}
function ET(e) {
return e = e.charCodeAt(0), "%" + (e >> 4 & 15).toString(16) + (e & 15).toString(16);
}
var gh = /[#\/\?@]/g, AT = /[#\?:]/g, IT = /[#\?]/g, MT = /[#\?@]/g, CT = /#/g;
function qr(e) {
this.g = e || null;
}
function Ou(e) {
if (!e.Sa && (e.Sa = /* @__PURE__ */ new Map(), e.hd = 0, e.g)) for (var t = e.g.split("&"), n = 0; n < t.length; n++) {
var i = t[n].indexOf("="), r = null;
if (0 <= i) {
var o = t[n].substring(0, i);
r = t[n].substring(i + 1);
} else o = t[n];
o = decodeURIComponent(o.replace(/\+/g, " ")), r = r || "", e.add(o, decodeURIComponent(r.replace(/\+/g, " ")));
}
}
h = qr.prototype, h.Sa = null, h.hd = null;
function mh(e) {
return Ou(e), e.hd;
}
h.add = function(e, t) {
Ou(this), this.g = null;
var n = this.Sa.has(e) ? this.Sa.get(e) : null;
return n || this.Sa.set(e, n = []), n.push(t), this.hd++, this;
}, h.set = function(e, t) {
return Ou(this), this.g = null, this.Sa.has(e) ? this.Sa.set(e, [t]) : this.add(e, t), this;
}, h.get = function(e) {
return Ou(this), this.Sa.get(e) || [];
}, h.toString = function() {
if (this.g) return this.g;
if (!this.Sa || !this.Sa.size) return "";
for (var e = [], t = g(this.Sa.keys()), n = t.next(); !n.done; n = t.next()) {
var i = n.value;
n = encodeURIComponent(i), i = this.Sa.get(i);
for (var r = 0; r < i.length; r++) {
var o = n;
i[r] !== "" && (o += "=" + encodeURIComponent(i[r])), e.push(o);
}
}
return this.g = e.join("&");
}, h.clone = function() {
var e = new qr();
if (e.g = this.g, this.Sa) {
for (var t = /* @__PURE__ */ new Map(), n = g(this.Sa), i = n.next(); !i.done; i = n.next()) {
var r = g(i.value);
i = r.next().value, r = r.next().value, t.set(i, r.concat());
}
e.Sa = t, e.hd = this.hd;
}
return e;
};
function Yr() {
}
function di(e, t) {
if (!e && !t) return !0;
if (!e || !t || e.byteLength != t.byteLength) return !1;
if ((ArrayBuffer.isView(e) ? e.buffer : e) == (ArrayBuffer.isView(t) ? t.buffer : t) && (e.byteOffset || 0) == (t.byteOffset || 0)) return !0;
var n = ue(e);
t = ue(t);
for (var i = 0; i < e.byteLength; i++) if (n[i] != t[i]) return !1;
return !0;
}
function An(e) {
return ArrayBuffer.isView(e) ? e.byteOffset == 0 && e.byteLength == e.buffer.byteLength ? e.buffer : new Uint8Array(e).buffer : e;
}
function ue(e, t, n) {
return n = n === void 0 ? 1 / 0 : n, yc(e, t === void 0 ? 0 : t, n, Uint8Array);
}
function vh(e, t, n) {
return n = n === void 0 ? 1 / 0 : n, yc(e, t === void 0 ? 0 : t, n, Uint16Array);
}
function qt(e, t, n) {
return n = n === void 0 ? 1 / 0 : n, yc(e, t === void 0 ? 0 : t, n, DataView);
}
function yc(e, t, n, i) {
var r = ArrayBuffer.isView(e) ? e.buffer : 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);
}
W("shaka.util.BufferUtils", Yr), Yr.toDataView = qt, Yr.toUint16 = vh, Yr.toUint8 = ue, Yr.toArrayBuffer = An, Yr.equal = di;
function C(e, t, n) {
var i = Ct.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;
}
}
C.prototype.toString = function() {
return "shaka.util.Error " + JSON.stringify(this, null, " ");
}, W("shaka.util.Error", C), C.Severity = { RECOVERABLE: 1, CRITICAL: 2 }, C.Category = { NETWORK: 1, TEXT: 2, MEDIA: 3, MANIFEST: 4, STREAMING: 5, DRM: 6, PLAYER: 7, CAST: 8, STORAGE: 9, ADS: 10 }, C.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,
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,
STREAMING_NOT_ALLOWED: 3024,
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,
DASH_MSE_ENCRYPTED_LEGACY_APPLE_MEDIA_KEYS_NOT_SUPPORTED: 4054,
CANNOT_ADD_EXTERNAL_CHAPTERS_TO_LIVE_STREAM: 4054,
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,
MISSING_EME_SUPPORT: 6020,
LOAD_INTERRUPTED: 7e3,
OPERATION_ABORTED: 7001,
NO_VIDEO_ELEMENT: 7002,
OBJECT_DESTROYED: 7003,
CONTENT_NOT_LOADED: 7004,
SRC_EQUALS_PRELOAD_NOT_SUPPORTED: 7005,
PRELOAD_DESTROYED: 7006,
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_O