@kwai-video-team/kwai-player-web
Version:
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
30,203 lines • 1.58 MB
JavaScript
var tA = Object.defineProperty;
var pl = Object.getOwnPropertySymbols;
var iA = Object.prototype.hasOwnProperty, rA = Object.prototype.propertyIsEnumerable;
var _l = (e, r, n) => r in e ? tA(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, Al = (e, r) => {
for (var n in r || (r = {}))
iA.call(r, n) && _l(e, n, r[n]);
if (pl)
for (var n of pl(r))
rA.call(r, n) && _l(e, n, r[n]);
return e;
};
var fo = (e, r, n) => new Promise((o, s) => {
var p = (y) => {
try {
C(n.next(y));
} catch (x) {
s(x);
}
}, g = (y) => {
try {
C(n.throw(y));
} catch (x) {
s(x);
}
}, C = (y) => y.done ? o(y.value) : Promise.resolve(y.value).then(p, g);
C((n = n.apply(e, r)).next());
});
Number.isFinite || (Number.isFinite = (e) => typeof e == "number" && isFinite(e));
Array.prototype.find || (Array.prototype.find = function(e, r) {
if (this === null || this === void 0)
throw new TypeError("Array.prototype.find called on null or undefined");
if (typeof e != "function")
throw new TypeError("callback must be a function");
const n = Object(this), o = n.length >>> 0;
for (let s = 0; s < o; s++)
if (e.call(r, n[s], s, n))
return n[s];
});
Array.prototype.findIndex || (Array.prototype.findIndex = function(e, r) {
if (this === null || this === void 0)
throw new TypeError("Array.prototype.findIndex called on null or undefined");
if (typeof e != "function")
throw new TypeError("callback must be a function");
const n = Object(this), o = n.length >>> 0;
for (let s = 0; s < o; s++)
if (s in n && e.call(r, n[s], s, n))
return s;
return -1;
});
Array.prototype.fill || (Array.prototype.fill = function(e, r = 0, n = this.length) {
if (this === null || this === void 0)
throw new TypeError("Array.prototype.fill called on null or undefined");
const o = Object(this), s = o.length >>> 0, p = r >> 0, g = n >> 0, C = p < 0 ? Math.max(s + p, 0) : Math.min(p, s), y = g < 0 ? Math.max(s + g, 0) : Math.min(g, s);
for (let x = C; x < y; x++)
o[x] = e;
return o;
});
var nA = Object.defineProperty, aA = (e, r, n) => r in e ? nA(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, Au = (e, r, n) => (aA(e, typeof r != "symbol" ? r + "" : r, n), n), Bn = function(e) {
var r = {};
function n(o) {
if (r[o])
return r[o].exports;
var s = r[o] = { i: o, l: !1, exports: {} };
return e[o].call(s.exports, s, s.exports, n), s.l = !0, s.exports;
}
return n.m = e, n.c = r, n.d = function(o, s, p) {
n.o(o, s) || Object.defineProperty(o, s, { enumerable: !0, get: p });
}, n.r = function(o) {
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(o, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(o, "__esModule", { value: !0 });
}, n.t = function(o, s) {
if (1 & s && (o = n(o)), 8 & s || 4 & s && typeof o == "object" && o && o.__esModule)
return o;
var p = /* @__PURE__ */ Object.create(null);
if (n.r(p), Object.defineProperty(p, "default", { enumerable: !0, value: o }), 2 & s && typeof o != "string")
for (var g in o)
n.d(p, g, function(C) {
return o[C];
}.bind(null, g));
return p;
}, n.n = function(o) {
var s = o && o.__esModule ? function() {
return o.default;
} : function() {
return o;
};
return n.d(s, "a", s), s;
}, n.o = function(o, s) {
return Object.prototype.hasOwnProperty.call(o, s);
}, n.p = "", n(n.s = 8);
}([function(e, r, n) {
var o = n(5);
function s(p, g) {
for (var C = 0; C < g.length; C++) {
var y = g[C];
y.enumerable = y.enumerable || !1, y.configurable = !0, "value" in y && (y.writable = !0), Object.defineProperty(p, o(y.key), y);
}
}
e.exports = function(p, g, C) {
return g && s(p.prototype, g), C && s(p, C), Object.defineProperty(p, "prototype", { writable: !1 }), p;
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r) {
function n(o) {
return e.exports = n = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(s) {
return typeof s;
} : function(s) {
return s && typeof Symbol == "function" && s.constructor === Symbol && s !== Symbol.prototype ? "symbol" : typeof s;
}, e.exports.__esModule = !0, e.exports.default = e.exports, n(o);
}
e.exports = n, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r, n) {
var o = n(7)();
e.exports = o;
try {
regeneratorRuntime = o;
} catch (s) {
typeof globalThis == "object" ? globalThis.regeneratorRuntime = o : Function("r", "regeneratorRuntime = r")(o);
}
}, function(e, r) {
function n() {
return e.exports = n = Object.assign ? Object.assign.bind() : function(o) {
for (var s = 1; s < arguments.length; s++) {
var p = arguments[s];
for (var g in p)
Object.prototype.hasOwnProperty.call(p, g) && (o[g] = p[g]);
}
return o;
}, e.exports.__esModule = !0, e.exports.default = e.exports, n.apply(this, arguments);
}
e.exports = n, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r) {
function n(o, s, p, g, C, y, x) {
try {
var h = o[y](x), F = h.value;
} catch (I) {
return void p(I);
}
h.done ? s(F) : Promise.resolve(F).then(g, C);
}
e.exports = function(o) {
return function() {
var s = this, p = arguments;
return new Promise(function(g, C) {
var y = o.apply(s, p);
function x(F) {
n(y, g, C, x, h, "next", F);
}
function h(F) {
n(y, g, C, x, h, "throw", F);
}
x(void 0);
});
};
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r, n) {
var o = n(1).default, s = n(6);
e.exports = function(p) {
var g = s(p, "string");
return o(g) == "symbol" ? g : g + "";
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r, n) {
var o = n(1).default;
e.exports = function(s, p) {
if (o(s) != "object" || !s)
return s;
var g = s[Symbol.toPrimitive];
if (g !== void 0) {
var C = g.call(s, p || "default");
if (o(C) != "object")
return C;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (p === "string" ? String : Number)(s);
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r, n) {
var o = n(1).default;
function s() {
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
e.exports = s = function() {
return g;
}, e.exports.__esModule = !0, e.exports.default = e.exports;
var p, g = {}, C = Object.prototype, y = C.hasOwnProperty, x = Object.defineProperty || function(de, X, ge) {
de[X] = ge.value;
}, h = typeof Symbol == "function" ? Symbol : {}, F = h.iterator || "@@iterator", I = h.asyncIterator || "@@asyncIterator", T = h.toStringTag || "@@toStringTag";
function D(de, X, ge) {
return Object.defineProperty(de, X, { value: ge, enumerable: !0, configurable: !0, writable: !0 }), de[X];
}
try {
D({}, "");
} catch (de) {
D = function(X, ge, Pe) {
return X[ge] = Pe;
};
}
function W(de, X, ge, Pe) {
var ae = X && X.prototype instanceof J ? X : J, q = Object.create(ae.prototype), m = new Re(Pe || []);
return x(q, "_invoke", { value: L(de, ge, m) }), q;
}
function j(de, X, ge) {
try {
return { type: "normal", arg: de.call(X, ge) };
} catch (Pe) {
return { type: "throw", arg: Pe };
}
}
g.wrap = W;
var O = "suspendedStart", K = "executing", z = "completed", B = {};
function J() {
}
function be() {
}
function $() {
}
var ye = {};
D(ye, F, function() {
return this;
});
var Be = Object.getPrototypeOf, Ve = Be && Be(Be(Oe([])));
Ve && Ve !== C && y.call(Ve, F) && (ye = Ve);
var je = $.prototype = J.prototype = Object.create(ye);
function we(de) {
["next", "throw", "return"].forEach(function(X) {
D(de, X, function(ge) {
return this._invoke(X, ge);
});
});
}
function ue(de, X) {
function ge(ae, q, m, ve) {
var U = j(de[ae], de, q);
if (U.type !== "throw") {
var M = U.arg, ne = M.value;
return ne && o(ne) == "object" && y.call(ne, "__await") ? X.resolve(ne.__await).then(function(Le) {
ge("next", Le, m, ve);
}, function(Le) {
ge("throw", Le, m, ve);
}) : X.resolve(ne).then(function(Le) {
M.value = Le, m(M);
}, function(Le) {
return ge("throw", Le, m, ve);
});
}
ve(U.arg);
}
var Pe;
x(this, "_invoke", { value: function(ae, q) {
function m() {
return new X(function(ve, U) {
ge(ae, q, ve, U);
});
}
return Pe = Pe ? Pe.then(m, m) : m();
} });
}
function L(de, X, ge) {
var Pe = O;
return function(ae, q) {
if (Pe === K)
throw Error("Generator is already running");
if (Pe === z) {
if (ae === "throw")
throw q;
return { value: p, done: !0 };
}
for (ge.method = ae, ge.arg = q; ; ) {
var m = ge.delegate;
if (m) {
var ve = w(m, ge);
if (ve) {
if (ve === B)
continue;
return ve;
}
}
if (ge.method === "next")
ge.sent = ge._sent = ge.arg;
else if (ge.method === "throw") {
if (Pe === O)
throw Pe = z, ge.arg;
ge.dispatchException(ge.arg);
} else
ge.method === "return" && ge.abrupt("return", ge.arg);
Pe = K;
var U = j(de, X, ge);
if (U.type === "normal") {
if (Pe = ge.done ? z : "suspendedYield", U.arg === B)
continue;
return { value: U.arg, done: ge.done };
}
U.type === "throw" && (Pe = z, ge.method = "throw", ge.arg = U.arg);
}
};
}
function w(de, X) {
var ge = X.method, Pe = de.iterator[ge];
if (Pe === p)
return X.delegate = null, ge === "throw" && de.iterator.return && (X.method = "return", X.arg = p, w(de, X), X.method === "throw") || ge !== "return" && (X.method = "throw", X.arg = new TypeError("The iterator does not provide a '" + ge + "' method")), B;
var ae = j(Pe, de.iterator, X.arg);
if (ae.type === "throw")
return X.method = "throw", X.arg = ae.arg, X.delegate = null, B;
var q = ae.arg;
return q ? q.done ? (X[de.resultName] = q.value, X.next = de.nextLoc, X.method !== "return" && (X.method = "next", X.arg = p), X.delegate = null, B) : q : (X.method = "throw", X.arg = new TypeError("iterator result is not an object"), X.delegate = null, B);
}
function le(de) {
var X = { tryLoc: de[0] };
1 in de && (X.catchLoc = de[1]), 2 in de && (X.finallyLoc = de[2], X.afterLoc = de[3]), this.tryEntries.push(X);
}
function oe(de) {
var X = de.completion || {};
X.type = "normal", delete X.arg, de.completion = X;
}
function Re(de) {
this.tryEntries = [{ tryLoc: "root" }], de.forEach(le, this), this.reset(!0);
}
function Oe(de) {
if (de || de === "") {
var X = de[F];
if (X)
return X.call(de);
if (typeof de.next == "function")
return de;
if (!isNaN(de.length)) {
var ge = -1, Pe = function ae() {
for (; ++ge < de.length; )
if (y.call(de, ge))
return ae.value = de[ge], ae.done = !1, ae;
return ae.value = p, ae.done = !0, ae;
};
return Pe.next = Pe;
}
}
throw new TypeError(o(de) + " is not iterable");
}
return be.prototype = $, x(je, "constructor", { value: $, configurable: !0 }), x($, "constructor", { value: be, configurable: !0 }), be.displayName = D($, T, "GeneratorFunction"), g.isGeneratorFunction = function(de) {
var X = typeof de == "function" && de.constructor;
return !!X && (X === be || (X.displayName || X.name) === "GeneratorFunction");
}, g.mark = function(de) {
return Object.setPrototypeOf ? Object.setPrototypeOf(de, $) : (de.__proto__ = $, D(de, T, "GeneratorFunction")), de.prototype = Object.create(je), de;
}, g.awrap = function(de) {
return { __await: de };
}, we(ue.prototype), D(ue.prototype, I, function() {
return this;
}), g.AsyncIterator = ue, g.async = function(de, X, ge, Pe, ae) {
ae === void 0 && (ae = Promise);
var q = new ue(W(de, X, ge, Pe), ae);
return g.isGeneratorFunction(X) ? q : q.next().then(function(m) {
return m.done ? m.value : q.next();
});
}, we(je), D(je, T, "Generator"), D(je, F, function() {
return this;
}), D(je, "toString", function() {
return "[object Generator]";
}), g.keys = function(de) {
var X = Object(de), ge = [];
for (var Pe in X)
ge.push(Pe);
return ge.reverse(), function ae() {
for (; ge.length; ) {
var q = ge.pop();
if (q in X)
return ae.value = q, ae.done = !1, ae;
}
return ae.done = !0, ae;
};
}, g.values = Oe, Re.prototype = { constructor: Re, reset: function(de) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = p, this.done = !1, this.delegate = null, this.method = "next", this.arg = p, this.tryEntries.forEach(oe), !de)
for (var X in this)
X.charAt(0) === "t" && y.call(this, X) && !isNaN(+X.slice(1)) && (this[X] = p);
}, stop: function() {
this.done = !0;
var de = this.tryEntries[0].completion;
if (de.type === "throw")
throw de.arg;
return this.rval;
}, dispatchException: function(de) {
if (this.done)
throw de;
var X = this;
function ge(U, M) {
return q.type = "throw", q.arg = de, X.next = U, M && (X.method = "next", X.arg = p), !!M;
}
for (var Pe = this.tryEntries.length - 1; Pe >= 0; --Pe) {
var ae = this.tryEntries[Pe], q = ae.completion;
if (ae.tryLoc === "root")
return ge("end");
if (ae.tryLoc <= this.prev) {
var m = y.call(ae, "catchLoc"), ve = y.call(ae, "finallyLoc");
if (m && ve) {
if (this.prev < ae.catchLoc)
return ge(ae.catchLoc, !0);
if (this.prev < ae.finallyLoc)
return ge(ae.finallyLoc);
} else if (m) {
if (this.prev < ae.catchLoc)
return ge(ae.catchLoc, !0);
} else {
if (!ve)
throw Error("try statement without catch or finally");
if (this.prev < ae.finallyLoc)
return ge(ae.finallyLoc);
}
}
}
}, abrupt: function(de, X) {
for (var ge = this.tryEntries.length - 1; ge >= 0; --ge) {
var Pe = this.tryEntries[ge];
if (Pe.tryLoc <= this.prev && y.call(Pe, "finallyLoc") && this.prev < Pe.finallyLoc) {
var ae = Pe;
break;
}
}
ae && (de === "break" || de === "continue") && ae.tryLoc <= X && X <= ae.finallyLoc && (ae = null);
var q = ae ? ae.completion : {};
return q.type = de, q.arg = X, ae ? (this.method = "next", this.next = ae.finallyLoc, B) : this.complete(q);
}, complete: function(de, X) {
if (de.type === "throw")
throw de.arg;
return de.type === "break" || de.type === "continue" ? this.next = de.arg : de.type === "return" ? (this.rval = this.arg = de.arg, this.method = "return", this.next = "end") : de.type === "normal" && X && (this.next = X), B;
}, finish: function(de) {
for (var X = this.tryEntries.length - 1; X >= 0; --X) {
var ge = this.tryEntries[X];
if (ge.finallyLoc === de)
return this.complete(ge.completion, ge.afterLoc), oe(ge), B;
}
}, catch: function(de) {
for (var X = this.tryEntries.length - 1; X >= 0; --X) {
var ge = this.tryEntries[X];
if (ge.tryLoc === de) {
var Pe = ge.completion;
if (Pe.type === "throw") {
var ae = Pe.arg;
oe(ge);
}
return ae;
}
}
throw Error("illegal catch attempt");
}, delegateYield: function(de, X, ge) {
return this.delegate = { iterator: Oe(de), resultName: X, nextLoc: ge }, this.method === "next" && (this.arg = p), B;
} }, g;
}
e.exports = s, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r, n) {
n.r(r), n.d(r, "KwaiVideoLocalLog", function() {
return je;
}), n.d(r, "LogLevel", function() {
return I;
}), n.d(r, "DefaultLogger", function() {
return j;
}), n.d(r, "Logger", function() {
return W;
}), n.d(r, "printVersion", function() {
return y;
}), n.d(r, "DEFAULT_LOG_LEVEL", function() {
return T;
});
var o = n(0), s = n.n(o), p = n(3), g = n.n(p), C = { idbName: "kwai-video-local-log", idbMaxDataCount: 25e3, idbMaxFoldLog: 20, maxLogLen: 4096 };
function y(we, ue) {
console.log("%c " + we + " %c " + ue + " %c", "background:#35495e ; padding: 1px; border-radius: 4px 0 0 4px; color: #fff", "background:#ffa483 ; padding: 1px; border-radius: 0 4px 4px 0; color: #fff", "background:transparent");
}
var x = function() {
function we() {
this.timeout = 6048e5;
}
var ue = we.prototype;
return ue.write = function(L, w) {
if (we.available)
try {
localStorage.setItem(L, JSON.stringify({ value: w, time: Date.now() }));
} catch (le) {
}
}, ue.read = function(L, w) {
if (w === void 0 && (w = !0), we.available)
try {
var le = localStorage.getItem(L);
if (le) {
var oe = JSON.parse(le), Re = oe.value, Oe = oe.time, de = Oe === void 0 ? 0 : Oe;
if (!w || Date.now() - de < (typeof w == "number" ? w : this.timeout))
return Re;
}
} catch (X) {
}
}, s()(we, null, [{ key: "available", get: function() {
if (we._available === void 0)
try {
localStorage.setItem("alg", "test"), we._available = !0;
} catch (L) {
we._available = !1;
}
return we._available;
} }]);
}();
x._available = void 0;
var h, F = x, I = function(we) {
return we.NONE = "none", we.ERROR = "e", we.WARN = "w", we.INFO = "i", we.DEBUG = "d", we.VERBOSE = "v", we;
}({}), T = I.ERROR, D = ((h = {})[I.NONE] = { value: 1, str: "N" }, h[I.ERROR] = { value: 100, str: "E" }, h[I.WARN] = { value: 200, str: "W" }, h[I.INFO] = { value: 300, str: "I" }, h[I.DEBUG] = { value: 400, str: "D" }, h[I.VERBOSE] = { value: 500, str: "V" }, h), W = function() {
function we(L) {
if (this._name = "kwai-v", this._level = T, this._id = -1, this._output = void 0, this._workerTag = "main", typeof location < "u" && location.protocol === "blob:") {
var w, le = location.href.split("/"), oe = (w = le[le.length - 1]) == null ? void 0 : w.match(/(\w+)-/);
oe && (this._workerTag = L ? L + "-" + oe[1] : oe[1]);
} else
L && (this._workerTag = L);
}
we.loadLogLevel = function(L, w) {
if (w === void 0 && (w = !0), location.href) {
var le = new RegExp(L + "=([a-z]{1})"), oe = location.href.match(le);
if (oe && oe.length > 1) {
var Re = oe[1];
if (this._isValueInLevel(Re))
return Re;
}
}
var Oe = new F().read(L, w);
if (this._isValueInLevel(Oe))
return Oe;
}, we.saveLogLevel = function(L, w) {
this._isValueInLevel(w) && new F().write(L, w);
}, we._isValueInLevel = function(L) {
return Object.values(I).indexOf(L) !== -1;
};
var ue = we.prototype;
return ue.setOutput = function(L) {
return this._output = L, this;
}, ue.setLevel = function(L) {
return this._level = L, this;
}, ue.setId = function(L) {
return this._id = L, this;
}, ue.setName = function(L) {
return this._name = L, this;
}, ue.getLevel = function() {
return this._level;
}, ue.getOutput = function() {
return this._output;
}, ue.hasOutput = function() {
return !!this._output;
}, ue.e = function(L) {
if (this._isLevelEnabled(this._level, I.ERROR)) {
for (var w = arguments.length, le = new Array(w > 1 ? w - 1 : 0), oe = 1; oe < w; oe++)
le[oe - 1] = arguments[oe];
var Re = this._printLog(I.ERROR, L, le);
try {
var Oe;
(Oe = this._output) == null || Oe.e.apply(Oe, [Re].concat(le));
} catch (de) {
}
}
}, ue.w = function(L) {
if (this._isLevelEnabled(this._level, I.WARN)) {
for (var w = arguments.length, le = new Array(w > 1 ? w - 1 : 0), oe = 1; oe < w; oe++)
le[oe - 1] = arguments[oe];
var Re = this._printLog(I.WARN, L, le);
try {
var Oe;
(Oe = this._output) == null || Oe.w.apply(Oe, [Re].concat(le));
} catch (de) {
}
}
}, ue.i = function(L) {
if (this._isLevelEnabled(this._level, I.INFO)) {
for (var w = arguments.length, le = new Array(w > 1 ? w - 1 : 0), oe = 1; oe < w; oe++)
le[oe - 1] = arguments[oe];
var Re = this._printLog(I.INFO, L, le);
try {
var Oe;
(Oe = this._output) == null || Oe.i.apply(Oe, [Re].concat(le));
} catch (de) {
}
}
}, ue.d = function(L) {
if (this._isLevelEnabled(this._level, I.DEBUG)) {
for (var w = arguments.length, le = new Array(w > 1 ? w - 1 : 0), oe = 1; oe < w; oe++)
le[oe - 1] = arguments[oe];
var Re = this._printLog(I.DEBUG, L, le);
try {
var Oe;
(Oe = this._output) == null || Oe.d.apply(Oe, [Re].concat(le));
} catch (de) {
}
}
}, ue.v = function(L) {
if (this._isLevelEnabled(this._level, I.VERBOSE)) {
for (var w = arguments.length, le = new Array(w > 1 ? w - 1 : 0), oe = 1; oe < w; oe++)
le[oe - 1] = arguments[oe];
var Re = this._printLog(I.VERBOSE, L, le);
try {
var Oe;
(Oe = this._output) == null || Oe.v.apply(Oe, [Re].concat(le));
} catch (de) {
}
}
}, ue._isLevelEnabled = function(L, w) {
return D[L].value >= D[w].value;
}, ue._printLog = function(L, w, le) {
var oe, Re, Oe = typeof w;
if (Oe === "object")
w = ((Re = w) == null ? void 0 : Re.constructor.name) || "unknown";
else if (Oe === "function") {
var de;
w = ((de = Object.getOwnPropertyDescriptor(w, "name")) == null ? void 0 : de.value) || "unknown";
}
var X, ge, Pe = (((oe = D[L]) == null ? void 0 : oe.str) || "") + "|" + this._name + "[" + (typeof this._id == "function" ? this._id() : this._id) + "][" + this._workerTag + "]::" + w;
return L === I.ERROR ? (X = console).error.apply(X, [Pe].concat(le.slice(0))) : (ge = console).log.apply(ge, [Pe].concat(le.slice(0))), Pe;
}, we;
}(), j = new W(), O = function() {
return s()(function we(ue) {
this._logger = void 0, this._id = 0, this._config = C, this._id = we._id, we._id++, this._logger = new W().setId(this._id).setLevel(I.INFO), this._config = g()({}, C, ue);
}, [{ key: "config", get: function() {
return this._config;
} }, { key: "logger", get: function() {
return this._logger;
} }, { key: "id", get: function() {
return this._id;
} }], [{ key: "packName", get: function() {
return "ll_es";
} }, { key: "version", get: function() {
return "1.0.13";
} }, { key: "buildTime", get: function() {
return "Tue Oct 08 2024 17:18:49 GMT+0800 (中国标准时间)";
} }]);
}();
O._id = 0;
var K = n(4), z = n.n(K), B = n(2), J = n.n(B), be = function() {
function we(L, w, le, oe, Re) {
var Oe = this;
Re === void 0 && (Re = 1), this._logger = void 0, this._name = void 0, this._storeName = void 0, this._dbIndex = void 0, this._version = void 0, this._taskQueue = [], this._openReq = void 0, this._isTransactionActive = !1, this._runTaskQueue = function() {
for (; Oe._taskQueue.length; ) {
var de = Oe._taskQueue.shift();
de && Oe.run(de.task, de.mode);
}
}, this._logger = L, this._name = w, this._storeName = le, this._dbIndex = oe, this._version = Re;
}
var ue = we.prototype;
return ue.init = function() {
var L = this;
if (!this._openReq && indexedDB) {
var w = this._openReq = indexedDB.open(this._name, this._version);
this._logger.i("idb-wrapper", "open", w), w.onerror = function() {
L._logger.i("idb-wrapper", "open error.");
}, w.onsuccess = function() {
L._logger.i("idb-wrapper", "open success."), L._runTaskQueue();
}, w.onupgradeneeded = function() {
L._logger.i("idb-wrapper", "open upgradeneeded."), w.result.objectStoreNames.contains(L._storeName) && w.result.deleteObjectStore(L._storeName);
var le = w.result.createObjectStore(L._storeName, { keyPath: "id", autoIncrement: !0 });
L._dbIndex && L._dbIndex.forEach(function(oe) {
le.createIndex(oe.name, oe.keyPath, oe.option);
});
};
}
}, ue.run = function(L, w) {
if (w === void 0 && (w = "readwrite"), this.init(), this._openReq && this._openReq.readyState === "done" && !this._openReq.error)
return this._doTask(L, w);
this.state !== "error" && (this._taskQueue.push({ task: L, mode: w }), this._taskQueue.length > 1e3 && this._taskQueue.shift());
}, ue.close = function() {
var L = this;
this._logger.i("idb-wrapper", "close"), this._openReq && (this._openReq.readyState === "done" ? (this._openReq.result.close(), this._openReq = void 0) : this._openReq.onsuccess = function() {
L.close();
});
}, ue.destroy = function() {
this._logger.i("idb-wrapper", "destroy"), this.close(), this._taskQueue = [];
}, ue._doTask = function(L, w) {
var le = this;
if (w === void 0 && (w = "readwrite"), this._openReq && !this._openReq.error)
try {
this._isTransactionActive = !0;
var oe = this._openReq.result.transaction(this._storeName, w), Re = void 0;
oe.oncomplete = function() {
le._isTransactionActive = !1, L.callback && L.callback(Re), le._runTaskQueue();
}, oe.onabort = oe.onerror = function() {
le._isTransactionActive = !1, L.callback && L.callback(Re), le._runTaskQueue();
}, Re = L.exec(oe.objectStore(this._storeName));
} catch (Oe) {
}
else
L.callback && L.callback();
}, s()(we, [{ key: "isTransactionActive", get: function() {
return this._isTransactionActive;
} }, { key: "state", get: function() {
return this._openReq && this._openReq.readyState === "done" ? this._openReq.error ? "error" : "ready" : "idle";
} }]);
}(), $ = [{ name: "id", keyPath: "id", option: { unique: !0 } }], ye = [function() {
function we(L) {
this._ctx = void 0, this._idb = void 0, this._logCount = 0, this._saveCount = 0, this._reCountOnSaveCount = 100, this._reduceData = !1, this._ctx = L, this._idb = new be(L.logger, L.config.idbName, L.config.idbName, $), this._reCountOnSaveCount = Math.min(200, Math.max(50, Math.round(this._ctx.config.idbMaxDataCount / 10))), this._count();
}
we.isSupported = function() {
return typeof indexedDB < "u";
};
var ue = we.prototype;
return ue.saveLog = function(L) {
var w = this, le = { exec: function(oe) {
return oe.add({ value: L });
}, callback: function(oe) {
w._saveCount++, w._saveCount % w._reCountOnSaveCount == 0 && w._count(), oe != null && oe.error && w._ctx.logger.i("idb-backend", "save log err", oe.error);
} };
this._idb.run(le);
}, ue.exportLog = function() {
var L = z()(J.a.mark(function w() {
var le = this;
return J.a.wrap(function(oe) {
for (; ; )
switch (oe.prev = oe.next) {
case 0:
return oe.abrupt("return", new Promise(function(Re, Oe) {
le._ctx.logger.i("idb-backend", "export start");
var de = { exec: function(X) {
return X.getAll();
}, callback: function(X) {
Re(X === void 0 ? "" : le._mergeGetAll(X.result));
} };
le._idb.run(de, "readonly");
}));
case 1:
case "end":
return oe.stop();
}
}, w);
}));
return function() {
return L.apply(this, arguments);
};
}(), ue.destroy = function() {
this._idb.destroy();
}, ue.clean = function() {
this._idb.run({ exec: function(L) {
return L.clear();
} });
}, ue._count = function() {
var L = this, w = { exec: function(le) {
return le.count();
}, callback: function(le) {
le != null && le.error || le == null || !le.result || (L._ctx.logger.i("idb-backend", "count: " + le.result + " max: " + L._ctx.config.idbMaxDataCount), L._logCount = le.result, L._logCount >= L._ctx.config.idbMaxDataCount && !L._reduceData && L._deleteFromHead(L._logCount - Math.round(L._ctx.config.idbMaxDataCount / 2)));
} };
this._idb.run(w);
}, ue._deleteFromHead = function(L) {
var w = this;
this._ctx.logger.i("idb-backend", "delete from head"), this._reduceData = !0;
var le = { exec: function(oe) {
return oe.openCursor();
}, callback: function(oe) {
if (w._reduceData = !1, oe != null && oe.result) {
var Re = IDBKeyRange.bound(oe.result.key, oe.result.key + L, !1, !1), Oe = { exec: function(de) {
return w._ctx.logger.i("idb-backend", "del: " + Re.lower + "~" + Re.upper), de.delete(Re);
}, callback: function(de) {
w._ctx.logger.i("idb-backend", "del result: " + !(de == null || !de.error));
} };
w._idb.run(Oe);
}
} };
this._idb.run(le);
}, ue._mergeGetAll = function(L) {
return L.length ? L.reduce(function(w, le) {
return "" + w + le.value + `
`;
}, "") : "";
}, s()(we, [{ key: "isActive", get: function() {
return this._idb.state !== "error";
} }]);
}()];
function Be(we, ue, L) {
var w = /* @__PURE__ */ new Date();
typeof we != "string" && (we = we.toString());
var le = w.toLocaleString() + "." + w.getMilliseconds().toString().padStart(3, "0") + "|" + we + "|";
return ue.forEach(function(oe) {
le += typeof oe == "object" ? JSON.stringify(oe) + " " : oe + " ";
}), le.length > L ? le.substring(0, L) : le;
}
function Ve(we) {
return we.join(`
`);
}
var je = function() {
function we(L) {
var w = this;
this._ctx = void 0, this._backend = void 0, this._delayTimer = void 0, this._logCache = [], this._loggerForAdd = void 0, this._downloadHref = void 0, this._startDelay = function() {
w._delayTimer = setInterval(function() {
w._saveLog(!0);
}, 1e3);
}, this._stopDelay = function() {
w._delayTimer && (clearTimeout(w._delayTimer), w._delayTimer = void 0);
}, y("kwai-video-local-log", "1.0.13"), this._ctx = new O(L);
var le = function(oe) {
for (var Re = arguments.length, Oe = new Array(Re > 1 ? Re - 1 : 0), de = 1; de < Re; de++)
Oe[de - 1] = arguments[de];
w.addLog.apply(w, [oe].concat(Oe));
};
this._loggerForAdd = { e: le, w: le, i: le, d: le, v: le }, this._ctx.logger.setOutput(this._loggerForAdd), this._ctx.logger.i("kwai-video-local-log", "constructor", L, this._ctx.config), this._backend = function(oe) {
for (var Re = 0; Re < ye.length; Re++) {
var Oe = ye[Re];
if (Oe != null && Oe.isSupported())
return new Oe(oe);
}
}(this._ctx), this._backend && this._startDelay();
}
we.isSupported = function() {
return function() {
for (var L = 0; L < ye.length; L++) {
var w = ye[L];
if (w != null && w.isSupported())
return !0;
}
return !1;
}();
};
var ue = we.prototype;
return ue.addLog = function(L) {
for (var w = arguments.length, le = new Array(w > 1 ? w - 1 : 0), oe = 1; oe < w; oe++)
le[oe - 1] = arguments[oe];
this._logCache.push(Be(L, le, this._ctx.config.maxLogLen)), this._saveLog();
}, ue.cleanLog = function() {
var L;
this._ctx.logger.i("kwai-video-local-log", "clean"), (L = this._backend) == null || L.clean();
}, ue.exportLog = function() {
var L = this;
return this._ctx.logger.i("kwai-video-local-log", "export log"), new Promise(function(w, le) {
L._backend ? L._backend.exportLog().then(function(oe) {
w(Ve([oe].concat(L._logCache)));
}) : w("");
});
}, ue.downloadLog = function(L) {
var w = this;
this._ctx.logger.i("kwai-video-local-log", "download log: " + L), this._destroyDownloadHref(), this.exportLog().then(function(le) {
var oe = new Blob([le], { type: "text/plain" });
if (document) {
var Re = document.createElement("a");
w._downloadHref = Re.href = URL.createObjectURL(oe), Re.download = L || "Log_web_" + (/* @__PURE__ */ new Date()).toLocaleString() + ".log", document.body.appendChild(Re), Re.click(), Re.remove();
} else
console.log("无document,当前是否在worker中");
});
}, ue.destroy = function() {
var L;
this._destroyDownloadHref(), (L = this._backend) == null || L.destroy(), this._stopDelay();
}, ue.getLoggerForAdd = function() {
return this._loggerForAdd;
}, ue._destroyDownloadHref = function() {
try {
this._downloadHref && (URL.revokeObjectURL(this._downloadHref), this._downloadHref = void 0);
} catch (L) {
}
}, ue._saveLog = function(L) {
if (L === void 0 && (L = !1), this._backend && this._backend.isActive && (this._logCache.length >= this._ctx.config.idbMaxFoldLog || this._logCache.length > 0 && L)) {
var w = Ve(this._logCache);
this._logCache.splice(0, this._logCache.length), w && this._backend.saveLog(w);
}
}, s()(we, null, [{ key: "version", get: function() {
return "1.0.13";
} }]);
}();
r.default = je;
}]);
Bn === void 0 && console.error("esm-webpack-plugin: nothing exported!");
Bn.KwaiVideoLocalLog;
const vu = Bn.LogLevel, Ii = Bn.DefaultLogger, gu = Bn.Logger, sA = Bn.printVersion;
Bn.DEFAULT_LOG_LEVEL;
Bn.default;
var oA = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function cA(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var lc = { exports: {} }, ca = typeof Reflect == "object" ? Reflect : null, vl = ca && typeof ca.apply == "function" ? ca.apply : function(e, r, n) {
return Function.prototype.apply.call(e, r, n);
}, ds;
ca && typeof ca.ownKeys == "function" ? ds = ca.ownKeys : Object.getOwnPropertySymbols ? ds = function(e) {
return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e));
} : ds = function(e) {
return Object.getOwnPropertyNames(e);
};
function lA(e) {
console && console.warn && console.warn(e);
}
var mu = Number.isNaN || function(e) {
return e !== e;
};
function qt() {
qt.init.call(this);
}
lc.exports = qt;
lc.exports.once = fA;
qt.EventEmitter = qt;
qt.prototype._events = void 0;
qt.prototype._eventsCount = 0;
qt.prototype._maxListeners = void 0;
var gl = 10;
function Ns(e) {
if (typeof e != "function")
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof e);
}
Object.defineProperty(qt, "defaultMaxListeners", {
enumerable: !0,
get: function() {
return gl;
},
set: function(e) {
if (typeof e != "number" || e < 0 || mu(e))
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + e + ".");
gl = e;
}
});
qt.init = function() {
(this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
};
qt.prototype.setMaxListeners = function(e) {
if (typeof e != "number" || e < 0 || mu(e))
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + ".");
return this._maxListeners = e, this;
};
function bu(e) {
return e._maxListeners === void 0 ? qt.defaultMaxListeners : e._maxListeners;
}
qt.prototype.getMaxListeners = function() {
return bu(this);
};
qt.prototype.emit = function(e) {
for (var r = [], n = 1; n < arguments.length; n++)
r.push(arguments[n]);
var o = e === "error", s = this._events;
if (s !== void 0)
o = o && s.error === void 0;
else if (!o)
return !1;
if (o) {
var p;
if (r.length > 0 && (p = r[0]), p instanceof Error)
throw p;
var g = new Error("Unhandled error." + (p ? " (" + p.message + ")" : ""));
throw g.context = p, g;
}
var C = s[e];
if (C === void 0)
return !1;
if (typeof C == "function")
vl(C, this, r);
else
for (var y = C.length, x = Iu(C, y), n = 0; n < y; ++n)
vl(x[n], this, r);
return !0;
};
function Eu(e, r, n, o) {
var s, p, g;
if (Ns(n), p = e._events, p === void 0 ? (p = e._events = /* @__PURE__ */ Object.create(null), e._eventsCount = 0) : (p.newListener !== void 0 && (e.emit(
"newListener",
r,
n.listener ? n.listener : n
), p = e._events), g = p[r]), g === void 0)
g = p[r] = n, ++e._eventsCount;
else if (typeof g == "function" ? g = p[r] = o ? [n, g] : [g, n] : o ? g.unshift(n) : g.push(n), s = bu(e), s > 0 && g.length > s && !g.warned) {
g.warned = !0;
var C = new Error("Possible EventEmitter memory leak detected. " + g.length + " " + String(r) + " listeners added. Use emitter.setMaxListeners() to increase limit");
C.name = "MaxListenersExceededWarning", C.emitter = e, C.type = r, C.count = g.length, lA(C);
}
return e;
}
qt.prototype.addListener = function(e, r) {
return Eu(this, e, r, !1);
};
qt.prototype.on = qt.prototype.addListener;
qt.prototype.prependListener = function(e, r) {
return Eu(this, e, r, !0);
};
function uA() {
if (!this.fired)
return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
}
function yu(e, r, n) {
var o = { fired: !1, wrapFn: void 0, target: e, type: r, listener: n }, s = uA.bind(o);
return s.listener = n, o.wrapFn = s, s;
}
qt.prototype.once = function(e, r) {
return Ns(r), this.on(e, yu(this, e, r)), this;
};
qt.prototype.prependOnceListener = function(e, r) {
return Ns(r), this.prependListener(e, yu(this, e, r)), this;
};
qt.prototype.removeListener = function(e, r) {
var n, o, s, p, g;
if (Ns(r), o = this._events, o === void 0)
return this;
if (n = o[e], n === void 0)
return this;
if (n === r || n.listener === r)
--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete o[e], o.removeListener && this.emit("removeListener", e, n.listener || r));
else if (typeof n != "function") {
for (s = -1, p = n.length - 1; p >= 0; p--)
if (n[p] === r || n[p].listener === r) {
g = n[p].listener, s = p;
break;
}
if (s < 0)
return this;
s === 0 ? n.shift() : hA(n, s), n.length === 1 && (o[e] = n[0]), o.removeListener !== void 0 && this.emit("removeListener", e, g || r);
}
return this;
};
qt.prototype.off = qt.prototype.removeListener;
qt.prototype.removeAllListeners = function(e) {
var r, n, o;
if (n = this._events, n === void 0)
return this;
if (n.removeListener === void 0)
return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : n[e] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete n[e]), this;
if (arguments.length === 0) {
var s = Object.keys(n), p;
for (o = 0; o < s.length; ++o)
p = s[o], p !== "removeListener" && this.removeAllListeners(p);
return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this;
}
if (r = n[e], typeof r == "function")
this.removeListener(e, r);
else if (r !== void 0)
for (o = r.length - 1; o >= 0; o--)
this.removeListener(e, r[o]);
return this;
};
function Cu(e, r, n) {
var o = e._events;
if (o === void 0)
return [];
var s = o[r];
return s === void 0 ? [] : typeof s == "function" ? n ? [s.listener || s] : [s] : n ? dA(s) : Iu(s, s.length);
}
qt.prototype.listeners = function(e) {
return Cu(this, e, !0);
};
qt.prototype.rawListeners = function(e) {
return Cu(this, e, !1);
};
qt.listenerCount = function(e, r) {
return typeof e.listenerCount == "function" ? e.listenerCount(r) : Tu.call(e, r);
};
qt.prototype.listenerCount = Tu;
function Tu(e) {
var r = this._events;
if (r !== void 0) {
var n = r[e];
if (typeof n == "function")
return 1;
if (n !== void 0)
return n.length;
}
return 0;
}
qt.prototype.eventNames = function() {
return this._eventsCount > 0 ? ds(this._events) : [];
};
function Iu(e, r) {
for (var n = new Array(r), o = 0; o < r; ++o)
n[o] = e[o];
return n;
}
function hA(e, r) {
for (; r + 1 < e.length; r++)
e[r] = e[r + 1];
e.pop();
}
function dA(e) {
for (var r = new Array(e.length), n = 0; n < r.length; ++n)
r[n] = e[n].listener || e[n];
return r;
}
function fA(e, r) {
return new Promise(function(n, o) {
function s(g) {
e.removeListener(r, p), o(g);
}
function p() {
typeof e.removeListener == "function" && e.removeListener("error", s), n([].slice.call(arguments));
}
Ru(e, r, p, { once: !0 }), r !== "error" && pA(e, s, { once: !0 });
});
}
function pA(e, r, n) {
typeof e.on == "function" && Ru(e, "error", r, n);
}
function Ru(e, r, n, o) {
if (typeof e.on == "function")
o.once ? e.once(r, n) : e.on(r, n);
else if (typeof e.addEventListener == "function")
e.addEventListener(r, function s(p) {
o.once && e.removeEventListener(r, s), n(p);
});
else
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof e);
}
var _A = lc.exports, wu = function() {
if (typeof Map < "u")
return Map;
function e(r, n) {
var o = -1;
return r.some(function(s, p) {
return s[0] === n ? (o = p, !0) : !1;
}), o;
}
return (
/** @class */
function() {
function r() {
this.__entries__ = [];
}
return Object.defineProperty(r.prototype, "size", {
/**
* @returns {boolean}
*/
get: function() {
return this.__entries__.length;
},
enumerable: !0,
configurable: !0
}), r.prototype.get = function(n) {
var o = e(this.__entries__, n), s = this.__entries__[o];
return s && s[1];
}, r.prototype.set = function(n, o) {
var s = e(this.__entries__, n);
~s ? this.__entries__[s][1] = o : this.__entries__.push([n, o]);
}, r.prototype.delete = function(n) {
var o = this.__entries__, s = e(o, n);
~s && o.splice(s, 1);
}, r.prototype.has = function(n) {
return !!~e(this.__entries__, n);
}, r.prototype.clear = function() {
this.__entries__.splice(0);
}, r.prototype.forEach = function(n, o) {
o === void 0 && (o = null);
for (var s = 0, p = this.__entries__; s < p.length; s++) {
var g = p[s];
n.call(o, g[1], g[0]);
}
}, r;
}()
);
}(), ko = typeof window < "u" && typeof document < "u" && window.document === document, bs = function() {
return typeof global < "u" && global.Math === Math ? global : typeof self < "u" && self.Math === Math ? self : typeof window < "u" && window.Math === Math ? window : Function("return this")();
}(), AA = function() {
return typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(bs) : function(e) {
return setTimeout(function() {
return e(Date.now());
}, 1e3 / 60);
};
}(), vA = 2;
function gA(e, r) {
var n = !1, o = !1, s = 0;
function p() {
n && (n = !1, e()), o && C();
}
function g() {
AA(p);
}
function C() {
var y = Date.now();
if (n) {
if (y - s < vA)
return;
o = !0;
} else
n = !0, o = !1, setTimeout(g, r);
s = y;
}
return C;
}
var mA = 20, bA = ["top", "right", "bottom", "left", "width", "height", "size", "weight"], EA = typeof MutationObserver < "u", yA = (
/** @class */
function() {
function e() {
this.connected_ = !1, this.mutationEventsAdded_ = !1, this.mutationsObserver_ = null, this.observers_ = [], this.onTransitionEnd_ = this.onTransitionEnd_.bind(this), this.refresh = gA(this.refresh.bind(this), mA);
}
return e.prototype.addObserver = function(r) {
~this.observers_.indexOf(r) || this.observers_.push(r), this.connected_ || this.connect_();
}, e.prototype.removeObserver = function(r) {
var n = this.observers_, o = n.indexOf(r);
~o && n.splice(o, 1), !n.length && this.connected_ && this.disconnect_();
}, e.prototype.refresh = function() {
var r = this.updateObservers_();
r && this.refresh();
}, e.prototype.updateObservers_ = function() {
var r = this.observers_.filter(function(n) {
return n.gatherActive(), n.hasActive();
});
return r.forEach(function(n) {
return n.broadcastActive();
}), r.length > 0;
}, e.prototype.connect_ = function() {
!ko || this.connected_ || (document.addEventListener("transitionend", this.onTransitionEnd_), window.addEventListener("resize", this.refresh), EA ? (this.mutationsObserver_ = new MutationObserver(this.refresh), this.mutationsObserver_.observe(document, {
attributes: !0,
childList: !0,
characterData: !0,
subtree: !0
})) : (document.addEventListener("DOMSubtreeModified", this.refresh), this.mutationEventsAdded_ = !0), this.connected_ = !0);
}, e.prototype.disconnect_ = function() {
!ko || !this.connected_ || (document.removeEventListener("transitionend", this.onTransitionEnd_), window.removeEventListener("resize", this.refresh), this.mutationsObserver_ && this.mutationsObserver_.disconnect(), this.mutationEventsAdded_ && document.removeEventListener("DOMSubtreeModified", this.refresh), this.mutationsObserver_ = null, this.mutationEventsAdded_ = !1, this.connected_ = !1);
}, e.prototype.onTransitionEnd_ = function(r) {
var n = r.propertyName, o = n === void 0 ? "" : n, s = bA.some(function(p) {
return !!~o.indexOf(p);
});
s && this.refresh();
}, e.getInstance = function() {
return this.instance_ || (this.instance_ = new e()), this.instance_;
}, e.instance_ = null, e;
}()
), Lu = function(e, r) {
for (var n = 0, o = Object.keys(r); n < o.length; n++) {
var s = o[n];
Object.defineProperty(e, s, {
value: r[s],
enumerable: !1,
writable: !1,
configurable: !0
});
}
return e;
}, ha = function(e) {
var r = e && e.ownerDocument && e.ownerDocument.defaultView;
return r || bs;
}, Du = ks(0, 0, 0, 0);
function Es(e) {
return parseFloat(e) || 0;
}
function ml(e) {
for (var r = [], n = 1; n < arguments.length; n++)
r[n - 1] = arguments[n];
return r.reduce(function(o, s) {
var p = e["border-" + s + "-width"];
return o + Es(p);
}, 0);
}
function CA(e) {
for (var r = ["top", "right", "bottom", "left"], n = {}, o = 0, s = r; o < s.length; o++) {
var p = s[o], g = e["padding-" + p];
n[p] = Es(g);
}
return n;
}
function TA(e) {
var r = e.getBBox();
return ks(0, 0, r.width, r.height);
}
function IA(e) {
var r = e.clientWidth, n = e.clientHeight;
if (!r && !n)
return Du;
var o = ha(e).getComputedStyle(e), s = CA(o), p = s.left + s.right, g = s.top + s.bottom, C = Es(o.width), y = Es(o.height);
if (o.boxSizing === "border-box" && (Math.round(C + p) !== r && (C -= ml(o, "left", "right") + p), Math.round(y + g) !== n && (y -= ml(o, "top", "bottom") + g)), !wA(e)) {
var x = Math.round(C + p) - r, h = Math.round(y + g) - n;
Math.abs(x) !== 1 && (C -= x), Math.abs(h) !== 1 && (y -= h);
}
return ks(s.left, s.top, C, y);
}
var RA = function() {
return typeof SVGGraphicsElement < "u" ? function(e) {
return e instanceof ha(e).SVGGraphicsElement;
} : function(e) {
return e instanceof ha(e).SVGElement && typeof e.getBBox == "function";
};
}();
function wA(e) {
return e === ha(e).document.documentElement;
}
function LA(e) {
return ko ? RA(e) ? TA(e) : IA(e) : Du;
}
function DA(e) {
var r = e.x, n = e.y, o = e.width, s = e.height, p = typeof DOMRectReadOnly < "u" ? DOMRectReadOnly : Object, g = Object.create(p.prototype);
return Lu(g, {
x: r,
y: n,
width: o,
height: s,
top: n,
right: r + o,
bottom: s + n,
left: r
}), g;
}
function ks(e, r, n, o) {
return { x: e, y: r, width: n, height: o };
}
var SA = (
/** @class */
function() {
function e(r) {
this.broadcastWidth = 0, this.broadcastHeight = 0, this.contentRect_ = ks(0, 0, 0, 0), this.target = r;
}
return e.prototype.isActive = function() {
var r = LA(this.target);
return this.contentRect_ = r, r.width !== this.broadcastWidth || r.height !== this.broadcastHeight;
}, e.prototype.broadcastRect = function() {
var r = this.contentRect_;
return this.broadcastWidth = r.width, this.broadcastHeight = r.height, r;
}, e;
}()
), OA = (
/** @class */
function() {
function e(r, n) {
var o = DA(n);
Lu(this, { target: r, contentRect: o });
}
return e;
}()
), NA = (
/** @class */
function() {
function e(r, n, o) {
if (this.activeObservations_ = [], this.observations_ = new wu(), typeof r != "function")
throw new TypeError("The callback provided as parameter 1 is not a function.");
this.callback_ = r, this.controller_ = n, this.callbackCtx_ = o;
}
return e.prototype.observe = function(r) {
if (!arguments.length)
throw new TypeError("1 argument required, but only 0 present.");
if (!(typeof Element > "u" || !(Element instanceof Object))) {
if (!(r instanceof ha(r).Element))
throw new TypeError('parameter 1 is not of type "Element".');
var n = this.observations_;
n.has(r) || (n.set(r, new SA(r)), this.controller_.addObserver(this), this.controller_.refresh());
}
}, e.prototype.unobserve = function(r) {
if (!arguments.length)
throw new TypeError("1 argument required, but only 0 present.");
if (!(typeof Element > "u" || !(Element instanceof Object))) {
if (!(r instanceof ha(r).Element))
throw new TypeError('parameter 1 is not of type "Element".');
var n = this.observations_;
n.has(r) && (n.delete(r), n.size || this.controller_.removeObserver(this));
}
}, e.prototype.disconnect = function() {
this.clearActive(), this.observations_.clear(), this.controller_.removeObserver(this);
}, e.prototype.gatherActive = function() {
var r = this;
this.clearActive(), this.observations_.forEach(function(n) {
n.isActive() && r.activeObservations_.push(n);
});
}, e.prototype.broadcastActive = function() {
if (this.hasActive()) {
var r = this.callbackCtx_, n = this.activeObservations_.map(function(o) {
return new OA(o.target, o.broadcastRect());
});
this.callback_.call(r, n, r), this.clearActive();
}
}, e.prototype.clearActive = function() {
this.activeObservations_.splice(0);
}, e.prototype.hasActive = function() {
return this.activeObservations_.length > 0;
}, e;
}()
), Su = typeof WeakMap < "u" ? /* @__PURE__ */ new WeakMap() : new wu(), Ou = (
/** @class */
function() {
function e(r) {
if (!(this instanceof e))
throw new TypeError("Cannot call a class as a function.");
if (!arguments.length)
throw new TypeError("1 argument required, but only 0 present.");
var n = yA.getInstance(), o = new NA(r, n, this);
Su.set(this, o);
}
return e;
}()
);
[
"observe",
"unobserve",
"disconnect"
].forEach(function(e) {
Ou.prototype[e] = function() {
var r;
return (r = Su.get(this))[e].apply(r, arguments);
};
});
(function() {
return typeof bs.ResizeObserver < "u" ? bs.ResizeObserver : Ou;
})();
var Nu = {}, kA = Object.prototype.hasOwnProperty, xA;
function bl(e) {
try {
return decodeURIComponent(e.replace(/\+/g, " "));
} catch (r) {
return null;
}
}
function El(e) {
try {
return encodeURIComponent(e);
} catch (r) {
return null;
}
}
function MA(e) {
for (var r = /([^=?#&]+)=?([^&]*)/g, n = {}, o; o = r.exec(e); ) {
var s = bl(o[1]), p = bl(o[2]);
s === null || p === null || s in n || (n[s] = p);
}
return n;
}
function PA(e, r) {
r = r || "";
var n = [], o, s;
typeof r != "string" && (r = "?");
for (s in e)
if (kA.call(e, s)) {
if (o = e[s], !o && (o === null || o === xA || isNaN(o)) && (o = ""), s = El(s), o = El(o), s === null || o === null)
continue;
n.push(s + "=" + o);
}
return n.length ? r + n.join("&") : "";
}
Nu.stringify = PA;
Nu.parse = MA;
var pa = function(e) {
var r = {};
function n(o) {
if (r[o])
return r[o].exports;
var s = r[o] = { i: o, l: !1, exports: {} };
return e[o].call(s.exports, s, s.exports, n), s.l = !0, s.exports;
}
return n.m = e, n.c = r, n.d = function(o, s, p) {
n.o(o, s) || Object.defineProperty(o, s, { enumerable: !0, get: p });
}, n.r = function(o) {
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(o, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(o, "__esModule", { value: !0 });
}, n.t = function(o, s) {
if (1 & s && (o = n(o)), 8 & s || 4 & s && typeof o == "object" && o && o.__esModule)
return o;
var p = /* @__PURE__ */ Object.create(null);
if (n.r(p), Object.defineProperty(p, "default", { enumerable: !0, value: o }), 2 & s && typeof o != "string")
for (var g in o)
n.d(p, g, function(C) {
return o[C];
}.bind(null, g));
return p;
}, n.n = function(o) {
var s = o && o.__esModule ? function() {
return o.default;
} : function() {
return o;
};
return n.d(s, "a", s), s;
}, n.o = function(o, s) {
return Object.prototype.hasOwnProperty.call(o, s);
}, n.p = "", n(n.s = 4);
}([function(e, r) {
function n(o) {
return e.exports = n = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(s) {
return typeof s;
} : function(s) {
return s && typeof Symbol == "function" && s.constructor === Symbol && s !== Symbol.prototype ? "symbol" : typeof s;
}, e.exports.__esModule = !0, e.exports.default = e.exports, n(o);
}
e.exports = n, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r, n) {
var o = n(2);
function s(p, g) {
for (var C = 0; C < g.length; C++) {
var y = g[C];
y.enumerable = y.enumerable || !1, y.configurable = !0, "value" in y && (y.writable = !0), Object.defineProperty(p, o(y.key), y);
}
}
e.exports = function(p, g, C) {
return g && s(p.prototype, g), C && s(p, C), Object.defineProperty(p, "prototype", { writable: !1 }), p;
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r, n) {
var o = n(0).default, s = n(3);
e.exports = function(p) {
var g = s(p, "string");
return o(g) == "symbol" ? g : g + "";
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r, n) {
var o = n(0).default;
e.exports = function(s, p) {
if (o(s) != "object" || !s)
return s;
var g = s[Symbol.toPrimitive];
if (g !== void 0) {
var C = g.call(s, p || "default");
if (o(C) != "object")
return C;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (p === "string" ? String : Number)(s);
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r, n) {
function o(D, W) {
console.log("%c " + D + " %c " + W + " %c", "background:#35495e ; padding: 1px; border-radius: 4px 0 0 4px; color: #fff", "background:#ffa483 ; padding: 1px; border-radius: 0 4px 4px 0; color: #fff", "background:transparent");
}
n.r(r), n.d(r, "LogLevel", function() {
return x;
}), n.d(r, "DefaultLogger", function() {
return T;
}), n.d(r, "Logger", function() {
return I;
}), n.d(r, "printVersion", function() {
return o;
}), n.d(r, "DEFAULT_LOG_LEVEL", function() {
return h;
});
var s = n(1), p = n.n(s), g = function() {
function D() {
this.timeout = 6048e5;
}
var W = D.prototype;
return W.write = function(j, O) {
if (D.available)
try {
localStorage.setItem(j, JSON.stringify({ value: O, time: Date.now() }));
} catch (K) {
}
}, W.read = function(j, O) {
if (O === void 0 && (O = !0), D.available)
try {
var K = localStorage.getItem(j);
if (K) {
var z = JSON.parse(K), B = z.value, J = z.time, be = J === void 0 ? 0 : J;
if (!O || Date.now() - be < (typeof O == "number" ? O : this.timeout))
return B;
}
} catch ($) {
}
}, p()(D, null, [{ key: "available", get: function() {
if (D._available === void 0)
try {
localStorage.setItem("alg", "test"), D._available = !0;
} catch (j) {
D._available = !1;
}
return D._available;
} }]);
}();
g._available = void 0;
var C, y = g, x = function(D) {
return D.NONE = "none", D.ERROR = "e", D.WARN = "w", D.INFO = "i", D.DEBUG = "d", D.VERBOSE = "v", D;
}({}), h = x.ERROR, F = ((C = {})[x.NONE] = { value: 1, str: "N" }, C[x.ERROR] = { value: 100, str: "E" }, C[x.WARN] = { value: 200, str: "W" }, C[x.INFO] = { value: 300, str: "I" }, C[x.DEBUG] = { value: 400, str: "D" }, C[x.VERBOSE] = { value: 500, str: "V" }, C), I = function() {
function D(j) {
if (this._name = "kwai-v", this._level = h, this._id = -1, this._output = void 0, this._workerTag = "main", typeof location < "u" && location.protocol === "blob:") {
var O, K = location.href.split("/"), z = (O = K[K.length - 1]) == null ? void 0 : O.match(/(\w+)-/);
z && (this._workerTag = j ? j + "-" + z[1] : z[1]);
} else
j && (this._workerTag = j);
}
D.loadLogLevel = function(j, O) {
if (O === void 0 && (O = !0), location.href) {
var K = new RegExp(j + "=([a-z]{1})"), z = location.href.match(K);
if (z && z.length > 1) {
var B = z[1];
if (this._isValueInLevel(B))
return B;
}
}
var J = new y().read(j, O);
if (this._isValueInLevel(J))
return J;
}, D.saveLogLevel = function(j, O) {
this._isValueInLevel(O) && new y().write(j, O);
}, D._isValueInLevel = function(j) {
return Object.values(x).indexOf(j) !== -1;
};
var W = D.prototype;
return W.setOutput = function(j) {
return this._output = j, this;
}, W.setLevel = function(j) {
return this._level = j, this;
}, W.setId = function(j) {
return this._id = j, this;
}, W.setName = function(j) {
return this._name = j, this;
}, W.getLevel = function() {
return this._level;
}, W.getOutput = function() {
return this._output;
}, W.hasOutput = function() {
return !!this._output;
}, W.e = function(j) {
if (this._isLevelEnabled(this._level, x.ERROR)) {
for (var O = arguments.length, K = new Array(O > 1 ? O - 1 : 0), z = 1; z < O; z++)
K[z - 1] = arguments[z];
var B = this._printLog(x.ERROR, j, K);
try {
var J;
(J = this._output) == null || J.e.apply(J, [B].concat(K));
} catch (be) {
}
}
}, W.w = function(j) {
if (this._isLevelEnabled(this._level, x.WARN)) {
for (var O = arguments.length, K = new Array(O > 1 ? O - 1 : 0), z = 1; z < O; z++)
K[z - 1] = arguments[z];
var B = this._printLog(x.WARN, j, K);
try {
var J;
(J = this._output) == null || J.w.apply(J, [B].concat(K));
} catch (be) {
}
}
}, W.i = function(j) {
if (this._isLevelEnabled(this._level, x.INFO)) {
for (var O = arguments.length, K = new Array(O > 1 ? O - 1 : 0), z = 1; z < O; z++)
K[z - 1] = arguments[z];
var B = this._printLog(x.INFO, j, K);
try {
var J;
(J = this._output) == null || J.i.apply(J, [B].concat(K));
} catch (be) {
}
}
}, W.d = function(j) {
if (this._isLevelEnabled(this._level, x.DEBUG)) {
for (var O = arguments.length, K = new Array(O > 1 ? O - 1 : 0), z = 1; z < O; z++)
K[z - 1] = arguments[z];
var B = this._printLog(x.DEBUG, j, K);
try {
var J;
(J = this._output) == null || J.d.apply(J, [B].concat(K));
} catch (be) {
}
}
}, W.v = function(j) {
if (this._isLevelEnabled(this._level, x.VERBOSE)) {
for (var O = arguments.length, K = new Array(O > 1 ? O - 1 : 0), z = 1; z < O; z++)
K[z - 1] = arguments[z];
var B = this._printLog(x.VERBOSE, j, K);
try {
var J;
(J = this._output) == null || J.v.apply(J, [B].concat(K));
} catch (be) {
}
}
}, W._isLevelEnabled = function(j, O) {
return F[j].value >= F[O].value;
}, W._printLog = function(j, O, K) {
var z, B, J = typeof O;
if (J === "object")
O = ((B = O) == null ? void 0 : B.constructor.name) || "unknown";
else if (J === "function") {
var be;
O = ((be = Object.getOwnPropertyDescriptor(O, "name")) == null ? void 0 : be.value) || "unknown";
}
var $, ye, Be = (((z = F[j]) == null ? void 0 : z.str) || "") + "|" + this._name + "[" + (typeof this._id == "function" ? this._id() : this._id) + "][" + this._workerTag + "]::" + O;
return j === x.ERROR ? ($ = console).error.apply($, [Be].concat(K.slice(0))) : (ye = console).log.apply(ye, [Be].concat(K.slice(0))), Be;
}, D;
}(), T = new I();
}]);
pa === void 0 && console.error("esm-webpack-plugin: nothing exported!");
pa.LogLevel;
const Oa = pa.DefaultLogger;
pa.Logger;
pa.printVersion;
pa.DEFAULT_LOG_LEVEL;
/*! js-cookie v3.0.5 | MIT */
function as(e) {
for (var r = 1; r < arguments.length; r++) {
var n = arguments[r];
for (var o in n)
e[o] = n[o];
}
return e;
}
var UA = {
read: function(e) {
return e[0] === '"' && (e = e.slice(1, -1)), e.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
},
write: function(e) {
return encodeURIComponent(e).replace(
/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
decodeURIComponent
);
}
};
function xo(e, r) {
function n(s, p, g) {
if (!(typeof document > "u")) {
g = as({}, r, g), typeof g.expires == "number" && (g.expires = new Date(Date.now() + g.expires * 864e5)), g.expires && (g.expires = g.expires.toUTCString()), s = encodeURIComponent(s).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
var C = "";
for (var y in g)
g[y] && (C += "; " + y, g[y] !== !0 && (C += "=" + g[y].split(";")[0]));
return document.cookie = s + "=" + e.write(p, s) + C;
}
}
function o(s) {
if (!(typeof document > "u" || arguments.length && !s)) {
for (var p = document.cookie ? document.cookie.split("; ") : [], g = {}, C = 0; C < p.length; C++) {
var y = p[C].split("="), x = y.slice(1).join("=");
try {
var h = decodeURIComponent(y[0]);
if (g[h] = e.read(x, h), s === h)
break;
} catch (F) {
}
}
return s ? g[s] : g;
}
}
return Object.create(
{
set: n,
get: o,
remove: function(s, p) {
n(
s,
"",
as({}, p, {
expires: -1
})
);
},
withAttributes: function(s) {
return xo(this.converter, as({}, this.attributes, s));
},
withConverter: function(s) {
return xo(as({}, this.converter, s), this.attributes);
}
},
{
attributes: { value: Object.freeze(r) },
converter: { value: Object.freeze(e) }
}
);
}
var po = xo(UA, { path: "/" });
const Na = "did", _o = "kwai_player_device_id";
function yl() {
try {
const e = Math.random() * 1e9 >>> 0, r = [], n = "0123456789ABCDEF";
for (let s = 0; s < 7; s++)
r.push(n.charAt(Math.random() * 16));
const o = `web_${e}${r.join("")}`;
return Oa.i(Na, "generate nanoId", o), o;
} catch (e) {
}
return "web_did_generation_failed";
}
function BA() {
let e = "";
try {
e = (po.get("did") || po.get("_did") || po.get("weblogger_did") || "").trim(), Oa.i(Na, "generate deviceId from cookie", e);
} catch (r) {
Oa.i(Na, "generate deviceId from cookie err", r);
}
try {
e ? localStorage == null || localStorage.setItem(_o, e) : (e = ((localStorage == null ? void 0 : localStorage.getItem(_o)) || "").trim(), Oa.i(Na, "generate deviceId from ls", e)), e || (e = yl(), localStorage == null || localStorage.setItem(_o, e));
} catch (r) {
Oa.i(Na, "generate deviceId from ls err", r);
}
return e || yl();
}
BA();
const ku = class Yn {
constructor() {
Au(this, "timeout", 7 * 24 * 3600 * 1e3);
}
write(r, n) {
if (Yn.available)
try {
localStorage.setItem(
r,
JSON.stringify({ value: n, time: Date.now() })
);
} catch (o) {
}
}
read(r, n = !0) {
if (Yn.available)
try {
const o = localStorage.getItem(r);
if (o) {
const { value: s, time: p = 0 } = JSON.parse(o);
if (!n || Date.now() - p < (typeof n == "number" ? n : this.timeout))
return s;
}
} catch (o) {
}
}
static get available() {
if (typeof Yn._available > "u")
try {
localStorage.setItem("alg", "test"), Yn._available = !0;
} catch (r) {
Yn._available = !1;
}
return Yn._available;
}
};
Au(ku, "_available");
let xu = ku;
var Mo = { exports: {} };
(function(e, r) {
(function(n, o) {
var s = "1.0.2", p = "", g = "?", C = "function", y = "undefined", x = "object", h = "string", F = "major", I = "model", T = "name", D = "type", W = "vendor", j = "version", O = "architecture", K = "console", z = "mobile", B = "tablet", J = "smarttv", be = "wearable", $ = "embedded", ye = 255, Be = "Amazon", Ve = "Apple", je = "ASUS", we = "BlackBerry", ue = "Browser", L = "Chrome", w = "Edge", le = "Firefox", oe = "Google", Re = "Huawei", Oe = "LG", de = "Microsoft", X = "Motorola", ge = "Opera", Pe = "Samsung", ae = "Sony", q = "Xiaomi", m = "Zebra", ve = "Facebook", U = function(te, ie) {
var ee = {};
for (var Te in te)
ie[Te] && ie[Te].length % 2 === 0 ? ee[Te] = ie[Te].concat(te[Te]) : ee[Te] = te[Te];
return ee;
}, M = function(te) {
for (var ie = {}, ee = 0; ee < te.length; ee++)
ie[te[ee].toUpperCase()] = te[ee];
return ie;
}, ne = function(te, ie) {
return typeof te === h ? Le(ie).indexOf(Le(te)) !== -1 : !1;
}, Le = function(te) {
return te.toLowerCase();
}, Ue = function(te) {
return typeof te === h ? te.replace(/[^\d\.]/g, p).split(".")[0] : o;
}, re = function(te, ie) {
if (typeof te === h)
return te = te.replace(/^\s\s*/, p).replace(/\s\s*$/, p), typeof ie === y ? te : te.substring(0, ye);
}, k = function(te, ie) {
for (var ee = 0, Te, Se, Ye, ze, it, ct; ee < ie.length && !it; ) {
var nt = ie[ee], zt = ie[ee + 1];
for (Te = Se = 0; Te < nt.length && !it; )
if (it = nt[Te++].exec(te), it)
for (Ye = 0; Ye < zt.length; Ye++)
ct = it[++Se], ze = zt[Ye], typeof ze === x && ze.length > 0 ? ze.length === 2 ? typeof ze[1] == C ? this[ze[0]] = ze[1].call(this, ct) : this[ze[0]] = ze[1] : ze.length === 3 ? typeof ze[1] === C && !(ze[1].exec && ze[1].test) ? this[ze[0]] = ct ? ze[1].call(this, ct, ze[2]) : o : this[ze[0]] = ct ? ct.replace(ze[1], ze[2]) : o : ze.length === 4 && (this[ze[0]] = ct ? ze[3].call(this, ct.replace(ze[1], ze[2])) : o) : this[ze] = ct || o;
ee += 2;
}
}, P = function(te, ie) {
for (var ee in ie)
if (typeof ie[ee] === x && ie[ee].length > 0) {
for (var Te = 0; Te < ie[ee].length; Te++)
if (ne(ie[ee][Te], te))
return ee === g ? o : ee;
} else if (ne(ie[ee], te))
return ee === g ? o : ee;
return te;
}, Z = {
"1.0": "/8",
"1.2": "/1",
"1.3": "/3",
"2.0": "/412",
"2.0.2": "/416",
"2.0.3": "/417",
"2.0.4": "/419",
"?": "/"
}, he = {
ME: "4.90",
"NT 3.11": "NT3.51",
"NT 4.0": "NT4.0",
2e3: "NT 5.0",
XP: ["NT 5.1", "NT 5.2"],
Vista: "NT 6.0",
7: "NT 6.1",
8: "NT 6.2",
"8.1": "NT 6.3",
10: ["NT 6.4", "NT 10.0"],
RT: "ARM"
}, Ie = {
browser: [
[
/\b(?:crmo|crios)\/([\w\.]+)/i
// Chrome for Android/iOS
],
[j, [T, "Chrome"]],
[
/edg(?:e|ios|a)?\/([\w\.]+)/i
// Microsoft Edge
],
[j, [T, "Edge"]],
[
// Presto based
/(opera mini)\/([-\w\.]+)/i,
// Opera Mini
/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,
// Opera Mobi/Tablet
/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i
// Opera
],
[T, j],
[
/opios[\/ ]+([\w\.]+)/i
// Opera mini on iphone >= 8.0
],
[j, [T, ge + " Mini"]],
[
/\bopr\/([\w\.]+)/i
// Opera Webkit
],
[j, [T, ge]],
[
// Mixed
/(kindle)\/([\w\.]+)/i,
// Kindle
/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,
// Lunascape/Maxthon/Netfront/Jasmine/Blazer
// Trident based
/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,
// Avant/IEMobile/SlimBrowser
/(ba?idubrowser)[\/ ]?([\w\.]+)/i,
// Baidu Browser
/(?:ms|\()(ie) ([\w\.]+)/i,
// Internet Explorer
// Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon
/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq)\/([-\w\.]+)/i,
// Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ, aka ShouQ
/(weibo)__([\d\.]+)/i
// Weibo
],
[T, j],
[
/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i
// UCBrowser
],
[j, [T, "UC" + ue]],
[
/\bqbcore\/([\w\.]+)/i
// WeChat Desktop for Windows Built-in Browser
],
[j, [T, "WeChat(Win) Desktop"]],
[
/micromessenger\/([\w\.]+)/i
// WeChat
],
[j, [T, "WeChat"]],
[
/konqueror\/([\w\.]+)/i
// Konqueror
],
[j, [T, "Konqueror"]],
[
/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i
// IE11
],
[j, [T, "IE"]],
[
/yabrowser\/([\w\.]+)/i
// Yandex
],
[j, [T, "Yandex"]],
[
/(avast|avg)\/([\w\.]+)/i
// Avast/AVG Secure Browser
],
[[T, /(.+)/, "$1 Secure " + ue], j],
[
/\bfocus\/([\w\.]+)/i
// Firefox Focus
],
[j, [T, le + " Focus"]],
[
/\bopt\/([\w\.]+)/i
// Opera Touch
],
[j, [T, ge + " Touch"]],
[
/coc_coc\w+\/([\w\.]+)/i
// Coc Coc Browser
],
[j, [T, "Coc Coc"]],
[
/dolfin\/([\w\.]+)/i
// Dolphin
],
[j, [T, "Dolphin"]],
[
/coast\/([\w\.]+)/i
// Opera Coast
],
[j, [T, ge + " Coast"]],
[
/miuibrowser\/([\w\.]+)/i
// MIUI Browser
],
[j, [T, "MIUI " + ue]],
[
/fxios\/([-\w\.]+)/i
// Firefox for iOS
],
[j, [T, le]],
[
/\bqihu|(qi?ho?o?|360)browser/i
// 360
],
[[T, "360 " + ue]],
[
/(oculus|samsung|sailfish)browser\/([\w\.]+)/i
],
[[T, /(.+)/, "$1 " + ue], j],
[
// Oculus/Samsung/Sailfish Browser
/(comodo_dragon)\/([\w\.]+)/i
// Comodo Dragon
],
[[T, /_/g, " "], j],
[
/(electron)\/([\w\.]+) safari/i,
// Electron-based App
/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,
// Tesla
/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i
// QQBrowser/Baidu App/2345 Browser
],
[T, j],
[
/(metasr)[\/ ]?([\w\.]+)/i,
// SouGouBrowser
/(lbbrowser)/i
// LieBao Browser
],
[T],
[
// WebView
/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i
// Facebook App for iOS & Android
],
[[T, ve], j],
[
/safari (line)\/([\w\.]+)/i,
// Line App for iOS
/\b(line)\/([\w\.]+)\/iab/i,
// Line App for Android
/(chromium|instagram)[\/ ]([-\w\.]+)/i
// Chromium/Instagram
],
[T, j],
[
/\bgsa\/([\w\.]+) .*safari\//i
// Google Search Appliance on iOS
],
[j, [T, "GSA"]],
[
/headlesschrome(?:\/([\w\.]+)| )/i
// Chrome Headless
],
[j, [T, L + " Headless"]],
[
/ wv\).+(chrome)\/([\w\.]+)/i
// Chrome WebView
],
[[T, L + " WebView"], j],
[
/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i
// Android Browser
],
[j, [T, "Android " + ue]],
[
/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i
// Chrome/OmniWeb/Arora/Tizen/Nokia
],
[T, j],
[
/version\/([\w\.]+) .*mobile\/\w+ (safari)/i
// Mobile Safari
],
[j, [T, "Mobile Safari"]],
[
/version\/([\w\.]+) .*(mobile ?safari|safari)/i
// Safari & Safari Mobile
],
[j, T],
[
/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i
// Safari < 3.0
],
[T, [j, P, Z]],
[
/(webkit|khtml)\/([\w\.]+)/i
],
[T, j],
[
// Gecko based
/(navigator|netscape\d?)\/([-\w\.]+)/i
// Netscape
],
[[T, "Netscape"], j],
[
/mobile vr; rv:([\w\.]+)\).+firefox/i
// Firefox Reality
],
[j, [T, le + " Reality"]],
[
/ekiohf.+(flow)\/([\w\.]+)/i,
// Flow
/(swiftfox)/i,
// Swiftfox
/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,
// IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror/Klar
/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,
// Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix
/(firefox)\/([\w\.]+)/i,
// Other Firefox-based
/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,
// Mozilla
// Other
/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,
// Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir/Obigo/Mosaic/Go/ICE/UP.Browser
/(links) \(([\w\.]+)/i
// Links
],
[T, j]
],
cpu: [
[
/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i
// AMD64 (x64)
],
[[O, "amd64"]],
[
/(ia32(?=;))/i
// IA32 (quicktime)
],
[[O, Le]],
[
/((?:i[346]|x)86)[;\)]/i
// IA32 (x86)
],
[[O, "ia32"]],
[
/\b(aarch64|arm(v?8e?l?|_?64))\b/i
// ARM64
],
[[O, "arm64"]],
[
/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i
// ARMHF
],
[[O, "armhf"]],
[
// PocketPC mistakenly identified as PowerPC
/windows (ce|mobile); ppc;/i
],
[[O, "arm"]],
[
/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i
// PowerPC
],
[[O, /ower/, p, Le]],
[
/(sun4\w)[;\)]/i
// SPARC
],
[[O, "sparc"]],
[
/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i
// IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC
],
[[O, Le]]
],
device: [
[
//////////////////////////
// MOBILES & TABLETS
// Ordered by popularity
/////////////////////////
// Samsung
/\b(sch-i[89]0\d|shw-m380s|sm-[pt]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i
],
[I, [W, Pe], [D, B]],
[
/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,
/samsung[- ]([-\w]+)/i,
/sec-(sgh\w+)/i
],
[I, [W, Pe], [D, z]],
[
// Apple
/\((ip(?:hone|od)[\w ]*);/i
// iPod/iPhone
],
[I, [W, Ve], [D, z]],
[
/\((ipad);[-\w\),; ]+apple/i,
// iPad
/applecoremedia\/[\w\.]+ \((ipad)/i,
/\b(ipad)\d\d?,\d\d?[;\]].+ios/i
],
[I, [W, Ve], [D, B]],
[
// Huawei
/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i
],
[I, [W, Re], [D, B]],
[
/(?:huawei|honor)([-\w ]+)[;\)]/i,
/\b(nexus 6p|\w{2,4}-[atu]?[ln][01259x][012359][an]?)\b(?!.+d\/s)/i
],
[I, [W, Re], [D, z]],
[
// Xiaomi
/\b(poco[\w ]+)(?: bui|\))/i,
// Xiaomi POCO
/\b; (\w+) build\/hm\1/i,
// Xiaomi Hongmi 'numeric' models
/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,
// Xiaomi Hongmi
/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,
// Xiaomi Redmi
/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i
// Xiaomi Mi
],
[[I, /_/g, " "], [W, q], [D, z]],
[
/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i
// Mi Pad tablets
],
[[I, /_/g, " "], [W, q], [D, B]],
[
// OPPO
/; (\w+) bui.+ oppo/i,
/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i
],
[I, [W, "OPPO"], [D, z]],
[
// Vivo
/vivo (\w+)(?: bui|\))/i,
/\b(v[12]\d{3}\w?[at])(?: bui|;)/i
],
[I, [W, "Vivo"], [D, z]],
[
// Realme
/\b(rmx[12]\d{3})(?: bui|;|\))/i
],
[I, [W, "Realme"], [D, z]],
[
// Motorola
/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,
/\bmot(?:orola)?[- ](\w*)/i,
/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i
],
[I, [W, X], [D, z]],
[
/\b(mz60\d|xoom[2 ]{0,2}) build\//i
],
[I, [W, X], [D, B]],
[
// LG
/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i
],
[I, [W, Oe], [D, B]],
[
/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,
/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,
/\blg-?([\d\w]+) bui/i
],
[I, [W, Oe], [D, z]],
[
// Lenovo
/(ideatab[-\w ]+)/i,
/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i
],
[I, [W, "Lenovo"], [D, B]],
[
// Nokia
/(?:maemo|nokia).*(n900|lumia \d+)/i,
/nokia[-_ ]?([-\w\.]*)/i
],
[[I, /_/g, " "], [W, "Nokia"], [D, z]],
[
// Google
/(pixel c)\b/i
// Google Pixel C
],
[I, [W, oe], [D, B]],
[
/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i
// Google Pixel
],
[I, [W, oe], [D, z]],
[
// Sony
/droid.+ ([c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i
],
[I, [W, ae], [D, z]],
[
/sony tablet [ps]/i,
/\b(?:sony)?sgp\w+(?: bui|\))/i
],
[[I, "Xperia Tablet"], [W, ae], [D, B]],
[
// OnePlus
/ (kb2005|in20[12]5|be20[12][59])\b/i,
/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i
],
[I, [W, "OnePlus"], [D, z]],
[
// Amazon
/(alexa)webm/i,
/(kf[a-z]{2}wi)( bui|\))/i,
// Kindle Fire without Silk
/(kf[a-z]+)( bui|\)).+silk\//i
// Kindle Fire HD
],
[I, [W, Be], [D, B]],
[
/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i
// Fire Phone
],
[[I, /(.+)/g, "Fire Phone $1"], [W, Be], [D, z]],
[
// BlackBerry
/(playbook);[-\w\),; ]+(rim)/i
// BlackBerry PlayBook
],
[I, W, [D, B]],
[
/\b((?:bb[a-f]|st[hv])100-\d)/i,
/\(bb10; (\w+)/i
// BlackBerry 10
],
[I, [W, we], [D, z]],
[
// Asus
/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i
],
[I, [W, je], [D, B]],
[
/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i
],
[I, [W, je], [D, z]],
[
// HTC
/(nexus 9)/i
// HTC Nexus 9
],
[I, [W, "HTC"], [D, B]],
[
/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,
// HTC
// ZTE
/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,
/(alcatel|geeksphone|nexian|panasonic|sony)[-_ ]?([-\w]*)/i
// Alcatel/GeeksPhone/Nexian/Panasonic/Sony
],
[W, [I, /_/g, " "], [D, z]],
[
// Acer
/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i
],
[I, [W, "Acer"], [D, B]],
[
// Meizu
/droid.+; (m[1-5] note) bui/i,
/\bmz-([-\w]{2,})/i
],
[I, [W, "Meizu"], [D, z]],
[
// Sharp
/\b(sh-?[altvz]?\d\d[a-ekm]?)/i
],
[I, [W, "Sharp"], [D, z]],
[
// MIXED
/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,
// BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron
/(hp) ([\w ]+\w)/i,
// HP iPAQ
/(asus)-?(\w+)/i,
// Asus
/(microsoft); (lumia[\w ]+)/i,
// Microsoft Lumia
/(lenovo)[-_ ]?([-\w]+)/i,
// Lenovo
/(jolla)/i,
// Jolla
/(oppo) ?([\w ]+) bui/i
// OPPO
],
[W, I, [D, z]],
[
/(archos) (gamepad2?)/i,
// Archos
/(hp).+(touchpad(?!.+tablet)|tablet)/i,
// HP TouchPad
/(kindle)\/([\w\.]+)/i,
// Kindle
/(nook)[\w ]+build\/(\w+)/i,
// Nook
/(dell) (strea[kpr\d ]*[\dko])/i,
// Dell Streak
/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,
// Le Pan Tablets
/(trinity)[- ]*(t\d{3}) bui/i,
// Trinity Tablets
/(gigaset)[- ]+(q\w{1,9}) bui/i,
// Gigaset Tablets
/(vodafone) ([\w ]+)(?:\)| bui)/i
// Vodafone
],
[W, I, [D, B]],
[
/(surface duo)/i
// Surface Duo
],
[I, [W, de], [D, B]],
[
/droid [\d\.]+; (fp\du?)(?: b|\))/i
// Fairphone
],
[I, [W, "Fairphone"], [D, z]],
[
/(u304aa)/i
// AT&T
],
[I, [W, "AT&T"], [D, z]],
[
/\bsie-(\w*)/i
// Siemens
],
[I, [W, "Siemens"], [D, z]],
[
/\b(rct\w+) b/i
// RCA Tablets
],
[I, [W, "RCA"], [D, B]],
[
/\b(venue[\d ]{2,7}) b/i
// Dell Venue Tablets
],
[I, [W, "Dell"], [D, B]],
[
/\b(q(?:mv|ta)\w+) b/i
// Verizon Tablet
],
[I, [W, "Verizon"], [D, B]],
[
/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i
// Barnes & Noble Tablet
],
[I, [W, "Barnes & Noble"], [D, B]],
[
/\b(tm\d{3}\w+) b/i
],
[I, [W, "NuVision"], [D, B]],
[
/\b(k88) b/i
// ZTE K Series Tablet
],
[I, [W, "ZTE"], [D, B]],
[
/\b(nx\d{3}j) b/i
// ZTE Nubia
],
[I, [W, "ZTE"], [D, z]],
[
/\b(gen\d{3}) b.+49h/i
// Swiss GEN Mobile
],
[I, [W, "Swiss"], [D, z]],
[
/\b(zur\d{3}) b/i
// Swiss ZUR Tablet
],
[I, [W, "Swiss"], [D, B]],
[
/\b((zeki)?tb.*\b) b/i
// Zeki Tablets
],
[I, [W, "Zeki"], [D, B]],
[
/\b([yr]\d{2}) b/i,
/\b(dragon[- ]+touch |dt)(\w{5}) b/i
// Dragon Touch Tablet
],
[[W, "Dragon Touch"], I, [D, B]],
[
/\b(ns-?\w{0,9}) b/i
// Insignia Tablets
],
[I, [W, "Insignia"], [D, B]],
[
/\b((nxa|next)-?\w{0,9}) b/i
// NextBook Tablets
],
[I, [W, "NextBook"], [D, B]],
[
/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i
// Voice Xtreme Phones
],
[[W, "Voice"], I, [D, z]],
[
/\b(lvtel\-)?(v1[12]) b/i
// LvTel Phones
],
[[W, "LvTel"], I, [D, z]],
[
/\b(ph-1) /i
// Essential PH-1
],
[I, [W, "Essential"], [D, z]],
[
/\b(v(100md|700na|7011|917g).*\b) b/i
// Envizen Tablets
],
[I, [W, "Envizen"], [D, B]],
[
/\b(trio[-\w\. ]+) b/i
// MachSpeed Tablets
],
[I, [W, "MachSpeed"], [D, B]],
[
/\btu_(1491) b/i
// Rotor Tablets
],
[I, [W, "Rotor"], [D, B]],
[
/(shield[\w ]+) b/i
// Nvidia Shield Tablets
],
[I, [W, "Nvidia"], [D, B]],
[
/(sprint) (\w+)/i
// Sprint Phones
],
[W, I, [D, z]],
[
/(kin\.[onetw]{3})/i
// Microsoft Kin
],
[[I, /\./g, " "], [W, de], [D, z]],
[
/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i
// Zebra
],
[I, [W, m], [D, B]],
[
/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i
],
[I, [W, m], [D, z]],
[
///////////////////
// CONSOLES
///////////////////
/(ouya)/i,
// Ouya
/(nintendo) ([wids3utch]+)/i
// Nintendo
],
[W, I, [D, K]],
[
/droid.+; (shield) bui/i
// Nvidia
],
[I, [W, "Nvidia"], [D, K]],
[
/(playstation [345portablevi]+)/i
// Playstation
],
[I, [W, ae], [D, K]],
[
/\b(xbox(?: one)?(?!; xbox))[\); ]/i
// Microsoft Xbox
],
[I, [W, de], [D, K]],
[
///////////////////
// SMARTTVS
///////////////////
/smart-tv.+(samsung)/i
// Samsung
],
[W, [D, J]],
[
/hbbtv.+maple;(\d+)/i
],
[[I, /^/, "SmartTV"], [W, Pe], [D, J]],
[
/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i
// LG SmartTV
],
[[W, Oe], [D, J]],
[
/(apple) ?tv/i
// Apple TV
],
[W, [I, Ve + " TV"], [D, J]],
[
/crkey/i
// Google Chromecast
],
[[I, L + "cast"], [W, oe], [D, J]],
[
/droid.+aft(\w)( bui|\))/i
// Fire TV
],
[I, [W, Be], [D, J]],
[
/\(dtv[\);].+(aquos)/i
// Sharp
],
[I, [W, "Sharp"], [D, J]],
[
/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,
// Roku
/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i
// HbbTV devices
],
[[W, re], [I, re], [D, J]],
[
/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i
// SmartTV from Unidentified Vendors
],
[[D, J]],
[
///////////////////
// WEARABLES
///////////////////
/((pebble))app/i
// Pebble
],
[W, I, [D, be]],
[
/droid.+; (glass) \d/i
// Google Glass
],
[I, [W, oe], [D, be]],
[
/droid.+; (wt63?0{2,3})\)/i
],
[I, [W, m], [D, be]],
[
/(quest( 2)?)/i
// Oculus Quest
],
[I, [W, ve], [D, be]],
[
///////////////////
// EMBEDDED
///////////////////
/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i
// Tesla
],
[W, [D, $]],
[
////////////////////
// MIXED (GENERIC)
///////////////////
/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i
// Android Phones from Unidentified Vendors
],
[I, [D, z]],
[
/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i
// Android Tablets from Unidentified Vendors
],
[I, [D, B]],
[
/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i
// Unidentifiable Tablet
],
[[D, B]],
[
/(phone|mobile(?:[;\/]| safari)|pda(?=.+windows ce))/i
// Unidentifiable Mobile
],
[[D, z]],
[
/(android[-\w\. ]{0,9});.+buil/i
// Generic Android Device
],
[I, [W, "Generic"]]
],
engine: [
[
/windows.+ edge\/([\w\.]+)/i
// EdgeHTML
],
[j, [T, w + "HTML"]],
[
/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i
// Blink
],
[j, [T, "Blink"]],
[
/(presto)\/([\w\.]+)/i,
// Presto
/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,
// WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna
/ekioh(flow)\/([\w\.]+)/i,
// Flow
/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,
// KHTML/Tasman/Links
/(icab)[\/ ]([23]\.[\d\.]+)/i
// iCab
],
[T, j],
[
/rv\:([\w\.]{1,9})\b.+(gecko)/i
// Gecko
],
[j, T]
],
os: [
[
// Windows
/microsoft (windows) (vista|xp)/i
// Windows (iTunes)
],
[T, j],
[
/(windows) nt 6\.2; (arm)/i,
// Windows RT
/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,
// Windows Phone
/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i
],
[T, [j, P, he]],
[
/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i
],
[[T, "Windows"], [j, P, he]],
[
// iOS/macOS
/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,
// iOS
/cfnetwork\/.+darwin/i
],
[[j, /_/g, "."], [T, "iOS"]],
[
/(mac os x) ?([\w\. ]*)/i,
/(macintosh|mac_powerpc\b)(?!.+haiku)/i
// Mac OS
],
[[T, "Mac OS"], [j, /_/g, "."]],
[
// Mobile OSes
/droid ([\w\.]+)\b.+(android[- ]x86)/i
// Android-x86
],
[j, T],
[
// Android/WebOS/QNX/Bada/RIM/Maemo/MeeGo/Sailfish OS
/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,
/(blackberry)\w*\/([\w\.]*)/i,
// Blackberry
/(tizen|kaios)[\/ ]([\w\.]+)/i,
// Tizen/KaiOS
/\((series40);/i
// Series 40
],
[T, j],
[
/\(bb(10);/i
// BlackBerry 10
],
[j, [T, we]],
[
/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i
// Symbian
],
[j, [T, "Symbian"]],
[
/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i
// Firefox OS
],
[j, [T, le + " OS"]],
[
/web0s;.+rt(tv)/i,
/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i
// WebOS
],
[j, [T, "webOS"]],
[
// Google Chromecast
/crkey\/([\d\.]+)/i
// Google Chromecast
],
[j, [T, L + "cast"]],
[
/(cros) [\w]+ ([\w\.]+\w)/i
// Chromium OS
],
[[T, "Chromium OS"], j],
[
// Console
/(nintendo|playstation) ([wids345portablevuch]+)/i,
// Nintendo/Playstation
/(xbox); +xbox ([^\);]+)/i,
// Microsoft Xbox (360, One, X, S, Series X, Series S)
// Other
/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,
// Joli/Palm
/(mint)[\/\(\) ]?(\w*)/i,
// Mint
/(mageia|vectorlinux)[; ]/i,
// Mageia/VectorLinux
/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,
// Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware/Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus/Raspbian/Plan9/Minix/RISCOS/Contiki/Deepin/Manjaro/elementary/Sabayon/Linspire
/(hurd|linux) ?([\w\.]*)/i,
// Hurd/Linux
/(gnu) ?([\w\.]*)/i,
// GNU
/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,
// FreeBSD/NetBSD/OpenBSD/PC-BSD/GhostBSD/DragonFly
/(haiku) (\w+)/i
// Haiku
],
[T, j],
[
/(sunos) ?([\w\.\d]*)/i
// Solaris
],
[[T, "Solaris"], j],
[
/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,
// Solaris
/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,
// AIX
/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,
// BeOS/OS2/AmigaOS/MorphOS/OpenVMS/Fuchsia/HP-UX
/(unix) ?([\w\.]*)/i
// UNIX
],
[T, j]
]
}, Ee = function(te, ie) {
if (typeof te === x && (ie = te, te = o), !(this instanceof Ee))
return new Ee(te, ie).getResult();
var ee = te || (typeof n !== y && n.navigator && n.navigator.userAgent ? n.navigator.userAgent : p), Te = ie ? U(Ie, ie) : Ie;
return this.getBrowser = function() {
var Se = {};
return Se[T] = o, Se[j] = o, k.call(Se, ee, Te.browser), Se.major = Ue(Se.version), Se;
}, this.getCPU = function() {
var Se = {};
return Se[O] = o, k.call(Se, ee, Te.cpu), Se;
}, this.getDevice = function() {
var Se = {};
return Se[W] = o, Se[I] = o, Se[D] = o, k.call(Se, ee, Te.device), Se;
}, this.getEngine = function() {
var Se = {};
return Se[T] = o, Se[j] = o, k.call(Se, ee, Te.engine), Se;
}, this.getOS = function() {
var Se = {};
return Se[T] = o, Se[j] = o, k.call(Se, ee, Te.os), Se;
}, this.getResult = function() {
return {
ua: this.getUA(),
browser: this.getBrowser(),
engine: this.getEngine(),
os: this.getOS(),
device: this.getDevice(),
cpu: this.getCPU()
};
}, this.getUA = function() {
return ee;
}, this.setUA = function(Se) {
return ee = typeof Se === h && Se.length > ye ? re(Se, ye) : Se, this;
}, this.setUA(ee), this;
};
Ee.VERSION = s, Ee.BROWSER = M([T, j, F]), Ee.CPU = M([O]), Ee.DEVICE = M([I, W, D, K, z, J, B, be, $]), Ee.ENGINE = Ee.OS = M([T, j]), e.exports && (r = e.exports = Ee), r.UAParser = Ee;
var pe = typeof n !== y && (n.jQuery || n.Zepto);
if (pe && !pe.ua) {
var G = new Ee();
pe.ua = G.getResult(), pe.ua.get = function() {
return G.getUA();
}, pe.ua.set = function(te) {
G.setUA(te);
var ie = G.getResult();
for (var ee in ie)
pe.ua[ee] = ie[ee];
};
}
})(typeof window == "object" ? window : oA);
})(Mo, Mo.exports);
var VA = Mo.exports;
const FA = /* @__PURE__ */ cA(VA);
let ss = 0;
function jA() {
return ss = ss ? ss + 1 : Date.now(), `c-${ss}`;
}
const vn = FA(), ys = vn.os.name, HA = ys && ys.toLowerCase().indexOf("android") >= 0, GA = ys && ys.toLowerCase().indexOf("ios") >= 0, sa = vn.device.type === "mobile" || HA || GA, Mu = "kwai-p";
let Po = vu.ERROR;
typeof location < "u" && (Po = gu.loadLogLevel("kwai-player-log") || vu.ERROR, Ii.setLevel(Po).setName(Mu));
const Pu = _A.EventEmitter;
(function() {
try {
if (typeof document < "u") {
var e = document.createElement("style");
e.appendChild(document.createTextNode("._kwai-player_1ufc0_2{position:relative;margin:0;padding:0}._kwai-player_1ufc0_2 *{margin:0;padding:0}._kwai-player-video-interactive_1ufc0_11{display:block;width:100%;height:100%;position:absolute;top:0;left:0}._kwai-player-poster_1ufc0_19{width:100%;height:100%;position:absolute;left:0;top:0;background-color:#333;background-size:contain;background-position:center;background-repeat:no-repeat}._kwai-player-video_1ufc0_11{display:block;width:100%;height:100%;position:absolute;top:0;left:0}._kwai-player-video_1ufc0_11 video{display:block;width:100%;height:100%}._kwai-player-video_1ufc0_11 canvas{display:block;margin:0 auto;width:100%;height:100%;max-width:100%;max-height:100%;position:relative}._kwai-player-disable-scroll_1ufc0_52{overflow:hidden;height:100%}._kwai-player-yoda_1ufc0_56{display:block;width:100%;height:100%;position:absolute;top:0;left:0}")), document.head.appendChild(e);
}
} catch (r) {
console.error("vite-plugin-css-injected-by-js", r);
}
})();
var zA = Object.defineProperty, KA = (e, r, n) => r in e ? zA(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, tt = (e, r, n) => (KA(e, typeof r != "symbol" ? r + "" : r, n), n), Pa = /* @__PURE__ */ ((e) => (e.NONE = "none", e.KWAI = "kwai", e.KWAI2 = "kwai2", e))(Pa || {}), _n = /* @__PURE__ */ ((e) => (e.SYSTEM = "system", e.WINDOW = "window", e))(_n || {}), fs = /* @__PURE__ */ ((e) => (e.VIDEO = "video", e.VIDEO_INTERACTIVE = "videoInteractive", e.DEFAULT = "default", e))(fs || {}), We = /* @__PURE__ */ ((e) => (e.ERROR = "error", e.MANIFEST_PARSED = "manifestparsed", e.LEVEL_SWITCHING = "levelswitching", e.LEVEL_SWITCHED = "levelswitched", e.LEVEL_SWITCH_PLAYING = "levelswitchplaying", e.LEVEL_SWITCH_FAILED = "levelswitchfailed", e.LEVEL_UPDATED = "levelupdated", e.AUDIO_TRACKS_SWITCHING = "audiotrackswitching", e.AUDIO_TRACKS_SWITCHED = "audiotrackswitched", e.LOADSTART = "loadstart", e.PROGRESS = "progress", e.SUSPEND = "suspend", e.ABORT = "abort", e.EMPTIED = "emptied", e.STALLED = "stalled", e.LOADEDMETADATA = "loadedmetadata", e.LOADEDDATA = "loadeddata", e.CANPLAY = "canplay", e.CANPLAYTHROUGH = "canplaythrough", e.PLAYING = "playing", e.WAITING = "waiting", e.SEEKING = "seeking", e.SEEKED = "seeked", e.ENDED = "ended", e.DURATIONCHANGE = "durationchange", e.TIMEUPDATE = "timeupdate", e.PLAY = "play", e.PAUSE = "pause", e.RATECHANGE = "ratechange", e.RESIZE = "resize", e.VOLUMECHANGE = "volumechange", e.ENTER_PICTURE_IN_PICTURE = "enterpictureinpicture", e.LEAVE_PICTURE_IN_PICTURE = "leavepictureinpicture", e.REPORT = "report", e.VIDEO_RENDERER_CHANGE = "videorendererchange", e.FULLSCREEN_CHANGE = "fullscreenchange", e.ATTRIBUTE_CHANGE = "attribute:change", e.INTERACTION = "interaction", e.LIVE_SHIFT_CHANGE = "liveshiftchange", e.LIVE_SHIFT_TYPE_CHANGE = "liveshifttypechange", e.OBJECT_FIT_CHANGE = "objectfitchange", e.ATTRIBUTE_CHANGE_CONFIG = "attribute:change:config", e.ATTRIBUTE_CHANGE_SRC = "attribute:change:src", e.ATTRIBUTE_CHANGE_VIDEO_ID = "attribute:change:videoid", e.ATTRIBUTE_CHANGE_PREVIEW_URL = "attribute:change:previewurl", e.ATTRIBUTE_CHANGE_MASK_URL = "attribute:change:maskurl", e.ATTRIBUTE_CHANGE_CROSS_ORIGIN = "attribute:change:crossorigin", e.ATTRIBUTE_CHANGE_PRELOAD = "attribute:change:preload", e.ATTRIBUTE_CHANGE_CURRENT_TIME = "attribute:change:currenttime", e.ATTRIBUTE_CHANGE_DEFAULT_PLAYBACK_RATE = "attribute:change:defaultplaybackrate", e.ATTRIBUTE_CHANGE_PLAYBACK_RATE = "attribute:change:playbackrate", e.ATTRIBUTE_CHANGE_AUTOPLAY = "attribute:change:autoplay", e.ATTRIBUTE_CHANGE_LOOP = "attribute:change:loop", e.ATTRIBUTE_CHANGE_CONTROLS = "attribute:change:controls", e.ATTRIBUTE_CHANGE_VOLUME = "attribute:change:volume", e.ATTRIBUTE_CHANGE_MUTED = "attribute:change:muted", e.ATTRIBUTE_CHANGE_DEFAULT_MUTED = "attribute:change:defaultmuted", e.ATTRIBUTE_CHANGE_POSTER = "attribute:change:poster", e.ATTRIBUTE_CHANGE_DISABLE_PICTURE_IN_PICTURE = "attribute:change:disablepictureinpicture", e.ATTRIBUTE_CHANGE_PLAYSINLINE = "attribute:change:playsinline", e.ATTRIBUTE_CHANGE_DISABLE_ADAPTIVE = "attribute:change:disableadaptive", e.ATTRIBUTE_CHANGE_DISABLE_DOWNLOAD = "attribute:change:disabledownload", e.ATTRIBUTE_CHANGE_DISABLE_MASK = "attribute:change:disablemask", e.ATTRIBUTE_CHANGE_DISABLE_HOTKEY = "attribute:change:disablehotkey", e.ATTRIBUTE_CHANGE_DISABLE_DANMAKU = "attribute:change:disabledanmaku", e.ATTRIBUTE_CHANGE_DANMAKU_RENDERING = "attribute:change:danmakurendering", e.ATTRIBUTE_CHANGE_DANMAKU_CONTROLS_POS = "attribute:change:danmakucontrolspos", e.ATTRIBUTE_CHANGE_DANMAKU_CONTROLS_POS_FULLSCREEN = "attribute:change:danmakucontrolsposfullscreen", e.ATTRIBUTE_CHANGE_CURRENT_LEVEL = "attribute:change:currentlevel", e.ATTRIBUTE_CHANGE_NEXT_LEVEL = "attribute:change:nextlevel", e.ATTRIBUTE_CHANGE_CURRENT_FRAME = "attribute:change:currentframe", e.ATTRIBUTE_CHANGE_AUDIO_TRACK = "attribute:change:audiotrack", e.ATTRIBUTE_CHANGE_PREFETCH = "attribute:change:prefetch", e.ATTRIBUTE_CHANGE_SHOW_PROGRESS = "attribute:change:showprogress", e.ATTRIBUTE_CHANGE_SHOW_TIME = "attribute:change:showtime", e.ATTRIBUTE_CHANGE_SHOW_NEXT = "attribute:change:shownext", e.ATTRIBUTE_CHANGE_SHOW_PREV = "attribute:change:showprev", e.ATTRIBUTE_CHANGE_BIZ_DATA = "attribute:change:bizdata", e.ATTRIBUTE_CHANGE_LIVE_TIME = "attribute:change:livetime", e.ATTRIBUTE_CHANGE_SHOW_INFO_PANEL = "attribute:change:showinfopanel", e.CLICK_NEXT = "clicknext", e.CLICK_LOGIN = "clicklogin", e.CLICK_REGISTER = "clickregister", e.CLICK_VIP = "clickvip", e))(We || {});
/*! For license information please see no-wasm-hdr.mjs.LICENSE.txt */
var Ai = function(e) {
var r = {};
function n(o) {
if (r[o])
return r[o].exports;
var s = r[o] = { i: o, l: !1, exports: {} };
return e[o].call(s.exports, s, s.exports, n), s.l = !0, s.exports;
}
return n.m = e, n.c = r, n.d = function(o, s, p) {
n.o(o, s) || Object.defineProperty(o, s, { enumerable: !0, get: p });
}, n.r = function(o) {
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(o, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(o, "__esModule", { value: !0 });
}, n.t = function(o, s) {
if (1 & s && (o = n(o)), 8 & s || 4 & s && typeof o == "object" && o && o.__esModule)
return o;
var p = /* @__PURE__ */ Object.create(null);
if (n.r(p), Object.defineProperty(p, "default", { enumerable: !0, value: o }), 2 & s && typeof o != "string")
for (var g in o)
n.d(p, g, function(C) {
return o[C];
}.bind(null, g));
return p;
}, n.n = function(o) {
var s = o && o.__esModule ? function() {
return o.default;
} : function() {
return o;
};
return n.d(s, "a", s), s;
}, n.o = function(o, s) {
return Object.prototype.hasOwnProperty.call(o, s);
}, n.p = "", n(n.s = 62);
}([function(e, r, n) {
n.d(r, "c", function() {
return o;
}), n.d(r, "q", function() {
return s;
}), n.d(r, "t", function() {
return p;
}), n.d(r, "s", function() {
return g;
}), n.d(r, "b", function() {
return C;
}), n.d(r, "d", function() {
return y;
}), n.d(r, "l", function() {
return x;
}), n.d(r, "i", function() {
return h;
}), n.d(r, "k", function() {
return F;
}), n.d(r, "r", function() {
return I;
}), n.d(r, "p", function() {
return T;
}), n.d(r, "m", function() {
return D;
}), n.d(r, "e", function() {
return W;
}), n.d(r, "f", function() {
return j;
}), n.d(r, "o", function() {
return O;
}), n.d(r, "a", function() {
return K;
}), n.d(r, "n", function() {
return z;
}), n.d(r, "h", function() {
return B;
}), n.d(r, "g", function() {
return J;
}), n.d(r, "j", function() {
return be;
});
var o = function($) {
return $.unknown = "unknown", $.h264 = "h264", $.hevc = "hevc", $.av1 = "av1", $.kvc3 = "kvc3", $.kvc4 = "kvc4", $.kvc5 = "kvc5", $.kvc6 = "kvc6", $.aac = "aac", $.mp3 = "mp3", $.opus = "opus", $.yuv = "yuv", $.rawvideo = "rawvideo", $.vvc = "vvc", $.bvc2 = "bvc2", $.kvc30 = "kvc30", $;
}({}), s = function($) {
return $.UNKNOWN = "unknown", $.FHD = "fhd", $.UHD_4K = "4k", $;
}({}), p = function($) {
return $.kvc3 = "kvc3", $.kvc4 = "kvc4", $.kvc5 = "kvc5", $.kvc6 = "kvc6", $.h265 = "h265", $.kw265 = "kw265", $.kvc30 = "kvc30", $;
}({}), g = function($) {
return $.video = "video", $.canvas = "canvas", $;
}({}), C = function($) {
return $.canvas2d = "canvas2d", $.webgl = "webgl", $;
}({}), y = function($) {
return $.buildin = "buildin", $.wasm = "wasm", $.none = "none", $.unsupported = "unsupported", $;
}({}), x = function($) {
return $.KWAI_FLV_ABR = "kwaiFlvAbr", $.KWAI_FLV_MP = "kwaiFlvMultipart", $.KWAI = "kwai", $.FILE = "file", $.OTHERS = "others", $;
}({}), h = function($) {
return $.flv = "flv", $.hls = "hls", $.hls_ts = "hls_ts", $.hls_fmp4 = "hls_fmp4", $.webrtc = "webrtc", $.mp4 = "mp4", $.raw = "raw", $.mp3 = "mp3", $.wav = "wav", $.aac = "aac", $.matroska = "matroska", $.ts = "ts", $.ivf = "ivf", $.yuv = "yuv", $.unknown = "unknown", $;
}({}), F = function($) {
return $.RTC = "rtc_retry", $.BACKUP = "backup", $.FALLBACK = "fallback", $.LOADER = "loader", $;
}({}), I = function($) {
return $.AUTO = "auto", $.MIN = "min", $;
}({}), T = function($) {
return $.NONE = "none", $.WAITING = "waiting", $;
}({}), D = function($) {
return $.NEXT = "next", $.PREV = "prev", $;
}({}), W = function($) {
return $.STANDARD = "standard", $.QUERY_START_END = "queryStartEnd", $;
}({}), j = function($) {
return $.MAIN = "main", $.AUDIO = "audio", $.SUBTITLE = "subtitle", $;
}({}), O = function($) {
return $.VIDEO = "video", $.AUDIO = "audio", $;
}({}), K = function($) {
return $.unknown = "unknown", $.native = "native", $.mse = "mse", $.rtc = "rtc", $;
}({}), z = function($) {
return $[$.Normal = 0] = "Normal", $[$.V360 = 1] = "V360", $[$.V180 = 2] = "V180", $;
}({}), B = function($) {
return $[$.normal = 0] = "normal", $[$.internal = 1] = "internal", $[$.retry = 2] = "retry", $;
}({}), J = function($) {
return $.NONE = "none", $.KWAI = "kwai", $.KWAI2 = "kwai2", $;
}({}), be = function($) {
return $.UNKNOWN = "", $.PROBABLY = "probably", $;
}({});
}, function(e, r, n) {
function o(T) {
return { data: T, byteIndex: 0, bitIndex: 0 };
}
function s(T, D) {
if (h(T) > D) {
var W = D % 8;
T.byteIndex = T.byteIndex + Math.floor(D / 8) + Math.floor((T.bitIndex + W) / 8), T.bitIndex = (T.bitIndex + W) % 8;
} else
T.byteIndex = T.data.byteLength - 1, T.bitIndex = 7;
}
function p(T, D) {
if (D > 32)
throw new Error("len must be less 32");
var W = T.data[T.byteIndex], j = Math.min(8 - T.bitIndex, D), O = D - j;
T.bitIndex += j;
var K = W >> 8 - T.bitIndex & Math.pow(2, j) - 1;
return T.bitIndex === 8 && (T.bitIndex = 0, T.byteIndex++), O ? K << O | p(T, O) : K;
}
function g(T) {
return p(T, I(T) + 1) - 1;
}
function C(T) {
var D = g(T);
return Math.pow(-1, D + 1) * Math.ceil(D / 2);
}
function y(T) {
var D = I(T);
return D >= 32 ? 0 : p(T, D) + (1 << D) - 1;
}
function x(T) {
for (var D = 0, W = 0; W < 8; W++) {
var j = p(T, 8);
if (D |= (127 & j) << 7 * W, !(128 & j))
break;
}
return D;
}
function h(T) {
return 8 * (T.data.byteLength - T.byteIndex) - T.bitIndex;
}
function F(T) {
T.bitIndex > 0 && (T.byteIndex++, T.bitIndex = 0);
}
function I(T) {
for (var D = h(T), W = 0; W < D; W++)
if (p(T, 1) === 1)
return T.bitIndex === 0 ? (T.byteIndex--, T.bitIndex = 7) : T.bitIndex--, W;
return 0;
}
n.d(r, "c", function() {
return o;
}), n.d(r, "g", function() {
return s;
}), n.d(r, "a", function() {
return p;
}), n.d(r, "h", function() {
return g;
}), n.d(r, "f", function() {
return C;
}), n.d(r, "i", function() {
return y;
}), n.d(r, "e", function() {
return x;
}), n.d(r, "d", function() {
return h;
}), n.d(r, "b", function() {
return F;
});
}, function(e, r, n) {
var o = function(s) {
return s.METADATA = "metadata", s.MEDIA_INFO = "mediaInfo", s.PARSING_INIT_SEGMENT = "parsingInitSegment", s.PARSING_DATA = "parsingData", s.PARSED_DATA = "parsedData", s.SCRIPT_PARSED = "scriptParsed", s.KEY_FRAME_INDEXS = "keyFrameIndexs", s.VIDEO_FRAME_INFO = "videoFrameInfo", s.DISCONTINUITY = "discontinuity", s.REPORT = "report", s.LOAD_END = "loadEnd", s.ERROR = "error", s.MANIFEST_LOADED = "manifestLoaded", s.MANIFEST_PARSED = "manifestParsed", s.LEVEL_SWITCHING = "levelSwitching", s.LEVEL_SWITCHED = "levelSwitched", s.LEVEL_SWITCH_PLAYING = "levelSwitchPlaying", s.LEVEL_SWITCH_FAILED = "levelSwitchFailed", s.LEVEL_LOADED = "levelLoaded", s.LEVEL_UPDATED = "levelUpdated", s.AUDIO_TRACK_SWITCHING = "audioTrackSwitching", s.AUDIO_TRACK_SWITCHED = "audioTrackSwitched", s.AUDIO_TRACK_UPDATED = "audioTrackUpdated", s.AUDIO_TRACK_SWITCH_FAILED = "audioTrackSwitchFailed", s.HLS_MANIFEST_PARSED = "hlsManifestParsed", s.HLS_KEY_LOADED = "hlsKeyLoaded", s.AUDIO_TRACK_LOADED = "audioLoaded", s.SUBTITLE_TRACK_LOADED = "subtitleTrackLoaded", s.SUBTITLE_LOADED = "subtitleLoaded", s.SUBTITLE_TRACK_SWITCHED = "subtitleTrackSwitched", s.SUBTITLE_TRACK_UPDATED = "subtitleTrackUpdated", s.BUFFER_CLEANING = "bufferCleaning", s.VIDEO_SEEK = "vdeoSeek", s.ABR_NEXT = "abrNext", s.PRIV_NAL = "privNal", s.SEI = "sei", s.AAC_PRIV = "aacPriv", s.RAW_DATA = "rawData", s.MP4_NOT_FASTSTART = "mp4NotFaststart", s.VIDEO_CODEC_DETECTED = "videoCodecChange", s.H265_DETECTED = "h265Detected", s.VIDEO_RENDERER_CHANGE = "videoRendererChange", s.DEC_LIB_LOADED = "decLibLoaded", s.DEC_INIT_COMPLETE = "decoderInitComplete", s.DEC_VIDEO_READY = "decVideoReady", s.STEP = "step", s.RENDERER_INIT_COMPLETE = "rendererInitComplete", s.RENDERER_BUF_EXPIRED = "rendererBufExpired", s.RENDERER_SEEK = "rendererSeek", s.RENDERER_BUF_UPDATE = "rendererBufUpdate", s.RENDERER_DRAW = "rendererDraw", s.RENDERER_WAITING = "rendererWaiting", s.RENDERER_WAITING_END = "rendererWaitingEnd", s.DECODER_FRAME = "decoderFrame", s.DECODER_IMG = "decoderImg", s.DECODER_SEEK = "decoderSeek", s.DECODER_SEEK_ABORT = "decoderSeekAbort", s.DECODER_WAITING = "decoderWaiting", s.DECODER_DATA_END = "decoderDataEnd", s.DECODER_BUF_LOW = "decoderDataEmpty", s.DECODER_DROP_FRAME = "decocerDropFrame", s.DECODER_MEDIA_INFO = "decoderMediaInfo", s.MEDIA_CONNECTED = "mediaConnected", s.LOADER_CHUNK_ARRIVAL = "loaderChunkArrival", s.DEMUXER_DETECTED = "demuxerDetected", s.MEDIA_DEMUX = "mediaDemux", s.KEY_FRAME = "keyFrame", s.USE_BACKUP = "useBackup", s.NEW_SOURCE = "newSource", s.DOWNLOAD = "download", s.STOP_LOAD = "stopLoad", s.LOAD = "load", s.WAITING = "waiting", s.LOADEDMETADATA = "loadedmetadata", s.LOADEDDATA = "loadeddata", s.CANPLAY = "canplay", s.SEEKING = "seeking", s.SEEK_WITH_LOAD = "seekWithLoad", s.SEEKED = "seeked", s.PLAYING = "playing", s.PAUSE = "pause", s.PLAY = "play", s.ENDED = "ended", s.TIMEUPDATE = "timeupdate", s.PROGRESS = "progress", s.RATE_CHANGE = "ratechange", s.DURATION_CHANGE = "durationchange", s.HEARTBEAT = "heartbeat", s.MSE_UPDATE = "mseUpdate", s.MSE_BUFFER_FULL = "mseBufferFull", s.MSE_SOURCE_CLOSE = "mseSourceClose", s.RETRY = "retry", s.WORKER_LOG = "workerLog", s.VISIBILITY_CHANGE = "visibilityChange", s.SCREENSHOT = "screenshot", s;
}(o || {});
r.a = o;
}, function(e, r, n) {
n.d(r, "b", function() {
return s;
}), n.d(r, "a", function() {
return p;
}), n.d(r, "c", function() {
return g;
}), n.d(r, "e", function() {
return C;
}), n.d(r, "f", function() {
return h;
}), n.d(r, "g", function() {
return F;
}), n.d(r, "d", function() {
return I;
});
var o = n(19), s = function(T) {
return T.NETWORK_ERROR = "networkError", T.MEDIA_ERROR = "mediaError", T.KEY_SYSTEM_ERROR = "keySystemError", T.MUX_ERROR = "muxError", T.OTHER_ERROR = "otherError", T.MSE_ERROR = "mseError", T.DECODER_ERROR = "decoderError", T.RENDERER_ERROR = "rendererError", T;
}({}), p = function(T) {
return T[T.LOAD_ERROR = 10] = "LOAD_ERROR", T[T.MANIFEST_LOAD_ERROR = 11] = "MANIFEST_LOAD_ERROR", T[T.LEVEL_LOAD_ERROR = 12] = "LEVEL_LOAD_ERROR", T[T.AUDIO_TRACK_LOAD_ERROR = 13] = "AUDIO_TRACK_LOAD_ERROR", T[T.KEY_LOAD_ERROR = 14] = "KEY_LOAD_ERROR", T[T.KEY_SYSTEM_LICENSE_REQUEST_FAILED = 15] = "KEY_SYSTEM_LICENSE_REQUEST_FAILED", T[T.DEC_LIB_LOAD_ERROR = 16] = "DEC_LIB_LOAD_ERROR", T[T.RTC_SDP_LOAD_ERROR = 17] = "RTC_SDP_LOAD_ERROR", T[T.SUBTITLE_TRACK_LOAD_ERROR = 18] = "SUBTITLE_TRACK_LOAD_ERROR", T[T.CANNOT_SEEK = 100] = "CANNOT_SEEK", T[T.VIDEO_ERROR = 101] = "VIDEO_ERROR", T[T.UNSUPPORTED = 102] = "UNSUPPORTED", T[T.CONFIG_ERROR = 103] = "CONFIG_ERROR", T[T.OTHER = 104] = "OTHER", T[T.UNKNOWN = 105] = "UNKNOWN", T[T.CANNOT_SEEK_BY_FRAME_INDEX = 106] = "CANNOT_SEEK_BY_FRAME_INDEX", T[T.SRC_EMPTY = 107] = "SRC_EMPTY", T[T.VIDEO_NO_SIZE = 108] = "VIDEO_NO_SIZE", T[T.NO_TRACKS_AVAILABLE = 109] = "NO_TRACKS_AVAILABLE", T[T.VIDEO_ERROR_1 = 111] = "VIDEO_ERROR_1", T[T.VIDEO_ERROR_2 = 112] = "VIDEO_ERROR_2", T[T.VIDEO_ERROR_3 = 113] = "VIDEO_ERROR_3", T[T.VIDEO_ERROR_4 = 114] = "VIDEO_ERROR_4", T[T.MEDIASOURCE_ERROR = 200] = "MEDIASOURCE_ERROR", T[T.ADDSOURCEBUFFER_ERROR = 201] = "ADDSOURCEBUFFER_ERROR", T[T.SOURCEBUFFER_ERROR = 202] = "SOURCEBUFFER_ERROR", T[T.ENDOFSTREAM_ERROR = 203] = "ENDOFSTREAM_ERROR", T[T.APPENDBUFFER_ERROR = 204] = "APPENDBUFFER_ERROR", T[T.CHANGETYPE_ERROR = 205] = "CHANGETYPE_ERROR", T[T.MSE_CAPABILITY_ERROR = 206] = "MSE_CAPABILITY_ERROR", T[T.MSE_SOURCE_BUFFER_CLOSE_ERROR = 207] = "MSE_SOURCE_BUFFER_CLOSE_ERROR", T[T.PARSING_ERROR = 301] = "PARSING_ERROR", T[T.REMUX_ERROR = 302] = "REMUX_ERROR", T[T.REMUX_ALLOC_ERROR = 303] = "REMUX_ALLOC_ERROR", T[T.REMUX_WORKER_ERROR = 304] = "REMUX_WORKER_ERROR", T[T.DEMUX_NOT_FOUND = 305] = "DEMUX_NOT_FOUND", T[T.MANIFEST_PARSING_ERROR = 400] = "MANIFEST_PARSING_ERROR", T[T.LEVEL_NO_UPDATE_ERROR = 402] = "LEVEL_NO_UPDATE_ERROR", T[T.KEY_SYSTEM_NO_ACCESS = 500] = "KEY_SYSTEM_NO_ACCESS", T[T.KEY_SYSTEM_NO_SESSION = 501] = "KEY_SYSTEM_NO_SESSION", T[T.KEY_SYSTEM_URL_ERROR = 502] = "KEY_SYSTEM_URL_ERROR", T[T.KEY_SYSTEM_NO_KEYS = 505] = "KEY_SYSTEM_NO_KEYS", T[T.FRAG_DECRYPT_ERROR = 506] = "FRAG_DECRYPT_ERROR", T[T.KEY_SYSTEM_NO_INIT_DATA = 507] = "KEY_SYSTEM_NO_INIT_DATA", T[T.KEY_SYSTEM_UNSUPPORTED = 508] = "KEY_SYSTEM_UNSUPPORTED", T[T.DECODER_LOAD_ERROR = 600] = "DECODER_LOAD_ERROR", T[T.DECODER_INIT_ERROR = 601] = "DECODER_INIT_ERROR", T[T.DECODER_DRAW_ERROR = 602] = "DECODER_DRAW_ERROR", T[T.DECODER_WEBGL_ERROR = 603] = "DECODER_WEBGL_ERROR", T[T.DECODER_UNSUPPORTED = 604] = "DECODER_UNSUPPORTED", T[T.DECODER_COPY_YUV_ERROR = 605] = "DECODER_COPY_YUV_ERROR", T[T.DECODER_DEC_ERROR = 606] = "DECODER_DEC_ERROR", T[T.DECODER_2D_ERROR = 607] = "DECODER_2D_ERROR", T[T.SCREENSHOT_INIT_ERROR = 700] = "SCREENSHOT_INIT_ERROR", T[T.SCREENSHOT_EMPTY_DATA_ERROR = 701] = "SCREENSHOT_EMPTY_DATA_ERROR", T[T.SCREENSHOT_CREATE_IMG_ERROR = 702] = "SCREENSHOT_CREATE_IMG_ERROR", T[T.LIVE_DISCONNECTED_ERROR = 1009] = "LIVE_DISCONNECTED_ERROR", T[T.WEBRTC_DISCONNECTED_ERROR = 1010] = "WEBRTC_DISCONNECTED_ERROR", T[T.WEBRTC_FAILED_ERROR = 1011] = "WEBRTC_FAILED_ERROR", T[T.WEBRTC_CLOSED_ERROR = 1012] = "WEBRTC_CLOSED_ERROR", T[T.WEBRTC_ICE_CANDIDATE_ERROR = 1013] = "WEBRTC_ICE_CANDIDATE_ERROR", T[T.WEBRTC_ICE_CONNECTION_ERROR = 1014] = "WEBRTC_ICE_CONNECTION_ERROR", T[T.WEBRTC_OFFER_ERROR = 1015] = "WEBRTC_OFFER_ERROR", T[T.WEBRTC_ANSWER_ERROR = 1016] = "WEBRTC_ANSWER_ERROR", T[T.WEBRTC_TRANSMISSION_DATA_NULL = 1017] = "WEBRTC_TRANSMISSION_DATA_NULL", T[T.WEBRTC_CONNECT_TIMEOUT = 1018] = "WEBRTC_CONNECT_TIMEOUT", T[T.WEBRTC_CONNECT_FAILED = 1019] = "WEBRTC_CONNECT_FAILED", T;
}({}), g = [p.VIDEO_ERROR, p.VIDEO_ERROR_1, p.VIDEO_ERROR_2, p.VIDEO_ERROR_3, p.VIDEO_ERROR_4];
function C(T, D, W, j) {
var O = { type: T, details: D, code: 0, fatal: !0, reason: W };
if (j)
for (var K in j) {
var z = j[K];
z !== void 0 && (O[K] = z);
}
return O;
}
var y = { other4xx: "05", serverError: "06", timeoutOpen: "07", timeoutIO: "08", handlingDataError: "10", other: "99" }, x = { 400: "01", 401: "02", 403: "03", 404: "04", 200: "09", 206: "09" };
function h(T) {
return T.indexOf(o.a.LOADER_CONNECT_TIMEOUT) >= 0;
}
function F(T) {
return T.indexOf(o.a.LOADER_TRANS_TIMEOUT) >= 0;
}
function I(T, D, W) {
if (W === void 0 && (W = 0), T >= 100)
return T;
var j = "00";
return h(D) ? j = y.timeoutOpen : F(D) ? j = y.timeoutIO : function(O) {
return O.indexOf(o.a.HANDLING_DATA_ERROR) >= 0;
}(D) ? j = y.handlingDataError : Object.prototype.hasOwnProperty.call(x, W) ? j = W !== 200 && W !== 206 || !D ? x[W] || "00" : y.other : /^4\d{2}$/.test(W.toString()) ? j = y.other4xx : /^5\d{2}$/.test(W.toString()) && (j = y.serverError), parseInt(T + j, 10);
}
}, function(e, r, n) {
n.d(r, "a", function() {
return s;
}), n.d(r, "f", function() {
return p;
}), n.d(r, "k", function() {
return g;
}), n.d(r, "c", function() {
return C;
}), n.d(r, "g", function() {
return y;
}), n.d(r, "d", function() {
return x;
}), n.d(r, "h", function() {
return h;
}), n.d(r, "l", function() {
return F;
}), n.d(r, "e", function() {
return I;
}), n.d(r, "j", function() {
return T;
}), n.d(r, "i", function() {
return D;
}), n.d(r, "b", function() {
return W;
});
var o = "uin8arr out of range.";
function s(j, O, K) {
var z = K ? O + K : j.byteLength;
if (Array.from)
return String.fromCharCode.apply(null, Array.from(j.subarray(O, z)));
for (var B = [], J = j.subarray(O, z), be = 0; be < J.length; be++)
B.push(J[be]);
return String.fromCharCode.apply(null, B);
}
function p(j, O, K) {
if (O === void 0 && (O = 0), K === void 0 && (K = !1), O + 1 >= j.length)
throw new Error(o + " " + O + "/" + j.length);
return K ? (j[O + 1] << 8) + j[O] : (j[O] << 8) + j[O + 1];
}
function g(j, O, K) {
if (K === void 0 && (K = 0), O.byteLength - K < 2)
throw new Error(o + " " + K + "/" + O.length);
O[K] = j >> 8 & 255, O[K + 1] = 255 & j;
}
function C(j, O, K) {
if (O === void 0 && (O = 0), K === void 0 && (K = !1), O + 1 >= j.length)
throw new Error(o + " " + O + "/" + j.length);
var z = 0;
return 32768 & (z = K ? (j[O + 1] << 8) + j[O] : (j[O] << 8) + j[O + 1]) && (z = z - 1 - 65535), z;
}
function y(j, O, K) {
if (O === void 0 && (O = 0), K === void 0 && (K = !1), O + 2 >= j.length)
throw new Error(o + " " + O + "/" + j.length);
return K ? (j[O + 2] << 16) + (j[O + 1] << 8) + j[O] : (j[O] << 16) + (j[O + 1] << 8) + j[O + 2];
}
function x(j, O, K) {
if (O === void 0 && (O = 0), K === void 0 && (K = !1), O + 2 >= j.length)
throw new Error(o + " " + O + "/" + j.length);
var z = 0;
return 8388608 & (z = K ? (j[O + 2] << 16) + (j[O + 1] << 8) + j[O] : (j[O] << 16) + (j[O + 1] << 8) + j[O + 2]) && (z = z - 1 - 16777215), z;
}
function h(j, O, K) {
if (O === void 0 && (O = 0), K === void 0 && (K = !1), O + 3 >= j.length)
throw new Error(o + " " + O + "/" + j.length);
var z = 0;
return (z = K ? j[O + 3] * Math.pow(2, 24) + (j[O + 2] << 16) + (j[O + 1] << 8) + j[O] : j[O] * Math.pow(2, 24) + (j[O + 1] << 16) + (j[O + 2] << 8) + j[O + 3]) < 0 ? 4294967296 + z : z;
}
function F(j, O, K) {
if (K === void 0 && (K = 0), O.byteLength - K < 4)
throw new Error(o + " " + K + "/" + O.length);
O[K] = j >> 24 & 255, O[K + 1] = j >> 16 & 255, O[K + 2] = j >> 8 & 255, O[K + 3] = 255 & j;
}
function I(j, O, K) {
if (K === void 0 && (K = !1), O + 3 >= j.length)
throw new Error(o + " " + O + "/" + j.length);
var z = 0;
return 2147483648 & (z = K ? j[O + 3] * Math.pow(2, 24) + (j[O + 2] << 16) + (j[O + 1] << 8) + j[O] : j[O] * Math.pow(2, 24) + (j[O + 1] << 16) + (j[O + 2] << 8) + j[O + 3]) && (z = z - 1 - 4294967295), z;
}
function T(j, O, K) {
if (K === void 0 && (K = 0), O.byteLength - K < 4)
throw new Error(o + " " + K + "/" + O.length);
j < 0 && (j += 4294967296), F(j, O, K);
}
function D(j, O, K) {
if (O === void 0 && (O = 0), K === void 0 && (K = !1), O + 7 >= j.length)
throw new Error(o + " " + O + "/" + j.length);
return K ? j[O + 7] * Math.pow(2, 56) + j[O + 6] * Math.pow(2, 48) + j[O + 5] * Math.pow(2, 40) + j[O + 4] * Math.pow(2, 32) + j[O + 3] * Math.pow(2, 24) + (j[O + 2] << 16) + (j[O + 1] << 8) + j[O] : j[O] * Math.pow(2, 56) + j[O + 1] * Math.pow(2, 48) + j[O + 2] * Math.pow(2, 40) + j[O + 3] * Math.pow(2, 32) + j[O + 4] * Math.pow(2, 24) + (j[O + 5] << 16) + (j[O + 6] << 8) + j[O + 7];
}
function W(j, O) {
if (j.length !== O.length)
return !1;
for (var K = 0; K < j.length; K++)
if (j[K] !== O[K])
return !1;
return !0;
}
}, function(e, r, n) {
var o = n(52);
function s(p, g) {
for (var C = 0; C < g.length; C++) {
var y = g[C];
y.enumerable = y.enumerable || !1, y.configurable = !0, "value" in y && (y.writable = !0), Object.defineProperty(p, o(y.key), y);
}
}
e.exports = function(p, g, C) {
return g && s(p.prototype, g), C && s(p, C), Object.defineProperty(p, "prototype", { writable: !1 }), p;
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r, n) {
var o = n(8), s = n.n(o), p = { version: { major: 0, string: "" } };
(function(g) {
if (typeof navigator < "u") {
g = g ? g.toLowerCase() : navigator.userAgent.toLowerCase();
var C = /(edge)\/([\w.]+)/.exec(g) || /(edg)\/([\w.]+)/.exec(g) || /(opr)[/]([\w.]+)/.exec(g) || /(chrome)[ /]([\w.]+)/.exec(g) || /(iemobile)[/]([\w.]+)/.exec(g) || /(version)(applewebkit)[ /]([\w.]+).*(safari)[ /]([\w.]+)/.exec(g) || /(webkit)[ /]([\w.]+).*(version)[ /]([\w.]+).*(safari)[ /]([\w.]+)/.exec(g) || /(webkit)[ /]([\w.]+)/.exec(g) || /(opera)(?:.*version|)[ /]([\w.]+)/.exec(g) || /(msie) ([\w.]+)/.exec(g) || g.indexOf("trident") >= 0 && /(rv)(?::| )([\w.]+)/.exec(g) || g.indexOf("compatible") < 0 && /(firefox)[ /]([\w.]+)/.exec(g) || [], y = /(ipad)/.exec(g) || /(ipod)/.exec(g) || /(windows phone)/.exec(g) || /(iphone)/.exec(g) || /(kindle)/.exec(g) || /(android)/.exec(g) || /(windows)/.exec(g) || /(mac)/.exec(g) || /(linux)/.exec(g) || /(cros)/.exec(g) || [], x = /(?:iphone|ipad|cpu) os (\d+)[._]\d+/.exec(g) || /android ([\d.]+)/.exec(g) || [], h = { browser: C[5] || C[3] || C[1] || "", version: C[2] || C[4] || "0", majorVersion: C[4] || C[2] || "0", platform: y[0] || "", platformVersion: x[1] || "" }, F = { x5: / tbs\//.test(g), xweb: / xweb\//.test(g), version: { major: 0, string: "" } };
if (h.browser) {
F[h.browser] = !0;
var I = h.majorVersion.split(".");
F.version = { major: parseInt(h.majorVersion, 10), string: h.version }, I.length > 1 && (F.version.minor = parseInt(I[1], 10)), I.length > 2 && (F.version.build = parseInt(I[2], 10));
}
if (h.platform && (F[h.platform] = !0), (F.chrome || F.opr || F.safari) && (F.webkit = !0), F.rv || F.iemobile) {
F.rv && delete F.rv;
var T = "msie";
h.browser = T, F[T] = !0;
}
if (F.edg || F.edge) {
delete F.edg, delete F.edge;
var D = "msedge";
h.browser = D, F[D] = !0;
}
if (F.opr) {
var W = "opera";
h.browser = W, F[W] = !0;
}
if (F.safari && F.android) {
var j = "android";
h.browser = j, F[j] = !0;
}
if (F.android) {
var O = g.match(/android[\s0-9.]+;([\w\s-]+)(build)?/);
if (O)
try {
var K;
F.model = (K = O[1].split("build")[0]) == null ? void 0 : K.trim();
} catch (B) {
}
} else
F.ipad ? F.model = "ipad" : F.iphone && (F.model = "iphone");
for (var z in (F.android || F.iphone || F.ipad) && (F.mobile = !0), F.ios = F.iphone || F.ipad, F.name = h.browser, F.platform = h.platform, F.platformVersion = h.platformVersion, p)
Object.prototype.hasOwnProperty.call(p, z) && delete p[z];
s()(p, F);
}
})(), r.a = p;
}, function(e, r, n) {
n.d(r, "e", function() {
return o;
}), n.d(r, "c", function() {
return s;
}), n.d(r, "d", function() {
return p;
}), n.d(r, "f", function() {
return g;
}), n.d(r, "b", function() {
return C;
}), n.d(r, "q", function() {
return y;
}), n.d(r, "a", function() {
return x;
}), n.d(r, "h", function() {
return h;
}), n.d(r, "r", function() {
return F;
}), n.d(r, "n", function() {
return I;
}), n.d(r, "p", function() {
return T;
}), n.d(r, "i", function() {
return D;
}), n.d(r, "j", function() {
return W;
}), n.d(r, "k", function() {
return j;
}), n.d(r, "o", function() {
return O;
}), n.d(r, "m", function() {
return K;
}), n.d(r, "l", function() {
return z;
}), n.d(r, "g", function() {
return B;
});
var o = 1048576, s = 10485760, p = 25, g = 1e3, C = 1e3, y = 9e4, x = 4294967296, h = 1e3, F = 0.1, I = 240, T = 2e3, D = 1e3, W = 1500, j = 5, O = 33554432, K = "kwai-k", z = "kwai-kernel-log", B = 500;
}, function(e, r) {
function n() {
return e.exports = n = Object.assign ? Object.assign.bind() : function(o) {
for (var s = 1; s < arguments.length; s++) {
var p = arguments[s];
for (var g in p)
Object.prototype.hasOwnProperty.call(p, g) && (o[g] = p[g]);
}
return o;
}, e.exports.__esModule = !0, e.exports.default = e.exports, n.apply(this, arguments);
}
e.exports = n, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r, n) {
n.d(r, "a", function() {
return o;
});
var o = function(s) {
return s[s.HEVC_NAL_TRAIL_N = 0] = "HEVC_NAL_TRAIL_N", s[s.HEVC_NAL_TRAIL_R = 1] = "HEVC_NAL_TRAIL_R", s[s.HEVC_NAL_TSA_N = 2] = "HEVC_NAL_TSA_N", s[s.HEVC_NAL_TSA_R = 3] = "HEVC_NAL_TSA_R", s[s.HEVC_NAL_STSA_N = 4] = "HEVC_NAL_STSA_N", s[s.HEVC_NAL_STSA_R = 5] = "HEVC_NAL_STSA_R", s[s.HEVC_NAL_RADL_N = 6] = "HEVC_NAL_RADL_N", s[s.HEVC_NAL_RADL_R = 7] = "HEVC_NAL_RADL_R", s[s.HEVC_NAL_RASL_N = 8] = "HEVC_NAL_RASL_N", s[s.HEVC_NAL_RASL_R = 9] = "HEVC_NAL_RASL_R", s[s.HEVC_NAL_VCL_N10 = 10] = "HEVC_NAL_VCL_N10", s[s.HEVC_NAL_VCL_R11 = 11] = "HEVC_NAL_VCL_R11", s[s.HEVC_NAL_VCL_N12 = 12] = "HEVC_NAL_VCL_N12", s[s.HEVC_NAL_VCL_R13 = 13] = "HEVC_NAL_VCL_R13", s[s.HEVC_NAL_VCL_N14 = 14] = "HEVC_NAL_VCL_N14", s[s.HEVC_NAL_VCL_R15 = 15] = "HEVC_NAL_VCL_R15", s[s.HEVC_NAL_BLA_W_LP = 16] = "HEVC_NAL_BLA_W_LP", s[s.HEVC_NAL_BLA_W_RADL = 17] = "HEVC_NAL_BLA_W_RADL", s[s.HEVC_NAL_BLA_N_LP = 18] = "HEVC_NAL_BLA_N_LP", s[s.HEVC_NAL_IDR_W_RADL = 19] = "HEVC_NAL_IDR_W_RADL", s[s.HEVC_NAL_IDR_N_LP = 20] = "HEVC_NAL_IDR_N_LP", s[s.HEVC_NAL_CRA_NUT = 21] = "HEVC_NAL_CRA_NUT", s[s.HEVC_NAL_RSV_IRAP_VCL22 = 22] = "HEVC_NAL_RSV_IRAP_VCL22", s[s.HEVC_NAL_RSV_IRAP_VCL23 = 23] = "HEVC_NAL_RSV_IRAP_VCL23", s[s.HEVC_NAL_RSV_VCL24 = 24] = "HEVC_NAL_RSV_VCL24", s[s.HEVC_NAL_RSV_VCL25 = 25] = "HEVC_NAL_RSV_VCL25", s[s.HEVC_NAL_RSV_VCL26 = 26] = "HEVC_NAL_RSV_VCL26", s[s.HEVC_NAL_RSV_VCL27 = 27] = "HEVC_NAL_RSV_VCL27", s[s.HEVC_NAL_RSV_VCL28 = 28] = "HEVC_NAL_RSV_VCL28", s[s.HEVC_NAL_RSV_VCL29 = 29] = "HEVC_NAL_RSV_VCL29", s[s.HEVC_NAL_RSV_VCL30 = 30] = "HEVC_NAL_RSV_VCL30", s[s.HEVC_NAL_RSV_VCL31 = 31] = "HEVC_NAL_RSV_VCL31", s[s.HEVC_NAL_VPS = 32] = "HEVC_NAL_VPS", s[s.HEVC_NAL_SPS = 33] = "HEVC_NAL_SPS", s[s.HEVC_NAL_PPS = 34] = "HEVC_NAL_PPS", s[s.HEVC_NAL_AUD = 35] = "HEVC_NAL_AUD", s[s.HEVC_NAL_EOS_NUT = 36] = "HEVC_NAL_EOS_NUT", s[s.HEVC_NAL_EOB_NUT = 37] = "HEVC_NAL_EOB_NUT", s[s.HEVC_NAL_FD_NUT = 38] = "HEVC_NAL_FD_NUT", s[s.HEVC_NAL_SEI_PREFIX = 39] = "HEVC_NAL_SEI_PREFIX", s[s.HEVC_NAL_SEI_SUFFIX = 40] = "HEVC_NAL_SEI_SUFFIX", s[s.HEVC_NAL_RSV_NVCL41 = 41] = "HEVC_NAL_RSV_NVCL41", s[s.HEVC_NAL_RSV_NVCL42 = 42] = "HEVC_NAL_RSV_NVCL42", s[s.HEVC_NAL_RSV_NVCL43 = 43] = "HEVC_NAL_RSV_NVCL43", s[s.HEVC_NAL_RSV_NVCL44 = 44] = "HEVC_NAL_RSV_NVCL44", s[s.HEVC_NAL_RSV_NVCL45 = 45] = "HEVC_NAL_RSV_NVCL45", s[s.HEVC_NAL_RSV_NVCL46 = 46] = "HEVC_NAL_RSV_NVCL46", s[s.HEVC_NAL_RSV_NVCL47 = 47] = "HEVC_NAL_RSV_NVCL47", s[s.HEVC_NAL_UNSPEC48 = 48] = "HEVC_NAL_UNSPEC48", s[s.HEVC_NAL_UNSPEC49 = 49] = "HEVC_NAL_UNSPEC49", s[s.HEVC_NAL_UNSPEC50 = 50] = "HEVC_NAL_UNSPEC50", s[s.HEVC_NAL_UNSPEC51 = 51] = "HEVC_NAL_UNSPEC51", s[s.HEVC_NAL_UNSPEC52 = 52] = "HEVC_NAL_UNSPEC52", s[s.HEVC_NAL_UNSPEC53 = 53] = "HEVC_NAL_UNSPEC53", s[s.HEVC_NAL_UNSPEC54 = 54] = "HEVC_NAL_UNSPEC54", s[s.HEVC_NAL_UNSPEC55 = 55] = "HEVC_NAL_UNSPEC55", s[s.HEVC_NAL_UNSPEC56 = 56] = "HEVC_NAL_UNSPEC56", s[s.HEVC_NAL_UNSPEC57 = 57] = "HEVC_NAL_UNSPEC57", s[s.HEVC_NAL_UNSPEC58 = 58] = "HEVC_NAL_UNSPEC58", s[s.HEVC_NAL_UNSPEC59 = 59] = "HEVC_NAL_UNSPEC59", s[s.HEVC_NAL_UNSPEC60 = 60] = "HEVC_NAL_UNSPEC60", s[s.HEVC_NAL_UNSPEC61 = 61] = "HEVC_NAL_UNSPEC61", s[s.HEVC_NAL_UNSPEC62 = 62] = "HEVC_NAL_UNSPEC62", s[s.PRIV_NAL_MAGIC_HEVC = 63] = "PRIV_NAL_MAGIC_HEVC", s[s.NAL_UNIT_INVALID = 64] = "NAL_UNIT_INVALID", s;
}({});
}, function(e, r, n) {
var o = n(56);
e.exports = function(s, p) {
s.prototype = Object.create(p.prototype), s.prototype.constructor = s, o(s, p);
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r, n) {
n.d(r, "e", function() {
return o;
}), n.d(r, "a", function() {
return s;
}), n.d(r, "d", function() {
return p;
}), n.d(r, "b", function() {
return g;
}), n.d(r, "c", function() {
return C;
}), n(0);
var o = function(y) {
return y[y.video = 1] = "video", y[y.audio = 2] = "audio", y;
}({}), s = function(y) {
return y[y.ADTS = 0] = "ADTS", y[y.ASC = 1] = "ASC", y;
}({}), p = function(y) {
return y.videoFrame = "videoFrame", y.decoderConfig = "decoderConfig", y;
}({}), g = function(y) {
return y.UNKNOWN = "unknown", y.FLV = "flv", y.FMP4 = "fmp4", y.TS = "ts", y.MP4 = "mp4", y.RAW = "raw", y.IVF = "ivf", y.YUV = "yuv", y;
}({}), C = function(y) {
return y.MANIFEST = "manifest", y.LEVEL = "level", y.AUDIO_TRACK = "audioTrack", y.SUBTITLE_TRACK = "subtitleTrack", y;
}({});
}, function(e, r, n) {
var o, s, p, g;
n.d(r, "a", function() {
return C;
}), n.d(r, "d", function() {
return y;
}), n.d(r, "c", function() {
return x;
}), n.d(r, "b", function() {
return h;
}), n.d(r, "e", function() {
return W;
}), n.d(r, "f", function() {
return j;
});
var C = function(O) {
return O[O.AVCOL_PRI_RESERVED0 = 0] = "AVCOL_PRI_RESERVED0", O[O.AVCOL_PRI_BT709 = 1] = "AVCOL_PRI_BT709", O[O.AVCOL_PRI_UNSPECIFIED = 2] = "AVCOL_PRI_UNSPECIFIED", O[O.AVCOL_PRI_RESERVED = 3] = "AVCOL_PRI_RESERVED", O[O.AVCOL_PRI_BT470M = 4] = "AVCOL_PRI_BT470M", O[O.AVCOL_PRI_BT470BG = 5] = "AVCOL_PRI_BT470BG", O[O.AVCOL_PRI_SMPTE170M = 6] = "AVCOL_PRI_SMPTE170M", O[O.AVCOL_PRI_SMPTE240M = 7] = "AVCOL_PRI_SMPTE240M", O[O.AVCOL_PRI_FILM = 8] = "AVCOL_PRI_FILM", O[O.AVCOL_PRI_BT2020 = 9] = "AVCOL_PRI_BT2020", O[O.AVCOL_PRI_SMPTE428 = 10] = "AVCOL_PRI_SMPTE428", O[O.AVCOL_PRI_SMPTEST428_1 = 10] = "AVCOL_PRI_SMPTEST428_1", O[O.AVCOL_PRI_SMPTE431 = 11] = "AVCOL_PRI_SMPTE431", O[O.AVCOL_PRI_SMPTE432 = 12] = "AVCOL_PRI_SMPTE432", O[O.AVCOL_PRI_EBU3213 = 22] = "AVCOL_PRI_EBU3213", O[O.AVCOL_PRI_JEDEC_P22 = 22] = "AVCOL_PRI_JEDEC_P22", O[O.AVCOL_PRI_NB = 23] = "AVCOL_PRI_NB", O;
}({}), y = function(O) {
return O[O.AVCOL_TRC_RESERVED0 = 0] = "AVCOL_TRC_RESERVED0", O[O.AVCOL_TRC_BT709 = 1] = "AVCOL_TRC_BT709", O[O.AVCOL_TRC_UNSPECIFIED = 2] = "AVCOL_TRC_UNSPECIFIED", O[O.AVCOL_TRC_RESERVED = 3] = "AVCOL_TRC_RESERVED", O[O.AVCOL_TRC_GAMMA22 = 4] = "AVCOL_TRC_GAMMA22", O[O.AVCOL_TRC_GAMMA28 = 5] = "AVCOL_TRC_GAMMA28", O[O.AVCOL_TRC_SMPTE170M = 6] = "AVCOL_TRC_SMPTE170M", O[O.AVCOL_TRC_SMPTE240M = 7] = "AVCOL_TRC_SMPTE240M", O[O.AVCOL_TRC_LINEAR = 8] = "AVCOL_TRC_LINEAR", O[O.AVCOL_TRC_LOG = 9] = "AVCOL_TRC_LOG", O[O.AVCOL_TRC_LOG_SQRT = 10] = "AVCOL_TRC_LOG_SQRT", O[O.AVCOL_TRC_IEC61966_2_4 = 11] = "AVCOL_TRC_IEC61966_2_4", O[O.AVCOL_TRC_BT1361_ECG = 12] = "AVCOL_TRC_BT1361_ECG", O[O.AVCOL_TRC_IEC61966_2_1 = 13] = "AVCOL_TRC_IEC61966_2_1", O[O.AVCOL_TRC_BT2020_10 = 14] = "AVCOL_TRC_BT2020_10", O[O.AVCOL_TRC_BT2020_12 = 15] = "AVCOL_TRC_BT2020_12", O[O.AVCOL_TRC_SMPTE2084 = 16] = "AVCOL_TRC_SMPTE2084", O[O.AVCOL_TRC_SMPTEST2084 = 16] = "AVCOL_TRC_SMPTEST2084", O[O.AVCOL_TRC_SMPTE428 = 17] = "AVCOL_TRC_SMPTE428", O[O.AVCOL_TRC_SMPTEST428_1 = 17] = "AVCOL_TRC_SMPTEST428_1", O[O.AVCOL_TRC_ARIB_STD_B67 = 18] = "AVCOL_TRC_ARIB_STD_B67", O[O.AVCOL_TRC_NB = 19] = "AVCOL_TRC_NB", O;
}({}), x = function(O) {
return O[O.AVCOL_SPC_RGB = 0] = "AVCOL_SPC_RGB", O[O.AVCOL_SPC_BT709 = 1] = "AVCOL_SPC_BT709", O[O.AVCOL_SPC_UNSPECIFIED = 2] = "AVCOL_SPC_UNSPECIFIED", O[O.AVCOL_SPC_RESERVED = 3] = "AVCOL_SPC_RESERVED", O[O.AVCOL_SPC_FCC = 4] = "AVCOL_SPC_FCC", O[O.AVCOL_SPC_BT470BG = 5] = "AVCOL_SPC_BT470BG", O[O.AVCOL_SPC_SMPTE170M = 6] = "AVCOL_SPC_SMPTE170M", O[O.AVCOL_SPC_SMPTE240M = 7] = "AVCOL_SPC_SMPTE240M", O[O.AVCOL_SPC_YCGCO = 8] = "AVCOL_SPC_YCGCO", O[O.AVCOL_SPC_YCOCG = 8] = "AVCOL_SPC_YCOCG", O[O.AVCOL_SPC_BT2020_NCL = 9] = "AVCOL_SPC_BT2020_NCL", O[O.AVCOL_SPC_BT2020_CL = 10] = "AVCOL_SPC_BT2020_CL", O[O.AVCOL_SPC_SMPTE2085 = 11] = "AVCOL_SPC_SMPTE2085", O[O.AVCOL_SPC_CHROMA_DERIVED_NCL = 12] = "AVCOL_SPC_CHROMA_DERIVED_NCL", O[O.AVCOL_SPC_CHROMA_DERIVED_CL = 13] = "AVCOL_SPC_CHROMA_DERIVED_CL", O[O.AVCOL_SPC_ICTCP = 14] = "AVCOL_SPC_ICTCP", O[O.AVCOL_SPC_NB = 15] = "AVCOL_SPC_NB", O;
}({}), h = function(O) {
return O[O.AVCOL_RANGE_UNSPECIFIED = 0] = "AVCOL_RANGE_UNSPECIFIED", O[O.AVCOL_RANGE_MPEG = 1] = "AVCOL_RANGE_MPEG", O[O.AVCOL_RANGE_JPEG = 2] = "AVCOL_RANGE_JPEG", O;
}({}), F = ((o = {})[C.AVCOL_PRI_RESERVED0] = "reserved", o[C.AVCOL_PRI_BT709] = "bt709", o[C.AVCOL_PRI_UNSPECIFIED] = "unknown", o[C.AVCOL_PRI_RESERVED] = "reserved", o[C.AVCOL_PRI_BT470M] = "bt470m", o[C.AVCOL_PRI_BT470BG] = "bt470bg", o[C.AVCOL_PRI_SMPTE170M] = "smpte170m", o[C.AVCOL_PRI_SMPTE240M] = "smpte240m", o[C.AVCOL_PRI_FILM] = "film", o[C.AVCOL_PRI_BT2020] = "bt2020", o[C.AVCOL_PRI_SMPTE428] = "smpte428", o[C.AVCOL_PRI_SMPTE431] = "smpte431", o[C.AVCOL_PRI_SMPTE432] = "smpte432", o[C.AVCOL_PRI_EBU3213] = "ebu3213", o), I = ((s = {})[y.AVCOL_TRC_RESERVED0] = "reserved", s[y.AVCOL_TRC_BT709] = "bt709", s[y.AVCOL_TRC_UNSPECIFIED] = "unknown", s[y.AVCOL_TRC_RESERVED] = "reserved", s[y.AVCOL_TRC_GAMMA22] = "bt470m", s[y.AVCOL_TRC_GAMMA28] = "bt470bg", s[y.AVCOL_TRC_SMPTE170M] = "smpte170m", s[y.AVCOL_TRC_SMPTE240M] = "smpte240m", s[y.AVCOL_TRC_LINEAR] = "linear", s[y.AVCOL_TRC_LOG] = "log100", s[y.AVCOL_TRC_LOG_SQRT] = "log316", s[y.AVCOL_TRC_IEC61966_2_4] = "iec61966-2-4", s[y.AVCOL_TRC_BT1361_ECG] = "bt1361e", s[y.AVCOL_TRC_IEC61966_2_1] = "iec61966-2-1", s[y.AVCOL_TRC_BT2020_10] = "bt2020-10", s[y.AVCOL_TRC_BT2020_12] = "bt2020-12", s[y.AVCOL_TRC_SMPTE2084] = "smpte2084", s[y.AVCOL_TRC_SMPTE428] = "smpte428", s[y.AVCOL_TRC_ARIB_STD_B67] = "arib-std-b67", s), T = ((p = {})[x.AVCOL_SPC_RGB] = "gbr", p[x.AVCOL_SPC_BT709] = "bt709", p[x.AVCOL_SPC_UNSPECIFIED] = "unknown", p[x.AVCOL_SPC_RESERVED] = "reserved", p[x.AVCOL_SPC_FCC] = "fcc", p[x.AVCOL_SPC_BT470BG] = "bt470bg", p[x.AVCOL_SPC_SMPTE170M] = "smpte170m", p[x.AVCOL_SPC_SMPTE240M] = "smpte240m", p[x.AVCOL_SPC_YCGCO] = "ycgco", p[x.AVCOL_SPC_BT2020_NCL] = "bt2020nc", p[x.AVCOL_SPC_BT2020_CL] = "bt2020c", p[x.AVCOL_SPC_SMPTE2085] = "smpte2085", p[x.AVCOL_SPC_CHROMA_DERIVED_NCL] = "chroma-derived-nc", p[x.AVCOL_SPC_CHROMA_DERIVED_CL] = "chroma-derived-c", p[x.AVCOL_SPC_ICTCP] = "ictcp", p), D = ((g = {})[h.AVCOL_RANGE_UNSPECIFIED] = "unknown", g[h.AVCOL_RANGE_MPEG] = "tv", g[h.AVCOL_RANGE_JPEG] = "pc", g);
function W(O) {
if (O && typeof O.colorRange == "number" && typeof O.matrixCoefficients == "number" && typeof O.colourPrimaries == "number" && typeof O.transferCharacteristics == "number") {
var K = T[O.matrixCoefficients], z = F[O.colourPrimaries], B = I[O.transferCharacteristics];
return K === z && K === B ? "(" + (O.colorRange ? D[O.colorRange] + " " : "unknown ") + K + ")" : "(" + (O.colorRange ? D[O.colorRange] + " " : "unknown ") + K + "/" + z + "/" + B + ")";
}
return "";
}
function j(O, K) {
return typeof O == typeof K && (O === void 0 || K === void 0 || O.colorRange === K.colorRange && O.colourPrimaries === K.colourPrimaries && O.matrixCoefficients === K.matrixCoefficients && O.transferCharacteristics === K.transferCharacteristics);
}
}, function(e, r, n) {
n.d(r, "a", function() {
return o;
});
var o = function(s) {
return s.INIT_265 = "init265", s.APPEND_DATA = "appendData", s.MEDIA_INFO = "mediaInfo", s.UPDATE_STATE = "updateState", s.RESET = "reset", s.DESTROY = "destroy", s.STEP = "step", s.SEEK = "seek", s.END_OF_DATA = "endOfData", s.DEC_DROP_FRAME = "dropFrame", s.CLEAN = "clean", s.INIT_RENDERER = "initRenderer", s.SCREENSHOT = "screenshot", s;
}({});
}, function(e, r, n) {
n.d(r, "b", function() {
return p;
}), n.d(r, "a", function() {
return g;
});
var o = n(5), s = n.n(o), p = function() {
function C() {
var x;
this._ = [], (x = this._).push.apply(x, arguments);
}
var y = C.prototype;
return y.push = function() {
var x;
(x = this._).push.apply(x, arguments);
}, y.destroyItem = function(x) {
for (var h = 0; h < this._.length; h++)
if (this._[h] === x)
return this._.splice(h, 1), void x.destroy();
}, y.destroy = function() {
for (; this._.length; ) {
var x = this._.shift();
x && x.destroy();
}
}, s()(C, [{ key: "destroyed", get: function() {
return !!this._.length;
} }]);
}(), g = function() {
function C() {
this.O = new p();
}
return C.prototype.destroy = function() {
this.O.destroy();
}, C;
}();
}, function(e, r, n) {
n.d(r, "j", function() {
return o;
}), n.d(r, "e", function() {
return s;
}), n.d(r, "f", function() {
return p;
}), n.d(r, "g", function() {
return g;
}), n.d(r, "h", function() {
return C;
}), n.d(r, "d", function() {
return y;
}), n.d(r, "a", function() {
return x;
}), n.d(r, "b", function() {
return h;
}), n.d(r, "c", function() {
return F;
}), n.d(r, "i", function() {
return I;
});
var o = function(T) {
return T[T.AUDIO = 8] = "AUDIO", T[T.VIDEO = 9] = "VIDEO", T[T.SCRIPT = 18] = "SCRIPT", T;
}({}), s = 13, p = 11, g = 4, C = 5, y = 0, x = 1, h = 3, F = 5, I = function() {
this.tagType = o.VIDEO, this.dataSize = 0, this.timestamp = 0, this.size = 0, this.cts = 0, this.frameType = 0, this.codecId = 0, this.body = void 0, this.packetType = void 0;
};
}, function(e, r, n) {
n.d(r, "a", function() {
return o;
});
var o = function(s) {
return s[s.VVC_NAL_UNIT_CODED_SLICE_TRAIL = 0] = "VVC_NAL_UNIT_CODED_SLICE_TRAIL", s[s.VVC_NAL_UNIT_CODED_SLICE_STSA = 1] = "VVC_NAL_UNIT_CODED_SLICE_STSA", s[s.VVC_NAL_UNIT_CODED_SLICE_RADL = 2] = "VVC_NAL_UNIT_CODED_SLICE_RADL", s[s.VVC_NAL_UNIT_CODED_SLICE_RASL = 3] = "VVC_NAL_UNIT_CODED_SLICE_RASL", s[s.VVC_NAL_UNIT_RESERVED_VCL_4 = 4] = "VVC_NAL_UNIT_RESERVED_VCL_4", s[s.VVC_NAL_UNIT_RESERVED_VCL_5 = 5] = "VVC_NAL_UNIT_RESERVED_VCL_5", s[s.VVC_NAL_UNIT_RESERVED_VCL_6 = 6] = "VVC_NAL_UNIT_RESERVED_VCL_6", s[s.VVC_NAL_UNIT_CODED_SLICE_IDR_W_RADL = 7] = "VVC_NAL_UNIT_CODED_SLICE_IDR_W_RADL", s[s.VVC_NAL_UNIT_CODED_SLICE_IDR_N_LP = 8] = "VVC_NAL_UNIT_CODED_SLICE_IDR_N_LP", s[s.VVC_NAL_UNIT_CODED_SLICE_CRA = 9] = "VVC_NAL_UNIT_CODED_SLICE_CRA", s[s.VVC_NAL_UNIT_CODED_SLICE_GDR = 10] = "VVC_NAL_UNIT_CODED_SLICE_GDR", s[s.VVC_NAL_UNIT_RESERVED_IRAP_VCL_11 = 11] = "VVC_NAL_UNIT_RESERVED_IRAP_VCL_11", s[s.VVC_NAL_UNIT_OPI = 12] = "VVC_NAL_UNIT_OPI", s[s.VVC_NAL_UNIT_DCI = 13] = "VVC_NAL_UNIT_DCI", s[s.VVC_NAL_UNIT_VPS = 14] = "VVC_NAL_UNIT_VPS", s[s.VVC_NAL_UNIT_SPS = 15] = "VVC_NAL_UNIT_SPS", s[s.VVC_NAL_UNIT_PPS = 16] = "VVC_NAL_UNIT_PPS", s[s.VVC_NAL_UNIT_PREFIX_APS = 17] = "VVC_NAL_UNIT_PREFIX_APS", s[s.VVC_NAL_UNIT_SUFFIX_APS = 18] = "VVC_NAL_UNIT_SUFFIX_APS", s[s.VVC_NAL_UNIT_PH = 19] = "VVC_NAL_UNIT_PH", s[s.VVC_NAL_UNIT_ACCESS_UNIT_DELIMITER = 20] = "VVC_NAL_UNIT_ACCESS_UNIT_DELIMITER", s[s.VVC_NAL_UNIT_EOS = 21] = "VVC_NAL_UNIT_EOS", s[s.VVC_NAL_UNIT_EOB = 22] = "VVC_NAL_UNIT_EOB", s[s.VVC_NAL_UNIT_PREFIX_SEI = 23] = "VVC_NAL_UNIT_PREFIX_SEI", s[s.VVC_NAL_UNIT_SUFFIX_SEI = 24] = "VVC_NAL_UNIT_SUFFIX_SEI", s[s.VVC_NAL_UNIT_FD = 25] = "VVC_NAL_UNIT_FD", s[s.VVC_NAL_UNIT_RESERVED_NVCL_26 = 26] = "VVC_NAL_UNIT_RESERVED_NVCL_26", s[s.VVC_NAL_UNIT_RESERVED_NVCL_27 = 27] = "VVC_NAL_UNIT_RESERVED_NVCL_27", s[s.VVC_NAL_UNIT_UNSPECIFIED_28 = 28] = "VVC_NAL_UNIT_UNSPECIFIED_28", s[s.VVC_NAL_UNIT_UNSPECIFIED_29 = 29] = "VVC_NAL_UNIT_UNSPECIFIED_29", s[s.VVC_NAL_UNIT_UNSPECIFIED_30 = 30] = "VVC_NAL_UNIT_UNSPECIFIED_30", s[s.VVC_NAL_UNIT_UNSPECIFIED_31 = 31] = "VVC_NAL_UNIT_UNSPECIFIED_31", s[s.VVC_NAL_UNIT_INVALID = 32] = "VVC_NAL_UNIT_INVALID", s;
}({});
}, function(e, r, n) {
n.d(r, "b", function() {
return Pe;
}), n.d(r, "h", function() {
return ae;
}), n.d(r, "f", function() {
return U;
}), n.d(r, "g", function() {
return M;
}), n.d(r, "d", function() {
return ne;
}), n.d(r, "e", function() {
return Le;
}), n.d(r, "c", function() {
return Ue;
}), n.d(r, "a", function() {
return re;
});
var o = n(11), s = [41, 41, 47, 49, 49, 51, 47, 47, 43, 43, 43, 40, 40], p = [12, 12, 12, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15], g = [33, 33, 38, 40, 40, 40, 41, 41, 37, 37, 37, 34, 34], C = [0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72, 80, 88, 96, 108, 120, 132, 144, 156, 172, 188, 212, 240, 276, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960, 1024], y = [0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, 80, 88, 96, 108, 120, 132, 144, 160, 176, 196, 216, 240, 264, 292, 320, 352, 384, 416, 448, 480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800, 832, 864, 896, 928, 1024], x = [0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 52, 60, 68, 76, 84, 92, 100, 108, 116, 124, 136, 148, 160, 172, 188, 204, 220, 240, 260, 284, 308, 336, 364, 396, 432, 468, 508, 552, 600, 652, 704, 768, 832, 896, 960, 1024], h = [0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 100, 112, 124, 136, 148, 160, 172, 184, 196, 212, 228, 244, 260, 280, 300, 320, 344, 368, 396, 424, 456, 492, 532, 572, 616, 664, 716, 772, 832, 896, 960, 1024], F = [0, 12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144, 156, 172, 188, 204, 220, 236, 252, 268, 288, 308, 328, 348, 372, 396, 420, 448, 476, 508, 544, 580, 620, 664, 712, 764, 820, 880, 944, 1024], I = [C, C, [0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72, 80, 88, 100, 112, 124, 140, 156, 172, 192, 216, 240, 268, 304, 344, 384, 424, 464, 504, 544, 584, 624, 664, 704, 744, 784, 824, 864, 904, 944, 984, 1024], y, y, [0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, 80, 88, 96, 108, 120, 132, 144, 160, 176, 196, 216, 240, 264, 292, 320, 352, 384, 416, 448, 480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800, 832, 864, 896, 928, 960, 992, 1024], x, x, h, h, h, F, F], T = [0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 128], D = [0, 4, 8, 12, 16, 20, 28, 36, 44, 56, 68, 80, 96, 112, 128], W = [0, 4, 8, 12, 16, 20, 24, 28, 36, 44, 52, 64, 76, 92, 108, 128], j = [0, 4, 8, 12, 16, 20, 24, 28, 32, 40, 48, 60, 72, 88, 108, 128], O = [0, 4, 8, 12, 16, 20, 24, 28, 36, 44, 52, 60, 72, 88, 108, 128], K = [T, T, T, D, D, D, W, W, j, j, j, O, O], z = function(k) {
return k[k.AOT_NULL = 0] = "AOT_NULL", k[k.AOT_AAC_MAIN = 1] = "AOT_AAC_MAIN", k[k.AOT_AAC_LC = 2] = "AOT_AAC_LC", k[k.AOT_AAC_SSR = 3] = "AOT_AAC_SSR", k[k.AOT_AAC_LTP = 4] = "AOT_AAC_LTP", k[k.AOT_SBR = 5] = "AOT_SBR", k[k.AOT_AAC_SCALABLE = 6] = "AOT_AAC_SCALABLE", k[k.AOT_PS = 29] = "AOT_PS", k[k.AOT_ER_AAC_ELD = 39] = "AOT_ER_AAC_ELD", k;
}({}), B = n(1), J = [[1, 0, 60], [3, 4, 59], [4, 10, 61], [4, 11, 58], [4, 12, 62], [5, 26, 57], [5, 27, 63], [6, 56, 56], [6, 57, 64], [6, 58, 55], [6, 59, 65], [7, 120, 66], [7, 121, 54], [7, 122, 67], [8, 246, 53], [8, 247, 68], [8, 248, 52], [8, 249, 69], [8, 250, 51], [9, 502, 70], [9, 503, 50], [9, 504, 49], [9, 505, 71], [10, 1012, 72], [10, 1013, 48], [10, 1014, 73], [10, 1015, 47], [10, 1016, 74], [10, 1017, 46], [11, 2036, 76], [11, 2037, 75], [11, 2038, 77], [11, 2039, 78], [11, 2040, 45], [11, 2041, 43], [12, 4084, 44], [12, 4085, 79], [12, 4086, 42], [12, 4087, 41], [12, 4088, 80], [12, 4089, 40], [13, 8180, 81], [13, 8181, 39], [13, 8182, 82], [13, 8183, 38], [13, 8184, 83], [14, 16370, 37], [14, 16371, 35], [14, 16372, 85], [14, 16373, 33], [14, 16374, 36], [14, 16375, 34], [14, 16376, 84], [14, 16377, 32], [15, 32756, 87], [15, 32757, 89], [15, 32758, 30], [15, 32759, 31], [16, 65520, 86], [16, 65521, 29], [16, 65522, 26], [16, 65523, 27], [16, 65524, 28], [16, 65525, 24], [16, 65526, 88], [17, 131054, 25], [17, 131055, 22], [17, 131056, 23], [18, 262114, 90], [18, 262115, 21], [18, 262116, 19], [18, 262117, 3], [18, 262118, 1], [18, 262119, 2], [18, 262120, 0], [19, 524242, 98], [19, 524243, 99], [19, 524244, 100], [19, 524245, 101], [19, 524246, 102], [19, 524247, 117], [19, 524248, 97], [19, 524249, 91], [19, 524250, 92], [19, 524251, 93], [19, 524252, 94], [19, 524253, 95], [19, 524254, 96], [19, 524255, 104], [19, 524256, 111], [19, 524257, 112], [19, 524258, 113], [19, 524259, 114], [19, 524260, 115], [19, 524261, 116], [19, 524262, 110], [19, 524263, 105], [19, 524264, 106], [19, 524265, 107], [19, 524266, 108], [19, 524267, 109], [19, 524268, 118], [19, 524269, 6], [19, 524270, 8], [19, 524271, 9], [19, 524272, 10], [19, 524273, 5], [19, 524274, 103], [19, 524275, 120], [19, 524276, 119], [19, 524277, 4], [19, 524278, 7], [19, 524279, 15], [19, 524280, 16], [19, 524281, 18], [19, 524282, 20], [19, 524283, 17], [19, 524284, 11], [19, 524285, 12], [19, 524286, 14], [19, 524287, 13]], be = [[[1, 0, 0, 0, 0, 0], [5, 16, 1, 0, 0, 0], [5, 17, -1, 0, 0, 0], [5, 18, 0, 0, 0, -1], [5, 19, 0, 1, 0, 0], [5, 20, 0, 0, 0, 1], [5, 21, 0, 0, -1, 0], [5, 22, 0, 0, 1, 0], [5, 23, 0, -1, 0, 0], [7, 96, 1, -1, 0, 0], [7, 97, -1, 1, 0, 0], [7, 98, 0, 0, -1, 1], [7, 99, 0, 1, -1, 0], [7, 100, 0, -1, 1, 0], [7, 101, 0, 0, 1, -1], [7, 102, 1, 1, 0, 0], [7, 103, 0, 0, -1, -1], [7, 104, -1, -1, 0, 0], [7, 105, 0, -1, -1, 0], [7, 106, 1, 0, -1, 0], [7, 107, 0, 1, 0, -1], [7, 108, -1, 0, 1, 0], [7, 109, 0, 0, 1, 1], [7, 110, 1, 0, 1, 0], [7, 111, 0, -1, 0, 1], [7, 112, 0, 1, 1, 0], [7, 113, 0, 1, 0, 1], [7, 114, -1, 0, -1, 0], [7, 115, 1, 0, 0, 1], [7, 116, -1, 0, 0, -1], [7, 117, 1, 0, 0, -1], [7, 118, -1, 0, 0, 1], [7, 119, 0, -1, 0, -1], [9, 480, 1, 1, -1, 0], [9, 481, -1, 1, -1, 0], [9, 482, 1, -1, 1, 0], [9, 483, 0, 1, 1, -1], [9, 484, 0, 1, -1, 1], [9, 485, 0, -1, 1, 1], [9, 486, 0, -1, 1, -1], [9, 487, 1, -1, -1, 0], [9, 488, 1, 0, -1, 1], [9, 489, 0, 1, -1, -1], [9, 490, -1, 1, 1, 0], [9, 491, -1, 0, 1, -1], [9, 492, -1, -1, 1, 0], [9, 493, 0, -1, -1, 1], [9, 494, 1, -1, 0, 1], [9, 495, 1, -1, 0, -1], [9, 496, -1, 1, 0, -1], [9, 497, -1, -1, -1, 0], [9, 498, 0, -1, -1, -1], [9, 499, 0, 1, 1, 1], [9, 500, 1, 0, 1, -1], [9, 501, 1, 1, 0, 1], [9, 502, -1, 1, 0, 1], [9, 503, 1, 1, 1, 0], [10, 1008, -1, -1, 0, 1], [10, 1009, -1, 0, -1, -1], [10, 1010, 1, 1, 0, -1], [10, 1011, 1, 0, -1, -1], [10, 1012, -1, 0, -1, 1], [10, 1013, -1, -1, 0, -1], [10, 1014, -1, 0, 1, 1], [10, 1015, 1, 0, 1, 1], [11, 2032, 1, -1, 1, -1], [11, 2033, -1, 1, -1, 1], [11, 2034, -1, 1, 1, -1], [11, 2035, 1, -1, -1, 1], [11, 2036, 1, 1, 1, 1], [11, 2037, -1, -1, 1, 1], [11, 2038, 1, 1, -1, -1], [11, 2039, -1, -1, 1, -1], [11, 2040, -1, -1, -1, -1], [11, 2041, 1, 1, -1, 1], [11, 2042, 1, -1, 1, 1], [11, 2043, -1, 1, 1, 1], [11, 2044, -1, 1, -1, -1], [11, 2045, -1, -1, -1, 1], [11, 2046, 1, -1, -1, -1], [11, 2047, 1, 1, 1, -1]], [[3, 0, 0, 0, 0, 0], [4, 2, 1, 0, 0, 0], [5, 6, -1, 0, 0, 0], [5, 7, 0, 0, 0, 1], [5, 8, 0, 0, -1, 0], [5, 9, 0, 0, 0, -1], [5, 10, 0, -1, 0, 0], [5, 11, 0, 0, 1, 0], [5, 12, 0, 1, 0, 0], [6, 26, 0, -1, 1, 0], [6, 27, -1, 1, 0, 0], [6, 28, 0, 1, -1, 0], [6, 29, 0, 0, 1, -1], [6, 30, 0, 1, 0, -1], [6, 31, 0, 0, -1, 1], [6, 32, -1, 0, 0, -1], [6, 33, 1, -1, 0, 0], [6, 34, 1, 0, -1, 0], [6, 35, -1, -1, 0, 0], [6, 36, 0, 0, -1, -1], [6, 37, 1, 0, 1, 0], [6, 38, 1, 0, 0, 1], [6, 39, 0, -1, 0, 1], [6, 40, -1, 0, 1, 0], [6, 41, 0, 1, 0, 1], [6, 42, 0, -1, -1, 0], [6, 43, -1, 0, 0, 1], [6, 44, 0, -1, 0, -1], [6, 45, -1, 0, -1, 0], [6, 46, 1, 1, 0, 0], [6, 47, 0, 1, 1, 0], [6, 48, 0, 0, 1, 1], [6, 49, 1, 0, 0, -1], [7, 100, 0, 1, -1, 1], [7, 101, 1, 0, -1, 1], [7, 102, -1, 1, -1, 0], [7, 103, 0, -1, 1, -1], [7, 104, 1, -1, 1, 0], [7, 105, 1, 1, 0, -1], [7, 106, 1, 0, 1, 1], [7, 107, -1, 1, 1, 0], [7, 108, 0, -1, -1, 1], [7, 109, 1, 1, 1, 0], [7, 110, -1, 0, 1, -1], [7, 111, -1, -1, -1, 0], [7, 112, -1, 0, -1, 1], [7, 113, 1, -1, -1, 0], [7, 114, 1, 1, -1, 0], [8, 230, 1, -1, 0, 1], [8, 231, -1, 1, 0, -1], [8, 232, -1, -1, 1, 0], [8, 233, -1, 0, 1, 1], [8, 234, -1, -1, 0, 1], [8, 235, -1, -1, 0, -1], [8, 236, 0, -1, -1, -1], [8, 237, 1, 0, 1, -1], [8, 238, 1, 0, -1, -1], [8, 239, 0, 1, -1, -1], [8, 240, 0, 1, 1, 1], [8, 241, -1, 1, 0, 1], [8, 242, -1, 0, -1, -1], [8, 243, 0, 1, 1, -1], [8, 244, 1, -1, 0, -1], [8, 245, 0, -1, 1, 1], [8, 246, 1, 1, 0, 1], [8, 247, 1, -1, 1, -1], [8, 248, -1, 1, -1, 1], [9, 498, 1, -1, -1, 1], [9, 499, -1, -1, -1, -1], [9, 500, -1, 1, 1, -1], [9, 501, -1, 1, 1, 1], [9, 502, 1, 1, 1, 1], [9, 503, -1, -1, 1, -1], [9, 504, 1, -1, 1, 1], [9, 505, -1, 1, -1, -1], [9, 506, -1, -1, 1, 1], [9, 507, 1, 1, -1, -1], [9, 508, 1, -1, -1, -1], [9, 509, -1, -1, -1, 1], [9, 510, 1, 1, -1, 1], [9, 511, 1, 1, 1, -1]], [[1, 0, 0, 0, 0, 0], [4, 8, 1, 0, 0, 0], [4, 9, 0, 0, 0, 1], [4, 10, 0, 1, 0, 0], [4, 11, 0, 0, 1, 0], [5, 24, 1, 1, 0, 0], [5, 25, 0, 0, 1, 1], [6, 52, 0, 1, 1, 0], [6, 53, 0, 1, 0, 1], [6, 54, 1, 0, 1, 0], [6, 55, 0, 1, 1, 1], [6, 56, 1, 0, 0, 1], [6, 57, 1, 1, 1, 0], [7, 116, 1, 1, 1, 1], [7, 117, 1, 0, 1, 1], [7, 118, 1, 1, 0, 1], [8, 238, 2, 0, 0, 0], [8, 239, 0, 0, 0, 2], [8, 240, 0, 0, 1, 2], [8, 241, 2, 1, 0, 0], [8, 242, 1, 2, 1, 0], [9, 486, 0, 0, 2, 1], [9, 487, 0, 1, 2, 1], [9, 488, 1, 2, 0, 0], [9, 489, 0, 1, 1, 2], [9, 490, 2, 1, 1, 0], [9, 491, 0, 0, 2, 0], [9, 492, 0, 2, 1, 0], [9, 493, 0, 1, 2, 0], [9, 494, 0, 2, 0, 0], [9, 495, 0, 1, 0, 2], [9, 496, 2, 0, 1, 0], [9, 497, 1, 2, 1, 1], [9, 498, 0, 2, 1, 1], [9, 499, 1, 1, 2, 0], [9, 500, 1, 1, 2, 1], [10, 1002, 1, 2, 0, 1], [10, 1003, 1, 0, 2, 0], [10, 1004, 1, 0, 2, 1], [10, 1005, 0, 2, 0, 1], [10, 1006, 2, 1, 1, 1], [10, 1007, 1, 1, 1, 2], [10, 1008, 2, 1, 0, 1], [10, 1009, 1, 0, 1, 2], [10, 1010, 0, 0, 2, 2], [10, 1011, 0, 1, 2, 2], [10, 1012, 2, 2, 1, 0], [10, 1013, 1, 2, 2, 0], [10, 1014, 1, 0, 0, 2], [10, 1015, 2, 0, 0, 1], [10, 1016, 0, 2, 2, 1], [11, 2034, 2, 2, 0, 0], [11, 2035, 1, 2, 2, 1], [11, 2036, 1, 1, 0, 2], [11, 2037, 2, 0, 1, 1], [11, 2038, 1, 1, 2, 2], [11, 2039, 2, 2, 1, 1], [11, 2040, 0, 2, 2, 0], [11, 2041, 0, 2, 1, 2], [12, 4084, 1, 0, 2, 2], [12, 4085, 2, 2, 0, 1], [12, 4086, 2, 1, 2, 0], [12, 4087, 2, 2, 2, 0], [12, 4088, 0, 2, 2, 2], [12, 4089, 2, 2, 2, 1], [12, 4090, 2, 1, 2, 1], [12, 4091, 1, 2, 1, 2], [12, 4092, 1, 2, 2, 2], [13, 8186, 0, 2, 0, 2], [13, 8187, 2, 0, 2, 0], [13, 8188, 1, 2, 0, 2], [14, 16378, 2, 0, 2, 1], [14, 16379, 2, 1, 1, 2], [14, 16380, 2, 1, 0, 2], [15, 32762, 2, 2, 2, 2], [15, 32763, 2, 2, 1, 2], [15, 32764, 2, 1, 2, 2], [15, 32765, 2, 0, 1, 2], [15, 32766, 2, 0, 0, 2], [16, 65534, 2, 2, 0, 2], [16, 65535, 2, 0, 2, 2]], [[4, 0, 1, 1, 1, 1], [4, 1, 0, 1, 1, 1], [4, 2, 1, 1, 0, 1], [4, 3, 1, 1, 1, 0], [4, 4, 1, 0, 1, 1], [4, 5, 1, 0, 0, 0], [4, 6, 1, 1, 0, 0], [4, 7, 0, 0, 0, 0], [4, 8, 0, 0, 1, 1], [4, 9, 1, 0, 1, 0], [5, 20, 1, 0, 0, 1], [5, 21, 0, 1, 1, 0], [5, 22, 0, 0, 0, 1], [5, 23, 0, 1, 0, 1], [5, 24, 0, 0, 1, 0], [5, 25, 0, 1, 0, 0], [7, 104, 2, 1, 1, 1], [7, 105, 1, 1, 2, 1], [7, 106, 1, 2, 1, 1], [7, 107, 1, 1, 1, 2], [7, 108, 2, 1, 1, 0], [7, 109, 2, 1, 0, 1], [7, 110, 1, 2, 1, 0], [7, 111, 2, 0, 1, 1], [7, 112, 0, 1, 2, 1], [8, 226, 0, 1, 1, 2], [8, 227, 1, 1, 2, 0], [8, 228, 0, 2, 1, 1], [8, 229, 1, 0, 1, 2], [8, 230, 1, 2, 0, 1], [8, 231, 1, 1, 0, 2], [8, 232, 1, 0, 2, 1], [8, 233, 2, 1, 0, 0], [8, 234, 2, 0, 1, 0], [8, 235, 1, 2, 0, 0], [8, 236, 2, 0, 0, 1], [8, 237, 0, 1, 0, 2], [8, 238, 0, 2, 1, 0], [8, 239, 0, 0, 1, 2], [8, 240, 0, 1, 2, 0], [8, 241, 0, 2, 0, 1], [8, 242, 1, 0, 0, 2], [8, 243, 0, 0, 2, 1], [8, 244, 1, 0, 2, 0], [8, 245, 2, 0, 0, 0], [8, 246, 0, 0, 0, 2], [9, 494, 0, 2, 0, 0], [9, 495, 0, 0, 2, 0], [9, 496, 1, 2, 2, 1], [9, 497, 2, 2, 1, 1], [9, 498, 2, 1, 2, 1], [9, 499, 1, 1, 2, 2], [9, 500, 1, 2, 1, 2], [9, 501, 2, 1, 1, 2], [10, 1004, 1, 2, 2, 0], [10, 1005, 2, 2, 1, 0], [10, 1006, 2, 1, 2, 0], [10, 1007, 0, 2, 2, 1], [10, 1008, 0, 1, 2, 2], [10, 1009, 2, 2, 0, 1], [10, 1010, 0, 2, 1, 2], [10, 1011, 2, 0, 2, 1], [10, 1012, 1, 0, 2, 2], [10, 1013, 2, 2, 2, 1], [10, 1014, 1, 2, 0, 2], [10, 1015, 2, 0, 1, 2], [10, 1016, 2, 1, 0, 2], [10, 1017, 1, 2, 2, 2], [11, 2036, 2, 1, 2, 2], [11, 2037, 2, 2, 1, 2], [11, 2038, 0, 2, 2, 0], [11, 2039, 2, 2, 0, 0], [11, 2040, 0, 0, 2, 2], [11, 2041, 2, 0, 2, 0], [11, 2042, 0, 2, 0, 2], [11, 2043, 2, 0, 0, 2], [11, 2044, 2, 2, 2, 2], [11, 2045, 0, 2, 2, 2], [11, 2046, 2, 2, 2, 0], [12, 4094, 2, 2, 0, 2], [12, 4095, 2, 0, 2, 2]], [[1, 0, 0, 0], [4, 8, -1, 0], [4, 9, 1, 0], [4, 10, 0, 1], [4, 11, 0, -1], [5, 24, 1, -1], [5, 25, -1, 1], [5, 26, -1, -1], [5, 27, 1, 1], [7, 112, -2, 0], [7, 113, 0, 2], [7, 114, 2, 0], [7, 115, 0, -2], [8, 232, -2, -1], [8, 233, 2, 1], [8, 234, -1, -2], [8, 235, 1, 2], [8, 236, -2, 1], [8, 237, 2, -1], [8, 238, -1, 2], [8, 239, 1, -2], [8, 240, -3, 0], [8, 241, 3, 0], [8, 242, 0, -3], [8, 243, 0, 3], [9, 488, -3, -1], [9, 489, 1, 3], [9, 490, 3, 1], [9, 491, -1, -3], [9, 492, -3, 1], [9, 493, 3, -1], [9, 494, 1, -3], [9, 495, -1, 3], [9, 496, -2, 2], [9, 497, 2, 2], [9, 498, -2, -2], [9, 499, 2, -2], [10, 1e3, -3, -2], [10, 1001, 3, -2], [10, 1002, -2, 3], [10, 1003, 2, -3], [10, 1004, 3, 2], [10, 1005, 2, 3], [10, 1006, -3, 2], [10, 1007, -2, -3], [10, 1008, 0, -4], [10, 1009, -4, 0], [10, 1010, 4, 1], [10, 1011, 4, 0], [11, 2024, -4, -1], [11, 2025, 0, 4], [11, 2026, 4, -1], [11, 2027, -1, -4], [11, 2028, 1, 4], [11, 2029, -1, 4], [11, 2030, -4, 1], [11, 2031, 1, -4], [11, 2032, 3, -3], [11, 2033, -3, -3], [11, 2034, -3, 3], [11, 2035, -2, 4], [11, 2036, -4, -2], [11, 2037, 4, 2], [11, 2038, 2, -4], [11, 2039, 2, 4], [11, 2040, 3, 3], [11, 2041, -4, 2], [12, 4084, -2, -4], [12, 4085, 4, -2], [12, 4086, 3, -4], [12, 4087, -4, -3], [12, 4088, -4, 3], [12, 4089, 3, 4], [12, 4090, -3, 4], [12, 4091, 4, 3], [12, 4092, 4, -3], [12, 4093, -3, -4], [13, 8188, 4, -4], [13, 8189, -4, 4], [13, 8190, 4, 4], [13, 8191, -4, -4]], [[4, 0, 0, 0], [4, 1, 1, 0], [4, 2, 0, -1], [4, 3, 0, 1], [4, 4, -1, 0], [4, 5, 1, 1], [4, 6, -1, 1], [4, 7, 1, -1], [4, 8, -1, -1], [6, 36, 2, -1], [6, 37, 2, 1], [6, 38, -2, 1], [6, 39, -2, -1], [6, 40, -2, 0], [6, 41, -1, 2], [6, 42, 2, 0], [6, 43, 1, -2], [6, 44, 1, 2], [6, 45, 0, -2], [6, 46, -1, -2], [6, 47, 0, 2], [6, 48, 2, -2], [6, 49, -2, 2], [6, 50, -2, -2], [6, 51, 2, 2], [7, 104, -3, 1], [7, 105, 3, 1], [7, 106, 3, -1], [7, 107, -1, 3], [7, 108, -3, -1], [7, 109, 1, 3], [7, 110, 1, -3], [7, 111, -1, -3], [7, 112, 3, 0], [7, 113, -3, 0], [7, 114, 0, -3], [7, 115, 0, 3], [7, 116, 3, 2], [8, 234, -3, -2], [8, 235, -2, 3], [8, 236, 2, 3], [8, 237, 3, -2], [8, 238, 2, -3], [8, 239, -2, -3], [8, 240, -3, 2], [8, 241, 3, 3], [9, 484, 3, -3], [9, 485, -3, -3], [9, 486, -3, 3], [9, 487, 1, -4], [9, 488, -1, -4], [9, 489, 4, 1], [9, 490, -4, 1], [9, 491, -4, -1], [9, 492, 1, 4], [9, 493, 4, -1], [9, 494, -1, 4], [9, 495, 0, -4], [9, 496, -4, 2], [9, 497, -4, -2], [9, 498, 2, 4], [9, 499, -2, -4], [9, 500, -4, 0], [9, 501, 4, 2], [9, 502, 4, -2], [9, 503, -2, 4], [9, 504, 4, 0], [9, 505, 2, -4], [9, 506, 0, 4], [10, 1014, -3, -4], [10, 1015, -3, 4], [10, 1016, 3, -4], [10, 1017, 4, -3], [10, 1018, 3, 4], [10, 1019, 4, 3], [10, 1020, -4, 3], [10, 1021, -4, -3], [11, 2044, 4, 4], [11, 2045, -4, 4], [11, 2046, -4, -4], [11, 2047, 4, -4]], [[1, 0, 0, 0], [3, 4, 1, 0], [3, 5, 0, 1], [4, 12, 1, 1], [6, 52, 2, 1], [6, 53, 1, 2], [6, 54, 2, 0], [6, 55, 0, 2], [7, 112, 3, 1], [7, 113, 1, 3], [7, 114, 2, 2], [7, 115, 3, 0], [7, 116, 0, 3], [8, 234, 2, 3], [8, 235, 3, 2], [8, 236, 1, 4], [8, 237, 4, 1], [8, 238, 1, 5], [8, 239, 5, 1], [8, 240, 3, 3], [8, 241, 2, 4], [8, 242, 0, 4], [8, 243, 4, 0], [9, 488, 4, 2], [9, 489, 2, 5], [9, 490, 5, 2], [9, 491, 0, 5], [9, 492, 6, 1], [9, 493, 5, 0], [9, 494, 1, 6], [9, 495, 4, 3], [9, 496, 3, 5], [9, 497, 3, 4], [9, 498, 5, 3], [9, 499, 2, 6], [9, 500, 6, 2], [9, 501, 1, 7], [10, 1004, 3, 6], [10, 1005, 0, 6], [10, 1006, 6, 0], [10, 1007, 4, 4], [10, 1008, 7, 1], [10, 1009, 4, 5], [10, 1010, 7, 2], [10, 1011, 5, 4], [10, 1012, 6, 3], [10, 1013, 2, 7], [10, 1014, 7, 3], [10, 1015, 6, 4], [10, 1016, 5, 5], [10, 1017, 4, 6], [10, 1018, 3, 7], [11, 2038, 7, 0], [11, 2039, 0, 7], [11, 2040, 6, 5], [11, 2041, 5, 6], [11, 2042, 7, 4], [11, 2043, 4, 7], [11, 2044, 5, 7], [11, 2045, 7, 5], [12, 4092, 7, 6], [12, 4093, 6, 6], [12, 4094, 6, 7], [12, 4095, 7, 7]], [[3, 0, 1, 1], [4, 2, 2, 1], [4, 3, 1, 0], [4, 4, 1, 2], [4, 5, 0, 1], [4, 6, 2, 2], [5, 14, 0, 0], [5, 15, 2, 0], [5, 16, 0, 2], [5, 17, 3, 1], [5, 18, 1, 3], [5, 19, 3, 2], [5, 20, 2, 3], [6, 42, 3, 3], [6, 43, 4, 1], [6, 44, 1, 4], [6, 45, 4, 2], [6, 46, 2, 4], [6, 47, 3, 0], [6, 48, 0, 3], [6, 49, 4, 3], [6, 50, 3, 4], [6, 51, 5, 2], [7, 104, 5, 1], [7, 105, 2, 5], [7, 106, 1, 5], [7, 107, 5, 3], [7, 108, 3, 5], [7, 109, 4, 4], [7, 110, 5, 4], [7, 111, 0, 4], [7, 112, 4, 5], [7, 113, 4, 0], [7, 114, 2, 6], [7, 115, 6, 2], [7, 116, 6, 1], [7, 117, 1, 6], [8, 236, 3, 6], [8, 237, 6, 3], [8, 238, 5, 5], [8, 239, 5, 0], [8, 240, 6, 4], [8, 241, 0, 5], [8, 242, 4, 6], [8, 243, 7, 1], [8, 244, 7, 2], [8, 245, 2, 7], [8, 246, 6, 5], [8, 247, 7, 3], [8, 248, 1, 7], [8, 249, 5, 6], [8, 250, 3, 7], [9, 502, 6, 6], [9, 503, 7, 4], [9, 504, 6, 0], [9, 505, 4, 7], [9, 506, 0, 6], [9, 507, 7, 5], [9, 508, 7, 6], [9, 509, 6, 7], [10, 1020, 5, 7], [10, 1021, 7, 0], [10, 1022, 0, 7], [10, 1023, 7, 7]], [[1, 0, 0, 0], [3, 4, 1, 0], [3, 5, 0, 1], [4, 12, 1, 1], [6, 52, 2, 1], [6, 53, 1, 2], [6, 54, 2, 0], [6, 55, 0, 2], [7, 112, 3, 1], [7, 113, 2, 2], [7, 114, 1, 3], [8, 230, 3, 0], [8, 231, 0, 3], [8, 232, 2, 3], [8, 233, 3, 2], [8, 234, 1, 4], [8, 235, 4, 1], [8, 236, 2, 4], [8, 237, 1, 5], [9, 476, 4, 2], [9, 477, 3, 3], [9, 478, 0, 4], [9, 479, 4, 0], [9, 480, 5, 1], [9, 481, 2, 5], [9, 482, 1, 6], [9, 483, 3, 4], [9, 484, 5, 2], [9, 485, 6, 1], [9, 486, 4, 3], [10, 974, 0, 5], [10, 975, 2, 6], [10, 976, 5, 0], [10, 977, 1, 7], [10, 978, 3, 5], [10, 979, 1, 8], [10, 980, 8, 1], [10, 981, 4, 4], [10, 982, 5, 3], [10, 983, 6, 2], [10, 984, 7, 1], [10, 985, 0, 6], [10, 986, 8, 2], [10, 987, 2, 8], [10, 988, 3, 6], [10, 989, 2, 7], [10, 990, 4, 5], [10, 991, 9, 1], [10, 992, 1, 9], [10, 993, 7, 2], [11, 1988, 6, 0], [11, 1989, 5, 4], [11, 1990, 6, 3], [11, 1991, 8, 3], [11, 1992, 0, 7], [11, 1993, 9, 2], [11, 1994, 3, 8], [11, 1995, 4, 6], [11, 1996, 3, 7], [11, 1997, 0, 8], [11, 1998, 10, 1], [11, 1999, 6, 4], [11, 2e3, 2, 9], [11, 2001, 5, 5], [11, 2002, 8, 0], [11, 2003, 7, 0], [11, 2004, 7, 3], [11, 2005, 10, 2], [11, 2006, 9, 3], [11, 2007, 8, 4], [11, 2008, 1, 10], [11, 2009, 7, 4], [11, 2010, 6, 5], [11, 2011, 5, 6], [11, 2012, 4, 8], [11, 2013, 4, 7], [11, 2014, 3, 9], [11, 2015, 11, 1], [11, 2016, 5, 8], [11, 2017, 9, 0], [11, 2018, 8, 5], [12, 4038, 10, 3], [12, 4039, 2, 10], [12, 4040, 0, 9], [12, 4041, 11, 2], [12, 4042, 9, 4], [12, 4043, 6, 6], [12, 4044, 12, 1], [12, 4045, 4, 9], [12, 4046, 8, 6], [12, 4047, 1, 11], [12, 4048, 9, 5], [12, 4049, 10, 4], [12, 4050, 5, 7], [12, 4051, 7, 5], [12, 4052, 2, 11], [12, 4053, 1, 12], [12, 4054, 12, 2], [12, 4055, 11, 3], [12, 4056, 3, 10], [12, 4057, 5, 9], [12, 4058, 6, 7], [12, 4059, 8, 7], [12, 4060, 11, 4], [12, 4061, 0, 10], [12, 4062, 7, 6], [12, 4063, 12, 3], [12, 4064, 10, 0], [12, 4065, 10, 5], [12, 4066, 4, 10], [12, 4067, 6, 8], [12, 4068, 2, 12], [12, 4069, 9, 6], [12, 4070, 9, 7], [12, 4071, 4, 11], [12, 4072, 11, 0], [12, 4073, 6, 9], [12, 4074, 3, 11], [12, 4075, 5, 10], [13, 8152, 8, 8], [13, 8153, 7, 8], [13, 8154, 12, 5], [13, 8155, 3, 12], [13, 8156, 11, 5], [13, 8157, 7, 7], [13, 8158, 12, 4], [13, 8159, 11, 6], [13, 8160, 10, 6], [13, 8161, 4, 12], [13, 8162, 7, 9], [13, 8163, 5, 11], [13, 8164, 0, 11], [13, 8165, 12, 6], [13, 8166, 6, 10], [13, 8167, 12, 0], [13, 8168, 10, 7], [13, 8169, 5, 12], [13, 8170, 7, 10], [13, 8171, 9, 8], [13, 8172, 0, 12], [13, 8173, 11, 7], [13, 8174, 8, 9], [13, 8175, 9, 9], [13, 8176, 10, 8], [13, 8177, 7, 11], [13, 8178, 12, 7], [13, 8179, 6, 11], [13, 8180, 8, 11], [13, 8181, 11, 8], [13, 8182, 7, 12], [13, 8183, 6, 12], [14, 16368, 8, 10], [14, 16369, 10, 9], [14, 16370, 8, 12], [14, 16371, 9, 10], [14, 16372, 9, 11], [14, 16373, 9, 12], [14, 16374, 10, 11], [14, 16375, 12, 9], [14, 16376, 10, 10], [14, 16377, 11, 9], [14, 16378, 12, 8], [14, 16379, 11, 10], [14, 16380, 12, 10], [14, 16381, 12, 11], [15, 32764, 10, 12], [15, 32765, 11, 11], [15, 32766, 11, 12], [15, 32767, 12, 12]], [[4, 0, 1, 1], [4, 1, 1, 2], [4, 2, 2, 1], [5, 6, 2, 2], [5, 7, 1, 0], [5, 8, 0, 1], [5, 9, 1, 3], [5, 10, 3, 2], [5, 11, 3, 1], [5, 12, 2, 3], [5, 13, 3, 3], [6, 28, 2, 0], [6, 29, 0, 2], [6, 30, 2, 4], [6, 31, 4, 2], [6, 32, 1, 4], [6, 33, 4, 1], [6, 34, 0, 0], [6, 35, 4, 3], [6, 36, 3, 4], [6, 37, 3, 0], [6, 38, 0, 3], [6, 39, 4, 4], [6, 40, 2, 5], [6, 41, 5, 2], [7, 84, 1, 5], [7, 85, 5, 1], [7, 86, 5, 3], [7, 87, 3, 5], [7, 88, 5, 4], [7, 89, 4, 5], [7, 90, 6, 2], [7, 91, 2, 6], [7, 92, 6, 3], [7, 93, 4, 0], [7, 94, 6, 1], [7, 95, 0, 4], [7, 96, 1, 6], [7, 97, 3, 6], [7, 98, 5, 5], [7, 99, 6, 4], [7, 100, 4, 6], [8, 202, 6, 5], [8, 203, 7, 2], [8, 204, 3, 7], [8, 205, 2, 7], [8, 206, 5, 6], [8, 207, 8, 2], [8, 208, 7, 3], [8, 209, 5, 0], [8, 210, 7, 1], [8, 211, 0, 5], [8, 212, 8, 1], [8, 213, 1, 7], [8, 214, 8, 3], [8, 215, 7, 4], [8, 216, 4, 7], [8, 217, 2, 8], [8, 218, 6, 6], [8, 219, 7, 5], [8, 220, 1, 8], [8, 221, 3, 8], [8, 222, 8, 4], [8, 223, 4, 8], [8, 224, 5, 7], [8, 225, 8, 5], [8, 226, 5, 8], [9, 454, 7, 6], [9, 455, 6, 7], [9, 456, 9, 2], [9, 457, 6, 0], [9, 458, 6, 8], [9, 459, 9, 3], [9, 460, 3, 9], [9, 461, 9, 1], [9, 462, 2, 9], [9, 463, 0, 6], [9, 464, 8, 6], [9, 465, 9, 4], [9, 466, 4, 9], [9, 467, 10, 2], [9, 468, 1, 9], [9, 469, 7, 7], [9, 470, 8, 7], [9, 471, 9, 5], [9, 472, 7, 8], [9, 473, 10, 3], [9, 474, 5, 9], [9, 475, 10, 4], [9, 476, 2, 10], [9, 477, 10, 1], [9, 478, 3, 10], [9, 479, 9, 6], [9, 480, 6, 9], [9, 481, 8, 0], [9, 482, 4, 10], [9, 483, 7, 0], [9, 484, 11, 2], [10, 970, 7, 9], [10, 971, 11, 3], [10, 972, 10, 6], [10, 973, 1, 10], [10, 974, 11, 1], [10, 975, 9, 7], [10, 976, 0, 7], [10, 977, 8, 8], [10, 978, 10, 5], [10, 979, 3, 11], [10, 980, 5, 10], [10, 981, 8, 9], [10, 982, 11, 5], [10, 983, 0, 8], [10, 984, 11, 4], [10, 985, 2, 11], [10, 986, 7, 10], [10, 987, 6, 10], [10, 988, 10, 7], [10, 989, 4, 11], [10, 990, 1, 11], [10, 991, 12, 2], [10, 992, 9, 8], [10, 993, 12, 3], [10, 994, 11, 6], [10, 995, 5, 11], [10, 996, 12, 4], [10, 997, 11, 7], [10, 998, 12, 5], [10, 999, 3, 12], [10, 1e3, 6, 11], [10, 1001, 9, 0], [10, 1002, 10, 8], [10, 1003, 10, 0], [10, 1004, 12, 1], [10, 1005, 0, 9], [10, 1006, 4, 12], [10, 1007, 9, 9], [10, 1008, 12, 6], [10, 1009, 2, 12], [10, 1010, 8, 10], [11, 2022, 9, 10], [11, 2023, 1, 12], [11, 2024, 11, 8], [11, 2025, 12, 7], [11, 2026, 7, 11], [11, 2027, 5, 12], [11, 2028, 6, 12], [11, 2029, 10, 9], [11, 2030, 8, 11], [11, 2031, 12, 8], [11, 2032, 0, 10], [11, 2033, 7, 12], [11, 2034, 11, 0], [11, 2035, 10, 10], [11, 2036, 11, 9], [11, 2037, 11, 10], [11, 2038, 0, 11], [11, 2039, 11, 11], [11, 2040, 9, 11], [11, 2041, 10, 11], [11, 2042, 12, 0], [11, 2043, 8, 12], [12, 4088, 12, 9], [12, 4089, 10, 12], [12, 4090, 9, 12], [12, 4091, 11, 12], [12, 4092, 12, 11], [12, 4093, 0, 12], [12, 4094, 12, 10], [12, 4095, 12, 12]], [[4, 0, 0, 0], [4, 1, 1, 1], [5, 4, 16, 16], [5, 5, 1, 0], [5, 6, 0, 1], [5, 7, 2, 1], [5, 8, 1, 2], [5, 9, 2, 2], [6, 20, 1, 3], [6, 21, 3, 1], [6, 22, 3, 2], [6, 23, 2, 0], [6, 24, 2, 3], [6, 25, 0, 2], [6, 26, 3, 3], [7, 54, 4, 1], [7, 55, 1, 4], [7, 56, 4, 2], [7, 57, 2, 4], [7, 58, 4, 3], [7, 59, 3, 4], [7, 60, 3, 0], [7, 61, 0, 3], [7, 62, 5, 1], [7, 63, 5, 2], [7, 64, 2, 5], [7, 65, 4, 4], [7, 66, 1, 5], [7, 67, 5, 3], [7, 68, 3, 5], [7, 69, 5, 4], [8, 140, 4, 5], [8, 141, 6, 2], [8, 142, 2, 6], [8, 143, 6, 1], [8, 144, 6, 3], [8, 145, 3, 6], [8, 146, 1, 6], [8, 147, 4, 16], [8, 148, 3, 16], [8, 149, 16, 5], [8, 150, 16, 3], [8, 151, 16, 4], [8, 152, 6, 4], [8, 153, 16, 6], [8, 154, 4, 0], [8, 155, 4, 6], [8, 156, 0, 4], [8, 157, 2, 16], [8, 158, 5, 5], [8, 159, 5, 16], [8, 160, 16, 7], [8, 161, 16, 2], [8, 162, 16, 8], [8, 163, 2, 7], [8, 164, 7, 2], [8, 165, 3, 7], [8, 166, 6, 5], [8, 167, 5, 6], [8, 168, 6, 16], [8, 169, 16, 10], [8, 170, 7, 3], [8, 171, 7, 1], [8, 172, 16, 9], [8, 173, 7, 16], [8, 174, 1, 16], [8, 175, 1, 7], [8, 176, 4, 7], [8, 177, 16, 11], [8, 178, 7, 4], [8, 179, 16, 12], [8, 180, 8, 16], [8, 181, 16, 1], [8, 182, 6, 6], [8, 183, 9, 16], [8, 184, 2, 8], [8, 185, 5, 7], [8, 186, 10, 16], [8, 187, 16, 13], [8, 188, 8, 3], [8, 189, 8, 2], [8, 190, 3, 8], [8, 191, 5, 0], [8, 192, 16, 14], [8, 193, 11, 16], [8, 194, 7, 5], [8, 195, 4, 8], [8, 196, 6, 7], [8, 197, 7, 6], [8, 198, 0, 5], [9, 398, 8, 4], [9, 399, 16, 15], [9, 400, 12, 16], [9, 401, 1, 8], [9, 402, 8, 1], [9, 403, 14, 16], [9, 404, 5, 8], [9, 405, 13, 16], [9, 406, 3, 9], [9, 407, 8, 5], [9, 408, 7, 7], [9, 409, 2, 9], [9, 410, 8, 6], [9, 411, 9, 2], [9, 412, 9, 3], [9, 413, 15, 16], [9, 414, 4, 9], [9, 415, 6, 8], [9, 416, 6, 0], [9, 417, 9, 4], [9, 418, 5, 9], [9, 419, 8, 7], [9, 420, 7, 8], [9, 421, 1, 9], [9, 422, 10, 3], [9, 423, 0, 6], [9, 424, 10, 2], [9, 425, 9, 1], [9, 426, 9, 5], [9, 427, 4, 10], [9, 428, 2, 10], [9, 429, 9, 6], [9, 430, 3, 10], [9, 431, 6, 9], [9, 432, 10, 4], [9, 433, 8, 8], [9, 434, 10, 5], [9, 435, 9, 7], [9, 436, 11, 3], [9, 437, 1, 10], [9, 438, 7, 0], [9, 439, 10, 6], [9, 440, 7, 9], [9, 441, 3, 11], [9, 442, 5, 10], [9, 443, 10, 1], [9, 444, 4, 11], [9, 445, 11, 2], [9, 446, 13, 2], [9, 447, 6, 10], [9, 448, 13, 3], [9, 449, 2, 11], [9, 450, 16, 0], [9, 451, 5, 11], [9, 452, 11, 5], [10, 906, 11, 4], [10, 907, 9, 8], [10, 908, 7, 10], [10, 909, 8, 9], [10, 910, 0, 16], [10, 911, 4, 13], [10, 912, 0, 7], [10, 913, 3, 13], [10, 914, 11, 6], [10, 915, 13, 1], [10, 916, 13, 4], [10, 917, 12, 3], [10, 918, 2, 13], [10, 919, 13, 5], [10, 920, 8, 10], [10, 921, 6, 11], [10, 922, 10, 8], [10, 923, 10, 7], [10, 924, 14, 2], [10, 925, 12, 4], [10, 926, 1, 11], [10, 927, 4, 12], [10, 928, 11, 1], [10, 929, 3, 12], [10, 930, 1, 13], [10, 931, 12, 2], [10, 932, 7, 11], [10, 933, 3, 14], [10, 934, 5, 12], [10, 935, 5, 13], [10, 936, 14, 4], [10, 937, 4, 14], [10, 938, 11, 7], [10, 939, 14, 3], [10, 940, 12, 5], [10, 941, 13, 6], [10, 942, 12, 6], [10, 943, 8, 0], [10, 944, 11, 8], [10, 945, 2, 12], [10, 946, 9, 9], [10, 947, 14, 5], [10, 948, 6, 13], [10, 949, 10, 10], [10, 950, 15, 2], [10, 951, 8, 11], [10, 952, 9, 10], [10, 953, 14, 6], [10, 954, 10, 9], [10, 955, 5, 14], [10, 956, 11, 9], [10, 957, 14, 1], [10, 958, 2, 14], [10, 959, 6, 12], [10, 960, 1, 12], [10, 961, 13, 8], [10, 962, 0, 8], [10, 963, 13, 7], [10, 964, 7, 12], [10, 965, 12, 7], [10, 966, 7, 13], [10, 967, 15, 3], [10, 968, 12, 1], [10, 969, 6, 14], [10, 970, 2, 15], [10, 971, 15, 5], [10, 972, 15, 4], [10, 973, 1, 14], [10, 974, 9, 11], [10, 975, 4, 15], [10, 976, 14, 7], [10, 977, 8, 13], [10, 978, 13, 9], [10, 979, 8, 12], [10, 980, 5, 15], [10, 981, 3, 15], [10, 982, 10, 11], [10, 983, 11, 10], [10, 984, 12, 8], [10, 985, 15, 6], [10, 986, 15, 7], [10, 987, 8, 14], [10, 988, 15, 1], [10, 989, 7, 14], [10, 990, 9, 0], [10, 991, 0, 9], [10, 992, 9, 13], [10, 993, 9, 12], [10, 994, 12, 9], [10, 995, 14, 8], [10, 996, 10, 13], [10, 997, 14, 9], [10, 998, 12, 10], [10, 999, 6, 15], [10, 1e3, 7, 15], [11, 2002, 9, 14], [11, 2003, 15, 8], [11, 2004, 11, 11], [11, 2005, 11, 14], [11, 2006, 1, 15], [11, 2007, 10, 12], [11, 2008, 10, 14], [11, 2009, 13, 11], [11, 2010, 13, 10], [11, 2011, 11, 13], [11, 2012, 11, 12], [11, 2013, 8, 15], [11, 2014, 14, 11], [11, 2015, 13, 12], [11, 2016, 12, 13], [11, 2017, 15, 9], [11, 2018, 14, 10], [11, 2019, 10, 0], [11, 2020, 12, 11], [11, 2021, 9, 15], [11, 2022, 0, 10], [11, 2023, 12, 12], [11, 2024, 11, 0], [11, 2025, 12, 14], [11, 2026, 10, 15], [11, 2027, 13, 13], [11, 2028, 0, 13], [11, 2029, 14, 12], [11, 2030, 15, 10], [11, 2031, 15, 11], [11, 2032, 11, 15], [11, 2033, 14, 13], [11, 2034, 13, 0], [11, 2035, 0, 11], [11, 2036, 13, 14], [11, 2037, 15, 12], [11, 2038, 15, 13], [11, 2039, 12, 15], [11, 2040, 14, 0], [11, 2041, 14, 14], [11, 2042, 13, 15], [11, 2043, 12, 0], [11, 2044, 14, 15], [12, 4090, 0, 14], [12, 4091, 0, 12], [12, 4092, 15, 14], [12, 4093, 15, 0], [12, 4094, 0, 15], [12, 4095, 15, 15]]], $ = [!1, !1, !0, !0, !1, !1, !0, !0, !0, !0, !0], ye = function() {
function k() {
}
return k.M = function(P, Z) {
for (var he = 0, Ie = Z[he][0], Ee = Object(B.a)(P, Ie); Ee !== Z[he][1]; ) {
var pe = Z[++he][0] - Ie;
Ie = Z[he][0], Ee <<= pe, Ee |= Object(B.a)(P, pe);
}
return he;
}, k.S = function(P, Z, he, Ie) {
for (var Ee = he; Ee < he + Ie; Ee++)
Z[Ee] && Object(B.a)(P, 1) && (Z[Ee] = -Z[Ee]);
}, k.T = function(P, Z) {
for (var he = 4; Object(B.a)(P, 1); )
he++;
var Ie = Object(B.a)(P, he) | 1 << he;
return Z < 0 ? -Ie : Ie;
}, k.decodeScaleFactor = function(P) {
var Z = this.M(P, J);
return J[Z][2];
}, k.decodeSpectralData = function(P, Z, he, Ie) {
var Ee = be[Z - 1], pe = this.M(P, Ee);
if (he[Ie] = Ee[pe][2], he[Ie + 1] = Ee[pe][3], Z < 5 && (he[Ie + 2] = Ee[pe][4], he[Ie + 3] = Ee[pe][5]), Z < 11)
$[Z - 1] && this.S(P, he, Ie, Z < 5 ? 4 : 2);
else {
if (!(Z === 11 || Z > 15))
throw new Error("Huffman: unknown spectral codebook: " + Z);
this.S(P, he, Ie, Z < 5 ? 4 : 2), Math.abs(he[Ie]) === 16 && (he[Ie] = this.T(P, he[Ie])), Math.abs(he[Ie + 1]) === 16 && (he[Ie + 1] = this.T(P, he[Ie + 1]));
}
}, k;
}(), Be = n(4), Ve = function(k) {
return k[k.ID_SCE = 0] = "ID_SCE", k[k.ID_CPE = 1] = "ID_CPE", k[k.ID_CCE = 2] = "ID_CCE", k[k.ID_LFE = 3] = "ID_LFE", k[k.ID_DSE = 4] = "ID_DSE", k[k.ID_PCE = 5] = "ID_PCE", k[k.ID_FIL = 6] = "ID_FIL", k[k.ID_END = 7] = "ID_END", k;
}({}), je = function(k) {
return k[k.ONLY_LONG_SEQUENCE = 0] = "ONLY_LONG_SEQUENCE", k[k.LONG_START_SEQUENCE = 1] = "LONG_START_SEQUENCE", k[k.EIGHT_SHORT_SEQUENCE = 2] = "EIGHT_SHORT_SEQUENCE", k[k.LONG_STOP_SEQUENCE = 3] = "LONG_STOP_SEQUENCE", k;
}(je || {}), we = "Input buffer exhausted before END element found", ue = "Pulse data corrupt or invalid", L = [1, 4, 3], w = [2, 6, 5], le = function(k) {
return k[k.BEFORE_TNS = 0] = "BEFORE_TNS", k[k.AFTER_TNS = 1] = "AFTER_TNS", k[k.AFTER_IMDCT = 2] = "AFTER_IMDCT", k;
}(le || {}), oe = "aac-raw-block", Re = function() {
function k() {
}
return k.decode = function(P, Z, he) {
for (var Ie = { sampling_frequency_index: Z, aot: he, ics: { window_sequence: 0, num_windows: 0, max_sfb: 0, num_window_groups: 0, window_group_length: [], num_swb: 0, swb_offset: [], predictor_present: 0 }, sfb_cb: [], sect_end: [] }, Ee = Object(B.c)(P), pe = []; Object(B.d)(Ee) > 3; ) {
var G = Object(B.a)(Ee, 3);
if (G === Ve.ID_CPE)
this.D(Ie, Ee);
else if (G === Ve.ID_CCE)
this.L(Ie, Ee);
else if (G === Ve.ID_LFE || G === Ve.ID_SCE)
this.V(Ie, Ee);
else if (G === Ve.ID_DSE)
this.U(Ee);
else if (G === Ve.ID_PCE)
this.P(Ie, Ee);
else {
if (G !== Ve.ID_FIL)
break;
var te = this.H(Ee);
if (te) {
var ie = this.K(Ee, te);
ie && pe.push(ie);
}
}
}
if (Object(B.b)(Ee), pe.length)
return { priv: pe };
}, k.K = function(P, Z) {
var he = Z.byteIndex;
if (!(he < 6)) {
var Ie = P.data;
he -= 2;
var Ee = Object(Be.f)(Ie, he);
if (Ie[he -= 2] === 75 && Ie[he + 1] === 83) {
var pe = Ie[he -= 1];
if (he - pe < 0)
return;
var G = Ie.subarray(he - pe, he + 3);
if (G[0] === 0 && G[1] === pe - 2 && Ee === function(te) {
for (var ie = 0, ee = 0, Te = 0; Te < te.length; Te++)
ee = (ee + (ie = (ie + te[Te]) % 255)) % 255;
return ee << 8 | ie;
}(G))
return { id: G[0], checkSum: Ee, data: Ie.subarray(he - pe + 2, he) };
}
}
}, k.P = function(P, Z) {
Object(B.g)(Z, 6), P.sampling_frequency_index = Object(B.a)(Z, 4);
var he = Object(B.a)(Z, 4), Ie = Object(B.a)(Z, 4), Ee = Object(B.a)(Z, 4), pe = Object(B.a)(Z, 2), G = Object(B.a)(Z, 3), te = Object(B.a)(Z, 4);
Object(B.a)(Z, 1) && Object(B.g)(Z, 4), Object(B.a)(Z, 1) && Object(B.g)(Z, 4), Object(B.a)(Z, 1) && Object(B.g)(Z, 3), Object(B.g)(Z, 5 * he), Object(B.g)(Z, 5 * Ie), Object(B.g)(Z, 5 * Ee), Object(B.g)(Z, 4 * pe), Object(B.g)(Z, 4 * G), Object(B.g)(Z, 5 * te), Object(B.b)(Z);
var ie = 8 * Object(B.a)(Z, 8);
if (Object(B.d)(Z) < ie)
throw new Error("decode_pce: " + we);
Object(B.g)(Z, ie);
}, k.H = function(P) {
var Z = Object(B.a)(P, 4);
if (Z === 15 && (Z += Object(B.a)(P, 8) - 1), Z)
return Object(B.g)(P, 8 * Z), { byteIndex: P.byteIndex, bitIndex: P.bitIndex };
}, k.V = function(P, Z) {
Object(B.g)(Z, 4), this.W(P, Z, 0);
}, k.D = function(P, Z) {
Object(B.g)(Z, 4);
var he = Object(B.a)(Z, 1);
if (he) {
this.X(P, Z), P.ics.predictor_present && P.aot !== z.AOT_AAC_MAIN && Object(B.a)(Z, 1) && k.J(P, Z);
var Ie = Object(B.a)(Z, 2);
if (Ie === 3)
throw new Error(oe + ' "ms_present = 3 is reserved.');
Ie && k.$(P, Z, Ie);
}
this.W(P, Z, he), this.W(P, Z, he);
}, k.$ = function(P, Z, he) {
var Ie = P.ics.num_window_groups * P.ics.max_sfb;
he === 1 && Object(B.g)(Z, Ie);
}, k.L = function(P, Z) {
Object(B.g)(Z, 4);
for (var he = 2 * Object(B.a)(Z, 1), Ie = Object(B.a)(Z, 3), Ee = 0, pe = 0; pe <= Ie; pe++) {
Ee++;
var G = Object(B.a)(Z, 1);
Object(B.g)(Z, 4), G && Object(B.a)(Z, 2) === 3 && Ee++;
}
he += Object(B.a)(Z, 1) || he >> 1, Object(B.g)(Z, 1), Object(B.g)(Z, 2), this.W(P, Z, 0);
for (var te = 0; te < Ee; te++) {
var ie = 1;
if (te > 0 && (ie = he === le.AFTER_IMDCT ? 1 : Object(B.a)(Z, 1)) && ye.decodeScaleFactor(Z), he !== le.AFTER_IMDCT)
for (var ee = 0; ee < P.ics.num_window_groups; ee++)
for (var Te = 0; Te < P.ics.max_sfb; Te++)
P.sfb_cb[ee][Te] !== 0 && ie === 0 && ye.decodeScaleFactor(Z);
}
}, k.U = function(P) {
Object(B.g)(P, 4);
var Z = Object(B.a)(P, 1), he = Object(B.a)(P, 8);
if (he === 255 && (he += Object(B.a)(P, 8)), Z && Object(B.b)(P), Object(B.d)(P) < 8 * he)
throw new Error(oe + " skip_data_stream_element: " + we);
Object(B.g)(P, 8 * he);
}, k.W = function(P, Z, he) {
var Ie = Object(B.a)(Z, 8);
if (he || this.X(P, Z), this.tt(P, Z), this.it(P, Z, Ie), Object(B.a)(Z, 1)) {
if (P.ics.window_sequence === je.EIGHT_SHORT_SEQUENCE)
throw new Error(oe + " error Pulse tool not allowed in eight short sequence.");
this.et(P, Z);
}
Object(B.a)(Z, 1) && this.nt(P, Z), Object(B.a)(Z, 1) && this.rt(P, Z), this.ht(P, Z);
}, k.tt = function(P, Z) {
for (var he = P.ics.window_sequence === je.EIGHT_SHORT_SEQUENCE ? 3 : 5, Ie = 0, Ee = 0; Ee < P.ics.num_window_groups; Ee++) {
P.sfb_cb[Ee] || (P.sfb_cb[Ee] = []), P.sect_end[Ee] || (P.sect_end[Ee] = []);
for (var pe = 0; pe < P.ics.max_sfb; ) {
var G = pe, te = Object(B.a)(Z, 4);
if (te === 12)
throw new Error(oe + " invalid band type");
var ie = 0;
do {
if (Object(B.d)(Z) < he)
throw new Error(oe + " decode_band_types: " + we);
if ((G += ie = Object(B.a)(Z, he)) > P.ics.max_sfb)
throw new Error(oe + " Number of bands(" + G + ") exceeds limit(" + P.ics.max_sfb + ").");
} while (ie == (1 << he) - 1);
for (; pe < G; pe++)
P.sfb_cb[Ee][Ie] = te, P.sect_end[Ee][Ie++] = G;
}
}
}, k.it = function(P, Z, he) {
for (var Ie = 0, Ee = 1, pe = 0; pe < P.ics.num_window_groups; pe++)
for (var G = 0; G < P.ics.max_sfb; ) {
var te = P.sect_end[pe][Ie];
switch (P.sfb_cb[pe][Ie]) {
case 0:
for (; G < te; G++, Ie++)
;
break;
case 15:
case 14:
for (; G < te; G++, Ie++)
ye.decodeScaleFactor(Z);
break;
case 13:
for (; G < te; G++, Ie++)
Ee-- > 0 ? Object(B.g)(Z, 9) : ye.decodeScaleFactor(Z);
break;
default:
for (; G < te; G++, Ie++)
ye.decodeScaleFactor(Z);
}
}
}, k.et = function(P, Z) {
var he = Object(B.a)(Z, 2) + 1, Ie = Object(B.a)(Z, 6);
if (Ie >= P.ics.num_swb)
throw new Error(oe + " " + ue);
var Ee = [P.ics.swb_offset[Ie]];
if (Ee[0] += Object(B.a)(Z, 5), Ee[0] >= P.ics.swb_offset[P.ics.num_swb])
throw new Error(oe + " " + ue);
for (var pe = [Object(B.a)(Z, 4)], G = 1; G < he; G++) {
if (Ee[G] = Object(B.a)(Z, 5) + Ee[G - 1], Ee[G] > P.ics.swb_offset[P.ics.num_swb])
throw new Error(oe + " " + ue);
pe[G] = Object(B.a)(Z, 4);
}
}, k.nt = function(P, Z) {
for (var he = P.ics.window_sequence === je.EIGHT_SHORT_SEQUENCE ? L : w, Ie = P.ics.window_sequence === je.EIGHT_SHORT_SEQUENCE ? 7 : P.aot === z.AOT_AAC_MAIN ? 20 : 12, Ee = 0; Ee < P.ics.num_windows; Ee++) {
var pe = Object(B.a)(Z, he[0]);
if (pe)
for (var G = Object(B.a)(Z, 1), te = 0; te < pe; te++) {
Object(B.g)(Z, he[1]);
var ie = Object(B.a)(Z, he[2]);
if (ie > Ie)
throw new Error(oe + " tns order: " + ie + " > " + Ie);
if (ie) {
Object(B.g)(Z, 1);
for (var ee = G + 3 - Object(B.a)(Z, 1), Te = 0; Te < ie; Te++)
Object(B.g)(Z, ee);
}
}
}
}, k.rt = function(P, Z) {
for (var he = [[1, 0, 5], [2, 1, 2], [8, 0, 2], [2, 1, 5]], Ie = P.ics.window_sequence, Ee = Object(B.a)(Z, 2), pe = 0; pe < Ee; pe++)
for (var G = 0; G < he[Ie][0]; G++)
for (var te = Object(B.a)(Z, 3), ie = 0; ie < te; ie++)
Object(B.g)(Z, 4 + (G == 0 && he[Ie][1] ? 4 : he[Ie][2]));
}, k.ht = function(P, Z) {
for (var he = P.sfb_cb, Ie = P.ics.swb_offset, Ee = 0, pe = 0, G = 0; G < P.ics.num_window_groups; G++) {
for (var te = P.ics.window_group_length[G], ie = 0; ie < P.ics.max_sfb; ie++, pe++) {
var ee = he[G][pe], Te = Ie[ie + 1] - Ie[ie], Se = Ee + Ie[ie];
if (!(ee === 0 || ee === 15 || ee === 14) && ee !== 13)
for (var Ye = 0; Ye < te; Ye++, Se += 128)
for (var ze = ee >= 5 ? 2 : 4, it = 0; it < Te; it += ze)
ye.decodeSpectralData(Z, ee, [0, 0, 0, 0], 0);
}
Ee += te << 7;
}
}, k.X = function(P, Z) {
var he = P.sampling_frequency_index;
if (Object(B.a)(Z, 1))
throw new Error(oe + ", Reserved bit set.");
var Ie = P.ics.window_sequence = Object(B.a)(Z, 2);
if (Object(B.g)(Z, 1), P.ics.num_window_groups = 1, P.ics.window_group_length[0] = 1, Ie === je.EIGHT_SHORT_SEQUENCE) {
P.ics.max_sfb = Object(B.a)(Z, 4);
for (var Ee = 0; Ee < 7; Ee++)
Object(B.a)(Z, 1) ? P.ics.window_group_length[P.ics.num_window_groups - 1]++ : (P.ics.num_window_groups++, P.ics.window_group_length[P.ics.num_window_groups - 1] = 1);
P.ics.num_windows = 8, P.ics.num_swb = p[he], P.ics.swb_offset = K[he], P.ics.predictor_present = 0;
} else if (P.ics.max_sfb = Object(B.a)(Z, 6), P.ics.num_windows = 1, P.ics.num_swb = s[he], P.ics.swb_offset = I[he], P.ics.predictor_present = Object(B.a)(Z, 1), P.ics.predictor_present)
if (P.aot === z.AOT_AAC_MAIN)
k.ot(P, Z);
else {
if (P.aot === z.AOT_AAC_LC)
throw new Error("Prediction is not allowed in AAC-LC.");
Object(B.a)(Z, 1) && k.J(P, Z);
}
if (P.ics.max_sfb > P.ics.num_swb)
throw new Error("Number of scalefactor bands in group (" + P.ics.max_sfb + ") exceeds limit (" + P.ics.num_swb + ").");
}, k.ot = function(P, Z) {
if (Object(B.a)(Z, 1)) {
var he = Object(B.a)(Z, 5);
if (he === 0 || he > 30)
throw new Error("Invalid Predictor Reset Group.");
}
Object(B.g)(Z, Math.min(P.ics.max_sfb, g[P.sampling_frequency_index]));
}, k.J = function(P, Z) {
Object(B.g)(Z, 14 + Math.min(P.ics.max_sfb, 40));
}, k;
}(), Oe = n(3), de = n(2), X = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350], ge = "adts";
function Pe(k, P, Z) {
Z === void 0 && (Z = "mp4a.40.2"), Z = Z || "mp4a.40.2";
var he = X.indexOf(k);
if (!(he < 0 || Z !== "mp4a.40.5" && Z !== "mp4a.40.2"))
return Z === "mp4a.40.5" && (he += 3), new Uint8Array([((31 & (Z === "mp4a.40.2" ? 2 : 5)) << 3) + (he >> 1 & 7), ((1 & he) << 7) + ((15 & P) << 3)]);
}
function ae(k, P, Z, he) {
if (he <= z.AOT_SBR)
try {
return Re.decode(P, Z, he);
} catch (Ie) {
k.v(ge, "aac raw error", Ie.message);
}
}
function q(k, P) {
return k[P] === 255 && (246 & k[P + 1]) == 240;
}
function m(k, P) {
return 1 & k[P + 1] ? 7 : 9;
}
function ve(k, P) {
return (3 & k[P + 3]) << 11 | k[P + 4] << 3 | (224 & k[P + 5]) >>> 5;
}
function U(k, P) {
return !!(P + 1 < k.length && q(k, P));
}
function M(k, P) {
return k.asc !== Object(Be.f)(P);
}
function ne(k, P, Z, he, Ie, Ee) {
if (Ee === void 0 && (Ee = ""), M(P, he) || !P.samplerate || !P.configParsed) {
var pe = Ie === o.a.ADTS ? function(G) {
return { objectType: 1 + ((192 & G[0]) >>> 6), sampleingIndex: (60 & G[0]) >>> 2, chanelConfig: (1 & G[0]) << 2 | (192 & G[1]) >>> 6 };
}(he) : function(G) {
return { objectType: G[0] >>> 3, sampleingIndex: (7 & G[0]) << 1 | G[1] >>> 7, chanelConfig: (120 & G[1]) >>> 3 };
}(he);
if (pe.sampleingIndex < 0 || pe.sampleingIndex >= 13)
return void Z.emit(de.a.ERROR, Object(Oe.e)(Oe.b.MUX_ERROR, Oe.a.PARSING_ERROR, "invalid sampling index:" + pe.sampleingIndex));
if (pe.chanelConfig < 0 || pe.chanelConfig >= 8)
return void Z.emit(de.a.ERROR, Object(Oe.e)(Oe.b.MUX_ERROR, Oe.a.PARSING_ERROR, "invalid chanelConfig:" + pe.chanelConfig));
pe.chanelConfig || (k.i(ge, "init track channelConfig:", pe.chanelConfig), pe.chanelConfig = 2), Le(k, P, pe, Ee), P.asc = Object(Be.f)(he), P.configParsed = !0;
}
}
function Le(k, P, Z, he) {
he === void 0 && (he = "");
var Ie = function(Ee, pe, G) {
G === void 0 && (G = "");
var te, ie, ee = pe.objectType, Te = pe.sampleingIndex, Se = pe.chanelConfig, Ye = navigator.userAgent.toLowerCase(), ze = G || "mp4a.40." + ee;
return Ee.v(ge, "manifest codec:" + G + ",data:type:" + ee + ",sampleingIndex:" + Te + "[" + X[Te] + "Hz],channelConfig:" + Se), /firefox/i.test(Ye) ? Te >= 6 ? (ee = 5, ie = new Array(4), te = Te - 3) : (ee = 2, ie = new Array(2), te = Te) : Ye.indexOf("android") !== -1 ? (ee = 2, ie = new Array(2), te = Te) : (ee = 5, ie = new Array(4), G && (G.indexOf("mp4a.40.29") !== -1 || G.indexOf("mp4a.40.5") !== -1) || !G && Te >= 6 ? te = Te - 3 : ((G && G.indexOf("mp4a.40.2") !== -1 && (Te >= 6 && Se === 1 || /vivaldi/i.test(Ye)) || !G && Se === 1) && (ee = 2, ie = new Array(2)), te = Te)), ie[0] = ee << 3, ie[0] |= (14 & Te) >> 1, ie[1] |= (1 & Te) << 7, ie[1] |= Se << 3, ee === 5 && (ie[1] |= (14 & te) >> 1, ie[2] = (1 & te) << 7, ie[2] |= 8, ie[3] = 0), { config: ie, samplerate: X[Te], extensionSamplerate: X[te], channelCount: Se, codec: "mp4a.40." + ee, manifestCodec: ze, sampleingIndex: Te };
}(k, Z, he);
Ie && (P.config = Ie.config, P.samplerate = Ie.samplerate, P.extensionSamplerate = Ie.extensionSamplerate, P.channelCount = Ie.channelCount, P.codec = Ie.codec, P.manifestCodec = Ie.manifestCodec, P.sampleDuration = Ue(P.samplerate, P.inputTimescale), P.aacSampleingIndex = Z.sampleingIndex, P.aot = Z.objectType, k.v("parsed codec:" + P.codec + ",rate:" + Ie.samplerate + ",nb channel:" + Ie.channelCount));
}
function Ue(k, P) {
return 1024 * P / k;
}
function re(k, P, Z, he, Ie, Ee, pe) {
var G = function(it, ct, nt, zt, bt, Mt, Kt) {
var Xt, ni = ct.length, wt = m(ct, nt);
return Xt = ve(ct, nt), (Xt -= wt) > 0 && nt + wt + Xt <= ni ? { headerLength: wt, frameLength: Xt, stamp: zt + bt * Mt, originStamp: Kt + bt * Mt } : null;
}(0, Z, he, Ie, Ee, Ue(P.samplerate, P.inputTimescale), pe);
if (G) {
var te = G.frameLength, ie = G.headerLength, ee = G.stamp, Te = G.originStamp, Se = ie + te, Ye = Math.max(0, he + Se - Z.length);
Ye ? new Uint8Array(Se - ie).set(Z.subarray(he + ie, Z.length), 0) : Z.subarray(he + ie, he + Se);
var ze = { unit: Z.subarray(he + ie, he + ie + te), pts: ee, dts: ee, originDTS: Te, originPTS: Te };
return Ye || P.samples.push(ze), { sample: ze, length: Se, missing: Ye };
}
}
}, function(e, r, n) {
e.exports = function(o) {
var s = {};
function p(g) {
if (s[g])
return s[g].exports;
var C = s[g] = { i: g, l: !1, exports: {} };
return o[g].call(C.exports, C, C.exports, p), C.l = !0, C.exports;
}
return p.m = o, p.c = s, p.d = function(g, C, y) {
p.o(g, C) || Object.defineProperty(g, C, { enumerable: !0, get: y });
}, p.r = function(g) {
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(g, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(g, "__esModule", { value: !0 });
}, p.t = function(g, C) {
if (1 & C && (g = p(g)), 8 & C || 4 & C && typeof g == "object" && g && g.__esModule)
return g;
var y = /* @__PURE__ */ Object.create(null);
if (p.r(y), Object.defineProperty(y, "default", { enumerable: !0, value: g }), 2 & C && typeof g != "string")
for (var x in g)
p.d(y, x, function(h) {
return g[h];
}.bind(null, x));
return y;
}, p.n = function(g) {
var C = g && g.__esModule ? function() {
return g.default;
} : function() {
return g;
};
return p.d(C, "a", C), C;
}, p.o = function(g, C) {
return Object.prototype.hasOwnProperty.call(g, C);
}, p.p = "", p(p.s = 4);
}([function(o, s) {
function p(g) {
return o.exports = p = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(C) {
return typeof C;
} : function(C) {
return C && typeof Symbol == "function" && C.constructor === Symbol && C !== Symbol.prototype ? "symbol" : typeof C;
}, o.exports.__esModule = !0, o.exports.default = o.exports, p(g);
}
o.exports = p, o.exports.__esModule = !0, o.exports.default = o.exports;
}, function(o, s, p) {
var g = p(2);
function C(y, x) {
for (var h = 0; h < x.length; h++) {
var F = x[h];
F.enumerable = F.enumerable || !1, F.configurable = !0, "value" in F && (F.writable = !0), Object.defineProperty(y, g(F.key), F);
}
}
o.exports = function(y, x, h) {
return x && C(y.prototype, x), h && C(y, h), Object.defineProperty(y, "prototype", { writable: !1 }), y;
}, o.exports.__esModule = !0, o.exports.default = o.exports;
}, function(o, s, p) {
var g = p(0).default, C = p(3);
o.exports = function(y) {
var x = C(y, "string");
return g(x) == "symbol" ? x : x + "";
}, o.exports.__esModule = !0, o.exports.default = o.exports;
}, function(o, s, p) {
var g = p(0).default;
o.exports = function(C, y) {
if (g(C) != "object" || !C)
return C;
var x = C[Symbol.toPrimitive];
if (x !== void 0) {
var h = x.call(C, y || "default");
if (g(h) != "object")
return h;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (y === "string" ? String : Number)(C);
}, o.exports.__esModule = !0, o.exports.default = o.exports;
}, function(o, s, p) {
function g(O, K) {
console.log("%c " + O + " %c " + K + " %c", "background:#35495e ; padding: 1px; border-radius: 4px 0 0 4px; color: #fff", "background:#ffa483 ; padding: 1px; border-radius: 0 4px 4px 0; color: #fff", "background:transparent");
}
p.r(s), p.d(s, "LogLevel", function() {
return I;
}), p.d(s, "DefaultLogger", function() {
return j;
}), p.d(s, "Logger", function() {
return W;
}), p.d(s, "printVersion", function() {
return g;
}), p.d(s, "DEFAULT_LOG_LEVEL", function() {
return T;
});
var C = p(1), y = p.n(C), x = function() {
function O() {
this.timeout = 6048e5;
}
var K = O.prototype;
return K.write = function(z, B) {
if (O.available)
try {
localStorage.setItem(z, JSON.stringify({ value: B, time: Date.now() }));
} catch (J) {
}
}, K.read = function(z, B) {
if (B === void 0 && (B = !0), O.available)
try {
var J = localStorage.getItem(z);
if (J) {
var be = JSON.parse(J), $ = be.value, ye = be.time, Be = ye === void 0 ? 0 : ye;
if (!B || Date.now() - Be < (typeof B == "number" ? B : this.timeout))
return $;
}
} catch (Ve) {
}
}, y()(O, null, [{ key: "available", get: function() {
if (O.ut === void 0)
try {
localStorage.setItem("alg", "test"), O.ut = !0;
} catch (z) {
O.ut = !1;
}
return O.ut;
} }]);
}();
x.ut = void 0;
var h, F = x, I = function(O) {
return O.NONE = "none", O.ERROR = "e", O.WARN = "w", O.INFO = "i", O.DEBUG = "d", O.VERBOSE = "v", O;
}({}), T = I.ERROR, D = ((h = {})[I.NONE] = { value: 1, str: "N" }, h[I.ERROR] = { value: 100, str: "E" }, h[I.WARN] = { value: 200, str: "W" }, h[I.INFO] = { value: 300, str: "I" }, h[I.DEBUG] = { value: 400, str: "D" }, h[I.VERBOSE] = { value: 500, str: "V" }, h), W = function() {
function O(z) {
if (this.ct = "kwai-v", this.ft = T, this.At = -1, this.vt = void 0, this.dt = "main", typeof location < "u" && location.protocol === "blob:") {
var B, J = location.href.split("/"), be = (B = J[J.length - 1]) == null ? void 0 : B.match(/(\w+)-/);
be && (this.dt = z ? z + "-" + be[1] : be[1]);
} else
z && (this.dt = z);
}
O.loadLogLevel = function(z, B) {
if (B === void 0 && (B = !0), location.href) {
var J = new RegExp(z + "=([a-z]{1})"), be = location.href.match(J);
if (be && be.length > 1) {
var $ = be[1];
if (this.lt($))
return $;
}
}
var ye = new F().read(z, B);
if (this.lt(ye))
return ye;
}, O.saveLogLevel = function(z, B) {
this.lt(B) && new F().write(z, B);
}, O.lt = function(z) {
return Object.values(I).indexOf(z) !== -1;
};
var K = O.prototype;
return K.setOutput = function(z) {
return this.vt = z, this;
}, K.setLevel = function(z) {
return this.ft = z, this;
}, K.setId = function(z) {
return this.At = z, this;
}, K.setName = function(z) {
return this.ct = z, this;
}, K.getLevel = function() {
return this.ft;
}, K.getOutput = function() {
return this.vt;
}, K.hasOutput = function() {
return !!this.vt;
}, K.e = function(z) {
if (this.bt(this.ft, I.ERROR)) {
for (var B = arguments.length, J = new Array(B > 1 ? B - 1 : 0), be = 1; be < B; be++)
J[be - 1] = arguments[be];
var $ = this.gt(I.ERROR, z, J);
try {
var ye;
(ye = this.vt) == null || ye.e.apply(ye, [$].concat(J));
} catch (Be) {
}
}
}, K.w = function(z) {
if (this.bt(this.ft, I.WARN)) {
for (var B = arguments.length, J = new Array(B > 1 ? B - 1 : 0), be = 1; be < B; be++)
J[be - 1] = arguments[be];
var $ = this.gt(I.WARN, z, J);
try {
var ye;
(ye = this.vt) == null || ye.w.apply(ye, [$].concat(J));
} catch (Be) {
}
}
}, K.i = function(z) {
if (this.bt(this.ft, I.INFO)) {
for (var B = arguments.length, J = new Array(B > 1 ? B - 1 : 0), be = 1; be < B; be++)
J[be - 1] = arguments[be];
var $ = this.gt(I.INFO, z, J);
try {
var ye;
(ye = this.vt) == null || ye.i.apply(ye, [$].concat(J));
} catch (Be) {
}
}
}, K.d = function(z) {
if (this.bt(this.ft, I.DEBUG)) {
for (var B = arguments.length, J = new Array(B > 1 ? B - 1 : 0), be = 1; be < B; be++)
J[be - 1] = arguments[be];
var $ = this.gt(I.DEBUG, z, J);
try {
var ye;
(ye = this.vt) == null || ye.d.apply(ye, [$].concat(J));
} catch (Be) {
}
}
}, K.v = function(z) {
if (this.bt(this.ft, I.VERBOSE)) {
for (var B = arguments.length, J = new Array(B > 1 ? B - 1 : 0), be = 1; be < B; be++)
J[be - 1] = arguments[be];
var $ = this.gt(I.VERBOSE, z, J);
try {
var ye;
(ye = this.vt) == null || ye.v.apply(ye, [$].concat(J));
} catch (Be) {
}
}
}, K.bt = function(z, B) {
return D[z].value >= D[B].value;
}, K.gt = function(z, B, J) {
var be, $, ye = typeof B;
if (ye === "object")
B = (($ = B) == null ? void 0 : $.constructor.name) || "unknown";
else if (ye === "function") {
var Be;
B = ((Be = Object.getOwnPropertyDescriptor(B, "name")) == null ? void 0 : Be.value) || "unknown";
}
var Ve, je, we = (((be = D[z]) == null ? void 0 : be.str) || "") + "|" + this.ct + "[" + (typeof this.At == "function" ? this.At() : this.At) + "][" + this.dt + "]::" + B;
return z === I.ERROR ? (Ve = console).error.apply(Ve, [we].concat(J.slice(0))) : (je = console).log.apply(je, [we].concat(J.slice(0))), we;
}, O;
}(), j = new W();
}]);
}, function(e, r, n) {
n.d(r, "a", function() {
return o;
}), n.d(r, "b", function() {
return s;
}), n.d(r, "c", function() {
return p;
});
var o = function(g) {
return g.LOADER_CONNECT_TIMEOUT = "connectTimeout", g.LOADER_TRANS_TIMEOUT = "transTimeout", g.HANDLING_DATA_ERROR = "handlingDataError", g;
}({}), s = function(g) {
return g.XHR_ERROR_NAME = "XHRError", g.FETCH_ERROR_NAME = "FetchError", g.FETCH_READ_ERROR_NAME = "ReadError", g.SLICE_UNPACK_ERROR_NAME = "SliceUnpackError", g;
}({}), p = function(g) {
return g.UNKNOWN = "unknown", g.FETCH = "fetch", g.XHR = "xhr", g;
}({});
}, function(e, r, n) {
n.d(r, "e", function() {
return p;
}), n.d(r, "d", function() {
return g;
}), n.d(r, "c", function() {
return C;
}), n.d(r, "b", function() {
return y;
}), n.d(r, "a", function() {
return x;
});
var o = n(7);
function s(h, F, I, T) {
I === void 0 && (I = 1), T === void 0 && (T = !1);
var D = h * F * I;
return T ? Math.round(D) : D;
}
function p(h, F, I) {
return I === void 0 && (I = !1), s(h, F, 1e-3, I);
}
function g(h, F, I) {
return I === void 0 && (I = !1), s(h, 1e3, 1 / F, I);
}
function C(h, F) {
return F === void 0 && (F = !1), s(h, 1e3, 1 / o.q, F);
}
function y(h, F) {
return F === void 0 && (F = 1), s(h, o.q, 1 / F);
}
function x(h, F) {
return h > o.a && F < 60 * o.q;
}
}, function(e, r, n) {
n.d(r, "a", function() {
return C;
}), n.d(r, "c", function() {
return y;
}), n.d(r, "d", function() {
return x;
}), n.d(r, "b", function() {
return h;
});
var o, s = n(8), p = n.n(s), g = { preferLowPowerToHighPerformance: !0, preserveDrawingBuffer: !0 };
function C() {
return typeof HTMLCanvasElement > "u" ? new OffscreenCanvas(1, 1) : document.createElement("canvas");
}
function y(I) {
return I.getContext("webgl", g);
}
function x(I, T) {
I != null && I.drawingBufferColorSpace && (I.drawingBufferColorSpace = T || "srgb");
}
function h() {
if (!o) {
var I = C();
F(I, o = { webGL: !1, performance: !1 }, !0) || F(I, o, !1);
}
return o;
}
function F(I, T, D) {
D === void 0 && (D = !1);
var W = !1, j = p()({ failIfMajorPerformanceCaveat: D }, g);
try {
var O = I.getContext("webgl", j);
if (O) {
var K = O.getExtension("WEBGL_debug_renderer_info");
T.webGL = !0, T.performance = D, K != null && K.UNMASKED_VENDOR_WEBGL && (T.vendor = O.getParameter(K == null ? void 0 : K.UNMASKED_VENDOR_WEBGL)), K != null && K.UNMASKED_RENDERER_WEBGL && (T.renderer = O.getParameter(K == null ? void 0 : K.UNMASKED_RENDERER_WEBGL)), W = !0;
var z = O.getExtension("WEBGL_lose_context");
z && z.loseContext();
}
} catch (B) {
}
return W;
}
}, function(e, r, n) {
n.d(r, "a", function() {
return o;
});
var o = function(s) {
return s[s.contain = 0] = "contain", s[s.fill = 1] = "fill", s[s.cover = 2] = "cover", s;
}({});
}, function(e, r, n) {
var o = n(59), s = n(60), p = /^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/, g = /[\n\r\t]/g, C = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//, y = /:\d+$/, x = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i, h = /^[a-zA-Z]:/;
function F(K) {
return (K || "").toString().replace(p, "");
}
var I = [["#", "hash"], ["?", "query"], function(K, z) {
return W(z.protocol) ? K.replace(/\\/g, "/") : K;
}, ["/", "pathname"], ["@", "auth", 1], [NaN, "host", void 0, 1, 1], [/:(\d*)$/, "port", void 0, 1], [NaN, "hostname", void 0, 1, 1]], T = { hash: 1, query: 1 };
function D(K) {
var z, B = (typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}).location || {}, J = {}, be = typeof (K = K || B);
if (K.protocol === "blob:")
J = new O(unescape(K.pathname), {});
else if (be === "string")
for (z in J = new O(K, {}), T)
delete J[z];
else if (be === "object") {
for (z in K)
z in T || (J[z] = K[z]);
J.slashes === void 0 && (J.slashes = C.test(K.href));
}
return J;
}
function W(K) {
return K === "file:" || K === "ftp:" || K === "http:" || K === "https:" || K === "ws:" || K === "wss:";
}
function j(K, z) {
K = (K = F(K)).replace(g, ""), z = z || {};
var B, J = x.exec(K), be = J[1] ? J[1].toLowerCase() : "", $ = !!J[2], ye = !!J[3], Be = 0;
return $ ? ye ? (B = J[2] + J[3] + J[4], Be = J[2].length + J[3].length) : (B = J[2] + J[4], Be = J[2].length) : ye ? (B = J[3] + J[4], Be = J[3].length) : B = J[4], be === "file:" ? Be >= 2 && (B = B.slice(2)) : W(be) ? B = J[4] : be ? $ && (B = B.slice(2)) : Be >= 2 && W(z.protocol) && (B = J[4]), { protocol: be, slashes: $ || W(be), slashesCount: Be, rest: B };
}
function O(K, z, B) {
if (K = (K = F(K)).replace(g, ""), !(this instanceof O))
return new O(K, z, B);
var J, be, $, ye, Be, Ve, je = I.slice(), we = typeof z, ue = this, L = 0;
for (we !== "object" && we !== "string" && (B = z, z = null), B && typeof B != "function" && (B = s.parse), J = !(be = j(K || "", z = D(z))).protocol && !be.slashes, ue.slashes = be.slashes || J && z.slashes, ue.protocol = be.protocol || z.protocol || "", K = be.rest, (be.protocol === "file:" && (be.slashesCount !== 2 || h.test(K)) || !be.slashes && (be.protocol || be.slashesCount < 2 || !W(ue.protocol))) && (je[3] = [/(.*)/, "pathname"]); L < je.length; L++)
typeof (ye = je[L]) != "function" ? ($ = ye[0], Ve = ye[1], $ != $ ? ue[Ve] = K : typeof $ == "string" ? ~(Be = $ === "@" ? K.lastIndexOf($) : K.indexOf($)) && (typeof ye[2] == "number" ? (ue[Ve] = K.slice(0, Be), K = K.slice(Be + ye[2])) : (ue[Ve] = K.slice(Be), K = K.slice(0, Be))) : (Be = $.exec(K)) && (ue[Ve] = Be[1], K = K.slice(0, Be.index)), ue[Ve] = ue[Ve] || J && ye[3] && z[Ve] || "", ye[4] && (ue[Ve] = ue[Ve].toLowerCase())) : K = ye(K, ue);
B && (ue.query = B(ue.query)), J && z.slashes && ue.pathname.charAt(0) !== "/" && (ue.pathname !== "" || z.pathname !== "") && (ue.pathname = function(w, le) {
if (w === "")
return le;
for (var oe = (le || "/").split("/").slice(0, -1).concat(w.split("/")), Re = oe.length, Oe = oe[Re - 1], de = !1, X = 0; Re--; )
oe[Re] === "." ? oe.splice(Re, 1) : oe[Re] === ".." ? (oe.splice(Re, 1), X++) : X && (Re === 0 && (de = !0), oe.splice(Re, 1), X--);
return de && oe.unshift(""), Oe !== "." && Oe !== ".." || oe.push(""), oe.join("/");
}(ue.pathname, z.pathname)), ue.pathname.charAt(0) !== "/" && W(ue.protocol) && (ue.pathname = "/" + ue.pathname), o(ue.port, ue.protocol) || (ue.host = ue.hostname, ue.port = ""), ue.username = ue.password = "", ue.auth && (~(Be = ue.auth.indexOf(":")) ? (ue.username = ue.auth.slice(0, Be), ue.username = encodeURIComponent(decodeURIComponent(ue.username)), ue.password = ue.auth.slice(Be + 1), ue.password = encodeURIComponent(decodeURIComponent(ue.password))) : ue.username = encodeURIComponent(decodeURIComponent(ue.auth)), ue.auth = ue.password ? ue.username + ":" + ue.password : ue.username), ue.origin = ue.protocol !== "file:" && W(ue.protocol) && ue.host ? ue.protocol + "//" + ue.host : "null", ue.href = ue.toString();
}
O.prototype = { set: function(K, z, B) {
var J = this;
switch (K) {
case "query":
typeof z == "string" && z.length && (z = (B || s.parse)(z)), J[K] = z;
break;
case "port":
J[K] = z, o(z, J.protocol) ? z && (J.host = J.hostname + ":" + z) : (J.host = J.hostname, J[K] = "");
break;
case "hostname":
J[K] = z, J.port && (z += ":" + J.port), J.host = z;
break;
case "host":
J[K] = z, y.test(z) ? (z = z.split(":"), J.port = z.pop(), J.hostname = z.join(":")) : (J.hostname = z, J.port = "");
break;
case "protocol":
J.protocol = z.toLowerCase(), J.slashes = !B;
break;
case "pathname":
case "hash":
if (z) {
var be = K === "pathname" ? "/" : "#";
J[K] = z.charAt(0) !== be ? be + z : z;
} else
J[K] = z;
break;
case "username":
case "password":
J[K] = encodeURIComponent(z);
break;
case "auth":
var $ = z.indexOf(":");
~$ ? (J.username = z.slice(0, $), J.username = encodeURIComponent(decodeURIComponent(J.username)), J.password = z.slice($ + 1), J.password = encodeURIComponent(decodeURIComponent(J.password))) : J.username = encodeURIComponent(decodeURIComponent(z));
}
for (var ye = 0; ye < I.length; ye++) {
var Be = I[ye];
Be[4] && (J[Be[1]] = J[Be[1]].toLowerCase());
}
return J.auth = J.password ? J.username + ":" + J.password : J.username, J.origin = J.protocol !== "file:" && W(J.protocol) && J.host ? J.protocol + "//" + J.host : "null", J.href = J.toString(), J;
}, toString: function(K) {
K && typeof K == "function" || (K = s.stringify);
var z, B = this, J = B.host, be = B.protocol;
be && be.charAt(be.length - 1) !== ":" && (be += ":");
var $ = be + (B.protocol && B.slashes || W(B.protocol) ? "//" : "");
return B.username ? ($ += B.username, B.password && ($ += ":" + B.password), $ += "@") : B.password ? ($ += ":" + B.password, $ += "@") : B.protocol !== "file:" && W(B.protocol) && !J && B.pathname !== "/" && ($ += "@"), (J[J.length - 1] === ":" || y.test(B.hostname) && !B.port) && (J += ":"), $ += J + B.pathname, (z = typeof B.query == "object" ? K(B.query) : B.query) && ($ += z.charAt(0) !== "?" ? "?" + z : z), B.hash && ($ += B.hash), $;
} }, O.extractProtocol = j, O.location = D, O.trimLeft = F, O.qs = s, e.exports = O;
}, function(e, r, n) {
var o = n(17), s = n(40), p = n(0), g = { chanelConfig: 2, objectType: 2, sampleingIndex: 7 }, C = "audio-helper", y = function() {
function x() {
}
return x.initAudioForFillSilent = function(h, F, I) {
I === void 0 && (I = ""), F.codec || (o.e(h, F, g, I || (/firefox/.test(navigator.userAgent.toLowerCase()) ? "mp4a.40.2" : "mp4a.40.5")), F.codecType = p.c.aac);
}, x.fillAACFrameByCount = function(h, F, I, T, D, W) {
D === void 0 && (D = 0), W === void 0 && (W = ""), x.initAudioForFillSilent(h, F, W);
var j = s.a.getSilentFrame(F.manifestCodec || F.codec, F.channelCount);
if (j && T > 0) {
for (var O = o.c(F.samplerate, F.inputTimescale), K = I * F.inputTimescale || 0, z = 0; z < T; z++) {
var B = D * F.inputTimescale + O * z;
F.samples.push({ unit: j, pts: K, dts: K, duration: O, originDTS: B, originPTS: B, isFill: !0 }), K += O;
}
return F.fillDuration += O * T, K / F.inputTimescale;
}
return I;
}, x.ensureAudioFrame = function(h, F, I, T, D) {
if (T === void 0 && (T = ""), I.samples.length) {
var W = I.samples[0];
if (F.samples.length === 0) {
var j = W.dts / I.inputTimescale;
h.i(C, "fill audio before remux frame @" + j + ". audio sample num:" + F.samples.length + " video sample num:" + I.samples.length), x.fillAACFrameByCount(h, F, j, 1, W.originDTS / I.inputTimescale, T);
}
var O = I.samples[I.samples.length - 1], K = O.dts / I.inputTimescale - (F.samples.length ? F.samples[F.samples.length - 1].dts / F.inputTimescale : W.dts / I.inputTimescale);
D && K > 1 && (h.i(C, "fill audio @end:" + O.dts / I.inputTimescale + ". diff:" + K), x.fillAACFrameByCount(h, F, O.dts / I.inputTimescale, 1, O.originDTS / I.inputTimescale, T));
}
}, x.alignStartByVideo = function(h, F, I) {
if (I.samples.length && F.active && F.samples.length) {
var T = o.c(F.samplerate, F.inputTimescale), D = I.samples[0], W = F.samples[0];
if (!D || !W)
return;
var j = D.pts / I.inputTimescale * F.inputTimescale;
if (W.pts - j < T)
return;
var O = s.a.getSilentFrame(F.manifestCodec || F.codec, F.channelCount);
if (O) {
h.i(C, "align start by video. fill audio " + D.pts / I.inputTimescale + ". gap:" + (D.pts / I.inputTimescale - W.pts / F.inputTimescale));
var K = D.originDTS / I.inputTimescale * F.inputTimescale;
F.samples.unshift({ unit: O, pts: j, dts: j, duration: T, originDTS: K, originPTS: K, isFill: !0 });
}
}
}, x.alignEndByRemuxer = function(h, F, I, T) {
if (I.outputRaw) {
var D = T.getLastPTS();
typeof D.video == "number" && typeof D.audio == "number" && D.audio < D.video && (h.i(C, "raw audio end: " + D.audio + " video end: " + D.video + " fill audio."), x.fillAACFrameByCount(h, F, D.video, 1));
}
}, x;
}();
r.a = y;
}, function(e, r, n) {
n.d(r, "a", function() {
return o;
}), n.d(r, "b", function() {
return s;
});
var o = function(p) {
return p[p.AV_PIX_FMT_MONO = 0] = "AV_PIX_FMT_MONO", p[p.AV_PIX_FMT_YUV420P = 1] = "AV_PIX_FMT_YUV420P", p[p.AV_PIX_FMT_YUV422P = 2] = "AV_PIX_FMT_YUV422P", p[p.AV_PIX_FMT_YUV444P = 3] = "AV_PIX_FMT_YUV444P", p;
}({});
function s(p, g, C) {
var y = [p], x = [g];
return C === o.AV_PIX_FMT_YUV420P ? (y[2] = y[1] = p / 2, x[2] = x[1] = g / 2) : C === o.AV_PIX_FMT_YUV422P ? (y[2] = y[1] = p / 2, x[2] = x[1] = g) : C === o.AV_PIX_FMT_YUV444P && (y[2] = y[1] = p, x[2] = x[1] = g), { w: y, h: x };
}
}, function(e, r, n) {
var o = n(5), s = n.n(o), p = function() {
function g() {
this.yt = 0, this._t = [], this.Ct = 0, this.It = 0;
}
var C = g.prototype;
return C.put = function(y) {
if (this.unreadLen + y.byteLength >= g.MAX_CACHE_SIZE)
throw new Error("max cache size");
this._t.push(y), this.yt += y.byteLength;
}, C.get = function(y) {
if (!(y > this.unreadLen)) {
var x, h = this._t[this.Ct];
if (this.It === 0 && y === h.byteLength)
y === h.buffer.byteLength ? x = h : (x = new Uint8Array(y)).set(h), this.Ct++, this.It = 0;
else {
x = new Uint8Array(y);
for (var F = 0, I = 0, T = 0; F < y; )
T = this.It, I = Math.min(h.byteLength, y - F + T), T === 0 && I === h.byteLength ? x.set(h, F) : x.set(h.subarray(T, I), F), F += I - T, I >= h.byteLength ? (this.Ct++, h = this._t[this.Ct], this.It = 0) : this.It = I;
}
return this.Ot(), x;
}
}, C.read = function(y) {
if (!(y > this.unreadLen)) {
for (var x = new Uint8Array(y), h = this.Ct, F = 0, I = 0, T = this.It; F < y; ) {
var D = this._t[h];
h > 0 && (T = 0), I = Math.min(D.byteLength, y - F + T), x.set(D.subarray(T, I), F), F += I - T, h++;
}
return x;
}
}, C.skip = function(y) {
var x = this.It + y;
if (!(x > this.yt)) {
if (x === this.yt)
this.clear();
else
for (; x > 0; ) {
var h = this._t[this.Ct].byteLength;
x < h ? (this.It = x, x = 0) : x === h ? (this.It = 0, x = 0, this.Ct++) : (this.It = 0, x -= h, this.Ct++);
}
this.Ot();
}
}, C.clear = function() {
this.yt = 0, this._t = [], this.Ct = 0, this.It = 0;
}, C.Ot = function() {
for (; this.Ct; ) {
var y = this._t.shift();
y && (this.yt -= y.byteLength), this.Ct--;
}
}, s()(g, [{ key: "unreadLen", get: function() {
return this.yt - this.It;
} }]);
}();
p.MAX_CACHE_SIZE = 524288e3, r.a = p;
}, function(e, r, n) {
n.d(r, "a", function() {
return o;
});
var o = function(s) {
return s.INIT = "init", s.FLUSH = "flush", s.LOAD_END = "loadEnd", s.DESTROY = "destroy", s.PUSH = "push", s.UPDATE_CONFIG = "updateConfig", s;
}({});
}, function(e, r, n) {
var o = n(43), s = function() {
function p() {
this._$evt = new o.EventEmitter();
}
var g = p.prototype;
return g.on = function(C, y) {
var x = this;
return this._$evt.on(C, y), { destroy: function() {
return x._$evt.off(C, y);
} };
}, g.prependListener = function(C, y) {
var x = this;
return this._$evt.prependListener(C, y), { destroy: function() {
return x._$evt.off(C, y);
} };
}, g.removeAllListeners = function(C) {
this._$evt.removeAllListeners(C);
}, g.off = function(C, y) {
this._$evt.off(C, y);
}, g.listeners = function(C) {
return this._$evt.listeners(C);
}, g.emit = function(C, y) {
return this._$evt.emit(C, y);
}, g.listenerCount = function(C) {
return this._$evt.listenerCount(C);
}, p;
}();
r.a = s;
}, function(e, r, n) {
var o, s, p, g, C;
o = /^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/, s = /^(?=([^\/?#]*))\1([^]*)$/, p = /(?:\/|^)\.(?=\/)/g, g = /(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g, C = { buildAbsoluteURL: function(y, x, h) {
if (h = h || {}, y = y.trim(), !(x = x.trim())) {
if (!h.alwaysNormalize)
return y;
var F = C.parseURL(y);
if (!F)
throw new Error("Error trying to parse base URL.");
return F.path = C.normalizePath(F.path), C.buildURLFromParts(F);
}
var I = C.parseURL(x);
if (!I)
throw new Error("Error trying to parse relative URL.");
if (I.scheme)
return h.alwaysNormalize ? (I.path = C.normalizePath(I.path), C.buildURLFromParts(I)) : x;
var T = C.parseURL(y);
if (!T)
throw new Error("Error trying to parse base URL.");
if (!T.netLoc && T.path && T.path[0] !== "/") {
var D = s.exec(T.path);
T.netLoc = D[1], T.path = D[2];
}
T.netLoc && !T.path && (T.path = "/");
var W = { scheme: T.scheme, netLoc: I.netLoc, path: null, params: I.params, query: I.query, fragment: I.fragment };
if (!I.netLoc && (W.netLoc = T.netLoc, I.path[0] !== "/"))
if (I.path) {
var j = T.path, O = j.substring(0, j.lastIndexOf("/") + 1) + I.path;
W.path = C.normalizePath(O);
} else
W.path = T.path, I.params || (W.params = T.params, I.query || (W.query = T.query));
return W.path === null && (W.path = h.alwaysNormalize ? C.normalizePath(I.path) : I.path), C.buildURLFromParts(W);
}, parseURL: function(y) {
var x = o.exec(y);
return x ? { scheme: x[1] || "", netLoc: x[2] || "", path: x[3] || "", params: x[4] || "", query: x[5] || "", fragment: x[6] || "" } : null;
}, normalizePath: function(y) {
for (y = y.split("").reverse().join("").replace(p, ""); y.length !== (y = y.replace(g, "")).length; )
;
return y.split("").reverse().join("");
}, buildURLFromParts: function(y) {
return y.scheme + y.netLoc + y.path + y.params + y.query + y.fragment;
} }, e.exports = C;
}, function(e, r, n) {
n.d(r, "a", function() {
return Ue;
});
var o = n(8), s = n.n(o), p = n(5), g = n.n(p), C = n(11), y = n(40), x = n(35), h = n(20), F = Object(x.b)(0);
F.bitDepth = 8, F.chromaFormat = "4:2:0", F.codec = "avc1.4d4015", F.colorInfo = { colorRange: 1, colourPrimaries: 1, transferCharacteristics: 4, matrixCoefficients: 2 }, F.fps = 15, F.codedHeight = 270, F.id = 1, F.level = "2.1", F.sar = { width: 1, height: 1 }, F.profile = "Main", F.codedWidth = 480, F.decConf = new Uint8Array([1, 77, 64, 21, 255, 225, 0, 29, 103, 77, 64, 21, 236, 160, 240, 71, 245, 128, 181, 1, 4, 2, 64, 0, 0, 3, 0, 64, 0, 0, 3, 0, 131, 197, 139, 101, 128, 1, 0, 5, 104, 235, 226, 75, 32]);
var I = [{ type: 5, data: new Uint8Array([101, 136, 132, 0, 21, 255, 254, 247, 129, 191, 50, 203, 47, 251, 43, 37, 199, 231, 157, 244, 178, 179, 60, 243, 144, 241, 201, 118, 38, 186, 227, 64, 0, 0, 3, 0, 0, 130, 250, 232, 125, 212, 175, 136, 56, 158, 108, 0, 0, 167, 0, 4, 128, 81, 80, 83, 109, 1, 86, 96, 46, 184, 52, 2, 161, 102, 0, 1, 67]) }], T = function() {
function re() {
}
return re.getFillTrackBySamples = function(k, P) {
if (P.length) {
k.bitDepth = F.bitDepth, k.chromaFormat = F.chromaFormat, k.codec = F.codec, k.colorInfo = F.colorInfo, k.fps = k.fps || F.fps, k.id = F.id, k.level = F.level, k.sar = F.sar, k.profile = F.profile, k.codedWidth = F.codedWidth, k.codedHeight = F.codedHeight, k.duration = 1 / 0, k.decConf = F.decConf, k.outputRaw = !1;
for (var Z = k.sampleDuration = k.inputTimescale / k.fps || Object(h.e)(1, k.inputTimescale), he = P[0].dts, Ie = P[0].originDTS, Ee = P[0].originPTS, pe = 0; he <= P[P.length - 1].dts; )
k.samples.push({ cts: 0, dts: he, key: !0, pts: he, originDTS: Ie, originPTS: Ee, units: I, size: 0, isFill: !0 }), he += Z, Ie += Z, Ee += Z, pe++;
return k.fillDuration += Z * pe, k;
}
}, re;
}(), D = n(0), W = n(3), j = n(9), O = n(32), K = n(24), z = n(6), B = n(2), J = n(4), be = Math.pow(2, 32) - 1, $ = { video: new Uint8Array([0, 0, 0, 45, 104, 100, 108, 114, 0, 0, 0, 0, 0, 0, 0, 0, 118, 105, 100, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 86, 105, 100, 101, 111, 72, 97, 110, 100, 108, 101, 114, 0]), audio: new Uint8Array([0, 0, 0, 45, 104, 100, 108, 114, 0, 0, 0, 0, 0, 0, 0, 0, 115, 111, 117, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 111, 117, 110, 100, 72, 97, 110, 100, 108, 101, 114, 0]) }, ye = new Uint8Array([0, 0, 0, 24, 102, 116, 121, 112, 105, 115, 111, 109, 0, 0, 0, 1, 105, 115, 111, 109, 97, 118, 99, 49]), Be = new Uint8Array([0, 0, 0, 16, 115, 116, 116, 115, 0, 0, 0, 0, 0, 0, 0, 0]), Ve = new Uint8Array([0, 0, 0, 16, 115, 116, 115, 99, 0, 0, 0, 0, 0, 0, 0, 0]), je = new Uint8Array([0, 0, 0, 16, 115, 116, 99, 111, 0, 0, 0, 0, 0, 0, 0, 0]), we = new Uint8Array([0, 0, 0, 20, 115, 116, 115, 122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), ue = new Uint8Array([0, 0, 0, 36, 100, 105, 110, 102, 0, 0, 0, 28, 100, 114, 101, 102, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 12, 117, 114, 108, 32, 0, 0, 0, 1]), L = new Uint8Array([0, 0, 0, 20, 118, 109, 104, 100, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]), w = new Uint8Array([0, 0, 0, 16, 115, 109, 104, 100, 0, 0, 0, 0, 0, 0, 0, 0]), le = new Uint8Array([0, 0, 0, 120, 109, 118, 104, 100, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255]), oe = new Uint8Array([0, 0, 0, 104, 116, 107, 104, 100, 1, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), Re = new Uint8Array([0, 0, 0, 32, 116, 114, 101, 120, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1]), Oe = new Uint8Array([0, 0, 0, 44, 109, 100, 104, 100, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 172, 68, 0, 0, 0, 0, 0, 0, 0, 0, 85, 196, 0, 0]), de = new Uint8Array([0, 0, 0, 93, 115, 116, 115, 100, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 77, 109, 112, 52, 97, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 16, 0, 0, 0, 0, 172, 68, 0, 0, 0, 0, 0, 41, 101, 115, 100, 115, 0, 0, 0, 0, 3, 27, 0, 1, 0, 4, 19, 64, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5]), X = new Uint8Array([0, 0, 0, 52, 115, 116, 115, 100, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 36, 46, 109, 112, 51, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0]), ge = new Uint8Array([0, 0, 0, 71, 115, 116, 115, 100, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 55, 79, 112, 117, 115, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 100, 79, 112, 115, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0]), Pe = new Uint8Array([0, 0, 0, 0, 115, 116, 115, 100, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 97, 118, 48, 49, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 2, 208, 0, 72, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 1, 10, 107, 119, 97, 105, 45, 118, 105, 100, 101, 111, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 255, 255]), ae = new Uint8Array([0, 0, 0, 16, 112, 97, 115, 112, 0, 0, 0, 1, 0, 0, 0, 1]), q = new Uint8Array([255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64]), m = new Uint8Array([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64]), ve = new Uint8Array([0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64]), U = function() {
function re() {
}
return re.moov = function(k, P) {
for (var Z = ye, he = k.length, Ie = re.wt.avc1; he--; ) {
var Ee = k[he];
Ee.type === D.o.VIDEO && (Ee.codec.indexOf("hev1") === 0 ? Ie = re.wt.hev1 : Ee.codec.indexOf("av01") === 0 && (Ie = re.wt.av01));
}
var pe = Z.byteLength + re.Et(k, P), G = { data: new Uint8Array(pe), offset: 0 };
return G.data.set(Z, 0), G.data.set(Ie, 16), G.offset += Z.byteLength, re.jt(G, k, P), G.data;
}, re.videoMediaSegment = function(k, P, Z, he) {
var Ie = Z.codec.indexOf("av01") === 0 ? 0 : 4, Ee = 8 + Z.mp4Samples.reduce(function(G, te) {
return G + te.units.reduce(function(ie, ee) {
return ie + ee.data.byteLength + Ie;
}, 0);
}, 0), pe = re.kt(Z, Ee, he);
return re.Mt(pe, k, P, Z, Ee, he), Z.samples.forEach(function(G) {
G.units.forEach(function(te) {
var ie = te.data.byteLength;
Ie ? (Object(J.l)(ie, pe.data, pe.offset), pe.data.set(te.data, pe.offset + Ie), pe.offset += Ie + ie) : (pe.data.set(te.data, pe.offset), pe.offset += ie);
});
}), pe.data;
}, re.audioMediaSegment = function(k, P, Z, he) {
var Ie = 8 + Z.mp4Samples.reduce(function(pe, G) {
return pe + G.unit.byteLength;
}, 0), Ee = re.kt(Z, Ie, he);
return re.Mt(Ee, k, P, Z, Ie, he), Z.mp4Samples.forEach(function(pe) {
Ee.data.set(pe.unit, Ee.offset), Ee.offset += pe.unit.byteLength;
}), Ee.data;
}, re.audioRawMpeg = function(k) {
var P = 8 + k.mp4Samples.reduce(function(he, Ie) {
return he + Ie.unit.byteLength;
}, 0), Z = { data: new Uint8Array(P), offset: 0 };
return re.St(Z, re.wt.mdat, P), k.mp4Samples.forEach(function(he) {
Z.data.set(he.unit, Z.offset), Z.offset += he.unit.byteLength;
}), Z.data;
}, re.Et = function(k, P) {
var Z = k.reduce(function(Ie, Ee) {
return Ie + re.Bt(Ee);
}, 0), he = P ? P.reduce(function(Ie, Ee) {
return Ie + Ee.byteLength + 8;
}, 0) : 0;
return 8 + le.byteLength + Z + re.Tt(k) + he;
}, re.jt = function(k, P, Z) {
var he = this, Ie = re.Et(P, Z);
re.St(k, re.wt.moov, Ie);
var Ee = P[0];
if (!Ee)
throw new Error("no tracks input.");
re.Dt(k, Ee.timescale, Ee.duration), P.forEach(function(pe) {
re.Rt(k, pe);
}), re.Lt(k, P), Z && Z.forEach(function(pe) {
he.Nt(k, pe);
});
}, re.Nt = function(k, P) {
this.St(k, re.wt.pssh, P.byteLength + 8), k.data.set(P, k.offset), k.offset += P.byteLength;
}, re.Qt = function(k) {
return 104 + 17 * k.mp4Samples.length + this.xt(k);
}, re.Vt = function(k, P, Z) {
if (this.xt(P)) {
var he = this.Ut(P);
this.St(k, re.wt.saiz, he), k.offset += 5;
var Ie = P.samples.length;
Object(J.l)(Ie, k.data, k.offset), k.offset += 4, P.samples.forEach(function(te) {
te.auxiliaryInfo && (k.data[k.offset] = te.auxiliaryInfo.enc.byteLength), k.offset++;
});
var Ee = this.Ft();
this.St(k, re.wt.saio, Ee), k.offset += 4, k.data[k.offset + 3] = 1, k.offset += 4;
var pe = k.offset - Z + 4 + 16;
Object(J.l)(pe, k.data, k.offset), k.offset += 4;
var G = this.Pt(P);
this.St(k, re.wt.senc, G), P.useSubSampleEnc && (k.data[k.offset + 3] = 2), k.offset += 4, Object(J.l)(Ie, k.data, k.offset), k.offset += 4, P.samples.forEach(function(te) {
te.auxiliaryInfo && (k.data.set(te.auxiliaryInfo.enc, k.offset), k.offset += te.auxiliaryInfo.enc.byteLength);
});
}
}, re.xt = function(k) {
var P = this.Pt(k);
return P ? P + this.Ut(k) + this.Ft() : 0;
}, re.Ut = function(k) {
return 17 + k.samples.length;
}, re.Pt = function(k) {
var P = k.samples.reduce(function(Z, he) {
return Z + (he.auxiliaryInfo ? he.auxiliaryInfo.enc.byteLength : 0);
}, 0);
return P ? 16 + P : 0;
}, re.Ft = function() {
return 20;
}, re.Mt = function(k, P, Z, he, Ie, Ee) {
Ee && (k.data.set(Ee), k.offset = Ee.byteLength), re.Ht(k, P, Z, he), re.St(k, re.wt.mdat, Ie);
}, re.kt = function(k, P, Z) {
var he = re.Qt(k);
return { data: new Uint8Array(he + P + (Z ? Z.byteLength : 0)), offset: 0 };
}, re.Dt = function(k, P, Z) {
var he = Math.floor(Z / (be + 1)), Ie = Math.floor(Z % (be + 1)), Ee = le;
Object(J.l)(P, Ee, 28), Object(J.l)(he, Ee, 32), Object(J.l)(Ie, Ee, 36), k.data.set(Ee, k.offset), k.offset += le.byteLength;
}, re.Yt = function(k, P) {
var Z = P.id, he = Math.floor(P.duration / (be + 1)), Ie = Math.floor(P.duration % (be + 1)), Ee = 0, pe = 0;
Object.prototype.hasOwnProperty.call(P, "codedWidth") && (Ee = P.codedWidth), Object.prototype.hasOwnProperty.call(P, "codedHeight") && (pe = P.codedHeight);
var G = oe;
Object(J.l)(Z, G, 28), Object(J.l)(he, G, 36), Object(J.l)(Ie, G, 40), P.rotation === 90 ? m.forEach(function(te, ie) {
return G[60 + ie] = te;
}) : P.rotation === 180 ? q.forEach(function(te, ie) {
return G[60 + ie] = te;
}) : P.rotation === 270 && ve.forEach(function(te, ie) {
return G[60 + ie] = te;
}), Object(J.k)(Ee, G, 96), Object(J.k)(pe, G, 100), k.data.set(G, k.offset), k.offset += oe.byteLength;
}, re.Bt = function(k) {
return 8 + oe.byteLength + re.Gt(k);
}, re.Rt = function(k, P) {
var Z = re.Bt(P);
this.St(k, re.wt.trak, Z), this.Yt(k, P), this.Kt(k, P);
}, re.Gt = function(k) {
return 8 + Oe.byteLength + $[k.type].byteLength + re.Zt(k);
}, re.Kt = function(k, P) {
var Z = re.Gt(P);
this.St(k, re.wt.mdia, Z), this.Wt(k, P.timescale, P.duration), k.data.set($[P.type], k.offset), k.offset += $[P.type].byteLength, this.Xt(k, P);
}, re.Wt = function(k, P, Z) {
var he = Math.floor(Z / (be + 1)), Ie = Math.floor(Z % (be + 1)), Ee = Oe;
Object(J.l)(P, Ee, 28), Object(J.l)(he, Ee, 32), Object(J.l)(Ie, Ee, 36), k.data.set(Ee, k.offset), k.offset += Ee.byteLength;
}, re.Zt = function(k) {
return k.type === D.o.AUDIO ? 8 + w.byteLength + ue.byteLength + re.zt(k) : 8 + L.byteLength + ue.byteLength + re.zt(k);
}, re.Xt = function(k, P) {
if (this.St(k, re.wt.minf, re.Zt(P)), P.type === D.o.AUDIO)
return k.data.set(w, k.offset), k.offset += w.byteLength, k.data.set(ue, k.offset), k.offset += ue.byteLength, void this.Jt(k, P);
k.data.set(L, k.offset), k.offset += L.byteLength, k.data.set(ue, k.offset), k.offset += ue.byteLength, this.Jt(k, P);
}, re.zt = function(k) {
return 8 + this.qt(k) + Be.byteLength + Ve.byteLength + we.byteLength + je.byteLength;
}, re.Jt = function(k, P) {
var Z = this.zt(P);
this.St(k, re.wt.stbl, Z), this.$t(k, P), k.data.set(Be, k.offset), k.offset += Be.byteLength, k.data.set(Ve, k.offset), k.offset += Ve.byteLength, k.data.set(we, k.offset), k.offset += we.byteLength, k.data.set(je, k.offset), k.offset += je.byteLength;
}, re.qt = function(k) {
return k.stsd ? k.stsd.byteLength + 8 : k.type === D.o.AUDIO ? re.ti(k) : re.ii(k);
}, re.$t = function(k, P) {
if (P.stsd)
return this.St(k, re.wt.stsd, P.stsd.byteLength + 8), k.data.set(P.stsd, k.offset), void (k.offset += P.stsd.byteLength);
P.type !== D.o.AUDIO ? re.ei(k, P) : this.ni(k, P);
}, re.si = function(k) {
return k.decConf ? 8 + k.decConf.byteLength : 0;
}, re.ii = function(k) {
var P = k.sar.width !== 1 || k.sar.height !== 1 ? ae.length : 0;
return Pe.byteLength + re.si(k) + P;
}, re.ei = function(k, P) {
var Z = this.si(P), he = this.ii(P), Ie = Pe, Ee = he - 16, pe = re.wt.avc1, G = re.wt.avcC;
P.codec.indexOf("hev1") === 0 ? (pe = re.wt.hev1, G = re.wt.hvcC) : P.codec.indexOf("av01") === 0 && (pe = re.wt.av01, G = re.wt.av1C);
var te = P.codedWidth, ie = P.codedHeight, ee = P.sar.width !== 1 || P.sar.height !== 1;
Object(J.l)(he, Ie, 0), this.ri(Ie, pe, Ee, 16), Object(J.k)(te, Ie, 48), Object(J.k)(ie, Ie, 50), k.data.set(Ie, k.offset), k.offset += Ie.byteLength, this.St(k, G, Z), P.decConf && (k.data.set(P.decConf, k.offset), k.offset += P.decConf.byteLength), ee && (k.data.set(ae, k.offset), Object(J.l)(P.sar.width || 0, k.data, k.offset + 8), Object(J.l)(P.sar.height || 0, k.data, k.offset + 12), k.offset += ae.length);
}, re.hi = function(k) {
return 33 + k.config.length + 4;
}, re.oi = function(k) {
return 52 + re.hi(k);
}, re.ai = function(k, P) {
var Z = P.config.length, he = re.hi(P), Ie = re.oi(P), Ee = Ie - 16, pe = de;
Object(J.l)(Ie, pe, 0), Object(J.l)(Ee, pe, 16), pe[41] = P.channelCount, Object(J.k)(P.samplerate, pe, 48), Object(J.l)(he, pe, 52), pe[65] = 23 + Z, pe[70] = 15 + Z, k.data.set(pe, k.offset), k.offset += pe.byteLength;
var G = [Z].concat(P.config).concat([6, 1, 2]);
k.data.set(G, k.offset), k.offset += G.length;
}, re.ui = function(k, P) {
var Z = ge;
Z[41] = Z[61] = P.channelCount, Object(J.k)(P.samplerate, Z, 48), Object(J.k)(P.samplerate, Z, 66), k.data.set(Z, k.offset), k.offset += Z.byteLength;
}, re.ci = function(k, P) {
var Z = X;
Z[41] = P.channelCount, Object(J.k)(P.samplerate, Z, 48), k.data.set(Z, k.offset), k.offset += Z.byteLength;
}, re.ti = function(k) {
return k.codec === "mp3" ? X.length : k.codec === "opus" ? ge.length : re.oi(k);
}, re.ni = function(k, P) {
P.codec === "mp3" ? re.ci(k, P) : P.codec === "opus" ? re.ui(k, P) : re.ai(k, P);
}, re.Tt = function(k) {
return 8 + k.length * Re.byteLength;
}, re.Lt = function(k, P) {
var Z = re.Tt(P);
this.St(k, re.wt.mvex, Z), P.forEach(function(he) {
re.fi(k, he);
});
}, re.fi = function(k, P) {
var Z = P.id, he = Re;
Object(J.l)(Z, he, 12), k.data.set(he, k.offset), k.offset += he.byteLength;
}, re.Ht = function(k, P, Z, he) {
var Ie = he.mp4Samples.length, Ee = k.offset, pe = re.Qt(he), G = pe - 24, te = 12 + Ie, ie = 20 + 16 * Ie, ee = pe + 8, Te = he.id, Se = he.mp4Samples || [], Ye = Math.floor(Z / (be + 1)), ze = Math.floor(Z % (be + 1));
re.St(k, re.wt.moof, pe), re.St(k, re.wt.mfhd, 16), Object(J.l)(P, k.data, k.offset + 4), k.offset += 8, re.St(k, re.wt.traf, G), re.St(k, re.wt.tfhd, 20), k.data[k.offset + 1] = 2, k.data[k.offset + 3] = 2, Object(J.l)(Te, k.data, k.offset + 4), k.data[k.offset + 11] = he.sampleDescIndex || 1, k.offset += 12, re.St(k, re.wt.tfdt, 20), k.data[k.offset] = 1, Object(J.l)(Ye, k.data, k.offset + 4), Object(J.l)(ze, k.data, k.offset + 8), k.offset += 12, re.St(k, re.wt.sdtp, te), k.offset += 4, Se.forEach(function(it, ct) {
var nt = it.flags;
k.data[k.offset + ct] = nt.dependsOn << 4 | nt.isDependedOn << 2 | nt.hasRedundancy;
}), k.offset += Ie, re.St(k, re.wt.trun, ie), k.data[k.offset] = 1, k.data[k.offset + 2] = 15, k.data[k.offset + 3] = 1, Object(J.l)(Ie, k.data, k.offset + 4), Object(J.l)(ee, k.data, k.offset + 8), k.offset += 12, Se.forEach(function(it, ct) {
if (it) {
var nt = k.offset + 16 * ct;
Object(J.l)(it.duration, k.data, nt), Object(J.l)(it.len, k.data, nt + 4), k.data[nt + 8] = it.flags.isLeading << 2 | it.flags.dependsOn, k.data[nt + 9] = it.flags.isDependedOn << 6 | it.flags.hasRedundancy << 4 | it.flags.isNonSync, k.data[nt + 10] = 61440 & it.flags.degradPrio, k.data[nt + 11] = 15 & it.flags.degradPrio, Object(J.j)(it.cts, k.data, nt + 12);
}
}), k.offset += 16 * Ie, this.xt(he) && this.Vt(k, he, Ee);
}, re.St = function(k, P, Z) {
re.ri(k.data, P, Z, k.offset), k.offset += 8;
}, re.ri = function(k, P, Z, he) {
Object(J.l)(Z, k, he), k.set(P, he + 4);
}, re;
}();
U.wt = { avc1: [97, 118, 99, 49], avcC: [97, 118, 99, 67], btrt: [98, 116, 114, 116], dinf: [100, 105, 110, 102], dref: [100, 114, 101, 102], esds: [101, 115, 100, 115], ftyp: [102, 116, 121, 112], hdlr: [104, 100, 108, 114], mdat: [109, 100, 97, 116], mdhd: [109, 100, 104, 100], mdia: [109, 100, 105, 97], mfhd: [109, 102, 104, 100], minf: [109, 105, 110, 102], moof: [109, 111, 111, 102], moov: [109, 111, 111, 118], mp4a: [109, 112, 52, 97], mvex: [109, 118, 101, 120], mvhd: [109, 118, 104, 100], pasp: [112, 97, 115, 112], sdtp: [115, 100, 116, 112], stbl: [115, 116, 98, 108], stco: [115, 116, 99, 111], stsc: [115, 116, 115, 99], stsd: [115, 116, 115, 100], stsz: [115, 116, 115, 122], stts: [115, 116, 116, 115], tfdt: [116, 102, 100, 116], tfhd: [116, 102, 104, 100], traf: [116, 114, 97, 102], trak: [116, 114, 97, 107], trun: [116, 114, 117, 110], trex: [116, 114, 101, 120], tkhd: [116, 107, 104, 100], vmhd: [118, 109, 104, 100], smhd: [115, 109, 104, 100], hvcC: [104, 118, 99, 67], pssh: [112, 115, 115, 104], saiz: [115, 97, 105, 122], saio: [115, 97, 105, 111], senc: [115, 101, 110, 99], av1C: [97, 118, 49, 67], hev1: [104, 101, 118, 49], av01: [97, 118, 48, 49] };
var M = U, ne = "remuxer", Le = function() {
function re(P, Z, he, Ie, Ee) {
var pe = this;
this.Ai = void 0, this.di = void 0, this.li = void 0, this.bi = void 0, this.pi = void 0, this.mi = void 0, this.gi = !1, this.yi = "", this._i = void 0, this.Ci = void 0, this.Ii = void 0, this.Oi = void 0, this.wi = void 0, this.Ei = void 0, this.ji = {}, this.ki = void 0, this.Mi = void 0, this.Si = void 0, this.Bi = void 0, this.Ti = void 0, this.Di = function(te) {
pe.Ai.emit(B.a.ERROR, te);
}, this.Ai = Z, this.di = he, this.li = Ie, this.Ci = P;
var G = navigator.userAgent;
this.bi = !(!(Ee && Ee.indexOf("Apple") > -1 && G) || G.match("CriOS")), this.gi = !1, this.pi = !!(z.a.chrome && z.a.version.major < 70), this.mi = !(z.a.chrome && z.a.version.major >= 73), this.Bi = {}, this.Ti = { video: 0, audio: 0 }, this.Ci.i(ne, "constructor safari: " + this.bi + ", forceFirstIDR: " + this.pi + " forceDTSPositive: " + this.mi);
}
var k = re.prototype;
return k.destroy = function() {
}, k.resetTimeStamp = function(P) {
this.Ci.i(ne, "reset timestamp", P), this.wi = this.Ei = P;
}, k.resetInitSegment = function(P) {
this.Ci.i(ne, "reset init segment."), this.gi = !1, this.ji = {}, this._i = P, this.ki = void 0, this.yi = "", this.Si = !1, this.Bi = {};
}, k.getLastDTS = function() {
return { video: this.Oi, audio: this.Ii };
}, k.getLastPTS = function() {
return this.Ti;
}, k.flush = function(P) {
var Z;
if (P === void 0 && (P = !0), this.Ci.i(ne, "flush ", !!this.Bi.sample, this.Bi.sample && this.Mi), this.Bi.sample && this.Mi && (this.Mi.samples = [this.Bi.sample], this.Bi.sample = void 0, Z = this.Ri(this.Mi, this.Oi || 0, !0, !1, !0)), Z && P) {
var he = [Z];
this.Ai.emit(B.a.PARSING_DATA, { segments: he, extra: this._i });
}
return Z;
}, k.remux = function(P, Z, he, Ie, Ee, pe, G) {
var te, ie, ee, Te, Se = this;
if (pe === void 0 && (pe = !1), G && (this.ki = G), this.Mi = Z, Ie || (this.Oi = this.Ii = void 0, this.Ti.video = this.Ti.audio = void 0), Z.active && !Z.outputRaw && (this.Bi.sample && (Ie && Z.samples.unshift(this.Bi.sample), this.Bi.sample = void 0), !this.di.gopRemux && Z.samples.length > 1 && !pe && (this.Bi.prevSampleDuration = Z.samples[Z.samples.length - 1].dts - Z.samples[Z.samples.length - 2].dts, this.Bi.sample = Z.samples.pop())), P.active && K.a.ensureAudioFrame(this.Ci, P, Z, (Te = this._i) == null ? void 0 : Te.audioCodec, pe), Z.active) {
if (!this.gi && Z.outputRaw && (ie = this.Li(Z)), Ie || K.a.alignStartByVideo(this.Ci, P, Z), Z.outputRaw && Z.samples.length) {
if (te = Z.samples, Z.samples = [], Z.mp4Samples = [], this.di.ensureVideo && P.samples.length && P.samplerate) {
var Ye = this.Ni(Z, P);
Ye && (Z = Ye, ee = !0, this.Ci.i(ne, "fill black video. raw output."));
}
} else if ((this.di.isLive || !Ie) && pe && !Z.outputRaw && Z.samples.length === 0 && P.samples.length && P.samplerate && (!this.gi || (P.samples[P.samples.length - 1].pts - P.samples[0].pts) / P.inputTimescale >= 1)) {
var ze = this.Ni(Z, P);
ze && (Z = ze, ee = !0, this.Ci.i(ne, "fill black video, no video samples."));
}
}
if (this.yi = Z.codec, this.Si && !ee && Z.samples.length && (this.gi = !1), this.gi || (this.Si = !1, this.Qi(P, Z, te || Z.samples, he, ie, ee)), !Ie && Z.samples.length && this.bi && (Z.samples[0].pts = Z.samples[0].dts), this.gi) {
var it = he, ct = he;
if (P.samples.length && Z.samples.length)
if (!Ie && Ee) {
if (P.samples[0].pts / P.inputTimescale - Z.samples[0].pts / Z.inputTimescale < 0) {
var nt = Z.samples[0];
nt.pts = P.samples[0].pts / P.inputTimescale * Z.inputTimescale, nt.dts = nt.pts - nt.cts;
}
} else {
var zt = P.samples[0].pts / P.inputTimescale - Z.samples[0].pts / Z.inputTimescale;
it += Math.max(0, zt), ct += Math.max(0, -zt);
}
var bt = this.xi(P, it, Ie, Ee), Mt = this.Ri(Z, ct, Ie, Ee, pe);
ee && (this.Si = !0);
var Kt = [];
if (bt && Kt.push(bt), Mt && Kt.push(Mt), Kt.length && this.Ai.emit(B.a.PARSING_DATA, { segments: Kt, extra: this._i }), te) {
var Xt = [], ni = [], wt = [];
te.forEach(function(pt) {
pt.dts = pt.dts / Z.inputTimescale - (Se.wi || 0), pt.cts = pt.cts / Z.inputTimescale, pt.pts = pt.dts + pt.cts, pt.originDTS = pt.originDTS / Z.inputTimescale, pt.originPTS = pt.originPTS / Z.inputTimescale, (pt.key && !pt.isFill || pt.keyTime) && Xt.push({ key: pt.key, pts: pt.pts, cts: pt.cts, originPTS: pt.originPTS }), pt.sei && ni.push(pt.sei), pt.privNal && wt.push(pt.privNal), (!Se.Ti.video || pt.pts > Se.Ti.video) && (Se.Ti.video = pt.pts);
}), this.Ai.emit(B.a.RAW_DATA, { type: C.d.videoFrame, samples: te, extra: this._i, keyTime: Xt, sei: ni, privNal: wt, mediaInfo: { colorInfo: Z.colorInfo, rotation: Z.rotation, fps: Z.fps, sar: Z.sar } });
}
}
}, k.computeInitPTSDTS = function(P, Z, he, Ie, Ee) {
Ie === void 0 && (Ie = 1), Ee === void 0 && (Ee = 1);
var pe = 1 / 0, G = 1 / 0;
return Z && (pe = G = Z.pts / Ie - P), he && (pe = Math.min(typeof pe == "number" ? pe : 1 / 0, he.pts / Ee - P), G = Math.min(typeof G == "number" ? G : 1 / 0, he.dts / Ee - P)), { initPTS: pe, initDTS: G };
}, k.Li = function(P) {
return P.codec ? this.Vi(P) : P.codecType ? { container: "video/mp4", codec: P.codec, codecType: P.codecType || D.c.unknown } : void 0;
}, k.Vi = function(P) {
if (P.codec) {
var Z = Object(O.a)(P.codedWidth, P.codedHeight, P.sar);
return { container: "video/mp4", codec: P.codec, codecType: P.codecType || D.c.unknown, metadata: { width: Z.width, height: Z.height, codedWidth: P.codedWidth, codedHeight: P.codedHeight, sar: P.sar, rotation: P.rotation, fps: P.fps, profile: P.profile, level: P.level, chromaFormat: P.chromaFormat, bitDepth: P.bitDepth, colorInfo: P.colorInfo, videoBitrate: P.bitrate, videoMaxBitrate: P.maxBitrate, enhancedFlv: P.enhancedFlv } };
}
}, k.Qi = function(P, Z, he, Ie, Ee, pe) {
var G, te, ie = this.Ai, ee = P.samples, Te = this.li, Se = {}, Ye = { tracks: Se }, ze = this.wi === void 0, it = "audio/mp4";
if (ze && (G = te = 1 / 0), P.config && ee.length && (P.duration = P.duration / P.timescale * P.samplerate, P.timescale = P.samplerate, this.Ci.v(ne, "audio sampling rate : " + P.samplerate), P.codecType === D.c.mp3 ? Te.mpeg ? (it = "audio/mpeg", P.codec = "") : Te.mp3 && (P.codec = "mp3") : P.codecType === D.c.opus && (P.codec = "opus"), this.ji.audio = P.codecType === D.c.mp3 && Te.mpeg ? new Uint8Array() : M.moov([P], this.ki), Se.audio = { container: it, codec: P.codec, codecType: P.codecType || D.c.unknown, metadata: { channel: P.channelCount, audioSampleRate: P.extensionSamplerate || P.samplerate, audioBitrate: P.bitrate, audioMaxBitrate: P.maxBitrate } }, ze && (G = te = ee[0].pts / P.inputTimescale - Ie)), Z.codec && he.length) {
var ct = Z.inputTimescale;
Z.timescale = ct, Z.duration <= 0 && (this.Ci.i(ne, "videoTrack.duration === 0"), Z.duration = 1), Z.outputRaw || (this.ji.video = M.moov([Z], this.ki), Se.video = this.Vi(Z)), Se.video && Se.video.metadata && (Se.video.metadata.isFillVideo = pe), ze && (G = Math.min(typeof G == "number" ? G : 1 / 0, he[0].pts / ct - Ie), te = Math.min(typeof te == "number" ? te : 1 / 0, he[0].dts / ct - Ie));
} else
Z.codec && !Z.active && (Se.video = this.Vi(Z), Se.video && Se.video.metadata && (Se.video.active = !1, Se.video.metadata.isFillVideo = pe));
Ee && (Se.rawVideo = Ee), Object.keys(Se).length ? (ie.emit(B.a.PARSING_INIT_SEGMENT, Ye), this.gi = !0, ze && (this.wi = G, this.Ei = te, this.Ci.i(ne, "init pts:" + G + " dts:" + te + " offset:" + Ie))) : this.Di(Object(W.e)(W.b.MUX_ERROR, W.a.PARSING_ERROR, "no audio/video samples found", { fatal: !1 }));
}, k.Ri = function(P, Z, he, Ie, Ee) {
var pe = this;
if (Ie === void 0 && (Ie = !1), Ee === void 0 && (Ee = !1), P.samples.length && this.wi !== void 0 && this.Ei !== void 0) {
var G, te, ie = P.inputTimescale, ee = P.samples, Te = [], Se = this.Ei * ie, Ye = this.wi * ie, ze = Object(h.e)(1, ie), it = ee.length, ct = [], nt = [], zt = [], bt = 0, Mt = 0, Kt = 0, Xt = this.Oi ? this.Oi * ie : 0, ni = this.bi;
if (it !== 0 && ie !== 0 && (ni && (he = he || !!(it && Xt && (Ie && Math.abs(Z * ie - Xt / ie) < 0.1 || Math.abs(ee[0].pts - Xt - Se) < ie / 5))), he || (Xt = Z * ie), Xt !== void 0)) {
ee.forEach(function(yt) {
yt.pts = Ue(yt.pts - Ye, Xt), yt.dts = Ue(yt.dts - Ye, Xt);
}), ee.sort(function(yt, Pt) {
var ei = yt.dts - Pt.dts, ki = yt.pts - Pt.pts;
return ei || ki;
}), this.mi && ee.forEach(function(yt) {
yt.dts < 0 && (yt.dts = 0, yt.cts = yt.pts - yt.dts);
}), Kt = ee[0].dts, Mt = Math.max(ee[0].pts, 0);
var wt, pt = Kt - Xt;
if (he && pt) {
if (Mt -= pt, Kt = Xt, ee[0].dts = Kt, ee[0].pts = Mt, pt < 0)
for (var ri = 1; ee[ri] && ee[ri].dts <= ee[ri - 1].dts; ) {
var yi = ee[ri - 1].dts + ze - ee[ri].dts;
ee[ri].dts += yi, ee[ri].pts += yi, ri++;
}
this.Ci.v(ne, "Video/PTS/DTS adjusted: " + Object(h.d)(Mt, ie, !0) + "/" + Object(h.d)(Kt, ie, !0));
}
te = ee[it - 1].dts, G = Math.max(ee[it - 1].pts, 0, te), ni && (bt = Math.round((te - Kt) / (it - 1)));
for (var Li = 0; Li < it; Li++) {
var vi = ee[Li];
ni ? vi.dts = Kt + Li * bt : (vi.dts = Math.max(vi.dts, Kt), typeof wt == "number" && vi.dts < wt && (vi.dts = wt + 1), vi.pts = vi.cts + vi.dts, wt = vi.dts);
}
!he && ee[0].key && ee[0].pts < ee[0].dts && (ee[0].pts = ee[0].dts);
for (var Ui = function() {
var yt, Pt = ee[xt];
if (!ni) {
if (xt < it - 1)
bt = Math.round(ee[xt + 1].dts - Pt.dts);
else if (bt = pe.Bi.prevSampleDuration ? pe.Bi.prevSampleDuration : P.sampleDuration || bt, Ee && pe.Ii) {
var ei = pe.Ii * ie - Pt.pts;
ei > 0.5 * P.inputTimescale && (bt = ei);
}
}
var ki = Pt.pts - Pt.dts;
if (bt < 0 || isNaN(bt) || !isFinite(bt)) {
var Br = he && it < 2 ? pt : 0;
bt = Math.round(Math.max(P.sampleDuration - Br, ze, 1));
var mi = ee[xt + 1];
mi && (mi.dts = Pt.dts + bt, mi.pts = mi.dts + mi.cts);
} else
bt = Math.round(bt);
var bi = P.codec.indexOf("av01") === 0 ? 0 : 4;
if (yt = Pt.units.reduce(function(mt, jt) {
return jt.data.byteLength + bi + mt;
}, 0), Pt.key && !Pt.isFill || Pt.keyTime) {
var fr = { key: Pt.key, pts: Pt.pts / ie, cts: Pt.cts / ie, originPTS: Pt.originPTS / ie };
P.codecType === D.c.hevc && Pt.units.reduce(function(mt, jt) {
return mt || jt.type === j.a.HEVC_NAL_CRA_NUT;
}, !1) && (Pt.key = !1, fr.cra = !0), ct.push(fr);
}
Pt.sei && nt.push(Pt.sei), Pt.privNal && zt.push(Pt.privNal), (bt / ie > 2 || bt / ie <= 1e-3) && pe.Ci.i(ne, "sample duration exception.", Ee, bt, ki), Te.push({ len: yt, units: Pt.units, duration: bt || 1, cts: ki, flags: { isLeading: 0, isDependedOn: 0, hasRedundancy: 0, degradPrio: 0, dependsOn: Pt.key ? 2 : 1, isNonSync: Pt.key ? 0 : 1 }, auxiliaryInfo: Pt.auxiliaryInfo });
}, xt = 0; xt < it; xt++)
Ui();
if (this.Oi = (te + bt) / ie, Te.length && this.pi) {
var Ct = Te[0].flags;
Ct.dependsOn = 2, Ct.isNonSync = 0;
}
P.mp4Samples = Te;
var Di = M.videoMediaSegment(P.sequenceNumber++, Math.round(Kt), P, this.Ui(D.o.VIDEO));
this.Mi && (this.Mi.sequenceNumber = P.sequenceNumber);
var Dt = { payload: Di, adjustedStart: pt / ie, startPTS: Mt / ie, endPTS: (G + bt) / ie, startDTS: Kt / ie, endDTS: this.Oi, type: D.o.VIDEO, originFirstDTS: ee[0].originDTS / ie, originFirstPTS: ee[0].originPTS / ie, firstParseTime: ee[0].parseTime, fillDuration: P.fillDuration / ie, droppedDuration: P.droppedDuration / ie, droppedFrames: P.droppedFrames, keyTime: ct, sei: nt, privNal: zt, sampleCount: Te.length };
return P.fillDuration = 0, P.droppedDuration = 0, P.droppedFrames = 0, P.samples = [], P.mp4Samples = [], this.Ti.video = G / ie, Dt;
}
}
}, k.xi = function(P, Z, he, Ie) {
if (Ie === void 0 && (Ie = !1), P.samples.length && this.wi !== void 0) {
var Ee, pe, G, te, ie = P.inputTimescale, ee = P.timescale, Te = ie / ee, Se = P.codecType === D.c.aac ? 1024 : 1152, Ye = Se * Te, ze = this.wi * ie, it = [], ct = Object(h.e)(1, ie), nt = P.codecType === D.c.mp3 && this.li.mpeg, zt = 0, bt = P.samples, Mt = this.Ii ? this.Ii * ie : this.Ii, Kt = !1;
if (he = he || !!(bt.length && Mt && (Ie && Math.abs(Z - Mt / ie) < 0.1 || Math.abs(bt[0].pts - Mt - ze) < 20 * Ye)), bt.forEach(function(ir) {
ir.pts = ir.dts = Ue(ir.pts - ze, Z * ie);
}), bt = bt.filter(function(ir) {
return ir.pts >= 0;
}), bt.length !== 0 && (he && Mt !== void 0 || (Mt = Ie ? Z * ie : bt[0].pts, Kt = !0), Mt !== void 0)) {
if (P.codecType === D.c.aac)
for (var Xt = this.di.maxAudioFramesDrift * Ye, ni = 0, wt = Mt; ni < bt.length; ) {
var pt = bt[ni], ri = pt.pts - wt;
if (ri <= -Xt)
this.Ci.w(ne, "Dropping 1 audio frame @ " + (Mt / ie).toFixed(3) + "s"), bt.splice(ni, 1), P.droppedDuration += Ye;
else if (ri >= Xt && ri < 100 * ie && wt) {
var yi = Math.round(ri / Ye);
this.Ci.i(ne, "Injecting " + yi + " audio frame @ " + (wt / ie).toFixed(3) + "s due to " + Math.round(Object(h.d)(ri, ie)) + " ms gap. " + ni + " " + P.manifestCodec + " " + P.codec);
for (var Li = 0; Li < yi; Li++) {
var vi = Math.max(wt, 0);
(pe = y.a.getSilentFrame(P.manifestCodec || P.codec, P.channelCount)) || (this.Ci.v(ne, "Unable to get silent frame for given audio codec; duplicating last frame instead."), pe = pt.unit.subarray());
var Ui = pt.originDTS - (yi - Li) * Ye;
bt.splice(ni, 0, { unit: pe, pts: vi, dts: vi, originDTS: Ui, originPTS: Ui, isFill: !0, duration: Ye }), wt += Ye, ni++;
}
P.fillDuration += Ye * yi, pt.pts = pt.dts = wt, wt += pt.duration || Ye;
} else {
var xt = bt[ni + 1];
if (xt) {
var Ct = Math.round(xt.pts - pt.pts);
Ct < 1 ? (xt.pts = xt.dts = pt.pts + 1, pt.duration = ct) : pt.duration = Ct > Xt ? Ye : Ct;
}
pt.pts = pt.dts = wt, wt = pt.pts + (pt.duration || Ye), ni++;
}
}
for (var Di = bt.length, Dt = 0, yt = bt.length; Dt < yt; Dt++) {
var Pt, ei = bt[Dt], ki = ei.unit, Br = ei.duration ? Math.round(ei.duration / Te) : Se, mi = ei.pts;
if (G !== void 0 && Ee)
Ee.duration = Math.round((mi - G) / Te);
else {
var bi = Math.round(mi - Mt), fr = 0;
if (he && P.codecType === D.c.aac && bi) {
if (bi > 0 && bi < 100 * ie)
fr = Math.round((mi - Mt) / Ye), this.Ci.v(ne, bi + " ms hole between AAC samples detected,filling it");
else if (bi < -0.012 * ie) {
this.Ci.v(ne, "drop overlapping AAC sample, expected/parsed/delta:" + (Mt / ie).toFixed(3) + "s/" + (mi / ie).toFixed(3) + "s/" + -bi / ie * 1e3 + "ms");
continue;
}
mi = Mt;
}
zt = mi;
for (var mt = 0; mt < fr; mt++) {
var jt = Se;
(pe = y.a.getSilentFrame(P.manifestCodec || P.codec, P.channelCount)) || (this.Ci.v(ne, "Unable to get silent frame for given audio codec; duplicating this frame instead."), pe = ki.subarray(), ei.duration && (jt = Br)), Ee = { len: pe.byteLength, cts: 0, duration: jt, unit: pe, flags: { isLeading: 0, isDependedOn: 0, hasRedundancy: 0, degradPrio: 0, dependsOn: 1, isNonSync: 0 }, auxiliaryInfo: ei.auxiliaryInfo }, it.push(Ee);
}
}
ei.aacPriv && (te || (te = []), (Pt = te).push.apply(Pt, ei.aacPriv)), Ee = { len: ki.byteLength, cts: 0, duration: Br, unit: ki, flags: { isLeading: 0, isDependedOn: 0, hasRedundancy: 0, degradPrio: 0, dependsOn: 1, isNonSync: 0 }, auxiliaryInfo: ei.auxiliaryInfo }, it.push(Ee), G = mi;
}
if (Di = it.length, Ee) {
if (Di && typeof G == "number") {
var Qr;
Ee && Ee.duration === 0 && (Ee.duration = Se), Mt = G + Te * Ee.duration, P.mp4Samples = it, Qr = nt ? M.audioRawMpeg(P) : M.audioMediaSegment(P.sequenceNumber++, zt / Te, P, this.Ui(D.o.AUDIO)), P.samples = [], P.mp4Samples = [];
var $t = zt / ie, si = this.Ii = Mt / ie, Vr = { payload: Qr, startPTS: $t, endPTS: si, startDTS: $t, endDTS: si, type: D.o.AUDIO, originFirstDTS: bt[0].originDTS / ie, originFirstPTS: bt[0].originPTS / ie, firstParseTime: bt[0].parseTime, fillDuration: P.fillDuration / ie, droppedDuration: P.droppedDuration / ie, aacPriv: te, sampleCount: it.length };
return nt && (Vr.updateTimestampOffset = !0), P.fillDuration = 0, P.droppedDuration = 0, this.Ti.audio = G / ie, Vr;
}
Kt && delete this.Ii, P.samples = [], P.mp4Samples = [];
}
}
}
}, k.Ui = function(P) {
var Z;
return this.ji && this.ji[P] && (Z = this.ji[P], delete this.ji[P]), Z;
}, k.Ni = function(P, Z) {
var he = s()({}, P);
he.samples = [], he.codecType = D.c.h264, he.inputTimescale = P.inputTimescale, he.timescale = P.timescale;
var Ie = T.getFillTrackBySamples(he, Z.samples);
return Ie && (this.gi = he.codec === this.yi), Ie;
}, g()(re, [{ key: "iSGenerated", get: function() {
return this.gi;
} }]);
}();
function Ue(re, k) {
var P;
if (k === void 0)
return re;
for (P = k < re ? -8589934592 : 8589934592; Math.abs(re - k) > 4294967296; )
re += P;
return re;
}
r.b = Le;
}, function(e, r, n) {
var o = n(5), s = n.n(o), p = n(0), g = n(22), C = n(21), y = "canvas-output", x = function() {
function h(I, T, D) {
this.Ci = void 0, this.Fi = void 0, this.Pi = void 0, this.Hi = p.s.video, this.Yi = null, this.Gi = null, this.Ki = { w: 0, h: 0 }, this.Zi = { w: 0, h: 0 }, this.Wi = { w: 0, h: 0 }, this.Pi = D, this.Fi = T, this.Ci = I, I.i(y, "constructor colorSpace: " + T.preferCanvasColorSpace);
}
h.getPictModeByCss = function(I) {
var T = g.a.contain;
return I instanceof HTMLCanvasElement && (I.style.objectFit === "fill" ? T = g.a.fill : I.style.objectFit === "cover" && (T = g.a.cover)), T;
};
var F = h.prototype;
return F.reset = function() {
this.Ci.i(y, "reset"), this.Hi = p.s.video, this.Xi();
}, F.updateCanvasSize = function(I, T) {
var D = !1;
return I === this.Ki.w && T === this.Ki.h || (D = !0, this.Ki.w = I, this.Ki.h = T, this.zi()), this.Ji(), D;
}, F.updateFormatSize = function(I, T, D) {
var W = !1, j = D % 180 == 90 || D % 180 == -90, O = j ? T : I, K = j ? I : T;
return O === this.Zi.w && K === this.Zi.h || (W = !0, this.Zi.w = O, this.Zi.h = K, this.zi(), this.Ji()), W;
}, F.updateRendererType = function(I) {
this.Ci.i(y, "updateRendererType: " + I);
var T = this.rendererType;
return I !== p.s.canvas || this.Pi || this.qi(), this.Hi = I, T !== this.rendererType;
}, F.destroy = function() {
this.Ci.i(y, "destroy"), this.Xi();
}, F.zi = function() {
if (this.Pi && this.Ki.h) {
var I = this.Ki, T = I.w, D = I.h, W = this.Zi, j = W.w, O = W.h;
if (O) {
var K = T / D;
K > j / O ? D > O && (T = (D = O) * K) : T > j && (D = (T = j) / K);
}
this.Pi.width = T, this.Pi.height = D, this.Ci.i(y, "update canvas size", T, D);
}
}, F.Ji = function() {
var I, T, D = ((I = this.Pi) == null ? void 0 : I.width) || this.Ki.w, W = ((T = this.Pi) == null ? void 0 : T.height) || this.Ki.h, j = this.Zi, O = j.w / j.h;
O > D / W ? (this.Wi.w = D, this.Wi.h = Math.round(D / O)) : (this.Wi.w = Math.round(W * O), this.Wi.h = W);
}, F.$i = function(I) {
this.Ci.i(y, "create canvas");
var T = document.createElement("canvas");
return I.w ? (T.width = I.w, T.height = I.h) : (I.w = T.width, I.h = T.height), T;
}, F.qi = function() {
this.Pi || (this.Pi = this.$i(this.Ki));
}, F.Xi = function() {
if (this.Ci.i(y, "destroy canvas"), this.Yi) {
var I = this.Yi.getExtension("WEBGL_lose_context");
I && I.loseContext();
}
this.Yi = null, this.Pi && (typeof HTMLCanvasElement < "u" && this.Pi instanceof HTMLCanvasElement && this.Pi.remove(), this.Pi = void 0);
}, s()(h, [{ key: "rendererType", get: function() {
return this.Hi;
} }, { key: "canvas", get: function() {
return this.Pi || this.qi(), this.Pi;
} }, { key: "webgl", get: function() {
var I;
return !this.Yi && this.Pi && (this.Yi = Object(C.c)(this.Pi)), (I = this.Fi) != null && I.preferCanvasColorSpace && this.Yi && Object.prototype.hasOwnProperty.call(this.Yi, "drawingBufferColorSpace") && (this.Yi.drawingBufferColorSpace = this.Fi.preferCanvasColorSpace), this.Yi;
} }, { key: "canvas2d", get: function() {
return !this.Gi && this.Pi && (this.Gi = this.Pi.getContext("2d")), this.Gi;
} }, { key: "canvasSize", get: function() {
return this.Ki;
} }, { key: "formatSize", get: function() {
return this.Zi;
} }, { key: "displaySize", get: function() {
return this.Wi;
} }]);
}();
r.a = x;
}, function(e, r, n) {
function o(s, p, g) {
return g === void 0 ? { width: s, height: p } : g.width > g.height ? { width: Math.round(g.width / g.height * s), height: p } : g.width < g.height ? { width: s, height: Math.round(p * g.height / g.width) } : { width: s, height: p };
}
n.d(r, "a", function() {
return o;
});
}, function(e, r, n) {
function o(x) {
var h = {};
function F(T) {
if (h[T])
return h[T].exports;
var D = h[T] = { i: T, l: !1, exports: {} };
return x[T].call(D.exports, D, D.exports, F), D.l = !0, D.exports;
}
F.m = x, F.c = h, F.i = function(T) {
return T;
}, F.d = function(T, D, W) {
F.o(T, D) || Object.defineProperty(T, D, { configurable: !1, enumerable: !0, get: W });
}, F.r = function(T) {
Object.defineProperty(T, "__esModule", { value: !0 });
}, F.n = function(T) {
var D = T && T.__esModule ? function() {
return T.default;
} : function() {
return T;
};
return F.d(D, "a", D), D;
}, F.o = function(T, D) {
return Object.prototype.hasOwnProperty.call(T, D);
}, F.p = "/", F.oe = function(T) {
throw console.error(T), T;
};
var I = F(F.s = ENTRY_MODULE);
return I.default || I;
}
var s = "[\\.|\\-|\\+|\\w|/|@]+", p = "\\(\\s*(/\\*.*?\\*/)?\\s*.*?(" + s + ").*?\\)";
function g(x) {
return (x + "").replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&");
}
function C(x, h, F) {
var I = {};
I[F] = [];
var T = h.toString(), D = T.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);
if (!D)
return I;
for (var W, j = D[1], O = new RegExp("(\\\\n|\\W)" + g(j) + p, "g"); W = O.exec(T); )
W[3] !== "dll-reference" && I[F].push(W[3]);
for (O = new RegExp("\\(" + g(j) + '\\("(dll-reference\\s(' + s + '))"\\)\\)' + p, "g"); W = O.exec(T); )
x[W[2]] || (I[F].push(W[1]), x[W[2]] = n(W[1]).m), I[W[2]] = I[W[2]] || [], I[W[2]].push(W[4]);
for (var K, z = Object.keys(I), B = 0; B < z.length; B++)
for (var J = 0; J < I[z[B]].length; J++)
K = I[z[B]][J], isNaN(1 * K) || (I[z[B]][J] = 1 * I[z[B]][J]);
return I;
}
function y(x) {
return Object.keys(x).reduce(function(h, F) {
return h || x[F].length > 0;
}, !1);
}
e.exports = function(x, h) {
h = h || {};
var F = { main: n.m }, I = h.all ? { main: Object.keys(F.main) } : function(O, K) {
for (var z = { main: [K] }, B = { main: [] }, J = { main: {} }; y(z); )
for (var be = Object.keys(z), $ = 0; $ < be.length; $++) {
var ye = be[$], Be = z[ye].pop();
if (J[ye] = J[ye] || {}, !J[ye][Be] && O[ye][Be]) {
J[ye][Be] = !0, B[ye] = B[ye] || [], B[ye].push(Be);
for (var Ve = C(O, O[ye][Be], ye), je = Object.keys(Ve), we = 0; we < je.length; we++)
z[je[we]] = z[je[we]] || [], z[je[we]] = z[je[we]].concat(Ve[je[we]]);
}
}
return B;
}(F, x), T = "";
Object.keys(I).filter(function(O) {
return O !== "main";
}).forEach(function(O) {
for (var K = 0; I[O][K]; )
K++;
I[O].push(K), F[O][K] = "(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })", T = T + "var " + O + " = (" + o.toString().replace("ENTRY_MODULE", JSON.stringify(K)) + ")({" + I[O].map(function(z) {
return JSON.stringify(z) + ": " + F[O][z].toString();
}).join(",") + `});
`;
}), T = T + "new ((" + o.toString().replace("ENTRY_MODULE", JSON.stringify(x)) + ")({" + I.main.map(function(O) {
return JSON.stringify(O) + ": " + F.main[O].toString();
}).join(",") + "}))(self);";
var D = new window.Blob([T], { type: "text/javascript" });
if (h.bare)
return D;
var W = (window.URL || window.webkitURL || window.mozURL || window.msURL).createObjectURL(D), j = new window.Worker(W);
return j.objectURL = W, j;
};
}, function(e, r, n) {
n.d(r, "b", function() {
return C;
}), n.d(r, "a", function() {
return y;
});
var o = n(18), s = n(7), p = n(2), g = function() {
function x(F) {
this.te = void 0, this.te = F;
}
var h = x.prototype;
return h.e = function(F) {
for (var I = arguments.length, T = new Array(I > 1 ? I - 1 : 0), D = 1; D < I; D++)
T[D - 1] = arguments[D];
this.te.postMessage({ event: p.a.WORKER_LOG, data: { level: o.LogLevel.ERROR, tag: F, msg: T } });
}, h.w = function(F) {
for (var I = arguments.length, T = new Array(I > 1 ? I - 1 : 0), D = 1; D < I; D++)
T[D - 1] = arguments[D];
this.te.postMessage({ event: p.a.WORKER_LOG, data: { level: o.LogLevel.WARN, tag: F, msg: T } });
}, h.i = function(F) {
for (var I = arguments.length, T = new Array(I > 1 ? I - 1 : 0), D = 1; D < I; D++)
T[D - 1] = arguments[D];
this.te.postMessage({ event: p.a.WORKER_LOG, data: { level: o.LogLevel.INFO, tag: F, msg: T } });
}, h.d = function(F) {
for (var I = arguments.length, T = new Array(I > 1 ? I - 1 : 0), D = 1; D < I; D++)
T[D - 1] = arguments[D];
this.te.postMessage({ event: p.a.WORKER_LOG, data: { level: o.LogLevel.DEBUG, tag: F, msg: T } });
}, h.v = function(F) {
for (var I = arguments.length, T = new Array(I > 1 ? I - 1 : 0), D = 1; D < I; D++)
T[D - 1] = arguments[D];
this.te.postMessage({ event: p.a.WORKER_LOG, data: { level: o.LogLevel.VERBOSE, tag: F, msg: T } });
}, x;
}();
function C(x, h, F, I, T) {
var D = new o.Logger(T).setName(s.m).setLevel(h).setId(F);
return I && D.setOutput(new g(x)), o.DefaultLogger.setLevel(h), D;
}
function y(x, h) {
try {
switch (h.level) {
case o.LogLevel.VERBOSE:
x.v.apply(x, [h.tag].concat(h.msg));
break;
case o.LogLevel.INFO:
x.i.apply(x, [h.tag].concat(h.msg));
break;
case o.LogLevel.ERROR:
x.e.apply(x, [h.tag].concat(h.msg));
break;
case o.LogLevel.WARN:
x.w.apply(x, [h.tag].concat(h.msg));
break;
case o.LogLevel.DEBUG:
x.d.apply(x, [h.tag].concat(h.msg));
}
} catch (F) {
}
}
}, function(e, r, n) {
n.d(r, "b", function() {
return C;
}), n.d(r, "a", function() {
return y;
});
var o = n(11), s = n(0), p = n(7);
function g(x, h, F) {
return F === void 0 && (F = p.f), { type: x, id: o.e[x], pid: -1, inputTimescale: F, timescale: F, codec: "", sequenceNumber: 0, samples: [], mp4Samples: [], duration: h, sampleDuration: 0, fillDuration: 0, droppedDuration: 0, droppedFrames: 0 };
}
function C(x, h) {
h === void 0 && (h = p.f);
var F = g(s.o.VIDEO, x, h);
return F.codedWidth = 0, F.codedHeight = 0, F.rotation = 0, F.sar = { width: 1, height: 1 }, F.profile = "", F.level = "", F.chromaFormat = "", F.fps = 0, F.codecType = s.c.unknown, F.dpb = 16, F;
}
function y(x, h) {
h === void 0 && (h = p.f);
var F = g(s.o.AUDIO, x, h);
return F.config = [], F.samplerate = 0, F.channelCount = 0, F.codecType = s.c.unknown, F;
}
}, function(e, r, n) {
n.d(r, "a", function() {
return p;
}), n.d(r, "b", function() {
return g;
}), n.d(r, "c", function() {
return C;
});
var o = { 0: "NONE", 8: "INTRA", 64: "STILL_PICTURE", 1: "MAIN_10", 65: "MAIN_10_STILL_PICTURE", 17: "MULTILAYER_MAIN_10", 81: "MULTILAYER_MAIN_10_STILL_PICTURE", 33: "MAIN_10_444", 97: "MAIN_10_444_STILL_PICTURE", 49: "MULTILAYER_MAIN_10_444", 113: "MULTILAYER_MAIN_10_444_STILL_PICTURE", 2: "MAIN_12", 34: "MAIN_12_444", 35: "MAIN_16_444", 10: "MAIN_12_INTRA", 42: "MAIN_12_444_INTRA", 43: "MAIN_16_444_INTRA", 66: "MAIN_12_STILL_PICTURE", 98: "MAIN_12_444_STILL_PICTURE", 99: "MAIN_16_444_STILL_PICTURE" }, s = { 16: "1.0", 32: "2.0", 35: "2.1", 48: "3.0", 51: "3.1", 64: "4.0", 67: "4.1", 80: "5.0", 83: "5.1", 86: "5.2", 96: "6.0", 99: "6.1", 102: "6.2", 105: "6.3" };
function p(y) {
switch (y) {
case 0:
return "Monochrome";
case 1:
return "4:2:0";
case 2:
return "4:2:2";
case 3:
return "4:4:4";
default:
return "Unknown";
}
}
var g = function(y) {
return s[y] || "Unknown";
}, C = function(y) {
return o[y] || "Unknown";
};
}, function(e, r, n) {
var o = n(17), s = n(24), p = function() {
function g(y) {
this.Ci = void 0, this.ie = -1, this.Ci = y;
}
var C = g.prototype;
return C.reset = function() {
this.ie = -1;
}, C.update = function(y, x) {
if (x.samples.length) {
var h = x.samples.reduce(function(z, B, J) {
return x.samples[z].pts > B.pts ? z : J;
}, 0), F = x.samples[0], I = Math.max(0, F.dts / x.inputTimescale), T = F.originDTS / x.inputTimescale, D = x.samples[h], W = (D.pts + (D.duration || 0)) / x.inputTimescale, j = o.c(y.samplerate, 1), O = W;
y.samples.length && (O = Math.min(y.samples[0].dts / y.inputTimescale, W)), this.ie === -1 ? this.ie = I : (T = this.ie - I + T, I = this.ie);
var K = Math.max(0, Math.ceil((O - I) / j));
K > 0 && (this.Ci.i("slient-audio", "fill cnt: " + K + "@" + I + " duration: " + (O - I)), this.ie = s.a.fillAACFrameByCount(this.Ci, y, I, K, T));
}
}, g;
}();
r.a = p;
}, function(e, r, n) {
function o(s, p) {
var g = [];
return s.samples.forEach(function(C) {
var y = s.inputTimescale;
g.push({ index: 0, dts: C.dts / y, pts: C.pts / y, duration: (C.duration || 0) / y });
}), g.sort(function(C, y) {
return C.pts - y.pts;
}), g.forEach(function(C, y) {
C.index = p + y;
}), g;
}
n.d(r, "a", function() {
return o;
});
}, function(e, r, n) {
r.a = { search: function(o, s) {
for (var p = 0, g = o.length - 1, C = null, y = null; p <= g; ) {
var x = s(y = o[C = (p + g) / 2 | 0]);
if (x > 0)
p = C + 1;
else {
if (!(x < 0))
return y;
g = C - 1;
}
}
return null;
}, searchIndex: function(o, s) {
for (var p = 0, g = o.length - 1, C = null; p <= g; ) {
var y = s(o[C = (p + g) / 2 | 0]);
if (y > 0)
p = C + 1;
else {
if (!(y < 0))
return C;
g = C - 1;
}
}
return -1;
} };
}, function(e, r, n) {
n.d(r, "a", function() {
return o;
});
var o = function() {
function s() {
}
return s.getSilentFrame = function(p, g) {
if (p === "mp4a.40.2") {
if (g === 1)
return new Uint8Array([0, 200, 0, 128, 35, 128]);
if (g === 2)
return new Uint8Array([33, 0, 73, 144, 2, 25, 0, 35, 128]);
if (g === 3)
return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 142]);
if (g === 4)
return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 128, 44, 128, 8, 2, 56]);
if (g === 5)
return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48, 4, 153, 0, 33, 144, 2, 56]);
if (g === 6)
return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48, 4, 153, 0, 33, 144, 2, 0, 178, 0, 32, 8, 224]);
} else {
if (g === 1)
return new Uint8Array([1, 64, 34, 128, 163, 78, 230, 128, 186, 8, 0, 0, 0, 28, 6, 241, 193, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94]);
if (g === 2)
return new Uint8Array([1, 64, 34, 128, 163, 94, 230, 128, 186, 8, 0, 0, 0, 0, 149, 0, 6, 241, 161, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94]);
if (g === 3)
return new Uint8Array([1, 64, 34, 128, 163, 94, 230, 128, 186, 8, 0, 0, 0, 0, 149, 0, 6, 241, 161, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94]);
}
return null;
}, s;
}();
}, function(e, r, n) {
function o(p) {
for (var g = [], C = p.byteLength, y = 0; y < C; ) {
if (p[y] < 128)
g.push(p[y]);
else if (!(p[y] < 192)) {
if (p[y] < 224) {
if (y < C - 1 && p[y + 1] >> 6 == 2) {
g.push((31 & p[y]) << 6 | 63 & p[y + 1]), y += 2;
continue;
}
} else if (p[y] < 240) {
if (y < C - 2 && p[y + 1] >> 6 == 2 && p[y + 2] >> 6 == 2) {
g.push((15 & p[y]) << 12 | (63 & p[y + 1]) << 6 | 63 & p[y + 2]), y += 3;
continue;
}
} else if (p[y] < 248 && y < C - 3 && p[y + 1] >> 6 == 2 && p[y + 2] >> 6 == 2 && p[y + 3] >> 6 == 2) {
g.push((7 & p[y]) << 18 | (63 & p[y + 1]) << 12 | (63 & p[y + 2]) << 6 | 63 & p[y + 3]), y += 4;
continue;
}
}
y++;
}
return (String.fromCodePoint || s).apply(void 0, g);
}
function s() {
for (var p = [], g = 0, C = "", y = arguments.length, x = new Array(y), h = 0; h < y; h++)
x[h] = arguments[h];
for (var F = 0, I = x.length; F !== I; ++F) {
var T = +x[F];
if (!(T < 1114111 && T >>> 0 === T))
throw RangeError("Invalid code point: " + T);
T <= 65535 ? g = p.push(T) : (T -= 65536, g = p.push(55296 + (T >> 10), T % 1024 + 56320)), g >= 16383 && (C += String.fromCharCode.apply(null, p), p.length = 0);
}
return C + String.fromCharCode.apply(null, p);
}
n.d(r, "a", function() {
return o;
});
}, function(e, r, n) {
n.r(r);
var o = n(18), s = n(11), p = n(27), g = n(34), C = n(28), y = n(2), x = n(47);
r.default = function(h) {
var F, I, T = new C.a();
[y.a.PRIV_NAL, y.a.VIDEO_CODEC_DETECTED, y.a.PARSING_INIT_SEGMENT, y.a.PARSED_DATA, y.a.LOAD_END, y.a.ERROR, y.a.DEMUXER_DETECTED, y.a.MEDIA_DEMUX, y.a.METADATA, y.a.KEY_FRAME_INDEXS, y.a.VIDEO_FRAME_INFO, y.a.MP4_NOT_FASTSTART, y.a.AAC_PRIV].forEach(function(D) {
return T.on(D, function(W) {
return h.postMessage({ event: D, data: W });
});
}), T.on(y.a.PARSING_DATA, function(D) {
var W = { event: y.a.PARSING_DATA, data: D }, j = [];
D.segments.forEach(function(O) {
j.push(O.payload.buffer);
}), h.postMessage(W, j);
}), T.on(y.a.RAW_DATA, function(D) {
var W = { event: y.a.RAW_DATA, data: D };
if (D.type === s.d.videoFrame) {
var j = [];
D.samples && D.samples.forEach(function(O) {
O.units.forEach(function(K) {
O.units.length && j.indexOf(K.data.buffer) === -1 && j.push(K.data.buffer);
});
});
try {
h.postMessage(W, j);
} catch (O) {
h.postMessage(W);
}
} else
h.postMessage(W);
}), h.addEventListener("message", function(D) {
var W = D.data;
switch (W.cmd) {
case p.a.INIT:
I || (I = Object(g.b)(h, W.config.logLevel || o.DEFAULT_LOG_LEVEL, W.contextId, W.hasExternalLogger, "mux")), I.i("mux-worker", "init", W), function(j, O, K, z, B) {
F = new x.a(j, O, K, z, B);
}(T, W.typeSupported, W.config, W.vendor, I);
break;
case p.a.PUSH:
F.pushMuxData(W.data, W.decryptdata, W.initSegment, W.timeOffset, W.contiguous, W.trackSwitch, W.discontinuity, W.accurateTimeOffset, W.fragEnd, W.transmuxData);
break;
case p.a.FLUSH:
F.flush();
break;
case p.a.LOAD_END:
F.end();
break;
case p.a.UPDATE_CONFIG:
F.updateConfig(W.config);
}
});
};
}, function(e, r, n) {
var o, s = typeof Reflect == "object" ? Reflect : null, p = s && typeof s.apply == "function" ? s.apply : function(K, z, B) {
return Function.prototype.apply.call(K, z, B);
};
o = s && typeof s.ownKeys == "function" ? s.ownKeys : Object.getOwnPropertySymbols ? function(K) {
return Object.getOwnPropertyNames(K).concat(Object.getOwnPropertySymbols(K));
} : function(K) {
return Object.getOwnPropertyNames(K);
};
var g = Number.isNaN || function(K) {
return K != K;
};
function C() {
C.init.call(this);
}
e.exports = C, e.exports.once = function(K, z) {
return new Promise(function(B, J) {
function be(ye) {
K.removeListener(z, $), J(ye);
}
function $() {
typeof K.removeListener == "function" && K.removeListener("error", be), B([].slice.call(arguments));
}
O(K, z, $, { once: !0 }), z !== "error" && function(ye, Be, Ve) {
typeof ye.on == "function" && O(ye, "error", Be, Ve);
}(K, be, { once: !0 });
});
}, C.EventEmitter = C, C.prototype.ee = void 0, C.prototype.ne = 0, C.prototype.se = void 0;
var y = 10;
function x(K) {
if (typeof K != "function")
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof K);
}
function h(K) {
return K.se === void 0 ? C.defaultMaxListeners : K.se;
}
function F(K, z, B, J) {
var be, $, ye, Be;
if (x(B), ($ = K.ee) === void 0 ? ($ = K.ee = /* @__PURE__ */ Object.create(null), K.ne = 0) : ($.newListener !== void 0 && (K.emit("newListener", z, B.listener ? B.listener : B), $ = K.ee), ye = $[z]), ye === void 0)
ye = $[z] = B, ++K.ne;
else if (typeof ye == "function" ? ye = $[z] = J ? [B, ye] : [ye, B] : J ? ye.unshift(B) : ye.push(B), (be = h(K)) > 0 && ye.length > be && !ye.warned) {
ye.warned = !0;
var Ve = new Error("Possible EventEmitter memory leak detected. " + ye.length + " " + String(z) + " listeners added. Use emitter.setMaxListeners() to increase limit");
Ve.name = "MaxListenersExceededWarning", Ve.emitter = K, Ve.type = z, Ve.count = ye.length, Be = Ve, console && console.warn && console.warn(Be);
}
return K;
}
function I() {
if (!this.fired)
return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
}
function T(K, z, B) {
var J = { fired: !1, wrapFn: void 0, target: K, type: z, listener: B }, be = I.bind(J);
return be.listener = B, J.wrapFn = be, be;
}
function D(K, z, B) {
var J = K.ee;
if (J === void 0)
return [];
var be = J[z];
return be === void 0 ? [] : typeof be == "function" ? B ? [be.listener || be] : [be] : B ? function($) {
for (var ye = new Array($.length), Be = 0; Be < ye.length; ++Be)
ye[Be] = $[Be].listener || $[Be];
return ye;
}(be) : j(be, be.length);
}
function W(K) {
var z = this.ee;
if (z !== void 0) {
var B = z[K];
if (typeof B == "function")
return 1;
if (B !== void 0)
return B.length;
}
return 0;
}
function j(K, z) {
for (var B = new Array(z), J = 0; J < z; ++J)
B[J] = K[J];
return B;
}
function O(K, z, B, J) {
if (typeof K.on == "function")
J.once ? K.once(z, B) : K.on(z, B);
else {
if (typeof K.addEventListener != "function")
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof K);
K.addEventListener(z, function be($) {
J.once && K.removeEventListener(z, be), B($);
});
}
}
Object.defineProperty(C, "defaultMaxListeners", { enumerable: !0, get: function() {
return y;
}, set: function(K) {
if (typeof K != "number" || K < 0 || g(K))
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + K + ".");
y = K;
} }), C.init = function() {
this.ee !== void 0 && this.ee !== Object.getPrototypeOf(this).ee || (this.ee = /* @__PURE__ */ Object.create(null), this.ne = 0), this.se = this.se || void 0;
}, C.prototype.setMaxListeners = function(K) {
if (typeof K != "number" || K < 0 || g(K))
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + K + ".");
return this.se = K, this;
}, C.prototype.getMaxListeners = function() {
return h(this);
}, C.prototype.emit = function(K) {
for (var z = [], B = 1; B < arguments.length; B++)
z.push(arguments[B]);
var J = K === "error", be = this.ee;
if (be !== void 0)
J = J && be.error === void 0;
else if (!J)
return !1;
if (J) {
var $;
if (z.length > 0 && ($ = z[0]), $ instanceof Error)
throw $;
var ye = new Error("Unhandled error." + ($ ? " (" + $.message + ")" : ""));
throw ye.context = $, ye;
}
var Be = be[K];
if (Be === void 0)
return !1;
if (typeof Be == "function")
p(Be, this, z);
else {
var Ve = Be.length, je = j(Be, Ve);
for (B = 0; B < Ve; ++B)
p(je[B], this, z);
}
return !0;
}, C.prototype.addListener = function(K, z) {
return F(this, K, z, !1);
}, C.prototype.on = C.prototype.addListener, C.prototype.prependListener = function(K, z) {
return F(this, K, z, !0);
}, C.prototype.once = function(K, z) {
return x(z), this.on(K, T(this, K, z)), this;
}, C.prototype.prependOnceListener = function(K, z) {
return x(z), this.prependListener(K, T(this, K, z)), this;
}, C.prototype.removeListener = function(K, z) {
var B, J, be, $, ye;
if (x(z), (J = this.ee) === void 0)
return this;
if ((B = J[K]) === void 0)
return this;
if (B === z || B.listener === z)
--this.ne == 0 ? this.ee = /* @__PURE__ */ Object.create(null) : (delete J[K], J.removeListener && this.emit("removeListener", K, B.listener || z));
else if (typeof B != "function") {
for (be = -1, $ = B.length - 1; $ >= 0; $--)
if (B[$] === z || B[$].listener === z) {
ye = B[$].listener, be = $;
break;
}
if (be < 0)
return this;
be === 0 ? B.shift() : function(Be, Ve) {
for (; Ve + 1 < Be.length; Ve++)
Be[Ve] = Be[Ve + 1];
Be.pop();
}(B, be), B.length === 1 && (J[K] = B[0]), J.removeListener !== void 0 && this.emit("removeListener", K, ye || z);
}
return this;
}, C.prototype.off = C.prototype.removeListener, C.prototype.removeAllListeners = function(K) {
var z, B, J;
if ((B = this.ee) === void 0)
return this;
if (B.removeListener === void 0)
return arguments.length === 0 ? (this.ee = /* @__PURE__ */ Object.create(null), this.ne = 0) : B[K] !== void 0 && (--this.ne == 0 ? this.ee = /* @__PURE__ */ Object.create(null) : delete B[K]), this;
if (arguments.length === 0) {
var be, $ = Object.keys(B);
for (J = 0; J < $.length; ++J)
(be = $[J]) !== "removeListener" && this.removeAllListeners(be);
return this.removeAllListeners("removeListener"), this.ee = /* @__PURE__ */ Object.create(null), this.ne = 0, this;
}
if (typeof (z = B[K]) == "function")
this.removeListener(K, z);
else if (z !== void 0)
for (J = z.length - 1; J >= 0; J--)
this.removeListener(K, z[J]);
return this;
}, C.prototype.listeners = function(K) {
return D(this, K, !0);
}, C.prototype.rawListeners = function(K) {
return D(this, K, !1);
}, C.listenerCount = function(K, z) {
return typeof K.listenerCount == "function" ? K.listenerCount(z) : W.call(K, z);
}, C.prototype.listenerCount = W, C.prototype.eventNames = function() {
return this.ne > 0 ? o(this.ee) : [];
};
}, function(e, r, n) {
n.d(r, "a", function() {
return y;
});
var o = n(10), s = n.n(o), p = n(14), g = n(21), C = n(32), y = function(x) {
function h(I) {
var T;
return (T = x.call(this) || this).Ci = void 0, T.re = void 0, T.he = void 0, T.Ci = I, T;
}
s()(h, x);
var F = h.prototype;
return F.copyImageData = function(I, T, D, W) {
var j;
this.re || (this.re = Object(g.a)());
var O = { willReadFrequently: !0 };
W && (O.colorSpace = W), this.he || (this.he = this.re.getContext("2d", O));
var K, z, B = 0, J = 0, be = typeof window < "u" && I instanceof HTMLVideoElement;
if (be)
B = I.videoWidth, J = I.videoHeight;
else if (D === 90 || D === 270) {
var $ = Object(C.a)(I.height, I.width, T);
B = $.height, J = $.width;
} else {
var ye = Object(C.a)(I.width, I.height, T);
B = ye.width, J = ye.height;
}
return this.re.width = B, this.re.height = J, be ? (K = this.he) == null || K.drawImage(I, 0, 0) : (z = this.he) == null || z.drawImage(I, 0, 0, I.width, I.height, 0, 0, this.re.width, this.re.height), (j = this.he) == null ? void 0 : j.getImageData(0, 0, B, J, O);
}, F.destroy = function() {
this.Ci.i("image-data-copier", "destrpy"), this.re = void 0, this.he = void 0;
}, h;
}(p.a);
}, function(e, r, n) {
var o = n(52);
e.exports = function(s, p, g) {
return (p = o(p)) in s ? Object.defineProperty(s, p, { value: g, enumerable: !0, configurable: !0, writable: !0 }) : s[p] = g, s;
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r, n) {
var o = function() {
function s() {
}
return s.getPosByTime = function(p, g) {
if (p && p.length !== 0) {
if (p[0] && g <= p[0].time)
return p[0];
if (p[p.length - 1] && g >= p[p.length - 1].time)
return p[p.length - 1];
for (var C = 0, y = p.length - 1, x = 0, h = 0; C <= y; )
if (g > (h = p[(x = (C + y) / 2 | 0) + 1] ? p[x + 1].time : Number.MAX_SAFE_INTEGER))
C = x + 1;
else {
if (!(g < p[x].time))
return g === h ? p[x + 1] : p[x];
y = x - 1;
}
return p[0];
}
}, s;
}();
r.a = o;
}, function(e, r, n) {
var o = n(11), s = n(3), p = n(26);
function g(V, E, d) {
return Uint8Array.prototype.slice ? V.slice(E, d) : new Uint8Array(Array.prototype.slice.call(V, E, d));
}
var C = function() {
function V(E, d) {
this.ae = void 0, this.ue = void 0, this.ae = E, this.ue = d;
}
return V.prototype.decrypt = function(E, d) {
return this.ae.decrypt({ name: "AES-CBC", iv: this.ue }, d, E);
}, V;
}(), y = function() {
function V() {
this.ce = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], this.fe = [new Uint32Array(256), new Uint32Array(256), new Uint32Array(256), new Uint32Array(256)], this.Ae = [new Uint32Array(256), new Uint32Array(256), new Uint32Array(256), new Uint32Array(256)], this.ve = new Uint32Array(256), this.de = new Uint32Array(256), this.le = new Uint32Array(0), this.be = 0, this.pe = 0, this.me = void 0, this.ge = void 0, this.ye();
}
var E = V.prototype;
return E._e = function(d) {
for (var l = new DataView(d), f = new Uint32Array(4), b = 0; b < 4; b++)
f[b] = l.getUint32(4 * b);
return f;
}, E.ye = function() {
var d = this.ve, l = this.de, f = this.fe, b = f[0], N = f[1], H = f[2], S = f[3], Y = this.Ae, ce = Y[0], Ae = Y[1], _e = Y[2], me = Y[3], Ce = new Uint32Array(256), Me = 0, Ge = 0, xe = 0;
for (xe = 0; xe < 256; xe++)
Ce[xe] = xe < 128 ? xe << 1 : xe << 1 ^ 283;
for (xe = 0; xe < 256; xe++) {
var Ze = Ge ^ Ge << 1 ^ Ge << 2 ^ Ge << 3 ^ Ge << 4;
Ze = Ze >>> 8 ^ 255 & Ze ^ 99, d[Me] = Ze, l[Ze] = Me;
var $e = Ce[Me], et = Ce[$e], st = Ce[et], Ke = 257 * Ce[Ze] ^ 16843008 * Ze;
b[Me] = Ke << 24 | Ke >>> 8, N[Me] = Ke << 16 | Ke >>> 16, H[Me] = Ke << 8 | Ke >>> 24, S[Me] = Ke, Ke = 16843009 * st ^ 65537 * et ^ 257 * $e ^ 16843008 * Me, ce[Ze] = Ke << 24 | Ke >>> 8, Ae[Ze] = Ke << 16 | Ke >>> 16, _e[Ze] = Ke << 8 | Ke >>> 24, me[Ze] = Ke, Me ? (Me = $e ^ Ce[Ce[Ce[st ^ $e]]], Ge ^= Ce[Ce[Ge]]) : Me = Ge = 1;
}
}, E.expandKey = function(d) {
for (var l = this._e(d), f = !0, b = 0; b < l.length && f; )
f = l[b] === this.le[b], b++;
if (!f) {
this.le = l;
var N = this.pe = l.length;
if (N !== 4 && N !== 6 && N !== 8)
throw new Error("Invalid aes key size=" + N);
var H, S, Y = this.be = 4 * (N + 6 + 1), ce = this.me = new Uint32Array(Y), Ae = this.ge = new Uint32Array(Y), _e = this.ve, me = this.ce, Ce = this.Ae, Me = Ce[0], Ge = Ce[1], xe = Ce[2], Ze = Ce[3], $e = 0, et = 0;
for (H = 0; H < Y; H++)
H < N ? $e = ce[H] = l[H] : (et = $e, H % N == 0 ? (et = _e[(et = et << 8 | et >>> 24) >>> 24] << 24 | _e[et >>> 16 & 255] << 16 | _e[et >>> 8 & 255] << 8 | _e[255 & et], et ^= me[H / N | 0] << 24) : N > 6 && H % N == 4 && (et = _e[et >>> 24] << 24 | _e[et >>> 16 & 255] << 16 | _e[et >>> 8 & 255] << 8 | _e[255 & et]), ce[H] = $e = (ce[H - N] ^ et) >>> 0);
for (S = 0; S < Y; S++)
H = Y - S, et = 3 & S ? ce[H] : ce[H - 4], Ae[S] = S < 4 || H <= 4 ? et : Me[_e[et >>> 24]] ^ Ge[_e[et >>> 16 & 255]] ^ xe[_e[et >>> 8 & 255]] ^ Ze[_e[255 & et]], Ae[S] = Ae[S] >>> 0;
}
}, E.Ce = function(d) {
return d << 24 | (65280 & d) << 8 | (16711680 & d) >> 8 | d >>> 24;
}, E.decrypt = function(d, l, f) {
for (var b, N, H, S, Y, ce, Ae, _e, me, Ce, Me, Ge, xe, Ze, $e = this.pe + 6, et = this.ge, st = this.de, Ke = this.Ae, Tt = Ke[0], It = Ke[1], ut = Ke[2], Et = Ke[3], ft = this._e(f), Lt = ft[0], Wt = ft[1], Yt = ft[2], hi = ft[3], Qi = new Int32Array(d), Xi = new Int32Array(Qi.length), Ci = this.Ce; l < Qi.length; ) {
for (me = Ci(Qi[l]), Ce = Ci(Qi[l + 1]), Me = Ci(Qi[l + 2]), Ge = Ci(Qi[l + 3]), Y = me ^ et[0], ce = Ge ^ et[1], Ae = Me ^ et[2], _e = Ce ^ et[3], xe = 4, Ze = 1; Ze < $e; Ze++)
b = Tt[Y >>> 24] ^ It[ce >> 16 & 255] ^ ut[Ae >> 8 & 255] ^ Et[255 & _e] ^ et[xe], N = Tt[ce >>> 24] ^ It[Ae >> 16 & 255] ^ ut[_e >> 8 & 255] ^ Et[255 & Y] ^ et[xe + 1], H = Tt[Ae >>> 24] ^ It[_e >> 16 & 255] ^ ut[Y >> 8 & 255] ^ Et[255 & ce] ^ et[xe + 2], S = Tt[_e >>> 24] ^ It[Y >> 16 & 255] ^ ut[ce >> 8 & 255] ^ Et[255 & Ae] ^ et[xe + 3], Y = b, ce = N, Ae = H, _e = S, xe += 4;
b = st[Y >>> 24] << 24 ^ st[ce >> 16 & 255] << 16 ^ st[Ae >> 8 & 255] << 8 ^ st[255 & _e] ^ et[xe], N = st[ce >>> 24] << 24 ^ st[Ae >> 16 & 255] << 16 ^ st[_e >> 8 & 255] << 8 ^ st[255 & Y] ^ et[xe + 1], H = st[Ae >>> 24] << 24 ^ st[_e >> 16 & 255] << 16 ^ st[Y >> 8 & 255] << 8 ^ st[255 & ce] ^ et[xe + 2], S = st[_e >>> 24] << 24 ^ st[Y >> 16 & 255] << 16 ^ st[ce >> 8 & 255] << 8 ^ st[255 & Ae] ^ et[xe + 3], xe += 3, Xi[l] = Ci(b ^ Lt), Xi[l + 1] = Ci(S ^ Wt), Xi[l + 2] = Ci(H ^ Yt), Xi[l + 3] = Ci(N ^ hi), Lt = me, Wt = Ce, Yt = Me, hi = Ge, l += 4;
}
return Xi.buffer;
}, V;
}(), x = function() {
function V(E, d) {
this.ae = void 0, this.le = void 0, this.ae = E, this.le = d;
}
return V.prototype.expandKey = function() {
return this.ae.importKey("raw", this.le, { name: "AES-CBC", length: 128 }, !1, ["encrypt", "decrypt"]);
}, V;
}(), h = "decrypter", F = function() {
function V(d, l, f) {
var b = (f === void 0 ? {} : f).removePKCS7Padding, N = b === void 0 || b;
if (this.Ie = !0, this.di = void 0, this.Ci = void 0, this.Oe = void 0, this.ae = null, this.we = null, this.le = null, this.Ee = null, this.je = null, this.ke = null, this.Me = null, this.Ci = d, this.di = l, this.Oe = N, N)
try {
var H = self.crypto;
H && (this.ae = H.subtle || H.webkitSubtle);
} catch (S) {
}
this.ae === null && (this.di.enableSoftwareAES = !0);
}
var E = V.prototype;
return E.isSync = function() {
return this.di.enableSoftwareAES;
}, E.flush = function() {
var d = this.Me;
if (d) {
var l, f, b, N = new Uint8Array(d);
return this.reset(), this.Oe ? (f = (l = N).byteLength, (b = f && new DataView(l.buffer).getUint8(f - 1)) ? g(l, 0, f - b) : l) : N;
}
this.reset();
}, E.reset = function() {
this.Me = null, this.ke = null, this.je = null, this.we && (this.we = null);
}, E.decrypt = function(d, l, f, b) {
if (this.di.enableSoftwareAES) {
this.softwareDecrypt(new Uint8Array(d), l, f);
var N = this.flush();
N && b(N.buffer);
} else
this.webCryptoDecrypt(new Uint8Array(d), l, f).then(b);
}, E.softwareDecrypt = function(d, l, f) {
var b, N, H, S = this.ke, Y = this.Me, ce = this.je;
this.Se("JS AES decrypt"), ce && (b = ce, N = d, (H = new Uint8Array(b.length + N.length)).set(b), H.set(N, b.length), d = H, this.je = null);
var Ae = this.Be(d);
if (!Ae.length)
return null;
S && (f = S);
var _e = this.we;
_e || (_e = this.we = new y()), _e.expandKey(l);
var me = Y;
return this.Me = _e.decrypt(Ae.buffer, 0, f), this.ke = g(Ae, -16).buffer, me || null;
}, E.webCryptoDecrypt = function(d, l, f) {
var b = this, N = this.ae;
return this.le === l && this.Ee || (this.le = l, this.Ee = new x(N, l)), this.Ee.expandKey().then(function(H) {
return N ? new C(N, f).decrypt(d.buffer, H) : Promise.reject(new Error("web crypto not initialized"));
}).catch(function(H) {
return b.Te(H, d, l, f);
});
}, E.Te = function(d, l, f, b) {
return this.Ci.w(h, "[decrypter.ts]: WebCrypto Error, disable WebCrypto API:", d), this.di.enableSoftwareAES = !0, this.Ie = !0, this.softwareDecrypt(l, f, b);
}, E.Be = function(d) {
var l = d, f = d.length - d.length % 16;
return f !== d.length && (l = g(d, 0, f), this.je = g(d, f)), l;
}, E.Se = function(d) {
this.Ie && (this.Ci.i(h, "[decrypter.ts]: " + d), this.Ie = !1);
}, V;
}(), I = n(5), T = n.n(I), D = n(10), W = n.n(D), j = n(17), O = n(7), K = null, z = [32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160], B = [44100, 48e3, 32e3, 22050, 24e3, 16e3, 11025, 12e3, 8e3], J = [[0, 72, 144, 12], [0, 0, 0, 0], [0, 72, 144, 12], [0, 144, 144, 12]], be = [0, 1, 1, 4];
function $(V, E, d, l, f) {
if (!(d + 24 > E.length)) {
var b = ye(E, d);
if (b && d + b.frameLength <= E.length) {
var N = l + f * (b.samplesPerFrame * O.f / b.sampleRate), H = { unit: E.subarray(d, d + b.frameLength), pts: N, dts: N, originDTS: l, originPTS: l };
return V.config = [], V.channelCount = b.channelCount, V.samplerate = b.sampleRate, V.samples.push(H), { sample: H, length: b.frameLength, missing: 0 };
}
}
}
function ye(V, E) {
var d = V[E + 1] >> 3 & 3, l = V[E + 1] >> 1 & 3, f = V[E + 2] >> 4 & 15, b = V[E + 2] >> 2 & 3;
if (d !== 1 && f !== 0 && f !== 15 && b !== 3) {
var N = V[E + 2] >> 1 & 1, H = V[E + 3] >> 6, S = 1e3 * z[14 * (d === 3 ? 3 - l : l === 3 ? 3 : 4) + f - 1], Y = B[3 * (d === 3 ? 0 : d === 2 ? 1 : 2) + b], ce = H === 3 ? 1 : 2, Ae = J[d][l], _e = be[l], me = 8 * Ae * _e, Ce = Math.floor(Ae * S / Y + N) * _e;
if (K === null) {
var Me = (navigator.userAgent || "").match(/Chrome\/(\d+)/i);
K = Me ? parseInt(Me[1]) : 0;
}
return K && K <= 87 && l === 2 && S >= 224e3 && H === 0 && (V[E + 3] = 128 | V[E + 3]), { sampleRate: Y, channelCount: ce, frameLength: Ce, samplesPerFrame: me };
}
}
function Be(V, E) {
return !(V[E] !== 255 || 224 & ~V[E + 1] || !(6 & V[E + 1]));
}
function Ve(V, E) {
return E + 1 < V.length && Be(V, E);
}
var je = function(V) {
return V[V.KEY_FRAME = 0] = "KEY_FRAME", V[V.INTER_FRAME = 1] = "INTER_FRAME", V[V.INTRA_ONLY_FRAME = 2] = "INTRA_ONLY_FRAME", V[V.SWITCH_FRAME = 3] = "SWITCH_FRAME", V;
}({}), we = function(V) {
return V[V.AV1_OBU_SEQUENCE_HEADER = 1] = "AV1_OBU_SEQUENCE_HEADER", V[V.AV1_OBU_TEMPORAL_DELIMITER = 2] = "AV1_OBU_TEMPORAL_DELIMITER", V[V.AV1_OBU_FRAME_HEADER = 3] = "AV1_OBU_FRAME_HEADER", V[V.AV1_OBU_TILE_GROUP = 4] = "AV1_OBU_TILE_GROUP", V[V.AV1_OBU_METADATA = 5] = "AV1_OBU_METADATA", V[V.AV1_OBU_FRAME = 6] = "AV1_OBU_FRAME", V[V.AV1_OBU_REDUNDANT_FRAME_HEADER = 7] = "AV1_OBU_REDUNDANT_FRAME_HEADER", V[V.AV1_OBU_TILE_LIST = 8] = "AV1_OBU_TILE_LIST", V[V.AV1_OBU_PADDING = 15] = "AV1_OBU_PADDING", V;
}({}), ue = n(8), L = n.n(ue), w = n(35), le = n(24), oe = n(2), Re = n(37), Oe = "base-demuxer", de = function() {
function V(d, l, f, b, N) {
var H = this;
this.Ci = void 0, this.Ai = void 0, this.De = void 0, this.di = void 0, this.li = void 0, this._i = void 0, this.Re = void 0, this.Le = void 0, this.Mi = void 0, this.Ne = void 0, this._t = void 0, this.Qe = void 0, this.xe = !1, this.Ve = !0, this.Ue = void 0, this.Fe = void 0, this.Pe = void 0, this.Di = function(S) {
H.Ai.emit(oe.a.ERROR, S);
}, d.i(Oe, "constructor", b), this.Ci = d, this.Ai = l, this.De = f, this.di = b, this.li = N, this.xe = !!this.di.gopRemux, this._t = new p.a(), this.He();
}
var E = V.prototype;
return E.resetInitSegment = function(d) {
var l;
this.Ci.i(Oe, "reset init", d), this._i = d;
var f = this.Ye(), b = this.Ge();
typeof f == "boolean" && (this.Mi.active = f, f || (this.xe = !1)), typeof b == "boolean" && (this.Ne.active = b), this.Re = this.Le = void 0, this.Mi.samples = [], this.Ne.samples = [], (l = this.Qe) == null || l.reset(), this.Ve = !0, this.Ue = void 0, this.Pe = void 0, this.Fe = void 0, this.xe = !!this.di.gopRemux, this._t.clear();
}, E.resetTimeStamp = function() {
}, E.updateConfig = function(d) {
L()(this.di, d);
}, E.flush = function() {
this.Ci.i(Oe, "flush"), this.Ke(!0), this.Ue = void 0;
}, E.destroy = function() {
this.Ci.i(Oe, "destroy"), this._t.clear();
}, E.He = function(d, l) {
d === void 0 && (d = 1 / 0), this.Mi = Object(w.b)(d, l), this.Ne = Object(w.a)(d, l);
}, E.Ze = function(d, l) {
var f;
if (((f = this._i) == null || !f.disableFillSlientForRaw) && l.outputRaw && !d.active) {
var b;
this.Qe || (le.a.initAudioForFillSilent(this.Ci, d, (b = this._i) == null ? void 0 : b.audioCodec), this.Qe = new Re.a(this.Ci)), this.Qe.update(d, l);
}
}, E.We = function(d, l) {
return !!(l.outputRaw || l.active || d.active) || (this.Di(Object(s.e)(s.b.MEDIA_ERROR, s.a.NO_TRACKS_AVAILABLE, "no tracks available. config V: " + this.di.videoEnabled + " A: " + this.di.audioEnabled)), !1);
}, E.Xe = function(d, l, f) {
if (d.samples.length === 0 && l.samples.length === 0)
return f && this.De.flush(), !1;
if (!f && (d.active && d.samples.length === 0 || l.active && l.samples.length < 3)) {
var b = d.active && d.configParsed && this.ze(d) || 0, N = l.active && l.decConf && this.Je(l) || 0, H = l.samples.reduce(function(S, Y) {
return S + (Y.key ? 1 : 0);
}, 0);
return b > 30 ? (this.Ci.i(Oe, "audio remux sec > 30, remux now."), this.Ke(!0)) : (N > 30 || this.di.isLive && H > 1) && (this.Ci.i(Oe, "video remux sec: " + N + " key: " + H + ", remux now."), this.Ke(!0)), !1;
}
return !0;
}, E.Ke = function(d) {
}, E.qe = function(d, l, f, b, N) {
this.Ve && (this.Ve = !1, this.Ai.emit(oe.a.MEDIA_DEMUX, { type: b }));
var H = !0, S = 0, Y = !1;
this.Ue && (H = this.Ue.contiguous, S = this.Ue.timeOffset, Y = this.Ue.accurateTimeOffset);
try {
this.De.remux(d, l, S, H, Y, f, N), this.Ue = void 0;
} catch (ce) {
this.Ci.i(Oe, ce), this.Di(Object(s.e)(s.b.MUX_ERROR, s.a.REMUX_ERROR, ce.message));
}
}, E.ze = function(d) {
return d.samples.length ? d.samples.length && j.c(d.samplerate, 1) * d.samples.length : 0;
}, E.Je = function(d) {
return d.samples.length ? (d.samples[d.samples.length - 1].dts - d.samples[0].dts) / d.inputTimescale : 0;
}, E.Ye = function() {
var d, l;
return typeof this.di.videoEnabled == "boolean" ? this.di.videoEnabled ? (l = this._i) == null ? void 0 : l.hasVideo : this.di.videoEnabled : (d = this._i) == null ? void 0 : d.hasVideo;
}, E.Ge = function() {
var d, l;
return typeof this.di.audioEnabled == "boolean" ? this.di.audioEnabled ? (l = this._i) == null ? void 0 : l.hasAudio : this.di.audioEnabled : (d = this._i) == null ? void 0 : d.hasAudio;
}, E.$e = function(d) {
var l = this.Mi;
d.key && (this.Pe = d.originPTS), d.keyframePTS = this.Pe, this.tn(d) && l.samples.push(d);
}, E.tn = function(d) {
var l, f, b, N = this.Mi;
if (!(((l = this._i) == null ? void 0 : l.pushVSampleMode) === "keyframesOnly" ? d.key : ((f = this._i) == null ? void 0 : f.pushVSampleMode) !== "disableAll"))
return !1;
var H = (b = this._i) == null ? void 0 : b.dropVideo;
if (H)
for (var S = 0; S < H.length; S++) {
var Y, ce, Ae;
if (!d.key && (((Y = H[S]) == null ? void 0 : Y.fragSn) === void 0 || ((ce = H[S]) == null ? void 0 : ce.fragSn) === this.Fe) && d.keyframePTS === Math.round(H[S].keyframePTS * N.inputTimescale))
return this.Ci.i(Oe, "drop sample pts: " + d.originPTS / N.inputTimescale + " frag sn: " + ((Ae = H[S]) == null ? void 0 : Ae.fragSn)), N.droppedFrames++, N.droppedDuration += d.duration || N.sampleDuration, !1;
}
return !0;
}, V;
}(), X = n(0), ge = n(15), Pe = function(V) {
return V[V.H264_NAL_UNSPECIFIED = 0] = "H264_NAL_UNSPECIFIED", V[V.H264_NAL_SLICE = 1] = "H264_NAL_SLICE", V[V.H264_NAL_DPA = 2] = "H264_NAL_DPA", V[V.H264_NAL_DPB = 3] = "H264_NAL_DPB", V[V.H264_NAL_DPC = 4] = "H264_NAL_DPC", V[V.H264_NAL_IDR_SLICE = 5] = "H264_NAL_IDR_SLICE", V[V.H264_NAL_SEI = 6] = "H264_NAL_SEI", V[V.H264_NAL_SPS = 7] = "H264_NAL_SPS", V[V.H264_NAL_PPS = 8] = "H264_NAL_PPS", V[V.H264_NAL_AUD = 9] = "H264_NAL_AUD", V[V.H264_NAL_END_SEQUENCE = 10] = "H264_NAL_END_SEQUENCE", V[V.H264_NAL_END_STREAM = 11] = "H264_NAL_END_STREAM", V[V.H264_NAL_FILLER_DATA = 12] = "H264_NAL_FILLER_DATA", V[V.H264_NAL_SPS_EXT = 13] = "H264_NAL_SPS_EXT", V[V.H264_NAL_PREFIX = 14] = "H264_NAL_PREFIX", V[V.H264_NAL_SUB_SPS = 15] = "H264_NAL_SUB_SPS", V[V.H264_NAL_DPS = 16] = "H264_NAL_DPS", V[V.H264_NAL_RESERVED17 = 17] = "H264_NAL_RESERVED17", V[V.H264_NAL_RESERVED18 = 18] = "H264_NAL_RESERVED18", V[V.H264_NAL_AUXILIARY_SLICE = 19] = "H264_NAL_AUXILIARY_SLICE", V[V.H264_NAL_EXTEN_SLICE = 20] = "H264_NAL_EXTEN_SLICE", V[V.H264_NAL_DEPTH_EXTEN_SLICE = 21] = "H264_NAL_DEPTH_EXTEN_SLICE", V[V.H264_NAL_RESERVED22 = 22] = "H264_NAL_RESERVED22", V[V.H264_NAL_RESERVED23 = 23] = "H264_NAL_RESERVED23", V[V.H264_NAL_UNSPECIFIED24 = 24] = "H264_NAL_UNSPECIFIED24", V[V.H264_NAL_UNSPECIFIED25 = 25] = "H264_NAL_UNSPECIFIED25", V[V.H264_NAL_UNSPECIFIED26 = 26] = "H264_NAL_UNSPECIFIED26", V[V.H264_NAL_UNSPECIFIED27 = 27] = "H264_NAL_UNSPECIFIED27", V[V.H264_NAL_UNSPECIFIED28 = 28] = "H264_NAL_UNSPECIFIED28", V[V.H264_NAL_UNSPECIFIED29 = 29] = "H264_NAL_UNSPECIFIED29", V[V.H264_NAL_UNSPECIFIED30 = 30] = "H264_NAL_UNSPECIFIED30", V[V.NAL_FF_IGNORE = 267448321] = "NAL_FF_IGNORE", V[V.PRIV_NAL_MAGIC_H264 = 31] = "PRIV_NAL_MAGIC_H264", V;
}({}), ae = n(9), q = n(4), m = n(1), ve = [{ w: 1, h: 1 }, { w: 12, h: 11 }, { w: 10, h: 11 }, { w: 16, h: 11 }, { w: 40, h: 33 }, { w: 24, h: 11 }, { w: 20, h: 11 }, { w: 32, h: 11 }, { w: 80, h: 33 }, { w: 18, h: 11 }, { w: 15, h: 11 }, { w: 64, h: 33 }, { w: 160, h: 99 }, { w: 4, h: 3 }, { w: 3, h: 2 }, { w: 2, h: 1 }], U = [X.c.hevc, X.c.kvc3, X.c.kvc4, X.c.kvc5, X.c.kvc6], M = [X.c.vvc, X.c.bvc2, X.c.kvc30];
function ne(V) {
return !!V && U.indexOf(V) >= 0;
}
function Le(V) {
return !!V && M.indexOf(V) >= 0;
}
function Ue(V) {
var E = Object(m.a)(V, 8);
if (E > 0 && E <= 16) {
var d = ve[E - 1];
return d ? { width: d.w, height: d.h } : void 0;
}
if (E === 255)
return { width: Object(m.a)(V, 16), height: Object(m.a)(V, 16) };
}
function re(V, E, d) {
return d === void 0 && (d = 0), V.forEach(function(l) {
l.dts = Math.max(0, l.dts + d) / E, l.cts = l.cts / E, l.pts = l.dts + l.cts, l.originDTS = l.originDTS / E;
}), V;
}
var k = n(41), P = /\0/g, Z = function() {
function V() {
}
return V.parseMetadata = function(E, d) {
var l = {};
try {
var f = V.en(E, d, 0), b = V.en(E, d, f.size);
typeof f.data == "string" && (l[f.data] = b.data);
} catch (N) {
E.i("AMF", N.toString());
}
return l;
}, V.nn = function(E, d, l) {
var f = V.rn(d, l), b = V.en(E, d, l + f.size), N = b.objectEnd;
return { data: { name: f.data, value: b.data }, size: b.size, objectEnd: N };
}, V.parseVariable = function(E, d, l) {
return V.nn(E, d, l);
}, V.parseLongString = function(E, d) {
var l = new DataView(E, d).getUint32(0);
return { data: l > 0 ? Object(k.a)(new Uint8Array(E, d + 4, l)).replace(P, " ").trim() : "", size: 4 + l };
}, V.parseDate = function(E, d) {
var l = new DataView(E, d), f = l.getFloat64(0), b = l.getInt16(8);
return { data: new Date(f += 60 * b * 1e3), size: 10 };
}, V.rn = function(E, d) {
var l = new DataView(E, d).getUint16(0);
return { data: l > 0 ? Object(k.a)(new Uint8Array(E, d + 2, l)).replace(P, " ").trim() : "", size: 2 + l };
}, V.en = function(E, d, l) {
var f, b = d.byteLength, N = l, H = d, S = new DataView(H, 0), Y = S.getUint8(N);
N += 1;
var ce = !1;
switch (Y) {
case 0:
f = S.getFloat64(N), N += 8;
break;
case 1:
f = !!S.getUint8(N), N += 1;
break;
case 2:
var Ae = V.rn(H, N);
f = Ae.data, N += Ae.size;
break;
case 3:
for (f = {}, (16777215 & S.getUint32(b - 4)) == 9 && 3; N < b - 4; ) {
var _e = V.nn(E, H, N);
if (_e.objectEnd)
break;
typeof _e.data.name == "string" && (f[_e.data.name] = _e.data.value), N = _e.size;
}
N <= b - 3 && (16777215 & S.getUint32(N - 1)) === 9 && (N += 3);
break;
case 8:
for (f = {}, N += 4, (16777215 & S.getUint32(b - 4)) == 9 && 3; N < b - 8; ) {
var me = V.parseVariable(E, H, N);
if (me.objectEnd)
break;
f[me.data.name] = me.data.value, N = me.size;
}
N <= b - 3 && (16777215 & S.getUint32(N - 1)) === 9 && (N += 3);
break;
case 9:
f = void 0, N = 1, ce = !0;
break;
case 10:
f = [];
var Ce = S.getUint32(N);
N += 4;
for (var Me = 0; Me < Ce; Me++) {
var Ge = V.en(E, H, N);
f.push(Ge.data), N = Ge.size;
}
break;
case 11:
var xe = V.parseDate(H, N + 1);
f = xe.data, N += xe.size;
break;
case 12:
var Ze = V.rn(H, N + 1);
f = Ze.data, N += Ze.size;
break;
default:
N = b, E.v("AMF", "AMF", "Unsupported AMF value type " + Y);
}
return { data: f, size: N, objectEnd: ce };
}, V;
}(), he = function() {
function V(d, l) {
this.Ci = void 0, this.Ai = void 0, this._t = void 0, this.hn = void 0, this.an = { tags: [] }, this.un = 0, this.cn = void 0, this.fn = void 0, this.An = void 0, this.Ci = d, this.Ai = l, this._t = new p.a(), this.un = ge.e, this.cn = this.vn;
}
var E = V.prototype;
return E.reset = function() {
this.un = ge.e, this.cn = this.vn, this._t.clear(), this.hn = void 0, this.an = { tags: [] }, this.An = void 0, this.fn = void 0;
}, E.append = function(d) {
for (this.an = { tags: [] }, this._t.put(d); this._t.unreadLen >= this.un; )
this.cn();
return this.an;
}, E.vn = function() {
var d = this._t.get(ge.e);
d && (d[0] === 70 && d[1] === 76 && d[2] === 86 && d[3] === 1 || this.Ai.emit(oe.a.ERROR, Object(s.e)(s.b.MUX_ERROR, s.a.PARSING_ERROR, "Flv: wrong head")), this.An = !!((4 & d[4]) >>> 2), this.fn = !!(1 & d[4]), this.Ci.i("flv-tag-dump", "head audio: " + this.An + " video: " + this.fn), this.an.head = d, this.un = ge.f, this.cn = this.dn);
}, E.dn = function() {
this.hn = new ge.i();
var d = this._t.get(ge.f);
d && (this.hn.tagType = d[0], this.hn.dataSize = Object(q.g)(d, 1), this.hn.timestamp = ((255 & d[7]) << 24) + Object(q.g)(d, 4), this.cn = this.ln, this.un = this.hn.dataSize + ge.g);
}, E.ln = function() {
var d = this.hn;
d && (d.tagType !== ge.j.SCRIPT && d.tagType !== ge.j.AUDIO && d.tagType !== ge.j.VIDEO || (d.body = this._t.get(d.dataSize), this._t.skip(4), this.an.tags.push(d), this.hn = void 0), this.cn = this.dn, this.un = ge.f);
}, T()(V, [{ key: "trackInfo", get: function() {
return typeof this.fn == "boolean" && typeof this.An == "boolean" ? { hasVideo: this.fn, hasAudio: this.An } : void 0;
} }]);
}(), Ie = n(45), Ee = n.n(Ie), pe = n(12), G = function() {
function V() {
}
return V.parse = function(E) {
var d = Object(m.c)(E), l = { seq_profile: Object(m.a)(d, 3), seq_level_idx_0: 0, seq_tier_0: 0, high_bitdepth: 0, twelve_bit: 0, monochrome: 0, chroma_subsampling_x: 0, chroma_subsampling_y: 0, chroma_sample_position: 0, initial_presentation_delay_present: 0, profile_string: "", level_string: "", chroma_format_string: "", bit_depth_luma: 8, width: 0, height: 0, codec: "", color_info: { colorRange: pe.b.AVCOL_RANGE_UNSPECIFIED, colourPrimaries: pe.a.AVCOL_PRI_UNSPECIFIED, transferCharacteristics: pe.d.AVCOL_TRC_UNSPECIFIED, matrixCoefficients: pe.c.AVCOL_SPC_UNSPECIFIED }, buffer_delay_length_minus_1: 0, frame_presentation_time_length_minus_1: 0, frame_id_numbers_present_flag: 0, reduced_still_picture_header: 0, decoder_model_info_present_flag: 0, equal_picture_interval: 0, delta_frame_id_length_minus_2: 0, additional_frame_id_length_minus_1: 0, data: E };
l.profile_string = function(xe) {
switch (xe) {
case 0:
return "Main";
case 1:
return "High";
case 2:
return "Professional";
default:
return "Unknown";
}
}(l.seq_profile), Object(m.a)(d, 1), l.reduced_still_picture_header = Object(m.a)(d, 1);
var f, b = 0, N = 0, H = [], S = [0], Y = [0], ce = [0];
if (l.reduced_still_picture_header)
H[0] = Object(m.a)(d, 5);
else {
Object(m.a)(d, 1) && (this.bn(d, l), l.decoder_model_info_present_flag = Object(m.a)(d, 1), l.decoder_model_info_present_flag && this.pn(d, l)), b = Object(m.a)(d, 1), N = Object(m.a)(d, 5);
for (var Ae = 0; Ae <= N; Ae++)
Object(m.a)(d, 12), H[Ae] = Object(m.a)(d, 5), H[Ae] > 7 ? S[Ae] = Object(m.a)(d, 1) : S[Ae] = 0, l.decoder_model_info_present_flag ? (Y[Ae] = Object(m.a)(d, 1), Y[Ae] && this.mn(d, l, Ae)) : Y[Ae] = 0, b && (ce[Ae] = Object(m.a)(d, 1), ce[Ae] && Object(m.a)(d, 4));
}
l.seq_level_idx_0 = H[0], l.seq_tier_0 = S[0], l.level_string = (f = H[0]) > 31 || f < 0 ? "Unknown" : f > 23 ? "Reserved" : 2 + (f >> 2) + "." + (3 & f);
var _e = Object(m.a)(d, 4), me = Object(m.a)(d, 4), Ce = Object(m.a)(d, _e + 1), Me = Object(m.a)(d, me + 1);
l.width = Ce + 1, l.height = Me + 1, l.frame_id_numbers_present_flag = l.reduced_still_picture_header ? 0 : Object(m.a)(d, 1), l.frame_id_numbers_present_flag && (l.delta_frame_id_length_minus_2 = Object(m.a)(d, 4), l.additional_frame_id_length_minus_1 = Object(m.a)(d, 3)), Object(m.a)(d, 3);
var Ge = 0;
return l.reduced_still_picture_header || (Object(m.a)(d, 4), (Ge = Object(m.a)(d, 1)) && Object(m.a)(d, 2), (Object(m.a)(d, 1) || Object(m.a)(d, 1)) && Object(m.a)(d, 1) || Object(m.a)(d, 1), Ge && Object(m.a)(d, 3)), Object(m.a)(d, 3), this.gn(d, l), Object(m.a)(d, 1), l.codec = "av01." + l.seq_profile + "." + ("0" + l.seq_level_idx_0).slice(-2) + (l.seq_tier_0 ? "H" : "M") + "." + ("0" + l.bit_depth_luma).slice(-2), l.chroma_format_string = function(xe) {
return xe.chroma_subsampling_x === 0 && xe.chroma_subsampling_y === 0 ? "4:4:4" : xe.chroma_subsampling_x === 1 && xe.chroma_subsampling_y === 0 ? "4:2:2" : xe.chroma_subsampling_x === 1 && xe.chroma_subsampling_y === 1 ? "4:2:0" : "Unknown";
}(l), l;
}, V.bn = function(E, d) {
Object(m.a)(E, 32), Object(m.a)(E, 32), d.equal_picture_interval = Object(m.a)(E, 1), d.equal_picture_interval && Object(m.i)(E);
}, V.pn = function(E, d) {
d.buffer_delay_length_minus_1 = Object(m.a)(E, 5), d.num_units_in_decoding_tick = Object(m.a)(E, 32), d.buffer_removal_time_length_minus_1 = Object(m.a)(E, 5), d.frame_presentation_time_length_minus_1 = Object(m.a)(E, 5);
}, V.mn = function(E, d, l) {
var f = d.buffer_delay_length_minus_1 + 1;
d.decoder_buffer_delay || (d.decoder_buffer_delay = []), d.decoder_buffer_delay[l] = Object(m.a)(E, f), d.encoder_buffer_delay || (d.encoder_buffer_delay = []), d.encoder_buffer_delay[l] = Object(m.a)(E, f), d.low_delay_mode_flag || (d.low_delay_mode_flag = []), d.low_delay_mode_flag[l] = Object(m.a)(E, f);
}, V.gn = function(E, d) {
d.high_bitdepth = Object(m.a)(E, 1), d.seq_profile === 2 && d.high_bitdepth ? (d.twelve_bit = Object(m.a)(E, 1), d.bit_depth_luma = d.twelve_bit ? 12 : 10) : d.seq_profile < 2 && (d.bit_depth_luma = d.high_bitdepth ? 10 : 8), d.seq_profile === 1 ? d.monochrome = 0 : d.monochrome = Object(m.a)(E, 1), Object(m.a)(E, 1) ? (d.color_info.colourPrimaries = Object(m.a)(E, 8), d.color_info.transferCharacteristics = Object(m.a)(E, 8), d.color_info.matrixCoefficients = Object(m.a)(E, 8)) : (d.color_info.colourPrimaries = pe.a.AVCOL_PRI_UNSPECIFIED, d.color_info.transferCharacteristics = pe.d.AVCOL_TRC_UNSPECIFIED, d.color_info.matrixCoefficients = pe.c.AVCOL_SPC_UNSPECIFIED), d.chroma_subsampling_x = 1, d.chroma_subsampling_y = 1, d.monochrome ? d.color_info.colorRange = Object(m.a)(E, 1) + 1 : (d.color_info.colourPrimaries === pe.a.AVCOL_PRI_BT709 && d.color_info.transferCharacteristics === pe.d.AVCOL_TRC_IEC61966_2_1 && d.color_info.matrixCoefficients === pe.c.AVCOL_SPC_RGB ? (d.color_info.colorRange = 1, d.chroma_subsampling_x = 0, d.chroma_subsampling_y = 0) : (d.color_info.colorRange = Object(m.a)(E, 1) + 1, d.seq_profile === 0 ? (d.chroma_subsampling_x = 1, d.chroma_subsampling_y = 1) : d.seq_profile === 1 ? (d.chroma_subsampling_x = 0, d.chroma_subsampling_y = 0) : d.bit_depth_luma === 12 ? (d.chroma_subsampling_x = Object(m.a)(E, 1), d.chroma_subsampling_x ? d.chroma_subsampling_y = Object(m.a)(E, 1) : d.chroma_subsampling_y = 0) : (d.chroma_subsampling_x = 1, d.chroma_subsampling_y = 0), d.chroma_subsampling_x && d.chroma_subsampling_y && Object(m.a)(E, 2)), Object(m.a)(E, 1));
}, V;
}();
function te(V, E) {
var d = Object.keys(V);
if (Object.getOwnPropertySymbols) {
var l = Object.getOwnPropertySymbols(V);
E && (l = l.filter(function(f) {
return Object.getOwnPropertyDescriptor(V, f).enumerable;
})), d.push.apply(d, l);
}
return d;
}
function ie(V) {
for (var E = 1; E < arguments.length; E++) {
var d = arguments[E] != null ? arguments[E] : {};
E % 2 ? te(Object(d), !0).forEach(function(l) {
Ee()(V, l, d[l]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(V, Object.getOwnPropertyDescriptors(d)) : te(Object(d)).forEach(function(l) {
Object.defineProperty(V, l, Object.getOwnPropertyDescriptor(d, l));
});
}
return V;
}
var ee = function() {
function V() {
}
return V.createCtx = function() {
return { seenFrameHeader: 0, ref: [] };
}, V.parseOBU = function(E, d) {
for (var l = [], f = 0; f < E.byteLength; ) {
var b = E.subarray(f), N = this.yn(b), H = 0, S = N.obu_extension_flag + 1, Y = Object(m.c)(b);
Object(m.g)(Y, 8 * S), H = N.obu_has_size_field ? Object(m.e)(Y) : b.length - S;
var ce = Y.byteIndex, Ae = ie(ie({}, N), {}, { data: b.subarray(0, ce + H) });
N.obu_type === we.AV1_OBU_SEQUENCE_HEADER ? (Ae.content = G.parse(Ae.data.subarray(ce)), d.sh = Ae.content = G.parse(Ae.data.subarray(ce))) : N.obu_type === we.AV1_OBU_FRAME_HEADER ? (d.seenFrameHeader = 0, this._n(Ae.data.subarray(ce), d)) : N.obu_type === we.AV1_OBU_REDUNDANT_FRAME_HEADER ? d.seenFrameHeader = 1 : N.obu_type === we.AV1_OBU_TEMPORAL_DELIMITER ? d.seenFrameHeader = 0 : N.obu_type === we.AV1_OBU_FRAME && (d.seenFrameHeader = 0, Ae.content = this.Cn(Ae.data.subarray(ce), d)), l.push(Ae), f += ce + H;
}
return l;
}, V.yn = function(E) {
var d = { obu_forbidden_bit: E[0] >> 7, obu_type: E[0] >> 3 & 15, obu_extension_flag: E[0] >> 2 & 1, obu_has_size_field: E[0] >> 1 & 1 };
return d.obu_extension_flag && (d.temporal_id = E[1] >> 5, d.spatial_id = E[1] >> 3 & 3), d;
}, V._n = function(E, d) {
var l = Object(m.c)(E);
d.seenFrameHeader ? d.frame = { keyframe: !1, show_existing_frame: 0 } : (d.seenFrameHeader = 1, d.frame = { keyframe: !1, show_existing_frame: 0 }, this.In(l, d), d.frame.show_existing_frame ? d.seenFrameHeader = 0 : d.seenFrameHeader = 1);
}, V.Cn = function(E, d) {
return this._n(E, d), d.frame;
}, V.In = function(E, d) {
var l = d.sh;
if (l) {
var f = je.INTER_FRAME;
if (l.reduced_still_picture_header)
f = je.KEY_FRAME;
else {
if (Object(m.a)(E, 1) == 1)
return void Object(m.a)(E, 3);
f = Object(m.a)(E, 2);
}
d.frame && (d.frame.keyframe = f === je.KEY_FRAME);
}
}, V.On = function(E, d) {
var l = d.frame_presentation_time_length_minus_1 + 1;
Object(m.a)(E, l);
}, V;
}(), Te = function() {
function V() {
}
return V.parse = function(E, d) {
d === void 0 && (d = !0);
var l = {}, f = new DataView(E.buffer, E.byteOffset).getUint32(0) !== (d ? 525030175 : 2113995134), b = 6, N = new Uint8Array(1024);
N.set(E.slice(0, 6), 0);
for (var H = E.byteLength, S = [E[H - 2], E[H - 1]], Y = 6; Y < H; ) {
var ce = E[Y];
S[0] === 0 && S[1] === 0 && ce === 3 || (N[b++] = ce), S[0] = S[1], S[1] = ce, ++Y;
}
for (var Ae = 6, _e = new DataView(N.buffer); Ae < b; ) {
var me = Ae, Ce = _e.getUint16(me, f);
me += 2;
var Me = _e.getUint16(me, f);
me += 2;
var Ge = _e.getUint16(me, f);
if (me += 2, V.wn(_e, l, me, Ge, Ce, Me, f), me += Ge, Ae += Me, !Me)
break;
}
return l;
}, V.wn = function(E, d, l, f, b, N, H) {
var S = V.En(E, l, f);
switch (l += f, b) {
case 1:
break;
case 2:
d[S] = V.En(E, l, N - 4);
break;
case 3:
d[S] = E.getUint32(l, H);
break;
case 4:
var Y = E.getUint32(l + 4, H), ce = E.getUint32(l, H);
d[S] = Math.pow(2, 32) * Y + ce;
break;
case 5:
d[S] = E.getFloat32(l, H);
break;
case 6:
d[S] = E.getFloat64(l, H);
}
}, V.En = function(E, d, l) {
for (var f = "", b = d; b < d + l; b++)
f += String.fromCharCode(E.getUint8(b));
return f;
}, V;
}();
function Se(V) {
for (var E, d = V.byteLength, l = [], f = 1; f < d - 2; )
V[f] === 0 && V[f + 1] === 0 && V[f + 2] === 3 ? (l.push(f + 2), f += 2) : f++;
if (l.length === 0)
return V;
E = d - l.length;
var b = new Uint8Array(E), N = 0;
for (f = 0; f < E; N++, f++)
N === l[0] && (N++, l.shift()), b[f] = V[N];
return b;
}
var Ye = function() {
function V() {
}
return V.parse = function(E) {
var d = [];
try {
for (var l = Se(E), f = 0; f < l.length - 1; ) {
var b = 0, N = 0, H = 0;
do
b = l[f], f++, N += b;
while (b === 255);
do
b = l[f], f++, H += b;
while (b === 255);
if (N === 251) {
var S = Object(q.f)(l, f + 1), Y = l.subarray(f + 3, f + 3 + S);
d.push({ type: N, data: Y });
} else {
var ce = l.subarray(f, f + H);
d.push({ type: N, data: ce });
}
f += H;
}
} catch (Ae) {
}
return d;
}, V;
}();
function ze(V) {
switch (V) {
case 1:
return "4:2:0";
case 2:
return "4:2:2";
case 3:
return "4:4:4";
default:
return "Unknown";
}
}
var it = { 1: "Main", 2: "Main 10", 3: "Main Still Picture", 4: "Rext" }, ct = { 30: "1", 60: "2", 63: "2.1", 90: "3", 93: "3.1", 120: "4", 123: "4.1", 150: "5", 153: "5.1", 156: "5.2", 180: "6", 183: "6.1", 186: "6.2", 255: "8.5" }, nt = n(16), zt = function() {
function V() {
}
return V.parse = function(E) {
var d = Se(E), l = Object(m.c)(d);
Object(m.a)(l, 8);
var f = { pps_id: 0, sps_id: 0, cabac: 0, pic_order_present: 0, slice_group_count: 0, mb_slice_group_map_type: 0, ref_count: [], weighted_pred: 0, weighted_bipred_idc: 0, chroma_qp_index_offset: [], deblocking_filter_parameters_present: 0, constrained_intra_pred: 0, redundant_pic_cnt_present: 0, transform_8x8_mode: 0, data: new Uint8Array(E) };
return f.pps_id = Object(m.h)(l), f.sps_id = Object(m.h)(l), f.cabac = Object(m.a)(l, 1), f.pic_order_present = Object(m.a)(l, 1), f.slice_group_count = Object(m.h)(l) + 1, f.slice_group_count > 1 && Object(m.h)(l), f.ref_count[0] = Object(m.h)(l) + 1, f.ref_count[1] = Object(m.h)(l) + 1, f.weighted_pred = Object(m.a)(l, 1), f.weighted_bipred_idc = Object(m.a)(l, 2), Object(m.f)(l), Object(m.f)(l), f.chroma_qp_index_offset[0] = Object(m.f)(l), f.deblocking_filter_parameters_present = Object(m.a)(l, 1), f.constrained_intra_pred = Object(m.a)(l, 1), f.redundant_pic_cnt_present = Object(m.a)(l, 1), f.transform_8x8_mode = 0, f;
}, V;
}(), bt = function() {
function V() {
}
return V.parse = function(E) {
var d = Se(E), l = Object(m.c)(d);
Object(m.g)(l, 8);
var f = Object(m.a)(l, 8);
Object(m.g)(l, 8);
var b = Object(m.a)(l, 8), N = Object(m.h)(l), H = function(yn) {
switch (yn) {
case 66:
return "Baseline";
case 77:
return "Main";
case 88:
return "Extended";
case 100:
return "High";
case 110:
return "High10";
case 122:
return "High422";
case 244:
return "High444";
default:
return "Unknown";
}
}(f), S = function(yn) {
return yn < 0 ? "Unknown" : (yn / 10).toFixed(1);
}(b), Y = 1, ce = 8, Ae = 8;
if ((f === 100 || f === 110 || f === 122 || f === 244 || f === 44 || f === 83 || f === 86 || f === 118 || f === 128 || f === 138 || f === 144) && ((Y = Object(m.h)(l)) === 3 && Object(m.a)(l, 1), ce = Object(m.h)(l) + 8, Ae = Object(m.h)(l) + 8, Object(m.a)(l, 1), Object(m.a)(l, 1)))
for (var _e = Y !== 3 ? 8 : 12, me = 0; me < _e; me++)
Object(m.a)(l, 1) && (me < 6 ? V.jn(l, 16) : V.jn(l, 64));
var Ce = Object(m.h)(l) + 4, Me = Object(m.h)(l), Ge = 0, xe = 0, Ze = 0, $e = 0, et = 0, st = [];
if (Me === 0)
Ge = Object(m.h)(l) + 4;
else if (Me === 1) {
xe = Object(m.a)(l, 1), $e = Object(m.f)(l), et = Object(m.f)(l), Ze = Object(m.h)(l);
for (var Ke = 0; Ke < Ze; Ke++)
st[Ke] = Object(m.f)(l);
}
var Tt = Object(m.h)(l);
Object(m.a)(l, 1);
var It = Object(m.h)(l) + 1, ut = Object(m.h)(l) + 1, Et = Object(m.a)(l, 1);
Et === 0 && Object(m.a)(l, 1), Object(m.a)(l, 1);
var ft = 0, Lt = 0, Wt = 0, Yt = 0;
Object(m.a)(l, 1) && (ft = Object(m.h)(l), Lt = Object(m.h)(l), Wt = Object(m.h)(l), Yt = Object(m.h)(l));
var hi = { width: 1, height: 1 }, Qi = 0, Xi = !0, Ci = 0, Xr = 0, Ji = pe.b.AVCOL_RANGE_UNSPECIFIED, an = pe.a.AVCOL_PRI_UNSPECIFIED, Fr = pe.d.AVCOL_TRC_UNSPECIFIED, $r = pe.c.AVCOL_SPC_UNSPECIFIED;
if (Object(m.a)(l, 1)) {
if (Object(m.a)(l, 1)) {
var jr = Ue(l);
jr && (hi = jr);
}
if (Object(m.a)(l, 1) && Object(m.a)(l, 1), Object(m.a)(l, 1) && (Object(m.a)(l, 3), Ji = Object(m.a)(l, 1) ? pe.b.AVCOL_RANGE_JPEG : pe.b.AVCOL_RANGE_MPEG, Object(m.a)(l, 1) && (an = Object(m.a)(l, 8), Fr = Object(m.a)(l, 8), $r = Object(m.a)(l, 8))), Object(m.a)(l, 1) && (Object(m.h)(l), Object(m.h)(l)), Object(m.a)(l, 1)) {
var $i = Object(m.a)(l, 32), Si = Object(m.a)(l, 32);
Xi = !!Object(m.a)(l, 1), Qi = (Ci = Si) / (Xr = 2 * $i);
}
}
var nr = 0, sn = 0;
Y === 0 ? (nr = 1, sn = 2 - Et) : (nr = Y === 3 ? 1 : 2, sn = (Y === 1 ? 2 : 1) * (2 - Et));
var on = 16 * It, Ti = 16 * ut * (2 - Et);
on -= (ft + Lt) * nr, Ti -= (Wt + Yt) * sn;
for (var ma = E.subarray(1, 4), Xa = "avc1.", ia = 0; ia < 3; ia++) {
var Hn = ma[ia].toString(16);
Hn.length < 2 && (Hn = "0" + Hn), Xa += Hn;
}
return { sps_id: N, profile_string: H, level_string: S, bit_depth_luma: ce, bit_depth_chroma: Ae, chroma_format_idc: Y, chroma_format_string: ze(Y), frame_rate: { fixed: Xi, fps: Qi, fps_den: Xr, fps_num: Ci }, sar: hi, codec_size: { width: on, height: Ti }, color_info: { colorRange: Ji, colourPrimaries: an, transferCharacteristics: Fr, matrixCoefficients: $r }, codec: Xa, pic_order_cnt_type: Me, log2_max_frame_num: Ce, log2_max_poc_lsb: Ge, frame_mbs_only_flag: Et, delta_pic_order_always_zero_flag: xe, num_ref_frames_in_pic_order_cnt_cycle: Ze, offset_for_ref_frame: st, offset_for_non_ref_pic: $e, offset_for_top_to_bottom_field: et, ref_frame_count: Tt, data: new Uint8Array(E) };
}, V.jn = function(E, d) {
for (var l = 8, f = 8, b = 0; b < d; b++)
f !== 0 && (f = (l + Object(m.f)(E) + 256) % 256), l = f === 0 ? l : f;
}, V;
}(), Mt = function() {
function V() {
}
return V.parse = function(E) {
var d = Se(E), l = Object(m.c)(d);
Object(m.g)(l, 16);
var f = { pps_id: Object(m.h)(l), sps_id: Object(m.h)(l), dependent_slice_segments_enabled_flag: Object(m.a)(l, 1), output_flag_present_flag: Object(m.a)(l, 1), num_extra_slice_header_bits: Object(m.a)(l, 3), sign_data_hiding_enabled_flag: Object(m.a)(l, 1), cabac_init_present_flag: Object(m.a)(l, 1), num_ref_idx_l0_default_active: Object(m.h)(l) + 1, num_ref_idx_l1_default_active: Object(m.h)(l) + 1, init_qp_minus26: Object(m.h)(l), constrained_intra_pred_flag: Object(m.a)(l, 1), transform_skip_enabled_flag: Object(m.a)(l, 1), tiles_enabled_flag: 0, entropy_coding_sync_enabled_flag: 0, data: new Uint8Array(E) };
return Object(m.a)(l, 1) && Object(m.h)(l), Object(m.f)(l), Object(m.f)(l), Object(m.g)(l, 4), f.tiles_enabled_flag = Object(m.a)(l, 1), f.entropy_coding_sync_enabled_flag = Object(m.a)(l, 1), f;
}, V;
}(), Kt = function() {
function V() {
}
return V.parsePTL = function(E, d, l) {
if (!this.kn(E, d.general_ptl) || Object(m.d)(E) < 8 + 16 * (l - 1 > 0 ? 1 : 0))
return !1;
var f;
d.general_ptl.level_idc = Object(m.a)(E, 8), d.general_ptl.level_string = (f = d.general_ptl.level_idc, ct[f] || "Unknown"), d.sub_layer_profile_present_flag = [], d.sub_layer_level_present_flag = [];
for (var b = 0; b < l - 1; b++)
d.sub_layer_profile_present_flag[b] = Object(m.a)(E, 1), d.sub_layer_level_present_flag[b] = Object(m.a)(E, 1);
if (l - 1 > 0)
for (var N = l - 1; N < 8; N++)
Object(m.a)(E, 2);
for (var H = 0; H < l - 1; H++) {
var S = d.sub_layer_ptl[H] = this.getPTLCommon();
if (d.sub_layer_profile_present_flag[H] && this.kn(E, S))
return !1;
if (d.sub_layer_level_present_flag[H]) {
if (Object(m.d)(E) < 8)
return !1;
S.level_idc = Object(m.a)(E, 8);
}
}
return !0;
}, V.getPTL = function() {
return { general_ptl: V.getPTLCommon(), sub_layer_ptl: [], sub_layer_profile_present_flag: [], sub_layer_level_present_flag: [] };
}, V.getPTLCommon = function() {
return { profile_space: 0, tier_flag: 0, profile_idc: 0, profile_compatibility: 0, profile_compatibility_flag: [], constraint_indicator: [], level_idc: 0, profile_string: "", level_string: "" };
}, V.kn = function(E, d) {
if (Object(m.d)(E) < 88)
return !1;
d.profile_space = Object(m.a)(E, 2), d.tier_flag = Object(m.a)(E, 1), d.profile_idc = Object(m.a)(E, 5), d.profile_compatibility_flag = [];
for (var l = 0; l < 32; l++)
d.profile_compatibility_flag[l] = Object(m.a)(E, 1), d.profile_compatibility = (d.profile_compatibility_flag[l] << 31 - l) + d.profile_compatibility, d.profile_idc == 0 && l > 0 && d.profile_compatibility_flag[l] && (d.profile_idc = l);
for (var f = 0; f < 6; f++)
d.constraint_indicator.push(Object(m.a)(E, 8));
var b;
return d.profile_string = (b = d.profile_idc, it[b] || "Unknown"), !0;
}, V;
}(), Xt = [1, 2, 2, 1], ni = [1, 2, 1, 1], wt = function() {
function V() {
}
return V.parse = function(E, d) {
d === void 0 && (d = X.c.hevc);
var l = Se(E), f = Object(m.c)(l), b = Kt.getPTL();
Object(m.g)(f, 16);
var N = Object(m.a)(f, 4), H = Object(m.a)(f, 3), S = H + 1;
Object(m.g)(f, 1);
var Y = { vps_id: N, sps_id: 0, chroma_format_idc: 0, chroma_format_string: "", profile_string: "", level_string: "", bit_depth_luma: 0, bit_depth_chroma: 0, fps: 0, width: 0, height: 0, conformance_window_flag: 0, codec: "", color_info: { colorRange: pe.b.AVCOL_RANGE_UNSPECIFIED, colourPrimaries: pe.a.AVCOL_PRI_UNSPECIFIED, transferCharacteristics: pe.d.AVCOL_TRC_UNSPECIFIED, matrixCoefficients: pe.c.AVCOL_SPC_UNSPECIFIED }, min_spatial_segmentation_idc: 0, log2_max_poc_lsb: 0, separate_colour_plane_flag: 0, log2_min_cb_size: 0, log2_diff_max_min_coding_block_size: 0, log2_min_tb_size: 0, log2_max_trafo_size: 0, log2_ctb_size: 0, ctb_width: 0, ctb_height: 0, temporal_layer: [], ptl: b, sar: { width: 1, height: 1 }, data: new Uint8Array(E) };
if (!Kt.parsePTL(f, b, S) || (Y.sps_id = Object(m.h)(f), Y.sps_id >= 16))
return Y;
var ce = Object(m.h)(f);
if (ce == 3 && Object(m.a)(f, 1) && (ce = 0), Y.width = Object(m.h)(f), Y.height = Object(m.h)(f), Y.conformance_window_flag = Object(m.a)(f, 1), Y.conformance_window_flag) {
var Ae = ni[ce], _e = Xt[ce];
Y.conf_win_left_offset = Object(m.h)(f), Y.conf_win_right_offset = Object(m.h)(f), Y.conf_win_top_offset = Object(m.h)(f), Y.conf_win_bottom_offset = Object(m.h)(f), Ae && _e && (Y.width = Y.width - (Y.conf_win_left_offset + Y.conf_win_right_offset) * _e, Y.height = Y.height - (Y.conf_win_top_offset + Y.conf_win_bottom_offset) * Ae);
}
Y.bit_depth_luma = Object(m.h)(f) + 8, Y.bit_depth_chroma = Object(m.h)(f) + 8, Y.log2_max_poc_lsb = Object(m.h)(f) + 4;
for (var me = Object(m.a)(f, 1) ? 0 : H; me <= H; me++)
Y.temporal_layer.push({ max_dec_pic_buffering: Object(m.h)(f) + 1 }), Object(m.h)(f), Object(m.h)(f);
Y.log2_min_cb_size = Object(m.h)(f) + 3, Y.log2_diff_max_min_coding_block_size = Object(m.h)(f), d !== X.c.kvc4 && d !== X.c.kvc5 && d !== X.c.kvc6 || Object(m.h)(f), d !== X.c.kvc3 && d !== X.c.kvc4 && d !== X.c.kvc5 && d !== X.c.kvc6 || Object(m.h)(f) && (Object(m.h)(f), Object(m.h)(f)), Y.log2_min_tb_size = Object(m.h)(f) + 2;
var Ce = Object(m.h)(f);
Y.log2_max_trafo_size = Ce + Y.log2_min_tb_size, Object(m.h)(f), Object(m.h)(f), Object(m.a)(f, 1) && Object(m.a)(f, 1) && this.skipScalingListData(f), Object(m.a)(f, 1), Object(m.a)(f, 1), Object(m.a)(f, 1) && (Object(m.a)(f, 4), Object(m.a)(f, 4), Object(m.h)(f), Object(m.h)(f), Object(m.a)(f, 1));
var Me = Object(m.h)(f);
if (Me > 64)
return Y;
for (var Ge = [], xe = 0; xe < Me; xe++)
if (this.parseRps(f, xe, Me, Ge) < 0)
return Y;
if (Object(m.a)(f, 1)) {
var Ze = Object(m.h)(f);
if (Ze > 31)
return Y;
for (me = 0; me < Ze; me++) {
var $e = Math.min(Y.log2_max_poc_lsb, 16);
Object(m.a)(f, $e), Object(m.a)(f, 1);
}
}
return Object(m.a)(f, 1), Object(m.a)(f, 1), Object(m.a)(f, 1) && this.hvccParseVui(f, Y, H), Y.log2_ctb_size = Y.log2_min_cb_size + Y.log2_diff_max_min_coding_block_size, Y.ctb_width = Y.width + (1 << Y.log2_ctb_size) - 1 >> Y.log2_ctb_size, Y.ctb_height = Y.height + (1 << Y.log2_ctb_size) - 1 >> Y.log2_ctb_size, Y.chroma_format_idc = ce, Y.chroma_format_string = ce === 3 ? "4:4:4" : "4:2:0", Y.profile_string = b.general_ptl.profile_string, Y.level_string = b.general_ptl.level_string, Y.codec = this.getCodec(b.general_ptl, d), Y;
}, V.getCodec = function(E, d) {
d === void 0 && (d = X.c.hevc);
for (var l = Math.abs(E.profile_compatibility).toString(16); l.length > 1; ) {
var f = l.length - 1;
if (l.charAt(f) !== "0")
break;
l = l.slice(0, f);
}
for (var b = "", N = !1, H = 5; H >= 0; H--)
(E.constraint_indicator[H] || N) && (b = "." + E.constraint_indicator[H].toString(16) + b, N = !0);
return (d === X.c.hevc ? "hev1" : d) + "." + ["", "A", "B", "C"][E.profile_space] + E.profile_idc + "." + l + "." + (E.tier_flag === 0 ? "L" : "H") + E.level_idc + b;
}, V.getGeneralPTL = function() {
return { profile_space: 0, tier_flag: 0, profile_idc: 0, profile_compatibility: 0, profile_compatibility_flag: [], constraint_indicator: [], level_idc: 0, profile_string: "", level_string: "" };
}, V.skipScalingListData = function(E) {
var d, l, f, b;
for (d = 0; d < 4; d++)
for (l = 0; l < (d == 3 ? 2 : 6); l++)
if (Object(m.a)(E, 1))
for (b = Math.min(64, 1 << 4 + (d << 1)), d > 1 && Object(m.f)(E), f = 0; f < b; f++)
Object(m.f)(E);
else
Object(m.h)(E);
}, V.parseRps = function(E, d, l, f) {
var b;
if (d && Object(m.a)(E, 1)) {
if (d >= l)
return -1;
for (Object(m.a)(E, 1), Object(m.h)(E), f[d] = 0, b = 0; b <= f[d - 1]; b++) {
var N = 0, H = Object(m.a)(E, 1);
H || (N = Object(m.a)(E, 1)), (H || N) && f[d]++;
}
} else {
var S = Object(m.h)(E), Y = Object(m.h)(E);
if (2 * (Y + S) > Object(m.d)(E))
return -1;
for (f[d] = S + Y, b = 0; b < S; b++)
Object(m.h)(E), Object(m.a)(E, 1);
for (b = 0; b < Y; b++)
Object(m.h)(E), Object(m.a)(E, 1);
}
return 0;
}, V.hvccParseVui = function(E, d, l) {
var f;
if (Object(m.a)(E, 1)) {
var b = Ue(E);
b && (d.sar = b);
}
Object(m.a)(E, 1) && Object(m.a)(E, 1), Object(m.a)(E, 1) && (Object(m.a)(E, 3), d.color_info.colorRange = Object(m.a)(E, 1) ? pe.b.AVCOL_RANGE_JPEG : pe.b.AVCOL_RANGE_MPEG, Object(m.a)(E, 1) && (d.color_info.colourPrimaries = Object(m.a)(E, 8), d.color_info.transferCharacteristics = Object(m.a)(E, 8), d.color_info.matrixCoefficients = Object(m.a)(E, 8))), Object(m.a)(E, 1) && (Object(m.h)(E), Object(m.h)(E)), Object(m.a)(E, 3), Object(m.a)(E, 1) && (Object(m.h)(E), Object(m.h)(E), Object(m.h)(E), Object(m.h)(E)), Object(m.a)(E, 1) && (this.parseTimingInfo(E, d), Object(m.a)(E, 1) && this.skipHrdParameters(E, 1, l)), Object(m.a)(E, 1) && (Object(m.a)(E, 3), f = Object(m.h)(E), d.min_spatial_segmentation_idc = Math.min(d.min_spatial_segmentation_idc, f), Object(m.h)(E), Object(m.h)(E), Object(m.h)(E), Object(m.h)(E));
}, V.parseTimingInfo = function(E, d) {
var l = Object(m.a)(E, 32), f = Object(m.a)(E, 32);
d.fps = f / l || 0, Object(m.a)(E, 1) && Object(m.h)(E);
}, V.skipHrdParameters = function(E, d, l) {
var f, b = 0, N = 0, H = 0;
for (d && (N = Object(m.a)(E, 1), H = Object(m.a)(E, 1), (N || H) && ((b = Object(m.a)(E, 1)) && Object(m.a)(E, 19), Object(m.a)(E, 8), b && Object(m.a)(E, 4), Object(m.a)(E, 15))), f = 0; f <= l; f++) {
var S = 0, Y = 0, ce = 0;
if (Object(m.a)(E, 1) || (ce = Object(m.a)(E, 1)), ce ? Object(m.h)(E) : Y = Object(m.a)(E, 1), !Y && (S = Object(m.h)(E)) > 31)
return -1;
N && this.Mn(E, S, b), H && this.Mn(E, S, b);
}
return 0;
}, V.Mn = function(E, d, l) {
var f;
for (f = 0; f <= d; f++)
Object(m.h)(E), Object(m.h)(E), l && (Object(m.h)(E), Object(m.h)(E)), Object(m.a)(E, 1);
}, V;
}(), pt = "vps-parser", ri = function() {
function V() {
}
return V.parse = function(E, d) {
var l = Se(d), f = Object(m.c)(l);
Object(m.g)(f, 16);
var b = { vps_id: Object(m.a)(f, 4), fps: 0, ptl: Kt.getPTL(), data: new Uint8Array(d) };
if (b.vps_id >= 16)
return E.i(pt, "VPS id out of range:", b.vps_id), b;
if (Object(m.a)(f, 2) !== 3)
return E.i(pt, "vps_reserved_three_2bits is not three"), b;
Object(m.g)(f, 6);
var N = Object(m.a)(f, 3);
if (Object(m.g)(f, 1), Object(m.a)(f, 16) != 65535)
return E.i(pt, `vps_reserved_ffff_16bits is not 0xffff
`), b;
if (N > 7)
return E.i(pt, "vps_max_sub_layers out of range: ", N), b;
if (!Kt.parsePTL(f, b.ptl, N))
return b;
for (var H = Object(m.a)(f, 1) ? 0 : N - 1; H < N; H++)
Object(m.h)(f), Object(m.h)(f), Object(m.h)(f);
var S = Object(m.a)(f, 6), Y = Object(m.h)(f) + 1;
if (Y < 1 || Y > 1024 || (Y - 1) * (S + 1) > Object(m.d)(f))
return E.i(pt, "too many layer_id_included_flags"), b;
for (H = 1; H < Y; H++)
for (var ce = 0; ce <= S; ce++)
Object(m.a)(f, 1);
if (Object(m.a)(f, 1)) {
var Ae = Object(m.a)(f, 32), _e = Object(m.a)(f, 32);
b.fps = _e / Ae || 0;
}
return b;
}, V;
}(), yi = function() {
function V() {
}
return V.parse = function(E) {
var d = Se(E), l = Object(m.c)(d);
Object(m.g)(l, 16);
var f = { data: new Uint8Array(E), pps_id: Object(m.a)(l, 6), sps_id: Object(m.a)(l, 4), width: 0, height: 0 };
Object(m.a)(l, 1), f.width = Object(m.h)(l), f.height = Object(m.h)(l), Object(m.a)(l, 1) && (f.pps_conf_win_left_offset = Object(m.h)(l), f.pps_conf_win_right_offset = Object(m.h)(l), f.pps_conf_win_top_offset = Object(m.h)(l), f.pps_conf_win_bottom_offset = Object(m.h)(l)), Object(m.a)(l, 1) && (Object(m.f)(l), Object(m.f)(l), Object(m.f)(l), Object(m.f)(l)), Object(m.a)(l, 1);
var b = Object(m.a)(l, 1);
if (Object(m.a)(l, 1)) {
var N = 0;
b || (N = Object(m.h)(l));
for (var H = Object(m.h)(l), S = 0; S <= N; S++)
Object(m.g)(l, H + 1);
}
return f;
}, V;
}(), Li = n(36), vi = function() {
function V() {
}
return V.parse = function(E) {
var d = Se(E), l = Object(m.c)(d);
Object(m.g)(l, 16);
var f = { data: new Uint8Array(E), sps_id: Object(m.a)(l, 4), vps_id: Object(m.a)(l, 4), max_sublayers_minus1: Object(m.a)(l, 3), chroma_format_idc: Object(m.a)(l, 2), chroma_format_string: "", level_idc: 0, level_string: "", profile_idc: 0, profile_string: "", width: 0, height: 0, bitdepth: 8, fps: 0, general_nal_hrd_params_present_flag: 0, general_vcl_hrd_params_present_flag: 0, general_du_hrd_params_present_flag: 0, hrd_cpb_cnt_minus1: 0, sps_num_ref_pic_lists: [], sps_long_term_ref_pics_flag: 0, sps_inter_layer_prediction_enabled_flag: 0, sps_log2_max_pic_order_cnt_lsb_minus4: 0, sps_weighted_pred_flag: 0, sps_weighted_bipred_flag: 0, codec: "vvc", color_info: { colorRange: pe.b.AVCOL_RANGE_UNSPECIFIED, colourPrimaries: pe.a.AVCOL_PRI_UNSPECIFIED, transferCharacteristics: pe.d.AVCOL_TRC_UNSPECIFIED, matrixCoefficients: pe.c.AVCOL_SPC_UNSPECIFIED } };
f.chroma_format_string = Object(Li.a)(f.chroma_format_idc);
var b = 1 << Object(m.a)(l, 2) + 5, N = Object(m.a)(l, 1);
if (N && this.Sn(l, f, 1, f.max_sublayers_minus1), Object(m.a)(l, 1), Object(m.a)(l, 1) && Object(m.g)(l, 1), f.width = Object(m.h)(l), f.height = Object(m.h)(l), Object(m.a)(l, 1) && (f.conf_win_left_offset = Object(m.h)(l), f.conf_win_right_offset = Object(m.h)(l), f.conf_win_top_offset = Object(m.h)(l), f.conf_win_bottom_offset = Object(m.h)(l)), Object(m.a)(l, 1)) {
var H = Math.floor(f.width / b) + 1, S = Math.floor(f.height / b) + 1, Y = Object(m.h)(l), ce = 0, Ae = 0;
Y > 0 && (Ae = Object(m.a)(l, 1), ce = Object(m.a)(l, 1));
for (var _e = 0; Y > 0 && _e <= Y; _e++)
ce && _e !== 0 || (_e > 0 && f.width > b && Object(m.g)(l, H), _e > 0 && f.height > b && Object(m.g)(l, S), _e < Y && f.width > b && Object(m.g)(l, H), _e < Y && f.height > b && Object(m.g)(l, S)), Ae || (Object(m.g)(l, 1), Object(m.g)(l, 1));
var me = Object(m.h)(l);
if (Object(m.a)(l, 1) && Object(m.a)(l, 1))
for (var Ce = 0; Ce <= Y; Ce++)
Object(m.g)(l, me + 1);
}
f.bitdepth = Object(m.h)(l) + 8, Object(m.a)(l, 2), f.sps_log2_max_pic_order_cnt_lsb_minus4 = Object(m.a)(l, 4), Object(m.a)(l, 1) && Object(m.h)(l);
var Me = Object(m.a)(l, 2);
Object(m.g)(l, 8 * Me);
var Ge = Object(m.a)(l, 2);
if (Object(m.g)(l, 8 * Ge), N) {
var xe = 0;
f.max_sublayers_minus1 > 0 && (xe = Object(m.a)(l, 1)), this.Bn(l, f.max_sublayers_minus1, xe);
}
Object(m.h)(l), Object(m.a)(l, 1), Object(m.h)(l), Object(m.h)(l) != 0 && (Object(m.h)(l), Object(m.h)(l));
var Ze = 0;
f.chroma_format_idc != 0 && (Ze = Object(m.a)(l, 1)), Ze && (Object(m.h)(l), Object(m.h)(l) != 0 && (Object(m.h)(l), Object(m.h)(l))), Object(m.h)(l), Object(m.h)(l) != 0 && (Object(m.h)(l), Object(m.h)(l));
var $e = 0;
b > 32 && ($e = Object(m.a)(l, 1));
var et = Object(m.a)(l, 1);
et && (Object(m.h)(l), Object(m.g)(l, 1)), Object(m.a)(l, 1) && Object(m.g)(l, 2);
var st = Object(m.a)(l, 1);
if (f.chroma_format_idc != 0)
for (var Ke = Object(m.a)(l, 1), Tt = Object(m.a)(l, 1) ? 1 : Ke ? 3 : 2, It = [], ut = 0; ut < Tt; ut++) {
Object(m.f)(l), It[ut] = Object(m.h)(l);
for (var Et = 0; Et <= It[ut]; Et++)
Object(m.h)(l), Object(m.h)(l);
}
Object(m.a)(l, 1), Object(m.a)(l, 1) && f.chroma_format_idc != 0 && Object(m.g)(l, 1), Object(m.a)(l, 1), f.sps_weighted_pred_flag = Object(m.a)(l, 1), f.sps_weighted_bipred_flag = Object(m.a)(l, 1), f.sps_long_term_ref_pics_flag = Object(m.a)(l, 1), f.vps_id > 0 && (f.sps_inter_layer_prediction_enabled_flag = Object(m.a)(l, 1)), Object(m.a)(l, 1);
for (var ft = Object(m.a)(l, 1), Lt = 0; Lt < (ft ? 1 : 2); Lt++) {
f.sps_num_ref_pic_lists[Lt] = Object(m.h)(l);
for (var Wt = 0; Wt < f.sps_num_ref_pic_lists[Lt]; Wt++)
this.Tn(l, f, Lt, Wt);
}
Object(m.a)(l, 1), Object(m.a)(l, 1) && Object(m.g)(l, 1);
var Yt = Object(m.a)(l, 1);
Object(m.a)(l, 1) && Object(m.g)(l, 1), Object(m.a)(l, 1), Object(m.a)(l, 1) && Object(m.g)(l, 1), Object(m.a)(l, 1) && Object(m.g)(l, 1);
var hi = 6 - Object(m.h)(l);
Object(m.a)(l, 1), Object(m.a)(l, 1) && (Object(m.h)(l), Object(m.g)(l, 1), Yt && Object(m.g)(l, 1), Object(m.a)(l, 1) && Object(m.g)(l, 1)), Object(m.a)(l, 2), hi >= 2 && Object(m.a)(l, 1) && hi >= 3 && Object(m.h)(l), Object(m.h)(l), Object(m.a)(l, 3), f.chroma_format_idc != 0 && Object(m.g)(l, 1), f.chroma_format_idc === 1 && Object(m.g)(l, 2);
var Qi = Object(m.a)(l, 1), Xi = 0;
if (f.chroma_format_idc !== 3 || $e || (Xi = Object(m.a)(l, 1)), (et || Qi) && Object(m.h)(l), Object(m.a)(l, 1) && Object(m.h)(l), Object(m.a)(l, 1)) {
var Ci = Object(m.a)(l, 2);
Object(m.f)(l);
for (var Xr = 0; Xr < Ci + 1; Xr++)
Object(m.f)(l), Object(m.h)(l);
}
var Ji = Object(m.a)(l, 1);
st && Ji && Object(m.g)(l, 1);
var an = 0;
if (Xi && Ji && (an = Object(m.a)(l, 1)), an && Object(m.g)(l, 1), Object(m.a)(l, 2), Object(m.a)(l, 1) && Object(m.a)(l, 1)) {
for (var Fr = Object(m.h)(l), $r = 0; $r < Fr; $r++)
Object(m.h)(l);
for (var jr = Object(m.h)(l), $i = 0; $i < jr; $i++)
Object(m.h)(l);
}
if (N && Object(m.a)(l, 1)) {
this.Dn(l, f);
var Si = 0;
f.max_sublayers_minus1 > 0 && (Si = Object(m.a)(l, 1));
var nr = Si ? 0 : f.max_sublayers_minus1;
this.Rn(l, f, nr);
}
return Object(m.a)(l, 1), Object(m.a)(l, 1) && (Object(m.h)(l), Object(m.b)(l), this.Ln(l, f)), f;
}, V.Sn = function(E, d, l, f) {
l && (d.profile_idc = Object(m.a)(E, 7), d.profile_string = Object(Li.c)(d.profile_idc), Object(m.g)(E, 1)), d.level_idc = Object(m.a)(E, 8), d.level_string = Object(Li.b)(d.level_idc), Object(m.g)(E, 2), l && this.Nn(E);
for (var b = [], N = f - 1; N >= 0; N--)
b[N] = Object(m.a)(E, 1);
E.bitIndex && Object(m.g)(E, 8 - E.bitIndex);
for (var H = f - 1; H >= 0; H--)
b[H] && Object(m.g)(E, 1);
if (l)
for (var S = Object(m.a)(E, 8), Y = 0; Y < S; Y++)
Object(m.g)(E, 32);
}, V.Nn = function(E) {
if (Object(m.a)(E, 1)) {
Object(m.g)(E, 71);
var d = Object(m.a)(E, 8), l = 0;
d > 5 && (Object(m.g)(E, 6), l = 6), d > l && Object(m.g)(E, d - l);
}
E.bitIndex && Object(m.g)(E, 8 - E.bitIndex);
}, V.Bn = function(E, d, l) {
for (var f = l ? 0 : d; f <= d; f++)
Object(m.h)(E), Object(m.h)(E), Object(m.h)(E);
}, V.Tn = function(E, d, l, f) {
var b = Object(m.h)(E), N = 0;
d.sps_long_term_ref_pics_flag && f < d.sps_num_ref_pic_lists[l] && b > 0 && (N = Object(m.a)(E, 1));
for (var H = 0; H < b; H++) {
var S = 0;
if (d.sps_inter_layer_prediction_enabled_flag && (S = Object(m.a)(E, 1)), S)
Object(m.h)(E);
else {
var Y = 0;
if (d.sps_long_term_ref_pics_flag && (Y = Object(m.a)(E, 1)), Y) {
var ce = Object(m.h)(E);
((d.sps_weighted_pred_flag || d.sps_weighted_bipred_flag) && H != 0 ? ce : ce + 1) && Object(m.g)(E, 1);
} else
N && Object(m.g)(E, d.sps_log2_max_pic_order_cnt_lsb_minus4 + 4);
}
}
}, V.Dn = function(E, d) {
var l = Object(m.a)(E, 32), f = Object(m.a)(E, 32);
d.fps = f / l || 0, d.general_nal_hrd_params_present_flag = Object(m.a)(E, 1), d.general_vcl_hrd_params_present_flag = Object(m.a)(E, 1), (d.general_nal_hrd_params_present_flag || d.general_vcl_hrd_params_present_flag) && (Object(m.a)(E, 1), d.general_du_hrd_params_present_flag = Object(m.a)(E, 1), d.general_du_hrd_params_present_flag && Object(m.g)(E, 8), Object(m.g)(E, 8), d.general_du_hrd_params_present_flag && Object(m.g)(E, 4), d.hrd_cpb_cnt_minus1 = Object(m.h)(E));
}, V.Rn = function(E, d, l) {
for (var f = l; f <= d.max_sublayers_minus1; f++) {
var b = 0;
Object(m.a)(E, 1) || (b = Object(m.a)(E, 1)), b ? Object(m.h)(E) : (d.general_nal_hrd_params_present_flag || d.general_vcl_hrd_params_present_flag) && d.hrd_cpb_cnt_minus1 === 0 && Object(m.g)(E, 1), d.general_nal_hrd_params_present_flag && this.Qn(E, d), d.general_vcl_hrd_params_present_flag && this.Qn(E, d);
}
}, V.Qn = function(E, d) {
for (var l = 0; l <= d.hrd_cpb_cnt_minus1; l++)
Object(m.h)(E), Object(m.h)(E), d.general_du_hrd_params_present_flag && (Object(m.h)(E), Object(m.h)(E)), Object(m.g)(E, 1);
}, V.Ln = function(E, d) {
var l = Object(m.a)(E, 1), f = Object(m.a)(E, 1);
Object(m.a)(E, 2), Object(m.a)(E, 1) && Object(m.a)(E, 8) === 255 && Object(m.a)(E, 32), Object(m.a)(E, 1) && Object(m.a)(E, 1), Object(m.a)(E, 1) && (d.color_info.colourPrimaries = Object(m.a)(E, 8), d.color_info.transferCharacteristics = Object(m.a)(E, 8), d.color_info.matrixCoefficients = Object(m.a)(E, 8), d.color_info.colorRange = Object(m.a)(E, 1) ? pe.b.AVCOL_RANGE_JPEG : pe.b.AVCOL_RANGE_MPEG), Object(m.a)(E, 1) && (l && !f || Object(m.h)(E), Object(m.h)(E));
}, V;
}(), Ui = function() {
function V() {
}
return V.parse = function(E) {
var d = Se(E), l = Object(m.c)(d);
return Object(m.g)(l, 16), { vps_id: Object(m.a)(l, 4), data: new Uint8Array(E) };
}, V;
}(), xt = "video-config", Ct = function() {
function V() {
}
return V.isParamSetsReady = function(E) {
return "nalus" in E ? !(!E.nalus || !E.nalus.length) : !!E.spsList.length;
}, V.parseAV1C = function(E, d, l) {
var f;
E.i(xt, "parse av1c");
var b = (f = ee.parseOBU(d.subarray(4), l)[0]) == null ? void 0 : f.content;
return { marker: d[0] >> 7 & 1, version: 127 & d[0], seq_profile: d[1] >> 5 & 7, seq_level_idx_0: 31 & d[1], seq_tier_0: d[2] >> 7 & 1, high_bitdepth: d[2] >> 6 & 1, twelve_bit: d[2] >> 5 & 1, monochrome: d[2] >> 4 & 1, chroma_subsampling_x: d[2] >> 3 & 1, chroma_subsampling_y: d[2] >> 2 & 1, chroma_sample_position: 3 & d[2], initial_presentation_delay_present: d[3] >> 4 & 1, sh: b };
}, V.parseAVCC = function(E, d) {
var l = d[0], f = d[1], b = d[2], N = d[3];
if (l === 1 && f !== 0) {
var H = 1 + (3 & d[4]);
if (H === 3 || H === 4) {
var S = 31 & d[5];
if (S !== 0) {
S > 1 && E.w(xt, "H264 SPS count: " + S);
for (var Y, ce, Ae = 6, _e = [], me = [], Ce = 0; Ce < S; Ce++) {
var Me = Object(q.f)(d, Ae);
if (Ae += 2, Me !== 0) {
var Ge = d.subarray(Ae, Ae + Me);
Ae += Me, _e[(Y = bt.parse(Ge)).sps_id] = Y;
}
}
var xe = d[Ae];
if (typeof xe == "number") {
if (xe !== 0) {
xe > 1 && E.w(xt, "H264 PPS count: " + xe), Ae++;
for (var Ze = 0; Ze < xe; Ze++) {
var $e = Object(q.f)(d, Ae);
Ae += 2;
var et = d.subarray(Ae, Ae + $e);
me[(ce = zt.parse(et)).pps_id] = ce, $e !== 0 && (Ae += $e);
}
return { version: l, avcProfile: f, profileCompatibility: b, avcLevel: N, naluLengthSize: H, paramSets: { spsList: _e, ppsList: me, sps: Y, pps: ce } };
}
E.i(xt, "Invalid H264 PPS count: " + xe);
}
} else
E.i(xt, "Invalid H264 SPS count: " + S);
} else
E.i(xt, "MP4: Strange NaluLengthSizeMinusOne: " + (H - 1));
} else
E.i(xt, "Invalid AVCDecoderConfigurationRecord");
}, V.parseHVCC = function(E, d, l) {
l === void 0 && (l = X.c.hevc);
var f = 22;
f++;
for (var b, N, H, S, Y = [], ce = [], Ae = []; f < d.byteLength; ) {
var _e = 63 & d[f];
if (f += 1, d.byteLength - f <= 2)
break;
var me = Object(q.f)(d, f);
f += 2;
for (var Ce = 0; Ce < me && !(d.byteLength - f <= 2); Ce++) {
var Me = Object(q.f)(d, f);
if (f += 2, Me !== 0) {
var Ge = d.subarray(f, f + Me);
if (Ge.byteLength !== Me)
break;
_e === ae.a.HEVC_NAL_VPS ? (E.v(xt, "VPS lengh " + Me), Ae[(H = ri.parse(E, Ge)).vps_id] = H) : _e === ae.a.HEVC_NAL_SPS ? (E.v(xt, "SPS lengh " + Me), Y[(b = wt.parse(Ge, l)).sps_id] = b) : _e === ae.a.HEVC_NAL_PPS ? (E.v(xt, "PPS lengh " + Me), ce[(N = Mt.parse(Ge)).pps_id] = N) : _e === ae.a.HEVC_NAL_SEI_PREFIX || _e === ae.a.HEVC_NAL_SEI_SUFFIX ? (E.i(xt, "sei " + _e + " in hvcc"), S || (S = []), S.push({ type: _e, data: Ge })) : E.i(xt, "found " + _e + " nalu in hvcc."), f += Me;
}
}
}
return { paramSets: { vpsList: Ae, spsList: Y, ppsList: ce, seiList: S, sps: b, pps: N } };
}, V.xn = function(E, d, l) {
d += 3 + (63 & E[d]);
var f = Object(m.c)(E);
f.byteIndex = d;
for (var b = [], N = l - 2; N >= 0; N--)
b[N] = Object(m.a)(f, 1);
for (var H = l; H <= 8 && l > 1; H++)
Object(m.g)(f, 1);
for (var S = l - 2; S >= 0; S--)
b[S] && Object(m.g)(f, 8);
return d = f.byteIndex, d += 1 + 4 * E[f.byteIndex];
}, V.parseVvcC = function(E, d) {
var l = 4, f = 1 & d[l];
if (l++, f) {
var b = d[++l] >> 4 & 7;
l += 2, l = this.xn(d, l, b), l += 6;
}
l++;
for (var N, H, S, Y = [], ce = [], Ae = []; l < d.byteLength; ) {
var _e = 31 & d[l];
l += 1;
var me = 1;
_e !== nt.a.VVC_NAL_UNIT_DCI && _e !== nt.a.VVC_NAL_UNIT_OPI && (me = Object(q.f)(d, l), l += 2);
for (var Ce = 0; Ce < me; Ce++) {
var Me = Object(q.f)(d, l);
l += 2;
var Ge = d.subarray(l, l + Me);
if (Ge.byteLength !== Me)
break;
l += Me, _e === nt.a.VVC_NAL_UNIT_VPS ? (E.v(xt, "VPS lengh " + Me), S = Ui.parse(Ge), Ae.push(S)) : _e === nt.a.VVC_NAL_UNIT_SPS ? (E.v(xt, "SPS lengh " + Me), N = vi.parse(Ge), Y.push(N)) : _e === nt.a.VVC_NAL_UNIT_PPS && (E.v(xt, "PPS lengh " + Me), H = yi.parse(Ge), ce.push(H));
}
}
return { paramSets: { vpsList: Ae, spsList: Y, ppsList: ce, sps: N, pps: H } };
}, V.parseBV2C = function(E, d) {
var l = 18;
l++;
for (var f, b, N, H = [], S = [], Y = []; l < d.byteLength; ) {
var ce = 31 & d[l];
l += 1;
var Ae = 1;
ce !== nt.a.VVC_NAL_UNIT_DCI && ce !== nt.a.VVC_NAL_UNIT_OPI && (Ae = Object(q.f)(d, l), l += 2);
for (var _e = 0; _e < Ae; _e++) {
var me = Object(q.f)(d, l);
l += 2;
var Ce = d.subarray(l, l + me);
if (Ce.byteLength !== me)
break;
l += me, ce === nt.a.VVC_NAL_UNIT_VPS ? (E.v(xt, "VPS lengh " + me), N = Ui.parse(Ce), Y.push(N)) : ce === nt.a.VVC_NAL_UNIT_SPS ? (E.v(xt, "SPS lengh " + me), f = vi.parse(Ce), H.push(f)) : ce === nt.a.VVC_NAL_UNIT_PPS && (E.v(xt, "PPS lengh " + me), b = yi.parse(Ce), S.push(b));
}
}
return { paramSets: { vpsList: Y, spsList: H, ppsList: S, sps: f, pps: b } };
}, V.parseKvLC = function(E, d) {
var l = 4;
l++, l++;
for (var f, b, N, H = [], S = [], Y = [], ce = []; l < d.byteLength; ) {
var Ae = 31 & d[l];
l += 1;
var _e = 1;
Ae !== nt.a.VVC_NAL_UNIT_DCI && Ae !== nt.a.VVC_NAL_UNIT_OPI && (_e = Object(q.f)(d, l), l += 2);
for (var me = 0; me < _e; me++) {
var Ce = Object(q.f)(d, l);
l += 2;
var Me = d.subarray(l, l + Ce);
if (Me.byteLength !== Ce)
break;
l += Ce, Ae === nt.a.VVC_NAL_UNIT_VPS ? (E.v(xt, "VPS lengh " + Ce), N = Ui.parse(Me), Y.push(N)) : Ae === nt.a.VVC_NAL_UNIT_SPS ? (E.v(xt, "SPS lengh " + Ce), f = vi.parse(Me), H.push(f)) : Ae === nt.a.VVC_NAL_UNIT_PPS && (E.v(xt, "PPS lengh " + Ce), b = yi.parse(Me), S.push(b)), ce.push({ type: Ae, data: Me });
}
}
return { paramSets: { vpsList: Y, spsList: H, ppsList: S, sps: f, pps: b, nalus: ce } };
}, V.generateAV1C = function(E, d) {
E.i(xt, "generate av1c");
var l = new Uint8Array(5 + d.data.length);
return l[0] = 129, l[1] = (d.seq_profile << 5) + (31 & d.seq_level_idx_0), l[2] = (d.seq_tier_0 << 7) + (d.high_bitdepth << 6) + (d.twelve_bit << 5) + (d.monochrome << 4) + (d.chroma_subsampling_x << 3) + (d.chroma_subsampling_y << 2) + (3 & d.chroma_sample_position), l[3] = 0, l[4] = 8, l.set(d.data, 5), l;
}, V.generateAVCC = function(E, d) {
if (E.i(xt, "generate avcc"), d.sps && d.pps && d.spsList.length && d.ppsList.length) {
var l = d.spsList.filter(function(Y) {
return !!Y;
}), f = d.ppsList.filter(function(Y) {
return !!Y;
}), b = l.reduce(function(Y, ce) {
return Y + ce.data.byteLength;
}, 0), N = f.reduce(function(Y, ce) {
return Y + ce.data.byteLength;
}, 0), H = new Uint8Array(7 + b + N + 2 * l.length + 2 * f.length);
H.set([1, d.sps.data[1], d.sps.data[2], d.sps.data[3], 255, 224 | l.length], 0);
var S = 6;
return l.forEach(function(Y) {
H[S] = Y.data.byteLength >> 8 & 255, H[S + 1] = 255 & Y.data.byteLength, H.set(Y.data, S + 2), S += 2 + Y.data.byteLength;
}), H[S] = f.length, S++, f.forEach(function(Y) {
H[S] = Y.data.byteLength >> 8 & 255, H[S + 1] = 255 & Y.data.byteLength, H.set(Y.data, S + 2), S += 2 + Y.data.byteLength;
}), H;
}
}, V.generateHVCC = function(E, d) {
if (E.i(xt, "generate hvcc"), d.sps && d.pps && d.spsList.length && d.ppsList.length && d.vpsList.length) {
var l = d.spsList.filter(function(me) {
return !!me;
}), f = d.ppsList.filter(function(me) {
return !!me;
}), b = d.vpsList.filter(function(me) {
return !!me;
}), N = l.reduce(function(me, Ce) {
return me + Ce.data.byteLength;
}, 0) + f.reduce(function(me, Ce) {
return me + Ce.data.byteLength;
}, 0) + b.reduce(function(me, Ce) {
return me + Ce.data.byteLength;
}, 0) + 2 * (l.length + f.length + b.length), H = d.sps.ptl, S = new Uint8Array(32 + N), Y = new DataView(S.buffer, 0);
S[0] = 1, S[1] = (192 & H.general_ptl.profile_space) + ((1 & H.general_ptl.tier_flag) << 5) + H.general_ptl.profile_idc & 31, Y.setUint32(2, H.general_ptl.profile_compatibility);
for (var ce = 0; ce < 6; ce++)
Y.setUint8(ce + 6, H.general_ptl.constraint_indicator[ce] || 0);
Y.setUint8(12, H.general_ptl.level_idc);
var Ae = 1;
d.pps.entropy_coding_sync_enabled_flag && d.pps.tiles_enabled_flag ? Ae = 0 : d.pps.entropy_coding_sync_enabled_flag ? Ae = 3 : d.pps.tiles_enabled_flag && (Ae = 2), S[13] = 240 + (3840 & d.sps.min_spatial_segmentation_idc), S[14] = 255 & d.sps.min_spatial_segmentation_idc, S[15] = 252 + (3 & Ae), S[16] = 252 + (3 & d.sps.chroma_format_idc), S[17] = 248 + (d.sps.bit_depth_luma - 8 & 7), S[18] = 248 + (d.sps.bit_depth_chroma - 8 & 7), S[21] = 3, S[22] = 3;
var _e = 23;
return [{ nalus: b, type: ae.a.HEVC_NAL_VPS }, { nalus: l, type: ae.a.HEVC_NAL_SPS }, { nalus: f, type: ae.a.HEVC_NAL_PPS }].forEach(function(me) {
S[_e] = me.type, _e++, Y.setUint16(_e, me.nalus.length), _e += 2, me.nalus.forEach(function(Ce) {
Y.setUint16(_e, Ce.data.byteLength), _e += 2, S.set(Ce.data, _e), _e += Ce.data.byteLength;
});
}), S;
}
}, V.onH264SPSNalu = function(E, d) {
var l = !1, f = bt.parse(E);
return d.sps && Object(q.b)(f.data, d.sps.data) || (l = !0), d.sps = f, d.spsList = [f], l;
}, V.onH264PPSNalu = function(E, d) {
var l = !1, f = zt.parse(E);
return d.pps && Object(q.b)(f.data, d.pps.data) || (l = !0), d.pps = f, d.ppsList = [f], l;
}, V.onHEVCVPSNalu = function(E, d, l) {
var f = !1, b = ri.parse(E, d), N = l.vps;
return N && Object(q.b)(b.data, N.data) || (f = !0), l.vps = b, l.vpsList = [b], f;
}, V.onHEVCSPSNalu = function(E, d, l) {
var f = !1, b = wt.parse(E, l);
return d.sps && Object(q.b)(b.data, d.sps.data) || (f = !0), d.sps = b, d.spsList = [b], f;
}, V.onHEVCPPSNalu = function(E, d) {
var l = !1, f = Mt.parse(E);
return d.pps && Object(q.b)(f.data, d.pps.data) || (l = !0), d.pps = f, d.ppsList = [f], l;
}, V.onVVCVPSNalu = function(E, d) {
var l = !1, f = Ui.parse(E), b = d.vps;
return b && Object(q.b)(f.data, b.data) || (l = !0), d.vps = f, d.vpsList = [f], l;
}, V.onVVCSPSNalu = function(E, d) {
var l = !1, f = vi.parse(E);
return d.sps && Object(q.b)(f.data, d.sps.data) || (l = !0), d.sps = f, d.spsList = [f], l;
}, V.onVVCPPSNalu = function(E, d) {
var l = !1, f = yi.parse(E);
return d.pps && Object(q.b)(f.data, d.pps.data) || (l = !0), d.pps = f, d.ppsList = [f], l;
}, V.hevDecoderConfigToSample = function(E, d) {
return { units: V.hevDecoderConfigToNalu(E), dts: 0, cts: 0, pts: 0, originDTS: d, originPTS: d, key: !1, size: 0 };
}, V.hevDecoderConfigToNalu = function(E) {
var d = [];
return E.seiList && E.seiList.forEach(function(l) {
l && d.push(l);
}), E.vpsList.forEach(function(l) {
l && d.push({ type: ae.a.HEVC_NAL_VPS, data: l.data });
}), E.spsList.forEach(function(l) {
l && d.push({ type: ae.a.HEVC_NAL_SPS, data: l.data });
}), E.ppsList.forEach(function(l) {
l && d.push({ type: ae.a.HEVC_NAL_PPS, data: l.data });
}), d;
}, V.vvcDecoderConfigToNalu = function(E) {
if (E.nalus)
return E.nalus;
var d = [];
return E.vpsList.forEach(function(l) {
l && d.push({ type: nt.a.VVC_NAL_UNIT_VPS, data: l.data });
}), E.spsList.forEach(function(l) {
l && d.push({ type: nt.a.VVC_NAL_UNIT_SPS, data: l.data });
}), E.ppsList.forEach(function(l) {
l && d.push({ type: nt.a.VVC_NAL_UNIT_PPS, data: l.data });
}), d;
}, V.avcDecoderConfigToNalu = function(E) {
var d = [];
return E.spsList.forEach(function(l) {
l && d.push({ type: Pe.H264_NAL_SPS, data: l.data });
}), E.ppsList.forEach(function(l) {
l && d.push({ type: Pe.H264_NAL_PPS, data: l.data });
}), d;
}, V.vvcDecoderConfigToSample = function(E, d) {
return { units: V.vvcDecoderConfigToNalu(E), dts: 0, cts: 0, pts: 0, originDTS: d, originPTS: d, key: !1, size: 0 };
}, V.getDPB264 = function(E) {
return E.sps ? Math.min(Math.max(E.sps.ref_frame_count, 2), 16) : 16;
}, V.getDPBHEVC = function(E) {
if (!E.sps)
return 16;
var d = E.sps.temporal_layer.reduce(function(l, f) {
return Math.max(f.max_dec_pic_buffering, l);
}, 2);
return Math.min(d, 16);
}, V.getDPBLenAV1 = function() {
return 8;
}, V;
}(), Di = "video-track-helper", Dt = function() {
function V() {
}
return V.updateAV1Track = function(E, d, l, f) {
l && (d.codedWidth = l.width, d.codedHeight = l.height, d.codec = l.codec, d.profile = l.profile_string, d.level = l.level_string, d.chromaFormat = l.chroma_format_string, d.bitDepth = l.bit_depth_luma, d.colorInfo = l.color_info, d.dpb = Ct.getDPBLenAV1(), d.decConf = f || Ct.generateAV1C(E, l));
}, V.updateAVCTrack = function(E, d, l, f) {
if (l.sps) {
var b = l.sps;
d.codedWidth = b.codec_size.width, d.codedHeight = b.codec_size.height, d.sar = L()({}, b.sar), b.frame_rate.fixed && b.frame_rate.fps !== 0 && (d.fps = b.frame_rate.fps, d.sampleDuration = d.inputTimescale / d.fps), d.codec = b.codec, d.profile = b.profile_string, d.level = b.level_string, d.chromaFormat = b.chroma_format_string, d.bitDepth = b.bit_depth_luma, d.colorInfo = b.color_info, d.dpb = Ct.getDPB264(l), d.fps && (d.sampleDuration = Math.floor(d.inputTimescale / d.fps)), d.decConf = f || Ct.generateAVCC(E, l);
}
}, V.updateHEVCTrack = function(E, d, l, f) {
if (l.sps) {
var b = l.sps, N = l.vps;
d.codedWidth = b.width, d.codedHeight = b.height, d.sar = L()({}, b.sar), d.codec = b.codec, d.profile = b.profile_string || (N == null ? void 0 : N.ptl.general_ptl.profile_string) || "", d.level = b.level_string || (N == null ? void 0 : N.ptl.general_ptl.level_string) || "", d.chromaFormat = b.chroma_format_string, d.bitDepth = b.bit_depth_luma, d.fps = b.fps || (N == null ? void 0 : N.fps) || 0, d.colorInfo = b.color_info, d.dpb = Ct.getDPBHEVC(l), d.fps && (d.sampleDuration = Math.floor(d.inputTimescale / d.fps)), d.decConf = f || Ct.generateHVCC(E, l);
}
}, V.updateVVCTrack = function(E, d, l, f) {
if (l.sps) {
var b = l.sps;
d.codedWidth = b.width, d.codedHeight = b.height, d.codec = b.codec, d.profile = b.profile_string || "", d.level = b.level_string || "", d.chromaFormat = b.chroma_format_string, d.bitDepth = b.bitdepth, d.fps = b.fps || 0, d.colorInfo = b.color_info, d.decConf = f;
}
}, V.onAV1Detected = function(E, d, l, f, b) {
return E.i(Di, "detected av1: " + f.av1 + " enabled: " + b), b !== !1 && f.av1 ? (d.outputRaw = !f.av1, d.active = !0) : (E.i(Di, "AV1 found, disabled."), d.active = !1), d.active;
}, V.onAVCDetected = function(E, d, l, f, b) {
return E.i(Di, "detected avc. enabled: " + b), d.active = b !== !1, d.active;
}, V.onHEVCDetected = function(E, d, l, f, b) {
return E.i(Di, "detected hevc: " + f.hevc + " wasm: " + l.wasmDecoderEnabled + " enabled: " + b), b !== !1 && (l.wasmDecoderEnabled || f.hevc) ? (d.outputRaw = !f.hevc || l.preferDecoder === X.d.wasm, d.active = !0) : (E.i(Di, "HEVC found, disabled. wasmDec:" + l.wasmDecoderEnabled), d.active = !1), d.active;
}, V.onKVCDetected = function(E, d, l, f) {
return E.i(Di, "detected kvc wasm: " + l.wasmDecoderEnabled + " enabled: " + f), f === !1 ? d.active = !1 : (d.active = l.wasmDecoderEnabled, d.outputRaw = d.active), d.active || E.i(Di, "KVC found, disabled. wasmDec:" + l.wasmDecoderEnabled), d.active;
}, V.onVVCDetected = function(E, d, l, f) {
return E.i(Di, "detected vvc wasm: " + l.wasmDecoderEnabled + " enabled: " + f), f === !1 ? d.active = !1 : (d.active = l.wasmDecoderEnabled, d.outputRaw = d.active), d.active || E.i(Di, "VVC found, disabled. wasmDec:" + l.wasmDecoderEnabled), d.active;
}, V;
}(), yt = "flv-demuxer", Pt = function(V) {
function E(l, f, b, N, H) {
var S;
return l.i(yt, "constructor"), (S = V.call(this, l, f, b, N, H) || this).Vn = 1 / 0, S.Un = 4, S.Fn = void 0, S.Pn = void 0, S.Hn = [], S.Yn = !1, S.Gn = void 0, S.Fn = new he(l, S.Ai), S;
}
W()(E, V), E.probe = function(l) {
return l.byteLength >= 3 && l[0] === 70 && l[1] === 76 && l[2] === 86;
};
var d = E.prototype;
return d.append = function(l, f, b, N, H, S) {
var Y = this;
if (H === void 0 && (H = !1), !l.byteLength && H)
return this.xe ? this.Kn() : H ? this.Zn() : this.Ke(), this.Fn.reset(), void this.Ai.emit(oe.a.PARSED_DATA, { extra: this._i });
this.Fe = S;
var ce = this.Fn.append(l), Ae = this.Fn.trackInfo;
Ae && (this.Mi.active === void 0 && (this.Mi.active = this.Ye() !== !1 && Ae.hasVideo, this.Mi.active || (this.xe = !1)), this.Ne.active === void 0 && (this.Ne.active = this.Ge() !== !1 && Ae.hasAudio));
var _e = ce.tags;
this.Ue || (this.Ue = { timeOffset: f, contiguous: b, accurateTimeOffset: N }), _e.length && (_e.forEach(function(me) {
me.tagType === ge.j.VIDEO && Y.Mi.active && (Y.Yn || (Y.Ne.samples.length && Y.Wn(), Y.Yn = !0), Y.Xn(me), !Y.xe && Y.Mi.samples.reduce(function(Ce, Me) {
return Ce + Me.size;
}, 0) > O.o && (Y.Ci.i(yt, "max size remux"), Y.Ke())), me.tagType === ge.j.AUDIO && Y.Ne.active && Y.zn(me), me.tagType === ge.j.SCRIPT && Y.Jn(me);
}), this.xe || this.Ke(!(!H || !this.Mi.samples.length && !this.Ne.samples.length)), H && ((this.Mi.samples.length || this.Ne.samples.length) && this.Zn(), this.Fn.reset(), this.Ai.emit(oe.a.PARSED_DATA, { extra: this._i })));
}, d.flush = function() {
this.Ci.i(yt, "flush"), this.Zn(), this.Ue = void 0;
}, d.resetInitSegment = function(l) {
this.Ci.i(yt, "reset init", l), V.prototype.resetInitSegment.call(this, l), this.Vn = l.duration, this.Hn = [], this.Fn.reset();
}, d.He = function() {
V.prototype.He.call(this, 1 / 0, O.h);
}, d.Wn = function() {
var l;
this.Ci.i(yt, "discontinuity"), this.Zn(), this.De.iSGenerated && this._i && this.De.resetInitSegment(this._i), (l = this.Qe) == null || l.reset();
}, d.qn = function(l, f, b) {
var N = b < f || b - f >= O.p;
return N && this.Ci.i(yt, "time exception. " + l + " last: " + f + " current:" + b + " offset: " + (b - f) / O.h + "s"), N ? b - f : 0;
}, d.$n = function(l, f, b) {
var N = this.qn(l, f, b);
if (N) {
if (this.Ci.i(yt, "time exception. waiting next key frame."), this.xe = !0, !this.Hn.length && this.Mi.active && typeof this.Le == "number" || this.Ne.active && typeof this.Re == "number") {
if (this.Hn.length && (this.Hn[0].diff < 0 || this.Hn[0].diff / O.h > 30))
return this.es(), void this.Ci.i(yt, "time exception. fix. " + l + ", diff: " + N);
this.ns() ? this.Ci.i(yt, "time exception. audio only") : (this.Ci.i(yt, "time exception. remux. " + l + ", diff: " + N), this.Ke(!0));
}
this.Hn.push({ type: l, diff: N });
}
}, d.Kn = function() {
this.xe && (this.Ci.v(yt, "key frame"), this.Hn.length ? (this.Mi.active && this.Mi.samples.length > 1 || this.ns()) && (this.Ci.i(yt, "time exception. fix on key frame.", this.Mi.samples.length, this.Ne.samples.length), this.es()) : this.Ke(!0));
}, d.es = function() {
(this.Hn.length > 1 || this.ns()) && (this.ss(this.Mi), this.ss(this.Ne)), this.De.flush();
var l = this.De.getLastDTS(), f = Math.max(l.video || 0, l.audio || 0);
this.Ci.i(yt, "fix offset", f, l), this.Ue = { accurateTimeOffset: !0, contiguous: !this.Ve, timeOffset: f }, this._i && this.De.resetInitSegment(this._i), this.De.resetTimeStamp(), this.Ne.samples.length && (this.Re = this.Ne.samples[this.Ne.samples.length - 1].dts), this.Mi.samples.length && (this.Le = this.Mi.samples[this.Mi.samples.length - 1].dts), this.Ke(!0), this.Hn = [], this.xe = !!this.di.gopRemux;
}, d.ss = function(l) {
var f = l.samples;
if (f.length > 1) {
var b = l.sampleDuration || 1, N = f[f.length - 1];
this.Ci.i(yt, "reset " + l.type + " track samples time. sampleDuration:" + b + " dts:" + N.dts);
for (var H = f.length - 2; H >= 0; H--) {
var S = f[H], Y = S.pts - S.dts;
S.dts = N.dts - b, S.pts = S.dts + Y, N = S;
}
}
}, d.Jn = function(l) {
if (l.body) {
var f = Z.parseMetadata(this.Ci, l.body.buffer);
if (Object.prototype.hasOwnProperty.call(f, "onMetaData")) {
var b = f.onMetaData && typeof f.onMetaData == "object" ? f.onMetaData : {};
if (typeof b.duration == "number" && (this.Vn = this.Vn || b.duration), typeof b.framerate == "number" && b.framerate > 0 && (this.Mi.fps = this.Mi.fps || b.framerate, this.Mi.sampleDuration = Math.floor(O.h / this.Mi.fps)), typeof b.videodatarate == "number" && (this.Mi.bitrate = b.videodatarate), typeof b.audiodatarate == "number" && (this.Ne.bitrate = b.audiodatarate), b.keyframes && typeof b.keyframes == "object") {
var N = b.keyframes;
if (N.filepositions && Array.isArray(N.filepositions) && N.times && Array.isArray(N.times) && N.filepositions.length === N.times.length) {
var H = [];
N.times.forEach(function(S, Y) {
H.push({ time: S, position: N.filepositions[Y] });
}), b.keyframes = N;
}
}
this.Ci.i(yt, "Parsed onMetaData"), this.Ai.emit(oe.a.METADATA, b);
}
}
}, d.Xn = function(l) {
if (l.body && l.body.length !== 0) {
var f = l.body[0], b = f >> 4 & 8;
l.frameType = f >> 4 & 7, b ? (this.Mi.enhancedFlv = !0, this.rs(l)) : this.hs(l);
}
}, d.rs = function(l) {
if (l.body && l.body.length !== 0) {
var f = 15 & l.body[0], b = Object(q.a)(l.body, 1, 4), N = 5;
if (b === "hvc1")
l.codecId = 12, f === ge.d ? this.os(l, N) : f !== ge.a && f !== ge.b || (f === ge.a && (l.cts = Object(q.d)(l.body, N), N += 3), this.us(l, N));
else {
if (b !== "av01")
return void this.Di(Object(s.e)(s.b.MUX_ERROR, s.a.PARSING_ERROR, "Flv: Unsupported codec in video frame enhanced: " + b));
l.codecId = 13, f === ge.d ? this.os(l, N) : f === ge.c || f === ge.a && this.us(l, N);
}
}
}, d.hs = function(l) {
if (l.body && l.body.length !== 0) {
var f = ge.h;
if (l.codecId = 15 & l.body[0], l.codecId === 7 || l.codecId === 12 || l.codecId === 13) {
var b = l.body[1];
if (l.cts = b === 1 ? Object(q.d)(l.body, 2) : 0, b === 0)
this.os(l, f);
else if (b === 1)
this.us(l, f);
else if (b !== 2)
return void this.Di(Object(s.e)(s.b.MUX_ERROR, s.a.PARSING_ERROR, "Flv: Invalid video packet type " + b));
} else
this.Di(Object(s.e)(s.b.MUX_ERROR, s.a.PARSING_ERROR, "Flv: Unsupported codec in video frame: " + l.codecId));
}
}, d.os = function(l, f) {
this.Ci.i(l, "parse video tag condec conf. id: " + l.codecId);
var b = this.Ye();
l.codecId === 7 ? (this.Mi.outputRaw && (this.Wn(), this.Mi.outputRaw = !1), Dt.onAVCDetected(this.Ci, this.Mi, this.di, this.li, b), this.cs(l, f)) : l.codecId === 12 ? (Dt.onHEVCDetected(this.Ci, this.Mi, this.di, this.li, b), this.fs(l, f)) : l.codecId === 13 && (Dt.onAV1Detected(this.Ci, this.Mi, this.di, this.li, b), this.As(l, f)), this.Mi.duration = this.Vn * O.h;
}, d.us = function(l, f) {
this.Mi.codec && this.vs(l, f);
}, d.fs = function(l, f) {
if (l.body) {
var b = this.Mi, N = l.body.subarray(f, l.body.byteLength), H = Ct.parseHVCC(this.Ci, N);
if (H && H.paramSets.spsList.length) {
var S;
if (this.Pn = H.paramSets, b.decConf && !Object(q.b)(b.decConf, N) && this.Wn(), b.codecType !== X.c.hevc && (b.codecType = X.c.hevc, this.Ai.emit(oe.a.VIDEO_CODEC_DETECTED, { codecType: X.c.hevc, enabled: !!b.active, decoder: this.Mi.outputRaw ? X.d.wasm : X.d.buildin, bitDepth: b.bitDepth, timeOffset: ((S = this.Ue) == null ? void 0 : S.timeOffset) || 0 })), Dt.updateHEVCTrack(this.Ci, b, H.paramSets), this.Mi.outputRaw) {
var Y = Ct.hevDecoderConfigToSample(H.paramSets, l.timestamp);
this.Ai.emit(oe.a.RAW_DATA, { type: o.d.decoderConfig, samples: re([Y], b.inputTimescale), extra: this._i });
}
} else
this.Di(Object(s.e)(s.b.MUX_ERROR, s.a.PARSING_ERROR, "Invalid HEVCDecoderConfigurationRecord"));
}
}, d.As = function(l, f) {
if (l.body) {
var b = this.Mi, N = l.body.subarray(f, l.body.byteLength);
this.Gn = ee.createCtx();
var H = Ct.parseAV1C(this.Ci, N, this.Gn);
if (H) {
var S;
b.decConf && !Object(q.b)(b.decConf, N) && this.Wn(), b.codecType !== X.c.av1 && (b.codecType = X.c.av1, this.Ai.emit(oe.a.VIDEO_CODEC_DETECTED, { enabled: !0, decoder: X.d.buildin, codecType: X.c.av1, timeOffset: ((S = this.Ue) == null ? void 0 : S.timeOffset) || 0 })), H.sh && Dt.updateAV1Track(this.Ci, b, H.sh, N);
} else
this.Di(Object(s.e)(s.b.MUX_ERROR, s.a.PARSING_ERROR, "Invalid AV1DecoderConfigurationRecord"));
}
}, d.cs = function(l, f) {
if (l.body) {
var b = l.body.subarray(f, l.body.byteLength), N = this.Mi, H = Ct.parseAVCC(this.Ci, l.body.subarray(f, l.body.byteLength));
if (H && H.paramSets.spsList.length) {
var S;
this.Pn = H.paramSets, N.decConf && !Object(q.b)(N.decConf, b) && this.Wn(), N.codecType !== X.c.h264 && (N.codecType = X.c.h264, this.Ai.emit(oe.a.VIDEO_CODEC_DETECTED, { enabled: !0, decoder: X.d.buildin, codecType: X.c.h264, timeOffset: ((S = this.Ue) == null ? void 0 : S.timeOffset) || 0 })), Dt.updateAVCTrack(this.Ci, N, H.paramSets, b);
} else
this.Di(Object(s.e)(s.b.MUX_ERROR, s.a.PARSING_ERROR, "Invalid AVCDecoderConfigurationRecord"));
}
}, d.vs = function(l, f) {
var b = this;
if (l.body) {
var N = this.Mi, H = l.body.buffer, S = l.body.byteLength - f, Y = new DataView(H, f, S), ce = [], Ae = 0, _e = this.Un, me = l.timestamp, Ce = l.cts, Me = !1;
me === this.Le && (Ce += 1);
var Ge = me + Ce, xe = l.frameType === 1;
xe && this.Kn(), typeof this.Le == "number" && this.$n(X.o.VIDEO, this.Le, me);
var Ze = [], $e = [];
if (l.codecId === 13)
this.Gn || (this.Gn = ee.createCtx()), ee.parseOBU(l.body.subarray(f), this.Gn).forEach(function(ut) {
ut.obu_type === we.AV1_OBU_SEQUENCE_HEADER && !N.decConf && ut.content && Dt.updateAV1Track(b.Ci, N, ut.content), ce.push({ type: 0, data: ut.data });
});
else
for (; Ae < S; ) {
if (Ae + 4 >= S) {
this.Ci.v(yt, "Malformed Nalu near timestamp " + me + ", offset = " + Ae + ", dataSize = " + S);
break;
}
var et = Y.getUint32(Ae);
if (_e === 3 && (et >>>= 8), et > S - _e)
return void this.Ci.v(yt, "Malformed Nalus near timestamp " + me + ", NaluSize > DataSize!");
var st = new Uint8Array(H, f + Ae + 4, _e + et - 4), Ke = 0;
if (l.codecId === 7)
if (this.Pn || (this.Pn = { spsList: [], ppsList: [] }), (Ke = 31 & Y.getUint8(Ae + _e)) === Pe.H264_NAL_IDR_SLICE)
xe = !0;
else if (Ke === Pe.PRIV_NAL_MAGIC_H264)
try {
$e.push(Te.parse(st, !0));
} catch (ut) {
this.Ci.w(yt, "PrivNal parse error " + ut);
}
else
Ke === Pe.H264_NAL_SEI ? Ze.push.apply(Ze, Ye.parse(st.subarray(1))) : Ke === Pe.H264_NAL_SPS ? Ct.onH264SPSNalu(st, this.Pn) && (Me = !0) : Ke === Pe.H264_NAL_PPS && Ct.onH264PPSNalu(st, this.Pn) && (Me = !0);
else if (l.codecId === 12)
if (this.Pn || (this.Pn = { vpsList: [], spsList: [], ppsList: [] }), (Ke = (126 & Y.getUint8(Ae + _e)) >> 1) === ae.a.HEVC_NAL_IDR_W_RADL || Ke === ae.a.HEVC_NAL_IDR_N_LP || Ke === ae.a.HEVC_NAL_CRA_NUT)
xe = !0;
else if (Ke === ae.a.PRIV_NAL_MAGIC_HEVC)
try {
$e.push(Te.parse(st, !1));
} catch (ut) {
this.Ci.w(yt, "PrivNal parse error " + ut);
}
else
Ke === ae.a.HEVC_NAL_SEI_PREFIX || Ke === ae.a.HEVC_NAL_SEI_SUFFIX ? Ze.push.apply(Ze, Ye.parse(st.subarray(2))) : Ke === ae.a.HEVC_NAL_VPS ? Ct.onHEVCVPSNalu(this.Ci, st, this.Pn) && (Me = !0) : Ke === ae.a.HEVC_NAL_SPS ? Ct.onHEVCSPSNalu(st, this.Pn, N.codecType) && (Me = !0) : Ke === ae.a.HEVC_NAL_PPS && Ct.onHEVCPPSNalu(st, this.Pn) && (Me = !0);
var Tt = { type: Ke, data: st };
ce.push(Tt), Ae += _e + et;
}
if (ce.length) {
var It = { units: ce, dts: me, cts: Ce, pts: Ge, originDTS: l.timestamp, originPTS: l.timestamp + l.cts, key: xe, parseTime: performance ? performance.now() / 1e3 : 0, size: ce.reduce(function(ut, Et) {
return ut + Et.data.length;
}, 0) };
Ze.length && (It.sei = { sei: Ze, streamTimestamp: l.timestamp }), $e.length && (It.privNal = { info: $e, streamTimestamp: l.timestamp }), this.$e(It);
}
this.Le = me, Me && this.Pn && Ct.isParamSetsReady(this.Pn) && (this.Ci.i(yt, "dec param sets update."), N.codecType === X.c.h264 ? Dt.updateAVCTrack(this.Ci, N, this.Pn) : ne(N.codecType) && Dt.updateHEVCTrack(this.Ci, N, this.Pn));
}
}, d.zn = function(l) {
if (l.body && l.body.length !== 0) {
var f = l.body[0];
if (l.body.byteLength <= 1)
this.Ci.v(yt, "Flv: Invalid audio packet, missing SoundData payload!");
else {
var b = this.Ne, N = f >> 4;
if (N === 10)
b.codecType = X.c.aac;
else {
if (N !== 2 && N !== 14)
return this.Ci.w(yt, "audio unsupported codec " + N), void (b.active = !1);
b.codecType = X.c.mp3;
}
if (b.codecType === X.c.aac) {
var H = l.body[1];
if (H === 0) {
if (l.body.byteLength < 4)
return;
var S = l.body.subarray(2, 4);
return void this.ds(S);
}
if (H !== 1)
return void this.Ci.v(yt, "Flv: Unsupported AAC data type " + H);
if (!b.configParsed) {
var Y, ce, Ae = [5500, 11025, 22050, 44100][f >> 2 & 3];
if (Ae < 11025)
return;
var _e = 1 + (1 & f);
this.Ci.i(yt, "missing AACPacketType 0. generate samplerate:" + Ae + " channel:" + _e + " codec:" + ((Y = this._i) == null ? void 0 : Y.audioCodec));
var me = j.b(Ae, _e, (ce = this._i) == null ? void 0 : ce.audioCodec);
if (!me)
return void this.Ci.v(yt, "generate ASC fail.");
this.ds(me);
}
}
b.duration = this.Vn * O.h;
var Ce, Me = b.codecType === X.c.aac ? 2 : 1, Ge = l.timestamp;
if (b.sampleDuration && this.Mi.active && typeof this.Re == "number" && this.$n(X.o.AUDIO, this.Re, l.timestamp), b.codecType === X.c.aac) {
var xe = l.body.subarray(2);
if (Ce = { unit: xe, dts: Ge, pts: Ge, originDTS: Ge, originPTS: Ge, parseTime: self.performance ? performance.now() / 1e3 : 0 }, xe.length > 2 && xe[0] === 255 && xe[1] >> 4 == 15) {
this.Ci.i(yt, "adts header detected.");
var Ze = j.a(this.Ci, b, xe, 0, Ge, 0, Ge);
Ze && (Ce = Ze.sample);
} else
b.samples.push(Ce);
if (this.di.enableAacPriv && typeof b.aacSampleingIndex == "number" && typeof b.aot == "number") {
var $e = j.h(this.Ci, Ce.unit, b.aacSampleingIndex, b.aot);
$e && (Ce.aacPriv = [{ payload: $e.priv, streamTimestamp: l.timestamp }]);
}
} else if (b.codecType === X.c.mp3) {
var et;
Ce = (et = $(b, l.body, Me, Ge, 0)) == null ? void 0 : et.sample;
}
this.Re = Ge;
}
}
}, d.ds = function(l) {
var f, b = this.Ne;
(j.g(b, l) || !b.configParsed) && b.codec && b.samples.length && this.Wn(), j.d(this.Ci, b, this.Ai, l, o.a.ASC, (f = this._i) == null ? void 0 : f.audioCodec);
}, d.Zn = function() {
this.Hn.length && (this.Mi.active && this.Mi.samples.length > 1 || this.ns()) ? (this.Ci.i(yt, "time exception. fix on remux all.", this.Mi.samples.length, this.Ne.samples.length), this.es()) : this.Ke(!0);
}, d.Ke = function(l) {
l === void 0 && (l = !1);
var f = this.Ne, b = this.Mi;
this.We(f, b) && (this.Ze(f, b), this.Xe(f, b, l) && this.qe(f, b, l, o.b.FLV));
}, d.Je = function(l) {
return l.samples.length ? this.Hn.reduce(function(f, b) {
return f || b.type === X.o.VIDEO;
}, !1) ? l.samples.length * (l.sampleDuration || O.h / O.d) / l.inputTimescale : (l.samples[l.samples.length - 1].dts - l.samples[0].dts) / l.inputTimescale : 0;
}, d.ns = function() {
var l;
return !(!this.di.isLive && this.di.isLive !== void 0 || !this.Ve || (l = this.Ue) != null && l.contiguous || !this.Mi.active || this.Mi.samples.length || !(this.Ne.samples.length > 0));
}, T()(E, null, [{ key: "probeSize", get: function() {
return 188;
} }]);
}(de), ei = n(38), ki = "ivf-demuxer", Br = function(V) {
function E(l, f, b, N, H) {
var S;
return l.i(ki, "constructor"), (S = V.call(this, l, f, b, N, H) || this).un = 0, S.cn = void 0, S.ls = 0, S.bs = 0, S.Gn = void 0, S.cn = S.gs, S.un = 8, S;
}
W()(E, V), E.probe = function(l) {
return l.length > 4 && l[0] === 68 && l[1] === 75 && l[2] === 73 && l[3] === 70;
};
var d = E.prototype;
return d.resetInitSegment = function(l) {
this.He(l.duration), V.prototype.resetInitSegment.call(this, l), this.ls = 0, this.cn = this.gs, this.un = 8;
}, d.append = function(l, f, b, N, H) {
for (this.Ue || (this.Ue = { timeOffset: f, contiguous: b, accurateTimeOffset: N }), this._t.put(l); this._t.unreadLen >= this.un; )
this.cn();
this.Ke(H);
}, d.He = function(l) {
V.prototype.He.call(this, l), this.Mi.active = this.Ye(), this.Ne.active = !1;
}, d.gs = function() {
if (!(this._t.unreadLen < 8)) {
var l = this._t.get(8);
if (l)
if (E.probe(l)) {
var f = Object(q.f)(l, 6, !0);
this.un = f - 8, this.cn = this.ys;
} else
this.Di(Object(s.e)(s.b.MUX_ERROR, s.a.REMUX_ERROR, "ivf start code error"));
}
}, d.ys = function() {
if (!(this._t.unreadLen < this.un)) {
var l = this._t.get(this.un), f = this.Mi;
if (l && f) {
var b = Object(q.a)(l, 0, 4);
if (b === "AV01") {
f.codecType = X.c.av1, f.codedWidth = Object(q.f)(l, 4, !0), f.codedHeight = Object(q.f)(l, 6, !0);
var N = Object(q.h)(l, 8, !0), H = Object(q.h)(l, 12, !0), S = Object(q.h)(l, 16, !0);
f.inputTimescale = N / H, f.duration = S, this.Ci.i(ki, "head. w: " + f.codedWidth + ", h:" + f.codedHeight + ", den:" + N + ", num:" + H + ", duration:" + f.duration), N && H || this.Di(Object(s.e)(s.b.MUX_ERROR, s.a.REMUX_ERROR, "ivf head den: " + N + ", num: " + H));
var Y = { duration: f.duration / f.inputTimescale, keyframes: [{ time: 0, position: this.un }] };
this.Ai.emit(oe.a.METADATA, Y), this.cn = this._s, this.un = 12;
} else
this.Di(Object(s.e)(s.b.MUX_ERROR, s.a.UNSUPPORTED, "ivf " + b + " unsupported"));
}
}
}, d._s = function() {
if (!(this._t.unreadLen < this.un)) {
var l = this._t.get(this.un);
if (l) {
var f = Object(q.h)(l, 0, !0);
this.ls = Object(q.i)(l, 4, !0), this.cn = this.Cs, this.un = f;
}
}
}, d.Cs = function() {
var l = this;
if (!(this._t.unreadLen < this.un)) {
var f = this._t.get(this.un), b = this.Mi;
if (f && b) {
var N = [], H = !1;
if (this.Gn || (this.Gn = ee.createCtx()), ee.parseOBU(f, this.Gn).forEach(function(Y) {
var ce;
Y.obu_type === we.AV1_OBU_SEQUENCE_HEADER && l.Gn && l.Gn.sh && (Dt.onAV1Detected(l.Ci, b, l.di, l.li, l.Ye()), Dt.updateAV1Track(l.Ci, b, l.Gn.sh)), H = H || !((ce = Y.content) == null || !ce.keyframe), N.push({ type: 0, data: Y.data });
}), N.length) {
var S = { units: N, dts: this.ls, cts: 0, pts: this.ls, originDTS: this.ls, originPTS: this.ls, key: H, size: N.reduce(function(Y, ce) {
return Y + ce.data.length;
}, 0) };
this.$e(S);
}
this.cn = this._s, this.un = 12;
}
}
}, d.Ke = function(l) {
l === void 0 && (l = !1);
var f = this.Ne, b = this.Mi;
if (this.We(f, b) && this.Xe(f, b, l)) {
var N = Object(ei.a)(b, this.bs);
this.bs += N.length, this.Ai.emit(oe.a.VIDEO_FRAME_INFO, { videoFramesInfo: N }), this.Ve && this.Ai.emit(oe.a.KEY_FRAME_INDEXS, { keyframes: [{ time: 0, position: 0 }] }), this.qe(f, b, l, o.b.IVF);
}
}, T()(E, null, [{ key: "probeSize", get: function() {
return 8;
} }]);
}(de);
function mi(V) {
var E = -function(d) {
var l = [];
if (l[0] = fr(bi(d[0]), bi(d[3])), l[1] = fr(bi(d[1]), bi(d[4])), l[0] == 0 || l[1] == 0)
return NaN;
var f = 180 * Math.atan2(bi(d[1]) / l[1], bi(d[0]) / l[0]) / Math.PI;
return -f;
}(V);
return E -= 360 * Math.floor(E / 360 + 25e-4), (E %= 360) < 0 && (E += 360), E;
}
function bi(V) {
return V / 65536;
}
function fr() {
for (var V = 0, E = arguments.length, d = new Array(E), l = 0; l < E; l++)
d[l] = arguments[l];
for (var f = d.length, b = 0; b < f; b++) {
if (d[b] === 1 / 0 || d[b] === -1 / 0)
return 1 / 0;
V += d[b] * d[b];
}
return Math.sqrt(V);
}
var mt = n(20), jt = function() {
function V() {
}
return V.parseOneDescriptor = function(E) {
var d = 0, l = E.data[E.pos], f = E.data[E.pos + 1];
for (E.pos += 2; 128 & f; )
d = (127 & f) << 7, f = E.data[E.pos], E.pos++;
d += 127 & f;
var b = E.data.subarray(E.pos, E.pos + d);
return l === 3 ? V.Is(E) : l === 4 ? V.Os(E) : (E.pos += d, { tag: l, data: b });
}, V.getAudioConfig = function(E) {
if (E.tag === 5)
return E.data;
if (E.descs && E.descs.length)
for (var d = 0; d < E.descs.length; d++) {
var l = V.getAudioConfig(E.descs[d]);
if (l)
return l;
}
}, V.getObjectTypeIndication = function(E) {
if (E.descs && E.descs.length) {
for (var d = 0; d < E.descs.length; d++)
if (E.descs[d].tag === 4)
return E.descs[d].oti;
}
return -1;
}, V.Is = function(E) {
var d = Object(q.f)(E.data, E.pos);
E.pos += 2;
var l = E.data[E.pos];
E.pos++;
var f = 0;
128 & l && (f = Object(q.f)(E.data, E.pos), E.pos += 2);
var b = "";
if (64 & l) {
var N = E.data[E.pos];
b = Object(q.a)(E.data, E.pos + 1, N), E.pos += N + 1;
}
var H = 0;
32 & l && (H = Object(q.f)(E.data, E.pos), E.pos += 2);
var S = { tag: 3, data: E.data, id: d, dependsOnESID: f, url: b, ocrESID: H };
return E.pos < E.data.byteLength && (S.descs = V.ws(E)), S;
}, V.Os = function(E) {
var d = { tag: 4, data: E.data, oti: E.data[E.pos], streamType: E.data[E.pos + 1], bufferSize: Object(q.g)(E.data, E.pos + 2), maxBitrate: Object(q.h)(E.data, E.pos + 5), avgBitrate: Object(q.h)(E.data, E.pos + 9) };
return E.pos += 13, E.data.byteLength > 13 && (d.descs = V.ws(E)), d;
}, V.ws = function(E) {
for (var d = []; E.pos < E.data.byteLength; ) {
var l = V.parseOneDescriptor(E);
d.push(l);
}
return d;
}, V;
}(), Qr = n(46), $t = function(V) {
return V[V.SIZE = 0] = "SIZE", V[V.NAME = 1] = "NAME", V[V.BIG_SIZE = 2] = "BIG_SIZE", V[V.DATA = 3] = "DATA", V;
}({}), si = function() {
function V() {
}
return V.readBoxes = function(E) {
for (var d = 0, l = $t.SIZE, f = { size: 0, headSize: 8, name: "" }, b = []; d < E.byteLength; )
switch (l) {
case $t.SIZE:
f.size = Object(q.h)(E, d), d += 4, l = $t.NAME;
break;
case $t.NAME:
f.name = Object(q.a)(E, d, 4), d += 4, l = f.size === 1 ? $t.BIG_SIZE : $t.DATA;
break;
case $t.BIG_SIZE:
f.size = Object(q.i)(E, d), f.headSize = 16, d += 8, l = $t.DATA;
break;
case $t.DATA:
f.data = E.subarray(d, d + f.size - f.headSize), d += f.data.byteLength, l = $t.SIZE, b.push(f), f = { size: 0, headSize: 8, name: "" };
}
return b;
}, V.readBox = function(E, d) {
d === void 0 && (d = 0);
for (var l = d, f = $t.SIZE, b = { size: 0, headSize: 8, name: "" }; l < E.byteLength && !b.data; )
switch (f) {
case $t.SIZE:
b.size = Object(q.h)(E, l), l += 4, f = $t.NAME;
break;
case $t.NAME:
b.name = Object(q.a)(E, l, 4), l += 4, f = b.size === 1 ? $t.BIG_SIZE : $t.DATA;
break;
case $t.BIG_SIZE:
b.size = Object(q.i)(E, l), b.headSize = 16, l += 8, f = $t.DATA;
break;
case $t.DATA:
if (!(E.byteLength - l >= b.size - b.headSize)) {
l = E.byteLength;
break;
}
b.data = E.subarray(l, l + b.size - b.headSize), l += b.data.byteLength, f = $t.SIZE;
}
if (b.size)
return b;
}, V.ftyp = function(E) {
var d = E.data;
if (d)
return { major_brand: Object(q.a)(d, 0, 4), minor_version: Object(q.h)(d, 4), compatible_brands: Object(q.a)(d, 8, d.byteLength - 8) };
}, V.moov = function(E) {
var d = { trak: [], mvex: [], pssh: [] };
return E.data && V.readBoxes(E.data).forEach(function(l) {
l.data && (l.name === "mvhd" ? d.mvhd = V.Es(l.data) : l.name === "trak" ? d.trak.push(V.ks(l.data)) : l.name === "mvex" ? d.mvex.push(V.Ms(l.data)) : l.name === "pssh" ? d.pssh.push(l) : l.name === "udta" && (d.udta || (d.udta = []), d.udta.push(V.Ss(l.data))));
}), d;
}, V.moof = function(E) {
var d = {};
return E.data && V.readBoxes(E.data).forEach(function(l) {
if (l.data && l.name === "traf") {
var f = V.Bs(l.data);
d.traf ? d.traf.push(f) : d.traf = [f];
}
}), d;
}, V.esds = function(E) {
if (E.data)
return jt.parseOneDescriptor({ data: E.data, pos: 4 });
}, V.sidx = function(E) {
var d = E.data;
if (d) {
var l = { referenceID: 0, timescale: 0, earliestPresentationTime: 0, firstOffset: 0, referenceCount: 0, references: [] }, f = d[0], b = 4;
l.referenceID = Object(q.e)(d, b), l.timescale = Object(q.h)(d, b + 4), b += 8, f === 0 ? (l.earliestPresentationTime = Object(q.h)(d, b), l.firstOffset = Object(q.h)(d, b + 4), b += 8) : (l.earliestPresentationTime = Object(q.i)(d, b), l.firstOffset = Object(q.i)(d, b + 8), b += 16), l.referenceCount = Object(q.f)(d, b + 2), b += 4;
for (var N = 0; N < l.referenceCount; N++) {
var H = 2147483647 & Object(q.h)(d, b);
b += 4;
var S = Object(q.h)(d, b);
b += 4, l.references.push({ size: H, duration: S / l.timescale }), b += 4;
}
return l;
}
}, V.btrt = function(E) {
var d = E.data;
if (d)
return { bufferSizeDB: Object(q.h)(d, 0), maxBitrate: Object(q.h)(d, 4), avgBitrate: Object(q.h)(d, 8) };
}, V.pasp = function(E) {
var d = E.data;
if (d)
return { hSpacing: Object(q.h)(d, 0), vSpacing: Object(q.h)(d, 4) };
}, V.Bs = function(E) {
var d = {};
return V.readBoxes(E).forEach(function(l) {
if (l.data)
if (l.name === "tfhd")
d.tfhd = V.Ts(l.data);
else if (l.name === "tfdt")
d.tfdt = V.Ds(l.data);
else if (l.name === "trun") {
var f = V.Rs(l.data);
d.trun ? d.trun.push(f) : d.trun = [f];
} else
l.name === "saiz" ? d.saiz = V.Ls(l.data) : l.name === "saio" ? d.saio = V.Ns(l.data) : l.name === "senc" && (d.senc = V.Qs(l.data));
}), d;
}, V.Ts = function(E) {
var d = { trackID: Object(q.h)(E, 4), baseDataOffset: 0, sampleDescriptionIndex: 0, defaultSampleDuration: 0, defaultSampleSize: 0, defaultSampleFlags: 0 }, l = Object(q.g)(E, 1), f = 8;
return f <= E.byteLength - 8 && 1 & l ? (d.baseDataOffset = Object(q.i)(E, f), f += 8) : d.baseDataOffset = 0, f <= E.byteLength - 4 && 2 & l ? (d.sampleDescriptionIndex = Object(q.h)(E, f), f += 4) : d.sampleDescriptionIndex = 0, f <= E.byteLength - 4 && 8 & l ? (d.defaultSampleDuration = Object(q.h)(E, f), f += 4) : d.defaultSampleDuration = 0, f <= E.byteLength - 4 && 16 & l ? (d.defaultSampleSize = Object(q.h)(E, f), f += 4) : d.defaultSampleSize = 0, f <= E.byteLength - 4 && 32 & l ? (d.defaultSampleFlags = Object(q.h)(E, f), f += 4) : d.defaultSampleFlags = 0, d;
}, V.Ds = function(E) {
return { baseMediaDecodeTime: E[0] === 1 ? Object(q.i)(E, 4) : Object(q.h)(E, 4) };
}, V.Rs = function(E) {
var d = E[0], l = Object(q.g)(E, 1), f = { sampleCount: 0, dataOffset: 0, firstSampleFlags: 0, sampleDuration: [], sampleSize: [], sampleFlags: [], sampleCompositionTimeOffset: [] }, b = 4;
if (f.sampleCount = Object(q.h)(E, b), (b += 4) <= E.byteLength - 4 && 1 & l ? (f.dataOffset = Object(q.e)(E, b), b += 4) : f.dataOffset = 0, b <= E.byteLength - 4 && 4 & l ? (f.firstSampleFlags = Object(q.h)(E, b), b += 4) : f.firstSampleFlags = 0, b <= E.byteLength - 4)
for (var N = 0; N < f.sampleCount; N++)
256 & l && (f.sampleDuration[N] = Object(q.h)(E, b), b += 4), 512 & l && (f.sampleSize[N] = Object(q.h)(E, b), b += 4), 1024 & l && (f.sampleFlags[N] = Object(q.h)(E, b), b += 4), 2048 & l && (f.sampleCompositionTimeOffset[N] = d === 0 ? Object(q.h)(E, b) : Object(q.e)(E, b), b += 4);
return f;
}, V.Ls = function(E) {
var d = E[0], l = Object(q.g)(E, 1), f = { defaultSampleInfoSize: 0, sampleCount: 0, sampleInfoSize: [] };
if (d === 0) {
var b = 4;
if (1 & l && (b += 8), f.defaultSampleInfoSize = E[b], f.sampleCount = Object(q.h)(E, b + 1), b += 5, f.defaultSampleInfoSize === 0)
for (var N = 0; N < f.sampleCount; N++)
f.sampleInfoSize[N] = E[b], b++;
}
return f;
}, V.Ns = function(E) {
var d = E[0], l = { entryCount: 0, offset: [] }, f = 4;
1 & Object(q.g)(E, 1) && (f += 8), l.entryCount = Object(q.h)(E, f), f += 4;
for (var b = 0; b < l.entryCount; b++)
d === 0 ? (l.offset[b] = Object(q.h)(E, f), f += 4) : (l.offset[b] = Object(q.i)(E, f), f += 8);
return l;
}, V.Qs = function(E, d) {
d === void 0 && (d = 0);
var l = { sampleCount: 0, useSubSampleEnc: !!(2 & Object(q.g)(E, 1)), encItemData: [] }, f = 4;
return l.sampleCount = Object(q.h)(E, f), f += 4, d && (l.iv = E.subarray(f, 8 * d), f += d), l.encData = E.subarray(f), l;
}, V.Es = function(E) {
var d = E[0], l = 0, f = 0;
return d === 1 ? (l = Object(q.h)(E, 20), f = Object(q.i)(E, 24)) : d === 0 && (l = Object(q.h)(E, 12), f = Object(q.h)(E, 16)), { timescale: l, duration: f };
}, V.Ms = function(E) {
var d = {};
return V.readBoxes(E).forEach(function(l) {
l.data && (l.name === "mehd" ? d.mehd = V.xs(l.data) : l.name === "trex" && (d.trex = V.Vs(l.data)));
}), d;
}, V.xs = function(E) {
return { fragmentDuration: E[0] === 1 ? Object(q.i)(E, 4) : Object(q.h)(E, 4) };
}, V.Vs = function(E) {
return { trackID: Object(q.h)(E, 4), sampleDescriptionIndex: Object(q.h)(E, 8), defaultSampleDuration: Object(q.h)(E, 12), defaultSampleSize: Object(q.h)(E, 16), defaultSampleFlags: Object(q.h)(E, 20) };
}, V.ks = function(E) {
var d = {};
return V.readBoxes(E).forEach(function(l) {
l.data && (l.name === "tkhd" ? d.tkhd = V.Us(l.data) : l.name === "tref" ? d.tref = V.Fs(l.data) : l.name === "mdia" ? d.mdia = V.Ps(l.data) : l.name === "edts" && (d.edts = V.Hs(l.data)));
}), d;
}, V.Us = function(E) {
var d = 0, l = 0, f = 4;
E[0] === 1 ? (d = Object(q.h)(E, f + 16), l = Object(q.i)(E, f + 24), f += 32) : (d = Object(q.h)(E, f + 8), l = Object(q.h)(E, f + 16), f += 20), f += 16;
for (var b = [], N = 0; N < 9; N++)
b.push(Object(q.e)(E, f)), f += 4;
return { width: Object(q.h)(E, f) >> 16, height: Object(q.h)(E, f + 4) >> 16, trackId: d, duration: l, matrix: b };
}, V.Hs = function(E) {
var d = {};
return V.readBoxes(E).forEach(function(l) {
l.name === "elst" && l.data && (d.elst = V.Ys(l.data));
}), d;
}, V.Ys = function(E) {
var d = { entries: [], entry_count: 0 }, l = E[0];
d.entry_count = Object(q.h)(E, 4);
for (var f = 8, b = 0; b < d.entry_count; b++) {
var N = { segment_duration: 0, media_time: 0, media_rate_integer: 0, media_rate_fraction: 0 };
d.entries.push(N), l === 1 ? (N.segment_duration = Object(q.i)(E, f), N.media_time = Object(q.i)(E, f + 8), f += 16) : (N.segment_duration = Object(q.h)(E, f), N.media_time = Object(q.e)(E, f + 4), f += 8), N.media_rate_integer = Object(q.c)(E, f), N.media_rate_fraction = Object(q.c)(E, f + 2), f += 4;
}
return d;
}, V.Fs = function(E) {
return { referenceType: Object(q.a)(E, 4, 4), trackId: Object(q.h)(E, 8) };
}, V.Ps = function(E) {
var d = {};
return V.readBoxes(E).forEach(function(l) {
l.data && (l.name === "minf" ? d.minf = V.Gs(l.data) : l.name === "hdlr" ? d.hdlr = V.Ks(l.data) : l.name === "mdhd" && (d.mdhd = V.Zs(l.data)));
}), d;
}, V.Ks = function(E) {
var d = {};
return E[0] === 0 && (d.type = Object(q.a)(E, 8, 4)), d;
}, V.Gs = function(E) {
var d = {};
return V.readBoxes(E).forEach(function(l) {
l.data && (l.name === "dinf" ? V.Ws(l.data) : l.name === "stbl" && (d.stbl = V.Xs(l.data)));
}), d;
}, V.Ws = function(E) {
V.readBoxes(E).forEach(function(d) {
d.data && d.name === "dref" && V.zs(d.data);
});
}, V.zs = function(E) {
for (var d = Object(q.h)(E, 4), l = 0; l < d && 8 < E.byteLength; l++)
;
}, V.Xs = function(E) {
var d = {};
return V.readBoxes(E).forEach(function(l) {
l.data && (l.name === "stsd" ? d.stsd = V.Js(l.data) : l.name === "stts" ? d.stts = V.$s(l.data) : l.name === "stsc" ? d.stsc = V.tr(l.data) : l.name === "stco" ? d.stco = V.ir(l.data) : l.name === "co64" ? d.stco = V.er(l.data) : l.name === "stsz" ? d.stsz = V.nr(l.data) : l.name === "stz2" ? d.stsz = V.sr(l.data) : l.name === "stss" ? d.stss = V.rr(l.data) : l.name === "ctts" ? d.ctts = V.hr(l.data) : l.name === "sgpd" ? d.sgpd = V.ar(l.data) : l.name === "stdp" ? d.stdp = V.ur(l.data) : l.name === "sdtp" ? d.sdtp = V.cr(l.data) : l.name === "sbgp" ? d.sbgp = V.Ar(l.data) : l.name === "subs" ? d.subs = V.vr(l.data) : l.name === "saiz" ? d.saiz = V.Ls(l.data) : l.name === "saio" ? d.saio = V.Ns(l.data) : l.name === "senc" && (d.senc = V.Qs(l.data)));
}), d;
}, V.vr = function(E) {
var d = E[0], l = { entries: [] }, f = 4, b = Object(q.h)(E, f);
f += 4;
for (var N = 0; N < b; N++) {
var H = { sampleDelta: Object(q.h)(E, f), subSamples: [] };
l.entries.push(H);
var S = Object(q.f)(E, f + 4);
f += 6;
for (var Y = 0; Y < S; Y++) {
var ce = { priority: E[f += d === 1 ? 4 : 2], discardable: E[f + 1], codecSpecificParameters: Object(q.h)(E, f + 2) };
H.subSamples.push(ce), f += 6;
}
}
return l;
}, V.Ar = function(E) {
var d = E[0], l = 4, f = { groupingType: Object(q.a)(E, l, 4), entries: [] };
l += 4, d === 1 && (l += 4);
var b = Object(q.h)(E, l);
l += 4;
for (var N = 0; N < b; N++)
f.entries.push({ sampleCount: Object(q.e)(E, l), groupDescriptionIndex: Object(q.e)(E, l + 4) }), l += 8;
return f;
}, V.cr = function(E) {
for (var d = { entries: [] }, l = 4; l < E.byteLength; )
d.entries.push({ sampleDependsOn: E[l] >> 4 & 3, sampleIsDependedOn: E[l] >> 2 & 3, sampleHasRedundancy: 3 & E[l] }), l++;
return d;
}, V.ur = function(E) {
for (var d = { priority: [] }, l = 4; l < E.length; )
d.priority.push(Object(q.f)(E, l)), l += 2;
return d;
}, V.ar = function(E) {
var d = E[0], l = { type: Object(q.a)(E, 4, 4), entries: [] }, f = 0, b = 8;
d === 1 && (f = Object(q.h)(E, b), b += 4), d === 2 && (b += 4);
var N = Object(q.h)(E, b);
b += 4;
for (var H = 0; H < N; H++) {
var S = 0;
d === 1 && f === 0 ? (S = Object(q.h)(E, b), b += 4) : S = f;
var Y = { descriptionLength: S, data: E.subarray(b, b + S) };
b += S, l.entries.push(Y);
}
return l;
}, V.Js = function(E) {
return { sampleEntrys: V.readBoxes(E.subarray(8, E.byteLength)), boxData: E };
}, V.$s = function(E) {
for (var d = Object(q.h)(E, 4), l = 8, f = [], b = 0; b < d; b++)
f.push({ sampleCount: Object(q.h)(E, l), sampleDelta: Object(q.h)(E, l + 4) }), l += 8;
return { timeToSample: f };
}, V.tr = function(E) {
for (var d = Object(q.h)(E, 4), l = 8, f = [], b = 0; b < d; b++)
f.push({ firstChunk: Object(q.h)(E, l), samplesPerChunk: Object(q.h)(E, l + 4), sampleDescriptionIndex: Object(q.h)(E, l + 8) }), l += 12;
return { sampleToChunkBox: f };
}, V.ir = function(E) {
for (var d = Object(q.h)(E, 4), l = 8, f = [], b = 0; b < d; b++)
f.push(Object(q.h)(E, l)), l += 4;
return { chunkOffset: f };
}, V.er = function(E) {
for (var d = Object(q.h)(E, 4), l = 8, f = [], b = 0; b < d; b++)
f.push(Object(q.i)(E, l)), l += 8;
return { chunkOffset: f };
}, V.nr = function(E) {
var d = Object(q.h)(E, 4), l = Object(q.h)(E, 8), f = 12;
if (d === 0) {
d = [];
for (var b = 0; b < l; b++)
d.push(Object(q.h)(E, f)), f += 4;
}
return { sampleCount: l, SampleSize: d };
}, V.sr = function(E) {
for (var d = E[7], l = [], f = Object(q.h)(E, 8), b = 12, N = 0; N < f; N++)
d === 4 ? (l.push(E[b] >> 4), ++N < f && l.push(15 & E[b]), b += 1) : d === 8 ? (l.push(E[b]), b += 1) : d === 16 && (l.push(Object(q.f)(E, b)), b += 2);
return { sampleCount: f, SampleSize: l };
}, V.rr = function(E) {
for (var d = Object(q.h)(E, 4), l = 8, f = [], b = 0; b < d; b++)
f.push(Object(q.h)(E, l)), l += 4;
return { sampleNumber: f };
}, V.hr = function(E) {
for (var d = Object(q.h)(E, 4), l = 8, f = [], b = 0; b < d; b++)
f.push({ sampleCount: Object(q.h)(E, l), sampleOffset: Object(q.e)(E, l + 4) }), l += 8;
return { compositionOffset: f };
}, V.Zs = function(E) {
var d = 0, l = 0;
return E[0] === 1 ? (d = Object(q.h)(E, 20), l = Object(q.i)(E, 24)) : (d = Object(q.h)(E, 12), l = Object(q.h)(E, 16)), { timescale: d, duration: l };
}, V.Ss = function(E) {
var d = V.readBoxes(E), l = { meta: {} };
return d.forEach(function(f) {
f.data && f.name === "meta" && L()(l.meta, V.dr(f.data));
}), l;
}, V.dr = function(E) {
var d = Object(q.h)(E, 4), l = {};
return (d === 1751411826 ? V.readBoxes(E.subarray(0, E.byteLength)) : V.readBoxes(E.subarray(4, E.byteLength))).forEach(function(f) {
f.data && (f.name === "hdlr" ? V.Ks(f.data) : f.name === "ilst" && L()(l, V.lr(f.data)));
}), l;
}, V.lr = function(E) {
for (var d = {}, l = 0, f = function() {
var b = Object(q.h)(E, l);
l += 4;
var N = Object(q.a)(E, l, 4);
l += 4, V.readBoxes(E.subarray(l, l + b - 8)).forEach(function(H) {
var S = H.data;
d[N] = S ? Object(q.a)(S, 8, S.length - 8) : "";
}), l += b - 8;
}; l < E.length; )
f();
return d;
}, V;
}(), Vr = [64, 102, 103, 104, 105, 107], ir = [64, 102, 103, 104], Zt = { avc1: X.c.h264, avcC: X.c.h264, hev1: X.c.hevc, hvc1: X.c.hevc, hvcC: X.c.hevc, kvc3: X.c.kvc3, kvc4: X.c.kvc4, kvc5: X.c.kvc5, kvc6: X.c.kvc6, kvc7: X.c.kvc30, kvLC: X.c.kvc30, av01: X.c.av1, av1C: X.c.av1, bvc2: X.c.bvc2, bv2C: X.c.bvc2, vvc1: X.c.vvc, vvcC: X.c.vvc }, Dn = "notReady", vt = "mp4-demuxer", Ei = function(V) {
function E(l, f, b, N, H) {
var S;
return (S = V.call(this, l, f, b, N, H) || this).Vn = 1 / 0, S.Un = 4, S.br = void 0, S.pr = void 0, S.mr = 0, S.gr = 0, S.It = 0, S.yr = void 0, S._r = void 0, S.Cr = void 0, S.Ir = void 0, S.Or = !1, S.wr = 8, S.Er = 0, S.jr = !0, S.kr = !1, S.Mr = 0, S.Pn = void 0, S.Sr = !1, S.ki = void 0, S.Gn = void 0, l.i(vt, "constructor"), S;
}
W()(E, V), E.probe = function(l) {
var f = Object(q.a)(l, 4, 4);
return !(f !== "styp" && f !== "ftyp");
};
var d = E.prototype;
return d.append = function(l, f, b, N, H, S) {
if (H === void 0 && (H = !1), this.jr) {
this.Fe = S, this._t.put(l), this.Ue || (this.Ue = { timeOffset: f, contiguous: b, accurateTimeOffset: N }), this.Or && this.Br() && this.Tr();
do {
if (this.Dr(), !this.pr || !this.jr)
return;
for (b || (this.Or || this.Rr(f), b = !0); this._t.unreadLen && this.Lr(); ) {
if (!this.Cr) {
var Y = this.Nr();
if (Y === Dn)
return void this.Ci.i(vt, "sample not ready");
this.Cr = Y;
}
if (!this.Cr)
return void (!this.Or && this.It < this.Mr && this.Di(Object(s.e)(s.b.MUX_ERROR, s.a.REMUX_ERROR, "can not find next sample")));
if (this.It) {
var ce = this.Cr.start - this.It;
if (this._t.unreadLen < ce)
return;
this._t.skip(this.Cr.start - this.It);
}
if (this.It = this.Cr.start, !(this.Cr && this.Cr.end - this.Cr.start <= this._t.unreadLen))
break;
var Ae = this._t.get(this.Cr.end - this.Cr.start);
if (!Ae)
return;
this.It += Ae.byteLength, this.Cr.type === X.o.VIDEO ? (this.Mi.active && this.Qr(this.Cr, Ae), this.mr++) : (this.Ne.active && this.Vr(this.Cr, Ae), this.gr++), this.Cr = void 0;
}
this.Br() && this.Tr();
} while (this.Or && this.Ur());
this.kr && !H || (this.Ke(H && !this.Lr()), H && this.Ai.emit(oe.a.PARSED_DATA, { extra: this._i }));
}
}, d.Dr = function() {
for (; this.Ur(); ) {
if (!this.Ir) {
var l = this._t.get(8);
if (!l)
return;
var f = Object(q.h)(l);
this.Ir = { size: f, name: Object(q.a)(l, 4, 4), headSize: f > 1 ? 8 : 16 }, this.It += 8;
}
if (this.Ir.size === 1) {
if (!(this._t.unreadLen >= 8))
return void (this.wr = 8);
var b = this._t.get(8);
if (!b)
return;
var N = Object(q.i)(b);
this.Ir.size = N, this.It += 8;
}
var H = this.Ir.size - this.Ir.headSize;
if (this.Ir.name === "mdat") {
if (this.Mr = this.It, !this.pr)
return this.Ir = void 0, this.jr = !1, void this.Ai.emit(oe.a.MP4_NOT_FASTSTART, { pos: this.It + H });
if (this.Or) {
this.Fr(this.It), this.wr = 0, this.Er = this.It + H;
break;
}
if (!this.Or) {
this.Ir = void 0, this.wr = 0;
break;
}
}
if (this._t.unreadLen >= H) {
var S = this._t.get(H);
if (this.Ir.data = S, this.It += H, this.wr = 8, this.Ir.name === "moov") {
if (this.Pr(this.Ir), this.yr && this.yr.samples.length || this._r && this._r.samples.length) {
this.wr = 0, this.Ir = void 0;
break;
}
this.Ir = void 0;
} else
this.Ir.name === "moof" ? (this.kr && this.Ke(), this.Or = !0, this.Hr(this.Ir, this.It), this.Ir = void 0) : this.Ir.name === "sidx" ? (this.Yr(this.Ir, this.It), this.Ir = void 0) : this.Ir.name === "ftyp" ? (this.br = si.ftyp(this.Ir), this.Ir = void 0) : this.Ir = void 0;
} else
this.wr = H;
}
}, d.Fr = function(l) {
var f, b, N = this.gr, H = this.mr, S = (f = this._r) == null ? void 0 : f.samples, Y = (b = this.yr) == null ? void 0 : b.samples, ce = S && S[N], Ae = Y && Y[H];
if (ce && Ae)
for (var _e = l, me = S[N], Ce = Y[H]; me || Ce; ) {
var Me = me ? me.noOffset ? me.start + _e : me.start : Number.MAX_SAFE_INTEGER, Ge = Ce ? Ce.noOffset ? Ce.start + _e : Ce.start : Number.MAX_SAFE_INTEGER, xe = void 0;
if (Me === Ge ? me && me.noOffset ? (xe = Ce, H++) : (xe = me, N++) : Me < Ge ? (xe = me, N++) : (xe = Ce, H++), xe) {
if (xe.noOffset) {
xe.noOffset = void 0;
var Ze = xe.end - xe.start;
xe.start = Math.min(Me, Ge), xe.end = xe.start + Ze;
}
_e = xe.end;
}
me = S[N], Ce = Y[H];
}
else if (ce || Ae) {
var $e = ce ? S : Y;
if (!$e)
return;
for (var et = $e.length - 1; et >= 0; et--) {
var st = $e[et];
if (st && st.noOffset) {
st.noOffset = void 0, st.start += l, st.end += l;
break;
}
}
}
}, d.Ur = function() {
return !!(this.wr && this._t.unreadLen >= this.wr);
}, d.Br = function() {
return !!(this.Or && this.Er && !this.Lr() && this.Er <= this.It + this._t.unreadLen);
}, d.Tr = function() {
this.Br() && (this._t.skip(this.Er - this.It), this.It = this.Er, this.Ir = void 0, this.wr = 8, this.Er = 0);
}, d.resetInitSegment = function(l, f) {
V.prototype.resetInitSegment.call(this, l), this.jr = !0, f && this._t.put(f), this.mr = 0, this.gr = 0, this.It = 0, this.Cr = void 0, this.Qe && this.Qe.reset(), this.Or && (this.yr && (this.yr.samples = [], this.yr.endPTS = 0), this._r && (this._r.samples = [], this._r.endPTS = 0), this.wr = 8, this.Ir = void 0), this.Ci.i(vt, "reset init");
}, d.Qr = function(l, f) {
var b = this, N = 0, H = [], S = !1, Y = this.Mi, ce = [], Ae = [], _e = !1;
if (Y.codecType === X.c.av1)
this.Gn || (this.Gn = ee.createCtx()), ee.parseOBU(f, this.Gn).forEach(function(Ze) {
var $e;
Ze.obu_type === we.AV1_OBU_SEQUENCE_HEADER && Ze.content && Dt.updateAV1Track(b.Ci, Y, Ze.content), S = S || Ze.obu_type !== we.AV1_OBU_SEQUENCE_HEADER && !(($e = Ze.content) == null || !$e.keyframe), H.push({ type: 0, data: Ze.data });
});
else
for (; N < f.byteLength; ) {
var me = Object(q.h)(f, N);
if (N += 4, me > l.size) {
this.Ci.i(vt, "nalu size error. " + me + " > " + l.size);
break;
}
var Ce = f.subarray(N, N + me);
this.Un === 3 && (me >>>= 8);
var Me = 0, Ge = void 0;
if (Y.codecType === X.c.h264) {
if ((Me = 31 & Ce[0]) === Pe.H264_NAL_IDR_SLICE)
S = S || !0;
else if (Me === Pe.H264_NAL_SEI)
ce.push.apply(ce, Ye.parse(Ce.subarray(1)));
else if (Me === Pe.PRIV_NAL_MAGIC_H264)
try {
Ae.push(Te.parse(Ce, !0));
} catch (Ze) {
this.Ci.w(vt, "PrivNal parse error " + Ze);
}
this.Pn || (this.Pn = { spsList: [], ppsList: [] }), Me === Pe.H264_NAL_SPS ? Ct.onH264SPSNalu(Ce, this.Pn) && (_e = !0) : Me === Pe.H264_NAL_PPS && Ct.onH264PPSNalu(Ce, this.Pn) && (_e = !0);
} else if (ne(Y.codecType)) {
if ((Me = (126 & Ce[0]) >> 1) === ae.a.HEVC_NAL_IDR_W_RADL || Me === ae.a.HEVC_NAL_IDR_N_LP || Me === ae.a.HEVC_NAL_CRA_NUT)
S = S || !0;
else if (Me === ae.a.HEVC_NAL_SEI_PREFIX || Me === ae.a.HEVC_NAL_SEI_SUFFIX)
ce.push.apply(ce, Ye.parse(Ce.subarray(2)));
else if (Me === ae.a.PRIV_NAL_MAGIC_HEVC)
try {
Ae.push(Te.parse(Ce, !1));
} catch (Ze) {
this.Ci.w(vt, "PrivNal parse error " + Ze);
}
this.Pn || (this.Pn = { vpsList: [], spsList: [], ppsList: [] }), Me === ae.a.HEVC_NAL_VPS ? Ct.onHEVCVPSNalu(this.Ci, Ce, this.Pn) && (_e = !0) : Me === ae.a.HEVC_NAL_SPS ? Ct.onHEVCSPSNalu(Ce, this.Pn, Y.codecType) && (_e = !0) : Me === ae.a.HEVC_NAL_PPS && Ct.onHEVCPPSNalu(Ce, this.Pn) && (_e = !0);
} else
Le(Y.codecType) && (Me = (248 & Ce[1]) >> 3, Ge = (7 & Ce[1]) - 1, Me !== nt.a.VVC_NAL_UNIT_CODED_SLICE_IDR_W_RADL && Me !== nt.a.VVC_NAL_UNIT_CODED_SLICE_IDR_N_LP || (S = S || !0), this.Pn || (this.Pn = { vpsList: [], spsList: [], ppsList: [] }), Me === nt.a.VVC_NAL_UNIT_VPS ? Ct.onVVCVPSNalu(Ce, this.Pn) && (_e = !0) : Me === nt.a.VVC_NAL_UNIT_SPS ? Ct.onVVCSPSNalu(Ce, this.Pn) && (_e = !0) : Me === ae.a.HEVC_NAL_PPS && Ct.onVVCPPSNalu(Ce, this.Pn) && (_e = !0));
H.push({ type: Me, data: Ce, temporalId: Ge }), N += me;
}
if (_e && this.Pn && Ct.isParamSetsReady(this.Pn) && (this.Ci.i(vt, "dec param sets update."), this.Gr(Y, this.Pn, _e)), H.length) {
var xe = { units: H, dts: l.dts, cts: l.cts, pts: l.pts, originDTS: l.dts, originPTS: l.pts, key: S, duration: l.duration, size: H.reduce(function(Ze, $e) {
return Ze + $e.data.length;
}, 0) };
ce.length && (xe.sei = { sei: ce, streamTimestamp: Object(mt.d)(l.pts, Y.inputTimescale) }), Ae.length && (xe.privNal = { info: Ae, streamTimestamp: Object(mt.d)(l.pts, Y.inputTimescale) }), l.auxiliaryInfo && (xe.auxiliaryInfo = l.auxiliaryInfo), this.$e(xe);
}
}, d.Vr = function(l, f) {
var b, N = this.Ne;
if (N.codecType !== X.c.aac || !(f.length <= 2 || N.asc && N.asc === Object(q.f)(f)))
if (N.codecType === X.c.mp3) {
var H;
b = (H = $(N, f, 0, l.dts, 0)) == null ? void 0 : H.sample;
} else {
if (b = { unit: f, dts: l.dts, pts: l.dts, duration: l.duration || l.duration || N.sampleDuration, originDTS: l.dts, originPTS: l.dts }, l.auxiliaryInfo && (b.auxiliaryInfo = l.auxiliaryInfo), f.length > 2 && f[0] === 255 && f[1] >> 4 == 15) {
this.Ci.i(vt, "adts header detected.");
var S = j.a(this.Ci, N, f, 0, l.dts, 0, l.dts);
S && (b = S.sample);
} else
N.samples.push(b);
if (this.di.enableAacPriv && typeof N.aacSampleingIndex == "number" && typeof N.aot == "number") {
var Y = j.h(this.Ci, f, N.aacSampleingIndex, N.aot);
Y && (b.aacPriv = [{ payload: Y.priv, streamTimestamp: Object(mt.d)(l.pts, N.inputTimescale) }]);
}
}
}, d.Lr = function() {
return !!(this._r && this.gr < this._r.samples.length || this.yr && this.mr < this.yr.samples.length);
}, d.Nr = function() {
var l = this._r ? this._r.samples[this.gr] : void 0, f = this.yr ? this.yr.samples[this.mr] : void 0, b = l ? l.start - this.It : -1, N = f ? f.start - this.It : -1;
return N >= 0 && (N < b || N > b && b < 0) ? f : b >= 0 && (b < N || b > N && N < 0) ? l : this.Or && (b < N && l != null && l.noOffset || b > N && f != null && f.noOffset) ? Dn : void 0;
}, d.Ke = function(l) {
l === void 0 && (l = !1);
var f = this.Ne, b = this.Mi;
this.We(f, b) && (this.Ze(f, b), l && le.a.alignEndByRemuxer(this.Ci, f, b, this.De), this.Xe(f, b, l) && this.qe(f, b, l, this.Or ? o.b.FMP4 : o.b.MP4, this.ki));
}, d.Kr = function(l) {
if (this.pr)
for (var f = 0; f < this.pr.mvex.length; f++) {
var b;
if (((b = this.pr.mvex[f].trex) == null ? void 0 : b.trackID) === l)
return this.pr.mvex[f].trex;
}
}, d.Zr = function(l) {
if (this.pr)
for (var f = 0; f < this.pr.trak.length; f++) {
var b;
if (((b = this.pr.trak[f].tkhd) == null ? void 0 : b.trackId) === l)
return this.pr.trak[f];
}
}, d.Hr = function(l, f) {
var b, N = this, H = si.moof(l);
H.traf && H.traf.length > 1 && (this.kr = !0), (b = H.traf) == null || b.forEach(function(S) {
var Y = S.tfdt, ce = S.tfhd, Ae = S.trun;
if (ce && Ae) {
var _e, me = N.Kr(ce.trackID), Ce = (Y == null ? void 0 : Y.baseMediaDecodeTime) || 0, Me = 0, Ge = ce.defaultSampleSize || (me == null ? void 0 : me.defaultSampleSize) || 0, xe = Ge, Ze = ce.defaultSampleDuration || (me == null ? void 0 : me.defaultSampleDuration) || 0, $e = ce.trackID || 0;
$e === N.Mi.id && (_e = N.Mi), $e === N.Ne.id && (_e = N.Ne);
var et = N.Zr($e);
if (et && _e) {
var st, Ke;
if ((st = et.mdia) != null && (st = st.mdhd) != null && st.timescale && (_e.inputTimescale = et.mdia.mdhd.timescale), _e.sampleDescIndex = ce.sampleDescriptionIndex, _e.type === X.o.VIDEO && N.yr ? Ke = N.yr : _e.type === X.o.AUDIO && N._r && (Ke = N._r), !Ke)
return;
var Tt = Ke.samples.length;
_e.type === "video" && typeof N.Le == "number" && N.Le > Ce ? Ce = N.Le : _e.type === "audio" && typeof N.Re == "number" && N.Re > Ce && (Ce = N.Re);
var It = 0;
Ae.forEach(function(ut) {
if (_e && Ke) {
var Et = !ut.dataOffset, ft = 0;
Et || (ft = ce.baseDataOffset ? ce.baseDataOffset + ut.dataOffset : ut.dataOffset + f - l.size);
for (var Lt = 0; Lt < (ut.sampleCount || 0); Lt++) {
Ze = ut.sampleDuration[Lt] || ce.defaultSampleDuration || (me == null ? void 0 : me.defaultSampleDuration) || Ze || 0, Me = ut.sampleCompositionTimeOffset[Lt] || 0, xe = ut.sampleSize[Lt] || Ge, Ze || _e.type !== X.o.AUDIO || (Ze = j.c(_e.samplerate, _e.inputTimescale));
var Wt = { type: _e.type, index: Tt, gopID: 0, dts: Ce, cts: Me, pts: Ce + Me, duration: Ze, start: ft, end: ft + xe, size: xe, noOffset: Et };
if (S.senc) {
if (_e.useSubSampleEnc = S.senc.useSubSampleEnc, S.senc.encItemData[Lt])
Wt.auxiliaryInfo = { enc: S.senc.encItemData[Lt] };
else if (S.saiz && S.senc.encData) {
var Yt = S.saiz.sampleInfoSize[Lt] || S.saiz.defaultSampleInfoSize;
Wt.auxiliaryInfo = { enc: S.senc.encData.subarray(It, It + Yt) }, It += Yt;
}
}
ft += xe, Ce += Ze, Tt++, Ke.samples.push(Wt), Ke.endPTS = Ce + Me;
}
}
}), _e.type === "video" ? N.Le = Ce : _e.type === "audio" && (N.Re = Ce);
}
}
});
}, d.Yr = function(l, f) {
var b = si.sidx(l), N = this.yr;
if (b && N && b.referenceID === this.Mi.id) {
N.keyframes = [];
var H = b.earliestPresentationTime / b.timescale, S = f;
b.references.forEach(function(Y) {
N.keyframes.push({ time: H, position: S }), H += Y.duration, S += Y.size;
}), this.Ai.emit(oe.a.KEY_FRAME_INDEXS, { keyframes: N.keyframes, append: !0 });
}
}, d.Pr = function(l) {
var f, b, N = this;
this.Ci.i(vt, "parse moov size: " + l.size);
var H = this.pr = si.moov(l), S = { mp4MoovSize: l.size };
if (H.udta && H.udta.forEach(function(Ke) {
L()(S, Ke.meta);
}), this.br && L()(S, this.br), H.mvhd) {
var Y = H.mvhd.timescale;
this.Vn = H.mvhd.duration / Y, this.Vn || H.mvex.forEach(function(Ke) {
Ke.mehd && (S.duration = N.Vn = Ke.mehd.fragmentDuration / Y);
}), S.duration = this.Vn;
}
if (this.ki = [], H.pssh.forEach(function(Ke) {
Ke.data && N.ki && N.ki.push(Ke.data);
}), H.trak.forEach(function(Ke) {
var Tt, It, ut, Et;
if (Ke.mdia && Ke.mdia.minf && Ke.mdia.minf.stbl && Ke.mdia.hdlr && Ke.mdia.mdhd && Ke.tkhd) {
if (Ke.mdia.hdlr.type === "vide")
N.Mi.active === void 0 && (N.Mi.active = !0), N.yr = N.Wr(N.Mi, Ke.mdia.minf.stbl, Ke.mdia.mdhd, H.mvhd, (Tt = Ke.edts) == null ? void 0 : Tt.elst), N.Mi.rotation = mi(Ke.tkhd.matrix), N.Mi.id = Ke.tkhd.trackId, (It = N.ki) != null && It.length && (N.Mi.stsd = (ut = Ke.mdia.minf.stbl.stsd) == null ? void 0 : ut.boxData), N.Mi.bitrate || (N.Mi.bitrate = 8 * (((Et = N.yr) == null ? void 0 : Et.size) || 0) / 1e3 / (Ke.mdia.mdhd.duration / Ke.mdia.mdhd.timescale));
else if (Ke.mdia.hdlr.type === "soun") {
var ft, Lt, Wt, Yt;
N.Ne.active === void 0 && (N.Ne.active = !0), N.Ne.id = Ke.tkhd.trackId, N._r = N.Wr(N.Ne, Ke.mdia.minf.stbl, Ke.mdia.mdhd, H.mvhd, (ft = Ke.edts) == null ? void 0 : ft.elst), (Lt = N.ki) != null && Lt.length && (N.Ne.stsd = (Wt = Ke.mdia.minf.stbl.stsd) == null ? void 0 : Wt.boxData), !N.Ne.bitrate && (N.Ne.bitrate = 8 * (((Yt = N._r) == null ? void 0 : Yt.size) || 0) / 1e3 / (Ke.mdia.mdhd.duration / Ke.mdia.mdhd.timescale));
}
}
}), this.yr && this.yr.description.length && this.Xr(this.yr.description), this._r && this._r.description.length && this.zr(this._r.description), this.yr) {
var ce, Ae, _e, me;
this.yr.keyframes && (S.keyframes = this.yr.keyframes, this._r && this._r.samples.length && this.yr.keyframes.length && this._r.samples[0].start < this.yr.keyframes[0].position && (S.keyframes[0] = L()({}, S.keyframes[0]), S.keyframes[0].position = this._r.samples[0].start));
var Ce = [], Me = this.Mi.inputTimescale, Ge = this.De.computeInitPTSDTS(0, (ce = this._r) != null && ce.samples ? (Ae = this._r) == null ? void 0 : Ae.samples[0] : void 0, (_e = this.yr) != null && _e.samples ? (me = this.yr) == null ? void 0 : me.samples[0] : void 0, this.Ne.inputTimescale, this.Mi.inputTimescale), xe = Ge.initDTS, Ze = Ge.initPTS;
this.yr.samples.forEach(function(Ke) {
Ce.push({ index: 0, dts: Ke.dts / Me - xe, pts: Ke.pts / Me - Ze, duration: Ke.duration / Me });
}), Ce.sort(function(Ke, Tt) {
return Ke.pts - Tt.pts;
}), Ce.forEach(function(Ke, Tt) {
Ke.index = Tt;
}), S.videoFramesInfo = Ce;
} else if (this._r && this._r.samples.length) {
var $e = 0, et = this.Ne.inputTimescale, st = [{ time: 0, position: this._r.samples[0].start }];
this._r.samples.forEach(function(Ke) {
Ke.dts - $e > 10 * et && (st.push({ time: Ke.dts / et, position: Ke.start }), $e = Ke.dts);
}), S.keyframes = st;
}
S.duration = Math.max(((f = this.yr) == null ? void 0 : f.duration) || 0, ((b = this._r) == null ? void 0 : b.duration) || 0, this.Vn), this.Sr && (S.mp4MoovNoPs = !0), this.Ci.i(vt, "Parsed onMetaData"), this.Ai.emit(oe.a.METADATA, S);
}, d.Rr = function(l) {
var f, b;
if (this.Ci.i(vt, "seek:" + l), l === 0 || this.Or)
return this.mr = 0, void (this.gr = 0);
var N = (f = this.yr) == null ? void 0 : f.samples, H = (b = this._r) == null ? void 0 : b.samples;
if (N && this.yr) {
var S = Qr.a.getPosByTime(this.yr.keyframes, l);
S && (this.mr = this.Jr(N, S.position));
}
if (H)
if (this.yr) {
if (N) {
var Y = N[this.mr];
Y && (this.gr = this.Jr(H, Y.end), this.Ci.i(vt, "seek audio by video pos: " + l + " a: " + this.gr + " v: " + this.mr));
}
} else
this.gr = this.qr(H, l * this.Mi.inputTimescale), this.Ci.i(vt, "seek audio by time: " + l + " a: " + this.gr + " v: " + this.mr);
}, d.Jr = function(l, f) {
if (l[0] && f < l[0].start)
return 0;
if (l[l.length - 1] && f >= l[l.length - 1].end)
return l.length - 1;
for (var b, N = 0, H = l.length - 1, S = 0, Y = 0; N <= H; ) {
if (f >= ((b = (Y = (S = (N + H) / 2 | 0) - 1) >= 0 ? l[Y] : void 0) ? b.end : l[S].start) && f < l[S].end)
return S;
if (f === l[S].end)
return S + 1;
f > l[S].end ? N = S + 1 : H = S - 1;
}
return 0;
}, d.qr = function(l, f) {
if (l[0] && f < l[0].dts)
return 0;
if (l[l.length - 1] && f >= l[l.length - 1].dts)
return l.length - 1;
for (var b = 0, N = l.length - 1, H = 0, S = 0, Y = 0; b <= N; )
if (f > (Y = l[S = (H = (b + N) / 2 | 0) + 1] ? l[S].dts : Number.MAX_SAFE_INTEGER))
b = S;
else {
if (!(f < l[H].dts))
return f === Y ? S : H;
N = H - 1;
}
return 0;
}, d.Xr = function(l) {
var f = this;
this.Ci.i(vt, "parse video desc: " + l[0].name);
var b = !1;
l.forEach(function(N) {
N.name !== "avc1" && N.name !== "hev1" && N.name !== "hvc1" && N.name !== "kvc3" && N.name !== "kvc4" && N.name !== "kvc5" && N.name !== "kvc6" && N.name !== "av01" && N.name !== "encv" && N.name !== "bvc2" && N.name !== "kvc7" && N.name !== "vvc1" || (f.$r(N), b = !0);
}), b || (this.Ci.i(vt, "video codec unsupported"), this.Mi.active = !1);
}, d.zr = function(l) {
var f = this;
this.Ci.i(vt, "parse audio desc: " + l[0].name);
var b = !1;
l.forEach(function(N) {
(N.name === "mp4a" || N.name === "enca" || N.name === "Opus" && f.li.opus) && (f.th(N), b = !0);
}), b || (this.Ci.i(vt, "audio codec unsupported"), this.Ne.active = !1);
}, d.th = function(l) {
var f = this;
if (l.data && l.data) {
var b = 8, N = Object(q.f)(l.data, b);
b += N >= 2 ? 56 : N === 1 ? 36 : 20, si.readBoxes(l.data.subarray(b, l.data.byteLength)).forEach(function(H) {
if (H.name === "esds")
f.ih(H);
else if (H.name === "wave" && H.data)
si.readBoxes(H.data).forEach(function(Y) {
Y.name === "esds" && f.ih(Y);
});
else if (H.name === "btrt") {
var S = si.btrt(H);
S && (f.Ne.maxBitrate = S.maxBitrate / 1e3, f.Ne.bitrate = S.avgBitrate / 1e3);
} else
H.name === "dOps" && H.data && (f.Ne.codecType = X.c.opus, f.Ne.codec = "opus", f.Ne.channelCount = H.data[1], f.Ne.samplerate = Object(q.h)(H.data, 4));
});
}
}, d.ih = function(l) {
if (l.name === "esds") {
var f = this.Ne, b = si.esds(l);
if (b) {
var N = jt.getObjectTypeIndication(b);
if (Vr.indexOf(N) === -1)
return void (f.active = !1);
if (ir.indexOf(N) !== -1) {
var H = jt.getAudioConfig(b);
H && j.d(this.Ci, f, this.Ai, H, o.a.ASC), f.codecType = X.c.aac;
} else
f.codecType = X.c.mp3;
}
}
}, d.$r = function(l) {
var f = this;
if (l.data) {
var b = this.Mi, N = si.readBoxes(l.data.subarray(78, l.data.byteLength)), H = this.Ye();
N.forEach(function(S) {
var Y;
if (S.name === "avcC")
b.codecType = Zt[S.name], Dt.onAVCDetected(f.Ci, b, f.di, f.li, H), f.eh(b, S), f.nh(b), f.Ai.emit(oe.a.VIDEO_CODEC_DETECTED, { enabled: !0, decoder: X.d.buildin, codecType: X.c.h264, timeOffset: ((Y = f.Ue) == null ? void 0 : Y.timeOffset) || 0 });
else if (S.name === "hvcC")
ne(b.codecType) || (b.codecType = Zt[l.name] || X.c.hevc, b.codecType === X.c.hevc ? Dt.onHEVCDetected(f.Ci, b, f.di, f.li, H) : Dt.onKVCDetected(f.Ci, b, f.di, H)), f.rh(b, S), f.nh(b);
else if (S.name === "av1C")
b.codecType = Zt[S.name], Dt.onAV1Detected(f.Ci, b, f.di, f.li, H), f.hh(b, S), f.nh(b);
else if (S.name === "vvcC" || S.name === "bv2C" || S.name === "kvLC")
b.codecType = Zt[S.name], Dt.onVVCDetected(f.Ci, b, f.di, H), f.oh(b, S), f.nh(b);
else if (S.name === "btrt") {
var ce = si.btrt(S);
ce && (b.maxBitrate = ce.maxBitrate / 1e3, b.bitrate = ce.avgBitrate / 1e3);
} else if (S.name === "pasp") {
var Ae = si.pasp(S);
Ae && f.Mi.sar.width == f.Mi.sar.height && (f.Mi.sar = { width: Ae.hSpacing, height: Ae.vSpacing });
}
});
}
}, d.hh = function(l, f) {
if (f.data) {
this.Gn = ee.createCtx();
var b = Ct.parseAV1C(this.Ci, f.data, this.Gn);
b ? b.sh && Dt.updateAV1Track(this.Ci, l, b.sh, f.data) : this.Di(Object(s.e)(s.b.MUX_ERROR, s.a.PARSING_ERROR, "Invalid AV1DecoderConfigurationRecord"));
}
}, d.eh = function(l, f) {
if (f.data) {
var b = Ct.parseAVCC(this.Ci, f.data);
b && Ct.isParamSetsReady(b.paramSets) ? (this.Pn = b.paramSets, this.Gr(l, b.paramSets)) : (this.Ci.i(vt, "parse avcc no sps/pps."), this.Sr = !0);
}
}, d.rh = function(l, f) {
if (this.Ci.i(vt, "parse hvcc", l.codecType), f.data) {
var b = Ct.parseHVCC(this.Ci, f.data, l.codecType), N = b && Ct.isParamSetsReady(b.paramSets);
if (N ? (this.Pn = b.paramSets, this.Gr(l, b.paramSets)) : (this.Ci.i(vt, "parse hvcc no vps/sps/pps."), this.Sr = !0), this.Mi.outputRaw && N) {
var H = Ct.hevDecoderConfigToSample(b.paramSets, 0);
this.Ai.emit(oe.a.RAW_DATA, { type: o.d.decoderConfig, samples: re([H], l.inputTimescale), extra: this._i });
}
}
}, d.oh = function(l, f) {
if (this.Ci.i(vt, "parse vvcC", l.codecType), f.data) {
var b, N = (b = l.codecType === X.c.kvc30 ? Ct.parseKvLC(this.Ci, f.data) : l.codecType === X.c.bvc2 ? Ct.parseBV2C(this.Ci, f.data) : Ct.parseVvcC(this.Ci, f.data)) && Ct.isParamSetsReady(b.paramSets);
if (N ? (this.Pn = b.paramSets, this.Gr(l, b.paramSets)) : (this.Ci.i(vt, "parse vvcc no vps/sps/pps."), this.Sr = !0), this.Mi.outputRaw && N) {
var H = Ct.vvcDecoderConfigToSample(b.paramSets, 0);
this.Ai.emit(oe.a.RAW_DATA, { type: o.d.decoderConfig, samples: [H], extra: this._i });
}
}
}, d.Gr = function(l, f, b) {
var N;
b === void 0 && (b = !0), l.codecType === X.c.h264 ? Dt.updateAVCTrack(this.Ci, l, f) : ne(l.codecType) ? Dt.updateHEVCTrack(this.Ci, l, f) : Le(l.codecType) && (Dt.updateVVCTrack(this.Ci, l, f), l.sampleDuration = this.yr && this.yr.samples.length ? Math.round(this.Vn * l.inputTimescale / this.yr.samples.length) : 3003, l.duration = this.Vn), b && this.Ai.emit(oe.a.VIDEO_CODEC_DETECTED, { codecType: l.codecType || X.c.unknown, enabled: !!l.active, decoder: this.Mi.outputRaw ? X.d.wasm : X.d.buildin, bitDepth: l.bitDepth, timeOffset: ((N = this.Ue) == null ? void 0 : N.timeOffset) || 0 });
}, d.Wr = function(l, f, b, N, H) {
this.Ci.i(vt, "parse stbl type: " + l.type, this.Vn);
var S = { description: f.stsd ? f.stsd.sampleEntrys : [], samples: [], keyframes: [], endPTS: 0, size: 0, duration: b.duration / b.timescale };
if (l.inputTimescale = b.timescale, l.duration = b.duration, f.stco && f.stsc && f.stsz && f.stsz.sampleCount) {
var Y, ce, Ae, _e = 0, me = 0, Ce = f.stco.chunkOffset[_e], Me = f.stsc.sampleToChunkBox[me], Ge = (Y = Me) == null ? void 0 : Y.samplesPerChunk, xe = (ce = Me) == null ? void 0 : ce.firstChunk, Ze = 0, $e = Math.ceil(Object(mt.e)(1, l.inputTimescale));
if (!Me)
throw new Error("mp4 stbl error. sampleToChunkBox undefined");
if (typeof Ge != "number")
throw new Error("mp4 stbl error. chunkSampleCount");
if (typeof xe != "number")
throw new Error("mp4 stbl error. firstChunk");
var et = 0, st = void 0, Ke = 0, Tt = 0;
if (f.stts) {
if (!(st = f.stts.timeToSample[et]))
throw new Error("mp4 stbl error. timeToSample");
Ke = st.sampleCount;
}
var It = 0, ut = void 0, Et = 0, ft = 0;
if (f.ctts) {
if (!(ut = f.ctts.compositionOffset[It]))
throw new Error("mp4 stbl error. compositionOffset");
Et = ut.sampleCount;
}
var Lt = 0, Wt = 0;
f.stss && (Wt = f.stss.sampleNumber[Lt]);
for (var Yt = 0; Yt < f.stsz.sampleCount; Yt++) {
if (Yt >= Ge && _e < f.stco.chunkOffset.length) {
Ze = 0, xe++, _e++, Ce = f.stco.chunkOffset[_e];
var hi = f.stsc.sampleToChunkBox[me + 1];
hi && xe >= hi.firstChunk && (me++, Me = hi), Ge += Me.samplesPerChunk;
}
if (f.stts && Yt >= Ke && et < f.stts.timeToSample.length - 1 && (et++, Ke += (st = f.stts.timeToSample[et]).sampleCount), f.ctts && Yt >= Et && It < f.ctts.compositionOffset.length - 1 && (It++, Et += (ut = f.ctts.compositionOffset[It]).sampleCount), f.stss && Wt && Yt >= Wt - 1 && (Lt++, Wt = f.stss.sampleNumber[Lt], Ae = { time: 0, position: 0 }), Me && Ce) {
var Qi, Xi;
ft = ((Qi = ut) == null ? void 0 : Qi.sampleOffset) || 0;
var Ci = typeof f.stsz.SampleSize == "number" ? f.stsz.SampleSize : f.stsz.SampleSize[Yt], Xr = Math.max($e, ((Xi = st) == null ? void 0 : Xi.sampleDelta) || 0);
Yt === 0 && (Tt = 0 - ft);
var Ji = Tt + ft, an = { type: l.type, index: Yt, gopID: S.keyframes.length || 1, dts: Tt, cts: ft, pts: Ji, duration: Xr, start: Ce + Ze, end: Ce + Ze + Ci, size: Ci };
Ji > S.endPTS && (S.endPTS = Ji), S.samples.push(an), S.size += Ci, Ae && (Ae.time = S.keyframes.length ? Math.round((Tt + ft) / l.inputTimescale * 1e3) / 1e3 : 0, Ae.position = an.start, S.keyframes.push(Ae), Ae = void 0), Tt += Xr, Ze += Ci, !f.stss && S.keyframes.length === 0 && S.samples.length && S.keyframes.push({ time: 0, position: S.samples[0].start });
}
}
if (H && H.entries.length > 1 && N) {
this.Ci.i(vt, "elst box", l.type, H);
for (var Fr = 0, $r = 0, jr = 0, $i = 0; $i < H.entries.length; $i++) {
var Si = H.entries[$i];
$i === 0 && Si.media_time === -1 ? (Fr = Si.segment_duration, $r = 1) : $r === $i && Si.media_time >= 0 && (jr = Si.media_time);
}
if (Fr && N.timescale > 0) {
var nr = jr - (Fr = Fr / N.timescale * b.timescale), sn = nr / l.inputTimescale;
this.Ci.i(vt, "elst track: " + l.type + " timeOffset: " + nr + "/" + sn + " startTime: " + jr);
var on = 0;
S.samples.forEach(function(Ti) {
Ti.dts = Math.max(Ti.dts - nr, on), Ti.pts = Ti.dts + Ti.cts, on++;
}), on = 0, S.keyframes.forEach(function(Ti, ma) {
ma > 0 && (Ti.time = Math.max(Ti.time - sn, 0)), on = Ti.time + 1e-3;
}), S.duration -= sn;
}
}
return l.type === X.o.VIDEO && S.samples.length && b.timescale && (S.fps = S.samples.length / (b.duration / b.timescale)), S.samples.length && (l.sampleDuration = this.Vn * l.inputTimescale / S.samples.length), S;
}
return S;
}, d.nh = function(l) {
try {
var f, b;
(f = this.yr) != null && f.fps && Number.isFinite((b = this.yr) == null ? void 0 : b.fps) && this.yr.fps > 0 && (l.fps = this.yr.fps);
} catch (N) {
}
}, T()(E, null, [{ key: "probeSize", get: function() {
return 8;
} }]);
}(de), qi = n(30), ui = function(V) {
return V[V.AV_PICTURE_STRUCTURE_UNKNOWN = 0] = "AV_PICTURE_STRUCTURE_UNKNOWN", V[V.AV_PICTURE_STRUCTURE_TOP_FIELD = 1] = "AV_PICTURE_STRUCTURE_TOP_FIELD", V[V.AV_PICTURE_STRUCTURE_BOTTOM_FIELD = 2] = "AV_PICTURE_STRUCTURE_BOTTOM_FIELD", V[V.AV_PICTURE_STRUCTURE_FRAME = 3] = "AV_PICTURE_STRUCTURE_FRAME", V;
}(ui || {}), ai = function(V) {
return V[V.MMCO_END = 0] = "MMCO_END", V[V.MMCO_SHORT2UNUSED = 1] = "MMCO_SHORT2UNUSED", V[V.MMCO_LONG2UNUSED = 2] = "MMCO_LONG2UNUSED", V[V.MMCO_SHORT2LONG = 3] = "MMCO_SHORT2LONG", V[V.MMCO_SET_MAX_LONG = 4] = "MMCO_SET_MAX_LONG", V[V.MMCO_RESET = 5] = "MMCO_RESET", V[V.MMCO_LONG = 6] = "MMCO_LONG", V;
}(ai || {}), Qt = function(V) {
return V[V.AV_PICTURE_TYPE_NONE = 0] = "AV_PICTURE_TYPE_NONE", V[V.AV_PICTURE_TYPE_I = 1] = "AV_PICTURE_TYPE_I", V[V.AV_PICTURE_TYPE_P = 2] = "AV_PICTURE_TYPE_P", V[V.AV_PICTURE_TYPE_B = 3] = "AV_PICTURE_TYPE_B", V[V.AV_PICTURE_TYPE_S = 4] = "AV_PICTURE_TYPE_S", V[V.AV_PICTURE_TYPE_SI = 5] = "AV_PICTURE_TYPE_SI", V[V.AV_PICTURE_TYPE_SP = 6] = "AV_PICTURE_TYPE_SP", V[V.AV_PICTURE_TYPE_BI = 7] = "AV_PICTURE_TYPE_BI", V;
}(Qt || {}), rr = function(V) {
return V[V.HEVC_SLICE_B = 0] = "HEVC_SLICE_B", V[V.HEVC_SLICE_P = 1] = "HEVC_SLICE_P", V[V.HEVC_SLICE_I = 2] = "HEVC_SLICE_I", V;
}(rr || {}), Sn = [Qt.AV_PICTURE_TYPE_P, Qt.AV_PICTURE_TYPE_B, Qt.AV_PICTURE_TYPE_I, Qt.AV_PICTURE_TYPE_SP, Qt.AV_PICTURE_TYPE_SI], Bi = "raw-demuxer", Wa = function(V) {
function E(l, f, b, N, H) {
var S;
return l.i(Bi, "constructor"), (S = V.call(this, l, f, b, N, H) || this).ah = !1, S.uh = void 0, S.mr = 0, S.fh = 0, S.Ti = 0, S.Ah = O.f / O.d, S.dh = void 0, S.bh(), S.Qe = new Re.a(S.Ci), S;
}
W()(E, V), E.probe = function(l) {
return l.length > 4 && l[0] === 0 && l[1] === 0 && l[2] === 0 && l[3] === 1;
};
var d = E.prototype;
return d.resetInitSegment = function(l) {
this.He(l.duration), V.prototype.resetInitSegment.call(this, l), this.ah = !1, this.uh = void 0, this.mr = 0, this.fh = 0, this.bh(), this.Ci.i(Bi, "reset init");
}, d.append = function(l, f, b, N, H) {
var S = this.ph(l);
if (this.Ue || (this.Ue = { timeOffset: f, contiguous: b, accurateTimeOffset: N }), S && S.length) {
var Y = -this._t.unreadLen;
this._t.put(l);
for (var ce = 0, Ae = 0; Ae < S.length; Ae++) {
var _e = S[Ae];
if (ce = _e.pos - Y - _e.state) {
var me = this._t.get(ce);
this._t.skip(_e.state), me && (me = _e.state === 3 && me[me.length - 1] === 0 ? me.subarray(0, me.length - 1) : me, this.mh(me));
} else
this._t.skip(_e.state);
Y = _e.pos;
}
} else
this._t.put(l);
if (H) {
var Ce, Me = this._t.get(this._t.unreadLen);
Me && (this.mh(Me), this.uh && this.Mi && this.gh(), this.flush());
var Ge = { duration: (this.Ti + this.Ah) / (((Ce = this.Mi) == null ? void 0 : Ce.inputTimescale) || O.f) };
this.Ai.emit(oe.a.METADATA, Ge);
}
}, d.He = function(l) {
var f;
V.prototype.He.call(this, l), this.Mi.naluState = 0, this.Mi.active = this.Ye(), le.a.initAudioForFillSilent(this.Ci, this.Ne, (f = this._i) == null ? void 0 : f.audioCodec);
}, d.ph = function(l) {
var f = this.Mi;
if (f) {
for (var b = l.byteLength, N = [], H = 0, S = f.naluState; H < b; )
b - H > 3 && S === 0 ? (l[H + 2] === 1 ? l[H + 1] === 0 && l[H] === 0 && N.push({ pos: H + 3, state: 3 }) : l[H + 2] === 0 && (S = 1, l[H + 1] === 0 && (S = 2, l[H] === 0 && (S = 3))), H += 3) : (S < 2 ? l[H] === 0 ? S++ : S = 0 : S === 3 || S === 2 ? l[H] === 1 ? (N.push({ pos: H + 1, state: S + 1 }), S = 0) : l[H] > 1 && (S = 0) : this.Ci.w(Bi, "error state", S), H++);
return f.naluState = S, N;
}
}, d.Ke = function(l) {
var f;
l === void 0 && (l = !1), this.gh();
var b = this.Ne, N = this.Mi;
if (this.We(b, N) && ((f = this.Qe) == null || f.update(b, N), this.Xe(b, N, l))) {
var H = Object(ei.a)(N, this.fh);
this.Ai.emit(oe.a.VIDEO_FRAME_INFO, { videoFramesInfo: H }), this.Ve && this.Ai.emit(oe.a.KEY_FRAME_INDEXS, { keyframes: [{ time: 0, position: 0 }] }), this.qe(b, N, l, o.b.RAW);
}
}, d.mh = function(l) {
var f = this.Mi;
if (f) {
if (!f.codecType || f.codecType === X.c.unknown) {
var b = 31 & l[0], N = (126 & l[0]) >> 1;
if (b >= Pe.H264_NAL_SPS && b <= Pe.H264_NAL_AUD)
f.codecType = X.c.h264, this.dh = { pict_type: Qt.AV_PICTURE_TYPE_NONE, picture_structure: ui.AV_PICTURE_STRUCTURE_UNKNOWN, key_frame: 0, priv_data: { picture_structure: ui.AV_PICTURE_STRUCTURE_UNKNOWN, poc: { poc_lsb: 0, poc_msb: 0, delta_poc_bottom: 0, delta_poc: [], frame_num: 0, prev_poc_msb: 0, prev_poc_lsb: 0, frame_num_offset: 0, prev_frame_num_offset: 0, prev_frame_num: 0 }, ps: { spsList: [], ppsList: [] } } }, this.Ai.emit(oe.a.VIDEO_CODEC_DETECTED, { enabled: !0, decoder: X.d.buildin, codecType: X.c.h264, timeOffset: 0 });
else {
if (!(N >= ae.a.HEVC_NAL_VPS && N <= ae.a.HEVC_NAL_AUD || N === ae.a.HEVC_NAL_SEI_PREFIX || N === ae.a.HEVC_NAL_SEI_SUFFIX))
return void this.Di(Object(s.e)(s.b.MUX_ERROR, s.a.REMUX_ERROR, "unsupport codec"));
var H, S, Y, ce;
this.dh = { pict_type: Qt.AV_PICTURE_TYPE_NONE, picture_structure: ui.AV_PICTURE_STRUCTURE_UNKNOWN, key_frame: 0, priv_data: { ps: { spsList: [], ppsList: [], vpsList: [] }, poc: 0, pocTid0: 0, max_dec_pic_buffering: 0 } }, ((H = this._i) == null ? void 0 : H.suffix) === ".kvc3" ? f.codecType = X.c.kvc3 : ((S = this._i) == null ? void 0 : S.suffix) === ".kvc4" ? f.codecType = X.c.kvc4 : ((Y = this._i) == null ? void 0 : Y.suffix) === ".kvc5" ? f.codecType = X.c.kvc5 : ((ce = this._i) == null ? void 0 : ce.suffix) === ".kvc6" ? f.codecType = X.c.kvc6 : f.codecType = X.c.hevc;
}
}
f.codecType === X.c.h264 ? this.yh(l) : ne(f.codecType) && this._h(l);
}
}, d.yh = function(l) {
var f = this.dh, b = this.Mi;
if (f && b) {
var N = f.priv_data, H = [0, 0], S = 0;
f.pict_type = Qt.AV_PICTURE_TYPE_I, f.key_frame = 0, f.picture_structure = ui.AV_PICTURE_STRUCTURE_UNKNOWN;
var Y = { ref_idc: l[0] >> 5 & 3, type: 31 & l[0], nuh_layer_id: 0, temporal_id: 0, data: l };
if (Y.type === Pe.H264_NAL_IDR_SLICE && (b.decConf && this.Ke(), this.fh = this.mr, f.key_frame = 1, N.poc.prev_frame_num = 0, N.poc.prev_frame_num_offset = 0, N.poc.prev_poc_msb = N.poc.prev_poc_lsb = 0), Y.type === Pe.H264_NAL_IDR_SLICE || Y.type === Pe.H264_NAL_SLICE) {
var ce = Object(m.c)(Se(l.subarray(1, l.byteLength)));
Y.gbCtx = ce, Object(m.h)(ce);
var Ae = Object(m.h)(ce);
f.pict_type = Sn[Ae % 5];
var _e = Object(m.h)(ce), me = N.ps.ppsList[_e], Ce = N.ps.spsList[me.sps_id];
if (N.ps.sps = Ce, N.ps.pps = me, !(N.ps.sps && N.ps.pps && Ce && me))
throw new Error("raw nal slice error. sps/pps undefined");
N.ps.sps.ref_frame_count <= 1 && N.ps.pps.ref_count[0] <= 1 && f.pict_type === Qt.AV_PICTURE_TYPE_I && (f.key_frame = 1), N.poc.frame_num = Object(m.a)(ce, Ce.log2_max_frame_num), Ce.frame_mbs_only_flag ? N.picture_structure = ui.AV_PICTURE_STRUCTURE_FRAME : Object(m.a)(ce, 1) ? N.picture_structure = ui.AV_PICTURE_STRUCTURE_TOP_FIELD + Object(m.a)(ce, 1) : N.picture_structure = ui.AV_PICTURE_STRUCTURE_FRAME, Y.type === Pe.H264_NAL_IDR_SLICE && Object(m.h)(ce), Ce.pic_order_cnt_type === 0 && (N.poc.poc_lsb = Object(m.a)(ce, Ce.log2_max_poc_lsb), me.pic_order_present == 1 && N.picture_structure == ui.AV_PICTURE_STRUCTURE_FRAME && (N.poc.delta_poc_bottom = Object(m.f)(ce))), Ce.pic_order_cnt_type != 1 || Ce.delta_pic_order_always_zero_flag || (N.poc.delta_poc[0] = Object(m.f)(ce), me.pic_order_present == 1 && N.picture_structure === ui.AV_PICTURE_STRUCTURE_FRAME && (N.poc.delta_poc[1] = Object(m.f)(ce))), H[0] = H[1] = Number.MAX_SAFE_INTEGER;
var Me = this.Ch(H, Ce, N.poc, N.picture_structure, Y.ref_idc);
if (Y.ref_idc && Y.type !== Pe.H264_NAL_IDR_SLICE && (S = this.Ih(f, ce)) < 0)
return;
if (N.poc.prev_frame_num = S ? 0 : N.poc.frame_num, N.poc.prev_frame_num_offset = S ? 0 : N.poc.frame_num_offset, Y.ref_idc !== 0 && (S ? (N.poc.prev_poc_msb = 0, N.poc.prev_poc_lsb = N.picture_structure === ui.AV_PICTURE_STRUCTURE_BOTTOM_FIELD ? 0 : H[0]) : (N.poc.prev_poc_msb = N.poc.poc_msb, N.poc.prev_poc_lsb = N.poc.poc_lsb)), !b.decConf) {
var Ge;
this.ah && this.De.iSGenerated && this._i && this.De.resetInitSegment(this._i), Dt.updateAVCTrack(this.Ci, b, N.ps), this.nh(b);
var xe = Ct.avcDecoderConfigToNalu(N.ps);
this.uh && (Ge = this.uh.units).push.apply(Ge, xe), b.fps && (this.Ah = b.inputTimescale / b.fps);
}
this.uh && (this.uh.poc !== -1 && Math.floor(Me / 2) !== Math.floor(this.uh.poc / 2) && this.gh(), this.uh.units.push({ type: Y.type, data: Y.data }), this.uh.poc === -1 && (this.uh.pts = this.mr ? (Me / 2 + this.fh + Ce.ref_frame_count) * this.Ah : 0, this.uh.cts = this.uh.pts - this.uh.dts, this.uh.originPTS = this.uh.originDTS + this.uh.cts, this.uh.pts > this.Ti && (this.Ti = this.uh.pts), this.uh.key = !!f.key_frame, this.uh.poc = Me));
} else if (Y.type !== Pe.H264_NAL_AUD) {
if (Y.type === Pe.H264_NAL_SPS) {
var Ze = bt.parse(l);
Ze && (N.ps.sps && !Object(q.b)(N.ps.sps.data, Ze.data) && (this.ah = !0), N.ps.spsList[Ze.sps_id] = Ze), Dt.onAVCDetected(this.Ci, b, this.di, this.li, this.Ye()), b.decConf && this.Ke(), b.decConf = void 0;
} else if (Y.type === Pe.H264_NAL_PPS) {
var $e = zt.parse(l);
$e && (N.ps.pps && !Object(q.b)(N.ps.pps.data, $e.data) && (this.ah = !0), N.ps.ppsList[$e.pps_id] = $e), b.decConf && this.Ke(), b.decConf = void 0;
}
}
}
}, d._h = function(l) {
var f = this.dh, b = this.Mi;
if (f && b) {
var N, H = f.priv_data;
f.pict_type = Qt.AV_PICTURE_TYPE_I, f.key_frame = 0, f.picture_structure = ui.AV_PICTURE_STRUCTURE_UNKNOWN;
var S = { type: (126 & l[0]) >> 1, nuh_layer_id: (1 & l[0]) << 5 & l[1] >> 3 & 31, temporal_id: (7 & l[1]) - 1, ref_idc: 0, data: l };
if (!(S.nuh_layer_id > 0))
switch (S.type) {
case ae.a.HEVC_NAL_TRAIL_N:
case ae.a.HEVC_NAL_TRAIL_R:
case ae.a.HEVC_NAL_TSA_N:
case ae.a.HEVC_NAL_TSA_R:
case ae.a.HEVC_NAL_STSA_N:
case ae.a.HEVC_NAL_STSA_R:
case ae.a.HEVC_NAL_BLA_W_LP:
case ae.a.HEVC_NAL_BLA_W_RADL:
case ae.a.HEVC_NAL_BLA_N_LP:
case ae.a.HEVC_NAL_IDR_W_RADL:
case ae.a.HEVC_NAL_IDR_N_LP:
case ae.a.HEVC_NAL_CRA_NUT:
case ae.a.HEVC_NAL_RADL_N:
case ae.a.HEVC_NAL_RADL_R:
case ae.a.HEVC_NAL_RASL_N:
case ae.a.HEVC_NAL_RASL_R:
if (!b.decConf && (this.ah && this.De.iSGenerated && this._i && this.De.resetInitSegment(this._i), Dt.updateHEVCTrack(this.Ci, b, H.ps), b.decConf && (this.nh(b), this.Ai.emit(oe.a.VIDEO_CODEC_DETECTED, { codecType: b.codecType || X.c.unknown, enabled: !!b.active, decoder: b.outputRaw ? X.d.wasm : X.d.buildin, bitDepth: b.bitDepth, timeOffset: 0 }), b.fps && (this.Ah = b.inputTimescale / b.fps), b.outputRaw))) {
var Y = Ct.hevDecoderConfigToSample(H.ps, this.uh ? this.uh.dts : 0);
this.Ai.emit(oe.a.RAW_DATA, { type: o.d.decoderConfig, samples: re([Y], b.inputTimescale), extra: this._i });
}
if (S.gbCtx = Object(m.c)(Se(S.data.subarray(2, S.data.byteLength))), N = this.Oh(f, S))
return N;
break;
case ae.a.HEVC_NAL_AUD:
break;
case ae.a.HEVC_NAL_SEI_PREFIX:
case ae.a.HEVC_NAL_SEI_SUFFIX:
b.decConf ? (this.gh(), this.uh && this.uh.units.push({ type: ae.a.HEVC_NAL_SEI_PREFIX, data: l })) : (H.ps.seiList || (H.ps.seiList = []), H.ps.seiList.push({ type: S.type, data: l }));
break;
case ae.a.HEVC_NAL_SPS:
var ce = wt.parse(l, b.codecType);
ce && (H.ps.sps && !Object(q.b)(H.ps.sps.data, ce.data) && (this.ah = !0), H.ps.spsList[ce.sps_id] = ce, H.max_dec_pic_buffering = ce.temporal_layer.reduce(function(Ce, Me) {
return Math.max(Ce, Me.max_dec_pic_buffering);
}, 0));
var Ae = this.Ye();
if (!(b.codecType === X.c.hevc ? Dt.onHEVCDetected(this.Ci, b, this.di, this.li, Ae) : Dt.onKVCDetected(this.Ci, b, this.di, Ae)))
return void this.Di(Object(s.e)(s.b.MUX_ERROR, s.a.REMUX_ERROR, "unsupport codec hevc"));
b.decConf && this.Ke(), b.decConf = void 0;
break;
case ae.a.HEVC_NAL_PPS:
var _e = Mt.parse(l);
_e && (H.ps.pps && !Object(q.b)(H.ps.pps.data, _e.data) && (this.ah = !0), H.ps.ppsList[_e.pps_id] = _e), b.decConf && this.Ke(), b.decConf = void 0;
break;
case ae.a.HEVC_NAL_VPS:
var me = ri.parse(this.Ci, l);
me && (H.ps.vps && !Object(q.b)(H.ps.vps.data, me.data) && (this.ah = !0), H.ps.vpsList[me.vps_id] = me), b.decConf && this.Ke(), b.decConf = void 0;
}
}
}, d.gh = function() {
this.Mi && this.uh && this.uh.units.length && this.uh.pts !== -1 && (this.$e(this.uh), this.mr++, this.uh = void 0), this.uh || this.bh();
}, d.bh = function() {
var l = this.mr * this.Ah;
this.uh = { poc: -1, key: !1, pts: -1, dts: l, cts: 0, units: [], originDTS: l, originPTS: l, duration: this.Ah, size: 0 };
}, d.Oh = function(l, f) {
var b, N, H = l.priv_data, S = H.ps, Y = f.gbCtx;
if (!Y)
return -1;
var ce = Object(m.a)(Y, 1);
(function(xe) {
return xe.type >= 16 && xe.type <= 23;
})(f) && (l.key_frame = 1, Object(m.g)(Y, 1));
var Ae = Object(m.h)(Y);
if (S.pps = S.ppsList[Ae], !S.pps)
throw new Error("raw hevc slice header error. pps undefined");
if (S.sps = S.spsList[S.pps.sps_id], !S.sps)
throw new Error("raw hevc slice header error. sps undefined");
if (S.vps = S.vpsList[S.sps.vps_id], ce)
N = 0;
else {
N = S.pps.dependent_slice_segments_enabled_flag ? Object(m.a)(Y, 1) : 0;
var _e = Math.ceil(Math.log2(S.sps.ctb_width * S.sps.ctb_height)), me = Object(m.a)(Y, _e);
if (me >= S.sps.ctb_width * S.sps.ctb_height)
return this.Ci.i(Bi, "Invalid slice segment address: " + me + "."), -1;
}
if (N)
return 0;
for (b = 0; b < S.pps.num_extra_slice_header_bits; b++)
Object(m.g)(Y, 1);
var Ce = Object(m.h)(Y);
if (Ce !== rr.HEVC_SLICE_I && Ce !== rr.HEVC_SLICE_P && Ce !== rr.HEVC_SLICE_B)
return this.Ci.i(Bi, `Unknown slice type: %d.
`, Ce), -1;
l.pict_type = Ce === rr.HEVC_SLICE_B ? Qt.AV_PICTURE_TYPE_B : Ce === rr.HEVC_SLICE_P ? Qt.AV_PICTURE_TYPE_P : Qt.AV_PICTURE_TYPE_I, S.pps.output_flag_present_flag && Object(m.g)(Y, 1), S.sps.separate_colour_plane_flag && Object(m.g)(Y, 2);
var Me = function(xe) {
return xe.type === ae.a.HEVC_NAL_IDR_W_RADL || xe.type === ae.a.HEVC_NAL_IDR_N_LP;
}(f);
if (Me)
H.poc = 0, this.Ke(), this.fh = this.mr;
else {
var Ge = Object(m.a)(Y, S.sps.log2_max_poc_lsb);
H.poc = this.wh(S.sps, H.pocTid0, Ge, f.type);
}
return f.temporal_id === 0 && f.type !== ae.a.HEVC_NAL_TRAIL_N && f.type !== ae.a.HEVC_NAL_TSA_N && f.type !== ae.a.HEVC_NAL_STSA_N && f.type !== ae.a.HEVC_NAL_RADL_N && f.type !== ae.a.HEVC_NAL_RASL_N && f.type !== ae.a.HEVC_NAL_RADL_R && f.type !== ae.a.HEVC_NAL_RASL_R && (H.pocTid0 = H.poc), this.uh && (this.uh.poc !== -1 && H.poc !== this.uh.poc && this.gh(), this.uh.units.push({ type: f.type, data: f.data }), this.uh.pts === -1 && (this.uh.pts = this.mr ? (H.poc + this.fh + H.max_dec_pic_buffering) * this.Ah : 0, this.uh.cts = this.uh.pts - this.uh.dts, this.uh.originPTS = this.uh.originDTS + this.uh.cts, this.uh.pts > this.Ti && (this.Ti = this.uh.pts), this.uh.key = Me, this.uh.poc = H.poc)), 1;
}, d.wh = function(l, f, b, N) {
var H, S = 1 << l.log2_max_poc_lsb, Y = f % S, ce = f - Y;
return H = b < Y && Y - b >= S / 2 ? ce + S : b > Y && b - Y > S / 2 ? ce - S : ce, N !== ae.a.HEVC_NAL_BLA_W_LP && N !== ae.a.HEVC_NAL_BLA_W_RADL && N !== ae.a.HEVC_NAL_BLA_N_LP || (H = 0), H + b;
}, d.Ch = function(l, f, b, N, H) {
var S = 1 << f.log2_max_frame_num, Y = [];
if (b.frame_num_offset = b.prev_frame_num_offset, b.frame_num < b.prev_frame_num && (b.frame_num_offset += S), f.pic_order_cnt_type === 0) {
var ce = 1 << f.log2_max_poc_lsb;
b.prev_poc_lsb < 0 && (b.prev_poc_lsb = b.poc_lsb), b.poc_lsb < b.prev_poc_lsb && b.prev_poc_lsb - b.poc_lsb >= ce / 2 ? b.poc_msb = b.prev_poc_msb + ce : b.poc_lsb > b.prev_poc_lsb && b.prev_poc_lsb - b.poc_lsb < -ce / 2 ? b.poc_msb = b.prev_poc_msb - ce : b.poc_msb = b.prev_poc_msb, Y[0] = Y[1] = b.poc_msb + b.poc_lsb, N === ui.AV_PICTURE_STRUCTURE_FRAME && (Y[1] += b.delta_poc_bottom);
} else if (f.pic_order_cnt_type === 1) {
var Ae, _e, me, Ce;
for (Ae = f.num_ref_frames_in_pic_order_cnt_cycle !== 0 ? b.frame_num_offset + b.frame_num : 0, H === 0 && Ae > 0 && Ae--, _e = 0, Ce = 0; Ce < f.num_ref_frames_in_pic_order_cnt_cycle; Ce++)
_e += f.offset_for_ref_frame[Ce];
if (Ae > 0) {
var Me = (Ae - 1) / f.num_ref_frames_in_pic_order_cnt_cycle, Ge = (Ae - 1) % f.num_ref_frames_in_pic_order_cnt_cycle;
for (me = Me * _e, Ce = 0; Ce <= Ge; Ce++)
me += f.offset_for_ref_frame[Ce];
} else
me = 0;
H == 0 && (me += f.offset_for_non_ref_pic), Y[0] = me + b.delta_poc[0], Y[1] = Y[0] + f.offset_for_top_to_bottom_field, N === ui.AV_PICTURE_STRUCTURE_FRAME && (Y[1] += b.delta_poc[1]);
} else {
var xe = 2 * (b.frame_num_offset + b.frame_num);
H || xe--, Y[0] = xe, Y[1] = xe;
}
return N !== ui.AV_PICTURE_STRUCTURE_BOTTOM_FIELD && (l[0] = Y[0]), N !== ui.AV_PICTURE_STRUCTURE_TOP_FIELD && (l[1] = Y[1]), Math.min(l[0], l[1]);
}, d.Ih = function(l, f) {
var b = l.priv_data;
if (!b.ps.pps)
return -1;
var N = 3 & l.pict_type, H = 0, S = [];
b.ps.pps.redundant_pic_cnt_present && Object(m.h)(f), N === Qt.AV_PICTURE_TYPE_B && Object(m.a)(f, 1);
var Y = { list_count: H };
if (this.Eh(Y, S, f, b.ps.pps, N, b.picture_structure) < 0)
return -2;
if (H = Y.list_count, N !== Qt.AV_PICTURE_TYPE_I) {
for (var ce = 0; ce < H; ce++)
if (Object(m.a)(f, 1))
for (var Ae = 0; ; Ae++) {
var _e = Object(m.h)(f);
if (!(_e < 3)) {
if (_e > 3)
return this.Ci.i(Bi, `illegal reordering_of_pic_nums_idc %d
`, _e), -3;
break;
}
if (Object(m.h)(f), Ae >= S[ce])
return this.Ci.i(Bi, `reference count %d overflow
`, Ae), -4;
}
}
if ((b.ps.pps.weighted_pred && N === Qt.AV_PICTURE_TYPE_P || b.ps.pps.weighted_bipred_idc === 1 && N == Qt.AV_PICTURE_TYPE_B) && b.ps.sps && this.jh(f, b.ps.sps, S, N, { use_weight: 0, use_weight_chroma: 0, luma_log2_weight_denom: 0, chroma_log2_weight_denom: 0, luma_weight_flag: [], chroma_weight_flag: [] }), Object(m.a)(f, 1))
for (var me = 0; me < 66; me++) {
var Ce = Object(m.h)(f);
if (Ce > ai.MMCO_LONG)
return this.Ci.i(Bi, "illegal memory management control operation " + Ce), -5;
if (Ce === ai.MMCO_END)
return 0;
if (Ce === ai.MMCO_RESET)
return 1;
Ce !== ai.MMCO_SHORT2UNUSED && Ce !== ai.MMCO_SHORT2LONG || Object(m.h)(f), Ce !== ai.MMCO_SHORT2LONG && Ce !== ai.MMCO_LONG2UNUSED && Ce !== ai.MMCO_LONG && Ce !== ai.MMCO_SET_MAX_LONG || Object(m.h)(f);
}
return 0;
}, d.Eh = function(l, f, b, N, H, S) {
var Y;
if (f[0] = N.ref_count[0], f[1] = N.ref_count[1], H !== Qt.AV_PICTURE_TYPE_I) {
var ce = [];
if (ce[0] = ce[1] = S === ui.AV_PICTURE_STRUCTURE_FRAME ? 15 : 31, Object(m.a)(b, 1) && (f[0] = Object(m.h)(b) + 1, H === Qt.AV_PICTURE_TYPE_B ? f[1] = Object(m.h)(b) + 1 : f[1] = 1), Y = H === Qt.AV_PICTURE_TYPE_B ? 2 : 1, f[0] - 1 > ce[0] || Y == 2 && f[1] - 1 > ce[1])
return this.Ci.i(Bi, `reference overflow %u > %u or %u > %u
`, f[0] - 1, ce[0], f[1] - 1, ce[1]), f[0] = f[1] = 0, l.list_count = 0, f[0] = 0, f[1] = 0, -1;
f[1] - 1 > ce[1] && (this.Ci.i(Bi, `reference overflow %u > %u
`, f[1] - 1, ce[1]), f[1] = 0);
} else
Y = 0, f[0] = f[1] = 0;
return l.list_count = Y, 0;
}, d.jh = function(l, f, b, N, H) {
var S, Y;
for (H.use_weight = 0, H.use_weight_chroma = 0, H.luma_log2_weight_denom = Object(m.h)(l), H.luma_log2_weight_denom > 7 && (this.Ci.i(Bi, `luma_log2_weight_denom %d is out of range
`, H.luma_log2_weight_denom), H.luma_log2_weight_denom = 0), f.chroma_format_idc && (H.chroma_log2_weight_denom = Object(m.h)(l), H.chroma_log2_weight_denom > 7 && (this.Ci.i(Bi, `chroma_log2_weight_denom %d is out of range
`, H.chroma_log2_weight_denom), H.chroma_log2_weight_denom = 0)), S = 0; S < 2; S++) {
for (H.luma_weight_flag[S] = 0, H.chroma_weight_flag[S] = 0, Y = 0; Y < b[S]; Y++)
if (Object(m.a)(l, 1) && (Object(m.f)(l), Object(m.f)(l)), f.chroma_format_idc && Object(m.a)(l, 1))
for (var ce = 0; ce < 2; ce++)
Object(m.f)(l), Object(m.f)(l);
if (N !== Qt.AV_PICTURE_TYPE_B)
break;
}
return H.use_weight = H.use_weight || H.use_weight_chroma, 0;
}, d.nh = function(l) {
(!l.fps || l.fps > O.n) && (l.fps = O.d);
}, T()(E, null, [{ key: "probeSize", get: function() {
return 4;
} }]);
}(de), Ya = function() {
function V(d, l, f) {
var b = this;
this.kh = void 0, this.Mh = void 0, this.decryptAacSamples = function(N, H, S) {
for (; ; H++) {
if (H >= N.length)
return void S();
if (!(N[H].unit.length < 32)) {
var Y = b.kh.isSync();
if (b.Sh(N, H, S, Y), !Y)
return;
}
}
}, this.Bh = function(N, H) {
for (var S = new Uint8Array(H), Y = 0, ce = 32; ce <= N.length - 16; ce += 160, Y += 16)
N.set(S.subarray(Y, Y + 16), ce);
return N;
}, this.Th = function(N, H, S, Y, ce, Ae) {
var _e = Se(ce.data), me = b.Dh(_e);
b.Rh(me.buffer, function(Ce) {
ce.data = b.Bh(_e, Ce), Ae || b.decryptAvcSamples(N, H, S + 1, Y);
});
}, this.Mh = f, this.kh = new F(d, l, { removePKCS7Padding: !1 });
}
var E = V.prototype;
return E.decryptAvcSamples = function(d, l, f, b) {
for (; ; l++, f = 0) {
if (l >= d.length)
return void b();
for (var N = d[l].units; !(f >= N.length); f++) {
var H = N[f];
if (!(H.data.length <= 48 || H.type !== 1 && H.type !== 5)) {
var S = this.kh.isSync();
if (this.Th(d, l, f, b, H, S), !S)
return;
}
}
}
}, E.Rh = function(d, l) {
this.Mh.key && this.kh.decrypt(d, this.Mh.key.buffer, this.Mh.iv.buffer, l);
}, E.Sh = function(d, l, f, b) {
var N = this, H = d[l];
if (H) {
var S = H.unit, Y = S.subarray(16, S.length - S.length % 16), ce = Y.buffer.slice(Y.byteOffset, Y.byteOffset + Y.length);
this.Rh(ce, function(Ae) {
Ae = new Uint8Array(Ae), S.set(new Uint8Array(Ae), 16), b || N.decryptAacSamples(d, l + 1, f);
});
}
}, E.Dh = function(d) {
for (var l = 16 * Math.floor((d.length - 48) / 160) + 16, f = new Uint8Array(l), b = 0, N = 32; N <= d.length - 16; N += 160, b += 16)
f.set(d.subarray(N, N + 16), b);
return f;
}, V;
}(), va = function(V) {
return V[V.registration = 5] = "registration", V[V.av1 = 95] = "av1", V[V.opus = 127] = "opus", V;
}({}), js = { 5: function(V, E) {
L()(V, { descriptor_name: "registration", format_identifier: Object(q.a)(E, 0, 4) });
} };
function Hs(V, E) {
var d = { descriptor_tag: V[E], descriptor_length: V[E + 1] }, l = js[d.descriptor_tag];
return l && l(d, V.subarray(E + 2, E + 2 + d.descriptor_length)), d;
}
var Vi = "ts-demuxer", jn = function(V) {
function E(l, f, b, N, H) {
var S;
return l.i(Vi, "constructor"), (S = V.call(this, l, f, b, N, H) || this).Lh = void 0, S.Nh = !1, S.Qh = -1, S.Vn = 0, S.xh = 0, S.Vh = null, S.Uh = null, S.Fh = null, S.Ph = !1, S.Hh = 0, S.Yh = !1, S.Gh = 0, S.Kh = { aacOverhead: 0, unknownTSPacketCount: 0 }, S.Zh = { spsList: [], ppsList: [], vpsList: [] }, S.Wh = { spsList: [], ppsList: [] }, S.Xh = void 0, S.ah = !1, S.zh = !1, S.Gn = void 0, S.Jh = function(Y, ce) {
return (31 & Y[ce + 10]) << 8 | Y[ce + 11];
}, S.qh = function(Y, ce, Ae, _e) {
var me, Ce, Me, Ge, xe = { audio: -1, video: -1, id3: -1, aCodecType: X.c.unknown, codecType: X.c.h264 };
me = (15 & Y[ce + 1]) << 8 | Y[ce + 2], Ce = ce + 3 + me - 4, Me = (15 & Y[ce + 10]) << 8 | Y[ce + 11], ce += 12 + Me;
for (var Ze = function() {
Ge = (31 & Y[ce + 1]) << 8 | Y[ce + 2];
var $e = Y[ce];
if (S.Ci.i(Vi, "PMT stream_type: " + $e), $e === 207 && _e || $e === 15)
xe.audio === -1 && (xe.audio = Ge), xe.aCodecType = X.c.aac;
else if ($e === 21)
xe.id3 === -1 && (xe.id3 = Ge);
else if ($e === 219 && _e || $e === 27)
xe.video === -1 && (xe.video = Ge);
else if ($e === 3 || $e === 4)
Ae.mpeg || Ae.mp3 ? xe.audio === -1 && (xe.audio = Ge) : S.Ci.i(Vi, "MPEG audio found, not supported in this browser for now"), xe.aCodecType = X.c.mp3;
else if ($e === 6 || $e >= 128 && $e <= 255) {
$e >= 128 && $e <= 255 && S.Ci.i(Vi, " PMT User Private: " + $e);
var et = 4095 & Object(q.f)(Y, ce + 3);
if (et) {
var st = !1, Ke = !1, Tt = !1, It = !1, ut = !1;
S.$h(Y, ce + 5, et).forEach(function(Et) {
if (Et.descriptor_tag === va.av1)
st = !0;
else if (Et.descriptor_tag !== va.opus && Et.descriptor_tag === va.registration) {
var ft = Et.format_identifier;
ft === "AV01" && (st = !0), ft === "KVC3" && (Ke = !0), ft === "KVC4" && (Tt = !0), ft === "KVC5" && (It = !0), ft === "KVC6" && (ut = !0);
}
}), st && (Ae.av1 ? xe.video === -1 && xe.video === -1 && (xe.video = Ge) : S.Ci.i(Vi, "AV1 video found, not supported in this browser for now"), xe.codecType = X.c.av1), Ke && (xe.codecType = X.c.kvc3, xe.video === -1 && (xe.video = Ge)), Tt && (xe.codecType = X.c.kvc4, xe.video === -1 && (xe.video = Ge)), It && (xe.codecType = X.c.kvc5, xe.video === -1 && (xe.video = Ge)), ut && (xe.codecType = X.c.kvc6, xe.video === -1 && (xe.video = Ge));
}
} else
$e === 36 ? (xe.codecType = X.c.hevc, xe.video === -1 && (xe.video = Ge)) : S.Ci.v("unkown stream type:" + $e);
ce += 5 + ((15 & Y[ce + 3]) << 8 | Y[ce + 4]);
}; ce < Ce; )
Ze();
return xe;
}, S.io = function(Y, ce) {
ce === void 0 && (ce = !1);
var Ae, _e, me, Ce, Me, Ge, xe = Y.data, Ze = 0, $e = 0, et = 0, st = 0, Ke = 0;
if (Y && Y.size !== 0) {
for (; xe[0].length < 19 && xe.length > 1; ) {
var Tt = new Uint8Array(xe[0].length + xe[1].length);
Tt.set(xe[0]), Tt.set(xe[1], xe[0].length), xe[0] = Tt, xe.splice(1, 1);
}
if (((Ae = xe[0])[0] << 16) + (Ae[1] << 8) + Ae[2] === 1) {
if ((me = (Ae[4] << 8) + Ae[5]) && me > Y.size - 6 || me === 0 && !ce)
return;
if (192 & (_e = Ae[7]))
if (st = $e = 536870912 * (14 & Ae[9]) + 4194304 * (255 & Ae[10]) + 16384 * (254 & Ae[11]) + 128 * (255 & Ae[12]) + (254 & Ae[13]) / 2, 64 & _e) {
if (Ke = et = 536870912 * (14 & Ae[14]) + 4194304 * (255 & Ae[15]) + 16384 * (254 & Ae[16]) + 128 * (255 & Ae[17]) + (254 & Ae[18]) / 2, Math.abs($e - et) > 60 * O.q)
if (S.Ci.w(Vi, Math.round(($e - et) / O.q) + "s delta between PTS and DTS, align them"), Object(mt.a)(et, $e)) {
S.Ci.i(Vi, "pes DTS > 33bit. align DTS:" + et + " PTS: " + $e);
var It = $e + 8589934591 - et;
It > 0 && It < 60 * O.q ? $e += 8589934591 : et = $e;
} else
et = $e;
} else
et = $e, Ke = st;
Ge = (Ce = Ae[8]) + 9, Y.size -= Ge, Me = new Uint8Array(Y.size);
for (var ut = 0, Et = xe.length; ut < Et; ut++) {
var ft = (Ae = xe[ut]).byteLength;
if (Ge) {
if (Ge > ft) {
Ge -= ft;
continue;
}
Ae = Ae.subarray(Ge), ft -= Ge, Ge = 0;
}
Me.set(Ae, Ze), Ze += ft;
}
return me && (me -= Ce + 3), { data: Me, pts: $e, dts: et, originDTS: Ke, originPTS: st, len: me };
}
}
}, S.eo = function(Y, ce) {
if (Y.units.length && Y.frame) {
var Ae = ce.samples, _e = Ae.length;
(!S.di.forceKeyFrameOnDiscontinuity || Y.key === !0 || ce.decConf && (_e || S.Ph)) && (S.di.gopRemux && Y.key && Ae && Ae.length > 1 && S.Ue && S.Ke(), Y.id = S.Mi.samples.length, Y.size = Y.units.reduce(function(me, Ce) {
return me + Ce.data.byteLength;
}, 0), S.$e(Y), !S.di.gopRemux && S.Mi.samples.reduce(function(me, Ce) {
return me + Ce.size;
}, 0) > O.o && (S.Ci.i(Vi, "max size remux"), S.Ke()));
}
}, S.no = function(Y, ce) {
if (typeof S.Le == "number" && !Object(mt.a)(S.Le, ce.dts) && ce.dts - S.Le < 90) {
var Ae = ce.pts - ce.dts;
ce.dts = S.Le + 90, ce.pts = ce.dts + Ae;
}
var _e = { key: Y, pts: ce.pts, dts: ce.dts, cts: ce.pts - ce.dts, units: [], originDTS: ce.originDTS, originPTS: ce.originPTS, size: 0 };
return Object(mt.a)(S.xh, ce.originPTS) && (S.Ci.i(Vi, "pts overflow last: " + S.xh + " curr: " + ce.originPTS), _e.keyTime = !0), S.Le = ce.dts, S.xh = ce.originPTS, _e;
}, S.so = function(Y, ce) {
if (Y.data) {
var Ae, _e = S.Mi, me = S.Fh;
_e.codecType === X.c.av1 ? (S.Gn || (S.Gn = ee.createCtx()), Ae = ee.parseOBU(Y.data, S.Gn)) : Ae = S.ro(Y.data), Y.data = null, me && me.frame && Ae.length && (!_e.audFound || me.originPTS !== Y.originPTS) && (S.eo(me, _e), me = S.Fh = S.no(!1, Y)), ne(_e.codecType) ? me = S._h(Ae, Y) : _e.codecType === X.c.h264 ? me = S.ho(Ae, Y) : _e.codecType === X.c.av1 && (me || (me = S.Fh = S.no(!1, Y)), Ae.forEach(function(Ce) {
if (Ce.obu_type === we.AV1_OBU_SEQUENCE_HEADER) {
var Me = Ce.content;
Me && S.Xh && !Object(q.b)(S.Xh.data, Me.data) && _e.decConf && (S.oo(!0), S.De.iSGenerated && S._i && S.De.resetInitSegment(S._i)), S.Xh = Me, Dt.updateAV1Track(S.Ci, _e, Me);
}
var Ge;
me && (me.frame = me.frame || Ce.obu_type === we.AV1_OBU_FRAME || Ce.obu_type === we.AV1_OBU_FRAME_HEADER, me.key = me.key || Ce.obu_type !== we.AV1_OBU_SEQUENCE_HEADER && !((Ge = Ce.content) == null || !Ge.keyframe), me.units.push({ type: 0, data: Ce.data }));
})), ce && me && (S.eo(me, _e), S.Fh = null);
}
}, S.ao = function(Y) {
if (Y.data) {
var ce = Y.data, Ae = S.Ne, _e = ce.length, me = 0, Ce = 0, Me = Y.pts;
if (Me !== void 0)
for (; Ce < _e; )
if (Ve(ce, Ce)) {
var Ge = $(Ae, ce, Ce, Me, me);
if (!Ge)
break;
Ce += Ge.length, me++;
} else
Ce++;
else
S.Ci.w("[tsdemuxer]: MPEG PES unknown PTS");
}
}, S.uo = function(Y) {
var ce;
if (Y.data) {
var Ae, _e, me, Ce, Me, Ge, xe = S.Ne, Ze = S.Uh, $e = Y.data, et = Y.pts, st = S.Vh, Ke = null;
if (S.Re = Y.dts, st) {
var Tt = new Uint8Array(st.byteLength + $e.byteLength);
Tt.set(st, 0), Tt.set($e, st.byteLength), $e = Tt;
}
for (me = 0, Ce = $e.length; me < Ce - 1 && !j.f($e, me); me++)
;
if (me && (me < Ce - 1 ? (Me = "AAC PES did not start with ADTS header,offset:" + me, Ge = !1) : (Me = "no ADTS header found in AAC PES", Ge = !0), S.Ci.w("parsing error:" + Me), S.Di(Object(s.e)(s.b.MUX_ERROR, s.a.PARSING_ERROR, Me, { fatal: Ge })), Ge))
return;
var It = $e.subarray(me + 2, me + 4);
if ((j.g(xe, It) || !xe.configParsed) && S.De.iSGenerated && S._i && S.De.resetInitSegment(S._i), j.d(S.Ci, xe, S.Ai, It, o.a.ADTS, (ce = S._i) == null ? void 0 : ce.audioCodec), _e = 0, Ae = j.c(xe.samplerate, xe.inputTimescale), Ze && (S.Gh || (S.Gh = et < Ze ? 1 : 0), S.Gh || st)) {
var ut = Ze + Ae;
Math.abs(ut - et) > 1 && (S.Ci.v("AAC: align PTS for overlapping frames by " + Math.round((ut - et) / 90)), et = ut);
}
for (; me < Ce; )
if (j.f($e, me) && me + 5 < Ce) {
var Et = j.a(S.Ci, xe, $e, me, et, _e, Y.originPTS);
if (!Et) {
me++;
break;
}
if (S.di.enableAacPriv && typeof xe.aacSampleingIndex == "number" && typeof xe.aot == "number") {
var ft = j.h(S.Ci, Et.sample.unit, xe.aacSampleingIndex, xe.aot);
ft && (Et.sample.aacPriv = [{ payload: ft.priv, streamTimestamp: Object(mt.c)(Et.sample.originPTS) }]);
}
me += Et.length, Ke = Et.sample.pts, Et.sample.originDTS = Y.originDTS, Et.sample.originPTS = Y.originPTS, _e++;
} else
me++;
_e > 1 && (S.Kh.aacOverhead = 1), st = me < Ce ? $e.subarray(me, Ce) : null, S.Vh = st, S.Uh = Ke;
}
}, S.Lh = void 0, S;
}
W()(E, V);
var d = E.prototype;
return d.setDecryptData = function(l) {
Ya && l && l.key && l.method === "SAMPLE-AES" ? this.Lh = new Ya(this.Ci, this.di, l) : this.Lh = void 0;
}, E.probe = function(l) {
var f = E.co(l);
return !(f < 0);
}, E.co = function(l) {
for (var f = Math.min(1e3, l.length - 564), b = 0; b < f; ) {
if (l[b] === 71 && l[b + 188] === 71 && l[b + 376] === 71)
return b;
b++;
}
return -1;
}, d.resetInitSegment = function(l) {
this.Nh = !1, this.Qh = -1, this.He(l.duration), this.Vh = null, this.Uh = null, this.Fh = null, this.Vn = l.duration, this.xh = 0, this.Gh = 0, this.Kh.aacOverhead = 0, V.prototype.resetInitSegment.call(this, l), l.stat = this.Kh;
}, d.append = function(l, f, b, N, H, S) {
H === void 0 && (H = !1), this.Fe = S, this.Ph = b, this.Hh = f, this.Yh = N, this.Ue || (this.Ue = { timeOffset: f, contiguous: b, accurateTimeOffset: N });
var Y, ce, Ae, _e, me, Ce = this.Mi, Me = this.Ne, Ge = this.Jh, xe = this.qh, Ze = this.io, $e = this.so, et = this.uo, st = this.ao, Ke = l.length;
this.Nh;
var Tt = Ce.pid, It = Me.pid, ut = this.Qh, Et = Ce.pesData, ft = Me.pesData;
if (!l.byteLength && H)
return this.flush(), void this.fo();
for (Ke -= (Ke + 0) % 188, Y = 0; Y < Ke; Y += 188)
if (l[Y] === 71) {
if (ce = !!(64 & l[Y + 1]), Ae = ((31 & l[Y + 1]) << 8) + l[Y + 2], (48 & l[Y + 3]) >> 4 > 1) {
if ((_e = Y + 5 + l[Y + 4]) === Y + 188)
continue;
} else
_e = Y + 4;
switch (Ae) {
case Tt:
ce && (Et && (me = Ze(Et, !0)) && me.pts !== void 0 && $e(me, !1), Et = { data: [], size: 0 }), Et && (Et.data.push(l.subarray(_e, Y + 188)), Et.size += Y + 188 - _e);
break;
case It:
ce && (ft && (me = Ze(ft)) && me.pts !== void 0 && (Me.codecType === X.c.aac ? et(me) : st(me)), ft = { data: [], size: 0 }), ft && (ft.data.push(l.subarray(_e, Y + 188)), ft.size += Y + 188 - _e);
break;
case 0:
ce && (_e += l[_e] + 1), ut = this.Qh = Ge(l, _e);
break;
case ut:
ce && (_e += l[_e] + 1);
var Lt = xe(l, _e, this.li, !!this.Lh);
if (Lt.video < 0 && Lt.audio < 0)
return void this.Di(Object(s.e)(s.b.MUX_ERROR, s.a.PARSING_ERROR, "no track found"));
if (!this.Nh) {
var Wt = {};
this.Vn && (Wt.duration = this.Vn), this.Ai.emit(oe.a.METADATA, Wt);
}
var Yt = this.Ye(), hi = this.Ge();
Lt.video > 0 && (!ne(Ce.codecType) && ne(Lt.codecType) ? Lt.codecType === X.c.hevc ? Dt.onHEVCDetected(this.Ci, Ce, this.di, this.li, Yt) : Dt.onKVCDetected(this.Ci, Ce, this.di, Yt) : (Ce.codecType !== X.c.h264 && Lt.codecType === X.c.h264 || Ce.codecType !== X.c.av1 && Lt.codecType === X.c.av1) && this.Mi.outputRaw && (this.Ke(!0), this.De.iSGenerated && this._i && this.De.resetInitSegment(this._i), this.Mi.outputRaw = !1), Lt.codecType === X.c.h264 ? Dt.onAVCDetected(this.Ci, Ce, this.di, this.li, Yt) : Lt.codecType === X.c.av1 && Dt.onAV1Detected(this.Ci, Ce, this.di, this.li, Yt), Ce.active === !1 ? Ce.pid = -1 : Ce.pid = Tt = Lt.video, Ce.codecType = Lt.codecType), Lt.audio > 0 && (typeof hi == "boolean" ? this.Ne.active = hi : Me.active = !0, Me.active && (Me.pid = It = Lt.audio), Me.codecType = Lt.aCodecType), this.Nh = !0;
break;
case 17:
case 8191:
break;
default:
this.Kh.unknownTSPacketCount ? this.Kh.unknownTSPacketCount++ : this.Kh.unknownTSPacketCount = 1;
}
} else
this.Di(Object(s.e)(s.b.MUX_ERROR, s.a.PARSING_ERROR, "TS packet did not start with 0x47", { fatal: !1 }));
Et && (me = Ze(Et, H)) && me.pts !== void 0 ? ($e(me, H), Ce.pesData = void 0) : (this.Fh && H && (this.eo(this.Fh, Ce), this.Fh = null), Ce.pesData = Et), ft && (me = Ze(ft)) && me.pts !== void 0 ? (Me.codecType === X.c.aac ? et(me) : st(me), Me.pesData = void 0) : (ft && ft.size, Me.pesData = ft), (It > 0 && Me.samples.length === 0 || Tt > 0 && Ce.samples.length === 0 || Tt <= 0 && It <= 0) && !H || (!H && this.di.gopRemux || this.Ke(H), H && this.fo());
}, d.fo = function() {
this.Ai.emit(oe.a.PARSED_DATA, { extra: this._i });
}, d.Ao = function() {
var l, f = this.Mi, b = this.Ne;
f.pesData && (l = this.io(f.pesData, !0)) && l.pts !== void 0 && this.so(l, !0), f.pesData = void 0, b.pesData && (l = this.io(b.pesData)) && l.pts !== void 0 && (b.codecType === X.c.aac ? this.uo(l) : this.ao(l)), b.pesData = void 0;
}, d.flush = function() {
this.Ci.i(Vi, "flush"), this.Ao(), V.prototype.flush.call(this), this.Fh = null;
}, d.He = function(l) {
V.prototype.He.call(this, l, O.q), this.Mi.audFound = !1, this.Mi.naluState = 0;
}, d.oo = function(l) {
l === void 0 && (l = !1), this.Ue && this.Ke(l);
}, d.Ke = function(l) {
var f;
l === void 0 && (l = !1);
var b = this.Ne, N = this.Mi;
if (this.We(b, N) && (this.Ze(b, N), this.Xe(b, N, l) && (!this.zh || l))) {
(f = this._i) != null && f.stat && (this._i.stat.audioNonMonotonous = this.Gh);
var H = !0, S = 0, Y = !1;
this.Ue && (H = this.Ue.contiguous, S = this.Ue.timeOffset, Y = this.Ue.accurateTimeOffset), this.Ve && (this.Ve = !1, this.Ai.emit(oe.a.MEDIA_DEMUX, { type: o.b.TS })), this.Lh ? this.vo(b, N, S, H, Y, l) : this.De.remux(b, N, S, H, Y, l), this.Ue = void 0;
}
}, d.vo = function(l, f, b, N, H, S) {
var Y = this;
S === void 0 && (S = !1), l.samples && this.Lh ? this.Lh.decryptAacSamples(l.samples, 0, function() {
Y.do(l, f, b, N, H, S);
}) : this.do(l, f, b, N, H, S);
}, d.do = function(l, f, b, N, H, S) {
var Y = this;
S === void 0 && (S = !1), f.samples && this.Lh ? this.Lh.decryptAvcSamples(f.samples, 0, 0, function() {
Y.De.remux(l, f, b, N, H, S);
}) : this.De.remux(l, f, b, N, H, S);
}, d.$h = function(l, f, b) {
for (var N = b ? f + b : l.byteLength, H = []; N - f > 2; ) {
var S = Hs(l, f);
H.push(S), f += 2 + S.descriptor_length;
}
return H;
}, d._h = function(l, f) {
var b = this, N = this.Mi, H = this.Zh, S = [], Y = [], ce = this.Fh, Ae = !1;
return l.forEach(function(_e) {
var me;
switch (_e.type) {
case ae.a.HEVC_NAL_IDR_W_RADL:
case ae.a.HEVC_NAL_IDR_N_LP:
case ae.a.HEVC_NAL_CRA_NUT:
b.lo(), Ae = !0, ce || (ce = b.Fh = b.no(!1, f)), ce.key = !0, ce.frame = !0;
break;
case ae.a.HEVC_NAL_AUD:
Ae = !1, N.audFound = !0, ce && b.eo(ce, N), ce = b.Fh = b.no(!1, f);
break;
case ae.a.HEVC_NAL_SPS:
Ae = !0;
var Ce = wt.parse(_e.data, N.codecType);
H.sps && !Object(q.b)(H.sps.data, Ce.data) && (b.ah = !0), H.spsList[Ce.sps_id] = Ce, H.sps = Ce;
break;
case ae.a.HEVC_NAL_PPS:
Ae = !0;
var Me = Mt.parse(_e.data);
H.pps && !Object(q.b)(H.pps.data, Me.data) && (b.ah = !0), H.ppsList[Me.pps_id] = Me, H.pps = Me;
break;
case ae.a.HEVC_NAL_VPS:
Ae = !0;
var Ge = ri.parse(b.Ci, _e.data);
H.vps && !Object(q.b)(H.vps.data, Ge.data) && (b.ah = !0), H.vpsList[Ge.vps_id] = Ge, H.vps = Ge;
break;
case ae.a.HEVC_NAL_SEI_PREFIX:
case ae.a.HEVC_NAL_SEI_SUFFIX:
S.push.apply(S, Ye.parse(_e.data.subarray(2)));
case ae.a.PRIV_NAL_MAGIC_HEVC:
if (_e.type === ae.a.PRIV_NAL_MAGIC_HEVC)
try {
Y.push(Te.parse(_e.data, !1));
} catch (xe) {
b.Ci.w(Vi, "PrivNal parse error " + xe);
}
default:
if (b.lo(), Ae = !0, _e.type === void 0) {
Ae = !1;
break;
}
ce || (ce = b.Fh = b.no(!0, f)), ce.frame = !0;
}
ce && Ae && ((me = ce.units) == null || me.push(_e));
}), ce && (S.length && (ce.sei = { sei: S, streamTimestamp: Object(mt.c)(ce.originPTS) }), Y.length && (ce.privNal = { info: Y, streamTimestamp: Object(mt.c)(ce.originPTS) })), ce;
}, d.ho = function(l, f) {
var b, N = this, H = this.Mi, S = this.Wh, Y = [], ce = [], Ae = this.Fh, _e = !1;
return l.forEach(function(me) {
var Ce;
switch (me.type) {
case Pe.H264_NAL_SLICE:
N.lo(), b = !0, Ae || (Ae = N.Fh = N.no(!0, f)), Ae.frame = !0;
var Me = me.data;
if (_e && Me.length > 4) {
var Ge = Object(m.c)(Me);
Object(m.g)(Ge, 8), Object(m.h)(Ge);
var xe = Object(m.h)(Ge);
xe !== 2 && xe !== 4 && xe !== 7 && xe !== 9 || (Ae.key = !0);
}
break;
case Pe.H264_NAL_IDR_SLICE:
N.lo(), b = !0, Ae || (Ae = N.Fh = N.no(!0, f)), Ae.key = !0, Ae.frame = !0;
break;
case Pe.H264_NAL_SEI:
Y.push.apply(Y, Ye.parse(me.data.subarray(1))), b = !0;
break;
case Pe.PRIV_NAL_MAGIC_H264:
try {
ce.push(Te.parse(me.data, !0));
} catch (et) {
N.Ci.w(Vi, "PrivNal parse error " + et);
}
b = !0;
break;
case Pe.H264_NAL_SPS:
b = !0, _e = !0;
var Ze = bt.parse(me.data);
S.sps && !Object(q.b)(S.sps.data, Ze.data) && (N.ah = !0), S.spsList[Ze.sps_id] = Ze, S.sps = Ze;
break;
case Pe.H264_NAL_PPS:
b = !0;
var $e = zt.parse(me.data);
S.pps && !Object(q.b)(S.pps.data, $e.data) && (N.ah = !0), S.ppsList[$e.pps_id] = $e, S.pps = $e;
break;
case Pe.H264_NAL_AUD:
b = !1, H.audFound = !0, Ae && N.eo(Ae, H), Ae = N.Fh = N.no(!1, f);
break;
case Pe.H264_NAL_FILLER_DATA:
default:
b = !1;
}
Ae && b && ((Ce = Ae.units) == null || Ce.push(me));
}), Ae && (Y.length && (Ae.sei = { sei: Y, streamTimestamp: Object(mt.c)(Ae.originPTS) }), ce.length && (Ae.privNal = { info: ce, streamTimestamp: Object(mt.c)(Ae.originPTS) })), Ae;
}, d.lo = function() {
var l, f = this.Mi;
f.decConf && this.ah && !this.Ve && (this.Ci.i(Vi, "remux on paramSets update."), this.oo(!0), this.De.iSGenerated && this._i && this.De.resetInitSegment(this._i));
var b = !1;
f.decConf && !this.ah || (f.codecType === X.c.h264 ? this.Wh.spsList.length && this.Wh.ppsList.length && (Dt.updateAVCTrack(this.Ci, f, this.Wh), b = !0) : this.Zh.spsList.length && this.Zh.ppsList.length && this.Zh.vpsList.length && (Dt.updateHEVCTrack(this.Ci, f, this.Zh), b = !0)), b && this.Ai.emit(oe.a.VIDEO_CODEC_DETECTED, { enabled: !!f.active, decoder: f.outputRaw ? X.d.wasm : X.d.buildin, codecType: f.codecType || X.c.unknown, bitDepth: f.bitDepth, timeOffset: ((l = this.Ue) == null ? void 0 : l.timeOffset) || 0 }), this.ah = !1;
}, d.bo = function() {
var l, f = this.Fh;
if (!f || f.units.length === 0) {
var b = this.Mi.samples;
f = b[b.length - 1];
}
if (f) {
var N = f.units;
l = N[N.length - 1];
}
return l;
}, d.ro = function(l) {
var f, b, N, H, S = 0, Y = 0, ce = this.Mi.naluState || 0, Ae = -1, _e = this.Mi, me = l.byteLength, Ce = me, Me = [], Ge = ce;
if (ce === -1)
Ae = 0, H = ne(_e.codecType) ? (126 & l[0]) >> 1 : 31 & l[0], ce = 0, S = 1;
else if (ce > 0)
for (; Y < 4; Y++) {
var xe = l[Y];
if (xe !== 0) {
if (xe === 1 && ce >= 2) {
Ae = Y + 1, H = ne(_e.codecType) ? (126 & l[Ae]) >> 1 : 31 & l[Ae], ce = 0;
var Ze = this.bo();
Ze && Ge && Y <= 4 - Ge && Ze.state && (Ze.data = Ze.data.subarray(0, Ze.data.byteLength - Ge));
break;
}
Y < me && (ce = 0);
break;
}
ce++, S = Y + 1;
}
for (; S < Ce; )
if ((f = l[S + 2]) === 1)
if (l[S] === 0 && l[S + 1] === 0) {
if (ce = S > 0 && l[S - 1] === 0 ? 3 : 2, S += 3, Ae >= 0)
N = { data: l.subarray(Ae, S - ce - 1), type: H || 0 }, Me.push(N);
else {
var $e = this.bo();
if ($e && (b = S - ce - 1) > 0) {
var et = new Uint8Array($e.data.byteLength + b);
et.set($e.data, 0), et.set(l.subarray(0, b), $e.data.byteLength), $e.data = et;
}
}
S < me ? (Ae = S, H = ne(_e.codecType) ? (126 & l[S]) >> 1 : 31 & l[S], ce = 0) : ce = -1;
} else
S += 3;
else
f === 0 ? S++ : S += 3;
for (var st = me - 1; st > me - 4 && st >= Y && l[st] === 0; st--)
ce++;
if (Ae >= 0 && ce >= 0 && Ae < me && (N = { data: l.subarray(Ae, me), type: H || 0, state: ce }, Me.push(N)), Me.length === 0) {
var Ke = this.bo();
if (Ke) {
var Tt = new Uint8Array(Ke.data.byteLength + l.byteLength);
Tt.set(Ke.data, 0), Tt.set(l, Ke.data.byteLength), Ke.data = Tt;
}
}
return _e.naluState = ce, Me;
}, T()(E, [{ key: "minChunkSize", get: function() {
return 188;
} }, { key: "encryptedChunkSize", get: function() {
return 752;
} }], [{ key: "probeSize", get: function() {
return 752;
} }]);
}(de), Qa = "demuxer-inline", ga = function() {
function V(d, l, f, b, N) {
this.Ai = void 0, this.di = void 0, this.po = void 0, this.li = void 0, this.kh = void 0, this.mo = null, this._t = new p.a(), this.yo = void 0, this.Ci = void 0, this._o = [], this.Co = void 0, this.De = void 0, this.Io = void 0, this.Oo = 0, this.Ai = d, this.li = l, this.di = f, this.po = b, this.Ci = N, Pt && this._o.push({ Demux: Pt, Remux: qi.b, type: o.b.FLV }), Ei && this._o.push({ Demux: Ei, Remux: qi.b, type: o.b.MP4 }), Br && this._o.push({ Demux: Br, Remux: qi.b, type: o.b.IVF }), jn && this._o.push({ Demux: jn, Remux: qi.b, type: o.b.TS }), Wa && this._o.push({ Demux: Wa, Remux: qi.b, type: o.b.RAW }), this.Oo = this._o.reduce(function(H, S) {
return Math.max(S.Demux.probeSize, H);
}, 0);
}
var E = V.prototype;
return E.pushMuxData = function(d, l, f, b, N, H, S, Y, ce, Ae) {
var _e = this, me = d;
if ((S || H) && this._t.clear(), Ae.progress && this.Oo)
if (this._t.put(d), ce)
me = this._t.get(this._t.unreadLen);
else {
var Ce = Math.floor(this._t.unreadLen / this.Oo) * this.Oo;
if (!(Ce >= this.Oo))
return void (this.Io || (this.Io = { contiguous: N, trackSwitch: H, discontinuity: S, accurateTimeOffset: Y }));
me = this._t.get(Ce);
}
else
this._t.unreadLen && (this._t.put(d), me = this._t.get(this._t.unreadLen));
if (me)
if (d = me, this.Io && (N = this.Io.contiguous, H = this.Io.trackSwitch, S = this.Io.discontinuity, Y = this.Io.accurateTimeOffset, this.Io = void 0), d.byteLength > 0 && l && l.key && l.method === "AES-128") {
var Me, Ge = this.kh;
!Ge && jn && F && (Ge = this.kh = new F(this.Ci, this.di, { removePKCS7Padding: ce })), S && (this.mo = null);
var xe = this.mo ? this.mo : l.iv;
(Me = Ge) == null || Me.decrypt(d, l.key.buffer, xe.buffer, function(Ze) {
ce ? _e.mo = null : (_e.mo = new Uint8Array(16), _e.mo.set(d.subarray(d.byteLength - 16), 0)), _e.wo(new Uint8Array(Ze), l, f, b, N, H, S, Y, ce, Ae);
});
} else
l && ce && (this.mo = null), this.wo(d, l, f, b, N, H, S, Y, ce, Ae);
}, E.flush = function() {
this.Co && this.Co.flush(), this._t.clear();
}, E.end = function() {
this.Ai.emit(oe.a.LOAD_END, {});
}, E.updateConfig = function(d) {
var l;
this.Ci.i(Qa, "update config", d), (l = this.Co) == null || l.updateConfig(d);
}, E.Eo = function(d, l) {
if (!this.Co || l && this.yo && !this.yo(d)) {
for (var f = this.Ai, b = this.li, N = this.di, H = 0, S = this._o.length; H < S; H++) {
var Y = this._o[H], ce = Y.Demux.probe;
if (ce(d)) {
this.De = new Y.Remux(this.Ci, f, N, b, Y.type === o.b.FLV ? "" : this.po), this.Co = new Y.Demux(this.Ci, f, this.De, N, b), this.Ai.emit(oe.a.DEMUXER_DETECTED, { type: Y.type }), this.yo = ce;
break;
}
}
if (!this.Co)
return void this.Ai.emit(oe.a.ERROR, Object(s.e)(s.b.MUX_ERROR, s.a.DEMUX_NOT_FOUND, "no demux matching with content found"));
}
}, E.wo = function(d, l, f, b, N, H, S, Y, ce, Ae) {
try {
this.Co || this.Eo(d, !0);
var _e = this.Co, me = this.De;
if (!me || !_e)
return;
this.Oo = l ? _e.encryptedChunkSize || 16 : _e.minChunkSize || 0, (H || S) && (_e.resetInitSegment(Ae, f), me.resetInitSegment(Ae)), S && (_e.resetTimeStamp(), me.resetTimeStamp()), l && Object.prototype.hasOwnProperty.call(_e, "setDecryptData") && _e.setDecryptData(l), _e.append(d, b, N, Y, ce, Ae.fragSn);
} catch (Ce) {
this.Ci.i(Qa, Ce), this.Ai.emit(oe.a.ERROR, Object(s.e)(s.b.MUX_ERROR, s.a.REMUX_ERROR, Ce.message));
}
}, V;
}();
r.a = ga;
}, function(e, r, n) {
var o = n(5), s = n.n(o), p = n(12), g = n(0), C = n(22), y = n(25), x = "yuv2rgb-helper", h = new Float32Array([0, -0.501960814, -0.501960814, 1, 0, 0, 1, 0, 0, 1, 0, 0]), F = new Float32Array([-0.0627451017, -0.501960814, -0.501960814, 1.1644, 0, 1.596, 1.1644, -0.3918, -0.813, 1.1644, 2.0172, 0]), I = new Float32Array([0, -0.501960814, -0.501960814, 1, 0, 1.4075, 1, -0.3455, -0.7169, 1, 1.779, 0]), T = new Float32Array([-0.0627451017, -0.501960814, -0.501960814, 1.164, -0.013561232000000003, 1.365248481, 1.164, -0.345441461, -0.756825597, 1.164, 2.059156233, 0.010008336]), D = new Float32Array([0, -0.501960814, -0.501960814, 1, -0.011864761000000005, 1.197778023, 1, -0.302259224, -0.6617980229999999, 1, 1.801888929, 8744828e-9]), W = new Float32Array([-0.0627451017, -0.501960814, -0.501960814, 1.1644, 0, 1.7927, 1.1644, -0.2132, -0.5329, 1.1644, 2.1124, 0]), j = new Float32Array([0, -0.501960814, -0.501960814, 1, 0, 1.581, 1, -0.1881, -0.47, 1, 1.8629, 0]), O = new Float32Array([-0.062561095, -0.500488759, -0.500488759, 1.1678, 0, 1.6836, 1.1678, -0.1879, -0.6523, 1.1678, 2.1481, 0]), K = new Float32Array([0, -0.500488759, -0.500488759, 1, 0, 1.476, 1, -0.1647, -0.5719, 1, 1.8832, 0]), z = function() {
function Ee(G, te) {
this.Ci = void 0, this.jo = { rotation: 0 }, this.ko = void 0, this.Ci = G, this.ko = te == null ? void 0 : te.preferCanvasColorSpace;
}
var pe = Ee.prototype;
return pe.update = function(G, te, ie) {
ie === void 0 && (ie = 0);
var ee, Te = G.format.colorInfo || te;
return Object(p.f)(this.jo.colorInfo, Te) || (this.jo.matrix = this.Mo(G, Te), this.Ci.i(x, "color info update", te)), ee = this.jo.matrix ? this.jo.matrix : this.jo.matrix = this.Mo(G, Te), this.jo.buffer = G, this.jo.colorInfo = te = Te, this.jo.rotation = ie, ee;
}, pe.destroy = function() {
this.Ci.i(x, "destroy"), this.jo.buffer = void 0, this.jo.colorInfo = void 0;
}, pe.updatePreferCanvasColorSpace = function(G) {
var te = (this.ko || "srgb") !== (G || "srgb");
return this.ko = G, te;
}, pe.Mo = function(G, te) {
return this.Ci.i(x, "generate yuv matrix color info", te), G.format.chroma === y.a.AV_PIX_FMT_MONO ? (this.Ci.i(x, "generate yuv matrix: mono."), h) : (te && (te.matrixCoefficients === p.c.AVCOL_SPC_BT470BG ? (this.Ci.i(x, "generate yuv matrix. color: BT470BG range: " + p.b[te.colorRange] + " matrix bt601. full: " + (te.colorRange === p.b.AVCOL_RANGE_JPEG)), ie = te.colorRange === p.b.AVCOL_RANGE_JPEG ? D : T) : te.matrixCoefficients === p.c.AVCOL_SPC_SMPTE170M ? (this.Ci.i(x, "generate yuv matrix. color: SMPTE170M range: " + p.b[te.colorRange] + " matrix bt601. full: " + (te.colorRange === p.b.AVCOL_RANGE_JPEG)), ie = te.colorRange === p.b.AVCOL_RANGE_JPEG ? I : F) : te.matrixCoefficients === p.c.AVCOL_SPC_BT709 ? (this.Ci.i(x, "generate yuv matrix. color: BT709 range: " + p.b[te.colorRange] + " matrix bt709. full: " + (te.colorRange === p.b.AVCOL_RANGE_JPEG)), ie = te.colorRange === p.b.AVCOL_RANGE_JPEG ? j : W) : te.matrixCoefficients === p.c.AVCOL_SPC_BT2020_NCL && (this.Ci.i(x, "generate yuv matrix. color: BT2020_NCL range: " + p.b[te.colorRange] + " matrix bt2020. full: " + (te.colorRange === p.b.AVCOL_RANGE_JPEG)), ie = te.colorRange === p.b.AVCOL_RANGE_JPEG ? K : O)), ie || (this.Ci.i(x, "generate yuv matrix. color: " + (te ? p.c[te.matrixCoefficients] : "unknown") + " bits: " + G.y.bits + " height: " + G.format.height), G.y.bits > 8 ? (this.Ci.i(x, "generate yuv matrix. matrix bt2020"), ie = O) : G.format.height <= 576 ? (this.Ci.i(x, "generate yuv matrix. matrix 601 limit"), ie = F) : (this.Ci.i(x, "generate yuv matrix. matrix 709 limit"), ie = W)), ie);
var ie;
}, s()(Ee, [{ key: "preferCanvasColorSpace", get: function() {
return this.ko;
} }, { key: "colorInfo", get: function() {
return this.jo.colorInfo;
} }, { key: "drawData", get: function() {
return this.jo;
} }]);
}(), B = n(21), J = n(32), be = n(6), $ = n(54), ye = n.n($), Be = "canvas2d-frame", Ve = function() {
function Ee(G, te, ie, ee) {
this.Ci = void 0, this.So = void 0, this.Bo = void 0, this.To = C.a.contain, this.Pi = void 0, this.Do = void 0, this.Ro = void 0, this.Lo = 0, this.No = "notSet", this.Qo = void 0, this.xo = void 0, this.Vo = void 0, G.i(Be, "constructor colorSpace: " + (ie == null ? void 0 : ie.preferCanvasColorSpace)), this.So = te, this.Ci = G, this.Bo = new z(G, ie), this.Bo.updatePreferCanvasColorSpace(this.Bo.preferCanvasColorSpace), this.Pi = Object(B.a)(), this.Do = this.Pi.getContext("2d"), this.Qo = ee || new ye.a({ logger: G }), this.Qo.readyState === "complete" ? this.No = "complete" : this.Qo.readyState === "loading" && (this.No = "loading");
}
var pe = Ee.prototype;
return pe.drawFrame = function(G, te, ie) {
var ee = this;
if (this.Do && this.Pi) {
var Te, Se, Ye = this.Bo.update(G, te, ie);
if (te = this.Bo.colorInfo, this.Lo = ie || 0, this.Ro && (Te = this.Ro).width === G.format.width && Te.height === G.format.height || (this.Ro = Te = this.Uo(this.Pi, G)), this.No === "notSet")
return this.No = "loading", this.Qo.initMap(Ye, ((Se = te) == null ? void 0 : Se.transferCharacteristics) || p.d.AVCOL_TRC_UNSPECIFIED, G.y.bits).then(function(ze) {
return ee.No = "complete", ze && (ee._yuv2rgb(G, Te.data), ee.Fo(Te), ee.Po()), ze;
});
this.No !== "loading" && (this._yuv2rgb(G, Te.data), this.Fo(Te), this.Po());
}
}, pe.Fo = function(G) {
var te = this.xo, ie = this.Vo, ee = this.Do, Te = this.Lo;
te && ie ? (ie.clearRect(0, 0, te.width, te.height), ie.putImageData(G, 0, 0), ee && (ee.clearRect(0, 0, ee.canvas.width, ee.canvas.height), Te === 90 ? (ee.rotate(Math.PI / 2), ee.drawImage(te, 0, 0, te.width, te.height, 0, -ee.canvas.width, ee.canvas.height, ee.canvas.width), ee.resetTransform()) : Te === 270 ? (ee.rotate(1.5 * Math.PI), ee.drawImage(te, 0, 0, te.width, te.height, -ee.canvas.height, 0, ee.canvas.height, ee.canvas.width), ee.resetTransform()) : Te === 180 ? (ee.rotate(Math.PI), ee.drawImage(te, 0, 0, te.width, te.height, -ee.canvas.width, -ee.canvas.height, ee.canvas.width, ee.canvas.height), ee.resetTransform()) : ee.drawImage(te, 0, 0, te.width, te.height, 0, 0, ee.canvas.width, ee.canvas.height))) : ee == null || ee.putImageData(G, 0, 0);
}, pe._yuv2rgb = function(G, te) {
this.Qo.yuv2rgb(G.y.bytes, G.u.bytes, G.v.bytes, te, G.format.width, G.format.height, G.format.chroma, G.y.bits);
}, pe.setPictMode = function(G) {
this.To !== G && (this.Ci.i(Be, "update pict mode", G), this.To = G, this.Po());
}, pe.updatePreferCanvasColorSpace = function(G) {
var te = this.Bo.updatePreferCanvasColorSpace(G), ie = this.Bo.drawData;
return this.Pi && ie.buffer && (this.Ro = this.Uo(this.Pi, ie.buffer)), te;
}, pe.clear = function() {
this.Ci.i(Be, "clear"), this.So.clearRect(0, 0, this.So.canvas.width, this.So.canvas.height);
}, pe.destroy = function() {
this.Ci.i(Be, "destroy"), this.Qo.destroy(), this.Bo.destroy(), this.Xi();
}, pe.Xi = function() {
this.Pi = void 0, this.Do = void 0, this.xo = void 0, this.Vo = void 0;
}, pe.Po = function() {
if (this.Pi) {
var G = 0, te = 0, ie = this.Pi.width, ee = this.Pi.height, Te = 0, Se = 0, Ye = this.So.canvas.width, ze = this.So.canvas.height, it = this.So, ct = ie / ee, nt = Ye / ze;
this.To === C.a.contain ? ct > nt ? ze -= 2 * (Se = (ze - Ye / ct) / 2) : Ye -= 2 * (Te = (Ye - ze * ct) / 2) : this.To === C.a.cover && (ct > nt ? ie -= 2 * (G = (ie - ee * nt) / 2) : ee -= 2 * (te = (ee - ie / nt) / 2)), it.clearRect(0, 0, it.canvas.width, it.canvas.height), it.drawImage(this.Pi, G, te, ie, ee, Te, Se, Ye, ze);
}
}, pe.Uo = function(G, te) {
this.Ci.i(Be, "init image data", te.format.width, te.format.height, this.Bo.preferCanvasColorSpace);
for (var ie = this.Bo.preferCanvasColorSpace ? { colorSpace: this.Bo.preferCanvasColorSpace } : void 0, ee = be.a.firefox ? new ImageData(te.format.width, te.format.height) : new ImageData(te.format.width, te.format.height, ie), Te = te.format.width * te.format.height, Se = 1; Se < Te; Se++)
ee.data[4 * Se - 1] = 255;
var Ye = this.Ho(te);
if (this.Lo === 90 || this.Lo === 270 || this.Lo === 180 || Ye) {
this.xo || (this.xo = Object(B.a)(), this.Vo = this.xo.getContext("2d")), this.xo.width = te.format.width, this.xo.height = te.format.height;
var ze = te.format.width, it = te.format.height;
if (Ye) {
var ct = Object(J.a)(te.format.width, te.format.height, te.format.sar);
ze = ct.width, it = ct.height;
}
if (this.Lo === 90 || this.Lo === 270) {
var nt = ze;
ze = it, it = nt;
}
G.width = ze, G.height = it;
} else
G.width = te.format.width, G.height = te.format.height;
return ee;
}, pe.Ho = function(G) {
return !(!G.format.sar || G.format.sar.width === G.format.height);
}, s()(Ee, [{ key: "preferCanvasColorSpace", get: function() {
return this.Bo.preferCanvasColorSpace;
} }, { key: "yuv2rgbLib", get: function() {
return this.Qo;
} }, { key: "ready", get: function() {
return this.No === "complete";
} }, { key: "type", get: function() {
return g.b.canvas2d;
} }, { key: "drawData", get: function() {
return this.Bo.drawData;
} }, { key: "imageData", get: function() {
var G;
return (G = this.Do) == null ? void 0 : G.getImageData(0, 0, this.Do.canvas.width, this.Do.canvas.height);
} }]);
}(), je = n(8), we = n.n(je), ue = n(10), L = n.n(ue), w = n(14), le = n(3), oe = n(44), Re = n(2), Oe = `
precision lowp float;
attribute vec2 aPosition;
attribute vec2 aLumaPosition;
attribute vec2 aChromaPosition;
varying vec2 vLumaPosition;
varying vec2 vChromaPosition;
uniform mat3 uMatrix;
void main() {
gl_Position = vec4((uMatrix * vec3(aPosition, 1)).xy, 0, 1);
vLumaPosition = aLumaPosition;
vChromaPosition = aChromaPosition;
}
`, de = `
#define EOTF_C1 .8359375
#define EOTF_C2 18.8515625
#define EOTF_C3 18.6875
#define EOTF_HLG_GAMMA 0.2
#define _EOTF_HLG_A 0.17883277
#define _EOTF_HLG_B 0.28466892
#define _EOTF_HLG_C 0.55991073
#define MAIN_A 2.51
#define MAIN_B 0.03
#define MAIN_C 1.23
#define MAIN_D 0.59
#define MAIN_E 0.14
#define MAIN_ADAPTED_LUM 0.001
precision lowp float;
const vec3 eotf_m1 = vec3(1.0 / .1593017578125);
const vec3 eotf_m2 = vec3(1.0 / 78.84375);
const vec3 tonemapping_hlg_m1 = vec3(1.0 / 1.3);
const vec3 main_m1 = vec3(0.555555555556);
const vec3 main_m2 = vec3(2.0);
// bt2020 to bt709
const mat3 mat_xyz_to_rgbp3 = mat3(
1.66049100210843, -0.124550474521591, -0.0181507633549054,
-0.587641138788548, 1.13289989712596, -0.100578898008008,
-0.0728498633198855, -0.00834942260436943, 1.11872966136291
);
float _eotf_hlg(float x) {
if (x < 0.5) {
return pow(x / 0.5, 2.0) / 12.0;
} else {
return (exp((x - _EOTF_HLG_C) / _EOTF_HLG_A) + _EOTF_HLG_B) / 12.0;
}
}
vec3 eotf_hlg(vec3 i) {
vec3 res;
float Y = 0.2627 * res.x + 0.6780 * res.y + 0.0593 * res.z;
res = pow(Y, EOTF_HLG_GAMMA) * res;
res.x = _eotf_hlg(i.x);
res.y = _eotf_hlg(i.y);
res.z = _eotf_hlg(i.z);
return res;
}
vec3 eotf(vec3 i) {
i = max(i, 1e-10);
vec3 input_m2 = pow(i, eotf_m2);
return pow((input_m2 - EOTF_C1) / (EOTF_C2 - EOTF_C3 * input_m2), eotf_m1) * 10000.0;
}
vec3 tonemapping_hlg(vec3 i) {
vec3 res = pow(i, tonemapping_hlg_m1);
return res;
}
float _trc_gamma(float i) {
if (i < 0.018) {
return 4.5 * i;
} else {
return 1.099 * pow(i, 0.45);
}
}
vec3 trc_gamma(vec3 i) {
vec3 res;
res.x = _trc_gamma(i.x);
res.y = _trc_gamma(i.y);
res.z = _trc_gamma(i.z);
return res;
}
uniform sampler2D uTextureY;
uniform sampler2D uTextureCb;
uniform sampler2D uTextureCr;
uniform vec3 uColorCovYOffset;
uniform mat3 uColorConversion;
uniform int uColorTrc;
uniform int uBitsPerPixel;
varying vec2 vLumaPosition;
varying vec2 vChromaPosition;
void main() {
vec3 yuv;
if (uBitsPerPixel > 8) {
float normalized = pow(2.0, float(uBitsPerPixel - 8));
yuv.x = (texture2D(uTextureY, vLumaPosition).r + texture2D(uTextureY, vLumaPosition).a * 256.0) / normalized;
yuv.y = (texture2D(uTextureCb, vChromaPosition).r + texture2D(uTextureCb, vChromaPosition).a * 256.0) / normalized;
yuv.z = (texture2D(uTextureCr, vChromaPosition).r + texture2D(uTextureCr, vChromaPosition).a * 256.0) / normalized;
yuv += uColorCovYOffset;
vec3 rgb = yuv * uColorConversion;
vec3 rgb_lum;
if (uColorTrc == 16) { // HDR10 or HDR10+
// 电光转换(EOTF)
rgb_lum = eotf(rgb);
//tone mapping
vec3 tmp = rgb_lum * MAIN_ADAPTED_LUM;
rgb_lum = tmp * (tmp * MAIN_A + MAIN_B) / (tmp * (tmp * MAIN_C + MAIN_D) + MAIN_E) / 1.3;
rgb_lum = pow(rgb_lum, main_m1) * pow(main_m2, rgb_lum) / 2.0; //g=1.8
//调节饱和度
float gray = (rgb_lum.x + rgb_lum.y + rgb_lum.z) / 2.0;
rgb_lum = rgb_lum + (rgb_lum * 1.5 - gray) * 0.12;
} else { // HLG
rgb_lum = eotf_hlg(rgb);
rgb_lum = tonemapping_hlg(rgb_lum);
}
vec3 rgbp3 = trc_gamma(mat_xyz_to_rgbp3 * rgb_lum);
gl_FragColor = vec4(rgbp3, 1.0);
} else {
yuv.x = texture2D(uTextureY, vLumaPosition).x;
yuv.y = texture2D(uTextureCb, vChromaPosition).x;
yuv.z = texture2D(uTextureCr, vChromaPosition).x;
yuv += uColorCovYOffset;
gl_FragColor = vec4(clamp(yuv * uColorConversion, 0.0, 1.0), 1.0);
}
}`, X = new Float32Array([-1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1]), ge = new Float32Array([1, -0, 0, 0, 1, 0, 0, 0, 1]), Pe = new Float32Array([0, -1, 0, 1, 0, 0, 0, 0, 1]), ae = new Float32Array([-1, 0, 0, 0, -1, 0, 0, 0, 1]), q = new Float32Array([0, 1, 0, -1, 0, 0, 0, 0, 1]), m = "webgl-frame", ve = function() {
function Ee(G, te, ie) {
this.Yi = void 0, this.Ci = void 0, this.Bo = void 0, this.Yo = {}, this.Go = {}, this.Ko = null, this.Zo = null, this.Wo = 0, this.Xo = null, this.zo = 0, this.Jo = null, this.qo = 0, this.$o = null, this.ta = null, this.ia = null, this.ea = null, this.na = null, this.sa = null, this.ra = null, this.ha = null, this.To = C.a.cover, G.i(m, "constructor colorSpace: " + (ie == null ? void 0 : ie.preferCanvasColorSpace)), this.Yi = te, this.Ci = G, this.Bo = new z(G, ie), Object(B.d)(te, this.Bo.preferCanvasColorSpace);
}
Ee.getRotMatrix = function(G) {
switch (G) {
case 90:
return Pe;
case 180:
return ae;
case 270:
return q;
}
return ge;
}, Ee.oa = function(G, te) {
G.bindTexture(G.TEXTURE_2D, te), G.texParameteri(G.TEXTURE_2D, G.TEXTURE_WRAP_S, G.CLAMP_TO_EDGE), G.texParameteri(G.TEXTURE_2D, G.TEXTURE_WRAP_T, G.CLAMP_TO_EDGE), G.texParameteri(G.TEXTURE_2D, G.TEXTURE_MIN_FILTER, G.LINEAR), G.texParameteri(G.TEXTURE_2D, G.TEXTURE_MAG_FILTER, G.LINEAR);
};
var pe = Ee.prototype;
return pe.destroy = function() {
this.Ci.i(m, "destroy");
var G = this.Yi;
if (G) {
this.aa(), this.Ci.i(m, "destroy. lose ctx");
var te = G.getExtension("WEBGL_lose_context");
te && te.loseContext();
}
this.Bo.destroy();
}, pe.setPictMode = function(G) {
if (this.To !== G) {
this.Ci.i(m, "update pict mode", G), this.To = G, this.clear();
var te = this.Bo.drawData;
te.buffer && this.drawFrame(te.buffer, te.colorInfo, te.rotation);
}
}, pe.setWebGLCtx = function(G, te) {
te === void 0 && (te = C.a.contain), this.Ci.i(m, "set webgl", G, G !== this.Yi), this.To = te, G !== this.Yi && (this.aa(), this.Yi = G);
}, pe.updatePreferCanvasColorSpace = function(G) {
return Object(B.d)(this.Yi, G), this.Bo.updatePreferCanvasColorSpace(G);
}, pe.ua = function(G) {
if (this.Yo[G])
return this.Yo[G];
var te = this.Yi;
if (!te)
return null;
var ie = te.createTexture();
return ie ? (this.Yo[G] = ie, ie) : null;
}, pe.ca = function(G, te, ie, ee, Te) {
var Se = this.Yi;
if (Se) {
var Ye = this.ua(G);
Se.activeTexture(Se.TEXTURE0), Ee.oa(Se, Ye), Se.texImage2D(Se.TEXTURE_2D, 0, ee > 8 ? Se.LUMINANCE_ALPHA : Se.LUMINANCE, te, ie, 0, ee > 8 ? Se.LUMINANCE_ALPHA : Se.LUMINANCE, Se.UNSIGNED_BYTE, Te);
}
}, pe.fa = function() {
this.Ci.i(m, "init");
var G = this.Yi;
G && (this.Ko = this.Aa(Oe, de), this.Ko && (this.Zo = G.createBuffer(), G.bindBuffer(G.ARRAY_BUFFER, this.Zo), G.bufferData(G.ARRAY_BUFFER, X, G.STATIC_DRAW), this.Wo = G.getAttribLocation(this.Ko, "aPosition"), this.Xo = G.createBuffer(), this.zo = G.getAttribLocation(this.Ko, "aLumaPosition"), this.Jo = G.createBuffer(), this.qo = G.getAttribLocation(this.Ko, "aChromaPosition"), this.$o = G.getUniformLocation(this.Ko, "uColorCovYOffset"), this.ia = G.getUniformLocation(this.Ko, "uColorConversion"), this.ea = G.getUniformLocation(this.Ko, "uColorTrc"), this.na = G.getUniformLocation(this.Ko, "uBitsPerPixel"), this.ta = G.getUniformLocation(this.Ko, "textureSize"), this.sa = G.getUniformLocation(this.Ko, "uMatrix"), G.pixelStorei(G.UNPACK_ALIGNMENT, 1)));
}, pe.va = function(G, te, ie) {
var ee = this.Yi;
ee && this.Ko && (ee.activeTexture(te), this.Yo[G] && ee.bindTexture(ee.TEXTURE_2D, this.Yo[G]), ee.texParameteri(ee.TEXTURE_2D, ee.TEXTURE_WRAP_S, ee.CLAMP_TO_EDGE), ee.texParameteri(ee.TEXTURE_2D, ee.TEXTURE_WRAP_T, ee.CLAMP_TO_EDGE), ee.texParameteri(ee.TEXTURE_2D, ee.TEXTURE_MIN_FILTER, ee.LINEAR), ee.texParameteri(ee.TEXTURE_2D, ee.TEXTURE_MAG_FILTER, ee.LINEAR), ee.uniform1i(ee.getUniformLocation(this.Ko, G), ie));
}, pe.Aa = function(G, te) {
var ie = this.Yi;
if (ie) {
this.Ci.i(m, "init program", ie);
var ee = this.da(ie.VERTEX_SHADER, G), Te = this.da(ie.FRAGMENT_SHADER, te);
this.ra = ee, this.ha = Te;
var Se = ie.createProgram();
if (Se && ee && Te) {
if (ie.attachShader(Se, ee), ie.attachShader(Se, Te), ie.linkProgram(Se), !ie.getProgramParameter(Se, ie.LINK_STATUS)) {
var Ye = ie.getProgramInfoLog(Se);
throw ie.deleteProgram(Se), new Error("GL program linking failed: " + Ye);
}
return Se;
}
}
return null;
}, pe.da = function(G, te) {
var ie = this.Yi;
if (ie) {
var ee = ie.createShader(G);
if (ee) {
if (ie.shaderSource(ee, te), ie.compileShader(ee), !ie.getShaderParameter(ee, ie.COMPILE_STATUS)) {
var Te = ie.getShaderInfoLog(ee);
throw ie.deleteShader(ee), new Error("GL shader compilation for " + G + " failed: " + Te);
}
return ee;
}
}
return null;
}, pe.drawFrame = function(G, te, ie) {
ie === void 0 && (ie = 0);
var ee = this.Yi;
if (ee) {
var Te = G.format, Se = G.y.bits > 8 ? 2 : 1, Ye = !this.Ko || this.la(G.format), ze = this.Bo.update(G, te, ie);
te = this.Bo.colorInfo, Ye && this.clear(), this.Ko || this.fa(), Ye && (this.ba(this.Xo, this.zo, G.y.stride / Se, G.format), this.ba(this.Jo, this.qo, G.u.stride * Te.width / Te.chromaWidth / Se, G.format)), this.ca("uTextureY", G.y.stride / Se, G.format.height, G.y.bits, G.y.bytes), this.ca("uTextureCb", G.u.stride / Se, G.format.chromaHeight, G.u.bits, G.u.bytes), this.ca("uTextureCr", G.v.stride / Se, G.format.chromaHeight, G.v.bits, G.v.bytes), ee.useProgram(this.Ko), this.To === C.a.contain ? ee.viewport((ee.canvas.width - Te.displayWidth) / 2, (ee.canvas.height - Te.displayHeight) / 2, Te.displayWidth, Te.displayHeight) : this.To === C.a.cover ? ee.canvas.width / ee.canvas.height > Te.displayWidth / Te.displayHeight ? ee.viewport(0, (ee.canvas.height - Te.displayHeight * (ee.canvas.width / Te.displayWidth)) / 2, ee.canvas.width, ee.canvas.height * (ee.canvas.width / Te.displayWidth)) : ee.viewport((ee.canvas.width - Te.displayWidth * (ee.canvas.height / Te.displayHeight)) / 2, 0, ee.canvas.width * (ee.canvas.height / Te.displayHeight), ee.canvas.height) : ee.viewport(0, 0, ee.canvas.width, ee.canvas.height), this.va("uTextureY", ee.TEXTURE0, 0), this.va("uTextureCb", ee.TEXTURE1, 1), this.va("uTextureCr", ee.TEXTURE2, 2), te && ee.uniform1i(this.ea, te.transferCharacteristics), ee.uniform1i(this.na, G.y.bits), ee.uniformMatrix3fv(this.sa, !1, Ee.getRotMatrix(ie)), ee.uniform3fv(this.$o, ze.subarray(0, 3)), ee.uniformMatrix3fv(this.ia, !1, ze.subarray(3, 12));
var it = new Float32Array([Te.width, Te.height]);
ee.uniform2fv(this.ta, it), ee.bindBuffer(ee.ARRAY_BUFFER, this.Zo), ee.enableVertexAttribArray(this.Wo), ee.vertexAttribPointer(this.Wo, 2, ee.FLOAT, !1, 0, 0), ee.bindBuffer(ee.ARRAY_BUFFER, this.Xo), ee.enableVertexAttribArray(this.zo), ee.vertexAttribPointer(this.zo, 2, ee.FLOAT, !1, 0, 0), ee.bindBuffer(ee.ARRAY_BUFFER, this.Jo), ee.enableVertexAttribArray(this.qo), ee.vertexAttribPointer(this.qo, 2, ee.FLOAT, !1, 0, 0), ee.drawArrays(ee.TRIANGLES, 0, X.length / 2), ee.finish();
}
}, pe.ba = function(G, te, ie, ee) {
var Te = this.Yi;
if (Te) {
var Se = ee.cropLeft / ie, Ye = (ee.cropLeft + ee.cropWidth) / ie, ze = (ee.cropTop + ee.cropHeight) / ee.height, it = ee.cropTop / ee.height, ct = new Float32Array([Se, ze, Ye, ze, Se, it, Se, it, Ye, ze, Ye, it]);
Te.bindBuffer(Te.ARRAY_BUFFER, G), Te.bufferData(Te.ARRAY_BUFFER, ct, Te.STATIC_DRAW);
}
}, pe.clear = function() {
var G = this.Yi;
G && (G.viewport(0, 0, G.canvas.width, G.canvas.height), G.clearColor(0, 0, 0, 0), G.clear(G.COLOR_BUFFER_BIT));
}, pe.la = function(G) {
var te, ie = (te = this.Bo.drawData.buffer) == null ? void 0 : te.format;
return !(ie && G.width === ie.width && G.height === ie.height && G.chromaWidth === ie.chromaWidth && G.chromaHeight === ie.chromaHeight);
}, pe.aa = function() {
var G = this;
this.Ci.i(m, "clear WebGL");
var te = this.Yi;
te && (te.disableVertexAttribArray(this.Wo), te.disableVertexAttribArray(this.zo), te.disableVertexAttribArray(this.qo), this.Zo && te.deleteBuffer(this.Zo), this.Xo && te.deleteBuffer(this.Xo), this.Jo && te.deleteBuffer(this.Jo), Object.keys(this.Yo).forEach(function(ie) {
G.Yi && G.Yo[ie] && G.Yi.deleteTexture(G.Yo[ie]), delete G.Yo[ie];
}), Object.keys(this.Go).forEach(function(ie) {
G.Yi && G.Go[ie] && G.Yi.deleteFramebuffer(G.Go[ie]), delete G.Go[ie];
}), this.Ko && te.deleteProgram(this.Ko), this.ra && te.deleteShader(this.ra), this.ha && te.deleteShader(this.ha), this.Ko = null);
}, s()(Ee, [{ key: "ready", get: function() {
return !0;
} }, { key: "preferCanvasColorSpace", get: function() {
return this.Bo.preferCanvasColorSpace;
} }, { key: "type", get: function() {
return g.b.webgl;
} }, { key: "drawData", get: function() {
return this.Bo.drawData;
} }, { key: "imageData", get: function() {
if (this.Yi) {
var G = new ImageData(this.Yi.canvas.width, this.Yi.canvas.height);
return this.Yi.readPixels(0, 0, this.Yi.canvas.width, this.Yi.canvas.height, this.Yi.RGBA, this.Yi.UNSIGNED_BYTE, G.data), G;
}
} }]);
}(), U = "canvas-renderer-screenshot", M = function(Ee) {
function pe(te, ie) {
var ee;
return (ee = Ee.call(this) || this).Ci = void 0, ee.Ai = void 0, ee.Pi = void 0, ee.Qo = void 0, ee.pa = void 0, ee.Ci = te, ee.Ai = ie, ee;
}
L()(pe, Ee);
var G = pe.prototype;
return G.screenshot = function(te, ie) {
var ee, Te, Se = te.type, Ye = te.drawData;
this.Ci.i(U, "screenshot type: " + Se + " id:" + (ie == null ? void 0 : ie.id) + " pts: " + ((ee = Ye.buffer) == null ? void 0 : ee.format.pts));
var ze = { pts: ((Te = Ye.buffer) == null ? void 0 : Te.format.pts) || -1 };
if (ie != null && ie.id && (ze.id = ie.id), !Ye.buffer)
return this.Ci.i(U, "screenshot type: " + Se + " id:" + (ie == null ? void 0 : ie.id) + " error. empty yuv"), ze.errorCode = le.a.SCREENSHOT_EMPTY_DATA_ERROR, ze.errorMessage = "empty yuv", void this.Ai.emit(Re.a.SCREENSHOT, we()(ze, { errorCode: le.a.SCREENSHOT_EMPTY_DATA_ERROR, errorMessage: "empty yuv" }));
this.Pi || (this.Pi = Object(B.a)());
var it = this.Pi;
if (this.ma(Ye.buffer.format.width, Ye.buffer.format.height, Ye.rotation), this.Qo ? this.Qo.updatePreferCanvasColorSpace(ie == null ? void 0 : ie.colorSpace) : (this.Ci.i(U, "create frame sink: " + Se), this.Qo = this.ga(it, Se, te.yuv2rgbLib)), this.Qo) {
var ct, nt = { width: Ye.buffer.format.displayWidth, height: Ye.buffer.format.displayHeight };
Ye.buffer.format.displayHeight = it.height, Ye.buffer.format.displayWidth = it.width;
try {
this.Qo.drawFrame(Ye.buffer, Ye.colorInfo, Ye.rotation);
} catch (zt) {
this.Ai.emit(Re.a.SCREENSHOT, we()(ze, { errorCode: le.a.SCREENSHOT_CREATE_IMG_ERROR, errorMessage: "draw frame error" }));
}
Ye.buffer.format.displayHeight = nt.height, Ye.buffer.format.displayWidth = nt.width, this.Qo.type === g.b.canvas2d ? ct = this.Qo.imageData : (this.pa || (this.pa = new oe.a(this.Ci), this.O.push(this.pa)), ct = this.pa.copyImageData(it, Ye.buffer.format.sar, Ye.rotation, ie == null ? void 0 : ie.colorSpace)), ct ? this.Ai.emit(Re.a.SCREENSHOT, we()(ze, { image: ct })) : this.Ai.emit(Re.a.SCREENSHOT, we()(ze, { errorCode: le.a.SCREENSHOT_CREATE_IMG_ERROR, errorMessage: "image data null" }));
} else
this.Ai.emit(Re.a.SCREENSHOT, we()(ze, { errorCode: le.a.SCREENSHOT_INIT_ERROR, errorMessage: "create frame sink error" }));
}, G.destroy = function() {
var te;
this.Ci.i(U, "destroy"), (te = this.Qo) == null || te.destroy(), this.Pi = void 0, Ee.prototype.destroy.call(this);
}, G.ma = function(te, ie, ee) {
var Te = this.Pi;
Te && (ee === 90 || ee === 270 ? (Te.width = ie, Te.height = te) : (Te.width = te, Te.height = ie));
}, G.ga = function(te, ie, ee, Te) {
this.Ci.i(U, "init frameSink type:" + ie + " colorSpace:" + (Te == null ? void 0 : Te.colorSpace));
var Se = Te != null && Te.colorSpace ? { preferCanvasColorSpace: Te.colorSpace } : void 0;
if (ie === g.b.webgl) {
var Ye = Object(B.c)(te);
if (Ye)
return Te != null && Te.colorSpace && Object(B.d)(Ye, Te.colorSpace), new ve(this.Ci, Ye, Se);
}
var ze = Te != null && Te.colorSpace ? { colorSpace: Te.colorSpace } : void 0, it = te.getContext("2d", ze);
if (it)
return new Ve(this.Ci, it, Se, ee);
}, pe;
}(w.a), ne = n(31), Le = n(39), Ue = function(Ee) {
return Ee[Ee.OK = 0] = "OK", Ee[Ee.REORDER = 1] = "REORDER", Ee;
}({}), re = 52428800, k = 1e3 / 24, P = "yuv-cache", Z = function() {
function Ee(G) {
this.Ci = void 0, this._t = [], this.ya = 0, this.Ct = -1, this._a = re, this.Ci = G;
}
var pe = Ee.prototype;
return pe.init = function(G) {
G && G > re && (this._a = G);
}, pe.reset = function() {
this.Ci.i(P, "reset"), this._t = [], this.ya = 0, this.Ct = -1;
}, pe.next = function() {
return this.getFrameByIndex(this.Ct + 1);
}, pe.prev = function() {
return this.getFrameByIndex(this.Ct - 1);
}, pe.push = function(G, te) {
te === void 0 && (te = !1);
var ie = Ue.OK, ee = G.y.bytes.byteLength + G.u.bytes.byteLength + G.v.bytes.byteLength, Te = this._t[this._t.length - 1];
this._t.push({ pts: G.format.pts, endPTS: G.format.pts + this.Ca(), size: ee, yuv: G });
var Se = this.Ia();
return te && (G.y.bytes = new Uint8Array(G.y.bytes), G.u.bytes = new Uint8Array(G.u.bytes), G.v.bytes = new Uint8Array(G.v.bytes)), Te && ((Se <= 0 || Se >= 1e3) && this.Ci.i(P, "yuv cache pts diff: " + Se + ", " + Te.pts + "/" + G.format.pts), Se < 0 ? (this.Oa(), ie = Ue.REORDER) : Te.endPTS = G.format.pts), this.ya += ee, this.wa(), ie;
}, pe.decDropFrameInfo = function(G) {
if (this.Ci.i(P, "dec drop: " + G.frames.length), G.frames.length) {
var te = this._t[this._t.length - 1], ie = G.frames[0].pts;
if (te) {
te.endPTS = ie;
var ee = ie - te.pts;
(ee <= 0 || ee >= 1e3) && this.Ci.i(P, "yuv drop frame pts diff: " + ee);
}
for (var Te = 0; Te < G.frames.length; Te++) {
var Se = G.frames[Te], Ye = G.frames[Te + 1];
this._t.push({ pts: Se.pts, endPTS: (Ye == null ? void 0 : Ye.pts) || Se.pts, size: 0 });
}
this.Oa();
}
}, pe.ptsToIndex = function(G) {
var te = this._t[this._t.length - 1];
return te && G <= te.endPTS ? G === te.endPTS ? this._t.length - 1 : Le.a.searchIndex(this._t, function(ie) {
return G < ie.pts ? -1 : G >= ie.endPTS ? 1 : 0;
}) : -1;
}, pe.getFrameByIndex = function(G) {
if (G >= 0 && G < this._t.length)
return this.Ct = G, this._t[G];
}, pe.getLessPtsIdxThen = function(G) {
var te = this._t[G];
if (te && G > 0 && G < this._t.length)
for (var ie = G - 1; ie >= 0; ie--) {
var ee = this._t[ie];
if (ee && ee.pts < te.pts)
return ie;
}
return -1;
}, pe.clean = function(G) {
this.Ci.i(P, "clean. st: " + G), G >= 0 && this.reset();
var te = this._t[this._t.length - 1];
if (te && G <= te.endPTS) {
var ie = Math.max(0, Le.a.searchIndex(this._t, function(ee) {
return G < ee.pts ? -1 : G > ee.pts ? 1 : 0;
}));
this._t = this._t.slice(0, ie), ie < this.Ct && (this.Ct = ie);
}
}, pe.hasDropedAfterIdx = function(G) {
if (G >= this._t.length)
return !1;
for (var te = Math.max(0, G); te < this._t.length; te++) {
var ie = this._t[te];
if (ie == null || !ie.yuv)
return !0;
}
return !1;
}, pe.wa = function() {
for (; this.ya >= this._a && this.Ct > 0; ) {
var G = this._t.shift();
G && G.yuv && (this.ya -= G.size), this.Ct--;
}
}, pe.Ia = function() {
var G = this._t;
return G.length > 1 ? G[G.length - 1].pts - G[G.length - 2].pts : 0;
}, pe.Ca = function() {
var G = this._t;
return G.length > 1 ? (G[G.length - 1].pts - G[0].pts) / (G.length - 1) : k;
}, pe.Oa = function() {
if (!(this._t.length <= 1)) {
this._t.sort(function(ee, Te) {
return ee.pts - Te.pts;
});
for (var G = 0; G < this._t.length; G++) {
var te = this._t[G], ie = this._t[G + 1];
te.endPTS = ie ? ie.pts : te.pts + this.Ca();
}
}
}, s()(Ee, [{ key: "current", get: function() {
return this.getFrameByIndex(this.Ct);
} }, { key: "index", get: function() {
return this.Ct;
}, set: function(G) {
G >= 0 && G < this._t.length && (this.Ct = G);
} }, { key: "cache", get: function() {
return this._t;
} }, { key: "remaining", get: function() {
return this._t.length - 1 - this.Ct;
} }]);
}(), he = "canvas-renderer", Ie = function() {
function Ee(G, te) {
this.di = void 0, this.Ai = void 0, this.Ci = void 0, this.Ea = void 0, this.Qo = void 0, this.ja = g.p.NONE, this.ka = !0, this.Ma = void 0, this.Sa = void 0, this.Ba = 0, this.Ta = 3, this.vt = g.s.canvas, this.Da = !1, this.Ra = void 0, this.La = 10, this.Na = void 0, this.Qa = void 0, G.i(he, "constructor"), this.Ai = te, this.Ci = G, this.Ea = new Z(G);
}
var pe = Ee.prototype;
return pe.init = function(G, te, ie) {
this.Ci.i(he, "init"), this.di = te, this.Na = new ne.a(this.Ci, te, ie), this.ja = this.di.videoDecBlockPolicy, this.Ea.init(te.videoFrameBufferSize);
try {
var ee = Object(B.b)(), Te = g.b.webgl;
te.preferCanvasType !== g.b.canvas2d && this.Na.webgl && ee.webGL ? (this.Ci.i(he, "webgl yuv2rgb"), this.Qo = new ve(this.Ci, this.Na.webgl, te)) : this.Na.canvas2d && (this.Ci.i(he, "software yuv2rgb"), this.Qo = new Ve(this.Ci, this.Na.canvas2d, te), Te = g.b.canvas2d), this.Ci.i(he, "renderer init complete. type: " + Te), this.Ai.emit(Re.a.RENDERER_INIT_COMPLETE, { type: Te });
} catch (Se) {
return this.Ci.i(he, Se), void this.Ai.emit(Re.a.ERROR, Object(le.e)(le.b.DECODER_ERROR, le.a.DECODER_WEBGL_ERROR, "render initialization error: " + (Se == null ? void 0 : Se.message)));
}
this.Qo ? this.xa() : this.Ai.emit(Re.a.ERROR, Object(le.e)(le.b.DECODER_ERROR, le.a.DECODER_WEBGL_ERROR, "render initialization error"));
}, pe.append = function(G) {
var te;
this.Ea.remaining, this.Ea.push(G) === Ue.REORDER && (this.Ci.i(he, "yuv cache reorder."), this.Ea.ptsToIndex(this.Ba), this.Ma = this.Ea.current, (te = this.Ma) != null && te.yuv && !this.ka && this.Va(this.Ma.yuv)), this.Ua(), this.Ai.emit(Re.a.RENDERER_BUF_UPDATE, { needMore: this.Ea.remaining < this.Ta, yuvBufLen: this.Ea.remaining, desc: "append" });
}, pe.Ua = function() {
this.ka && (this.Ea.remaining >= this.Ta || this.Fa()) && this.Pa();
}, pe.updateState = function(G, te, ie, ee, Te, Se, Ye) {
var ze, it, ct;
Ye === void 0 && (Ye = C.a.contain), this.Ba = G, this.vt !== Te && (this.Ci.i(he, "renderer type change to " + Te + ". clear."), this.Qo && this.Qo.clear()), (ze = this.Qo) == null || ze.setPictMode(Ye), this.vt = Te, this.La = Se, Te !== g.s.video && this.Na && this.Na.updateCanvasSize(te, ie) && (it = this.Qo) != null && it.drawData.buffer && this.Va((ct = this.Qo) == null ? void 0 : ct.drawData.buffer);
}, pe.updateMediaInfo = function(G) {
this.Ci.i(he, "update media info", G), this.Sa = G;
}, pe.step = function(G) {
if (!this.ka) {
if (G === g.m.NEXT) {
var te, ie = this.Ma ? this.Ma.pts : -1;
ie >= 0 && (te = this.Ma) != null && te.yuv && (this.Ba = ie, this.Ai.emit(Re.a.STEP, { type: G, time: ie }));
} else if (G === g.m.PREV) {
var ee = this.Ma ? this.Ea.index - 1 : this.Ea.index;
if (ee > 0) {
var Te = this.Ea.getLessPtsIdxThen(ee);
if (Te >= 0) {
if (ee - Te > 1 && this.Ci.i(he, "step prev skip " + (ee - Te - 1)), this.Ma = this.Ea.getFrameByIndex(Te), this.Ma && this.Ma.yuv)
return this.Ba = this.Ma.yuv.format.pts, void this.Ai.emit(Re.a.STEP, { type: G, time: this.Ma.yuv.format.pts });
} else
this.Ea.reset();
}
this.Ai.emit(Re.a.STEP, { type: G, time: -1 });
}
}
}, pe.seek = function(G, te) {
this.Ci.i(he, "seek[" + te + "]: seek. time: " + G);
var ie = this.Ea.ptsToIndex(G);
if (ie !== -1) {
var ee;
if (!this.Ea.hasDropedAfterIdx(ie))
return this.Ea.index = ie, this.Ma = this.Ea.current, this.Ci.i(he, "seek[" + te + "]: hit yuv cache. time: " + G + " draw pts: " + ((ee = this.Ma) == null ? void 0 : ee.pts) + " remain yuv: " + this.Ea.remaining), this.Ba = G, this.Ha(), this.Ai.emit(Re.a.RENDERER_BUF_UPDATE, { needMore: this.Ea.remaining < this.Ta, yuvBufLen: this.Ea.remaining, desc: "seek" }), void this.Ai.emit(Re.a.RENDERER_SEEK, { hitCache: !0, time: G, id: te });
this.Ci.i(he, "seek[" + te + "]: yuv cache has dropped. reset yuv cache."), this.Ea.reset(), this.Ai.emit(Re.a.RENDERER_BUF_UPDATE, { needMore: this.Ea.remaining < this.Ta, yuvBufLen: this.Ea.remaining, desc: "seek reset" });
}
this.Ta = this.La || 10, this.ka = !0, this.Ci.i(he, "seek[" + te + "]: miss yuv cache"), this.Ai.emit(Re.a.RENDERER_SEEK, { hitCache: !1, time: G, id: te });
}, pe.endOfData = function() {
this.Ci.i(he, "end of data"), this.Da = !0, this.Ua();
}, pe.decDropFrameInfo = function(G) {
this.Ea.decDropFrameInfo(G);
}, pe.screenshot = function(G) {
this.Qa || (this.Qa = new M(this.Ci, this.Ai)), this.Qo && this.Qa.screenshot(this.Qo, G);
}, pe.reset = function(G, te) {
te === void 0 && (te = !1), this.Ci.i(he, "reset", G), this.Ea.reset(), te || (this.Ba = -1), this.ka = !0, this.Ma = void 0, this.Da = !1, this.Ai.emit(Re.a.RENDERER_BUF_UPDATE, { needMore: !0, yuvBufLen: 0, desc: "reset" });
}, pe.destroy = function() {
var G, te;
this.Ci.i(he, "destroy."), this.Qo && this.Qo.destroy(), this.Ea.reset(), this.Ya(), (G = this.Na) == null || G.destroy(), this.Na = void 0, (te = this.Qa) == null || te.destroy();
}, pe.Fa = function() {
return this.Da;
}, pe.Ha = function() {
var G, te;
if (this.Na && this.Ba !== -1) {
var ie = this.Ea.remaining;
for (!this.Ma || (G = this.Ma) != null && G.yuv || this.Ci.i(he, "skip empty frame"), this.Ma && (te = this.Ma) != null && te.yuv || (this.Ma = this.Ea.next()); this.Ma && this.Ba >= 0; ) {
var ee = this.Ba - this.Ma.pts, Te = this.Ba - this.Ma.endPTS;
if (this.ka && Te > 200)
this.Ci.v(he, "skip draw", this.Ba, this.Ma.endPTS, Te), this.Ma = this.Ea.next();
else {
if (this.Ua(), this.ka || !(ee >= -1))
break;
if (Te <= 200) {
this.Ma.yuv && this.Va(this.Ma.yuv), this.Ma = this.Ea.next();
break;
}
this.ja === g.p.NONE ? (this.Ma.yuv && this.Va(this.Ma.yuv), this.Ma = this.Ea.next()) : (this.Ci.v(he, "skip b", this.Ma.pts, ee, Te), this.Ma = this.Ea.next(), this.Ma || this.Fa() || this.Ga());
}
}
ie != this.Ea.remaining && this.Ai.emit(Re.a.RENDERER_BUF_UPDATE, { desc: "update", needMore: this.Ea.remaining < this.Ta, yuvBufLen: this.Ea.remaining });
}
}, pe.Va = function(G) {
var te, ie = this;
if (this.Na) {
var ee = G.format, Te = ((te = this.Sa) == null ? void 0 : te.rotation) || 0, Se = ee.sar ? Object(J.a)(ee.width, ee.height, ee.sar) : ee;
if (this.Na.updateFormatSize(Se.width, Se.height, Te), ee.displayWidth = this.Na.displaySize.w, ee.displayHeight = this.Na.displaySize.h, this.Qo) {
var Ye, ze = this.Qo.drawFrame(G, (Ye = this.Sa) == null ? void 0 : Ye.colorInfo, Te);
if (ze !== void 0)
return this.Ai.emit(Re.a.RENDERER_WAITING), void ze.then(function(it) {
it ? (ie.Ai.emit(Re.a.RENDERER_WAITING_END), ie.Ai.emit(Re.a.RENDERER_DRAW, { yuvBufLen: ie.Ea.remaining })) : ie.Ai.emit(Re.a.ERROR, Object(le.e)(le.b.DECODER_ERROR, le.a.DECODER_2D_ERROR, "render initialization error. 2d"));
});
if (!this.Qo.ready)
return void this.Ai.emit(Re.a.RENDERER_WAITING);
}
this.Ai.emit(Re.a.RENDERER_DRAW, { yuvBufLen: this.Ea.remaining });
}
}, pe.xa = function() {
var G = this;
this.Ra || (this.Ra = setInterval(function() {
G.Ha();
}, 0));
}, pe.Ya = function() {
this.Ra && (clearInterval(this.Ra), this.Ra = void 0);
}, pe.Ga = function() {
var G = this.La || 10;
this.Ci.i(he, "waiting. frame buf: " + G), this.Ta !== G && (this.Ta = G), this.ka = !0, this.Ai.emit(Re.a.DECODER_WAITING);
}, pe.Pa = function() {
this.Ci.i(he, "waiting ready. frame buf: " + this.Ea.remaining + ", data ended: " + this.Fa()), this.ka = !1, this.Ai.emit(Re.a.DEC_VIDEO_READY);
}, Ee;
}();
r.a = Ie;
}, function(e, r, n) {
var o = n(0), s = n(7), p = n(3), g = n(9), C = n(11), y = n(16), x = n(5), h = n.n(x), F = s.b / s.n, I = "video-dec-cache", T = function() {
function m(U, M) {
var ne = this;
this.Ci = void 0, this.Ai = void 0, this.Ka = [], this.Za = 0, this.yt = 0, this.Wa = 0, this.Xa = -1, this.za = [], this.Ja = 1, this.Ah = 33, this.qa = void 0, this.$a = void 0, this.isIDR = function(Le) {
return Le.units.reduce(function(Ue, re) {
return ne.za.indexOf(re.type) !== -1 || Ue;
}, !1);
}, U.i(I, "constructor"), this.Ai = M, this.Ci = U;
}
var ve = m.prototype;
return ve.updateIdrFrame = function(U) {
this.Ci.i(I, "updateIdrFrame", U), this.za = U;
}, ve.appendData = function(U) {
var M = this;
if (U.type === C.d.decoderConfig) {
this.qa = U.samples[0];
var ne = this.$a = [], Le = {};
return this.qa.units.forEach(function(re) {
Le[re.type] || (Le[re.type] = !0, ne.push(re.type));
}), void this.Ci.i(I, "dec config", ne);
}
var Ue = this.Ka;
U.samples.forEach(function(re, k) {
var P = M.isIDR(re);
if (P || M.Xa !== -1) {
if (P) {
if (M.qa) {
var Z, he = !1;
M.$a && (he = M.$a.reduce(function(G, te) {
return G && re.units.reduce(function(ie, ee) {
return ie || ee.type === te;
}, !1);
}, !0)), !he && (M.Ci.i(I, "key sample has not dec config. push dec config units."), (Z = re.units).unshift.apply(Z, M.qa.units));
}
M.Wa++;
}
var Ie = re.units.reduce(function(G, te) {
return te.data.length + G;
}, 0), Ee = { id: M.Ja, key: P, gopId: M.Wa, type: U.type || C.d.videoFrame, size: Ie, data: re, dts: re.dts * s.b, pts: re.pts * s.b, mediaInfo: U.mediaInfo };
Ee.pts > M.Xa && (M.Xa = Ee.pts);
var pe = Ue[Ue.length - 1];
pe && Math.abs(Ee.dts - pe.dts) > 1e3 && M.Ci.i(I, "append error", M.Ka, M.Za), Ee.discontinuity = !!(Ee.type === C.d.videoFrame && pe && Math.abs(Ee.dts - pe.dts) > s.p), Ue.push(Ee), M.yt += Ie, M.Ja++;
}
}), Ue.length > 10 && (this.Ah = Math.max(F, (Ue[Ue.length - 1].dts - Ue[0].dts) / (Ue.length - 1))), this.tu();
}, ve.clean = function() {
this.Ci.i(I, "clean"), this.Ka = [], this.Ja = 0, this.Za = 0, this.yt = 0, this.Wa = 0, this.Xa = -1;
}, ve.getItem = function(U) {
return this.Ka[U];
}, ve.getItemIdxByDts = function(U) {
var M = this.iu(this.Ka, U);
if (M === -1) {
var ne = this.Ka[this.Ka.length - 1];
ne && U > ne.dts && U < ne.dts + this.Ah && (M = this.Ka.length - 1);
}
return M;
}, ve.getItemByDts = function(U) {
var M = this.getItemIdxByDts(U);
if (M >= 0)
return this.Ka[M];
}, ve.seek = function(U) {
var M = this.getItemIdxByDts(U);
if (M < 0 && this.hit(U) && this.Ka.length && U > this.Ka[this.Ka.length - 1].dts && (M = this.Ka.length - 1), M >= 0) {
for (var ne = M; ne >= 0; ne--)
if (this.Ka[ne].key && this.Ka[ne].pts <= U)
return this.Za = ne, !0;
}
return !1;
}, ve.hit = function(U) {
var M = this.Ka;
return !!M.length && U >= M[0].pts && U <= this.Xa + this.Ah;
}, ve.next = function() {
if (this.Za < this.Ka.length) {
var U = this.Ka[this.Za];
return this.Za++, this.tu(), U;
}
}, ve.tu = function() {
var U = this.Ka;
if (U.length) {
for (var M = 0; this.yt > 134217728 && this.Za > 0; ) {
var ne, Le = ((ne = this.current) == null ? void 0 : ne.gopId) || U[U.length - 1].gopId, Ue = U[0];
if (Le - Ue.gopId < 2)
break;
U.shift(), this.yt = this.yt - Ue.size, this.Za--, M++;
}
M && this.Ci.i(I, "remove", M);
}
}, ve.iu = function(U, M) {
for (var ne, Le = U, Ue = 0, re = Le.length - 1, k = void 0, P = void 0; Ue <= re; )
if (ne = Le[k = (Ue + re) / 2 | 0], (P = Le[k + 1]) && M > P.dts)
Ue = k + 1;
else {
if (P && M === P.dts)
return k + 1;
if (!(M < ne.dts))
return P ? k : -1;
re = k - 1;
}
return -1;
}, h()(m, [{ key: "current", get: function() {
return this.Ka[this.Za];
} }, { key: "remain", get: function() {
return this.Ka.length - this.Za;
} }, { key: "length", get: function() {
return this.Ka.length;
} }, { key: "idx", get: function() {
return this.Za;
}, set: function(U) {
this.Za = Math.min(Math.max(0, U), this.Ka.length);
} }, { key: "size", get: function() {
return this.yt;
} }, { key: "data", get: function() {
return this.Ka;
} }, { key: "frameDuration", get: function() {
return this.Ah;
} }]);
}(), D = n(50), W = n.n(D), j = n(2), O = n(25), K = function(m) {
return m[m.KS265_PIXFMT_YUV_420P = 0] = "KS265_PIXFMT_YUV_420P", m[m.KS265_PIXFMT_YUV_420SP = 1] = "KS265_PIXFMT_YUV_420SP", m[m.KS265_PIXFMT_YUV_420SP_VU = 2] = "KS265_PIXFMT_YUV_420SP_VU", m;
}(K || {}), z = { nWidth: 720, nHeight: 1280, nCodedWidth: 720, nCodedHeight: 1280, nLumaBitDepth: 10, nChromaBitDepth: 10, nChromaFormatIdc: 0, profile: 1, level: 150, has_b_frames: 1, pts: 0, bIllegalStream: 0, poc: 0 }, B = [0, 0, 0, 1], J = "ks265-wrapper", be = function() {
function m(U, M) {
this.Ai = void 0, this.Ci = void 0, this.eu = void 0, this.nu = void 0, this.Do = 0, this.su = !1, this.ru = 0, this.hu = !1, this.di = { pAuth: 0, threads: 1, nal_mode: 0, pic_out_pos: 0, bEnableOutputRecToFile: 0, strRecYuvFileName: 0, logLevel: 0, outputPixfmt: K.KS265_PIXFMT_YUV_420P, b_use_pthread: 0, b_alpha_decode: 0, p_arg: 0, p_log_func: 0, b_zerobuffer_contains_ref: 1 }, this.ou = 0, this.au = 0, U.i(J, "constructor"), this.Ai = M, this.Ci = U;
}
var ve = m.prototype;
return ve.init = function(U, M, ne) {
var Le = this;
if (this.Ci.i(J, "init simd: " + M + " threads: " + ne), !U.wasm.data)
return Promise.reject("ks265 wasm is null");
var Ue = U.js.data, re = U.jsw ? U.jsw.data : "", k = new Function(Ue + " return KW265;")(), P = re ? new Blob([Ue], { type: "text/javascript" }) : "", Z = new Blob([re], { type: "text/javascript" });
return k({ wasmBinary: U.wasm.data, mainScriptUrlOrBlob: P, locateFile: function(he) {
return he.indexOf(".worker.js") !== -1 ? URL.createObjectURL(Z) : "";
} }).then(function(he) {
Le.eu = he, Le.uu(), ne > 1 && (Le.di.b_use_pthread = 1, Le.di.threads = ne), Le.di.nal_mode = 0, Le.cu();
});
}, ve.pushNalus = function(U, M, ne) {
if (ne === void 0 && (ne = !1), this.eu && this.nu) {
this.fu(this.eu, this.au + 24, z), this.eu.setValue(this.au, 0, "i32"), this.ru++;
var Le = U.reduce(function(P, Z) {
return P + Z.data.byteLength;
}, 0) + B.length * U.length, Ue = new Uint8Array(Le), re = 0;
U.forEach(function(P) {
Ue.set(B, re), Ue.set(P.data, re + B.length), re += B.length + P.data.byteLength;
});
var k = performance.now();
this.nu.KS265DecodeFrame(this.Do, Ue, Le, Math.round(M) || 0), this.Au(k), this.hu = ne;
}
}, ve.getPendingNALNumber = function() {
return this.ru;
}, ve.endOfFrame = function() {
}, ve.nextFrame = function() {
this.ru && this.Au(), this.su = !0;
}, ve.free = function() {
var U;
(U = this.nu) == null || U.KS265DecoderDestroy(this.Do), this.eu && (this.ou && this.eu._free(this.ou), this.au && this.eu._free(this.au)), this.ou = this.au = 0;
}, ve.rebuild = function() {
this.Ci.i(J, "rebuild"), this.free(), this.ru = 0, this.su = !1, this.hu = !1, this.cu();
}, ve.flush = function() {
}, ve.reset = function() {
}, ve.isWaitingData = function() {
return this.su;
}, ve.Au = function(U) {
if (this.nu && this.eu && (U = U || performance.now(), this.hu && this.nu.KS265DecodeFlush(this.Do, 0), !(this.nu.KS265DecoderGetDecodedFrame(this.Do, this.au) < 0))) {
var M = this.vu(this.eu, this.au);
M.bValid && (this.Ai.emit(j.a.DECODER_FRAME, { frame: this.du(this.eu, M), startTime: U }), this.hu || this.nu.KS265DecoderReturnDecodedFrame(this.Do, this.au), this.su = !1, this.ru--);
}
}, ve.cu = function() {
this.nu && this.eu && (this.ou = this.lu(this.eu, this.di), this.au = this.bu(this.eu), this.Do = this.nu.KS265DecoderCreate(this.ou), this.nu.KS265DecodeFlush(this.Do, 1));
}, ve.du = function(U, M) {
var ne = O.a.AV_PIX_FMT_YUV420P, Le = Object(O.b)(M.frameinfo.nCodedWidth || M.frameinfo.nWidth, M.frameinfo.nCodedHeight || M.frameinfo.nHeight, ne), Ue = Le.w, re = Le.h;
return { format: { width: Ue[0], height: re[0], chroma: ne, chromaWidth: Ue[1], chromaHeight: re[1], cropLeft: 0, cropTop: 0, cropWidth: M.frameinfo.nWidth, cropHeight: M.frameinfo.nHeight, displayWidth: 0, displayHeight: 0, pts: M.frameinfo.pts }, y: { bytes: U.HEAPU8.subarray(M.pData[0], M.pData[0] + M.iStride[0] * re[0]), stride: M.iStride[0], bits: 8 }, u: { bytes: U.HEAPU8.subarray(M.pData[1], M.pData[1] + M.iStride[1] * re[1]), stride: M.iStride[1], bits: 8 }, v: { bytes: U.HEAPU8.subarray(M.pData[2], M.pData[2] + M.iStride[2] * re[1]), stride: M.iStride[2], bits: 8 } };
}, ve.lu = function(U, M) {
var ne = U._malloc(52);
return U.setValue(ne, M.pAuth, "i32"), U.setValue(ne + 4, M.threads, "i32"), U.setValue(ne + 8, M.nal_mode, "i32"), U.setValue(ne + 12, M.pic_out_pos, "i32"), U.setValue(ne + 16, M.bEnableOutputRecToFile, "i32"), U.setValue(ne + 20, M.strRecYuvFileName, "i32"), U.setValue(ne + 24, M.logLevel, "i32"), U.setValue(ne + 28, M.outputPixfmt, "i32"), U.setValue(ne + 32, M.b_use_pthread, "i32"), U.setValue(ne + 36, M.b_alpha_decode, "i32"), U.setValue(ne + 40, M.p_arg, "i32"), U.setValue(ne + 44, M.p_log_func, "i32"), U.setValue(ne + 48, M.b_zerobuffer_contains_ref, "i32"), ne;
}, ve.pu = function(U, M) {
return { nWidth: U.getValue(M, "i32"), nHeight: U.getValue(M + 4, "i32"), nCodedWidth: U.getValue(M + 8, "i32"), nCodedHeight: U.getValue(M + 12, "i32"), nLumaBitDepth: U.getValue(M + 16, "i32"), nChromaBitDepth: U.getValue(M + 20, "i32"), nChromaFormatIdc: U.getValue(M + 24, "i32"), profile: U.getValue(M + 28, "i32"), level: U.getValue(M + 32, "i32"), has_b_frames: U.getValue(M + 36, "i32"), pts: U.getValue(M + 40, "i32"), bIllegalStream: U.getValue(M + 48, "i32"), poc: U.getValue(M + 52, "i32") };
}, ve.fu = function(U, M, ne) {
U.setValue(M, ne.nWidth, "i32"), U.setValue(M + 4, ne.nHeight, "i32"), U.setValue(M + 8, ne.nCodedWidth, "i32"), U.setValue(M + 12, ne.nCodedHeight, "i32"), U.setValue(M + 16, ne.nChromaFormatIdc, "i32"), U.setValue(M + 20, ne.profile, "i32"), U.setValue(M + 24, ne.level, "i32"), U.setValue(M + 28, ne.has_b_frames, "i32"), U.setValue(M + 32, ne.pts, "i64");
}, ve.bu = function(U) {
return U._malloc(80);
}, ve.vu = function(U, M) {
return { bValid: U.getValue(M, "i32"), pData: [U.getValue(M + 4, "i32"), U.getValue(M + 8, "i32"), U.getValue(M + 12, "i32")], iStride: [U.getValue(M + 16, "i16"), U.getValue(M + 18, "i16"), U.getValue(M + 20, "i16")], frameinfo: this.pu(U, M + 24) };
}, ve.uu = function() {
this.eu && (this.nu = { KS265DecoderCreate: this.eu.cwrap("KS265DecoderCreate", "number", ["number"]), KS265DecoderDestroy: this.eu.cwrap("KS265DecoderDestroy", "number", ["number"]), KS265DecoderSetDecConfig: this.eu.cwrap("KS265DecoderSetDecConfig", "number", ["number", "number"]), KS265DecodeFrameHeader: this.eu.cwrap("KS265DecodeFrameHeader", "number", ["number", "array", "number"]), KS265DecodeFrame: this.eu.cwrap("KS265DecodeFrame", "number", ["number", "array", "number", "number"]), KS265DecodeFlush: this.eu.cwrap("KS265DecodeFlush", "number", ["number", "number"]), KS265DecoderGetDecodedFrame: this.eu.cwrap("KS265DecoderGetDecodedFrame", "number", ["number", "number"]), KS265DecoderReturnDecodedFrame: this.eu.cwrap("KS265DecoderReturnDecodedFrame", "number", ["number", "number"]), KS265DumpVUIParameters: this.eu.cwrap("KS265DumpVUIParameters", "number", ["number", "number", "number"]), module: this.eu });
}, m;
}(), $ = be, ye = n(12), Be = n(36), Ve = [0, 0, 0, 1], je = "kvc30-wrapper", we = function() {
function m(U, M) {
this.Ai = void 0, this.Ci = void 0, this.eu = void 0, this.mu = void 0, this.Do = 0, this.su = !1, this.ru = 0, this.hu = !1, this.di = { threads: 1, needOutput: 1 }, this.ou = 0, this.gu = 0, this.au = 0, this.yu = 0, this._u = [], this.Cu = void 0, this.Iu = { ysize: 0, usize: 0, vsize: 0, y: 0, u: 0, v: 0, buf: 0, pBufs: 0 }, this.Ou = void 0, U.i(je, "constructor"), this.Ai = M, this.Ci = U;
}
var ve = m.prototype;
return ve.init = function(U, M, ne) {
var Le = this;
if (this.Ci.i(je, "init simd: " + M + " threads: " + ne), !U.wasm.data)
return Promise.reject("kvc wasm is null");
var Ue = U.js.data, re = U.jsw ? U.jsw.data : "", k = new Function(Ue + " return KVC30;")(), P = re ? new Blob([Ue], { type: "text/javascript" }) : "", Z = new Blob([re], { type: "text/javascript" });
return k({ wasmBinary: U.wasm.data, mainScriptUrlOrBlob: P, locateFile: function(he) {
return he.indexOf(".worker.js") !== -1 ? URL.createObjectURL(Z) : "";
} }).then(function(he) {
Le.eu = he, Le.wu(), ne > 1 ? (Le.di.threads = 1, Le.di.threads = ne) : Le.di.threads = 0, Le.cu();
});
}, ve.pushNalus = function(U, M, ne) {
if (ne === void 0 && (ne = !1), this.eu) {
this.eu.setValue(this.au, 0, "i32"), this.ru++;
var Le = U.reduce(function(k, P) {
return k + P.data.byteLength;
}, 0) + Ve.length * U.length, Ue = new Uint8Array(Le), re = 0;
U.forEach(function(k) {
Ue.set(Ve, re), Ue.set(k.data, re + Ve.length), re += Ve.length + k.data.byteLength;
}), this.Eu(this.eu, Ue, M), this.ju(), this.hu = ne;
}
}, ve.getPendingNALNumber = function() {
return this.ru;
}, ve.endOfFrame = function() {
}, ve.nextFrame = function() {
this.su = !0;
}, ve.free = function() {
var U;
(U = this.mu) == null || U.KVCDecoderDestroy(this.Do), this.eu && (this.Do && this.eu._free(this.Do), this.Do = 0, this.ou && this.eu._free(this.ou), this.gu && this.eu._free(this.gu), this.au && this.eu._free(this.au), this.yu && this.eu._free(this.yu), this.ku(), this.ou = this.au = 0, this.Mu());
}, ve.rebuild = function() {
this.Ci.i(je, "rebuild"), this.ru = 0, this.su = !1, this.hu = !1, this.Iu.ysize = 0, this.Iu.usize = 0, this.Iu.vsize = 0, this.Ci.i(je, "rebuild"), this.free(), this.cu();
}, ve.flush = function() {
this.Ci.i(je, "flush"), this.eu && (this.eu.setValue(this.gu, 0, "i64"), this.eu.setValue(this.gu + 8, 0, "i32"), this.eu.setValue(this.gu + 12, 0, "i32"));
var U = !1;
do
U = this.ju();
while (U);
this.ru = 0, this.su = !1;
}, ve.reset = function() {
}, ve.isWaitingData = function() {
return this.su;
}, ve.cu = function() {
this.eu && this.mu && (this.Ci.i(je, "new decoder."), this.ou = this.Su(this.eu, this.di), this.gu = this.eu._malloc(16), this.au = this.eu._malloc(112), this.yu = this.eu._malloc(72), this.Do = this.mu.KVCDecoderCreate(this.ou));
}, ve.du = function(U, M) {
return { format: { width: M.width[0], height: M.height[0], chroma: 1, chromaWidth: M.width[1], chromaHeight: M.height[1], cropLeft: 0, cropTop: 0, cropWidth: M.width[0], cropHeight: M.height[0], displayWidth: 0, displayHeight: 0, pts: M.pts, colorInfo: this.Bu() }, y: { bytes: U.HEAPU8.subarray(M.bufs[0], M.bufs[0] + M.stride[0] * M.height[0] * M.bytesPerPixel), stride: M.stride[0], bits: M.bitDepth }, u: { bytes: U.HEAPU8.subarray(M.bufs[1], M.bufs[1] + M.stride[1] * M.height[1] * M.bytesPerPixel), stride: M.stride[1], bits: M.bitDepth }, v: { bytes: U.HEAPU8.subarray(M.bufs[2], M.bufs[2] + M.stride[2] * M.height[2] * M.bytesPerPixel), stride: M.stride[2], bits: M.bitDepth } };
}, ve.Su = function(U, M) {
var ne = U._malloc(68);
return U.setValue(ne, 0, "i32"), U.setValue(ne + 4, 0, "i32"), U.setValue(ne + 8, 0, "i32"), U.setValue(ne + 12, 0, "i32"), U.setValue(ne + 16, 0, "i32"), U.setValue(ne + 20, 0, "i32"), U.setValue(ne + 24, 0, "i32"), U.setValue(ne + 28, 0, "i32"), U.setValue(ne + 32, 0, "i32"), U.setValue(ne + 36, M.threads, "i32"), U.setValue(ne + 40, M.needOutput, "i32"), U.setValue(ne + 44, 0, "i32"), U.setValue(ne + 48, 0, "i32"), U.setValue(ne + 52, 0, "i32"), U.setValue(ne + 56, 0, "i32"), U.setValue(ne + 60, 0, "i32"), U.setValue(ne + 64, 0, "i32"), ne;
}, ve.Eu = function(U, M, ne) {
var Le = U._malloc(M.byteLength);
U.HEAPU8.set(M, Le), U.setValue(this.gu, Math.round(ne), "i64"), U.setValue(this.gu + 8, Le, "i32"), U.setValue(this.gu + 12, M.byteLength, "i32"), this._u.push(Le), this.Mu(16);
}, ve.Mu = function(U) {
if (U === void 0 && (U = 0), this.eu)
for (; this._u.length > U; ) {
var M = this._u.shift();
M && this.eu._free(M);
}
}, ve.Tu = function(U, M) {
return { pts: U.getValue(M, "i64"), bufs: [U.getValue(M + 8, "i32"), U.getValue(M + 12, "i32"), U.getValue(M + 16, "i32"), U.getValue(M + 20, "i32")], p_output_frame: U.getValue(M + 24, "i32"), p_buffer_ref: U.getValue(M + 28, "i32"), width: [U.getValue(M + 32, "i32"), U.getValue(M + 36, "i32"), U.getValue(M + 40, "i32"), U.getValue(M + 44, "i32")], height: [U.getValue(M + 48, "i32"), U.getValue(M + 52, "i32"), U.getValue(M + 56, "i32"), U.getValue(M + 60, "i32")], stride: [U.getValue(M + 64, "i32"), U.getValue(M + 68, "i32"), U.getValue(M + 72, "i32"), U.getValue(M + 76, "i32")], bytesPerPixel: U.getValue(M + 80, "i32"), colorFormat: U.getValue(M + 84, "i32"), bitDepth: U.getValue(M + 88, "i32"), planes: U.getValue(M + 92, "i32"), hasOutput: U.getValue(M + 96, "i32"), isKeyFrame: U.getValue(M + 100, "i32"), isPostProcess: U.getValue(M + 104, "i32"), pixFmt: U.getValue(M + 108, "i32") };
}, ve.Du = function(U, M) {
return { chromaFormat: U.getValue(M, "i32"), codedWidth: U.getValue(M + 4, "i32"), codedHeight: U.getValue(M + 8, "i32"), width: U.getValue(M + 12, "i32"), height: U.getValue(M + 16, "i32"), hasBFrames: U.getValue(M + 20, "i32"), profile: U.getValue(M + 24, "i32"), level: U.getValue(M + 28, "i32"), bitdepth: U.getValue(M + 32, "i32"), b_vui_valid: U.getValue(M + 36, "i32"), aspect_ratio_info_present_flag: U.getValue(M + 40, "i32"), video_full_range_flag: U.getValue(M + 44, "i32"), sar_width: U.getValue(M + 48, "i32"), sar_height: U.getValue(M + 52, "i32"), colour_description_present_flag: U.getValue(M + 56, "i32"), colour_primaries: U.getValue(M + 60, "i32"), transfer_characteristics: U.getValue(M + 64, "i32"), matrix_coeffs: U.getValue(M + 68, "i32") };
}, ve.ju = function() {
if (!this.eu || !this.mu)
return !1;
if (!this.mu.KVCDecodeFrame(this.Do, this.gu, this.au)) {
var U = this.Tu(this.eu, this.au);
if (U.hasOutput)
return this.Cu || this.Ru(), this.mu.KVCDecoderPostProcess && this.Lu(this.eu, U), this.Ai.emit(j.a.DECODER_FRAME, { frame: this.du(this.eu, U), startTime: performance.now() }), this.mu.KVCDecodeUnrefFrame(this.Do, this.au), this.su = !1, this.ru--, !0;
}
return !1;
}, ve.Lu = function(U, M) {
var ne;
if ((ne = this.mu) != null && ne.KVCDecoderPostProcess) {
var Le = this.Iu, Ue = M.stride[0] * M.height[0] * M.bytesPerPixel, re = M.stride[1] * M.height[1] * M.bytesPerPixel, k = M.stride[2] * M.height[2] * M.bytesPerPixel;
Ue === Le.ysize && re === Le.usize && k === Le.vsize || this.Nu(U, M);
var P = this.mu.KVCDecoderPostProcess(this.Do, this.au, Le.pBufs, this.au + 64);
P ? this.Ci.i(je, "post process fail: " + P) : M.bufs = [Le.y, Le.u, Le.v];
}
}, ve.ku = function() {
this.Ci.i(je, "free post process yuv.");
var U = this.Iu;
this.eu && (U.buf && this.eu._free(U.buf), U.pBufs && this.eu._free(U.pBufs)), U.y = U.u = U.v = U.buf = U.pBufs = 0;
}, ve.Nu = function(U, M) {
this.Ci.i(je, "malloc post process yuv."), this.ku();
var ne = this.Iu;
ne.ysize = M.stride[0] * M.height[0] * M.bytesPerPixel, ne.usize = M.stride[1] * M.height[1] * M.bytesPerPixel, ne.vsize = M.stride[2] * M.height[2] * M.bytesPerPixel;
var Le = ne.ysize + ne.usize + ne.vsize;
ne.buf = U._malloc(Le), ne.y = ne.buf, ne.u = ne.y + ne.ysize, ne.v = ne.u + ne.usize, ne.pBufs = U._malloc(16), U.setValue(ne.pBufs, ne.y, "i32"), U.setValue(ne.pBufs + 4, ne.u, "i32"), U.setValue(ne.pBufs + 8, ne.v, "i32");
}, ve.Ru = function() {
this.eu && this.mu && (this.mu.KVCExportParams(this.Do, this.yu), this.Cu = this.Du(this.eu, this.yu), this.Ci.i(je, "video info", this.Cu), this.Cu && this.Ai.emit(j.a.DECODER_MEDIA_INFO, { width: this.Cu.width, height: this.Cu.height, codedWidth: this.Cu.codedWidth, codedHeight: this.Cu.codedHeight, sar: { width: this.Cu.sar_width, height: this.Cu.sar_width }, profile: Object(Be.c)(this.Cu.profile), level: Object(Be.b)(this.Cu.level), chromaFormat: Object(Be.a)(this.Cu.chromaFormat), bitDepth: this.Cu.bitdepth, colorInfo: this.Bu() }));
}, ve.Bu = function() {
var U = this.Cu;
return U && U.colour_description_present_flag ? (this.Ou = !0, { colorRange: U.video_full_range_flag ? ye.b.AVCOL_RANGE_JPEG : ye.b.AVCOL_RANGE_MPEG, colourPrimaries: U.colour_primaries, transferCharacteristics: U.transfer_characteristics, matrixCoefficients: U.matrix_coeffs }) : (this.Ou !== !1 && this.Ci.i(je, "no colour_description_present_flag"), this.Ou = !1, { colorRange: ye.b.AVCOL_RANGE_UNSPECIFIED, colourPrimaries: ye.a.AVCOL_PRI_UNSPECIFIED, transferCharacteristics: ye.d.AVCOL_TRC_UNSPECIFIED, matrixCoefficients: ye.c.AVCOL_SPC_UNSPECIFIED });
}, ve.wu = function() {
this.eu && (this.mu = { KVCDecoderCreate: this.eu.cwrap("kvc30dec_create", "number", ["number"]), KVCDecoderDestroy: this.eu.cwrap("kvc30dec_destroy", "number", ["number"]), KVCDecodeFrame: this.eu.cwrap("kvc30dec_decode", "number", ["number", "number", "number"]), KVCDecodeUnrefFrame: this.eu.cwrap("kvc30dec_unref_frame", "number", ["number", "number"]), KVCExportParams: this.eu.cwrap("kvc30dec_export_params", "number", ["number", "number"]), KVCGetVersion: this.eu.cwrap("kvc30dec_get_version", "number", []), module: this.eu }, this.eu._kvc30dec_post_process && (this.Ci.i(je, "post process func detected."), this.mu.KVCDecoderPostProcess = this.eu.cwrap("kvc30dec_post_process", "number", ["number", "number", "number", "number"])));
}, m;
}(), ue = we, L = function(m) {
return m[m.KVC_PIXFMT_YUV_420P = 0] = "KVC_PIXFMT_YUV_420P", m[m.KVC_PIXFMT_YUV_420SP = 1] = "KVC_PIXFMT_YUV_420SP", m[m.KVC_PIXFMT_YUV_420SP_VU = 2] = "KVC_PIXFMT_YUV_420SP_VU", m;
}(L || {}), w = { width: 720, height: 1280, codedWidth: 720, codedHeight: 1280, chromaFormat: 0, profile: 1, level: 150, hasBFrames: 1, pts: 0 }, le = [0, 0, 0, 1], oe = "kvc-wrapper", Re = function() {
function m(U, M, ne) {
ne === void 0 && (ne = o.c.kvc4), this.Ai = void 0, this.Ci = void 0, this.eu = void 0, this.mu = void 0, this.Do = 0, this.su = !1, this.ru = 0, this.hu = !1, this.Qu = o.c.unknown, this.xu = !1, this.Iu = { ysize: 0, usize: 0, vsize: 0, y: 0, u: 0, v: 0 }, this.di = { threads: 1, queueDecode: 0, picOutPos: 0, outputPixfmt: L.KVC_PIXFMT_YUV_420P, b_use_pthread: 0 }, this.ou = 0, this.au = 0, U.i(oe, "constructor"), this.Ci = U, this.Ai = M, this.Qu = ne;
}
var ve = m.prototype;
return ve.init = function(U, M, ne) {
var Le = this;
if (this.Ci.i(oe, "init simd: " + M + " threads: " + ne), !U.wasm.data)
return Promise.reject("kvc wasm is null");
var Ue = U.js.data, re = U.jsw ? U.jsw.data : "", k = new Function(Ue + " return KVCDecoder;")(), P = re ? new Blob([Ue], { type: "text/javascript" }) : "", Z = new Blob([re], { type: "text/javascript" });
return k({ wasmBinary: U.wasm.data, mainScriptUrlOrBlob: P, locateFile: function(he) {
return he.indexOf(".worker.js") !== -1 ? URL.createObjectURL(Z) : "";
} }).then(function(he) {
var Ie;
Le.eu = he, Le.wu(), Le.xu = Le.Qu === o.c.kvc5 || Le.Qu === o.c.kvc6, Le.Qu === o.c.kvc6 && (Ie = Le.mu) != null && Ie.KVCDecoderPostProcess && Le.Ci.i(oe, "kvc6 post process on."), ne > 1 && (Le.di.b_use_pthread = 1, Le.di.threads = ne), Le.di.queueDecode = 0, Le.cu();
});
}, ve.pushNalus = function(U, M, ne) {
if (ne === void 0 && (ne = !1), this.eu && this.mu) {
this.Vu(this.eu, this.au + 24, w), this.eu.setValue(this.au, 0, "i32"), this.ru++;
var Le = U.reduce(function(P, Z) {
return P + Z.data.byteLength;
}, 0) + le.length * U.length, Ue = new Uint8Array(Le), re = 0;
U.forEach(function(P) {
Ue.set(le, re), Ue.set(P.data, re + le.length), re += le.length + P.data.byteLength;
});
var k = performance.now();
this.mu.KVCDecodeFrame(this.Do, Ue, Le, Math.round(M) || 0), this.Au(k), this.hu = ne;
}
}, ve.getPendingNALNumber = function() {
return this.ru;
}, ve.endOfFrame = function() {
}, ve.nextFrame = function() {
this.ru && this.Au(), this.su = !0;
}, ve.free = function() {
var U;
(U = this.mu) == null || U.KVCDecoderDestroy(this.Do), this.Do = 0, this.eu && (this.ou && this.eu._free(this.ou), this.au && this.eu._free(this.au)), this.ku(), this.ou = this.au = 0;
}, ve.rebuild = function() {
this.Ci.i(oe, "rebuild"), this.ru = 0, this.su = !1, this.hu = !1, this.Iu.ysize = 0, this.Iu.usize = 0, this.Iu.vsize = 0, this.free(), this.cu();
}, ve.flush = function() {
}, ve.reset = function() {
}, ve.isWaitingData = function() {
return this.su;
}, ve.Au = function(U) {
if (this.eu && this.mu && (U = U || performance.now(), this.hu && this.mu.KVCDecodeFlush(this.Do, 0), !(this.mu.KVCDecoderGetDecodedFrame(this.Do, this.au) < 0))) {
var M = this.Tu(this.eu, this.au);
M.valid && (this.Qu === o.c.kvc6 && this.mu.KVCDecoderPostProcess && this.Lu(this.eu, M), this.Ai.emit(j.a.DECODER_FRAME, { frame: this.du(this.eu, M), startTime: U }), this.hu || this.mu.KVCDecoderReturnDecodedFrame(this.Do, this.au), this.su = !1, this.ru--);
}
}, ve.Lu = function(U, M) {
var ne;
(ne = this.mu) != null && ne.KVCDecoderPostProcess && (M.ysize === this.Iu.ysize && M.usize === this.Iu.usize && M.vsize === this.Iu.vsize || this.Nu(U, M), U.HEAPU8.set(U.HEAPU8.subarray(M.data[0], M.data[0] + M.ysize), this.Iu.y), U.HEAPU8.set(U.HEAPU8.subarray(M.data[1], M.data[1] + M.usize), this.Iu.u), U.HEAPU8.set(U.HEAPU8.subarray(M.data[2], M.data[2] + M.vsize), this.Iu.v), M.data = [this.Iu.y, this.Iu.u, this.Iu.v], U.setValue(this.au + 8, M.data[0], "i32"), U.setValue(this.au + 12, M.data[1], "i32"), U.setValue(this.au + 16, M.data[2], "i32"), this.mu.KVCDecoderPostProcess(this.Do, this.au));
}, ve.ku = function() {
this.Ci.i(oe, "free post process yuv."), this.eu && (this.Iu.y && this.eu._free(this.Iu.y), this.Iu.u && this.eu._free(this.Iu.u), this.Iu.v && this.eu._free(this.Iu.v)), this.Iu.y = this.Iu.u = this.Iu.v = 0;
}, ve.Nu = function(U, M) {
this.Ci.i(oe, "malloc post process yuv."), this.ku(), this.Iu.y = U._malloc(M.ysize), this.Iu.u = U._malloc(M.usize), this.Iu.v = U._malloc(M.vsize), this.Iu.ysize = M.ysize, this.Iu.usize = M.usize, this.Iu.vsize = M.vsize;
}, ve.cu = function() {
this.eu && this.mu && (this.ou = this.Su(this.eu, this.di), this.au = this.Uu(this.eu), this.Do = this.mu.KVCDecoderCreate(this.ou), this.mu.KVCDecodeFlush(this.Do, 1));
}, ve.du = function(U, M) {
var ne = O.a.AV_PIX_FMT_YUV420P, Le = Object(O.b)(M.info.codedWidth || M.info.width, M.info.codedHeight || M.info.height, ne), Ue = Le.w, re = Le.h;
return { format: { width: Ue[0], height: re[0], chroma: ne, chromaWidth: Ue[1], chromaHeight: re[1], cropLeft: 0, cropTop: 0, cropWidth: Ue[0], cropHeight: re[0], displayWidth: 0, displayHeight: 0, pts: M.info.pts }, y: { bytes: U.HEAPU8.subarray(M.data[0], M.data[0] + M.ysize), stride: M.stride[0], bits: 8 }, u: { bytes: U.HEAPU8.subarray(M.data[1], M.data[1] + M.usize), stride: M.stride[1], bits: 8 }, v: { bytes: U.HEAPU8.subarray(M.data[2], M.data[2] + M.vsize), stride: M.stride[2], bits: 8 } };
}, ve.Su = function(U, M) {
var ne = U._malloc(20);
return U.setValue(ne, M.threads, "i32"), U.setValue(ne + 4, M.queueDecode, "i32"), U.setValue(ne + 8, M.picOutPos, "i32"), U.setValue(ne + 12, M.outputPixfmt, "i32"), U.setValue(ne + 16, M.b_use_pthread, "i32"), ne;
}, ve.Fu = function(U) {
return U._malloc(40);
}, ve.Pu = function(U, M) {
return { width: U.getValue(M, "i32"), height: U.getValue(M + 4, "i32"), codedWidth: U.getValue(M + 8, "i32"), codedHeight: U.getValue(M + 12, "i32"), chromaFormat: U.getValue(M + 16, "i32"), profile: U.getValue(M + 20, "i32"), level: U.getValue(M + 24, "i32"), hasBFrames: U.getValue(M + 28, "i32"), pts: U.getValue(M + 32, "i64") };
}, ve.Vu = function(U, M, ne) {
U.setValue(M, ne.width, "i32"), U.setValue(M + 4, ne.height, "i32"), U.setValue(M + 8, ne.codedWidth, "i32"), U.setValue(M + 12, ne.codedHeight, "i32"), U.setValue(M + 16, ne.chromaFormat, "i32"), U.setValue(M + 20, ne.profile, "i32"), U.setValue(M + 24, ne.level, "i32"), U.setValue(M + 28, ne.hasBFrames, "i32"), U.setValue(M + 32, ne.pts, "i64");
}, ve.Uu = function(U) {
return U._malloc(this.xu ? 65536 : 64);
}, ve.Tu = function(U, M) {
var ne, Le = U.getValue(M, "i32"), Ue = 4, re = 0;
this.xu ? (re = U.getValue(M + Ue, "i32"), Ue += 4, ne = this.Pu(U, M + 32)) : ne = this.Pu(U, M + 24);
var k = [U.getValue(M + Ue, "i32"), U.getValue(M + Ue + 4, "i32"), U.getValue(M + Ue + 8, "i32")];
Ue += 12;
var P = [U.getValue(M + Ue, "i16"), U.getValue(M + Ue + 2, "i16"), U.getValue(M + Ue + 4, "i16")];
return Ue += 6, { valid: Le, poc: re, data: k, stride: P, info: ne, ysize: P[0] * ne.height, usize: P[1] * ne.height / 2, vsize: P[2] * ne.height / 2 };
}, ve.wu = function() {
this.eu && (this.mu = { KVCDecoderCreate: this.eu.cwrap("KVCDecoderCreate", "number", ["number"]), KVCDecoderDestroy: this.eu.cwrap("KVCDecoderDestroy", "number", ["number"]), KVCDecoderSetDecConfig: this.eu.cwrap("KVCDecoderSetDecConfig", "number", ["number", "number"]), KVCDecodeFrameHeader: this.eu.cwrap("KVCDecodeFrameHeader", "number", ["number", "array", "number"]), KVCDecodeFrame: this.eu.cwrap("KVCDecodeFrame", "number", ["number", "array", "number", "number"]), KVCDecodeFlush: this.eu.cwrap("KVCDecodeFlush", "number", ["number", "number"]), KVCDecoderGetDecodedFrame: this.eu.cwrap("KVCDecoderGetDecodedFrame", "number", ["number", "number"]), KVCDecoderReturnDecodedFrame: this.eu.cwrap("KVCDecoderReturnDecodedFrame", "number", ["number", "number"]), KVCDecoderGetVersion: this.eu.cwrap("KVCDecoderGetVersion", "number", []), KVC19DumpVUIParameters: this.eu.cwrap("KVCDumpVUIParameters", "number", ["number", "number", "number"]), module: this.eu }, this.eu.Hu && (this.Ci.i(oe, "post process func detected."), this.mu.KVCDecoderPostProcess = this.eu.cwrap("KVCDecoderPostProcess", "number", ["number", "number"])));
}, m;
}(), Oe = Re, de = s.b / s.d, X = [g.a.HEVC_NAL_TRAIL_N, g.a.HEVC_NAL_TSA_N, g.a.HEVC_NAL_STSA_N, g.a.HEVC_NAL_RADL_N, g.a.HEVC_NAL_RASL_N], ge = [g.a.HEVC_NAL_IDR_W_RADL, g.a.HEVC_NAL_IDR_N_LP, g.a.HEVC_NAL_CRA_NUT], Pe = [y.a.VVC_NAL_UNIT_CODED_SLICE_IDR_W_RADL, y.a.VVC_NAL_UNIT_CODED_SLICE_IDR_N_LP, y.a.VVC_NAL_UNIT_CODED_SLICE_CRA, y.a.VVC_NAL_UNIT_CODED_SLICE_GDR], ae = "video-dec-inline", q = function() {
function m(U, M) {
var ne = this;
this.Ci = void 0, this.Yu = void 0, this.Ai = void 0, this.Ba = -1, this.Gu = 0, this.La = 16, this.Ku = 0, this.Le = 0, this.Ah = 33, this.Zu = 0, this.Wu = 0, this.Ra = void 0, this.Sa = void 0, this.Xu = !1, this.vt = o.s.canvas, this.zu = { id: -1, time: -1 }, this.Ju = 1, this.qu = o.r.AUTO, this.Xa = -1, this.Da = !1, this.$u = 0, this.tc = !1, this.ec = 16, this.nc = void 0, this.sc = [], this.rc = [], this.hc = void 0, this.oc = function(Le) {
ne.Ci.i(ae, "seek[" + ne.zu.id + "]: on seeked. hit cache:" + Le), ne.Ai.emit(j.a.DECODER_SEEK, { hitCache: Le, id: ne.zu.id }), Le && (ne.zu.id = -1);
}, this.ac = function(Le) {
for (ne.Ku = Le.frame.format.pts; ne.rc.length && Le.frame.format.pts + 1 >= ne.rc[0].pts; )
ne.rc.shift();
if (Le.startTime) {
var Ue, re = performance.now() - Le.startTime;
ne.Ku += re, ne.Wu++;
var k = Le.frame;
k.format.sar = (Ue = ne.Sa) == null ? void 0 : Ue.sar;
try {
ne.uc(k);
} catch (Z) {
return void ne.Ai.emit(j.a.ERROR, Object(p.e)(p.b.DECODER_ERROR, p.a.DECODER_COPY_YUV_ERROR, "copy yuv error. " + (Z == null ? void 0 : Z.message)));
}
ne.Ai.emit(j.a.DECODER_IMG, { droped: ne.Zu, decoded: ne.Wu, decId: ne.Ju, frame: k });
var P = ne.zu.time;
ne.Da && (P = ne.Xa >= 0 ? Math.min(ne.Xa, P) : P), ne.zu.id >= 0 && Le.frame.format.pts + 1 >= P && (ne.Ci.i(ae, "seek[" + ne.zu.id + "]: on frame seeked. time: " + ne.zu.time + ". frmae pts: " + k.format.pts), ne.oc(!0));
}
}, this.fc = function(Le) {
return Le.units.reduce(function(Ue, re) {
return X.indexOf(re.type) !== -1 && Ue;
}, !0);
}, this.Ac = function(Le) {
return Le.units.reduce(function(Ue, re) {
return ne.vc(re.type, re.temporalId) && Ue;
}, !0);
}, this.vc = function(Le, Ue) {
return Le != 255 && !!Ue;
}, this.Ai = M, this.Ci = U, this.Ai.on(j.a.DECODER_FRAME, this.ac), this.hc = this.fc, this.nc = new T(U, M);
}
var ve = m.prototype;
return ve.init = function(U, M, ne, Le, Ue, re, k) {
var P = this;
this.Ci.i(ae, "init. " + k), this.Ju = U, this.qu = ne.videoDropFramePolicy, this.nc.updateIdrFrame(ge), k === o.t.kw265 ? this.Yu = new $(this.Ci, this.Ai) : re === o.c.kvc3 || re === o.c.kvc4 || re === o.c.kvc5 || re === o.c.kvc6 ? this.Yu = new Oe(this.Ci, this.Ai, re) : re === o.c.bvc2 || re === o.c.vvc || re === o.c.kvc30 ? (this.nc.updateIdrFrame(Pe), this.hc = this.Ac, this.Yu = new ue(this.Ci, this.Ai)) : this.Yu = new W.a(this.Ci, this.Ai);
try {
this.Yu.init(M, Le, Ue).then(function() {
P.Yu && (P.tc = !0, P.Yu.nextFrame(), P.xa(), P.Ai.emit(j.a.DEC_INIT_COMPLETE, { simd: Le, threads: Ue, decoderType: k }));
}).catch(function(Z) {
P.Ai.emit(j.a.ERROR, Object(p.e)(p.b.DECODER_ERROR, p.a.DECODER_INIT_ERROR, typeof Z != "string" ? "" + Z : Z));
});
} catch (Z) {
this.Ai.emit(j.a.ERROR, Object(p.e)(p.b.DECODER_ERROR, p.a.DECODER_INIT_ERROR, (Z == null ? void 0 : Z.message) || ""));
}
}, ve.appendData = function(U) {
this.Da && this.Ci.i(ae, "end of data false on append"), this.Da = !1;
var M = this.nc;
M.appendData(U), !this.Xu && M.frameDuration && (this.Ah = M.frameDuration);
}, ve.endOfData = function() {
this.Ci.i(ae, "end of data"), this.Da = !0;
}, ve.updateState = function(U, M, ne, Le, Ue, re) {
this.vt = M, this.tc = ne, this.Gu = Le, this.La = re, M !== o.s.video && (this.Ba = U);
}, ve.updateMediaInfo = function(U) {
this.Ci.i(ae, "update media info", U), this.Sa = U, this.dc();
}, ve.destroy = function() {
this.Ai.off(j.a.DECODER_FRAME, this.ac), this.tc = !1, this.Ya();
}, ve.reset = function(U, M) {
M === void 0 && (M = !1), this.Ci.i(ae, "reset", U), this.lc(), this.Ju = U, this.Xa = -1, this.Ku = 0, this.Le = 0, this.Ba = -1, this.Gu = 0, this.Da = !1, this.$u = 0, this.tc = !0, this.dc(), this.nc.clean(), M || (this.zu.id = -1, this.zu.time = 0), this.sc = [];
}, ve.seek = function(U, M) {
U = Math.max(0, U), this.zu.id > 0 && this.Ci.i(ae, "seek[" + M + "]: decoder seek abort [" + this.zu.id + "] " + this.zu.time), this.Ci.i(ae, "seek[" + M + "]: decoder seek. time: " + U, U, this.Ba);
var ne = this.nc, Le = this.rc;
if (this.Ba = this.zu.time = U, this.zu.id = M, Le.length) {
var Ue = Le[0].pts || 0, re = this.rc.reduce(function(Ee, pe) {
return Math.max(pe.pts, Ee);
}, Le[Le.length - 1].pts);
if (this.rc.length <= 16 && re > 0 && U >= Ue && U <= re)
return void this.Ci.i(ae, "seek[" + M + "]: decoder seek hit dec cache. cache st: " + Ue + " ed: " + re);
}
if (ne.hit(U)) {
var k = ne.getItemIdxByDts(U), P = ne.idx, Z = ne.current;
if (ne.getItem(k), this.Ci.i(ae, "seek[" + M + "]: decoder seek. test", Z == null ? void 0 : Z.dts, U), !Z || U - Z.dts > 3e3 || U < Z.dts) {
var he, Ie;
this.Ai.emit(j.a.RENDERER_BUF_EXPIRED), ne.seek(U), k < P ? this.Ci.i(ae, "seek[" + M + "]: decoder seek hit data cache. dec from key dts: " + ((he = ne.current) == null ? void 0 : he.dts) + "/" + U) : this.Ci.i(ae, "seek[" + M + "]: decoder seek hit data cache. switch gop. " + (Z == null ? void 0 : Z.gopId) + " -> " + ((Ie = ne.current) == null ? void 0 : Ie.gopId)), this.bc(), this.lc();
} else
this.Ci.i(ae, "seek[" + M + "]: decoder seek hit data cache. continue decode.");
} else
this.Ci.i(ae, "seek[" + M + "]: decoder seek miss cache."), ne.clean(), this.oc(!1);
}, ve.Fa = function() {
return !(!this.Da || this.nc.remain || !this.Yu || this.Yu.isWaitingData() || this.Yu.getPendingNALNumber());
}, ve.uc = function(U) {
this.mc(U.y, U.format.width, U.format.height), this.mc(U.u, U.format.chromaWidth, U.format.chromaHeight), this.mc(U.v, U.format.chromaWidth, U.format.chromaHeight);
}, ve.mc = function(U, M, ne) {
var Le = U.bits > 8 ? 2 : 1;
if (U.stride / Le > M) {
for (var Ue = new Uint8Array(M * ne * Le), re = 0; re < ne; re++)
Ue.set(U.bytes.subarray(U.stride * re, U.stride * re + M * Le), re * M * Le);
U.stride = M * Le, U.bytes = Ue;
} else
U.bytes = new Uint8Array(U.bytes);
}, ve.gc = function(U) {
if (this.Yu && U) {
for (var M = 0; M < this.sc.length; M++) {
if (this.sc[M] === U.id)
return void this.sc.shift();
this.sc[M] < U.id && this.sc.shift();
}
this.rc.push({ pts: U.pts, dts: U.dts, gopId: U.gopId }), this.rc.sort(function(Le, Ue) {
return Le.pts - Ue.pts;
});
try {
this.Yu.pushNalus(U.data.units, U.pts, this.Da && !this.nc.remain), U.pts > this.$u && (this.$u = U.pts), U.type === C.d.videoFrame && (this.Le = U.dts, this.nc.remain || this.Yu.endOfFrame());
} catch (Le) {
var ne = "push data pts:" + Math.round(U.pts) + " dts:" + Math.round(U.dts) + " to dec error.";
this.Ci.i(ae, ne, Le), this.Ai.emit(j.a.ERROR, Object(p.e)(p.b.DECODER_ERROR, p.a.DECODER_DEC_ERROR, ne, { fatal: !1 }));
}
}
}, ve.lc = function() {
var U;
(U = this.Yu) == null || U.rebuild(), this.rc = [];
}, ve.bc = function() {
this.Ci.i(ae, "reset time"), this.Yu && this.Le && this.Yu.reset(), this.Ku = 0, this.Le = 0, this.$u = 0;
}, ve.yc = function() {
if (this.Yu && this.Ba !== -1 && this.vt !== o.s.video) {
var U = this.nc, M = this.Ba;
if (this.Ku && U.remain && this.tc && this.zu.id < 0) {
var ne = this._c(M), Le = U.getItem(ne);
Le && ne > 5 && this.Cc(M, Le.gopId);
}
M += (this.La + 16) * this.Ah;
var Ue = this.Gu < this.La;
if (this.tc && U.remain && (this.Ku <= M || Ue)) {
for (var re = U.current, k = 0; re && (re.pts <= M || re.dts <= M || !this.Le || Ue) && !(++k > 3); )
this.gc(re), U.next(), re = U.current, Ue = !1;
this.Da && !U.remain ? (this.Yu.flush(), this.Ai.emit(j.a.DECODER_DATA_END)) : U.remain < this.ec && this.Ai.emit(j.a.DECODER_BUF_LOW);
}
this.Yu.isWaitingData() && !this.Yu.getPendingNALNumber() || this.Yu.nextFrame();
}
}, ve._c = function(U) {
for (var M = this.nc, ne = M.idx; ne < M.length; ne++) {
var Le = M.data[ne];
if (Le.type === C.d.videoFrame && Le.dts >= U)
return ne - M.idx;
}
return M.remain ? M.remain : -1;
}, ve.Cc = function(U, M) {
for (var ne = [], Le = this.nc, Ue = Le.idx; Ue < Le.length; ) {
var re = Le.getItem(Ue);
if (re.type === C.d.videoFrame)
if (re.gopId < M)
ne.push(re);
else {
if (re.gopId > M || !(U > re.dts && this.qu !== o.r.MIN))
break;
this.hc(re.data) && ne.push(re);
}
else
re.gopId < M && ne.push(re);
Ue++;
}
this.Ic(ne, M);
}, ve.Ic = function(U, M) {
var ne = !1, Le = !1, Ue = { frames: [] };
if (U.length) {
U.sort(function(k, P) {
return k.pts - P.pts;
});
for (var re = 0; re < U.length; re++)
U[re].discontinuity && (ne = !0), U[re].gopId !== M && (Le = !0), this.sc.push(U[re].id), Ue.frames.push({ pts: U[re].pts });
}
this.Zu += U.length, Le && this.Yu && this.lc(), ne && this.bc(), Ue.frames.length && (this.Ci.i(ae, "drop frame. num: " + Ue.frames.length + " rebuild: " + Le + " pts: " + Ue.frames[0].pts + "~" + Ue.frames[Ue.frames.length - 1].pts), this.Ai.emit(j.a.DECODER_DROP_FRAME, Ue));
}, ve.dc = function() {
var U = this.Sa;
U && U.fps && typeof U.fps == "number" && U.fps > 0 && U.fps < s.n ? (this.Xu = !0, this.Ah = s.b / U.fps, this.ec = Math.max(2 * U.fps, 16)) : this.Ah = de;
}, ve.xa = function() {
var U = this;
this.Ra || (this.Ra = setInterval(function() {
U.yc();
}, 0));
}, ve.Ya = function() {
this.Ra && (clearInterval(this.Ra), this.Ra = void 0);
}, m;
}();
r.a = q;
}, function(e, r) {
e.exports = void 0;
}, function(e, r, n) {
var o, s, p, g, C, y, x, h, F, I, T, D, W, j, O, K, z, B, J, be, $, ye, Be, Ve, je, we, ue, L, w, le, oe, Re, Oe, de, X, ge, Pe, ae, q;
e.exports = (s = o = "3.7.7", p = typeof Buffer == "function", g = typeof TextDecoder == "function" ? new TextDecoder() : void 0, C = typeof TextEncoder == "function" ? new TextEncoder() : void 0, y = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", x = Array.prototype.slice.call(y), q = {}, x.forEach(function(m, ve) {
return q[m] = ve;
}), h = q, F = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/, I = String.fromCharCode.bind(String), T = typeof Uint8Array.from == "function" ? Uint8Array.from.bind(Uint8Array) : function(m) {
return new Uint8Array(Array.prototype.slice.call(m, 0));
}, D = function(m) {
return m.replace(/=/g, "").replace(/[+\/]/g, function(ve) {
return ve == "+" ? "-" : "_";
});
}, W = function(m) {
return m.replace(/[^A-Za-z0-9\+\/]/g, "");
}, j = function(m) {
for (var ve, U, M, ne, Le = "", Ue = m.length % 3, re = 0; re < m.length; ) {
if ((U = m.charCodeAt(re++)) > 255 || (M = m.charCodeAt(re++)) > 255 || (ne = m.charCodeAt(re++)) > 255)
throw new TypeError("invalid character found");
Le += x[(ve = U << 16 | M << 8 | ne) >> 18 & 63] + x[ve >> 12 & 63] + x[ve >> 6 & 63] + x[63 & ve];
}
return Ue ? Le.slice(0, Ue - 3) + "===".substring(Ue) : Le;
}, O = typeof btoa == "function" ? function(m) {
return btoa(m);
} : p ? function(m) {
return Buffer.from(m, "binary").toString("base64");
} : j, K = p ? function(m) {
return Buffer.from(m).toString("base64");
} : function(m) {
for (var ve = 4096, U = [], M = 0, ne = m.length; M < ne; M += ve)
U.push(I.apply(null, m.subarray(M, M + ve)));
return O(U.join(""));
}, z = function(m, ve) {
return ve === void 0 && (ve = !1), ve ? D(K(m)) : K(m);
}, B = function(m) {
if (m.length < 2)
return (ve = m.charCodeAt(0)) < 128 ? m : ve < 2048 ? I(192 | ve >>> 6) + I(128 | 63 & ve) : I(224 | ve >>> 12 & 15) + I(128 | ve >>> 6 & 63) + I(128 | 63 & ve);
var ve = 65536 + 1024 * (m.charCodeAt(0) - 55296) + (m.charCodeAt(1) - 56320);
return I(240 | ve >>> 18 & 7) + I(128 | ve >>> 12 & 63) + I(128 | ve >>> 6 & 63) + I(128 | 63 & ve);
}, J = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g, be = function(m) {
return m.replace(J, B);
}, $ = p ? function(m) {
return Buffer.from(m, "utf8").toString("base64");
} : C ? function(m) {
return K(C.encode(m));
} : function(m) {
return O(be(m));
}, ye = function(m, ve) {
return ve === void 0 && (ve = !1), ve ? D($(m)) : $(m);
}, Be = function(m) {
return ye(m, !0);
}, Ve = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g, je = function(m) {
switch (m.length) {
case 4:
var ve = ((7 & m.charCodeAt(0)) << 18 | (63 & m.charCodeAt(1)) << 12 | (63 & m.charCodeAt(2)) << 6 | 63 & m.charCodeAt(3)) - 65536;
return I(55296 + (ve >>> 10)) + I(56320 + (1023 & ve));
case 3:
return I((15 & m.charCodeAt(0)) << 12 | (63 & m.charCodeAt(1)) << 6 | 63 & m.charCodeAt(2));
default:
return I((31 & m.charCodeAt(0)) << 6 | 63 & m.charCodeAt(1));
}
}, we = function(m) {
return m.replace(Ve, je);
}, ue = function(m) {
if (m = m.replace(/\s+/g, ""), !F.test(m))
throw new TypeError("malformed base64.");
m += "==".slice(2 - (3 & m.length));
for (var ve, U, M, ne = "", Le = 0; Le < m.length; )
ve = h[m.charAt(Le++)] << 18 | h[m.charAt(Le++)] << 12 | (U = h[m.charAt(Le++)]) << 6 | (M = h[m.charAt(Le++)]), ne += U === 64 ? I(ve >> 16 & 255) : M === 64 ? I(ve >> 16 & 255, ve >> 8 & 255) : I(ve >> 16 & 255, ve >> 8 & 255, 255 & ve);
return ne;
}, L = typeof atob == "function" ? function(m) {
return atob(W(m));
} : p ? function(m) {
return Buffer.from(m, "base64").toString("binary");
} : ue, w = p ? function(m) {
return T(Buffer.from(m, "base64"));
} : function(m) {
return T(L(m).split("").map(function(ve) {
return ve.charCodeAt(0);
}));
}, le = function(m) {
return w(Re(m));
}, oe = p ? function(m) {
return Buffer.from(m, "base64").toString("utf8");
} : g ? function(m) {
return g.decode(w(m));
} : function(m) {
return we(L(m));
}, Re = function(m) {
return W(m.replace(/[-_]/g, function(ve) {
return ve == "-" ? "+" : "/";
}));
}, de = function(m) {
return { value: m, enumerable: !1, writable: !0, configurable: !0 };
}, X = function() {
var m = function(ve, U) {
return Object.defineProperty(String.prototype, ve, de(U));
};
m("fromBase64", function() {
return Oe(this);
}), m("toBase64", function(ve) {
return ye(this, ve);
}), m("toBase64URI", function() {
return ye(this, !0);
}), m("toBase64URL", function() {
return ye(this, !0);
}), m("toUint8Array", function() {
return le(this);
});
}, ge = function() {
var m = function(ve, U) {
return Object.defineProperty(Uint8Array.prototype, ve, de(U));
};
m("toBase64", function(ve) {
return z(this, ve);
}), m("toBase64URI", function() {
return z(this, !0);
}), m("toBase64URL", function() {
return z(this, !0);
});
}, Pe = function() {
X(), ge();
}, ae = { version: o, VERSION: s, atob: L, atobPolyfill: ue, btoa: O, btoaPolyfill: j, fromBase64: Oe = function(m) {
return oe(Re(m));
}, toBase64: ye, encode: ye, encodeURI: Be, encodeURL: Be, utob: be, btou: we, decode: Oe, isValid: function(m) {
if (typeof m != "string")
return !1;
var ve = m.replace(/\s+/g, "").replace(/={0,2}$/, "");
return !/[^\s0-9a-zA-Z\+/]/.test(ve) || !/[^\s0-9a-zA-Z\-_]/.test(ve);
}, fromUint8Array: z, toUint8Array: le, extendString: X, extendUint8Array: ge, extendBuiltins: Pe, Base64: {} }, Object.keys(ae).forEach(function(m) {
return ae.Base64[m] = ae[m];
}), ae);
}, function(e, r, n) {
var o = n(53).default, s = n(55);
e.exports = function(p) {
var g = s(p, "string");
return o(g) === "symbol" ? g : String(g);
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r) {
function n(o) {
return e.exports = n = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(s) {
return typeof s;
} : function(s) {
return s && typeof Symbol == "function" && s.constructor === Symbol && s !== Symbol.prototype ? "symbol" : typeof s;
}, e.exports.__esModule = !0, e.exports.default = e.exports, n(o);
}
e.exports = n, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r, n) {
e.exports = function(o) {
var s = {};
function p(g) {
if (s[g])
return s[g].exports;
var C = s[g] = { i: g, l: !1, exports: {} };
return o[g].call(C.exports, C, C.exports, p), C.l = !0, C.exports;
}
return p.m = o, p.c = s, p.d = function(g, C, y) {
p.o(g, C) || Object.defineProperty(g, C, { enumerable: !0, get: y });
}, p.r = function(g) {
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(g, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(g, "__esModule", { value: !0 });
}, p.t = function(g, C) {
if (1 & C && (g = p(g)), 8 & C || 4 & C && typeof g == "object" && g && g.__esModule)
return g;
var y = /* @__PURE__ */ Object.create(null);
if (p.r(y), Object.defineProperty(y, "default", { enumerable: !0, value: g }), 2 & C && typeof g != "string")
for (var x in g)
p.d(y, x, function(h) {
return g[h];
}.bind(null, x));
return y;
}, p.n = function(g) {
var C = g && g.__esModule ? function() {
return g.default;
} : function() {
return g;
};
return p.d(C, "a", C), C;
}, p.o = function(g, C) {
return Object.prototype.hasOwnProperty.call(g, C);
}, p.p = "", p(p.s = 9);
}([function(o, s, p) {
var g = p(8)();
o.exports = g;
try {
regeneratorRuntime = g;
} catch (C) {
typeof globalThis == "object" ? globalThis.regeneratorRuntime = g : Function("r", "regeneratorRuntime = r")(g);
}
}, function(o, s) {
function p(g, C, y, x, h, F, I) {
try {
var T = g[F](I), D = T.value;
} catch (W) {
return void y(W);
}
T.done ? C(D) : Promise.resolve(D).then(x, h);
}
o.exports = function(g) {
return function() {
var C = this, y = arguments;
return new Promise(function(x, h) {
var F = g.apply(C, y);
function I(D) {
p(F, x, h, I, T, "next", D);
}
function T(D) {
p(F, x, h, I, T, "throw", D);
}
I(void 0);
});
};
}, o.exports.__esModule = !0, o.exports.default = o.exports;
}, function(o, s, p) {
var g = p(6);
function C(y, x) {
for (var h = 0; h < x.length; h++) {
var F = x[h];
F.enumerable = F.enumerable || !1, F.configurable = !0, "value" in F && (F.writable = !0), Object.defineProperty(y, g(F.key), F);
}
}
o.exports = function(y, x, h) {
return x && C(y.prototype, x), h && C(y, h), Object.defineProperty(y, "prototype", { writable: !1 }), y;
}, o.exports.__esModule = !0, o.exports.default = o.exports;
}, function(o, s) {
function p(g) {
return o.exports = p = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(C) {
return typeof C;
} : function(C) {
return C && typeof Symbol == "function" && C.constructor === Symbol && C !== Symbol.prototype ? "symbol" : typeof C;
}, o.exports.__esModule = !0, o.exports.default = o.exports, p(g);
}
o.exports = p, o.exports.__esModule = !0, o.exports.default = o.exports;
}, function(o, s, p) {
o.exports = function() {
var g, C = "3.7.7", y = C, x = typeof Buffer == "function", h = typeof TextDecoder == "function" ? new TextDecoder() : void 0, F = typeof TextEncoder == "function" ? new TextEncoder() : void 0, I = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", T = Array.prototype.slice.call(I), D = (g = {}, T.forEach(function(M, ne) {
return g[M] = ne;
}), g), W = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/, j = String.fromCharCode.bind(String), O = typeof Uint8Array.from == "function" ? Uint8Array.from.bind(Uint8Array) : function(M) {
return new Uint8Array(Array.prototype.slice.call(M, 0));
}, K = function(M) {
return M.replace(/=/g, "").replace(/[+\/]/g, function(ne) {
return ne == "+" ? "-" : "_";
});
}, z = function(M) {
return M.replace(/[^A-Za-z0-9\+\/]/g, "");
}, B = function(M) {
for (var ne, Le, Ue, re, k = "", P = M.length % 3, Z = 0; Z < M.length; ) {
if ((Le = M.charCodeAt(Z++)) > 255 || (Ue = M.charCodeAt(Z++)) > 255 || (re = M.charCodeAt(Z++)) > 255)
throw new TypeError("invalid character found");
k += T[(ne = Le << 16 | Ue << 8 | re) >> 18 & 63] + T[ne >> 12 & 63] + T[ne >> 6 & 63] + T[63 & ne];
}
return P ? k.slice(0, P - 3) + "===".substring(P) : k;
}, J = typeof btoa == "function" ? function(M) {
return btoa(M);
} : x ? function(M) {
return Buffer.from(M, "binary").toString("base64");
} : B, be = x ? function(M) {
return Buffer.from(M).toString("base64");
} : function(M) {
for (var ne = 4096, Le = [], Ue = 0, re = M.length; Ue < re; Ue += ne)
Le.push(j.apply(null, M.subarray(Ue, Ue + ne)));
return J(Le.join(""));
}, $ = function(M, ne) {
return ne === void 0 && (ne = !1), ne ? K(be(M)) : be(M);
}, ye = function(M) {
if (M.length < 2)
return (ne = M.charCodeAt(0)) < 128 ? M : ne < 2048 ? j(192 | ne >>> 6) + j(128 | 63 & ne) : j(224 | ne >>> 12 & 15) + j(128 | ne >>> 6 & 63) + j(128 | 63 & ne);
var ne = 65536 + 1024 * (M.charCodeAt(0) - 55296) + (M.charCodeAt(1) - 56320);
return j(240 | ne >>> 18 & 7) + j(128 | ne >>> 12 & 63) + j(128 | ne >>> 6 & 63) + j(128 | 63 & ne);
}, Be = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g, Ve = function(M) {
return M.replace(Be, ye);
}, je = x ? function(M) {
return Buffer.from(M, "utf8").toString("base64");
} : F ? function(M) {
return be(F.encode(M));
} : function(M) {
return J(Ve(M));
}, we = function(M, ne) {
return ne === void 0 && (ne = !1), ne ? K(je(M)) : je(M);
}, ue = function(M) {
return we(M, !0);
}, L = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g, w = function(M) {
switch (M.length) {
case 4:
var ne = ((7 & M.charCodeAt(0)) << 18 | (63 & M.charCodeAt(1)) << 12 | (63 & M.charCodeAt(2)) << 6 | 63 & M.charCodeAt(3)) - 65536;
return j(55296 + (ne >>> 10)) + j(56320 + (1023 & ne));
case 3:
return j((15 & M.charCodeAt(0)) << 12 | (63 & M.charCodeAt(1)) << 6 | 63 & M.charCodeAt(2));
default:
return j((31 & M.charCodeAt(0)) << 6 | 63 & M.charCodeAt(1));
}
}, le = function(M) {
return M.replace(L, w);
}, oe = function(M) {
if (M = M.replace(/\s+/g, ""), !W.test(M))
throw new TypeError("malformed base64.");
M += "==".slice(2 - (3 & M.length));
for (var ne, Le, Ue, re = "", k = 0; k < M.length; )
ne = D[M.charAt(k++)] << 18 | D[M.charAt(k++)] << 12 | (Le = D[M.charAt(k++)]) << 6 | (Ue = D[M.charAt(k++)]), re += Le === 64 ? j(ne >> 16 & 255) : Ue === 64 ? j(ne >> 16 & 255, ne >> 8 & 255) : j(ne >> 16 & 255, ne >> 8 & 255, 255 & ne);
return re;
}, Re = typeof atob == "function" ? function(M) {
return atob(z(M));
} : x ? function(M) {
return Buffer.from(M, "base64").toString("binary");
} : oe, Oe = x ? function(M) {
return O(Buffer.from(M, "base64"));
} : function(M) {
return O(Re(M).split("").map(function(ne) {
return ne.charCodeAt(0);
}));
}, de = function(M) {
return Oe(ge(M));
}, X = x ? function(M) {
return Buffer.from(M, "base64").toString("utf8");
} : h ? function(M) {
return h.decode(Oe(M));
} : function(M) {
return le(Re(M));
}, ge = function(M) {
return z(M.replace(/[-_]/g, function(ne) {
return ne == "-" ? "+" : "/";
}));
}, Pe = function(M) {
return X(ge(M));
}, ae = function(M) {
return { value: M, enumerable: !1, writable: !0, configurable: !0 };
}, q = function() {
var M = function(ne, Le) {
return Object.defineProperty(String.prototype, ne, ae(Le));
};
M("fromBase64", function() {
return Pe(this);
}), M("toBase64", function(ne) {
return we(this, ne);
}), M("toBase64URI", function() {
return we(this, !0);
}), M("toBase64URL", function() {
return we(this, !0);
}), M("toUint8Array", function() {
return de(this);
});
}, m = function() {
var M = function(ne, Le) {
return Object.defineProperty(Uint8Array.prototype, ne, ae(Le));
};
M("toBase64", function(ne) {
return $(this, ne);
}), M("toBase64URI", function() {
return $(this, !0);
}), M("toBase64URL", function() {
return $(this, !0);
});
}, ve = function() {
q(), m();
}, U = { version: C, VERSION: y, atob: Re, atobPolyfill: oe, btoa: J, btoaPolyfill: B, fromBase64: Pe, toBase64: we, encode: we, encodeURI: ue, encodeURL: ue, utob: Ve, btou: le, decode: Pe, isValid: function(M) {
if (typeof M != "string")
return !1;
var ne = M.replace(/\s+/g, "").replace(/={0,2}$/, "");
return !/[^\s0-9a-zA-Z\+/]/.test(ne) || !/[^\s0-9a-zA-Z\-_]/.test(ne);
}, fromUint8Array: $, toUint8Array: de, extendString: q, extendUint8Array: m, extendBuiltins: ve, Base64: {} };
return Object.keys(U).forEach(function(M) {
return U.Base64[M] = U[M];
}), U;
}();
}, function(o, s) {
function p() {
return o.exports = p = Object.assign ? Object.assign.bind() : function(g) {
for (var C = 1; C < arguments.length; C++) {
var y = arguments[C];
for (var x in y)
({}).hasOwnProperty.call(y, x) && (g[x] = y[x]);
}
return g;
}, o.exports.__esModule = !0, o.exports.default = o.exports, p.apply(null, arguments);
}
o.exports = p, o.exports.__esModule = !0, o.exports.default = o.exports;
}, function(o, s, p) {
var g = p(3).default, C = p(7);
o.exports = function(y) {
var x = C(y, "string");
return g(x) == "symbol" ? x : x + "";
}, o.exports.__esModule = !0, o.exports.default = o.exports;
}, function(o, s, p) {
var g = p(3).default;
o.exports = function(C, y) {
if (g(C) != "object" || !C)
return C;
var x = C[Symbol.toPrimitive];
if (x !== void 0) {
var h = x.call(C, y || "default");
if (g(h) != "object")
return h;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (y === "string" ? String : Number)(C);
}, o.exports.__esModule = !0, o.exports.default = o.exports;
}, function(o, s, p) {
var g = p(3).default;
function C() {
o.exports = C = function() {
return x;
}, o.exports.__esModule = !0, o.exports.default = o.exports;
var y, x = {}, h = Object.prototype, F = h.hasOwnProperty, I = Object.defineProperty || function(ae, q, m) {
ae[q] = m.value;
}, T = typeof Symbol == "function" ? Symbol : {}, D = T.iterator || "@@iterator", W = T.asyncIterator || "@@asyncIterator", j = T.toStringTag || "@@toStringTag";
function O(ae, q, m) {
return Object.defineProperty(ae, q, { value: m, enumerable: !0, configurable: !0, writable: !0 }), ae[q];
}
try {
O({}, "");
} catch (ae) {
O = function(q, m, ve) {
return q[m] = ve;
};
}
function K(ae, q, m, ve) {
var U = q && q.prototype instanceof Be ? q : Be, M = Object.create(U.prototype), ne = new ge(ve || []);
return I(M, "_invoke", { value: Re(ae, m, ne) }), M;
}
function z(ae, q, m) {
try {
return { type: "normal", arg: ae.call(q, m) };
} catch (ve) {
return { type: "throw", arg: ve };
}
}
x.wrap = K;
var B = "suspendedStart", J = "suspendedYield", be = "executing", $ = "completed", ye = {};
function Be() {
}
function Ve() {
}
function je() {
}
var we = {};
O(we, D, function() {
return this;
});
var ue = Object.getPrototypeOf, L = ue && ue(ue(Pe([])));
L && L !== h && F.call(L, D) && (we = L);
var w = je.prototype = Be.prototype = Object.create(we);
function le(ae) {
["next", "throw", "return"].forEach(function(q) {
O(ae, q, function(m) {
return this._invoke(q, m);
});
});
}
function oe(ae, q) {
function m(U, M, ne, Le) {
var Ue = z(ae[U], ae, M);
if (Ue.type !== "throw") {
var re = Ue.arg, k = re.value;
return k && g(k) == "object" && F.call(k, "__await") ? q.resolve(k.__await).then(function(P) {
m("next", P, ne, Le);
}, function(P) {
m("throw", P, ne, Le);
}) : q.resolve(k).then(function(P) {
re.value = P, ne(re);
}, function(P) {
return m("throw", P, ne, Le);
});
}
Le(Ue.arg);
}
var ve;
I(this, "_invoke", { value: function(U, M) {
function ne() {
return new q(function(Le, Ue) {
m(U, M, Le, Ue);
});
}
return ve = ve ? ve.then(ne, ne) : ne();
} });
}
function Re(ae, q, m) {
var ve = B;
return function(U, M) {
if (ve === be)
throw Error("Generator is already running");
if (ve === $) {
if (U === "throw")
throw M;
return { value: y, done: !0 };
}
for (m.method = U, m.arg = M; ; ) {
var ne = m.delegate;
if (ne) {
var Le = Oe(ne, m);
if (Le) {
if (Le === ye)
continue;
return Le;
}
}
if (m.method === "next")
m.sent = m.A = m.arg;
else if (m.method === "throw") {
if (ve === B)
throw ve = $, m.arg;
m.dispatchException(m.arg);
} else
m.method === "return" && m.abrupt("return", m.arg);
ve = be;
var Ue = z(ae, q, m);
if (Ue.type === "normal") {
if (ve = m.done ? $ : J, Ue.arg === ye)
continue;
return { value: Ue.arg, done: m.done };
}
Ue.type === "throw" && (ve = $, m.method = "throw", m.arg = Ue.arg);
}
};
}
function Oe(ae, q) {
var m = q.method, ve = ae.iterator[m];
if (ve === y)
return q.delegate = null, m === "throw" && ae.iterator.return && (q.method = "return", q.arg = y, Oe(ae, q), q.method === "throw") || m !== "return" && (q.method = "throw", q.arg = new TypeError("The iterator does not provide a '" + m + "' method")), ye;
var U = z(ve, ae.iterator, q.arg);
if (U.type === "throw")
return q.method = "throw", q.arg = U.arg, q.delegate = null, ye;
var M = U.arg;
return M ? M.done ? (q[ae.resultName] = M.value, q.next = ae.nextLoc, q.method !== "return" && (q.method = "next", q.arg = y), q.delegate = null, ye) : M : (q.method = "throw", q.arg = new TypeError("iterator result is not an object"), q.delegate = null, ye);
}
function de(ae) {
var q = { tryLoc: ae[0] };
1 in ae && (q.catchLoc = ae[1]), 2 in ae && (q.finallyLoc = ae[2], q.afterLoc = ae[3]), this.tryEntries.push(q);
}
function X(ae) {
var q = ae.completion || {};
q.type = "normal", delete q.arg, ae.completion = q;
}
function ge(ae) {
this.tryEntries = [{ tryLoc: "root" }], ae.forEach(de, this), this.reset(!0);
}
function Pe(ae) {
if (ae || ae === "") {
var q = ae[D];
if (q)
return q.call(ae);
if (typeof ae.next == "function")
return ae;
if (!isNaN(ae.length)) {
var m = -1, ve = function U() {
for (; ++m < ae.length; )
if (F.call(ae, m))
return U.value = ae[m], U.done = !1, U;
return U.value = y, U.done = !0, U;
};
return ve.next = ve;
}
}
throw new TypeError(g(ae) + " is not iterable");
}
return Ve.prototype = je, I(w, "constructor", { value: je, configurable: !0 }), I(je, "constructor", { value: Ve, configurable: !0 }), Ve.displayName = O(je, j, "GeneratorFunction"), x.isGeneratorFunction = function(ae) {
var q = typeof ae == "function" && ae.constructor;
return !!q && (q === Ve || (q.displayName || q.name) === "GeneratorFunction");
}, x.mark = function(ae) {
return Object.setPrototypeOf ? Object.setPrototypeOf(ae, je) : (ae.__proto__ = je, O(ae, j, "GeneratorFunction")), ae.prototype = Object.create(w), ae;
}, x.awrap = function(ae) {
return { __await: ae };
}, le(oe.prototype), O(oe.prototype, W, function() {
return this;
}), x.AsyncIterator = oe, x.async = function(ae, q, m, ve, U) {
U === void 0 && (U = Promise);
var M = new oe(K(ae, q, m, ve), U);
return x.isGeneratorFunction(q) ? M : M.next().then(function(ne) {
return ne.done ? ne.value : M.next();
});
}, le(w), O(w, j, "Generator"), O(w, D, function() {
return this;
}), O(w, "toString", function() {
return "[object Generator]";
}), x.keys = function(ae) {
var q = Object(ae), m = [];
for (var ve in q)
m.push(ve);
return m.reverse(), function U() {
for (; m.length; ) {
var M = m.pop();
if (M in q)
return U.value = M, U.done = !1, U;
}
return U.done = !0, U;
};
}, x.values = Pe, ge.prototype = { constructor: ge, reset: function(ae) {
if (this.prev = 0, this.next = 0, this.sent = this.A = y, this.done = !1, this.delegate = null, this.method = "next", this.arg = y, this.tryEntries.forEach(X), !ae)
for (var q in this)
q.charAt(0) === "t" && F.call(this, q) && !isNaN(+q.slice(1)) && (this[q] = y);
}, stop: function() {
this.done = !0;
var ae = this.tryEntries[0].completion;
if (ae.type === "throw")
throw ae.arg;
return this.rval;
}, dispatchException: function(ae) {
if (this.done)
throw ae;
var q = this;
function m(Ue, re) {
return M.type = "throw", M.arg = ae, q.next = Ue, re && (q.method = "next", q.arg = y), !!re;
}
for (var ve = this.tryEntries.length - 1; ve >= 0; --ve) {
var U = this.tryEntries[ve], M = U.completion;
if (U.tryLoc === "root")
return m("end");
if (U.tryLoc <= this.prev) {
var ne = F.call(U, "catchLoc"), Le = F.call(U, "finallyLoc");
if (ne && Le) {
if (this.prev < U.catchLoc)
return m(U.catchLoc, !0);
if (this.prev < U.finallyLoc)
return m(U.finallyLoc);
} else if (ne) {
if (this.prev < U.catchLoc)
return m(U.catchLoc, !0);
} else {
if (!Le)
throw Error("try statement without catch or finally");
if (this.prev < U.finallyLoc)
return m(U.finallyLoc);
}
}
}
}, abrupt: function(ae, q) {
for (var m = this.tryEntries.length - 1; m >= 0; --m) {
var ve = this.tryEntries[m];
if (ve.tryLoc <= this.prev && F.call(ve, "finallyLoc") && this.prev < ve.finallyLoc) {
var U = ve;
break;
}
}
U && (ae === "break" || ae === "continue") && U.tryLoc <= q && q <= U.finallyLoc && (U = null);
var M = U ? U.completion : {};
return M.type = ae, M.arg = q, U ? (this.method = "next", this.next = U.finallyLoc, ye) : this.complete(M);
}, complete: function(ae, q) {
if (ae.type === "throw")
throw ae.arg;
return ae.type === "break" || ae.type === "continue" ? this.next = ae.arg : ae.type === "return" ? (this.rval = this.arg = ae.arg, this.method = "return", this.next = "end") : ae.type === "normal" && q && (this.next = q), ye;
}, finish: function(ae) {
for (var q = this.tryEntries.length - 1; q >= 0; --q) {
var m = this.tryEntries[q];
if (m.finallyLoc === ae)
return this.complete(m.completion, m.afterLoc), X(m), ye;
}
}, catch: function(ae) {
for (var q = this.tryEntries.length - 1; q >= 0; --q) {
var m = this.tryEntries[q];
if (m.tryLoc === ae) {
var ve = m.completion;
if (ve.type === "throw") {
var U = ve.arg;
X(m);
}
return U;
}
}
throw Error("illegal catch attempt");
}, delegateYield: function(ae, q, m) {
return this.delegate = { iterator: Pe(ae), resultName: q, nextLoc: m }, this.method === "next" && (this.arg = y), ye;
} }, x;
}
o.exports = C, o.exports.__esModule = !0, o.exports.default = o.exports;
}, function(o, s, p) {
p.r(s), p.d(s, "KwaiPlayerYUV2RGB", function() {
return Ve;
});
var g = p(1), C = p.n(g), y = p(2), x = p.n(y), h = p(0), F = p.n(h), I = p(4), T = "AGFzbQEAAAABHQVgAX8Bf2AAAGABfwBgAAF/YAh/f39/f39/fwF/AgcBAWEBYQAAAwcGAAECAAMEBAUBcAEBAQUHAQGAEICAAgYJAX8BQZCMhCALBx0HAWICAAFjAAIBZAAGAWUABQFmAQABZwAEAWgAAwqHOgZRAQJ/QYAIKAIAIgEgAEEHakF4cSICaiEAAkAgAkEAIAAgAU0bRQRAIAA/AEEQdE0NASAAEAANAQtBkIiAIEEwNgIAQX8PC0GACCAANgIAIAELAgALkgwBB38CQCAARQ0AIABBCGsiAyAAQQRrKAIAIgFBeHEiAGohBQJAIAFBAXENACABQQJxRQ0BIAMgAygCACIBayIDQaSIgCAoAgBJDQEgACABaiEAAkACQAJAQaiIgCAoAgAgA0cEQCADKAIMIQIgAUH/AU0EQCACIAMoAggiBEcNAkGUiIAgQZSIgCAoAgBBfiABQQN2d3E2AgAMBQsgAygCGCEGIAIgA0cEQCADKAIIIgEgAjYCDCACIAE2AggMBAsgAygCFCIBBH8gA0EUagUgAygCECIBRQ0DIANBEGoLIQQDQCAEIQcgASICQRRqIQQgAigCFCIBDQAgAkEQaiEEIAIoAhAiAQ0ACyAHQQA2AgAMAwsgBSgCBCIBQQNxQQNHDQNBnIiAICAANgIAIAUgAUF+cTYCBCADIABBAXI2AgQgBSAANgIADwsgBCACNgIMIAIgBDYCCAwCC0EAIQILIAZFDQACQCADKAIcIgFBAnRBxIqAIGoiBCgCACADRgRAIAQgAjYCACACDQFBmIiAIEGYiIAgKAIAQX4gAXdxNgIADAILIAZBEEEUIAYoAhAgA0YbaiACNgIAIAJFDQELIAIgBjYCGCADKAIQIgEEQCACIAE2AhAgASACNgIYCyADKAIUIgFFDQAgAiABNgIUIAEgAjYCGAsgAyAFTw0AIAUoAgQiAUEBcUUNAAJAAkACQAJAIAFBAnFFBEBBrIiAICgCACAFRgRAQayIgCAgAzYCAEGgiIAgQaCIgCAoAgAgAGoiADYCACADIABBAXI2AgQgA0GoiIAgKAIARw0GQZyIgCBBADYCAEGoiIAgQQA2AgAPC0GoiIAgKAIAIAVGBEBBqIiAICADNgIAQZyIgCBBnIiAICgCACAAaiIANgIAIAMgAEEBcjYCBCAAIANqIAA2AgAPCyABQXhxIABqIQAgBSgCDCECIAFB/wFNBEAgBSgCCCIEIAJGBEBBlIiAIEGUiIAgKAIAQX4gAUEDdndxNgIADAULIAQgAjYCDCACIAQ2AggMBAsgBSgCGCEGIAIgBUcEQCAFKAIIIgEgAjYCDCACIAE2AggMAwsgBSgCFCIBBH8gBUEUagUgBSgCECIBRQ0CIAVBEGoLIQQDQCAEIQcgASICQRRqIQQgAigCFCIBDQAgAkEQaiEEIAIoAhAiAQ0ACyAHQQA2AgAMAgsgBSABQX5xNgIEIAMgAEEBcjYCBCAAIANqIAA2AgAMAwtBACECCyAGRQ0AAkAgBSgCHCIBQQJ0QcSKgCBqIgQoAgAgBUYEQCAEIAI2AgAgAg0BQZiIgCBBmIiAICgCAEF+IAF3cTYCAAwCCyAGQRBBFCAGKAIQIAVGG2ogAjYCACACRQ0BCyACIAY2AhggBSgCECIBBEAgAiABNgIQIAEgAjYCGAsgBSgCFCIBRQ0AIAIgATYCFCABIAI2AhgLIAMgAEEBcjYCBCAAIANqIAA2AgAgA0GoiIAgKAIARw0AQZyIgCAgADYCAA8LIABB/wFNBEAgAEF4cUG8iIAgaiEBAn9BlIiAICgCACIEQQEgAEEDdnQiAHFFBEBBlIiAICAAIARyNgIAIAEMAQsgASgCCAshACABIAM2AgggACADNgIMIAMgATYCDCADIAA2AggPC0EfIQIgAEH///8HTQRAIABBJiAAQQh2ZyIBa3ZBAXEgAUEBdGtBPmohAgsgAyACNgIcIANCADcCECACQQJ0QcSKgCBqIQcCfwJAAn9BmIiAICgCACIBQQEgAnQiBHFFBEBBmIiAICABIARyNgIAQRghAiAHIQRBCAwBCyAAQRkgAkEBdmtBACACQR9HG3QhAiAHKAIAIQQDQCAEIgEoAgRBeHEgAEYNAiACQR12IQQgAkEBdCECIAEgBEEEcWpBEGoiBygCACIEDQALQRghAiABIQRBCAshACADIQEgAwwBCyABKAIIIgQgAzYCDEEIIQIgAUEIaiEHQRghAEEACyEFIAcgAzYCACACIANqIAQ2AgAgAyABNgIMIAAgA2ogBTYCAEG0iIAgQbSIgCAoAgBBAWsiAEF/IAAbNgIACwu4KQELfyMAQRBrIgokAAJAAkACQAJAAkACQAJAAkACQAJAIABB9AFNBEBBlIiAICgCACIEQRAgAEELakH4A3EgAEELSRsiBkEDdiIAdiIBQQNxBEACQCABQX9zQQFxIABqIgJBA3QiAUG8iIAgaiIAIAFBxIiAIGooAgAiASgCCCIFRgRAQZSIgCAgBEF+IAJ3cTYCAAwBCyAFIAA2AgwgACAFNgIICyABQQhqIQAgASACQQN0IgJBA3I2AgQgASACaiIBIAEoAgRBAXI2AgQMCwsgBkGciIAgKAIAIghNDQEgAQRAAkBBAiAAdCICQQAgAmtyIAEgAHRxaCIBQQN0IgBBvIiAIGoiAiAAQcSIgCBqKAIAIgAoAggiBUYEQEGUiIAgIARBfiABd3EiBDYCAAwBCyAFIAI2AgwgAiAFNgIICyAAIAZBA3I2AgQgACAGaiIHIAFBA3QiASAGayIFQQFyNgIEIAAgAWogBTYCACAIBEAgCEF4cUG8iIAgaiEBQaiIgCAoAgAhAgJ/IARBASAIQQN2dCIDcUUEQEGUiIAgIAMgBHI2AgAgAQwBCyABKAIICyEDIAEgAjYCCCADIAI2AgwgAiABNgIMIAIgAzYCCAsgAEEIaiEAQaiIgCAgBzYCAEGciIAgIAU2AgAMCwtBmIiAICgCACILRQ0BIAtoQQJ0QcSKgCBqKAIAIgIoAgRBeHEgBmshAyACIQEDQAJAIAEoAhAiAEUEQCABKAIUIgBFDQELIAAoAgRBeHEgBmsiASADIAEgA0kiARshAyAAIAIgARshAiAAIQEMAQsLIAIoAhghCSACIAIoAgwiAEcEQCACKAIIIgEgADYCDCAAIAE2AggMCgsgAigCFCIBBH8gAkEUagUgAigCECIBRQ0DIAJBEGoLIQUDQCAFIQcgASIAQRRqIQUgACgCFCIBDQAgAEEQaiEFIAAoAhAiAQ0ACyAHQQA2AgAMCQtBfyEGIABBv39LDQAgAEELaiIBQXhxIQZBmIiAICgCACIHRQ0AQR8hCEEAIAZrIQMgAEH0//8HTQRAIAZBJiABQQh2ZyIAa3ZBAXEgAEEBdGtBPmohCAsCQAJAAkAgCEECdEHEioAgaigCACIBRQRAQQAhAAwBC0EAIQAgBkEZIAhBAXZrQQAgCEEfRxt0IQIDQAJAIAEoAgRBeHEgBmsiBCADTw0AIAEhBSAEIgMNAEEAIQMgASEADAMLIAAgASgCFCIEIAQgASACQR12QQRxaigCECIBRhsgACAEGyEAIAJBAXQhAiABDQALCyAAIAVyRQRAQQAhBUECIAh0IgBBACAAa3IgB3EiAEUNAyAAaEECdEHEioAgaigCACEACyAARQ0BCwNAIAAoAgRBeHEgBmsiAiADSSEBIAIgAyABGyEDIAAgBSABGyEFIAAoAhAiAQR/IAEFIAAoAhQLIgANAAsLIAVFDQAgA0GciIAgKAIAIAZrTw0AIAUoAhghCCAFIAUoAgwiAEcEQCAFKAIIIgEgADYCDCAAIAE2AggMCAsgBSgCFCIBBH8gBUEUagUgBSgCECIBRQ0DIAVBEGoLIQIDQCACIQQgASIAQRRqIQIgACgCFCIBDQAgAEEQaiECIAAoAhAiAQ0ACyAEQQA2AgAMBwsgBkGciIAgKAIAIgVNBEBBqIiAICgCACEAAkAgBSAGayIBQRBPBEAgACAGaiICIAFBAXI2AgQgACAFaiABNgIAIAAgBkEDcjYCBAwBCyAAIAVBA3I2AgQgACAFaiIBIAEoAgRBAXI2AgRBACECQQAhAQtBnIiAICABNgIAQaiIgCAgAjYCACAAQQhqIQAMCQsgBkGgiIAgKAIAIgJJBEBBoIiAICACIAZrIgE2AgBBrIiAIEGsiIAgKAIAIgAgBmoiAjYCACACIAFBAXI2AgQgACAGQQNyNgIEIABBCGohAAwJC0EAIQAgBkEvaiIDAn9B7IuAICgCAARAQfSLgCAoAgAMAQtB+IuAIEJ/NwIAQfCLgCBCgKCAgICABDcCAEHsi4AgIApBDGpBcHFB2KrVqgVzNgIAQYCMgCBBADYCAEHQi4AgQQA2AgBBgCALIgFqIgRBACABayIHcSIBIAZNDQhBzIuAICgCACIFBEBBxIuAICgCACIIIAFqIgkgCE0gBSAJSXINCQsCQEHQi4AgLQAAQQRxRQRAAkACQAJAAkBBrIiAICgCACIFBEBB1IuAICEAA0AgACgCACIIIAVNBEAgBSAIIAAoAgRqSQ0DCyAAKAIIIgANAAsLQQAQASICQX9GDQMgASEEQfCLgCAoAgAiAEEBayIFIAJxBEAgASACayACIAVqQQAgAGtxaiEECyAEIAZNDQNBzIuAICgCACIABEBBxIuAICgCACIFIARqIgcgBU0gACAHSXINBAsgBBABIgAgAkcNAQwFCyAEIAJrIAdxIgQQASICIAAoAgAgACgCBGpGDQEgAiEACyAAQX9GDQEgBkEwaiAETQRAIAAhAgwEC0H0i4AgKAIAIgIgAyAEa2pBACACa3EiAhABQX9GDQEgAiAEaiEEIAAhAgwDCyACQX9HDQILQdCLgCBB0IuAICgCAEEEcjYCAAsgARABIgJBf0ZBABABIgBBf0ZyIAAgAk1yDQUgACACayIEIAZBKGpNDQULQcSLgCBBxIuAICgCACAEaiIANgIAQciLgCAoAgAgAEkEQEHIi4AgIAA2AgALAkBBrIiAICgCACIDBEBB1IuAICEAA0AgAiAAKAIAIgEgACgCBCIFakYNAiAAKAIIIgANAAsMBAtBpIiAICgCACIAQQAgACACTRtFBEBBpIiAICACNgIAC0EAIQBB2IuAICAENgIAQdSLgCAgAjYCAEG0iIAgQX82AgBBuIiAIEHsi4AgKAIANgIAQeCLgCBBADYCAANAIABBA3QiAUHEiIAgaiABQbyIgCBqIgU2AgAgAUHIiIAgaiAFNgIAIABBAWoiAEEgRw0AC0GgiIAgIARBKGsiAEF4IAJrQQdxIgFrIgU2AgBBrIiAICABIAJqIgE2AgAgASAFQQFyNgIEIAAgAmpBKDYCBEGwiIAgQfyLgCAoAgA2AgAMBAsgAiADTSABIANLcg0CIAAoAgxBCHENAiAAIAQgBWo2AgRBrIiAICADQXggA2tBB3EiAGoiATYCAEGgiIAgQaCIgCAoAgAgBGoiAiAAayIANgIAIAEgAEEBcjYCBCACIANqQSg2AgRBsIiAIEH8i4AgKAIANgIADAMLQQAhAAwGC0EAIQAMBAtBpIiAICgCACACSwRAQaSIgCAgAjYCAAsgAiAEaiEFQdSLgCAhAAJAA0AgBSAAKAIAIgFHBEAgACgCCCIADQEMAgsLIAAtAAxBCHFFDQMLQdSLgCAhAANAAkAgACgCACIBIANNBEAgAyABIAAoAgRqIgVJDQELIAAoAgghAAwBCwtBoIiAICAEQShrIgBBeCACa0EHcSIBayIHNgIAQayIgCAgASACaiIBNgIAIAEgB0EBcjYCBCAAIAJqQSg2AgRBsIiAIEH8i4AgKAIANgIAIAMgBUEnIAVrQQdxakEvayIAIAAgA0EQakkbIgFBGzYCBCABQdyLgCApAgA3AhAgAUHUi4AgKQIANwIIQdyLgCAgAUEIajYCAEHYi4AgIAQ2AgBB1IuAICACNgIAQeCLgCBBADYCACABQRhqIQADQCAAQQc2AgQgAEEIaiAAQQRqIQAgBUkNAAsgASADRg0AIAEgASgCBEF+cTYCBCADIAEgA2siAkEBcjYCBCABIAI2AgACfyACQf8BTQRAIAJBeHFBvIiAIGohAAJ/QZSIgCAoAgAiAUEBIAJBA3Z0IgJxRQRAQZSIgCAgASACcjYCACAADAELIAAoAggLIQEgACADNgIIIAEgAzYCDEEMIQJBCAwBC0EfIQAgAkH///8HTQRAIAJBJiACQQh2ZyIAa3ZBAXEgAEEBdGtBPmohAAsgAyAANgIcIANCADcCECAAQQJ0QcSKgCBqIQECQAJAQZiIgCAoAgAiBUEBIAB0IgRxRQRAQZiIgCAgBCAFcjYCACABIAM2AgAMAQsgAkEZIABBAXZrQQAgAEEfRxt0IQAgASgCACEFA0AgBSIBKAIEQXhxIAJGDQIgAEEddiEEIABBAXQhACABIARBBHFqIgQoAhAiBQ0ACyAEIAM2AhALIAMgATYCGEEIIQIgAyIBIQBBDAwBCyABKAIIIgAgAzYCDCABIAM2AgggAyAANgIIQQAhAEEYIQJBDAsgA2ogATYCACACIANqIAA2AgALQaCIgCAoAgAiACAGTQ0AQaCIgCAgACAGayIBNgIAQayIgCBBrIiAICgCACIAIAZqIgI2AgAgAiABQQFyNgIEIAAgBkEDcjYCBCAAQQhqIQAMBAtBkIiAIEEwNgIAQQAhAAwDCyAAIAI2AgAgACAAKAIEIARqNgIEIAJBeCACa0EHcWoiCCAGQQNyNgIEIAFBeCABa0EHcWoiBCAGIAhqIgNrIQcCQEGsiIAgKAIAIARGBEBBrIiAICADNgIAQaCIgCBBoIiAICgCACAHaiIANgIAIAMgAEEBcjYCBAwBC0GoiIAgKAIAIARGBEBBqIiAICADNgIAQZyIgCBBnIiAICgCACAHaiIANgIAIAMgAEEBcjYCBCAAIANqIAA2AgAMAQsgBCgCBCIAQQNxQQFGBEAgAEF4cSEJIAQoAgwhAgJAIABB/wFNBEAgBCgCCCIBIAJGBEBBlIiAIEGUiIAgKAIAQX4gAEEDdndxNgIADAILIAEgAjYCDCACIAE2AggMAQsgBCgCGCEGAkAgAiAERwRAIAQoAggiACACNgIMIAIgADYCCAwBCwJAIAQoAhQiAAR/IARBFGoFIAQoAhAiAEUNASAEQRBqCyEBA0AgASEFIAAiAkEUaiEBIAAoAhQiAA0AIAJBEGohASACKAIQIgANAAsgBUEANgIADAELQQAhAgsgBkUNAAJAIAQoAhwiAEECdEHEioAgaiIBKAIAIARGBEAgASACNgIAIAINAUGYiIAgQZiIgCAoAgBBfiAAd3E2AgAMAgsgBkEQQRQgBigCECAERhtqIAI2AgAgAkUNAQsgAiAGNgIYIAQoAhAiAARAIAIgADYCECAAIAI2AhgLIAQoAhQiAEUNACACIAA2AhQgACACNgIYCyAHIAlqIQcgBCAJaiIEKAIEIQALIAQgAEF+cTYCBCADIAdBAXI2AgQgAyAHaiAHNgIAIAdB/wFNBEAgB0F4cUG8iIAgaiEAAn9BlIiAICgCACIBQQEgB0EDdnQiAnFFBEBBlIiAICABIAJyNgIAIAAMAQsgACgCCAshASAAIAM2AgggASADNgIMIAMgADYCDCADIAE2AggMAQtBHyECIAdB////B00EQCAHQSYgB0EIdmciAGt2QQFxIABBAXRrQT5qIQILIAMgAjYCHCADQgA3AhAgAkECdEHEioAgaiEAAkACQEGYiIAgKAIAIgFBASACdCIFcUUEQEGYiIAgIAEgBXI2AgAgACADNgIADAELIAdBGSACQQF2a0EAIAJBH0cbdCECIAAoAgAhAQNAIAEiACgCBEF4cSAHRg0CIAJBHXYhASACQQF0IQIgACABQQRxaiIFKAIQIgENAAsgBSADNgIQCyADIAA2AhggAyADNgIMIAMgAzYCCAwBCyAAKAIIIgEgAzYCDCAAIAM2AgggA0EANgIYIAMgADYCDCADIAE2AggLIAhBCGohAAwCCwJAIAhFDQACQCAFKAIcIgFBAnRBxIqAIGoiAigCACAFRgRAIAIgADYCACAADQFBmIiAICAHQX4gAXdxIgc2AgAMAgsgCEEQQRQgCCgCECAFRhtqIAA2AgAgAEUNAQsgACAINgIYIAUoAhAiAQRAIAAgATYCECABIAA2AhgLIAUoAhQiAUUNACAAIAE2AhQgASAANgIYCwJAIANBD00EQCAFIAMgBmoiAEEDcjYCBCAAIAVqIgAgACgCBEEBcjYCBAwBCyAFIAZBA3I2AgQgBSAGaiIEIANBAXI2AgQgAyAEaiADNgIAIANB/wFNBEAgA0F4cUG8iIAgaiEAAn9BlIiAICgCACIBQQEgA0EDdnQiAnFFBEBBlIiAICABIAJyNgIAIAAMAQsgACgCCAshASAAIAQ2AgggASAENgIMIAQgADYCDCAEIAE2AggMAQtBHyEAIANB////B00EQCADQSYgA0EIdmciAGt2QQFxIABBAXRrQT5qIQALIAQgADYCHCAEQgA3AhAgAEECdEHEioAgaiEBAkACQCAHQQEgAHQiAnFFBEBBmIiAICACIAdyNgIAIAEgBDYCACAEIAE2AhgMAQsgA0EZIABBAXZrQQAgAEEfRxt0IQAgASgCACEBA0AgASICKAIEQXhxIANGDQIgAEEddiEHIABBAXQhACACIAdBBHFqIgcoAhAiAQ0ACyAHIAQ2AhAgBCACNgIYCyAEIAQ2AgwgBCAENgIIDAELIAIoAggiACAENgIMIAIgBDYCCCAEQQA2AhggBCACNgIMIAQgADYCCAsgBUEIaiEADAELAkAgCUUNAAJAIAIoAhwiAUECdEHEioAgaiIFKAIAIAJGBEAgBSAANgIAIAANAUGYiIAgIAtBfiABd3E2AgAMAgsgCUEQQRQgCSgCECACRhtqIAA2AgAgAEUNAQsgACAJNgIYIAIoAhAiAQRAIAAgATYCECABIAA2AhgLIAIoAhQiAUUNACAAIAE2AhQgASAANgIYCwJAIANBD00EQCACIAMgBmoiAEEDcjYCBCAAIAJqIgAgACgCBEEBcjYCBAwBCyACIAZBA3I2AgQgAiAGaiIFIANBAXI2AgQgAyAFaiADNgIAIAgEQCAIQXhxQbyIgCBqIQBBqIiAICgCACEBAn9BASAIQQN2dCIHIARxRQRAQZSIgCAgBCAHcjYCACAADAELIAAoAggLIQQgACABNgIIIAQgATYCDCABIAA2AgwgASAENgIIC0GoiIAgIAU2AgBBnIiAICADNgIACyACQQhqIQALIApBEGokACAACwUAQZAIC9sDAQd/AkAgB0EKRgRAQQAhByAFBEAgACELIARBfnEhCgNAIAQEQCAEIAlsIQwgCiAJQQF2bCENQQAhCANAIAggDGoiDkEBdCEAAkACQAJAAkAgBg4EAgABAgMLIAggDWpBfnEhBwwCCyAIIApqQX5xIQcMAQsgACEHCyADIA5BAnRqIAIgB2otAAAgAiAHQQFqIg5qLQAAQQh0ckECdkH/AXEgACALaiIALQABQQp0IAAtAAAiAEECdHJBgB5xckEOdCABIAdqLQAAIAEgDmotAABBCHRyQfwHcSAAQQh0QYD4AHFyckGQCGooAgA2AAAgCEEBaiIIIARHDQALCyAJQQFqIgkgBUcNAAsLDAELQQAhByAFBEAgACELIARBAXYhCgNAIAQEQCAEIAlsIQwgCUEBdiAKbCENQQAhCANAIAggDGohAAJAAkACQAJAIAYOBAIAAQIDCyAIQQF2IA1qIQcMAgsgCEEBdiAKaiEHDAELIAAhBwsgAyAAQQJ0aiACIAdqLQAAIAAgC2otAAAiAEEEdEGAHnFyQQ50IAEgB2otAAAgAEEIdEGAHnFyQQJ0ckGQCGooAgA2AAAgCEEBaiIIIARHDQALCyAJQQFqIgkgBUcNAAsLC0EACwsLAQBBgAgLBBAGAQQ=", D = "CnZhciBLd2FpWVVWMlJHQiA9ICgoKSA9PiB7CiAgdmFyIF9zY3JpcHROYW1lID0gdHlwZW9mIGRvY3VtZW50ICE9ICd1bmRlZmluZWQnID8gZG9jdW1lbnQuY3VycmVudFNjcmlwdD8uc3JjIDogdW5kZWZpbmVkOwogIAogIHJldHVybiAoCmZ1bmN0aW9uKG1vZHVsZUFyZyA9IHt9KSB7CiAgdmFyIG1vZHVsZVJ0bjsKCnZhciBhPW1vZHVsZUFyZyxmLGcsaD1uZXcgUHJvbWlzZSgoYixjKT0+e2Y9YjtnPWN9KSxsPSJvYmplY3QiPT10eXBlb2Ygd2luZG93LG09ImZ1bmN0aW9uIj09dHlwZW9mIGltcG9ydFNjcmlwdHMsbj1PYmplY3QuYXNzaWduKHt9LGEpLHA9IiIscSxyOwppZihsfHxtKW0/cD1zZWxmLmxvY2F0aW9uLmhyZWY6InVuZGVmaW5lZCIhPXR5cGVvZiBkb2N1bWVudCYmZG9jdW1lbnQuY3VycmVudFNjcmlwdCYmKHA9ZG9jdW1lbnQuY3VycmVudFNjcmlwdC5zcmMpLF9zY3JpcHROYW1lJiYocD1fc2NyaXB0TmFtZSkscC5zdGFydHNXaXRoKCJibG9iOiIpP3A9IiI6cD1wLnN1YnN0cigwLHAucmVwbGFjZSgvWz8jXS4qLywiIikubGFzdEluZGV4T2YoIi8iKSsxKSxtJiYocj1iPT57dmFyIGM9bmV3IFhNTEh0dHBSZXF1ZXN0O2Mub3BlbigiR0VUIixiLCExKTtjLnJlc3BvbnNlVHlwZT0iYXJyYXlidWZmZXIiO2Muc2VuZChudWxsKTtyZXR1cm4gbmV3IFVpbnQ4QXJyYXkoYy5yZXNwb25zZSl9KSxxPWI9PmZldGNoKGIse2NyZWRlbnRpYWxzOiJzYW1lLW9yaWdpbiJ9KS50aGVuKGM9PmMub2s/Yy5hcnJheUJ1ZmZlcigpOlByb21pc2UucmVqZWN0KEVycm9yKGMuc3RhdHVzKyIgOiAiK2MudXJsKSkpO3ZhciB0PWEucHJpbnRFcnJ8fGNvbnNvbGUuZXJyb3IuYmluZChjb25zb2xlKTsKT2JqZWN0LmFzc2lnbihhLG4pO249bnVsbDt2YXIgdT1hLndhc21CaW5hcnksdix3PSExLHg7ZnVuY3Rpb24geSgpe3ZhciBiPXYuYnVmZmVyO2EuSEVBUDg9bmV3IEludDhBcnJheShiKTthLkhFQVAxNj1uZXcgSW50MTZBcnJheShiKTthLkhFQVBVOD14PW5ldyBVaW50OEFycmF5KGIpO2EuSEVBUFUxNj1uZXcgVWludDE2QXJyYXkoYik7YS5IRUFQMzI9bmV3IEludDMyQXJyYXkoYik7YS5IRUFQVTMyPW5ldyBVaW50MzJBcnJheShiKTthLkhFQVBGMzI9bmV3IEZsb2F0MzJBcnJheShiKTthLkhFQVBGNjQ9bmV3IEZsb2F0NjRBcnJheShiKX12YXIgej1bXSxBPVtdLEI9W107ZnVuY3Rpb24gQygpe3ZhciBiPWEucHJlUnVuLnNoaWZ0KCk7ei51bnNoaWZ0KGIpfXZhciBEPTAsRT1udWxsLEY9bnVsbCxHPWI9PmIuc3RhcnRzV2l0aCgiZGF0YTphcHBsaWNhdGlvbi9vY3RldC1zdHJlYW07YmFzZTY0LCIpLEg7CmZ1bmN0aW9uIEkoYil7aWYoYj09SCYmdSlyZXR1cm4gbmV3IFVpbnQ4QXJyYXkodSk7aWYocilyZXR1cm4gcihiKTt0aHJvdyJib3RoIGFzeW5jIGFuZCBzeW5jIGZldGNoaW5nIG9mIHRoZSB3YXNtIGZhaWxlZCI7fWZ1bmN0aW9uIEooYil7cmV0dXJuIHU/UHJvbWlzZS5yZXNvbHZlKCkudGhlbigoKT0+SShiKSk6cShiKS50aGVuKGM9Pm5ldyBVaW50OEFycmF5KGMpLCgpPT5JKGIpKX1mdW5jdGlvbiBMKGIsYyxkKXtyZXR1cm4gSihiKS50aGVuKGU9PldlYkFzc2VtYmx5Lmluc3RhbnRpYXRlKGUsYykpLnRoZW4oZCxlPT57dChgZmFpbGVkIHRvIGFzeW5jaHJvbm91c2x5IHByZXBhcmUgd2FzbTogJHtlfWApO2Eub25BYm9ydD8uKGUpO2U9IkFib3J0ZWQoIitlKyIpIjt0KGUpO3c9ITA7ZT1uZXcgV2ViQXNzZW1ibHkuUnVudGltZUVycm9yKGUrIi4gQnVpbGQgd2l0aCAtc0FTU0VSVElPTlMgZm9yIG1vcmUgaW5mby4iKTtnKGUpO3Rocm93IGU7fSl9CmZ1bmN0aW9uIE0oYixjKXt2YXIgZD1IO3JldHVybiB1fHwiZnVuY3Rpb24iIT10eXBlb2YgV2ViQXNzZW1ibHkuaW5zdGFudGlhdGVTdHJlYW1pbmd8fEcoZCl8fCJmdW5jdGlvbiIhPXR5cGVvZiBmZXRjaD9MKGQsYixjKTpmZXRjaChkLHtjcmVkZW50aWFsczoic2FtZS1vcmlnaW4ifSkudGhlbihlPT5XZWJBc3NlbWJseS5pbnN0YW50aWF0ZVN0cmVhbWluZyhlLGIpLnRoZW4oYyxmdW5jdGlvbihrKXt0KGB3YXNtIHN0cmVhbWluZyBjb21waWxlIGZhaWxlZDogJHtrfWApO3QoImZhbGxpbmcgYmFjayB0byBBcnJheUJ1ZmZlciBpbnN0YW50aWF0aW9uIik7cmV0dXJuIEwoZCxiLGMpfSkpfQp2YXIgTj1iPT57Zm9yKDswPGIubGVuZ3RoOyliLnNoaWZ0KCkoYSl9LE89e2E6Yj0+e3ZhciBjPXgubGVuZ3RoO2I+Pj49MDtpZigyMTQ3NDgzNjQ4PGIpcmV0dXJuITE7Zm9yKHZhciBkPTE7ND49ZDtkKj0yKXt2YXIgZT1jKigxKy4yL2QpO2U9TWF0aC5taW4oZSxiKzEwMDY2MzI5Nik7YTp7ZT0oTWF0aC5taW4oMjE0NzQ4MzY0OCw2NTUzNipNYXRoLmNlaWwoTWF0aC5tYXgoYixlKS82NTUzNikpLXYuYnVmZmVyLmJ5dGVMZW5ndGgrNjU1MzUpLzY1NTM2O3RyeXt2Lmdyb3coZSk7eSgpO3ZhciBrPTE7YnJlYWsgYX1jYXRjaChLKXt9az12b2lkIDB9aWYoaylyZXR1cm4hMH1yZXR1cm4hMX19LFA9ZnVuY3Rpb24oKXtmdW5jdGlvbiBiKGQpe1A9ZC5leHBvcnRzO3Y9UC5iO3koKTtBLnVuc2hpZnQoUC5jKTtELS07YS5tb25pdG9yUnVuRGVwZW5kZW5jaWVzPy4oRCk7MD09RCYmKG51bGwhPT1FJiYoY2xlYXJJbnRlcnZhbChFKSxFPW51bGwpLEYmJihkPUYsRj1udWxsLGQoKSkpO3JldHVybiBQfQp2YXIgYz17YTpPfTtEKys7YS5tb25pdG9yUnVuRGVwZW5kZW5jaWVzPy4oRCk7aWYoYS5pbnN0YW50aWF0ZVdhc20pdHJ5e3JldHVybiBhLmluc3RhbnRpYXRlV2FzbShjLGIpfWNhdGNoKGQpe3QoYE1vZHVsZS5pbnN0YW50aWF0ZVdhc20gY2FsbGJhY2sgZmFpbGVkIHdpdGggZXJyb3I6ICR7ZH1gKSxnKGQpfUh8fD1HKCJsaWJ5dXYycmdiLndhc20iKT8ibGlieXV2MnJnYi53YXNtIjphLmxvY2F0ZUZpbGU/YS5sb2NhdGVGaWxlKCJsaWJ5dXYycmdiLndhc20iLHApOnArImxpYnl1djJyZ2Iud2FzbSI7TShjLGZ1bmN0aW9uKGQpe2IoZC5pbnN0YW5jZSl9KS5jYXRjaChnKTtyZXR1cm57fX0oKTthLl95dXYycmdiPShiLGMsZCxlLGssSyxTLFQpPT4oYS5feXV2MnJnYj1QLmQpKGIsYyxkLGUsayxLLFMsVCk7YS5fZ2V0X21hcF9wdHI9KCk9PihhLl9nZXRfbWFwX3B0cj1QLmUpKCk7YS5fbWFsbG9jPWI9PihhLl9tYWxsb2M9UC5nKShiKTthLl9mcmVlPWI9PihhLl9mcmVlPVAuaCkoYik7CnZhciBRO0Y9ZnVuY3Rpb24gUigpe1F8fFUoKTtRfHwoRj1SKX07ZnVuY3Rpb24gVSgpe2Z1bmN0aW9uIGIoKXtpZighUSYmKFE9ITAsYS5jYWxsZWRSdW49ITAsIXcpKXtOKEEpO2YoYSk7YS5vblJ1bnRpbWVJbml0aWFsaXplZD8uKCk7aWYoYS5wb3N0UnVuKWZvcigiZnVuY3Rpb24iPT10eXBlb2YgYS5wb3N0UnVuJiYoYS5wb3N0UnVuPVthLnBvc3RSdW5dKTthLnBvc3RSdW4ubGVuZ3RoOyl7dmFyIGM9YS5wb3N0UnVuLnNoaWZ0KCk7Qi51bnNoaWZ0KGMpfU4oQil9fWlmKCEoMDxEKSl7aWYoYS5wcmVSdW4pZm9yKCJmdW5jdGlvbiI9PXR5cGVvZiBhLnByZVJ1biYmKGEucHJlUnVuPVthLnByZVJ1bl0pO2EucHJlUnVuLmxlbmd0aDspQygpO04oeik7MDxEfHwoYS5zZXRTdGF0dXM/KGEuc2V0U3RhdHVzKCJSdW5uaW5nLi4uIiksc2V0VGltZW91dChmdW5jdGlvbigpe3NldFRpbWVvdXQoZnVuY3Rpb24oKXthLnNldFN0YXR1cygiIil9LDEpO2IoKX0sMSkpOmIoKSl9fQppZihhLnByZUluaXQpZm9yKCJmdW5jdGlvbiI9PXR5cGVvZiBhLnByZUluaXQmJihhLnByZUluaXQ9W2EucHJlSW5pdF0pOzA8YS5wcmVJbml0Lmxlbmd0aDspYS5wcmVJbml0LnBvcCgpKCk7VSgpO21vZHVsZVJ0bj1oOwoKCiAgcmV0dXJuIG1vZHVsZVJ0bjsKfQopOwp9KSgpOwppZiAodHlwZW9mIGV4cG9ydHMgPT09ICdvYmplY3QnICYmIHR5cGVvZiBtb2R1bGUgPT09ICdvYmplY3QnKQogIG1vZHVsZS5leHBvcnRzID0gS3dhaVlVVjJSR0I7CmVsc2UgaWYgKHR5cGVvZiBkZWZpbmUgPT09ICdmdW5jdGlvbicgJiYgZGVmaW5lWydhbWQnXSkKICBkZWZpbmUoW10sICgpID0+IEt3YWlZVVYyUkdCKTsK", W = "lib-yuv2rgb-wrapper", j = function() {
function je(ue) {
var L;
this.I = void 0, this.C = void 0, this.B = void 0, this.h = void 0, this.I = ue, (L = this.I) == null || L.i(W, "constructor");
}
var we = je.prototype;
return we.init = function() {
var ue = C()(F.a.mark(function L() {
var w, le, oe, Re, Oe, de = this;
return F.a.wrap(function(X) {
for (; ; )
switch (X.prev = X.next) {
case 0:
return (w = this.I) == null || w.i(W, "init libyuv2rgb."), le = I.Base64.decode(D), oe = new Blob([le], { type: "text/javascript" }), Re = new Function(le + " return KwaiYUV2RGB;")(), Oe = { wasmBinary: I.Base64.toUint8Array(T), mainScriptUrlOrBlob: oe }, X.abrupt("return", Re(Oe).then(function(ge) {
var Pe;
(Pe = de.I) == null || Pe.i(W, "inited."), de.C = ge;
}));
case 6:
case "end":
return X.stop();
}
}, L, this);
}));
return function() {
return ue.apply(this, arguments);
};
}(), we.destroy = function() {
var ue, L;
(ue = this.I) == null || ue.i(W, "destroy"), this.Y(), this.h && ((L = this.C) == null || L._free(this.h), this.h = void 0), this.B = void 0, this.C = void 0;
}, we.yuv2rgb = function(ue, L, w, le, oe, Re, Oe, de) {
var X = this.B, ge = this.C;
ge && (X ? X.y.size === ue.length && X.u.size === L.length && X.v.size === w.length || (this.Y(), X.y.ptr = ge._malloc(ue.length), X.y.size = ue.length, X.u.ptr = ge._malloc(L.length), X.u.size = L.length, X.v.ptr = ge._malloc(w.length), X.v.size = ue.length, X.rgb.ptr = ge._malloc(le.length), X.rgb.size = le.length) : X = this.B = { y: { ptr: ge._malloc(ue.length), size: ue.length }, u: { ptr: ge._malloc(L.length), size: L.length }, v: { ptr: ge._malloc(w.length), size: w.length }, rgb: { ptr: ge._malloc(le.length), size: le.length } }, ge.HEAPU8.set(ue, X.y.ptr), ge.HEAPU8.set(L, X.u.ptr), ge.HEAPU8.set(w, X.v.ptr), ge._yuv2rgb(X.y.ptr, X.u.ptr, X.v.ptr, X.rgb.ptr, oe, Re, Oe, de), le.set(ge.HEAPU8.subarray(X.rgb.ptr, X.rgb.ptr + X.rgb.size)));
}, we.Y = function() {
this.B && this.C && (this.C._free(this.B.y.ptr), this.C._free(this.B.u.ptr), this.C._free(this.B.v.ptr), this.C._free(this.B.rgb.ptr));
}, x()(je, [{ key: "inited", get: function() {
return !!this.C;
} }, { key: "map", get: function() {
if (this.C) {
var ue = this.C._get_map_ptr();
return this.C.HEAPU8.subarray(ue, ue + 67108864);
}
} }]);
}(), O = "map10bit", K = function() {
function je() {
}
return je.initMap = function() {
var we = C()(F.a.mark(function ue(L, w, le, oe) {
var Re, Oe, de, X, ge, Pe;
return F.a.wrap(function(ae) {
for (; ; )
switch (ae.prev = ae.next) {
case 0:
for (oe == null || oe.i(O, "init yuv2rgb map. full: " + w), Re = [], Oe = typeof OffscreenCanvas < "u" || document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp") === 0, de = 0, X = 1; X < 9; X++)
ge = "https://s2-10895.kwimgs.com/kos/nlav10895/yuvmap/3/" + (w ? "full/" : "limit/") + "map_10bit_" + X + "." + (Oe ? "webp" : "png"), Re.push(je.G(ge, X, L, de, oe)), de += 8388608;
return ae.next = 7, Promise.all(Re);
case 7:
return Pe = ae.sent, ae.abrupt("return", Promise.resolve(Pe.reduce(function(q, m) {
return q && m.result;
}, !0)));
case 9:
case "end":
return ae.stop();
}
}, ue);
}));
return function(ue, L, w, le) {
return we.apply(this, arguments);
};
}(), je.G = function() {
var we = C()(F.a.mark(function ue(L, w, le, oe, Re) {
return F.a.wrap(function(Oe) {
for (; ; )
switch (Oe.prev = Oe.next) {
case 0:
return Re == null || Re.i(O, "load map slice. url: " + L + " idx: " + w), Oe.abrupt("return", new Promise(function(de) {
fetch(L).then(function(X) {
X.ok ? X.blob().then(function(ge) {
createImageBitmap(ge).then(function(Pe) {
var ae = typeof HTMLCanvasElement > "u" ? new OffscreenCanvas(1, 1) : document.createElement("canvas"), q = ae.getContext("2d");
if (ae.width = Pe.width, ae.height = Pe.height, q) {
q.drawImage(Pe, 0, 0);
var m = q.getImageData(0, 0, ae.width, ae.height);
le.set(m.data, oe), de({ idx: w, result: !0 });
} else
de({ idx: w, result: !1 });
Pe.close();
});
}) : de({ idx: w, result: !1 });
}).catch(function(X) {
de({ idx: w, result: !1 });
});
}));
case 2:
case "end":
return Oe.stop();
}
}, ue);
}));
return function(ue, L, w, le, oe) {
return we.apply(this, arguments);
};
}(), je;
}();
function z(je) {
return B.apply(this, arguments);
}
function B() {
return (B = C()(F.a.mark(function je(we) {
return F.a.wrap(function(ue) {
for (; ; )
switch (ue.prev = ue.next) {
case 0:
return ue.abrupt("return", new Promise(function(L) {
setTimeout(function() {
L();
}, we);
}));
case 1:
case "end":
return ue.stop();
}
}, je);
}))).apply(this, arguments);
}
var J = function() {
function je() {
}
return je.N = function(we, ue, L, w, le) {
for (var oe = ue[0], Re = ue[1], Oe = ue[2], de = ue[3], X = ue[4], ge = ue[5], Pe = ue[6], ae = ue[7], q = ue[8], m = w; m < le; m++)
for (var ve = 0; ve < 256; ve++)
for (var U = 0; U < 256; U++) {
var M = m - L, ne = ve - 128, Le = U - 128, Ue = ((m / 16 << 8) + U << 12) + ((m % 16 << 8) + ve) << 2;
we[Ue] = Math.min(255, Math.max(0, M * oe + ne * Re + Le * Oe | 0)), we[Ue + 1] = Math.min(255, Math.max(0, M * de + ne * X + Le * ge | 0)), we[Ue + 2] = Math.min(255, Math.max(0, M * Pe + ne * ae + Le * q | 0)), we[Ue + 3] = 255;
}
}, je.initMap = function() {
var we = C()(F.a.mark(function ue(L, w, le) {
var oe, Re;
return F.a.wrap(function(Oe) {
for (; ; )
switch (Oe.prev = Oe.next) {
case 0:
return le == null || le.i("map8bit", "init yuv2rgb map. matrix: " + w), oe = w.subarray(3, 12), Re = w[0] === 0 ? 0 : 16, je.N(L, oe, Re, 0, 64), Oe.next = 5, z(0);
case 5:
return je.N(L, oe, Re, 64, 128), Oe.next = 8, z(0);
case 8:
return je.N(L, oe, Re, 128, 192), Oe.next = 11, z(0);
case 11:
return je.N(L, oe, Re, 192, 256), Oe.abrupt("return", !0);
case 13:
case "end":
return Oe.stop();
}
}, ue);
}));
return function(ue, L, w) {
return we.apply(this, arguments);
};
}(), je;
}(), be = p(5), $ = p.n(be), ye = {}, Be = "yuv2rgb", Ve = function() {
function je(ue) {
var L;
this.Z = void 0, this.I = void 0, this.F = void 0, this.R = "notSet", this.Z = (L = ue, $()({}, ye, L)), this.I = this.Z.logger, this.F = new j(this.I);
}
var we = je.prototype;
return we.initMap = function() {
var ue = C()(F.a.mark(function L(w, le, oe) {
var Re, Oe, de, X, ge, Pe = this;
return F.a.wrap(function(ae) {
for (; ; )
switch (ae.prev = ae.next) {
case 0:
if (Oe = w[0] === 0, (Re = this.I) == null || Re.i(Be, "init yuv2rgb map. matrix: " + w + " full: " + Oe + " bit: " + oe), this.R = "loading", this.F) {
ae.next = 5;
break;
}
return ae.abrupt("return", Promise.reject("wasm undefined."));
case 5:
if (ae.prev = 5, this.F.inited) {
ae.next = 10;
break;
}
return ae.next = 9, this.F.init();
case 9:
(de = this.I) == null || de.i(Be, "wasm inited.");
case 10:
if (X = this.F.map) {
ae.next = 14;
break;
}
return this.R = "error", ae.abrupt("return", Promise.reject("map null."));
case 14:
return ge = oe === 10 ? K.initMap(X, Oe, le, this.I) : J.initMap(X, w, this.I), ae.abrupt("return", ge.then(function(q) {
return Pe.R = q ? "complete" : "error", q;
}));
case 18:
return ae.prev = 18, ae.t0 = ae.catch(5), ae.abrupt("return", Promise.reject(ae.t0));
case 21:
case "end":
return ae.stop();
}
}, L, this, [[5, 18]]);
}));
return function(L, w, le) {
return ue.apply(this, arguments);
};
}(), we.yuv2rgb = function(ue, L, w, le, oe, Re, Oe, de) {
var X;
(X = this.F) == null || X.yuv2rgb(ue, L, w, le, oe, Re, Oe, de);
}, we.destroy = function() {
var ue, L;
(ue = this.I) == null || ue.i(Be, "destroy"), this.I = void 0, (L = this.F) == null || L.destroy(), this.R = "notSet";
}, x()(je, [{ key: "readyState", get: function() {
return this.R;
} }], [{ key: "version", get: function() {
return "1.0.0-alpha.8";
} }]);
}();
s.default = Ve;
}]).default;
}, function(e, r, n) {
var o = n(53).default;
e.exports = function(s, p) {
if (o(s) !== "object" || s === null)
return s;
var g = s[Symbol.toPrimitive];
if (g !== void 0) {
var C = g.call(s, p || "default");
if (o(C) !== "object")
return C;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (p === "string" ? String : Number)(s);
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r) {
function n(o, s) {
return e.exports = n = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(p, g) {
return p.__proto__ = g, p;
}, e.exports.__esModule = !0, e.exports.default = e.exports, n(o, s);
}
e.exports = n, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r) {
Number.isFinite || (Number.isFinite = function(n) {
return typeof n == "number" && isFinite(n);
}), Number.MAX_SAFE_INTEGER || (Number.MAX_SAFE_INTEGER = Math.pow(2, 53) - 1), Object.values || (Object.values = function(n) {
if (n == null)
throw new TypeError("Cannot convert undefined or null to object");
var o = [];
for (var s in n)
Object.prototype.hasOwnProperty.call(n, s) && o.push(n[s]);
return o;
});
}, function(e, r, n) {
n.r(r);
var o = n(18), s = n(13), p = n(34), g = n(48), C = n(28), y = n(2);
r.default = function(x) {
var h, F, I = new C.a();
[y.a.STEP, y.a.RENDERER_BUF_UPDATE, y.a.DEC_VIDEO_READY, y.a.DECODER_WAITING, y.a.RENDERER_SEEK, y.a.RENDERER_DRAW, y.a.ERROR, y.a.RENDERER_INIT_COMPLETE, y.a.RENDERER_WAITING, y.a.RENDERER_WAITING_END].forEach(function(T) {
return I.on(T, function(D) {
return x.postMessage({ event: T, data: D });
});
}), I.on(y.a.DECODER_IMG, function(T) {
x.postMessage({ event: y.a.DECODER_IMG, data: T }, [T.frame.y.bytes.buffer, T.frame.u.bytes.buffer, T.frame.v.bytes.buffer]);
}), I.on(y.a.SCREENSHOT, function(T) {
T.image ? x.postMessage({ event: y.a.SCREENSHOT, data: T }, [T.image.data.buffer]) : x.postMessage({ event: y.a.SCREENSHOT, data: T });
}), x.addEventListener("message", function(T) {
var D = T.data;
switch (D.cmd) {
case s.a.UPDATE_STATE:
h.updateState(D.streamTime, D.width, D.height, D.stoped, D.output, D.maxFrameBufLen, D.pictMode);
break;
case s.a.APPEND_DATA:
h.append(D.frame);
break;
case s.a.SEEK:
h.seek(D.time, D.id);
break;
case s.a.STEP:
h.step(D.type);
break;
case s.a.INIT_RENDERER:
F || (F = Object(p.b)(x, D.config.logLevel || o.DEFAULT_LOG_LEVEL, D.contextId, D.hasExternalLogger, "vr")), function(W, j, O, K) {
(h = new g.a(W, I)).init(j, O, K);
}(F, D.id, D.config, D.canvas);
break;
case s.a.RESET:
h.reset(D.decId, D.seeking);
break;
case s.a.MEDIA_INFO:
h.updateMediaInfo(D.mediaInfo);
break;
case s.a.END_OF_DATA:
h.endOfData();
break;
case s.a.DEC_DROP_FRAME:
h.decDropFrameInfo(D.data);
break;
case s.a.DESTROY:
h && h.destroy(), I && I.removeAllListeners();
break;
case s.a.SCREENSHOT:
h.screenshot(D.options);
}
});
};
}, function(e, r, n) {
e.exports = function(o, s) {
if (s = s.split(":")[0], !(o = +o))
return !1;
switch (s) {
case "http":
case "ws":
return o !== 80;
case "https":
case "wss":
return o !== 443;
case "ftp":
return o !== 21;
case "gopher":
return o !== 70;
case "file":
return !1;
}
return o !== 0;
};
}, function(e, r, n) {
var o = Object.prototype.hasOwnProperty;
function s(g) {
try {
return decodeURIComponent(g.replace(/\+/g, " "));
} catch (C) {
return null;
}
}
function p(g) {
try {
return encodeURIComponent(g);
} catch (C) {
return null;
}
}
r.stringify = function(g, C) {
C = C || "";
var y, x, h = [];
for (x in typeof C != "string" && (C = "?"), g)
if (o.call(g, x)) {
if ((y = g[x]) || y != null && !isNaN(y) || (y = ""), x = p(x), y = p(y), x === null || y === null)
continue;
h.push(x + "=" + y);
}
return h.length ? C + h.join("&") : "";
}, r.parse = function(g) {
for (var C, y = /([^=?#&]+)=?([^&]*)/g, x = {}; C = y.exec(g); ) {
var h = s(C[1]), F = s(C[2]);
h === null || F === null || h in x || (x[h] = F);
}
return x;
};
}, function(e, r, n) {
n.r(r);
var o = n(18), s = n(13), p = n(34), g = n(28), C = n(2), y = n(49);
r.default = function(x) {
var h, F, I = new g.a();
[C.a.DEC_INIT_COMPLETE, C.a.DECODER_SEEK, C.a.RENDERER_BUF_EXPIRED, C.a.DECODER_DATA_END, C.a.DECODER_BUF_LOW, C.a.DECODER_DROP_FRAME, C.a.ERROR, C.a.DECODER_MEDIA_INFO].forEach(function(T) {
return I.on(T, function(D) {
return x.postMessage({ event: T, data: D });
});
}), I.on(C.a.DECODER_IMG, function(T) {
x.postMessage({ event: C.a.DECODER_IMG, data: T }, [T.frame.y.bytes.buffer, T.frame.u.bytes.buffer, T.frame.v.bytes.buffer]);
}), x.addEventListener("message", function(T) {
var D = T.data;
switch (D.cmd) {
case s.a.APPEND_DATA:
h.appendData(D.data);
break;
case s.a.UPDATE_STATE:
h.updateState(D.streamTime, D.output, D.active, D.frameBufLen, D.playbackRate, D.maxFrameBufLen);
break;
case s.a.INIT_265:
F || (F = Object(p.b)(x, D.config.logLevel || o.DEFAULT_LOG_LEVEL, D.contextId, D.hasExternalLogger, "vd")), function(W, j, O, K, z, B, J, be) {
h && h.destroy(), (h = new y.a(W, I)).init(j, O, K, z, B, J, be);
}(F, D.id, D.lib, D.config, D.simd, D.threads, D.codecType, D.decoderType);
break;
case s.a.MEDIA_INFO:
h.updateMediaInfo(D.mediaInfo);
break;
case s.a.DESTROY:
h && h.destroy(), I && I.removeAllListeners();
break;
case s.a.RESET:
h.reset(D.decId, D.seeking);
break;
case s.a.SEEK:
h.seek(D.time, D.id);
break;
case s.a.END_OF_DATA:
h.endOfData();
}
});
};
}, function(e, r, n) {
n.r(r), n.d(r, "default", function() {
return fl;
}), n.d(r, "createKernel", function() {
return eA;
}), n.d(r, "AbstractDestroyable", function() {
return F.a;
}), n.d(r, "CanvasContextType", function() {
return h.b;
}), n.d(r, "CodecType", function() {
return h.c;
}), n.d(r, "DestroyableList", function() {
return F.b;
}), n.d(r, "Decoder", function() {
return h.d;
}), n.d(r, "DemuxerType", function() {
return _e.b;
}), n.d(r, "DownloadStatus", function() {
return ut;
}), n.d(r, "ErrorDetails", function() {
return L.a;
}), n.d(r, "ErrorTypes", function() {
return L.b;
}), n.d(r, "HttpRangeType", function() {
return h.e;
}), n.d(r, "KEvents", function() {
return w.a;
}), n.d(r, "LiveShiftType", function() {
return h.g;
}), n.d(r, "LogLevel", function() {
return Ra.LogLevel;
}), n.d(r, "MediaBox", function() {
return h.i;
}), n.d(r, "ReportTypes", function() {
return pr;
}), n.d(r, "StereoType", function() {
return h.n;
}), n.d(r, "VideoDecBlockPolicy", function() {
return h.p;
}), n.d(r, "VideoDropFramePolicy", function() {
return h.r;
}), n.d(r, "VideoRendererType", function() {
return h.s;
}), n.d(r, "WasmDecoder", function() {
return h.t;
});
var o = n(8), s = n.n(o), p = n(5), g = n.n(p), C = n(10), y = n.n(C), x = (n(57), n(43)), h = n(0), F = n(14), I = n(19), T = 255, D = 20;
function W(A, _, a) {
if (A[_] === void 0)
A[_] = a;
else {
var t = A[_];
Array.isArray(t) ? t.push(a) : typeof t == "string" && (A[_] = [t, a]);
}
}
function j(A) {
var _ = {};
return typeof A == "string" ? A.trim().split(/[\r\n]+/).forEach(function(a) {
var t = a.split(": "), i = t.shift(), c = t.join(":");
i && W(_, i, c);
}) : A && A.forEach(function(a, t) {
a.split(",").forEach(function(i) {
W(_, t, i);
});
}), _;
}
function O(A) {
var _ = [];
if (A)
for (var a in A) {
var t = A[a];
t && _.push(a + ": " + (Array.isArray(t) ? t.join(",") : t).slice(0, T));
}
if (_.length)
return _.length > D ? (_.sort(function(i, c) {
return K(c) - K(i);
}), _.slice(0, D)) : _;
}
var K = function(A) {
return A.toLowerCase().indexOf("kwaisign") === 0 || A.toLowerCase().indexOf("x-ks-") === 0 ? 1 : 0;
}, z = function(A) {
return A.MOZ_CHUNK = "moz-chunked-arraybuffer", A.UNKNOW = "unknow", A.UNSUPPORT = "", A;
}({}), B = function() {
function A() {
var a = this;
this.tag = "xhr", this.Oc = null, this.wc = void 0, this.Ec = null, this.jc = z.UNKNOW, this.kc = function() {
if (a.Oc) {
var t = a.Oc;
t.readyState === 2 && (a.wc.responseUrl = t.responseURL, a.wc.responseHeader = j(t.getAllResponseHeaders()), a.Ec && a.Ec.onConnect && a.Ec.onConnect(a.wc, t.status), (t.status < 200 || t.status > 299) && a.Di());
}
}, this.Mc = function() {
if (a.Oc) {
var t = a.Oc.response;
a.Ec && a.Ec.onProgress && t && a.Ec.onProgress(a.wc, t);
}
}, this.Sc = function() {
var t = null, i = a.Oc;
!a.jc && i && (t = i.response), a.Ec && a.Ec.onEnd(a.wc, t);
}, this.Di = function() {
var t;
if (a.Ec && a.Ec.onError) {
var i = new Error("xhr load error.");
i.name = I.b.XHR_ERROR_NAME, a.Ec.onError(i);
}
(t = a.Oc) == null || t.abort();
}, this.Oc = null;
}
A.isSupportChunk = function() {
if (A.Bc !== z.UNKNOW)
return A.Bc;
try {
var a = new XMLHttpRequest();
if (a.open("GET", "https://example.com", !0), a.responseType = z.MOZ_CHUNK, a.responseType === z.MOZ_CHUNK)
return A.Bc = z.MOZ_CHUNK, A.Bc;
} catch (t) {
A.Bc = z.UNSUPPORT;
}
return z.UNSUPPORT;
};
var _ = A.prototype;
return _.load = function(a, t) {
this.Ec = t, this.wc = a, this.jc = z.UNSUPPORT, a.progress && a.responseType === "arraybuffer" && (this.jc = A.isSupportChunk());
var i = this.Oc = new XMLHttpRequest();
i.open(a.requestMethod ? a.requestMethod : "GET", this.wc.url, !0), this.jc === z.MOZ_CHUNK ? (i.responseType = z.MOZ_CHUNK, i.onprogress = this.Mc, i.onload = this.Sc) : (i.responseType = a.responseType || "arraybuffer", i.onload = this.Sc), i.onreadystatechange = this.kc, i.onerror = this.Di, i.withCredentials = !!a.credentials, a.range && i.setRequestHeader("Range", a.range), a.headers && a.headers.forEach(function(c) {
i.setRequestHeader(c.header, c.value);
}), i.send(a.requestBody);
}, _.abort = function() {
this.Oc && (this.Oc.onreadystatechange = null, this.Oc.onprogress = null, this.Oc.onload = null, this.Oc.onerror = null, this.Oc.abort(), this.Oc = null);
}, _.destroy = function() {
this.Ec = null, this.abort();
}, A;
}();
B.Bc = z.UNKNOW;
var J = [h.i.hls, h.i.hls_ts, h.i.hls_fmp4];
function be(A) {
return !!A && J.indexOf(A) !== -1;
}
var $ = n(6);
function ye(A, _) {
var a = A.toString();
return a.toLowerCase().indexOf("[native code]") !== -1 && a.indexOf(_) !== -1 ? h.j.UNKNOWN : h.j.PROBABLY;
}
var Be = function() {
function A(a) {
this.tag = "fetch", this.Ci = void 0, this.wc = void 0, this.Ec = null, this.Tc = null, this.Dc = null, this.Rc = !1, this.Ci = a;
}
A.isSupported = function() {
return typeof fetch < "u" && typeof ReadableStream < "u";
};
var _ = A.prototype;
return _.load = function(a, t) {
var i = this;
this.wc = a, this.Ec = t;
var c = new Headers();
a.headers && a.headers.forEach(function(Q) {
c.append(Q.header, Q.value);
}), a.range && c.append("Range", a.range);
var u = { method: a.requestMethod ? a.requestMethod : "GET", headers: c, mode: "cors", cache: "default", referrerPolicy: "no-referrer-when-downgrade", signal: this.Lc() };
a.requestBody && (u.body = a.requestBody), a.credentials && (u.credentials = "include");
var v = fetch;
if (a.preferNative === !0) {
var R = this.Nc();
v = R.func, a.monkeyPatched = R.patched, a.useResetNativeFetch = R == null ? void 0 : R.resetNativeFetch;
} else
a.monkeyPatched = ye(v, "fetch");
v(a.url, u).then(function(Q) {
if (a.responseUrl = Q.url, a.redirected = Q.redirected, a.responseHeader = j(Q.headers), i.Ec && i.Ec.onConnect && i.Ec.onConnect(a, Q.status), Q.ok)
return i.Rc ? void (Q.body && Q.body.getReader().cancel().catch(function(fe) {
return i.Ci.i(i.tag, fe);
})) : a.responseType === "arraybuffer" ? a.progress ? void (Q.body && (i.Dc = Q.body.getReader(), i.Qc(i.Dc))) : void Q.arrayBuffer().then(function(fe) {
i.xc(a, fe);
}).catch(function(fe) {
if (!i.Rc) {
var ke = new Error("arraybuffer error. " + Q.status + " " + fe);
ke.name = I.b.FETCH_ERROR_NAME, i.Di(ke);
}
}) : void Q.text().then(function(fe) {
i.xc(a, fe);
}).catch(function(fe) {
if (!i.Rc) {
var ke = new Error("text error. " + Q.status + " " + fe);
ke.name = I.b.FETCH_ERROR_NAME, i.Di(ke);
}
});
var se = new Error("res not ok. " + Q.status + " " + Q.statusText);
se.name = I.b.FETCH_ERROR_NAME, i.Di(se);
}).catch(function(Q) {
Q.name !== "AbortError" && i.Di(Q);
});
}, _.abort = function() {
this.Tc && (this.Tc.abort(), this.Tc = null), this.Dc && (this.Dc.cancel().catch(function() {
}), this.Dc = null), this.Rc = !0;
}, _.destroy = function() {
this.Ec = null, this.abort();
}, _.Mc = function(a, t) {
this.Ec && this.Ec.onProgress && this.Ec.onProgress(a, t);
}, _.xc = function(a, t) {
this.Ec && this.Ec.onEnd && (this.Dc = null, this.Tc = null, this.Ec.onEnd(a, t));
}, _.Di = function(a) {
this.Ec && this.Ec.onError && this.Ec.onError(a);
}, _.Qc = function(a) {
var t = this;
a.read().then(function(i) {
if (t.Rc)
return a.cancel(), null;
if (i.done)
return t.xc(t.wc, null), null;
var c = i.value.buffer;
return t.wc.useResetNativeFetch && $.a.safari && (c = new Uint8Array(new Uint8Array(c).subarray()).buffer), t.Mc(t.wc, c), t.Qc(a);
}).catch(function(i) {
i.name !== "AbortError" && (i.name = I.b.FETCH_READ_ERROR_NAME, t.Di(i));
});
}, _.Lc = function() {
try {
if (AbortController)
return this.Tc = new AbortController(), this.Tc.signal;
} catch (a) {
return null;
}
return null;
}, _.Nc = function() {
if (A.Vc !== void 0)
return A.Vc;
if (ye(fetch, "fetch") === h.j.PROBABLY) {
var a = function(t) {
var i, c, u = document.createElement("iframe");
document.body.appendChild(u);
var v = (i = ((c = u.contentWindow) == null ? void 0 : c.fetch) || null) == null ? void 0 : i.bind(t);
return document.body.removeChild(u), v;
}(window);
this.Ci.i(this.tag, "detected io monkey patched. get native io, fetch: " + !!a), A.Vc = a ? { func: a, patched: h.j.PROBABLY, resetNativeFetch: !0 } : { func: fetch, patched: h.j.PROBABLY, resetNativeFetch: !1 };
} else
A.Vc = { func: fetch, patched: h.j.UNKNOWN, resetNativeFetch: !1 };
return A.Vc;
}, A;
}();
Be.Vc = void 0;
var Ve = n(7), je = n(22), we = "fallback", ue = function(A) {
function _(t) {
var i;
return (i = A.call(this) || this).Do = void 0, i.Ci = void 0, i.Uc = !1, i.Fc = void 0, i.Do = t, i.Ci = t.logger, i;
}
y()(_, A);
var a = _.prototype;
return a.reset = function() {
return this.Ci.i(we, "reset"), this.Uc = !1, this;
}, a.stop = function() {
return this;
}, a.setRetryFunc = function(t) {
return this.Fc = t, this;
}, a.destroy = function() {
this.Ci.i(we, "fallback: " + this.constructor.name + " destroy."), this.Fc = void 0, A.prototype.destroy.call(this);
}, a.getAvailable = function() {
return !(!this.Fc || this.Uc);
}, a.Pc = function(t) {
if (this.Fc && this.Fc() !== !1)
return this.Uc = !0, t;
}, a.emit = function(t, i) {
return this.Do.evt.emit(t, i);
}, _;
}(F.a), L = n(3), w = n(2), le = function(A) {
return A.FLV_LIVE_RELOAD = "flvLiveReload", A.USE_BACKUP = "useBackup", A.USE_BACKUP_MULTIPART = "useBackupMultipart", A.NO_WORKER = "noWorker", A.SWAP_REMUX_TYPE = "swapRemuxType", A.SWAP_AUDIO_CODECSTR = "swapAudioCodecStr", A.NEXT_DESC = "nextDesc", A.SWAP_WASM_DECODER = "swapWasmDecoder", A.SWAP_CORE = "swapCore", A.SWAP_264 = "swap264", A.RELOAD_WASM = "reloadWasm", A.DROP_V_FRAME = "dropVFrame", A;
}({}), oe = "fallback", Re = function(A) {
function _(t) {
var i;
return (i = A.call(this) || this).Do = void 0, i.Ci = void 0, i.Hc = {}, i.Yc = void 0, i.Di = function(c) {
if (i.Ci.i(oe, "on error", c, Object.keys(i.Hc)), i.Yc || (i.Yc = i.Gc()), c.fatal) {
i.Ci.i(oe, "error. type: " + c.type + " details: " + c.details + " reason: " + c.reason);
for (var u = 0; u < i.Yc.actions.length; u++) {
var v = i.Yc.actions[u];
if (v) {
var R = i.Hc[v.type];
if (R != null && R.getAvailable()) {
var Q = i.Do.stat.coreType, se = R.run(c);
if (se)
return i.Ci.i(oe, "fallback run. type: " + v.type + " " + u + "/" + i.Yc.actions.length + ". reason: " + c.reason), c.preventFollowUp = !0, se.code = Object(L.d)(c.details, c.reason, c.statusCode), se.errorData = s()({}, c), se.core = Q, i.Do.evt.emit(w.a.RETRY, se), void i.Kc(u);
}
}
}
i.Ci.i(oe, "no fallback matched. reason: " + c.reason);
}
}, i.Do = t, i.Ci = t.logger, i.O.push(i.Do.evt.prependListener(w.a.ERROR, i.Di)), i;
}
y()(_, A);
var a = _.prototype;
return a.register = function(t, i) {
var c = this;
return this.Ci.i(oe, "register " + t + " " + i.constructor.name), this.Hc[t] && (this.Ci.i(oe, t + " existed."), this.O.destroyItem(i)), this.Hc[t] = i, this.O.push(i), { destroy: function() {
return c.unregisterAndDestroy(t);
} };
}, a.unregisterAndDestroy = function(t) {
var i = this.Hc[t];
return i && (this.O.destroyItem(i), i.destroy(), delete this.Hc[t], this.Ci.i(oe, "unregisterAndDestroy " + t)), this;
}, a.hasFallback = function(t) {
return !!this.Hc[t];
}, a.reset = function() {
for (var t in this.Ci.i(oe, "reset"), this.Hc)
this.unregisterAndDestroy(t);
this.Hc = {}, this.Yc = void 0;
}, a.stop = function() {
for (var t in this.Hc)
this.Hc[t].stop();
}, a.Kc = function(t) {
if (this.Yc) {
var i = this.Yc.actions[t];
!i || i.type !== le.SWAP_CORE && i.type !== le.NO_WORKER || (this.Zc(le.USE_BACKUP), this.Zc(le.USE_BACKUP_MULTIPART), this.Zc(le.FLV_LIVE_RELOAD));
}
}, a.Gc = function() {
this.Ci.i(oe, "generate fallback policy.");
var t = this.Do, i = ($.a.mobile, { core: t.stat.coreType, actions: [] });
return t.stat.coreType === h.a.mse ? i.actions.push({ type: le.RELOAD_WASM }, { type: le.FLV_LIVE_RELOAD }, { type: le.USE_BACKUP_MULTIPART }, { type: le.USE_BACKUP }, { type: le.NO_WORKER }, { type: le.DROP_V_FRAME }, { type: le.SWAP_REMUX_TYPE }, { type: le.SWAP_AUDIO_CODECSTR }, { type: le.SWAP_264 }, { type: le.NEXT_DESC }, { type: le.SWAP_WASM_DECODER }, { type: le.SWAP_CORE }) : t.stat.coreType === h.a.native && i.actions.push({ type: le.USE_BACKUP }, { type: le.SWAP_264 }, { type: le.NEXT_DESC }, { type: le.SWAP_CORE }, { type: le.RELOAD_WASM }, { type: le.FLV_LIVE_RELOAD }, { type: le.USE_BACKUP_MULTIPART }, { type: le.NO_WORKER }, { type: le.SWAP_REMUX_TYPE }, { type: le.SWAP_AUDIO_CODECSTR }, { type: le.SWAP_WASM_DECODER }), i;
}, a.Zc = function(t) {
var i;
(i = this.Hc[t]) == null || i.reset();
}, _;
}(F.a), Oe = function(A) {
function _() {
return A.apply(this, arguments) || this;
}
y()(_, A);
var a = _.prototype;
return a.run = function(t) {
if (this.getAvailable() && t.details === L.a.DECODER_INIT_ERROR && (this.Do.stat.wasmLibHitCache !== "none" || this.Do.stat.wasmThreadsEnabled))
return this.Ci.i("fallback-reload-wasm", "run"), this.Do.stat.wasmThreadsEnabled && (this.Do.stat.wasmThreadsEnabled = !1), this.Pc({ type: h.k.FALLBACK, message: "wasm lib init error. reload wasm.", fallback: le.RELOAD_WASM });
}, a.getAvailable = function() {
return !this.Uc && !$.a.mobile;
}, _;
}(ue);
function de() {
return typeof navigator > "u" ? 0 : navigator.hardwareConcurrency || 0;
}
var X = n(31);
function ge() {
return typeof window != "object" || typeof document != "object" || typeof document.createElement != "function";
}
var Pe = n(33), ae = n.n(Pe), q = n(13), m = n(48), ve = "canvas-renderer-wrapper", U = function() {
function A(a) {
var t = this;
if (this.Do = void 0, this.Ci = void 0, this.Ai = void 0, this.Wc = void 0, this.Xc = void 0, this.At = 0, this.Gu = 0, this.Na = void 0, this.zc = function(i) {
var c = i.data;
(c.event === w.a.RENDERER_DRAW || c.event === w.a.RENDERER_BUF_UPDATE) && (t.Gu = c.data.yuvBufLen), t.Xc && t.Ai.emit(c.event, c.data);
}, this.Jc = function(i) {
t.Do.logger.i(ve, "worker onerror", i.message), t.Ai.emit(w.a.ERROR, Object(L.e)(L.b.RENDERER_ERROR, L.a.DECODER_DEC_ERROR, "r: " + i.message));
}, this.Do = a, this.Ci = a.logger, this.Ai = a.evt, !a.cOutput)
throw new Error("canvas output undefined.");
this.Na = a.cOutput;
}
var _ = A.prototype;
return _.init = function(a) {
this.Ci.i(ve, "init renderer");
var t = this.Do.getDecConfig();
if (this.Na.canvas instanceof HTMLCanvasElement) {
if (a)
try {
var i;
this.Xc = ae()(58);
var c = this.Na.canvas.transferControlToOffscreen();
(i = this.Xc) == null || i.postMessage({ cmd: q.a.INIT_RENDERER, id: this.At, config: t, canvas: c, contextId: this.Do.id, hasExternalLogger: !!this.Do.config.logger }, [c]);
} catch (v) {
var u;
this.Ci.i(ve, "rendering worker startup failed.", v), (u = this.Xc) == null || u.terminate(), this.Xc = void 0;
}
this.Xc ? (this.Xc.addEventListener("message", this.zc), this.Xc.addEventListener("error", this.Jc)) : (this.Wc = new m.a(this.Ci, this.Ai), this.Wc.init(this.At, t, this.Na.canvas));
} else
this.Ai.emit(w.a.ERROR, Object(L.e)(L.b.RENDERER_ERROR, L.a.DECODER_UNSUPPORTED, "init error worker:" + !!this.Xc + " canvas:" + !!this.Na.canvas + " decoder:" + !!this.Wc));
}, _.destroy = function() {
this.Ci.i(ve, "destroy"), this.Xc ? (this.Xc.postMessage({ cmd: q.a.DESTROY }), this.Xc.removeEventListener("message", this.zc), this.Xc.removeEventListener("error", this.Jc), this.Xc.terminate()) : this.Wc && (this.Wc.destroy(), this.Wc = void 0);
}, _.step = function(a) {
this.Ci.i(ve, "step: " + a), this.Xc ? this.Xc.postMessage({ cmd: q.a.STEP, type: a }) : this.Wc && this.Wc.step(a);
}, _.updateMediaInfo = function(a) {
(this.Xc || this.Wc) && (this.Xc ? this.Xc.postMessage({ cmd: q.a.MEDIA_INFO, mediaInfo: a }) : this.Wc && this.Wc.updateMediaInfo(a));
}, _.seek = function(a, t) {
this.Ci.i(ve, "seek[" + t + "]: time: " + a), this.Xc ? this.Xc.postMessage({ cmd: q.a.SEEK, time: a, id: t }) : this.Wc && this.Wc.seek(a, t);
}, _.reset = function(a) {
a === void 0 && (a = !1), this.Gu = 0, this.Xc ? this.Xc.postMessage({ cmd: q.a.RESET, decId: this.At, seeking: a }) : this.Wc && this.Wc.reset(this.At, a);
}, _.append = function(a) {
this.Xc ? this.Xc.postMessage({ cmd: q.a.APPEND_DATA, frame: a }, [a.y.bytes.buffer, a.u.bytes.buffer, a.v.bytes.buffer]) : this.Wc && this.Wc.append(a);
}, _.update = function(a, t, i, c, u, v, R) {
this.Xc ? this.Xc.postMessage({ cmd: q.a.UPDATE_STATE, streamTime: a, width: t, height: i, stoped: c, output: u, maxFrameBufLen: v, pictMode: R }) : this.Wc && this.Wc.updateState(a, t, i, c, u, v, R);
}, _.endOfData = function() {
this.Xc ? this.Xc.postMessage({ cmd: q.a.END_OF_DATA }) : this.Wc && this.Wc.endOfData();
}, _.dropFrame = function(a) {
this.Xc ? this.Xc.postMessage({ cmd: q.a.DEC_DROP_FRAME, data: a }) : this.Wc && this.Wc.decDropFrameInfo(a);
}, _.screenshot = function(a) {
this.Xc ? this.Xc.postMessage({ cmd: q.a.SCREENSHOT, options: a }) : this.Wc && this.Wc.screenshot(a);
}, g()(A, [{ key: "isUseingWorker", get: function() {
return !!this.Xc;
} }, { key: "id", get: function() {
return this.At;
}, set: function(a) {
this.At = a;
} }, { key: "frameBufLen", get: function() {
return this.Gu;
} }]);
}(), M = [16, 24, 32], ne = function() {
function A() {
this.qc = [], this.$c = 0;
}
return A.prototype.onWaiting = function() {
this.qc.push(performance.now()), this.qc.length > 3 && this.qc.shift(), this.$c >= M.length - 1 || this.qc.length >= 3 && this.qc[this.qc.length - 1] - this.qc[0] < 15e3 && this.$c++;
}, g()(A, [{ key: "maxFrameBufLen", get: function() {
return M[this.$c] || M[M.length - 1] || M[0];
} }]);
}(), Le = "canvas-provider", Ue = function(A) {
function _(t) {
var i;
return (i = A.call(this) || this).Do = void 0, i.Ci = void 0, i.Ai = void 0, i.Sa = [], i.tf = !1, i.if = !0, i.zu = void 0, i.No = !1, i.ef = void 0, i.yt = { w: 0, h: 0 }, i.nf = !1, i.sf = void 0, i.rf = new ne(), i.Ra = function() {
var c;
i.tf && (c = i.Do.cOutput) != null && c.canvas && (i.hf(), requestAnimationFrame(i.Ra));
}, i.Do = t, i.Ci = t.logger, i.Ai = t.evt, i.sf = new U(t), i.O.push(i.sf), i;
}
y()(_, A);
var a = _.prototype;
return a.destroy = function() {
this.Sa = [], this.stop(), A.prototype.destroy.call(this);
}, a.setMediaInfo = function(t) {
this.Ci.i(Le, "setMediaInfo", t), this.Sa.push(t);
}, a.start = function() {
this.tf || (this.Ci.i(Le, "start loop"), this.tf = !0, requestAnimationFrame(this.Ra));
}, a.stop = function() {
this.Ci.i(Le, "stop loop"), this.tf = !1;
}, a.step = function(t) {
this.Ci.i(Le, "step type: " + t + "."), this.sf.step(t);
}, a.hf = function() {
}, a.af = function(t) {
var i = !1, c = (ge() ? 1 : window.devicePixelRatio) || 1, u = t.clientWidth * c, v = t.clientHeight * c;
return this.yt.w === u && this.yt.h === v || (this.yt.w = u, this.yt.h = v, i = !0), i;
}, g()(_, [{ key: "canvas", get: function() {
var t;
return (t = this.Do.cOutput) == null ? void 0 : t.canvas;
} }, { key: "waiting", get: function() {
return this.if;
} }, { key: "pausedOnWaiting", get: function() {
return this.ef;
}, set: function(t) {
this.ef = t;
} }]);
}(F.a), re = n(51), k = (n(50), "https://s2-10895.kwimgs.com/kos/nlav10895/"), P = { key: "kwai-deckvc30-lib", lib: k + "kvc30/9/libkvc30dec.wasm", libS: k + "kvc30/9/libkvc30dec-simd.wasm", libT: k + "kvc30/9/libkvc30dec-threads.wasm", libST: k + "kvc30/9/libkvc30dec-simd-threads.wasm", js: k + "kvc30/9/libkvc30dec.js", jsT: k + "kvc30/9/libkvc30dec-threads.js", jsST: k + "kvc30/9/libkvc30dec-simd-threads.js", jsW: k + "kvc30/9/libkvc30dec-threads.worker.js" }, Z = { key: "kwai-deckvc-lib", lib: k + "kvc/kvc-decoder-1.wasm", libS: k + "kvc/kvc-decoder-simd-1.wasm", libT: k + "kvc/kvc-decoder-threads-2.wasm", libST: k + "kvc/kvc-decoder-simd-threads-2.wasm", js: k + "kvc/kvc-decoder-1.js", jsT: k + "kvc/kvc-decoder-threads-2.js", jsST: k + "kvc/kvc-decoder-simd-threads-2.js", jsW: k + "kvc/kvc-decoder-threads-2.worker.js" }, he = { key: "kwai-deckvc4-lib", lib: k + "kvc4/kvc-decoder-1.wasm", libS: k + "kvc4/kvc-decoder-simd-1.wasm", libT: k + "kvc4/kvc-decoder-threads-1.wasm", libST: k + "kvc4/kvc-decoder-simd-threads-1.wasm", js: k + "kvc4/kvc-decoder-1.js", jsT: k + "kvc4/kvc-decoder-threads-1.js", jsST: k + "kvc4/kvc-decoder-simd-threads-1.js", jsW: k + "kvc4/kvc-decoder-threads-1.worker.js" }, Ie = { key: "kwai-deckvc6-lib", lib: k + "kvc6/kvc-decoder-2.wasm", libS: k + "kvc6/kvc-decoder-simd-2.wasm", libT: k + "kvc6/kvc-decoder-threads-2.wasm", libST: k + "kvc6/kvc-decoder-simd-threads-2.wasm", js: k + "kvc6/kvc-decoder-2.js", jsT: k + "kvc6/kvc-decoder-threads-2.js", jsST: k + "kvc6/kvc-decoder-simd-threads-2.js", jsW: k + "kvc6/kvc-decoder-threads-2.worker.js" }, Ee = { key: "kwai-kw265-lib", lib: k + "ks265/libks265dec-4.wasm", libS: k + "ks265/libks265dec-simd-4.wasm", libT: k + "ks265/libks265dec-threads-4.wasm", libST: k + "ks265/libks265dec-simd-threads-4.wasm", js: k + "ks265/libks265dec-4.js", jsT: k + "ks265/libks265dec-threads-4.js", jsST: k + "ks265/libks265dec-simd-threads-4.js", jsW: k + "ks265/libks265dec-threads-4.worker.js" }, pe = function() {
function A() {
this.timeout = 6048e5;
}
var _ = A.prototype;
return _.write = function(a, t) {
if (A.available)
try {
return localStorage.setItem(a, JSON.stringify({ value: t, time: Date.now() })), !0;
} catch (i) {
}
return !1;
}, _.read = function(a, t) {
if (t === void 0 && (t = !0), A.available)
try {
var i = localStorage.getItem(a);
if (i) {
var c = JSON.parse(i), u = c.value, v = c.time, R = v === void 0 ? 0 : v;
if (!t || Date.now() - R < (typeof t == "number" ? t : this.timeout))
return u;
}
} catch (Q) {
}
}, g()(A, null, [{ key: "available", get: function() {
if (A.ut === void 0)
try {
localStorage.setItem("alg", "test"), A.ut = !0;
} catch (a) {
A.ut = !1;
}
return A.ut;
} }]);
}();
pe.ut = void 0;
var G = pe, te = {}, ie = Ee, ee = {}, Te = "dec-lib-helper", Se = function() {
function A(a) {
this.Ci = void 0, this.uf = new G(), this.Ci = a, te[h.t.kvc3] = Z, te[h.t.kvc4] = he, te[h.t.kvc5] = Ie, te[h.t.kvc6] = Ie, te[h.t.kvc30] = P, te[h.t.kw265] = Ee;
}
var _ = A.prototype;
return _.getDecLibURL = function(a) {
return te[a] || ie;
}, _.getLsLibCacheKeys = function() {
var a = [], t = Object.keys(te).map(function(u) {
return te[u].key;
});
if (G.available)
for (var i = 0; i < localStorage.length; i++) {
var c = localStorage.key(i);
c && t.indexOf(c) >= 0 && a.push(c);
}
return a;
}, _.getMemLibCacheKeys = function() {
return Object.keys(ee);
}, _.saveToCache = function(a, t, i) {
if (i === void 0 && (i = !0), this.Ci.i(Te, "save to cache " + a + ". key: " + this.getDecLibURL(a).key + " ls: " + i), t.wasm.data && (ee[a] = t, i)) {
var c = { ts: Date.now(), js: s()({}, t.js), wasm: { url: t.wasm.url, data: re.Base64.fromUint8Array(t.wasm.data) } };
t.jsw && (c.jsw = s()({}, t.jsw));
var u = !1, v = 1;
do
this.cf(v, a), u = this.uf.write(this.getDecLibURL(a).key, c), this.getLsLibCacheKeys().length, v--;
while (!u && v >= 0);
}
}, _.loadFromCache = function(a, t) {
this.Ci.i(Te, "load from cache " + a + ".");
var i = ee[a];
if (i) {
if (this.Ci.i(Te, "hit cache " + a + ". mem"), this.ff(a, i, t))
return "mem";
delete ee[a];
}
var c = this.getDecLibURL(a), u = this.uf.read(c.key, !1);
return u && this.ff(a, u, t) ? (this.Ci.i(Te, "hit cache " + a + ". ls"), ee[a] = t, "ls") : "none";
}, _.removeMemCache = function() {
ee = {};
}, _.removeAllCache = function() {
this.Ci.i(Te, "remove all cache"), this.removeMemCache();
var a = this.getLsLibCacheKeys();
G.available && a.forEach(function(t) {
localStorage.removeItem(t);
});
}, _.ff = function(a, t, i) {
return t.js && t.js.data && t.js.url === i.js.url && (this.Ci.i(Te, "hit cache " + a + " js."), i.js.data = t.js.data), i.jsw && t.jsw && t.jsw.data && t.jsw.url === i.jsw.url && (this.Ci.i(Te, "hit cache " + a + " jsw."), i.jsw.data = t.jsw.data), t.wasm && t.wasm.data && t.wasm.url === i.wasm.url && (this.Ci.i(Te, "hit cache " + a + " wasm."), i.wasm.data = typeof t.wasm.data == "string" ? re.Base64.toUint8Array(t.wasm.data) : new Uint8Array(t.wasm.data)), !(!i.js.data || !i.wasm.data);
}, _.cf = function(a, t) {
var i = this;
if (this.Ci.i(Te, "remove ls Cache", a), G.available) {
var c = this.getLsLibCacheKeys();
if (c.length > a) {
var u = [], v = [];
c.forEach(function(Q) {
var se = i.uf.read(Q), fe = i.Af(se);
se && fe ? v.push({ key: Q, val: se }) : u.push(Q);
}), v.sort(function(Q, se) {
return Q.val.ts - se.val.ts;
});
for (var R = 0; R < v.length - a; R++)
u.push(v[R].key);
this.Ci.i(Te, "remove", u), u.forEach(function(Q) {
localStorage.removeItem(Q);
});
}
}
}, _.Af = function(a) {
return !!(a && typeof a == "object" && Object.prototype.hasOwnProperty.call(a, "ts") && typeof a.ts == "number" && Object.prototype.hasOwnProperty.call(a, "js") && typeof a.js == "object" && typeof a.js.data == "string" && Object.prototype.hasOwnProperty.call(a, "wasm") && typeof a.wasm == "object" && typeof a.wasm.data == "string");
}, A;
}(), Ye = n(23), ze = n.n(Ye), it = 0, ct = "loader", nt = function() {
function A(a) {
var t = this;
this.Ci = void 0, this.wc = void 0, this.vf = void 0, this.Ec = null, this.di = void 0, this.df = void 0, this.lf = void 0, this.bf = 0, this.pf = !1, this.mf = !1, this.gf = void 0, this.yf = void 0, this._f = void 0, this.Cf = void 0, this.If = 0, this.Ct = 0, this.Of = function() {
var i;
t.pf = !0, t.mf = !1;
var c = t.lf, u = t.wc;
(i = t.Ec) != null && i.onLoad && t.Ec.onLoad(u, c), c.code = 0, c.tfirst = 0, c.loaded = 0, t.wf(), t.vf = new (t.Ef())(t.Ci), c.type = t.vf instanceof Be ? I.c.FETCH : I.c.XHR, t.vf && (c.id = t.vf.tag + "-" + t.Ct, t.di.connectionTimeout && (t.gf = setTimeout(function() {
return t.jf(I.a.LOADER_CONNECT_TIMEOUT);
}, t.di.connectionTimeout)), t.kf(u), c.tsload = Date.now(), c.tstart = performance.now(), t.Ci.i(ct, "[" + t.Ct + "]load: " + t.vf.tag + " " + u.url + " progress: " + u.progress + " type: " + u.type + " responseType: " + u.responseType + " range: " + u.range), t.vf.load(u, t.df));
}, this.Mf = function(i, c) {
t.Sf();
var u = t.lf;
t.Bf(i, u), t.Tf(), u.code = c, u.tfirst = Math.max(u.trequest, performance.now()), t.Ci.i(ct, "[" + t.Ct + "]connect code: " + c + " len: " + u.contentLength + " totalLength: " + u.contentTotalLength), t.Ec && t.Ec.onConnect && t.Ec.onConnect(i, u), typeof i.rangeStart == "number" && i.rangeStart > 0 && u.code !== 206 && t.Ec && t.Ec.onError && setTimeout(function() {
t.Di(new Error("range error. " + i.range + " statu code:" + u.code));
}, 0);
}, this.Mc = function(i, c) {
try {
var u = t.lf;
if (t.If = performance.now(), !i.breakpointContinuation && u.output > u.loaded) {
if (u.loaded + c.byteLength - u.output > 0) {
var v = c.slice(u.output - u.loaded);
t.Df(t.wc, v, u);
}
u.loaded += c.byteLength;
} else
u.loaded += c.byteLength, t.Df(t.wc, c, u);
} catch (R) {
t.Ci.i(ct, "handling data error. ", R), t.Di(new Error(I.a.HANDLING_DATA_ERROR + ". " + R));
}
}, this.Di = function(i) {
t.Rf(), t.Lf();
var c, u = t.lf, v = t.di, R = t.wc, Q = u.type === I.c.FETCH && R.monkeyPatched && R.preferNative === void 0;
t.pf = !1, t.Ci.i(ct, "[" + t.Ct + "]error: " + i.name + " " + (i == null ? void 0 : i.message) + " code: " + u.code + " retry: " + u.retry + "/" + v.maxRetry + " " + (Q ? "monkeyPatchedFetch" : "")), t.wc.breakpointContinuation && u.code === 416 || Q && t.lf.output === u.loaded && u.loaded > 0 ? (c = t.Ec) != null && c.onEnd && t.Ec.onEnd(t.wc, null, u) : (u.fatal = !v.maxRetry || u.retry >= v.maxRetry || !v.maxRetry, u.errName = i.name, u.errMessage = i.name + ": " + i.message + ". status: " + u.code, Q && (i.name === I.b.FETCH_READ_ERROR_NAME && !t.lf.loaded || i.message === I.a.LOADER_TRANS_TIMEOUT && !t.lf.loaded || i.message === I.a.LOADER_CONNECT_TIMEOUT || !t.lf.code) && (t.wc.preferNative = !0, t.Ci.i(ct, "monkey patched fetch error. switch to native fetch.")), t.Ec && t.Ec.onError && t.Ec.onError(t.wc, u), u.fatal || (v.breakpointContinuation && t.lf.contentTotalLength && (t.Ci.i(ct, "[" + t.Ct + "]breakpointContinuation. " + t.lf.loaded + " / " + t.lf.contentTotalLength), t.lf.output && t.lf.loaded > 0 ? (t.Cf ? t.wc.rangeStart = t.Cf + t.lf.output : t.wc.rangeStart = t.lf.output, t.wc.breakpointContinuation = !0) : (t.wc.rangeStart = t.Cf, t.wc.breakpointContinuation = !1)), u.retry++, t.Ec && (t.bf ? (t._f = setTimeout(t.Of, t.bf), t.bf = 2 * t.bf) : t.Of())));
}, this.jf = function(i) {
t.pf = !1, t.Nf();
var c = new Error(i);
t.Di(c);
}, this.Ci = a, this.Ct = it += 1, this.Ci.i(ct, "[" + this.Ct + "]constructor"), this.vf = null, this.di = { connectionTimeout: 0, transmissionTimeout: 0, maxRetry: 0, retryDelay: 0 }, this.df = { onConnect: this.Mf, onProgress: this.Mc, onEnd: this.xc.bind(this), onError: this.Di };
}
var _ = A.prototype;
return _.Ef = function() {
return A.Qf !== void 0 || (A.Qf = B, $.a.msie || $.a.msedge ? B.isSupportChunk() ? A.Qf = B : Be.isSupported() && (A.Qf = Be) : Be.isSupported() ? A.Qf = Be : B.isSupportChunk() && (A.Qf = B)), A.Qf;
}, _.load = function(a, t, i) {
this.fa(a, t, i), this.Of();
}, _.destroy = function() {
this.vf && this.Ci.i(ct, "[" + this.Ct + "]destroy."), this.Rf(), this.Nf(!1), this.Lf(), this.Ec = null;
}, _.abort = function() {
this.Ci.i(ct, "[" + this.Ct + "]abort"), this.Rf(), this.Nf();
}, _.fa = function(a, t, i) {
this.wc = a, this.Cf = a.rangeStart, this.Ec = t, this.di = i || this.di, this.lf = { id: "", type: I.c.UNKNOWN, trequest: performance.now(), retry: 0, loaded: 0, code: 0, output: 0, tfirst: 0, tload: 0, total: 0, tsload: 0, tstart: 0, fatal: !1, errName: "", errMessage: "" }, this.di.retryDelay && (this.bf = this.di.retryDelay);
}, _.Lf = function() {
this.vf && (this.vf.destroy(), this.vf = null);
}, _.Nf = function(a) {
a === void 0 && (a = !0), a && this.Ec && this.Ec.onAbort && !this.mf && this.pf && this.Ec.onAbort(this.wc, this.lf), this.mf = !0, this.vf && this.vf.abort();
}, _.Rf = function() {
this.Sf(), this.wf(), this.xf();
}, _.Df = function(a, t, i) {
this.lf.output += t.byteLength, this.Ec && this.Ec.onProgress && this.Ec.onProgress(a, t, i);
}, _.xc = function(a, t) {
this.Rf();
var i = this.lf;
this.Bf(a, i), i.total = t ? i.loaded = typeof t == "string" ? t.length || 0 : t.byteLength || 0 : i.loaded, i.tload = Math.max(i.tfirst, performance.now()), this.pf = !1, i.output = 0, this.Ci.i(ct, "[" + this.Ct + "]end size: " + i.total + " duration: " + i.trequest + "-" + i.tload), this.Ec && this.Ec.onEnd(a, t, i);
}, _.Tf = function() {
var a = this;
this.xf(), this.If = performance.now();
var t = this.di.transmissionTimeout || 0;
t && (this.yf = setInterval(function() {
performance.now() - a.If > t && a.jf(I.a.LOADER_TRANS_TIMEOUT);
}, 1e3));
}, _.xf = function() {
this.yf && (clearInterval(this.yf), this.yf = void 0);
}, _.Sf = function() {
this.gf && (clearTimeout(this.gf), this.gf = void 0);
}, _.wf = function() {
this._f && (clearTimeout(this._f), this._f = void 0);
}, _.kf = function(a) {
if (a.rangeEnd || a.rangeStart)
if (a.rangeType && a.rangeType !== h.e.STANDARD && typeof a.url == "string") {
var t = new ze.a(a.url, !0);
a.rangeEnd ? (t.query.start = (a.rangeStart || 0).toString(), t.query.end = (a.rangeEnd - 1).toString()) : a.rangeStart && (t.query.start = a.rangeStart.toString()), a.url = t.toString();
} else
a.rangeEnd ? a.range = "bytes=" + (a.rangeStart || 0) + "-" + (a.rangeEnd - 1) : a.rangeStart && (a.range = "bytes=" + a.rangeStart + "-");
}, _.Bf = function(a, t) {
if (!t.contentTotalLength || !t.contentLength) {
var i = a.responseHeader;
if (i) {
if (a.range || typeof a.rangeStart == "number") {
var c = i["content-range"];
c && (t.contentTotalLength = parseInt((Array.isArray(c) ? c[0] || "0" : c).split("/")[1] || "0") || 0);
}
var u = i["content-length"];
u && (t.contentLength = parseInt(Array.isArray(u) ? u[0] || "0" : u) || 0);
}
}
}, g()(A, [{ key: "context", get: function() {
return this.wc;
} }, { key: "config", get: function() {
return this.di;
} }]);
}();
nt.Qf = void 0;
var zt = "dec-lib-loader", bt = function() {
function A(a) {
var t = this;
this.Vf = h.t.kw265, this.Do = void 0, this.Ci = void 0, this.Uf = void 0, this.Ff = void 0, this.Pf = void 0, this.Hf = 0, this.Bo = void 0, this.Yf = function(i, c) {
c.fatal && (t.Lf(), t.Do.evt.emit(w.a.ERROR, Object(L.e)(L.b.NETWORK_ERROR, L.a.DEC_LIB_LOAD_ERROR, c.errMessage, { statusCode: c.code, url: i.url })));
}, this.Do = a, this.Ci = a.logger, this.Bo = new Se(a.logger);
}
var _ = A.prototype;
return _.load = function(a, t, i, c) {
this.Ci.i(zt, "load ignoreCache: " + a + " decoderType: " + t + " simd: " + i + ", threads: " + c), this.Hf = performance.now(), this.Vf = t;
var u = this.Bo.getDecLibURL(this.Vf), v = u.js, R = "", Q = u.lib;
c && u.jsW && (i && u.libST && u.jsST ? (Q = u.libST, v = u.jsST, R = u.jsW) : u.libT && u.jsT ? (Q = u.libT, v = u.jsT, R = u.jsW) : c = !1), i && !c && u.libS && (Q = u.libS);
var se, fe = { js: { url: v, data: "" }, wasm: { url: Q } };
R && (fe.jsw = { url: R, data: "" }), a || (se = this.Bo.loadFromCache(this.Vf, fe)), this.Ci.i(zt, "wasm: " + Q + " cacheType: " + se), this.Gf(fe, se) || (fe.js.data || this.Kf(fe), fe.wasm.data || this.Zf(fe), fe.jsw && !fe.jsw.data && this.Wf(fe));
}, _.destroy = function() {
this.Lf();
}, _.Lf = function() {
this.Xf(), this.zf(), this.Jf();
}, _.Gf = function(a, t) {
t === void 0 && (t = "none");
var i = !!(a.js.data && a.wasm.data && (!a.jsw || a.jsw && a.jsw.data));
if (t !== "mem" && i && this.Bo.saveToCache(this.Vf, a, t === "none"), i) {
this.Ci.i(zt, "dec lib loaded", t);
var c = { lib: a, hitCache: t, duration: performance.now() - this.Hf };
this.Do.evt.emit(w.a.DEC_LIB_LOADED, c);
}
return i;
}, _.Zf = function(a) {
var t = this;
this.Ci.i(zt, "load wasm"), this.Xf();
var i = this.Uf = new nt(this.Ci), c = { onError: this.Yf, onEnd: function(R, Q) {
Q instanceof ArrayBuffer && (a.wasm.data = new Uint8Array(Q), t.Gf(a));
} }, u = { connectionTimeout: this.Do.config.decLibConnectionTimeout, maxRetry: this.Do.config.decLibLoadingMaxRetry, retryDelay: this.Do.config.decLibLoadingRetryDelay }, v = { url: a.wasm.url, responseType: "arraybuffer", progress: !1, preferNative: this.Do.stat.preferNativeLoader };
i.load(v, c, u);
}, _.Kf = function(a) {
var t = this;
this.Ci.i(zt, "load js"), this.zf();
var i = this.Ff = new nt(this.Ci), c = { onError: this.Yf, onEnd: function(R, Q) {
typeof Q == "string" && (a.js.data = Q, t.Gf(a));
} }, u = { connectionTimeout: this.Do.config.decLibConnectionTimeout, maxRetry: this.Do.config.decLibLoadingMaxRetry }, v = { url: a.js.url, responseType: "text", progress: !1, preferNative: this.Do.stat.preferNativeLoader };
i.load(v, c, u);
}, _.Wf = function(a) {
var t = this;
if (this.Ci.i(zt, "load jsw"), this.Jf(), a.jsw) {
var i = this.Pf = new nt(this.Ci), c = { onError: this.Yf, onEnd: function(R, Q) {
typeof Q == "string" && (a.jsw && (a.jsw.data = Q), t.Gf(a));
} }, u = { connectionTimeout: this.Do.config.decLibConnectionTimeout, maxRetry: this.Do.config.decLibLoadingMaxRetry }, v = { url: a.jsw.url, responseType: "text", progress: !1, preferNative: this.Do.stat.preferNativeLoader };
i.load(v, c, u);
}
}, _.Xf = function() {
this.Uf && this.Uf.destroy();
}, _.zf = function() {
this.Ff && this.Ff.destroy();
}, _.Jf = function() {
this.Pf && this.Pf.destroy();
}, A;
}(), Mt = n(21);
function Kt() {
var A, _, a;
if (!ge())
return ((A = window) == null ? void 0 : A.ManagedMediaSource) || ((_ = window) == null ? void 0 : _.MediaSource) || ((a = window) == null ? void 0 : a.WebKitMediaSource);
}
function Xt() {
var A, _, a;
if (!ge())
return ((A = window) == null ? void 0 : A.ManagedSourceBuffer) || ((_ = window) == null ? void 0 : _.SourceBuffer) || ((a = window) == null ? void 0 : a.WebKitSourceBuffer);
}
var ni = function(A) {
function _() {
return A.apply(this, arguments) || this;
}
return y()(_, A), _.prototype.run = function(a) {
if (this.getAvailable() && (this.Do.stat.coreType === h.a.mse && a.type === L.b.NETWORK_ERROR && a.details !== L.a.DEC_LIB_LOAD_ERROR && a.details !== L.a.KEY_SYSTEM_LICENSE_REQUEST_FAILED && !this.Do.stat.multipart || this.Do.stat.coreType === h.a.native && a.details !== L.a.KEY_SYSTEM_UNSUPPORTED)) {
var t = this.Do.lctx.current;
if (t && t.urlId < t.url.length - 1)
return this.Ci.i("fallback-backup", "run"), t.urlId++, this.Pc({ type: h.k.BACKUP, message: "trans error. use backup url.", fallback: le.USE_BACKUP });
}
}, _;
}(ue), wt = n(39);
function pt(A, _) {
return _ ? wt.a.search(_, function(a) {
return A < a.start ? -1 : A > a.start + a.duration ? 1 : 0;
}) : null;
}
function ri(A, _) {
return _ ? wt.a.searchIndex(_, function(a) {
return A < a.start ? -1 : A > a.start + a.duration ? 1 : 0;
}) : -1;
}
function yi(A) {
if (A) {
var _ = A.toLocaleLowerCase();
return _.indexOf("audio") >= 0 ? h.o.AUDIO : _.match(/(video|sps|pps|VTDecompression)/i) ? h.o.VIDEO : void 0;
}
}
var Li = "fallback-drop-v-frame", vi = function(A) {
function _() {
for (var t, i = arguments.length, c = new Array(i), u = 0; u < i; u++)
c[u] = arguments[u];
return (t = A.call.apply(A, [this].concat(c)) || this).qf = 0, t;
}
y()(_, A);
var a = _.prototype;
return a.run = function(t) {
var i = yi(t.reason);
if (this.getAvailable() && i === h.o.VIDEO && t.details === L.a.VIDEO_ERROR_3) {
var c, u, v = this.Do;
this.Ci.i(Li, "run"), this.qf++;
var R = v.streamTime.getKeyFrameTime(v.currentTime), Q = (c = v.lctx.current) == null ? void 0 : c.dropVideo, se = v.stat.multipart ? (u = pt(v.currentTime, v.lctx.current.fragments)) == null ? void 0 : u.sn : -1;
if (typeof se != "number" || !Q)
return;
if (R) {
for (var fe = 0; fe < Q.length; fe++) {
var ke, Fe, Ne;
if (se >= 0 && se === ((ke = Q[fe]) == null ? void 0 : ke.fragSn) && ((Fe = Q[fe]) == null ? void 0 : Fe.keyframePTS) === R.originPTS || ((Ne = Q[fe]) == null ? void 0 : Ne.keyframePTS) === R.originPTS)
return;
}
var He = { time: v.currentTime, keyframePTS: R.originPTS, fragSn: se >= 0 ? se : void 0, mode: "keyframesOnly" }, rt = "video dec err: " + t.details + " @" + He.time + " drop v sample after key pts: " + He.keyframePTS + ".";
return this.Ci.i(Li, rt), Q.push(He), this.Pc({ type: h.k.FALLBACK, message: rt, fallback: le.DROP_V_FRAME });
}
}
}, a.reset = function() {
return this.Ci.i(Li, "reset"), this.qf = 0, A.prototype.reset.call(this), this;
}, a.getAvailable = function() {
return !(!(this.Fc && this.qf < this.Do.config.mseDecErrSkip) || this.Do.stat.isLive === !0 && this.Do.stat.box === h.i.flv);
}, _;
}(ue), Ui = "fallback-flv-live-reload", xt = function(A) {
function _() {
for (var t, i = arguments.length, c = new Array(i), u = 0; u < i; u++)
c[u] = arguments[u];
return (t = A.call.apply(A, [this].concat(c)) || this).$f = void 0, t.qf = 0, t;
}
y()(_, A);
var a = _.prototype;
return a.run = function(t) {
if (this.Fc && t.type === L.b.NETWORK_ERROR && t.details !== L.a.DEC_LIB_LOAD_ERROR && t.details !== L.a.KEY_SYSTEM_LICENSE_REQUEST_FAILED && this.Do.stat.isLive !== !1 && this.Do.stat.box === h.i.flv && this.getAvailable())
return this.Ci.i(Ui, "run"), this.tA(Math.max(this.Do.config.retryDelay, 1e3 * this.Do.bufferedSec), t, this.Fc), { type: h.k.LOADER, message: "live flv network error reason: " + (t == null ? void 0 : t.reason) + ". retry: " + this.qf + ". reload", fallback: le.FLV_LIVE_RELOAD };
}, a.reset = function() {
return this.Ci.i(Ui, "reset"), this.iA(), this.qf = 0, A.prototype.reset.call(this), this;
}, a.stop = function() {
return this.iA(), this;
}, a.destroy = function() {
this.iA();
}, a.getAvailable = function() {
return this.qf < this.Do.config.maxRetry;
}, a.tA = function(t, i, c) {
var u = this;
this.$f || (this.$f = setTimeout(function() {
u.Ci.i(Ui, "live retry:" + u.qf), u.qf++, c(), u.$f = void 0;
}, t));
}, a.iA = function() {
this.$f && (this.Ci.i(Ui, "clear retry delay timer."), clearTimeout(this.$f), this.$f = void 0);
}, _;
}(ue), Ct = function(A) {
function _() {
return A.apply(this, arguments) || this;
}
return y()(_, A), _.prototype.run = function(a) {
if (this.getAvailable() && a.details === L.a.REMUX_WORKER_ERROR && this.Do.stat.webWorker)
return this.Ci.i("fallback-no-worker", "remux worker error. close worker and retry."), this.Do.stat.webWorker = !1, this.Pc({ type: h.k.FALLBACK, message: "remux worker error. close worker", fallback: le.NO_WORKER });
}, _;
}(ue), Di = function(A) {
function _() {
return A.apply(this, arguments) || this;
}
return y()(_, A), _.prototype.run = function(a) {
var t = this.Do.stat.audioCodec, i = yi(a.reason);
if (this.getAvailable() && (!i || i === h.o.AUDIO) && (a.details === L.a.VIDEO_ERROR || a.details === L.a.VIDEO_ERROR_3) && !this.Do.stat.recoverSwapAudioCodec && t)
return this.Ci.i("fallback-swap-audio-codec-str", "run"), t = t.indexOf("mp4a.40.5") !== -1 ? "mp4a.40.2" : "mp4a.40.5", this.Do.stat.audioCodec = t, this.Do.stat.recoverSwapRemux = !0, this.Pc({ type: h.k.FALLBACK, message: "video error: " + a.details + ". change audio codec: " + t + ".", fallback: le.SWAP_AUDIO_CODECSTR });
}, _;
}(ue), Dt = function(A) {
function _() {
return A.apply(this, arguments) || this;
}
return y()(_, A), _.prototype.run = function(a) {
var t = yi(a.reason);
if (this.getAvailable() && (!t || t === h.o.VIDEO) && !this.Do.stat.recoverSwapRemux && (a.details === L.a.VIDEO_ERROR || a.details === L.a.VIDEO_ERROR_3))
return this.Ci.i("fallback-swap-remux", "run"), this.Do.stat.recoverSwapRemux = !0, this.Do.stat.box === h.i.flv && this.Do.stat.isLive ? this.Do.stat.gopRemux = !0 : this.Do.streamingMuxEnabled = !1, this.Pc({ type: h.k.FALLBACK, message: "video error: " + a.details + ". change remux type.", fallback: le.SWAP_REMUX_TYPE });
}, _;
}(ue), yt = function(A) {
function _() {
return A.apply(this, arguments) || this;
}
y()(_, A);
var a = _.prototype;
return a.run = function(t) {
if (this.getAvailable() && is && (t.details === L.a.VIDEO_ERROR || t.details === L.a.VIDEO_ERROR_3 || t.details === L.a.VIDEO_ERROR_4 || t.details === L.a.VIDEO_NO_SIZE) && this.Do.stat.codecType === h.c.hevc && this.Do.stat.decoder === h.d.buildin && this.Do.config.wasmDecoderEnabled && ht.TYPE_SUPPORTED.hevc && !$.a.mobile)
return this.Ci.i("fallback-wasm-decoder", "run"), this.Do.lctx.levels.forEach(function(i) {
return i.dropVideo = [];
}), this.Do.resetStreamingEnabled(), this.Do.stat.hevcFallbackWasm = !0, this.Pc({ type: h.k.FALLBACK, message: "buildin " + (ht.isSupportHW ? "hardware" : "software") + " hevc dec error. video error: " + t.details + ". use wasm decoder.", fallback: le.SWAP_WASM_DECODER });
}, a.getAvailable = function() {
return !this.Uc && !$.a.mobile;
}, _;
}(ue), Pt = n(34), ei = n(12);
function ki() {
return document.hidden || document.webkitHidden || document.mozHidden || !0;
}
function Br(A) {
var _;
performance.addEventListener && (_ = A, performance && (typeof performance.setResourceTimingBufferSize == "function" ? performance.setResourceTimingBufferSize(_) : typeof performance.webkitSetResourceTimingBufferSize == "function" && performance.webkitSetResourceTimingBufferSize(_)), performance.addEventListener("resourcetimingbufferfull", bi));
}
function mi() {
performance.removeEventListener && performance.removeEventListener("resourcetimingbufferfull", bi);
}
var bi = function() {
performance && (typeof performance.clearResourceTimings == "function" ? performance.clearResourceTimings() : typeof performance.webkitClearResourceTimings == "function" && performance.webkitClearResourceTimings());
}, fr = n(44), mt = function(A) {
return A[A.NONE = 0] = "NONE", A[A.WAITING = 1] = "WAITING", A[A.SEEK = 2] = "SEEK", A[A.SELECT_BITRATE = 3] = "SELECT_BITRATE", A[A.INIT = 4] = "INIT", A[A.LOADING = 5] = "LOADING", A;
}({}), jt = "kernel-base", Qr = function(A) {
function _(t) {
var i;
if ((i = A.call(this) || this).Do = void 0, i.Ci = void 0, i.eA = void 0, i.nA = void 0, i.sA = void 0, i.Io = mt.INIT, i.Sa = void 0, i.rA = 0, i.hA = [], i.oA = void 0, i.aA = void 0, i.uA = !1, i.pa = void 0, !t.video)
throw new Error("video is null");
return i.Do = t, i.Ci = t.logger, i.eA = t.video, i.aA = { loadedmetadata: i.cA.bind(i), loadeddata: i.fA.bind(i), canplay: i.AA.bind(i), seeking: i.vA.bind(i), seeked: i.dA.bind(i), waiting: i.lA.bind(i), playing: i.bA.bind(i), pause: i.pA.bind(i), play: i.mA.bind(i), error: i.gA.bind(i), ended: i.yA.bind(i), ratechange: i._A.bind(i), durationchange: i.CA.bind(i), timeupdate: i.IA.bind(i), progress: i.OA.bind(i), emptied: i.wA.bind(i), resize: i.EA.bind(i) }, i.jA(), i;
}
y()(_, A);
var a = _.prototype;
return a.destroy = function() {
this.Ci.i(jt, "destroy"), this.uA = !1, this.kA(), this.MA(), A.prototype.destroy.call(this);
}, a.getTrackBufInfo = function() {
}, a.load = function() {
this.eA.load();
}, a.resume = function() {
var t, i = this;
this.eA.paused && ((t = this.eA.play()) == null || t.catch(function(c) {
return i.Ci.i(jt, "resume, call play() fail.", c);
}));
}, a.refresh = function() {
}, a.stopLoad = function() {
}, a.SA = function() {
var t = this.Sa && this.Sa.fps ? this.Sa.fps : 30;
return this.eA.duration && !this.eA.ended ? this.eA.currentTime + 1 / t : -1;
}, a.BA = function() {
var t = this.Sa && this.Sa.fps ? this.Sa.fps : 30;
return this.eA.duration && this.eA.currentTime - 1 / t >= 0 ? this.eA.currentTime - 1 / t : -1;
}, a.jA = function() {
if (this.eA)
for (var t in this.aA)
this.eA.addEventListener(t, this.aA[t]);
}, a.MA = function() {
if (this.eA)
for (var t in this.aA)
this.eA.removeEventListener(t, this.aA[t]);
}, a.cA = function() {
this.Ci.i(jt, "loadedmetadata"), this.emit(w.a.LOADEDMETADATA);
}, a.fA = function() {
this.Ci.i(jt, "loadeddata"), this.emit(w.a.LOADEDDATA);
}, a.AA = function() {
this.Ci.i(jt, "canplay " + !!this.Io), this.emit(w.a.CANPLAY);
}, a.vA = function() {
this.Ci.i(jt, "seeking " + this.eA.currentTime), this.emit(w.a.SEEKING);
}, a.dA = function() {
this.Ci.i(jt, "seeked"), this.emit(w.a.SEEKED);
}, a.lA = function() {
this.Ci.i(jt, "video waiting");
}, a.bA = function() {
this.Ci.i(jt, "playing"), this.nA || (this.Io = mt.NONE, this.TA(), this.emit(w.a.PLAYING));
}, a.pA = function() {
this.Ci.i(jt, "pause. seeking: " + this.eA.seeking), this.eA.ended || this.emit(w.a.PAUSE);
}, a.mA = function() {
this.Ci.i(jt, "play", this.nA), this.emit(w.a.PLAY), $.a.safari && this.eA.currentTime >= this.eA.duration && this.eA.loop && (this.Ci.i(jt, "safari loop fix. seek 0. loop: " + this.eA.loop + " " + this.eA.currentTime + "/" + this.eA.duration + "."), this.eA.currentTime = 0);
}, a.gA = function(t) {
this.Ci.i(jt, "error", t);
}, a.yA = function() {
this.Ci.i(jt, "ended"), this.uA = !1, this.emit(w.a.ENDED), this.kA();
}, a._A = function() {
this.Ci.i(jt, "ratechange " + this.eA.playbackRate), this.emit(w.a.RATE_CHANGE);
}, a.CA = function() {
this.Ci.i(jt, "durationchange " + this.eA.duration), this.emit(w.a.DURATION_CHANGE);
}, a.IA = function() {
this.emit(w.a.TIMEUPDATE);
}, a.OA = function() {
this.emit(w.a.PROGRESS);
}, a.wA = function() {
this.Ci.i(jt, "video emptied");
}, a.EA = function() {
this.Ci.i(jt, "video resize");
}, a.DA = function() {
this.emit(w.a.HEARTBEAT);
}, a.TA = function() {
this.sA || (this.sA = setInterval(this.DA.bind(this), Ve.i));
}, a.kA = function() {
this.sA && (clearInterval(this.sA), this.sA = void 0);
}, a.RA = function(t) {
this.uA = !1;
}, a.emit = function(t, i) {
if (t === w.a.ERROR) {
var c = i;
c.fatal && (this.nA = c), this.Ci.i(jt, "error", c);
}
return this.Do.evt.emit(t, i);
}, a.internalSeek = function(t) {
this.uA = !0;
try {
this.eA.currentTime = t;
} catch (i) {
this.Ci.i(jt, "internal seek err.", i);
}
}, a.screenshot = function(t) {
var i = 1e3 * this.eA.currentTime;
if (this.eA instanceof HTMLVideoElement && this.eA.videoWidth) {
this.pa || (this.pa = new fr.a(this.Ci), this.O.push(this.pa));
var c = this.pa.copyImageData(this.eA, void 0, 0, t == null ? void 0 : t.colorSpace);
c && this.emit(w.a.SCREENSHOT, { pts: i, id: t == null ? void 0 : t.id, image: c });
} else
this.emit(w.a.SCREENSHOT, { pts: i, id: t == null ? void 0 : t.id, errorCode: L.a.SCREENSHOT_CREATE_IMG_ERROR, errorMessage: "no video" });
}, g()(_, [{ key: "type", get: function() {
return h.a.unknown;
} }]);
}(F.a), $t = function() {
function A(a) {
this.Do = void 0, this.LA = 0, this.Do = a, this.Do.logger.i("auto-lazyload", a.stat.autoLazyLoad, a.stat.lazyLoadMaxDuration, a.stat.lazyLoadRecoverDuration);
}
var _ = A.prototype;
return _.update = function() {
var a = this.Do.lctx.current;
!this.Do.stat.isLive && this.Do.stat.autoLazyLoad && a && (a.maxBitrate || a.bitrate || this.Do.loadRec.currentLoad) && (this.NA(a, 8 * this.Do.loadRec.smoothedDownloadSpeed / 1e3), this.checkStreamingMux());
}, _.checkStreamingMux = function() {
var a, t = this.Do, i = this.Do.stat;
if (i.box === h.i.flv && i.isLive)
t.streamingMux = !0;
else {
var c = t.bufferedSec + (((a = t.mse) == null ? void 0 : a.getBufferQueueSec()) || 0), u = this.QA();
if (i.lazyLoadRecoverDuration <= u.min + 1e-3) {
var v = i.multipart ? this.xA() : this.VA();
Number.isFinite(this.LA) && this.LA > 0 ? t.streamingMux = !(v && v / this.LA * 2 < c) : t.streamingMux = !(v && v / 2 < c);
} else
t.streamingMux = c < i.lazyLoadRecoverDuration + (i.lazyLoadMaxDuration - i.lazyLoadRecoverDuration) / 2;
}
}, _.NA = function(a, t) {
var i = this.Do, c = 0;
if (a.maxBitrate)
c = t / a.maxBitrate;
else if (a.bitrate)
c = t / (1.5 * a.bitrate);
else if (i.loadRec.currentLoad) {
var u = i.loadRec.currentLoad.audioDataRate + i.loadRec.currentLoad.videoDataRate;
if (!u)
return;
c = t / (1.5 * u);
}
c /= Math.max(1, i.playbackRate), this.LA = c;
var v = this.QA();
c > 5 ? this.UA(Math.max(v.min, i.stat.lazyLoadMaxDuration - 2)) : c < 3 && this.UA(Math.min(v.max, i.stat.lazyLoadMaxDuration + 2));
}, _.UA = function(a) {
this.Do.stat.lazyLoadMaxDuration = a, this.Do.stat.lazyLoadRecoverDuration = 0.8 * this.Do.stat.lazyLoadMaxDuration;
}, _.QA = function() {
var a = 16, t = 30;
if (this.Do.stat.multipart) {
var i = this.xA();
i && (a = Math.max(16, 3 * i), t = Math.max(30, 5 * i));
}
return { min: a, max: t };
}, _.VA = function() {
var a = this.Do.lctx.current;
if (a) {
var t = 8 * Ve.e / 1e3, i = a.maxBitrate || 1.5 * a.bitrate || 0;
if (i)
return t / i;
}
return 0;
}, _.xA = function() {
var a = this.Do;
if (a.stat.multipart) {
var t = a.lctx.current;
if (t)
return t.targetduration || t.averagetargetduration || 0;
}
return 0;
}, g()(A, [{ key: "streamingMuxThreshold", get: function() {
var a = this.Do.stat;
if (a.box === h.i.flv && a.isLive)
return 0;
var t = this.QA();
return a.lazyLoadRecoverDuration <= t.min + 1e-3 ? 0 : a.lazyLoadRecoverDuration + (a.lazyLoadMaxDuration - a.lazyLoadRecoverDuration) / 2;
} }]);
}(), si = function(A) {
return A.WIDEVINE = "com.widevine.alpha", A.PLAYREADY = "com.microsoft.playready", A.FAIRPLAY = "com.apple.fairplay", A;
}({}), Vr = function(A) {
return A.WIDEVINE = "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed", A;
}({}), ir = !ge() && window.navigator && window.navigator.requestMediaKeySystemAccess ? window.navigator.requestMediaKeySystemAccess.bind(window.navigator) : void 0, Zt = "eme", Dn = function() {
function A(a) {
var t = this;
this.Do = void 0, this.Ci = void 0, this.FA = { audioRobustness: "SW_SECURE_CRYPTO", videoRobustness: "SW_SECURE_DECODE" }, this.PA = [], this.HA = !1, this.vf = void 0, this.YA = void 0, this.GA = void 0, this.KA = "", this.ZA = [], this.WA = function(i) {
if (t.Ci.i(Zt, 'Media is encrypted using "' + i.initDataType + '" init data type'), !t.GA && t.ZA.length && i.initDataType === "cenc" && i.initData && (t.KA = t.KA || t.Do.config.widevineLicenseUrl, t.XA(si.WIDEVINE, t.ZA)), !t.GA)
return t.Ci.i(Zt, "Fatal: Media is encrypted but no CDM access or no keys have been requested"), void t.zA(Object(L.e)(L.b.KEY_SYSTEM_ERROR, L.a.KEY_SYSTEM_NO_KEYS, "media is encrypted but no CDM access or no keys have been requested"));
var c = function(u) {
t.Do.video && (t.JA(u), t.qA(i.initDataType, i.initData));
};
t.GA.then(c).catch(c);
}, this.$A = function(i) {
var c = i.target;
t.tv(i.message, c);
}, this.Yf = function(i, c) {
c.fatal && t.zA(Object(L.e)(L.b.NETWORK_ERROR, L.a.KEY_SYSTEM_LICENSE_REQUEST_FAILED, c.errMessage, { statusCode: c.code }));
}, this.ev = function() {
return !!($.a.chrome && $.a.version.major >= 68 || $.a.firefox || $.a.msedge && $.a.version.major >= 88);
}, this.zA = function(i) {
t.Do.evt.emit(w.a.ERROR, i);
}, this.Do = a, this.Ci = a.logger, a.video && a.video.addEventListener("encrypted", this.WA), this.YA = { maxRetry: a.config.keyLoadingMaxRetry, connectionTimeout: a.config.keyConnectionTimeout, transmissionTimeout: a.config.keyTransmissionTimeout, retryDelay: a.config.keyLoadingRetryDelay };
}
A.nv = function(a, t, i) {
var c = { audioCapabilities: [{ contentType: 'audio/mp4; codecs="mp4a.40.5"', robustness: i.audioRobustness || "" }, { contentType: 'audio/mp4; codecs="mp4a.40.2"', robustness: i.audioRobustness || "" }], videoCapabilities: [] };
return t.forEach(function(u) {
c.videoCapabilities.push({ contentType: 'video/mp4; codecs="' + u + '"', robustness: i.videoRobustness || "" });
}), [c];
};
var _ = A.prototype;
return _.onManifestParsed = function(a, t) {
var i = this;
if (t === void 0 && (t = !1), this.ZA = a.map(function(u) {
return u.videoCodec;
}), t)
if (a.reduce(function(u, v) {
return u && (v.drmSchemaId === Vr.WIDEVINE || !v.drmSchemaId);
}, !0) && ir && this.ev()) {
this.KA = a.reduce(function(u, v) {
return u || v.drmToken || "";
}, "");
var c = si.WIDEVINE;
this.Ci.i(Zt, "on manifest parsed", c, this.ZA), this.XA(si.WIDEVINE, this.ZA);
} else
setTimeout(function() {
return i.zA(Object(L.e)(L.b.KEY_SYSTEM_ERROR, L.a.KEY_SYSTEM_UNSUPPORTED, "DRM unsupported."));
}, 0);
}, _.reset = function() {
var a = this;
this.Ci.i(Zt, "reset"), this.PA.map(function(c) {
if (c.mediaKeysSession)
return c.mediaKeysSession.removeEventListener("message", a.$A), c.mediaKeysSession.close().catch(function() {
});
}), this.sv(), this.PA = [], this.HA = !1;
try {
var t, i;
if ((t = this.Do.video) != null && t.mediaKeys)
return (i = this.Do.video) == null ? void 0 : i.setMediaKeys(null).catch(function(c) {
return a.Ci.i(Zt, c);
});
} catch (c) {
}
}, _.destroy = function() {
var a = this, t = this.Do.video;
t && t.removeEventListener("encrypted", this.WA);
var i = this.PA;
i.length && Promise.all(i.map(function(c) {
if (c.mediaKeysSession)
return c.mediaKeysSession.removeEventListener("message", a.$A), c.mediaKeysSession.close().catch(function() {
});
})).then(function() {
if (t)
return t.setMediaKeys(null);
}).catch(function() {
});
}, _.JA = function(a) {
if (this.Ci.i(Zt, "attemptSetMediaKeys", !!a), !this.Do.video)
throw new Error("Attempted to set mediaKeys without first attaching a media element");
if (!this.HA) {
var t = this.PA[0];
if (!t || !t.mediaKeys)
return this.Ci.i(Zt, "Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"), void this.zA(Object(L.e)(L.b.KEY_SYSTEM_ERROR, L.a.KEY_SYSTEM_NO_KEYS, "media is encrypted but no CDM access or no keys have been obtained yet"));
this.Ci.i(Zt, "Setting keys for encrypted media"), this.Do.video.setMediaKeys(t.mediaKeys), this.HA = !0;
}
}, _.qA = function(a, t) {
var i = this, c = this.PA[0];
if (!c)
return this.Ci.i(Zt, "Fatal: Media is encrypted but not any key-system access has been obtained yet"), void this.zA(Object(L.e)(L.b.KEY_SYSTEM_ERROR, L.a.KEY_SYSTEM_NO_ACCESS, "media is encrypted but not any key-system access has been obtained yet"));
if (c.mediaKeysSessionInitialized)
this.Ci.i(Zt, "Key-Session already initialized but requested again");
else {
var u = c.mediaKeysSession;
if (!u)
return this.Ci.i(Zt, "Fatal: Media is encrypted but no key-session existing"), void this.zA(Object(L.e)(L.b.KEY_SYSTEM_ERROR, L.a.KEY_SYSTEM_NO_SESSION, "media is encrypted but no key-session existing"));
if (!t)
return this.Ci.i(Zt, "Fatal: initData required for generating a key session is null"), void this.zA(Object(L.e)(L.b.KEY_SYSTEM_ERROR, L.a.KEY_SYSTEM_NO_INIT_DATA, "initData required for generating a key session is null"));
this.Ci.i(Zt, 'Generating key-session request for "' + a + '" init data type'), c.mediaKeysSessionInitialized = !0, u.generateRequest(a, t).then(function() {
i.Ci.d(Zt, "Key-session generation succeeded");
}).catch(function(v) {
i.Ci.i(Zt, "Error generating key-session request:", v), i.zA(Object(L.e)(L.b.KEY_SYSTEM_ERROR, L.a.KEY_SYSTEM_NO_SESSION, "error generating key-session request:" + v, { fatal: !1 }));
});
}
}, _.XA = function(a, t) {
var i = this, c = A.nv(a, t, this.FA);
if (this.Ci.i(Zt, "Requesting encrypted media key-system access"), ir) {
var u = ir(a, c);
this.GA = u.then(function(v) {
var R = { mediaKeysSessionInitialized: !1, mediaKeySystemAccess: v, mediaKeySystemDomain: a };
i.PA.push(R);
var Q = Promise.resolve().then(function() {
return v.createMediaKeys();
}).then(function(se) {
return R.mediaKeys = se, i.PA.forEach(function(fe) {
fe.mediaKeysSession || (fe.mediaKeysSession = fe.mediaKeys.createSession()).addEventListener("message", i.$A, !1);
}), se;
});
return Q.catch(function(se) {
i.Ci.i(Zt, "Failed to create media-keys:", se);
}), Q;
}), u.catch(function(v) {
i.Ci.i(Zt, 'Failed to obtain key-system "' + a + '" access:', v);
});
} else
this.Ci.i(Zt, "no requestMediaKeySystemAccess");
}, _.hv = function(a) {
switch (a) {
case si.WIDEVINE:
if (!this.Do.config.widevineLicenseUrl)
break;
return this.Do.config.widevineLicenseUrl;
case si.PLAYREADY:
if (!this.Do.config.playreadyLicenseUrl)
break;
return this.Do.config.playreadyLicenseUrl;
case si.FAIRPLAY:
if (!this.Do.config.fairplayLicenseUrl)
break;
return this.Do.config.fairplayLicenseUrl;
}
throw new Error('no license server URL configured for key-system "' + a + '"');
}, _.tv = function(a, t) {
var i = this, c = this.PA[0];
if (!c)
return this.Ci.i(Zt, "Fatal error: Media is encrypted but no key-system access has been obtained yet"), void this.zA(Object(L.e)(L.b.KEY_SYSTEM_ERROR, L.a.KEY_SYSTEM_NO_ACCESS, "media is encrypted but no key-system access has been obtained yet"));
this.sv();
var u = { onError: this.Yf, onEnd: function(Q, se) {
i.sv(), se instanceof ArrayBuffer && t.update(se);
} }, v = this.vf = new nt(this.Ci), R = { requestMethod: "POST", requestBody: a, url: this.KA || this.hv(c.mediaKeySystemDomain), responseType: "arraybuffer" };
v.load(R, u, this.YA);
}, _.sv = function() {
this.vf && this.vf.destroy();
}, g()(A, [{ key: "isActive", get: function() {
return !(!this.Do.video || !this.Do.video.mediaKeys);
} }]);
}(), vt = "mse", Ei = function() {
function A(a, t, i, c) {
var u = this;
this.di = void 0, this.ov = void 0, this.Io = void 0, this.Ai = void 0, this.Ci = void 0, this.video = void 0, this.sourceBuffer = void 0, this.av = void 0, this.uv = void 0, this.cv = { video: [], audio: [] }, this.fv = { video: [], audio: [] }, this.fn = void 0, this.An = void 0, this.Da = !1, this.Av = void 0, this.Vn = 1 / 0, this.vv = 0, this.dv = !1, this.lv = void 0, this.bv = {}, this.pv = !1, this.mv = void 0, this.gv = 0, this.yv = void 0, this._v = {}, this.Cv = ht.isChangeTypeSupported(), this.Iv = function() {
u.Ci.i(vt, "MediaSource onSourceOpen"), u.av && (u.av.removeEventListener("sourceopen", u.Iv), u.Ov(), u.refresh());
}, this.wv = function() {
u.Ci.i(vt, "MediaSource onSourceEnded");
}, this.Ev = function() {
u.Ci.i(vt, "MediaSource onSourceClose"), u.Ai.emit(w.a.MSE_SOURCE_CLOSE);
}, this.jv = function(v) {
u.yc(v), u.Da && u.kv(), u.Mv(), u.Io.mseUpdate++, u.Ai.emit(w.a.MSE_UPDATE);
}, this.Sv = function(v) {
var R = u.Bv(v.currentTarget);
u.Ci.i(vt, R + " SourceBuffer Error: ", v), u.zA(Object(L.e)(L.b.MSE_ERROR, L.a.SOURCEBUFFER_ERROR, R + " source buffer error. " + JSON.stringify(u._v)));
}, this.Tv = function() {
u.Ci.i(vt, "startPlayBufEnd"), u.Dv(), u.gv = 0, u.refresh();
}, this.zA = function(v) {
u.Ai.emit(w.a.ERROR, v);
}, i.i(vt, "constructor"), this.di = a, this.ov = t, this.Ci = i, this.Ai = c, this.fn = !1, this.An = !1, this.sourceBuffer = {}, this.uv = {}, this.mv = {}, this.Av = !0, this.Io = { mseBufferFull: 0, mseRemove: 0, mseUpdate: 0 };
}
var _ = A.prototype;
return _.attach = function(a) {
var t = this;
this.Ci.i(vt, "attach", a), this.video = a;
var i = Kt();
if (i) {
var c = this.av = new i();
this.ov.mms = "streaming" in c;
var u = URL.createObjectURL(c);
this.Ci.i(vt, "attach mms:" + this.ov.mms + " src: " + u), this.video.src = u;
try {
this.video.load();
} catch (v) {
}
a.disableRemotePlayback = !0, this.Rv(c), this.pv = !1;
} else
setTimeout(function() {
t.zA(Object(L.e)(L.b.MSE_ERROR, L.a.MEDIASOURCE_ERROR, "MediaSource is not support"));
}, 0);
}, _.trackInfo = function(a) {
var t = a.tracks.audio, i = a.tracks.video;
t && t.container && (this.uv.audio = t.container + '; codecs="' + t.codec + '"'), i && i.codec && i.active !== !1 && (this.uv.video = i.container + '; codecs="' + i.codec + '"'), this.An = !(!this.An && !t), this.fn = !!(this.fn || i && i.active !== !1), this.Ci.i(vt, "track info. video: " + this.fn + " audio: " + this.An), this.Ov();
}, _.updateDuration = function(a) {
this.Ci.i(vt, "update duration: " + a), this.Vn = a, this.Mv();
}, _.setStartBufSec = function(a) {
this.Ci.i(vt, "startPlayBufSec: " + a), this.Dv(), this.gv = a, this.yv = setTimeout(this.Tv, 1e3 * a);
}, _.Mv = function() {
if (typeof this.Vn == "number" && this.video && this.av && this.sourceBuffer && this.video.readyState !== 0 && this.av.readyState === "open") {
for (var a = 0, t = Object.values(this.sourceBuffer); a < t.length; a++) {
var i = t[a];
if (i && i.updating)
return;
}
var c = this.video.duration;
if (this.lv === void 0 && (this.lv = this.av.duration), this.ov.isLive && this.ov.liveShiftType === h.g.NONE)
this.lv = this.av.duration = 1 / 0;
else if (this.Vn !== this.lv && this.Vn !== c || !Number.isFinite(c)) {
var u = !0;
for (var v in this.sourceBuffer)
u = u && !!this.Vn && this.bufferedEndByType(v) < this.Vn;
u && this.Vn && (this.lv = this.av.duration = this.Vn), this.Vn = void 0;
}
}
}, _.Ov = function() {
var a = (this.An ? 1 : 0) + (this.fn ? 1 : 0), t = (this.uv.audio ? 1 : 0) + (this.uv.video ? 1 : 0);
if (this.Ci.v(vt, "checkSourceBuffer", a, t, this.uv), this.av && this.av.readyState === "open" && a > 0 && t >= a)
for (var i in this.uv)
this.uv[i] && (this.Ci.i(vt, "add sb: " + i + " " + this.uv[i]), this.Lv(i));
}, _.Lv = function(a) {
var t = this;
if (this.Ci.i(vt, "add source buffer: " + a), !this.sourceBuffer[a] && !this.pv) {
try {
var i = this.uv[a];
if (!this.av || !i)
throw new Error(a + " add source buffer. no mime codec");
this.sourceBuffer[a] = this.av.addSourceBuffer(i), this._v[a] = { sn: 0, subSn: 0, codec: i }, this.mv[a] = !1;
} catch (v) {
return this.Ci.i(vt, v), void this.zA(Object(L.e)(L.b.MSE_ERROR, L.a.ADDSOURCEBUFFER_ERROR, "type:" + a + " codec:" + this.uv[a] + " msg:" + v.message));
}
var c = this.sourceBuffer[a];
if (c) {
var u = this.bv[a] = { updateend: function() {
t.jv(a);
}, error: function(v) {
t.Sv(v);
} };
c.addEventListener("error", u.error), c.addEventListener("updateend", u.updateend), this.Vn && this.av && this.Vn !== this.av.duration && (this.av.duration = this.Vn);
}
}
}, _.Nv = function() {
return !(!this.fv || !(this.fv.video && this.fv.video.length || this.fv.audio && this.fv.audio.length));
}, _.refresh = function() {
for (var a in this.sourceBuffer)
this.yc(a);
}, _.Qv = function(a) {
if (this.fv[a] && this.fv[a].length > 0) {
if (!this.Av)
return void (this.xv() > 209715200 && !this.dv && (this.dv = !0, this.zA(Object(L.e)(L.b.MSE_ERROR, L.a.APPENDBUFFER_ERROR, "bufferfull"))));
var t = this.sourceBuffer[a];
if (t && !t.updating && !this.dv) {
var i = this.fv[a].shift();
this.Vv(i);
}
}
}, _.mediaSegment = function(a) {
var t = this;
a.forEach(function(i) {
var c = i.type;
i.codec = t.uv[i.type], t.fv[c] && t.fv[c].push(i), t.sourceBuffer[c] && (t.pv = !0, t.yc(c));
});
}, _.bufferedByType = function(a) {
var t = this.sourceBuffer[a];
return t && t.buffered && t.buffered.length > 0 ? { start: t.buffered.start(0), end: t.buffered.end(t.buffered.length - 1) } : { start: 0, end: 0 };
}, _.bufferedEndByType = function(a) {
var t = this.sourceBuffer[a];
return t && t.buffered && t.buffered.length > 0 ? t.buffered.end(t.buffered.length - 1) : 0;
}, _.bufferSliceNumByType = function(a) {
var t = this.sourceBuffer[a];
return t ? t.buffered.length : 0;
}, _.pendingSecByType = function(a) {
var t = this.fv[a];
return t ? t.reduce(function(i, c) {
return i + c.endDTS - c.startDTS;
}, 0) : 0;
}, _.pendingNum = function() {
for (var a = 0, t = 0, i = Object.values(this.fv); t < i.length; t++)
a += i[t].length;
return a;
}, _.Uv = function(a) {
var t = this.video;
if (t && !t.seeking) {
var i = t.currentTime, c = this.sourceBuffer[a];
if (c) {
var u = this.cv[a], v = c.buffered;
if (v.length >= 1 && i - v.start(0) >= 10) {
var R = i - 5;
if (u && u.length && u[u.length - 1].start === 0 && u[u.length - 1].end === R)
return;
u.push({ start: 0, end: R });
}
}
}
}, _.Fv = function(a, t) {
try {
for (var i = 0; i < a.buffered.length; i++) {
var c = a.buffered.start(i), u = a.buffered.end(i), v = Math.max(c, t.start), R = Math.min(u, t.end);
if (R > v)
return this.Ci.i(vt, "remove: " + v + " ~ " + R), a.remove(v, R), this.Io.mseRemove++, !(t.end > u && i < a.buffered.length - 1) || (t.start = Math.max(t.start, R), !1);
if (!(t.end > R))
break;
t.start = Math.max(t.start, R);
}
return !0;
} catch (Q) {
return !(a && a.updating);
}
}, _.Vv = function(a) {
if (a && this.sourceBuffer[a.type] && this.video && !this.video.error) {
var t = this._v[a.type], i = this.sourceBuffer[a.type];
if (a.codec && t && a.codec !== t.codec && (this.Ci.i(vt, a.type + " codecType change: " + a.codec), i && this.Cv)) {
this.Ci.i(vt, a.type + " changeType: " + a.codec);
try {
i.changeType(a.codec), t.subSn = 0;
} catch (c) {
return void this.zA(Object(L.e)(L.b.MSE_ERROR, L.a.CHANGETYPE_ERROR, "type:" + a.type + " codec:" + a.codec + " code:" + c.code + " msg:" + c.message));
}
}
t && (t.codec = a.codec, t.start = a.startDTS, t.end = a.endDTS, t.sn++, t.subSn++);
try {
i && (a.updateTimestampOffset && !i.buffered.length && (i.timestampOffset = a.startPTS), i.appendBuffer(a.payload.buffer), this.mv[a.type] = !0);
} catch (c) {
this.Ci.i(vt, a.type, c.code, c.message), c.code !== 22 ? (this.vv ? this.vv++ : this.vv = 1, this.vv > this.di.appendErrorMaxRetry ? (this.dv = !0, this.zA(Object(L.e)(L.b.MSE_ERROR, L.a.APPENDBUFFER_ERROR, "code:" + c.code + " type:" + a.type + " msg:" + c.message))) : this.fv[a.type].unshift(a)) : (this.fv[a.type].unshift(a), this.Uv(a.type), this.hasCleanUpTask(a.type) && this.Pv(a.type), this.Ci.i(vt, "mse bufferfull"), this.Io.mseBufferFull++, this.Ai.emit(w.a.MSE_BUFFER_FULL));
}
}
}, _.Bv = function(a) {
for (var t in this.sourceBuffer)
if (this.sourceBuffer[t] === a)
return t;
return "unknown";
}, _.clean = function(a, t, i) {
this.Ci.i(vt, "clean. st: " + a + " ed: " + t + " type: " + i);
var c = 0, u = Number.POSITIVE_INFINITY;
for (var v in this.mv = {}, this.Da = !1, this.sourceBuffer)
if (this.mv[v] = !1, (!i || i === v) && this.sourceBuffer[v]) {
var R = this.fv[v];
if (a && R) {
c = Math.max(c, a);
for (var Q = R.length - 1; Q >= 0; Q--) {
var se = R[Q];
if (se && se.startPTS && !(se.startPTS >= a))
break;
R.pop();
}
} else
this.fv[v] = [];
t && (u = Math.min(u, t)), this.cv[v].push({ start: c, end: u }), this.Pv(v);
}
this.Av = !0;
}, _.setAppendEnabled = function(a) {
!this.Av && a ? (this.Av = a, this.refresh()) : this.Av = a;
}, _.getAppendEnabled = function() {
return this.Av;
}, _.endOfData = function() {
if (this.Ci.i(vt, "data end."), this.Da = !0, !this.Nv() && this.video && this.video.buffered.length) {
if ($.a.firefox && !this.ov.isLive && this.Vn === void 0)
return this.Vn = this.video.buffered.end(this.video.buffered.length - 1), this.Ci.i(vt, "data end. firefox no duration", this.Vn, this.ov.isLive), this.Mv(), void this.kv();
(this.ov.isLive || !this.ov.isLive && this.Vn !== void 0) && (this.Ci.i(vt, "data end. end of stream"), this.kv());
}
}, _.ended = function() {
return this.Da;
}, _.kv = function() {
var a = this.av;
if (a && a.readyState === "open" && !this.Nv()) {
for (var t = 0, i = Object.values(this.sourceBuffer); t < i.length; t++) {
var c = i[t];
if (c && c.updating)
return;
}
try {
this.Ci.i(vt, "end of stream"), a.endOfStream();
} catch (u) {
this.Ci.i(vt, u), this.zA(Object(L.e)(L.b.MSE_ERROR, L.a.ENDOFSTREAM_ERROR, "code:" + u.code + " msg:" + u.message));
}
}
}, _.destroy = function() {
if (this.Ci.i(vt, "destroy"), this.av) {
var a = this.av;
if (this.kv(), a.readyState !== "closed") {
for (var t in this.sourceBuffer) {
var i = this.sourceBuffer[t], c = this.bv[t];
i && c && (i.removeEventListener("error", c.error), i.removeEventListener("updateend", c.updateend), a.removeSourceBuffer(i));
}
this.sourceBuffer = {};
}
this.Hv(a), this.av = void 0;
}
this.Dv(), this.fv = { video: [], audio: [] }, this.uv = {}, this.mv = {}, this.cv = { video: [], audio: [] }, this.sourceBuffer = {}, this.bv = {};
}, _.hasCleanUpTask = function(a) {
var t = 0;
if (a === void 0)
for (var i = 0, c = Object.values(this.cv); i < c.length; i++)
t += c[i].length;
else
this.cv[a] && (t = this.cv[a].length);
return t > 0;
}, _.hasSourceBuffer = function() {
return !!Object.keys(this.sourceBuffer).length;
}, _.hasTrackInfo = function() {
return !!Object.keys(this.uv).length;
}, _.hasSourceBufferAppendStarted = function() {
if (Object.keys(this.mv).length) {
for (var a = !0, t = 0, i = Object.values(this.mv); t < i.length; t++) {
var c = i[t];
a = a && c;
}
return a;
}
return !1;
}, _.xv = function() {
var a = 0;
for (var t in this.fv)
a += this.fv[t].reduce(function(i, c) {
return c.payload && c.payload.byteLength ? i + c.payload.byteLength : i;
}, 0);
return a;
}, _.getBufferQueueSec = function(a) {
var t = this;
return this.fv ? (a ? [a] : Object.keys(this.fv)).reduce(function(i, c) {
return t.fv[c] && t.fv[c].length > 0 && (Object.keys(t.sourceBuffer).length === 0 || t.sourceBuffer[c]) ? Math.max(i, t.fv[c].reduce(function(u, v) {
var R = v.endDTS - v.startDTS;
return R ? u + R : u;
}, 0)) : i;
}, 0) : 0;
}, _.yc = function(a) {
if (this.hasCleanUpTask(a) && this.Pv(a), this.gv > 0) {
if (!this.hasTrackInfo())
return;
for (var t in this.sourceBuffer)
if (this.pendingSecByType(t) < this.gv)
return;
this.Tv();
}
this.Qv(a);
}, _.Pv = function(a) {
for (var t = this.cv[a]; t && t.length; ) {
var i = t[0], c = this.sourceBuffer[a];
if (c && i) {
if (c.updating || !this.Fv(c, i))
return;
t.shift();
} else
t.shift();
}
this.refresh();
}, _.Dv = function() {
this.yv && (clearTimeout(this.yv), this.yv = void 0);
}, _.Rv = function(a) {
a.addEventListener("sourceopen", this.Iv), a.addEventListener("sourceended", this.wv), a.addEventListener("sourceclose", this.Ev);
}, _.Hv = function(a) {
a.removeEventListener("sourceopen", this.Iv), a.removeEventListener("sourceended", this.wv), a.removeEventListener("sourceclose", this.Ev);
}, g()(A, [{ key: "stat", get: function() {
return this.Io;
} }, { key: "readyState", get: function() {
return this.av ? this.av.readyState : "closed";
} }, { key: "trackBufInfo", get: function() {
var a = {};
try {
for (var t in this.sourceBuffer)
for (var i = this.sourceBuffer[t].buffered, c = a[t] = [], u = 0; u < i.length; u++)
c.push({ st: i.start(u), ed: i.end(u) });
} catch (v) {
}
return a;
} }]);
}(), qi = function() {
function A(a) {
this.Do = void 0, this.Ci = void 0, this.di = void 0, this.Yv = 5e3, this.Gv = !1, this.Kv = 0, this.Do = a, this.Ci = a.logger, this.di = a.stat.autoPlaybackRateConf;
}
var _ = A.prototype;
return _.tick = function() {
if (this.Gv && this.Do.video && !this.Do.video.paused) {
if (this.Yv > 0) {
var a = performance.now();
return this.Yv -= a - this.Kv, void (this.Kv = a);
}
this.Zv(this.Do.bufferedSec, this.Do.video);
}
}, _.Zv = function(a, t) {
if (this.di) {
var i = 1, c = this.di.rule, u = 0;
for (u = 0; u < c.length && !(t.playbackRate >= c[u].rate); u++)
;
u >= c.length && (u = c.length - 1);
var v = c[u];
if (v) {
var R = u < c.length - 1 ? c[u + 1] : void 0, Q = u > 0 ? c[u - 1] : void 0;
i = v.rate, Q && a > Q.lower && (i = Q.rate), R && a < R.upper && (i = R.rate), t.playbackRate !== i && (this.Ci.i("playback-rate-manager", "auto change playback rate from " + t.playbackRate + " to " + i), t.playbackRate = i);
}
}
}, g()(A, [{ key: "enabled", get: function() {
return this.Gv;
}, set: function(a) {
if (a !== this.Gv)
if (a) {
if (!this.di || !this.Do.config.autoPlaybackRate)
return;
this.Gv = !0, this.Kv = performance.now(), this.Yv = this.di.startDelay ? 1e3 * this.di.startDelay : this.Yv, this.Do.isLiveShift && this.Do.stat.liveShiftActive && this.Do.video && (this.Do.video.playbackRate = 1);
} else
this.Gv && this.Do.video && (this.Do.video.playbackRate = 1), this.Gv = !1;
} }]);
}(), ui = n(30), ai = function() {
function A() {
}
return A.prototype.decode = function(_, a) {
if (!_)
return "";
if (typeof _ != "string")
throw new Error("Error - expected string data.");
return decodeURIComponent(encodeURIComponent(_));
}, A;
}(), Qt = function() {
function A() {
this.values = /* @__PURE__ */ Object.create(null);
}
var _ = A.prototype;
return _.set = function(a, t) {
this.get(a) || t === "" || (this.values[a] = t);
}, _.get = function(a, t, i) {
return i ? this.has(a) ? this.values[a] : t[i] : this.has(a) ? this.values[a] : t;
}, _.has = function(a) {
return a in this.values;
}, _.alt = function(a, t, i) {
for (var c = 0; c < i.length; ++c)
if (t === i[c]) {
this.set(a, t);
break;
}
}, _.integer = function(a, t) {
/^-?\d+$/.test(t) && this.set(a, parseInt(t, 10));
}, _.percent = function(a, t) {
if (/^([\d]{1,3})(\.[\d]*)?%$/.test(t)) {
var i = parseFloat(t);
if (i >= 0 && i <= 100)
return this.set(a, i), !0;
}
return !1;
}, A;
}();
function rr(A, _, a, t) {
var i = t ? A.split(t) : [A];
for (var c in i)
if (typeof i[c] == "string") {
var u = i[c].split(a);
u.length === 2 && _(u[0], u[1]);
}
}
var Sn = typeof VTTCue > "u" ? void 0 : new VTTCue(0, 0, ""), Bi = (Sn == null ? void 0 : Sn.align) === "middle" ? "middle" : "center";
function Wa(A, _, a) {
var t = A;
function i() {
var u = function(v) {
function R(se, fe, ke, Fe) {
return 3600 * (se ? parseInt(se) : 0) + 60 * (fe ? parseInt(fe) : 0) + (ke ? parseInt(ke) : 0) + (Fe ? parseFloat(Fe) : 0);
}
var Q = v.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);
return Q ? parseFloat(Q[2]) > 59 ? R(Q[2], Q[3], "0", Q[4]) : R(Q[1], Q[2], Q[3], Q[4]) : null;
}(A);
if (u === null)
throw new Error("Malformed timestamp: " + t);
return A = A.replace(/^[^\sa-zA-Z-]+/, ""), u;
}
function c() {
A = A.replace(/^\s+/, "");
}
if (c(), _.startTime = i(), c(), A.substr(0, 3) !== "-->")
throw new Error("Malformed time stamp (time stamps must be separated by '-->'): " + t);
A = A.substr(3), c(), _.endTime = i(), c(), function(u, v) {
var R = new Qt();
rr(u, function(fe, ke) {
var Fe;
switch (fe) {
case "region":
for (var Ne = a.length - 1; Ne >= 0; Ne--)
if (a[Ne].id === ke) {
R.set(fe, a[Ne].region);
break;
}
break;
case "vertical":
R.alt(fe, ke, ["rl", "lr"]);
break;
case "line":
Fe = ke.split(","), R.integer(fe, Fe[0]), R.percent(fe, Fe[0]) && R.set("snapToLines", !1), R.alt(fe, Fe[0], ["auto"]), Fe.length === 2 && R.alt("lineAlign", Fe[1], ["start", Bi, "end"]);
break;
case "position":
Fe = ke.split(","), R.percent(fe, Fe[0]), Fe.length === 2 && R.alt("positionAlign", Fe[1], ["start", Bi, "end", "line-left", "line-right", "auto"]);
break;
case "size":
R.percent(fe, ke);
break;
case "align":
R.alt(fe, ke, ["start", Bi, "end", "left", "right"]);
}
}, /:/, /\s/), v.region = R.get("region", null), v.vertical = R.get("vertical", "");
var Q = R.get("line", "auto");
Q === "auto" && (Sn == null ? void 0 : Sn.line) === -1 && (Q = -1), v.line = Q, v.lineAlign = R.get("lineAlign", "start"), v.snapToLines = R.get("snapToLines", !0), v.size = R.get("size", 100), v.align = R.get("align", Bi);
var se = R.get("position", "auto");
se === "auto" && (Sn == null ? void 0 : Sn.position) === 50 && (se = v.align === "start" || v.align === "left" ? 0 : v.align === "end" || v.align === "right" ? 100 : 50), v.position = se;
}(A, _);
}
var Ya = function() {
function A() {
this.state = "INITIAL", this.buffer = "", this.decoder = new ai(), this.regionList = [], this.cue = null, this.style = "", this.oncue = void 0, this.onstyle = void 0, this.onparsingerror = void 0, this.onflush = void 0;
}
var _ = A.prototype;
return _.parse = function(a) {
var t = this;
a && (this.buffer += this.decoder.decode(a, { stream: !0 }));
var i = function() {
var Q = t.buffer, se = 0;
for (Q = Q.replace(/<br(?: \/)?>/gi, `
`); se < Q.length && Q[se] !== "\r" && Q[se] !== `
`; )
++se;
var fe = Q.substr(0, se);
return Q[se] === "\r" && ++se, Q[se] === `
` && ++se, t.buffer = Q.substr(se), fe;
};
try {
var c = "";
if (this.state === "INITIAL") {
if (!/\r\n|\n/.test(this.buffer))
return this;
var u = (c = i()).match(/^()?WEBVTT([ \t].*)?$/);
if (!u || !u[0])
throw new Error("Malformed WebVTT signature.");
this.state = "HEADER";
}
for (var v = !1; this.buffer; ) {
if (!/\r\n|\n/.test(this.buffer))
return this;
switch (v ? v = !1 : c = i(), this.state) {
case "HEADER":
/:/.test(c) ? rr(c, function(Q, se) {
}, /:/) : c || (this.state = "ID");
continue;
case "NOTE":
c || (this.state = "ID");
continue;
case "STYLE":
c ? this.style += c : (this.style && (this.onstyle && this.onstyle(this.style), this.style = ""), this.state = "ID");
continue;
case "ID":
if (/^NOTE($|[ \t])/.test(c)) {
this.state = "NOTE";
break;
}
if (/^STYLE($|[ \t])/.test(c)) {
this.state = "STYLE";
break;
}
if (!c)
continue;
if (this.cue = new VTTCue(0, 0, ""), this.state = "CUE", c.indexOf("-->") === -1) {
this.cue.id = c;
continue;
}
case "CUE":
if (!this.cue) {
this.state = "BADCUE";
continue;
}
try {
Wa(c, this.cue, this.regionList);
} catch (Q) {
this.cue = null, this.state = "BADCUE";
continue;
}
this.state = "CUETEXT";
continue;
case "CUETEXT":
var R = c.indexOf("-->") !== -1;
if (!c || R && (v = !0)) {
this.oncue && this.cue && this.oncue(this.cue), this.cue = null, this.state = "ID";
continue;
}
if (this.cue === null)
continue;
this.cue.text && (this.cue.text += `
`), this.cue.text += c;
continue;
case "BADCUE":
c || (this.state = "ID");
}
}
} catch (Q) {
this.state === "CUETEXT" && this.cue && this.oncue && this.oncue(this.cue), this.cue = null, this.state = this.state === "INITIAL" ? "BADWEBVTT" : "BADCUE";
}
return this;
}, _.flush = function() {
try {
if ((this.cue || this.state === "HEADER") && (this.buffer += `
`, this.parse()), this.state === "INITIAL" || this.state === "BADWEBVTT")
throw new Error("Malformed WebVTT signature.");
} catch (a) {
this.onparsingerror && this.onparsingerror(a);
}
return this.onflush && this.onflush(), this;
}, A;
}(), va = n(41), js = n(20), Hs = /\r\n|\n\r|\n|\r/g, Vi = function(A, _, a) {
return a === void 0 && (a = 0), A.substr(a, _.length) === _;
}, jn = function(A) {
for (var _ = 5381, a = A.length; a; )
_ = 33 * _ ^ A.charCodeAt(--a);
return (_ >>> 0).toString();
};
function Qa(A, _, a, t, i, c, u, v) {
var R, Q = new Ya(), se = Object(va.a)(new Uint8Array(A)).trim().replace(Hs, `
`).split(`
`), fe = [], ke = Object(js.b)(_, a), Fe = "", Ne = "00:00.000", He = 0, rt = 0, Qe = !0, _t = !1;
Q.onstyle = function(dt) {
Fe += dt;
}, Q.oncue = function(dt) {
var Rt = t[i], gi = t.ccOffset, Ht = (He - ke) / Ve.q;
if (Rt != null && Rt.new && (rt !== void 0 ? gi = t.ccOffset = Rt.start : function(_i, Nn, kn) {
var ci = _i[Nn], er = _i[ci.prevCC];
if (!er || !er.new && ci.new)
return _i.ccOffset = _i.presentationOffset = ci.start, void (ci.new = !1);
for (; (Nt = er) != null && Nt.new; ) {
var Nt;
_i.ccOffset += ci.start - er.start, ci.new = !1, er = _i[(ci = er).prevCC];
}
_i.presentationOffset = kn;
}(t, i, Ht)), Ht && (gi = Ht - t.presentationOffset), _t) {
var Pi = dt.endTime - dt.startTime, Oi = Object(ui.a)((dt.startTime + gi - rt) * Ve.q, c * Ve.q) / Ve.q;
dt.startTime = Oi, dt.endTime = Oi + Pi;
}
var ti = dt.text.trim();
dt.text = decodeURIComponent(encodeURIComponent(ti)), dt.id || (dt.id = function(_i, Nn, kn) {
return jn(_i.toString()) + jn(Nn.toString()) + jn(kn);
}(dt.startTime, dt.endTime, ti)), dt.endTime > 0 && fe.push(dt);
}, Q.onparsingerror = function(dt) {
R = dt;
}, Q.onflush = function() {
R ? v(R) : u(fe, Fe);
}, se.forEach(function(dt) {
if (Qe) {
if (Vi(dt, "X-TIMESTAMP-MAP=")) {
Qe = !1, _t = !0, dt.substr(16).split(",").forEach(function(Rt) {
Vi(Rt, "LOCAL:") ? Ne = Rt.substr(6) : Vi(Rt, "MPEGTS:") && (He = parseInt(Rt.substr(7)));
});
try {
rt = function(Rt) {
var gi = parseInt(Rt.substr(-3)), Ht = parseInt(Rt.substr(-6, 2)), Pi = parseInt(Rt.substr(-9, 2)), Oi = Rt.length > 9 ? parseInt(Rt.substr(0, Rt.indexOf(":"))) : 0;
if (!(Number.isFinite(gi) && Number.isFinite(Ht) && Number.isFinite(Pi) && Number.isFinite(Oi)))
throw Error("Malformed X-TIMESTAMP-MAP: Local:" + Rt);
return gi += 1e3 * Ht, gi += 6e4 * Pi, gi + 36e5 * Oi;
}(Ne) / 1e3;
} catch (Rt) {
_t = !1, R = Rt;
}
return;
}
dt === "" && (Qe = !1);
}
Q.parse(dt + `
`);
}), Q.flush();
}
var ga = "subtitle", V = function() {
function A(a) {
var t = this;
this.Do = void 0, this.Ci = void 0, this.Wv = -1, this._ = [], this.Xv = 0, this.zv = void 0, this.Jv = void 0, this.qv = function() {
var i = t._.reduce(function(c, u, v) {
return u.track.mode === "showing" ? v : c;
}, -1);
i !== t.Wv && (t.Wv = i, t.Ci.i(ga, "subtitle switching"), t.Do.evt.emit(w.a.SUBTITLE_TRACK_SWITCHED, { level: i }));
}, this.Do = a, this.Ci = a.logger, this.zv = { ccOffset: 0, presentationOffset: 0, 0: { start: 0, prevCC: -1, new: !1 } }, this.Do.video && this.Do.video.textTracks.addEventListener("change", this.qv);
}
var _ = A.prototype;
return _.addTracks = function(a) {
var t = this;
a.forEach(function(i, c) {
var u = t.$v();
u && t.Do.video && (i.default ? (t.Wv = c, u.mode = "showing") : u.mode = "hidden");
});
}, _.select = function(a) {
if (this.td(), a !== this.Wv) {
var t = this._[a], i = this._[this.Wv];
i && (i.track.mode = "hidden"), t ? (this.nd(t.style), t.track.mode = "showing", this.Wv = a) : this.Wv = -1, this.Do.evt.emit(w.a.SUBTITLE_TRACK_SWITCHED, { level: this.Wv });
}
}, _.reset = function() {
this.Ci.i(ga, "reset"), this._.forEach(function(a) {
(function(t) {
var i = t.mode;
if (i === "disabled" && (t.mode = "hidden"), t.cues) {
for (var c = t.cues.length; c--; )
t.removeCue(t.cues[c]);
i === "disabled" && (t.mode = i);
}
})(a.track), a.track.mode = "hidden";
}), this.Xv = 0, this.Wv = -1, this.zv = { ccOffset: 0, presentationOffset: 0, 0: { start: 0, prevCC: -1, new: !1 } }, this.td();
}, _.parseVTTs = function(a, t, i) {
var c = this, u = this._[this.Wv];
u && Qa(a, i, t, this.zv, i, t, function(v, R) {
v.forEach(function(Q) {
(function(se, fe) {
var ke = se.mode;
if (ke === "disabled" && (se.mode = "hidden"), se.cues && !se.cues.getCueById(fe.id))
try {
if (se.addCue(fe), !se.cues.getCueById(fe.id))
throw new Error("addCue is failed for: " + fe);
} catch (Ne) {
var Fe = new self.TextTrackCue(fe.startTime, fe.endTime, fe.text);
Fe.id = fe.id, se.addCue(Fe);
}
ke === "disabled" && (se.mode = ke);
})(u.track, Q);
}), R && (u.style += R, c.nd(u.style));
}, function(v) {
c.Ci.i(ga, v);
});
}, _.destroy = function() {
this.Do.video && this.Do.video.textTracks.removeEventListener("change", this.qv), this.reset(), this._ = [];
}, _.$v = function() {
var a;
if (this.Xv < this._.length)
a = this._[this.Xv].track, this.Xv++;
else {
var t = this.Do.video;
t && (a = t.addTextTrack("subtitles"), this._.push({ track: a, style: "" }), this.Xv++);
}
return a;
}, _.nd = function(a) {
a && (this.Jv || (this.Jv = document.createElement("style"), document.head.appendChild(this.Jv)), this.Jv.innerHTML = a);
}, _.td = function() {
this.Jv && (this.Jv.innerHTML = "", document.head.removeChild(this.Jv), this.Jv = void 0);
}, A;
}(), E = function(A) {
function _() {
return A.apply(this, arguments) || this;
}
return y()(_, A), _.prototype.run = function(a) {
if (this.getAvailable() && this.Do.stat.multipart && this.Do.stat.coreType === h.a.mse && a.type === L.b.NETWORK_ERROR && a.details !== L.a.DEC_LIB_LOAD_ERROR && a.details !== L.a.KEY_SYSTEM_LICENSE_REQUEST_FAILED)
return this.Ci.i("fallback-multipart", "run"), this.Pc({ type: h.k.BACKUP, message: "error. multipart use backup url.", fallback: le.USE_BACKUP_MULTIPART });
}, _;
}(ue), d = "LevelHelper";
function l(A, _, a, t) {
var i = _[a], c = _[t];
if (i && c) {
var u = c.startPTS;
Number.isFinite(u) ? t > a ? (i.duration = u - i.start, i.duration < 0 && A.w(d, "negative duration computed for frag " + i.sn + ",level " + i.level + ", duration " + i.duration + ", there should be some duration drift between playlist and fragment!. from")) : (c.duration = i.start - u, c.duration < 0 && A.w(d, "negative duration computed for frag " + c.sn + ",level " + c.level + ", duration " + c.duration + ", there should be some duration drift between playlist and fragment!. to")) : c.start = t > a ? i.start + i.duration : Math.max(i.start - c.duration, 0);
}
}
function f(A, _, a, t, i, c, u) {
var v = t;
if (Number.isFinite(a.startPTS)) {
var R = Math.abs(a.startPTS - t);
Number.isFinite(a.deltaPTS) ? a.deltaPTS = Math.max(R, a.deltaPTS) : a.deltaPTS = R, v = Math.max(t, a.startPTS), t = Math.min(t, a.startPTS), i = Math.max(i, a.endPTS), c = Math.min(c, a.startDTS), u = Math.max(u, a.endDTS);
}
var Q = t - a.start;
a.start = a.startPTS = t, a.maxStartPTS = v, a.endPTS = i, a.startDTS = c, a.endDTS = u;
var se = a.duration;
a.duration = i - t, A.i(d, "update frag duration: " + se + " -> " + a.duration);
var fe, ke = a.sn;
if (!_ || typeof ke != "number" || ke < _.startSN || ke > _.endSN)
return 0;
var Fe = ke - _.startSN, Ne = _.fragments;
for (Ne[Fe] = a, fe = Fe; fe > 0; fe--)
l(A, Ne, fe, fe - 1);
for (fe = Fe; fe < Ne.length - 1; fe++)
l(A, Ne, fe, fe + 1);
return _.ptsKnown = !0, Q;
}
function b(A, _, a) {
for (var t = a; t < _.fragments.length - 1; t++)
l(A, _.fragments, t, t + 1);
}
function N(A, _, a, t) {
t === void 0 && (t = h.g.NONE);
var i = t !== h.g.NONE, c = _.fragments.length - 1;
a.partOfData || function(u, v, R) {
R.initSegment && v.initSegment && (R.initSegment = v.initSegment);
var Q, se = 0;
if (H(v, R, function(Fe, Ne) {
se = Fe.cc - Ne.cc, Number.isFinite(Fe.startPTS) && (Ne.start = Ne.startPTS = Fe.startPTS, Ne.endPTS = Fe.endPTS, Ne.duration = Fe.duration, Ne.dropped = Fe.dropped, Q = Ne), R.ptsKnown = !0;
}), !!R.ptsKnown) {
if (se) {
u.v(d, "discontinuity sliding from playlist, take drift into account");
for (var fe = R.fragments, ke = 0; ke < fe.length; ke++)
fe[ke].cc += se;
}
Q ? f(u, R, Q, Q.startPTS, Q.endPTS, Q.startDTS, Q.endDTS) : function(Fe, Ne) {
var He = Ne.startSN - Fe.startSN, rt = Fe.fragments, Qe = Ne.fragments;
if (!(He < 0 || He > rt.length))
for (var _t = 0; _t < Qe.length; _t++)
Qe[_t].start += rt[He].start;
}(v, R), R.ptsKnown = v.ptsKnown;
}
}(A, _, a), _.mergeFrom(a, i), t === h.g.KWAI2 && c > 0 && b(A, _, c);
}
function H(A, _, a) {
if (A && _)
for (var t = Math.max(A.startSN, _.startSN) - _.startSN, i = Math.min(A.endSN, _.endSN) - _.startSN, c = _.startSN - A.startSN, u = t; u <= i; u++) {
var v = A.fragments[c + u], R = _.fragments[u];
if (!v || !R)
break;
a(v, R, u);
}
}
function S(A, _, a) {
var t = 1e3 * (_.averagetargetduration ? _.averagetargetduration : _.targetduration), i = t / 2;
return A && _.endSN === A.endSN && (t = i), a && (t = Math.max(i, t - (performance.now() - a))), Math.round(t);
}
function Y(A) {
return !A.drmSchemaId || A.drmSchemaId === Vr.WIDEVINE;
}
var ce = "playback-rate";
function Ae(A, _, a, t, i) {
a === void 0 && (a = 3), _ = Math.round(_), !t || t.startDelay === _ || _ <= 0 || (t.startDelay = typeof i == "number" ? i : _, t.rule = [{ rate: 1.5, lower: _ + 2 * a + 1, upper: Number.MAX_SAFE_INTEGER }, { rate: 1.25, lower: _ + a + 1, upper: _ + 2 * a }, { rate: 1.1, lower: _ + 1, upper: _ + a }, { rate: 1, lower: 0, upper: _ }], A.i(ce, "update auto playbackRate delay: " + _ + ", step: " + a + " startDelay: " + i, JSON.stringify(t)));
}
var _e = n(11), me = /\.[^./\\?#]+(?=$|[?#])/i, Ce = /\.slice($|\?)/i, Me = { ".mp4": h.i.mp4, ".m4s": h.i.mp4, ".mov": h.i.mp4, ".m4a": h.i.mp4, ".flv": h.i.flv, ".m3u8": h.i.hls, ".sdp": h.i.webrtc, ".webm": h.i.matroska, ".mkv": h.i.matroska, ".mka": h.i.matroska, ".mp3": h.i.mp3, ".wav": h.i.wav, ".aac": h.i.aac, ".ts": h.i.ts, ".yuv": h.i.yuv, ".slice": h.i.flv };
function Ge(A) {
var _ = A.toLocaleLowerCase().match(me);
return _ ? _[0] : "";
}
function xe(A) {
var _ = Ge(A);
return _ && Me[_] || h.i.unknown;
}
function Ze(A) {
return Ce.test(A);
}
var $e = /^[^_][A-Za-z0-9_-]*$/, et = /_([A-Za-z0-9]+)_/;
function st(A) {
var _ = new ze.a(A).pathname, a = xe(A), t = a === h.i.flv || be(a) || a === h.i.ts, i = "", c = "", u = _.split("/"), v = u[u.length - 1] || "";
if (t) {
try {
var R = _.lastIndexOf("/");
R >= 0 && (_ = _.slice(R + 1));
var Q = _.split(".")[0].split("_");
Q.length === 1 ? (i = It(Q[0]), c = Tt(A)) : Q.length === 2 ? (i = It(Q[0]), c = It(Q[1])) : Q.length > 2 && (i = It(Q.slice(0, Q.length - 1).join("_")), c = It(Q[Q.length - 1]));
} catch (se) {
}
return { streamID: i, transcodingTpl: c, filename: v };
}
return { streamID: "", transcodingTpl: Tt(A), filename: v };
}
var Ke, Tt = function(A) {
var _ = A.match(et), a = "";
return _ != null && _.length && _.length > 1 && (a = _[1]), It(a);
}, It = function(A) {
return $e.test(A) ? A : "";
}, ut = function(A) {
return A.FAIL = "FAIL", A.ABORT = "ABORT", A.SUCCESS = "SUCCESS", A.CONNECTED = "CONNECTED", A;
}({}), Et = ((Ke = {})[_e.c.MANIFEST] = L.a.MANIFEST_LOAD_ERROR, Ke[_e.c.LEVEL] = L.a.LEVEL_LOAD_ERROR, Ke[_e.c.AUDIO_TRACK] = L.a.AUDIO_TRACK_LOAD_ERROR, Ke[_e.c.SUBTITLE_TRACK] = L.a.SUBTITLE_TRACK_LOAD_ERROR, Ke);
function ft(A, _, a, t, i) {
var c = typeof _.url == "string" ? _.url : "", u = new ze.a(c).host, v = { domain: u, stream_host: u, download_url: c, download_start_time: a.tsload, download_spend_time: a.tload ? Math.round(a.tload - a.tstart) : Math.round(performance.now() - a.tstart), http_response_time: a.tfirst ? Math.round(a.tfirst - a.tstart) : 0, download_status: A, http_status_code: a.code, retry_index: a.retry, error_code: 0, error_message: "", loader_id: a.id, download_size: a.total || a.loaded || 0, resource_type: _.type || "", use_reset_native_fetch: _.useResetNativeFetch ? 1 : 0 };
_.redirected && (v.redirect = 1), _.responseUrl && c !== _.responseUrl && (v.response_url = _.responseUrl), i && (v.codec = i), t && (v.quality_type = t), _.monkeyPatched && (v.monkey_patched = 1);
var R = _.frag;
if (R && (v.slice_play_start_time = Math.round(1e3 * R.start), R.duration && (v.slice_play_duration = Math.round(1e3 * R.duration)), R.sn && (v.slice_index = R.sn), R.level && (v.slice_level_index = R.level)), A === ut.FAIL) {
var Q = Et[_.type] || L.a.LOAD_ERROR;
v.error_code = Object(L.d)(Q, a.errMessage, a.code);
}
a.errMessage && (v.error_message = a.errMessage), _.responseHeader && (v.response_header = O(_.responseHeader)), typeof _.rangeStart == "number" && (v.range_start = _.rangeStart), _.rangeEnd && (v.range_end = _.rangeEnd);
var se = st(v.download_url);
if (se.transcodingTpl && (v.transcoding_template = se.transcodingTpl), typeof _.url == "string") {
var fe = function(ke) {
if (performance && typeof performance.getEntriesByName == "function") {
var Fe = performance.getEntriesByName(ke, "resource");
if (Fe.length) {
var Ne = Fe[Fe.length - 1], He = {};
return Ne.redirectStart && (He.redirect = Math.round(Ne.redirectEnd - Ne.redirectStart)), He.dns = Math.round(Ne.domainLookupEnd - Ne.domainLookupStart), He.tcp = Math.round(Ne.connectEnd - Ne.connectStart), He.request = Math.round(Ne.requestStart - Ne.connectEnd), He.firstResponse = Math.round(Ne.responseStart - Ne.requestStart), Ne.responseStart > 0 ? He.response = Math.round(Ne.responseEnd - Ne.responseStart) : He.response = Math.round(Ne.responseEnd - Ne.fetchStart), He.duration = Math.round(Ne.duration) || 0, He;
}
}
return null;
}(_.url);
fe && (fe.redirect && (v.time_redirect = fe.redirect), fe.dns && (v.time_dns = fe.dns), fe.tcp && (v.time_tcp = fe.tcp), fe.request && (v.time_request = fe.request), fe.firstResponse && (v.time_first_response = fe.firstResponse), fe.response && (v.time_response = fe.response), fe.duration && (v.duration = fe.duration));
}
return v;
}
var Lt = { beacon: !1, predictStep: 5, targetBuffer: 10, duration: 5, smoothRatioToTarget: 0, switchpanelty: 2.5 * 1e-6, slidingWindowSize: 3, kalmanR: Math.pow(0.2, 2), kalmanQ: 4e-4, initBitrate: 2e6, startBitrateLimit: !0, speedPredictRatio: 1.5, speedPredictNum: 3, algorithm: 1, speedPredictRatioOnStart: 3, lowProfileThreshold: 4, lowProfileBitrate: 25e5, lowProfileStartThreshold: 5 }, Wt = function(A) {
return A[A.Default = 0] = "Default", A[A.Seek = 1] = "Seek", A;
}(Wt || {}), Yt = "kwai_hls_adaptive", hi = "algorithm-hls", Qi = function() {
function A(a) {
this.Do = void 0, this.Ci = void 0, this.Fi = void 0, this.sd = 0, this.rd = 0, this.hd = void 0, this.od = [], this.ad = {}, this.ud = void 0, this.Ct = 0, this.fd = 0, this.Ad = Wt.Default, this.vd = 0, this.dd = !1, this.ld = 0, this.bd = 0, this.pd = 0, this.md = 0, this.ud = new G(), this.Fi = s()({}, Lt), this.Do = a, this.Ci = a.logger;
}
var _ = A.prototype;
return _.init = function(a) {
var t = s()({}, Lt);
this.Fi = s()(t, a), this.md = this.Fi.initBitrate;
}, _.onManifestUpdated = function() {
var a = this, t = this.Do.lctx;
this.md = this.Fi.initBitrate, this.od = [], t.abrLevels.forEach(function(i) {
a.od.push(1e3 * i.bitrate), i.default && (a.md = i.bitrate);
}), this.Ct = Math.min(t.abrDefault, this.od.length - 1), this.Ci.i(hi, "setInfo " + this.od + ", " + this.Ct), this.fd = 0, this.sd = this.Fi.duration, this.rd = 0, this.hd = new Array(this.Fi.slidingWindowSize), this.hd[this.Fi.slidingWindowSize - 1] = 0, this.Ad = Wt.Default, this.ld = this.gd(this.od, this.Fi.lowProfileBitrate);
}, _.destroy = function() {
}, _.bitrateInit = function() {
var a = this, t = this.yd(this.od, this.md), i = this.ud.read(Yt);
if (this.Ci.i(hi, "storage read:" + i), i !== void 0 && i.bitrate >= 0 && i.speed > 0 && i.version === 2) {
i.time && i.lowProfile && Date.now() - i.time < 2592e5 && (this.bd = Math.min(i.lowProfile, this.Fi.lowProfileStartThreshold + 1), this.bd > this.Fi.lowProfileStartThreshold && (this.dd = !0, t = Math.min(t, this.ld)));
var c = Math.min(i.bitrate, 1024 * i.speed / this.Fi.speedPredictRatioOnStart), u = this.od.reduce(function(v, R, Q) {
return Math.abs(R - c) < Math.abs(a.od[v] - c) ? Q : v;
}, 0);
t = this.Fi.startBitrateLimit ? Math.min(t, u) : u;
}
return t;
}, _.onLevelLoad = function(a) {
a < this.od.length && a >= 0 && (this.Ct = a);
}, _.onKeyPoint = function(a) {
if (a.byteLength) {
var t = a.duration || a.spendTime, i = a.byteLength / t * 7.8125;
this.ad = s()({ cache: !1 }, a), this.Ci.v(hi, "report download time:" + t + " bytes:" + a.byteLength + " buffered:" + a.buffered + " speed:" + i + " cache:" + this.ad.cache);
var c = this._d(i, a.buffered / 1e3), u = this.od[c];
u && c !== this.fd && this.ud.write(Yt, { version: 2, index: c, bitrate: u, speed: this.ad && this.ad.speed ? this.ad.speed : 0, lowProfile: Math.max(0, this.dd ? this.bd + 1 : this.bd - 1), time: Date.now() }), this.fd = c, this.ad.speed = i, this.ad.buffered = a.buffered, this.ad.nextBitrate = this.od[this.fd], this.ad.currentBitrate = this.od[this.Ct];
}
}, _.onSeek = function(a) {
this.Ci.v(hi, "report seek buffered:" + a.buffered + " inBuffer:" + a.isInBuffer), a.isInBuffer ? this.Cd() : this.ad.seek = 1, (!a.isInBuffer || a.buffered / 1e3 < this.Fi.targetBuffer) && (this.Ci.i(hi, "status change to seek."), this.Ad = Wt.Seek, this.vd = this.Fi.speedPredictNum);
}, _.onDownloadEnabled = function(a) {
a || this.Cd();
}, _.Cd = function() {
this.sd = 0, this.rd = 0, this.hd = new Array(this.Fi.slidingWindowSize);
}, _._d = function(a, t) {
this.sd = t, this.hd.shift(), this.hd.push(a), this.Ad === Wt.Seek && (t >= this.Fi.targetBuffer || this.vd <= 0) && (this.vd = 0, this.Ad = Wt.Default, this.Ci.i(hi, "status change to default. buffered:" + t + " step:" + this.vd));
var i = -1;
return this.Ad === Wt.Seek ? (this.vd--, this.rd = this.sd, i = this.Id(a)) : i = this.Od(a, t), this.dd && (i = Math.min(i, this.ld)), i;
}, _.Id = function(a) {
var t = 1024 * a, i = this.od[this.Ct];
if (i && (t < i || t > i * this.Fi.speedPredictRatio))
for (var c = this.od.length - 1; c >= 0; c--) {
var u = this.od[c];
if (u && t > u * this.Fi.speedPredictRatio)
return c;
}
return this.Ct;
}, _.Od = function(a, t) {
var i, c = 1024 * a, u = this.od, v = u[this.Ct], R = this.Do.playbackRate;
for (i = u.length - 1; i > 0; i--) {
var Q = u[i];
if (Q && c > Q * R)
break;
}
var se = u[i], fe = this.Ct;
if (typeof se != "number" || typeof v != "number")
return fe;
var ke = t / R;
return se > v ? ke > se * this.Fi.duration / c && (fe = i) : se < v && ke < v * this.Fi.duration / c + this.Fi.duration && (fe = i), this.Ci.v(hi, "_nextRateBySpeedAndBuffered bitrateBySpeed:" + se + ", nextBitrate:" + fe + ", bitrate:" + v + ", remainingTime:" + ke + ", speed:" + c + ", playbackRate:" + R), fe;
}, _.yd = function(a, t) {
return a.reduce(function(i, c, u) {
return (a[i] + c) / 2 >= t ? i : u;
}, 0);
}, _.gd = function(a, t) {
return a.reduce(function(i, c, u) {
return c > t ? i : u;
}, 0);
}, g()(A, [{ key: "nextLevel", get: function() {
return this.fd;
} }, { key: "lowProfile", get: function() {
return this.dd;
} }]);
}(), Xi = { speedPredictRatioOnStart: 6 }, Ci = function() {
function A(a) {
this.Do = void 0, this.wd = void 0, this.Ed = void 0, this.jd = 0, this.Ct = 0, this.Do = a, this.Ed = 0;
}
var _ = A.prototype;
return _.init = function() {
return this.wd = new Qi(this.Do), this.wd.init(this.Do.config.hlsAdaptiveConfig || Xi), this.wd.onManifestUpdated(), this.wd.bitrateInit();
}, _.onAbrLevelsUpdated = function() {
var a;
(a = this.wd) == null || a.onManifestUpdated();
}, _.destory = function() {
this.wd && (this.wd = void 0);
}, _.onDownload = function(a) {
if (this.wd && this.Do.isAbrAvailable && typeof a.slice_play_start_time == "number" && typeof a.slice_play_duration == "number" && Number.isFinite(a.slice_play_start_time) && Number.isFinite(a.slice_play_duration) && a.download_status === ut.SUCCESS) {
this.Ed = a.slice_play_start_time + a.slice_play_duration;
var t = { buffered: this.Ed - 1e3 * this.Do.currentTime, duration: a.duration || 0, spendTime: a.download_spend_time, byteLength: a.download_size };
this.wd.onKeyPoint(t);
}
}, _.onNewSource = function() {
if (this.wd) {
var a = this.Do.lctx.currentIdx;
this.jd = this.jd || performance.now(), a >= 0 && a < this.Do.lctx.levels.length && (this.Ct = a), this.wd.onLevelLoad(this.Do.lctx.orignIndexToAbr(a));
}
}, _.onSeek = function(a) {
this.wd && this.Do.isAbrAvailable && this.wd.onSeek({ isInBuffer: a.isInBuffer, buffered: this.Ed - 1e3 * this.Do.currentTime });
}, _.nextBitrateIndex = function() {
var a = this.Do.lctx;
if (a.abr && this.wd) {
var t = a.abrIndexToOrign(this.wd.nextLevel);
if (t !== this.Ct && t >= 0 && t < a.levels.length)
return t;
}
return this.Ct;
}, _.setDownloadEnabled = function(a) {
this.wd && this.wd.onDownloadEnabled(a);
}, g()(A, [{ key: "abrInitLevel", get: function() {
var a;
return ((a = this.wd) == null ? void 0 : a.bitrateInit()) || 0;
} }]);
}(), Xr = function() {
function A(a) {
var t = this;
this.Do = void 0, this.kd = function() {
t.Do.evt.emit(w.a.MANIFEST_LOADED);
}, this.Do = a;
}
var _ = A.prototype;
return _.loadManifest = function() {
this.kd();
}, _.loadLevel = function() {
}, _.destroy = function() {
}, A;
}(), Ji = n(29), an = { audio: { a3ds: !0, "ac-3": !0, "ac-4": !0, alac: !0, alaw: !0, dra1: !0, "dts+": !0, "dts-": !0, dtsc: !0, dtse: !0, dtsh: !0, "ec-3": !0, enca: !0, g719: !0, g726: !0, m4ae: !0, mha1: !0, mha2: !0, mhm1: !0, mhm2: !0, mlpa: !0, mp4a: !0, "raw ": !0, Opus: !0, samr: !0, sawb: !0, sawp: !0, sevc: !0, sqcp: !0, ssmv: !0, twos: !0, ulaw: !0 }, video: { avc1: !0, avc2: !0, avc3: !0, avc4: !0, avcp: !0, drac: !0, dvav: !0, dvhe: !0, encv: !0, hev1: !0, hvc1: !0, mjp2: !0, mp4v: !0, mvc1: !0, mvc2: !0, mvc3: !0, mvc4: !0, resv: !0, rv60: !0, s263: !0, svc1: !0, svc2: !0, "vc-1": !0, vp08: !0, vp09: !0 } };
function Fr(A) {
var _ = {};
return (A || "").split(/[ ,]+/).forEach(function(a) {
a.indexOf("avc1") !== 0 && a.indexOf("hev1") !== 0 && a.indexOf("av01") !== 0 && a.indexOf("kvc") !== 0 || (_.video = a), a.indexOf("mp4a") === 0 && (_.audio = a);
}), _;
}
function $r(A, _) {
var a = [].concat(A.split(/[ ,]+/));
["video", "audio"].forEach(function(t) {
var i = a.filter(function(u) {
return function(v, R) {
var Q = an[R];
return !!Q && Q[v.slice(0, 4)] === !0;
}(u, t);
});
if (i.length) {
var c = i.filter(function(u) {
return u.lastIndexOf("avc1", 0) === 0 || u.lastIndexOf("av01", 0) === 0 || u.lastIndexOf("hev1", 0) === 0 || u.lastIndexOf("hvc1", 0) === 0 || u.lastIndexOf("mp4a", 0) === 0;
});
_[t + "Codec"] = c.length > 0 ? c[0] : i[0], a = a.filter(function(u) {
return i.indexOf(u) === -1;
});
}
}), _.codec = a.join(",");
}
function jr(A) {
return A.indexOf("avc1") === 0 ? h.c.h264 : A.indexOf("hev1") === 0 || A.indexOf("hvc1") === 0 ? h.c.hevc : A.indexOf("av01") === 0 ? h.c.av1 : h.c.unknown;
}
var $i = function() {
function A(_) {
this.url = [], this.urlId = 0, this.bitrate = 0, this.maxBitrate = 0, this.qualityType = "", this.qualityLabel = "", this.id = 0, this.codec = "", this.audioCodec = "", this.videoCodec = "", this.hidden = !1, this.enableAdaptive = !0, this.default = !1, this.width = void 0, this.height = void 0, this.index = 0, this.drmSchemaId = "", this.drmToken = "", this.hdr = void 0, this.vCodecType = h.c.unknown, this.meta = void 0, this.fileName = void 0, this.fileSize = void 0, this.dropVideo = [], this.url = [_], this.urlId = 0;
}
return A.prototype.getKLevel = function() {
return { width: this.width, height: this.height, qualityLabel: this.qualityLabel, qualityType: this.qualityType, bitrate: this.bitrate, maxBitrate: this.maxBitrate };
}, g()(A, [{ key: "currentUrl", get: function() {
return this.url[this.urlId] || "";
} }]);
}(), Si = function(A) {
function _(t) {
var i;
return (i = A.call(this, t) || this).startSN = 0, i.endSN = 0, i.fragments = [], i.initSegment = null, i.live = !0, i.needSidxRanges = !1, i.startTimeOffset = null, i.targetduration = 0, i.totalduration = 0, i.type = null, i.version = null, i.ptsKnown = !1, i.m3u8Slice = void 0, i.audioGroupIds = void 0, i.attrs = void 0, i.averagetargetduration = void 0, i.name = void 0, i.lang = void 0, i.groupId = "", i.instreamId = "", i.autoselect = void 0, i.forced = void 0, i.size = 0, i.partOfData = !1, i.http416 = 0, i;
}
y()(_, A);
var a = _.prototype;
return a.clear = function() {
this.fragments = [], this.startSN = 0, this.endSN = 0, this.initSegment = null, this.m3u8Slice = void 0, this.live = !0, this.needSidxRanges = !1, this.startTimeOffset = 0;
}, a.mergeFrom = function(t, i) {
if (i === void 0 && (i = !1), t.fragments.length) {
var c = this.endSN;
if (this.endSN = t.endSN, t.partOfData || (t.initSegment && !this.initSegment && (this.initSegment = t.initSegment), this.live = t.live, this.needSidxRanges = t.needSidxRanges, this.targetduration = t.targetduration, this.ptsKnown = t.ptsKnown, this.averagetargetduration = t.averagetargetduration, this.hasFrag || (this.m3u8Slice = t.m3u8Slice, this.audioGroupIds = t.audioGroupIds, this.attrs = t.attrs, this.name = t.name, this.lang = t.lang, this.groupId = t.groupId, this.instreamId = t.instreamId, this.autoselect = t.autoselect, this.forced = t.forced)), i && this.fragments.length) {
for (var u, v = t.fragments.length, R = 0; R < t.fragments.length; R++) {
var Q = t.fragments[R].sn;
if (typeof Q == "number" && Q > c) {
v = R;
break;
}
}
if (this.fragments.length && t.fragments.splice(0, v), t.partOfData) {
var se = this.fragments[this.fragments.length - 1], fe = se.endPTS, ke = se.cc;
fe && t.fragments.forEach(function(Fe) {
Fe.start = Fe.startPTS = fe, Fe.endPTS = Fe.startPTS + Fe.duration, fe = Fe.endPTS, Fe.cc = ke + Fe.cc;
});
}
(u = this.fragments).push.apply(u, t.fragments), this.totalduration = this.fragments.reduce(function(Fe, Ne) {
return Fe + Ne.duration;
}, 0), t.partOfData ? this.size += t.size : this.size = t.size;
} else
this.startSN = t.startSN, this.fragments = t.fragments, this.totalduration = t.totalduration, this.size = t.size;
}
}, a.getTimeInfoAfter = function(t) {
t === void 0 && (t = 0);
var i, c, u = [], v = [];
return this.fragments.forEach(function(R) {
typeof R.sn == "number" && (R.sn >= t && typeof c == "number" && c !== R.cc && (i ? i.push({ sn: R.sn, start: R.start }) : i = [{ sn: R.sn, start: R.start }]), c = R.cc, R.sn >= t && (u.push(R.start), typeof R.programDateTime == "number" && v.push(R.programDateTime)));
}), { live: this.live, startSn: this.startSN, endSn: this.endSN, duration: this.totalduration, times: u, utcs: v, discontinuity: i, targetduration: this.targetduration };
}, g()(_, [{ key: "timeInfo", get: function() {
return this.getTimeInfoAfter();
} }, { key: "hasProgramDateTime", get: function() {
return !(!this.fragments[0] || typeof this.fragments[0].programDateTime != "number" || !Number.isFinite(this.fragments[0].programDateTime));
} }, { key: "hasFrag", get: function() {
return this.fragments.length > 0;
} }]);
}($i), nr = function() {
function A() {
}
return A.verify = function(_) {
return !!(_ && _.adaptationSet && _.adaptationSet.representation && _.adaptationSet.representation.length) && _.adaptationSet.representation.reduce(function(a, t) {
return !!(t.url && t.bandwidth && a);
}, !0);
}, A.parse = function(_) {
var a = [];
return A.verify(_) && _.adaptationSet.representation.forEach(function(t) {
if (t && (t.url || t.m3u8)) {
var i = new Si(t.baseUrl ? Object(Ji.buildAbsoluteURL)(t.baseUrl, t.url, { alwaysNormalize: !0 }) : t.url);
i.bitrate = Math.floor(t.bandwidth / 1e3), i.maxBitrate = Math.floor(t.bandwidth / 1e3), i.qualityType = t.qualityType || "", i.qualityLabel = t.qualityLabel || "", t.width && t.height && (i.width = t.width, i.height = t.height), $r(t.codecs || "", i), i.audioCodec = "", i.m3u8Slice = t.m3u8 || t.m3u8Slice, i.totalduration = t.duration, t.backupUrl && t.backupUrl.length && (i.url = i.url.concat(t.backupUrl)), i.default = t.defaultSelect || !1, i.urlId = 0, a.push(i);
}
}), { levels: a, def: 0 };
}, A;
}(), sn = function() {
return g()(function(A, _) {
this.Md = null, this.baseuri = void 0, this.reluri = void 0, this.method = null, this.key = null, this.iv = void 0, this.baseuri = A, this.reluri = _;
}, [{ key: "uri", get: function() {
return !this.Md && this.reluri && (this.Md = Object(Ji.buildAbsoluteURL)(this.baseuri, this.reluri, { alwaysNormalize: !0 })), this.Md;
} }]);
}(), on = function(A) {
return A.AUDIO = "audio", A.VIDEO = "video", A;
}({}), Ti = function() {
function A() {
var a;
this.Sd = "", this.Bd = null, this.Mh = null, this.Td = ((a = {})[on.AUDIO] = !1, a[on.VIDEO] = !1, a), this.rawProgramDateTime = null, this.programDateTime = null, this.tagList = [], this.relurl = void 0, this.baseurl = void 0, this.duration = void 0, this.sn = 0, this.levelkey = void 0, this.level = 0, this.start = 0, this.cc = 0, this.maxStartPTS = 0, this.startPTS = void 0, this.endPTS = void 0, this.startDTS = void 0, this.endDTS = void 0, this.deltaPTS = void 0, this.dropped = 0, this.type = void 0, this.loader = void 0, this.title = null, this.urlId = 0, this.data = void 0;
}
var _ = A.prototype;
return _.setByteRange = function(a, t) {
var i = a.split("@", 2), c = [];
i.length === 1 ? c[0] = t ? t.byteRangeEndOffset : 0 : c[0] = parseInt(i[1], 10), c[1] = parseInt(i[0], 10) + c[0], this.Bd = c;
}, _.addElementaryStream = function(a) {
this.Td[a] = !0;
}, _.hasElementaryStream = function(a) {
return this.Td[a] === !0;
}, _.createInitializationVector = function(a) {
for (var t = new Uint8Array(16), i = 12; i < 16; i++)
t[i] = a >> 8 * (15 - i) & 255;
return t;
}, _.setDecryptDataFromLevelKey = function(a, t) {
var i = a;
return a && a.method && a.uri && !a.iv && ((i = new sn(a.baseuri, a.reluri)).method = a.method, i.iv = this.createInitializationVector(t)), i;
}, g()(A, [{ key: "url", get: function() {
return !this.Sd && this.relurl && (this.Sd = Object(Ji.buildAbsoluteURL)(this.baseurl, this.relurl, { alwaysNormalize: !0 })), this.Sd;
}, set: function(a) {
this.Sd = a;
} }, { key: "byteRange", get: function() {
return this.Bd ? this.Bd : [];
} }, { key: "byteRangeStartOffset", get: function() {
return this.byteRange[0];
} }, { key: "byteRangeEndOffset", get: function() {
return this.byteRange[1];
} }, { key: "decryptdata", get: function() {
if (!this.levelkey && !this.Mh)
return null;
if (!this.Mh && this.levelkey) {
var a = this.sn;
typeof a != "number" && (a = 0), this.Mh = this.setDecryptDataFromLevelKey(this.levelkey, a);
}
return this.Mh;
} }, { key: "endProgramDateTime", get: function() {
if (this.programDateTime === null || !Number.isFinite(this.programDateTime))
return null;
var a = Number.isFinite(this.duration) ? this.duration : 0;
return this.programDateTime + 1e3 * a;
} }, { key: "encrypted", get: function() {
return !(!this.decryptdata || this.decryptdata.uri === null || this.decryptdata.key !== null);
} }]);
}(), ma = function(A) {
return A[A.LongVideo = 1] = "LongVideo", A[A.ShortVideo = 2] = "ShortVideo", A[A.LiveGame = 3] = "LiveGame", A[A.LiveShow = 4] = "LiveShow", A[A.LivePlayBack = 5] = "LivePlayBack", A;
}({}), Xa = { 1: h.i.hls_ts, 2: h.i.mp4, 3: h.i.flv, 4: h.i.hls_fmp4 }, ia = { avc: h.c.h264, hevc: h.c.hevc, av1: h.c.av1, kvc3: h.c.kvc3, kvc4: h.c.kvc4, kvc5: h.c.kvc5, kvc6: h.c.kvc6, kvc30: h.c.kvc30 };
function Hn(A) {
var _ = h.i.unknown;
if (A && A.length < 2048)
for (var a = A.split(`
`), t = 0; t < a.length; t++) {
var i = a[t].trim();
i && i.indexOf("#") !== 0 && (_ = xe(i));
}
return _ === h.i.ts ? h.i.hls_ts : _ === h.i.mp4 ? h.i.hls_fmp4 : h.i.unknown;
}
var yn = function() {
function A() {
}
return A.verify = function(_) {
return !!(_ && _.adaptationSet && _.adaptationSet.length) && _.adaptationSet.reduce(function(a, t) {
return !!(a && t.representation && t.representation.length);
}, !0);
}, A.parse = function(_, a) {
a === void 0 && (a = !1);
var t, i, c, u, v, R, Q, se, fe, ke = [], Fe = !1, Ne = 0, He = [], rt = {};
if (A.verify(_)) {
var Qe = _;
R = Xa[Qe.mediaType], Q = Qe.stereoType === 1 ? h.n.V360 : h.n.Normal, Qe.businessType !== void 0 && (se = Qe.businessType >= 3 && Qe.businessType <= 5), Qe.businessType === ma.LivePlayBack && (fe = !0), Qe.version && (rt.version = Qe.version), Qe.videoId && (rt.videoId = Qe.videoId), Qe.videoBaseFeature && (rt.videoBaseFeature = Qe.videoBaseFeature), Qe.videoAestheticFeature && (rt.videoAestheticFeature = Qe.videoAestheticFeature), Qe.videoFeature && (rt.videoFeature = Qe.videoFeature), typeof Qe.programStartTime == "number" && (rt.programStartTime = Qe.programStartTime), Qe.adaptationSet.forEach(function(ti) {
var _i = ti.duration / 1e3;
se === void 0 && _i && (se = !1), !Ne && _i && (Ne = _i);
var Nn = ti.drmSchemaId, kn = ti.drmToken;
ti.drmSchemaId && (Fe = !0);
var ci = h.f.MAIN;
if (ti.mimeType && (ti.mimeType.indexOf("video") !== -1 ? rt.videoMimeType = ti.mimeType : ti.mimeType.indexOf("audio") !== -1 ? (rt.audioMimeType = ti.mimeType, ci = h.f.AUDIO) : ti.mimeType === "text/vtt" ? (rt.subtitleMimeType = ti.mimeType, ci = h.f.SUBTITLE) : ci = void 0), ci) {
ci === h.f.MAIN ? rt.videoDuration = ti.duration : ci === h.f.AUDIO && (rt.audioDuration = ti.duration);
var er = ti.representation.map(function(Nt, fn) {
var kt;
if (!R && Nt.m3u8Slice && (R = Hn(Nt.m3u8Slice)), R || (R = xe(Nt.url)), be(R) ? ((kt = new Si(Nt.url)).lang = ti.language || "", kt.default = !!Nt.defaultSelect, kt.id = Nt.id || fn, kt.m3u8Slice = Nt.m3u8Slice, kt.totalduration = _i || Ne) : kt = new $i(Nt.url), typeof Nt.fileSize == "number" && (kt.fileSize = Nt.fileSize), kt.vCodecType = h.c.unknown, kt.hdr = Nt.hdrType || 0, kt.maxBitrate = Nt.maxBitrate || 0, kt.bitrate = Nt.avgBitrate || kt.maxBitrate, kt.qualityType = Nt.qualityType || "", kt.qualityLabel = Nt.qualityLabel || "", kt.codec = Nt.codecs || "", kt.codec) {
var wa = Fr(kt.codec);
kt.videoCodec = wa.video || "", kt.vCodecType = jr(kt.videoCodec);
}
return Nt.videoCodec && ia[Nt.videoCodec] && (kt.vCodecType = ia[Nt.videoCodec] || h.c.unknown), He.push(kt.vCodecType), Qe.adaptationSet.length === 1 && (kt.audioCodec = ""), Nt.width && Nt.height && (kt.width = Nt.width, kt.height = Nt.height), kt.hidden = Nt.hidden || !1, kt.enableAdaptive = Nt.disableAdaptive === void 0 || !Nt.disableAdaptive, kt.default = Nt.defaultSelect || !1, kt.index = fn, kt.drmSchemaId = Nt.drmSchemaId || Nn, kt.drmToken = Nt.drmToken || kn, kt.drmSchemaId && (Fe = !0), Nt.backupUrl && Nt.backupUrl.length && (kt.url = kt.url.concat(Nt.backupUrl)), kt.urlId = 0, kt.default && c === void 0 && (ci === h.f.MAIN ? c = fn : ci === h.f.AUDIO ? u = fn : ci === h.f.SUBTITLE && (v = fn)), (Nt.comment || Nt.kvqScore) && (kt.meta = { comment: Nt.comment, kvqScore: Nt.kvqScore }), kt;
});
ci === h.f.MAIN ? ke = ke.concat(er) : ci === h.f.AUDIO ? (t || (t = []), t = t.concat(er)) : ci === h.f.SUBTITLE && (i || (i = []), i = i.concat(er));
}
});
}
if (i && A.processingSubtitleType(i, Ne), a)
return [{ codecType: He.length === 1 ? He[0] : h.c.unknown, mediaLevels: { levels: ke, def: c || 0, audioTracks: t, defAudio: u || 0, subtitleTracks: i, defSubtitle: v || 0, drm: Fe, box: R, stereoType: Q, isLive: se, meta: rt } }];
var _t = {};
ke.forEach(function(ti) {
var _i = _t[ti.vCodecType];
_i || (_t[ti.vCodecType] = _i = { def: 0, levels: [] }), ti.default && (_i.def = _i.levels.length), _i.levels.push(ti);
});
var dt = Object.keys(_t).length, Rt = [];
for (var gi in _t) {
var Ht = _t[gi];
if (Ht) {
var Pi = Ht.levels[0];
if (dt > 1 && Pi && Pi.m3u8Slice) {
var Oi = Hn(Pi.m3u8Slice);
be(Oi) && (R = Oi);
}
Rt.push({ codecType: gi, mediaLevels: { levels: Ht.levels, def: Ht.def, audioTracks: t, defAudio: u || 0, subtitleTracks: i, defSubtitle: v || 0, drm: Fe, box: R, stereoType: Q, isLive: se, isLiveShift: fe, meta: rt } });
}
}
return Rt;
}, A.processingSubtitleType = function(_, a) {
_.forEach(function(t, i) {
if (xe(t.currentUrl) === h.i.hls) {
t.live = !1, t.index = i, t.totalduration = a, t.targetduration = a, t.endSN = 1;
var c = new Ti();
c.type = h.f.SUBTITLE, c.start = 0, c.sn = 1, c.level = i, c.cc = 0, c.url = t.currentUrl, c.duration = a, t.fragments = [c];
}
});
}, A.getAdaptationIdxByType = function(_, a) {
for (var t = 0; t < _.adaptationSet.length; t++) {
var i = _.adaptationSet[t];
if (i) {
var c;
if (i.mimeType === void 0)
return a === "video" ? 0 : -1;
if (((c = i.mimeType) == null ? void 0 : c.indexOf(a)) === 0)
return t;
}
}
return -1;
}, A;
}(), xp = /^(\d+)x(\d+)$/, Ac = /\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g, ba = function() {
function A(a) {
for (var t in typeof a == "string" && (a = A.parseAttrList(a)), a)
Object.prototype.hasOwnProperty.call(a, t) && (this[t] = a[t]);
}
var _ = A.prototype;
return _.decimalInteger = function(a) {
var t = parseInt(this[a], 10);
return t > Number.MAX_SAFE_INTEGER ? 1 / 0 : t;
}, _.hexadecimalInteger = function(a) {
if (this[a]) {
var t = (this[a] || "0x").slice(2);
t = (1 & t.length ? "0" : "") + t;
for (var i = new Uint8Array(t.length / 2), c = 0; c < t.length / 2; c++)
i[c] = parseInt(t.slice(2 * c, 2 * c + 2), 16);
return i;
}
return null;
}, _.hexadecimalIntegerAsNumber = function(a) {
var t = parseInt(this[a], 16);
return t > Number.MAX_SAFE_INTEGER ? 1 / 0 : t;
}, _.decimalFloatingPoint = function(a) {
return parseFloat(this[a]);
}, _.optionalFloat = function(a, t) {
var i = this[a];
return i ? parseFloat(i) : t;
}, _.enumeratedString = function(a) {
return this[a];
}, _.bool = function(a) {
return this[a] === "YES";
}, _.decimalResolution = function(a) {
var t = xp.exec(this[a]);
if (t)
return { width: parseInt(t[1], 10), height: parseInt(t[2], 10) };
}, A.parseAttrList = function(a) {
var t, i = {};
for (Ac.lastIndex = 0; (t = Ac.exec(a)) !== null; ) {
var c = t[2];
c.indexOf('"') === 0 && c.lastIndexOf('"') === c.length - 1 && (c = c.slice(1, -1)), i[t[1]] = c;
}
return i;
}, A;
}(), vc = /#EXT-X-STREAM-INF:([^\n\r]*)[\r\n]+([^\r\n]+)/g, gc = /#EXT-X-MEDIA:(.*)/g, mc = new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source, /|(?!#)([\S+ ?]+)/.source, /|#EXT-X-BYTERANGE:*(.+)/.source, /|#EXT-X-PROGRAM-DATE-TIME:(.+)/.source, /|#.*/.source].join(""), "g"), Mp = /(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE): *(\d+))|(?:#EXT-X-(TARGETDURATION): *(\d+))|(?:#EXT-X-(KEY):(.+))|(?:#EXT-X-(START):(.+))|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DISCONTINUITY-SEQ)UENCE:(\d+))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(VERSION):(\d+))|(?:#EXT-X-(MAP):(.+))|(?:(#)([^:]*):(.*))|(?:(#)(.*))(?:.*)\r?\n?/, Pp = /\.(mp4|m4s|m4v|m4a)$/i, bc = "m3u8-parser";
function Up(A, _) {
A.rawProgramDateTime ? A.programDateTime = Date.parse(A.rawProgramDateTime) || parseInt(A.rawProgramDateTime) : _ && _.programDateTime && (A.programDateTime = _.endProgramDateTime), typeof A.programDateTime == "number" && Number.isFinite(A.programDateTime) || (A.programDateTime = null, A.rawProgramDateTime = null);
}
var Ea = function() {
function A() {
}
return A.Dd = function(_, a) {
for (var t = 0; t < _.length; t++) {
var i = _[t];
if (i.id === a)
return i;
}
}, A.Rd = function(_) {
var a, t = _.split(".");
return t.length > 2 ? (a = t.shift() + ".", a += parseInt(t.shift(), 10).toString(16), a += ("000" + parseInt(t.shift(), 10).toString(16)).substr(-4)) : a = _, a;
}, A.Ld = function(_, a) {
return Object(Ji.buildAbsoluteURL)(a, _, { alwaysNormalize: !0 });
}, A.parseMasterPlaylist = function(_, a) {
var t, i = [];
for (vc.lastIndex = 0; (t = vc.exec(_)) !== null; ) {
var c = new Si(A.Ld(t[2], a)), u = c.attrs = new ba(t[1]), v = u.decimalResolution("RESOLUTION");
v && (c.width = v.width, c.height = v.height), c.maxBitrate = u.decimalInteger("BANDWIDTH") / 1e3;
var R = u.decimalInteger("AVERAGE-BANDWIDTH") / 1e3;
c.bitrate = R || c.maxBitrate, c.name = u.NAME, $r(u.CODECS || "", c), c.videoCodec && c.videoCodec.indexOf("avc1") !== -1 && (c.vCodecType = jr(c.videoCodec), c.videoCodec = A.Rd(c.videoCodec)), i.push(c);
}
return i;
}, A.parseMasterPlaylistMedia = function(_, a, t, i) {
var c;
i === void 0 && (i = []);
var u = [], v = 0;
for (gc.lastIndex = 0; (c = gc.exec(_)) !== null; ) {
var R = new ba(c[1]);
if (R.TYPE === t) {
var Q = new Si(R.URI ? A.Ld(R.URI, a) : "");
if (Q.attrs = R, Q.index = Q.id = v++, Q.groupId = R["GROUP-ID"] || "", Q.instreamId = R["INSTREAM-ID"] || "", Q.name = R.NAME || R.LANGUAGE, Q.type = t, Q.default = R.DEFAULT === "YES", Q.autoselect = R.AUTOSELECT === "YES", Q.forced = R.FORCED === "YES", Q.lang = R.LANGUAGE || "", i.length) {
var se = A.Dd(i, Q.groupId);
Q.audioCodec = se ? se.codec : i[0].codec;
}
u.push(Q);
}
}
return u;
}, A.parseLevelPlaylist = function(_, a, t, i, c, u, v) {
c === void 0 && (c = h.f.MAIN), u === void 0 && (u = 0), v === void 0 && (v = 0);
var R, Q, se, fe = v, ke = 0, Fe = 0, Ne = null, He = new Ti(), rt = null, Qe = new Si(t);
for (mc.lastIndex = 0; (Q = mc.exec(a)) !== null; ) {
var _t = Q[1];
if (_t) {
He.duration = parseFloat(_t);
var dt = (" " + Q[2]).slice(1);
He.title = dt || null, He.tagList.push(dt ? ["INF", _t, dt] : ["INF", _t]);
} else if (Q[3]) {
if (Number.isFinite(He.duration)) {
var Rt = fe++;
He.type = c, He.start = ke, He.levelkey = R, He.sn = Rt, He.level = i, He.cc = Fe, He.urlId = u, He.baseurl = t, He.relurl = (" " + Q[3]).slice(1), Up(He, Ne), Qe.fragments.push(He), Ne = He, ke += He.duration, He = new Ti();
}
} else if (Q[4]) {
var gi = (" " + Q[4]).slice(1);
Ne ? He.setByteRange(gi, Ne) : He.setByteRange(gi);
} else if (Q[5])
He.rawProgramDateTime = (" " + Q[5]).slice(1), He.tagList.push(["PROGRAM-DATE-TIME", He.rawProgramDateTime]), rt === null && (rt = Qe.fragments.length);
else {
if (!(Q = Q[0].match(Mp)) || Q.length <= 0)
break;
for (se = 1; se < Q.length && Q[se] === void 0; se++)
;
var Ht = (" " + Q[se + 1]).slice(1), Pi = (" " + Q[se + 2]).slice(1);
switch (Q[se]) {
case "#":
He.tagList.push(Pi ? [Ht, Pi] : [Ht]);
break;
case "PLAYLIST-TYPE":
Qe.type = Ht.toUpperCase();
break;
case "MEDIA-SEQUENCE":
fe = Qe.startSN = parseInt(Ht, 10);
break;
case "TARGETDURATION":
Qe.targetduration = parseFloat(Ht);
break;
case "VERSION":
Qe.version = parseInt(Ht, 10);
break;
case "EXTM3U":
break;
case "ENDLIST":
Qe.live = !1;
break;
case "DIS":
Fe++, He.tagList.push(["DIS"]);
break;
case "DISCONTINUITY-SEQ":
Fe = parseInt(Ht, 10);
break;
case "KEY":
var Oi = new ba(Ht), ti = Oi.enumeratedString("METHOD"), _i = Oi.URI, Nn = Oi.hexadecimalInteger("IV");
ti && (R = new sn(t, _i), _i && ["AES-128", "SAMPLE-AES", "SAMPLE-AES-CENC"].indexOf(ti) >= 0 && (R.method = ti, R.key = null, Nn && (R.iv = Nn)));
break;
case "START":
var kn = new ba(Ht).decimalFloatingPoint("TIME-OFFSET");
Number.isFinite(kn) && (Qe.startTimeOffset = kn);
break;
case "MAP":
var ci = new ba(Ht);
He.relurl = ci.URI, ci.BYTERANGE && He.setByteRange(ci.BYTERANGE), He.baseurl = t, He.level = i, He.type = c, He.sn = "initSegment", Qe.initSegment = He, (He = new Ti()).rawProgramDateTime = Qe.initSegment.rawProgramDateTime;
break;
default:
_.w(bc, "line parsed but not handled: " + Q);
}
}
}
return (He = Ne) && !He.relurl && (Qe.fragments.pop(), ke -= He.duration), Qe.totalduration = ke, Qe.averagetargetduration = ke / Qe.fragments.length, Qe.endSN = fe - 1, !Qe.initSegment && Qe.fragments.length && Qe.fragments.every(function(er) {
return Pp.test(er.relurl);
}) && (_.w(bc, "MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"), (He = new Ti()).relurl = Qe.fragments[0].relurl, He.baseurl = t, He.level = i, He.type = c, He.sn = "initSegment", Qe.initSegment = He, Qe.needSidxRanges = !0), rt && function(er, Nt) {
for (var fn = er[Nt], kt = Nt - 1; kt >= 0; kt--) {
var wa = er[kt];
fn && fn.programDateTime && (wa.programDateTime = fn.programDateTime - 1e3 * wa.duration), fn = wa;
}
}(Qe.fragments, rt), Qe;
}, A;
}(), Bp = function() {
function A() {
}
return A.parse = function(_) {
return nr.verify(_) ? nr.parse(_) : yn.verify(_) ? yn.parse(_)[0].mediaLevels : { levels: [], def: 0 };
}, A.parseLevelSlice = function(_, a, t) {
if (a.m3u8Slice) {
var i = Ea.parseLevelPlaylist(_, a.m3u8Slice, a.url[0], a.index, t, 0);
return delete a.m3u8Slice, i.fragments.length === 0 ? void 0 : i;
}
}, A;
}(), Vp = new RegExp('codecs="((/w|.)+)"'), Gs = [{ k: "video/mp4", v: h.i.mp4 }, { k: "video/quicktime", v: h.i.mp4 }, { k: "video/x-flv", v: h.i.flv }, { k: "video/webm", v: h.i.matroska }, { k: "video/x-matroska", v: h.i.matroska }, { k: "video/mp2t", v: h.i.ts }, { k: "audio/x-matroska", v: h.i.matroska }, { k: "audio/mp4", v: h.i.mp4 }, { k: "audio/mpeg", v: h.i.mp3 }, { k: "audio/aac", v: h.i.aac }, { k: "application/vnd.apple.mpegurl", v: h.i.hls }, { k: "application/x-mpegurl", v: h.i.hls }, { k: "audio/wave", v: h.i.wav }, { k: "audio/wav", v: h.i.wav }, { k: "audio/x-wav", v: h.i.wav }, { k: "audio/x-pn-wav", v: h.i.wav }];
function zs(A) {
for (var _ = { type: A, box: h.i.unknown, vCodec: h.c.unknown }, a = 0; a < Gs.length; a++)
if (A.toLocaleLowerCase().indexOf(Gs[a].k) === 0) {
_.box = Gs[a].v;
var t = A.match(Vp);
t && t.length > 2 && t[1].split(",").forEach(function(i) {
i.indexOf("avc1") === 0 ? _.vCodec = h.c.h264 : i.indexOf("av01") === 0 ? _.vCodec = h.c.av1 : i.indexOf("hev1") !== 0 && i.indexOf("hvc1") !== 0 || (_.vCodec = h.c.hevc);
});
break;
}
return _;
}
var Ec = function() {
function A() {
}
return A.verify = function(_) {
return !!(_ && Object.prototype.hasOwnProperty.call(_, "version") && Object.prototype.hasOwnProperty.call(_, "adaptationSet") && Object.prototype.hasOwnProperty.call(_.adaptationSet, "representation") && Array.isArray(_.adaptationSet.representation) && _.adaptationSet.representation.length > 0) && _.adaptationSet.representation.reduce(function(a, t) {
return !!(a && t.url && t.bitrate && t.qualityType);
}, !0);
}, A.parse = function(_) {
var a, t = [];
return A.verify(_) && _.adaptationSet.representation.forEach(function(i, c) {
var u = new $i(i.url);
u.id = i.id || c, u.maxBitrate = i.bitrate || 0, u.bitrate = i.averageBitrate || u.maxBitrate, u.qualityType = i.qualityType || "", u.qualityLabel = i.name || "", u.codec = i.codec || "", u.hidden = i.hidden || !1, u.enableAdaptive = i.enableAdaptive === void 0 || !!i.enableAdaptive, u.default = i.defaultSelect || !1, u.index = c, t.push(u), u.default && a === void 0 && (a = c);
}), { levels: t, def: a || 0, srcType: h.l.KWAI_FLV_ABR };
}, A;
}(), yc = function() {
function A() {
}
return A.verify = function(_) {
return !!(_ && Object.prototype.hasOwnProperty.call(_, "segments") && Array.isArray(_.segments) && _.segments.length > 0) && (_.segments.forEach(function(a) {
if (!a.url || !a.duration || !a.time)
return !1;
}), !0);
}, A.parse = function(_, a) {
a === void 0 && (a = "");
var t = [], i = { levels: t, withCredentials: !1, hasVideo: !0, hasAudio: !0 };
if (A.verify(_)) {
var c = new Si("");
t.push(c);
var u = _;
i.withCredentials = !!u.withCredentials, u.hasAudio !== void 0 && (i.hasAudio = !!u.hasAudio), u.hasVideo !== void 0 && (i.hasVideo = !!u.hasVideo);
var v = 0, R = 0, Q = 0, se = 0, fe = 0;
u.segments.forEach(function(ke, Fe) {
var Ne = new Ti();
Ne.sn = Fe, typeof ke.startUtcTime == "string" ? Ne.programDateTime = parseInt(ke.startUtcTime) : typeof ke.startUtcTime == "number" && (Ne.programDateTime = ke.startUtcTime), typeof ke.duration == "string" ? Ne.duration = (parseFloat(ke.duration) || 0) / 1e3 : Ne.duration = (ke.duration || 0) / 1e3, Ne.start = v, Ne.baseurl = a, Ne.relurl = ke.url, ke.filesize && (fe += ke.filesize), Ne.duration > se && (se = Ne.duration), v += Ne.duration, Fe > 0 && Q !== ke.periodId && (Ne.tagList.push(["DIS"]), R++), Ne.cc = R, Q = ke.periodId, c.fragments.push(Ne);
}), c.bitrate = 8 * fe / 1024 / c.totalduration, c.live = !1, c.type = h.f.MAIN, c.startSN = 0, c.endSN = c.fragments.length - 1, c.totalduration = v, c.targetduration = se, c.averagetargetduration = v / c.fragments.length;
}
return i;
}, A;
}(), Cc = new RegExp("^((http|https)://)|blob:"), Fp = [h.i.matroska, h.i.mp3, h.i.aac], jp = [h.i.flv, h.i.raw, h.i.webrtc, h.i.ivf], Hp = [h.i.mp4, h.i.flv, h.i.hls, h.i.raw, h.i.hls_fmp4, h.i.hls_ts, h.i.ts, h.i.ivf], Tc = Object.values(h.c), Bt = "media-src", Ks = function() {
function A() {
}
return A.verifyMix = function(_) {
var a = 0;
for (var t in _)
Tc.indexOf(t) !== -1 && a++;
return a > 0;
}, A.isSrcEmpty = function(_) {
try {
if (typeof _ == "string") {
if (!(_ = _.trim()))
return !0;
if (!Cc.test(_))
return Object.keys(JSON.parse(_)).length === 0;
} else if (!(_ instanceof Blob))
return !_ || Object.keys(_).length === 0;
} catch (a) {
}
return !1;
}, A.filteringLevels = function(_, a, t) {
t === void 0 && (t = !1), _.i(Bt, "filteringLevels. input: " + a.levels.length + ". mse: " + ht.isMSEAvailable() + " mixCodec: " + t);
var i = $.a.chrome || $.a.firefox;
a.levels.forEach(function(v) {
i && v.audioCodec && v.audioCodec.indexOf("mp4a.40.34") !== -1 && (v.audioCodec = "");
});
var c = ht.isMSEAvailable() ? ht.isMSECodecStrSupportedInMp4 : ht.isVideoCodecStrSupportedInMp4, u = ht.isMSEAvailable() ? ht.isMSECodecSupported : ht.isVideoCodecSupported;
return a.levels = a.levels.filter(function(v) {
var R = !v.audioCodec || c(v.audioCodec, "audio"), Q = typeof v.hdr == "number" && v.hdr > 0, se = !0;
(t || v.vCodecType === h.c.av1 || $.a.mobile) && ((se = v.videoCodec ? c(v.videoCodec) : v.vCodecType === h.c.unknown || u(v.vCodecType, ht.getPlayTestDefinition(v), Q)) || _.i(Bt, "filteringLevels. " + v.qualityType + " v unsupported. codec: " + v.vCodecType + " hdr: " + Q), v.qualityType.toLocaleLowerCase().indexOf("4k") >= 0 && ($.a.mobile && (se = !1), se || _.i(Bt, "filteringLevels. " + v.qualityType + " v unsupported. mobile: " + $.a.mobile)));
var fe = Y(v);
return fe || _.i(Bt, "filteringLevels. " + v.qualityType + " v unsupported. drm: " + v.drmSchemaId), R && se && fe;
}), a.audioTracks && (a.audioTracks = a.audioTracks.filter(function(v) {
var R = !v.audioCodec || c(v.audioCodec, "audio");
R || _.i(Bt, "filteringLevels. " + v.qualityType + " a unsupported. codec: " + v.audioCodec);
var Q = Y(v);
return Q || _.i(Bt, "filteringLevels. " + v.qualityType + " a unsupported. drm: " + v.drmSchemaId), R && Q;
}), a.audioTracks.forEach(function(v) {
i && v.audioCodec && v.audioCodec.indexOf("mp4a.40.34") !== -1 && (v.audioCodec = "");
})), A.initLevelsDefault(_, a), a;
}, A.initLevelsDefault = function(_, a) {
return _.i(Bt, "init level default"), a.def = -1, a.levels.forEach(function(t, i) {
t.index = i, t.default && (a.def = i);
}), a.def < 0 && (a.def = a.levels.reduce(function(t, i, c) {
return i.bitrate < a.levels[t].bitrate ? c : t;
}, 0), _.i(Bt, "no default main level, select lowest bit rate idx: " + a.def)), _.i(Bt, "audio level default: " + a.def), a.audioTracks && a.audioTracks.length && (a.defAudio = void 0, a.audioTracks.forEach(function(t, i) {
t.index = i, t.default && (a.defAudio = i);
}), a.defAudio === void 0 && (a.defAudio = 0), _.i(Bt, "audio level default: " + a.defAudio)), a.subtitleTracks && a.subtitleTracks.length && (a.subtitleTracks.forEach(function(t, i) {
t.index = i, t.default && (a.defSubtitle = i);
}), a.defSubtitle === void 0 && (a.defSubtitle = 0), _.i(Bt, "subtitle level default: " + a.defSubtitle)), a;
}, A.preParse = function(_, a, t, i, c) {
if (c === void 0 && (c = ""), _.i(Bt, "pre parse. native: " + t + ", codecType: " + i + ", baseUrl: " + c), typeof a == "string") {
var u = this.Nd(_, a);
if (!u)
return [{ src: a, box: h.i.unknown, srcType: h.l.OTHERS }];
a = u;
} else
a instanceof Blob || (a = JSON.parse(JSON.stringify(a)));
if (Array.isArray(a)) {
_.i(Bt, "input mix container.", a.length);
var v = [], R = [];
a.forEach(function(fe) {
if (fe != null && fe.src) {
var ke = { info: A.Qd(_, fe.src, t, i, c), priority: 0, mime: void 0 };
v.push(ke.info.box), fe.type && (ke.mime = zs(fe.type)), R.push(ke);
}
});
for (var Q = 0; Q < R.length; Q++) {
var se = R[Q];
if (se.info && se.info.src) {
if (se.mime && (se.mime.box !== h.i.unknown && (se.info.box = se.mime.box), se.mime.vCodec !== h.c.unknown && (se.info.codecType = se.mime.vCodec)), t !== void 0 && t !== se.info.nativeFirst || se.priority++, se.info.nativeFirst)
se.priority += se.info.box === h.i.unknown ? 1 : ht.isVideoBoxSupported(se.info.box) ? 2 : -100, se.priority += se.info.codecType === h.c.unknown ? 1 : i && i === se.info.codecType || ht.isVideoCodecSupported(se.info.codecType) ? 2 : -100;
else {
if (!ht.isMSEAvailable())
continue;
se.priority += se.info.box === h.i.unknown ? 1 : Hp.indexOf(se.info.box) >= 0 ? 2 : -100, se.priority += se.info.codecType === h.c.unknown ? 1 : i && i === se.info.codecType || ht.isMSECodecSupported(se.info.codecType) ? 2 : -100;
}
_.i(Bt, "input mix container. media desc " + Q + ". box: " + se.info.box + " codec: " + se.info.codecType + " priority: " + se.priority);
}
}
return R.sort(function(fe, ke) {
return ke.priority - fe.priority;
}).filter(function(fe) {
return fe.priority > 0;
}).map(function(fe) {
return fe.info;
});
}
return [A.Qd(_, a, t, i, c)];
}, A.Qd = function(_, a, t, i, c) {
if (c === void 0 && (c = ""), _.i(Bt, "parse media desc. native: " + t + " codecType: " + i), typeof a == "string") {
var u = this.Nd(_, a);
if (!u)
return { src: a, box: h.i.unknown, srcType: h.l.OTHERS };
a = u;
}
var v, R = ht.isMSEAvailable();
if (A.verifyMix(a)) {
_.i(Bt, "input mix codec.", Object.keys(a));
var Q = a, se = [];
for (var fe in Q) {
var ke = fe;
if (Tc.indexOf(ke) !== -1) {
var Fe = Q[ke];
if (typeof Fe == "string" && (Fe = Fe.trim()), !Fe) {
_.i(Bt, fe + " src is empty.");
continue;
}
var Ne = this.xd(_, Fe, c, ke, !0), He = Array.isArray(Ne) ? this.Vd(Ne, ke) || Ne[0] : Ne;
if (!He)
continue;
He.codecType = ke, se.push(He);
}
}
v = this.Ud(_, se, t, i);
} else {
var rt = this.xd(_, a, c);
Array.isArray(rt) ? rt.length > 1 ? (_.i(Bt, "input aas v2 mix codec."), v = this.Ud(_, rt, t, i)) : rt.length === 1 && ((v = rt[0]).nativeFirst = this.Fd(_, v.box, R, t)) : (v = rt).nativeFirst = this.Fd(_, v.box, R, t);
}
return v || (v = { src: a, box: h.i.unknown, srcType: h.l.OTHERS }), v;
}, A.Ud = function(_, a, t, i) {
var c, u, v = this, R = {}, Q = {}, se = [], fe = ht.isMSEAvailable();
a.forEach(function(Qe) {
var _t = Qe.codecType;
if (_t)
if (Qe.nativeFirst = v.Fd(_, Qe.box, fe, t), se.push(_t), fe && !Qe.nativeFirst) {
var dt = ht.getVideoCodecCompatibilityByCodec(_t);
Q[_t] = dt.decoder, _t === h.c.h264 && (dt.decoder = h.d.buildin, dt.smooth = !0), dt.smooth && dt.decoder === h.d.buildin && Qe.mediaLevels && (Qe.compatibility = dt, R[_t] = Qe);
} else {
var Rt = ht.isVideoCodecSupported(_t);
Q[_t] = Rt ? h.d.buildin : h.d.unsupported, (_t === h.c.h264 || Rt) && (Qe.compatibility = { decoder: h.d.buildin, smooth: !0, mix: !1 }, R[_t] = Qe);
}
});
var ke, Fe, Ne = (c = R[h.c.hevc]) != null && c.mediaLevels && R[h.c.hevc].mediaLevels.levels.length ? R[h.c.hevc] : void 0, He = (u = R[h.c.av1]) != null && u.mediaLevels && R[h.c.av1].mediaLevels.levels.length ? R[h.c.av1] : void 0, rt = R[h.c.h264];
return _.i(Bt, "input vcodec. hevc: " + !!Ne + " av1: " + !!He + " h264: " + !!rt), i && R[i] && (ke = R[i], _.i(Bt, "selected the specified codec: " + i)), ke || ((ke = He || Ne || rt) && (ke.nativeFirst = this.Fd(_, ke.box, fe, t)), _.i(Bt, "selected src: " + ((Fe = ke) == null ? void 0 : Fe.codecType), ke)), ke && (se.length && (ke.mixCodecInput = se), ke.mixCodecAvailable = Q), ke;
}, A.Vd = function(_, a) {
for (var t = 0; t < _.length; t++)
if (_[t].codecType === a)
return _[t];
}, A.Fd = function(_, a, t, i) {
if (!t || Fp.indexOf(a) !== -1)
return _.i(Bt, "get native first true. box: " + a + " mse: " + t), !0;
if (jp.indexOf(a) !== -1 || !ht.isVideoBoxSupported(a))
return _.i(Bt, "get native first false. box: " + a), !1;
if (!$.a.mobile) {
if (i) {
var c = ht.isVideoBoxSupported(a), u = !!c;
return _.i(Bt, "get native first pc " + u + ". box: " + a + " nativeFirstParams: true video box supported: " + c), u;
}
if (i === void 0) {
var v = ht.isMSEAvailable(), R = !v;
return _.i(Bt, "get native first pc " + R + ". box: " + a + " nativeFirstParams: undefined mse supported: " + v), R;
}
return _.i(Bt, "get native first pc false. nativeFirstParams: false"), !1;
}
if (a === h.i.mp4 || a === h.i.hls || a === h.i.hls_ts || a === h.i.ts) {
if (i === void 0 || i) {
var Q = ht.isVideoBoxSupported(a), se = !!Q;
return _.i(Bt, "get native first mobile " + se + ". box: " + a + " nativeFirstParams: " + i + " video box supported: " + Q), se;
}
return _.i(Bt, "get native first mobile false. nativeFirstParams: " + i), !1;
}
if (a === h.i.hls_fmp4) {
if (i === void 0 || i) {
var fe = ht.isVideoBoxSupported(a), ke = !(!fe || !$.a.x5 && !$.a.xweb);
return _.i(Bt, "get native first mobile " + ke + ". box: " + a + " nativeFirstParams: " + i + " video box supported: " + fe + " x5: " + $.a.x5 + " xweb: " + $.a.xweb), ke;
}
return _.i(Bt, "get native first mobile false. nativeFirstParams: " + i), !1;
}
}, A.xd = function(_, a, t, i, c) {
var u = this;
t === void 0 && (t = ""), i === void 0 && (i = h.c.unknown), c === void 0 && (c = !1);
var v = { src: a, box: h.i.unknown, srcType: h.l.OTHERS };
if (typeof a == "string") {
var R = new $i(a);
R.vCodecType = i, v.box = xe(a), v.mediaLevels = { levels: [R], def: 0 }, v.isLive = this.Pd(v.box);
} else if (a instanceof Blob) {
var Q = "unknow";
a instanceof File ? (v.box = xe(a.name), Q = a.name) : v.box = zs(a.type).box;
var se = be(v.box) ? new Si(URL.createObjectURL(a)) : new $i(URL.createObjectURL(a));
se.vCodecType = i, se.fileName = Q, v.mediaLevels = { levels: [se], def: 0 }, v.srcType = h.l.FILE, v.isLive = !1;
} else {
if (yn.verify(a)) {
var fe = yn.parse(a);
return _.i(Bt, "kwai manifest"), fe.map(function(Ne) {
var He, rt;
_.i(Bt, "kwai manifest codec: " + Ne.codecType + " meta:", Ne.mediaLevels.meta), A.Hd(Ne.mediaLevels.levels, i);
var Qe = { meta: Ne.mediaLevels.meta, mediaLevels: A.filteringLevels(_, Ne.mediaLevels, c || fe.length > 1), src: a, box: Ne.mediaLevels.box || xe(((He = Ne.mediaLevels.levels[0]) == null ? void 0 : He.url[0]) || ""), srcType: h.l.KWAI, isLive: u.Pd(v.box), isLiveShift: Ne.mediaLevels.isLiveShift, codecType: Ne.codecType };
return typeof ((rt = Qe.mediaLevels) == null ? void 0 : rt.isLive) == "boolean" && (Qe.isLive = Qe.mediaLevels.isLive), be(Qe.box) && (Qe.multipart = !0), Qe;
});
}
if (Ec.verify(a)) {
_.i(Bt, "flv abr manifest", i);
var ke = Ec.parse(a);
A.Hd(ke.levels, i), v.mediaLevels = A.filteringLevels(_, ke, c), v.box = h.i.flv, v.isLive = !0, v.srcType = h.l.KWAI_FLV_ABR;
} else if (yc.verify(a)) {
_.i(Bt, "flv multipart");
var Fe = yc.parse(a, t);
v.mediaLevels = s()({ def: 0 }, Fe), A.Hd(v.mediaLevels.levels, i), v.box = h.i.flv, v.isLive = !1, v.multipart = !0, v.srcType = h.l.KWAI_FLV_MP;
} else
nr.verify(a) && (v.mediaLevels = A.filteringLevels(_, nr.parse(a), c), v.box = h.i.hls, v.srcType = h.l.KWAI);
}
return be(v.box) && (v.multipart = !0), v;
}, A.Hd = function(_, a) {
a === void 0 && (a = h.c.unknown), _.forEach(function(t) {
t.vCodecType === h.c.unknown && a !== h.c.unknown && (t.vCodecType = a);
});
}, A.Pd = function(_) {
var a;
return [h.i.flv, h.i.hls, h.i.unknown, h.i.ivf, h.i.yuv].indexOf(_) === -1 && (a = !1), _ === h.i.webrtc && (a = !0), a;
}, A.Nd = function(_, a) {
var t = a.trim();
if (t) {
if (!Cc.test(t)) {
try {
t = JSON.parse(t);
} catch (i) {
_.i(Bt, "formatStrData error", i);
}
typeof t == "string" && (t = Object(Ji.buildAbsoluteURL)(location.href, t, { alwaysNormalize: !0 }));
}
return t;
}
}, A;
}();
function Gp(A) {
switch (A) {
case h.f.MAIN:
return _e.c.LEVEL;
case h.f.SUBTITLE:
return _e.c.SUBTITLE_TRACK;
case h.f.AUDIO:
return _e.c.AUDIO_TRACK;
default:
return _e.c.LEVEL;
}
}
var ya, Ic, $a, Fi = "playlist-loader", zp = function() {
function A(a) {
var t = this;
this.Yd = {}, this.di = void 0, this.Ci = void 0, this.Ai = void 0, this.Do = void 0, this.Gd = function(i, c) {
c.retry && t.Ai.emit(w.a.RETRY, { type: h.k.LOADER, core: h.a.mse, message: "manifest: " + c.errMessage, code: Object(L.d)(L.a.LOAD_ERROR, c.errMessage, c.code) });
}, this.Kd = function(i, c, u) {
if (t.Ai.emit(w.a.DOWNLOAD, ft(ut.SUCCESS, i, u)), i.isSidxRequest)
t.zA(Object(L.e)(L.b.OTHER_ERROR, L.a.UNSUPPORTED, "unsupport sidx", { statusCode: u.code, url: i.url.toString() }));
else if (t.Zd(i.type), typeof c == "string")
if (c.indexOf("#EXTM3U") !== 0 && c.indexOf("#EXTINF:") >= 0 && i.rangeStart && i.levelDetails)
t.Wd(i, c, u);
else {
if (c.indexOf("#EXTM3U") !== 0) {
if (i.rangeStart && c.trim().length === 0)
return t.Ci.i(Fi, "emit empty. rangestart: " + i.rangeStart + ". response is empty."), void t.Xd(i, u);
var v = c;
return v.length > 100 && (v = v.slice(0, 100)), void t.zd(i, "no EXTM3U delimiter." + v, u, !!c.trim().length);
}
c.indexOf("#EXTINF:") > 0 || c.indexOf("#EXT-X-TARGETDURATION:") > 0 ? t.Wd(i, c, u) : t.Jd(i, c, u);
}
else
t.zA(Object(L.e)(L.b.NETWORK_ERROR, L.a.MANIFEST_PARSING_ERROR, 'expected responseType of "text" for PlaylistLoader', { statusCode: u.code, url: i.url.toString() }));
}, this.qd = function(i, c) {
t.$d(i, c);
}, this.tl = function(i, c) {
t.Ai.emit(w.a.DOWNLOAD, ft(ut.ABORT, i, c));
}, this.zA = function(i) {
if (i.type === L.b.NETWORK_ERROR) {
var c = t.Do.lctx.current;
!c || t.Do.stat.isLive || c.hasFrag && c.live || (i.fatal = !0);
}
t.Ai.emit(w.a.ERROR, i);
}, this.Do = a, this.di = a.config, this.Ci = a.logger, this.Ai = a.evt, this.Yd = {};
}
A.il = function(a) {
return a === _e.c.LEVEL;
}, A.el = function(a) {
switch (a.type) {
case _e.c.AUDIO_TRACK:
return h.f.AUDIO;
case _e.c.SUBTITLE_TRACK:
return h.f.SUBTITLE;
default:
return h.f.MAIN;
}
}, A.nl = function(a) {
if (a.urlBeforePreprocess)
return a.urlBeforePreprocess;
var t = a.responseUrl;
return t && t.indexOf("data:") !== 0 || typeof a.url != "string" || (t = a.url), t || "";
};
var _ = A.prototype;
return _.sl = function(a) {
var t = new nt(this.Ci);
return a.loader = t, this.Yd[a.type] = t, t;
}, _.Ef = function(a) {
return this.Yd[a.type];
}, _.Zd = function(a) {
this.Yd[a] && delete this.Yd[a];
}, _.rl = function() {
for (var a in this.Yd) {
var t = this.Yd[a];
t && t.destroy(), this.Zd(a);
}
}, _.destroy = function() {
this.rl();
}, _.load = function(a) {
var t;
this.Ci.i(Fi, "Loading playlist of type " + a.type + ", level: " + a.level + ", id: " + a.id);
var i, c, u, v, R = this.Ef(a);
if (R) {
var Q = R.context;
if (Q && Q.url === a.url)
return this.Ci.i(Fi, "playlist request ongoing"), !1;
this.Ci.w(Fi, "aborting previous loader for type: " + a.type), R.abort();
}
a.type === _e.c.MANIFEST ? (i = this.di.manifestLoadingMaxRetry, c = this.di.manifestConnectionTimeout, u = this.di.manifestTransmissionTimeout, v = this.di.manifestLoadingRetryDelay) : (i = this.di.levelLoadingMaxRetry, c = this.di.levelConnectionTimeout, u = this.di.levelTransmissionTimeout, v = this.di.levelLoadingRetryDelay), R = this.sl(a), a.responseType = a.responseType || "text";
var se, fe = { connectionTimeout: c, transmissionTimeout: u, maxRetry: i, retryDelay: v }, ke = { onLoad: this.Gd, onEnd: this.Kd, onError: this.qd, onAbort: this.tl };
return (t = this.di.preprocessUrl) != null && t.manifest && (this.Ci.i(Fi, "preprocessUrl manifest"), a.urlBeforePreprocess = a.url, a.url = (se = this.di.preprocessUrl) == null ? void 0 : se.manifest(a.url)), this.Ci.d(Fi, "Calling internal loader delegate for URL: " + a.url), R.load(a, ke, fe), !0;
}, _.Jd = function(a, t, i) {
this.Ci.i(Fi, "handle master play list");
var c = t, u = A.nl(a), v = Ea.parseMasterPlaylist(c, u);
if (v.length) {
var R = v.map(function(He, rt) {
return { id: He.attrs ? He.attrs.AUDIO : rt, codec: He.audioCodec };
}), Q = Ea.parseMasterPlaylistMedia(c, u, "AUDIO", R), se = Ea.parseMasterPlaylistMedia(c, u, "SUBTITLES", R);
if (Q.length) {
var fe = !1;
if (Q.forEach(function(He) {
He.url || (fe = !0);
}), fe === !1 && v[0].audioCodec && (!v[0].attrs || !v[0].attrs.AUDIO)) {
this.Ci.v(Fi, "audio codec signaled in quality level, but no embedded audio track signaled, create one");
var ke = new Si("");
ke.type = h.f.MAIN, ke.name = "main", ke.id = -1, Q.unshift(ke);
}
}
var Fe = 0;
v.forEach(function(He, rt) {
He.default && (Fe = rt);
});
var Ne = { levels: v, audioTracks: Q, subtitleTracks: se, def: Fe };
this.Ci.i(Fi, "hls mainfest"), this.Ai.emit(w.a.HLS_MANIFEST_PARSED, Ne);
} else
this.zd(a, "no level found in manifest", i);
}, _.Wd = function(a, t, i) {
var c = a.id, u = a.level, v = a.type;
this.Ci.i(Fi, "handle track or level play list. id: " + c + " type: " + v + ", level: " + u);
var R = A.nl(a), Q = Number.isFinite(c) ? c : 0, se = Number.isFinite(u) ? u : Q, fe = A.el(a), ke = a.levelDetails, Fe = !(t.indexOf("#EXTM3U") === 0 || !a.rangeStart), Ne = ke && Fe ? ke.endSN + 1 : 0;
ke && (ke.http416 = 0);
var He = Ea.parseLevelPlaylist(this.Ci, t, R, se, fe, Q, Ne);
Fe && (He.startSN = Ne, this.Ci.i(Fi, "part of media playlist data")), He.size = t.length, He.partOfData = Fe;
var rt = He.fragments[0];
if (a.liveShiftKwai2Params && rt && rt.programDateTime) {
var Qe = a.liveShiftKwai2Params;
Qe.paramName === "offset" ? this.Ci.w(Fi, "liveshift kwai2 m3u8 response. req: " + Qe.time + " res: " + rt.programDateTime + " diff: " + (Qe.time - rt.programDateTime) + " sn: " + rt.sn + " cnt: " + He.fragments.length) : a.liveShiftKwai2Params.paramName === "seqId" && this.Ci.w(Fi, "liveshift kwai2 m3u8 response. req: " + Qe.seqId + " res: " + rt.sn + " cnt: " + He.fragments.length);
}
if (v === _e.c.MANIFEST) {
var _t = { levels: [He], def: 0 };
this.Ci.i(Fi, "hls mainfest. track/level"), this.Ai.emit(w.a.HLS_MANIFEST_PARSED, _t);
}
if (He.needSidxRanges && He.initSegment) {
var dt, Rt = He.initSegment.url;
return (dt = this.di.preprocessUrl) != null && dt.stream && (this.Ci.i(Fi, "preprocessUrl stream sidx"), a.urlBeforePreprocess = Rt, Rt = this.di.preprocessUrl.stream(Rt)), void this.load({ url: Rt, isSidxRequest: !0, type: v, level: u, levelDetails: He, id: c, rangeStart: 0, rangeEnd: 2048, responseType: "arraybuffer", headers: this.di.headers });
}
a.levelDetails = He, this.hl(a, i);
}, _.zd = function(a, t, i, c) {
this.zA(Object(L.e)(L.b.NETWORK_ERROR, L.a.MANIFEST_PARSING_ERROR, t, { statusCode: i.code, url: a.url.toString() }));
}, _.$d = function(a, t) {
var i, c;
this.Ci.i(Fi, "A network error occured while loading a " + a.type + "-type playlist");
var u = this.Ef(a);
switch (a.type) {
case _e.c.MANIFEST:
i = L.a.MANIFEST_LOAD_ERROR, c = !0;
break;
case _e.c.LEVEL:
i = L.a.LEVEL_LOAD_ERROR, c = !0;
break;
case _e.c.AUDIO_TRACK:
i = L.a.AUDIO_TRACK_LOAD_ERROR, c = !0;
break;
case _e.c.SUBTITLE_TRACK:
i = L.a.SUBTITLE_TRACK_LOAD_ERROR, c = !1;
break;
default:
i = L.a.MANIFEST_LOAD_ERROR, c = !1;
}
if (this.Ai.emit(w.a.DOWNLOAD, ft(ut.FAIL, a, t)), t.fatal) {
if (u && (u.abort(), this.Zd(a.type)), a.rangeStart && t.code === 416)
return this.Ci.i(Fi, "emit empty. level 416"), a.levelDetails && a.levelDetails.http416++, void this.Xd(a, t);
this.zA(Object(L.e)(L.b.NETWORK_ERROR, i, t.errMessage, { fatal: c, statusCode: t.code, url: a.url.toString() }));
}
}, _.Xd = function(a, t) {
var i = new Si("");
a.levelDetails ? (i.endSN = a.levelDetails.endSN, i.targetduration = a.levelDetails.targetduration) : i.targetduration = 2, this.Ai.emit(w.a.LEVEL_LOADED, { details: i, level: a.level || 0, stats: t });
}, _.hl = function(a, t) {
var i, c = a.type, u = a.level, v = a.levelDetails;
if (v && (v.targetduration || (i = a.levelDetails) != null && i.partOfData))
if (A.il(a.type))
this.Ai.emit(w.a.LEVEL_LOADED, { details: v, level: u || 0, stats: t });
else
switch (c) {
case _e.c.AUDIO_TRACK:
this.Ai.emit(w.a.AUDIO_TRACK_LOADED, { details: v, level: u || 0, stats: t });
break;
case _e.c.SUBTITLE_TRACK:
this.Ai.emit(w.a.SUBTITLE_TRACK_LOADED, { details: v, level: u || 0, stats: t });
}
else
this.zd(a, "invalid target duration.", t);
}, A;
}(), Za = "mp-hls", qa = function(A) {
function _(t) {
var i;
return (i = A.call(this) || this).ol = void 0, i.Do = void 0, i.Ci = void 0, i.Ai = void 0, i.kd = function(c) {
var u = i.Do.lctx;
c = Ks.filteringLevels(i.Ci, c), i.Do.stat.drm = c.drm, u.levels = c.levels, u.currentIdx = c.def, c.audioTracks && (u.audioTracks = c.audioTracks, u.audioIdx = c.defAudio || 0), c.subtitleTracks && (u.subtitleTracks = c.subtitleTracks, u.subtitleIdx = c.defSubtitle || 0), i.Ai.emit(w.a.MANIFEST_LOADED);
}, i.Do = t, i.Ci = t.logger, i.Ai = t.evt, i.ol = new zp(i.Do), i.O.push(i.ol, i.Ai.on(w.a.HLS_MANIFEST_PARSED, i.kd)), i;
}
y()(_, A);
var a = _.prototype;
return a.loadManifest = function() {
if (this.Ci.i(Za, "load manifest."), this.Do.lctx.levels.length)
this.Ai.emit(w.a.MANIFEST_LOADED);
else if (this.ol) {
var t = { url: this.Do.src, type: _e.c.MANIFEST, level: 0, id: null, credentials: this.Do.config.credentials, headers: this.Do.config.headers, progress: !1, preferNative: this.Do.stat.preferNativeLoader };
this.al(t), this.ol.load(t);
}
}, a.loadLevel = function(t, i, c) {
if (i === void 0 && (i = h.f.MAIN), c === void 0 && (c = 0), this.Ci.i(Za, "load level. type: " + i), t.m3u8Slice) {
this.Ci.i(Za, "load level. parse m3u8 slice.", c);
var u = Bp.parseLevelSlice(this.Ci, t, i);
if (u) {
var v = { details: u, level: c };
if (i === h.f.MAIN ? this.Ai.emit(w.a.LEVEL_LOADED, v) : i === h.f.AUDIO ? this.Ai.emit(w.a.AUDIO_TRACK_LOADED, v) : i === h.f.SUBTITLE && this.Ai.emit(w.a.SUBTITLE_TRACK_LOADED, v), !u.live)
return;
}
}
if (this.ol) {
var R = t.urlId, Q = { url: t.url[R], type: Gp(i), level: t.index, id: R, credentials: this.Do.config.credentials, headers: this.Do.config.headers, levelDetails: t, progress: !1, preferNative: this.Do.stat.preferNativeLoader };
t.size && t.http416 < Ve.k && this.Do.stat.liveShiftType === h.g.KWAI && this.Ci.i(Za, "load m3u8 range start: " + t.size + "."), this.al(Q), this.ol.load(Q);
}
}, a.al = function(t) {
this.Do.isLiveShiftKwai2 && (t.url = this.Do.getKwai2LiveShiftUrl(t.url), this.Do.stat.liveShiftKwai2Params && (t.liveShiftKwai2Params = s()({}, this.Do.stat.liveShiftKwai2Params)), this.Do.stat.liveShiftKwai2Params.seqId = void 0);
}, _;
}(F.a), Kp = qa ? ((ya = {})[h.i.hls] = qa, ya[h.i.hls_ts] = qa, ya[h.i.hls_fmp4] = qa, ya[h.i.flv] = Xr, ya) : ((Ic = {})[h.i.flv] = Xr, Ic), Ws = n(26), Rc = function() {
function A(a, t, i) {
var c = this;
this.Do = void 0, this.Ci = void 0, this.Yd = {}, this.di = void 0, this.YA = void 0, this.ul = void 0, this.cl = void 0, this.fl = function(u, v, R) {
var Q = u.frag;
Q.decryptdata ? v && v instanceof ArrayBuffer ? (c.ul = Q.decryptdata.key = new Uint8Array(v), c.Yd[Q.type] = void 0, c.Do.evt.emit(w.a.HLS_KEY_LOADED, { frag: Q })) : c.zA("key empty", R.code) : c.zA("frag decrypt data empty", R.code);
}, this.Al = function(u, v) {
var R = u.frag.loader;
v.fatal && (R && R.abort(), c.Yd[u.frag.type] = void 0, c.zA(v.errMessage, v.code));
}, this.zA = function(u, v) {
c.Do.evt.emit(w.a.ERROR, Object(L.e)(L.b.NETWORK_ERROR, L.a.KEY_LOAD_ERROR, u, { statusCode: v }));
}, this.Do = a, this.Ci = a.logger, this.di = t, this.YA = i, this.Yd = {}, this.ul = null, this.cl = null;
}
var _ = A.prototype;
return _.destroy = function() {
for (var a in this.Yd) {
var t = this.Yd[a];
t && t.destroy();
}
this.Yd = {};
}, _.load = function(a) {
var t = a.type, i = this.Yd[t], c = a.decryptdata, u = null;
if (c && (u = c.uri), !u || u === this.cl && this.ul !== null)
this.ul && (c && (c.key = this.ul), this.Do.evt.emit(w.a.HLS_KEY_LOADED, { frag: a }));
else {
var v = this.YA;
i && (this.Ci.w("KeyLoader", "abort previous key loader for type:" + t), i.abort()), a.loader = this.Yd[t] = new nt(this.Ci), this.cl = u, this.ul = null;
var R = { url: u, frag: a, responseType: "arraybuffer", credentials: this.di.credentials, headers: this.di.headers, preferNative: this.di.preferNativeLoader }, Q = v, se = { onEnd: this.fl, onError: this.Al };
a.loader.load(R, se, Q);
}
}, A;
}(), Ca = n(27), Cn = { local: 0, server: 0 }, Ja = "live-time", Zr = function(A) {
function _(t) {
var i;
return (i = A.call(this) || this).Ci = void 0, i.vl = { abst: 0, originDTS: 0 }, i.dl = void 0, i.ll = void 0, _.Ci = i.Ci = t, t.i(Ja, "constructor"), _.bl = { onError: _.Yf, onEnd: _.pl }, _.YA = { connectionTimeout: 5e3 }, i;
}
y()(_, A), _.load = function(t, i) {
_.sv();
var c = { url: "https://ntp.nc.gifshow.com/", responseType: "text", progress: !1, preferNative: i };
(_.vf = new nt(t)).load(c, _.bl, _.YA);
};
var a = _.prototype;
return a.ntpSync = function(t) {
this.Ci.i(Ja, "sync. state:", _.ml);
var i = performance.now();
(_.ml === "suspend" || i - _.gl > 18e5) && (this.Ci.i(Ja, "sync start."), _.gl = i, _.ml = "loading", _.load(this.Ci, t));
}, a.onPrivNal = function(t) {
var i = this;
t.info.forEach(function(c) {
typeof c.abst == "number" && typeof t.streamTimestamp == "number" && (i.vl.abst = c.abst / 1e3, i.vl.originDTS = t.streamTimestamp / 1e3);
});
}, a.onParsing = function(t) {
var i = this;
t.segments.forEach(function(c) {
c.type === h.o.VIDEO ? i.dl = { dts: c.startDTS, originDTS: c.originFirstDTS, parseTime: c.firstParseTime } : c.type === h.o.AUDIO && (i.ll = { dts: c.startDTS, originDTS: c.originFirstDTS, parseTime: c.firstParseTime });
});
}, a.destroy = function() {
_.sv();
}, a.getDisplayDelay = function(t) {
return this.yl(t, this.dl);
}, a.getAudioRenderDelay = function(t) {
return this.yl(t, this.ll);
}, a.getRecDelay = function() {
var t = this.dl;
if (this.serverNowMs && t != null && t.parseTime) {
var i = this.vl, c = this.serverMs(1e3 * t.parseTime + _._l);
if (c && i.originDTS && i.abst)
return Math.round(c - 1e3 * (t.originDTS - i.originDTS + i.abst));
}
return 0;
}, a.serverMs = function(t) {
return Cn.server ? t - Cn.local + Cn.server : null;
}, a.yl = function(t, i) {
var c = this.serverNowMs, u = this.vl;
return c && i && u.abst && u.originDTS ? Math.round(1e3 * (i.dts - t - (i.originDTS - u.originDTS + u.abst)) + c) : 0;
}, _.sv = function() {
_.vf && _.vf.destroy();
}, g()(_, [{ key: "syncState", get: function() {
return _.ml;
} }, { key: "time", get: function() {
return s()({}, Cn);
} }, { key: "now", get: function() {
return this.serverNowMs || Date.now();
} }, { key: "serverNowMs", get: function() {
return Cn.server ? performance.now() - Cn.local + Cn.server : null;
} }], [{ key: "workerTimeOffset", set: function(t) {
_._l = t;
} }]);
}(F.a);
$a = Zr, Zr._l = 0, Zr.vf = void 0, Zr.bl = void 0, Zr.YA = void 0, Zr.ml = "suspend", Zr.Ci = void 0, Zr.gl = void 0, Zr.Yf = function() {
$a.Ci.i(Ja, "ntp sync load error."), $a.sv();
}, Zr.pl = function(A, _) {
if ($a.sv(), typeof _ == "string") {
Cn.local = performance.now();
var a = _.split(",");
a.length > 1 && (Cn.server = 1e3 * parseFloat(a[0]) + parseInt(a[1], 10) / 1e3 / 2);
}
};
var Ys = Zr, Wp = n(47), cn = "mux-base", Qs = function(A) {
function _(t, i, c) {
var u;
if ((u = A.call(this) || this).At = void 0, u.Ai = void 0, u.Do = void 0, u.Ci = void 0, u.te = void 0, u.Cl = void 0, u.Rr = !1, u.Il = void 0, u.If = 0, u.Ol = 0, u._i = void 0, u.wl = !1, u.zc = function(v) {
var R = v.data.event, Q = v.data.data;
u.El(R, Q), u.Ai.emit(R, Q);
}, u.At = c, u.Ai = t, u.Do = i, u.Ci = i.logger, i.stat.webWorker && (u.te = i.stat.muxWorker, i.stat.muxWorker = void 0, !u.te))
try {
u.Ci.i(cn, "init mux worker"), u.te = ae()(42), Ys.workerTimeOffset = performance.now();
} catch (v) {
}
return u.Cl = 0, u._i = { audioCodec: i.stat.audioCodec, videoCodec: "", duration: 0, remuxId: 1, hasAudio: i.lctx.hasAudio, hasVideo: i.lctx.hasVideo, disableFillSlientForRaw: i.stat.avSeparated && i.config.audioEnabled !== !1 }, i.lctx.current && i.lctx.current.dropVideo.length && (u._i.dropVideo = i.lctx.current.dropVideo), u.Ci.i(cn, "constructor", u._i), u;
}
y()(_, A);
var a = _.prototype;
return a.init = function() {
var t = this;
this.Ci.i(cn, "TYPE_SUPPORTED", "hw: " + ht.isSupportHW, ht.TYPE_SUPPORTED);
var i = s()({}, ht.TYPE_SUPPORTED);
if (this.Do.stat.hevcFallbackWasm && (i.hevc = !1), this.te) {
this.te.addEventListener("message", this.zc), this.te.addEventListener("error", function(c) {
t.Ci.i(cn, "worker onerror", c.message), t.Ai.emit(w.a.ERROR, Object(L.e)(L.b.MUX_ERROR, L.a.REMUX_WORKER_ERROR, c.message));
});
try {
this.te.postMessage({ cmd: Ca.a.INIT, typeSupported: i, config: this.Do.getRemuxConfig(), vendor: navigator.vendor, hasExternalLogger: !!this.Do.config.logger, contextId: this.Do.id });
} catch (c) {
this.Ci.i(cn, "worker init error"), this.te.terminate(), this.te = void 0;
}
}
this.te || (this.Il = new Wp.a(this.Ai, i, this.Do.getRemuxConfig(), navigator.vendor, this.Ci), this.O.push(this.Ai.prependListener(w.a.PARSING_DATA, this.jl.bind(this)), this.Ai.prependListener(w.a.PARSED_DATA, this.fo.bind(this)), this.Ai.prependListener(w.a.RAW_DATA, this.kl.bind(this))));
}, a.destroy = function() {
this.Do.stat.muxWorker = void 0, this.te && (this.te.postMessage({ cmd: Ca.a.DESTROY }), this.te.removeEventListener("message", this.zc), this.te.terminate(), this.te = void 0), A.prototype.destroy.call(this);
}, a.reset = function(t) {
this.Ci.i(cn, "reset: " + t), this._i.remuxId++, this.Cl = 0, this.Rr = t, this.wl = !1;
}, a.end = function() {
this.wl || (this.wl = !0, this.te ? this.te.postMessage({ cmd: Ca.a.LOAD_END }) : this.Il && this.Il.end());
}, a.updateConfig = function(t) {
this.te ? this.te.postMessage({ cmd: Ca.a.UPDATE_CONFIG, config: t }) : this.Il && this.Il.updateConfig(t);
}, a.onFragProgress = function(t) {
this.Ml(t, !1);
}, a.onFragLoaded = function(t) {
this.Ml(t, !0);
}, a.updateSuffix = function(t) {
this._i.suffix = t;
}, a.Ml = function(t, i) {
var c = t.context.frag, u = t.discontinuity || !1, v = (c == null ? void 0 : c.start) || 0, R = !1, Q = !0, se = null;
if (this._i.progress = t.progress, t.data && t.data.byteLength) {
var fe = performance.now(), ke = fe - (this.If || t.stats.trequest);
t.stats.trequest !== this.Ol && (this.Ol = t.stats.trequest, ke = fe - t.stats.trequest), this.If = fe, this.Ai.emit(w.a.LOADER_CHUNK_ARRIVAL, { progress: t.context.progress, byteLength: t.data.byteLength, timeCost: ke, ts: performance.now() });
}
this.Cl === 0 && (R = !0, Q = t.remuxContiguous || !1, this.Ci.i(cn, "chunk 0 contiguous: " + Q)), i ? (this.If = 0, this.Cl = 0, se = t.data ? new Uint8Array(t.data) : new Uint8Array()) : (this.Cl++, t.data && (se = new Uint8Array(t.data))), se && (this.Sl(se, (c == null ? void 0 : c.decryptdata) || null, t.initData, v, Q, R, u, !this.Rr || (c == null ? void 0 : c.start) === 0, i), this.Rr = !1);
}, a.jl = function(t) {
this.Bl(t) && (t.expired = !0, this.Ci.i(cn, "parsing data expired"));
}, a.fo = function(t) {
this.Bl(t) ? (t.expired = !0, this.Ci.i(cn, "parsed expired")) : t && (t.trackType = this.At);
}, a.kl = function(t) {
this.Bl(t) && (t.expired = !0);
}, a.Bl = function(t) {
return !(!t.extra || t.extra.remuxId === this._i.remuxId);
}, a.Sl = function(t, i, c, u, v, R, Q, se, fe) {
v || this.Ci.i(cn, " demux contiguous false");
var ke = this._i;
this.te ? this.te.postMessage({ cmd: Ca.a.PUSH, data: t, decryptdata: i, initSegment: c, timeOffset: u || 0, contiguous: v, trackSwitch: R, discontinuity: Q, accurateTimeOffset: se, fragEnd: fe, transmuxData: ke }, [t.buffer]) : this.Il && this.Il.pushMuxData(t, i, c, u, v, R, Q, se, fe, s()({}, ke));
}, a.El = function(t, i) {
switch (t) {
case w.a.PARSING_DATA:
this.jl(i);
break;
case w.a.PARSED_DATA:
this.fo(i);
break;
case w.a.RAW_DATA:
this.kl(i);
}
}, g()(_, [{ key: "totalDuration", set: function(t) {
this._i.duration = t;
} }, { key: "id", get: function() {
return this.At;
} }]);
}(F.a), Xs = "mux-multipart", Yp = function(A) {
function _(t, i, c) {
var u;
return (u = A.call(this, t, i, c) || this).Tl = void 0, u.Dl = void 0, u.Tl = void 0, u.Dl = {}, u;
}
y()(_, A);
var a = _.prototype;
return a.reset = function(t) {
A.prototype.reset.call(this, t), this.Tl = void 0;
}, a.Ml = function(t, i) {
if (t.context.frag) {
var c = t.context.frag, u = this.Tl, v = !1, R = Number.isFinite(c.startDTS) ? c.startDTS : c.start, Q = !1, se = !0, fe = null;
if (this._i.progress = t.progress, typeof c.sn == "number" && (this._i.fragSn = c.sn), t.data && t.data.byteLength) {
var ke = performance.now(), Fe = { progress: t.context.progress, byteLength: t.data.byteLength, timeCost: performance.now() - (this.If || t.stats.trequest), ts: performance.now() };
this.If = ke, this.Ai.emit(w.a.LOADER_CHUNK_ARRIVAL, Fe);
}
if (this.Cl === 0) {
this.Dl = {}, v = !(u && c.level === u.level), Q = !(u && c.cc === u.cc);
var Ne = u && c.sn === u.sn + 1;
se = !(v || !Ne), this.Do.stat.isLive && (Q = Q || !Ne), u && t.remuxContiguous && (se || (R = Number.isFinite(u.endDTS) ? u.endDTS : u.start + u.duration), se = !0);
}
i ? (this.If = 0, this.Cl = 0, this.Tl = t.context.frag, fe = t.data ? new Uint8Array(t.data) : new Uint8Array(), this.Tl = c) : (this.Cl++, t.data && (fe = new Uint8Array(t.data))), fe && (typeof t.liveShiftOffset == "number" && (R = t.liveShiftOffset), this.Sl(fe, c.decryptdata, t.initData, R, se, v, Q, !this.Rr || t.context.frag.start === 0, i), this.Rr = !1);
}
}, a.jl = function(t) {
var i = this;
if (this.Bl(t))
return this.Ci.i(Xs, "parsing data expired"), void (t.expired = !0);
t.frag = this.Tl;
var c = this.Dl;
t.segments.forEach(function(u) {
var v = u.type;
if (v === h.o.VIDEO && u.adjustedStart && u.adjustedStart > 1)
i.Ci.i(Xs, "video segment adjustedStart: " + u.adjustedStart + " > 1");
else {
var R = c[v];
R ? (R.endPTS = u.endPTS, R.endDTS = u.endDTS) : (u.endPTS || u.endDTS || !i.Tl || (u.endPTS = u.startPTS + i.Tl.duration, u.endDTS = u.startDTS + i.Tl.duration), c[v] = { startDTS: u.startDTS, startPTS: u.startPTS, endPTS: u.endPTS, endDTS: u.endDTS });
}
});
}, a.fo = function(t) {
if (this.Bl(t))
return t.expired = !0, void this.Ci.i(Xs, "parsed expired");
t.info = s()({}, this.Dl), t.frag = this.Tl, this.Dl = {}, t && (t.trackType = this.At);
}, a.kl = function(t) {
this.Bl(t) ? t.expired = !0 : t.frag = this.Tl;
}, _;
}(Qs), ra = "initSegment", xi = "stream-media", wc = function(A) {
function _(t, i, c, u) {
var v;
return (v = A.call(this) || this).Ai = void 0, v.Rl = void 0, v.Ll = void 0, v.Nl = 0, v.Ql = -1, v.Il = void 0, v.xl = !0, v.Vl = !0, v.Ul = 0, v.Fl = 0, v.Pl = !1, v.vf = void 0, v.Hl = void 0, v.Yl = void 0, v.Gl = !1, v.Do = void 0, v.Ci = void 0, v.Kl = void 0, v.bl = void 0, v.Zl = void 0, v.Wl = void 0, v.Xl = void 0, v.zl = function() {
var R = v.Do.lctx.getNextIdx(v.Rl);
v.Do.lctx.getLevelIdx(v.Rl) !== R && v.Do.lctx.setLevelIdx(R, v.Rl);
var Q = v.level;
if (Q) {
if (v.Kl && Q.hasFrag) {
var se = v.Kl.frag, fe = Q.fragments[v.Nl];
fe && v.Do.config.adjustFragTime && v.Nl === v.Kl.pos && se && Number.isFinite(se.startPTS) && f(v.Ci, Q, fe, se.startPTS, se.endPTS, se.startDTS, se.endDTS);
}
if (v.xl && !v.vf && !v.Pl) {
if (v.Jl())
return void v.Il.end();
var ke = v.Tr();
ke && (Q.hasFrag && Q.initSegment && !Q.initSegment.data && (v.Ci.i(xi, "[" + v.Rl + "]load init segment."), v.ql(Q.initSegment)), v.Ci.i(xi, "[" + v.Rl + "]load frag: " + ke.sn + " level: " + v.index), v.ql(ke));
}
}
}, v.$l = function(R) {
if (!R.expired) {
var Q = R.frag;
if (v.Ci.i(xi, "[" + v.Rl + "]parsed. " + (Q == null ? void 0 : Q.sn)), R.trackType === v.Rl && Q) {
for (var se in v.Pl = !1, v.Gl = !1, R.info) {
var fe = R.info[se];
if (fe && fe.endPTS && fe.endDTS) {
var ke = v.Ll[Q.level];
ke != null && ke.hasFrag && (v.Do.isLiveShift || !v.Do.config.adjustFragTime ? ke.live && typeof Q.sn == "number" && b(v.Ci, ke, Q.sn - ke.startSN) : f(v.Ci, ke, Q, fe.startPTS, fe.endPTS, fe.startDTS, fe.endDTS));
}
}
v.Kl && (v.Kl = void 0), v.Jl() ? v.Il.end() : v.Rl === h.f.MAIN && v.Ai.emit(w.a.ABR_NEXT, { startSec: v.tb(v.Nl) }), v.zl();
}
}
}, v.ib = function() {
if (v.Xl && v.eb(v.Xl.context.frag, v.Ll[v.Xl.context.frag.level])) {
var R = v.Xl.data.get(v.Xl.data.unreadLen);
R && v.nb(v.Xl.context, R.buffer, v.Xl.stats, v.Xl.progress), v.Xl = void 0;
}
}, v.sb = function(R, Q) {
Q.retry && v.Ai.emit(w.a.RETRY, { type: h.k.LOADER, core: h.a.mse, message: "" + Q.errMessage, code: Object(L.d)(L.a.LOAD_ERROR, Q.errMessage, Q.code) });
}, v.Mc = function(R, Q, se) {
R.frag && R.frag.sn === ra || Q instanceof ArrayBuffer && v.rb(R, Q, se, !0);
}, v.xc = function(R, Q, se) {
v.Ql = -1, v.Fl = 0, R.frag && R.frag.sn === ra ? v.hb() : v.Lf();
var fe = v.Ll[R.frag.level], ke = ft(ut.SUCCESS, R, se, fe == null ? void 0 : fe.qualityType, fe == null ? void 0 : fe.codec);
v.Ai.emit(w.a.DOWNLOAD, ke), v.Ci.i(xi, "[" + v.Rl + "]frag loaded. " + R.frag.sn), typeof Q != "string" && (R.frag && R.frag.sn === ra && Q ? (R.frag.data = new Uint8Array(Q), v.Pl = !1, v.ib()) : v.rb(R, Q, se, !1));
}, v.Di = function(R, Q) {
R.preferNative && v.Do.stat.preferNativeLoader === void 0 && (v.Ci.i(xi, "[" + v.Rl + "]prefer native loader."), v.Do.stat.preferNativeLoader = !0), v.Pl = !1;
var se = v.Ll[R.frag.level];
if (v.Ai.emit(w.a.DOWNLOAD, ft(ut.FAIL, R, Q, se == null ? void 0 : se.qualityType, se == null ? void 0 : se.codec)), Q.fatal && se)
if (v.Gl = !1, v.Ql < 0 && (v.Ql = Math.max(0, v.Nl - 1)), v.ob(), v.Fl += R.frag.duration || 0, R.frag.sn === ra || Q.code !== 404 || v.Do.config.maxFragFailSec && v.Fl >= v.Do.config.maxFragFailSec || v.Jl()) {
var fe = Object(L.e)(L.b.NETWORK_ERROR, L.a.LOAD_ERROR, Q.errMessage, { statusCode: Q.code, url: R.url.toString() });
v.Ai.emit(w.a.ERROR, fe);
} else
v.Nl < se.fragments.length && (v.Ai.emit(w.a.VIDEO_SEEK, { sec: se.fragments[v.Nl].start }), v.zl());
}, v.ab = function(R, Q) {
var se = v.Ll[R.frag.level];
v.Ai.emit(w.a.DOWNLOAD, ft(ut.ABORT, R, Q, se == null ? void 0 : se.qualityType, se == null ? void 0 : se.codec));
}, v.Rl = t, v.Ai = i, v.Do = c, v.Ci = c.logger, v.Ll = t === h.f.MAIN ? c.lctx.levels : c.lctx.audioTracks, v.Ci.i(xi, "[" + t + "] constructor"), c.lctx.setLevelIdx(u, v.Rl), c.lctx.setNextIdx(u, v.Rl), v.bl = { onLoad: v.sb, onProgress: v.Mc, onEnd: v.xc, onError: v.Di, onAbort: v.ab }, v.Zl = { connectionTimeout: c.config.connectionTimeout, transmissionTimeout: c.config.transmissionTimeout, maxRetry: c.config.maxRetry, retryDelay: c.config.retryDelay, breakpointContinuation: c.config.breakpointContinuation }, v.Wl = { connectionTimeout: c.config.keyConnectionTimeout, transmissionTimeout: c.config.keyTransmissionTimeout, maxRetry: c.config.keyLoadingMaxRetry, retryDelay: c.config.keyLoadingRetryDelay }, v.O.push(v.Ai.prependListener(w.a.PARSED_DATA, v.$l)), v.Il = new Yp(i, c, t), v.Il.init(), v.O.push(c.evt.on(w.a.HLS_KEY_LOADED, v.ib)), v;
}
y()(_, A);
var a = _.prototype;
return a.levelUpdated = function(t) {
if (t === void 0 && (t = !0), this.level && this.level.hasFrag) {
var i = this.level.startSN;
Number.isFinite(this.Ul) && this.Ul !== i && (this.Nl = Math.max(0, this.Nl - (i - this.Ul))), this.Ul = i, this.Il.totalDuration = this.level.totalduration, t && this.zl();
}
}, a.reset = function() {
var t;
this.Ci.i(xi, "reset type: " + this.Rl + " frag num: " + ((t = this.level) == null ? void 0 : t.fragments.length)), this.Nl = 0, this.Kl = void 0, this.Ul = 0, this.Gl = !1, this.ob(), this.ub(!0);
}, a.seek = function(t, i, c) {
i === void 0 && (i = !1), c === void 0 && (c = !0), this.Gl = !1;
var u = this.level;
if (this.xl = !0, this.Kl = void 0, this.ob(), this.Xl = void 0, u && u.hasFrag) {
var v, R, Q = this.Do.isLiveShiftKwai2 ? t - (this.Do.stat.liveShiftOffset || 0) / 1e3 : t, se = t === 0 ? 0 : ri(Q, u.fragments);
if (se >= 0 ? this.Nl = se : (this.Nl = 0, u.hasFrag && Q >= u.fragments[0].start && (this.Nl = u.fragments.length - 1)), this.ub(!0), this.Ci.i(xi, "[" + this.Rl + "]seek: " + t + " " + i + " idx: " + this.Nl + " start: " + ((v = u.fragments[this.Nl]) == null ? void 0 : v.start) + " url: " + ((R = u.fragments[this.Nl]) == null ? void 0 : R.url)), c)
if (i)
this.Ai.emit(w.a.VIDEO_SEEK, { sec: u.fragments[this.Nl].start || t });
else if (this.Do.isLiveShift && t !== this.Do.currentTime) {
var fe;
this.Ai.emit(w.a.VIDEO_SEEK, { sec: i && ((fe = u.fragments[this.Nl]) == null ? void 0 : fe.start) || t });
} else
this.Ai.emit(w.a.VIDEO_SEEK, { sec: t });
this.zl();
}
return t;
}, a.destroy = function() {
this.Ci.i(xi, "[" + this.Rl + "]destroy"), this.ob(), this.Il && this.Il.destroy(), this.Yl && (this.Yl.destroy(), this.Yl = void 0), this.Kl = void 0, A.prototype.destroy.call(this);
}, a.nextBackup = function() {
if (this.Ci.i(xi, "[" + this.Rl + "]next backup."), this.Ll)
for (var t = 0; t < this.Ll.length; t++) {
var i = this.Ll[t];
if (i.urlId >= i.url.length - 1)
return !1;
i.urlId++, delete i.m3u8Slice, i.fragments = [];
}
return this.ob(), this.Vl = !0, this.Ql >= 0 && (this.Nl = this.Ql), this.ub(!0), !0;
}, a.setDownloadEnabled = function(t, i) {
i === void 0 && (i = !0), !this.xl && t ? (this.xl = t, i && this.zl()) : this.xl = t;
}, a.setIndex = function(t) {
this.Ci.i(xi, "[" + this.Rl + "]set index " + t + "."), this.ob(), this.Vl = !0, this.Do.lctx.setLevelIdx(t, this.Rl), this.Do.lctx.setNextIdx(t, this.Rl), this.Kl = void 0;
}, a.setNext = function(t) {
this.Ci.i(xi, "[" + this.Rl + "]set next " + t + "."), this.Vl = !0, this.Do.lctx.setNextIdx(t, this.Rl), this.Gl = !0;
}, a.cb = function(t) {
return t.maxStartPTS || t.startPTS || t.start;
}, a.fb = function(t) {
if (this.level && this.level.hasFrag)
return this.level.fragments[t];
}, a.tb = function(t) {
var i = this.fb(t);
return i ? this.cb(i) : 0;
}, a.ub = function(t) {
this.Pl = !1, this.Il.reset(t);
}, a.ob = function() {
this.Xl = void 0, this.Lf(), this.hb();
}, a.Lf = function() {
this.vf && (this.vf.destroy(), this.vf = void 0);
}, a.hb = function() {
this.Hl && (this.Hl.destroy(), this.Hl = void 0);
}, a.Ab = function(t) {
var i;
this.Ci.i(xi, "[" + this.Rl + "]load key " + t.sn + "."), !this.Yl && Rc && (this.Yl = new Rc(this.Do, { credentials: this.Do.config.credentials, headers: this.Do.config.headers, preferNativeLoader: this.Do.stat.preferNativeLoader }, this.Wl)), (i = this.Yl) == null || i.load(t);
}, a.Jl = function() {
var t = this.level;
return !!(t && t.hasFrag && !t.live && this.Nl >= t.fragments.length);
}, a.Tr = function() {
var t, i = this.level;
return i && this.Nl < i.fragments.length && (t = i.fragments[this.Nl]), t && (t.encrypted && t.decryptdata && this.Ab(t), typeof t.sn == "number" && this.Nl++), t;
}, a.ql = function(t) {
if (this.Rl === h.f.MAIN && this.Do.stat.avSeparated && this.Do.config.videoEnabled === !1) {
if (this.Vl) {
this.Ci.i(xi, "[" + this.Rl + "]mock load frag. video enabled false");
var i = t.start;
this.Ai.emit(w.a.NEW_SOURCE, { sync: i }), this.Vl = !1;
}
} else if ((this.Rl !== h.f.AUDIO || this.Do.config.audioEnabled !== !1) && t) {
var c, u, v = { url: t.url, responseType: "arraybuffer", progress: t.sn !== ra && this.Rl === h.f.MAIN && this.Do.streamingMux, frag: t, type: "frag", credentials: this.Do.config.credentials, headers: this.Do.config.headers, preferNative: this.Do.stat.preferNativeLoader }, R = t.byteRangeStartOffset, Q = t.byteRangeEndOffset;
if (Number.isFinite(R) && Number.isFinite(Q) && (v.rangeStart = R, v.rangeEnd = Q, v.rangeType = this.Do.config.httpRangeType), (c = this.Do.config.preprocessUrl) != null && c.stream && (this.Ci.d(xi, "[" + this.Rl + "]preprocessUrl stream."), v.url = (u = this.Do.config.preprocessUrl) == null ? void 0 : u.stream(v.url)), t.sn === ra)
v.progress = !1, this.hb(), this.Hl = new nt(this.Ci), this.Hl.load(v, this.bl, this.Zl);
else if (this.Lf(), this.vf = new nt(this.Ci), this.vf.load(v, this.bl, this.Zl), this.Pl = !0, this.Rl === h.f.MAIN && this.Vl) {
var se = t.start;
this.Ai.emit(w.a.NEW_SOURCE, { sync: se }), this.Vl = !1;
}
}
}, a.rb = function(t, i, c, u) {
if (this.eb(t.frag, this.Ll[t.frag.level])) {
if (this.Xl) {
this.lb(t, i, c, u);
var v = this.Xl.data.get(this.Xl.data.unreadLen);
this.Xl = void 0, v && (i = v);
}
this.nb(t, i, c, u);
} else
this.Xl ? this.lb(t, i, c, u) : (this.Xl = { context: t, stats: c, data: new Ws.a(), progress: u }, i && this.Xl.data.put(new Uint8Array(i)));
}, a.lb = function(t, i, c, u) {
this.Xl && (this.Xl.context = t, this.Xl.stats = c, this.Xl.progress = u, i && this.Xl.data.put(new Uint8Array(i)));
}, a.eb = function(t, i) {
return !(t.encrypted && t.decryptdata && !t.decryptdata.key || i != null && i.initSegment && !i.initSegment.data);
}, a.nb = function(t, i, c, u) {
var v;
this.Ci.i(xi, "start demux");
var R = this.Ll[t.frag.level], Q = { context: t, data: i, initData: R == null || (v = R.initSegment) == null ? void 0 : v.data, stats: c, audioCodec: R == null ? void 0 : R.audioCodec, videoCodec: R == null ? void 0 : R.videoCodec, remuxContiguous: !!(this.Gl || R != null && R.live), progress: u }, se = this.level;
this.Do.isLiveShiftKwai2 && se && typeof t.frag.sn == "number" && this.Do.liveTime && typeof this.Do.stat.liveShiftOffset == "number" && this.Do.stat.liveShiftOffset >= 0 && (t.frag.programDateTime ? Q.liveShiftOffset = (t.frag.programDateTime - this.Do.stat.liveStartTime) / 1e3 : Q.liveShiftOffset = (this.Do.stat.liveShiftOffsetAligned || this.Do.stat.liveShiftOffset) / 1e3), u ? this.Il.onFragProgress(Q) : this.Il.onFragLoaded(Q);
}, g()(_, [{ key: "levels", get: function() {
return this.Ll;
} }, { key: "level", get: function() {
return this.Do.lctx.getLevel(this.Rl);
} }, { key: "index", get: function() {
return this.Do.lctx.getLevelIdx(this.Rl);
} }, { key: "manualNext", set: function(t) {
if (this.Rl === h.f.MAIN) {
var i = this.level;
if (i != null && i.hasFrag) {
var c = ri(this.Do.currentTime + (i.targetduration || 5) / 2, i.fragments) + 1;
if (c > 0 && c < i.fragments.length) {
c < this.Nl && (this.ob(), this.ub(!1), this.Nl = c, this.Gl = !1), this.Vl = !0, this.Do.lctx.setNextIdx(t, this.Rl);
var u = i.fragments[this.Nl];
if (!u)
return this.Ci.i(xi, "set nextLevel failed. no frag @" + this.Nl), void this.Ai.emit(w.a.LEVEL_SWITCH_FAILED);
var v = this.cb(u);
return this.Ai.emit(w.a.LEVEL_SWITCHING, { id: 0, time: v, level: t, smooth: !0, auto: !1 }), (this.Kl && this.Kl.frag.sn !== u.sn || !this.Kl) && (this.Kl = { level: this.Do.lctx.getLevelIdx(this.Rl), pos: this.Nl, frag: u, alignPTS: v }), this.Ai.emit(w.a.BUFFER_CLEANING, { startSec: this.Kl.alignPTS || v }), void this.zl();
}
}
this.Ci.i(xi, "set nextLevel failed. no frag"), this.Ai.emit(w.a.LEVEL_SWITCH_FAILED);
}
} }, { key: "type", get: function() {
return this.Rl;
} }, { key: "lastLoadedFrag", get: function() {
var t = this.Nl;
return this.vf && t--, this.fb(t);
} }]);
}(F.a), Lc = function() {
function A(a, t) {
var i = this;
this.Ai = void 0, this.Do = void 0, this.vf = void 0, this.xl = !0, this.Nl = 0, this.Ul = 0, this.bl = void 0, this.Zl = void 0, this.bb = [], this.zl = function() {
if (!(i.index < 0)) {
var c = i.level;
if (i.xl && c && !i.vf) {
var u = i.Tr();
u && i.ql(u);
}
}
}, this.xc = function(c, u, v) {
i.Lf();
var R = i.Do.lctx.subtitleTracks[c.frag.level], Q = ft(ut.SUCCESS, c, v, R.qualityType);
i.Ai.emit(w.a.DOWNLOAD, Q), u && typeof u != "string" && (R && R.hasFrag && R.fragments.length === 1 && !R.live && i.bb.indexOf(c.frag.level) === -1 && i.bb.push(c.frag.level), i.Ai.emit(w.a.SUBTITLE_LOADED, { data: u, cc: c.frag.cc, start: c.frag.start })), i.zl();
}, this.Di = function(c, u) {
var v;
i.Ai.emit(w.a.DOWNLOAD, ft(ut.FAIL, c, u, (v = i.Do.lctx.subtitleTracks[c.frag.level]) == null ? void 0 : v.qualityType)), i.Lf(), i.zl();
}, this.Ai = a, this.Do = t, t.lctx.subtitleIdx = t.lctx.subtitleTracks.reduce(function(c, u, v) {
return u.default ? v : c;
}, -1), this.bl = { onEnd: this.xc, onError: this.Di }, this.Zl = { connectionTimeout: t.config.connectionTimeout, transmissionTimeout: t.config.transmissionTimeout, maxRetry: t.config.maxRetry, retryDelay: t.config.retryDelay };
}
var _ = A.prototype;
return _.levelUpdated = function() {
if (this.level && this.level.hasFrag) {
var a = this.level.startSN;
Number.isFinite(this.Ul) && this.Ul !== a && (this.Nl = Math.max(0, this.Nl - (a - this.Ul))), this.Ul = a, this.zl();
}
}, _.seek = function(a) {
if (this.index < 0)
return 0;
var t = this.level;
if (this.bb.indexOf(this.index) !== -1)
return a;
if (this.xl = !0, t && t.hasFrag) {
var i = a === 0 ? 0 : ri(a, t.fragments), c = t.fragments[i];
this.vf && c && this.vf.context.frag.sn === c.sn && this.vf.context.frag.level === c.level || (this.Nl = i >= 0 ? i : t.fragments.length - 1, this.Lf(), this.zl());
}
return a;
}, _.setDownloadEnabled = function(a) {
!this.xl && a ? (this.xl = a, this.zl()) : this.xl = a;
}, _.setIndex = function(a) {
this.Lf(), this.Do.lctx.subtitleIdx = a;
}, _.Tr = function() {
var a = this.level;
if (a && a.hasFrag && this.Nl < a.fragments.length) {
var t = a.fragments[this.Nl];
if (t && typeof t.sn == "number")
return this.Nl++, t;
}
}, _.Lf = function() {
this.vf && (this.vf.destroy(), this.vf = void 0);
}, _.ql = function(a) {
if (a) {
var t = { url: a.url, responseType: "arraybuffer", frag: a, type: "frag", credentials: this.Do.config.credentials, progress: !1, preferNative: this.Do.stat.preferNativeLoader }, i = a.byteRangeStartOffset, c = a.byteRangeEndOffset;
Number.isFinite(i) && Number.isFinite(c) && (t.rangeStart = i, t.rangeEnd = c), this.Lf(), this.vf = new nt(this.Do.logger), this.vf.load(t, this.bl, this.Zl);
}
}, g()(A, [{ key: "levels", get: function() {
return this.Do.lctx.subtitleTracks;
} }, { key: "level", get: function() {
return this.Do.lctx.subtitle;
} }, { key: "index", get: function() {
return this.Do.lctx.subtitleIdx;
} }, { key: "lastLoadedFrag", get: function() {
var a = this.Nl;
if (this.vf && a--, this.level && this.level.hasFrag)
return this.level.fragments[a];
} }]);
}(), Mi = "multipart", Qp = function(A) {
function _(t) {
var i;
return (i = A.call(this) || this).Ai = void 0, i.pb = void 0, i.Do = void 0, i.Ci = void 0, i.mb = void 0, i.gb = void 0, i.yb = void 0, i._b = void 0, i.Cb = !1, i.Ib = void 0, i.Ob = void 0, i.wb = !1, i.Eb = 0, i.jb = function(c) {
i.pb && i.pb.onDownload(c), i.mb && i.Do.config.videoEnabled !== !1 && (i.gb && i.kb(i.mb, i.gb), i.Ob && i.kb(i.mb, i.Ob));
}, i.Mb = function(c) {
i.gb && i.gb.seek(c.startSec, !1, !1);
}, i.kd = function() {
i.Ci.i(Mi, "on manifest loaded");
var c = i.Do, u = c.lctx;
if (c.stat.avSeparated = !!c.lctx.audioTracks.length, i.Ci.i(Mi, "manifest loaded. av separated: " + c.stat.avSeparated), u.audioTracks && u.audioTracks.length && (i.gb = new wc(h.f.AUDIO, i.Ai, c, u.audioIdx)), u.subtitleTracks && u.subtitleTracks.length && Lc && (i.Ob || (i.Ob = new Lc(i.Ai, c)), i.Sb()), u.levels.length > 0) {
var v = 0;
i.Ci.i(Mi, "manifest", u.abr, u.default), v = i.pb && u.abr ? i.pb.init() || 0 : u.default, i.mb = new wc(h.f.MAIN, i.Ai, c, v), i.Ai.emit(w.a.MANIFEST_PARSED, { levels: [], currentLevel: 0 }), i.pb && i.Do.lctx.abr && i.mb.setIndex(i.pb.abrInitLevel), i.Cb = !0;
var R, Q = c.lctx.current;
if (!Q)
return;
if (Q.hasFrag) {
if (c.stat.isLive = Q.live, i.Bb(Q), i.Tb(Q), i.Db(h.f.MAIN), Q.live) {
var se = S(null, Q, 0);
i.yb = setTimeout(function(fe) {
return i.Rb(fe, h.f.MAIN);
}, se, i.mb.index);
}
} else
i.Rb(c.lctx.currentIdx, h.f.MAIN);
i.gb && c.lctx.audioTracks.length && ((R = c.lctx.audio) != null && R.hasFrag ? (i.Db(h.f.AUDIO), Q.live && i.Rb(c.lctx.audioIdx, h.f.AUDIO)) : i.Rb(c.lctx.audioIdx, h.f.AUDIO));
} else
u.levels.length ? i.Ai.emit(w.a.ERROR, Object(L.e)(L.b.MUX_ERROR, L.a.MANIFEST_PARSING_ERROR, "manifest parsing error. core: mse mulitpart.")) : i.Ai.emit(w.a.ERROR, Object(L.e)(L.b.MUX_ERROR, L.a.UNSUPPORTED, "no supported codec"));
}, i.Lb = function(c) {
i.Nb(c, h.f.AUDIO);
}, i.Qb = function(c) {
i.Nb(c, h.f.SUBTITLE);
}, i.Nb = function(c, u) {
u === void 0 && (u = h.f.MAIN), i.Ci.i(Mi, "on level loaded. type: " + u + " level: " + c.level);
var v = c.level, R = i.Do, Q = i.xb(u);
if (Q && Q.level && v === Q.index) {
var se = Q.level, fe = c.details;
if ((u === h.f.MAIN && R.stat.isLive === void 0 || R.stat.isLive && !fe.live) && (R.stat.isLive = fe.live), R.stat.isLive) {
var ke = S(se, c.details, c.stats ? c.stats.trequest : 0);
if (se.hasFrag)
if (fe.endSN !== se.endSN)
N(i.Ci, se, fe, R.stat.liveShiftType), i.Db(u, fe.startSN), i.Eb = 0;
else {
if (i.Ci.i(Mi, "level no update. retry: " + i.Eb + "/" + R.config.levelNoUpdateRetry), i.Eb >= R.config.levelNoUpdateRetry)
return void i.Ai.emit(w.a.ERROR, Object(L.e)(L.b.MUX_ERROR, L.a.LEVEL_NO_UPDATE_ERROR, i.Do.stat.box + " level no update retry: " + i.Eb + "/" + R.config.levelNoUpdateRetry));
i.Eb++;
}
else
i.Bb(fe), N(i.Ci, se, fe, R.stat.liveShiftType), i.Tb(se), i.Db(u, fe.startSN);
i.Ci.v("live playlist, reload in " + Math.round(ke) + " ms"), R.isLiveShiftKwai2 ? i.Vb(Q, ke) : i.Ub(u, Q.index, ke);
} else
i.Fb(), N(i.Ci, se, fe, R.stat.liveShiftType), i.Db(u, fe.startSN);
}
}, i.Vb = function(c, u) {
if (c || (c = i.xb(h.f.MAIN)), c) {
var v = i.Do.getKwai2LiveShiftReloadInterval();
(typeof v != "number" || v <= 0) && (v = typeof u != "number" || u <= 0 ? S(null, c.level, null) : u), i.Ci.i(Mi, "load level delay: " + v + " default: " + u), i.Ub(h.f.MAIN, c.index, v);
}
}, i.Ub = function(c, u, v) {
i.Fb(), i.yb = setTimeout(function(R) {
return i.Rb(R, c);
}, v, u);
}, i.Db = function(c, u) {
c === void 0 && (c = h.f.MAIN), u === void 0 && (u = 0);
var v = i.xb(c), R = i.Do, Q = R.stat;
if (v && v.level && v.level.hasFrag) {
v.setDownloadEnabled(!0, !1);
var se = v.level.getTimeInfoAfter(u);
if (c === h.f.MAIN) {
if (R.isLiveShiftKwai2 && typeof R.stat.liveShiftOffset == "number") {
var fe = R.lctx.current.fragments, ke = R.getLiveShiftKwai2OffsetUTC(R.stat.liveShiftOffset);
if (Q.liveShiftKwai2Params.paramName === "offset" && fe.length)
for (var Fe = function(Qe) {
var _t = fe[Qe], dt = _t.programDateTime;
if (dt && Q.liveShiftOffset && ke >= dt && ke <= dt + 1e3 * _t.duration) {
if (Q.liveShiftOffsetAligned = Q.liveShiftOffset - (ke - dt), i.Ci.i(Mi, "liveshift kwai2. align offset: " + Q.liveShiftOffset + " -> " + Q.liveShiftOffsetAligned + ", i: " + Qe + "/" + fe.length), (Qe = Math.min(Qe, fe.length - 2)) > 0) {
var Rt = fe[0];
fe.forEach(function(gi) {
gi.start -= Rt.start;
});
}
return Ne = Qe, 1;
}
Ne = Qe;
}, Ne = 0; Ne < fe.length && !Fe(Ne); Ne++)
;
}
c === h.f.MAIN && (Q.liveShiftKwai2Params.paramName = "seqId"), i.Ai.emit(w.a.LEVEL_UPDATED, se);
} else
c === h.f.AUDIO && i.Ai.emit(w.a.AUDIO_TRACK_UPDATED, se);
var He = !v.level.live || R.isLiveShift, rt = He && Q.startFromSec >= 0;
v.levelUpdated(!rt), He && (i.Ci.i(Mi, "start from " + Q.startFromSec + " on level update"), rt && i.seek(Q.startFromSec, i._b, !1, !0), c === h.f.SUBTITLE && v.seek(R.currentTime));
}
}, i.Pb = function(c) {
if (i.pb && i.Do.lctx.abr && i.mb) {
var u = i.pb.nextBitrateIndex();
u >= 0 && u !== i.Do.lctx.currentIdx && (i.Ai.emit(w.a.LEVEL_SWITCHING, { id: 0, time: c.startSec, level: u, smooth: !0, auto: !0 }), i.setNextLevel(u));
}
}, i.kb = function(c, u) {
var v = c.lastLoadedFrag, R = u.lastLoadedFrag;
v ? R && (R.start + R.duration > v.start + v.duration - 0.5 ? u.setDownloadEnabled(!1) : u.setDownloadEnabled(!0)) : u.setDownloadEnabled(!0);
}, i.xb = function(c) {
return c === void 0 && (c = h.f.MAIN), c === h.f.MAIN ? i.mb : c === h.f.AUDIO ? i.gb : i.Ob;
}, i.Hb = function(c) {
return c === void 0 && (c = h.f.MAIN), c === h.f.MAIN ? i.Do.lctx.levels : c === h.f.AUDIO ? i.Do.lctx.audioTracks : i.Do.lctx.subtitleTracks;
}, i.Ai = t.evt, i.Do = t, i.Ci = t.logger, i._b = t.config.startFromKeyframe, i.Yb(), i.O.push(t.fallback.register(le.USE_BACKUP_MULTIPART, new E(t).setRetryFunc(i.nextBackup.bind(i)))), i;
}
y()(_, A);
var a = _.prototype;
return a.Yb = function() {
var t = this, i = this.Ai;
this.O.push(i.prependListener(w.a.RATE_CHANGE, function() {
t.Do.isLiveShiftKwai2 && (t.Ci.i(Mi, "liveshift kwai2 reload Interval change by playback rate change."), t.Vb());
}), i.prependListener(w.a.DOWNLOAD, this.jb), i.prependListener(w.a.BUFFER_CLEANING, this.Mb), i.prependListener(w.a.MANIFEST_LOADED, this.kd), i.prependListener(w.a.LEVEL_LOADED, this.Nb), i.prependListener(w.a.AUDIO_TRACK_LOADED, this.Lb), i.prependListener(w.a.SUBTITLE_TRACK_LOADED, this.Qb), i.prependListener(w.a.ABR_NEXT, this.Pb), i.prependListener(w.a.NEW_SOURCE, function() {
var c;
(c = t.pb) == null || c.onNewSource();
}));
}, a.init = function() {
this.Gb();
var t = Kp[this.Do.stat.box || h.i.hls];
t ? this.Ib = new t(this.Do) : this.Ai.emit(w.a.ERROR, Object(L.e)(L.b.OTHER_ERROR, L.a.UNSUPPORTED, "unsupported box: " + this.Do.stat.box));
}, a.destroy = function() {
this.Ib && (this.Ib.destroy(), this.Ib = void 0), this.Fb(), this.mb && (this.mb.destroy(), this.mb = void 0), this.gb && (this.gb.destroy(), this.gb = void 0), this.pb && (this.pb.destory(), this.pb = void 0), A.prototype.destroy.call(this);
}, a.loadSource = function() {
this.Ci.i(Mi, "load source"), this.Ib && this.Ib.loadManifest();
}, a.setDownloadEnabled = function(t) {
t === void 0 && (t = !0), this.Do.stat.isNetworkInUse = t, this.mb && this.mb.setDownloadEnabled(t), this.pb && this.pb.setDownloadEnabled(t);
}, a.isSeekable = function() {
return !this.Do.stat.isLive || this.Do.stat.liveShiftType !== h.g.NONE;
}, a.seek = function(t, i, c, u) {
i === void 0 && (i = !1), c === void 0 && (c = !1), u === void 0 && (u = !1), this.Ci.i(Mi, "seek time: " + t + " key: " + i + " inbuf: " + c), this.pb && this.pb.onSeek({ isInBuffer: c });
var v = this.Do, R = v.stat;
if (c) {
var Q = this.xb(h.f.MAIN);
v.isLiveShiftKwai2 && (this.Ci.i(Mi, "liveshift kwai2 reload Interval change by seek."), this.Vb(Q));
}
if (!c && this.mb) {
if (this.mb.level && this.mb.level.hasFrag) {
if (this.Ci.i(Mi, "seek: " + t + "."), !this.gb)
return v.isLiveShiftKwai2 && !pt(t - (R.liveShiftOffset || 0) / 1e3, this.mb.level.fragments) && !u ? (this.Kb(t), void this.Rb(this.Do.lctx.currentIdx, h.f.MAIN)) : (this.mb.seek(t, i), this.Ob && this.Ob.seek(t), void (R.startFromSec = -1));
if (this.gb.level && this.gb.level.hasFrag && !this.gb.level.live) {
var se = this.mb.seek(t, i);
return this.gb.seek(se, !1, !1), this.Ob && this.Ob.seek(se), void (R.startFromSec = -1);
}
}
this.Ci.i(Mi, "no frag. startFromSec: " + t), R.startFromSec = t, this._b = i;
}
}, a.nextBackup = function() {
if (this.mb) {
var t = this.mb.nextBackup();
if (this.gb && t && (t = this.gb.nextBackup()), t)
return this.mb.setDownloadEnabled(!1), this._b = !1, this.Rb(this.Do.lctx.currentIdx, h.f.MAIN), this.gb && (this.gb.setDownloadEnabled(!1), this.Rb(this.Do.lctx.audioIdx, h.f.AUDIO)), !0;
}
return !1;
}, a.onAbrLevelsUpdated = function() {
this.pb && this.pb.onAbrLevelsUpdated();
}, a.setAudioTrack = function(t) {
var i;
this.gb && (t = Math.min(t, this.gb.levels.length - 1), this.gb.setIndex(t), this.Cb && ((i = this.Do.video) != null && i.ended || this.seek(this.Do.currentTime), this.Zb(t, h.f.AUDIO), this.Ai.emit(w.a.AUDIO_TRACK_SWITCHING, { id: 0, time: this.Do.currentTime, level: t, smooth: !1, auto: !1 })));
}, a.setSubtitleTrack = function(t) {
this.Ob && (t = Math.min(t, this.Ob.levels.length - 1), this.Ob.setIndex(t), this.Cb && t >= 0 && (this.Zb(t, h.f.SUBTITLE) || this.Ob.seek(this.Do.currentTime)));
}, a.Rb = function(t, i) {
var c = this.Hb(i);
if (this.Ci.i(Mi, "load level: " + t + " " + i), c.length) {
var u = c[t];
u && typeof u == "object" && u.url.length > 0 && this.Ib && be(this.Do.stat.box) ? this.Ib.loadLevel(u, i, t) : this.Ai.emit(w.a.ERROR, Object(L.e)(L.b.OTHER_ERROR, L.a.UNSUPPORTED, "unsupported. " + this.Do.stat.box + " has no level manifest."));
}
}, a.Fb = function() {
this.yb !== void 0 && (clearTimeout(this.yb), this.yb = void 0);
}, a.Gb = function() {
this.Do.config.adaptive && !this.pb && (this.pb = new Ci(this.Do));
}, a.setCurrentLevel = function(t) {
var i, c;
t >= 0 ? (this.Wb(!1), this.mb && (t = Math.min(t, this.mb.levels.length - 1), this.Kb(this.Do.currentTime), this.mb.setIndex(t), this.Ci.i(Mi, "setCurrentLevel: " + t + " manifest: " + this.Cb + " video ended:" + ((i = this.Do.video) == null ? void 0 : i.ended) + ", currentTime:" + this.Do.currentTime), this.Cb && ((c = this.Do.video) != null && c.ended || this.seek(this.Do.currentTime), this.Zb(t), this.Ai.emit(w.a.LEVEL_SWITCHING, { id: 0, time: this.Do.currentTime, level: t, smooth: !1, auto: !1 })))) : this.Wb(!0);
}, a.setManualNextLevel = function(t) {
var i;
this.Wb(t < 0), this.Cb ? (i = this.mb) != null && i.level && this.mb.level.hasFrag && t >= 0 && (t = Math.min(t, this.mb.levels.length - 1), this.mb.manualNext = t, this.Zb(t) || this.setDownloadEnabled(!0)) : this.setCurrentLevel(t);
}, a.setNextLevel = function(t) {
this.mb && this.Do.lctx.nextIdx !== t && (this.mb.setNext(t), this.Zb(t));
}, a.Kb = function(t) {
if (this.Do.isLiveShiftKwai2) {
var i, c = this.Do, u = c.stat;
c.lctx.clearFrag(), (i = this.mb) == null || i.reset(), u.liveShiftKwai2Params.paramName = "offset", u.liveShiftOffset = 1e3 * t, u.liveShiftOffsetAligned = void 0, u.startFromSec = t, this.Eb = 0, this.Ci.i(Mi, "liveshift kwai2 reset", t);
}
}, a.Zb = function(t, i) {
i === void 0 && (i = h.f.MAIN);
var c = this.xb(i), u = c == null ? void 0 : c.levels[t];
return !(!u || u.hasFrag && !u.live) && (c.setDownloadEnabled(!1), this.Rb(t, i), !0);
}, a.Wb = function(t) {
this.pb && (t && !this.Do.lctx.abr && this.Do.isAbrAvailable && this.Ai.emit(w.a.LEVEL_SWITCHING, { id: 0, time: this.Do.currentTime, level: -1, smooth: !0, auto: !1 }), this.Do.lctx.abr = t && this.Do.isAbrAvailable);
}, a.Sb = function() {
if (!this.wb && this.Ob) {
var t = this.Do.lctx.subtitle;
t && (t.hasFrag ? this.Db(h.f.SUBTITLE) : this.Rb(this.Do.lctx.subtitleIdx, h.f.SUBTITLE)), this.wb = !0;
}
}, a.Bb = function(t) {
if (this.Do.stat.isLive) {
var i = this.Do.config.liveDelayFragNum;
if (i && i > 0 && !this.Do.config.autoPlaybackRateConf) {
var c = this.Do.getLiveDelay() / Ve.f;
Ae(this.Ci, c, c / 2, this.Do.stat.autoPlaybackRateConf, 0);
}
}
}, a.Tb = function(t) {
var i = this.Do;
if (!i.stat.isLive || i.isLiveShift) {
if (i.stat.isLive && !i.isLiveShiftKwai2)
if (i.stat.startFromSec < 0 && t.totalduration) {
var c = i.liveLocalTime;
i.stat.liveShiftType === h.g.KWAI && (c += t.targetduration + 1), c > 0 && (i.stat.startFromSec = c, this.Ci.i(Mi, "live delay startFromSec: " + i.stat.startFromSec), i.isLiveShift && i.updateLiveShiftStatuByTime(i.stat.startFromSec));
} else
i.stat.startFromSec >= 0 && i.isLiveShift && i.updateLiveShiftStatuByTime(i.stat.startFromSec);
} else
i.stat.startFromSec = -1;
}, g()(_, [{ key: "audioTracks", get: function() {
return this.gb ? this.gb.levels : [];
} }]);
}(F.a);
function $s(A, _, a) {
if (_ === void 0 && a === void 0)
return A;
var t = new ze.a(A, !0);
return _ && t.query.kabr_spts === void 0 && (t.query.kabr_spts = "" + Math.floor(_)), a === !0 && (t.query.onlyaudio = "yes"), t.toString();
}
var ji, Zs, Gn = n(15), ar = function(A) {
return A[A.tagType = 0] = "tagType", A[A.tagSize = 1] = "tagSize", A[A.timestamp = 2] = "timestamp", A[A.frameType = 3] = "frameType", A[A.packetType = 4] = "packetType", A;
}(ar || {}), Dc = "flv-key-detector", Xp = function() {
function A(a) {
this.Do = void 0, this.Ci = void 0, this.Nl = 0, this.Xb = void 0, this.zb = new Uint8Array(Gn.e), this.Jb = 0, this.qb = ar.tagType, this.$b = 0, this.tp = 0, this.ep = 0, this.np = 0, this.sp = 0, this.rp = 0, this.hp = [], this.Do = a, this.Ci = a.logger, this.reset();
}
var _ = A.prototype;
return _.reset = function() {
this.Ci.i(Dc, "reset"), this.Nl = Gn.e, this.Xb = void 0, this.zb = new Uint8Array(Gn.e), this.Jb = 0, this.qb = ar.tagType, this.$b = 0, this.tp = 3, this.ep = 0, this.np = 4, this.sp = 0, this.rp = 0, this.hp = [];
}, _.append = function(a) {
if (this.Xb === !1)
return [];
if (this.Xb === void 0 && (a.length + this.Jb >= Gn.e ? (this.zb.set(a.subarray(0, Gn.e - this.Jb), this.Jb), this.Jb = Gn.e, this.Xb = this.zb[0] === 70 && this.zb[1] === 76 && this.zb[2] === 86, this.Ci.i(Dc, "get header: " + this.Xb)) : (this.zb.set(a, this.Jb), this.Jb += a.length)), this.Nl > a.byteLength)
return this.Nl -= a.byteLength, [];
this.hp = [];
for (var t = this.Nl, i = 0; t < a.byteLength; )
switch (this.qb) {
case ar.tagType:
this.sp = a[t], this.$b = 0, this.tp = 3, i = t, t++, this.qb = ar.tagSize;
break;
case ar.tagSize:
if (this.$b = this.$b + (a[t] << 8 * (this.tp - 1)), this.tp--, t++, this.tp > 0)
break;
this.sp === Gn.j.VIDEO ? (this.ep = 0, this.np = 4, this.qb = ar.timestamp) : (t += 7 + this.$b + 4, this.qb = ar.tagType);
break;
case ar.timestamp:
this.ep += this.np === 1 ? a[t] << 24 : a[t] << 8 * (this.np - 2), this.np--, t++, this.np === 0 && (t += 3, this.rp = 0, this.qb = ar.frameType);
break;
case ar.frameType:
this.rp = a[t] >> 4, t++, this.qb = ar.packetType;
break;
case ar.packetType:
this.rp === 1 && a[t] === 1 && this.hp.push({ timestamp: this.ep, pos: i }), t += this.$b - 1 + 4, this.qb = ar.tagType;
}
return this.Nl = t - a.byteLength, this.hp;
}, g()(A, [{ key: "isFlv", get: function() {
return this.Xb;
} }, { key: "header", get: function() {
return this.Xb ? this.zb : void 0;
} }]);
}(), $p = n(46), qs = n(4), Sc = function(A) {
return A[A.flvHeader = 0] = "flvHeader", A[A.scriptData = 1] = "scriptData", A[A.audio = 2] = "audio", A[A.video = 3] = "video", A[A.seliceSeq = 4] = "seliceSeq", A;
}(Sc || {}), es = "kwai-slice", Zp = function() {
function A(a) {
this.Ci = void 0, this._t = new Ws.a(), this.op = [], this.Wv = this.ap(), this.up = 0, this.Ci = a;
}
var _ = A.prototype;
return _.reset = function() {
this.Ci.i(es, "reset"), this._t.clear(), this.op = [], this.Wv = this.ap(), this.up = 0;
}, _.append = function(a) {
for (this._t.put(new Uint8Array(a)); this._t.unreadLen >= (this.Wv.bodyLen || 15); )
this.Wv.bodyLen ? this.cp() : this.fp();
var t = this.op.reduce(function(u, v) {
var R;
return (((R = v.data) == null ? void 0 : R.byteLength) || 0) + u;
}, 0);
if (t) {
var i = new Uint8Array(t), c = 0;
return this.op.forEach(function(u) {
u.data && (i.set(u.data, c), c += u.data.byteLength);
}), this.op = [], i.buffer;
}
}, _.fp = function() {
if (this._t.unreadLen >= 15) {
var a = this._t.get(15);
if (!a)
throw new Error(es + " read slice_header fail");
var t = this.Wv;
if (t.bodyLen = (a[0] << 4) + (a[1] >> 4) - 15, t.type = 15 & a[1], t.sliceSeq = Object(qs.i)(a, 2), t.segmentId = Object(qs.h)(a, 10), t.posFlag = a[14] >> 6, t.frameType = a[14] >> 4 & 3, t.extended = 1 & a[14], t.bodyLen <= 0)
throw this.Wv = this.ap(), new Error(es + " slice body len: " + t.bodyLen);
}
}, _.cp = function() {
var a = this.Wv;
if (a.bodyLen && this._t.unreadLen >= a.bodyLen) {
var t = this._t.get(a.bodyLen);
if (!t)
throw new Error(es + " read slice_body fail");
var i = 0;
a.extended && (i += Object(qs.f)(t));
var c = t.subarray(i);
t.length > 3 && t[i] === 70 && t[i + 1] === 76 && t[i + 2] === 86 && (this.up > 0 && (c = c.subarray(13)), this.up++), a.data = c, this.op.push(a), this.Wv = this.ap();
}
}, _.ap = function() {
return { bodyLen: 0, type: Sc.flvHeader, sliceSeq: 0, segmentId: 0, posFlag: 0, frameType: 0, extended: 0 };
}, A;
}(), Tn = "media-loader", qp = function() {
function A(a, t) {
var i = this;
this.bl = void 0, this.Do = void 0, this.Ci = void 0, this.wc = void 0, this.Ap = 0, this.vf = void 0, this.vp = void 0, this.YA = void 0, this.dp = void 0, this.wl = !1, this.Nl = void 0, this.lp = 0, this.bp = !0, this.pp = 0, this.mp = !1, this.gp = !1, this.yp = Ve.e, this._p = function(c, u) {
i.bl.onLoad && i.bl.onLoad(c, u);
}, this.Cp = function(c, u) {
i.Ip(u), !i.mp && i.bl.onConnect && i.bl.onConnect(c, u), i.mp = !0;
}, this.Op = function(c, u, v) {
if (typeof u != "string") {
var R;
i.pp += u.byteLength, !c.rangeEnd && i.pp >= i.yp && i.Do.stat.isLive === !1 && (!i.Ap || i.Ap && i.pp < i.Ap) && ((R = i.vf) == null || R.abort(), i.Lf(), i.lp = i.pp, i.wp()), i.Ep(c, u, v);
}
}, this.jp = function(c, u) {
i.bl.onAbort && i.bl.onAbort(c, u), i.Lf();
}, this.Yf = function(c, u) {
u.fatal && (i.Lf(), i.Do.stat.isNetworkInUse = !1), c.preferNative && i.Do.stat.preferNativeLoader === void 0 && (i.Ci.i(Tn, "load error. prefer native loader."), i.Do.stat.preferNativeLoader = !0), u.code === 416 && (!i.Ap || c.rangeEnd && c.rangeEnd >= i.Ap) ? (i.Ci.i(Tn, "416 end"), i.wl = !0, i.Lf(), i.kp(c, null, u)) : i.bl.onError && i.bl.onError(c, u);
}, this.pl = function(c, u, v) {
if (c.range && i.bl.onRangeEnd && i.bl.onRangeEnd(c, v), i.Ip(v), i.Lf(), typeof u != "string") {
var R = (u == null ? void 0 : u.byteLength) || 0;
!i.Do.stat.isLive && u && i.Ep(c, u, v), (!c.range || typeof c.rangeStart == "number" && c.rangeEnd && c.rangeEnd - c.rangeStart > i.pp + R || i.Ap && c.rangeEnd && c.rangeEnd >= i.Ap) && (i.Ci.i(Tn, "end true"), i.wl = !0), i.wl || i.Do.stat.isLive ? (v.fatal && (i.Do.stat.isNetworkInUse = !1), i.kp(c, null, v)) : (c.rangeEnd && (i.lp = c.rangeEnd), i.wp());
}
}, this.bl = a, this.Do = t, this.Ci = t.logger, this.vp = { onLoad: this._p, onConnect: this.Cp, onEnd: this.pl, onError: this.Yf, onAbort: this.jp, onProgress: this.Op }, this.YA = { connectionTimeout: t.config.connectionTimeout, transmissionTimeout: t.config.transmissionTimeout }, t.stat.box === h.i.yuv && t.yuvParams ? this.yp = t.yuvParams.dataSize : this.yp = this.Do.src instanceof Blob ? Ve.c : Ve.e, this.Do.src instanceof Blob && (this.Do.loadRec.contentLen = this.Ap = this.Do.src.size), $.a.version && (this.gp = $.a.name === "chrome" && $.a.version.major >= 99), this.Ci.i(Tn, "without preflight: " + this.gp + "; range size: " + this.yp, this.Ap), this.updateConfig();
}
var _ = A.prototype;
return _.load = function(a) {
this.Ci.i(Tn, "load"), this.Lf(), this.mp = !1, this.wl = !1, this.wc = a, Ze(a.url) || a.fileName && Ze(a.fileName) ? (this.Ci.i(Tn, "kwai slice"), this.Do.stat.isKwaiSlice = !0, this.dp ? this.dp.reset() : this.dp = new Zp(this.Ci)) : this.Do.stat.isKwaiSlice = !1, this.wc.progress = this.Do.streamingMux, this.wc.responseType = "arraybuffer", this.wc.credentials = this.Do.config.credentials, this.wc.headers = this.Do.config.headers, this.wp();
}, _.seek = function(a) {
var t;
this.Ci.i(Tn, "seek time:" + a.time + ", pos:" + a.position), (t = this.vf) == null || t.abort(), this.Lf(), this.bp = !0, this.Nl = a, this.wl = !1, this.wp();
}, _.updateConfig = function() {
var a = this.Do;
this.Ci.i(Tn, "update loader config"), this.YA.maxRetry = a.stat.isLive ? 0 : a.config.maxRetry, this.YA.retryDelay = a.stat.isLive ? 0 : a.config.retryDelay, this.YA.breakpointContinuation = !(a.stat.box === h.i.flv && a.stat.isLive) && a.config.breakpointContinuation;
}, _.destroy = function() {
this.Lf();
}, _.ended = function() {
return this.wl;
}, _.setDownloadEnabled = function(a) {
a === void 0 && (a = !0), this.bp !== a && (this.bp = a, a && !this.vf && this.wp());
}, _.wp = function() {
var a;
if (this.bp !== !1 && !this.wl && this.wc)
if (this.Lf(), this.Nl && (this.lp = this.Nl.position, this.wc.frag && (this.wc.frag.start = this.Nl.time), this.Nl = void 0), this.Ap && this.lp >= this.Ap)
this.Do.stat.isNetworkInUse = !1;
else {
var t, i = this.wc;
this.Do.stat.isLive || (this.wc.progress = this.Do.streamingMux, i.rangeStart = this.lp, i.rangeEnd = (Math.floor(this.lp / this.yp) + 1) * this.yp, i.rangeType = this.Do.config.httpRangeType, this.Gf(i)), this.Do.stat.isNetworkInUse = !0, this.pp = 0, (a = this.Do.config.preprocessUrl) != null && a.stream && (this.Ci.d(Tn, "preprocessUrl stream"), i.url = (t = this.Do.config.preprocessUrl) == null ? void 0 : t.stream(i.url)), this.vf = new nt(this.Ci), this.vf.load(i, this.vp, this.YA);
}
else
this.Do.stat.isNetworkInUse = !1;
}, _.Lf = function() {
this.vf && (this.vf.destroy(), this.vf = void 0);
}, _.Ep = function(a, t, i) {
if (this.bl.onProgress)
if (this.Do.stat.isKwaiSlice) {
var c = this.Mp(a, t, i);
c && this.bl.onProgress(a, c, i);
} else
this.bl.onProgress(a, t, i);
}, _.kp = function(a, t, i) {
if (this.Do.stat.isKwaiSlice && t) {
var c = this.Mp(a, t, i) || null;
this.bl.onEnd(a, c, i);
} else
this.bl.onEnd(a, t, i);
}, _.Mp = function(a, t, i) {
if (this.Do.stat.isKwaiSlice && this.dp)
try {
return this.dp.append(new Uint8Array(t));
} catch (c) {
i.fatal = !0, i.errName = I.b.SLICE_UNPACK_ERROR_NAME, i.errMessage = c.message, this.bl.onError && this.bl.onError(a, i);
}
}, _.Gf = function(a) {
a.rangeEnd && this.Ap && a.rangeEnd > this.Ap && (this.wl = !0);
}, _.Ip = function(a) {
!this.Ap && a.contentTotalLength && (this.Do.loadRec.contentLen = this.Ap = a.contentTotalLength);
}, A;
}(), Jp = function() {
function A(a) {
var t = this;
this.Ci = void 0, this.wc = void 0, this.an = void 0, this.bl = void 0, this.vf = void 0, this.Sp = void 0, this.Bp = void 0, this.yb = void 0, this.Tp = 0, this.Dp = function() {
t.Rf(), t.vf && t.vf.destroy(), t.wc && t.an && t.bl && (t.an.firstPackageDuration = Math.round(t.an.firstPackageDuration), t.an.duration = Math.round(performance.now() - t.Tp), t.bl.onEnd(t.wc, t.an));
}, this.Mc = function(i, c, u) {
t.an && (t.an.firstPackageDuration = u.tfirst ? u.tfirst - u.trequest : 0, t.an.loaded = u.loaded);
}, this.Yf = function() {
t.an && (t.an.succeeded = !1), t.Dp();
}, this.pl = function() {
t.Dp();
}, this.Ci = a, this.Sp = { connectionTimeout: 0, transmissionTimeout: 0, maxRetry: 0, retryDelay: 0 }, this.Bp = { onProgress: this.Mc, onError: this.Yf, onEnd: this.pl };
}
var _ = A.prototype;
return _.start = function(a, t) {
this.wc = a, this.bl = t, this.an = { loaded: 0, duration: 0, firstPackageDuration: 0, succeeded: !0 }, this.Tp = performance.now(), this.vf && this.vf.destroy();
var i = Math.min(1e4, a.timeout);
this.Sp.connectionTimeout = i;
var c = { url: a.url, progress: !0, responseType: "arraybuffer", preferNative: a.preferNativeLoader };
this.vf = new nt(this.Ci), this.Rp(i), this.vf.load(c, this.Bp, this.Sp);
}, _.cancel = function() {
this.Rf(), this.vf && this.vf.destroy();
}, _.destroy = function() {
this.cancel();
}, _.Rp = function(a) {
var t = this;
this.yb = setTimeout(function() {
return t.Dp();
}, a);
}, _.Rf = function() {
clearTimeout(this.yb);
}, A;
}(), qr = "algorithm-simple", e_ = { stableBufferDiffThresholdSecond: 0.15, stableBufferIntervalMs: 2e3, speedTestTimeoutMs: 500, generateSpeedGapMs: 3e3, bufferCheckIntervalMs: 500, smoothedSpeedUtilizationRatio: 0.8, smallSpeedToBitrateRatio: 0.7, enoughSpeedToBitrateRatio: 0.9, bufferLowerLimitSecond: 0.8, recentBufferedSize: 16, smoothedSpeedRatio: 0.9, isSpeedFullyUsed: !1 }, t_ = function() {
function A(a) {
this.Do = void 0, this.Ci = void 0, this.Fi = void 0, this.Lp = void 0, this.Ll = void 0, this.Wv = 0, this.Np = 0, this.Qp = performance.now(), this.xp = void 0, this.Vp = 0, this.Up = 0, this.Fp = 0, this.yb = void 0, this.Do = a, this.Ci = a.logger, this.xp = new Jp(a.logger);
}
var _ = A.prototype;
return _.init = function(a) {
var t = this;
this.Fi = s()({}, e_), s()(this.Fi, a), this.Ci.i(qr, "init", a, this.Fi), this.Lp = [0], this.yb = setInterval(function() {
t.Pp();
}, this.Fi.bufferCheckIntervalMs);
}, _.onManifestUpdated = function() {
this.Ll = this.Do.lctx.abrLevels.slice(0), this.Np = this.Do.lctx.abrDefault;
}, _.onKeyPoint = function(a) {
var t = a.byteLength / Math.max(a.spendTime, 0.05) * 8 / 1024;
this.Ci.i(qr, "buffered: " + a.byteLength.toFixed(2) + ", size: " + a.byteLength + ", time: " + a.spendTime.toFixed(2)), this.Np = this._d(t, a.buffered);
}, _.onLevelLoad = function(a) {
this.Wv = Math.max(0, a);
}, _.onSeek = function() {
}, _.onDownloadEnabled = function() {
}, _.destroy = function() {
this.xp.destroy(), clearInterval(this.yb);
}, _.Hp = function(a) {
var t = a - this.Up, i = t / a, c = performance.now();
return (t < -this.Fi.stableBufferDiffThresholdSecond || i < -0.2) && (this.Ci.v(qr, "bufferDiffDown: " + t.toFixed(2) + "s, diffRatio: " + i.toFixed(2)), this.Qp = Math.max(c, this.Qp)), t > this.Fi.stableBufferDiffThresholdSecond && c - this.Qp + this.Fi.bufferCheckIntervalMs > this.Fi.stableBufferIntervalMs && (this.Qp = Math.max(c - 2 * this.Fi.bufferCheckIntervalMs, this.Qp + 2 * this.Fi.bufferCheckIntervalMs), this.Ci.v(qr, "bufferDiffUp: " + t.toFixed(2) + "s")), this.Up = a, c - this.Qp > this.Fi.stableBufferIntervalMs;
}, _.Yp = function() {
return this.Fi.isSpeedFullyUsed;
}, _.Pp = function() {
var a = this.Do.bufferedSec, t = this.Hp(a);
if (this.Yp()) {
var i = this.Ll[this.Wv + 1];
this.Vp = t && i ? i.bitrate : 0;
} else
t && this.Wv + 1 < this.Ll.length && this.Do.lctx.abr && this.Do.config.abrSpeedTest && (this.Gp(), this.Qp = performance.now() + this.Fi.generateSpeedGapMs);
this.Lp.push(a), this.Lp.length > this.Fi.recentBufferedSize && this.Lp.shift();
}, _.Gp = function() {
var a = this;
this.Ci.v(qr, "start speed testing on index: " + (this.Wv + 1));
var t = this.Ll[this.Wv + 1];
if (t) {
var i = t.currentUrl, c = this.Do.loadRec.traffic, u = t.bitrate;
this.xp.start({ url: i, timeout: this.Fi.speedTestTimeoutMs, preferNativeLoader: this.Fi.preferNativeLoader }, { onEnd: function(v, R) {
var Q = a.Do.loadRec.traffic - c;
if (R.succeeded && R.duration > 0 && R.firstPackageDuration > 0) {
var se = 8 * (Q + R.loaded) / R.duration;
a.Ci.v(qr, "testSpeed: " + se.toFixed(0)), se >= u && (a.Vp = u);
}
a.Ci.v(qr, "succeeded: " + R.succeeded + ", firstPackageDuration: " + R.firstPackageDuration + ", originalDownloadSize: " + Q + ", downloadSize: " + R.loaded + ", downloadTime: " + R.duration);
} });
}
}, _.Kp = function(a) {
for (var t = 0, i = this.Ll.length - 1; i >= 0; i--)
if (a >= this.Ll[i].bitrate) {
t = i;
break;
}
return t;
}, _._d = function(a, t) {
var i = this.Od(a, t);
return i != this.Wv && (this.Qp = performance.now() + this.Fi.generateSpeedGapMs), i < this.Wv ? (this.xp.cancel(), this.Vp = 0, this.Fp = a, this.Lp = [t]) : this.Fp = this.Zp(a), i;
}, _.Zp = function(a) {
return this.Fp > 0 ? a * (1 - this.Fi.smoothedSpeedRatio) + this.Fp * this.Fi.smoothedSpeedRatio : a;
}, _.Wp = function(a) {
return a + (a - Math.max.apply(Math, this.Lp));
}, _.Xp = function(a) {
var t = Math.max.apply(Math, this.Lp), i = 1 + (a - t) / t, c = this.Ll[this.Wv];
return c ? i * c.bitrate : 0;
}, _.zp = function(a) {
var t = this.Ll[this.Wv];
return !!t && a / t.bitrate < this.Fi.smallSpeedToBitrateRatio;
}, _.Jp = function(a) {
var t = this.Ll[this.Wv];
return !!t && a / t.bitrate > this.Fi.enoughSpeedToBitrateRatio;
}, _.Od = function(a, t) {
var i = this.Xp(t), c = this.Zp(a);
this.Ci.v(qr, "gopSpeed: " + a.toFixed(0) + ", smoothedSpeed: " + c.toFixed(0));
var u = this.Wp(t);
this.Ci.v(qr, "bufferSpeed: " + i.toFixed(0) + ", predictedBuffered: " + u.toFixed(1));
var v = this.Wv;
return u < this.Fi.bufferLowerLimitSecond || this.zp(i) ? v = Math.min(this.Wv, this.Kp(i)) : this.Jp(i) && (this.Vp > 0 ? (this.Ci.i(qr, "generatedSpeed used"), v = this.Kp(this.Vp), this.Vp = 0) : v = this.Kp(c * this.Fi.smoothedSpeedUtilizationRatio), v = Math.min(this.Wv + 1, Math.max(v, this.Wv))), v;
}, g()(A, [{ key: "nextLevel", get: function() {
return this.Ci.v(qr, "nextLevel: " + this.Np), this.Np;
} }, { key: "lowProfile", get: function() {
return !1;
} }]);
}(), Oc = "single-abr", i_ = function() {
function A(a) {
this.Do = void 0, this.Ci = void 0, this.qp = void 0, this.$p = 0, this.jd = 0, this.tm = 0, this.Ct = 0, this.wd = void 0, this.Do = a, this.Ci = a.logger, a.lctx.abr = a.isAbrAvailable, this.wd = new t_(a);
}
var _ = A.prototype;
return _.init = function() {
return this.$p = 0, this.jd = performance.now(), this.tm = 0, this.wd.init(s()({ preferNativeLoader: this.Do.stat.preferNativeLoader }, this.Do.config.liveAdaptiveConfig)), this.wd.onManifestUpdated(), this.Do.lctx.levels.length && (this.Do.lctx.abr ? this.Ct = this.Do.lctx.abrIndexToOrign(this.wd.nextLevel) : this.Ct = this.Do.lctx.default), this.Ct;
}, _.destory = function() {
this.wd && this.wd.destroy();
}, _.onAbrLevelsUpdated = function() {
this.wd.onManifestUpdated(), this.Ct = this.Do.lctx.abrIndexToOrign(this.wd.nextLevel);
}, _.onLoaderChunk = function(a) {
this.$p += a;
}, _.onLevelLoad = function(a) {
var t = this.Do.lctx;
t.levels.length && a >= 0 && a < t.levels.length && (this.tm = 0, this.jd = performance.now(), this.$p = 0, this.Ct = a, this.wd.onLevelLoad(t.orignIndexToAbr(a)));
}, _.onKeyFrame = function(a) {
var t = this.Do, i = t.lctx.levels;
if (this.tm++, (t.lctx.abr || typeof this.qp == "number") && this.tm > 1 && i) {
var c = this.Ct, u = !1, v = performance.now();
if (this.wd.onKeyPoint({ buffered: t.bufferedSec, byteLength: this.$p, spendTime: (v - this.jd) / 1e3 }), this.$p = 0, this.jd = v, typeof this.qp == "number")
c = this.qp, this.qp = void 0;
else {
if (!t.lctx.abr || !this.wd)
return;
c = t.lctx.abrIndexToOrign(this.wd.nextLevel), u = !0;
}
if (c !== this.Ct)
return { url: this.getRequestUrl(c, a), level: c, auto: u };
}
}, _.getRequestUrl = function(a, t) {
var i = this.Do.lctx.levels[a];
if (i) {
var c = i.currentUrl;
return this.Do.stat.box === h.i.flv ? $s(c, t || this.Do.config.defaultSpts, this.Do.config.videoEnabled === !1) : c;
}
return "";
}, g()(A, [{ key: "nextLevel", get: function() {
return typeof this.qp == "number" ? this.qp : this.Ct;
}, set: function(a) {
var t = this.Do.lctx;
this.Ci.i(Oc, "next level: " + a), a >= 0 ? (a = Math.min(t.levels.length - 1, a), t.setNextIdx(a), t.abr = !1, this.qp = a) : a === -1 && (t.abr = this.Do.isAbrAvailable);
} }, { key: "currentLevel", get: function() {
return this.Ct;
}, set: function(a) {
var t = this.Do.lctx;
this.Ci.i(Oc, "current level: " + a), a >= 0 ? (a = Math.min(t.levels.length - 1, a), t.setLevelIdx(a), t.abr = !1, this.Ct = a) : a === -1 && (t.abr = this.Do.isAbrAvailable);
} }]);
}(), Nc = n(35), r_ = n(38), n_ = n(24), kc = n(28), a_ = n(37), s_ = ["mono", "4:2:0", "4:2:2", "4:4:4"], o_ = { colorRange: ei.b.AVCOL_RANGE_JPEG, colourPrimaries: ei.a.AVCOL_PRI_BT2020, transferCharacteristics: ei.d.AVCOL_TRC_SMPTEST2084, matrixCoefficients: ei.c.AVCOL_SPC_BT2020_CL }, xc = function() {
function A(a, t, i) {
this.At = void 0, this.Ai = void 0, this.im = void 0, this.Do = void 0, this.Ci = void 0, this._t = new Ws.a(), this.wl = !1, this.Hh = -1, this.nm = 0, this.De = void 0, this.Ve = !0, this.Mi = void 0, this.Ne = void 0, this.Qe = void 0, this.Ph = !1, this.Yh = !1, this.Ah = 0, this.sm = void 0, this.If = 0, this.rm = 0, this.hm = void 0, this.Vn = 0, this.At = i, this.Ai = a, this.Do = t, this.Ci = t.logger, this.Qe = new a_.a(t.logger), this.im = new kc.a(), this.De = new ui.b(t.logger, this.Ai, t.getRemuxConfig(), ht.TYPE_SUPPORTED, "");
}
var _ = A.prototype;
return _.init = function() {
var a;
this.Ai.emit(w.a.DEMUXER_DETECTED, { type: _e.b.YUV }), (a = this.Do.cOutput) == null || a.updateRendererType(h.s.canvas), this.He(0);
}, _.destroy = function() {
this._t.clear(), this.im.removeAllListeners(), this.De.destroy();
}, _.reset = function(a) {
this.Ci.i("yuv", "reset: " + a), this.wl = !1, this.Hh = -1, this.Qe && this.Qe.reset(), this.Ve = !1;
}, _.end = function() {
this.wl || (this.wl = !0, this.Ai.emit(w.a.LOAD_END, {}));
}, _.onFragProgress = function(a) {
this.om(a, !1);
}, _.onFragLoaded = function(a) {
this.om(a, !0);
}, _.updateConfig = function() {
}, _.updateSuffix = function() {
}, _.om = function(a, t) {
if (a.data && a.data.byteLength) {
var i = performance.now(), c = { progress: a.context.progress, byteLength: a.data.byteLength, timeCost: performance.now() - (this.If || a.stats.trequest), ts: performance.now() };
this.If = i, this.Ai.emit(w.a.LOADER_CHUNK_ARRIVAL, c);
}
var u = a.context.frag, v = this.Mi;
if (v)
if (this.am(), this.sm) {
var R = this.sm;
if (R) {
var Q = (u == null ? void 0 : u.start) || 0;
this.Hh !== Q ? (this.nm = Math.floor(Q / (1 / R.fps)), this.Hh = Q, this.Ph = !1, this.Yh = !1, this.De.resetInitSegment({ duration: this.Vn, remuxId: 0 })) : this.Yh = !0, a.data && this._t.put(new Uint8Array(a.data)), v.codedWidth || (v.codedWidth = R.width, v.codedHeight = R.height, v.fps = R.fps, v.bitDepth = R.bpp, v.codecType = h.c.rawvideo);
for (var se = this.um(); se; ) {
var fe = Math.floor(this.nm * this.Ah);
se.format.pts = fe / v.inputTimescale * Ve.b, this.nm++, v.samples.push({ units: [], dts: fe, cts: 0, pts: fe, originDTS: fe, originPTS: fe, key: !0, yuv: se, duration: this.Ah, size: 0 }), this.rm++, se = this.um();
}
this.Do.updateVideoPlaybackQuality(this.rm, 0), this.Ke(t), t && (this.If = 0, this.Vn || (this.Vn = this.nm / R.fps, this.Ai.emit(w.a.METADATA, { duration: this.Vn })));
}
} else
this.Ai.emit(w.a.ERROR, Object(L.e)(L.b.MUX_ERROR, L.a.PARSING_ERROR, "yuv params error. " + JSON.stringify(this.sm)));
}, _.He = function(a) {
this.Mi = Object(Nc.b)(a), this.Mi.active = !0, this.Mi.outputRaw = !0, this.Mi.codec = "yuv", this.Ne = Object(Nc.a)(a), n_.a.initAudioForFillSilent(this.Ci, this.Ne, this.Do.stat.audioCodec);
}, _.um = function() {
if (this.sm) {
var a = this.sm.dataSize;
if (a)
return this._t.unreadLen >= a ? this.fm() : void 0;
this.Ai.emit(w.a.ERROR, Object(L.e)(L.b.MUX_ERROR, L.a.REMUX_ERROR, "yuv params error, can not get img size. " + JSON.stringify(this.sm)));
}
}, _.am = function() {
if (!this.sm) {
var a;
if (this.sm = this.Do.yuvParams, this.sm && this.Mi) {
this.sm.bpp > 8 && (this.Mi.colorInfo = o_);
var t = {};
if (this.Ah = Math.round(this.Mi.inputTimescale / this.sm.fps), this.Mi && (this.Mi.chromaFormat = s_[this.sm.chroma] || ""), this.Do.loadRec.contentLen) {
this.hm = [];
var i = Math.floor(this.Do.loadRec.contentLen / this.sm.dataSize);
this.Vn = t.duration = i / this.sm.fps;
for (var c = [], u = 0; u < i; u++) {
var v = u * this.Ah / this.Mi.inputTimescale;
this.hm.push({ index: u, dts: v, pts: v, duration: this.Ah }), c.push({ time: v, position: this.sm.dataSize * u });
}
t.keyframes = c;
}
this.Ai.emit(w.a.METADATA, t), this.hm && this.Ai.emit(w.a.VIDEO_FRAME_INFO, { videoFramesInfo: this.hm });
}
return this.Ai.emit(w.a.VIDEO_CODEC_DETECTED, { decoder: h.d.none, enabled: !0, codecType: h.c.yuv, bitDepth: (a = this.sm) == null ? void 0 : a.bpp, timeOffset: 0 }), this.sm;
}
}, _.fm = function() {
var a = this.sm;
if (a) {
var t = this._t, i = a.bpp > 8 ? 2 : 1, c = t.get(a.width * a.height * i), u = t.get(a.chromaWidth * a.chromaHeight * i), v = t.get(a.chromaWidth * a.chromaHeight * i);
return c && u && v ? { format: s()({}, a), y: { bytes: c, stride: a.width * i, bits: a.bpp }, u: { bytes: u, stride: a.chromaWidth * i, bits: a.bpp }, v: { bytes: v, stride: a.chromaWidth * i, bits: a.bpp } } : void 0;
}
}, _.Ke = function(a) {
a === void 0 && (a = !1);
var t = this.Ne, i = this.Mi;
if (i && t)
if (this.Qe.update(t, i), t.samples.length !== 0 || i.samples.length !== 0) {
if (a || !(t.active && t.samples.length === 0 || i.active && i.samples.length < 2)) {
if (this.Ve && (this.Vn || this.Ai.emit(w.a.KEY_FRAME_INDEXS, { keyframes: [{ time: 0, position: 0 }] }), this.Ve = !1, this.Ai.emit(w.a.MEDIA_DEMUX, { type: _e.b.YUV })), !this.hm) {
var c = Object(r_.a)(i, this.nm - i.samples.length);
this.Ai.emit(w.a.VIDEO_FRAME_INFO, { videoFramesInfo: c });
}
try {
this.De.remux(t, i, this.Hh, this.Ph, this.Yh, a), this.Ph = !0;
} catch (u) {
this.Ci.i("yuv", u), this.Ai.emit(w.a.ERROR, Object(L.e)(L.b.MUX_ERROR, L.a.REMUX_ERROR, u.message));
}
}
} else
a && this.De.flush();
}, g()(A, [{ key: "totalDuration", set: function(a) {
} }, { key: "id", get: function() {
return this.At;
} }]);
}(), Jr = "single", c_ = function(A) {
function _(t) {
var i;
return (i = A.call(this) || this).Ai = void 0, i.Do = void 0, i.Ci = void 0, i.vf = void 0, i.Bp = void 0, i.Am = void 0, i.vm = 0, i.No = !1, i.Gl = !1, i.dm = !1, i.lm = void 0, i.bm = void 0, i.pm = void 0, i.gm = !1, i.ym = !0, i._m = !1, i.Cm = !1, i.Im = !1, i.Om = !1, i.wm = !1, i.Il = void 0, i.Op = function(c, u, v) {
if (u instanceof ArrayBuffer) {
var R, Q, se;
if (i.Am && i.Am.onLoaderChunk(u.byteLength), i.lm && i.lm.isFlv !== !1 && !i.Do.stat.flvAbrNotAligned) {
var fe = i.lm.append(new Uint8Array(u));
if (i.Am && i.Do.lctx.levels.length > 1)
for (var ke = 0; ke < fe.length; ke++) {
var Fe = fe[ke];
if (!Fe)
break;
if (i.Do.streamTime.localTimeOffset === void 0 && (i.Do.streamTime.localTimeOffset = Fe.timestamp / Ve.h), i.Am) {
if (i.Om) {
var Ne = (Q = c.url, new ze.a(Q, !0).query.kabr_spts);
if (typeof Ne == "string" && parseInt(Ne) > 0 && Math.abs(parseInt(Ne) - Fe.timestamp) > Ve.g)
return i.Ci.i(Jr, "keyframes not aligned req: " + Ne + " get: " + Fe.timestamp), i.Em(i.Am.currentLevel, !0), void (i.Do.stat.flvAbrNotAligned = !0);
}
if (R = i.Am.onKeyFrame(Fe.timestamp)) {
var He = new Uint8Array(Fe.pos);
He.set(new Uint8Array(u).subarray(0, Fe.pos)), u = He.buffer;
var rt = { smooth: !0, auto: R.auto, id: 0, time: i.vm || i.Do.currentTime, level: R.level };
i.Ai.emit(w.a.LEVEL_SWITCHING, rt), i.vm = i.Do.streamTime.getLocalTime(Fe.timestamp / Ve.h) || 0, R.auto && (i.Om = !0);
break;
}
}
}
}
i.gm && ((se = i.lm) != null && se.header && (u = i.jm(u)), i.gm = !1);
var Qe = { context: c, data: u, stats: v, remuxContiguous: i.Gl, discontinuity: i.dm, progress: !0 };
i.dm = !1, R ? (i.Gl || (i.Gl = !0), i.Il.onFragLoaded(Qe), i.lm && i.lm.reset(), i.RA(R.url, R.level)) : i.Il.onFragProgress(Qe);
}
}, i._p = function(c, u) {
u.retry && i.Ai.emit(w.a.RETRY, { type: h.k.LOADER, core: h.a.mse, message: "" + u.errMessage, code: Object(L.d)(L.a.LOAD_ERROR, u.errMessage, u.code) });
}, i.Cp = function(c, u) {
if (i.Do.stat.box === void 0 || i.Do.stat.box === h.i.unknown) {
var v, R = (v = c.responseHeader) == null ? void 0 : v["content-type"];
R && (i.Do.stat.box = zs(Array.isArray(R) ? R[0] || "" : R).box);
}
i.Cm = !(!u.contentLength && !u.contentTotalLength), i.Ci.i(Jr, "on connect. contentLength: " + u.contentLength + " contentTotalLength: " + u.contentTotalLength), i.Ai.emit(w.a.MEDIA_CONNECTED, { headers: c.responseHeader }), i.jb(ut.CONNECTED, c, u);
}, i.jp = function(c, u) {
i.jb(ut.ABORT, c, u);
}, i.km = function(c, u) {
i.jb(ut.SUCCESS, c, u);
}, i.Yf = function(c, u) {
i.jb(ut.FAIL, c, u), u.fatal && i.Ai.emit(w.a.ERROR, Object(L.e)(L.b.NETWORK_ERROR, L.a.LOAD_ERROR, u.errMessage, { statusCode: u.code, url: c.url }));
}, i.pl = function(c, u, v) {
i.Do.config.flvLoadEndError && i.Do.stat.isLive && i.Do.stat.box === h.i.flv ? i.Ai.emit(w.a.ERROR, Object(L.e)(L.b.NETWORK_ERROR, L.a.LIVE_DISCONNECTED_ERROR, "flv live load end", { statusCode: v.code, url: c.url })) : (i.Il.onFragLoaded({ context: c, data: null, stats: v, remuxContiguous: !1, progress: !0 }), i.jb(ut.SUCCESS, c, v), i.bm ? i.Il.end() : i._m = !0);
}, i.Mm = function(c) {
var u = i.Do.stat;
i.bm = s()({}, c), i.bm.keyframes && (i.pm = i.bm.keyframes, i.Ci.i(Jr, "metadata keyframe", i.pm)), i.bm.keyframes || i.bm.duration ? (u.isLive = !1, i.Il.updateConfig(i.Do.getRemuxConfig())) : u.box === h.i.flv && u.isLive === void 0 && (u.isLive = !0, i.Il.updateConfig(i.Do.getRemuxConfig())), i.vf.updateConfig(), i.ym ? u.startFromSec > 0 && !u.isLive && i.pm && i.pm.length > 1 ? i.seek(u.startFromSec, i.Do.config.startFromKeyframe) : i._m && i.Il.end() : i.seek(u.startFromSec, i.Do.config.startFromKeyframe), u.startFromSec = -1, u.box === h.i.mp4 && (c.mp4FastStart = i.ym), i._m = !1;
}, i.Sm = function() {
i._m && (i.Il.end(), i._m = !1);
}, i.jl = function(c) {
$.a.safari && i.Do.stat.codecType === h.c.hevc && c.segments.forEach(function(u) {
if (u.type === h.o.VIDEO && u.keyTime)
for (var v = 0; v < u.keyTime.length; v++) {
var R;
if ((R = u.keyTime[v]) != null && R.cra)
return i.Ci.i(Jr, "safari hevc cra nalu. always seek 0"), void (i.wm = !0);
}
});
}, i.Bm = function(c) {
if (i.Ci.i(Jr, "get key index"), c.append)
if (i.pm && c.keyframes[0]) {
for (var u = 0; u < c.keyframes.length; u++) {
for (var v = !1, R = 0; R < i.pm.length; R++)
if (c.keyframes[u].time === i.pm[R].time) {
v = !0;
break;
}
v || i.pm.push(c.keyframes[u]);
}
i.pm.sort(function(Q, se) {
return Q.time - se.time;
});
} else
i.pm = c.keyframes;
else
i.pm = c.keyframes;
}, i.Tm = function(c) {
i.Ci.i(Jr, "not faststart", c.pos), i.vf.seek({ position: c.pos, time: 0 }), i.Il.reset(!0), i.ym = !1, i._m = !1;
}, i.Dm = function(c) {
i.Do.demuxerType = c.type, i.Cm && (i.Do.stat.isLive = !1), i.Ci.i(Jr, "demuxer detected: " + c.type + ", box:" + i.Do.stat.box + " isLive:" + i.Do.stat.isLive), i.vf.updateConfig();
}, i.Ai = t.evt, i.Do = t, i.Ci = t.logger, i.lm = new Xp(i.Do), i.Bp = { onLoad: i._p, onConnect: i.Cp, onProgress: i.Op, onError: i.Yf, onEnd: i.pl, onAbort: i.jp, onRangeEnd: i.km }, i.vf = new qp(i.Bp, t), i.Il = xc && t.stat.box === h.i.yuv ? new xc(i.Ai, t, h.f.MAIN) : new Qs(i.Ai, t, h.f.MAIN), i.Il.init(), i.O.push(i.Ai.prependListener(w.a.METADATA, i.Mm), i.Ai.prependListener(w.a.PARSING_INIT_SEGMENT, i.Sm), i.Ai.prependListener(w.a.PARSING_DATA, i.jl), i.Ai.prependListener(w.a.KEY_FRAME_INDEXS, i.Bm), i.Ai.prependListener(w.a.MP4_NOT_FASTSTART, i.Tm), i.Ai.prependListener(w.a.DEMUXER_DETECTED, i.Dm)), i;
}
y()(_, A);
var a = _.prototype;
return a.init = function() {
this.Do.stat.box === h.i.yuv && this.Il instanceof Qs && this.Ai.emit(w.a.ERROR, Object(L.e)(L.b.MUX_ERROR, L.a.UNSUPPORTED, "yuv streams are not supported. yuv disabled.")), this.Am || (this.Am = new i_(this.Do), this.No = !0, this.Do.lctx.currentIdx = this.Am.init(), this.Do.lctx.levels.length && this.Ai.emit(w.a.MANIFEST_PARSED, { levels: [], currentLevel: 0, auto: !1 }));
}, a.destroy = function() {
this.vf && this.vf.destroy(), this.Am && this.Am.destory(), this.lm = void 0, this.Il.destroy(), A.prototype.destroy.call(this);
}, a.loadSource = function() {
var t = this.Am;
if (t) {
var i = this.Do.lctx.current;
i ? this.RA(this.Rm(i.currentUrl) ? $s(i.currentUrl, this.Do.config.defaultSpts, this.Do.config.videoEnabled === !1) : i.currentUrl, t.currentLevel) : this.Ai.emit(w.a.ERROR, Object(L.e)(L.b.OTHER_ERROR, L.a.MANIFEST_PARSING_ERROR, "manifest parse error. core: mse."));
} else
typeof this.Do.src == "string" ? this.RA(this.Do.src) : this.Ai.emit(w.a.ERROR, Object(L.e)(L.b.OTHER_ERROR, L.a.MANIFEST_PARSING_ERROR, "src Incorrect!"));
}, a.setDownloadEnabled = function(t) {
t === void 0 && (t = !0), this.vf.setDownloadEnabled(t);
}, a.isSeekable = function() {
return !(!this.pm || !this.pm.length || this.Do.stat.isLive || this.Do.stat.isKwaiSlice);
}, a.seek = function(t, i, c) {
i === void 0 && (i = !1), c === void 0 && (c = !1), this.Ci.i(Jr, "seek: " + t + " " + i + " " + c);
var u = this.pm;
if ((u || t < Ve.r) && !c) {
var v = u ? $p.a.getPosByTime(u, this.wm ? 0 : t) : { time: 0, position: 0 };
v && (this.vf.seek(v), this.vm = v.time, this.Il.reset(!0), this.gm = v.position > 0, t !== this.Do.currentTime && this.Ai.emit(w.a.VIDEO_SEEK, { sec: i ? v.time : t }));
} else
this.Ci.w(Jr, "no keyframe index"), this.Ai.emit(w.a.ERROR, Object(L.e)(L.b.MEDIA_ERROR, L.a.CANNOT_SEEK, "can not seek", { fatal: !1 }));
}, a.nextBackup = function() {
return !1;
}, a.onAbrLevelsUpdated = function() {
var t;
(t = this.Am) == null || t.onAbrLevelsUpdated();
}, a.setCurrentLevel = function(t) {
this.Ci.i(Jr, "set current level " + t), this.Am && t >= 0 && t !== this.Am.currentLevel && this.Em(t);
}, a.setManualNextLevel = function(t) {
this.setNextLevel(t);
}, a.setNextLevel = function(t) {
if (this.No || this.setCurrentLevel(t), this.Do.stat.flvAbrNotAligned) {
if (t < 0)
return this.Ci.i(Jr, "flv not aligned. unsupprted abr."), void this.Ai.emit(w.a.LEVEL_SWITCH_FAILED);
this.Em(t, !0);
}
var i = this.Am;
i && (t === -1 && this.Ai.emit(w.a.LEVEL_SWITCHING, { id: 0, level: -1, time: this.Do.currentTime, smooth: !0, auto: !0 }), i.nextLevel = t, this.Om = !0);
}, a.setAudioTrack = function() {
}, a.setSubtitleTrack = function() {
}, a.RA = function(t, i) {
i === void 0 && (i = 0), this.Im = !0, this.Am && this.Am.onLevelLoad(i), this.Do.lctx.currentIdx = i;
var c = this.Do.lctx.current;
this.Do.stat.audioCodec = this.Do.stat.audioCodec || (c ? c.audioCodec : ""), this.Ai.emit(w.a.NEW_SOURCE, { sync: this.vm });
var u = Ge((c == null ? void 0 : c.fileName) || t);
u && this.Il.updateSuffix(u);
var v = new Ti();
v.start = this.vm, v.type = "frag";
var R = { url: t, responseType: "arraybuffer", credentials: this.Do.config.credentials, headers: this.Do.config.headers, frag: v, fileName: c == null ? void 0 : c.fileName, preferNative: this.Do.stat.preferNativeLoader };
this.vf.load(R);
}, a.Em = function(t, i) {
var c = this.Am;
if (c) {
c.currentLevel = t;
var u = this.Do.lctx.current;
if (u && this.No) {
var v = this.Rm(u.currentUrl) ? $s(u.currentUrl, this.Do.config.defaultSpts, this.Do.config.videoEnabled === !1) : u.currentUrl;
this.lm && this.lm.reset(), this.Gl = !1, this.dm = !0, this.vm = this.Do.currentTime;
var R = { id: 0, level: c.currentLevel, time: this.vm, smooth: !1, auto: !1 };
i && (R.fallback = i), this.Ai.emit(w.a.LEVEL_SWITCHING, R), this.Il.reset(!0), this.Im && this.RA(v, c.currentLevel);
}
}
}, a.jb = function(t, i, c) {
var u, v = ft(t, i, c, (u = this.Do.lctx.current) == null ? void 0 : u.qualityType);
this.Ai.emit(w.a.DOWNLOAD, v);
}, a.jm = function(t) {
var i, c = (i = this.lm) == null ? void 0 : i.header;
if (c) {
var u = new Uint8Array(t.byteLength + c.length);
return u.set(c), u.set(new Uint8Array(t), c.length), u.buffer;
}
return t;
}, a.Rm = function(t) {
var i = this.Do.stat;
return !(!i.isLive && i.isLive !== void 0 || i.box !== h.i.flv);
}, _;
}(F.a), l_ = function(A) {
function _(t) {
var i;
return (i = A.call(this) || this).Lm = void 0, i.Do = void 0, i.Dm = function(c) {
i.Do.demuxerType = c.type, i.Do.logger.i("transmuxer", "demuxer detected, box:" + i.Do.stat.box + " isLive:" + i.Do.stat.isLive);
}, i.Do = t, t.stat.multipart ? i.Lm = new Qp(t) : i.Lm = new c_(t), i.O.push(i.Lm), i;
}
y()(_, A);
var a = _.prototype;
return a.init = function() {
this.Nm(), this.Lm.init();
}, a.loadSource = function() {
this.Lm.loadSource();
}, a.setDownloadEnabled = function(t) {
t === void 0 && (t = !0), this.Lm.setDownloadEnabled(t);
}, a.seek = function(t, i, c) {
c === void 0 && (c = !1), this.Lm.seek(t, i, c);
}, a.heartbeat = function() {
}, a.isSeekable = function() {
return this.Lm.isSeekable();
}, a.setNextLevel = function(t) {
this.Lm.setManualNextLevel(t);
}, a.setCurrentLevel = function(t) {
this.Lm.setCurrentLevel(t);
}, a.onAbrLevelsUpdated = function() {
this.Lm.onAbrLevelsUpdated();
}, a.setAudioTrack = function(t) {
this.Do.lctx.audioTracks.length && this.Lm.setAudioTrack(t);
}, a.setSubtitleTrack = function(t) {
this.Do.lctx.subtitleTracks.length && this.Lm.setSubtitleTrack(t);
}, a.Nm = function() {
var t = this.Do.evt;
this.O.push(t.prependListener(w.a.DEMUXER_DETECTED, this.Dm));
}, _;
}(F.a), Mc = function() {
function A(a) {
this.Qm = void 0, this.Qm = a;
}
var _ = A.prototype;
return _.update = function(a) {
var t = this;
a.forEach(function(i) {
t.Qm[i.index] = i;
});
}, _.timeToIndex = function(a) {
if (this.Qm.length) {
if (a < this.Qm[0].pts)
return 0;
if (a > this.Qm[this.Qm.length - 1].pts)
return this.Qm.length - 1;
for (var t, i, c, u = 0, v = this.Qm.length - 1; u <= v; )
if (t = (u + v) / 2 | 0, i = this.Qm[t], (c = this.Qm[t + 1]) && c.pts - 1e-3 < a)
u = t + 1;
else {
if (!(i && i.pts - 1e-3 > a))
return t;
v = t - 1;
}
}
return -1;
}, _.isIndexInRange = function(a) {
return a >= 0 && a < this.Qm.length;
}, _.indexToTime = function(a) {
var t = this.Qm[a];
return t ? t.pts : -1;
}, _.getNextFramePTSByTime = function(a) {
var t = this.timeToIndex(a), i = this.Qm[t + 1];
return t >= 0 && i ? i.pts : -1;
}, _.getPrevFramePTSByTime = function(a) {
var t = this.timeToIndex(a) - 1, i = this.Qm[t];
return t >= 0 && i ? i.pts : -1;
}, g()(A, [{ key: "totalVideoFrames", get: function() {
return this.Qm.length;
} }]);
}(), Pc = "seek-stuck", u_ = function() {
function A(a) {
this.Do = void 0, this.xm = -1, this.Do = a;
}
var _ = A.prototype;
return _.onSeeking = function() {
this.Do.logger.i(Pc, "seeking. reset"), this.xm = -1;
}, _.tick = function(a) {
var t, i, c = this.Do, u = c.video;
if (!a || !u || u.buffered.length !== 1 || c.stat.isLive && !be(c.stat.box) || c.stat.isNetworkInUse || (t = c.mse) != null && t.ended())
return !1;
var v = c.bufferedSec + (((i = c.mse) == null ? void 0 : i.getBufferQueueSec()) || 0);
if (v >= c.stat.lazyLoadRecoverDuration && v < 300) {
var R = performance.now();
return this.xm < 0 && (this.xm = R), R - this.xm >= 2e3 ? (this.xm = -1, this.Do.logger.i(Pc, "mp stuck fix."), "fix") : "hit";
}
return this.xm = -1, !1;
}, A;
}(), h_ = function() {
function A(a) {
this.Vm = void 0, this.Um = void 0, this.Fm = 0, this.if = !1, this.Pm = !1, this.Vm = a;
}
var _ = A.prototype;
return _.check = function() {
var a = this.Vm, t = performance.now();
if (!a.paused && !a.seeking && !a.ended && t - this.Fm >= 100) {
if (this.Fm = t, !this.Pm)
return typeof this.Um == "number" && Math.abs(a.currentTime - this.Um) > 0.017 && (this.Pm = !0), void (this.Um = a.currentTime);
a.currentTime === this.Um ? this.if || (this.if = !0, this.Hm(a, "waiting")) : this.if && (this.if = !1, this.Hm(a, "playing")), this.Um = a.currentTime;
}
}, _.reset = function() {
this.Um = void 0, this.Pm = !1, this.if = !1;
}, _.Hm = function(a, t) {
if (a && a.dispatchEvent) {
var i = document.createEvent("CustomEvent");
i.initCustomEvent(t, !0, !0, {}), a.dispatchEvent(i);
}
}, A;
}(), ln = "yuv-renderer", Uc = function(A) {
function _(t) {
var i;
return (i = A.call(this, t) || this).Ju = 1, i.Ym = 0, i.Gm = { streamTime: 0, stoped: !1, frameBufLen: 0, maxFrameBufLen: 0, pictMode: je.a.contain }, i.Km = function() {
var c, u;
i.if = !1, i.ef !== !1 || (c = i.Do.video) != null && c.ended || (u = i.Do.video) == null || (u = u.play()) == null || u.catch(function(v) {
return i.Ci.i(ln, "on dec ready, call play() fail.", v);
}), i.ef = void 0;
}, i.Zm = function() {
var c, u;
(c = i.Do.video) != null && c.ended || (i.rf.onWaiting(), i.if = !0, i.ef === void 0 && (i.ef = !((u = i.Do.video) == null || !u.paused)));
}, i.Wm = function(c) {
i.Ci.i(ln, "seek[" + c.id + "]: renderer seek event", c), c.hitCache ? i.if = !1 : (i.ub(!0), i.hf()), i.zu = void 0;
}, i.Xm = function() {
var c;
i.Ci.i(ln, "on ren waiting."), i.ef === void 0 && (i.ef = !((c = i.Do.video) == null || !c.paused)), i.Ai.emit(w.a.DECODER_WAITING);
}, i.zm = function() {
i.Km();
}, i.Gm.maxFrameBufLen = i.rf.maxFrameBufLen, i;
}
y()(_, A);
var a = _.prototype;
return a.init = function(t, i) {
this.Ci.i(ln, "init " + t + ", " + i);
var c = this.Ai;
this.O.push(c.prependListener(w.a.DEC_VIDEO_READY, this.Km), c.prependListener(w.a.DECODER_WAITING, this.Zm), c.prependListener(w.a.RENDERER_SEEK, this.Wm), c.prependListener(w.a.RENDERER_WAITING, this.Xm), c.prependListener(w.a.RENDERER_WAITING_END, this.zm)), this.sf.id = this.Ju, this.sf.init(!1), this.No = !0, this.start();
}, a.setMediaInfo = function(t) {
this.sf.updateMediaInfo(t);
}, a.appendData = function(t) {
var i = this;
t.samples.forEach(function(c) {
c.yuv && i.sf.append(c.yuv);
});
}, a.endOfData = function() {
this.Ci.i(ln, "endOfData"), this.sf.endOfData();
}, a.heartbeat = function() {
this.Ci.i(ln, "hb seeking: " + this.zu);
}, a.seek = function(t, i) {
this.Ci.i(ln, "seek[" + i + "]: " + t + " " + this.zu), t *= Ve.b, this.sf.seek(t, i), this.start();
}, a.seekWithLoad = function() {
this.Ci.i(ln, "seekWithLoad"), this.ub(!0), this.hf();
}, a.clean = function(t) {
t === void 0 && (t = 0), this.Ci.i(ln, "clean"), t || this.ub(!1);
}, a.decoderChange = function(t, i) {
this.Ci.i(ln, "decoderChange: " + t + " @ " + i);
}, a.onParsingData = function(t) {
var i = this;
t.segments.forEach(function(c) {
c.type === h.o.AUDIO && i.Ym++;
});
}, a.screenshot = function(t) {
this.sf.screenshot(t);
}, a.ub = function(t) {
t === void 0 && (t = !1), this.Ju++, this.Ym = 0, t || (this.zu = void 0), this.sf.id = this.Ju, this.sf.reset(t), this.if = !0;
}, a.hf = function() {
var t, i = (t = this.Do.cOutput) == null ? void 0 : t.canvas;
if (!i)
throw new Error("canvas output undefined.");
if (i instanceof HTMLCanvasElement) {
var c, u = this.Do.currentTime * Ve.b, v = !1, R = !((c = this.Do.video) == null || !c.ended), Q = this.af(i), se = this.Gm, fe = X.a.getPictModeByCss(i);
if (u !== 0 || this.Ym || (u = -1), se.streamTime === u && se.stoped === R && se.frameBufLen === this.sf.frameBufLen && se.maxFrameBufLen === this.rf.maxFrameBufLen && se.pictMode === fe || (se.streamTime = u, se.stoped = R, se.frameBufLen = this.sf.frameBufLen, se.maxFrameBufLen = this.rf.maxFrameBufLen, se.pictMode = fe, v = !0), !v && !this.if && !Q)
return;
(v || Q) && this.sf.update(u, this.yt.w, this.yt.h, R, h.s.canvas, se.maxFrameBufLen, fe);
}
}, g()(_, [{ key: "isCanvasRenderer", get: function() {
return !0;
} }, { key: "decBufLow", get: function() {
return !1;
} }]);
}(Ue), lt = "kernel-base-mse", Js = function(A) {
function _(t) {
var i;
(i = A.call(this, t) || this).Jm = void 0, i.Lm = void 0, i.qm = !1, i.$m = void 0, i.tg = !1, i.ig = void 0, i.eg = !1, i.Ob = void 0, i.ng = 3, i.sg = 0, i.rg = void 0, i.hg = void 0, i.og = void 0, i.ag = void 0, i.ug = void 0, i.cg = !1, i.fg = void 0, i.Ag = [], i.vg = void 0, i.dg = void 0, i.lg = !1, i.bg = !0, i.pg = void 0, i.mg = 0, i.gg = NaN, i.yg = 0, i._g = {}, i.Cg = !1, i.fl = 0, i.Ig = [], i.Og = function() {
i.Ci.i(lt, "mse buffer full. live: " + i.Do.live + " paused: " + i.eA.paused), i.Do.live ? i.eA.paused && (i.stopLoad(), i.wg()) : i.Lm && i.Lm.setDownloadEnabled(!1);
}, i.Eg = function() {
i.Io !== mt.NONE && i.Do.isTimeinBuffered(i.eA.currentTime) && i.eA.readyState >= 3 ? (i.AA(), i.Ci.v(lt, "canplay polyfill")) : i.qm && i.jg();
}, i.kg = function() {
i.emit(w.a.ERROR, Object(L.e)(L.b.OTHER_ERROR, L.a.MSE_SOURCE_BUFFER_CLOSE_ERROR, "mse source close.", { fatal: !0 }));
}, i.Mg = function(u) {
i.Ob && i.Ob.parseVTTs(u.data, u.start, u.cc);
}, i.Sg = function(u) {
u.id = i.rA, i.rA++, u.auto = i.Do.lctx.abr, !u.smooth && i.Jm && (i.Jm.clean(), i.Do.streamingMux = !0), i.oA = u;
}, i.Bg = function(u) {
var v;
u.id = i.rA, i.rA++, u.auto = i.Do.lctx.abr, !u.smooth && i.Jm && (i.Jm.clean(), i.Do.streamingMux = !0), u.fallback && (i.Ci.i(lt, "level switch fallback, set seek on canplay"), i.qm = !0), typeof u.level == "number" && (u.bitrate = u.level < 0 ? -1 : ((v = i.Do.lctx.levels[u.level]) == null ? void 0 : v.bitrate) || 0), u.level === -1 ? setTimeout(function() {
return i.emit(w.a.LEVEL_SWITCHED, { time: u.time, bitrate: u.bitrate, level: u.level, smooth: u.smooth, auto: u.auto, id: u.id });
}, 0) : (u.smooth ? i.hA = i.hA.sort(function(R, Q) {
return R.data.time - Q.data.time;
}).filter(function(R) {
return R.data.time < u.time - 0.5;
}) : i.hA = [], i.hA.push({ switched: !1, data: u }));
}, i.Mb = function(u) {
i.Jm && i.Jm.clean(u.startSec, i.eA.duration);
}, i.Tg = function(u) {
i.Ci.i(lt, "manifest parsed", i.fg);
var v = i.Do, R = i.Lm;
if (R) {
i.Ci.i(lt, "avSeparated: " + v.stat.avSeparated), i.Dg();
var Q, se = v.lctx.startIdx;
if (typeof se == "number" && se >= 0 && se < v.lctx.levels.length && (R.setCurrentLevel(se), i.Ci.i(lt, "set level from level startIdx.")), typeof i.fg == "number")
return i.fg >= 0 && (R.setCurrentLevel(i.fg), i.Ci.i(lt, "set level:" + i.fg + ". manifest parsed stop event."), u.preventFollowUp = !0), void (i.fg = void 0);
v.lctx.subtitleTracks.length && i.Rg(), v.config.emeEnabled && ((Q = i.hg) == null || Q.onManifestParsed(v.lctx.levels, v.stat.drm));
}
}, i.Lg = function(u) {
var v = i.Do, R = i.Jm;
v.stat.isLive && v.stat.liveShiftType !== h.g.KWAI || u == null || !u.duration || !R || R.updateDuration(u.duration), i.Ci.i(lt, "audio track update", u);
}, i.Ng = function(u) {
var v = i.Do, R = i.Jm;
(!v.stat.isLive && (u == null ? void 0 : u.live) === !1 || v.stat.liveShiftType === h.g.KWAI) && u != null && u.duration && R && R.updateDuration(u.duration), i.Ci.i(lt, "level update", u);
}, i.Qg = function(u) {
if (i.Ci.i(lt, "seek event from trans", u, u.sec === i.Do.currentTime), u.sec !== i.Do.currentTime) {
i.eg = !0;
try {
i.internalSeek(u.sec);
} catch (v) {
}
}
}, i.kl = function(u) {
u.expired || (i.rg && i.rg.appendData(u), i.Do.loadRec.onRaw(u));
}, i.xg = function(u) {
i.Ci.i(lt, "video codec detected. dec:" + u.decoder + ", codec:" + u.codecType + ", bitDepth:" + u.bitDepth + " " + u.timeOffset);
var v, R, Q = i.Do;
u.decoder && (i.Do.stat.decoder = u.decoder), i.rg && u.decoder === h.d.buildin ? (i.rg.decoderChange(h.d.buildin, u.timeOffset || 0), Q.config.ensureVideo ? i.Vg() : (Q.config.ensureVideo = !0, (R = Q.cOutput) == null || R.updateRendererType(h.s.video), i.Ug(!i.rg.pausedOnWaiting))) : (u.decoder === h.d.buildin && ((v = Q.cOutput) == null || v.updateRendererType(h.s.video)), u.enabled && u.decoder === h.d.wasm && is ? (i.Fg(is, u.codecType, u.bitDepth), i.rg && i.rg.decoderChange(h.d.wasm, u.timeOffset || 0)) : u.enabled && u.decoder === h.d.none && Q.stat.box === h.i.yuv && Uc && i.Fg(Uc, u.codecType, u.bitDepth));
}, i.Pg = function(u) {
i.og.update();
}, i.Hg = function() {
i.Ci.i(lt, "wasm video ready"), i.Do.live ? i.Yg() : i.Jm && i.Jm.setAppendEnabled(!0);
}, i.Gg = function(u) {
if (i.Ci.i(lt, "h265 step frame", u), u.type) {
var v = u.time / 1e3;
u.type === h.m.NEXT ? (v < 0 && (v = i.SA()), v !== i.eA.currentTime && (i.eg = !0, i.internalSeek(v))) : v >= 0 ? v !== i.eA.currentTime && (i.eg = !0, i.internalSeek(v)) : i.eA.currentTime = i.BA();
}
}, i.Kg = function(u) {
var v;
if (i.Ci.i(lt, "seek[" + u + "]: seek with load"), (!i.Do.stat.isLive || i.Do.isLiveShift) && i.Lm && i.Jm) {
i.ag.onSeeking();
var R = i.eA.currentTime;
if (!i.Lm.isSeekable() && R >= Ve.r)
return i.Ci.i(lt, "seek[" + u + "]: seek disabled, rollback: " + i.sg + " seekTime: " + R), void (R !== i.sg && i.internalSeek(i.sg));
i.rg && i.rg.seekWithLoad(), i.emit(w.a.SEEK_WITH_LOAD), i.Io = mt.SEEK, i.hA.length && (i.hA = i.hA.slice(i.hA.length - 1), i.hA[0].data.time = R), i.Jm.clean(), i.Jm.setAppendEnabled(!1), (v = i.rg) != null && v.isCanvasRenderer && (i.qm = !1), i.Lm.seek(R, $.a.msie || i.Do.config.alwaysSeekKeyframe, !1);
}
}, i.Zg = function(u) {
i.Ci.i(lt, "seek[" + u.id + "]: decoder seek event.", u), u.preventFollowUp || (i.Ci.i(lt, "wasm seek frame", u), u.hitCache ? i.Yg() : i.Kg(u.id));
}, i.Wg = function() {
i.Ci.i(lt, "h265 render buf empty. waiting."), i.Xg();
}, i.zg = function(u) {
i.Do.cOutput && (i.Do.cOutput.updateRendererType(u.type), u.type = i.Do.cOutput.rendererType, u.canvas = i.Do.cOutput.rendererType === h.s.canvas && i.Do.cOutput.canvas ? i.Do.cOutput.canvas : void 0);
}, i.Jg = function(u) {
if (i.rg) {
var v = i.Sa;
v && (v.width = u.width, v.height = u.height, v.codedWidth = u.codedWidth, v.codedHeight = u.codedHeight, v.sar = u.sar, v.profile = u.profile, v.level = u.level, v.chromaFormat = u.chromaFormat, v.bitDepth = u.bitDepth, u.colorInfo && (v.colorInfo = u.colorInfo, v.colorSpace = Object(ei.e)(u.colorInfo)), i.rg.setMediaInfo(s()({}, v)), i.emit(w.a.MEDIA_INFO, i.Sa));
}
}, i.Sm = function(u) {
var v;
if (i.Do.stat.avSeparated) {
if (Object.prototype.hasOwnProperty.call(u.tracks, "video") && (i._g.main = u.tracks.video), Object.prototype.hasOwnProperty.call(u.tracks, "audio") && (i._g.audio = u.tracks.audio), !i._g.main && i.Do.config.videoEnabled !== !1 && i.Do.stat.decoder === h.d.buildin || !i._g.audio && i.Do.config.audioEnabled !== !1)
return void i.Ci.i(lt, "av separated. init segment not ready. wating next");
i.Ci.i(lt, "av separated. init segment ready."), u.tracks.video = i._g.main, u.tracks.audio = i._g.audio;
}
i.Cg = !0;
var R = i.Jm, Q = i.Do, se = i.Do.lctx.current;
if (se && u.tracks && u.tracks.video && !se.codec && (se.codec = u.tracks.video.codec), i.hA.length) {
var fe = i.hA.filter(function(Qe) {
return !Qe.switched;
})[0];
fe && (fe.switched = !0, i.emit(w.a.LEVEL_SWITCHED, s()({}, fe.data)));
}
i.oA && (i.emit(w.a.AUDIO_TRACK_SWITCHED, i.oA), i.oA = void 0);
var ke = u.tracks.rawVideo || u.tracks.video, Fe = u.tracks.audio, Ne = {};
if (Fe) {
var He = Fe.metadata;
Ne.hasAudio = !0, Ne.channel = He.channel, Ne.audioBitrate = He.audioBitrate, Ne.audioSampleRate = He.audioSampleRate, Ne.audioCodec = Fe.codec, Ne.audioCodecType = Fe.codecType;
}
if (ke) {
var rt = ke.metadata;
Ne.hasVideo = ke.active !== !1, rt && !rt.isFillVideo && (Ne.width = rt.width, Ne.height = rt.height, Ne.rotation = rt.rotation, Ne.fps = rt.fps, Ne.profile = rt.profile, Ne.level = rt.level, Ne.chromaFormat = rt.chromaFormat, Ne.bitDepth = rt.bitDepth, Ne.videoBitrate = rt.videoBitrate, rt.colorInfo && (Ne.colorSpace = Object(ei.e)(rt.colorInfo)), Ne.videoCodec = ke.codec, Ne.videoCodecType = ke.codecType), s()(Ne, ke.metadata);
}
Q.stat.codecType = Ne.videoCodecType = (ke == null ? void 0 : ke.codecType) || h.c.unknown, i.Do.stat.audioCodec = ((v = i.Do.lctx.current) == null ? void 0 : v.audioCodec) || "", Q.lctx.current && (!Q.lctx.current.bitrate && Ne.videoBitrate && Ne.audioBitrate && (Q.lctx.current.bitrate = Ne.videoBitrate + Ne.audioBitrate), !Q.lctx.current.maxBitrate && ke != null && ke.metadata && ke.metadata.videoMaxBitrate && Fe != null && Fe.metadata.audioMaxBitrate && (Q.lctx.current.maxBitrate = ke.metadata.videoMaxBitrate + Fe.metadata.audioMaxBitrate)), Ne.videoDecoder = Q.stat.decoder, i.rg && i.rg.setMediaInfo(s()({}, Ne)), Ne.videoCodecType !== h.c.kvc30 && i.emit(w.a.MEDIA_INFO, Ne), i.Sa = Ne, i.Ci.i(lt, "mediainfo", Ne), R && R.trackInfo(u), i.qg();
}, i.$g = function(u) {
if (!u.expired) {
if (i.Cg) {
if (i.Ig.length)
for (; i.Ig.length; ) {
var v = i.Ig.shift();
v && i.ty(v);
}
} else
i.Ig.push(u);
i.ty(u), i.Yg();
}
}, i.Mm = function(u) {
!i.Do.stat.isLive && u.videoFramesInfo && (i.pg = new Mc(u.videoFramesInfo)), typeof u.duration == "number" && i.Jm && (delete u.keyframes, i.Lm && !i.Do.stat.multipart && i.Jm.updateDuration(u.duration));
}, i.iy = function(u) {
!i.Do.stat.isLive && u.videoFramesInfo && (i.pg ? i.pg.update(u.videoFramesInfo) : i.pg = new Mc(u.videoFramesInfo));
}, i.Sc = function(u) {
i.Do.stat.isLive = !1, i.fl++, i.fl < 2 && i.Do.stat.avSeparated ? u.preventFollowUp = !0 : (i.Jm && i.Jm.endOfData(), i.rg && i.rg.endOfData());
}, i.ey = function(u) {
i.Lm && i.Lm.setSubtitleTrack(u.level);
}, i.ny = function(u) {
i.Do.config.logger && Object(Pt.a)(i.Do.config.logger, u);
}, i.Ci.i(lt, "constructor"), i.og = new $t(i.Do), i.ag = new u_(i.Do), i.bg = !!i.Do.config.catchUpPausedLive, Dn && (i.hg = new Dn(i.Do), i.O.push(i.hg)), t.video && $.a.x5 && $.a.android && (i.$m = new h_(i.eA)), i.wg(), i.Yb();
var c = i.Ug.bind(i);
return i.dg = new xt(t).setRetryFunc(c), i.O.push(i.Do.evt.on(w.a.WORKER_LOG, i.ny)), i;
}
y()(_, A);
var a = _.prototype;
return a.load = function(t) {
this.Ci.i(lt, "call load: " + t), this.sy(), this.hy(), this.TA(), this.fg = void 0, this.vg = void 0, this.RA(t);
}, a.stopLoad = function() {
this.Ci.i(lt, "call stopLoad"), this.kA(), this.oy(), this.vg && (this.vg.enabled = !1), this.rg && this.uy(), this.Lm && (this.Ay(), this.emit(w.a.STOP_LOAD));
}, a.destroy = function() {
var t;
this.Do.logger.i(lt, "call destroy"), this.$m = void 0, this.kA(), this.oy(), this.Lm && this.emit(w.a.STOP_LOAD), this.vy(), (t = this.Ob) == null || t.destroy(), this.ug && (this.eA.play = this.ug.play, this.eA.pause = this.ug.pause), this.pg = void 0, mi(), this.sy(), A.prototype.destroy.call(this);
}, a.hy = function() {
var t = this.Do, i = this.Ug.bind(this);
this.Ag.push(t.fallback.register(le.FLV_LIVE_RELOAD, this.dg), t.fallback.register(le.USE_BACKUP, new ni(t).setRetryFunc(i)), t.fallback.register(le.NO_WORKER, new Ct(t).setRetryFunc(i)), t.fallback.register(le.DROP_V_FRAME, new vi(t).setRetryFunc(i)), t.fallback.register(le.SWAP_REMUX_TYPE, new Dt(t).setRetryFunc(i)), t.fallback.register(le.SWAP_AUDIO_CODECSTR, new Di(t).setRetryFunc(i))), yt && this.Ag.push(t.fallback.register(le.SWAP_WASM_DECODER, new yt(t).setRetryFunc(i)));
}, a.sy = function() {
this.Ag.forEach(function(t) {
return t.destroy();
}), this.Ag = [];
}, a.resume = function() {
var t, i = this;
this.Ci.i(lt, "call resume"), this.Do.live && this.lg || (this.Lm || this.RA(h.h.internal), this.eA.paused && ((t = this.eA.play()) == null || t.catch(function(c) {
return i.Ci.i(lt, "resume, call play() fail.", c);
})));
}, a.refresh = function() {
if (this.Ci.i(lt, "call refresh. live: " + this.Do.live), this.Do.live) {
if (this.lg)
return;
this.dg.reset();
} else
this.Do.stat.startFromSec = this.eA.currentTime;
var t = this.Do.lctx.currentIdx, i = this.Do.lctx.audioIdx, c = this.Do.lctx.subtitleIdx, u = this.Do.lctx.abr;
this.Do.lctx.currentIdx = t, this.Do.lctx.audioIdx = i, this.Do.lctx.subtitleIdx = c, this.Do.lctx.abr = u, this.Ug(), this.nA = void 0;
}, a.onAbrLevelsUpdated = function() {
var t;
(t = this.Lm) == null || t.onAbrLevelsUpdated();
}, a.setCurrentLevel = function(t) {
var i;
this.Ci.i(lt, "set currentLevel", t);
var c = this.Do;
return c.lctx.verifyLevelIdx(t) && this.nA ? (this.Ci.i(lt, "set currentLevel on error. refresh"), c.lctx.currentIdx = t, void this.refresh()) : !this.ly(t, h.o.VIDEO) || t === c.lctx.currentIdx && !c.lctx.abr || this.nA ? (this.Ci.i(lt, "set currentLevel fail.", !this.ly(t, h.o.VIDEO), t, c.lctx.currentIdx, !c.lctx.abr, this.nA), void this.emit(w.a.LEVEL_SWITCH_FAILED)) : t < 0 ? (this.Ci.i(lt, "set currentLevel to auto."), void this.setNextLevel(-1)) : c.isSwitchLevelByReload ? (c.lctx.currentIdx = t, this.fg = t, void (this.eA.ended ? (this.Ci.i(lt, "set currentLevel on manifest parsed. reset trans"), this.Ay(), this.by(), this.uy()) : (this.Ci.i(lt, "set currentLevel on manifest parsed. reload"), this.Ug()))) : (this.Io !== mt.INIT && this.Io !== mt.LOADING && (this.Io = mt.SELECT_BITRATE, this.qm = !0), this.Jm && (this.Jm.clean(), c.streamingMux = !0), t >= 0 && t !== c.lctx.currentIdx && this.Dg(), (i = this.Lm) == null || i.setCurrentLevel(t), void (this.rg && this.rg.clean()));
}, a.setNextLevel = function(t) {
var i;
this.Ci.i(lt, "set nextLevel", t);
var c = this.Do;
return c.lctx.verifyLevelIdx(t) && this.nA ? (c.lctx.currentIdx = t, void this.refresh()) : !this.ly(t, h.o.VIDEO) || this.nA ? (this.Ci.i(lt, "set nextLevel failed.", t), void this.emit(w.a.LEVEL_SWITCH_FAILED)) : void (c.bufferedSec < this.ng && t >= 0 || t >= 0 && c.isSwitchLevelByReload || c.isLiveShift ? this.setCurrentLevel(t) : (t >= 0 && t !== c.lctx.nextIdx && this.Dg(), (i = this.Lm) == null || i.setNextLevel(t)));
}, a.setAudioTrack = function(t) {
this.Ci.i(lt, "set audioTrack", t);
var i = this.Do;
if (!this.ly(t, h.o.AUDIO) || t === i.lctx.audioIdx || this.nA)
return this.Ci.i(lt, "set audioTrack fail.", !this.ly(t, h.o.AUDIO), t, i.lctx.audioIdx, this.nA), void this.emit(w.a.AUDIO_TRACK_SWITCH_FAILED);
this.Lm && t !== i.lctx.audioIdx && i.lctx.audioTracks.length > 1 && (this.Dg(), this.Lm.setAudioTrack(t), this.Io !== mt.INIT && this.Io !== mt.LOADING && (this.Io = mt.SELECT_BITRATE, this.qm = !0), this.Jm && (this.Jm.clean(), i.streamingMux = !0));
}, a.setSubtitleTrack = function(t) {
this.Lm && t !== this.Do.lctx.subtitleIdx && this.Do.lctx.subtitleTracks.length >= 1 && this.Ob && this.Ob.select(t);
}, a.liveEnd = function() {
this.Ci.i(lt, "liveEnd", this.Do.stat.isLive), this.Do.stat.isLive && (this.Do.stat.isLive = !1, this.lg = !0, this.Do.fallback.stop());
}, a.getTotalVideoFrames = function() {
return this.pg ? this.pg.totalVideoFrames : -1;
}, a.getCurrentVideoFrame = function() {
return this.pg ? this.pg.timeToIndex(this.eA.currentTime) : -1;
}, a.seekToNextFrame = function() {
if (!(this.getCurrentVideoFrame() >= this.getTotalVideoFrames() - 1))
if (this.rg)
this.rg.step(h.m.NEXT);
else if (this.pg) {
var t = this.pg.getNextFramePTSByTime(this.eA.currentTime);
t >= 0 && (this.eA.currentTime = t + 1e-3);
} else {
var i = this.SA();
i > 0 && (this.eA.currentTime = i);
}
}, a.seekToPrevFrame = function() {
if (this.getCurrentVideoFrame() !== 0)
if (this.rg)
this.rg.step(h.m.PREV);
else if (this.pg) {
var t = this.pg.getPrevFramePTSByTime(this.eA.currentTime);
t >= 0 && (this.eA.currentTime = t + 1e-3);
} else {
var i = this.BA();
i >= 0 && (this.eA.currentTime = i);
}
}, a.setCurretVideoFrame = function(t) {
this.pg && this.pg.isIndexInRange(t) ? this.pg.indexToTime(t) >= 0 ? this.eA.currentTime = this.pg.indexToTime(t) + 1e-3 : this.emit(w.a.ERROR, Object(L.e)(L.b.MEDIA_ERROR, L.a.CANNOT_SEEK_BY_FRAME_INDEX, t + " out of range: [0, " + this.getTotalVideoFrames() + "]", { fatal: !1 })) : this.emit(w.a.ERROR, Object(L.e)(L.b.MEDIA_ERROR, L.a.CANNOT_SEEK_BY_FRAME_INDEX, "unsupported", { fatal: !1 }));
}, a.getTrackBufInfo = function() {
var t;
return (t = this.Jm) == null ? void 0 : t.trackBufInfo;
}, a.screenshot = function(t) {
this.rg && this.rg.isCanvasRenderer ? this.rg.screenshot(t) : A.prototype.screenshot.call(this, t);
}, a.cA = function() {
this.eA instanceof HTMLVideoElement && !this.eA.videoWidth && this.Do.stat.codecType !== h.c.h264 && this.Do.stat.decoder === h.d.buildin && (this.Do.canCodecFallback || this.Do.hasNextMediaDesc()) ? (this.Ci.i(lt, "metadata video size: " + this.eA.videoWidth + ". fallback 264"), this.emit(w.a.ERROR, Object(L.e)(L.b.MEDIA_ERROR, L.a.VIDEO_NO_SIZE, "buildin " + this.Do.stat.codecType + " dec no width."))) : A.prototype.cA.call(this);
}, a.pA = function() {
A.prototype.pA.call(this), this.Do.config.catchUpPausedLive && !this.Do.stat.liveShiftActive && (this.bg = !0);
}, a.bA = function() {
if (!this.nA && this.Do.live) {
var t = this.Do.getLiveDelay();
if (this.Ci.i(lt, "on video playing. live: " + this.Do.live + " delay: " + t), t > 0 && this.Do.bufferedSec > t / 1e3 + 1 && this.bg) {
var i = this.Do.bufferedEnd - t / 1e3;
this.Do.isTimeinBuffered(i) && this.internalSeek(i);
}
this.bg = !1;
}
A.prototype.bA.call(this), this.gg = NaN;
}, a.mA = function() {
this.nA || this.Lm || this.load(), this.rg && (this.rg.start(), this.rg.waiting && this.rg.isCanvasRenderer && (this.rg.pausedOnWaiting = !1, this.py())), A.prototype.mA.call(this);
}, a.yA = function() {
this.sg = 0, this.eg = !1, A.prototype.yA.call(this);
}, a.wg = function() {
var t, i;
(this.Jm && (this.Jm.hasTrackInfo() || this.eA.error) || (t = this.hg) != null && t.isActive) && (this.Ci.i(lt, "rebuild mse"), URL.revokeObjectURL(this.eA.src), this.by(), (i = this.hg) != null && i.isActive && (this.Ci.i(lt, "eme reset src"), this.eA.src = "", this.hg.reset())), this.Jm ? this.Jm.clean() : (this.Jm = new Ei(this.Do.config, this.Do.stat, this.Ci, this.Do.evt), this.Jm.attach(this.eA), this.Do.mse = this.Jm, this.Jm && this.Do.isLiveShiftKwai2 && this.Jm.updateDuration(this.Do.getLiveShiftKwai2Duration()));
}, a.ly = function(t, i) {
var c = !0;
return i === h.o.VIDEO ? c = this.Do.lctx.verifyLevelIdx(t) : i === h.o.AUDIO && (c = this.Do.lctx.verifyAudioTrackIdx(t)), !!(this.Lm && this.Jm && c);
}, a.jg = function() {
if (this.qm && this.Jm && !this.Jm.hasCleanUpTask()) {
var t = 1e-3;
this.Do.isTimeinBuffered(this.eA.currentTime + t) && (this.Ci.i(lt, "seek on canplay " + this.eA.currentTime + " + " + t), this.qm = !1, this.internalSeek(this.eA.currentTime + t));
}
}, a.my = function() {
(this.Lm = new l_(this.Do)).init(), this.$m && this.$m.reset();
}, a.Yb = function() {
var t = this.Do.evt;
this.O.push(t.prependListener(w.a.PARSING_DATA, this.$g), t.prependListener(w.a.PARSING_INIT_SEGMENT, this.Sm), t.prependListener(w.a.LOAD_END, this.Sc), t.prependListener(w.a.SUBTITLE_LOADED, this.Mg), t.prependListener(w.a.AUDIO_TRACK_SWITCHING, this.Sg), t.prependListener(w.a.LEVEL_SWITCHING, this.Bg), t.prependListener(w.a.BUFFER_CLEANING, this.Mb), t.prependListener(w.a.METADATA, this.Mm), t.prependListener(w.a.VIDEO_FRAME_INFO, this.iy), t.prependListener(w.a.MANIFEST_PARSED, this.Tg), t.prependListener(w.a.AUDIO_TRACK_UPDATED, this.Lg), t.prependListener(w.a.LEVEL_UPDATED, this.Ng), t.prependListener(w.a.VIDEO_SEEK, this.Qg), t.prependListener(w.a.RAW_DATA, this.kl), t.prependListener(w.a.VIDEO_CODEC_DETECTED, this.xg), t.prependListener(w.a.LOADER_CHUNK_ARRIVAL, this.Pg), t.prependListener(w.a.MSE_BUFFER_FULL, this.Og), t.prependListener(w.a.MSE_UPDATE, this.Eg), t.prependListener(w.a.MSE_SOURCE_CLOSE, this.kg), t.prependListener(w.a.DEC_VIDEO_READY, this.Hg), t.prependListener(w.a.STEP, this.Gg), t.prependListener(w.a.DECODER_SEEK, this.Zg), t.prependListener(w.a.DECODER_WAITING, this.Wg), t.prependListener(w.a.VIDEO_RENDERER_CHANGE, this.zg), t.prependListener(w.a.DECODER_MEDIA_INFO, this.Jg), t.prependListener(w.a.SUBTITLE_TRACK_SWITCHED, this.ey));
}, a.Fg = function(t, i, c) {
c === void 0 && (c = 8), this.Ci.i(lt, "init canvas renderer");
var u = this.Jm, v = this.Do;
if (!this.rg) {
var R, Q, se;
u && u.setAppendEnabled(!1), v.stat.mainThreadRendering = v.config.mainThreadRendering, (R = v.cOutput) == null || R.updateRendererType(h.s.canvas);
var fe = this.rg = new t(v);
this.gy(), fe.init(i, c), (Q = this.Jm) != null && Q.ended() && fe.endOfData(), this.emit(w.a.VIDEO_RENDERER_CHANGE, { enabled: !0, canvas: (se = v.cOutput) == null ? void 0 : se.canvas, type: h.s.canvas });
}
}, a.Yg = function() {
var t = this.Do;
if (this.Lm && this.Jm)
if (t.stat.multipart || t.stat.isLive || this.Io !== mt.WAITING) {
var i = t.bufferedSec, c = this.Jm.getBufferQueueSec(), u = !0;
if ((i < t.stat.lazyLoadRecoverDuration || t.live && !this.Jm.getAppendEnabled()) && this.Jm.setAppendEnabled(!this.rg || !this.rg.isCanvasRenderer || !this.rg.waiting), t.stat.lazyLoadMaxDuration > 0 && i + c >= (this.Jm.readyState === "closed" ? 1 : t.stat.lazyLoadMaxDuration))
u = !1;
else {
if (!(i + c < t.stat.lazyLoadRecoverDuration))
return void this.og.checkStreamingMux();
this.og.checkStreamingMux(), u = !0;
}
t.isDownloadInterruptible && this.Lm && (this.Ci.v(lt, "download: " + u + " buffered:" + i + " mse:" + c), !u && this.rg && this.rg.decBufLow && (this.Ci.i(lt, "dec data empty, download enable."), u = !0), this.Lm.setDownloadEnabled(u)), this.Jm.pendingNum() && this.Jm.refresh();
} else
this.Lm.setDownloadEnabled(!0);
}, a.vA = function() {
var t, i, c = this, u = this.Do.stat.seekingId++;
if (this.Ci.i(lt, "seek[" + u + "]: to " + this.eA.currentTime + " internal:" + this.uA), this.Do.config.forceRenderOnSeekEnd && ((t = this.rg) == null || !t.isCanvasRenderer) && this.eA.currentTime >= this.eA.duration)
this.Ci.i(lt, "seek[" + u + "]: to end, force render. paused: " + this.eA.paused), this.eA.currentTime = this.eA.duration - 1e-3, this.eA.paused && ((i = this.eA.play()) == null || i.catch(function(Q) {
return c.Ci.i(lt, "resume, call play() fail.", Q);
}));
else if (this.Sa && !(this.eA && this.eA.currentTime >= this.eA.duration && this.Jm && this.Jm.ended())) {
this.Do.streamingMux = !0;
var v = this.uA;
if (this.uA = !1, this.eg)
this.eg = !1;
else {
this.emit(w.a.SEEKING, { internal: v });
var R = this.eA.currentTime;
if (this.Do.isLiveShift && R > this.eA.duration - this.Do.config.liveShiftDelaySec && !v)
return this.internalSeek(this.eA.duration - this.Do.config.liveShiftDelaySec), void this.Ci.i(lt, "liveshift kwai2 seek out of range");
if (this.Do.isLiveShift && this.Do.liveTime && this.Do.updateLiveShiftStatuByTime(R), this.rg && this.rg.isCanvasRenderer) {
if (v)
return;
this.rg.seek(R, u);
} else
this.Do.isTimeinBuffered(R) ? v || ($.a.msedge && $.a.version.major < 88 || $.a.msie ? (this.qm = !0, this.Kg(u)) : this.Lm && be(this.Do.stat.box) && this.Lm.seek(R, !1, !0)) : R === 0 && this.eA.buffered.length > 0 && this.eA.buffered.start(0) < 1 ? v || this.internalSeek(this.eA.buffered.start(0)) : this.Kg(u);
}
}
}, a.Xg = function() {
!this.eA.ended && this.rg && this.rg.isCanvasRenderer && (this.eA.paused || this.py(), function(t, i, c) {
if (t && t.dispatchEvent && window.CustomEvent) {
var u = new CustomEvent(i, c);
t.dispatchEvent(u);
}
}(this.eA, "waiting"));
}, a.Vg = function() {
var t, i = this;
this.rg && this.rg.pausedOnWaiting === !1 && !this.eA.ended && ((t = this.eA.play()) == null || t.catch(function(c) {
return i.Ci.i(lt, "custom waiting ended, call play() fail.", c);
}));
}, a.Ay = function() {
this.Lm && (this.Lm.destroy(), this.Lm = void 0);
}, a.by = function() {
this.Ci.i(lt, "destroy mse"), this.Do.mse = void 0, this.Jm && (this.Jm.destroy(), this.Jm = void 0);
}, a.uy = function() {
this.rg && (this.rg.destroy(), this.rg = void 0);
}, a.Ug = function(t) {
var i, c, u = this;
t === void 0 && (t = !0), this.Ci.i(lt, "reload. play: " + t), (i = this.Do.cOutput) == null || i.reset(), this.Do.live && !this.Do.isLiveShiftKwai2 || (this.Do.stat.startFromSec = this.eA.currentTime), this.Do.isLiveShiftKwai2 && (this.Do.stat.liveShiftKwai2Params.paramName = "offset", this.Do.stat.liveShiftKwai2Params.time = this.eA.currentTime), this.fg = this.Do.lctx.abr ? -1 : this.Do.lctx.currentIdx, this.hA = [], this.oA = void 0, this.uA = !1, this.vy(), this.RA(h.h.retry), t ? (c = this.eA.play()) == null || c.catch(function(v) {
return u.Ci.i(lt, "reload. call play() fail.", v);
}) : this.eA.pause();
}, a.qg = function() {
this.ig || (this.ig = setInterval(this.yy.bind(this), 100));
}, a.oy = function() {
this.ig && (clearInterval(this.ig), this.ig = void 0);
}, a.vy = function() {
this.Ci.i(lt, "stop video"), this.eA && (this.Ay(), this.uy(), this.by(), URL.revokeObjectURL(this.eA.src), this.eA.src && (this.eA.src = ""));
}, a.yy = function() {
var t = this.Do;
t.stat.isLive ? (this.vg || $.a.safari || $.a.ios || !t.stat.autoPlaybackRateConf || (this.Ci.i(lt, "autoPlayback rate on."), this.vg = new qi(t)), this.vg && (this.vg.enabled = !t.stat.liveShiftActive, this.vg.tick())) : this.vg && (this.vg.enabled = !1);
var i = this.eA;
this.$m && t.stat.firstFrameLoaded && this.$m.check();
var c = i.buffered.length > 1, u = this.Io === mt.WAITING || this.Io === mt.LOADING || this.Io === mt.INIT || this.Io === mt.SEEK || this.Io === mt.SELECT_BITRATE, v = u && !i.seeking, R = i.currentTime, Q = this.ag.tick(u);
if (Q) {
if (Q === "fix") {
var se, fe = i.buffered.start(0);
i.buffered.length && fe > R && (this.Ci.i(lt, "play stuck. current time: " + R + " not in buffer range. " + fe), this.internalSeek(fe + 0.1)), this.Ci.i(lt, "play stuck. restart download."), (se = this.Lm) == null || se.setDownloadEnabled(!0);
}
} else {
if (v || (this.yg = 0), (c || v) && !this.rg && !i.ended && this.Jm && !this.Jm.hasCleanUpTask() && this.Jm.hasSourceBufferAppendStarted()) {
var ke = t.currentBuffer(R), Fe = t.nextBuffer(R);
v ? !ke || ke.end - R < 1 ? (Fe && this.Ci.i(lt, "play stuck " + R + ". buffered num: " + t.bufferSliceNum + " jump to next buf"), this._y(Fe)) : this.eA.buffered.length > 1 && ke.end - R > 1 ? (ke && this.Ci.i(lt, "play stuck " + R + ". multi buf. current time+"), this._y(ke)) : ke.end - R > 1 && (this.yg > 2 ? (this.Ci.i(lt, "play stuck " + R + ". current time +, " + i.seeking), this.internalSeek(R + 0.5), this.yg = 0) : this.yg++) : c && ke && ke.end - R <= 0.1 && (Fe && this.Ci.i(lt, "try jump next C"), this._y(Fe));
}
this.hA.length && this.Cy();
}
}, a._y = function(t) {
if (t) {
var i = t.start + ($.a.safari ? 0.3 : 1e-3);
i > t.end && (i = t.start), this.gg === i && (i += 0.1), this.gg = i, this.internalSeek(i), this.Ci.i(lt, "jump to " + i);
}
}, a.Cy = function() {
var t = this.hA[0];
t && this.eA.currentTime >= t.data.time && this.Do.isTimeinBuffered(this.eA.currentTime) && (t.switched || this.emit(w.a.LEVEL_SWITCHED, s()({}, t.data)), this.emit(w.a.LEVEL_SWITCH_PLAYING, t.data), this.hA.shift());
}, a.RA = function(t) {
if (this.Ci.i(lt, "_load start sec:", this.Do.stat.startFromSec), !$.a.mobile && !ht.isMSECodecCapabilityNormal()) {
var i = "MSE is not fully functional. h264: " + ht.TYPE_SUPPORTED.h264 + "; aac: " + ht.TYPE_SUPPORTED.aac;
return this.Ci.i(lt, i), void this.emit(w.a.ERROR, Object(L.e)(L.b.MSE_ERROR, L.a.MSE_CAPABILITY_ERROR, i));
}
this.Do.stat.srcType !== h.l.KWAI && this.Do.stat.srcType !== h.l.KWAI_FLV_ABR || this.Do.lctx.levels.length ? (A.prototype.RA.call(this, t), this.Sa = void 0, this.nA = void 0, this.Io = mt.LOADING, this.hA = [], this.oy(), this.pg = void 0, this.gg = NaN, this.Do.fallback.stop(), this.Do.stat.isLive && (this.Ci.i(lt, "live stream clear frag"), this.Do.lctx.clearFrag()), this.Ob && this.Ob.reset(), this.Ay(), this.uy(), this.wg(), this.Do.config.startPlayBufferSec && !t && this.Jm && this.Jm.setStartBufSec(this.Do.config.startPlayBufferSec), this.TA(), this.my(), this.emit(w.a.LOAD, { type: t }), this.Lm && (this.Do.initLiveShiftKwai2StartSec(), this.Lm.loadSource()), this.Do.stat.isLive && (this.lg = !1, this.Do.config.autoPlaybackRate && this.vg && (this.vg.enabled = !0))) : this.emit(w.a.ERROR, Object(L.e)(L.b.OTHER_ERROR, L.a.SRC_EMPTY, "level cnt 0"));
}, a.ty = function(t) {
var i;
this.Do.mse && this.Do.mse.mediaSegment(t.segments), (i = this.Do.liveTime) == null || i.onParsing(t), this.Do.loadRec.onParsing(t), this.rg && this.rg.onParsingData(t);
}, a.Dg = function() {
this._g.audio = this._g.main = void 0, this.Cg = !this.Do.stat.avSeparated, this.fl = 0, this.Ig = [], this.Ci.i(lt, "reset initSegment ready: " + this.Cg);
}, a.AA = function() {
A.prototype.AA.call(this), this.Io !== mt.NONE && (this.Io = mt.NONE, this.jg(), this.Cy(), this.eA.paused || this.bA());
}, a.IA = function() {
this.eA.seeking || (this.sg = this.eA.currentTime), A.prototype.IA.call(this), ki() && performance.now() - this.mg > Ve.i && (this.Yg(), this.mg = performance.now());
}, a.dA = function() {
this.Sa && A.prototype.dA.call(this), this.Ci.i(lt, "seeked. " + this.Do.currentTime + "/" + this.Do.streamTime.getStreamTime(this.Do.currentTime));
}, a.lA = function() {
if (this.Ci.i(lt, "video waiting " + this.Do.currentTime), this.lg && this.Do.stat.box === h.i.flv && this.Do.stat.isLive)
this.stopLoad();
else {
this.Io = this.Io || mt.WAITING;
var t = this.Do.bufferedSec, i = !this.eA.ended && !this.eA.seeking && this.Io === mt.WAITING;
this.emit(w.a.WAITING, { block: i, bufferedSec: t });
}
}, a.gA = function(t) {
var i, c, u;
if (this.Ci.i(lt, "video error@" + this.Do.currentTime + " " + ((i = this.eA.error) == null ? void 0 : i.message)), !this.nA && this.Sa) {
var v = ((c = this.eA.error) == null ? void 0 : c.code) || 0, R = ((u = this.eA.error) == null ? void 0 : u.message) || "video error", Q = Object(L.d)(L.c[v] || L.a.VIDEO_ERROR, R);
this.emit(w.a.ERROR, Object(L.e)(L.b.MEDIA_ERROR, Q, R));
}
}, a.DA = function() {
var t;
A.prototype.DA.call(this), this.Lm && this.Lm.heartbeat(), this.Do.isLiveShift && this.Do.updateLiveShiftStatuByTime(), (t = this.rg) == null || t.heartbeat(), this.Jm && this.Do.isLiveShiftKwai2 && this.Jm.updateDuration(this.Do.getLiveShiftKwai2Duration()), this.Yg();
}, a.Rg = function() {
this.Lm && (!this.Ob && V && (this.Ob = new V(this.Do)), this.Ob && this.Ob.addTracks(this.Do.lctx.subtitleTracks));
}, a.py = function() {
this.cg = !0, this.eA.pause();
}, a.gy = function() {
var t = this;
!this.ug && this.rg && (this.ug = { play: this.eA.play, pause: this.eA.pause }, this.eA.pause = function() {
t.ug.pause.call(t.eA), t.rg && t.rg.waiting && t.rg.isCanvasRenderer && !t.cg && (t.rg.pausedOnWaiting = !0), t.cg = !1;
}, this.eA.play = function() {
return t.rg && t.rg.waiting && t.rg.isCanvasRenderer ? (t.rg.pausedOnWaiting = !1, Promise.resolve()) : t.ug.play.call(t.eA);
});
}, g()(_, [{ key: "type", get: function() {
return h.a.mse;
} }]);
}(Qr), d_ = { av1: ['video/mp4; codecs="av01.0.08M.08,mp4a.40.2"'], hevc: ['video/mp4; codecs="hev1.1.6.L120.90,mp4a.40.2"', 'video/mp4; codecs="hvc1.1.6.L120.90,mp4a.40.2"'], h264: ['video/mp4; codecs="avc1.4D4028,mp4a.40.2"'], opus: ['video/mp4; codecs="opus"'], mp3: ['video/mp4; codecs="mp3"'], aac: ['video/mp4; codecs="mp4a.40.2"'] }, f_ = { av1: ['video/mp4; codecs="av01.0.08M.10"'], hevc: ['video/mp4; codecs="hev1.2.2.L120.90"', 'video/mp4; codecs="hvc1.2.2.L120.90"'], h264: ['video/mp4; codecs="avc1.6e0028"'] }, p_ = { av1: ['video/mp4; codecs="av01.0.12M.08"'], hevc: ['video/mp4; codecs="hev1.1.6.L150.90"', 'video/mp4; codecs="hvc1.1.6.L150.90"'], h264: ['video/mp4; codecs="avc1.4D4033"'] }, __ = { av1: ['video/mp4; codecs="av01.0.12M.10"'], hevc: ['video/mp4; codecs="hev1.2.2.L150.90"', 'video/mp4; codecs="hvc1.2.2.L150.90"'], h264: ['video/mp4; codecs="avc1.6e0028"'] }, A_ = { mp4: ["video/mp4", "video/quicktime"], flv: ["video/x-flv"], ts: ["video/mp2t"], matroska: ["video/x-matroska", "video/webm"], hls: ["application/vnd.apple.mpegURL", "application/x-mpegURL"], hls_ts: ["application/vnd.apple.mpegURL", "application/x-mpegURL"], hls_fmp4: ["application/vnd.apple.mpegURL", "application/x-mpegURL"], aac: ["audio/aac"], mp3: ["audio/mpeg", "audio/mp3"] }, un = function() {
function A() {
}
return A.isMSEAvailable = function() {
if (A.Iy !== void 0)
return A.Iy;
if (!Js)
return A.Iy = !1, !1;
var _ = Kt(), a = Xt();
if (A.Oy = !!(_ && a && a.prototype && typeof a.prototype.appendBuffer == "function" && typeof a.prototype.remove == "function"), _ && $.a.mobile && A.Oy)
try {
var t = new _(), i = document.createElement("video");
i.src = URL.createObjectURL(t), URL.revokeObjectURL(i.src), A.Iy = !0;
} catch (c) {
A.Iy = !1;
}
else
A.Iy = A.Oy;
return A.Iy;
}, A.isMSECodecCapabilityNormal = function() {
return A.isMSEAvailable() && A.TYPE_SUPPORTED.h264;
}, A.isSupported = function(_) {
return _ === void 0 && (_ = h.c.h264), A.isMSECodecSupported(_) && A.isMSEAvailable();
}, A.isMSECodecSupported = function(_, a, t) {
if (_ === void 0 && (_ = h.c.h264), a === void 0 && (a = h.q.FHD), t === void 0 && (t = !1), $.a.msedge && $.a.platform === "windows" || $.a.msie)
return A.isMSEAvailable() && _ === h.c.h264;
if (A.wy(_, a) === !1)
return !1;
var i = A.Ey(_, a, t);
return !!i && i.reduce(function(c, u) {
return c || A.isMSECodecStrSupported(u);
}, !1);
}, A.isVideoCodecSupported = function(_, a, t) {
if (_ === void 0 && (_ = h.c.h264), a === void 0 && (a = h.q.FHD), t === void 0 && (t = !1), $.a.msedge && $.a.platform === "windows" || $.a.msie)
return _ === h.c.h264;
if (A.wy(_, a) === !1)
return !1;
var i = A.Ey(_, a, t);
if (!i)
return !1;
var c = A.jy();
return i.reduce(function(u, v) {
return u || !(!c || !c.canPlayType(v));
}, !0);
}, A.isVideoBoxSupported = function(_) {
if (_ === void 0 && (_ = h.i.mp4), _ === h.i.unknown)
return !0;
var a = A_[_];
if (!a)
return !1;
var t = A.jy();
return a.reduce(function(i, c) {
return i || !(!t || !t.canPlayType(c));
}, !1);
}, A.isVideoCodecStrSupportedInMp4 = function(_, a) {
a === void 0 && (a = "");
try {
var t = A.jy();
return !(!t || !t.canPlayType((a || "video") + '/mp4;codecs="' + _ + '"'));
} catch (i) {
}
return !1;
}, A.isWebRTCSupported = function() {
return "RTCPeerConnection" in window && "RTCRtpTransceiver" in window;
}, A.isMSECodecStrSupportedInMp4 = function(_, a) {
var t;
return a === void 0 && (a = ""), !((t = Kt()) == null || !t.isTypeSupported((a || "video") + '/mp4;codecs="' + _ + '"'));
}, A.isMSECodecStrSupported = function(_) {
var a = Kt();
return !(!a || typeof a.isTypeSupported != "function" || !a.isTypeSupported(_));
}, A.isChangeTypeSupported = function() {
if (A.Cv === void 0) {
var _ = Xt();
A.Cv = !(!_ || _.prototype.changeType === void 0);
}
return A.Cv;
}, A.getVideoCodecCompatibilityByCodec = function(_, a, t) {
a === void 0 && (a = h.q.FHD), t === void 0 && (t = !1);
var i = h.d.unsupported, c = !0;
_ === h.c.h264 ? i = a === h.q.UHD_4K ? (t ? A.TYPE_SUPPORTED.h264Hdr4k : A.TYPE_SUPPORTED.h2644k) ? h.d.buildin : h.d.unsupported : (t ? A.TYPE_SUPPORTED.h264Hdr : A.TYPE_SUPPORTED.h264) ? h.d.buildin : h.d.unsupported : _ === h.c.av1 ? (i = a === h.q.UHD_4K ? (t ? A.TYPE_SUPPORTED.av1Hdr4k : A.TYPE_SUPPORTED.av14k) ? h.d.buildin : h.d.unsupported : (t ? A.TYPE_SUPPORTED.av1Hdr : A.TYPE_SUPPORTED.av1) ? h.d.buildin : h.d.unsupported, c = de() >= 2) : _ === h.c.hevc ? (i = a === h.q.UHD_4K ? (t ? A.TYPE_SUPPORTED.hevcHdr4k : A.TYPE_SUPPORTED.hevc4k) ? h.d.buildin : h.d.unsupported : (t ? A.TYPE_SUPPORTED.hevcHdr : A.TYPE_SUPPORTED.hevc) ? h.d.buildin : h.d.unsupported) === h.d.buildin ? ($.a.msedge && $.a.platform === "windows" && (i = h.d.unsupported), c = !!(de() >= 2 || $.a.safari)) : c = A.wasmSmooth : _ !== h.c.kvc3 && _ !== h.c.kvc4 && _ !== h.c.kvc5 && _ !== h.c.kvc6 && _ !== h.c.vvc && _ !== h.c.kvc30 && _ !== h.c.bvc2 || (i = typeof WebAssembly < "u" ? h.d.wasm : h.d.unsupported, c = A.wasmSmooth);
var u = !1;
return i === h.d.buildin && (u = A.isChangeTypeSupported(), _ === h.c.hevc && A.wy(_, a) === !1 && (i = h.d.wasm)), { decoder: i, smooth: i !== h.d.unsupported && c, mix: u };
}, A.getPlayTestDefinition = function(_) {
if (typeof _.width == "number" && typeof _.height == "number") {
if ((_ == null ? void 0 : _.width) > 1920 || (_ == null ? void 0 : _.height) > 1920)
return h.q.UHD_4K;
} else if (_.qualityType.toLowerCase().indexOf("4k") !== -1)
return h.q.UHD_4K;
return h.q.FHD;
}, A.Ey = function(_, a, t) {
a === void 0 && (a = h.q.FHD), t === void 0 && (t = !1), _ === h.c.unknown && (_ = h.c.h264);
var i = t ? f_ : d_, c = t ? __ : p_;
return a === h.q.UHD_4K && c[_] || i[_];
}, A.wy = function(_, a) {
if (a === void 0 && (a = h.q.FHD), _ === h.c.hevc && A.playHEVCTest && (a === h.q.UHD_4K && A.playHEVCTest[a] === !1 || a !== h.q.UHD_4K && A.playHEVCTest[h.q.FHD] === !1))
return !1;
}, A.jy = function() {
return Zs || ge() || (Zs = document.createElement("video")), Zs;
}, A.ky = function() {
try {
return typeof WebAssembly < "u" && typeof MessageChannel < "u" && new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)), WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 4, 1, 3, 1, 1, 10, 11, 1, 9, 0, 65, 0, 254, 16, 2, 0, 26, 11]));
} catch (_) {
return !1;
}
}, A.My = function() {
return typeof WebAssembly < "u" && WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 96, 0, 1, 123, 3, 2, 1, 0, 10, 10, 1, 8, 0, 65, 0, 253, 15, 253, 98, 11]));
}, g()(A, null, [{ key: "isSupportSimd", get: function() {
return A.Sy === void 0 && (A.Sy = A.My()), A.Sy;
} }, { key: "isSupportThreads", get: function() {
return A.By === void 0 && (A.By = A.ky()), A.By;
} }, { key: "wasmSmooth", get: function() {
if (A.Ty === void 0) {
var _ = de();
A.Ty = !!(A.isSupportHW && A.isSupportThreads && _ && _ >= 6);
}
return A.Ty;
} }, { key: "isSupportHW", get: function() {
return !!Object(Mt.b)().performance;
} }, { key: "playHEVCTest", get: function() {
return this.Dy;
}, set: function(_) {
this.Dy = _;
} }]);
}();
ji = un, un.Cv = void 0, un.Iy = void 0, un.Oy = void 0, un.Sy = void 0, un.By = void 0, un.Ty = void 0, un.Dy = void 0, un.TYPE_SUPPORTED = { mpeg: ji.isMSECodecStrSupported("audio/mpeg"), mp3: ji.isMSECodecSupported(h.c.mp3), opus: ji.isMSECodecSupported(h.c.opus), aac: ji.isMSECodecSupported(h.c.aac), hevc: ji.isMSECodecSupported(h.c.hevc), hevc4k: ji.isMSECodecSupported(h.c.hevc, h.q.UHD_4K), hevcHdr: ji.isMSECodecSupported(h.c.hevc, h.q.FHD, !0), hevcHdr4k: ji.isMSECodecSupported(h.c.hevc, h.q.UHD_4K, !0), av1: ji.isMSECodecSupported(h.c.av1), av14k: ji.isMSECodecSupported(h.c.av1, h.q.UHD_4K), av1Hdr: ji.isMSECodecSupported(h.c.av1, h.q.FHD, !0), av1Hdr4k: ji.isMSECodecSupported(h.c.av1, h.q.UHD_4K, !0), h264: ji.isMSECodecSupported(h.c.h264), h2644k: ji.isMSECodecSupported(h.c.h264, h.q.UHD_4K), h264Hdr: ji.isMSECodecSupported(h.c.h264, h.q.FHD, !0), h264Hdr4k: ji.isMSECodecSupported(h.c.h264, h.q.UHD_4K, !0) };
var ht = un, v_ = n(49), ts = "dec-wrapper", g_ = function() {
function A(a) {
var t = this;
this.Ai = void 0, this.Do = void 0, this.Ry = void 0, this.Ly = void 0, this.At = 0, this.zc = function(i) {
var c = i.data;
t.Ly && t.Ai.emit(c.event, c.data);
}, this.Jc = function(i) {
t.Do.logger.i(ts, "worker onerror", i.message), t.Ai.emit(w.a.ERROR, Object(L.e)(L.b.DECODER_ERROR, L.a.DECODER_DEC_ERROR, "dec: " + i.message));
}, this.Do = a, this.Ai = a.evt;
}
var _ = A.prototype;
return _.init = function(a) {
a === void 0 && (a = !0), this.Do.logger.i(ts, "init worker: " + a), a && (this.Ly = ae()(61)), this.Ly ? (this.Ly.addEventListener("message", this.zc), this.Ly.addEventListener("error", this.Jc)) : this.Ry = new v_.a(this.Do.logger, this.Ai);
}, _.start = function(a, t, i, c, u) {
this.Do.logger.i(ts, "start");
var v = this.Do.getDecConfig();
this.Ly ? this.Ly.postMessage({ cmd: q.a.INIT_265, id: this.At, lib: a, config: v, simd: i, threads: t, codecType: c, decoderType: u, contextId: this.Do.id, hasExternalLogger: !!this.Do.config.logger }) : this.Ry && this.Ry.init(this.At, a, v, i, t, c, u);
}, _.destroy = function() {
this.Ly ? (this.Ly.postMessage({ cmd: q.a.DESTROY }), this.Ly.removeEventListener("message", this.zc), this.Ly.removeEventListener("error", this.Jc), this.Ly.terminate()) : this.Ry && (this.Ry.destroy(), this.Ry = void 0);
}, _.append = function(a) {
this.Ly ? this.Ly.postMessage({ cmd: q.a.APPEND_DATA, data: a }) : this.Ry && this.Ry.appendData(a);
}, _.endOfData = function() {
this.Ly ? this.Ly.postMessage({ cmd: q.a.END_OF_DATA }) : this.Ry && this.Ry.endOfData();
}, _.updateMediaInfo = function(a) {
this.Ly ? this.Ly.postMessage({ cmd: q.a.MEDIA_INFO, mediaInfo: a }) : this.Ry && this.Ry.updateMediaInfo(a);
}, _.reset = function(a) {
this.Ly ? this.Ly.postMessage({ cmd: q.a.RESET, decId: this.At, seeking: a }) : this.Ry && this.Ry.reset(this.At, a);
}, _.seek = function(a, t) {
this.Do.logger.i(ts, "seek[" + t + "]: time: " + a), this.Ly ? this.Ly.postMessage({ cmd: q.a.SEEK, time: a, id: t }) : this.Ry && this.Ry.seek(a, t);
}, _.update = function(a, t, i, c, u, v) {
this.Ly ? this.Ly.postMessage({ cmd: q.a.UPDATE_STATE, streamTime: a, output: t, active: i, frameBufLen: c, playbackRate: u, maxFrameBufLen: v }) : this.Ry && this.Ry.updateState(a, t, i, c, u, v);
}, g()(A, [{ key: "id", get: function() {
return this.At;
}, set: function(a) {
this.At = a;
} }, { key: "isUseingWorker", get: function() {
return !!this.Ly;
} }]);
}(), m_ = [4, 2], b_ = [8, 6, 4, 2], Ta = function(A) {
return A[A.data = 0] = "data", A[A.end = 1] = "end", A;
}(Ta || {}), di = "v-dec-proxy", is = function(A) {
function _(t) {
var i;
return (i = A.call(this, t) || this).Ny = [], i.Qy = void 0, i.Ym = 0, i.xy = !0, i.Vy = [], i.Gm = { streamTime: 0, stoped: !1, output: h.s.canvas, decAppendActive: !0, frameBufLen: 0, maxFrameBufLen: 0, pictMode: je.a.contain }, i.Uy = void 0, i.Qu = h.c.hevc, i.Vf = h.t.kw265, i.Ju = 1, i.Fy = void 0, i.Py = void 0, i.Hy = void 0, i.Yy = !1, i.Gy = function(c) {
i.Ci.i(di, "dec lib loaded"), i.Do.stat.wasmLibHitCache = c.hitCache, i.Ky(c.lib);
}, i.Zy = function(c) {
i.Do.updateVideoPlaybackQuality(c.decoded, c.droped), c.decId === i.Ju && i.sf.append(c.frame);
}, i.Wy = function(c) {
var u;
if (i.Ci.i(di, "seek[" + c.id + "]: decoder seek event.", c), ((u = i.zu) == null ? void 0 : u.id) !== c.id && i.Xy(i.seek))
return void (c.preventFollowUp = !0);
c.hitCache && (i.if = !1), c.hitCache || (i.ub(!0), i.hf()), i.oc(c);
}, i.Xy = function(c) {
var u;
if ((u = i.Py) != null && u.id && i.Py.time >= 0) {
i.Ci.i(di, "seek[" + i.Py.id + "]: has pending seek.");
var v = i.Py, R = v.time, Q = v.id;
return i.Py = void 0, i.zu = { id: Q, time: R, state: "dec" }, i.seek(R, Q), !0;
}
return !1;
}, i.Km = function() {
var c, u;
i.Ci.i(di, "on dec ready."), i.if = !1, i.ef !== !1 || (c = i.Do.video) != null && c.ended || (u = i.Do.video) == null || (u = u.play()) == null || u.catch(function(v) {
return i.Ci.i(di, "on dec ready, call play() fail.", v);
}), i.ef = void 0;
}, i.Zm = function() {
var c, u;
(c = i.Do.video) != null && c.ended || (i.Ci.i(di, "on dec waiting."), i.rf.onWaiting(), i.if = !0, i.ef === void 0 && (i.ef = !((u = i.Do.video) == null || !u.paused)));
}, i.zy = function(c) {
for (i.Ci.i(di, "on dec init complete"), i.No = !0, i.Jy(); i.Ny.length; ) {
var u = i.Ny.shift();
u && (u.type === Ta.data && u.data ? i.Qy.append(u.data) : u.type === Ta.end && i.Qy.endOfData());
}
i.Do.stat.wasmSimd = c.simd, i.Do.stat.wasmThreads = c.threads, i.Do.stat.wasmDecoder = c.decoderType;
}, i.qy = function() {
i.Yy = !0;
}, i.Wm = function(c) {
var u, v;
i.Ci.i(di, "seek[" + c.id + "]: renderer seek event", c, "pending:", i.Py), c.hitCache ? (u = i.Py) != null && u.id ? i.Xy(i.seek) : (i.if = !1, i.oc(c)) : (i.Ai.emit(w.a.DECODER_WAITING), (v = i.Py) != null && v.id ? i.Xy(i.Qy.seek) : (i.zu && (i.zu.state = "dec"), i.Qy.seek(c.time, c.id)));
}, i.Xm = function() {
var c;
i.Ci.i(di, "on ren waiting."), i.ef === void 0 && (i.ef = !((c = i.Do.video) == null || !c.paused)), i.Ai.emit(w.a.DECODER_WAITING);
}, i.zm = function() {
i.Km();
}, i.$y = function() {
i.Ci.i(di, "renderer buf expired"), i.sf.reset(!0);
}, i.t_ = function(c) {
i.xy = !!c.needMore;
}, i.Yb(), i.Hy = new bt(i.Do), i.Gm.maxFrameBufLen = i.rf.maxFrameBufLen, i.Uy = ht.isSupportSimd, t.stat.wasmThreadsEnabled = !!(ht.isSupportThreads && i.Do.config.maxVideoDecThreads > 1), i.Qy = new g_(t), i.O.push(i.Qy), Oe && i.O.push(i.Do.fallback.register(le.RELOAD_WASM, new Oe(i.Do).setRetryFunc(i.i_.bind(i)))), i.Qy.id = i.sf.id = i.Ju, i;
}
y()(_, A);
var a = _.prototype;
return a.Yb = function() {
var t = this, i = this.Ai;
this.O.push(i.prependListener(w.a.DEC_LIB_LOADED, this.Gy), i.prependListener(w.a.DEC_INIT_COMPLETE, this.zy), i.prependListener(w.a.DECODER_IMG, this.Zy), i.prependListener(w.a.DEC_VIDEO_READY, this.Km), i.prependListener(w.a.DECODER_SEEK, this.Wy), i.prependListener(w.a.DECODER_WAITING, this.Zm), i.prependListener(w.a.DECODER_DATA_END, function() {
return t.sf.endOfData();
}), i.prependListener(w.a.DECODER_BUF_LOW, function() {
return t.qy();
}), i.prependListener(w.a.DECODER_DROP_FRAME, function(c) {
return t.sf.dropFrame(c);
}), i.prependListener(w.a.RENDERER_BUF_UPDATE, this.t_), i.prependListener(w.a.RENDERER_BUF_EXPIRED, this.$y), i.prependListener(w.a.RENDERER_SEEK, this.Wm), i.prependListener(w.a.RENDERER_WAITING, this.Xm), i.prependListener(w.a.RENDERER_WAITING_END, this.zm));
}, a.init = function(t, i) {
this.Ci.i(di, "init codecType: " + t + " bitDepth: " + i), t && (this.Qu = t), t === h.c.kvc3 ? this.Vf = h.t.kvc3 : t === h.c.kvc4 ? this.Vf = h.t.kvc4 : t === h.c.kvc5 ? this.Vf = h.t.kvc5 : t === h.c.kvc6 ? this.Vf = h.t.kvc6 : t === h.c.hevc ? (this.Vf = h.t.kw265, i && i > 8 && (this.Vf = h.t.h265)) : t !== h.c.bvc2 && t !== h.c.kvc30 && t !== h.c.vvc || (this.Vf = h.t.kvc30), this.sf.id = this.Ju, this.sf.init(!(!$.a.chrome || this.Do.stat.mainThreadRendering !== !1)), this.Qy.init(!this.Do.config.mainThreadDecoding), this.e_();
}, a.setMediaInfo = function(t) {
A.prototype.setMediaInfo.call(this, t), this.Jy();
}, a.appendData = function(t) {
this.No ? (this.Yy = !1, this.Qy.append(t)) : this.Ny.push({ type: Ta.data, data: t });
}, a.endOfData = function() {
this.Ci.i(di, "endOfData"), this.No ? this.Qy.endOfData() : this.Ny.push({ type: Ta.end });
}, a.decoderChange = function(t, i) {
this.Ci.i(di, "decoderChange type: " + t + " time: " + i), this.Fy = t;
var c = this.Vy;
t === h.d.wasm ? (!c.length || c.length && c[c.length - 1].end !== -1) && c.push({ start: i, end: -1 }) : t === h.d.buildin && c.length && c[c.length - 1].end === -1 && (c[c.length - 1].end = i);
}, a.onParsingData = function(t) {
var i = this;
t.segments.forEach(function(c) {
c.type === h.o.AUDIO && i.Ym++;
});
}, a.heartbeat = function() {
var t;
this.Ci.i(di, "hb decAppend: " + this.xy + " waiting: " + this.if + " seeking: " + ((t = this.zu) == null ? void 0 : t.id));
}, a.seek = function(t, i) {
var c, u;
this.Ci.i(di, "seek[" + i + "]: seek. time:" + t + ". state:" + (this.zu ? this.zu.state + "|" + ((c = this.zu) == null ? void 0 : c.id) : ""));
var v = t * Ve.b;
(u = this.zu) != null && u.id ? this.zu.state === "renderer" ? (this.Ci.i(di, "seek[" + i + "]: pending."), this.Py = { id: i, time: t, state: "pending" }) : (this.Ci.i(di, "seek[" + i + "]: seek start. dec seeking."), this.zu = { id: i, time: t, state: "dec" }, this.Qy.seek(v, i), this.start()) : (this.Ci.i(di, "seek[" + i + "]: seek start."), this.zu = { id: i, time: t, state: "renderer" }, this.sf.seek(v, i), this.start());
}, a.seekWithLoad = function() {
this.Ci.i(di, "seekWithLoad. dec ready: " + this.No), this.No ? (this.ub(!0), this.hf()) : this.Ny = [];
}, a.clean = function() {
this.Ci.i(di, "clean"), this.ub(!1);
}, a.screenshot = function(t) {
this.sf.screenshot(t);
}, a.hf = function() {
var t, i = (t = this.Do.cOutput) == null ? void 0 : t.canvas;
if (i instanceof HTMLCanvasElement) {
var c, u, v = this.Do.currentTime * Ve.b, R = !1, Q = !((c = this.Do.video) == null || !c.ended), se = ((u = this.Do.video) == null ? void 0 : u.playbackRate) || 1, fe = this.isCanvasRenderer ? h.s.canvas : h.s.video, ke = this.af(i), Fe = this.xy, Ne = this.Gm, He = X.a.getPictModeByCss(i);
if (this.Do.cOutput && this.Do.cOutput.rendererType !== fe && (Ne.output = fe, R = !0, this.Ai.emit(w.a.VIDEO_RENDERER_CHANGE, { enabled: !0, type: Ne.output, canvas: void 0 })), v !== 0 || this.Ym || (v = -1), Ne.streamTime === v && Ne.stoped === Q && Ne.decAppendActive === Fe && Ne.frameBufLen === this.sf.frameBufLen && Ne.maxFrameBufLen === this.rf.maxFrameBufLen && Ne.pictMode === He || (Ne.streamTime = v, Ne.stoped = Q, Ne.decAppendActive = Fe, Ne.frameBufLen = this.sf.frameBufLen, Ne.maxFrameBufLen = this.rf.maxFrameBufLen, Ne.pictMode = He, this.Do.stat.frameBufLen = Ne.frameBufLen, R = !0), !R && !this.if && !ke)
return;
(R || this.if) && this.Qy.update(v, fe, Fe, this.sf.frameBufLen, se, Ne.maxFrameBufLen), (R || ke) && this.sf.update(v, this.yt.w, this.yt.h, Q, fe, Ne.maxFrameBufLen, He);
}
}, a.Jy = function() {
if (this.Sa.length && this.No) {
var t = this.Sa.shift();
if (t) {
var i = {};
t.rotation && (i.rotation = ((t == null ? void 0 : t.rotation) || 0) % 360, i.rotation < 0 && (i.rotation += 360)), t.fps && (i.fps = t.fps), t.colorInfo && (i.colorInfo = JSON.parse(JSON.stringify(t.colorInfo))), i.sar = t.sar, this.Qy.updateMediaInfo(i), this.sf.updateMediaInfo(i);
}
}
}, a.ub = function(t) {
t === void 0 && (t = !1), this.Ci.i(di, "reset", t), this.Ju++, this.xy = !0, this.Ym = 0, this.Vy = [], t || (this.zu = void 0, this.Py = void 0), this.Fy === h.d.wasm && this.Vy.push({ start: 0, end: -1 }), this.Qy.id = this.sf.id = this.Ju, this.Qy.reset(t), this.sf.reset(t), this.if = !0;
}, a.e_ = function(t) {
t === void 0 && (t = !1), this.Uy === void 0 || this.Do.stat.wasmThreadsEnabled === void 0 ? (this.Uy = !!ht.isSupportSimd, this.Do.stat.wasmThreadsEnabled = !!(ht.isSupportThreads && this.Do.config.maxVideoDecThreads > 1), this.Hy.load(t, this.Vf, this.Uy, this.Do.stat.wasmThreadsEnabled)) : this.Hy.load(t, this.Vf, this.Uy, this.Do.stat.wasmThreadsEnabled);
}, a.Ky = function(t) {
this.Ci.i(di, "init dec"), this.start();
var i = this.Do.stat.wasmThreadsEnabled ? this.n_() : 1;
this.Qy.id = this.Ju, this.Qy.start(t, i, !!this.Uy, this.Qu, this.Vf);
}, a.n_ = function() {
var t = Math.min(de(), this.Do.config.maxVideoDecThreads), i = b_;
this.Vf === h.t.kw265 && (i = m_);
for (var c = 0; c < i.length; c++)
if (t >= i[c])
return i[c];
return i[i.length - 1];
}, a.oc = function(t) {
this.Ci.i(di, "seek[" + t.id + "]: seeked. hit cache: " + t.hitCache + "."), this.zu = void 0;
}, a.i_ = function() {
this.e_(!0);
}, g()(_, [{ key: "isCanvasRenderer", get: function() {
var t = this.Vy.length;
if (t)
for (var i = this.Do.currentTime, c = t - 1; c >= 0; c--) {
var u = this.Vy[c];
if (u && i >= u.start && (i < u.end || u.end === -1))
return !0;
}
return !1;
} }, { key: "decBufLow", get: function() {
return this.Yy;
} }]);
}(Ue), Bc = 536870912, rs = { alwaysSeekKeyframe: !1, lazyLoadMaxDuration: -1, lazyLoadRecoverDuration: 20, webWorker: !0, appendErrorMaxRetry: 3, credentials: !1, streamingMux: !0, autoPlaybackRate: !0, autoPlaybackRateConf: void 0, enableSoftwareAES: !0, startPlayBufferSec: 0, startFromSec: -1, startFromKeyframe: !0, defaultSpts: -5e3, resourceBuffer: !0, resourceBufferSize: 500, ntp: !0, ensureVideo: !1, adaptive: !0, abrSpeedTest: !0, httpRangeType: h.e.STANDARD, enableAacPriv: !1, mseDecErrSkip: 2, maxAudioFramesDrift: 5, forceKeyFrameOnDiscontinuity: !1, videoDropFramePolicy: h.r.AUTO, videoDecBlockPolicy: h.p.WAITING, videoFrameBufferSize: Bc, maxVideoDecThreads: 8, mainThreadRendering: !1, mainThreadDecoding: !1, wasmDecoderEnabled: !$.a.mobile, maxRetry: 3, connectionTimeout: 1e4, transmissionTimeout: 3e4, retryDelay: 100, maxFragFailSec: 11, flvLoadEndError: !0, catchUpPausedLive: !0, breakpointContinuation: !0, manifestLoadingMaxRetry: 3, manifestConnectionTimeout: 1e4, manifestTransmissionTimeout: 1e4, manifestLoadingRetryDelay: 1, levelLoadingMaxRetry: 3, levelConnectionTimeout: 1e4, levelTransmissionTimeout: 1e4, levelLoadingRetryDelay: 100, levelNoUpdateRetry: 10, emeEnabled: !0, widevineLicenseUrl: "", playreadyLicenseUrl: "", fairplayLicenseUrl: "", keyLoadingMaxRetry: 3, keyConnectionTimeout: 1e4, keyTransmissionTimeout: 5e3, keyLoadingRetryDelay: 300, sdpConnectionTimeout: 1e4, peerConnectionTimeout: 1e4, peerConnectionMaxRetry: 5, peerConnectionRetryDelay: 3e3, decLibLoadingMaxRetry: 2, decLibConnectionTimeout: 5e3, decLibLoadingRetryDelay: 300, liveDelayFragNum: 3, liveShiftDelaySec: 60, liveShiftType: h.g.NONE, preferNativeLoader: void 0, playbackAbilityCacheTimeout: 864e5, adjustFragTime: !0 }, E_ = { maxRetry: 1, retryDelay: 100, connectionTimeout: 1e4, levelConnectionTimeout: 1e4, manifestConnectionTimeout: 1e4 }, Ia = function() {
function A() {
}
return A.isStreamingSupported = function() {
return A.s_ === void 0 && (A.s_ = Be.isSupported() || !!B.isSupportChunk()), A.s_;
}, A.processConfig = function(_) {
if (_) {
var a = _.src, t = _.preprocessUrl, i = _.logger;
_ = s()(JSON.parse(JSON.stringify(_)), { src: a, preprocessUrl: t, logger: i });
}
_.isLive ? rs.videoFrameBufferSize = 104857600 : rs.videoFrameBufferSize = Bc;
var c = be(_.box) ? s()({}, rs, E_) : s()({}, rs);
return s()(c, _), c.wasmDecoderEnabled = c.wasmDecoderEnabled && !!is, c.startPlayBufferSec = Math.min(5, Math.max(0, c.startPlayBufferSec)), this.r_(c), Worker || (c.webWorker = !1), c;
}, A.r_ = function(_) {
var a = _.autoPlaybackRateConf;
if (a) {
var t = a.rule;
if (t && Array.isArray(t) && ((t = t.filter(function(i) {
return i.upper > i.lower && i.rate > 0;
})).sort(function(i, c) {
return c.rate - i.rate;
}), t.length > 1))
return a.rule = t, void (_.autoPlaybackRateConf = a);
}
}, A;
}();
Ia.s_ = void 0;
var eo = "event-bus-consumer-manager", y_ = function() {
function A(a, t) {
this.Ci = void 0, this.h_ = [], this.Ai = void 0, a.i(eo, "constructor"), this.Ci = a, this.Ai = t, this.o_();
}
var _ = A.prototype;
return _.destroy = function() {
this.Ci.i(eo, "destroy"), this.Ai.removeAllListeners(), this.h_.splice(0, this.h_.length);
}, _.register = function(a, t) {
t === void 0 && (t = !1), this.Ci.i(eo, "register", a.getName()), t ? this.h_.unshift(a) : this.h_.push(a), a.setEvtEmitter(this.Ai);
}, _.unregister = function(a) {
for (var t = this.h_.length - 1; t >= 0; t--)
a === this.h_[t] && this.h_.splice(t, 1);
}, _.o_ = function() {
var a = this;
Object.values(w.a).forEach(function(t) {
var i = "on" + t.charAt(0).toUpperCase() + t.slice(1);
a.Ai.on(t, function() {
for (var c = arguments.length, u = new Array(c), v = 0; v < c; v++)
u[v] = arguments[v];
for (var R = 0; R < a.h_.length; R++) {
var Q = a.h_[R];
if (Q && i in Q) {
var se, fe = (se = Q[i]).call.apply(se, [Q].concat(u));
if (fe != null && fe.stop)
break;
}
}
});
});
}, g()(A, [{ key: "evt", get: function() {
return this.Ai;
} }]);
}(), to = function(A) {
function _() {
for (var t, i = arguments.length, c = new Array(i), u = 0; u < i; u++)
c[u] = arguments[u];
return (t = A.call.apply(A, [this].concat(c)) || this).Ai = void 0, t;
}
y()(_, A);
var a = _.prototype;
return a.getName = function() {
throw new Error("getName method must be override.");
}, a.setEvtEmitter = function(t) {
this.Ai = t;
}, a.emit = function(t, i) {
var c;
return ((c = this.Ai) == null ? void 0 : c.emit(t, i)) || !1;
}, a.onWorkerLog = function(t) {
}, _;
}(F.a), Vc = "exposed-event", C_ = function(A) {
function _(t, i) {
var c;
return (c = A.call(this) || this).Do = void 0, c.Ci = void 0, c.a_ = void 0, c.Do = t, c.Ci = t.logger, c.a_ = i, c;
}
y()(_, A);
var a = _.prototype;
return a.onReport = function(t) {
this.a_.emit(w.a.REPORT, t);
}, a.onError = function(t) {
if ((t == null || !t.preventFollowUp) && t.fatal) {
var i = s()({}, t);
if (this.Do.stat.coreType === h.a.native) {
var c = this.Do.stat.retryInfo.getLastMseError();
c && (this.Ci.i(Vc, "replace error info by mse error."), s()(i, { type: c.type, details: c.details, reason: c.reason, code: c.code }), c.url !== void 0 && (i.url = c.url), c.statusCode !== void 0 && (i.statusCode = c.statusCode));
}
this.a_.emit(w.a.ERROR, i);
}
}, a.onManifestParsed = function(t) {
t != null && t.preventFollowUp || this.a_.emit(w.a.MANIFEST_PARSED, t);
}, a.onLevelSwitching = function(t) {
this.a_.emit(w.a.LEVEL_SWITCHING, t);
}, a.onLevelSwitched = function(t) {
this.a_.emit(w.a.LEVEL_SWITCHED, t);
}, a.onLevelSwitchFailed = function() {
this.a_.emit(w.a.LEVEL_SWITCH_FAILED);
}, a.onLevelUpdated = function(t) {
this.a_.emit(w.a.LEVEL_UPDATED, t);
}, a.onLevelSwitchPlaying = function(t) {
this.a_.emit(w.a.LEVEL_SWITCH_PLAYING, t);
}, a.onAudioTrackSwitching = function(t) {
this.a_.emit(w.a.AUDIO_TRACK_SWITCHING, t);
}, a.onAudioTrackSwitched = function(t) {
this.a_.emit(w.a.AUDIO_TRACK_SWITCHED, t);
}, a.onAudioTrackUpdated = function(t) {
this.a_.emit(w.a.AUDIO_TRACK_UPDATED, t);
}, a.onAudioTrackSwitchFailed = function() {
this.a_.emit(w.a.AUDIO_TRACK_SWITCH_FAILED);
}, a.onSubtitleTrackSwitched = function(t) {
this.a_.emit(w.a.SUBTITLE_TRACK_SWITCHED, t);
}, a.onLoadEnd = function(t) {
t != null && t.preventFollowUp || this.a_.emit(w.a.LOAD_END);
}, a.onVideoRendererChange = function(t) {
this.a_.emit(w.a.VIDEO_RENDERER_CHANGE, t);
}, a.onH265Detected = function(t) {
this.a_.emit(w.a.H265_DETECTED, t);
}, a.onScreenshot = function(t) {
t.pts === -1 && (t.pts = this.Do.video ? 1e3 * this.Do.video.currentTime : 0), this.a_.emit(w.a.SCREENSHOT, t);
}, a.getName = function() {
return Vc;
}, _;
}(to), T_ = function(A) {
function _() {
return A.apply(this, arguments) || this;
}
return y()(_, A), _.prototype.run = function(a) {
if (this.getAvailable() && this.Do.hasNextMediaDesc() && (this.Do.stat.coreType === h.a.mse || this.Do.stat.coreType === h.a.native) && (this.Ci.i("fallback-next-desc", "run"), this.Do.nextMediaDesc()))
return this.Pc({ type: h.k.FALLBACK, message: "use next media description.", fallback: le.NEXT_DESC });
}, _;
}(ue), Fc = "fallback-swap-to-264", I_ = function(A) {
function _() {
return A.apply(this, arguments) || this;
}
return y()(_, A), _.prototype.run = function(a) {
var t;
if (this.getAvailable() && a.type === L.b.MEDIA_ERROR && (a.details === L.a.VIDEO_ERROR || a.details === L.a.VIDEO_ERROR_3 || a.details === L.a.VIDEO_ERROR_4 || a.details === L.a.VIDEO_NO_SIZE) && this.Do.canCodecFallback && this.Do.video instanceof HTMLVideoElement && (this.Do.stat.coreType === h.a.mse || this.Do.stat.coreType === h.a.native && ((t = this.Do.video) == null || !t.videoWidth)) && this.Do.stat.codecType !== h.c.h264 && this.Do.stat.decoder === h.d.buildin) {
var i = "metadata video size: " + this.Do.video.videoWidth + ". fallback 264";
this.Ci.i(Fc, "run"), this.Do.reProcessSrc(h.c.h264, this.Do.stat.native);
var c = this.Pc({ type: h.k.FALLBACK, message: i, fallback: le.SWAP_264 });
return ht.playHEVCTest === void 0 && (this.Ci.i(Fc, "play hevc test start"), this.Do.hevcTest.start()), c;
}
}, _;
}(ue), R_ = function(A) {
function _() {
return A.apply(this, arguments) || this;
}
return y()(_, A), _.prototype.run = function(a) {
if (this.getAvailable() && this.Do.stat.coreType === h.a.native && this.Do.stat.native && a.statusCode !== 0 && ht.isMSEAvailable()) {
var t = "box: " + this.Do.stat.box + " native startup failed. switch to mse";
return this.Ci.i("fallback-swap-to-mse", "run"), this.Do.reProcessSrc(void 0, !1), this.Pc({ type: h.k.FALLBACK, message: t, fallback: le.SWAP_CORE });
}
}, _;
}(ue), w_ = function(A) {
function _() {
return A.apply(this, arguments) || this;
}
return y()(_, A), _.prototype.run = function(a) {
var t = yi(a.reason);
if (this.getAvailable() && this.Do.stat.coreType === h.a.mse && !this.Do.stat.native && !this.Do.isLiveShift) {
var i = a.reason, c = !1;
if (a.details === L.a.DEMUX_NOT_FOUND ? (i = "demux not found", c = !0) : (this.Do.stat.box !== h.i.mp4 && this.Do.stat.box !== h.i.unknown || this.Do.stat.decoder !== h.d.buildin || a.details !== L.a.SOURCEBUFFER_ERROR && a.details !== L.a.MEDIASOURCE_ERROR && a.details !== L.a.ADDSOURCEBUFFER_ERROR && (a.type !== L.b.NETWORK_ERROR || a.details === L.a.DEC_LIB_LOAD_ERROR || a.details === L.a.KEY_SYSTEM_LICENSE_REQUEST_FAILED || a.statusCode !== 0 || Object(L.f)(a.reason) || Object(L.g)(a.reason))) && (this.Do.stat.box !== h.i.mp4 || t !== h.o.AUDIO || this.Do.stat.recoverSwapRemux || a.details !== L.a.VIDEO_ERROR_3) ? (this.Do.stat.box === h.i.mp4 && a.details === L.a.VIDEO_ERROR_4 && a.reason.indexOf("CHUNK_DEMUXER_ERROR_APPEND_FAILED") >= 0 || this.Do.stat.box === h.i.mp4 && t === h.o.AUDIO && this.Do.stat.decoder === h.d.wasm && a.type === L.b.MSE_ERROR && this.Do.stat.codecType === h.c.hevc && ht.isVideoCodecSupported(h.c.hevc)) && (c = !0) : c = !0, c)
return this.Ci.i("fallback-swap-to-native", "run@" + this.Do.currentTime, this.Do.stat.startFromSec, this.Do.config.startFromSec), this.Do.stat.decoder === h.d.wasm && this.emit(w.a.VIDEO_RENDERER_CHANGE, { enabled: !0, canvas: void 0, type: h.s.video }), this.Do.reProcessSrc(void 0, !0), this.Pc({ type: h.k.FALLBACK, message: i + ". swap to native.", fallback: le.SWAP_CORE });
}
}, _;
}(ue), Ra = n(18), On = "ios-compatible", L_ = function(A) {
function _(t, i) {
var c;
return (c = A.call(this) || this).Do = void 0, c.Ci = void 0, c.u_ = void 0, c.c_ = !1, c.f_ = void 0, c.A_ = function() {
var u = c.Do.video;
c.f_ = setTimeout(function() {
c.Ci.i(On, "fix play stuck", u == null ? void 0 : u.currentTime), u && c.u_((u == null ? void 0 : u.currentTime) + 1e-3);
}, 1e3);
}, c.v_ = function() {
c.f_ && (clearTimeout(c.f_), c.f_ = void 0);
}, c.Do = t, c.Ci = t.logger, c.u_ = i, c.Ci.i(On, "constructor"), c;
}
y()(_, A);
var a = _.prototype;
return a.onLoad = function() {
this.d_();
}, a.destroy = function() {
this.Ci.i(On, "destroy"), this.d_();
}, a.onVisibilityChange = function(t) {
this.Ci.i(On, "onVisibilityChange", t.hidden), !t.hidden && $.a.ios && (this.Ci.i(On, "ios hidden false. play stuck detector on."), this.c_ = !0);
}, a.onPlay = function() {
this.c_ && (this.Ci.i(On, "on play. start detector timer."), this.c_ = !1, this.A_());
}, a.onTimeupdate = function() {
this.f_ && this.d_();
}, a.getName = function() {
return On;
}, a.d_ = function() {
this.Ci.i(On, "reset"), this.c_ = !1, this.v_();
}, _;
}(to), pr = function(A) {
return A.METADATA = "metadata", A.MEDIA_INFO = "mediaInfo", A.HEARTBEAT = "heartbeat", A.DOWNLOAD = "download", A.REALTIME_BEACON = "realtimeBeacon", A.DISCONTINUITY = "discontinuity", A.KEY_FRAME = "keyFrame", A.PRIV_NAL = "privNal", A.SEI = "sei", A.AAC_PRIV = "aacPriv", A;
}({}), D_ = function() {
function A() {
var a = this;
this.yb = void 0, this.Oc = void 0, this.l_ = void 0, this.xc = function() {
a.b_();
}, this.p_ = function() {
a.Oc && a.Oc.readyState >= 2 && a.b_();
}, this.b_ = function() {
a.Oc && a.l_ && a.l_(a.Oc.status), a.stop();
};
}
var _ = A.prototype;
return _.start = function(a, t) {
this.l_ = t, this.Oc && this.stop();
var i = this.Oc = new XMLHttpRequest();
i.open("GET", a, !0), i.onreadystatechange = this.p_, i.onerror = this.xc, i.onload = this.xc, i.send(), this.yb = setTimeout(this.b_, 1e3);
}, _.stop = function() {
this.yb && (clearTimeout(this.yb), this.yb = void 0), this.Oc && (this.Oc.onreadystatechange = null, this.Oc.onload = null, this.Oc.onerror = null, this.Oc.abort(), this.Oc = void 0), this.l_ = void 0;
}, A;
}(), fi = "kernel-native", S_ = function(A) {
function _(t) {
var i;
return (i = A.call(this, t) || this).m_ = void 0, i.g_ = !1, i.O.push(i.Do.fallback.register(le.USE_BACKUP, new ni(t).setRetryFunc(i.Ug.bind(i)))), i;
}
y()(_, A);
var a = _.prototype;
return a.Ug = function(t) {
this.RA(h.h.retry);
}, a.load = function(t) {
var i;
this.Ci.i(fi, "load", this.Do.stat.startFromSec);
var c = this.Do.lctx.levels;
if (c.length || this.emit(w.a.ERROR, Object(L.e)(L.b.OTHER_ERROR, L.a.MANIFEST_PARSING_ERROR, "manifest parse error. core: native")), this.Do.stat.drm)
this.emit(w.a.ERROR, Object(L.e)(L.b.KEY_SYSTEM_ERROR, L.a.KEY_SYSTEM_UNSUPPORTED, "DRM unsupported."));
else {
var u = this.Do.lctx.default, v = this.Do.lctx.startIdx;
typeof v == "number" && v >= 0 && v < c.length && (u = v, this.Ci.i(fi, "set level from level startIdx.")), this.Ci.i(fi, "level: " + u + " " + ((i = c[u]) == null ? void 0 : i.qualityType)), this.Do.lctx.currentIdx = this.Do.lctx.nextIdx = u, this.Do.lctx.abr = !1, this.emit(w.a.MANIFEST_PARSED, { levels: [], currentLevel: 0 }), this.RA(t);
}
}, a.onAbrLevelsUpdated = function() {
}, a.refresh = function() {
var t, i = this;
this.Do.stat.startFromSec = this.eA.currentTime, this.RA(h.h.retry), (t = this.eA.play()) == null || t.catch(function(c) {
return i.Ci.i(fi, "refresh. call play() fail.", c);
});
}, a.stopLoad = function() {
this.emit(w.a.STOP_LOAD), this.kA();
}, a.setCurrentLevel = function(t) {
var i = this;
this.Ci.i(fi, "set current level: " + t + " @ " + this.eA.currentTime);
var c = this.Do;
if (c.lctx.levels.length) {
if (t >= 0 && t < c.lctx.levels.length && c.lctx.currentIdx !== t) {
c.lctx.currentIdx = c.lctx.nextIdx = t;
var u = c.lctx.current;
if (u) {
var v;
return this.Io = mt.SELECT_BITRATE, c.stat.startFromSec = this.eA.currentTime, this.rA++, this.emit(w.a.LEVEL_SWITCHING, { time: c.currentTime, bitrate: u.bitrate, level: t, smooth: !1, auto: !1, id: this.rA }), this.y_(c.lctx.currentIdx), !this.eA.paused && ((v = this.eA.play()) == null || v.catch(function(R) {
return i.Ci.i(fi, "set current level, call play() fail.", R);
})), void this.emit(w.a.LEVEL_SWITCHED, { time: c.currentTime, bitrate: u.bitrate, level: t, smooth: !1, auto: !1, id: this.rA });
}
}
this.emit(w.a.LEVEL_SWITCH_FAILED);
} else
c.lctx.currentIdx = c.lctx.nextIdx = t;
}, a.setNextLevel = function(t) {
this.setCurrentLevel(t);
}, a.liveEnd = function() {
}, a.destroy = function() {
this.Ci.i(fi, "destroy"), this.m_ && (this.m_.stop(), this.m_ = void 0), A.prototype.destroy.call(this), this.eA.src = "";
}, a.mA = function() {
this.nA || this.eA.src || this.load(), A.prototype.mA.call(this);
}, a.AA = function() {
var t = this.Do, i = t.lctx.current;
i && this.Io === mt.SELECT_BITRATE && this.emit(w.a.LEVEL_SWITCH_PLAYING, { time: t.currentTime, bitrate: i.bitrate, level: t.lctx.currentIdx, smooth: !1, auto: !1, id: this.rA }), this.Io !== mt.NONE && (this.Io = mt.NONE), A.prototype.AA.call(this);
}, a.IA = function() {
var t = this.Do;
A.prototype.IA.call(this), this.g_ && (this.Ci.i(fi, "timeupdate start from: " + t.stat.startFromSec), this.__(), this.g_ = !1);
}, a.lA = function() {
this.Ci.i(fi, "video waiting"), this.Io = this.Io || mt.WAITING;
var t = this.Do.bufferedSec, i = !this.eA.ended && !this.eA.seeking && this.Io === mt.WAITING;
this.emit(w.a.WAITING, { block: i, bufferedSec: t });
}, a.CA = function() {
var t;
($.a.android || this.Do.stat.isLive === void 0 || ((t = this.Sa) == null ? void 0 : t.width) === 0) && this.Sa && this.eA.duration > 0 && (this.Sa.isLive = this.Do.stat.isLive = !isFinite(this.eA.duration), this.eA instanceof HTMLVideoElement && (this.Sa.width = this.eA.videoWidth, this.Sa.height = this.eA.videoHeight), this.emit(w.a.MEDIA_INFO, this.Sa)), this.C_() && this.eA.duration > 0 && (this.Ci.i(fi, "check video dec failed. on android wechat hls duration change."), this.I_()), A.prototype.CA.call(this);
}, a.fA = function() {
if (this.Ci.i(fi, "video loadeddata. duration: " + this.eA.duration + " box: " + this.Do.stat.box), !(!this.C_() && this.eA instanceof HTMLVideoElement && (this.Ci.i(fi, "check video dec failed. on video loaded data."), this.I_()))) {
this.Do.stat.isLive === void 0 && this.eA.duration > 0 && (this.Do.stat.isLive = !isFinite(this.eA.duration)), this.Sa = { videoDecoder: h.d.buildin }, this.eA instanceof HTMLVideoElement && (this.Ci.i(fi, "video loadeddata. width: " + this.eA.videoWidth + " height: " + this.eA.videoHeight), this.Sa.width = this.eA.videoWidth, this.Sa.height = this.eA.videoHeight);
var t = this.Do, i = t.lctx.current;
if (i && i.codec) {
var c = Fr(i.codec);
this.Sa.audioCodec = c.audio, this.Sa.videoCodec = c.video, c.video && (t.stat.codecType = jr(c.video));
}
this.Sa.videoCodecType = t.stat.codecType, $.a.android ? t.stat.startFromSec && (this.g_ = !0) : this.__(), this.emit(w.a.MEDIA_INFO, this.Sa);
}
}, a.vA = function() {
this.Ci.i(fi, "seeking " + this.eA.currentTime);
var t = this.eA.currentTime;
this.uA ? this.uA = !1 : (this.emit(w.a.SEEKING), this.Do.isTimeinBuffered(t) || this.emit(w.a.SEEK_WITH_LOAD));
}, a.gA = function(t) {
var i, c = this;
this.Ci.i(fi, "video error", t);
var u = ((i = this.eA.error) == null ? void 0 : i.code) || 0, v = Object(L.d)(L.c[u] || L.a.VIDEO_ERROR, "video error");
if (u === 4 && this.Do.canCodecFallback)
this.emit(w.a.ERROR, Object(L.e)(L.b.MEDIA_ERROR, v, "buildin " + this.Do.stat.codecType + " dec error. video error: " + u));
else {
var R = "video error";
this.eA && this.eA.error && (R += " code:" + u + " message:" + this.eA.error.message);
var Q = Object(L.e)(L.b.MEDIA_ERROR, (u ? L.c[u] : L.a.VIDEO_ERROR) || L.a.VIDEO_ERROR, R, { url: this.eA.src });
u === 2 || u === 4 ? (this.m_ || (this.m_ = new D_()), this.Ci.i(fi, "video error start detect status code."), this.m_.start(this.eA.src, function(se) {
c.Ci.i(fi, "video error check http status code:", se), (u === 2 || u === 4 && se > 0) && (se < 200 || se > 299) ? c.emit(w.a.ERROR, Object(L.e)(L.b.NETWORK_ERROR, L.a.LOAD_ERROR, R, { statusCode: se, url: c.eA.src })) : (se === 0 && (Q.statusCode = 0), c.emit(w.a.ERROR, Q));
})) : this.emit(w.a.ERROR, Q);
}
}, a.RA = function(t) {
this.Ci.i(fi, "_load type: " + t), this.Sa = void 0, this.nA = void 0, this.Do.isLiveShift ? this.emit(w.a.ERROR, Object(L.e)(L.b.OTHER_ERROR, L.a.UNSUPPORTED, "unsupported. core: " + this.type + " liveShift: " + this.Do.stat.liveShiftType)) : (this.Io = mt.LOADING, A.prototype.RA.call(this, t), this.emit(w.a.LOAD, { type: t }), this.y_(this.Do.lctx.currentIdx), this.TA());
}, a.y_ = function(t) {
var i = this.Do, c = i.lctx.current;
if (c) {
var u;
this.Ci.i(fi, "level", t);
var v, R = c.currentUrl;
this.emit(w.a.NEW_SOURCE, { sync: i.stat.startFromSec || 0 }), (u = this.Do.config.preprocessUrl) != null && u.stream && (this.Ci.d(fi, "preprocessUrl stream"), R = (v = this.Do.config.preprocessUrl) == null ? void 0 : v.stream(R)), this.Ci.i(fi, "play: " + R), this.eA.src = R;
}
}, a.__ = function() {
var t = this.Do;
t.stat.startFromSec > 0 && (this.Ci.i(fi, "start from: " + t.stat.startFromSec), this.eA.currentTime = t.stat.startFromSec, t.stat.startFromSec = 0);
}, a.I_ = function() {
return this.Ci.i(fi, "check video dec failed."), !!(this.eA instanceof HTMLVideoElement && !this.eA.videoWidth && this.Do.canCodecFallback) && (this.emit(w.a.ERROR, Object(L.e)(L.b.MEDIA_ERROR, L.a.VIDEO_NO_SIZE, "buildin " + this.Do.stat.codecType + " dec no width.")), !0);
}, a.C_ = function() {
return $.a.android && ($.a.xweb || $.a.x5) && be(this.Do.stat.box);
}, g()(_, [{ key: "type", get: function() {
return h.a.native;
} }]);
}(Qr), O_ = n(45), N_ = n.n(O_), k_ = function() {
function A() {
this.O_ = 0, this.w_ = 0, this.E_ = 0, this.j_ = 0, this.an = void 0, this.an = this.k_();
}
var _ = A.prototype;
return _.reset = function() {
this.an = this.k_(), this.O_ = 0, this.w_ = 0, this.E_ = 0, this.j_ = 0;
}, _.parse = function(a) {
var t = this, i = this.an, c = 0, u = 0, v = "", R = "", Q = "", se = "";
i.totalReceive = 0, a.forEach(function(Fe) {
if (Fe.type === "inbound-rtp") {
if (Fe.mediaType === "video") {
var Ne = Fe.timestamp - t.O_;
t.O_ && (c = (Fe.bytesReceived - t.E_) / Ne), t.E_ = Fe.bytesReceived, t.O_ = Fe.timestamp, i.key = Fe.keyFramesDecoded, i.videoPacketsLost = Fe.packetsLost, R = Fe.codecId, se = Fe.trackId;
} else if (Fe.mediaType === "audio") {
var He = Fe.timestamp - t.w_;
t.j_ && (u = (Fe.bytesReceived - t.j_) / He), t.j_ = Fe.bytesReceived, i.audioPacketsLost = Fe.packetsLost, v = Fe.codecId, Q = Fe.trackId;
}
i.totalReceive += Fe.bytesReceived, t.w_ = Fe.timestamp;
}
}), i.audioDataRate = Math.round(7.8125 * u), i.videoDataRate = Math.round(7.8125 * c), i.speed = 1e3 * (c + u), a.forEach(function(Fe) {
Fe.type === "codec" ? Fe.id === R ? i.videoCodec = Fe.mimeType : Fe.id === v && (i.audioCodec = Fe.mimeType, i.audioChannelCount = Fe.channels, i.audioSampleRate = Fe.clockRate) : Fe.type === "track" && (Fe.id === se ? (i.width = Fe.frameWidth, i.height = Fe.frameHeight, i.videoAvgJitterBufferDelay = Fe.jitterBufferDelay / Fe.jitterBufferEmittedCount) : Fe.id === Q && (i.audioAvgJitterBufferDelay = Fe.jitterBufferDelay / Fe.jitterBufferEmittedCount));
});
var fe = null, ke = null;
return a.forEach(function(Fe) {
Fe.type === "transport" && (fe = a == null ? void 0 : a.get(Fe.selectedCandidatePairId));
}), fe || a.forEach(function(Fe) {
Fe.type === "candidate-pair" && Fe.selected && (fe = Fe);
}), fe && fe.remoteCandidateId && (ke = a == null ? void 0 : a.get(fe.remoteCandidateId)), ke && (i.rtcRemoteAddress = ke.address || ke.ip || ke.ipAddress, i.rtcRemotePort = ke.port || ke.portNumber), this.an = i, i;
}, _.k_ = function() {
return { totalReceive: 0, speed: 0, rtcRemoteAddress: "", rtcRemotePort: 0, width: 0, height: 0, audioCodec: "", videoCodec: "", audioChannelCount: 0, audioSampleRate: 0, videoDataRate: 0, audioDataRate: 0, key: 0, audioPacketsLost: 0, videoPacketsLost: 0, audioAvgJitterBufferDelay: 0, videoAvgJitterBufferDelay: 0 };
}, g()(A, [{ key: "result", get: function() {
return this.an;
} }]);
}();
function jc(A, _) {
var a = Object.keys(A);
if (Object.getOwnPropertySymbols) {
var t = Object.getOwnPropertySymbols(A);
_ && (t = t.filter(function(i) {
return Object.getOwnPropertyDescriptor(A, i).enumerable;
})), a.push.apply(a, t);
}
return a;
}
function Hc(A) {
for (var _ = 1; _ < arguments.length; _++) {
var a = arguments[_] != null ? arguments[_] : {};
_ % 2 ? jc(Object(a), !0).forEach(function(t) {
N_()(A, t, a[t]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(A, Object.getOwnPropertyDescriptors(a)) : jc(Object(a)).forEach(function(t) {
Object.defineProperty(A, t, Object.getOwnPropertyDescriptor(a, t));
});
}
return A;
}
var _r = "kernel-rtc", Gc = function(A) {
function _(t) {
var i;
return (i = A.call(this, t) || this).vf = void 0, i.M_ = void 0, i.YA = void 0, i.S_ = void 0, i.B_ = "", i.T_ = void 0, i.D_ = !1, i._f = null, i.qf = 0, i.R_ = null, i.L_ = void 0, i.N_ = void 0, i.Q_ = void 0, i.x_ = void 0, i.V_ = function(c) {
i.M_ && i.M_.getStats(null).then(function(u) {
var v = i.T_.parse(u);
c(v);
}, function(u) {
return console.log(u);
});
}, i.YA = { connectionTimeout: i.Do.config.sdpConnectionTimeout || 1e4, maxRetry: 0, retryDelay: i.Do.config.retryDelay || 1e3 }, i.L_ = i.Do.config.transmissionTimeout || 1e4, i.N_ = i.Do.config.peerConnectionTimeout || 1e5, i.Q_ = i.Do.config.peerConnectionMaxRetry || 5, i.x_ = i.Do.config.peerConnectionRetryDelay || 3e3, i.T_ = new k_(), i;
}
y()(_, A);
var a = _.prototype;
return a.load = function(t) {
this.Ci.i(_r, "load");
var i = this.Do.lctx.current;
i && (this.B_ = i.currentUrl), this.RA(t);
}, a.resume = function() {
this.eA.paused && this.refresh();
}, a.destroy = function() {
A.prototype.destroy.call(this), this.U_(), this.sv(), this.eA && (this.eA.srcObject = null), this.F_(), this.S_ = void 0, this.vy();
}, a.refresh = function() {
this.F_(), this.RA(h.h.retry);
}, a.stopLoad = function() {
this.emit(w.a.STOP_LOAD), this.M_ && (this.M_.close(), this.M_ = null), this.U_(), this.kA();
}, a.liveEnd = function() {
}, a.cA = function() {
var t = this;
this.V_(function(i) {
t.Sa || (t.Sa = {}), t.Sa.width = i.width, t.Sa.height = i.height, t.Sa.audioCodec = i.audioCodec, t.Sa.audioSampleRate = i.audioSampleRate, t.Sa.channel = i.audioChannelCount, t.Sa.videoCodec = i.videoCodec, t.Sa.hasVideo = !!i.videoCodec, t.Sa.hasAudio = !!i.audioCodec, t.Sa.streamHost = i.rtcRemoteAddress;
}), A.prototype.cA.call(this);
}, a.DA = function() {
var t = this;
this.V_(function(i) {
var c;
i.speed || t.R_ || ((c = t.M_) == null ? void 0 : c.connectionState) !== "connected" ? i.speed && (t.R_ && clearTimeout(t.R_), t.R_ = null) : t.R_ = +setTimeout(function() {
var u = Object(L.e)(L.b.NETWORK_ERROR, L.a.WEBRTC_TRANSMISSION_DATA_NULL, "transmission timeout " + t.L_, { fatal: !1, url: t.B_ });
t.emit(w.a.ERROR, u), t.P_(u.reason);
}, t.L_), t.Do.loadRec.setRTCStats(i), t.emit(w.a.HEARTBEAT);
});
}, a.AA = function() {
this.Io !== mt.NONE && (this.Io = mt.NONE), A.prototype.AA.call(this);
}, a.RA = function(t) {
var i = this;
this.T_.reset(), this.Io = mt.LOADING, this.emit(w.a.LOAD, { type: t }), this.emit(w.a.NEW_SOURCE, { sync: 0 }), this.M_ && this.M_.close(), this.H_(), this.Y_().catch(function(c) {
i.P_(c == null ? void 0 : c.reason);
});
}, a.internalSeek = function(t) {
}, a.vy = function() {
this.eA && (this.eA.srcObject = null);
}, a.P_ = function(t) {
var i = this;
this.D_ = !0, this.M_ && this.M_.close(), this.U_(), this.qf < this.Q_ && (this.R_ && clearTimeout(this.R_), this._f && clearTimeout(this._f), this._f = +setTimeout(function() {
i.qf++, i.Ci.i(_r, "retry", i.qf, t, i.B_), i.emit(w.a.RETRY, { type: h.k.RTC, message: "reason: " + t + ". retry: " + i.qf, code: L.a.WEBRTC_FAILED_ERROR }), i._f = null, i.H_(), i.Y_().then(function() {
i.qf = 0, i.D_ = !1;
}, function(c) {
i.qf < i.Q_ ? i.P_(t) : i.emit(w.a.ERROR, Hc(Hc({}, c), {}, { fatal: !0, url: i.B_ }));
});
}, this.x_));
}, a.U_ = function() {
this._f && (clearTimeout(this._f), this._f = null);
}, a.G_ = function(t) {
var i = this;
this.sv();
var c = this.vf = new nt(this.Ci), u = { url: this.B_, responseType: "text", requestBody: t, requestMethod: "POST", progress: !1, headers: [{ header: "Content-type", value: "application/json" }] };
return new Promise(function(v, R) {
c.load(u, { onEnd: function(Q, se) {
if (i.sv(), typeof se == "string") {
var fe = JSON.parse(se);
i.emit(w.a.LEVEL_UPDATED), v(fe.sdp);
}
}, onError: function(Q, se) {
if (i.Ci.i(_r, "loadSdp", se), se.fatal) {
var fe = { type: L.b.NETWORK_ERROR, details: L.a.RTC_SDP_LOAD_ERROR, reason: se.errMessage, fatal: se.fatal, url: i.B_ };
i.sv(), R(fe);
}
}, onAbort: function() {
i.sv(), R();
} }, i.YA);
}).catch(function(v) {
return Promise.reject(v);
});
}, a.H_ = function() {
var t = this, i = this.M_ = new RTCPeerConnection();
return i.addEventListener("track", function(c) {
return t.K_(c);
}), i.addEventListener("connectionstatechange", function(c) {
return t.Z_(c);
}), i.addEventListener("icecandidateerror", function(c) {
return t.W_(c);
}), i.addEventListener("signalingstatechange", function(c) {
return t.X_(c);
}), i.addEventListener("iceconnectionstatechange", function(c) {
return t.z_(c);
}), i.addEventListener("icegatheringstatechange", function(c) {
return t.J_(c);
}), i.addTransceiver("audio", { direction: "recvonly" }), i.addTransceiver("video", { direction: "recvonly" }), i;
}, a.F_ = function() {
this.M_ && this.M_.close(), this.M_ = null;
}, a.Y_ = function() {
var t = this, i = this.M_;
return i || Promise.reject("PeerConnection isn't exist"), this.q_().then(function(c) {
return t.G_(JSON.stringify({ sdp: c.sdp }));
}).then(function(c) {
return t.tC(c);
}).then(function() {
return i ? new Promise(function(c, u) {
var v = setTimeout(function() {
var R = Object(L.e)(L.b.NETWORK_ERROR, L.a.WEBRTC_CONNECT_TIMEOUT, "webrtc connect timeout", { fatal: !1, url: t.B_ });
t.emit(w.a.ERROR, R), u(R);
}, t.N_);
i.addEventListener("connectionstatechange", function R() {
switch (i.connectionState) {
case "connected":
c(void 0), clearTimeout(v), i.removeEventListener("connectionstatechange", R);
break;
case "closed":
case "disconnected":
case "failed":
clearTimeout(v), i.removeEventListener("connectionstatechange", R), u({ type: L.b.NETWORK_ERROR, details: L.a.WEBRTC_CONNECT_FAILED, fatal: !1, reason: i.onconnectionstatechange });
}
});
}) : Promise.reject("PeerConnection isn't exist");
}).catch(function(c) {
return t.Ci.i(_r, c), Promise.reject(c);
});
}, a.q_ = function() {
var t = this, i = this.M_;
return i ? i.createOffer().then(function(c) {
return t.Ci.i(_r, "offer", c), i.setLocalDescription(c).then(function() {
return c;
});
}, function(c) {
t.Ci.i(_r, "offer", c);
var u = Object(L.e)(L.b.NETWORK_ERROR, L.a.WEBRTC_OFFER_ERROR, "webrtc createoffer error" + c, { fatal: !1, url: t.B_ });
return t.emit(w.a.ERROR, u), Promise.reject(u);
}) : Promise.reject();
}, a.tC = function(t) {
var i = this, c = this.M_;
if (!c || c.signalingState === "closed")
return Promise.reject();
var u = new RTCSessionDescription({ type: "answer", sdp: t });
return c.setRemoteDescription(u).then(function() {
i.Ci.i(_r, "answer", u);
}, function(v) {
i.Ci.i(_r, "answer", v);
var R = Object(L.e)(L.b.NETWORK_ERROR, L.a.WEBRTC_ANSWER_ERROR, "webrtc answer error", { fatal: !1, url: i.B_ });
return i.emit(w.a.ERROR, R), Promise.reject(R);
});
}, a.K_ = function(t) {
if (this.Do.video && t.streams && this.S_ !== t.streams[0]) {
var i, c = this.S_ = t.streams[0];
this.Do.video.srcObject = c || null;
var u = this.Sa = { videoDecoder: h.d.buildin };
(i = t.streams[0]) == null || i.getTracks().forEach(function(v) {
var R = v.getSettings();
u.width = R.width || u.width, u.height = R.height || u.height, u.fps = R.frameRate || u.fps;
});
}
}, a.Z_ = function(t) {
var i = this.M_;
if (i)
switch (this.Ci.i(_r, "pcConnectionStateChange", i.connectionState, t), i.connectionState) {
case "connecting":
case "connected":
break;
case "disconnected":
case "failed":
case "closed":
this.emit(w.a.ERROR, Object(L.e)(L.b.NETWORK_ERROR, L.a.WEBRTC_DISCONNECTED_ERROR, i.connectionState, { fatal: !1, url: this.B_ })), !this.D_ && this.P_("PeerConnection state is " + i.connectionState);
}
}, a.W_ = function(t) {
var i;
this.Ci.i(_r, "iceCandidateError", t), this.emit(w.a.ERROR, Object(L.e)(L.b.NETWORK_ERROR, L.a.WEBRTC_ICE_CANDIDATE_ERROR, ((i = this.M_) == null ? void 0 : i.iceConnectionState) || "", { fatal: !1 })), !this.D_ && this.P_("iceCandidateError");
}, a.X_ = function(t) {
var i;
this.Ci.i(_r, "signalingStateChange", (i = this.M_) == null ? void 0 : i.signalingState, t);
}, a.z_ = function(t) {
var i;
this.Ci.i(_r, "iceConnecttionStateChange", (i = this.M_) == null ? void 0 : i.iceConnectionState, t);
}, a.J_ = function(t) {
var i;
this.Ci.i(_r, "iceGatheringStateChange", (i = this.M_) == null ? void 0 : i.iceGatheringState, t);
}, a.sv = function() {
this.vf && (this.vf.destroy(), this.vf = void 0);
}, g()(_, [{ key: "type", get: function() {
return h.a.rtc;
} }]);
}(Qr), io = "kwai-kernel-id", ro = function() {
function A() {
}
return A.next = function() {
if (G.available) {
var _ = A.uf.read(io, !1), a = A.At;
return typeof _ == "number" ? (a = this.getNextId(_), this.uf.write(io, a)) : (a = this.getNextId(a), this.uf.write(io, a)), A.At = a, a;
}
return A.At = A.getNextId(A.At), A.At;
}, A.getNextId = function(_) {
return ++_ > A.MAX_ID ? 0 : _;
}, g()(A, null, [{ key: "MAX_ID", get: function() {
return 999;
} }]);
}();
ro.At = 0, ro.uf = new G();
var zc = "sei-time", x_ = function(A) {
function _(a) {
var t;
return (t = A.call(this) || this).Do = void 0, t.iC = 0, t.Ci = void 0, t.eC = { idx: 0, data: [], name: "sei" }, t.nC = { idx: 0, data: [], name: "aacPriv" }, t.sC = { idx: 0, data: [], name: "privNal" }, t.$g = function(i) {
i.segments.forEach(function(c) {
c.type === h.o.VIDEO ? (c.sei && t.rC(c.sei, t.eC), c.privNal && t.rC(c.privNal, t.sC)) : c.type === h.o.AUDIO && c.aacPriv && t.rC(c.aacPriv, t.nC);
}), t.hC();
}, t.kl = function(i) {
i.sei && t.rC(i.sei, t.eC), t.hC();
}, t.oC = function() {
var i;
if ((i = t.Do.video) == null || !i.seeking) {
var c = 1e3 * t.Do.currentTime, u = t.aC(c, t.eC);
u == null || u.forEach(function(Q) {
t.Do.evt.emit(w.a.SEI, Q);
});
var v = t.aC(c, t.nC);
v == null || v.forEach(function(Q) {
t.Do.evt.emit(w.a.AAC_PRIV, Q);
});
var R = t.aC(c, t.sC);
R == null || R.forEach(function(Q) {
t.Do.evt.emit(w.a.PRIV_NAL, Q);
});
}
}, t.aC = function(i, c) {
if (c.data.length && c.idx < c.data.length) {
for (var u = [], v = 0, R = c.idx; R < c.data.length; R++) {
var Q;
if (!(i >= (((Q = c.data[R]) == null ? void 0 : Q.time) || 0)))
break;
u.push(c.data[R]), v = R;
}
if (u.length)
return c.idx = v + 1, u;
}
}, t.uC = function() {
t.Ci.i(zc, "seek with load. remove all sei"), t.eC.data.splice(0), t.eC.idx = 0, t.nC.data.splice(0), t.nC.idx = 0, t.sC.data.splice(0), t.sC.idx = 0, t.iC = 0;
}, t.cC = function() {
var i = 1e3 * t.Do.currentTime;
t.fC(i, t.eC), t.fC(i, t.nC), t.fC(i, t.sC);
}, t.fC = function(i, c) {
for (var u = 0; u < c.data.length; u++)
if (c.data[u].time >= i) {
c.idx = u;
break;
}
}, t.rC = function(i, c) {
i.forEach(function(u) {
u && typeof u.streamTimestamp == "number" && (u.time = t.Do.streamTime.getLocalTime(u.streamTimestamp / 1e3), typeof u.time == "number" && (u.time = Math.round(1e3 * u.time), c.data.push(u)));
}), c.data.sort(function(u, v) {
return u.time - v.time;
});
}, t.hC = function() {
var i = t.Do.video;
if (t.iC > 20 && i && i.buffered.length) {
var c = 1e3 * i.buffered.start(0);
t.AC(c, t.eC), t.AC(c, t.nC), t.AC(c, t.sC), t.iC = 0;
}
t.iC++;
}, t.AC = function(i, c) {
if (c.data.length && i > c.data[0].time) {
for (var u = 0; u < Math.min(c.idx, c.data.length); u++)
if (c.data[u].time >= i) {
c.data.splice(0, u), c.idx = Math.max(0, c.idx - u), t.Ci.i(zc, "remove " + u + " " + c.name + " info @" + i + ". remain " + c.data.length);
break;
}
}
}, t.Do = a, t.Ci = a.logger, t.O.push(t.Do.evt.on(w.a.PARSING_DATA, t.$g), t.Do.evt.on(w.a.RAW_DATA, t.kl), t.Do.evt.on(w.a.TIMEUPDATE, t.oC), t.Do.evt.on(w.a.SEEK_WITH_LOAD, t.uC), t.Do.evt.on(w.a.SEEKING, t.cC)), t;
}
return y()(_, A), g()(_, [{ key: "seiLength", get: function() {
return this.eC.data.length;
} }, { key: "seiIdx", get: function() {
return this.eC.idx;
} }, { key: "aacPrivLength", get: function() {
return this.nC.data.length;
} }, { key: "aacPrivIdx", get: function() {
return this.nC.idx;
} }, { key: "privNalLength", get: function() {
return this.sC.data.length;
} }, { key: "privNalIdx", get: function() {
return this.sC.idx;
} }]);
}(F.a), zn = "stream-time", M_ = function(A) {
function _(t) {
var i;
return (i = A.call(this) || this).Ci = void 0, i.Do = void 0, i.vC = [], i.dC = void 0, i.jl = function(c) {
c.expired || c.segments.forEach(function(u) {
var v;
u.type === h.o.VIDEO && u.keyTime && (u.keyTime.forEach(function(R) {
R.key && i.Do.evt.emit(w.a.KEY_FRAME, { pts: R.pts, cts: R.cts });
}), (v = i.vC).push.apply(v, u.keyTime.map(function(R) {
return s()({ frag: c.frag }, R);
})), i.vC.sort(function(R, Q) {
return R.pts - Q.pts;
})), u.type === h.o.AUDIO && u.originFirstDTS && (i.dC = u.originFirstDTS - u.startDTS);
});
}, i.kl = function(c) {
var u;
c.keyTime && !c.expired && (u = i.vC).push.apply(u, c.keyTime.map(function(v) {
return s()({ frag: c.frag }, v);
}));
}, i.uC = function() {
var c, u = ((c = i.Do.video) == null ? void 0 : c.currentTime) || 0, v = i.Do.lctx.current, R = 0;
if (i.Ci.i(zn, "on seek with load. current time: " + i.Do.currentTime), i.Do.stat.multipart && Object.prototype.hasOwnProperty.call(v, "fragments")) {
var Q = pt(u, v.fragments);
if (!Q)
return i.Ci.i(zn, "no frag. clear video key time."), void i.vC.splice(0, i.vC.length);
for (var se = i.vC.length - 1; se >= 0; se--) {
var fe;
if (((fe = i.vC[se].frag) == null ? void 0 : fe.sn) === Q.sn || i.vC[se].originPTS < u) {
R = se;
break;
}
}
}
i.Ci.i(zn, "clear video key time. st: " + R), i.vC.splice(R, i.vC.length - R);
}, t.logger.i(zn, "constructor"), i.Do = t, i.Ci = t.logger, i.O.push(i.Do.evt.on(w.a.PARSING_DATA, i.jl), i.Do.evt.on(w.a.RAW_DATA, i.kl), i.Do.evt.on(w.a.SEEK_WITH_LOAD, i.uC)), i;
}
y()(_, A);
var a = _.prototype;
return a.reset = function() {
this.Ci.i(zn, "reset"), this.dC = void 0, this.vC = [];
}, a.getLocalTime = function(t) {
if (!(t < 0)) {
if (this.vC.length) {
var i = this.lC(t, this.vC);
if (i)
return t - i.originPTS + i.pts;
}
return typeof this.dC == "number" ? t - this.dC : void 0;
}
}, a.getStreamTime = function(t) {
if (!(t < 0)) {
if (this.vC.length) {
var i, c = this.bC(t, this.vC);
if (c)
return this.Ci.i(zn, "get stream time by video. local: " + t + " pts: " + c.info.pts + " originPTS: " + c.info.originPTS + " sn: " + ((i = c.info.frag) == null ? void 0 : i.sn) + " key: " + this.vC.length), t - c.info.pts + c.info.originPTS;
}
return this.Ci.i(zn, "get local time by audio. local: " + t + " offset: " + this.dC), typeof this.dC == "number" ? t + this.dC : void 0;
}
}, a.getKeyFrameTime = function(t, i) {
if (i === void 0 && (i = 0), this.vC.length) {
var c = this.bC(t, this.vC);
return c ? this.vC[c.idx + i] : void 0;
}
}, a.bC = function(t, i) {
if (i) {
for (var c = i.length - 1; c >= 0; c--)
if (i[c].pts <= t)
return { info: i[c], idx: c };
}
}, a.lC = function(t, i) {
if (i) {
for (var c = i.length - 1; c >= 0; c--)
if (i[c].originPTS <= t)
return i[c];
}
}, g()(_, [{ key: "localTimeOffset", get: function() {
return this.dC;
}, set: function(t) {
this.dC = t;
} }]);
}(F.a), Hi = function(A) {
return A.SERIES_12 = "15_pro_max/15_plus/14_pro_max", A.SERIES_11 = "15_pro/15/14_pro", A.SERIES_10 = "14_plus/13_pro_max/12_pro_max", A.SERIES_9 = "14/13/13_pro/12/12_pro", A.SERIES_8 = "se_3/se_2/8/7/6s/6", A.SERIES_7 = "13_mini/12/11_pro/xs/x", A.SERIES_6 = "11_pro_max/xs_max", A.SERIES_5 = "11/xr", A.SERIES_4 = "8_plus/7_plus/6s_plus/6_plus", A.SERIES_3 = "se/5c/5s/5", A.SERIES_2 = "4s/4", A.SERIES_1 = "3gs/3g/1", A;
}({}), P_ = { "430_932_3": Hi.SERIES_12, "393_852_3": Hi.SERIES_11, "428_926_3": Hi.SERIES_10, "390_844_3": Hi.SERIES_9, "375_667_2": Hi.SERIES_8, "375_812_3": Hi.SERIES_7, "414_896_3": Hi.SERIES_6, "414_896_2": Hi.SERIES_5, "414_736_3": Hi.SERIES_4, "320_568_2": Hi.SERIES_3, "320_480_2": Hi.SERIES_2, "320_480_1": Hi.SERIES_1 };
function Kc() {
if ($.a.iphone && typeof window < "u" && window.screen) {
var A = window.screen.width + "_" + window.screen.height + "_" + window.devicePixelRatio;
return P_[A] || "unknown";
}
return "unknown";
}
var ns = n(25), U_ = new RegExp("_([0-9]+)x([0-9]+)(_([0-9]+))?(_([0-9]+))?(_(420|422|444|mono))?"), B_ = ["mono", "420", "422", "444"], no, Wc = function() {
function A() {
this._ = [];
}
var _ = A.prototype;
return _.append = function(a) {
this._.push(a);
}, _.clear = function() {
this._ = [];
}, _.getLastMseError = function() {
for (var a = this._.length - 1; a >= 0; a--) {
var t = this._[a];
if (t && t.core === h.a.mse) {
var i = t.errorData;
return i && (i.code = Object(L.d)(i.details, i.reason, i.statusCode)), i;
}
}
}, _.pC = function(a) {
return a.map(function(t) {
var i = { message: t.message, pos: t.pos, ts: t.ts };
return t.code !== void 0 && (i.code = t.code), t.core !== void 0 && (i.core = t.core), t.count !== void 0 && (i.count = t.count), t.fallback !== void 0 && (i.fallback = t.fallback), i;
});
}, g()(A, [{ key: "hasData", get: function() {
return !!this._.length;
} }, { key: "retryCount", get: function() {
return this._.reduce(function(a, t) {
return (typeof t.count == "number" && t.count > 0 ? t.count : 1) + a;
}, 0);
} }, { key: "mergedBeacon", get: function() {
var a = [];
return this._.forEach(function(t) {
var i;
if (a.length && t.type === h.k.LOADER && ((i = a[a.length - 1]) == null ? void 0 : i.type) === h.k.LOADER) {
var c = a[a.length - 1].count;
a[a.length - 1].count = c ? c + 1 : 2;
} else
a.push(s()({}, t));
}), this.pC(a.slice(-10));
} }, { key: "beacon", get: function() {
return this.pC(this._.slice(-10));
} }]);
}(), V_ = function() {
function A() {
this.coreType = h.a.unknown, this.native = !1, this.codecType = h.c.unknown, this.gopRemux = !1, this.audioCodec = "", this.recoverSwapRemux = !1, this.recoverSwapAudioCodec = !1, this.box = void 0, this.isLive = void 0, this.autoLazyLoad = !0, this.lazyLoadRecoverDuration = 12.8, this.lazyLoadMaxDuration = 16, this.firstFrameLoaded = !1, this.startFromSec = -1, this.webWorker = !0, this.muxWorker = void 0, this.isNetworkInUse = !1, this.srcType = h.l.OTHERS, this.videoPlaybackQuality = void 0, this.drm = void 0, this.mixContainerInput = void 0, this.mixCodecInput = void 0, this.mixCodecAvailable = void 0, this.srcMeta = void 0, this.multipart = void 0, this.demuxerType = void 0, this.retryInfo = new Wc(), this.mainThreadRendering = void 0, this.stereoType = void 0, this.decoder = h.d.buildin, this.wasmDecoder = void 0, this.wasmSimd = void 0, this.wasmThreads = void 0, this.wasmThreadsEnabled = void 0, this.wasmLibHitCache = void 0, this.isKwaiSlice = void 0, this.autoPlaybackRateConf = void 0, this.preferNativeLoader = void 0, this.avSeparated = !1, this.mms = !1, this.hevcFallbackWasm = !1, this.frameBufLen = 0, this.flvAbrNotAligned = !1, this.seekingId = 1, this.liveShiftKwai2Params = { paramName: "offset", time: 0 }, this.liveStartTime = 0, this.liveShiftOffset = void 0, this.liveShiftOffsetAligned = void 0, this.mC = !1, this.gC = h.g.NONE;
}
return A.prototype.reset = function() {
this.coreType = h.a.unknown, this.codecType = h.c.unknown, this.audioCodec = "", this.recoverSwapRemux = !1, this.recoverSwapAudioCodec = !1, this.box = h.i.unknown, this.autoLazyLoad = !0, this.firstFrameLoaded = !1, this.isNetworkInUse = !1, this.srcType = h.l.OTHERS, this.retryInfo.clear(), this.decoder = h.d.buildin, this.lazyLoadMaxDuration = 16, this.lazyLoadRecoverDuration = 0.8 * this.lazyLoadMaxDuration, this.isKwaiSlice = !1, this.avSeparated = !1, this.mms = !1, this.hevcFallbackWasm = !1, this.frameBufLen = 0, this.flvAbrNotAligned = !1, this.seekingId = 1, this.liveShiftKwai2Params = { paramName: "offset", time: 0 }, this.liveStartTime = 0, this.liveShiftOffset = void 0, this.mC = !1, this.gC = h.g.NONE, this.drm = this.videoPlaybackQuality = this.mixContainerInput = this.mixCodecInput = this.mixCodecAvailable = this.multipart = this.stereoType = this.mainThreadRendering = this.wasmDecoder = this.wasmSimd = this.wasmThreads = this.wasmLibHitCache = void 0;
}, g()(A, [{ key: "liveShiftActive", get: function() {
return this.liveShiftType !== h.g.NONE && this.mC;
}, set: function(_) {
this.mC = _;
} }, { key: "liveShiftType", get: function() {
return this.isLive && (this.gC !== h.g.KWAI && this.gC !== h.g.KWAI2 || !$.a.mobile) && be(this.box) ? this.gC : h.g.NONE;
}, set: function(_) {
this.gC = _;
} }]);
}(), F_ = function() {
function A() {
this.yC = 0, this._C = 0, this.CC = 0, this.IC = 0, this.OC = 0;
}
var _ = A.prototype;
return _.reset = function() {
this.CC = performance.now(), this.yC = this._C = this.IC = this.OC = 0;
}, _.getFPS = function(a) {
if (a) {
var t, i = performance.now(), c = a.totalVideoFrames, u = a.droppedVideoFrames;
if (c) {
c < this._C && (this._C = 0, this.yC = 0);
var v = i - this.CC, R = u - this.yC, Q = c - this._C, se = 0, fe = 0;
this.CC && (se = parseFloat((1e3 * R / v).toFixed(2)), fe = parseFloat((1e3 * Q / v).toFixed(2))), this.IC = this.IC += Q, this.OC = this.OC += R, this.CC = i, this.yC = u, this._C = c, t = { decoded: this.IC, dropped: this.OC, decodedFPS: fe, droppedFPS: se };
}
return this.CC = i, t;
}
}, A;
}(), Yc = "level-ctx", Qc = function() {
function A(a, t) {
this.Ci = void 0, this.An = void 0, this.fn = void 0, this.pb = !1, this.wC = -1, this.EC = 0, this.jC = 0, this.Ll = [], this.kC = 0, this.MC = [], this.SC = 0, this.BC = [], this.TC = [], this.DC = void 0, this.RC = void 0, a.i(Yc, "constructor abr:" + t), this.Ci = a, this.pb = t;
}
var _ = A.prototype;
return _.getLevel = function(a) {
return a === void 0 && (a = h.f.MAIN), a === h.f.MAIN ? this.Ll[this.EC] : a === h.f.AUDIO ? this.MC[this.kC] : a === h.f.SUBTITLE ? this.BC[this.SC] : void 0;
}, _.setLevelIdx = function(a, t) {
t === void 0 && (t = h.f.MAIN), t === h.f.MAIN ? this.currentIdx = a : t === h.f.AUDIO ? this.audioIdx = a : t === h.f.SUBTITLE && (this.subtitleIdx = a);
}, _.getLevelIdx = function(a) {
return a === void 0 && (a = h.f.MAIN), a === h.f.MAIN ? this.EC : a === h.f.AUDIO ? this.kC : a === h.f.SUBTITLE ? this.SC : -1;
}, _.setNextIdx = function(a, t) {
t === void 0 && (t = h.f.MAIN), t === h.f.MAIN && (this.nextIdx = a);
}, _.getNextIdx = function(a) {
return a === void 0 && (a = h.f.MAIN), a === h.f.MAIN ? this.jC : -1;
}, _.clearFrag = function() {
this.Ci.i(Yc, "clear"), [this.Ll, this.MC, this.BC].forEach(function(a) {
a.forEach(function(t) {
var i = t;
i.fragments && i.clear();
});
});
}, _.verifyLevelIdx = function(a) {
return this.Ll.length > 0 && a < this.Ll.length && a >= -1;
}, _.verifyAudioTrackIdx = function(a) {
return this.MC.length > 0 && a < this.MC.length && a >= 0;
}, _.verifySubtitleTracksIdx = function(a) {
return this.BC.length > 0 && a < this.BC.length && a >= 0;
}, _.abrIndexToOrign = function(a) {
var t = this.TC[a];
return t ? t.index : 0;
}, _.orignIndexToAbr = function(a) {
var t = 0;
return this.TC.forEach(function(i, c) {
i.index !== a || (t = c);
}), t;
}, _.LC = function() {
var a = this, t = this.RC;
this.DC = 0, this.TC = [], this.Ll.forEach(function(i, c) {
i.default && !t && (a.DC = c), i.enableAdaptive && (!t || t && t.indexOf(c) !== -1) && a.TC.push(i);
}), this.TC.sort(function(i, c) {
return i.bitrate - c.bitrate;
});
}, g()(A, [{ key: "hasAudio", get: function() {
return this.An;
}, set: function(a) {
this.An = a;
} }, { key: "hasVideo", get: function() {
return this.fn;
}, set: function(a) {
this.fn = a;
} }, { key: "abr", get: function() {
return this.pb;
}, set: function(a) {
this.pb = a;
} }, { key: "startIdx", get: function() {
return this.wC;
}, set: function(a) {
this.wC = a;
} }, { key: "currentIdx", get: function() {
return this.EC;
}, set: function(a) {
a >= 0 && (this.EC = a);
} }, { key: "nextIdx", get: function() {
return this.jC;
}, set: function(a) {
a >= 0 && (this.jC = a);
} }, { key: "levels", get: function() {
return this.Ll;
}, set: function(a) {
this.Ll = a, this.LC();
} }, { key: "current", get: function() {
return this.Ll[this.EC];
} }, { key: "currentUrl", get: function() {
var a = this.Ll[this.EC];
return (a == null ? void 0 : a.currentUrl) || "";
} }, { key: "audioIdx", get: function() {
return this.kC;
}, set: function(a) {
a >= 0 && (this.kC = a);
} }, { key: "audioTracks", get: function() {
return this.MC;
}, set: function(a) {
this.MC = a;
} }, { key: "audio", get: function() {
return this.MC[this.kC];
} }, { key: "subtitleIdx", get: function() {
return this.SC;
}, set: function(a) {
a >= 0 && (this.SC = a);
} }, { key: "subtitleTracks", get: function() {
return this.BC;
}, set: function(a) {
this.BC = a;
} }, { key: "subtitle", get: function() {
return this.BC[this.SC];
} }, { key: "abrLevels", get: function() {
return this.TC;
} }, { key: "availableList", set: function(a) {
this.RC = a, this.LC();
} }, { key: "default", get: function() {
return this.DC || 0;
}, set: function(a) {
this.DC = a;
} }, { key: "abrDefault", get: function() {
var a = 0;
return this.TC.forEach(function(t, i) {
t.default && (a = i);
}), a;
} }]);
}(), Xc = function() {
function A() {
this.NC = 0, this.QC = [], this.xC = [], this.VC = {}, this.UC = {}, this.FC = void 0, this.PC = 0, this.HC = 0, this.YC = 0, this.GC = 0, this.KC = 0, this.ZC = 0, this.WC = 0;
}
var _ = A.prototype;
return _.onStreamOpen = function(a, t, i, c) {
if (this.QC.length > 10) {
var u = this.QC.shift();
if (u) {
this.VC[u.vCodecType] = (this.VC[u.vCodecType] || 0) + u.traffic;
var v = u.qualityType || "unknown";
this.UC[v] = (this.UC[v] || 0) + u.traffic;
}
}
var R = this.FC ? this.FC.index + 1 : 0;
this.FC = { index: R, startPos: a, url: t, bitrate: i, qualityType: c, traffic: 0, loadTimeCost: 0, keyFrame: 0, videoDataRate: 0, audioDataRate: 0, speed: 0, vCodecType: h.c.unknown, segments: [] }, this.QC.push(this.FC);
}, _.onMediaInfo = function(a) {
var t = this.QC[this.QC.length - 1];
t && (a.videoCodecType && (t.vCodecType = a.videoCodecType), t.mediaInfo = s()({}, a));
}, _.setRTCStats = function(a) {
var t = this.FC;
t && (t.traffic = a.totalReceive, t.audioDataRate = a.audioDataRate, t.videoDataRate = a.videoDataRate, t.speed = a.speed, t.keyFrame = a.key, this.NC = t.traffic);
}, _.onDataReceive = function(a) {
this.NC += a.byteLength;
var t = this.xC;
t.length > 200 && t.pop(), t.unshift(a);
var i = this.FC;
i && (i.traffic += a.byteLength, i.loadTimeCost += a.timeCost, i.speed = Math.round(i.traffic / i.loadTimeCost * 1e3) || 0);
}, _.onParsing = function(a) {
var t = this;
a.segments.forEach(function(i) {
if (t.XC(i.type, 1e3 * (i.endDTS - i.startDTS), i.payload.byteLength), i.type === h.o.VIDEO) {
var c = i.endDTS - i.startDTS;
isNaN(c) || (t.YC += Math.round(1e3 * c)), i.fillDuration && (t.KC += Math.round(1e3 * i.fillDuration)), i.droppedDuration && (t.WC += Math.round(1e3 * i.droppedDuration));
}
if (i.type === h.o.AUDIO) {
var u = i.endDTS - i.startDTS;
isNaN(u) || (t.HC += Math.round(1e3 * u)), i.fillDuration && (t.GC += Math.round(1e3 * i.fillDuration)), i.droppedDuration && (t.ZC += Math.round(1e3 * i.droppedDuration));
}
});
}, _.onRaw = function(a) {
if (a.samples.length) {
var t = a.samples.reduce(function(c, u) {
return u.yuv ? c + u.yuv.y.bytes.length + u.yuv.u.bytes.length + u.yuv.v.bytes.length : c + u.units.reduce(function(v, R) {
return v + R.data.byteLength;
}, 0);
}, 0), i = a.samples[a.samples.length - 1].dts - a.samples[0].dts + (a.samples[a.samples.length - 1].duration || 0);
this.XC(h.o.VIDEO, i / 90, t);
}
}, _.downloadInfoByRange = function(a) {
a === void 0 && (a = 1e3);
var t = { size: 0, timeCost: 0 };
if (this.xC.length)
for (var i = performance.now(), c = 0; c < this.xC.length; c++) {
var u = this.xC[c];
if (!(u && u.ts > i - a))
break;
t.size += u.byteLength, t.timeCost += u.timeCost;
}
return t;
}, _.XC = function(a, t, i) {
var c = this.QC[this.QC.length - 1];
if (c) {
var u = c.segments;
u.push({ type: a, duration: t, byteLength: i }), u.length > 200 && u.shift();
for (var v = 0, R = 0, Q = 0; Q < u.length; Q++) {
var se = u[Q];
se && se.type === a && (R += se.byteLength, v += se.duration);
}
v > 0 && (a === h.o.VIDEO ? c.videoDataRate = Math.round(8 * R / v) : a === h.o.AUDIO && (c.audioDataRate = Math.round(8 * R / v)));
}
}, g()(A, [{ key: "smoothedDownloadSpeed", get: function() {
var a = this.xC, t = a[0];
return t && !t.progress ? t.byteLength / t.timeCost * 1e3 : 1e3 * a.reduceRight(function(i, c) {
var u = c.byteLength / c.timeCost;
return i > 0 ? u * (1 - 0.9) + 0.9 * i : u;
}, 0);
} }, { key: "trafficGroupedByVCodecType", get: function() {
var a = s()({}, this.VC);
return a.total = this.NC, this.QC.forEach(function(t) {
a[t.vCodecType] = (a[t.vCodecType] || 0) + t.traffic;
}), a;
} }, { key: "trafficGroupedByLevel", get: function() {
var a = s()({}, this.UC);
return a.total = this.NC, this.QC.forEach(function(t) {
var i = t.qualityType || "unknown";
a[i] = (a[i] || 0) + t.traffic;
}), a;
} }, { key: "traffic", get: function() {
return this.NC;
} }, { key: "speed", get: function() {
var a = this.FC, t = this.downloadInfoByRange();
return this.xC.length ? t.timeCost ? Math.round(t.size / t.timeCost * 1e3) : 0 : (a == null ? void 0 : a.speed) || 0;
} }, { key: "currentLoad", get: function() {
return this.FC;
} }, { key: "streams", get: function() {
return this.QC;
} }, { key: "contentLen", get: function() {
return this.PC;
}, set: function(a) {
this.PC = a;
} }, { key: "muxA", get: function() {
return this.HC;
} }, { key: "muxV", get: function() {
return this.YC;
} }, { key: "fillA", get: function() {
return this.GC;
} }, { key: "fillV", get: function() {
return this.KC;
} }, { key: "droppedA", get: function() {
return this.ZC;
} }, { key: "droppedV", get: function() {
return this.WC;
} }]);
}(), j_ = n(42), H_ = ((no = {})[h.q.FHD] = "data:video/mp4;base64,AAAAHGZ0eXBpc29tAAACAGlzb21pc28ybXA0MQAAA1Btb292AAAAbG12aGQAAAAAAAAAAAAAAAAAAAPoAAADmAABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAACenRyYWsAAABcdGtoZAAAAAMAAAAAAAAAAAAAAAEAAAAAAAADmAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAHgAAABDgAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAA5gAAXcAAAEAAAAAAfJtZGlhAAAAIG1kaGQAAAAAAAAAAAAAAAAAEk+AABJPgFXEAAAAAAAhaGRscgAAAAAAAAAAdmlkZQAAAAAAAAAAAAAAAAAAAAGpbWluZgAAABR2bWhkAAAAAQAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAABaXN0YmwAAAEFc3RzZAAAAAAAAAABAAAA9Wh2YzEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAHgAQ4AEgAAABIAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY//8AAAB7aHZjQwEBYAAAAJAAAAAAAHjwAPz9+PgAAA8DoAABABhAAQwB//8BYAAAAwCQAAADAAADAHiVmAmhAAEALkIBAQFgAAADAJAAAAMAAAMAeKADwIAQ5ZZWaSTK8BagIIBAgAAAAwCAAAADAISiAAEAB0QBwXK0YkAAAAAQcGFzcAAAAAEAAAABAAAAFGJ0cnQAAAAAAAAV+AAAFfgAAAAYc3R0cwAAAAAAAAABAAAAAQAST4AAAAAcc3RzYwAAAAAAAAABAAAAAQAAAAEAAAABAAAAFHN0c3oAAAAAAAACvwAAAAEAAAAUc3RjbwAAAAAAAAABAAADfAAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNjAuMTYuMTAwAAAACGZyZWUAAALHbWRhdAAAABhAAQwB//8BYAAAAwCQAAADAAADAHiVmAkAAAAuQgEBAWAAAAMAkAAAAwAAAwB4oAPAgBDlllZpJMrwFqAggECAAAADAIAAAAMAhAAAAAdEAcFytGJAAAACYigBrxMImujggedddccbbbbbbuZo4//8Qs/H9kAtWJjtrvgCQAzQ8gAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwFbpe9yuAXAHyJgAAADAAADAAADAAADAAADAAADAAADAAADAAFJkwKEKkAAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAZEhwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwPuAAADAAADAAADAAADAAADAAADAAADAAADAAADAAAHpAAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwABzQAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAUMAAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwBsQAAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwGHAAADAAADAAADAAADAAADAAADAAADAAADAAADAtoAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAWMAAADAAADAAADAAADAAADAAADAAADAAADAAAJCAAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAADygAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAABawAAADAAADAAADAAADAAADAAADAAADAAADAAAhYAAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAALeAFwEAAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAUUA=", no[h.q.UHD_4K] = "data:video/mp4;base64,AAAAHGZ0eXBpc29tAAACAGlzb21pc28ybXA0MQAAA1Ftb292AAAAbG12aGQAAAAAAAAAAAAAAAAAAAPoAAADmAABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAACe3RyYWsAAABcdGtoZAAAAAMAAAAAAAAAAAAAAAEAAAAAAAADmAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAPAAAACHAAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAA5gAAXcAAAEAAAAAAfNtZGlhAAAAIG1kaGQAAAAAAAAAAAAAAAAAEk+AABJPgFXEAAAAAAAhaGRscgAAAAAAAAAAdmlkZQAAAAAAAAAAAAAAAAAAAAGqbWluZgAAABR2bWhkAAAAAQAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAABanN0YmwAAAEGc3RzZAAAAAAAAAABAAAA9mh2YzEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAPAAhwAEgAAABIAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY//8AAAB8aHZjQwEBYAAAAJAAAAAAAJbwAPz9+PgAAA8DoAABABhAAQwB//8BYAAAAwCQAAADAAADAJaVmAmhAAEAL0IBAQFgAAADAJAAAAMAAAMAlqAB4CACHFllZpJMrwFqAggECAAAAwAIAAADAAhAogABAAdEAcFytGJAAAAAEHBhc3AAAAABAAAAAQAAABRidHJ0AAAAAAAAQGgAAEBoAAAAGHN0dHMAAAAAAAAAAQAAAAEAEk+AAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAABRzdHN6AAAAAAAACA0AAAABAAAAFHN0Y28AAAAAAAAAAQAAA30AAABidWR0YQAAAFptZXRhAAAAAAAAACFoZGxyAAAAAAAAAABtZGlyYXBwbAAAAAAAAAAAAAAAAC1pbHN0AAAAJal0b28AAAAdZGF0YQAAAAEAAAAATGF2ZjYwLjE2LjEwMAAAAAhmcmVlAAAIFW1kYXQAAAAYQAEMAf//AWAAAAMAkAAAAwAAAwCWlZgJAAAAL0IBAQFgAAADAJAAAAMAAAMAlqAB4CACHFllZpJMrwFqAggECAAAAwAIAAADAAhAAAAAB0QBwXK0YkAAAAevKAGvEwRHlP3jty4cOG7Zs2bNmzZs2bNWrVq1atWrVq1atWvmaOP//ELPx/ZALViY7a74AkAM0PIAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAX8Cl73K4BcAfImAAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAIWAkwKEKkAAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMDMocAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMCkgAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAABgwAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAasAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAFZAAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAg4AAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMCJgAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAABFQAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAkIAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAAPqAAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAHJAAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAACugAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAABDQAAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAX8AAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAIqAAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAC2gAAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAA54AAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAASkAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAXUAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAdMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAhYAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAmoAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAq4AAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAvoAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAA04AAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAA5IAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAA84AAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAA+oAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMABCwAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMABEwAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMABHQAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAgIA=", no), $c = "kwai-kernel-hevc", hn = "playback-hevc-test", Zc = function() {
function A(a) {
var t = this;
this.Ci = void 0, this.uf = new G(), this.zC = void 0, this.JC = [h.q.FHD, h.q.UHD_4K], this.qC = 0, this.$C = void 0, this.tI = function() {
var i, c;
t.Ci.i(hn, "on video event. " + ((i = A.iI) == null ? void 0 : i.videoWidth) + " " + ((c = A.iI) == null ? void 0 : c.error)), t.$C ? (t.$C[t.JC[t.qC]] = !!A.iI && A.iI.videoWidth > 0 && !A.iI.error, t.qC++, t.qC < t.JC.length ? (t.eI(), t.nI(t.JC[t.qC])) : t.sI()) : t.sI();
}, this.Ci = a;
}
var _ = A.prototype;
return _.init = function(a) {
if (this.Ci.i(hn, "init"), a > 0) {
var t = this.uf.read($c, a);
this.Ci.i(hn, "load from ls", t);
try {
t !== void 0 && Object.prototype.hasOwnProperty.call(t, h.q.FHD) && Object.prototype.hasOwnProperty.call(t, h.q.UHD_4K) && (ht.playHEVCTest = t, this.$C = ht.playHEVCTest);
} catch (i) {
this.Ci.i(hn, "load ls error");
}
}
}, _.start = function() {
var a;
this.Ci.i(hn, "start");
var t = this.$C !== void 0 || A.iI;
this.Ci.i(hn, "start. tested: " + t), t || (a = A.iI) != null && a.src || this.rI();
}, _.destroy = function() {
this.Rf(), this.eI();
}, _.sI = function() {
this.Ci.i(hn, "complete result:", this.$C, performance.now()), this.Rf(), this.eI(), ht.playHEVCTest = this.$C, this.uf.write($c, this.$C);
}, _.rI = function() {
var a;
this.Ci.i(hn, "start video test"), ge() ? this.sI() : (this.Rp(), this.$C = ((a = {})[h.q.FHD] = !1, a[h.q.UHD_4K] = !1, a), this.qC = 0, this.nI(this.JC[0]));
}, _.nI = function(a) {
this.Ci.i(hn, "test: " + a), A.iI || (A.iI = document.createElement("video")), A.iI.preload = "metadata", A.iI.addEventListener("error", this.tI), A.iI.addEventListener("loadeddata", this.tI), A.iI.addEventListener("loadedmetadata", this.tI), A.iI.src = H_[a], A.iI.play().catch(function() {
});
}, _.eI = function() {
A.iI && (A.iI.removeEventListener("error", this.tI), A.iI.removeEventListener("loadeddata", this.tI), A.iI.removeEventListener("loadedmetadata", this.tI), A.iI.src = "");
}, _.Rp = function() {
var a = this;
this.Rf(), this.zC = setTimeout(function() {
a.Ci.i(hn, "timeout"), a.sI();
}, 1e3);
}, _.Rf = function() {
this.zC && (clearTimeout(this.zC), this.zC = void 0);
}, A;
}();
Zc.iI = void 0;
var G_ = Zc, pi = "av-ctx", qc = function(A) {
function _(t, i) {
var c;
return (c = A.call(this) || this).video = void 0, c.mse = void 0, c.stat = new V_(), c.loadRec = void 0, c.lctx = void 0, c.hI = [], c.oI = 0, c.aI = 0, c.uI = void 0, c.di = void 0, c.cI = !1, c.fI = !1, c.Na = void 0, c.AI = void 0, c.vI = new F_(), c.dI = void 0, c.lI = void 0, c.At = void 0, c.Ci = void 0, c.Ai = void 0, c.bI = void 0, c.pI = void 0, c.mI = void 0, c.At = ro.next(), c.Ci = new Ra.Logger().setName(Ve.m).setId(c.At), c.Ai = new kc.a(), c.video = i, c.AI = new Ys(c.Ci), c.lI = new G_(c.Ci), c.lctx = new Qc(c.Ci, !0), c.bI = new Re(c), c.pI = new M_(c), c.mI = new x_(c), c.gI(Ia.processConfig(t)), c.AI && c.O.push(c.AI), c.O.push(c.lI, c.bI, c.pI, c.mI), c;
}
y()(_, A);
var a = _.prototype;
return a.destroy = function() {
var t;
this.logger.i(pi, "destroy"), (t = this.stat.muxWorker) == null || t.terminate(), this.yI(), this._I(), this.Ai.removeAllListeners(), A.prototype.destroy.call(this);
}, a.updateVideoPlaybackQuality = function(t, i) {
this.stat.videoPlaybackQuality ? (this.stat.videoPlaybackQuality.droppedVideoFrames = i, this.stat.videoPlaybackQuality.totalVideoFrames = t) : this.stat.videoPlaybackQuality = { corruptedVideoFrames: 0, creationTime: 0, droppedVideoFrames: i, totalVideoFrames: t };
}, a.isTimeinBuffered = function(t) {
if (this.video) {
for (var i = this.video.buffered, c = 0; c < i.length; c++)
if (t >= i.start(c) && t < i.end(c))
return !0;
}
return !1;
}, a.currentBuffer = function(t) {
if (this.video)
for (var i = this.video.buffered, c = 0; c < i.length; c++) {
var u = i.start(c), v = i.end(c);
if (u <= t && t < v)
return { start: u, end: v };
}
}, a.nextBuffer = function(t) {
if (this.video)
for (var i = this.video.buffered, c = 0; c < i.length; c++) {
var u = i.start(c), v = i.end(c);
if (u > t)
return { start: u, end: v };
}
}, a.getLiveShiftKwai2OffsetUTC = function(t) {
return this.stat.liveStartTime + t;
}, a.getLiveShiftKwai2Duration = function() {
return (this.AI.now - this.stat.liveStartTime) / 1e3;
}, a.getKwai2LiveShiftReloadInterval = function() {
var t = this.lctx.current;
if (t) {
if (t.fragments.length > 1 && typeof this.stat.liveShiftOffset == "number") {
var i = t.fragments[t.fragments.length - 2];
return Math.max((t.averagetargetduration || t.targetduration) * Ve.f, (this.stat.liveShiftOffsetAligned || this.stat.liveShiftOffset) + i.start * Ve.f - this.currentTime * Ve.f) / this.playbackRate;
}
return (t.averagetargetduration || t.targetduration) * Ve.f / this.playbackRate;
}
return 10 * Ve.f / this.playbackRate;
}, a.getKwai2LiveShiftUrl = function(t) {
var i = this.lctx.current, c = ze()(t, !0), u = this.stat.liveShiftKwai2Params;
if (this.AI) {
if (u.paramName === "seqId") {
var v = i.fragments[i.fragments.length - 1], R = u.seqId || (v == null ? void 0 : v.sn);
if (typeof R == "number")
return c.query.seqID = R.toString(), c.toString();
}
return u.time = Math.round(this.getLiveShiftKwai2OffsetUTC(this.stat.liveShiftOffset || 0)), c.query.startTime = u.time.toString(), c.toString();
}
return c.toString();
}, a.getLiveDelay = function() {
var t = this.stat, i = this.di, c = 10;
if (t.multipart) {
var u = this.lctx.current;
c = (u == null ? void 0 : u.averagetargetduration) || (u == null ? void 0 : u.targetduration) || c;
}
return t.box === h.i.flv ? -this.di.defaultSpts : be(t.box) ? this.isLiveShift ? i.liveShiftDelaySec * Ve.f : c * Ve.f * (i.liveDelayFragNum || 1) : -this.di.defaultSpts;
}, a.initLiveShiftKwai2StartSec = function() {
if (this.isLiveShiftKwai2) {
var t = this.stat.startFromSec >= 0 ? this.stat.startFromSec : this.liveLocalTime;
this.Ci.i(pi, "init liveshift kwai2 start from sec: " + t + " startFromSec: " + this.stat.startFromSec + " live: " + this.liveLocalTime + " duration: " + this.getLiveShiftKwai2Duration()), t > 0 && (this.stat.startFromSec = t, this.stat.liveShiftOffset = 1e3 * t, this.stat.liveShiftOffsetAligned = void 0, this.updateLiveShiftStatuByTime(t));
}
}, a.getRemuxConfig = function() {
var t = this.di, i = { isLive: this.stat.isLive, logLevel: t.logLevel, enableSoftwareAES: t.enableSoftwareAES, gopRemux: this.stat.gopRemux, preferDecoder: t.preferDecoder, streamingMux: this.streamingMux, ensureVideo: t.ensureVideo, maxAudioFramesDrift: t.maxAudioFramesDrift, forceKeyFrameOnDiscontinuity: t.forceKeyFrameOnDiscontinuity, wasmDecoderEnabled: t.wasmDecoderEnabled, enableAacPriv: t.enableAacPriv, audioEnabled: t.audioEnabled, videoEnabled: t.videoEnabled, mseDecErrSkip: t.mseDecErrSkip, adjustFragTime: t.adjustFragTime };
return this.video instanceof HTMLAudioElement && (this.Ci.i(pi, "HTMLAudioElement. set videoEnabled false."), i.videoEnabled = !1), i;
}, a.getDecConfig = function() {
var t = this.di;
return { logLevel: t.logLevel, videoDropFramePolicy: t.videoDropFramePolicy, videoFrameBufferSize: t.videoFrameBufferSize, videoDecBlockPolicy: t.videoDecBlockPolicy, maxVideoDecThreads: t.maxVideoDecThreads, mainThreadRendering: t.mainThreadRendering, mainThreadDecoding: t.mainThreadDecoding, preferCanvasType: t.preferCanvasType, preferCanvasColorSpace: t.preferCanvasColorSpace };
}, a.setSrc = function(t, i) {
this.logger.i(pi, "set src", t), t && (this.d_(), this.resetStreamingEnabled(), this.dI = void 0, this.loadRec = new Xc()), this.CI(t, i);
}, a.reProcessSrc = function(t, i) {
this.logger.i(pi, "reprocess src. codecType: " + t + " native: " + i + ", has origin src: " + !!this.uI), this.uI && this.II(this.uI, t, i);
}, a.updateLiveShiftStatuByTime = function(t) {
var i;
if (this.isLiveShift && (t === void 0 && (t = (i = this.video) == null ? void 0 : i.currentTime), this.lctx.current && typeof t == "number" && Number.isFinite(t))) {
var c = this.liveLocalTime;
c > 0 && (this.stat.liveShiftActive = !!(c && t < c - 5), this.Ci.i(pi, "update live shift statu by time. type: " + this.stat.liveShiftType + " " + this.stat.liveShiftActive + ", time: " + t + " ed: " + c));
}
}, a.resetStreamingEnabled = function() {
var t = this.di;
this.cI = this.fI = !(!t.streamingMux || !Ia.isStreamingSupported() || $.a.msie || $.a.safari && (this.stat.isLive === !1 || this.stat.multipart) || $.a.msedge && $.a.version.major < 88 && (this.stat.isLive === !1 || this.stat.multipart)), this.logger.i(pi, "resetStreamingEnabled: " + this.cI);
}, a.resetGopRemux = function() {
this.stat.multipart && !this.cI ? this.stat.gopRemux = !1 : this.stat.gopRemux = !!($.a.safari || $.a.opera && $.a.version.major < 37), this.logger.i(pi, "resetGopRemux: " + this.stat.gopRemux);
}, a.hasNextMediaDesc = function() {
return this.oI + 1 < this.hI.length;
}, a.nextMediaDesc = function() {
if (this.hasNextMediaDesc()) {
this.oI++;
var t = this.hI[this.oI];
if (t)
return this.Ci.i(pi, "next media desc."), this.OI(t), !0;
}
return !1;
}, a.gI = function(t) {
if (this.di = t, !t.logLevel) {
var i = Ra.Logger.loadLogLevel(Ve.l);
t.logLevel = i || Ra.DEFAULT_LOG_LEVEL;
}
var c;
if (t.logger && this.Ci.setOutput(t.logger), this.Ci.setLevel(t.logLevel), this.Ci.getLevel() !== Ra.LogLevel.NONE && (c = _.version, $.a.msie || console.log("%c kwai-player-kernel %c " + c + " %c", "background:#35495e ; padding: 1px; border-radius: 4px 0 0 4px; color: #fff", "background:#ffa483 ; padding: 1px; border-radius: 0 4px 4px 0; color: #fff", "background:transparent")), this.logger.i(pi, "logger init."), this.logger.i(pi, "set config"), this.lI.init(this.di.playbackAbilityCacheTimeout), this.resetStreamingEnabled(), this.logger.i(pi, "browser", JSON.stringify($.a)), ge() || this.logger.i(pi, "ua", navigator.userAgent), this.d_(), this.dI = void 0, this.stat.startFromSec = t.startFromSec >= 0 ? t.startFromSec : typeof t.startFrom == "number" && t.startFrom >= 0 ? t.startFrom / 1e3 : -1, this.stat.webWorker = t.webWorker && !!j_.default, typeof t.preferNativeLoader == "boolean" && (this.stat.preferNativeLoader = t.preferNativeLoader), this.di.autoPlaybackRateConf)
this.logger.i(pi, "use config.autoPlaybackRateConf", this.di.autoPlaybackRateConf), this.stat.autoPlaybackRateConf = this.di.autoPlaybackRateConf;
else {
var u = -Math.floor(this.di.defaultSpts / Ve.f);
this.stat.autoPlaybackRateConf = function(v, R, Q) {
Q === void 0 && (Q = 3);
var se = { startDelay: 0, interval: 0.6, rule: [] };
return Ae(v, R, Q, se), se;
}(this.Ci, u), this.logger.i(pi, "use default autoPlaybackRateConf", this.stat.autoPlaybackRateConf), this.Ci.i(pi, "get by delay: " + u);
}
try {
this.stat.webWorker && (this.stat.muxWorker = ae()(42)), Ys.workerTimeOffset = performance.now(), this.logger.i(pi, "init mux worker");
} catch (v) {
}
t.lazyLoadMaxDuration > 0 && t.lazyLoadRecoverDuration > 0 && t.lazyLoadMaxDuration >= t.lazyLoadRecoverDuration && (this.stat.lazyLoadMaxDuration = t.lazyLoadMaxDuration, this.stat.lazyLoadRecoverDuration = t.lazyLoadRecoverDuration), this.loadRec = new Xc(), t.src && this.CI(t.src);
}, a.d_ = function() {
this.logger.i(pi, "reset stat");
var t = this.di, i = this.stat;
this.fI = this.cI;
var c = i.preferNativeLoader;
i.reset(), this.resetGopRemux(), this.pI.reset(), this.bI.reset(), i.isLive = t.isLive, i.native = t.nativeFirst, i.liveShiftType = this.di.liveShiftType, i.preferNativeLoader = c, this.stat = i;
}, a.CI = function(t, i) {
this.oI = 0, this.aI = Date.now(), this.II(t, i);
}, a.II = function(t, i, c) {
this.Ci.i(pi, "process src. codec: " + i + " native: " + c), t && (this.uI = t);
var u = this.config;
this.hI = Ks.preParse(this.Ci, t, typeof c == "boolean" ? c : u.nativeFirst, i, u.baseURL);
var v = this.hI[this.oI];
v && this.OI(v);
}, a.OI = function(t) {
var i, c, u, v, R, Q, se = this.config, fe = this.stat;
(i = this.Na) == null || i.reset(), this.stat.srcType === h.l.FILE && this.yI();
var ke, Fe, Ne = this.lctx = new Qc(this.Ci, se.adaptive);
if (fe.codecType = t.codecType ? t.codecType : h.c.unknown, fe.box = se.box || t.box || h.i.unknown, fe.srcType = t.srcType, fe.mixContainerInput = t.mixContainerInput, fe.mixCodecInput = t.mixCodecInput, fe.mixCodecAvailable = t.mixCodecAvailable, fe.multipart = t.multipart, fe.stereoType = (c = t.mediaLevels) == null ? void 0 : c.stereoType, (u = t.mediaLevels) != null && u.meta && (fe.srcMeta = (ke = t.mediaLevels) == null ? void 0 : ke.meta, this.liveTime && typeof t.mediaLevels.meta.programStartTime == "number" && (this.stat.liveStartTime = t.mediaLevels.meta.programStartTime)), se.liveDelayFragNum && se.liveDelayFragNum > 0 && fe.multipart && !se.autoPlaybackRateConf) {
var He = this.getLiveDelay();
Ae(this.Ci, He / 1e3, 10, fe.autoPlaybackRateConf), this.Ci.i(pi, "update by delay: " + He + ".", se);
}
t.nativeFirst !== void 0 && (fe.native = t.nativeFirst), typeof t.isLive == "boolean" && (fe.isLive = t.isLive), t.isLiveShift === !0 && (fe.liveShiftType = h.g.KWAI2), typeof ((v = t.mediaLevels) == null ? void 0 : v.isLive) == "boolean" && (fe.isLive = t.mediaLevels.isLive), Ne.hasAudio = (R = t.mediaLevels) == null ? void 0 : R.hasAudio, Ne.hasVideo = (Q = t.mediaLevels) == null ? void 0 : Q.hasVideo, !t.mediaLevels || t.srcType === h.l.OTHERS && be(fe.box) && !fe.native || (this.Ci.i(pi, "src. get levels from src."), fe.drm = t.mediaLevels.drm, this.lctx.levels = t.mediaLevels.levels, this.lctx.default = this.lctx.currentIdx = t.mediaLevels.def, t.mediaLevels.audioTracks && (this.lctx.audioTracks = t.mediaLevels.audioTracks, this.lctx.audioIdx = t.mediaLevels.defAudio || 0), t.mediaLevels.subtitleTracks && (this.lctx.subtitleTracks = t.mediaLevels.subtitleTracks, this.lctx.subtitleIdx = t.mediaLevels.defSubtitle || 0)), this.lctx.default = function(rt) {
if (!$.a.mobile || rt.levels.length <= 1 || rt.levels[0].vCodecType !== h.c.hevc)
return rt.default;
var Qe, _t;
if (rt.levels.forEach(function(Rt, gi) {
if (Rt.width && Rt.height) {
var Ht = Math.min(Rt.width, Rt.height);
Ht > 720 ? _t = _t && Ht > _t.minWH ? _t : { idx: gi, minWH: Ht } : Qe = Qe && Qe.minWH > Ht ? Qe : { idx: gi, minWH: Ht };
}
}), !Qe || !_t)
return rt.default;
if ($.a.android)
return parseFloat($.a.platformVersion || "") >= 10 ? _t.idx : Qe.idx;
if ($.a.iphone) {
var dt = Kc();
return dt === "unknown" ? typeof window < "u" && window.screen && (window.screen.width > 400 || window.devicePixelRatio > 2) ? _t.idx : Qe.idx : [Hi.SERIES_1, Hi.SERIES_2, Hi.SERIES_3, Hi.SERIES_4, Hi.SERIES_8].indexOf(dt) === -1 ? _t.idx : Qe.idx;
}
return rt.default;
}(this.lctx), t.box === h.i.yuv && (this.dI = function(rt) {
if (rt) {
var Qe = rt.match(U_);
if (Qe && Qe.length > 2) {
var _t = parseInt(Qe[1]), dt = parseInt(Qe[2]), Rt = Qe[4] ? parseInt(Qe[4]) : Ve.d, gi = Qe[6] ? parseInt(Qe[6]) : 8, Ht = ns.a.AV_PIX_FMT_YUV420P;
Qe[8] !== void 0 && (Ht = B_.indexOf(Qe[8]));
var Pi = 0, Oi = 0;
return Ht === ns.a.AV_PIX_FMT_YUV420P ? (Pi = _t / 2, Oi = dt / 2) : Ht === ns.a.AV_PIX_FMT_YUV422P ? (Pi = _t / 2, Oi = dt) : Ht === ns.a.AV_PIX_FMT_YUV444P ? (Pi = _t, Oi = dt) : (Pi = 0, Oi = 0), { width: _t, height: dt, chroma: Ht, chromaWidth: Pi, chromaHeight: Oi, cropLeft: 0, cropTop: 0, cropWidth: _t, cropHeight: dt, displayWidth: _t, displayHeight: dt, pts: 0, fps: Rt, bpp: gi, dataSize: (_t * dt + Pi * Oi * 2) * (gi > 8 ? 2 : 1) };
}
}
}(t.src instanceof File ? t.src.name : this.lctx.currentUrl)), this.config.ntp && this.stat.isLive !== !1 && this.stat.box === h.i.flv && ((Fe = this.AI) == null || Fe.ntpSync(this.stat.preferNativeLoader)), this.resetStreamingEnabled(), this.resetGopRemux(), this.logger.i(pi, "use media desc complete. box: " + fe.box + " live: " + fe.isLive + " native: " + fe.native + " mobile: " + !!$.a.mobile + " gopRemux: " + fe.gopRemux + " streamingMux: " + this.streamingMux + " liveShift: " + fe.liveShiftType + " mixCodec: " + fe.mixCodecInput + " levelCnt: " + Ne.levels.length + " hasVideo: " + Ne.hasVideo + " hasAudio: " + Ne.hasAudio);
}, a.yI = function() {
this.lctx && this.lctx.levels.forEach(function(t) {
t.url.forEach(function(i) {
i.indexOf("blob:") === 0 && URL.revokeObjectURL(i);
});
});
}, a._I = function() {
this.Na && (this.Na.destroy(), this.Na = void 0);
}, g()(_, [{ key: "isLiveShiftKwai2", get: function() {
return this.stat.liveShiftType === h.g.KWAI2;
} }, { key: "isLiveShift", get: function() {
return this.stat.liveShiftType !== h.g.NONE;
} }, { key: "logger", get: function() {
return this.Ci;
} }, { key: "id", get: function() {
return this.At;
} }, { key: "live", get: function() {
return !(!this.stat.isLive || this.stat.liveShiftActive);
} }, { key: "isDownloadInterruptible", get: function() {
return !(this.live && this.stat.multipart === !1);
} }, { key: "liveLocalTime", get: function() {
var t = this.lctx.current;
if (this.isLiveShift) {
var i, c, u = Number.isFinite((i = this.video) == null ? void 0 : i.duration) ? (c = this.video) == null ? void 0 : c.duration : this.isLiveShiftKwai2 ? this.getLiveShiftKwai2Duration() : (t == null ? void 0 : t.totalduration) || 0;
if (u)
return u - (this.getLiveDelay() / Ve.f + 0.1);
} else if (t && t.totalduration)
return t.totalduration - (this.getLiveDelay() / Ve.f + 0.1);
return 0;
} }, { key: "yuvParams", get: function() {
return this.dI;
} }, { key: "canCodecFallback", get: function() {
return !(!this.stat.mixCodecInput || this.stat.codecType === h.c.h264 || this.stat.mixCodecInput.indexOf(h.c.h264) === -1 || this.stat.decoder !== h.d.buildin);
} }, { key: "fps", get: function() {
return this.vI;
} }, { key: "liveTime", get: function() {
return this.AI;
} }, { key: "cOutput", get: function() {
if (X.a)
return this.Na || (this.Na = new X.a(this.Ci, this.di)), this.Na;
} }, { key: "isAbrAvailable", get: function() {
return this.di.adaptive && this.lctx.levels.length > 1 && !this.isSwitchLevelByReload && !this.isLiveShift;
} }, { key: "isSwitchLevelByReload", get: function() {
return !(this.stat.box === h.i.flv && this.stat.isLive !== !1 && !$.a.firefox && this.di.videoEnabled !== !1 || be(this.stat.box));
} }, { key: "mediaBufferedSec", get: function() {
return this.video && this.video.buffered && this.video.buffered.length ? { start: this.video.buffered.start(0), end: this.video.buffered.end(this.video.buffered.length - 1) } : { start: 0, end: 0 };
} }, { key: "bufferedSt", get: function() {
return this.video && this.video.buffered.length ? this.video.buffered.start(0) : -1;
} }, { key: "bufferedEnd", get: function() {
return this.video && this.video.buffered.length ? this.video.buffered.end(this.video.buffered.length - 1) : 0;
} }, { key: "bufferedSec", get: function() {
return this.video && this.video.buffered.length > 0 ? Math.max(0, this.video.buffered.end(this.video.buffered.length - 1) - this.video.currentTime) : 0;
} }, { key: "bufferSliceNum", get: function() {
return this.video ? this.video.buffered.length : 0;
} }, { key: "currentTime", get: function() {
return this.video ? this.video.currentTime : 0;
} }, { key: "playbackRate", get: function() {
return this.video ? this.video.playbackRate : 1;
} }, { key: "config", get: function() {
return this.di;
} }, { key: "src", get: function() {
var t;
return ((t = this.hI[this.oI]) == null ? void 0 : t.src) || "";
} }, { key: "srcUpdateTime", get: function() {
return this.aI;
} }, { key: "originSrc", get: function() {
return this.uI;
} }, { key: "videoPlaybackQuality", get: function() {
return this.stat.videoPlaybackQuality ? this.stat.videoPlaybackQuality : this.video instanceof HTMLVideoElement ? this.video.getVideoPlaybackQuality !== void 0 ? this.video.getVideoPlaybackQuality() : { corruptedVideoFrames: 0, creationTime: 0, droppedVideoFrames: this.video.webkitDecodedFrameCount || 0, totalVideoFrames: this.video.webkitDroppedFrameCount || 0 } : void 0;
} }, { key: "demuxerType", get: function() {
return this.stat.demuxerType;
}, set: function(t) {
this.logger.i(pi, "set demuxer type", t);
var i = this.stat;
if (t !== i.demuxerType) {
var c = i.box === void 0 || i.box === h.i.unknown;
t === _e.b.RAW ? (i.box = h.i.raw, i.isLive = !1) : t === _e.b.FLV ? (i.box = h.i.flv, i.multipart && (i.isLive = !1)) : t === _e.b.MP4 || t === _e.b.FMP4 ? (c && (i.box = h.i.mp4), i.multipart || (i.isLive = !1)) : t === _e.b.TS ? c && (i.box = h.i.ts) : t === _e.b.IVF && (i.box = h.i.ivf, i.isLive = !1), i.demuxerType = t, this.resetGopRemux();
}
} }, { key: "streamingMuxEnabled", get: function() {
return this.cI && !(this.src instanceof Blob);
}, set: function(t) {
this.cI = t;
} }, { key: "streamingMux", get: function() {
return this.stat.box === h.i.flv && this.stat.isLive !== !1 || this.streamingMuxEnabled && this.fI;
}, set: function(t) {
this.fI = t;
} }, { key: "hevcTest", get: function() {
return this.lI;
} }, { key: "evt", get: function() {
return this.Ai;
} }, { key: "fallback", get: function() {
return this.bI;
} }, { key: "streamTime", get: function() {
return this.pI;
} }], [{ key: "packName", get: function() {
return "no-wasm-hdr_es";
} }, { key: "version", get: function() {
return "3.3.37";
} }, { key: "buildTime", get: function() {
return "Mon Jan 20 2025 18:07:08 GMT+0800 (中国标准时间)";
} }]);
}(F.a);
qc.instanceCount = 0;
var Hr = qc, en = function(A) {
return A.NORMEL = "normal", A.SEEK = "seek", A.END = "end", A.LEVEL_SWITCH = "levelSwitch", A.FIRST_FRAME = "firstFrame", A.LOAD = "load", A.BACKUP = "backup", A;
}({}), oi = function(A) {
return A.START = "start", A.MANIFEST = "manifest", A.LEVEL = "level", A.STREAM_CONNECTED = "streamConnected", A.DATA = "data", A.DEMUX = "demux", A.SEGMENT = "segment", A.CANPLAY = "canplay", A.LOADEDMETADATA = "loadedmetadata", A.LOADEDDATA = "loadeddata", A.SEEKED = "seeked", A;
}(oi || {}), Jc = [{ event: oi.START, detailName: "first-loader-open" }, { event: oi.MANIFEST, detailName: "manifest-duration" }, { event: oi.LEVEL, detailName: "level-duration" }, { event: oi.STREAM_CONNECTED, detailName: "stream-connected-duration" }, { event: oi.DATA, detailName: "first-package-duration" }, { event: oi.DEMUX, detailName: "first-remux-duration" }, { event: oi.SEGMENT, detailName: "first-segment-duration" }, { event: oi.LOADEDMETADATA, detailName: "first-meta-duration" }, { event: [oi.LOADEDDATA, oi.CANPLAY, oi.SEEKED], detailName: "first-frame-duration" }], ao = "first-frame", z_ = function() {
function A(a) {
this.wI = 0, this.Vn = 0, this.ee = void 0, this.Pm = 0, this.EI = 0, this.jI = {}, this.Do = void 0, this.Ci = void 0, this.ee = Jc.slice(0), this.Do = a, this.Ci = a.logger;
}
var _ = A.prototype;
return _.start = function() {
this.Ci.i(ao, "start"), this.wI = 0, this.Pm = performance.now(), this.Vn = 0, this.ee = Jc.slice(0), this.EI = 0, this.jI = {}, this.process(oi.START, this.Pm);
}, _.process = function(a, t) {
var i;
if (t === void 0 && (t = 0), this.Ci.i(ao, "process type: " + a + " " + t + " complete: " + this.wI), this.wI)
return !1;
var c = this.ee, u = -1;
t = t || performance.now();
for (var v = 0; v < c.length; v++) {
var R = c[v];
if (Array.isArray(R.event)) {
if (R.event.indexOf(a) !== -1) {
u = v;
break;
}
} else if (R.event === a) {
u = v;
break;
}
}
if (u === -1)
return !1;
var Q = c.splice(0, u + 1).pop(), se = ((i = this.Do.mse) == null ? void 0 : i.readyState) === "closed";
if ((c.length === 0 || se && a === oi.SEGMENT) && (this.Vn = t - this.Pm, this.wI = Date.now(), this.Ci.i(ao, "complete " + this.Vn + " " + this.wI)), Q) {
var fe = Math.round(t - this.EI);
this.EI === 0 && (fe = Date.now()), this.EI = t, this.jI[Q.detailName] = fe;
}
return !!this.wI;
}, _.onDownloadError = function() {
this.jI.download_retry ? this.jI.download_retry++ : this.jI.download_retry = 1;
}, _.onRetry = function() {
this.jI.retry ? this.jI.retry++ : this.jI.retry = 1;
}, g()(A, [{ key: "complete", get: function() {
return this.wI;
} }, { key: "duration", get: function() {
return this.Vn;
} }, { key: "details", get: function() {
return this.jI;
} }]);
}(), el = [/headless/, /spider/, /[a-z0-9]+bot[^a-z0-9]/], dn = function(A) {
return A.none = "", A.probably = "probably", A.maybe = "maybe", A;
}(dn || {}), tl = function() {
if (ge())
return dn.none;
if (navigator.webdriver)
return dn.probably;
for (var A = navigator.userAgent.toLowerCase(), _ = 0; _ < el.length; _++)
if (el[_].test(A))
return dn.probably;
if (window.innerWidth <= 0 && window.innerHeight <= 0)
return dn.probably;
if (ht.isMSEAvailable() && !ht.isMSECodecCapabilityNormal())
return dn.maybe;
try {
var a = document.createElement("canvas");
a.width = 4, a.width = 4;
var t = a.getContext("2d");
if (t) {
t.fillStyle = "#FFFFFF", t == null || t.fillRect(0, 0, a.width, a.height);
for (var i = t.getImageData(0, 0, a.width, a.height).data, c = 0; c < i.length; c++)
if (i[c] !== 0)
return dn.none;
return dn.maybe;
}
} catch (u) {
return dn.probably;
}
return dn.none;
}(), so, Gr = {};
try {
var il;
(il = navigator.userAgentData) == null || il.getHighEntropyValues(["architecture", "bitness", "model", "platform", "platformVersion"]).then(function(A) {
s()(Gr, A);
});
} catch (A) {
}
var K_ = new Uint8Array(16);
function W_() {
if (!so && !(so = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto < "u" && typeof msCrypto.getRandomValues == "function" && msCrypto.getRandomValues.bind(msCrypto)))
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
return so(K_);
}
for (var Y_ = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i, Q_ = function(A) {
return typeof A == "string" && Y_.test(A);
}, Gi = [], oo = 0; oo < 256; ++oo)
Gi.push((oo + 256).toString(16).substr(1));
var X_ = function(A) {
var _ = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, a = (Gi[A[_ + 0]] + Gi[A[_ + 1]] + Gi[A[_ + 2]] + Gi[A[_ + 3]] + "-" + Gi[A[_ + 4]] + Gi[A[_ + 5]] + "-" + Gi[A[_ + 6]] + Gi[A[_ + 7]] + "-" + Gi[A[_ + 8]] + Gi[A[_ + 9]] + "-" + Gi[A[_ + 10]] + Gi[A[_ + 11]] + Gi[A[_ + 12]] + Gi[A[_ + 13]] + Gi[A[_ + 14]] + Gi[A[_ + 15]]).toLowerCase();
if (!Q_(a))
throw TypeError("Stringified UUID is invalid");
return a;
}, co, $_ = function(A, _, a) {
var t = (A = A || {}).random || (A.rng || W_)();
if (t[6] = 15 & t[6] | 64, t[8] = 63 & t[8] | 128, _) {
a = a || 0;
for (var i = 0; i < 16; ++i)
_[a + i] = t[i];
return _;
}
return X_(t);
}, Z_ = (/* @__PURE__ */ new Date()).getTimezoneOffset() / -60;
function lo() {
return co || (co = { support_mse: ht.isMSEAvailable() ? 1 : 0, support_aac_mse: ht.TYPE_SUPPORTED.aac ? 1 : 0, support_aac: ht.isVideoCodecSupported(h.c.aac) ? 1 : 0, support_h264_mse: ht.TYPE_SUPPORTED.h264 ? 1 : 0, support_h264: ht.isVideoCodecSupported(h.c.h264) ? 1 : 0, support_h265_mse: ht.TYPE_SUPPORTED.hevc ? 1 : 0, support_h265: ht.isVideoCodecSupported(h.c.hevc) ? 1 : 0, support_av1_mse: ht.TYPE_SUPPORTED.av1 ? 1 : 0, support_simd: ht.isSupportSimd ? 1 : 0, support_thread: ht.isSupportThreads ? 1 : 0, support_hw: ht.isSupportHW ? 1 : 0, support_change_type: ht.isChangeTypeSupported() ? 1 : 0, support_streaming: Ia.isStreamingSupported() ? 1 : 0, hardware_concurrency: de() || 0, wasm_dec_smooth: ht.wasmSmooth ? 1 : 0 }), co;
}
function rl(A, _) {
var a, t;
return typeof navigator < "u" && (navigator.webdriver && (a = navigator.webdriver ? 1 : 0), navigator.onLine !== void 0 && (t = navigator.onLine ? 1 : 0)), { session_id: _.sessionId, kernel_version: Hr.version, pack_name: Hr.packName, creation_time: _.creationTime, time_zone: Z_, src_update_time: A.srcUpdateTime, load_start_time: _.loadStartTime, instance_count: Hr.instanceCount, webdriver: a, on_line: t };
}
function nl() {
var A = {};
if (typeof navigator < "u") {
navigator.onLine !== void 0 && (A.network_on_line = navigator.onLine ? 1 : 0);
var _ = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
(_ == null ? void 0 : _.rtt) !== void 0 && (A.network_rtt = _.rtt), (_ == null ? void 0 : _.rtt) !== void 0 && (A.network_downlink = _.downlink), (_ == null ? void 0 : _.effectiveType) !== void 0 && (A.network_effective_type = _.effectiveType), (_ == null ? void 0 : _.saveData) !== void 0 && (A.network_save_data = _.saveData ? 1 : 0);
}
return A;
}
function al(A, _) {
var a, t, i, c = (a = A.video) == null ? void 0 : a.duration, u = A.lctx.current, v = (u == null ? void 0 : u.currentUrl) || "", R = s()({ play_url: (u == null ? void 0 : u.fileName) || v, url_id: (u == null ? void 0 : u.urlId) || 0, stream_host: v ? new ze.a(v).host : "", reuse: _.reuse, metadata_time: _.metadataTime, play_start_time: _.playStartTime, playing_start_time: _.playingStartTime, stream_duration: Math.round(1e3 * (c && Number.isFinite(c) ? c : 0)), max_bitrate: (u == null ? void 0 : u.maxBitrate) || 0, codec: _.codecs, play_pos: _.playPos || 0, v_data_rate: Math.round(((t = A.loadRec.currentLoad) == null ? void 0 : t.videoDataRate) || 0), a_data_rate: Math.round(((i = A.loadRec.currentLoad) == null ? void 0 : i.audioDataRate) || 0), drm: A.stat.drm ? 1 : 0, adaptive_multi_rate: A.lctx.abr ? 1 : 0, use_backup: _.useBackup, play_to_end: _.playToEnd, v_decoder: A.stat.decoder, video_codec_type: A.stat.codecType || h.c.unknown, start_codec: _.startCodec, demuxer: A.stat.demuxerType || _e.b.UNKNOWN, core_type: A.stat.coreType, mms: A.stat.mms ? 1 : 0, box: A.stat.box, kwai_slice: A.stat.isKwaiSlice ? 1 : 0, monkey_patched_fetch: _.monkeyPatchedFetch }, rl(A, _), nl(), function(fe) {
var ke = fe.video;
return ke ? { elem_crossorigin: ke.crossOrigin, elem_autoplay: ke.autoplay ? 1 : 0, elem_loop: ke.loop ? 1 : 0, elem_volume: ke.volume, elem_muted: ke.muted ? 1 : 0, elem_preload: ke.preload, elem_controls: ke.controls ? 1 : 0, elem_ready_state: ke.readyState, elem_network_state: ke.networkState, elem_playback_rate: ke.playbackRate, elem_paused: ke.paused ? 1 : 0, elem_ended: ke.ended ? 1 : 0, elem_seeking: ke.seeking ? 1 : 0, elem_tag_name: ke.tagName } : {};
}(A));
A.stat.flvAbrNotAligned && (R.flv_abr_not_aligned = 1), typeof ht.playHEVCTest == "boolean" && (R.play_hevc_test = ht.playHEVCTest ? 1 : 0), A.stat.isLive !== void 0 && (R.live = A.stat.isLive ? 1 : 0), R.live_shift_type = A.stat.liveShiftType;
var Q = st((u == null ? void 0 : u.fileName) || v);
A.stat.box === h.i.flv && A.stat.isLive !== !1 && (R.stream_id = Q.streamID), _.httpHeader && (R.response_header = O(_.httpHeader)), u != null && u.bitrate && (R.bitrate = Math.round(u.bitrate)), u != null && u.qualityType && (R.quality_type = u.qualityType), u != null && u.qualityLabel && (R.quality_label = u.qualityLabel), _.startQualityType && (R.start_quality_type = _.startQualityType), Q.transcodingTpl && (R.transcoding_template = Q.transcodingTpl), Q.filename && (R.filename = Q.filename), typeof navigator < "u" && navigator.deviceMemory && (R.device_memory = navigator.deviceMemory);
var se = Object(Mt.b)();
return se.renderer && (R.gpu_renderer = se.renderer), tl && (R.bot = tl), _.canvasCtxType && (R.canvas_ctx = _.canvasCtxType), A.stat.wasmDecoder && (R.wasm_dec = A.stat.wasmDecoder, R.wasm_dec_simd = A.stat.wasmSimd ? 1 : 0, R.wasm_dec_threads = A.stat.wasmThreads || 0), R;
}
function sl(A) {
var _ = {};
if (A.metadata)
for (var a in A.metadata) {
if (Object.keys(_).length > 50)
break;
var t = A.metadata[a];
typeof t == "string" ? _[a] = t.substring(0, 50) : typeof t != "number" && typeof t != "boolean" || (_[a] = t);
}
return _;
}
function uo() {
var A = {};
return Gr && (Gr.architecture && (A.architecture = Gr.architecture), Gr.bitness && (A.bitness = Gr.bitness), Gr.model && (A.model = Gr.model), Gr.platform && (A.platform = Gr.platform), Gr.platformVersion && (A.platform_version = Gr.platformVersion)), A;
}
function ho() {
var A = {};
return $.a.platformVersion && (A.platform = $.a.platform || "", A.platform_version = $.a.platformVersion || 0), $.a.iphone ? A.model = Kc() : $.a.model && (A.model = $.a.model), $.a.version && (A.browser_name = $.a.name || "", A.browser_major = $.a.version.major || 0), A;
}
function ol() {
var A, _, a, t = {};
return ge() || ((A = window.screen) != null && A.width && (t.screen_w = window.screen.width), (_ = window.screen) != null && _.height && (t.screen_h = window.screen.height), (a = window.screen) != null && a.colorDepth && (t.screen_color_depth = window.screen.colorDepth), t.device_pixel_ratio = window.devicePixelRatio || 1), t;
}
function cl(A) {
var _ = {};
return A && (A.fps && (_.fps = Math.round(1e3 * A.fps) / 1e3), A.width && (_.width = A.width), A.height && (_.height = A.height), A.codedWidth && (_.coded_width = A.codedWidth), A.codedHeight && (_.coded_height = A.codedHeight), A.sar && A.sar.width !== A.sar.height && (_.sar = A.sar), A.enhancedFlv && (_.enhanced_flv = A.enhancedFlv ? 1 : 0)), _;
}
function ll(A) {
var _ = { src_type: A.stat.srcType };
return A.stat.stereoType && (_.stereo_type = A.stat.stereoType), A.stat.mixCodecInput && A.stat.mixCodecInput.length && (_.mix_codec_input = A.stat.mixCodecInput), A.stat.mixContainerInput && A.stat.mixContainerInput.length && (_.mix_container_input = A.stat.mixContainerInput), A.stat.mixCodecAvailable && (_.mix_codec_available = A.stat.mixCodecAvailable), _;
}
function ul(A) {
var _ = {};
return A.stat.srcMeta && (_.src_meta = A.stat.srcMeta), _;
}
function hl(A) {
var _, a, t, i = {};
return (_ = A.lctx.current) != null && _.meta && (i.current_level_meta = A.lctx.current.meta, A.lctx.current.meta.comment && A.lctx.current.meta.comment.split("/").forEach(function(c) {
c.indexOf("tt=") === 0 && (i.transcoding_template = c.substring(3)), c.indexOf("ttExplain=") === 0 && (i.transcoding_template_explain = c.substring(10));
})), (a = A.lctx.current) != null && a.fileSize && (i.filesize = (t = A.lctx.current) == null ? void 0 : t.fileSize), i;
}
function dl(A) {
var _ = performance.now();
return { play: Math.round(A.playDuration + (A.playStartMS ? _ - A.playStartMS : 0)), actualPlay: Math.round(A.actualPlayDuration + (A.actualPlayStartMS ? _ - A.actualPlayStartMS : 0)), pause: Math.round(A.pauseDuration + (A.pauseStartMS ? _ - A.pauseStartMS : 0)), buffer: Math.round(A.bufferTime + (A.bufferingStartMS ? _ - A.bufferingStartMS : 0)) };
}
var q_ = function() {
function A(a, t) {
this.kI = void 0, this.Do = void 0, this.MI = void 0, this.SI = 1, this.BI = 0, this.TI = 0, this.DI = !0, this.RI = void 0, this.LI = void 0, this.NI = 0, this.QI = 0, this.xI = "", this.VI = new Wc(), this.kI = a, this.Do = t, this.SI = 1, this.MI = { play: 0, actualPlay: 0, pause: 0, buffer: 0, blockCount: 0, pauseCnt: 0, renderBlockCount: 0, seekCnt: 0, seekLoadCnt: 0, decodedFrames: 0, droppedFrames: 0, muxDroppedFrames: 0, traffic: 0, download: 0, mseUpdate: 0, mseRemove: 0, segment: 0, muxA: 0, muxV: 0, fillA: 0, fillV: 0, droppedA: 0, droppedV: 0, keyFrame: 0, onLineChange: 0, visibilityChange: 0, heartbeatTimeout: 0, loadCnt: 0, refreshCnt: 0, wasmDecErr: 0, videoRemuxSampleCount: 0, audioRemuxSampleCount: 0, videoRemuxDuration: 0, audioRemuxDuration: 0 }, this.UI();
}
var _ = A.prototype;
return _.FI = function(a, t) {
var i = {};
for (var c in t) {
var u = a[c], v = t[c];
typeof u == "number" && typeof v == "number" && (i[c] = u - v, t[c] = u);
}
return i;
}, _.UI = function() {
this.BI = performance.now(), this.TI = Date.now(), this.LI = void 0, this.RI = void 0, this.QI = 0, this.xI = "";
}, _.setFirstScreenDuration = function(a, t, i) {
this.LI = Math.round(a), this.RI = t, this.DI = !0, this.NI = i;
}, _.setError = function(a, t) {
this.QI = a, this.xI = t;
}, _.build = function() {
var a, t = this.kI, i = this.Do, c = this.Do.stat, u = performance.now(), v = Math.round(u - this.BI), R = this.FI(t, this.MI), Q = i.mse ? this.FI((a = i.mse) == null ? void 0 : a.stat, this.MI) : void 0, se = this.FI(dl(this.kI), this.MI), fe = this.FI(this.Do.loadRec, this.MI), ke = this.Do.loadRec.downloadInfoByRange(v), Fe = ke.timeCost ? Math.round(ke.size / ke.timeCost * 1e3) : 0, Ne = { tick_index: this.SI, tick_start: this.TI, tick_duration: v, error_code: this.QI, error_message: this.xI, block_cnt: R.blockCount || 0, render_block_cnt: R.renderBlockCount || 0, decoded_video_frames: R.decodedFrames || 0, dropped_video_frames: (R.droppedFrames || 0) + (R.muxDroppedFrames || 0), segment_cnt: R.segment || 0, play_duration: se.play || 0, buffer_time: se.buffer || 0, actual_play_duration: se.actualPlay || 0, played_video_duration: se.play || 0, traffic: Math.round(((fe == null ? void 0 : fe.traffic) || 0) / 1024), hidden: ki() ? 1 : 0, download: R.download, download_speed: Fe, seek_cnt: R.seekCnt, seek_load_cnt: R.seekLoadCnt, pause_duration: se.pause, pause_cnt: R.pauseCnt, on_line_change: R.onLineChange, visibility_change: R.visibilityChange, heartbeat_timeout: R.heartbeatTimeout, load_cnt: R.loadCnt, refresh_cnt: R.refreshCnt, media_buffered_a: t.bufferedEndA, media_buffered_v: t.bufferedEndV };
return s()(Ne, lo(), al(i, t), ho(), uo(), function(He) {
var rt, Qe, _t, dt, Rt;
return He.mse ? (dt = He.mse.bufferedByType(h.o.VIDEO), Rt = He.mse.bufferedByType(h.o.AUDIO)) : dt = Rt = He.mediaBufferedSec, { a_buf_start: Math.round(1e3 * Rt.start) || 0, a_buf_end: Math.round(1e3 * Rt.end) || 0, a_buf_len: Math.round(1e3 * Math.max(0, Rt.end - He.currentTime)) || 0, a_buf_slices: ((rt = He.mse) == null ? void 0 : rt.bufferSliceNumByType(h.o.AUDIO)) || He.bufferSliceNum || 0, v_buf_start: Math.round(1e3 * dt.start) || 0, v_buf_end: Math.round(1e3 * dt.end) || 0, v_buf_len: Math.round(1e3 * Math.max(0, dt.end - He.currentTime)) || 0, v_buf_slices: ((Qe = He.mse) == null ? void 0 : Qe.bufferSliceNumByType(h.o.VIDEO)) || He.bufferSliceNum || 0, buffer_queue_cnt: ((_t = He.mse) == null ? void 0 : _t.pendingNum()) || 0 };
}(i), function(He) {
if (He.stat.isLive && He.stat.box === h.i.flv) {
var rt, Qe, _t, dt = (rt = He.liveTime) == null ? void 0 : rt.getDisplayDelay(He.currentTime);
if (dt)
return { v_rec_delay: (Qe = He.liveTime) == null ? void 0 : Qe.getRecDelay(), v_render_delay: dt || 0, a_render_delay: ((_t = He.liveTime) == null ? void 0 : _t.getAudioRenderDelay(He.currentTime)) || 0 };
}
return {};
}(i), hl(i)), this.VI.hasData && (Ne.retry_record = this.VI.beacon, Ne.retry_cnt = this.VI.retryCount, this.VI.clear()), R.wasmDecErr && (Ne.wasm_dec_err = R.wasmDecErr), fe.muxA && (Ne.mux_a = fe.muxA), fe.muxV && (Ne.mux_v = fe.muxV), fe.fillA && (Ne.fill_a = fe.fillA), fe.fillV && (Ne.fill_v = fe.fillV), fe.droppedA && (Ne.dropped_a = fe.droppedA), fe.droppedV && (Ne.dropped_v = fe.droppedV), R.muxDroppedFrames && (Ne.mux_dropped_video_frames = R.muxDroppedFrames), c.coreType === h.a.mse && (Ne.mse_update_cnt = (Q == null ? void 0 : Q.mseUpdate) || 0, Ne.mse_remove_cnt = (Q == null ? void 0 : Q.mseRemove) || 0, Ne.key_frame_cnt = R.keyFrame, c.isLive ? (Ne.live_shift_type = i.stat.liveShiftType, i.isLiveShift && (Ne.live_shift = i.stat.liveShiftActive ? 1 : 0)) : (Ne.lazyload_min = Math.floor(c.lazyLoadRecoverDuration), Ne.lazyload_max = Math.floor(c.lazyLoadMaxDuration)), R.audioRemuxSampleCount && (Ne.a_remux_sample_cnt = R.audioRemuxSampleCount), R.videoRemuxSampleCount && (Ne.v_remux_sample_cnt = R.videoRemuxSampleCount), R.audioRemuxDuration && (Ne.a_remux_duration = Math.floor(1e3 * R.audioRemuxDuration)), R.videoRemuxDuration && (Ne.v_remux_duration = Math.floor(1e3 * R.videoRemuxDuration))), this.DI && (this.LI === void 0 ? Ne.first_screen_total_duration = 0 : (Ne.first_screen_total_duration = this.LI, Ne.first_screen_details = this.RI, c.coreType === h.a.mse && c.box === h.i.mp4 && (Ne.mp4_moov_size = t.mp4MoovSize, t.mp4FastStart !== void 0 && (Ne.mp4_fast_start = t.mp4FastStart ? 0 : 1)), this.RI = void 0, this.LI = void 0, this.DI = !1)), typeof this.NI == "number" && t.playStartTime && (Ne.click_to_first_frame = this.NI, this.NI > 0 && (this.NI = void 0)), this.SI === 1 && s()(Ne, lo(), ll(this.Do), ol()), this.UI(), this.SI++, Ne;
}, A;
}(), zr = "monitor", J_ = function(A) {
function _(t) {
var i;
return (i = A.call(this) || this).HI = void 0, i.YI = void 0, i.GI = void 0, i.Do = void 0, i.Ci = void 0, i.KI = void 0, i.kI = void 0, i.ZI = void 0, i.WI = !1, i.XI = !1, i.zI = !1, i.JI = !1, i.qI = function() {
i.kI.onLineChange++;
}, i.$I = function(c) {
var u;
c === void 0 && (c = en.NORMEL);
try {
var v;
u = (v = i.ZI) == null ? void 0 : v.build();
} catch (Q) {
}
if (u) {
var R;
c === en.NORMEL && u.first_screen_total_duration > 0 ? (u.type = en.FIRST_FRAME, u.metadata = sl(i.data)) : (c === en.LOAD && s()(u, ul(i.Do)), u.type = c), i.JI && (s()(u, cl((R = i.Do.loadRec.currentLoad) == null ? void 0 : R.mediaInfo)), i.JI = !1), i.Do.stat.isLive || (u.seek_record = i.kI.seekRecord.slice(0), i.kI.seekRecord = []), i.Ci.i(zr, "realtime beacon", u), i.emit(w.a.REPORT, { type: pr.REALTIME_BEACON, value: u });
}
}, i.GI = performance.now(), i.YI = Date.now(), i.KI = new z_(t), i.Do = t, i.Ci = t.logger, i.ub(), ge || (window.addEventListener("online", i.qI), window.addEventListener("offline", i.qI)), i;
}
y()(_, A);
var a = _.prototype;
return a.getName = function() {
return zr;
}, a.ub = function() {
var t;
this.XI = !1, this.zI = !1, this.JI = !1, this.kI = (t = { decodedFrames: 0, droppedFrames: 0, muxDroppedFrames: 0, sessionId: $_(), creationTime: 0, startTime: 0, loadStartTime: 0, playStartTime: 0, metadataTime: 0, playingStartTime: 0, playDuration: 0, actualPlayDuration: 0, pauseDuration: 0, pauseCnt: 0, bufferTime: 0, blockCount: 0, renderBlockCount: 0, seekCnt: 0, seekDuration: 0, seekLoadCnt: 0, seekLoadDuration: 0, seekStartTime: 0, unknownTSPacketCount: 0, audioNonMonotonous: 0, startBitrate: 0, smoothBitrate: -1, useBackup: 0, aacOverhead: 0, errorCode: 0, errorMessage: "", download: 0, reuse: 0, playPos: 0, seekRecord: [], codecs: "", firstScreenTotalDuration: 0, clickToFirstFrame: 0, playToEnd: 0, keyFrame: 0, onLineChange: 0, visibilityChange: 0, lastHeartbeatTime: 0, heartbeatTimeout: 0, loadCnt: 0, refreshCnt: 0, monkeyPatchedFetch: "", bufferedEndA: 0, bufferedEndV: 0, wasmDecErr: 0, audioRemuxSampleCount: 0, videoRemuxSampleCount: 0, audioRemuxDuration: 0, videoRemuxDuration: 0 }, Be.isSupported() && (t.monkeyPatchedFetch = ye(fetch, "fetch")), t), this.kI.creationTime = this.YI, this.Ci.i(zr, "reset", this.kI.sessionId), this.Do.fps.reset(), this.Do.fps.getFPS(this.Do.videoPlaybackQuality);
}, a.onRendererInitComplete = function(t) {
this.Ci.i(zr, "renderer init complete. type: " + t.type), this.data.canvasCtxType = t.type;
}, a.onLoaderChunkArrival = function(t) {
this.Do.loadRec.onDataReceive(t), this.tO(oi.DATA);
}, a.onMediaConnected = function(t) {
t.headers && (this.kI.httpHeader = t.headers), this.tO(oi.STREAM_CONNECTED);
}, a.onMediaDemux = function() {
this.tO(oi.DEMUX, performance.now());
}, a.onKeyFrame = function(t) {
this.Do.loadRec.currentLoad && this.Do.loadRec.currentLoad.keyFrame++, this.data.keyFrame++, t && this.emit(w.a.REPORT, { type: pr.KEY_FRAME, value: t });
}, a.onDecLibLoaded = function(t) {
this.kI.decLibLoadDuration = t.duration, this.kI.decLibCacheHit = t.hitCache;
}, a.onNewSource = function(t) {
var i = this.kI, c = this.Do.lctx.current;
c ? (this.Do.loadRec.onStreamOpen(t.sync, c.currentUrl, c.bitrate, c.qualityType), i.level = this.Do.lctx.currentIdx, i.startQualityType || (i.startQualityType = c.qualityType)) : this.Do.loadRec.onStreamOpen(t.sync, "", 0, "unknown");
}, a.onDiscontinuity = function(t) {
this.emit(w.a.REPORT, { type: pr.DISCONTINUITY, value: t });
}, a.onDownload = function(t) {
var i = this, c = this.kI;
t.error_code && !this.KI.complete && this.KI.onDownloadError(), c.download++;
var u = s()({ use_backup: c.useBackup, first_screen: c.firstScreenTotalDuration ? 1 : 0 }, rl(this.Do, c), ho(), uo(), nl(), t);
t.error_code === 1009 ? setTimeout(function() {
i.emit(w.a.REPORT, { type: pr.DOWNLOAD, value: u });
}, 0) : this.emit(w.a.REPORT, { type: pr.DOWNLOAD, value: u });
}, a.onHeartbeat = function() {
var t, i, c = this.kI, u = this.Do, v = u.fps.getFPS(this.Do.videoPlaybackQuality), R = {}, Q = u.loadRec, se = performance.now();
c.lastHeartbeatTime && se - c.lastHeartbeatTime > Ve.j && c.heartbeatTimeout++, c.lastHeartbeatTime = performance.now(), (u.stat.coreType === h.a.mse || u.stat.coreType === h.a.rtc) && (R.totalReceive = Q.traffic, R.speed = Q.speed, R.videoDataRate = ((t = Q.currentLoad) == null ? void 0 : t.videoDataRate) || 0, R.audioDataRate = ((i = Q.currentLoad) == null ? void 0 : i.audioDataRate) || 0), u.mse && (R.videoBuffered = c.bufferedEndV = Math.round(Math.max(0, 1e3 * (u.mse.bufferedEndByType(h.o.VIDEO) - u.currentTime))), R.audioBuffered = c.bufferedEndA = Math.round(Math.max(0, 1e3 * (u.mse.bufferedEndByType(h.o.AUDIO) - u.currentTime))), R.fillAudio = Q.fillA, R.fillVideo = Q.fillV, R.keyFrame = c.keyFrame, u.stat.isLive ? (R.isLive = u.stat.isLive, u.stat.liveShiftType && (R.liveShift = u.stat.liveShiftActive)) : (R.lazyloadMin = u.stat.lazyLoadRecoverDuration, R.lazyloadMax = u.stat.lazyLoadMaxDuration)), R.buffered = Math.round(1e3 * u.bufferedSec), R.decodedFPS = (v == null ? void 0 : v.decodedFPS) || 0, R.droppedFPS = (v == null ? void 0 : v.droppedFPS) || 0, c.decodedFrames = R.decodedFrames = (v == null ? void 0 : v.decoded) || 0, c.droppedFrames = R.droppedFrames = ((v == null ? void 0 : v.dropped) || 0) + c.muxDroppedFrames, u.stat.isLive && u.stat.box === h.i.flv && u.liveTime && (R.audioRenderDelay = u.liveTime.getAudioRenderDelay(u.currentTime), R.displayDelay = u.liveTime.getDisplayDelay(u.currentTime), R.recDelay = u.liveTime.getRecDelay()), u.stat.decoder === h.d.wasm && (R.wasmFrameBufLen = u.stat.frameBufLen), R.playPos = 1e3 * u.currentTime, this.Ci.i(zr, "heartbeat", R), this.emit(w.a.REPORT, { type: pr.HEARTBEAT, value: R });
}, a.destroy = function() {
this.Ci.i(zr, "destroy"), this.$I(en.END), this.iO(), ge() || (window.removeEventListener("online", this.qI), window.removeEventListener("offline", this.qI)), A.prototype.destroy.call(this);
}, a.onLoad = function(t) {
if (this.Ci.i(zr, "on load: " + t.type), this.kI.loadCnt++, this.kI.metadata = void 0, t.type)
t.type !== h.h.internal && t.type !== h.h.retry || this.KI.complete || this.KI.start(), this.kI.errorCode = 0, this.kI.errorMessage = "";
else {
var i;
if ((i = this.Do.lctx.current) == null || i.currentUrl, this.kI.startTime) {
var c = this.kI.reuse;
this.ub(), this.kI.reuse = c + 1;
}
this.kI.startTime = performance.now(), this.kI.loadStartTime = Date.now(), this.KI.start(), this.WI = ki(), this.iO(), this.ZI = new q_(this.kI, this.Do), this.$I(en.LOAD);
}
}, a.onStopLoad = function() {
this.$I(en.END), this.iO(), this.eO();
}, a.onManifestParsed = function(t) {
this.Ci.i(zr, "on manifest:", t);
var i = this.Do.lctx.current;
i && (this.kI.startBitrate || (this.kI.startBitrate = i.bitrate)), this.tO(oi.MANIFEST);
}, a.onLevelUpdated = function(t) {
this.tO(oi.LEVEL);
}, a.onAudioTrackUpdated = function() {
}, a.onMediaInfo = function(t) {
var i, c, u, v = this.Do;
(t = t || {}).box = v.stat.box, t.tagName = (i = v.video) == null ? void 0 : i.tagName, v.stat.srcMeta && (t.srcMeta = v.stat.srcMeta), (c = v.lctx.current) != null && c.meta && (t.currentLevelMeta = (u = v.lctx.current) == null ? void 0 : u.meta), typeof v.stat.isLive == "boolean" && (t.isLive = v.stat.isLive), t.liveShiftEnabled = v.isLiveShift, t.liveShiftType = v.stat.liveShiftType, t.packName = Hr.packName, v.loadRec.onMediaInfo(t);
var R = [];
t.videoCodec && R.push(t.videoCodec), t.audioCodec && R.push(t.audioCodec), this.kI.codecs = R.join(","), this.kI.startCodec || (this.kI.startCodec = this.kI.codecs), t.sid = this.kI.sessionId, t.hardwareAccelerated = ht.isSupportHW, t.coreType = v.stat.coreType, !t.streamHost && v.lctx.currentUrl && (t.streamHost = new ze.a(v.lctx.currentUrl).host);
var Q, se = Object(Mt.b)();
se.renderer && (t.gpu = se.renderer), v.loadRec.currentLoad && (v.loadRec.currentLoad.mediaInfo = t), v.config.ntp && v.stat.isLive !== !1 && v.stat.box === h.i.flv && ((Q = v.liveTime) == null || Q.ntpSync(v.stat.preferNativeLoader)), v.stat.isKwaiSlice && (t.isKwaiSlice = v.stat.isKwaiSlice);
var fe = JSON.stringify(t);
this.Ci.i(zr, "mediainfo", fe), this.JI = !0, this.emit(w.a.REPORT, { type: pr.MEDIA_INFO, value: JSON.parse(fe) });
}, a.onParsingData = function(t) {
var i = this.kI;
t.extra && t.extra.stat && (i.unknownTSPacketCount = i.unknownTSPacketCount || t.extra.stat.unknownTSPacketCount || 0, i.audioNonMonotonous = i.audioNonMonotonous || t.extra.stat.audioNonMonotonous || 0, i.aacOverhead = i.aacOverhead || t.extra.stat.aacOverhead || 0), t.segments.forEach(function(c) {
c.type === h.o.VIDEO ? (c.droppedFrames && (i.muxDroppedFrames += c.droppedFrames), i.videoRemuxSampleCount += c.sampleCount, i.videoRemuxDuration += c.endDTS - c.startDTS) : c.type === h.o.AUDIO && (i.audioRemuxSampleCount += c.sampleCount, i.audioRemuxDuration += c.endDTS - c.startDTS);
}), this.tO(oi.SEGMENT);
}, a.onPrivNal = function(t) {
var i;
(i = this.Do.liveTime) == null || i.onPrivNal(t), this.emit(w.a.REPORT, { type: pr.PRIV_NAL, value: t });
}, a.onSei = function(t) {
this.emit(w.a.REPORT, { type: pr.SEI, value: t });
}, a.onAacPriv = function(t) {
this.emit(w.a.REPORT, { type: pr.AAC_PRIV, value: t });
}, a.onPlay = function() {
this.kI.playStartTime || (this.kI.playStartTime = Date.now()), this.nO();
}, a.onLoadedmetadata = function() {
this.tO(oi.LOADEDMETADATA), this.kI.metadataTime || (this.kI.metadataTime = Date.now());
}, a.onLoadeddata = function() {
this.tO(oi.LOADEDDATA), this.eO();
}, a.onCanplay = function() {
this.tO(oi.CANPLAY), $.a.safari && this.Do.stat.coreType !== h.a.mse || this.eO();
}, a.onPlaying = function() {
var t;
$.a.ios && ((t = this.Do.video) == null ? void 0 : t.readyState) !== 4 || (this.XI || (this.XI = !0), this.sO(), this.rO(), this.eO());
}, a.onPause = function() {
var t;
(t = this.Do.video) != null && t.seeking || !this.XI || (this.hO(), this.oO(), this.XI = !1);
}, a.onEnded = function() {
this.kI.playToEnd++, this.XI = !1, this.hO(), this.rO(), this.eO(), this.$I(en.END), this.iO();
}, a.onWaiting = function(t) {
this.kI.playPos = Math.round(1e3 * this.Do.currentTime), this.XI && this.KI.complete && t.block && this.aO(t.bufferedSec);
}, a.onSeeking = function(t) {
this.kI.seekRecord.push({ from: this.kI.playPos, to: Math.round(1e3 * this.Do.currentTime), time: Date.now() }), this.kI.seekRecord.length > 50 && this.kI.seekRecord.shift(), this.Do.stat.isLive || t != null && t.internal || (this.kI.seekStartTime = performance.now());
}, a.onSeekWithLoad = function() {
this.KI.complete && (this.$I(en.SEEK), this.uO(), this.zI = !0);
}, a.onSeeked = function() {
if (this.Do.fps.getFPS(this.Do.videoPlaybackQuality), this.kI.seekStartTime) {
this.kI.seekCnt++;
var t = Math.round(performance.now() - this.kI.seekStartTime);
this.kI.seekDuration += t, this.kI.seekStartTime = 0, this.zI && (this.kI.seekLoadCnt++, this.kI.seekLoadDuration += t);
}
this.zI = !1, this.KI.complete || this.Do.stat.coreType === h.a.mse || !$.a.safari && !$.a.msie || this.tO(oi.SEEKED);
}, a.onTimeupdate = function() {
var t, i, c = this.Do, u = c.video;
if (u) {
u.loop && !c.stat.isLive && c.currentTime === 0 && Number.isFinite(u.duration) && u.duration > 0 && u.duration - this.kI.playPos / 1e3 < 1 && this.kI.playToEnd++;
var v = Math.round(1e3 * c.currentTime);
$.a.msie && c.stat.coreType !== h.a.mse && this.kI.bufferingStartMS && this.kI.playPos !== v && this.onPlaying(), this.kI.playPos = v, !$.a.ios || typeof this.kI.bufferingStartMS != "number" || ((t = this.Do.video) == null ? void 0 : t.readyState) !== 4 || (i = this.Do.video) != null && i.paused || this.onPlaying();
}
}, a.onProgress = function() {
var t;
$.a.safari && this.Do.stat.coreType !== h.a.mse && this.kI.bufferingStartMS && ((t = this.Do.video) == null ? void 0 : t.readyState) === 4 && this.eO();
}, a.mediaCapabilities = function(t) {
this.kI.smoothBitrate = t;
}, a.onLevelSwitching = function(t) {
t.smooth || (this.$I(en.LEVEL_SWITCH), this.uO());
}, a.onRetry = function(t) {
this.Do.stat.retryInfo.append(t), t.type === h.k.BACKUP && (this.kI.useBackup = 1), this.KI.onRetry(), t.type === h.k.BACKUP && (this.ZI && this.ZI.setError(t.code || 0, t.message || ""), this.$I(en.BACKUP), this.ZI && this.ZI.setError(0, ""));
}, a.onRefresh = function() {
this.kI.refreshCnt++;
}, a.onMetadata = function(t) {
this.kI.metadata || (this.kI.metadata = t), t.mp4MoovSize && (this.kI.mp4MoovSize = t.mp4MoovSize), typeof t.mp4FastStart == "boolean" && (this.kI.mp4FastStart = t.mp4FastStart), typeof t.mp4MoovNoPs == "boolean" && (this.kI.mp4MoovNoPs = t.mp4MoovNoPs), typeof t.compatible_brands == "string" && (this.kI.mp4CompatibleBrands = t.compatible_brands), this.Ci.i(zr, "metadata", t), this.emit(w.a.REPORT, { type: pr.METADATA, value: t });
}, a.onVisibilityChange = function() {
this.kI.visibilityChange++;
}, a.onError = function(t) {
t.preventFollowUp || (t.fatal ? (this.Ci.i(zr, "error", t), this.kI.errorCode = t.code, this.kI.errorMessage = t.reason, this.ZI && this.ZI.setError(t.code, t.reason), this.hO(), this.rO(), this.eO()) : t.details === L.a.DECODER_DEC_ERROR && this.kI.wasmDecErr++);
}, a.tO = function(t, i) {
i === void 0 && (i = 0), !this.KI.complete && this.KI.process(t, i) && this.cO();
}, a.sO = function() {
this.kI.playingStartTime || (this.kI.playingStartTime = Date.now()), this.kI.playStartMS = this.kI.playStartMS || performance.now(), this.kI.actualPlayStartMS = this.kI.actualPlayStartMS || performance.now();
}, a.hO = function() {
this.kI.playStartMS && (this.kI.playDuration += performance.now() - this.kI.playStartMS), this.kI.actualPlayStartMS && (this.kI.actualPlayDuration += performance.now() - this.kI.actualPlayStartMS), this.kI.playStartMS = void 0, this.kI.actualPlayStartMS = void 0;
}, a.oO = function() {
this.kI.pauseCnt++, this.kI.pauseStartMS = this.kI.pauseStartMS || performance.now();
}, a.rO = function() {
this.kI.pauseStartMS && (this.kI.pauseDuration += performance.now() - this.kI.pauseStartMS), this.kI.pauseStartMS = void 0;
}, a.aO = function(t) {
this.kI.bufferingStartMS || (this.kI.blockCount++, this.kI.bufferingStartMS = performance.now(), t > 0.6 && this.kI.renderBlockCount++), this.kI.actualPlayStartMS && (this.kI.actualPlayDuration += performance.now() - this.kI.actualPlayStartMS), this.kI.actualPlayStartMS = void 0;
}, a.eO = function() {
this.kI.bufferingStartMS && (this.kI.bufferTime += performance.now() - this.kI.bufferingStartMS, this.kI.bufferingStartMS = void 0);
}, a.cO = function() {
this.Ci.i(zr, "first frame"), this.Do.stat.firstFrameLoaded = !0;
var t = this.kI;
t.firstScreenTotalDuration = t.firstScreenTotalDuration || Math.round(this.KI.duration), t.firstScreenDetails = t.firstScreenDetails || this.KI.details, t.playStartTime && this.KI.complete ? t.clickToFirstFrame = t.clickToFirstFrame || Math.max(1, this.KI.complete - t.playStartTime) : t.clickToFirstFrame = 1, this.ZI && this.ZI.setFirstScreenDuration(this.KI.duration, this.KI.details, t.clickToFirstFrame), this.Do.video && !this.Do.video.paused && this.sO();
}, a.nO = function() {
this.HI === void 0 && (this.HI = setInterval(this.$I, 1e4));
}, a.iO = function() {
this.HI && (clearTimeout(this.HI), this.HI = void 0);
}, a.uO = function() {
this.iO(), this.nO();
}, g()(_, [{ key: "runningStartTime", get: function() {
return this.GI;
} }, { key: "sid", get: function() {
return this.kI.sessionId;
} }, { key: "snapshot", get: function() {
var t = this.Do.loadRec, i = this.Do.stat;
return s()({ streams: t.streams, live: i.isLive, liveShift: i.liveShiftActive, demuxer: i.demuxerType, decSimd: i.wasmSimd, decThreads: i.wasmThreads, decoderType: i.wasmDecoder }, this.kI);
} }, { key: "data", get: function() {
return this.kI;
} }, { key: "audienceStat", get: function() {
var t, i = this.kI, c = dl(i), u = this.Do.stat, v = this.Do.loadRec, R = { play_duration: c.play, actual_play_duration: c.actualPlay, traffic: Math.round(v.traffic / 1024), buffer_time: c.buffer, block_cnt: i.blockCount, render_block_cnt: i.renderBlockCount, click_to_first_frame: i.playStartTime && i.clickToFirstFrame || 0, first_screen_total_duration: Math.round(i.firstScreenTotalDuration) || 0, first_screen_details: i.firstScreenDetails || this.KI.details || null, error_code: i.errorCode || 0, error_message: i.errorMessage || "", remux_process_type: (this.Do.streamingMuxEnabled ? 1 : 0) + (u.gopRemux ? 1 : 0), hidden_start: this.WI ? 1 : 0, current_running_time: Math.round(performance.now() - i.startTime), running_time: Math.round(performance.now() - this.GI), smooth_bitrate: i.smoothBitrate, start_bitrate: i.startBitrate || 0, abr: this.Do.config.adaptive ? 1 : 0, pause_cnt: i.pauseCnt, traffic_vcodec: v.trafficGroupedByVCodecType, traffic_level: v.trafficGroupedByLevel, decoded_video_frames: i.decodedFrames, dropped_video_frames: i.droppedFrames + i.muxDroppedFrames, pause_duration: c.pause, seek_cnt: i.seekCnt, seek_duration: i.seekDuration, seek_load_cnt: i.seekLoadCnt, seek_load_duration: i.seekLoadDuration, start_sec: u.isLive ? 0 : Math.round(this.Do.config.startFromSec || 0), on_line_change: i.onLineChange, visibility_change: i.visibilityChange, heartbeat_timeout: i.heartbeatTimeout, load_cnt: i.loadCnt, refresh_cnt: i.refreshCnt, media_buffered_v: i.bufferedEndV, media_buffered_a: i.bufferedEndA, remux_worker: this.Do.stat.webWorker ? 1 : 0, av_separated: this.Do.stat.avSeparated ? 1 : 0 };
if (u.retryInfo.hasData && (R.retry_record = u.retryInfo.mergedBeacon, R.retry_cnt = u.retryInfo.retryCount), i.wasmDecErr && (R.wasm_dec_err = i.wasmDecErr), s()(R, lo(), al(this.Do, i), ho(), uo(), cl((t = this.Do.loadRec.currentLoad) == null ? void 0 : t.mediaInfo), ll(this.Do), ul(this.Do), hl(this.Do), ol()), R.metadata = sl(i), u.coreType === h.a.mse && this.Do.mse && (R.mse_buffer_full = this.Do.mse.stat.mseBufferFull, R.mse_remove = this.Do.mse.stat.mseRemove, R.key_frame_cnt = i.keyFrame, u.box === h.i.mp4 && (R.mp4_moov_size = i.mp4MoovSize, i.mp4CompatibleBrands !== void 0 && (R.mp4_compatible_brands = i.mp4CompatibleBrands), i.mp4FastStart !== void 0 && (R.mp4_fast_start = i.mp4FastStart ? 1 : 0), i.mp4MoovNoPs !== void 0 && (R.mp4_moov_no_ps = i.mp4MoovNoPs ? 1 : 0)), R.a_remux_sample_cnt = i.audioRemuxSampleCount, R.v_remux_sample_cnt = i.videoRemuxSampleCount, R.a_remux_duration = Math.floor(1e3 * i.audioRemuxDuration), R.v_remux_duration = Math.floor(1e3 * i.videoRemuxDuration)), typeof this.Do.config.audioEnabled == "boolean" && (R.a_enabled = this.Do.config.audioEnabled ? 1 : 0), typeof this.Do.config.videoEnabled == "boolean" && (R.v_enabled = this.Do.config.videoEnabled ? 1 : 0), v.muxA && (R.mux_a = v.muxA), v.muxV && (R.mux_v = v.muxV), v.fillA && (R.fill_a = v.fillA), v.fillV && (R.fill_v = v.fillV), v.droppedA && (R.dropped_a = v.droppedA), v.droppedV && (R.dropped_v = v.droppedV), i.muxDroppedFrames && (R.mux_dropped_video_frames = i.muxDroppedFrames), be(u.box) && (R.unknown_ts_packet_count = i.unknownTSPacketCount, R.audio_non_monotonous = i.audioNonMonotonous, R.aac_overhead = i.aacOverhead), typeof i.decLibLoadDuration == "number" && (R.dec_lib_load_duration = Math.round(i.decLibLoadDuration), R.dec_lib_hit = i.decLibCacheHit || ""), this.Do.stat.coreType === h.a.native) {
var Q = this.Do.stat.retryInfo.getLastMseError();
Q && (R.last_error_code = i.errorCode, R.last_error_message = i.errorMessage, R.error_code = Q.code, R.error_message = Q.reason);
}
return R;
} }]);
}(to), Ot = "kernel", fl = function(A) {
function _(t, i) {
var c;
return (c = A.call(this) || this).eA = void 0, c.Do = void 0, c.fO = void 0, c.nA = void 0, c.AO = new x.EventEmitter(), c.Ci = void 0, c.vO = !1, c.dO = void 0, c.Ai = void 0, c.lO = void 0, c.Tg = function(u) {
var v = c.Do;
u.levels = v.lctx.levels.map(function(se) {
return se.getKLevel();
}), u.currentLevel = v.lctx.currentIdx, u.auto = v.lctx.abr, u.levels = v.lctx.levels.map(function(se) {
return se.getKLevel();
});
var R = v.lctx.audioTracks;
R && R.length && (u.audioTrack = v.lctx.audioIdx, u.audioTracks = R.map(function(se) {
return { lang: se.lang, qualityLabel: se.qualityLabel, qualityType: se.qualityType, bitrate: se.bitrate, groupId: se.groupId };
}));
var Q = v.lctx.subtitleTracks;
Q && Q.length && (u.subtitleTrack = v.lctx.subtitleIdx, u.subtitleTracks = Q.map(function(se) {
return { lang: se.lang, name: se.name, groupId: se.groupId };
})), u.currentLevel = v.lctx.currentIdx, u.auto = v.lctx.abr, u.isLive = v.stat.isLive, v.stat.stereoType !== void 0 && (u.stereoType = v.stat.stereoType);
}, c.bO = function(u) {
c.pO(u);
}, c.sb = function(u) {
u.type === h.h.retry && (c.nA = void 0);
}, c.mO = function(u) {
u.pos = Math.floor(c.eA.currentTime), u.ts = Math.floor(performance.now());
}, c.Di = function(u) {
if (c.Ci.i(Ot, "on error", u), !u.preventFollowUp) {
var v = c.Do;
if (u.details === L.a.MANIFEST_PARSING_ERROR)
try {
Ks.isSrcEmpty(c.Do.src) && (c.Ci.i(Ot, "src empty", c.Do.src), u.details = L.a.SRC_EMPTY), v.src ? typeof v.src == "string" ? u.reason += "src str:" + v.src.slice(0, 1024) : v.src instanceof Blob ? u.reason += "src: blob" : u.reason += "src other:" + JSON.stringify(v.src).slice(0, 1024) : u.reason += "src:" + v.src;
} catch (Q) {
u.reason += Q.message;
}
var R = Object(L.d)(u.details, u.reason, u.statusCode || 0);
u.code = R, c.nA || (c.nA = u), u.fatal && c.stopLoad();
}
}, c.gO = function(u) {
c.Ci.i(Ot, "window error:", u.message);
try {
c.Ci.i(Ot, "window error stack:", u.error.stack);
} catch (v) {
}
}, c.yO = function() {
c.Do.evt.emit(w.a.VISIBILITY_CHANGE, { hidden: document.hidden });
}, c.eA = t, c.Do = new Hr(i || {}, c.eA), c.Yb(), c.Ci = c.Do.logger, typeof location < "u" && c.Ci.i(Ot, "href: " + location.href), c.Ci.i(Ot, Hr.packName + ", " + Hr.version + " build: " + Hr.buildTime + " cors: " + (t == null ? void 0 : t.crossOrigin) + " autoplay: " + (t == null ? void 0 : t.autoplay) + " dom: " + t.tagName, i), (!c.Do.config || c.Do.config.audioEnabled === !1 && c.Do.config.videoEnabled === !1) && setTimeout(function() {
c.zA(Object(L.e)(L.b.OTHER_ERROR, L.a.CONFIG_ERROR, "config data error"));
}, 0), c.fO = new J_(c.Do), c.Do.config.src && (c.lO = c._O()), c.dO = new L_(c.Do, function(u) {
var v;
return (v = c.lO) == null ? void 0 : v.internalSeek(u);
}), c.Ai = new y_(c.Ci, c.Do.evt), c.Ai.register(c.dO), c.Ai.register(c.fO), c.Ai.register(new C_(c.Do, c.AO)), c.O.push(c.Ai, c.dO, c.fO), c.Ci.i(Ot, "config", c.Do.config), Hr.instanceCount++, ge() || (window.addEventListener("error", c.gO), document.addEventListener("visibilitychange", c.yO)), c;
}
y()(_, A), _.isSupport = function(t) {
if (h.i.webrtc === (t == null ? void 0 : t.box))
return ht.isWebRTCSupported();
if (t != null && t.nativeFirst)
return ht.isVideoBoxSupported(t == null ? void 0 : t.box);
var i = ht.isSupported();
if (i) {
var c = !0;
t && (c = !(!t.isLive || t.box !== h.i.flv));
var u = !c || Ia.isStreamingSupported();
return i && !!u;
}
return ht.isVideoBoxSupported(t == null ? void 0 : t.box);
}, _.videoCodecCapabilities = function(t) {
return ht.getVideoCodecCompatibilityByCodec(t);
};
var a = _.prototype;
return a.on = function(t, i) {
this.Ci.i(Ot, "call on " + t), this.AO.on(t, i);
}, a.once = function(t, i) {
this.Ci.i(Ot, "call once " + t), this.AO.once(t, i);
}, a.removeAllListeners = function(t) {
this.Ci.i(Ot, "call removeAllListeners"), this.AO.removeAllListeners(t);
}, a.off = function(t, i) {
this.Ci.i(Ot, "call off " + t), this.AO.off(t, i);
}, a.listeners = function(t) {
return this.AO.listeners(t);
}, a.emit = function(t, i) {
return this.AO.emit(t, i);
}, a.listenerCount = function(t) {
return this.AO.listenerCount(t);
}, a.prependListener = function(t, i) {
this.AO.prependListener(t, i);
}, a.prependOnceListener = function(t, i) {
this.AO.prependOnceListener(t, i);
}, a.load = function(t, i) {
var c, u = this;
if (this.Ci.i(Ot, "call kernel load", t, i), this.fO.data.startTime > 0 && this.Ci.i(Ot, "play summary data:", this.fO.audienceStat), t && this.Do.setSrc(t), this.Do.src)
if (_.isSupport({ box: this.Do.stat.box, isLive: this.Do.stat.isLive, nativeFirst: this.Do.stat.native })) {
var v, R;
typeof (i == null ? void 0 : i.startFromSec) == "number" ? this.Do.stat.startFromSec = i.startFromSec : t && (this.Do.stat.startFromSec = -1), this.Do.stat.multipart && this.Do.config.resourceBuffer && Br(this.Do.config.resourceBufferSize), t && ((c = this.lO) == null ? void 0 : c.type) !== ((R = this.Do).stat.box === h.i.webrtc ? h.a.rtc : R.stat.native ? h.a.native : h.a.mse) && ((v = this.lO) == null || v.destroy(), this.lO = void 0), this.Do.fallback.register(le.NEXT_DESC, new T_(this.Do).setRetryFunc(this.CO.bind(this))), this.Do.fallback.register(le.SWAP_264, new I_(this.Do).setRetryFunc(this.CO.bind(this))), this.RA();
} else
setTimeout(function() {
u.zA(Object(L.e)(L.b.OTHER_ERROR, L.a.UNSUPPORTED, "unsupported: " + u.Do.stat.box + " live: " + u.Do.stat.isLive + " native: " + u.Do.stat.native));
}, 0);
else
this.zA(Object(L.e)(L.b.OTHER_ERROR, L.a.SRC_EMPTY, "url empty"));
}, a.getTimeNow = function() {
var t;
return ((t = this.Do.liveTime) == null ? void 0 : t.serverNowMs) || null;
}, a.setAvailableAbrLevels = function(t) {
this.Ci.i(Ot, "setAvailableAbrLevels", t), this.Do.lctx.availableList = t.splice(0), this.lO && "onAbrLevelsUpdated" in this.lO && this.lO.onAbrLevelsUpdated();
}, a.preload = function(t, i) {
this.Ci.i(Ot, "call preload");
}, a.isTimeinBuffered = function(t) {
return this.Do.stat.box !== h.i.webrtc && this.Do.isTimeinBuffered(t);
}, a.resume = function() {
var t, i, c = this;
this.Ci.i(Ot, "call resume"), (t = this.lO) == null || t.resume(), this.eA.paused && ((i = this.eA.play()) == null || i.catch(function(u) {
return c.Ci.i(Ot, "resume, call play() fail.", u);
}));
}, a.destroy = function() {
var t;
this.Ci.i(Ot, "call kernel destroy. play summary data:", this.fO.audienceStat), this.vO && (Hr.instanceCount--, this.vO = !0), mi(), this.Do.fallback.unregisterAndDestroy(le.NEXT_DESC), this.Do.fallback.unregisterAndDestroy(le.SWAP_264), this.Do.fallback.unregisterAndDestroy(le.SWAP_CORE), A.prototype.destroy.call(this), (t = this.lO) == null || t.destroy(), this.Do.destroy(), this.removeAllListeners(), ge() || (window.removeEventListener("error", this.gO), document.removeEventListener("visibilitychange", this.yO));
}, a.refresh = function() {
var t, i;
this.Ci.i(Ot, "call kernel refresh"), this.fO.onRefresh(), this.nA = void 0, (t = this.Do.cOutput) == null || t.reset(), (i = this.lO) == null || i.refresh();
}, a.stopLoad = function() {
var t;
this.Ci.i(Ot, "call kernel stopLoad"), (t = this.lO) == null || t.stopLoad();
}, a.getStreamTime = function(t) {
var i = this.Do.streamTime.getStreamTime(t / 1e3);
return i ? 1e3 * i : NaN;
}, a.getAudienceStat = function() {
return this.fO.audienceStat;
}, a.getMediaInfo = function() {
var t;
return s()({}, (t = this.Do.loadRec.currentLoad) == null ? void 0 : t.mediaInfo);
}, a.experiment = function(t) {
this.Ci.i(Ot, "experiment", t);
}, a.liveEnd = function() {
this.Ci.i(Ot, "call liveEnd"), this.lO && "liveEnd" in this.lO && this.lO.liveEnd();
}, a.seekToNextFrame = function() {
this.Ci.i(Ot, "call seekToNextFrame"), this.lO && "seekToNextFrame" in this.lO ? this.lO.seekToNextFrame() : this.IO();
}, a.seekToPrevFrame = function() {
this.Ci.i(Ot, "call seekToPrevFrame"), this.lO && "seekToPrevFrame" in this.lO ? this.lO.seekToPrevFrame() : this.IO();
}, a.seekByFrameIndex = function(t) {
if (this.Ci.i(Ot, "call seekByFrameIndex", t), this.lO && "setCurretVideoFrame" in this.lO)
return this.lO.setCurretVideoFrame(t);
this.IO();
}, a.screenshot = function(t) {
var i;
t && (t = JSON.parse(JSON.stringify(t))), this.Ci.i(Ot, "call screenshot", t), (i = this.lO) == null || i.screenshot(t);
}, a.RA = function(t) {
this.nA = void 0, this.lO || (this.lO = this._O()), this.lO && (this.Do.fallback.hasFallback(le.SWAP_CORE) || (this.lO.type === h.a.mse ? this.Do.fallback.register(le.SWAP_CORE, new w_(this.Do).setRetryFunc(this.OO.bind(this))) : this.lO.type === h.a.native && this.Do.fallback.register(le.SWAP_CORE, new R_(this.Do).setRetryFunc(this.wO.bind(this)))), this.lO.load(t), this.Do.stat.coreType = this.lO.type);
}, a._O = function() {
var t = this.Do, i = function(c) {
return c.stat.native ? new S_(c) : c.stat.box !== h.i.webrtc && Js ? new Js(c) : c.stat.box === h.i.webrtc && Gc ? new Gc(c) : void 0;
}(t);
if (i)
return this.Ci.i(Ot, "init av core. type: " + i.type), t.stat.coreType = i.type, i;
this.zA(Object(L.e)(L.b.OTHER_ERROR, L.a.UNSUPPORTED, "init core error. " + t.stat.box + " native: " + t.stat.native + " unsupported."));
}, a.OO = function() {
this.CO(h.a.native);
}, a.wO = function() {
this.CO(h.a.mse);
}, a.CO = function(t) {
var i, c, u = this, v = this.eA.paused;
!this.Do.live && this.Do.stat.startFromSec <= 0 && (this.Do.stat.startFromSec = this.eA.currentTime), (i = this.lO) == null || i.destroy(), this.lO = void 0, t !== void 0 && (this.Do.stat.native = t !== h.a.mse), this.Do.stat.demuxerType = void 0, this.RA(h.h.retry), v || (c = this.eA.play()) == null || c.catch(function(R) {
return u.Ci.i(Ot, "recover, call play() fail.", R);
});
}, a.pO = function(t) {
var i = this.Do.cOutput;
i && (t === void 0 && (t = { enabled: !0, type: i.rendererType, canvas: i.rendererType === h.s.canvas && i.canvas ? i.canvas : void 0 }), this.Ci.i(Ot, "video renderer change", t), t.canvas && this.emit(w.a.H265_DETECTED, { canvas: t.canvas, message: "", enabled: t.enabled, decoder: h.d.wasm }));
}, a.IO = function() {
this.zA(Object(L.e)(L.b.MEDIA_ERROR, L.a.CANNOT_SEEK_BY_FRAME_INDEX, "unsupported", { fatal: !1 }));
}, a.zA = function(t) {
this.Do.evt.emit(w.a.ERROR, t);
}, a.Yb = function() {
var t = this.Do.evt;
t.on(w.a.ERROR, this.Di), t.on(w.a.MANIFEST_PARSED, this.Tg), t.on(w.a.VIDEO_RENDERER_CHANGE, this.bO), t.on(w.a.LOAD, this.sb), t.on(w.a.RETRY, this.mO);
}, g()(_, [{ key: "liveShiftType", get: function() {
return this.Do.stat.liveShiftType;
} }, { key: "liveShift", get: function() {
return this.Do.stat.liveShiftActive;
} }, { key: "liveShiftDelaySec", get: function() {
return this.Do.config.liveShiftDelaySec;
} }, { key: "currentVideoFrame", get: function() {
return this.lO && "getCurrentVideoFrame" in this.lO ? this.lO.getCurrentVideoFrame() : 0;
}, set: function(t) {
this.Ci.i(Ot, "call set currentVideoFrame", t), this.lO && "setCurretVideoFrame" in this.lO && this.lO.setCurretVideoFrame(t);
} }, { key: "totalVideoFrames", get: function() {
return this.lO && "getTotalVideoFrames" in this.lO ? this.lO.getTotalVideoFrames() : 0;
} }, { key: "audioTrack", get: function() {
return this.Do.lctx.audioIdx || 0;
}, set: function(t) {
var i;
this.Ci.i(Ot, "call set audioTrack", t), this.Do.config.audioEnabled === !1 && (this.Ci.i(Ot, "set audioTrack failed. conf audio enabled false"), this.emit(w.a.AUDIO_TRACK_SWITCH_FAILED)), this.lO && "setAudioTrack" in this.lO && ((i = this.lO) == null || i.setAudioTrack(t));
} }, { key: "subtitleTrack", get: function() {
return this.Do.lctx.subtitleIdx || 0;
}, set: function(t) {
var i;
this.Ci.i(Ot, "call set subtitleTrack", t), this.lO && "setSubtitleTrack" in this.lO && ((i = this.lO) == null || i.setSubtitleTrack(t));
} }, { key: "currentLevel", get: function() {
return this.Do.lctx.currentIdx || 0;
}, set: function(t) {
if (this.Ci.i(Ot, "call set currentLevel from: " + this.Do.lctx.currentIdx + " to: " + t + " ", this.Do.lctx.abr), this.lO && "setCurrentLevel" in this.lO)
if (t < 0 && !this.Do.isAbrAvailable)
this.Ci.i(Ot, "set currentLevel failed. unsupported auto"), this.emit(w.a.LEVEL_SWITCH_FAILED);
else if (this.Do.config.videoEnabled === !1)
this.Ci.i(Ot, "set currentLevel failed. conf video enabled false"), this.emit(w.a.LEVEL_SWITCH_FAILED);
else {
var i;
(i = this.lO) == null || i.setCurrentLevel(t);
}
else
this.Ci.i(Ot, "set nextLevel failed. unsupported"), this.emit(w.a.LEVEL_SWITCH_FAILED);
} }, { key: "nextLevel", get: function() {
return this.Do.lctx.nextIdx || 0;
}, set: function(t) {
if (this.Ci.i(Ot, "call set nextLevel from: " + this.Do.lctx.nextIdx + " to " + t), this.lO && "setNextLevel" in this.lO)
if (t < 0 && !this.Do.isAbrAvailable)
this.Ci.i(Ot, "set nextLevel failed. unsupported auto"), this.emit(w.a.LEVEL_SWITCH_FAILED);
else if (this.Do.config.videoEnabled === !1)
this.Ci.i(Ot, "set nextLevel failed. conf video enabled false"), this.emit(w.a.LEVEL_SWITCH_FAILED);
else {
var i;
(i = this.lO) == null || i.setNextLevel(t);
}
else
this.Ci.i(Ot, "set nextLevel failed. unsupported"), this.emit(w.a.LEVEL_SWITCH_FAILED);
} }, { key: "startLevel", get: function() {
return this.Do.lctx.startIdx || 0;
}, set: function(t) {
this.Ci.i(Ot, "call set startLevel", t), this.Do.lctx.startIdx = t;
} }, { key: "outputLog", get: function() {
return this.Do.logger.getOutput();
}, set: function(t) {
this.Ci.i(Ot, "call set output log", t), this.Do.logger.setOutput(t);
} }, { key: "autoLevelEnabled", get: function() {
return this.Do.lctx.abr;
} }, { key: "monitorData", get: function() {
return this.fO && this.lO ? s()(this.fO.snapshot, { trackBufInfo: this.lO.getTrackBufInfo() }) : null;
} }, { key: "currentLevelTimeInfo", get: function() {
var t = this.Do.lctx.current;
if (t && t.timeInfo)
return t.timeInfo;
} }, { key: "instanceId", get: function() {
return this.Do.id;
} }], [{ key: "version", get: function() {
return Hr.version;
} }, { key: "buildTime", get: function() {
return Hr.buildTime;
} }, { key: "MediaBox", get: function() {
return h.i;
} }, { key: "Events", get: function() {
return { REPORT: w.a.REPORT, ERROR: w.a.ERROR, LEVEL_SWITCHING: w.a.LEVEL_SWITCHING, LEVEL_SWITCHED: w.a.LEVEL_SWITCHED, LEVEL_SWITCH_PLAYING: w.a.LEVEL_SWITCH_PLAYING, LEVEL_SWITCH_FAILED: w.a.LEVEL_SWITCH_FAILED, AUDIO_TRACK_SWITCHING: w.a.AUDIO_TRACK_SWITCHING, AUDIO_TRACK_SWITCHED: w.a.AUDIO_TRACK_SWITCHED, AUDIO_TRACK_UPDATED: w.a.AUDIO_TRACK_UPDATED, SUBTITLE_TRACK_SWITCHED: w.a.SUBTITLE_TRACK_SWITCHED, MANIFEST_PARSED: w.a.MANIFEST_PARSED, LEVEL_UPDATED: w.a.LEVEL_UPDATED, LOAD_END: w.a.LOAD_END, VIDEO_RENDERER_CHANGE: w.a.VIDEO_RENDERER_CHANGE, SCREENSHOT: w.a.SCREENSHOT };
} }, { key: "Reports", get: function() {
return s()({}, pr);
} }]);
}(F.a);
function eA(A, _) {
return ge() ? void 0 : new fl(A, _);
}
}]);
Ai === void 0 && console.error("esm-webpack-plugin: nothing exported!");
const WA = Ai.default;
Ai.createKernel;
Ai.AbstractDestroyable;
Ai.CanvasContextType;
Ai.CodecType;
Ai.DestroyableList;
Ai.Decoder;
Ai.DemuxerType;
Ai.DownloadStatus;
Ai.ErrorDetails;
Ai.ErrorTypes;
Ai.HttpRangeType;
const Ar = Ai.KEvents;
Ai.LiveShiftType;
Ai.LogLevel;
Ai.MediaBox;
Ai.ReportTypes;
Ai.StereoType;
Ai.VideoDecBlockPolicy;
Ai.VideoDropFramePolicy;
Ai.VideoRendererType;
Ai.WasmDecoder;
const An = {
"kwai-player": "_kwai-player_1ufc0_2",
"kwai-player-video-interactive": "_kwai-player-video-interactive_1ufc0_11",
"kwai-player-poster": "_kwai-player-poster_1ufc0_19",
"kwai-player-video": "_kwai-player-video_1ufc0_11",
"kwai-player-disable-scroll": "_kwai-player-disable-scroll_1ufc0_52",
"kwai-player-yoda": "_kwai-player-yoda_1ufc0_56"
}, Ao = "kwai-player-id", Uo = class In {
static next() {
if (xu.available) {
const r = In._ls.read(Ao, !1);
let n = In._id;
return typeof r == "number" ? (n = this.getNextId(r), this._ls.write(Ao, n)) : (n = this.getNextId(n), this._ls.write(Ao, n)), In._id = n, n;
} else
return In._id = In.getNextId(In._id), In._id;
}
static get MAX_ID() {
return 999;
}
static getNextId(r) {
return r++, r > In.MAX_ID ? 0 : r;
}
};
tt(Uo, "_id", 0), tt(Uo, "_ls", new xu());
let YA = Uo;
class da {
static verify(r) {
return !!(r && r.liveStreamId && (Array.isArray(r.liveAdaptiveManifest) && r.liveAdaptiveManifest.length || Array.isArray(r.multiResolutionPlayUrls) && r.multiResolutionPlayUrls.length || Array.isArray(r.playUrls) && r.playUrls.length || r.hlsPlayUrl));
}
static parse(r) {
if (da.verify(r)) {
let n;
return r.liveAdaptiveManifest && r.liveAdaptiveManifest.length ? n = r.liveAdaptiveManifest[0] : r.multiResolutionPlayUrls && r.multiResolutionPlayUrls.length && (n = da._multiResolution2Manifest(r.multiResolutionPlayUrls)), sa && r.hlsPlayUrl ? n ? [{ src: n }, { src: r.hlsPlayUrl }] : r.hlsPlayUrl : n;
}
}
static _multiResolution2Manifest(r) {
return {
version: "1",
adaptationSet: {
representation: r.map((n, o) => {
var s;
return {
id: o,
url: (s = n.urls[0]) == null ? void 0 : s.url,
name: n.name,
bitrate: 0,
qualityType: n.type,
defaultSelect: n.defaultSelect
};
}).filter((n) => n.url)
}
};
}
}
var Uu = /* @__PURE__ */ ((e) => (e[e.CTOR_ERROR = 1e4] = "CTOR_ERROR", e))(Uu || {});
class QA {
/**
* 验证数据有效性
* @param data - 待验证数据
*/
static verify(r) {
return r && Object.prototype.hasOwnProperty.call(r, "version") && Object.prototype.hasOwnProperty.call(r, "adaptationSet") && Object.prototype.hasOwnProperty.call(r.adaptationSet, "representation") && Array.isArray(r.adaptationSet.representation) && r.adaptationSet.representation.length > 0 ? r.adaptationSet.representation.reduce((n, o) => !!(n && o.url && o.bitrate && o.qualityType), !0) : !1;
}
}
class XA {
/**
* 验证数据有效性
* @param data - 待验证数据
*/
static verify(r) {
return r && r.adaptationSet && r.adaptationSet.length ? r.adaptationSet.reduce((n, o) => !!(n && o.representation && o.representation.length), !0) : !1;
}
}
const $A = /\.[^./\\?#]+(?=$|[?#])/i;
function ZA(e) {
const r = e.toLocaleLowerCase().match($A);
return r ? r[0] : "";
}
class Ua {
static parse(r) {
if (typeof r == "string")
try {
return r = JSON.parse(r), Ua._parseManifest(r);
} catch (n) {
return Ua._parseUrl(r);
}
else if (typeof r == "object")
return Ua._parseManifest(r);
}
static _parseUrl(r) {
return ZA(r) === ".flv" ? {
isLive: !0,
src: {
liveStreamId: "",
playUrls: [{
url: r
}]
}
} : {
isLive: !1,
src: [{ url: r }]
};
}
static _parseManifest(r) {
return XA.verify(r) ? {
isLive: !1,
src: r
} : QA.verify(r) ? {
isLive: !0,
src: {
liveStreamId: "",
liveAdaptiveManifest: [r]
}
} : da.verify(r) ? {
isLive: !0,
src: r
} : {
isLive: !1
};
}
}
const Cl = typeof document > "u" ? void 0 : document.createElement("video");
function qA() {
return !!(Cl != null && Cl.requestPictureInPicture);
}
const Tl = "fullscreen";
class JA {
constructor(r, n) {
tt(this, "_evt"), tt(this, "_logger"), tt(this, "_element"), tt(this, "_isFillWindow", !1), tt(this, "_originStyle"), tt(this, "_isSupportFullscreen", !0), tt(this, "_onFullscreenChange", () => {
this._logger.i(Tl, "_onFullscreenChange", this.isFull()), this.isFull() || (this._recoverStyle(), document.body.classList.remove(An["kwai-player-disable-scroll"])), this._isFillWindow = !1, this._evt.emit("fullChange", {
type: _n.SYSTEM,
isFull: this.isFull()
});
}), this._evt = r, this._logger = n, !(typeof document > "u") && (this._isSupportFullscreen = typeof this._getExitFullscreenFunc() < "u" && !(vn.os.name === "iOS" && vn.device.type === "mobile"), "onfullscreenchange" in document ? (document.addEventListener("fullscreenchange", this._onFullscreenChange), document.addEventListener("fullscreenerror", this._onFullscreenChange)) : "onwebkitfullscreenchange" in document && (document.addEventListener("webkitfullscreenchange", this._onFullscreenChange), document.addEventListener("webkitfullscreenerror", this._onFullscreenChange)));
}
destroy() {
document.removeEventListener("fullscreenchange", this._onFullscreenChange), document.removeEventListener("fullscreenerror", this._onFullscreenChange), document.removeEventListener("webkitfullscreenchange", this._onFullscreenChange), document.removeEventListener("webkitfullscreenerror", this._onFullscreenChange);
}
/**
* 全屏或网页全屏
* @param e 需要全屏的元素
*/
requestFull(r, n) {
n === _n.SYSTEM ? this.requestFullscreen(r) : n === _n.WINDOW ? this.requestFillWindow(r) : this._isSupportFullscreen ? this.requestFullscreen(r) : this.requestFillWindow(r);
}
/**
* 退出全屏或网页全屏
*/
exitFull(r) {
if (r === _n.SYSTEM)
return this.exitFullscreen();
if (r === _n.WINDOW)
return this.exitFillWindow();
this.isFull(_n.SYSTEM) ? this.exitFullscreen() : this.exitFillWindow();
}
/**
* 是否是全屏或网页全屏状态
* @returns 全屏状态
*/
isFull(r) {
return r === _n.SYSTEM ? this.isFullScreen() : r === _n.WINDOW ? this.isFillWindow() : this.isFullScreen() || this.isFillWindow();
}
/**
* 全屏
* @param element 需要全屏的元素
* @returns
*/
requestFullscreen(r) {
this._element = r, this._originStyle || this._saveOriginStyle(r), (vn.os.name === "Mac OS" || vn.browser.name === "IE" || vn.os.name === "iOS" && vn.device.type !== "mobile") && (r.style.width = "100%", r.style.height = "100%", r.style.background = "black");
const n = r;
let o;
n.requestFullscreen ? o = n.requestFullscreen() : n.mozRequestFullscreen ? o = n.mozRequestFullscreen() : n.mozRequestFullScreen ? o = n.mozRequestFullScreen() : n.webkitRequestFullscreen ? o = n.webkitRequestFullscreen() : n.webkitRequestFullScreen ? o = n.webkitRequestFullScreen() : n.msRequestFullscreen && (o = n.msRequestFullscreen()), typeof Promise < "u" && o instanceof Promise && o.catch((s) => this._logger.e(Tl, s));
}
/**
* 退出全屏
*/
exitFullscreen() {
this._recoverStyle(), this._element = void 0;
const r = document;
r.exitFullscreen ? r.exitFullscreen() : r.webkitCancelFullScreen ? r.webkitCancelFullScreen() : r.mozCancelFullScreen ? r.mozCancelFullScreen() : r.msExitFullscreen && r.msExitFullscreen();
}
/**
* 当前是否是全屏状态
* @returns 全屏状态
*/
isFullScreen() {
const r = document;
return !!(r.fullscreen || r.fullscreenElement || r.isFullScreen || r.webkitIsFullScreen || r.mozFullScreen || r.msFullscreenElement);
}
/**
* 网页全屏
* @param element 需要全屏的元素
* @returns
*/
requestFillWindow(r) {
this._element = r, this._originStyle || this._saveOriginStyle(r), r.style.width = "100%", r.style.height = "100%", r.style.background = "black", r.style.position = "fixed", r.style.left = "0", r.style.top = "0", r.style.zIndex = "99999", document.body.classList.add(An["kwai-player-disable-scroll"]), this._isFillWindow = !0, this._evt.emit("fullChange", {
type: "window",
isFull: !0
});
}
/**
* 退出网页全屏
*/
exitFillWindow() {
this._recoverStyle(), this._isFillWindow = !1, this._element && (this._element.style.zIndex = "auto"), this._element = void 0, document.body.classList.remove(An["kwai-player-disable-scroll"]), this._evt.emit("fullChange", {
type: "window",
isFull: !1
});
}
/**
* 当前是否是网页全屏状态
* @returns 网页全屏状态
*/
isFillWindow() {
return this._isFillWindow;
}
isFullscreenAvailable(r) {
return r !== _n.WINDOW && typeof document < "u" ? !!document.body.requestFullscreen || !!document.body.webkitRequestFullscreen || !!document.body.msRequestFullscreen || !!document.body.mozRequestFullscreen : !0;
}
_getExitFullscreenFunc() {
const r = document;
return r.exitFullscreen || r.webkitCancelFullScreen || r.mozCancelFullScreen || r.msExitFullscreen;
}
_saveOriginStyle(r) {
this._originStyle = {
position: r.style.position,
background: r.style.background,
width: r.style.width,
height: r.style.height,
left: r.style.left,
right: r.style.right
};
}
_recoverStyle() {
if (this._element)
for (const r in this._originStyle)
this._element.style[r] = this._originStyle[r];
this._originStyle = void 0;
}
}
const ev = "ControlsPlugin", tv = "I18nPlugin", iv = "LoggerPlugin", rv = "HotkeyPlugin", nv = "PlayInfoPlugin", av = "RotatePlugin", sv = "PreviewPlugin", ov = "MaskPlugin", cv = "VRPlugin", lv = "DanmakuPlugin";
var uv = /* @__PURE__ */ ((e) => (e.DARK = "dark", e.LIGHT = "light", e))(uv || {}), hv = /* @__PURE__ */ ((e) => (e.BOTTOM = "bottom", e.PLAY_BAR = "playBar", e.NONE = "none", e))(hv || {}), dv = /* @__PURE__ */ ((e) => (e.PLAY_BAR_LEFT = "playBarLeft", e.PLAY_BAR_RIGHT = "playBarRight", e.CONTEXT_MENU = "contextMenu", e))(dv || {});
class AC {
constructor() {
tt(this, "_callbacks", []);
}
add(r) {
this._callbacks.push(r);
}
remove(r) {
const n = this._callbacks.findIndex((o) => o === r);
n >= 0 && this._callbacks.splice(n, 1);
}
call(r) {
this._callbacks.forEach((n) => n(r));
}
destroy() {
this._callbacks.splice(0, this._callbacks.length);
}
}
class or extends Pu {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static isInstanceOfPlugin(r) {
return typeof r.beforeInstall == "function" && typeof r.afterInstall == "function" && typeof r.beforeUninstall == "function" && typeof r.afterUninstall == "function" && typeof r.getLabel == "function";
}
/**
* 控制条插槽按钮
*/
get controlsSoltBtns() {
}
/**
* 播放器实例化前钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
beforeInstall(r, n) {
}
/**
* 播放器实例化后钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
afterInstall(r, n) {
}
/**
* 播放器销毁前钩子
* @param player 播放器实例
*/
beforeUninstall(r) {
}
/**
* 播放器销毁后钩子
* @param player 播放器实例
*/
afterUninstall(r) {
}
}
tt(or, "label"), /**
* 版本
*/
tt(or, "version"), /**
* 当前环境是否支持
*/
tt(or, "isSupported");
const Bu = class Vu extends or {
/**
* @override
*/
getLabel() {
return Vu.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
};
tt(Bu, "label", ev);
let vC = Bu;
const Fu = class ju extends or {
/**
* @override
*/
getLabel() {
return ju.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
};
tt(Fu, "label", tv);
let gC = Fu;
const Hu = class Gu extends or {
/**
* @override
*/
getLabel() {
return Gu.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
/**
* 增加业务相关数据
* @param key 上报数据key
* @param value 上报数据
*/
addBizLog(r, n) {
}
appendSummaryField(r, n) {
}
};
tt(Hu, "label", iv);
let mC = Hu;
const zu = class Ku extends or {
/**
* @override
*/
getLabel() {
return Ku.label;
}
};
tt(zu, "label", rv);
let bC = zu;
const Wu = class Yu extends or {
/**
* @override
*/
getLabel() {
return Yu.label;
}
};
tt(Wu, "label", nv);
let EC = Wu;
const Qu = class Xu extends or {
/**
* @override
*/
getLabel() {
return Xu.label;
}
};
tt(Qu, "label", av);
let yC = Qu;
const $u = class Zu extends or {
/**
* @override
*/
getLabel() {
return Zu.label;
}
};
tt($u, "label", sv);
let CC = $u;
const qu = class Ju extends or {
/**
* @override
*/
getLabel() {
return Ju.label;
}
};
tt(qu, "label", ov);
let TC = qu;
const eh = class th extends or {
/**
* @override
*/
getLabel() {
return th.label;
}
};
tt(eh, "label", cv);
let IC = eh;
const ih = class rh extends or {
/**
* @override
*/
getLabel() {
return rh.label;
}
};
tt(ih, "label", lv);
let RC = ih;
const zi = "pluginBase", nh = class ah {
constructor() {
tt(this, "_instances", []);
}
static register(r, n = "append") {
Ii.i(zi, "register", r.label, r.version), r.label || Ii.i(zi, "register plugin label is empty.");
const o = this._plugins.findIndex((s) => s.label === r.label);
o >= 0 ? (Ii.i(zi, `register plugin label: ${r.label} exists.`), this._plugins.splice(o, 1, r)) : n === "append" ? this._plugins.push(r) : this._plugins.unshift(r);
}
static deregister(r) {
if (typeof r == "string") {
Ii.i(zi, "deregister", r);
const n = this._plugins.findIndex((o) => o.label === r);
if (n === -1) {
Ii.i(`${r} plugin unregistered`);
return;
}
this._plugins.splice(n, 1);
} else {
Ii.i(zi, "deregister", r.label);
const n = this._plugins.indexOf(r);
if (n === -1) {
Ii.i(`${r.label} plugin unregistered`);
return;
}
this._plugins.splice(n, 1);
}
}
initialize(r) {
const n = this._instances;
for (const o of ah._plugins)
try {
if (r && r[o.label] === !1)
continue;
if (o.isSupported === !1) {
Ii.i(zi, `initialize ${o.label}, ${o.version}. The current browser does not support this plugin.`);
continue;
}
Ii.i(zi, "initialize", o.label, o.version, r);
const s = new o();
or.isInstanceOfPlugin(s) ? n.push(s) : Ii.e(zi, `plugin type error: ${s}`);
} catch (s) {
Ii.e(zi, "plugin initialize error", s);
}
}
beforeInstallPlugins(r, n) {
for (const o of this._instances) {
const s = o.getLabel();
Ii.i(zi, "beforeInstallPlugins", n, s);
try {
if (!o.beforeInstall)
continue;
n && typeof n[s] == "object" ? o.beforeInstall(r, n[s]) : o.beforeInstall(r);
} catch (p) {
Ii.e(zi, "beforeInstallPlugins error", p);
}
}
}
afterInstallPlugins(r, n) {
for (const o of this._instances) {
const s = o.getLabel();
Ii.i(zi, "afterInstallPlugins", s, n);
try {
if (!o.afterInstall)
continue;
n && typeof n[s] == "object" ? o.afterInstall(r, n[s]) : o.afterInstall(r);
} catch (p) {
Ii.e(zi, "afterInstallPlugins error", p);
}
}
}
beforeUninstallPlugins(r) {
for (const n of this._instances)
try {
if (Ii.i(zi, "beforeUninstallPlugins", n.getLabel()), !n.beforeUninstall)
continue;
n.beforeUninstall.call(n, r);
} catch (o) {
Ii.e(zi, "plugin beforeUninstall error", o);
}
}
afterUninstallPlugins(r) {
for (const n of this._instances)
try {
if (Ii.i(zi, "afterUninstallPlugins", n.getLabel()), !n.afterUninstall)
continue;
n.afterUninstall.call(n, r);
} catch (o) {
Ii.e(zi, "plugin afterUninstall error", o);
}
this._instances = [];
}
getPlugin(r) {
for (let n = 0; n < this._instances.length; n++)
if (this._instances[n].getLabel() === r)
return this._instances[n];
}
getAllPlugins() {
return this._instances;
}
};
tt(nh, "_plugins", []);
let vo = nh;
const fv = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAC1JREFUWEft0EERAAAAAUH6lxbDZxU4s815PffjAAECBAgQIECAAAECBAgQIDAaPwAh6O5R/QAAAABJRU5ErkJggg==", at = "kwai-player", Bo = class Wr {
constructor(r, n) {
tt(this, "_pluginBase", new vo()), tt(this, "_eventHandlers"), tt(this, "_evt"), tt(this, "_mainDom"), tt(this, "_video"), tt(this, "_kernel"), tt(this, "_error"), tt(this, "_config"), tt(this, "_src", ""), tt(this, "_autoplay", !1), tt(this, "_preload", "none"), tt(this, "_poster", ""), tt(this, "_controls", "default"), tt(this, "_videoWidth", 0), tt(this, "_videoHeight", 0), tt(this, "_kernelLoaded", !1), tt(this, "_livePaused", !1), tt(this, "_canvas"), tt(this, "_mediaInfo"), tt(this, "_logger"), tt(this, "_isLiveShift", !1), tt(this, "_full"), tt(this, "_subContainerNumber", 0), tt(this, "_data"), tt(this, "_id"), tt(this, "_videoLayer"), tt(this, "_videoInteractiveLayer"), tt(this, "_posterLayer"), tt(this, "_preprocessSrcFunc"), tt(this, "_preprocessURL"), tt(this, "_kernelStartTimeout", 0), tt(this, "_instanceId"), tt(this, "_yodaDom"), tt(this, "_yoda"), tt(this, "_kernelType", "unknown"), tt(this, "_outputLogger"), tt(this, "_yodaEnabled", !0), tt(this, "_screenshotId", 1), tt(this, "_screenshotQueue", []), tt(this, "_observer"), tt(this, "_objectFit", ""), tt(this, "requestFullscreen", (g) => {
if (this._logger.i(at, "requestFullscreen"), !!this._mainDom) {
if (this._yoda) {
this._yoda.isFullscreen() || this._yoda.fullScreen("portrait");
return;
}
this._full.isFull(g) || this._full.requestFull(this._mainDom, g);
}
}), tt(this, "exitFullscreen", (g) => {
if (this._logger.i(at, "exitFullscreen"), !!this._mainDom) {
if (this._yoda) {
this._yoda.exitFullScreen();
return;
}
this._full.isFull(g) && this._full.exitFull(g);
}
}), tt(this, "_onFullscreenchange", (g) => {
this.emit(We.FULLSCREEN_CHANGE, g);
}), tt(this, "_onMutedChange", (g) => {
this._video && (this._video.muted = g);
}), tt(this, "_onVideoLoadstart", () => {
this.emit(We.LOADSTART);
}), tt(this, "_onVideoProgress", () => {
this.emit(We.PROGRESS);
}), tt(this, "_onVideoSuspend", () => {
this.emit(We.SUSPEND);
}), tt(this, "_onVideoAbort", () => {
this.emit(We.ABORT);
}), tt(this, "_onVideoEmptied", () => {
this.emit(We.EMPTIED);
}), tt(this, "_onVideoStalled", () => {
this.emit(We.STALLED);
}), tt(this, "_onVideoLoadedmetadata", () => {
this.emit(We.LOADEDMETADATA);
}), tt(this, "_onVideoLoadeddata", () => {
this.emit(We.LOADEDDATA);
}), tt(this, "_onVideoCanplay", () => {
this.emit(We.CANPLAY);
}), tt(this, "_onVideoCanplaythrough", () => {
this.emit(We.CANPLAYTHROUGH);
}), tt(this, "_onVideoPlaying", () => {
vn.os.name !== "iOS" && vn.os.name !== "Android" && this._hidePosterDom(), this.emit(We.PLAYING);
}), tt(this, "_onVideoWaiting", () => {
this.emit(We.WAITING);
}), tt(this, "_onVideoSeeking", () => {
this.emit(We.SEEKING);
}), tt(this, "_onVideoSeeked", () => {
this.emit(We.SEEKED), this.kernel && this._updateIsLiveShift(this.kernel.liveShift);
}), tt(this, "_onVideoEnded", () => {
this.emit(We.ENDED);
}), tt(this, "_onVideoDurationchange", () => {
this.emit(We.DURATIONCHANGE);
}), tt(this, "_onVideoTimeupdate", () => {
var g, C;
this._posterLayer.style.display !== "none" && ((g = this._video) == null ? void 0 : g.readyState) === 4 && !((C = this._video) != null && C.paused) && this._hidePosterDom(), this.emit(We.TIMEUPDATE);
}), tt(this, "_onVideoPlay", () => {
this.emit(We.PLAY);
}), tt(this, "_onVideoPause", () => {
this.emit(We.PAUSE);
}), tt(this, "_onVideoRatechange", () => {
this.emit(We.RATECHANGE);
}), tt(this, "_onVideoResize", () => {
this.emit(We.RESIZE);
}), tt(this, "_onVideoVolumechange", () => {
this.emit(We.VOLUMECHANGE);
}), tt(this, "_onVideoEnterpictureinpicture", () => {
this.emit(We.ENTER_PICTURE_IN_PICTURE);
}), tt(this, "_onVideoLeavepictureinpicture", () => {
this.emit(We.LEAVE_PICTURE_IN_PICTURE);
});
var o;
if (this._instanceId = YA.next(), this._logger = new gu().setLevel(Po).setName(Mu).setId(this._instanceId), n != null && n.logger && this._logger.setOutput(n.logger), sA("kwai-player", Wr.packVersion), this._logger.i(at, Wr.packVersion, Wr.version, this._instanceId, r.toString(), n), this._data = n || {}, typeof r == "string" ? (this._id = r, this._mainDom = document.querySelector(r)) : (this._id = `kp_${Math.random() * 1e3 | 0}`, this._mainDom = r), this._evt = new Pu(), this._evt.setMaxListeners(30), this._full = new JA(this._evt, this._logger), this._evt.on("fullChange", this._onFullscreenchange), this._eventHandlers = {
loadstart: this._onVideoLoadstart,
progress: this._onVideoProgress,
suspend: this._onVideoSuspend,
abort: this._onVideoAbort,
emptied: this._onVideoEmptied,
stalled: this._onVideoStalled,
loadedmetadata: this._onVideoLoadedmetadata,
loadeddata: this._onVideoLoadeddata,
canplay: this._onVideoCanplay,
canplaythrough: this._onVideoCanplaythrough,
playing: this._onVideoPlaying,
waiting: this._onVideoWaiting,
seeking: this._onVideoSeeking,
seeked: this._onVideoSeeked,
ended: this._onVideoEnded,
durationchange: this._onVideoDurationchange,
timeupdate: this._onVideoTimeupdate,
play: this._onVideoPlay,
pause: this._onVideoPause,
ratechange: this._onVideoRatechange,
resize: this._onVideoResize,
volumechange: this._onVideoVolumechange,
enterpictureinpicture: this._onVideoEnterpictureinpicture,
leavepictureinpicture: this._onVideoLeavepictureinpicture
}, n && typeof n.controls < "u" && (this.controls = n.controls), this._videoLayer = document.createElement("div"), this._videoLayer.className = An["kwai-player-video"], this._posterLayer = document.createElement("div"), this._posterLayer.className = An["kwai-player-poster"], this._posterLayer.dataset.kpRole = "poster", this._videoLayer.appendChild(this._posterLayer), this._videoInteractiveLayer = document.createElement("div"), this._videoInteractiveLayer.className = An["kwai-player-video-interactive"], this._video = document.createElement("video"), !this._mainDom) {
this._logger.i(at, `container not found.${r}`), this._setError({ code: Uu.CTOR_ERROR, message: `container not found.${r}` });
return;
}
this._observer = new MutationObserver((g) => {
for (const C of g)
C.type === "attributes" && C.attributeName === "style" && this._applyObjectFit();
});
const s = { attributes: !0, attributeFilter: ["style"] };
this._observer.observe(this._mainDom, s), this._applyObjectFit(), this._mainDom.className = this._mainDom.className ? `${this._mainDom.className} ${An["kwai-player"]}` : An["kwai-player"], this._mainDom.setAttribute("role", "player"), this._mainDom.appendChild(this._videoLayer), this._mainDom.appendChild(this._videoInteractiveLayer), this._video.controls = !1, this._videoLayer.appendChild(this.video), Wr._yodaClass && (this._yodaDom = document.createElement("div"), this._yodaDom.className = An["kwai-player-yoda"], this._videoLayer.appendChild(this._yodaDom)), this._bindVideo(), this._pluginBase.initialize(n == null ? void 0 : n.plugins), this._pluginBase.beforeInstallPlugins(this, n == null ? void 0 : n.plugins), n && this._parseData(n);
const p = ((o = this._config) == null ? void 0 : o.src) || this._src;
p && this._initKernel(!1), this._pluginBase.afterInstallPlugins(this, n == null ? void 0 : n.plugins), p && (this._kernelStartTimeout = +setTimeout(() => {
this._clearKernelStartTimer(), this._kernelStart();
}, 0)), this._logger.i(at, "constructor completed.");
}
static get version() {
return "1.1.0";
}
/**
* 获取版本号
*/
get version() {
return Wr.version;
}
/**
* 获取包版本号
*/
get packVersion() {
return Wr.packVersion;
}
/**
* 实例ID
*/
get instanceId() {
return this._instanceId;
}
/**
* 获取内核类型
*/
get kernelType() {
return this._kernelType;
}
/**
* 本地日志实例
*/
get logger() {
return this._logger;
}
get outputLogger() {
return this._outputLogger;
}
set outputLogger(r) {
this._logger.i(at, "call set output logger", r), this._outputLogger = r, this._logger.setOutput(r), this._kernel && (this._kernel.outputLog = r);
}
/**
* 配置
*/
get config() {
return this._logger.i(at, "call get config", this._config), this._config;
}
set config(r) {
this._logger.i(at, "call set config", r), this._config = r, this._yoda || (this._initKernel(), this.emit(We.ATTRIBUTE_CHANGE_CONFIG));
}
/**
* 获取当前错误
*/
get error() {
return this._logger.i(at, "call get error", this._error), this._error;
}
/**
* videoId
*/
get videoId() {
var r;
return (r = this._data) == null ? void 0 : r.videoId;
}
set videoId(r) {
this._data && (this._data.videoId = r, this.emit(We.ATTRIBUTE_CHANGE_VIDEO_ID));
}
/**
* 设置预览图url
* @remark 依赖预览图插件
*/
get previewUrl() {
var r;
return (r = this._data) == null ? void 0 : r.previewUrl;
}
set previewUrl(r) {
this._logger.i(at, "call set previewUrl", r), this._data && (this._data.previewUrl = r, this.emit(We.ATTRIBUTE_CHANGE_PREVIEW_URL));
}
/**
* 设置弹幕防挡url
* @remark 依赖弹幕防挡插件
*/
get maskUrl() {
var r;
return (r = this._data) == null ? void 0 : r.maskUrl;
}
set maskUrl(r) {
this._logger.i(at, "call set maskUrl", r), this._data && (this._data.maskUrl = r, this.emit(We.ATTRIBUTE_CHANGE_MASK_URL));
}
/**
* 禁用弹幕防挡url
*/
get disableMask() {
var r;
return (r = this._data) == null ? void 0 : r.disableMask;
}
set disableMask(r) {
this._logger.i(at, "call set disableMask", r), this._data && (this._data.disableMask = r, this.emit(We.ATTRIBUTE_CHANGE_DISABLE_MASK));
}
/**
* 获取播放地址
*/
get src() {
return this._logger.v(at, "call get src", this._src), this._src;
}
set src(r) {
this._logger.i(at, "call set src", r), this._src = this._preprocessSrcFunc ? this._preprocessSrcFunc(r) : r, this._destroyKernel(), this.emit(We.ATTRIBUTE_CHANGE_SRC), this._initKernel();
}
/**
* 获取当前是否时移回放
*/
get isLiveShift() {
return this._isLiveShift;
}
set liveShiftType(r) {
this._logger.i(at, "call set liveShiftType", r), this._data && (this._data.liveShiftType = r, this.emit(We.LIVE_SHIFT_TYPE_CHANGE));
}
/**
* 直播时移类型
*/
get liveShiftType() {
var r;
return ((r = this._data) == null ? void 0 : r.liveShiftType) || Pa.NONE;
}
set crossOrigin(r) {
this._logger.i(at, "call set crossOrigin", r), this._video && (this._video.crossOrigin = r), this.emit(We.ATTRIBUTE_CHANGE_CROSS_ORIGIN);
}
/**
* 跨域配置
*/
get crossOrigin() {
var r;
return this._logger.v(at, "call get crossOrigin", (r = this._video) == null ? void 0 : r.crossOrigin), this._video ? this._video.crossOrigin : null;
}
/**
* 网络状态
*/
get networkState() {
var r;
return this._logger.v(at, "call get networkState", (r = this._video) == null ? void 0 : r.networkState), this._video ? this._video.networkState : 0;
}
/**
* 预加载配置
*/
get preload() {
return this._logger.v(at, "call get preload", this._preload), this._preload;
}
set preload(r) {
this._logger.i(at, "call set preload", r), this._preload = r, this._video.preload = r, this.emit(We.ATTRIBUTE_CHANGE_PRELOAD);
}
/**
* 获取预加载配置
*/
get buffered() {
var r;
if (!this._yoda)
return (r = this._video) == null ? void 0 : r.buffered;
}
/**
* 获取video元素readyState
*/
get readyState() {
return this._yoda ? this._yoda.readyState : this._video ? this._video.readyState : 0;
}
/**
* 获取video元素seeking状态
*/
get seeking() {
var r;
return this._yoda ? this._yoda.seeking : !!((r = this._video) != null && r.seeking);
}
/**
* 获取video播放时间
*/
get currentTime() {
return this._yoda ? this._yoda.currentTime : this._video ? this._video.currentTime : 0;
}
set currentTime(r) {
this._logger.i(at, "call set currentTime", r);
try {
this._yoda && (this._yoda.currentTime = r), this._video && (this._video.currentTime = r), this.emit(We.ATTRIBUTE_CHANGE_CURRENT_TIME);
} catch (n) {
}
}
/**
* 获取video时长
*/
get duration() {
return this._yoda ? this._yoda.duration : this._video ? this._video.duration : NaN;
}
/**
* 获取暂停状态
*/
get paused() {
return this._yoda ? this._yoda.paused : this._video ? this._video.paused : !0;
}
/**
* 获取默认倍速
*/
get defaultPlaybackRate() {
var r;
return this._logger.v(at, "call get defaultPlaybackRate", (r = this._video) == null ? void 0 : r.defaultPlaybackRate), this._video ? this._video.defaultPlaybackRate : 1;
}
set defaultPlaybackRate(r) {
this._logger.i(at, "call set defaultPlaybackRate", r), this._yoda && (this._yoda.defaultPlaybackRate = r), this._video && (this._video.defaultPlaybackRate = r), this.emit(We.ATTRIBUTE_CHANGE_DEFAULT_PLAYBACK_RATE);
}
/**
* 获取当前倍速
*/
get playbackRate() {
return this._video ? this._video.playbackRate : 1;
}
set playbackRate(r) {
this._logger.i(at, "call set playbackRate", r), this._yoda && (this._yoda.playbackRate = r), this._video && (this._video.playbackRate = r), this.emit(We.ATTRIBUTE_CHANGE_PLAYBACK_RATE);
}
/**
* 获取是否播放
* yoda返回undefined
*/
get played() {
var r;
if (!this._yoda)
return (r = this._video) == null ? void 0 : r.played;
}
/**
* 获取是否可以seek
* yoda返回undefined
*/
get seekable() {
var r;
if (!this._yoda)
return (r = this._video) == null ? void 0 : r.seekable;
}
/**
* 获取是否播放完成
*/
get ended() {
return this._yoda ? this._yoda.ended : this._video ? this._video.ended : !1;
}
/**
* 获取是否自动播放
*/
get autoplay() {
return this._autoplay;
}
set autoplay(r) {
this._logger.i(at, "call set autoplay", r), this._autoplay = r, this._yoda && (this._yoda.autoplay = r), this.emit(We.ATTRIBUTE_CHANGE_AUTOPLAY);
}
/**
* 获取是否循环播放
*/
get loop() {
return this._yoda ? this._yoda.loop : this._video ? this._video.loop : !1;
}
set loop(r) {
this._logger.i(at, "call set loop", r), this._video && (this._video.loop = r), this.emit(We.ATTRIBUTE_CHANGE_LOOP);
}
/**
* 获取是否显示控制条
*/
get controls() {
return this._controls;
}
set controls(r) {
this._logger.i(at, "call set controls", r), r !== this._controls && (this._controls = r), this.emit(We.ATTRIBUTE_CHANGE_CONTROLS);
}
/**
* 音量
* yoda始终返回1
*/
get volume() {
return this._yoda ? 1 : this._video ? this._video.volume : 1;
}
set volume(r) {
this._video && (this._video.volume = r < 0 ? 0 : r > 1 ? 1 : r, this.emit(We.ATTRIBUTE_CHANGE_VOLUME));
}
/**
* 获取静音状态
*/
get muted() {
return this._yoda ? this._yoda.muted : this._video ? this._video.muted : !1;
}
set muted(r) {
this._logger.i(at, `call set muted: ${r}, hasVideo: ${!!this._video}`), this._yoda && (this._yoda.muted = r), this._video && (this._video.muted = r), this.emit(We.ATTRIBUTE_CHANGE_MUTED);
}
/**
* 获取默认静音状态
*/
get defaultMuted() {
return this._yoda ? this._yoda.defaultMuted : this._video ? this._video.defaultMuted : !1;
}
set defaultMuted(r) {
this._logger.i(at, "call set defaultMuted", r), this._yoda && (this._yoda.defaultMuted = r), this._video && (this._video.defaultMuted = r), this.emit(We.ATTRIBUTE_CHANGE_DEFAULT_MUTED);
}
/*
* public set width(val: number | string) {
* this._width = val;
* }
*/
/*
* public set height(val: number | string) {
* this._height = val;
* }
*/
/**
* 获取视频宽
*/
get videoWidth() {
var r;
return this._videoWidth || ((r = this._video) == null ? void 0 : r.videoWidth);
}
/**
* 获取视频高
*/
get videoHeight() {
var r;
return this._videoHeight || ((r = this._video) == null ? void 0 : r.videoHeight);
}
/**
* 获取封面图
*/
get poster() {
return this._poster;
}
set poster(r) {
this._logger.i(at, "call set poster", r), this._poster = r, this._updatePosterDom(), this.emit(We.ATTRIBUTE_CHANGE_POSTER);
}
/**
* 获取禁用画中画状态
* yoda无效
*/
get disablePictureInPicture() {
var r;
return this._yoda ? !0 : !!((r = this._video) != null && r.disablePictureInPicture);
}
set disablePictureInPicture(r) {
this._logger.i(at, "call set disablePictureInPicture", r), !this._yoda && this._video && (this._video.disablePictureInPicture = r, this.emit(We.ATTRIBUTE_CHANGE_DISABLE_PICTURE_IN_PICTURE));
}
/**
* UI中是否展示下载按钮
*/
get disableDownload() {
var r;
return (r = this._data) == null ? void 0 : r.disableDownload;
}
set disableDownload(r) {
this._logger.i(at, "call set disableDownload", r), this._data && (this._data.disableDownload = r, this.emit(We.ATTRIBUTE_CHANGE_DISABLE_DOWNLOAD));
}
/**
* 获取是否内联(inline)播放
*/
get playsinline() {
var r;
return !!((r = this._video) != null && r.hasAttribute("playsinline"));
}
set playsinline(r) {
this._logger.i(at, "call set playsinline", r), this._video && (this._video.playsInline = r, this._video.webKitPlaysInline = r, r ? (this._video.setAttribute("playsinline", "playsinline"), this._video.setAttribute("webkit-playsinline", "webkit-playsinline"), this._video.setAttribute("x5-playsinline", "x5-playsinline")) : (this._video.removeAttribute("playsinline"), this._video.removeAttribute("webkit-playsinline"), this._video.removeAttribute("x5-playsinline")), this.emit(We.ATTRIBUTE_CHANGE_PLAYSINLINE));
}
/**
* 获取自适应码率开关状态
*/
get disableAdaptive() {
var r;
return (r = this._data) == null ? void 0 : r.disableAdaptive;
}
set disableAdaptive(r) {
this._logger.i(at, "call set disableAdaptive", r), this._data && (this._data.disableAdaptive = r, this.emit(We.ATTRIBUTE_CHANGE_DISABLE_ADAPTIVE));
}
/**
* 获取当前视频轨id
*/
get currentLevel() {
var r;
return ((r = this._kernel) == null ? void 0 : r.currentLevel) || 0;
}
set currentLevel(r) {
var n, o, s;
if (this._logger.i(at, "call set currentLevel", r, !!this._kernel, this._livePaused), this._kernel) {
const p = this._video.paused;
this._livePaused ? ((n = this._kernel) == null || n.refresh(), this._kernel.currentLevel = r) : (this._kernel.currentLevel = r, this.emit(We.ATTRIBUTE_CHANGE_CURRENT_LEVEL)), !p && this._video.paused && (this._logger.i(at, "set level. play"), (s = (o = this._video) == null ? void 0 : o.play()) == null || s.catch((g) => this._logger.i(at, "set current level, call play() fail.", g)));
}
}
/**
* 获取即将切换的视频轨id
*/
get nextLevel() {
var r;
return ((r = this._kernel) == null ? void 0 : r.nextLevel) || 0;
}
set nextLevel(r) {
var n, o, s;
if (this._logger.i(at, "call set nextLevel", r), this._kernel) {
const p = this._video.paused;
this._livePaused ? ((n = this._kernel) == null || n.refresh(), this._kernel.currentLevel = r) : (this._kernel.nextLevel = r, this.emit(We.ATTRIBUTE_CHANGE_NEXT_LEVEL)), !p && this._video.paused && (this._logger.i(at, "set next level. play"), (s = (o = this._video) == null ? void 0 : o.play()) == null || s.catch((g) => this._logger.i(at, "set next level, call play() fail.", g)));
}
}
/**
* 获取当前播放帧数
*/
get currentVideoFrame() {
var r;
return ((r = this._kernel) == null ? void 0 : r.currentVideoFrame) || 0;
}
set currentVideoFrame(r) {
this._kernel && (this._kernel.currentVideoFrame = r, this.emit(We.ATTRIBUTE_CHANGE_CURRENT_FRAME));
}
/**
* 获取当前视频总帧数
*/
get totalVideoFrames() {
var r;
return ((r = this._kernel) == null ? void 0 : r.totalVideoFrames) || 0;
}
/**
* 当前清晰度时间信息
*/
get currentLevelTimeInfo() {
var r;
return (r = this._kernel) == null ? void 0 : r.currentLevelTimeInfo;
}
/**
* 返回当前video
*/
get video() {
return this._video;
}
/**
* 返回当前canvas,视频渲染在canvas时有值
*/
get canvas() {
return this._canvas;
}
get yodaDom() {
return this._yodaDom;
}
/**
* 获取当前音频轨id
*/
get audioTrack() {
return this._kernel ? this._kernel.audioTrack : -1;
}
set audioTrack(r) {
this._logger.i(at, "call set audioTrack", r), this._kernel && (this._kernel.audioTrack = r, this.emit(We.ATTRIBUTE_CHANGE_AUDIO_TRACK));
}
/**
* 产品ID,用于上报
*/
get productName() {
var r;
return (r = this._data) == null ? void 0 : r.productName;
}
set productName(r) {
this._logger.i(at, "call set productName", r), this._data && (this._data.productName = r);
}
/**
* 获取当前是否开启连接预热
* @remarks 依赖预加载插件
*/
get prefetch() {
var r;
return (r = this._data) == null ? void 0 : r.prefetch;
}
set prefetch(r) {
this._logger.i(at, "call set prefetch", r), this._data && (this._data.prefetch = r, this.emit(We.ATTRIBUTE_CHANGE_PREFETCH));
}
/**
* 获取是否显示进度条
* @remarks 依赖控制条插件
*/
get showProgress() {
var r;
return (r = this._data) == null ? void 0 : r.showProgress;
}
set showProgress(r) {
this._logger.i(at, "call set showProgress", r), this._data && (this._data.showProgress = r, this.emit(We.ATTRIBUTE_CHANGE_SHOW_PROGRESS));
}
/**
* 是否显示时间
* @remarks 依赖控制条插件
*/
get showTime() {
var r;
return (r = this._data) == null ? void 0 : r.showTime;
}
set showTime(r) {
this._logger.i(at, "call set showTime", r), this._data && (this._data.showTime = r, this.emit(We.ATTRIBUTE_CHANGE_SHOW_TIME));
}
/**
* 获取是否启用热键
* @remarks 依赖热键插件
*/
get disableHotkey() {
var r;
return (r = this._data) == null ? void 0 : r.disableHotkey;
}
set disableHotkey(r) {
this._logger.i(at, "call set disableHotkey", r), this._data && (this._data.disableHotkey = r, this.emit(We.ATTRIBUTE_CHANGE_DISABLE_HOTKEY));
}
/**
* 弹幕是否可用
* @remark 依赖弹幕插件
*/
get disableDanmaku() {
var r;
return (r = this._data) == null ? void 0 : r.disableDanmaku;
}
set disableDanmaku(r) {
this._logger.i(at, "call set disableDanmaku", r), this._data && (this._data.disableDanmaku = r, this.emit(We.ATTRIBUTE_CHANGE_DISABLE_DANMAKU));
}
/**
* 是否渲染弹幕
* @remark 依赖弹幕插件
*/
get danmakuRendering() {
var r;
return (r = this._data) == null ? void 0 : r.danmakuRendering;
}
set danmakuRendering(r) {
this._logger.i(at, "call set danmakuRendering", r), this._data && (this._data.danmakuRendering = r, this.emit(We.ATTRIBUTE_CHANGE_DANMAKU_RENDERING));
}
/**
* 设置是否显示信息面板
* @remarks 依赖信息面板插件
*/
get showInfoPanel() {
var r;
return (r = this._data) == null ? void 0 : r.showInfoPanel;
}
set showInfoPanel(r) {
this._logger.i(at, "call set showInfoPanel", r), this._data && (this._data.showInfoPanel = r, this.emit(We.ATTRIBUTE_CHANGE_SHOW_INFO_PANEL));
}
/**
* 是否显示下一个按钮,与UI相关
*/
get showNext() {
var r;
return (r = this._data) == null ? void 0 : r.showNext;
}
set showNext(r) {
this._logger.i(at, "call set showNext", r), this._data && (this._data.showNext = r, this.emit(We.ATTRIBUTE_CHANGE_SHOW_NEXT));
}
/**
* 是否显示上一个按钮,与UI相关
*/
get showPrev() {
var r;
return (r = this._data) == null ? void 0 : r.showPrev;
}
set showPrev(r) {
this._logger.i(at, "call set showPrev", r), this._data && (this._data.showPrev = r, this.emit(We.ATTRIBUTE_CHANGE_SHOW_PREV));
}
/**
* 业务参数
*/
get bizData() {
var r;
return (r = this._data) == null ? void 0 : r.bizData;
}
set bizData(r) {
this._logger.i(at, "set biz data", r), this._data && (this._data.bizData = r), this._yoda && this._yoda.updateUserConfig({ biz: JSON.parse(JSON.stringify(r)) }), this.emit(We.ATTRIBUTE_CHANGE_BIZ_DATA);
}
/**
* 当前场次直播时间信息,配合直播时移功能
* @alpha
*/
get liveTime() {
var r;
return (r = this._data) != null && r.liveTime ? { start: this._data.liveTime.start, end: this._data.liveTime.end } : void 0;
}
set liveTime(r) {
this._logger.i(at, "set live time", r), this._data && (this._data.liveTime = Object.assign({}, r)), this.emit(We.ATTRIBUTE_CHANGE_LIVE_TIME);
}
get objectFit() {
return this._objectFit;
}
/**
* 返回当前的内核实例
*/
get kernel() {
return this._kernel;
}
setPreprocessURL(r) {
this._preprocessURL = r;
}
setPreprocessSrcFunc(r) {
this._preprocessSrcFunc = r;
}
/**
* 加载视频
*/
load() {
var r;
this._logger.i(at, "call load"), (r = this._kernel) == null || r.load(), this._kernelLoaded = !0;
}
/**
* 播放视频
*/
play() {
var r, n, o, s, p;
return this._logger.i(at, "call play", this._kernelLoaded, this._livePaused), this._yoda ? ((n = (r = this._video) == null ? void 0 : r.play()) == null || n.catch((g) => this._logger.i(at, "play, call play() fail.", g)), this._yoda.play()) : (this._livePaused && !this._isLiveShiftMode() ? (o = this._kernel) == null || o.refresh() : this._kernelLoaded || this.load(), this._video.paused ? (p = (s = this._video) == null ? void 0 : s.play()) == null ? void 0 : p.catch((g) => this._logger.i(at, "play, call play() fail.", g)) : Promise.resolve());
}
/**
* 暂停视频
*/
pause() {
var r, n, o;
if (this._logger.i(at, "call pause", (r = this._mediaInfo) == null ? void 0 : r.isLive), this._yoda) {
this._yoda.pause();
return;
}
return this._kernel && (n = this._mediaInfo) != null && n.isLive && !this._isLiveShiftMode() && (this._logger.i(at, "live stop load"), this._kernel.stopLoad(), this._livePaused = !0), this._isLiveShiftMode() && !this._isLiveShift && this._updateIsLiveShift(!0), (o = this._video) == null ? void 0 : o.pause();
}
/**
* 开启画中画
*/
requestPictureInPicture() {
return this._logger.i(at, "call requestPictureInPicture"), this._yoda ? Promise.reject("not support requestPictureInPicture. yoda") : this._video && "requestPictureInPicture" in this._video ? this._video.requestPictureInPicture() : Promise.reject("not support requestPictureInPicture");
}
isPictureInPictureAvailable() {
return this._yoda ? !1 : qA();
}
/**
* 销毁播放器
*/
destroy() {
var r, n, o;
this._logger.i(at, "call destroy"), (r = this._observer) == null || r.disconnect(), this._observer = void 0, this._clearKernelStartTimer(), this._preprocessSrcFunc = void 0, this._screenshotQueue = [], this._pluginBase.beforeUninstallPlugins(this), this._evt.removeAllListeners(), this._destroyKernel(), this._unbindVideo(), this._destroyYoda(), (n = this._videoLayer.parentElement) == null || n.removeChild(this._videoLayer), (o = this._videoLayer.parentElement) == null || o.removeChild(this._videoInteractiveLayer), this.removeAllListeners(), this._pluginBase.afterUninstallPlugins(this);
}
/**
* 重新加载视频
*/
refresh() {
var r;
this._logger.i(at, "call refresh"), (r = this._kernel) == null || r.refresh();
}
/**
* 支持时移时回到直播状态
*/
jumpToLive() {
var r, n;
this._logger.i(at, `call jumpToLive type: ${(r = this._data) == null ? void 0 : r.liveShiftType}`), this.kernel && (n = this._data) != null && n.liveShiftType && this._isLiveShiftMode() && (this.video.currentTime = this.video.duration - this.kernel.liveShiftDelaySec, this.kernel && this._updateIsLiveShift(!0));
}
/**
* 获取流时间
* @param val 播放时间,ms
* @returns 播放时间对应的流时间,ms
*/
getStreamTime(r) {
var n;
return this._yoda ? 0 : ((n = this._kernel) == null ? void 0 : n.getStreamTime(r)) || 0;
}
/**
* 注册播放器插件
* @param plugin plugin需继承自PluginModule
*/
static register(r, n = "append") {
vo.register(r, n);
}
/**
* 注销播放器插件
* @param plugin 插件或插件名称
*/
static deregister(r) {
vo.deregister(r);
}
/**
* 设置yoda kernel 定义
* @param val yoda kernel
*/
static setYoda(r) {
Wr._yodaClass = r;
}
/**
* 根据插件名获取插件实例
* @param label 插件名
* @returns plugin
*/
getPluginInstance(r) {
return this._pluginBase.getPlugin(r);
}
/**
* 获取所有的插件实例
* @returns 所有的插件实例
*/
getAllPlugins() {
return this._pluginBase.getAllPlugins();
}
/**
* 创建一个子容器
* @returns HTMLDivELement
*/
createSubContainer(r = fs.DEFAULT) {
const n = document.createElement("div");
n.id = `${this._id}-sub-${Math.round(this._subContainerNumber++)}`;
let o = this._mainDom;
if (r === fs.VIDEO && (o = this._videoLayer), r === fs.VIDEO_INTERACTIVE && (o = this._videoInteractiveLayer), o)
o.children.length ? o.children[o.children.length - 1].insertAdjacentElement("afterend", n) : o.appendChild(n);
else
throw new Error("cteate sub container error. no parent found.");
return n;
}
/**
* 是否全屏
* @returns boolean
*/
isFullscreen(r) {
return this._yoda ? this._yoda.isFullscreen() : this._full.isFull(r);
}
isFullscreenAvailable(r) {
return this._yoda ? !0 : this._full.isFullscreenAvailable(r);
}
_applyObjectFit() {
var r;
const n = ((r = this._mainDom) == null ? void 0 : r.style.objectFit) || "";
this._logger.i(at, `apply objectFit: ${n}`), this._video.style.objectFit = n, this._canvas && (this._canvas.style.objectFit = n), this._yoda && (this._yoda.objectFit = n || "contain"), this._objectFit = n, this.emit(We.OBJECT_FIT_CHANGE);
}
removeSubContainer(r) {
r.parentElement && r.parentElement.removeChild(r);
}
/**
* 当前画面截图
* yoda暂不支持截图
* @returns 截图
*/
screenshot() {
const r = this._kernel;
return this._yoda ? (this._logger.i(at, "screenshot yoda"), this._yoda.screenshot()) : r ? (this._screenshotId++, new Promise((n) => {
const o = this._screenshotId.toString();
this._screenshotQueue.push({
id: o,
timer: setTimeout(() => {
this._logger.i(at, `screenshot[${o}] timeout.`), this._resolveScreenShotFromQueue(o);
}, 500),
callback: n
}), r.screenshot({ id: o }), this._logger.i(at, `screenshot[${o}] kernel`);
})) : (this._logger.i(at, "screenshot player not ready."), Promise.resolve());
}
_resolveScreenShotFromQueue(r, n) {
for (let o = 0; o < this._screenshotQueue.length; o++)
if (r === this._screenshotQueue[o].id) {
clearTimeout(this._screenshotQueue[o].timer), this._screenshotQueue[o].callback(n), this._screenshotQueue.splice(o, 1);
return;
}
this._logger.i(at, `screenshot[${r}] not found.`);
}
/**
* 获取主容器
* @returns
*/
get mainContainer() {
return this._mainDom;
}
get videoLayer() {
return this._videoLayer;
}
get videoInteractiveLayer() {
return this._videoInteractiveLayer;
}
/**
* 获取当前QOS信息
* @returns
*/
get audienceStat() {
var r;
return (r = this._kernel) == null ? void 0 : r.getAudienceStat();
}
/** @internal */
_updatePosterDom() {
sa ? (this._video.poster = this._poster || "", this._hidePosterDom()) : this._poster ? (this._video.poster = fv, this._posterLayer.className = An["kwai-player-poster"], this._posterLayer.style.backgroundImage = `url(${this._poster})`) : (this._video.poster = "", this._posterLayer.className = "", this._posterLayer.style.backgroundImage = "");
}
/** @internal */
_hidePosterDom() {
this._posterLayer.style.display = "none";
}
/** @internal */
_setIsUseCanvas(r) {
this._video && (this._video.style.display = r ? "none" : "block");
}
/** @internal */
_setError(r) {
this._error = r, this._error && setTimeout(() => {
try {
this.emit(We.ERROR, this._error);
} catch (n) {
}
}, 0);
}
/** @internal */
_resetPlayerStat() {
if (this._canvas) {
try {
this._videoLayer.removeChild(this._canvas);
} catch (r) {
}
this._canvas = void 0;
}
this._setError(void 0), this._setIsUseCanvas(!1), this._mediaInfo = void 0, this._isLiveShift = !1;
}
/** @internal */
_destroyKernel() {
this._kernel && (this._kernelLoaded = !1, this._livePaused = !1, this.pause(), this._kernel.destroy(), this._kernel = void 0);
}
/** @internal */
_destroyYoda() {
this._yoda && (this._yoda.destroy(), this._yoda = void 0);
}
/** @internal */
_initYodaKernel(r) {
if (this._logger.i(at, "yoda init"), !Wr._yodaClass || !this._yodaDom || !this._src)
return !1;
const n = Ua.parse(this._src);
return n && n.src ? (this._yoda || (this._logger.i(at, "yoda new instance."), this._yoda = new Wr._yodaClass(this._yodaDom, this._logger, r), this._bindYoda(this._yoda), this._kernelType = "yoda"), this._logger.i(at, "yoda instance already exists. try update conf"), n.isLive ? this._yoda.src = { isLive: n.isLive, src: n.src } : this._yoda.src = { isLive: n.isLive, src: n.src }, this.emit(We.ATTRIBUTE_CHANGE_MUTED), !0) : !1;
}
/** @internal */
_bindYoda(r) {
this._logger.i(at, "yoda bind event."), r.on("play", this._onVideoPlay), r.on("playing", this._onVideoPlaying), r.on("pause", this._onVideoPause), r.on("loadedmetadata", () => {
this._onVideoLoadedmetadata(), this._onVideoDurationchange();
}), r.on("timeupdate", this._onVideoTimeupdate), r.on("ended", this._onVideoEnded), r.on("waiting", this._onVideoWaiting), r.on("seeked", this._onVideoSeeked), r.on("seeking", this._onVideoSeeking), r.on("resize", (n) => {
this._videoWidth = n.data.width, this._videoHeight = n.data.height, this._onVideoResize();
}), r.on("error", (n) => {
if (n.data.type === "initFailed" || n.data.type === "canNotInsert" || n.data.type === "internal" || n.data.type === "domLost") {
const o = r.actionOnReady === "play";
this._destroyYoda(), this._yodaEnabled = !1, this._initKernel(), o && this.play();
return;
}
this._setError(Object.assign({ code: 0 }, n.data.originalError));
});
}
/** @internal */
_bindVideo() {
if (this._video)
for (const r in this._eventHandlers)
this._video.addEventListener(r, this._eventHandlers[r]);
}
/** @internal */
_unbindVideo() {
if (this._video)
for (const r in this._eventHandlers)
this._video.removeEventListener(r, this._eventHandlers[r]);
}
/** @internal */
_parseData(r) {
this._logger.i(at, "parse data.", r), r.src && (this._src = this._preprocessSrcFunc ? this._preprocessSrcFunc(r.src) : r.src), r.config && (this._config = r.config), r.crossOrigin && (this.crossOrigin = r.crossOrigin), typeof r.preload < "u" && (this.preload = r.preload), typeof r.defaultPlaybackRate == "number" && (this.defaultPlaybackRate = r.defaultPlaybackRate), typeof r.playbackRate == "number" && (this.playbackRate = r.playbackRate), typeof r.autoplay < "u" && (this.autoplay = r.autoplay), typeof r.loop < "u" && (this.loop = r.loop), typeof r.controls < "u" && (this.controls = r.controls), typeof r.volume == "number" && (this.volume = r.volume), typeof r.muted < "u" && (this.muted = r.muted), typeof r.defaultMuted < "u" && (this.defaultMuted = r.defaultMuted), typeof r.disablePictureInPicture < "u" && (this.disablePictureInPicture = r.disablePictureInPicture), typeof r.disableAdaptive < "u" && (this.disableAdaptive = r.disableAdaptive), typeof r.playsinline < "u" && (this.playsinline = r.playsinline), typeof r.liveShiftType < "u" && (this.liveShiftType = r.liveShiftType), typeof r.logger < "u" && (this._outputLogger = r.logger), this.poster = r.poster || "";
}
/** @internal */
_initKernel(r = !0) {
var n, o, s, p, g;
if (this._logger.i(at, "init kernel"), !this._video)
return;
if (this._posterLayer.style.display = sa ? "none" : "block", this._destroyKernel(), !this._src && !((n = this._config) != null && n.src)) {
this._video.src = "", this._resetPlayerStat();
return;
}
this._config || (this._config = {});
const C = Object.assign({}, this._config, {
adaptive: ((o = this._data) == null ? void 0 : o.disableAdaptive) === !1,
liveShiftType: (s = this._data) == null ? void 0 : s.liveShiftType,
ntp: !1
});
if (da.verify(this._src) ? (this._logger.i(at, "live feed to media desc"), C.src = da.parse(this._src)) : C.src = this._src, this._preprocessURL && (C.preprocessUrl = this._preprocessURL), typeof C.nativeFirst > "u" && sa && (C.nativeFirst = !0), this._isLiveShiftMode() && (C.catchUpPausedLive = !1), (p = this._data) != null && p.logger && (C.logger = this._data.logger), this._resetPlayerStat(), this._logger.i(at, `yoda check mobile: ${sa} liveshift: ${this.liveShiftType} class: ${!!Wr._yodaClass}`), sa && this._yodaEnabled && this.liveShiftType === Pa.NONE && Wr._yodaClass) {
const x = {
defaultMuted: this.defaultMuted,
muted: this.muted,
defaultPlaybackRate: this.defaultPlaybackRate,
playbackRate: this.playbackRate,
autoplay: this._autoplay,
loop: this.loop,
objectFit: this._objectFit || "contain",
biz: (g = this._data) == null ? void 0 : g.bizData
};
if (this._initYodaKernel(x)) {
r && this._clearKernelStartTimer();
return;
}
} else
this._destroyYoda();
this._kernelType = "kwai-player-kernel", this._logger.i(at, "init kernel", this._kernelType);
const y = this._kernel = new WA(this._video, C);
y.on(Ar.VIDEO_RENDERER_CHANGE, (x) => {
const h = this._videoLayer;
if (x.type === "canvas" && (this._setIsUseCanvas(!0), this._canvas = x.canvas, this._canvas && h.insertAdjacentElement("afterbegin", this._canvas)), x.type === "video") {
this._setIsUseCanvas(!1);
try {
this._canvas && h.removeChild(this._canvas);
} catch (F) {
}
this._canvas = void 0;
}
this._applyObjectFit(), this.emit(We.VIDEO_RENDERER_CHANGE, x);
}), y.on(Ar.MANIFEST_PARSED, (x) => {
this._logger.i(at, Ar.MANIFEST_PARSED, x), this.emit(We.MANIFEST_PARSED, x);
}), y.on(Ar.LEVEL_SWITCHING, (x) => {
this.emit(We.LEVEL_SWITCHING, x);
}), y.on(Ar.LEVEL_SWITCHED, (x) => {
this.emit(We.LEVEL_SWITCHED, x);
}), y.on(Ar.LEVEL_SWITCH_PLAYING, (x) => {
this.emit(We.LEVEL_SWITCH_PLAYING, x);
}), y.on(Ar.LEVEL_SWITCH_FAILED, () => {
this.emit(We.LEVEL_SWITCH_FAILED);
}), y.on(Ar.LEVEL_UPDATED, (x) => {
this.emit(We.LEVEL_UPDATED, x);
}), y.on(Ar.AUDIO_TRACK_SWITCHING, (x) => {
this.emit(We.AUDIO_TRACKS_SWITCHING, x);
}), y.on(Ar.AUDIO_TRACK_SWITCHED, (x) => {
this.emit(We.AUDIO_TRACKS_SWITCHED, x);
}), y.on(Ar.ERROR, (x) => {
this._setError({ code: x.code, message: x.reason });
}), y.on(Ar.REPORT, (x) => {
x.type === "mediaInfo" && (this._videoWidth = x.value.width || 0, this._videoHeight = x.value.height || 0, this._mediaInfo = x.value, this._data && x.value.liveShiftType && (this.liveShiftType = x.value.liveShiftType)), this.emit(We.REPORT, x);
}), y.on(Ar.SCREENSHOT, (x) => {
this._logger.i(at, `screenshot[${x.id}] kernel evt. id: ${x.id} img: ${!!x.image}`), x.id && this._resolveScreenShotFromQueue(x.id, x.image);
}), r && (this._clearKernelStartTimer(), this._kernelStart());
}
/** @internal */
_clearKernelStartTimer() {
this._kernelStartTimeout && (clearTimeout(this._kernelStartTimeout), this._kernelStartTimeout = 0);
}
/** @internal */
_kernelStart() {
if (!(!this._kernel || !this._video) && (this._autoplay || this._preload === "" || this._preload === "auto" || this._preload === "metadata") && (this._kernel.load(), this._kernelLoaded = !0, this.autoplay)) {
const r = this._video.play();
r instanceof Promise && r.catch(() => {
var n;
this._logger.i(at, "autoplay fail, retry."), this._onMutedChange(!0), (n = this._video) == null || n.play().catch(() => {
});
});
}
}
/** @internal */
_updateIsLiveShift(r) {
r !== this._isLiveShift && (this._isLiveShift = r, this.emit(We.LIVE_SHIFT_CHANGE));
}
/** @internal */
_isLiveShiftMode() {
var r;
return !!((r = this._data) != null && r.liveShiftType) && this._data.liveShiftType !== Pa.NONE;
}
on(r, n) {
this._evt.on(r, n);
}
once(r, n) {
this._evt.once(r, n);
}
removeAllListeners(r) {
this._logger.i(at, "call removeAllListeners"), this._evt.removeAllListeners(r);
}
off(r, n) {
this._evt.off(r, n);
}
listeners(r) {
return this._evt.listeners(r);
}
emit(r, n) {
return this._evt.emit(r, n);
}
listenerCount(r) {
return this._evt.listenerCount(r);
}
};
tt(Bo, "packVersion", "1.1.0"), /** @internal */
tt(Bo, "_yodaClass");
let Ur = Bo;
const Gt = "vue2", pv = [
We.LOADSTART,
We.PROGRESS,
We.SUSPEND,
We.ABORT,
We.ERROR,
We.EMPTIED,
We.STALLED,
We.LOADEDMETADATA,
We.LOADEDDATA,
We.CANPLAY,
We.CANPLAYTHROUGH,
We.PLAYING,
We.WAITING,
We.SEEKING,
We.SEEKED,
We.ENDED,
We.DURATIONCHANGE,
We.TIMEUPDATE,
We.PLAY,
We.PAUSE,
We.RATECHANGE,
We.RESIZE,
We.VOLUMECHANGE,
We.MANIFEST_PARSED,
We.LEVEL_SWITCHING,
We.LEVEL_SWITCHED,
We.LEVEL_SWITCH_PLAYING,
We.LEVEL_SWITCH_FAILED,
We.AUDIO_TRACKS_SWITCHING,
We.AUDIO_TRACKS_SWITCHED,
We.FULLSCREEN_CHANGE,
We.LEVEL_UPDATED,
We.CLICK_NEXT,
We.CLICK_REGISTER,
We.CLICK_LOGIN,
We.CLICK_VIP,
We.INTERACTION,
We.ATTRIBUTE_CHANGE,
We.REPORT
], _v = {
name: "KwaiPlayerVue2",
props: {
id: {
type: String,
default: ""
},
config: {
type: Object,
default() {
return {};
}
},
plugins: {
type: Object,
default() {
return {};
}
},
src: {
type: [Object, String],
default: ""
},
controls: {
type: [Boolean, String],
default: !0
},
videoId: {
type: [String],
default: ""
},
autoplay: {
type: [Boolean],
default: !1
},
crossOrigin: {
type: [String, null],
default: null
},
defaultMuted: {
type: [Boolean],
default: !1
},
defaultPlaybackRate: {
type: [Number],
default: 1
},
loop: {
type: [Boolean],
default: !1
},
muted: {
type: [Boolean],
default: !1
},
preload: {
type: [String, void 0],
default: void 0
},
poster: {
type: [String],
default: ""
},
currentTime: {
type: [Number]
},
playbackRate: {
type: [Number],
default: 1
},
volume: {
type: [Number],
default: 1
},
disablePictureInPicture: {
type: [Boolean],
default: !1
},
playsinline: {
type: [Boolean],
default: !1
},
disableDownload: {
type: [Boolean],
default: !0
},
disableAdaptive: {
type: [Boolean],
default: !0
},
disableHotkey: {
type: [Boolean],
default: !1
},
disableMask: {
type: [Boolean],
default: !1
},
currentLevel: {
type: [Number],
default: 0
},
nextLevel: {
type: [Number],
default: 0
},
audioTrack: {
type: [Number],
default: 0
},
currentVideoFrame: {
type: [Number],
default: 0
},
showProgress: {
type: [Boolean],
default: void 0
},
showTime: {
type: [Boolean],
default: void 0
},
prefetch: {
type: [Boolean],
default: !0
},
showInfoPanel: {
type: [Boolean],
default: !1
},
productName: {
type: [String],
default: ""
},
previewUrl: {
type: [String],
default: ""
},
maskUrl: {
type: [String],
default: ""
},
disableDanmaku: {
type: [Boolean]
},
danmakuRendering: {
type: [Boolean],
default: !0
},
bizData: {
type: [Object]
},
liveShiftType: {
type: [String]
}
},
data() {
return {
player: void 0,
cid: 0
};
},
watch: {
config: function(e) {
this.player && (this.player.logger.i(Gt, "call set config", e), this.player.config = e);
},
controls: function(e) {
this.player && (this.player.logger.i(Gt, "call set controls", e), this.player.controls = e);
},
videoId: function(e) {
this.player && (this.player.logger.i(Gt, "call set videoId", e), this.player.videoId = e);
},
src: function(e) {
this.player && (this.player.logger.i(Gt, "call set src", e), this.player.src = e);
},
autoplay: function(e) {
this.player && (this.player.logger.i(Gt, "call set autoplay", e), this.player.autoplay = e);
},
crossOrigin: function(e) {
this.player && (this.player.logger.i(Gt, "call set crossOrigin", e), this.player.crossOrigin = e);
},
defaultMuted: function(e) {
this.player && (this.player.logger.i(Gt, "call set defaultMuted", e), this.player.defaultMuted = e);
},
defaultPlaybackRate: function(e) {
this.player && (this.player.logger.i(Gt, "call set defaultPlaybackRate", e), this.player.defaultPlaybackRate = e);
},
loop: function(e) {
this.player && (this.player.logger.i(Gt, "call set loop", e), this.player.loop = e);
},
muted: function(e) {
this.player && (this.player.logger.i(Gt, "call set muted", e), this.player.muted = e);
},
preload: function(e) {
this.player && (this.player.logger.i(Gt, "call set preload", e), this.player.preload = e || "none");
},
poster: function(e) {
this.player && (this.player.logger.i(Gt, "call set poster", e), this.player.poster = e || "");
},
currentTime: function(e) {
this.player && (this.player.logger.i(Gt, "call set currentTime", e), this.player.currentTime = e);
},
playbackRate: function(e) {
this.player && (this.player.logger.i(Gt, "call set playbackRate", e), this.player.playbackRate = e);
},
volume: function(e) {
this.player && (this.player.logger.i(Gt, "call set volume", e), this.player.volume = e);
},
disablePictureInPicture: function(e) {
this.player && (this.player.logger.i(Gt, "call set disablePictureInPicture", e), this.player.disablePictureInPicture = e);
},
playsinline: function(e) {
this.player && (this.player.logger.i(Gt, "call set playsinline", e), this.player.playsinline = e);
},
disableDownload: function(e) {
this.player && (this.player.logger.i(Gt, "call set disableDownload", e), this.player.disableDownload = e);
},
disableAdaptive: function(e) {
this.player && (this.player.logger.i(Gt, "call set disableAdaptive", e), this.player.disableAdaptive = e);
},
disableHotkey: function(e) {
this.player && (this.player.logger.i(Gt, "call set disableHotkey", e), this.player.disableHotkey = e);
},
disableMask: function(e) {
this.player && (this.player.logger.i(Gt, "call set disableMask", e), this.player.disableMask = e);
},
currentLevel: function(e) {
this.player && (this.player.logger.i(Gt, "call set currentLevel", e), this.player.currentLevel = e);
},
nextLevel: function(e) {
this.player && (this.player.logger.i(Gt, "call set nextLevel", e), this.player.nextLevel = e);
},
audioTrack: function(e) {
this.player && (this.player.logger.i(Gt, "call set audioTrack", e), this.player.audioTrack = e);
},
currentVideoFrame: function(e) {
this.player && (this.player.logger.i(Gt, "call set currentVideoFrame", e), this.player.currentVideoFrame = e);
},
showProgress: function(e) {
this.player && (this.player.logger.i(Gt, "call set showProgress", e), this.player.showProgress = e);
},
showTime: function(e) {
this.player && (this.player.logger.i(Gt, "call set showTime", e), this.player.showTime = e);
},
prefetch: function(e) {
this.player && (this.player.logger.i(Gt, "call set prefetch", e), this.player.prefetch = e);
},
showInfoPanel: function(e) {
this.player && (this.player.logger.i(Gt, "call set showInfoPanel", e), this.player.showInfoPanel = e);
},
previewUrl: function(e) {
this.player && (this.player.logger.i(Gt, "call set previewUrl", e), this.player.previewUrl = e);
},
maskUrl: function(e) {
this.player && (this.player.logger.i(Gt, "call set maskUrl", e), this.player.maskUrl = e);
},
disableDanmaku: function(e) {
this.player && (this.player.logger.i(Gt, "call set disableDanmaku", e), this.player.disableDanmaku = e);
},
danmakuRendering: function(e) {
this.player && (this.player.logger.i(Gt, "call set danmakuRendering", e), this.player.danmakuRendering = e);
},
bizData: function(e) {
this.player && (this.player.bizData = e);
},
liveShiftType: function(e) {
this.player && (this.player.liveShiftType = e);
}
},
methods: {
load() {
var e;
(e = this.player) == null || e.load();
},
play() {
var e;
return (e = this.player) == null ? void 0 : e.play();
},
pause() {
var e;
(e = this.player) == null || e.pause();
},
destroy() {
var e;
(e = this.player) == null || e.destroy();
},
requestPictureInPicture() {
var e;
return (e = this.player) == null ? void 0 : e.requestPictureInPicture();
},
isFullscreen(e) {
var r;
return (r = this.player) == null ? void 0 : r.isFullscreen(e);
},
requestFullscreen(e) {
var r;
(r = this.player) == null || r.requestFullscreen(e);
},
exitFullscreen(e) {
var r;
(r = this.player) == null || r.exitFullscreen(e);
},
isFullscreenAvailable(e) {
var r;
return (r = this.player) == null ? void 0 : r.isFullscreenAvailable(e);
},
screenshot() {
var e;
return (e = this.player) == null ? void 0 : e.screenshot();
},
// readonly
getError() {
var e;
return (e = this.player) == null ? void 0 : e.error;
},
getNetworkState() {
var e;
return ((e = this.player) == null ? void 0 : e.networkState) || 0;
},
getBuffered() {
var e;
return (e = this.player) == null ? void 0 : e.buffered;
},
getReadyState() {
var e;
return ((e = this.player) == null ? void 0 : e.readyState) || 0;
},
getSeeking() {
var e;
return ((e = this.player) == null ? void 0 : e.seeking) || !1;
},
getDuration() {
var e;
return ((e = this.player) == null ? void 0 : e.duration) || 0;
},
getPaused() {
var e;
return ((e = this.player) == null ? void 0 : e.paused) || !1;
},
getSeekable() {
var e;
return (e = this.player) == null ? void 0 : e.seekable;
},
getEnded() {
var e;
return ((e = this.player) == null ? void 0 : e.ended) || !1;
},
getVideoWidth() {
var e;
return (e = this.player) == null ? void 0 : e.videoWidth;
},
getVideoHeight() {
var e;
return (e = this.player) == null ? void 0 : e.videoHeight;
},
getTotalVideoFrames() {
var e;
return ((e = this.player) == null ? void 0 : e.totalVideoFrames) || 0;
},
//
setSrc(e) {
this.player && (this.player.src = e);
},
getSrc() {
var e;
return (e = this.player) == null ? void 0 : e.src;
},
setConfig(e) {
this.player && (this.player.config = e);
},
getConfig() {
var e;
return (e = this.player) == null ? void 0 : e.config;
},
setCrossOrigin(e) {
this.player && (this.player.crossOrigin = e);
},
getCrossOrigin() {
var e;
return ((e = this.player) == null ? void 0 : e.crossOrigin) || null;
},
setPreload(e) {
this.player && (this.preload = e);
},
getPreload() {
var e;
return ((e = this.player) == null ? void 0 : e.preload) || "";
},
setCurrentTime(e) {
this.player && (this.player.currentTime = e);
},
getCurrentTime() {
var e;
return ((e = this.player) == null ? void 0 : e.currentTime) || 0;
},
setDefaultPlaybackRate(e) {
this.player && (this.player.defaultPlaybackRate = e);
},
getDefaultPlaybackRate() {
var e;
return (e = this.player) == null ? void 0 : e.defaultPlaybackRate;
},
setPlaybackRate(e) {
this.player && (this.player.playbackRate = e);
},
getPlaybackRate() {
var e;
return ((e = this.player) == null ? void 0 : e.playbackRate) || 1;
},
setAutoplay(e) {
this.player && (this.player.autoplay = e);
},
getAutoplay() {
var e;
return ((e = this.player) == null ? void 0 : e.autoplay) || !1;
},
setLoop(e) {
this.player && (this.player.loop = e);
},
getLoop() {
var e;
return ((e = this.player) == null ? void 0 : e.loop) || !1;
},
setControls(e) {
this.player && (this.player.controls = e);
},
getControls() {
var e;
return ((e = this.player) == null ? void 0 : e.controls) || !1;
},
setVideoId(e) {
this.player && (this.player.videoId = e);
},
getVideoId() {
var e;
return ((e = this.player) == null ? void 0 : e.videoId) || !1;
},
setVolume(e) {
this.player && (this.player.volume = e);
},
getVolume() {
var e;
return ((e = this.player) == null ? void 0 : e.volume) || 0;
},
setMuted(e) {
this.player && (this.player.muted = e);
},
getMuted() {
var e;
return ((e = this.player) == null ? void 0 : e.muted) || !1;
},
setDefaultMuted(e) {
player && (this.player.defaultMuted = e);
},
getDefaultMuted() {
var e;
return ((e = this.player) == null ? void 0 : e.defaultMuted) || !1;
},
setPoster(e) {
this.player && (this.player.poster = e);
},
getPoster() {
var e;
return ((e = this.player) == null ? void 0 : e.poster) || "";
},
setDisablePictureInPicture(e) {
player && (this.player.disablePictureInPicture = e);
},
getDisablePictureInPicture() {
var e;
return ((e = this.player) == null ? void 0 : e.disablePictureInPicture) || !1;
},
setPlaysinline(e) {
this.player && (this.player.playsinline = e);
},
getPlaysinline() {
var e;
return ((e = this.player) == null ? void 0 : e.playsinline) || !1;
},
setDisableDownload(e) {
this.player && (this.player.disableDownload = e);
},
getDisableDownload() {
var e;
return (e = this.player) == null ? void 0 : e.disableDownload;
},
setDisableAdaptive(e) {
this.player && (this.player.disableAdaptive = e);
},
getDisableAdaptive() {
var e;
return (e = this.player) == null ? void 0 : e.disableAdaptive;
},
setDisableHotkey(e) {
this.player && (this.player.disableHotkey = e);
},
getDisableHotkey() {
var e;
return (e = this.player) == null ? void 0 : e.disableHotkey;
},
setDisableMask(e) {
this.player && (this.player.disableMask = e);
},
getDisableMask() {
var e;
return (e = this.player) == null ? void 0 : e.disableMask;
},
setCurrentLevel(e) {
this.player && (this.player.currentLevel = e);
},
getCurrentLevel() {
var e;
return ((e = this.player) == null ? void 0 : e.currentLevel) || 0;
},
setNextLevel(e) {
this.player && (this.player.nextLevel = e);
},
getNextLevel() {
var e;
return ((e = this.player) == null ? void 0 : e.nextLevel) || 0;
},
setAudioTrack(e) {
this.player && (this.player.audioTrack = e);
},
getAudioTrack() {
var e;
return ((e = this.player) == null ? void 0 : e.audioTrack) || 0;
},
setCurrentVideoFrame(e) {
this.player && (this.player.currentVideoFrame = e);
},
getCurrentVideoFrame() {
var e;
return ((e = this.player) == null ? void 0 : e.currentVideoFrame) || 0;
},
setShowProgress(e) {
this.player && (this.player.showProgress = e);
},
getShowProgress() {
var e;
return (e = this.player) == null ? void 0 : e.showProgress;
},
setShowTime(e) {
this.player && (this.player.showTime = e);
},
getShowTime() {
var e;
return (e = this.player) == null ? void 0 : e.showTime;
},
setPrefetch(e) {
this.player && (this.player.prefetch = e);
},
getPrefetch() {
var e;
return (e = this.player) == null ? void 0 : e.prefetch;
},
setShowInfoPanel(e) {
this.player && (this.player.showInfoPanel = e);
},
getShowInfoPanel() {
var e;
return (e = this.player) == null ? void 0 : e.showInfoPanel;
},
setProductName(e) {
this.player && (this.player.productName = e);
},
getProductName() {
var e;
return (e = this.player) == null ? void 0 : e.productName;
},
setPreviewUrl(e) {
this.player && (this.player.previewUrl = e);
},
getPreviewUrl() {
var e;
return (e = this.player) == null ? void 0 : e.previewUrl;
},
setMaskUrl(e) {
this.player && (this.player.maskUrl = e);
},
getMaskUrl() {
var e;
return (e = this.player) == null ? void 0 : e.maskUrl;
},
setDisableDanmaku(e) {
this.player && (this.player.disableDanmaku = e);
},
getDisableDanmaku() {
var e;
return (e = this.player) == null ? void 0 : e.disableDanmaku;
},
setDanmakuRendering(e) {
this.player && (this.player.danmakuRendering = e);
},
getDanmakuRendering() {
var e;
return (e = this.player) == null ? void 0 : e.danmakuRendering;
},
getAudienceStat() {
var e;
return (e = this.player) == null ? void 0 : e.audienceStat;
},
getStreamTime(e) {
var r;
return ((r = this.player) == null ? void 0 : r.getStreamTime(e)) || 0;
},
getIsLiveShift() {
var e;
return ((e = this.player) == null ? void 0 : e.isLiveShift) || !1;
},
getLiveShiftType() {
var e;
return ((e = this.player) == null ? void 0 : e.liveShiftType) || Pa.NONE;
},
setLiveShiftType(e) {
this.player && (this.player.liveShiftType = e);
},
getVersion() {
return Ur.version;
},
getPluginInstance(e) {
var r;
return (r = this.player) == null ? void 0 : r.getPluginInstance(e);
},
getAllPlugins() {
var e;
return (e = this.player) == null ? void 0 : e.getAllPlugins();
}
},
created() {
this.cid = this.id || jA();
},
mounted() {
const e = this.player = new Ur(`#${this.cid}`, {
config: this.config,
src: this.src,
crossOrigin: this.crossOrigin,
preload: this.preload,
defaultPlaybackRate: this.defaultPlaybackRate,
playbackRate: this.playbackRate,
autoplay: this.autoplay,
loop: this.loop,
controls: this.controls,
videoId: this.videoId,
volume: this.volume,
muted: this.muted,
defaultMuted: this.defaultMuted,
poster: this.poster,
disablePictureInPicture: this.disablePictureInPicture,
disableDownload: this.disableDownload,
disableAdaptive: this.disableAdaptive,
disableHotkey: this.disableHotkey,
disableMask: this.disableMask,
playsinline: this.playsinline,
showProgress: this.showProgress,
showTime: this.showTime,
prefetch: this.prefetch,
showInfoPanel: this.showInfoPanel,
productName: this.productName,
previewUrl: this.previewUrl,
maskUrl: this.maskUrl,
disableDanmaku: this.disableDanmaku,
danmakuRendering: this.danmakuRendering,
plugins: this.plugins,
bizData: this.bizData,
liveShiftType: this.liveShiftType
});
e.logger.i(Gt, "mounted"), pv.forEach((r) => {
e.on(r, (n) => {
this.$emit(r, n);
});
});
},
beforeUnmount() {
this.player.destroy();
}
};
var Av = function() {
var e = this, r = e.$createElement, n = e._self._c || r;
return n("div", {
attrs: {
id: e.cid
}
}, [e._t("watermark")], 2);
}, vv = [];
function gv(e, r, n, o, s, p, g, C) {
var y = typeof e == "function" ? e.options : e;
r && (y.render = r, y.staticRenderFns = n, y._compiled = !0), o && (y.functional = !0), p && (y._scopeId = "data-v-" + p);
var x;
if (g ? (x = function(I) {
I = I || // cached call
this.$vnode && this.$vnode.ssrContext || // stateful
this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !I && typeof __VUE_SSR_CONTEXT__ < "u" && (I = __VUE_SSR_CONTEXT__), s && s.call(this, I), I && I._registeredComponents && I._registeredComponents.add(g);
}, y._ssrRegister = x) : s && (x = C ? function() {
s.call(
this,
(y.functional ? this.parent : this).$root.$options.shadowRoot
);
} : s), x)
if (y.functional) {
y._injectStyles = x;
var h = y.render;
y.render = function(I, T) {
return x.call(T), h(I, T);
};
} else {
var F = y.beforeCreate;
y.beforeCreate = F ? [].concat(F, x) : [x];
}
return {
exports: e,
options: y
};
}
const Il = {};
var mv = /* @__PURE__ */ gv(
_v,
Av,
vv,
!1,
bv,
null,
null,
null
);
function bv(e) {
for (let r in Il)
this[r] = Il[r];
}
const wC = /* @__PURE__ */ function() {
return mv.exports;
}();
var Ev = Object.defineProperty, yv = (e, r, n) => r in e ? Ev(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, sh = (e, r, n) => (yv(e, typeof r != "symbol" ? r + "" : r, n), n), Vn = function(e) {
var r = {};
function n(o) {
if (r[o])
return r[o].exports;
var s = r[o] = { i: o, l: !1, exports: {} };
return e[o].call(s.exports, s, s.exports, n), s.l = !0, s.exports;
}
return n.m = e, n.c = r, n.d = function(o, s, p) {
n.o(o, s) || Object.defineProperty(o, s, { enumerable: !0, get: p });
}, n.r = function(o) {
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(o, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(o, "__esModule", { value: !0 });
}, n.t = function(o, s) {
if (1 & s && (o = n(o)), 8 & s || 4 & s && typeof o == "object" && o && o.__esModule)
return o;
var p = /* @__PURE__ */ Object.create(null);
if (n.r(p), Object.defineProperty(p, "default", { enumerable: !0, value: o }), 2 & s && typeof o != "string")
for (var g in o)
n.d(p, g, function(C) {
return o[C];
}.bind(null, g));
return p;
}, n.n = function(o) {
var s = o && o.__esModule ? function() {
return o.default;
} : function() {
return o;
};
return n.d(s, "a", s), s;
}, n.o = function(o, s) {
return Object.prototype.hasOwnProperty.call(o, s);
}, n.p = "", n(n.s = 8);
}([function(e, r, n) {
var o = n(5);
function s(p, g) {
for (var C = 0; C < g.length; C++) {
var y = g[C];
y.enumerable = y.enumerable || !1, y.configurable = !0, "value" in y && (y.writable = !0), Object.defineProperty(p, o(y.key), y);
}
}
e.exports = function(p, g, C) {
return g && s(p.prototype, g), C && s(p, C), Object.defineProperty(p, "prototype", { writable: !1 }), p;
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r) {
function n(o) {
return e.exports = n = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(s) {
return typeof s;
} : function(s) {
return s && typeof Symbol == "function" && s.constructor === Symbol && s !== Symbol.prototype ? "symbol" : typeof s;
}, e.exports.__esModule = !0, e.exports.default = e.exports, n(o);
}
e.exports = n, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r, n) {
var o = n(7)();
e.exports = o;
try {
regeneratorRuntime = o;
} catch (s) {
typeof globalThis == "object" ? globalThis.regeneratorRuntime = o : Function("r", "regeneratorRuntime = r")(o);
}
}, function(e, r) {
function n() {
return e.exports = n = Object.assign ? Object.assign.bind() : function(o) {
for (var s = 1; s < arguments.length; s++) {
var p = arguments[s];
for (var g in p)
Object.prototype.hasOwnProperty.call(p, g) && (o[g] = p[g]);
}
return o;
}, e.exports.__esModule = !0, e.exports.default = e.exports, n.apply(this, arguments);
}
e.exports = n, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r) {
function n(o, s, p, g, C, y, x) {
try {
var h = o[y](x), F = h.value;
} catch (I) {
return void p(I);
}
h.done ? s(F) : Promise.resolve(F).then(g, C);
}
e.exports = function(o) {
return function() {
var s = this, p = arguments;
return new Promise(function(g, C) {
var y = o.apply(s, p);
function x(F) {
n(y, g, C, x, h, "next", F);
}
function h(F) {
n(y, g, C, x, h, "throw", F);
}
x(void 0);
});
};
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r, n) {
var o = n(1).default, s = n(6);
e.exports = function(p) {
var g = s(p, "string");
return o(g) == "symbol" ? g : g + "";
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r, n) {
var o = n(1).default;
e.exports = function(s, p) {
if (o(s) != "object" || !s)
return s;
var g = s[Symbol.toPrimitive];
if (g !== void 0) {
var C = g.call(s, p || "default");
if (o(C) != "object")
return C;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (p === "string" ? String : Number)(s);
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r, n) {
var o = n(1).default;
function s() {
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
e.exports = s = function() {
return g;
}, e.exports.__esModule = !0, e.exports.default = e.exports;
var p, g = {}, C = Object.prototype, y = C.hasOwnProperty, x = Object.defineProperty || function(de, X, ge) {
de[X] = ge.value;
}, h = typeof Symbol == "function" ? Symbol : {}, F = h.iterator || "@@iterator", I = h.asyncIterator || "@@asyncIterator", T = h.toStringTag || "@@toStringTag";
function D(de, X, ge) {
return Object.defineProperty(de, X, { value: ge, enumerable: !0, configurable: !0, writable: !0 }), de[X];
}
try {
D({}, "");
} catch (de) {
D = function(X, ge, Pe) {
return X[ge] = Pe;
};
}
function W(de, X, ge, Pe) {
var ae = X && X.prototype instanceof J ? X : J, q = Object.create(ae.prototype), m = new Re(Pe || []);
return x(q, "_invoke", { value: L(de, ge, m) }), q;
}
function j(de, X, ge) {
try {
return { type: "normal", arg: de.call(X, ge) };
} catch (Pe) {
return { type: "throw", arg: Pe };
}
}
g.wrap = W;
var O = "suspendedStart", K = "executing", z = "completed", B = {};
function J() {
}
function be() {
}
function $() {
}
var ye = {};
D(ye, F, function() {
return this;
});
var Be = Object.getPrototypeOf, Ve = Be && Be(Be(Oe([])));
Ve && Ve !== C && y.call(Ve, F) && (ye = Ve);
var je = $.prototype = J.prototype = Object.create(ye);
function we(de) {
["next", "throw", "return"].forEach(function(X) {
D(de, X, function(ge) {
return this._invoke(X, ge);
});
});
}
function ue(de, X) {
function ge(ae, q, m, ve) {
var U = j(de[ae], de, q);
if (U.type !== "throw") {
var M = U.arg, ne = M.value;
return ne && o(ne) == "object" && y.call(ne, "__await") ? X.resolve(ne.__await).then(function(Le) {
ge("next", Le, m, ve);
}, function(Le) {
ge("throw", Le, m, ve);
}) : X.resolve(ne).then(function(Le) {
M.value = Le, m(M);
}, function(Le) {
return ge("throw", Le, m, ve);
});
}
ve(U.arg);
}
var Pe;
x(this, "_invoke", { value: function(ae, q) {
function m() {
return new X(function(ve, U) {
ge(ae, q, ve, U);
});
}
return Pe = Pe ? Pe.then(m, m) : m();
} });
}
function L(de, X, ge) {
var Pe = O;
return function(ae, q) {
if (Pe === K)
throw Error("Generator is already running");
if (Pe === z) {
if (ae === "throw")
throw q;
return { value: p, done: !0 };
}
for (ge.method = ae, ge.arg = q; ; ) {
var m = ge.delegate;
if (m) {
var ve = w(m, ge);
if (ve) {
if (ve === B)
continue;
return ve;
}
}
if (ge.method === "next")
ge.sent = ge._sent = ge.arg;
else if (ge.method === "throw") {
if (Pe === O)
throw Pe = z, ge.arg;
ge.dispatchException(ge.arg);
} else
ge.method === "return" && ge.abrupt("return", ge.arg);
Pe = K;
var U = j(de, X, ge);
if (U.type === "normal") {
if (Pe = ge.done ? z : "suspendedYield", U.arg === B)
continue;
return { value: U.arg, done: ge.done };
}
U.type === "throw" && (Pe = z, ge.method = "throw", ge.arg = U.arg);
}
};
}
function w(de, X) {
var ge = X.method, Pe = de.iterator[ge];
if (Pe === p)
return X.delegate = null, ge === "throw" && de.iterator.return && (X.method = "return", X.arg = p, w(de, X), X.method === "throw") || ge !== "return" && (X.method = "throw", X.arg = new TypeError("The iterator does not provide a '" + ge + "' method")), B;
var ae = j(Pe, de.iterator, X.arg);
if (ae.type === "throw")
return X.method = "throw", X.arg = ae.arg, X.delegate = null, B;
var q = ae.arg;
return q ? q.done ? (X[de.resultName] = q.value, X.next = de.nextLoc, X.method !== "return" && (X.method = "next", X.arg = p), X.delegate = null, B) : q : (X.method = "throw", X.arg = new TypeError("iterator result is not an object"), X.delegate = null, B);
}
function le(de) {
var X = { tryLoc: de[0] };
1 in de && (X.catchLoc = de[1]), 2 in de && (X.finallyLoc = de[2], X.afterLoc = de[3]), this.tryEntries.push(X);
}
function oe(de) {
var X = de.completion || {};
X.type = "normal", delete X.arg, de.completion = X;
}
function Re(de) {
this.tryEntries = [{ tryLoc: "root" }], de.forEach(le, this), this.reset(!0);
}
function Oe(de) {
if (de || de === "") {
var X = de[F];
if (X)
return X.call(de);
if (typeof de.next == "function")
return de;
if (!isNaN(de.length)) {
var ge = -1, Pe = function ae() {
for (; ++ge < de.length; )
if (y.call(de, ge))
return ae.value = de[ge], ae.done = !1, ae;
return ae.value = p, ae.done = !0, ae;
};
return Pe.next = Pe;
}
}
throw new TypeError(o(de) + " is not iterable");
}
return be.prototype = $, x(je, "constructor", { value: $, configurable: !0 }), x($, "constructor", { value: be, configurable: !0 }), be.displayName = D($, T, "GeneratorFunction"), g.isGeneratorFunction = function(de) {
var X = typeof de == "function" && de.constructor;
return !!X && (X === be || (X.displayName || X.name) === "GeneratorFunction");
}, g.mark = function(de) {
return Object.setPrototypeOf ? Object.setPrototypeOf(de, $) : (de.__proto__ = $, D(de, T, "GeneratorFunction")), de.prototype = Object.create(je), de;
}, g.awrap = function(de) {
return { __await: de };
}, we(ue.prototype), D(ue.prototype, I, function() {
return this;
}), g.AsyncIterator = ue, g.async = function(de, X, ge, Pe, ae) {
ae === void 0 && (ae = Promise);
var q = new ue(W(de, X, ge, Pe), ae);
return g.isGeneratorFunction(X) ? q : q.next().then(function(m) {
return m.done ? m.value : q.next();
});
}, we(je), D(je, T, "Generator"), D(je, F, function() {
return this;
}), D(je, "toString", function() {
return "[object Generator]";
}), g.keys = function(de) {
var X = Object(de), ge = [];
for (var Pe in X)
ge.push(Pe);
return ge.reverse(), function ae() {
for (; ge.length; ) {
var q = ge.pop();
if (q in X)
return ae.value = q, ae.done = !1, ae;
}
return ae.done = !0, ae;
};
}, g.values = Oe, Re.prototype = { constructor: Re, reset: function(de) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = p, this.done = !1, this.delegate = null, this.method = "next", this.arg = p, this.tryEntries.forEach(oe), !de)
for (var X in this)
X.charAt(0) === "t" && y.call(this, X) && !isNaN(+X.slice(1)) && (this[X] = p);
}, stop: function() {
this.done = !0;
var de = this.tryEntries[0].completion;
if (de.type === "throw")
throw de.arg;
return this.rval;
}, dispatchException: function(de) {
if (this.done)
throw de;
var X = this;
function ge(U, M) {
return q.type = "throw", q.arg = de, X.next = U, M && (X.method = "next", X.arg = p), !!M;
}
for (var Pe = this.tryEntries.length - 1; Pe >= 0; --Pe) {
var ae = this.tryEntries[Pe], q = ae.completion;
if (ae.tryLoc === "root")
return ge("end");
if (ae.tryLoc <= this.prev) {
var m = y.call(ae, "catchLoc"), ve = y.call(ae, "finallyLoc");
if (m && ve) {
if (this.prev < ae.catchLoc)
return ge(ae.catchLoc, !0);
if (this.prev < ae.finallyLoc)
return ge(ae.finallyLoc);
} else if (m) {
if (this.prev < ae.catchLoc)
return ge(ae.catchLoc, !0);
} else {
if (!ve)
throw Error("try statement without catch or finally");
if (this.prev < ae.finallyLoc)
return ge(ae.finallyLoc);
}
}
}
}, abrupt: function(de, X) {
for (var ge = this.tryEntries.length - 1; ge >= 0; --ge) {
var Pe = this.tryEntries[ge];
if (Pe.tryLoc <= this.prev && y.call(Pe, "finallyLoc") && this.prev < Pe.finallyLoc) {
var ae = Pe;
break;
}
}
ae && (de === "break" || de === "continue") && ae.tryLoc <= X && X <= ae.finallyLoc && (ae = null);
var q = ae ? ae.completion : {};
return q.type = de, q.arg = X, ae ? (this.method = "next", this.next = ae.finallyLoc, B) : this.complete(q);
}, complete: function(de, X) {
if (de.type === "throw")
throw de.arg;
return de.type === "break" || de.type === "continue" ? this.next = de.arg : de.type === "return" ? (this.rval = this.arg = de.arg, this.method = "return", this.next = "end") : de.type === "normal" && X && (this.next = X), B;
}, finish: function(de) {
for (var X = this.tryEntries.length - 1; X >= 0; --X) {
var ge = this.tryEntries[X];
if (ge.finallyLoc === de)
return this.complete(ge.completion, ge.afterLoc), oe(ge), B;
}
}, catch: function(de) {
for (var X = this.tryEntries.length - 1; X >= 0; --X) {
var ge = this.tryEntries[X];
if (ge.tryLoc === de) {
var Pe = ge.completion;
if (Pe.type === "throw") {
var ae = Pe.arg;
oe(ge);
}
return ae;
}
}
throw Error("illegal catch attempt");
}, delegateYield: function(de, X, ge) {
return this.delegate = { iterator: Oe(de), resultName: X, nextLoc: ge }, this.method === "next" && (this.arg = p), B;
} }, g;
}
e.exports = s, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r, n) {
n.r(r), n.d(r, "KwaiVideoLocalLog", function() {
return je;
}), n.d(r, "LogLevel", function() {
return I;
}), n.d(r, "DefaultLogger", function() {
return j;
}), n.d(r, "Logger", function() {
return W;
}), n.d(r, "printVersion", function() {
return y;
}), n.d(r, "DEFAULT_LOG_LEVEL", function() {
return T;
});
var o = n(0), s = n.n(o), p = n(3), g = n.n(p), C = { idbName: "kwai-video-local-log", idbMaxDataCount: 25e3, idbMaxFoldLog: 20, maxLogLen: 4096 };
function y(we, ue) {
console.log("%c " + we + " %c " + ue + " %c", "background:#35495e ; padding: 1px; border-radius: 4px 0 0 4px; color: #fff", "background:#ffa483 ; padding: 1px; border-radius: 0 4px 4px 0; color: #fff", "background:transparent");
}
var x = function() {
function we() {
this.timeout = 6048e5;
}
var ue = we.prototype;
return ue.write = function(L, w) {
if (we.available)
try {
localStorage.setItem(L, JSON.stringify({ value: w, time: Date.now() }));
} catch (le) {
}
}, ue.read = function(L, w) {
if (w === void 0 && (w = !0), we.available)
try {
var le = localStorage.getItem(L);
if (le) {
var oe = JSON.parse(le), Re = oe.value, Oe = oe.time, de = Oe === void 0 ? 0 : Oe;
if (!w || Date.now() - de < (typeof w == "number" ? w : this.timeout))
return Re;
}
} catch (X) {
}
}, s()(we, null, [{ key: "available", get: function() {
if (we._available === void 0)
try {
localStorage.setItem("alg", "test"), we._available = !0;
} catch (L) {
we._available = !1;
}
return we._available;
} }]);
}();
x._available = void 0;
var h, F = x, I = function(we) {
return we.NONE = "none", we.ERROR = "e", we.WARN = "w", we.INFO = "i", we.DEBUG = "d", we.VERBOSE = "v", we;
}({}), T = I.ERROR, D = ((h = {})[I.NONE] = { value: 1, str: "N" }, h[I.ERROR] = { value: 100, str: "E" }, h[I.WARN] = { value: 200, str: "W" }, h[I.INFO] = { value: 300, str: "I" }, h[I.DEBUG] = { value: 400, str: "D" }, h[I.VERBOSE] = { value: 500, str: "V" }, h), W = function() {
function we(L) {
if (this._name = "kwai-v", this._level = T, this._id = -1, this._output = void 0, this._workerTag = "main", typeof location < "u" && location.protocol === "blob:") {
var w, le = location.href.split("/"), oe = (w = le[le.length - 1]) == null ? void 0 : w.match(/(\w+)-/);
oe && (this._workerTag = L ? L + "-" + oe[1] : oe[1]);
} else
L && (this._workerTag = L);
}
we.loadLogLevel = function(L, w) {
if (w === void 0 && (w = !0), location.href) {
var le = new RegExp(L + "=([a-z]{1})"), oe = location.href.match(le);
if (oe && oe.length > 1) {
var Re = oe[1];
if (this._isValueInLevel(Re))
return Re;
}
}
var Oe = new F().read(L, w);
if (this._isValueInLevel(Oe))
return Oe;
}, we.saveLogLevel = function(L, w) {
this._isValueInLevel(w) && new F().write(L, w);
}, we._isValueInLevel = function(L) {
return Object.values(I).indexOf(L) !== -1;
};
var ue = we.prototype;
return ue.setOutput = function(L) {
return this._output = L, this;
}, ue.setLevel = function(L) {
return this._level = L, this;
}, ue.setId = function(L) {
return this._id = L, this;
}, ue.setName = function(L) {
return this._name = L, this;
}, ue.getLevel = function() {
return this._level;
}, ue.getOutput = function() {
return this._output;
}, ue.hasOutput = function() {
return !!this._output;
}, ue.e = function(L) {
if (this._isLevelEnabled(this._level, I.ERROR)) {
for (var w = arguments.length, le = new Array(w > 1 ? w - 1 : 0), oe = 1; oe < w; oe++)
le[oe - 1] = arguments[oe];
var Re = this._printLog(I.ERROR, L, le);
try {
var Oe;
(Oe = this._output) == null || Oe.e.apply(Oe, [Re].concat(le));
} catch (de) {
}
}
}, ue.w = function(L) {
if (this._isLevelEnabled(this._level, I.WARN)) {
for (var w = arguments.length, le = new Array(w > 1 ? w - 1 : 0), oe = 1; oe < w; oe++)
le[oe - 1] = arguments[oe];
var Re = this._printLog(I.WARN, L, le);
try {
var Oe;
(Oe = this._output) == null || Oe.w.apply(Oe, [Re].concat(le));
} catch (de) {
}
}
}, ue.i = function(L) {
if (this._isLevelEnabled(this._level, I.INFO)) {
for (var w = arguments.length, le = new Array(w > 1 ? w - 1 : 0), oe = 1; oe < w; oe++)
le[oe - 1] = arguments[oe];
var Re = this._printLog(I.INFO, L, le);
try {
var Oe;
(Oe = this._output) == null || Oe.i.apply(Oe, [Re].concat(le));
} catch (de) {
}
}
}, ue.d = function(L) {
if (this._isLevelEnabled(this._level, I.DEBUG)) {
for (var w = arguments.length, le = new Array(w > 1 ? w - 1 : 0), oe = 1; oe < w; oe++)
le[oe - 1] = arguments[oe];
var Re = this._printLog(I.DEBUG, L, le);
try {
var Oe;
(Oe = this._output) == null || Oe.d.apply(Oe, [Re].concat(le));
} catch (de) {
}
}
}, ue.v = function(L) {
if (this._isLevelEnabled(this._level, I.VERBOSE)) {
for (var w = arguments.length, le = new Array(w > 1 ? w - 1 : 0), oe = 1; oe < w; oe++)
le[oe - 1] = arguments[oe];
var Re = this._printLog(I.VERBOSE, L, le);
try {
var Oe;
(Oe = this._output) == null || Oe.v.apply(Oe, [Re].concat(le));
} catch (de) {
}
}
}, ue._isLevelEnabled = function(L, w) {
return D[L].value >= D[w].value;
}, ue._printLog = function(L, w, le) {
var oe, Re, Oe = typeof w;
if (Oe === "object")
w = ((Re = w) == null ? void 0 : Re.constructor.name) || "unknown";
else if (Oe === "function") {
var de;
w = ((de = Object.getOwnPropertyDescriptor(w, "name")) == null ? void 0 : de.value) || "unknown";
}
var X, ge, Pe = (((oe = D[L]) == null ? void 0 : oe.str) || "") + "|" + this._name + "[" + (typeof this._id == "function" ? this._id() : this._id) + "][" + this._workerTag + "]::" + w;
return L === I.ERROR ? (X = console).error.apply(X, [Pe].concat(le.slice(0))) : (ge = console).log.apply(ge, [Pe].concat(le.slice(0))), Pe;
}, we;
}(), j = new W(), O = function() {
return s()(function we(ue) {
this._logger = void 0, this._id = 0, this._config = C, this._id = we._id, we._id++, this._logger = new W().setId(this._id).setLevel(I.INFO), this._config = g()({}, C, ue);
}, [{ key: "config", get: function() {
return this._config;
} }, { key: "logger", get: function() {
return this._logger;
} }, { key: "id", get: function() {
return this._id;
} }], [{ key: "packName", get: function() {
return "ll_es";
} }, { key: "version", get: function() {
return "1.0.13";
} }, { key: "buildTime", get: function() {
return "Tue Oct 08 2024 17:18:49 GMT+0800 (中国标准时间)";
} }]);
}();
O._id = 0;
var K = n(4), z = n.n(K), B = n(2), J = n.n(B), be = function() {
function we(L, w, le, oe, Re) {
var Oe = this;
Re === void 0 && (Re = 1), this._logger = void 0, this._name = void 0, this._storeName = void 0, this._dbIndex = void 0, this._version = void 0, this._taskQueue = [], this._openReq = void 0, this._isTransactionActive = !1, this._runTaskQueue = function() {
for (; Oe._taskQueue.length; ) {
var de = Oe._taskQueue.shift();
de && Oe.run(de.task, de.mode);
}
}, this._logger = L, this._name = w, this._storeName = le, this._dbIndex = oe, this._version = Re;
}
var ue = we.prototype;
return ue.init = function() {
var L = this;
if (!this._openReq && indexedDB) {
var w = this._openReq = indexedDB.open(this._name, this._version);
this._logger.i("idb-wrapper", "open", w), w.onerror = function() {
L._logger.i("idb-wrapper", "open error.");
}, w.onsuccess = function() {
L._logger.i("idb-wrapper", "open success."), L._runTaskQueue();
}, w.onupgradeneeded = function() {
L._logger.i("idb-wrapper", "open upgradeneeded."), w.result.objectStoreNames.contains(L._storeName) && w.result.deleteObjectStore(L._storeName);
var le = w.result.createObjectStore(L._storeName, { keyPath: "id", autoIncrement: !0 });
L._dbIndex && L._dbIndex.forEach(function(oe) {
le.createIndex(oe.name, oe.keyPath, oe.option);
});
};
}
}, ue.run = function(L, w) {
if (w === void 0 && (w = "readwrite"), this.init(), this._openReq && this._openReq.readyState === "done" && !this._openReq.error)
return this._doTask(L, w);
this.state !== "error" && (this._taskQueue.push({ task: L, mode: w }), this._taskQueue.length > 1e3 && this._taskQueue.shift());
}, ue.close = function() {
var L = this;
this._logger.i("idb-wrapper", "close"), this._openReq && (this._openReq.readyState === "done" ? (this._openReq.result.close(), this._openReq = void 0) : this._openReq.onsuccess = function() {
L.close();
});
}, ue.destroy = function() {
this._logger.i("idb-wrapper", "destroy"), this.close(), this._taskQueue = [];
}, ue._doTask = function(L, w) {
var le = this;
if (w === void 0 && (w = "readwrite"), this._openReq && !this._openReq.error)
try {
this._isTransactionActive = !0;
var oe = this._openReq.result.transaction(this._storeName, w), Re = void 0;
oe.oncomplete = function() {
le._isTransactionActive = !1, L.callback && L.callback(Re), le._runTaskQueue();
}, oe.onabort = oe.onerror = function() {
le._isTransactionActive = !1, L.callback && L.callback(Re), le._runTaskQueue();
}, Re = L.exec(oe.objectStore(this._storeName));
} catch (Oe) {
}
else
L.callback && L.callback();
}, s()(we, [{ key: "isTransactionActive", get: function() {
return this._isTransactionActive;
} }, { key: "state", get: function() {
return this._openReq && this._openReq.readyState === "done" ? this._openReq.error ? "error" : "ready" : "idle";
} }]);
}(), $ = [{ name: "id", keyPath: "id", option: { unique: !0 } }], ye = [function() {
function we(L) {
this._ctx = void 0, this._idb = void 0, this._logCount = 0, this._saveCount = 0, this._reCountOnSaveCount = 100, this._reduceData = !1, this._ctx = L, this._idb = new be(L.logger, L.config.idbName, L.config.idbName, $), this._reCountOnSaveCount = Math.min(200, Math.max(50, Math.round(this._ctx.config.idbMaxDataCount / 10))), this._count();
}
we.isSupported = function() {
return typeof indexedDB < "u";
};
var ue = we.prototype;
return ue.saveLog = function(L) {
var w = this, le = { exec: function(oe) {
return oe.add({ value: L });
}, callback: function(oe) {
w._saveCount++, w._saveCount % w._reCountOnSaveCount == 0 && w._count(), oe != null && oe.error && w._ctx.logger.i("idb-backend", "save log err", oe.error);
} };
this._idb.run(le);
}, ue.exportLog = function() {
var L = z()(J.a.mark(function w() {
var le = this;
return J.a.wrap(function(oe) {
for (; ; )
switch (oe.prev = oe.next) {
case 0:
return oe.abrupt("return", new Promise(function(Re, Oe) {
le._ctx.logger.i("idb-backend", "export start");
var de = { exec: function(X) {
return X.getAll();
}, callback: function(X) {
Re(X === void 0 ? "" : le._mergeGetAll(X.result));
} };
le._idb.run(de, "readonly");
}));
case 1:
case "end":
return oe.stop();
}
}, w);
}));
return function() {
return L.apply(this, arguments);
};
}(), ue.destroy = function() {
this._idb.destroy();
}, ue.clean = function() {
this._idb.run({ exec: function(L) {
return L.clear();
} });
}, ue._count = function() {
var L = this, w = { exec: function(le) {
return le.count();
}, callback: function(le) {
le != null && le.error || le == null || !le.result || (L._ctx.logger.i("idb-backend", "count: " + le.result + " max: " + L._ctx.config.idbMaxDataCount), L._logCount = le.result, L._logCount >= L._ctx.config.idbMaxDataCount && !L._reduceData && L._deleteFromHead(L._logCount - Math.round(L._ctx.config.idbMaxDataCount / 2)));
} };
this._idb.run(w);
}, ue._deleteFromHead = function(L) {
var w = this;
this._ctx.logger.i("idb-backend", "delete from head"), this._reduceData = !0;
var le = { exec: function(oe) {
return oe.openCursor();
}, callback: function(oe) {
if (w._reduceData = !1, oe != null && oe.result) {
var Re = IDBKeyRange.bound(oe.result.key, oe.result.key + L, !1, !1), Oe = { exec: function(de) {
return w._ctx.logger.i("idb-backend", "del: " + Re.lower + "~" + Re.upper), de.delete(Re);
}, callback: function(de) {
w._ctx.logger.i("idb-backend", "del result: " + !(de == null || !de.error));
} };
w._idb.run(Oe);
}
} };
this._idb.run(le);
}, ue._mergeGetAll = function(L) {
return L.length ? L.reduce(function(w, le) {
return "" + w + le.value + `
`;
}, "") : "";
}, s()(we, [{ key: "isActive", get: function() {
return this._idb.state !== "error";
} }]);
}()];
function Be(we, ue, L) {
var w = /* @__PURE__ */ new Date();
typeof we != "string" && (we = we.toString());
var le = w.toLocaleString() + "." + w.getMilliseconds().toString().padStart(3, "0") + "|" + we + "|";
return ue.forEach(function(oe) {
le += typeof oe == "object" ? JSON.stringify(oe) + " " : oe + " ";
}), le.length > L ? le.substring(0, L) : le;
}
function Ve(we) {
return we.join(`
`);
}
var je = function() {
function we(L) {
var w = this;
this._ctx = void 0, this._backend = void 0, this._delayTimer = void 0, this._logCache = [], this._loggerForAdd = void 0, this._downloadHref = void 0, this._startDelay = function() {
w._delayTimer = setInterval(function() {
w._saveLog(!0);
}, 1e3);
}, this._stopDelay = function() {
w._delayTimer && (clearTimeout(w._delayTimer), w._delayTimer = void 0);
}, y("kwai-video-local-log", "1.0.13"), this._ctx = new O(L);
var le = function(oe) {
for (var Re = arguments.length, Oe = new Array(Re > 1 ? Re - 1 : 0), de = 1; de < Re; de++)
Oe[de - 1] = arguments[de];
w.addLog.apply(w, [oe].concat(Oe));
};
this._loggerForAdd = { e: le, w: le, i: le, d: le, v: le }, this._ctx.logger.setOutput(this._loggerForAdd), this._ctx.logger.i("kwai-video-local-log", "constructor", L, this._ctx.config), this._backend = function(oe) {
for (var Re = 0; Re < ye.length; Re++) {
var Oe = ye[Re];
if (Oe != null && Oe.isSupported())
return new Oe(oe);
}
}(this._ctx), this._backend && this._startDelay();
}
we.isSupported = function() {
return function() {
for (var L = 0; L < ye.length; L++) {
var w = ye[L];
if (w != null && w.isSupported())
return !0;
}
return !1;
}();
};
var ue = we.prototype;
return ue.addLog = function(L) {
for (var w = arguments.length, le = new Array(w > 1 ? w - 1 : 0), oe = 1; oe < w; oe++)
le[oe - 1] = arguments[oe];
this._logCache.push(Be(L, le, this._ctx.config.maxLogLen)), this._saveLog();
}, ue.cleanLog = function() {
var L;
this._ctx.logger.i("kwai-video-local-log", "clean"), (L = this._backend) == null || L.clean();
}, ue.exportLog = function() {
var L = this;
return this._ctx.logger.i("kwai-video-local-log", "export log"), new Promise(function(w, le) {
L._backend ? L._backend.exportLog().then(function(oe) {
w(Ve([oe].concat(L._logCache)));
}) : w("");
});
}, ue.downloadLog = function(L) {
var w = this;
this._ctx.logger.i("kwai-video-local-log", "download log: " + L), this._destroyDownloadHref(), this.exportLog().then(function(le) {
var oe = new Blob([le], { type: "text/plain" });
if (document) {
var Re = document.createElement("a");
w._downloadHref = Re.href = URL.createObjectURL(oe), Re.download = L || "Log_web_" + (/* @__PURE__ */ new Date()).toLocaleString() + ".log", document.body.appendChild(Re), Re.click(), Re.remove();
} else
console.log("无document,当前是否在worker中");
});
}, ue.destroy = function() {
var L;
this._destroyDownloadHref(), (L = this._backend) == null || L.destroy(), this._stopDelay();
}, ue.getLoggerForAdd = function() {
return this._loggerForAdd;
}, ue._destroyDownloadHref = function() {
try {
this._downloadHref && (URL.revokeObjectURL(this._downloadHref), this._downloadHref = void 0);
} catch (L) {
}
}, ue._saveLog = function(L) {
if (L === void 0 && (L = !1), this._backend && this._backend.isActive && (this._logCache.length >= this._ctx.config.idbMaxFoldLog || this._logCache.length > 0 && L)) {
var w = Ve(this._logCache);
this._logCache.splice(0, this._logCache.length), w && this._backend.saveLog(w);
}
}, s()(we, null, [{ key: "version", get: function() {
return "1.0.13";
} }]);
}();
r.default = je;
}]);
Vn === void 0 && console.error("esm-webpack-plugin: nothing exported!");
const Rl = Vn.KwaiVideoLocalLog, oh = Vn.LogLevel, Cv = Vn.DefaultLogger, Tv = Vn.Logger;
Vn.printVersion;
Vn.DEFAULT_LOG_LEVEL;
Vn.default;
var Vo = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function ch(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var uc = { exports: {} }, la = typeof Reflect == "object" ? Reflect : null, wl = la && typeof la.apply == "function" ? la.apply : function(e, r, n) {
return Function.prototype.apply.call(e, r, n);
}, ps;
la && typeof la.ownKeys == "function" ? ps = la.ownKeys : Object.getOwnPropertySymbols ? ps = function(e) {
return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e));
} : ps = function(e) {
return Object.getOwnPropertyNames(e);
};
function Iv(e) {
console && console.warn && console.warn(e);
}
var lh = Number.isNaN || function(e) {
return e !== e;
};
function Jt() {
Jt.init.call(this);
}
uc.exports = Jt;
uc.exports.once = Dv;
Jt.EventEmitter = Jt;
Jt.prototype._events = void 0;
Jt.prototype._eventsCount = 0;
Jt.prototype._maxListeners = void 0;
var Ll = 10;
function xs(e) {
if (typeof e != "function")
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof e);
}
Object.defineProperty(Jt, "defaultMaxListeners", {
enumerable: !0,
get: function() {
return Ll;
},
set: function(e) {
if (typeof e != "number" || e < 0 || lh(e))
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + e + ".");
Ll = e;
}
});
Jt.init = function() {
(this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
};
Jt.prototype.setMaxListeners = function(e) {
if (typeof e != "number" || e < 0 || lh(e))
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + ".");
return this._maxListeners = e, this;
};
function uh(e) {
return e._maxListeners === void 0 ? Jt.defaultMaxListeners : e._maxListeners;
}
Jt.prototype.getMaxListeners = function() {
return uh(this);
};
Jt.prototype.emit = function(e) {
for (var r = [], n = 1; n < arguments.length; n++)
r.push(arguments[n]);
var o = e === "error", s = this._events;
if (s !== void 0)
o = o && s.error === void 0;
else if (!o)
return !1;
if (o) {
var p;
if (r.length > 0 && (p = r[0]), p instanceof Error)
throw p;
var g = new Error("Unhandled error." + (p ? " (" + p.message + ")" : ""));
throw g.context = p, g;
}
var C = s[e];
if (C === void 0)
return !1;
if (typeof C == "function")
wl(C, this, r);
else
for (var y = C.length, x = _h(C, y), n = 0; n < y; ++n)
wl(x[n], this, r);
return !0;
};
function hh(e, r, n, o) {
var s, p, g;
if (xs(n), p = e._events, p === void 0 ? (p = e._events = /* @__PURE__ */ Object.create(null), e._eventsCount = 0) : (p.newListener !== void 0 && (e.emit(
"newListener",
r,
n.listener ? n.listener : n
), p = e._events), g = p[r]), g === void 0)
g = p[r] = n, ++e._eventsCount;
else if (typeof g == "function" ? g = p[r] = o ? [n, g] : [g, n] : o ? g.unshift(n) : g.push(n), s = uh(e), s > 0 && g.length > s && !g.warned) {
g.warned = !0;
var C = new Error("Possible EventEmitter memory leak detected. " + g.length + " " + String(r) + " listeners added. Use emitter.setMaxListeners() to increase limit");
C.name = "MaxListenersExceededWarning", C.emitter = e, C.type = r, C.count = g.length, Iv(C);
}
return e;
}
Jt.prototype.addListener = function(e, r) {
return hh(this, e, r, !1);
};
Jt.prototype.on = Jt.prototype.addListener;
Jt.prototype.prependListener = function(e, r) {
return hh(this, e, r, !0);
};
function Rv() {
if (!this.fired)
return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
}
function dh(e, r, n) {
var o = { fired: !1, wrapFn: void 0, target: e, type: r, listener: n }, s = Rv.bind(o);
return s.listener = n, o.wrapFn = s, s;
}
Jt.prototype.once = function(e, r) {
return xs(r), this.on(e, dh(this, e, r)), this;
};
Jt.prototype.prependOnceListener = function(e, r) {
return xs(r), this.prependListener(e, dh(this, e, r)), this;
};
Jt.prototype.removeListener = function(e, r) {
var n, o, s, p, g;
if (xs(r), o = this._events, o === void 0)
return this;
if (n = o[e], n === void 0)
return this;
if (n === r || n.listener === r)
--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete o[e], o.removeListener && this.emit("removeListener", e, n.listener || r));
else if (typeof n != "function") {
for (s = -1, p = n.length - 1; p >= 0; p--)
if (n[p] === r || n[p].listener === r) {
g = n[p].listener, s = p;
break;
}
if (s < 0)
return this;
s === 0 ? n.shift() : wv(n, s), n.length === 1 && (o[e] = n[0]), o.removeListener !== void 0 && this.emit("removeListener", e, g || r);
}
return this;
};
Jt.prototype.off = Jt.prototype.removeListener;
Jt.prototype.removeAllListeners = function(e) {
var r, n, o;
if (n = this._events, n === void 0)
return this;
if (n.removeListener === void 0)
return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : n[e] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete n[e]), this;
if (arguments.length === 0) {
var s = Object.keys(n), p;
for (o = 0; o < s.length; ++o)
p = s[o], p !== "removeListener" && this.removeAllListeners(p);
return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this;
}
if (r = n[e], typeof r == "function")
this.removeListener(e, r);
else if (r !== void 0)
for (o = r.length - 1; o >= 0; o--)
this.removeListener(e, r[o]);
return this;
};
function fh(e, r, n) {
var o = e._events;
if (o === void 0)
return [];
var s = o[r];
return s === void 0 ? [] : typeof s == "function" ? n ? [s.listener || s] : [s] : n ? Lv(s) : _h(s, s.length);
}
Jt.prototype.listeners = function(e) {
return fh(this, e, !0);
};
Jt.prototype.rawListeners = function(e) {
return fh(this, e, !1);
};
Jt.listenerCount = function(e, r) {
return typeof e.listenerCount == "function" ? e.listenerCount(r) : ph.call(e, r);
};
Jt.prototype.listenerCount = ph;
function ph(e) {
var r = this._events;
if (r !== void 0) {
var n = r[e];
if (typeof n == "function")
return 1;
if (n !== void 0)
return n.length;
}
return 0;
}
Jt.prototype.eventNames = function() {
return this._eventsCount > 0 ? ps(this._events) : [];
};
function _h(e, r) {
for (var n = new Array(r), o = 0; o < r; ++o)
n[o] = e[o];
return n;
}
function wv(e, r) {
for (; r + 1 < e.length; r++)
e[r] = e[r + 1];
e.pop();
}
function Lv(e) {
for (var r = new Array(e.length), n = 0; n < r.length; ++n)
r[n] = e[n].listener || e[n];
return r;
}
function Dv(e, r) {
return new Promise(function(n, o) {
function s(g) {
e.removeListener(r, p), o(g);
}
function p() {
typeof e.removeListener == "function" && e.removeListener("error", s), n([].slice.call(arguments));
}
Ah(e, r, p, { once: !0 }), r !== "error" && Sv(e, s, { once: !0 });
});
}
function Sv(e, r, n) {
typeof e.on == "function" && Ah(e, "error", r, n);
}
function Ah(e, r, n, o) {
if (typeof e.on == "function")
o.once ? e.once(r, n) : e.on(r, n);
else if (typeof e.addEventListener == "function")
e.addEventListener(r, function s(p) {
o.once && e.removeEventListener(r, s), n(p);
});
else
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof e);
}
var Ov = uc.exports, vh = function() {
if (typeof Map < "u")
return Map;
function e(r, n) {
var o = -1;
return r.some(function(s, p) {
return s[0] === n ? (o = p, !0) : !1;
}), o;
}
return (
/** @class */
function() {
function r() {
this.__entries__ = [];
}
return Object.defineProperty(r.prototype, "size", {
/**
* @returns {boolean}
*/
get: function() {
return this.__entries__.length;
},
enumerable: !0,
configurable: !0
}), r.prototype.get = function(n) {
var o = e(this.__entries__, n), s = this.__entries__[o];
return s && s[1];
}, r.prototype.set = function(n, o) {
var s = e(this.__entries__, n);
~s ? this.__entries__[s][1] = o : this.__entries__.push([n, o]);
}, r.prototype.delete = function(n) {
var o = this.__entries__, s = e(o, n);
~s && o.splice(s, 1);
}, r.prototype.has = function(n) {
return !!~e(this.__entries__, n);
}, r.prototype.clear = function() {
this.__entries__.splice(0);
}, r.prototype.forEach = function(n, o) {
o === void 0 && (o = null);
for (var s = 0, p = this.__entries__; s < p.length; s++) {
var g = p[s];
n.call(o, g[1], g[0]);
}
}, r;
}()
);
}(), Fo = typeof window < "u" && typeof document < "u" && window.document === document, Cs = function() {
return typeof global < "u" && global.Math === Math ? global : typeof self < "u" && self.Math === Math ? self : typeof window < "u" && window.Math === Math ? window : Function("return this")();
}(), Nv = function() {
return typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(Cs) : function(e) {
return setTimeout(function() {
return e(Date.now());
}, 1e3 / 60);
};
}(), kv = 2;
function xv(e, r) {
var n = !1, o = !1, s = 0;
function p() {
n && (n = !1, e()), o && C();
}
function g() {
Nv(p);
}
function C() {
var y = Date.now();
if (n) {
if (y - s < kv)
return;
o = !0;
} else
n = !0, o = !1, setTimeout(g, r);
s = y;
}
return C;
}
var Mv = 20, Pv = ["top", "right", "bottom", "left", "width", "height", "size", "weight"], Uv = typeof MutationObserver < "u", Bv = (
/** @class */
function() {
function e() {
this.connected_ = !1, this.mutationEventsAdded_ = !1, this.mutationsObserver_ = null, this.observers_ = [], this.onTransitionEnd_ = this.onTransitionEnd_.bind(this), this.refresh = xv(this.refresh.bind(this), Mv);
}
return e.prototype.addObserver = function(r) {
~this.observers_.indexOf(r) || this.observers_.push(r), this.connected_ || this.connect_();
}, e.prototype.removeObserver = function(r) {
var n = this.observers_, o = n.indexOf(r);
~o && n.splice(o, 1), !n.length && this.connected_ && this.disconnect_();
}, e.prototype.refresh = function() {
var r = this.updateObservers_();
r && this.refresh();
}, e.prototype.updateObservers_ = function() {
var r = this.observers_.filter(function(n) {
return n.gatherActive(), n.hasActive();
});
return r.forEach(function(n) {
return n.broadcastActive();
}), r.length > 0;
}, e.prototype.connect_ = function() {
!Fo || this.connected_ || (document.addEventListener("transitionend", this.onTransitionEnd_), window.addEventListener("resize", this.refresh), Uv ? (this.mutationsObserver_ = new MutationObserver(this.refresh), this.mutationsObserver_.observe(document, {
attributes: !0,
childList: !0,
characterData: !0,
subtree: !0
})) : (document.addEventListener("DOMSubtreeModified", this.refresh), this.mutationEventsAdded_ = !0), this.connected_ = !0);
}, e.prototype.disconnect_ = function() {
!Fo || !this.connected_ || (document.removeEventListener("transitionend", this.onTransitionEnd_), window.removeEventListener("resize", this.refresh), this.mutationsObserver_ && this.mutationsObserver_.disconnect(), this.mutationEventsAdded_ && document.removeEventListener("DOMSubtreeModified", this.refresh), this.mutationsObserver_ = null, this.mutationEventsAdded_ = !1, this.connected_ = !1);
}, e.prototype.onTransitionEnd_ = function(r) {
var n = r.propertyName, o = n === void 0 ? "" : n, s = Pv.some(function(p) {
return !!~o.indexOf(p);
});
s && this.refresh();
}, e.getInstance = function() {
return this.instance_ || (this.instance_ = new e()), this.instance_;
}, e.instance_ = null, e;
}()
), gh = function(e, r) {
for (var n = 0, o = Object.keys(r); n < o.length; n++) {
var s = o[n];
Object.defineProperty(e, s, {
value: r[s],
enumerable: !1,
writable: !1,
configurable: !0
});
}
return e;
}, fa = function(e) {
var r = e && e.ownerDocument && e.ownerDocument.defaultView;
return r || Cs;
}, mh = Ms(0, 0, 0, 0);
function Ts(e) {
return parseFloat(e) || 0;
}
function Dl(e) {
for (var r = [], n = 1; n < arguments.length; n++)
r[n - 1] = arguments[n];
return r.reduce(function(o, s) {
var p = e["border-" + s + "-width"];
return o + Ts(p);
}, 0);
}
function Vv(e) {
for (var r = ["top", "right", "bottom", "left"], n = {}, o = 0, s = r; o < s.length; o++) {
var p = s[o], g = e["padding-" + p];
n[p] = Ts(g);
}
return n;
}
function Fv(e) {
var r = e.getBBox();
return Ms(0, 0, r.width, r.height);
}
function jv(e) {
var r = e.clientWidth, n = e.clientHeight;
if (!r && !n)
return mh;
var o = fa(e).getComputedStyle(e), s = Vv(o), p = s.left + s.right, g = s.top + s.bottom, C = Ts(o.width), y = Ts(o.height);
if (o.boxSizing === "border-box" && (Math.round(C + p) !== r && (C -= Dl(o, "left", "right") + p), Math.round(y + g) !== n && (y -= Dl(o, "top", "bottom") + g)), !Gv(e)) {
var x = Math.round(C + p) - r, h = Math.round(y + g) - n;
Math.abs(x) !== 1 && (C -= x), Math.abs(h) !== 1 && (y -= h);
}
return Ms(s.left, s.top, C, y);
}
var Hv = function() {
return typeof SVGGraphicsElement < "u" ? function(e) {
return e instanceof fa(e).SVGGraphicsElement;
} : function(e) {
return e instanceof fa(e).SVGElement && typeof e.getBBox == "function";
};
}();
function Gv(e) {
return e === fa(e).document.documentElement;
}
function zv(e) {
return Fo ? Hv(e) ? Fv(e) : jv(e) : mh;
}
function Kv(e) {
var r = e.x, n = e.y, o = e.width, s = e.height, p = typeof DOMRectReadOnly < "u" ? DOMRectReadOnly : Object, g = Object.create(p.prototype);
return gh(g, {
x: r,
y: n,
width: o,
height: s,
top: n,
right: r + o,
bottom: s + n,
left: r
}), g;
}
function Ms(e, r, n, o) {
return { x: e, y: r, width: n, height: o };
}
var Wv = (
/** @class */
function() {
function e(r) {
this.broadcastWidth = 0, this.broadcastHeight = 0, this.contentRect_ = Ms(0, 0, 0, 0), this.target = r;
}
return e.prototype.isActive = function() {
var r = zv(this.target);
return this.contentRect_ = r, r.width !== this.broadcastWidth || r.height !== this.broadcastHeight;
}, e.prototype.broadcastRect = function() {
var r = this.contentRect_;
return this.broadcastWidth = r.width, this.broadcastHeight = r.height, r;
}, e;
}()
), Yv = (
/** @class */
function() {
function e(r, n) {
var o = Kv(n);
gh(this, { target: r, contentRect: o });
}
return e;
}()
), Qv = (
/** @class */
function() {
function e(r, n, o) {
if (this.activeObservations_ = [], this.observations_ = new vh(), typeof r != "function")
throw new TypeError("The callback provided as parameter 1 is not a function.");
this.callback_ = r, this.controller_ = n, this.callbackCtx_ = o;
}
return e.prototype.observe = function(r) {
if (!arguments.length)
throw new TypeError("1 argument required, but only 0 present.");
if (!(typeof Element > "u" || !(Element instanceof Object))) {
if (!(r instanceof fa(r).Element))
throw new TypeError('parameter 1 is not of type "Element".');
var n = this.observations_;
n.has(r) || (n.set(r, new Wv(r)), this.controller_.addObserver(this), this.controller_.refresh());
}
}, e.prototype.unobserve = function(r) {
if (!arguments.length)
throw new TypeError("1 argument required, but only 0 present.");
if (!(typeof Element > "u" || !(Element instanceof Object))) {
if (!(r instanceof fa(r).Element))
throw new TypeError('parameter 1 is not of type "Element".');
var n = this.observations_;
n.has(r) && (n.delete(r), n.size || this.controller_.removeObserver(this));
}
}, e.prototype.disconnect = function() {
this.clearActive(), this.observations_.clear(), this.controller_.removeObserver(this);
}, e.prototype.gatherActive = function() {
var r = this;
this.clearActive(), this.observations_.forEach(function(n) {
n.isActive() && r.activeObservations_.push(n);
});
}, e.prototype.broadcastActive = function() {
if (this.hasActive()) {
var r = this.callbackCtx_, n = this.activeObservations_.map(function(o) {
return new Yv(o.target, o.broadcastRect());
});
this.callback_.call(r, n, r), this.clearActive();
}
}, e.prototype.clearActive = function() {
this.activeObservations_.splice(0);
}, e.prototype.hasActive = function() {
return this.activeObservations_.length > 0;
}, e;
}()
), bh = typeof WeakMap < "u" ? /* @__PURE__ */ new WeakMap() : new vh(), Eh = (
/** @class */
function() {
function e(r) {
if (!(this instanceof e))
throw new TypeError("Cannot call a class as a function.");
if (!arguments.length)
throw new TypeError("1 argument required, but only 0 present.");
var n = Bv.getInstance(), o = new Qv(r, n, this);
bh.set(this, o);
}
return e;
}()
);
[
"observe",
"unobserve",
"disconnect"
].forEach(function(e) {
Eh.prototype[e] = function() {
var r;
return (r = bh.get(this))[e].apply(r, arguments);
};
});
var Ps = function() {
return typeof Cs.ResizeObserver < "u" ? Cs.ResizeObserver : Eh;
}(), Xv = function(e, r) {
if (r = r.split(":")[0], e = +e, !e)
return !1;
switch (r) {
case "http":
case "ws":
return e !== 80;
case "https":
case "wss":
return e !== 443;
case "ftp":
return e !== 21;
case "gopher":
return e !== 70;
case "file":
return !1;
}
return e !== 0;
}, hc = {}, $v = Object.prototype.hasOwnProperty, Zv;
function Sl(e) {
try {
return decodeURIComponent(e.replace(/\+/g, " "));
} catch (r) {
return null;
}
}
function Ol(e) {
try {
return encodeURIComponent(e);
} catch (r) {
return null;
}
}
function qv(e) {
for (var r = /([^=?#&]+)=?([^&]*)/g, n = {}, o; o = r.exec(e); ) {
var s = Sl(o[1]), p = Sl(o[2]);
s === null || p === null || s in n || (n[s] = p);
}
return n;
}
function Jv(e, r) {
r = r || "";
var n = [], o, s;
typeof r != "string" && (r = "?");
for (s in e)
if ($v.call(e, s)) {
if (o = e[s], !o && (o === null || o === Zv || isNaN(o)) && (o = ""), s = Ol(s), o = Ol(o), s === null || o === null)
continue;
n.push(s + "=" + o);
}
return n.length ? r + n.join("&") : "";
}
hc.stringify = Jv;
hc.parse = qv;
var yh = Xv, Us = hc, e0 = /^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/, Ch = /[\n\r\t]/g, t0 = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//, Th = /:\d+$/, i0 = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i, r0 = /^[a-zA-Z]:/;
function dc(e) {
return (e || "").toString().replace(e0, "");
}
var jo = [
["#", "hash"],
// Extract from the back.
["?", "query"],
// Extract from the back.
function(e, r) {
return bn(r.protocol) ? e.replace(/\\/g, "/") : e;
},
["/", "pathname"],
// Extract from the back.
["@", "auth", 1],
// Extract from the front.
[NaN, "host", void 0, 1, 1],
// Set left over value.
[/:(\d*)$/, "port", void 0, 1],
// RegExp the back.
[NaN, "hostname", void 0, 1, 1]
// Set left over.
], Nl = { hash: 1, query: 1 };
function Ih(e) {
var r;
typeof window < "u" ? r = window : typeof Vo < "u" ? r = Vo : typeof self < "u" ? r = self : r = {};
var n = r.location || {};
e = e || n;
var o = {}, s = typeof e, p;
if (e.protocol === "blob:")
o = new En(unescape(e.pathname), {});
else if (s === "string") {
o = new En(e, {});
for (p in Nl)
delete o[p];
} else if (s === "object") {
for (p in e)
p in Nl || (o[p] = e[p]);
o.slashes === void 0 && (o.slashes = t0.test(e.href));
}
return o;
}
function bn(e) {
return e === "file:" || e === "ftp:" || e === "http:" || e === "https:" || e === "ws:" || e === "wss:";
}
function Rh(e, r) {
e = dc(e), e = e.replace(Ch, ""), r = r || {};
var n = i0.exec(e), o = n[1] ? n[1].toLowerCase() : "", s = !!n[2], p = !!n[3], g = 0, C;
return s ? p ? (C = n[2] + n[3] + n[4], g = n[2].length + n[3].length) : (C = n[2] + n[4], g = n[2].length) : p ? (C = n[3] + n[4], g = n[3].length) : C = n[4], o === "file:" ? g >= 2 && (C = C.slice(2)) : bn(o) ? C = n[4] : o ? s && (C = C.slice(2)) : g >= 2 && bn(r.protocol) && (C = n[4]), {
protocol: o,
slashes: s || bn(o),
slashesCount: g,
rest: C
};
}
function n0(e, r) {
if (e === "")
return r;
for (var n = (r || "/").split("/").slice(0, -1).concat(e.split("/")), o = n.length, s = n[o - 1], p = !1, g = 0; o--; )
n[o] === "." ? n.splice(o, 1) : n[o] === ".." ? (n.splice(o, 1), g++) : g && (o === 0 && (p = !0), n.splice(o, 1), g--);
return p && n.unshift(""), (s === "." || s === "..") && n.push(""), n.join("/");
}
function En(e, r, n) {
if (e = dc(e), e = e.replace(Ch, ""), !(this instanceof En))
return new En(e, r, n);
var o, s, p, g, C, y, x = jo.slice(), h = typeof r, F = this, I = 0;
for (h !== "object" && h !== "string" && (n = r, r = null), n && typeof n != "function" && (n = Us.parse), r = Ih(r), s = Rh(e || "", r), o = !s.protocol && !s.slashes, F.slashes = s.slashes || o && r.slashes, F.protocol = s.protocol || r.protocol || "", e = s.rest, (s.protocol === "file:" && (s.slashesCount !== 2 || r0.test(e)) || !s.slashes && (s.protocol || s.slashesCount < 2 || !bn(F.protocol))) && (x[3] = [/(.*)/, "pathname"]); I < x.length; I++) {
if (g = x[I], typeof g == "function") {
e = g(e, F);
continue;
}
p = g[0], y = g[1], p !== p ? F[y] = e : typeof p == "string" ? (C = p === "@" ? e.lastIndexOf(p) : e.indexOf(p), ~C && (typeof g[2] == "number" ? (F[y] = e.slice(0, C), e = e.slice(C + g[2])) : (F[y] = e.slice(C), e = e.slice(0, C)))) : (C = p.exec(e)) && (F[y] = C[1], e = e.slice(0, C.index)), F[y] = F[y] || o && g[3] && r[y] || "", g[4] && (F[y] = F[y].toLowerCase());
}
n && (F.query = n(F.query)), o && r.slashes && F.pathname.charAt(0) !== "/" && (F.pathname !== "" || r.pathname !== "") && (F.pathname = n0(F.pathname, r.pathname)), F.pathname.charAt(0) !== "/" && bn(F.protocol) && (F.pathname = "/" + F.pathname), yh(F.port, F.protocol) || (F.host = F.hostname, F.port = ""), F.username = F.password = "", F.auth && (C = F.auth.indexOf(":"), ~C ? (F.username = F.auth.slice(0, C), F.username = encodeURIComponent(decodeURIComponent(F.username)), F.password = F.auth.slice(C + 1), F.password = encodeURIComponent(decodeURIComponent(F.password))) : F.username = encodeURIComponent(decodeURIComponent(F.auth)), F.auth = F.password ? F.username + ":" + F.password : F.username), F.origin = F.protocol !== "file:" && bn(F.protocol) && F.host ? F.protocol + "//" + F.host : "null", F.href = F.toString();
}
function a0(e, r, n) {
var o = this;
switch (e) {
case "query":
typeof r == "string" && r.length && (r = (n || Us.parse)(r)), o[e] = r;
break;
case "port":
o[e] = r, yh(r, o.protocol) ? r && (o.host = o.hostname + ":" + r) : (o.host = o.hostname, o[e] = "");
break;
case "hostname":
o[e] = r, o.port && (r += ":" + o.port), o.host = r;
break;
case "host":
o[e] = r, Th.test(r) ? (r = r.split(":"), o.port = r.pop(), o.hostname = r.join(":")) : (o.hostname = r, o.port = "");
break;
case "protocol":
o.protocol = r.toLowerCase(), o.slashes = !n;
break;
case "pathname":
case "hash":
if (r) {
var s = e === "pathname" ? "/" : "#";
o[e] = r.charAt(0) !== s ? s + r : r;
} else
o[e] = r;
break;
case "username":
case "password":
o[e] = encodeURIComponent(r);
break;
case "auth":
var p = r.indexOf(":");
~p ? (o.username = r.slice(0, p), o.username = encodeURIComponent(decodeURIComponent(o.username)), o.password = r.slice(p + 1), o.password = encodeURIComponent(decodeURIComponent(o.password))) : o.username = encodeURIComponent(decodeURIComponent(r));
}
for (var g = 0; g < jo.length; g++) {
var C = jo[g];
C[4] && (o[C[1]] = o[C[1]].toLowerCase());
}
return o.auth = o.password ? o.username + ":" + o.password : o.username, o.origin = o.protocol !== "file:" && bn(o.protocol) && o.host ? o.protocol + "//" + o.host : "null", o.href = o.toString(), o;
}
function s0(e) {
(!e || typeof e != "function") && (e = Us.stringify);
var r, n = this, o = n.host, s = n.protocol;
s && s.charAt(s.length - 1) !== ":" && (s += ":");
var p = s + (n.protocol && n.slashes || bn(n.protocol) ? "//" : "");
return n.username ? (p += n.username, n.password && (p += ":" + n.password), p += "@") : n.password ? (p += ":" + n.password, p += "@") : n.protocol !== "file:" && bn(n.protocol) && !o && n.pathname !== "/" && (p += "@"), (o[o.length - 1] === ":" || Th.test(n.hostname) && !n.port) && (o += ":"), p += o + n.pathname, r = typeof n.query == "object" ? e(n.query) : n.query, r && (p += r.charAt(0) !== "?" ? "?" + r : r), n.hash && (p += n.hash), p;
}
En.prototype = { set: a0, toString: s0 };
En.extractProtocol = Rh;
En.location = Ih;
En.trimLeft = dc;
En.qs = Us;
var o0 = En;
const kl = /* @__PURE__ */ ch(o0), c0 = {
/**
* Searches for an item in an array which matches a certain condition.
* This requires the condition to only match one item in the array,
* and for the array to be ordered.
*
* @param {Array<T>} list The array to search.
* @param {BinarySearchComparison<T>} comparisonFn
* Called and provided a candidate item as the first argument.
* Should return:
* > -1 if the item should be located at a lower index than the provided item.
* > 1 if the item should be located at a higher index than the provided item.
* > 0 if the item is the item you're looking for.
*
* @return {T | null} The object if it is found or null otherwise.
*/
search: function(e, r) {
let n = 0, o = e.length - 1, s = null, p = null;
for (; n <= o; ) {
s = (n + o) / 2 | 0, p = e[s];
const g = r(p);
if (g > 0)
n = s + 1;
else if (g < 0)
o = s - 1;
else
return p;
}
},
searchIndex: function(e, r) {
let n = 0, o = e.length - 1, s = null, p = null;
for (; n <= o; ) {
s = (n + o) / 2 | 0, p = e[s];
const g = r(p);
if (g > 0)
n = s + 1;
else if (g < 0)
o = s - 1;
else
return s;
}
return -1;
}
};
var _a = function(e) {
var r = {};
function n(o) {
if (r[o])
return r[o].exports;
var s = r[o] = { i: o, l: !1, exports: {} };
return e[o].call(s.exports, s, s.exports, n), s.l = !0, s.exports;
}
return n.m = e, n.c = r, n.d = function(o, s, p) {
n.o(o, s) || Object.defineProperty(o, s, { enumerable: !0, get: p });
}, n.r = function(o) {
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(o, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(o, "__esModule", { value: !0 });
}, n.t = function(o, s) {
if (1 & s && (o = n(o)), 8 & s || 4 & s && typeof o == "object" && o && o.__esModule)
return o;
var p = /* @__PURE__ */ Object.create(null);
if (n.r(p), Object.defineProperty(p, "default", { enumerable: !0, value: o }), 2 & s && typeof o != "string")
for (var g in o)
n.d(p, g, function(C) {
return o[C];
}.bind(null, g));
return p;
}, n.n = function(o) {
var s = o && o.__esModule ? function() {
return o.default;
} : function() {
return o;
};
return n.d(s, "a", s), s;
}, n.o = function(o, s) {
return Object.prototype.hasOwnProperty.call(o, s);
}, n.p = "", n(n.s = 4);
}([function(e, r) {
function n(o) {
return e.exports = n = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(s) {
return typeof s;
} : function(s) {
return s && typeof Symbol == "function" && s.constructor === Symbol && s !== Symbol.prototype ? "symbol" : typeof s;
}, e.exports.__esModule = !0, e.exports.default = e.exports, n(o);
}
e.exports = n, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r, n) {
var o = n(2);
function s(p, g) {
for (var C = 0; C < g.length; C++) {
var y = g[C];
y.enumerable = y.enumerable || !1, y.configurable = !0, "value" in y && (y.writable = !0), Object.defineProperty(p, o(y.key), y);
}
}
e.exports = function(p, g, C) {
return g && s(p.prototype, g), C && s(p, C), Object.defineProperty(p, "prototype", { writable: !1 }), p;
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r, n) {
var o = n(0).default, s = n(3);
e.exports = function(p) {
var g = s(p, "string");
return o(g) == "symbol" ? g : g + "";
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r, n) {
var o = n(0).default;
e.exports = function(s, p) {
if (o(s) != "object" || !s)
return s;
var g = s[Symbol.toPrimitive];
if (g !== void 0) {
var C = g.call(s, p || "default");
if (o(C) != "object")
return C;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (p === "string" ? String : Number)(s);
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, r, n) {
function o(D, W) {
console.log("%c " + D + " %c " + W + " %c", "background:#35495e ; padding: 1px; border-radius: 4px 0 0 4px; color: #fff", "background:#ffa483 ; padding: 1px; border-radius: 0 4px 4px 0; color: #fff", "background:transparent");
}
n.r(r), n.d(r, "LogLevel", function() {
return x;
}), n.d(r, "DefaultLogger", function() {
return T;
}), n.d(r, "Logger", function() {
return I;
}), n.d(r, "printVersion", function() {
return o;
}), n.d(r, "DEFAULT_LOG_LEVEL", function() {
return h;
});
var s = n(1), p = n.n(s), g = function() {
function D() {
this.timeout = 6048e5;
}
var W = D.prototype;
return W.write = function(j, O) {
if (D.available)
try {
localStorage.setItem(j, JSON.stringify({ value: O, time: Date.now() }));
} catch (K) {
}
}, W.read = function(j, O) {
if (O === void 0 && (O = !0), D.available)
try {
var K = localStorage.getItem(j);
if (K) {
var z = JSON.parse(K), B = z.value, J = z.time, be = J === void 0 ? 0 : J;
if (!O || Date.now() - be < (typeof O == "number" ? O : this.timeout))
return B;
}
} catch ($) {
}
}, p()(D, null, [{ key: "available", get: function() {
if (D._available === void 0)
try {
localStorage.setItem("alg", "test"), D._available = !0;
} catch (j) {
D._available = !1;
}
return D._available;
} }]);
}();
g._available = void 0;
var C, y = g, x = function(D) {
return D.NONE = "none", D.ERROR = "e", D.WARN = "w", D.INFO = "i", D.DEBUG = "d", D.VERBOSE = "v", D;
}({}), h = x.ERROR, F = ((C = {})[x.NONE] = { value: 1, str: "N" }, C[x.ERROR] = { value: 100, str: "E" }, C[x.WARN] = { value: 200, str: "W" }, C[x.INFO] = { value: 300, str: "I" }, C[x.DEBUG] = { value: 400, str: "D" }, C[x.VERBOSE] = { value: 500, str: "V" }, C), I = function() {
function D(j) {
if (this._name = "kwai-v", this._level = h, this._id = -1, this._output = void 0, this._workerTag = "main", typeof location < "u" && location.protocol === "blob:") {
var O, K = location.href.split("/"), z = (O = K[K.length - 1]) == null ? void 0 : O.match(/(\w+)-/);
z && (this._workerTag = j ? j + "-" + z[1] : z[1]);
} else
j && (this._workerTag = j);
}
D.loadLogLevel = function(j, O) {
if (O === void 0 && (O = !0), location.href) {
var K = new RegExp(j + "=([a-z]{1})"), z = location.href.match(K);
if (z && z.length > 1) {
var B = z[1];
if (this._isValueInLevel(B))
return B;
}
}
var J = new y().read(j, O);
if (this._isValueInLevel(J))
return J;
}, D.saveLogLevel = function(j, O) {
this._isValueInLevel(O) && new y().write(j, O);
}, D._isValueInLevel = function(j) {
return Object.values(x).indexOf(j) !== -1;
};
var W = D.prototype;
return W.setOutput = function(j) {
return this._output = j, this;
}, W.setLevel = function(j) {
return this._level = j, this;
}, W.setId = function(j) {
return this._id = j, this;
}, W.setName = function(j) {
return this._name = j, this;
}, W.getLevel = function() {
return this._level;
}, W.getOutput = function() {
return this._output;
}, W.hasOutput = function() {
return !!this._output;
}, W.e = function(j) {
if (this._isLevelEnabled(this._level, x.ERROR)) {
for (var O = arguments.length, K = new Array(O > 1 ? O - 1 : 0), z = 1; z < O; z++)
K[z - 1] = arguments[z];
var B = this._printLog(x.ERROR, j, K);
try {
var J;
(J = this._output) == null || J.e.apply(J, [B].concat(K));
} catch (be) {
}
}
}, W.w = function(j) {
if (this._isLevelEnabled(this._level, x.WARN)) {
for (var O = arguments.length, K = new Array(O > 1 ? O - 1 : 0), z = 1; z < O; z++)
K[z - 1] = arguments[z];
var B = this._printLog(x.WARN, j, K);
try {
var J;
(J = this._output) == null || J.w.apply(J, [B].concat(K));
} catch (be) {
}
}
}, W.i = function(j) {
if (this._isLevelEnabled(this._level, x.INFO)) {
for (var O = arguments.length, K = new Array(O > 1 ? O - 1 : 0), z = 1; z < O; z++)
K[z - 1] = arguments[z];
var B = this._printLog(x.INFO, j, K);
try {
var J;
(J = this._output) == null || J.i.apply(J, [B].concat(K));
} catch (be) {
}
}
}, W.d = function(j) {
if (this._isLevelEnabled(this._level, x.DEBUG)) {
for (var O = arguments.length, K = new Array(O > 1 ? O - 1 : 0), z = 1; z < O; z++)
K[z - 1] = arguments[z];
var B = this._printLog(x.DEBUG, j, K);
try {
var J;
(J = this._output) == null || J.d.apply(J, [B].concat(K));
} catch (be) {
}
}
}, W.v = function(j) {
if (this._isLevelEnabled(this._level, x.VERBOSE)) {
for (var O = arguments.length, K = new Array(O > 1 ? O - 1 : 0), z = 1; z < O; z++)
K[z - 1] = arguments[z];
var B = this._printLog(x.VERBOSE, j, K);
try {
var J;
(J = this._output) == null || J.v.apply(J, [B].concat(K));
} catch (be) {
}
}
}, W._isLevelEnabled = function(j, O) {
return F[j].value >= F[O].value;
}, W._printLog = function(j, O, K) {
var z, B, J = typeof O;
if (J === "object")
O = ((B = O) == null ? void 0 : B.constructor.name) || "unknown";
else if (J === "function") {
var be;
O = ((be = Object.getOwnPropertyDescriptor(O, "name")) == null ? void 0 : be.value) || "unknown";
}
var $, ye, Be = (((z = F[j]) == null ? void 0 : z.str) || "") + "|" + this._name + "[" + (typeof this._id == "function" ? this._id() : this._id) + "][" + this._workerTag + "]::" + O;
return j === x.ERROR ? ($ = console).error.apply($, [Be].concat(K.slice(0))) : (ye = console).log.apply(ye, [Be].concat(K.slice(0))), Be;
}, D;
}(), T = new I();
}]);
_a === void 0 && console.error("esm-webpack-plugin: nothing exported!");
_a.LogLevel;
const ka = _a.DefaultLogger;
_a.Logger;
_a.printVersion;
_a.DEFAULT_LOG_LEVEL;
/*! js-cookie v3.0.5 | MIT */
function os(e) {
for (var r = 1; r < arguments.length; r++) {
var n = arguments[r];
for (var o in n)
e[o] = n[o];
}
return e;
}
var l0 = {
read: function(e) {
return e[0] === '"' && (e = e.slice(1, -1)), e.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
},
write: function(e) {
return encodeURIComponent(e).replace(
/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
decodeURIComponent
);
}
};
function Ho(e, r) {
function n(s, p, g) {
if (!(typeof document > "u")) {
g = os({}, r, g), typeof g.expires == "number" && (g.expires = new Date(Date.now() + g.expires * 864e5)), g.expires && (g.expires = g.expires.toUTCString()), s = encodeURIComponent(s).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
var C = "";
for (var y in g)
g[y] && (C += "; " + y, g[y] !== !0 && (C += "=" + g[y].split(";")[0]));
return document.cookie = s + "=" + e.write(p, s) + C;
}
}
function o(s) {
if (!(typeof document > "u" || arguments.length && !s)) {
for (var p = document.cookie ? document.cookie.split("; ") : [], g = {}, C = 0; C < p.length; C++) {
var y = p[C].split("="), x = y.slice(1).join("=");
try {
var h = decodeURIComponent(y[0]);
if (g[h] = e.read(x, h), s === h)
break;
} catch (F) {
}
}
return s ? g[s] : g;
}
}
return Object.create(
{
set: n,
get: o,
remove: function(s, p) {
n(
s,
"",
os({}, p, {
expires: -1
})
);
},
withAttributes: function(s) {
return Ho(this.converter, os({}, this.attributes, s));
},
withConverter: function(s) {
return Ho(os({}, this.converter, s), this.attributes);
}
},
{
attributes: { value: Object.freeze(r) },
converter: { value: Object.freeze(e) }
}
);
}
var go = Ho(l0, { path: "/" });
const xa = "did", mo = "kwai_player_device_id";
function xl() {
try {
const e = Math.random() * 1e9 >>> 0, r = [], n = "0123456789ABCDEF";
for (let s = 0; s < 7; s++)
r.push(n.charAt(Math.random() * 16));
const o = `web_${e}${r.join("")}`;
return ka.i(xa, "generate nanoId", o), o;
} catch (e) {
}
return "web_did_generation_failed";
}
function u0() {
let e = "";
try {
e = (go.get("did") || go.get("_did") || go.get("weblogger_did") || "").trim(), ka.i(xa, "generate deviceId from cookie", e);
} catch (r) {
ka.i(xa, "generate deviceId from cookie err", r);
}
try {
e ? localStorage == null || localStorage.setItem(mo, e) : (e = ((localStorage == null ? void 0 : localStorage.getItem(mo)) || "").trim(), ka.i(xa, "generate deviceId from ls", e)), e || (e = xl(), localStorage == null || localStorage.setItem(mo, e));
} catch (r) {
ka.i(xa, "generate deviceId from ls err", r);
}
return e || xl();
}
function h0(e) {
Is = e;
}
let Is = u0();
const wh = class Qn {
constructor() {
sh(this, "timeout", 7 * 24 * 3600 * 1e3);
}
write(r, n) {
if (Qn.available)
try {
localStorage.setItem(
r,
JSON.stringify({ value: n, time: Date.now() })
);
} catch (o) {
}
}
read(r, n = !0) {
if (Qn.available)
try {
const o = localStorage.getItem(r);
if (o) {
const { value: s, time: p = 0 } = JSON.parse(o);
if (!n || Date.now() - p < (typeof n == "number" ? n : this.timeout))
return s;
}
} catch (o) {
}
}
static get available() {
if (typeof Qn._available > "u")
try {
localStorage.setItem("alg", "test"), Qn._available = !0;
} catch (r) {
Qn._available = !1;
}
return Qn._available;
}
};
sh(wh, "_available");
let Lh = wh;
var Go = { exports: {} };
(function(e, r) {
(function(n, o) {
var s = "1.0.2", p = "", g = "?", C = "function", y = "undefined", x = "object", h = "string", F = "major", I = "model", T = "name", D = "type", W = "vendor", j = "version", O = "architecture", K = "console", z = "mobile", B = "tablet", J = "smarttv", be = "wearable", $ = "embedded", ye = 255, Be = "Amazon", Ve = "Apple", je = "ASUS", we = "BlackBerry", ue = "Browser", L = "Chrome", w = "Edge", le = "Firefox", oe = "Google", Re = "Huawei", Oe = "LG", de = "Microsoft", X = "Motorola", ge = "Opera", Pe = "Samsung", ae = "Sony", q = "Xiaomi", m = "Zebra", ve = "Facebook", U = function(te, ie) {
var ee = {};
for (var Te in te)
ie[Te] && ie[Te].length % 2 === 0 ? ee[Te] = ie[Te].concat(te[Te]) : ee[Te] = te[Te];
return ee;
}, M = function(te) {
for (var ie = {}, ee = 0; ee < te.length; ee++)
ie[te[ee].toUpperCase()] = te[ee];
return ie;
}, ne = function(te, ie) {
return typeof te === h ? Le(ie).indexOf(Le(te)) !== -1 : !1;
}, Le = function(te) {
return te.toLowerCase();
}, Ue = function(te) {
return typeof te === h ? te.replace(/[^\d\.]/g, p).split(".")[0] : o;
}, re = function(te, ie) {
if (typeof te === h)
return te = te.replace(/^\s\s*/, p).replace(/\s\s*$/, p), typeof ie === y ? te : te.substring(0, ye);
}, k = function(te, ie) {
for (var ee = 0, Te, Se, Ye, ze, it, ct; ee < ie.length && !it; ) {
var nt = ie[ee], zt = ie[ee + 1];
for (Te = Se = 0; Te < nt.length && !it; )
if (it = nt[Te++].exec(te), it)
for (Ye = 0; Ye < zt.length; Ye++)
ct = it[++Se], ze = zt[Ye], typeof ze === x && ze.length > 0 ? ze.length === 2 ? typeof ze[1] == C ? this[ze[0]] = ze[1].call(this, ct) : this[ze[0]] = ze[1] : ze.length === 3 ? typeof ze[1] === C && !(ze[1].exec && ze[1].test) ? this[ze[0]] = ct ? ze[1].call(this, ct, ze[2]) : o : this[ze[0]] = ct ? ct.replace(ze[1], ze[2]) : o : ze.length === 4 && (this[ze[0]] = ct ? ze[3].call(this, ct.replace(ze[1], ze[2])) : o) : this[ze] = ct || o;
ee += 2;
}
}, P = function(te, ie) {
for (var ee in ie)
if (typeof ie[ee] === x && ie[ee].length > 0) {
for (var Te = 0; Te < ie[ee].length; Te++)
if (ne(ie[ee][Te], te))
return ee === g ? o : ee;
} else if (ne(ie[ee], te))
return ee === g ? o : ee;
return te;
}, Z = {
"1.0": "/8",
"1.2": "/1",
"1.3": "/3",
"2.0": "/412",
"2.0.2": "/416",
"2.0.3": "/417",
"2.0.4": "/419",
"?": "/"
}, he = {
ME: "4.90",
"NT 3.11": "NT3.51",
"NT 4.0": "NT4.0",
2e3: "NT 5.0",
XP: ["NT 5.1", "NT 5.2"],
Vista: "NT 6.0",
7: "NT 6.1",
8: "NT 6.2",
"8.1": "NT 6.3",
10: ["NT 6.4", "NT 10.0"],
RT: "ARM"
}, Ie = {
browser: [
[
/\b(?:crmo|crios)\/([\w\.]+)/i
// Chrome for Android/iOS
],
[j, [T, "Chrome"]],
[
/edg(?:e|ios|a)?\/([\w\.]+)/i
// Microsoft Edge
],
[j, [T, "Edge"]],
[
// Presto based
/(opera mini)\/([-\w\.]+)/i,
// Opera Mini
/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,
// Opera Mobi/Tablet
/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i
// Opera
],
[T, j],
[
/opios[\/ ]+([\w\.]+)/i
// Opera mini on iphone >= 8.0
],
[j, [T, ge + " Mini"]],
[
/\bopr\/([\w\.]+)/i
// Opera Webkit
],
[j, [T, ge]],
[
// Mixed
/(kindle)\/([\w\.]+)/i,
// Kindle
/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,
// Lunascape/Maxthon/Netfront/Jasmine/Blazer
// Trident based
/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,
// Avant/IEMobile/SlimBrowser
/(ba?idubrowser)[\/ ]?([\w\.]+)/i,
// Baidu Browser
/(?:ms|\()(ie) ([\w\.]+)/i,
// Internet Explorer
// Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon
/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq)\/([-\w\.]+)/i,
// Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ, aka ShouQ
/(weibo)__([\d\.]+)/i
// Weibo
],
[T, j],
[
/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i
// UCBrowser
],
[j, [T, "UC" + ue]],
[
/\bqbcore\/([\w\.]+)/i
// WeChat Desktop for Windows Built-in Browser
],
[j, [T, "WeChat(Win) Desktop"]],
[
/micromessenger\/([\w\.]+)/i
// WeChat
],
[j, [T, "WeChat"]],
[
/konqueror\/([\w\.]+)/i
// Konqueror
],
[j, [T, "Konqueror"]],
[
/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i
// IE11
],
[j, [T, "IE"]],
[
/yabrowser\/([\w\.]+)/i
// Yandex
],
[j, [T, "Yandex"]],
[
/(avast|avg)\/([\w\.]+)/i
// Avast/AVG Secure Browser
],
[[T, /(.+)/, "$1 Secure " + ue], j],
[
/\bfocus\/([\w\.]+)/i
// Firefox Focus
],
[j, [T, le + " Focus"]],
[
/\bopt\/([\w\.]+)/i
// Opera Touch
],
[j, [T, ge + " Touch"]],
[
/coc_coc\w+\/([\w\.]+)/i
// Coc Coc Browser
],
[j, [T, "Coc Coc"]],
[
/dolfin\/([\w\.]+)/i
// Dolphin
],
[j, [T, "Dolphin"]],
[
/coast\/([\w\.]+)/i
// Opera Coast
],
[j, [T, ge + " Coast"]],
[
/miuibrowser\/([\w\.]+)/i
// MIUI Browser
],
[j, [T, "MIUI " + ue]],
[
/fxios\/([-\w\.]+)/i
// Firefox for iOS
],
[j, [T, le]],
[
/\bqihu|(qi?ho?o?|360)browser/i
// 360
],
[[T, "360 " + ue]],
[
/(oculus|samsung|sailfish)browser\/([\w\.]+)/i
],
[[T, /(.+)/, "$1 " + ue], j],
[
// Oculus/Samsung/Sailfish Browser
/(comodo_dragon)\/([\w\.]+)/i
// Comodo Dragon
],
[[T, /_/g, " "], j],
[
/(electron)\/([\w\.]+) safari/i,
// Electron-based App
/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,
// Tesla
/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i
// QQBrowser/Baidu App/2345 Browser
],
[T, j],
[
/(metasr)[\/ ]?([\w\.]+)/i,
// SouGouBrowser
/(lbbrowser)/i
// LieBao Browser
],
[T],
[
// WebView
/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i
// Facebook App for iOS & Android
],
[[T, ve], j],
[
/safari (line)\/([\w\.]+)/i,
// Line App for iOS
/\b(line)\/([\w\.]+)\/iab/i,
// Line App for Android
/(chromium|instagram)[\/ ]([-\w\.]+)/i
// Chromium/Instagram
],
[T, j],
[
/\bgsa\/([\w\.]+) .*safari\//i
// Google Search Appliance on iOS
],
[j, [T, "GSA"]],
[
/headlesschrome(?:\/([\w\.]+)| )/i
// Chrome Headless
],
[j, [T, L + " Headless"]],
[
/ wv\).+(chrome)\/([\w\.]+)/i
// Chrome WebView
],
[[T, L + " WebView"], j],
[
/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i
// Android Browser
],
[j, [T, "Android " + ue]],
[
/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i
// Chrome/OmniWeb/Arora/Tizen/Nokia
],
[T, j],
[
/version\/([\w\.]+) .*mobile\/\w+ (safari)/i
// Mobile Safari
],
[j, [T, "Mobile Safari"]],
[
/version\/([\w\.]+) .*(mobile ?safari|safari)/i
// Safari & Safari Mobile
],
[j, T],
[
/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i
// Safari < 3.0
],
[T, [j, P, Z]],
[
/(webkit|khtml)\/([\w\.]+)/i
],
[T, j],
[
// Gecko based
/(navigator|netscape\d?)\/([-\w\.]+)/i
// Netscape
],
[[T, "Netscape"], j],
[
/mobile vr; rv:([\w\.]+)\).+firefox/i
// Firefox Reality
],
[j, [T, le + " Reality"]],
[
/ekiohf.+(flow)\/([\w\.]+)/i,
// Flow
/(swiftfox)/i,
// Swiftfox
/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,
// IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror/Klar
/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,
// Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix
/(firefox)\/([\w\.]+)/i,
// Other Firefox-based
/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,
// Mozilla
// Other
/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,
// Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir/Obigo/Mosaic/Go/ICE/UP.Browser
/(links) \(([\w\.]+)/i
// Links
],
[T, j]
],
cpu: [
[
/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i
// AMD64 (x64)
],
[[O, "amd64"]],
[
/(ia32(?=;))/i
// IA32 (quicktime)
],
[[O, Le]],
[
/((?:i[346]|x)86)[;\)]/i
// IA32 (x86)
],
[[O, "ia32"]],
[
/\b(aarch64|arm(v?8e?l?|_?64))\b/i
// ARM64
],
[[O, "arm64"]],
[
/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i
// ARMHF
],
[[O, "armhf"]],
[
// PocketPC mistakenly identified as PowerPC
/windows (ce|mobile); ppc;/i
],
[[O, "arm"]],
[
/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i
// PowerPC
],
[[O, /ower/, p, Le]],
[
/(sun4\w)[;\)]/i
// SPARC
],
[[O, "sparc"]],
[
/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i
// IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC
],
[[O, Le]]
],
device: [
[
//////////////////////////
// MOBILES & TABLETS
// Ordered by popularity
/////////////////////////
// Samsung
/\b(sch-i[89]0\d|shw-m380s|sm-[pt]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i
],
[I, [W, Pe], [D, B]],
[
/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,
/samsung[- ]([-\w]+)/i,
/sec-(sgh\w+)/i
],
[I, [W, Pe], [D, z]],
[
// Apple
/\((ip(?:hone|od)[\w ]*);/i
// iPod/iPhone
],
[I, [W, Ve], [D, z]],
[
/\((ipad);[-\w\),; ]+apple/i,
// iPad
/applecoremedia\/[\w\.]+ \((ipad)/i,
/\b(ipad)\d\d?,\d\d?[;\]].+ios/i
],
[I, [W, Ve], [D, B]],
[
// Huawei
/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i
],
[I, [W, Re], [D, B]],
[
/(?:huawei|honor)([-\w ]+)[;\)]/i,
/\b(nexus 6p|\w{2,4}-[atu]?[ln][01259x][012359][an]?)\b(?!.+d\/s)/i
],
[I, [W, Re], [D, z]],
[
// Xiaomi
/\b(poco[\w ]+)(?: bui|\))/i,
// Xiaomi POCO
/\b; (\w+) build\/hm\1/i,
// Xiaomi Hongmi 'numeric' models
/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,
// Xiaomi Hongmi
/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,
// Xiaomi Redmi
/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i
// Xiaomi Mi
],
[[I, /_/g, " "], [W, q], [D, z]],
[
/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i
// Mi Pad tablets
],
[[I, /_/g, " "], [W, q], [D, B]],
[
// OPPO
/; (\w+) bui.+ oppo/i,
/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i
],
[I, [W, "OPPO"], [D, z]],
[
// Vivo
/vivo (\w+)(?: bui|\))/i,
/\b(v[12]\d{3}\w?[at])(?: bui|;)/i
],
[I, [W, "Vivo"], [D, z]],
[
// Realme
/\b(rmx[12]\d{3})(?: bui|;|\))/i
],
[I, [W, "Realme"], [D, z]],
[
// Motorola
/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,
/\bmot(?:orola)?[- ](\w*)/i,
/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i
],
[I, [W, X], [D, z]],
[
/\b(mz60\d|xoom[2 ]{0,2}) build\//i
],
[I, [W, X], [D, B]],
[
// LG
/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i
],
[I, [W, Oe], [D, B]],
[
/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,
/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,
/\blg-?([\d\w]+) bui/i
],
[I, [W, Oe], [D, z]],
[
// Lenovo
/(ideatab[-\w ]+)/i,
/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i
],
[I, [W, "Lenovo"], [D, B]],
[
// Nokia
/(?:maemo|nokia).*(n900|lumia \d+)/i,
/nokia[-_ ]?([-\w\.]*)/i
],
[[I, /_/g, " "], [W, "Nokia"], [D, z]],
[
// Google
/(pixel c)\b/i
// Google Pixel C
],
[I, [W, oe], [D, B]],
[
/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i
// Google Pixel
],
[I, [W, oe], [D, z]],
[
// Sony
/droid.+ ([c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i
],
[I, [W, ae], [D, z]],
[
/sony tablet [ps]/i,
/\b(?:sony)?sgp\w+(?: bui|\))/i
],
[[I, "Xperia Tablet"], [W, ae], [D, B]],
[
// OnePlus
/ (kb2005|in20[12]5|be20[12][59])\b/i,
/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i
],
[I, [W, "OnePlus"], [D, z]],
[
// Amazon
/(alexa)webm/i,
/(kf[a-z]{2}wi)( bui|\))/i,
// Kindle Fire without Silk
/(kf[a-z]+)( bui|\)).+silk\//i
// Kindle Fire HD
],
[I, [W, Be], [D, B]],
[
/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i
// Fire Phone
],
[[I, /(.+)/g, "Fire Phone $1"], [W, Be], [D, z]],
[
// BlackBerry
/(playbook);[-\w\),; ]+(rim)/i
// BlackBerry PlayBook
],
[I, W, [D, B]],
[
/\b((?:bb[a-f]|st[hv])100-\d)/i,
/\(bb10; (\w+)/i
// BlackBerry 10
],
[I, [W, we], [D, z]],
[
// Asus
/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i
],
[I, [W, je], [D, B]],
[
/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i
],
[I, [W, je], [D, z]],
[
// HTC
/(nexus 9)/i
// HTC Nexus 9
],
[I, [W, "HTC"], [D, B]],
[
/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,
// HTC
// ZTE
/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,
/(alcatel|geeksphone|nexian|panasonic|sony)[-_ ]?([-\w]*)/i
// Alcatel/GeeksPhone/Nexian/Panasonic/Sony
],
[W, [I, /_/g, " "], [D, z]],
[
// Acer
/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i
],
[I, [W, "Acer"], [D, B]],
[
// Meizu
/droid.+; (m[1-5] note) bui/i,
/\bmz-([-\w]{2,})/i
],
[I, [W, "Meizu"], [D, z]],
[
// Sharp
/\b(sh-?[altvz]?\d\d[a-ekm]?)/i
],
[I, [W, "Sharp"], [D, z]],
[
// MIXED
/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,
// BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron
/(hp) ([\w ]+\w)/i,
// HP iPAQ
/(asus)-?(\w+)/i,
// Asus
/(microsoft); (lumia[\w ]+)/i,
// Microsoft Lumia
/(lenovo)[-_ ]?([-\w]+)/i,
// Lenovo
/(jolla)/i,
// Jolla
/(oppo) ?([\w ]+) bui/i
// OPPO
],
[W, I, [D, z]],
[
/(archos) (gamepad2?)/i,
// Archos
/(hp).+(touchpad(?!.+tablet)|tablet)/i,
// HP TouchPad
/(kindle)\/([\w\.]+)/i,
// Kindle
/(nook)[\w ]+build\/(\w+)/i,
// Nook
/(dell) (strea[kpr\d ]*[\dko])/i,
// Dell Streak
/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,
// Le Pan Tablets
/(trinity)[- ]*(t\d{3}) bui/i,
// Trinity Tablets
/(gigaset)[- ]+(q\w{1,9}) bui/i,
// Gigaset Tablets
/(vodafone) ([\w ]+)(?:\)| bui)/i
// Vodafone
],
[W, I, [D, B]],
[
/(surface duo)/i
// Surface Duo
],
[I, [W, de], [D, B]],
[
/droid [\d\.]+; (fp\du?)(?: b|\))/i
// Fairphone
],
[I, [W, "Fairphone"], [D, z]],
[
/(u304aa)/i
// AT&T
],
[I, [W, "AT&T"], [D, z]],
[
/\bsie-(\w*)/i
// Siemens
],
[I, [W, "Siemens"], [D, z]],
[
/\b(rct\w+) b/i
// RCA Tablets
],
[I, [W, "RCA"], [D, B]],
[
/\b(venue[\d ]{2,7}) b/i
// Dell Venue Tablets
],
[I, [W, "Dell"], [D, B]],
[
/\b(q(?:mv|ta)\w+) b/i
// Verizon Tablet
],
[I, [W, "Verizon"], [D, B]],
[
/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i
// Barnes & Noble Tablet
],
[I, [W, "Barnes & Noble"], [D, B]],
[
/\b(tm\d{3}\w+) b/i
],
[I, [W, "NuVision"], [D, B]],
[
/\b(k88) b/i
// ZTE K Series Tablet
],
[I, [W, "ZTE"], [D, B]],
[
/\b(nx\d{3}j) b/i
// ZTE Nubia
],
[I, [W, "ZTE"], [D, z]],
[
/\b(gen\d{3}) b.+49h/i
// Swiss GEN Mobile
],
[I, [W, "Swiss"], [D, z]],
[
/\b(zur\d{3}) b/i
// Swiss ZUR Tablet
],
[I, [W, "Swiss"], [D, B]],
[
/\b((zeki)?tb.*\b) b/i
// Zeki Tablets
],
[I, [W, "Zeki"], [D, B]],
[
/\b([yr]\d{2}) b/i,
/\b(dragon[- ]+touch |dt)(\w{5}) b/i
// Dragon Touch Tablet
],
[[W, "Dragon Touch"], I, [D, B]],
[
/\b(ns-?\w{0,9}) b/i
// Insignia Tablets
],
[I, [W, "Insignia"], [D, B]],
[
/\b((nxa|next)-?\w{0,9}) b/i
// NextBook Tablets
],
[I, [W, "NextBook"], [D, B]],
[
/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i
// Voice Xtreme Phones
],
[[W, "Voice"], I, [D, z]],
[
/\b(lvtel\-)?(v1[12]) b/i
// LvTel Phones
],
[[W, "LvTel"], I, [D, z]],
[
/\b(ph-1) /i
// Essential PH-1
],
[I, [W, "Essential"], [D, z]],
[
/\b(v(100md|700na|7011|917g).*\b) b/i
// Envizen Tablets
],
[I, [W, "Envizen"], [D, B]],
[
/\b(trio[-\w\. ]+) b/i
// MachSpeed Tablets
],
[I, [W, "MachSpeed"], [D, B]],
[
/\btu_(1491) b/i
// Rotor Tablets
],
[I, [W, "Rotor"], [D, B]],
[
/(shield[\w ]+) b/i
// Nvidia Shield Tablets
],
[I, [W, "Nvidia"], [D, B]],
[
/(sprint) (\w+)/i
// Sprint Phones
],
[W, I, [D, z]],
[
/(kin\.[onetw]{3})/i
// Microsoft Kin
],
[[I, /\./g, " "], [W, de], [D, z]],
[
/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i
// Zebra
],
[I, [W, m], [D, B]],
[
/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i
],
[I, [W, m], [D, z]],
[
///////////////////
// CONSOLES
///////////////////
/(ouya)/i,
// Ouya
/(nintendo) ([wids3utch]+)/i
// Nintendo
],
[W, I, [D, K]],
[
/droid.+; (shield) bui/i
// Nvidia
],
[I, [W, "Nvidia"], [D, K]],
[
/(playstation [345portablevi]+)/i
// Playstation
],
[I, [W, ae], [D, K]],
[
/\b(xbox(?: one)?(?!; xbox))[\); ]/i
// Microsoft Xbox
],
[I, [W, de], [D, K]],
[
///////////////////
// SMARTTVS
///////////////////
/smart-tv.+(samsung)/i
// Samsung
],
[W, [D, J]],
[
/hbbtv.+maple;(\d+)/i
],
[[I, /^/, "SmartTV"], [W, Pe], [D, J]],
[
/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i
// LG SmartTV
],
[[W, Oe], [D, J]],
[
/(apple) ?tv/i
// Apple TV
],
[W, [I, Ve + " TV"], [D, J]],
[
/crkey/i
// Google Chromecast
],
[[I, L + "cast"], [W, oe], [D, J]],
[
/droid.+aft(\w)( bui|\))/i
// Fire TV
],
[I, [W, Be], [D, J]],
[
/\(dtv[\);].+(aquos)/i
// Sharp
],
[I, [W, "Sharp"], [D, J]],
[
/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,
// Roku
/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i
// HbbTV devices
],
[[W, re], [I, re], [D, J]],
[
/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i
// SmartTV from Unidentified Vendors
],
[[D, J]],
[
///////////////////
// WEARABLES
///////////////////
/((pebble))app/i
// Pebble
],
[W, I, [D, be]],
[
/droid.+; (glass) \d/i
// Google Glass
],
[I, [W, oe], [D, be]],
[
/droid.+; (wt63?0{2,3})\)/i
],
[I, [W, m], [D, be]],
[
/(quest( 2)?)/i
// Oculus Quest
],
[I, [W, ve], [D, be]],
[
///////////////////
// EMBEDDED
///////////////////
/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i
// Tesla
],
[W, [D, $]],
[
////////////////////
// MIXED (GENERIC)
///////////////////
/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i
// Android Phones from Unidentified Vendors
],
[I, [D, z]],
[
/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i
// Android Tablets from Unidentified Vendors
],
[I, [D, B]],
[
/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i
// Unidentifiable Tablet
],
[[D, B]],
[
/(phone|mobile(?:[;\/]| safari)|pda(?=.+windows ce))/i
// Unidentifiable Mobile
],
[[D, z]],
[
/(android[-\w\. ]{0,9});.+buil/i
// Generic Android Device
],
[I, [W, "Generic"]]
],
engine: [
[
/windows.+ edge\/([\w\.]+)/i
// EdgeHTML
],
[j, [T, w + "HTML"]],
[
/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i
// Blink
],
[j, [T, "Blink"]],
[
/(presto)\/([\w\.]+)/i,
// Presto
/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,
// WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna
/ekioh(flow)\/([\w\.]+)/i,
// Flow
/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,
// KHTML/Tasman/Links
/(icab)[\/ ]([23]\.[\d\.]+)/i
// iCab
],
[T, j],
[
/rv\:([\w\.]{1,9})\b.+(gecko)/i
// Gecko
],
[j, T]
],
os: [
[
// Windows
/microsoft (windows) (vista|xp)/i
// Windows (iTunes)
],
[T, j],
[
/(windows) nt 6\.2; (arm)/i,
// Windows RT
/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,
// Windows Phone
/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i
],
[T, [j, P, he]],
[
/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i
],
[[T, "Windows"], [j, P, he]],
[
// iOS/macOS
/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,
// iOS
/cfnetwork\/.+darwin/i
],
[[j, /_/g, "."], [T, "iOS"]],
[
/(mac os x) ?([\w\. ]*)/i,
/(macintosh|mac_powerpc\b)(?!.+haiku)/i
// Mac OS
],
[[T, "Mac OS"], [j, /_/g, "."]],
[
// Mobile OSes
/droid ([\w\.]+)\b.+(android[- ]x86)/i
// Android-x86
],
[j, T],
[
// Android/WebOS/QNX/Bada/RIM/Maemo/MeeGo/Sailfish OS
/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,
/(blackberry)\w*\/([\w\.]*)/i,
// Blackberry
/(tizen|kaios)[\/ ]([\w\.]+)/i,
// Tizen/KaiOS
/\((series40);/i
// Series 40
],
[T, j],
[
/\(bb(10);/i
// BlackBerry 10
],
[j, [T, we]],
[
/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i
// Symbian
],
[j, [T, "Symbian"]],
[
/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i
// Firefox OS
],
[j, [T, le + " OS"]],
[
/web0s;.+rt(tv)/i,
/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i
// WebOS
],
[j, [T, "webOS"]],
[
// Google Chromecast
/crkey\/([\d\.]+)/i
// Google Chromecast
],
[j, [T, L + "cast"]],
[
/(cros) [\w]+ ([\w\.]+\w)/i
// Chromium OS
],
[[T, "Chromium OS"], j],
[
// Console
/(nintendo|playstation) ([wids345portablevuch]+)/i,
// Nintendo/Playstation
/(xbox); +xbox ([^\);]+)/i,
// Microsoft Xbox (360, One, X, S, Series X, Series S)
// Other
/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,
// Joli/Palm
/(mint)[\/\(\) ]?(\w*)/i,
// Mint
/(mageia|vectorlinux)[; ]/i,
// Mageia/VectorLinux
/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,
// Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware/Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus/Raspbian/Plan9/Minix/RISCOS/Contiki/Deepin/Manjaro/elementary/Sabayon/Linspire
/(hurd|linux) ?([\w\.]*)/i,
// Hurd/Linux
/(gnu) ?([\w\.]*)/i,
// GNU
/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,
// FreeBSD/NetBSD/OpenBSD/PC-BSD/GhostBSD/DragonFly
/(haiku) (\w+)/i
// Haiku
],
[T, j],
[
/(sunos) ?([\w\.\d]*)/i
// Solaris
],
[[T, "Solaris"], j],
[
/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,
// Solaris
/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,
// AIX
/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,
// BeOS/OS2/AmigaOS/MorphOS/OpenVMS/Fuchsia/HP-UX
/(unix) ?([\w\.]*)/i
// UNIX
],
[T, j]
]
}, Ee = function(te, ie) {
if (typeof te === x && (ie = te, te = o), !(this instanceof Ee))
return new Ee(te, ie).getResult();
var ee = te || (typeof n !== y && n.navigator && n.navigator.userAgent ? n.navigator.userAgent : p), Te = ie ? U(Ie, ie) : Ie;
return this.getBrowser = function() {
var Se = {};
return Se[T] = o, Se[j] = o, k.call(Se, ee, Te.browser), Se.major = Ue(Se.version), Se;
}, this.getCPU = function() {
var Se = {};
return Se[O] = o, k.call(Se, ee, Te.cpu), Se;
}, this.getDevice = function() {
var Se = {};
return Se[W] = o, Se[I] = o, Se[D] = o, k.call(Se, ee, Te.device), Se;
}, this.getEngine = function() {
var Se = {};
return Se[T] = o, Se[j] = o, k.call(Se, ee, Te.engine), Se;
}, this.getOS = function() {
var Se = {};
return Se[T] = o, Se[j] = o, k.call(Se, ee, Te.os), Se;
}, this.getResult = function() {
return {
ua: this.getUA(),
browser: this.getBrowser(),
engine: this.getEngine(),
os: this.getOS(),
device: this.getDevice(),
cpu: this.getCPU()
};
}, this.getUA = function() {
return ee;
}, this.setUA = function(Se) {
return ee = typeof Se === h && Se.length > ye ? re(Se, ye) : Se, this;
}, this.setUA(ee), this;
};
Ee.VERSION = s, Ee.BROWSER = M([T, j, F]), Ee.CPU = M([O]), Ee.DEVICE = M([I, W, D, K, z, J, B, be, $]), Ee.ENGINE = Ee.OS = M([T, j]), e.exports && (r = e.exports = Ee), r.UAParser = Ee;
var pe = typeof n !== y && (n.jQuery || n.Zepto);
if (pe && !pe.ua) {
var G = new Ee();
pe.ua = G.getResult(), pe.ua.get = function() {
return G.getUA();
}, pe.ua.set = function(te) {
G.setUA(te);
var ie = G.getResult();
for (var ee in ie)
pe.ua[ee] = ie[ee];
};
}
})(typeof window == "object" ? window : Vo);
})(Go, Go.exports);
var d0 = Go.exports;
const f0 = /* @__PURE__ */ ch(d0), Pn = f0(), Rs = Pn.os.name, p0 = Rs && Rs.toLowerCase().indexOf("android") >= 0, _0 = Rs && Rs.toLowerCase().indexOf("ios") >= 0, Ut = Pn.device.type === "mobile" || p0 || _0;
function zo(e = 0, r) {
e = Math.floor(e) || 0;
let n = 0;
const o = e % 60;
if (r === !0 || typeof r > "u" && e >= 3600) {
const s = Math.floor(e / 3600);
return n = Math.floor(e % 3600 / 60), `${s >= 10 ? s : `0${s}`}:${n >= 10 ? n : `0${n}`}:${o >= 10 ? o : `0${o}`}`;
} else
return n = Math.floor(e / 60), `${n >= 10 ? n : `0${n}`}:${o >= 10 ? o : `0${o}`}`;
}
const A0 = "kwai-p";
let Ml = oh.ERROR;
typeof location < "u" && (Ml = Tv.loadLogLevel("kwai-player-log") || oh.ERROR, Cv.setLevel(Ml).setName(A0));
const nn = Ov.EventEmitter;
(function() {
try {
if (typeof document != "undefined") {
var e = document.createElement("style");
e.appendChild(document.createTextNode("")), document.head.appendChild(e);
}
} catch (r) {
console.error("vite-plugin-css-injected-by-js", r);
}
})();
var v0 = Object.defineProperty, g0 = (e, r, n) => r in e ? v0(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, br = (e, r, n) => (g0(e, typeof r != "symbol" ? r + "" : r, n), n);
const Ko = "ControlsPlugin", m0 = "I18nPlugin", b0 = "LoggerPlugin", E0 = "HotkeyPlugin", y0 = "PlayInfoPlugin", C0 = "RotatePlugin", T0 = "PreviewPlugin", I0 = "MaskPlugin", R0 = "VRPlugin", w0 = "DanmakuPlugin";
let Er = class extends nn {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static isInstanceOfPlugin(r) {
return typeof r.beforeInstall == "function" && typeof r.afterInstall == "function" && typeof r.beforeUninstall == "function" && typeof r.afterUninstall == "function" && typeof r.getLabel == "function";
}
/**
* 控制条插槽按钮
*/
get controlsSoltBtns() {
}
/**
* 播放器实例化前钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
beforeInstall(r, n) {
}
/**
* 播放器实例化后钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
afterInstall(r, n) {
}
/**
* 播放器销毁前钩子
* @param player 播放器实例
*/
beforeUninstall(r) {
}
/**
* 播放器销毁后钩子
* @param player 播放器实例
*/
afterUninstall(r) {
}
};
br(Er, "label"), /**
* 版本
*/
br(Er, "version"), /**
* 当前环境是否支持
*/
br(Er, "isSupported");
const L0 = class Dh extends Er {
/**
* @override
*/
getLabel() {
return Dh.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
};
br(L0, "label", Ko);
const D0 = class Sh extends Er {
/**
* @override
*/
getLabel() {
return Sh.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
};
br(D0, "label", m0);
const S0 = class Oh extends Er {
/**
* @override
*/
getLabel() {
return Oh.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
/**
* 增加业务相关数据
* @param key 上报数据key
* @param value 上报数据
*/
addBizLog(r, n) {
}
appendSummaryField(r, n) {
}
};
br(S0, "label", b0);
const O0 = class Nh extends Er {
/**
* @override
*/
getLabel() {
return Nh.label;
}
};
br(O0, "label", E0);
const N0 = class kh extends Er {
/**
* @override
*/
getLabel() {
return kh.label;
}
};
br(N0, "label", y0);
const k0 = class xh extends Er {
/**
* @override
*/
getLabel() {
return xh.label;
}
};
br(k0, "label", C0);
const x0 = class Mh extends Er {
/**
* @override
*/
getLabel() {
return Mh.label;
}
};
br(x0, "label", T0);
const M0 = class Ph extends Er {
/**
* @override
*/
getLabel() {
return Ph.label;
}
};
br(M0, "label", I0);
const P0 = class Uh extends Er {
/**
* @override
*/
getLabel() {
return Uh.label;
}
};
br(P0, "label", R0);
const U0 = class Bh extends Er {
/**
* @override
*/
getLabel() {
return Bh.label;
}
};
br(U0, "label", w0);
var Bs, At, Vh, Jn, Pl, Fh, Wo, jh, ws = {}, Hh = [], B0 = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
function Mn(e, r) {
for (var n in r)
e[n] = r[n];
return e;
}
function Gh(e) {
var r = e.parentNode;
r && r.removeChild(e);
}
function Yo(e, r, n) {
var o, s, p, g = {};
for (p in r)
p == "key" ? o = r[p] : p == "ref" ? s = r[p] : g[p] = r[p];
if (arguments.length > 2 && (g.children = arguments.length > 3 ? Bs.call(arguments, 2) : n), typeof e == "function" && e.defaultProps != null)
for (p in e.defaultProps)
g[p] === void 0 && (g[p] = e.defaultProps[p]);
return _s(e, g, o, s, null);
}
function _s(e, r, n, o, s) {
var p = { type: e, props: r, key: n, ref: o, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, __h: null, constructor: void 0, __v: s == null ? ++Vh : s };
return s == null && At.vnode != null && At.vnode(p), p;
}
function Yi(e) {
return e.children;
}
function Ln(e, r) {
this.props = e, this.context = r;
}
function ja(e, r) {
if (r == null)
return e.__ ? ja(e.__, e.__.__k.indexOf(e) + 1) : null;
for (var n; r < e.__k.length; r++)
if ((n = e.__k[r]) != null && n.__e != null)
return n.__e;
return typeof e.type == "function" ? ja(e) : null;
}
function zh(e) {
var r, n;
if ((e = e.__) != null && e.__c != null) {
for (e.__e = e.__c.base = null, r = 0; r < e.__k.length; r++)
if ((n = e.__k[r]) != null && n.__e != null) {
e.__e = e.__c.base = n.__e;
break;
}
return zh(e);
}
}
function Qo(e) {
(!e.__d && (e.__d = !0) && Jn.push(e) && !Ls.__r++ || Pl !== At.debounceRendering) && ((Pl = At.debounceRendering) || Fh)(Ls);
}
function Ls() {
var e, r, n, o, s, p, g, C;
for (Jn.sort(Wo); e = Jn.shift(); )
e.__d && (r = Jn.length, o = void 0, s = void 0, g = (p = (n = e).__v).__e, (C = n.__P) && (o = [], (s = Mn({}, p)).__v = p.__v + 1, fc(C, p, s, n.__n, C.ownerSVGElement !== void 0, p.__h != null ? [g] : null, o, g == null ? ja(p) : g, p.__h), Xh(o, p), p.__e != g && zh(p)), Jn.length > r && Jn.sort(Wo));
Ls.__r = 0;
}
function Kh(e, r, n, o, s, p, g, C, y, x) {
var h, F, I, T, D, W, j, O = o && o.__k || Hh, K = O.length;
for (n.__k = [], h = 0; h < r.length; h++)
if ((T = n.__k[h] = (T = r[h]) == null || typeof T == "boolean" || typeof T == "function" ? null : typeof T == "string" || typeof T == "number" || typeof T == "bigint" ? _s(null, T, null, null, T) : Array.isArray(T) ? _s(Yi, { children: T }, null, null, null) : T.__b > 0 ? _s(T.type, T.props, T.key, T.ref ? T.ref : null, T.__v) : T) != null) {
if (T.__ = n, T.__b = n.__b + 1, (I = O[h]) === null || I && T.key == I.key && T.type === I.type)
O[h] = void 0;
else
for (F = 0; F < K; F++) {
if ((I = O[F]) && T.key == I.key && T.type === I.type) {
O[F] = void 0;
break;
}
I = null;
}
fc(e, T, I = I || ws, s, p, g, C, y, x), D = T.__e, (F = T.ref) && I.ref != F && (j || (j = []), I.ref && j.push(I.ref, null, T), j.push(F, T.__c || D, T)), D != null ? (W == null && (W = D), typeof T.type == "function" && T.__k === I.__k ? T.__d = y = Wh(T, y, e) : y = Yh(e, T, I, O, D, y), typeof n.type == "function" && (n.__d = y)) : y && I.__e == y && y.parentNode != e && (y = ja(I));
}
for (n.__e = W, h = K; h--; )
O[h] != null && (typeof n.type == "function" && O[h].__e != null && O[h].__e == n.__d && (n.__d = Qh(o).nextSibling), Zh(O[h], O[h]));
if (j)
for (h = 0; h < j.length; h++)
$h(j[h], j[++h], j[++h]);
}
function Wh(e, r, n) {
for (var o, s = e.__k, p = 0; s && p < s.length; p++)
(o = s[p]) && (o.__ = e, r = typeof o.type == "function" ? Wh(o, r, n) : Yh(n, o, o, s, o.__e, r));
return r;
}
function Ds(e, r) {
return r = r || [], e == null || typeof e == "boolean" || (Array.isArray(e) ? e.some(function(n) {
Ds(n, r);
}) : r.push(e)), r;
}
function Yh(e, r, n, o, s, p) {
var g, C, y;
if (r.__d !== void 0)
g = r.__d, r.__d = void 0;
else if (n == null || s != p || s.parentNode == null)
e:
if (p == null || p.parentNode !== e)
e.appendChild(s), g = null;
else {
for (C = p, y = 0; (C = C.nextSibling) && y < o.length; y += 1)
if (C == s)
break e;
e.insertBefore(s, p), g = p;
}
return g !== void 0 ? g : s.nextSibling;
}
function Qh(e) {
var r, n, o;
if (e.type == null || typeof e.type == "string")
return e.__e;
if (e.__k) {
for (r = e.__k.length - 1; r >= 0; r--)
if ((n = e.__k[r]) && (o = Qh(n)))
return o;
}
return null;
}
function V0(e, r, n, o, s) {
var p;
for (p in n)
p === "children" || p === "key" || p in r || Ss(e, p, null, n[p], o);
for (p in r)
s && typeof r[p] != "function" || p === "children" || p === "key" || p === "value" || p === "checked" || n[p] === r[p] || Ss(e, p, r[p], n[p], o);
}
function Ul(e, r, n) {
r[0] === "-" ? e.setProperty(r, n == null ? "" : n) : e[r] = n == null ? "" : typeof n != "number" || B0.test(r) ? n : n + "px";
}
function Ss(e, r, n, o, s) {
var p;
e:
if (r === "style")
if (typeof n == "string")
e.style.cssText = n;
else {
if (typeof o == "string" && (e.style.cssText = o = ""), o)
for (r in o)
n && r in n || Ul(e.style, r, "");
if (n)
for (r in n)
o && n[r] === o[r] || Ul(e.style, r, n[r]);
}
else if (r[0] === "o" && r[1] === "n")
p = r !== (r = r.replace(/Capture$/, "")), r = r.toLowerCase() in e ? r.toLowerCase().slice(2) : r.slice(2), e.l || (e.l = {}), e.l[r + p] = n, n ? o || e.addEventListener(r, p ? Vl : Bl, p) : e.removeEventListener(r, p ? Vl : Bl, p);
else if (r !== "dangerouslySetInnerHTML") {
if (s)
r = r.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
else if (r !== "width" && r !== "height" && r !== "href" && r !== "list" && r !== "form" && r !== "tabIndex" && r !== "download" && r in e)
try {
e[r] = n == null ? "" : n;
break e;
} catch (g) {
}
typeof n == "function" || (n == null || n === !1 && r[4] !== "-" ? e.removeAttribute(r) : e.setAttribute(r, n));
}
}
function Bl(e) {
return this.l[e.type + !1](At.event ? At.event(e) : e);
}
function Vl(e) {
return this.l[e.type + !0](At.event ? At.event(e) : e);
}
function fc(e, r, n, o, s, p, g, C, y) {
var x, h, F, I, T, D, W, j, O, K, z, B, J, be, $, ye = r.type;
if (r.constructor !== void 0)
return null;
n.__h != null && (y = n.__h, C = r.__e = n.__e, r.__h = null, p = [C]), (x = At.__b) && x(r);
try {
e:
if (typeof ye == "function") {
if (j = r.props, O = (x = ye.contextType) && o[x.__c], K = x ? O ? O.props.value : x.__ : o, n.__c ? W = (h = r.__c = n.__c).__ = h.__E : ("prototype" in ye && ye.prototype.render ? r.__c = h = new ye(j, K) : (r.__c = h = new Ln(j, K), h.constructor = ye, h.render = j0), O && O.sub(h), h.props = j, h.state || (h.state = {}), h.context = K, h.__n = o, F = h.__d = !0, h.__h = [], h._sb = []), h.__s == null && (h.__s = h.state), ye.getDerivedStateFromProps != null && (h.__s == h.state && (h.__s = Mn({}, h.__s)), Mn(h.__s, ye.getDerivedStateFromProps(j, h.__s))), I = h.props, T = h.state, h.__v = r, F)
ye.getDerivedStateFromProps == null && h.componentWillMount != null && h.componentWillMount(), h.componentDidMount != null && h.__h.push(h.componentDidMount);
else {
if (ye.getDerivedStateFromProps == null && j !== I && h.componentWillReceiveProps != null && h.componentWillReceiveProps(j, K), !h.__e && h.shouldComponentUpdate != null && h.shouldComponentUpdate(j, h.__s, K) === !1 || r.__v === n.__v) {
for (r.__v !== n.__v && (h.props = j, h.state = h.__s, h.__d = !1), h.__e = !1, r.__e = n.__e, r.__k = n.__k, r.__k.forEach(function(Be) {
Be && (Be.__ = r);
}), z = 0; z < h._sb.length; z++)
h.__h.push(h._sb[z]);
h._sb = [], h.__h.length && g.push(h);
break e;
}
h.componentWillUpdate != null && h.componentWillUpdate(j, h.__s, K), h.componentDidUpdate != null && h.__h.push(function() {
h.componentDidUpdate(I, T, D);
});
}
if (h.context = K, h.props = j, h.__P = e, B = At.__r, J = 0, "prototype" in ye && ye.prototype.render) {
for (h.state = h.__s, h.__d = !1, B && B(r), x = h.render(h.props, h.state, h.context), be = 0; be < h._sb.length; be++)
h.__h.push(h._sb[be]);
h._sb = [];
} else
do
h.__d = !1, B && B(r), x = h.render(h.props, h.state, h.context), h.state = h.__s;
while (h.__d && ++J < 25);
h.state = h.__s, h.getChildContext != null && (o = Mn(Mn({}, o), h.getChildContext())), F || h.getSnapshotBeforeUpdate == null || (D = h.getSnapshotBeforeUpdate(I, T)), $ = x != null && x.type === Yi && x.key == null ? x.props.children : x, Kh(e, Array.isArray($) ? $ : [$], r, n, o, s, p, g, C, y), h.base = r.__e, r.__h = null, h.__h.length && g.push(h), W && (h.__E = h.__ = null), h.__e = !1;
} else
p == null && r.__v === n.__v ? (r.__k = n.__k, r.__e = n.__e) : r.__e = F0(n.__e, r, n, o, s, p, g, y);
(x = At.diffed) && x(r);
} catch (Be) {
r.__v = null, (y || p != null) && (r.__e = C, r.__h = !!y, p[p.indexOf(C)] = null), At.__e(Be, r, n);
}
}
function Xh(e, r) {
At.__c && At.__c(r, e), e.some(function(n) {
try {
e = n.__h, n.__h = [], e.some(function(o) {
o.call(n);
});
} catch (o) {
At.__e(o, n.__v);
}
});
}
function F0(e, r, n, o, s, p, g, C) {
var y, x, h, F = n.props, I = r.props, T = r.type, D = 0;
if (T === "svg" && (s = !0), p != null) {
for (; D < p.length; D++)
if ((y = p[D]) && "setAttribute" in y == !!T && (T ? y.localName === T : y.nodeType === 3)) {
e = y, p[D] = null;
break;
}
}
if (e == null) {
if (T === null)
return document.createTextNode(I);
e = s ? document.createElementNS("http://www.w3.org/2000/svg", T) : document.createElement(T, I.is && I), p = null, C = !1;
}
if (T === null)
F === I || C && e.data === I || (e.data = I);
else {
if (p = p && Bs.call(e.childNodes), x = (F = n.props || ws).dangerouslySetInnerHTML, h = I.dangerouslySetInnerHTML, !C) {
if (p != null)
for (F = {}, D = 0; D < e.attributes.length; D++)
F[e.attributes[D].name] = e.attributes[D].value;
(h || x) && (h && (x && h.__html == x.__html || h.__html === e.innerHTML) || (e.innerHTML = h && h.__html || ""));
}
if (V0(e, I, F, s, C), h)
r.__k = [];
else if (D = r.props.children, Kh(e, Array.isArray(D) ? D : [D], r, n, o, s && T !== "foreignObject", p, g, p ? p[0] : n.__k && ja(n, 0), C), p != null)
for (D = p.length; D--; )
p[D] != null && Gh(p[D]);
C || ("value" in I && (D = I.value) !== void 0 && (D !== e.value || T === "progress" && !D || T === "option" && D !== F.value) && Ss(e, "value", D, F.value, !1), "checked" in I && (D = I.checked) !== void 0 && D !== e.checked && Ss(e, "checked", D, F.checked, !1));
}
return e;
}
function $h(e, r, n) {
try {
typeof e == "function" ? e(r) : e.current = r;
} catch (o) {
At.__e(o, n);
}
}
function Zh(e, r, n) {
var o, s;
if (At.unmount && At.unmount(e), (o = e.ref) && (o.current && o.current !== e.__e || $h(o, null, r)), (o = e.__c) != null) {
if (o.componentWillUnmount)
try {
o.componentWillUnmount();
} catch (p) {
At.__e(p, r);
}
o.base = o.__P = null, e.__c = void 0;
}
if (o = e.__k)
for (s = 0; s < o.length; s++)
o[s] && Zh(o[s], r, n || typeof e.type != "function");
n || e.__e == null || Gh(e.__e), e.__ = e.__e = e.__d = void 0;
}
function j0(e, r, n) {
return this.constructor(e, n);
}
function Ba(e, r, n) {
var o, s, p;
At.__ && At.__(e, r), s = (o = typeof n == "function") ? null : n && n.__k || r.__k, p = [], fc(r, e = (!o && n || r).__k = Yo(Yi, null, [e]), s || ws, ws, r.ownerSVGElement !== void 0, !o && n ? [n] : s ? null : r.firstChild ? Bs.call(r.childNodes) : null, p, !o && n ? n : s ? s.__e : r.firstChild, o), Xh(p, e);
}
function za(e, r) {
var n = { __c: r = "__cC" + jh++, __: e, Consumer: function(o, s) {
return o.children(s);
}, Provider: function(o) {
var s, p;
return this.getChildContext || (s = [], (p = {})[r] = this, this.getChildContext = function() {
return p;
}, this.shouldComponentUpdate = function(g) {
this.props.value !== g.value && s.some(function(C) {
C.__e = !0, Qo(C);
});
}, this.sub = function(g) {
s.push(g);
var C = g.componentWillUnmount;
g.componentWillUnmount = function() {
s.splice(s.indexOf(g), 1), C && C.call(g);
};
}), o.children;
} };
return n.Provider.__ = n.Consumer.contextType = n;
}
Bs = Hh.slice, At = { __e: function(e, r, n, o) {
for (var s, p, g; r = r.__; )
if ((s = r.__c) && !s.__)
try {
if ((p = s.constructor) && p.getDerivedStateFromError != null && (s.setState(p.getDerivedStateFromError(e)), g = s.__d), s.componentDidCatch != null && (s.componentDidCatch(e, o || {}), g = s.__d), g)
return s.__E = s;
} catch (C) {
e = C;
}
throw e;
} }, Vh = 0, Ln.prototype.setState = function(e, r) {
var n;
n = this.__s != null && this.__s !== this.state ? this.__s : this.__s = Mn({}, this.state), typeof e == "function" && (e = e(Mn({}, n), this.props)), e && Mn(n, e), e != null && this.__v && (r && this._sb.push(r), Qo(this));
}, Ln.prototype.forceUpdate = function(e) {
this.__v && (this.__e = !0, e && this.__h.push(e), Qo(this));
}, Ln.prototype.render = Yi, Jn = [], Fh = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Wo = function(e, r) {
return e.__v.__b - r.__v.__b;
}, Ls.__r = 0, jh = 0;
var H0 = 0;
function De(e, r, n, o, s, p) {
var g, C, y = {};
for (C in r)
C == "ref" ? g = r[C] : y[C] = r[C];
var x = { type: e, props: y, key: n, ref: g, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, __h: null, constructor: void 0, __v: --H0, __source: s, __self: p };
if (typeof e == "function" && (g = e.defaultProps))
for (C in g)
y[C] === void 0 && (y[C] = g[C]);
return At.vnode && At.vnode(x), x;
}
var Aa, li, bo, Fl, Ha = 0, qh = [], As = [], jl = At.__b, Hl = At.__r, Gl = At.diffed, zl = At.__c, Kl = At.unmount;
function Ka(e, r) {
At.__h && At.__h(li, e, Ha || r), Ha = 0;
var n = li.__H || (li.__H = { __: [], __h: [] });
return e >= n.__.length && n.__.push({ __V: As }), n.__[e];
}
function ot(e) {
return Ha = 1, G0(Jh, e);
}
function G0(e, r, n) {
var o = Ka(Aa++, 2);
if (o.t = e, !o.__c && (o.__ = [n ? n(r) : Jh(void 0, r), function(C) {
var y = o.__N ? o.__N[0] : o.__[0], x = o.t(y, C);
y !== x && (o.__N = [x, o.__[1]], o.__c.setState({}));
}], o.__c = li, !li.u)) {
var s = function(C, y, x) {
if (!o.__c.__H)
return !0;
var h = o.__c.__H.__.filter(function(I) {
return I.__c;
});
if (h.every(function(I) {
return !I.__N;
}))
return !p || p.call(this, C, y, x);
var F = !1;
return h.forEach(function(I) {
if (I.__N) {
var T = I.__[0];
I.__ = I.__N, I.__N = void 0, T !== I.__[0] && (F = !0);
}
}), !(!F && o.__c.props === C) && (!p || p.call(this, C, y, x));
};
li.u = !0;
var p = li.shouldComponentUpdate, g = li.componentWillUpdate;
li.componentWillUpdate = function(C, y, x) {
if (this.__e) {
var h = p;
p = void 0, s(C, y, x), p = h;
}
g && g.call(this, C, y, x);
}, li.shouldComponentUpdate = s;
}
return o.__N || o.__;
}
function Ft(e, r) {
var n = Ka(Aa++, 3);
!At.__s && pc(n.__H, r) && (n.__ = e, n.i = r, li.__H.__h.push(n));
}
function Un(e, r) {
var n = Ka(Aa++, 4);
!At.__s && pc(n.__H, r) && (n.__ = e, n.i = r, li.__h.push(n));
}
function St(e) {
return Ha = 5, wi(function() {
return { current: e };
}, []);
}
function wi(e, r) {
var n = Ka(Aa++, 7);
return pc(n.__H, r) ? (n.__V = e(), n.i = r, n.__h = e, n.__V) : n.__;
}
function mr(e, r) {
return Ha = 8, wi(function() {
return e;
}, r);
}
function sr(e) {
var r = li.context[e.__c], n = Ka(Aa++, 9);
return n.c = e, r ? (n.__ == null && (n.__ = !0, r.sub(li)), r.props.value) : e.__;
}
function z0() {
for (var e; e = qh.shift(); )
if (e.__P && e.__H)
try {
e.__H.__h.forEach(vs), e.__H.__h.forEach(Xo), e.__H.__h = [];
} catch (r) {
e.__H.__h = [], At.__e(r, e.__v);
}
}
At.__b = function(e) {
li = null, jl && jl(e);
}, At.__r = function(e) {
Hl && Hl(e), Aa = 0;
var r = (li = e.__c).__H;
r && (bo === li ? (r.__h = [], li.__h = [], r.__.forEach(function(n) {
n.__N && (n.__ = n.__N), n.__V = As, n.__N = n.i = void 0;
})) : (r.__h.forEach(vs), r.__h.forEach(Xo), r.__h = [])), bo = li;
}, At.diffed = function(e) {
Gl && Gl(e);
var r = e.__c;
r && r.__H && (r.__H.__h.length && (qh.push(r) !== 1 && Fl === At.requestAnimationFrame || ((Fl = At.requestAnimationFrame) || K0)(z0)), r.__H.__.forEach(function(n) {
n.i && (n.__H = n.i), n.__V !== As && (n.__ = n.__V), n.i = void 0, n.__V = As;
})), bo = li = null;
}, At.__c = function(e, r) {
r.some(function(n) {
try {
n.__h.forEach(vs), n.__h = n.__h.filter(function(o) {
return !o.__ || Xo(o);
});
} catch (o) {
r.some(function(s) {
s.__h && (s.__h = []);
}), r = [], At.__e(o, n.__v);
}
}), zl && zl(e, r);
}, At.unmount = function(e) {
Kl && Kl(e);
var r, n = e.__c;
n && n.__H && (n.__H.__.forEach(function(o) {
try {
vs(o);
} catch (s) {
r = s;
}
}), n.__H = void 0, r && At.__e(r, n.__v));
};
var Wl = typeof requestAnimationFrame == "function";
function K0(e) {
var r, n = function() {
clearTimeout(o), Wl && cancelAnimationFrame(r), setTimeout(e);
}, o = setTimeout(n, 100);
Wl && (r = requestAnimationFrame(n));
}
function vs(e) {
var r = li, n = e.__c;
typeof n == "function" && (e.__c = void 0, n()), li = r;
}
function Xo(e) {
var r = li;
e.__c = e.__(), li = r;
}
function pc(e, r) {
return !e || e.length !== r.length || r.some(function(n, o) {
return n !== e[o];
});
}
function Jh(e, r) {
return typeof r == "function" ? r(e) : r;
}
function ed(e, r) {
for (var n in r)
e[n] = r[n];
return e;
}
function Yl(e, r) {
for (var n in e)
if (n !== "__source" && !(n in r))
return !0;
for (var o in r)
if (o !== "__source" && e[o] !== r[o])
return !0;
return !1;
}
function Ql(e) {
this.props = e;
}
(Ql.prototype = new Ln()).isPureReactComponent = !0, Ql.prototype.shouldComponentUpdate = function(e, r) {
return Yl(this.props, e) || Yl(this.state, r);
};
var Xl = At.__b;
At.__b = function(e) {
e.type && e.type.__f && e.ref && (e.props.ref = e.ref, e.ref = null), Xl && Xl(e);
};
var W0 = typeof Symbol != "undefined" && Symbol.for && Symbol.for("react.forward_ref") || 3911;
function Vs(e) {
function r(n) {
var o = ed({}, n);
return delete o.ref, e(o, n.ref || null);
}
return r.$$typeof = W0, r.render = r, r.prototype.isReactComponent = r.__f = !0, r.displayName = "ForwardRef(" + (e.displayName || e.name) + ")", r;
}
var Y0 = At.__e;
At.__e = function(e, r, n, o) {
if (e.then) {
for (var s, p = r; p = p.__; )
if ((s = p.__c) && s.__c)
return r.__e == null && (r.__e = n.__e, r.__k = n.__k), s.__c(e, r);
}
Y0(e, r, n, o);
};
var $l = At.unmount;
function td(e, r, n) {
return e && (e.__c && e.__c.__H && (e.__c.__H.__.forEach(function(o) {
typeof o.__c == "function" && o.__c();
}), e.__c.__H = null), (e = ed({}, e)).__c != null && (e.__c.__P === n && (e.__c.__P = r), e.__c = null), e.__k = e.__k && e.__k.map(function(o) {
return td(o, r, n);
})), e;
}
function id(e, r, n) {
return e && (e.__v = null, e.__k = e.__k && e.__k.map(function(o) {
return id(o, r, n);
}), e.__c && e.__c.__P === r && (e.__e && n.insertBefore(e.__e, e.__d), e.__c.__e = !0, e.__c.__P = n)), e;
}
function Eo() {
this.__u = 0, this.t = null, this.__b = null;
}
function rd(e) {
var r = e.__.__c;
return r && r.__a && r.__a(e);
}
function cs() {
this.u = null, this.o = null;
}
At.unmount = function(e) {
var r = e.__c;
r && r.__R && r.__R(), r && e.__h === !0 && (e.type = null), $l && $l(e);
}, (Eo.prototype = new Ln()).__c = function(e, r) {
var n = r.__c, o = this;
o.t == null && (o.t = []), o.t.push(n);
var s = rd(o.__v), p = !1, g = function() {
p || (p = !0, n.__R = null, s ? s(C) : C());
};
n.__R = g;
var C = function() {
if (!--o.__u) {
if (o.state.__a) {
var x = o.state.__a;
o.__v.__k[0] = id(x, x.__c.__P, x.__c.__O);
}
var h;
for (o.setState({ __a: o.__b = null }); h = o.t.pop(); )
h.forceUpdate();
}
}, y = r.__h === !0;
o.__u++ || y || o.setState({ __a: o.__b = o.__v.__k[0] }), e.then(g, g);
}, Eo.prototype.componentWillUnmount = function() {
this.t = [];
}, Eo.prototype.render = function(e, r) {
if (this.__b) {
if (this.__v.__k) {
var n = document.createElement("div"), o = this.__v.__k[0].__c;
this.__v.__k[0] = td(this.__b, n, o.__O = o.__P);
}
this.__b = null;
}
var s = r.__a && Yo(Yi, null, e.fallback);
return s && (s.__h = null), [Yo(Yi, null, r.__a ? null : e.children), s];
};
var Zl = function(e, r, n) {
if (++n[1] === n[0] && e.o.delete(r), e.props.revealOrder && (e.props.revealOrder[0] !== "t" || !e.o.size))
for (n = e.u; n; ) {
for (; n.length > 3; )
n.pop()();
if (n[1] < n[0])
break;
e.u = n = n[2];
}
};
(cs.prototype = new Ln()).__a = function(e) {
var r = this, n = rd(r.__v), o = r.o.get(e);
return o[0]++, function(s) {
var p = function() {
r.props.revealOrder ? (o.push(s), Zl(r, e, o)) : s();
};
n ? n(p) : p();
};
}, cs.prototype.render = function(e) {
this.u = null, this.o = /* @__PURE__ */ new Map();
var r = Ds(e.children);
e.revealOrder && e.revealOrder[0] === "b" && r.reverse();
for (var n = r.length; n--; )
this.o.set(r[n], this.u = [1, 0, this.u]);
return e.children;
}, cs.prototype.componentDidUpdate = cs.prototype.componentDidMount = function() {
var e = this;
this.o.forEach(function(r, n) {
Zl(e, n, r);
});
};
var Q0 = typeof Symbol != "undefined" && Symbol.for && Symbol.for("react.element") || 60103, X0 = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/, $0 = /^on(Ani|Tra|Tou|BeforeInp|Compo)/, Z0 = /[A-Z0-9]/g, q0 = typeof document != "undefined", J0 = function(e) {
return (typeof Symbol != "undefined" && typeof Symbol() == "symbol" ? /fil|che|rad/ : /fil|che|ra/).test(e);
};
Ln.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveProps", "componentWillUpdate"].forEach(function(e) {
Object.defineProperty(Ln.prototype, e, { configurable: !0, get: function() {
return this["UNSAFE_" + e];
}, set: function(r) {
Object.defineProperty(this, e, { configurable: !0, writable: !0, value: r });
} });
});
var ql = At.event;
function eg() {
}
function tg() {
return this.cancelBubble;
}
function ig() {
return this.defaultPrevented;
}
At.event = function(e) {
return ql && (e = ql(e)), e.persist = eg, e.isPropagationStopped = tg, e.isDefaultPrevented = ig, e.nativeEvent = e;
};
var rg = { enumerable: !1, configurable: !0, get: function() {
return this.class;
} }, Jl = At.vnode;
At.vnode = function(e) {
typeof e.type == "string" && function(r) {
var n = r.props, o = r.type, s = {};
for (var p in n) {
var g = n[p];
if (!(p === "value" && "defaultValue" in n && g == null || q0 && p === "children" && o === "noscript" || p === "class" || p === "className")) {
var C = p.toLowerCase();
p === "defaultValue" && "value" in n && n.value == null ? p = "value" : p === "download" && g === !0 ? g = "" : C === "ondoubleclick" ? p = "ondblclick" : C !== "onchange" || o !== "input" && o !== "textarea" || J0(n.type) ? C === "onfocus" ? p = "onfocusin" : C === "onblur" ? p = "onfocusout" : $0.test(p) ? p = C : o.indexOf("-") === -1 && X0.test(p) ? p = p.replace(Z0, "-$&").toLowerCase() : g === null && (g = void 0) : C = p = "oninput", C === "oninput" && s[p = C] && (p = "oninputCapture"), s[p] = g;
}
}
o == "select" && s.multiple && Array.isArray(s.value) && (s.value = Ds(n.children).forEach(function(y) {
y.props.selected = s.value.indexOf(y.props.value) != -1;
})), o == "select" && s.defaultValue != null && (s.value = Ds(n.children).forEach(function(y) {
y.props.selected = s.multiple ? s.defaultValue.indexOf(y.props.value) != -1 : s.defaultValue == y.props.value;
})), n.class && !n.className ? (s.class = n.class, Object.defineProperty(s, "className", rg)) : (n.className && !n.class || n.class && n.className) && (s.class = s.className = n.className), r.props = s;
}(e), e.$$typeof = Q0, Jl && Jl(e);
};
var eu = At.__r;
At.__r = function(e) {
eu && eu(e), e.__c;
};
var tu = At.diffed;
At.diffed = function(e) {
tu && tu(e);
var r = e.props, n = e.__e;
n != null && e.type === "textarea" && "value" in r && r.value !== n.value && (n.value = r.value == null ? "" : r.value);
};
(function() {
try {
if (typeof document != "undefined") {
var e = document.createElement("style");
e.appendChild(document.createTextNode('._controls_azwg4_1{position:absolute;display:flex;flex-direction:column;justify-content:space-between;top:0;left:0;width:100%;height:100%;font-size:24px;font-family:PingFang SC,Roboto,Noto,sans-serif;font-weight:400}._controls_azwg4_1 ._video-area_azwg4_14{position:relative;width:100%;height:100%;flex-grow:1}._controls_azwg4_1 ._video-area_azwg4_14 ._bottom-controls_azwg4_20{position:absolute;bottom:0;width:100%;display:flex;flex-direction:column;justify-content:flex-end;transition:opacity .3s ease-in}._controls_azwg4_1 ._video-area_azwg4_14 ._bottom-controls_azwg4_20 ._bottom-controls-bg_azwg4_29{position:absolute;pointer-events:none;height:6.5833333333em;width:100%;background:0 bottom repeat-x linear-gradient(rgba(0,0,0,0),rgb(0,0,0));background-size:auto 6.5833333333em;opacity:.4;border-radius:.625em}._controls_azwg4_1 ._sending-area_azwg4_39{position:relative;width:100%;display:flex;justify-content:space-between;background-color:#191a1f;align-items:center}._controls_azwg4_1 ._sending-area_azwg4_39 ._sending-area-controls_azwg4_47{width:100%;margin:.4166666667em}._controls_azwg4_1 ._button-panel_azwg4_51{display:flex;position:relative;margin:.5833333333em 1.875em 1.5833333333em;justify-content:space-between}._controls_azwg4_1 ._button-panel-left_azwg4_57,._controls_azwg4_1 ._button-panel-right_azwg4_58{height:1.5833333333em;display:flex;flex-direction:row;align-items:center}._controls_azwg4_1 ._button-panel-center_azwg4_64{display:flex;flex-direction:row;flex-grow:1;justify-content:center;align-items:center}._controls_azwg4_1 ._button-panel-center_azwg4_64>div{margin:0 .6666666667em;width:100%}._controls_azwg4_1 ._panel-button-margins-left_azwg4_75{margin-left:1.25em}._controls_azwg4_1 ._panel-button-margins-right_azwg4_78{margin-right:1.25em}._controls_azwg4_1 ._panel-button-wrapper_azwg4_81{display:flex;align-items:center;justify-content:center;position:relative;line-height:1.5833333333em;min-width:1.5833333333em;height:1.5833333333em;color:rgba(255,255,255,.9);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;-webkit-tap-highlight-color:transparent}._controls_azwg4_1 ._panel-button-wrapper_azwg4_81._disabled_azwg4_97,._controls_azwg4_1 ._panel-button-wrapper_azwg4_81._disabled_azwg4_97:hover{opacity:.3;cursor:default}._controls_azwg4_1 ._panel-button-wrapper_azwg4_81 ._panel-button_azwg4_75{-webkit-tap-highlight-color:transparent;text-align:center}._controls_azwg4_1 ._panel-button-wrapper_azwg4_81 ._panel-button-text_azwg4_105{font-weight:400;font-size:.9166666667em;line-height:1;text-align:center}._controls_azwg4_1 ._live-shift_azwg4_111._disabled_azwg4_97{opacity:.3}._controls_azwg4_1 ._live-shift-chips_azwg4_114{display:flex;align-items:center;justify-content:center;border-radius:.3333333333em;border:2px solid rgba(255,255,255,.4);padding:0 .4166666667em 0 0;height:1.9166666667em;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;word-break:keep-all}._controls_azwg4_1 ._live-shift-button_azwg4_128{display:flex;align-items:center;justify-content:center;border-radius:.3333333333em;border:2px solid rgba(255,255,255,.4);padding:0 .4166666667em 0 0;height:1.9166666667em;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;word-break:keep-all;cursor:pointer}._controls_azwg4_1 ._live-shift-button_azwg4_128._disabled_azwg4_97{cursor:default}._controls_azwg4_1 ._panel-button-icon_azwg4_146{width:1.5833333333em;height:1.5833333333em}._controls_azwg4_1 ._panel-button-icon-plugin_azwg4_150{height:1.5833333333em}._controls_azwg4_1 ._panel-button-icon-plugin_azwg4_150 svg{width:1.5833333333em;height:1.5833333333em}._controls_azwg4_1 ._current-time-display_azwg4_157{margin-left:.9166666667em;font-family:Consolas,Monaco,monospace}._controls_azwg4_1 ._current-time-display_azwg4_157>div{font-weight:500;font-size:.9166666667em;color:#fff}._controls_azwg4_1 ._time-remaining-display_azwg4_166{margin-left:.4166666667em;font-family:Consolas,Monaco,monospace}._controls_azwg4_1 ._time-remaining-display_azwg4_166>div{font-weight:500;font-size:.9166666667em;color:rgba(255,255,255,.4);white-space:nowrap}._controls_azwg4_1 ._timeline_azwg4_176{display:block;margin:0 1.875em;padding:.25em 0 .2083333333em;cursor:pointer}._controls_azwg4_1 ._timeline_azwg4_176 ._thumb_azwg4_182{opacity:0}._controls_azwg4_1 ._timeline_azwg4_176 ._thumb-drag_azwg4_185{opacity:1}._controls_azwg4_1 ._segmented-track_azwg4_188,._controls_azwg4_1 ._segmented-vertical-track_azwg4_189{position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}._controls_azwg4_1 ._segmented-track_azwg4_188._disabled_azwg4_97,._controls_azwg4_1 ._segmented-track_azwg4_188._disabled_azwg4_97:hover,._controls_azwg4_1 ._segmented-vertical-track_azwg4_189._disabled_azwg4_97,._controls_azwg4_1 ._segmented-vertical-track_azwg4_189._disabled_azwg4_97:hover{cursor:default}._controls_azwg4_1 ._segmented-vertical-track_azwg4_189{height:100%;width:100%}._controls_azwg4_1 ._thumb_azwg4_182,._controls_azwg4_1 ._thumb-vertical_azwg4_206{position:absolute;top:50%;width:.625em;height:.625em;background:rgb(255,255,255);border-radius:50%;transform:translateY(-50%);transition:opacity .3s ease .3s}._controls_azwg4_1 ._thumb-vertical_azwg4_206{left:0;right:0;margin:0 auto}._controls_azwg4_1 ._segment-background_azwg4_221,._controls_azwg4_1 ._segment-vertical-background_azwg4_222{height:.1666666667em;background-color:rgba(255,255,255,.3)}._controls_azwg4_1 ._segment-vertical-background_azwg4_222{width:.1666666667em;height:100%;margin:0 auto}._controls_azwg4_1 ._segment-highlight-before_azwg4_231,._controls_azwg4_1 ._segment-vertical-highlight-before_azwg4_232{position:absolute;height:.1666666667em;background:rgba(255,255,255,.54)}._controls_azwg4_1 ._segment-highlight-after_azwg4_237,._controls_azwg4_1 ._segment-vertical-highlight-after_azwg4_238{position:absolute;height:.1666666667em;background:rgb(255,255,255)}._controls_azwg4_1 ._segment-vertical-highlight-before_azwg4_232,._controls_azwg4_1 ._segment-vertical-highlight-after_azwg4_238{width:.1666666667em;height:100%;bottom:0}._controls_azwg4_1 ._overlay_azwg4_249{position:absolute;top:0;left:0;width:100%;height:100%;background:center no-repeat;background-size:contain}._controls_azwg4_1 ._overflow_azwg4_258{background-color:rgba(0,0,0,.9);border-radius:4px;position:absolute;right:0;bottom:2.2916666667em;z-index:20;max-height:10.4166666667em;overflow-x:hidden;white-space:nowrap;padding:.375em 0;transition:transform .3s ease-out,opacity .2s linear;transform-origin:right bottom;opacity:1;transform:scale(1);color:#fff}._controls_azwg4_1 ._overflow_azwg4_258._closed_azwg4_275{transform:scale(0);transform-origin:right bottom;opacity:0}._controls_azwg4_1 ._overflow-item_azwg4_280{padding:0 0 0 1.2857142857em;display:flex;align-items:center;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;margin:.375em 0}@media (hover: hover){._controls_azwg4_1 ._error-retry_azwg4_293:hover{border:1px solid #333;cursor:pointer}._controls_azwg4_1 ._overflow-item_azwg4_280:hover{background-color:#212121}._controls_azwg4_1 ._playback-rate_azwg4_300:hover{color:#326bfb}._controls_azwg4_1 ._timeline_azwg4_176:hover ._thumb_azwg4_182{opacity:1}}._controls_azwg4_1 ._overflow-icon_azwg4_307{width:1.5833333333em;height:1.5833333333em;margin-right:.9166666667em;background-size:contain}._controls_azwg4_1 ._overflow-checkbox_azwg4_313{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:.75em;height:.75em;margin:0 .625em;border:none;outline:none}._controls_azwg4_1 ._overflow-checkbox_azwg4_313:checked{background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAyNCAyNCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMjQgMjQ7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDpub25lO30KCS5zdDF7ZmlsbDojNDI4NUY0O30KPC9zdHlsZT4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTAsMGgyNHYyNEgwVjB6Ii8+CjxwYXRoIGNsYXNzPSJzdDEiIGQ9Ik05LDE2LjJMNC44LDEybC0xLjQsMS40TDksMTlMMjEsN2wtMS40LTEuNEw5LDE2LjJ6Ii8+Cjwvc3ZnPgo=)}._controls_azwg4_1 ._overflow-content_azwg4_326{flex-grow:1;display:flex;align-items:center;justify-content:space-between;line-height:1.5714285714em;font-size:.5833333333em;padding:.5em 0;font-weight:400}._controls_azwg4_1 ._loading_azwg4_336{position:absolute;left:50%;top:50%;right:0;bottom:0;pointer-events:none;overflow:hidden;transform:translate(-50%,-50%);width:25%;height:25%;max-width:7.5em;max-height:3.3333333333em;background-color:rgba(0,0,0,.5);border-radius:4px;display:flex;justify-content:center;align-items:center}._controls_azwg4_1 ._spinner_azwg4_355{-webkit-animation:_container-rotate_azwg4_1 1568ms linear infinite;animation:_container-rotate_azwg4_1 1568ms linear infinite;height:100%;width:100%}._controls_azwg4_1 ._spinner_azwg4_355:after{position:absolute;content:" ";top:-25%;left:-25%;width:150%;height:150%}._controls_azwg4_1 ._spinner_azwg4_355:before{position:absolute;content:" ";top:2px;left:2px;right:2px;bottom:2px;border-radius:100%}._controls_azwg4_1 ._kwai-layer_azwg4_378{width:100%;height:100%;white-space:nowrap;-webkit-animation-name:_fill-unfill-rotate_azwg4_1;animation-name:_fill-unfill-rotate_azwg4_1;-webkit-animation-duration:5332ms;animation-duration:5332ms;-webkit-animation-timing-function:cubic-bezier(.4,0,.2,1);animation-timing-function:cubic-bezier(.4,0,.2,1);-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}._controls_azwg4_1 ._spinner-mask-1_azwg4_391{left:-50%}._controls_azwg4_1 ._spinner-mask-2_azwg4_392{right:-50%}._controls_azwg4_1 ._spinner-mask-1_azwg4_391,._controls_azwg4_1 ._spinner-mask-2_azwg4_392{position:absolute;width:100%;height:200%;top:-50%;overflow:hidden}._controls_azwg4_1 ._loading-spinner-frame_azwg4_427,._controls_azwg4_1 ._loading-panel-spinner-frame_azwg4_428{height:100%;width:25%;min-width:20px;overflow:hidden}._controls_azwg4_1 ._loading-spinner-mask-2-bg_azwg4_435{-webkit-animation-name:_mask-2-spin_azwg4_1;animation-name:_mask-2-spin_azwg4_1}._controls_azwg4_1 ._loading_azwg4_336 ._loading-spinner-mask-2-bg_azwg4_435{left:-100%;background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/Pgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMC8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9UUi8yMDAxL1JFQy1TVkctMjAwMTA5MDQvRFREL3N2ZzEwLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgaWQ9ImJvZHlfMSIgd2lkdGg9IjEwMjQiIGhlaWdodD0iNzY4Ij4KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMy45MTgzNjc0IDAgMCAzLjkxODM2NzQgMTI4LjAwMDAzIC0wKSI+CiAgICA8cGF0aCBzdHJva2Utd2lkdGg9IjYiIGQ9Ik05OCA0OUw5OCA1M0MgNzMuMSA1MyA1MyA3My4xIDUzIDk4QyA1MyAxMTYgNjMuNiAxMzEuNiA3OC45IDEzOC44TDc4LjkgMTM4LjhMNzcuMjAwMDA1IDE0Mi40MDAwMUMgNzcuMyAxNDIuNDAwMDEgNzcuNCAxNDIuNTAwMDIgNzcuNTAwMDEgMTQyLjUwMDAyQyA3Ny40MDAwMSAxNDIuNTAwMDIgNzcuMzAwMDEgMTQyLjQwMDAxIDc3LjIwMDAwNSAxNDIuNDAwMDFDIDYwLjUgMTM0LjUgNDkgMTE3LjYgNDkgOThDIDQ5IDcwLjkgNzAuOSA0OSA5OCA0OXoiIHN0cm9rZT0ibm9uZSIgZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJub256ZXJvIiAvPgo8L2c+Cjwvc3ZnPg==);background-position:right center}._controls_azwg4_1 ._loading-spinner-mask-1-bg_azwg4_434{-webkit-animation-name:_mask-1-spin_azwg4_1;animation-name:_mask-1-spin_azwg4_1}._controls_azwg4_1 ._loading-spinner-mask-1-bg_azwg4_434,._controls_azwg4_1 ._loading-spinner-mask-2-bg_azwg4_435{position:absolute;background-repeat:no-repeat;width:200%;height:100%;top:0;-webkit-animation-duration:1333ms;animation-duration:1333ms;-webkit-animation-timing-function:cubic-bezier(.4,0,.2,1);animation-timing-function:cubic-bezier(.4,0,.2,1);-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}._controls_azwg4_1 ._loading_azwg4_336 ._loading-spinner-mask-1-bg_azwg4_434{left:0;background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxOTYgMTk2IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAxOTYgMTk2OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxwYXRoIGZpbGw9IiNmZmYiIHN0cm9rZS13aWR0aD0iNiIgZD0iTTE0Nyw5OGMwLDE5LjYtMTEuNSwzNi41LTI4LjIsNDQuNGwwLDBjLTAuMSwwLTAuMiwwLjEtMC4zLDAuMQoJYzAuMSwwLDAuMi0wLjEsMC4zLTAuMWwtMS43LTMuNkMxMzIuNCwxMzEuNiwxNDMsMTE2LDE0Myw5OGMwLTI0LjktMjAuMS00NS00NS00NXYtNEMxMjUuMSw0OSwxNDcsNzAuOSwxNDcsOTh6Ii8+Cjwvc3ZnPgo=);background-position:left center}._controls_azwg4_1 ._context-menu_azwg4_508{position:absolute;left:0;top:0;color:#fff;z-index:20;background-color:rgba(0,0,0,.9);border-radius:4px}._controls_azwg4_1 ._context-menu-list_azwg4_517{padding:0}._controls_azwg4_1 ._context-menu-item_azwg4_520{cursor:pointer;display:flex;align-items:center;justify-content:space-between;margin:.375em 0}._controls_azwg4_1 ._context-menu-item_azwg4_520:hover{background-color:rgba(255,255,255,.1)}._controls_azwg4_1 ._context-menu-label_azwg4_530{vertical-align:middle;padding:.5em 1.7142857143em;font-weight:400;font-size:.5833333333em;line-height:1.5714285714em;white-space:nowrap}._controls_azwg4_1 ._context-menu-checkbox_azwg4_538{margin:0 .75em 0 0;-webkit-appearance:none;-moz-appearance:none;appearance:none;width:.75em;height:.75em;cursor:pointer}._controls_azwg4_1 ._context-menu-checkbox_azwg4_538:checked{background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+PHN2ZyB0PSIxNjY2MTczNTA3OTc2IiBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHAtaWQ9IjQ0MjUiIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMjUwIiBoZWlnaHQ9IjI1MCI+PHBhdGggZD0iTTgxNy43MjggMTk4LjcybDExMS43NDQgMTE0LjU2LTU0NS4yMTYgNTMyLjEyOC0yODUuOTItMjczLjAyNCAxMTAuNTI4LTExNS43MTIgMTc0LjE3NiAxNjYuMzM2eiIgcC1pZD0iNDQyNiIgZmlsbD0iI2ZmZmZmZiI+PC9wYXRoPjwvc3ZnPg==);background-size:contain}@-webkit-keyframes _container-rotate_azwg4_1{to{transform:rotate(360deg)}}@keyframes _container-rotate_azwg4_1{to{transform:rotate(360deg)}}@-webkit-keyframes _fill-unfill-rotate_azwg4_1{12.5%{transform:rotate(135deg)}25%{transform:rotate(270deg)}37.5%{transform:rotate(405deg)}50%{transform:rotate(540deg)}62.5%{transform:rotate(675deg)}75%{transform:rotate(810deg)}87.5%{transform:rotate(945deg)}to{transform:rotate(1080deg)}}@keyframes _fill-unfill-rotate_azwg4_1{12.5%{transform:rotate(135deg)}25%{transform:rotate(270deg)}37.5%{transform:rotate(405deg)}50%{transform:rotate(540deg)}62.5%{transform:rotate(675deg)}75%{transform:rotate(810deg)}87.5%{transform:rotate(945deg)}to{transform:rotate(1080deg)}}@-webkit-keyframes _mask-1-spin_azwg4_1{0%{transform:rotate(157deg)}50%{transform:rotate(30deg)}to{transform:rotate(157deg)}}@keyframes _mask-1-spin_azwg4_1{0%{transform:rotate(157deg)}50%{transform:rotate(30deg)}to{transform:rotate(157deg)}}@-webkit-keyframes _mask-2-spin_azwg4_1{0%{transform:rotate(-155deg)}50%{transform:rotate(-30deg)}to{transform:rotate(-155deg)}}@keyframes _mask-2-spin_azwg4_1{0%{transform:rotate(-155deg)}50%{transform:rotate(-30deg)}to{transform:rotate(-155deg)}}._controls_azwg4_1 ._error-alert_azwg4_657{display:flex;justify-content:center;align-items:center;flex-direction:column;position:absolute;top:0;left:0;width:100%;height:100%;background-color:rgba(255,255,255,.9)}._controls_azwg4_1 ._error-icon_azwg4_669{height:6.6666666667em;width:6.6666666667em;background-size:100%;background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYwIiBoZWlnaHQ9IjE2MCIgdmlld0JveD0iMCAwIDE2MCAxNjAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxtYXNrIGlkPSJtYXNrMF8yNV8xNTgiIHN0eWxlPSJtYXNrLXR5cGU6YWxwaGEiIG1hc2tVbml0cz0idXNlclNwYWNlT25Vc2UiIHg9IjAiIHk9IjAiIHdpZHRoPSIxNjAiIGhlaWdodD0iMTYwIj4KPHJlY3Qgd2lkdGg9IjE2MCIgaGVpZ2h0PSIxNjAiIGZpbGw9IiNEOUQ5RDkiLz4KPC9tYXNrPgo8ZyBtYXNrPSJ1cmwoI21hc2swXzI1XzE1OCkiPgo8cGF0aCBkPSJNNzMuMzk5OCA2NC44NjRDNzYuNTc3MiA2MC4yMjQ3IDgzLjQyMzEgNjAuMjI0NyA4Ni42MDA1IDY0Ljg2NEwxNDMuMDE2IDE0Ny4yMzdDMTQ2LjY1MyAxNTIuNTQ2IDE0Mi44NTEgMTU5Ljc1NyAxMzYuNDE2IDE1OS43NTdIMjMuNTg0M0MxNy4xNDkzIDE1OS43NTcgMTMuMzQ3NyAxNTIuNTQ2IDE2Ljk4MzkgMTQ3LjIzN0w3My4zOTk4IDY0Ljg2NFoiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl8yNV8xNTgpIi8+CjxwYXRoIGQ9Ik03Mi4zNzE3IDk0LjIwNDhDNzIuMTQwOCA5MS40MjM2IDczLjM0MDIgODguNjE2NyA3NS45MDk3IDg3LjUyNzdDNzcuMDU4MiA4Ny4wNDEgNzguMzExMSA4Ni42NjY3IDc5LjQ0ODYgODYuNjY2N0M4MC41ODYgODYuNjY2NyA4MS44Mzg5IDg3LjA0MSA4Mi45ODc0IDg3LjUyNzdDODUuNTU2OSA4OC42MTY3IDg2Ljc1NjMgOTEuNDIzNiA4Ni41MjU1IDk0LjIwNDhMODQuNTAyNSAxMTguNTgxQzg0LjI1NzcgMTIxLjUzIDgyLjQwODUgMTI0LjUzIDc5LjQ0ODYgMTI0LjUzQzc2LjQ4ODcgMTI0LjUzIDc0LjYzOTUgMTIxLjUzIDc0LjM5NDcgMTE4LjU4MUw3Mi4zNzE3IDk0LjIwNDhaIiBmaWxsPSJ1cmwoI3BhaW50MV9saW5lYXJfMjVfMTU4KSIvPgo8ZWxsaXBzZSBjeD0iNzkuMzg0IiBjeT0iMTM4LjAxNCIgcng9IjUuMDUwNDkiIHJ5PSI1LjM0NzU3IiBmaWxsPSJ3aGl0ZSIvPgo8cGF0aCBkPSJNMTA3LjYxNSA0Ny4xMDYxTDExMy43MjcgMzIuMjc0QzExMy45OTUgMzEuNjI1MyAxMTQuOTU0IDMxLjc3NjcgMTE1LjAwOCAzMi40NzYzTDExNi40NjcgNTEuMjA0MkMxMTYuNTAyIDUxLjY2MjggMTE2LjA3NCA1Mi4wMTkgMTE1LjYzIDUxLjg5OTlMMTEyLjIwNSA1MC45ODIzQzExMS45MTMgNTAuOTA0MSAxMTEuNjA1IDUxLjAzMTkgMTExLjQ1NSA1MS4yOTM3TDEwMy4yMjEgNjUuNjAxOUMxMDIuODg0IDY2LjE4NzUgMTAxLjk5IDY1Ljk1ODEgMTAxLjk3NiA2NS4yODI2TDEwMS42MTQgNDYuOTgxNEMxMDEuNjA1IDQ2LjUzNzcgMTAyLjAyNCA0Ni4yMDk0IDEwMi40NTMgNDYuMzI0M0wxMDYuODI2IDQ3LjQ5NkMxMDcuMTUgNDcuNTgyNyAxMDcuNDg3IDQ3LjQxNTggMTA3LjYxNSA0Ny4xMDYxWiIgZmlsbD0idXJsKCNwYWludDJfbGluZWFyXzI1XzE1OCkiLz4KPGcgZmlsdGVyPSJ1cmwoI2ZpbHRlcjBfZl8yNV8xNTgpIj4KPHBhdGggZD0iTTU3LjA1MzYgNTAuNTk0OEw1My42NzEgNDIuNTA1OUM1My4zOTk1IDQxLjg1NjcgNTQuMTg4NSA0MS4yODQzIDU0LjcyMTQgNDEuNzQzOEw2Mi41NTQ4IDQ4LjQ5ODJDNjIuOTAyNCA0OC43OTc5IDYyLjg1MDMgNDkuMzUwOSA2Mi40NTI4IDQ5LjU4MDRMNjEuMDI3NyA1MC40MDMyQzYwLjc2NTQgNTAuNTU0NiA2MC42MzgyIDUwLjg2MzggNjAuNzE3OSA1MS4xNTZMNjMuMTQ2NyA2MC4wNjA4QzYzLjMyNTEgNjAuNzE0OCA2Mi41MjcxIDYxLjE4NjcgNjIuMDQgNjAuNzE1NEw1NC42OTU1IDUzLjYwOTRDNTQuMzc3MiA1My4zMDE0IDU0LjQ0MjIgNTIuNzc0NCA1NC44MjU4IDUyLjU1MjlMNTYuNzcxOSA1MS40MjkzQzU3LjA2MjQgNTEuMjYxNiA1Ny4xODMxIDUwLjkwNDIgNTcuMDUzNiA1MC41OTQ4WiIgZmlsbD0idXJsKCNwYWludDNfbGluZWFyXzI1XzE1OCkiLz4KPC9nPgo8ZyBmaWx0ZXI9InVybCgjZmlsdGVyMV9mXzI1XzE1OCkiPgo8cGF0aCBkPSJNMjcuMjI3NyA3Ni4yOTUyTDIwLjI1MzggNzAuOTgxNEMxOS42OTQxIDcwLjU1NDkgMjAuMDkxMSA2OS42NjQ3IDIwLjc4MjQgNjkuNzk2MkwzMC45NDM1IDcxLjcyODlDMzEuMzk0NCA3MS44MTQ3IDMxLjYyNTggNzIuMzE5NyAzMS4zOTYzIDcyLjcxNzJMMzAuNTczNSA3NC4xNDIzQzMwLjQyMjEgNzQuNDA0NSAzMC40NjY1IDc0LjczNTkgMzAuNjgxNiA3NC45NDkxTDM3LjIzNzQgODEuNDQ2NkMzNy43MTg5IDgxLjkyMzcgMzcuMjYzOCA4Mi43MzE0IDM2LjYwNjMgODIuNTY2OEwyNi42OTI4IDgwLjA4NUMyNi4yNjMxIDc5Ljk3NzUgMjYuMDU1OSA3OS40ODg2IDI2LjI3NzMgNzkuMTA1TDI3LjQwMSA3Ny4xNTg4QzI3LjU2ODcgNzYuODY4MyAyNy40OTQ0IDc2LjQ5ODUgMjcuMjI3NyA3Ni4yOTUyWiIgZmlsbD0idXJsKCNwYWludDRfbGluZWFyXzI1XzE1OCkiLz4KPC9nPgo8L2c+CjxkZWZzPgo8ZmlsdGVyIGlkPSJmaWx0ZXIwX2ZfMjVfMTU4IiB4PSI1Mi4yODI0IiB5PSI0MC4yNDQzIiB3aWR0aD0iMTIuMjIzMyIgaGVpZ2h0PSIyMS45OTUzIiBmaWx0ZXJVbml0cz0idXNlclNwYWNlT25Vc2UiIGNvbG9yLWludGVycG9sYXRpb24tZmlsdGVycz0ic1JHQiI+CjxmZUZsb29kIGZsb29kLW9wYWNpdHk9IjAiIHJlc3VsdD0iQmFja2dyb3VuZEltYWdlRml4Ii8+CjxmZUJsZW5kIG1vZGU9Im5vcm1hbCIgaW49IlNvdXJjZUdyYXBoaWMiIGluMj0iQmFja2dyb3VuZEltYWdlRml4IiByZXN1bHQ9InNoYXBlIi8+CjxmZUdhdXNzaWFuQmx1ciBzdGREZXZpYXRpb249IjAuNjY2NjY3IiByZXN1bHQ9ImVmZmVjdDFfZm9yZWdyb3VuZEJsdXJfMjVfMTU4Ii8+CjwvZmlsdGVyPgo8ZmlsdGVyIGlkPSJmaWx0ZXIxX2ZfMjVfMTU4IiB4PSIxNy4zMjE2IiB5PSI2Ny4xMTY1IiB3aWR0aD0iMjIuNzgzIiBoZWlnaHQ9IjE4LjEzODgiIGZpbHRlclVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgY29sb3ItaW50ZXJwb2xhdGlvbi1maWx0ZXJzPSJzUkdCIj4KPGZlRmxvb2QgZmxvb2Qtb3BhY2l0eT0iMCIgcmVzdWx0PSJCYWNrZ3JvdW5kSW1hZ2VGaXgiLz4KPGZlQmxlbmQgbW9kZT0ibm9ybWFsIiBpbj0iU291cmNlR3JhcGhpYyIgaW4yPSJCYWNrZ3JvdW5kSW1hZ2VGaXgiIHJlc3VsdD0ic2hhcGUiLz4KPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMS4zMzMzMyIgcmVzdWx0PSJlZmZlY3QxX2ZvcmVncm91bmRCbHVyXzI1XzE1OCIvPgo8L2ZpbHRlcj4KPGxpbmVhckdyYWRpZW50IGlkPSJwYWludDBfbGluZWFyXzI1XzE1OCIgeDE9IjgwLjAwMDIiIHkxPSI1NS4yMjY4IiB4Mj0iODAuMDAwMiIgeTI9IjE5NC42MDEiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0iI0U5RTlFOSIvPgo8c3RvcCBvZmZzZXQ9IjAuNzU1MjA4IiBzdG9wLWNvbG9yPSIjQ0NDRkQ3Ii8+CjwvbGluZWFyR3JhZGllbnQ+CjxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQxX2xpbmVhcl8yNV8xNTgiIHgxPSI3OS40NDg2IiB5MT0iODYuNjY2NyIgeDI9Ijc5LjQ0ODYiIHkyPSIxMjQuNTMiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0id2hpdGUiLz4KPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSJ3aGl0ZSIvPgo8L2xpbmVhckdyYWRpZW50Pgo8bGluZWFyR3JhZGllbnQgaWQ9InBhaW50Ml9saW5lYXJfMjVfMTU4IiB4MT0iMTE0LjMwOCIgeTE9IjI5LjU2MjMiIHgyPSIxMDMuOTU2IiB5Mj0iNjguMTk5MyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgo8c3RvcCBzdG9wLWNvbG9yPSIjRUZGMUY1Ii8+CjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI0RDRTBFNyIvPgo8L2xpbmVhckdyYWRpZW50Pgo8bGluZWFyR3JhZGllbnQgaWQ9InBhaW50M19saW5lYXJfMjVfMTU4IiB4MT0iNTIuMzExOSIgeTE9IjQwLjA1MjUiIHgyPSI2NC44NTkyIiB5Mj0iNjEuNzg1MSIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgo8c3RvcCBzdG9wLWNvbG9yPSIjRUZGMUY1Ii8+CjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI0RDRTBFNyIvPgo8L2xpbmVhckdyYWRpZW50Pgo8bGluZWFyR3JhZGllbnQgaWQ9InBhaW50NF9saW5lYXJfMjVfMTU4IiB4MT0iMTcuODUwMSIgeTE9IjY5LjUzNjIiIHgyPSIzOS41ODI3IiB5Mj0iODIuMDgzNiIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgo8c3RvcCBzdG9wLWNvbG9yPSIjRUZGMUY1Ii8+CjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI0VGRjFGNSIvPgo8L2xpbmVhckdyYWRpZW50Pgo8L2RlZnM+Cjwvc3ZnPgo=)}._controls_azwg4_1 ._error-title_azwg4_675{margin-top:1.5384615385em;font-size:1.0833333333em;font-weight:500;line-height:1.3846153846em}._controls_azwg4_1 ._error-message_azwg4_681{font-size:.9166666667em;font-weight:400;line-height:1.4090909091em;margin:.9166666667em;word-wrap:break-word;word-break:break-all;display:-webkit-box;-webkit-box-orient:vertical;line-clamp:2;-webkit-line-clamp:2;overflow:hidden;max-height:25%}._controls_azwg4_1 ._error-retry_azwg4_293{color:#333;width:7.75em;height:3em;text-align:center;border-radius:.5em;border:1px solid #ccced2;display:flex;justify-content:center;align-items:center;z-index:2}._controls_azwg4_1 ._error-retry_azwg4_293 ._error-retry-icon_azwg4_708{color:#333;width:1.25em;height:1.25em}._controls_azwg4_1 ._error-retry_azwg4_293>span{font-size:.9166666667em;margin-left:.5em;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}._controls_azwg4_1 ._bottom-popup-layer_azwg4_721{position:absolute;left:50%;transform:translate(-50%);bottom:.4166666667em}._controls_azwg4_1 ._panel-playback-list_azwg4_727{margin-bottom:3.3333333333em;text-align:center;padding:.25em 0;background-color:rgba(0,0,0,.9);border-radius:4px}._controls_azwg4_1 ._panel-playback-list_azwg4_727 ._playback-rate_azwg4_300{padding:.5em 1em;cursor:pointer;white-space:nowrap;text-align:left;display:flex;align-items:center;justify-content:center;-webkit-tap-highlight-color:transparent}._controls_azwg4_1 ._panel-playback-list_azwg4_727 ._playback-rate_azwg4_300>div{line-height:1.5454545455em;font-size:.9166666667em}._controls_azwg4_1 ._panel-volume-wrapper_azwg4_748{background-color:rgba(0,0,0,.9);border-radius:4px;margin-bottom:3.3333333333em;width:1.7916666667em;height:6.4166666667em;display:flex;flex-direction:column;align-content:center;justify-content:center;align-items:center;padding:0 0 .5em}._controls_azwg4_1 ._panel-volume-wrapper_azwg4_748 ._volume-text_azwg4_761{height:1.5454545455em;line-height:1.5454545455em;margin:.3636363636em .5454545455em;font-size:.9166666667em}._controls_azwg4_1 ._bottom-popup-layer-low-pos_azwg4_767{margin-bottom:2.2083333333em}._controls_azwg4_1 ._panel-button-tip_azwg4_770{background-color:rgba(0,0,0,.9);border-radius:4px;position:absolute;left:50%;transform:translate(-50%);bottom:3.25em;white-space:nowrap;padding:.5416666667em 1em}._controls_azwg4_1 ._panel-button-tip_azwg4_770 ._text_azwg4_780{line-height:1.5714285714em;font-size:1em}._controls_azwg4_1 ._panel-button-tip-low-pos_azwg4_784{bottom:2.625em}._controls_azwg4_1 ._tooltip_azwg4_787{background-color:rgba(0,0,0,.9);border-radius:4px;position:absolute;left:1.875em;bottom:5.4583333333em;white-space:nowrap;padding:.5416666667em .5em;color:#fff}._controls_azwg4_1 ._tooltip_azwg4_787>div{font-size:.75em;line-height:.8181818182em}._controls_azwg4_1 ._tooltip-low-pos_azwg4_801{bottom:4.7083333333em}._controls_azwg4_1 ._preview_azwg4_804{position:absolute;left:0;bottom:1.5833333333em;background-color:rgba(0,0,0,.3);border-radius:8px;overflow:hidden;display:block;visibility:hidden}._controls_azwg4_1 ._preview_azwg4_804 ._preview-img_azwg4_814{position:relative;transform-origin:0 0;left:0;top:0}._controls_azwg4_1 ._preview_azwg4_804 ._preview-time_azwg4_820{position:absolute;bottom:0;width:100%;height:50%;color:#fff;padding:.25em;background:0 bottom repeat-x linear-gradient(rgba(0,0,0,0),rgba(0,0,0,.8))}._controls_azwg4_1 ._preview_azwg4_804 ._preview-time_azwg4_820>div{position:absolute;text-align:center;left:0;right:0;bottom:.3636363636em;font-weight:500;font-size:.75em}._controls_azwg4_1 ._preview_azwg4_804 ._preview-time-no-img_azwg4_838{position:relative;background:none;width:auto;height:auto}._controls_azwg4_1 ._preview_azwg4_804 ._preview-time-no-img_azwg4_838>div{position:relative;bottom:0;background:none}')), document.head.appendChild(e);
}
} catch (r) {
console.error("vite-plugin-css-injected-by-js", r);
}
})();
var ng = Object.defineProperty, ag = (e, r, n) => r in e ? ng(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, Ni = (e, r, n) => (ag(e, typeof r != "symbol" ? r + "" : r, n), n);
(function() {
try {
if (typeof document < "u") {
var e = document.createElement("style");
e.appendChild(document.createTextNode("")), document.head.appendChild(e);
}
} catch (r) {
console.error("vite-plugin-css-injected-by-js", r);
}
})();
var sg = Object.defineProperty, og = (e, r, n) => r in e ? sg(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, yr = (e, r, n) => (og(e, typeof r != "symbol" ? r + "" : r, n), n);
const cg = "ControlsPlugin", nd = "I18nPlugin", lg = "LoggerPlugin", ug = "HotkeyPlugin", hg = "PlayInfoPlugin", ad = "RotatePlugin", sd = "PreviewPlugin", dg = "MaskPlugin", od = "VRPlugin", cd = "DanmakuPlugin";
var ta = /* @__PURE__ */ ((e) => (e.BOTTOM = "bottom", e.PLAY_BAR = "playBar", e.NONE = "none", e))(ta || {}), Ga = /* @__PURE__ */ ((e) => (e.PLAY_BAR_LEFT = "playBarLeft", e.PLAY_BAR_RIGHT = "playBarRight", e.CONTEXT_MENU = "contextMenu", e))(Ga || {});
let Cr = class extends nn {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static isInstanceOfPlugin(r) {
return typeof r.beforeInstall == "function" && typeof r.afterInstall == "function" && typeof r.beforeUninstall == "function" && typeof r.afterUninstall == "function" && typeof r.getLabel == "function";
}
/**
* 控制条插槽按钮
*/
get controlsSoltBtns() {
}
/**
* 播放器实例化前钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
beforeInstall(r, n) {
}
/**
* 播放器实例化后钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
afterInstall(r, n) {
}
/**
* 播放器销毁前钩子
* @param player 播放器实例
*/
beforeUninstall(r) {
}
/**
* 播放器销毁后钩子
* @param player 播放器实例
*/
afterUninstall(r) {
}
};
yr(Cr, "label"), /**
* 版本
*/
yr(Cr, "version"), /**
* 当前环境是否支持
*/
yr(Cr, "isSupported");
const ld = class ud extends Cr {
/**
* @override
*/
getLabel() {
return ud.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
};
yr(ld, "label", cg);
let fg = ld;
const pg = class hd extends Cr {
/**
* @override
*/
getLabel() {
return hd.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
};
yr(pg, "label", nd);
const _g = class dd extends Cr {
/**
* @override
*/
getLabel() {
return dd.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
/**
* 增加业务相关数据
* @param key 上报数据key
* @param value 上报数据
*/
addBizLog(r, n) {
}
appendSummaryField(r, n) {
}
};
yr(_g, "label", lg);
const Ag = class fd extends Cr {
/**
* @override
*/
getLabel() {
return fd.label;
}
};
yr(Ag, "label", ug);
const vg = class pd extends Cr {
/**
* @override
*/
getLabel() {
return pd.label;
}
};
yr(vg, "label", hg);
const gg = class _d extends Cr {
/**
* @override
*/
getLabel() {
return _d.label;
}
};
yr(gg, "label", ad);
const mg = class Ad extends Cr {
/**
* @override
*/
getLabel() {
return Ad.label;
}
};
yr(mg, "label", sd);
const bg = class vd extends Cr {
/**
* @override
*/
getLabel() {
return vd.label;
}
};
yr(bg, "label", dg);
const Eg = class gd extends Cr {
/**
* @override
*/
getLabel() {
return gd.label;
}
};
yr(Eg, "label", od);
const yg = class md extends Cr {
/**
* @override
*/
getLabel() {
return md.label;
}
};
yr(yg, "label", cd);
var Je = /* @__PURE__ */ ((e) => (e.ERROR = "error", e.MANIFEST_PARSED = "manifestparsed", e.LEVEL_SWITCHING = "levelswitching", e.LEVEL_SWITCHED = "levelswitched", e.LEVEL_SWITCH_PLAYING = "levelswitchplaying", e.LEVEL_SWITCH_FAILED = "levelswitchfailed", e.LEVEL_UPDATED = "levelupdated", e.AUDIO_TRACKS_SWITCHING = "audiotrackswitching", e.AUDIO_TRACKS_SWITCHED = "audiotrackswitched", e.LOADSTART = "loadstart", e.PROGRESS = "progress", e.SUSPEND = "suspend", e.ABORT = "abort", e.EMPTIED = "emptied", e.STALLED = "stalled", e.LOADEDMETADATA = "loadedmetadata", e.LOADEDDATA = "loadeddata", e.CANPLAY = "canplay", e.CANPLAYTHROUGH = "canplaythrough", e.PLAYING = "playing", e.WAITING = "waiting", e.SEEKING = "seeking", e.SEEKED = "seeked", e.ENDED = "ended", e.DURATIONCHANGE = "durationchange", e.TIMEUPDATE = "timeupdate", e.PLAY = "play", e.PAUSE = "pause", e.RATECHANGE = "ratechange", e.RESIZE = "resize", e.VOLUMECHANGE = "volumechange", e.ENTER_PICTURE_IN_PICTURE = "enterpictureinpicture", e.LEAVE_PICTURE_IN_PICTURE = "leavepictureinpicture", e.REPORT = "report", e.VIDEO_RENDERER_CHANGE = "videorendererchange", e.FULLSCREEN_CHANGE = "fullscreenchange", e.ATTRIBUTE_CHANGE = "attribute:change", e.INTERACTION = "interaction", e.LIVE_SHIFT_CHANGE = "liveshiftchange", e.LIVE_SHIFT_TYPE_CHANGE = "liveshifttypechange", e.OBJECT_FIT_CHANGE = "objectfitchange", e.ATTRIBUTE_CHANGE_CONFIG = "attribute:change:config", e.ATTRIBUTE_CHANGE_SRC = "attribute:change:src", e.ATTRIBUTE_CHANGE_VIDEO_ID = "attribute:change:videoid", e.ATTRIBUTE_CHANGE_PREVIEW_URL = "attribute:change:previewurl", e.ATTRIBUTE_CHANGE_MASK_URL = "attribute:change:maskurl", e.ATTRIBUTE_CHANGE_CROSS_ORIGIN = "attribute:change:crossorigin", e.ATTRIBUTE_CHANGE_PRELOAD = "attribute:change:preload", e.ATTRIBUTE_CHANGE_CURRENT_TIME = "attribute:change:currenttime", e.ATTRIBUTE_CHANGE_DEFAULT_PLAYBACK_RATE = "attribute:change:defaultplaybackrate", e.ATTRIBUTE_CHANGE_PLAYBACK_RATE = "attribute:change:playbackrate", e.ATTRIBUTE_CHANGE_AUTOPLAY = "attribute:change:autoplay", e.ATTRIBUTE_CHANGE_LOOP = "attribute:change:loop", e.ATTRIBUTE_CHANGE_CONTROLS = "attribute:change:controls", e.ATTRIBUTE_CHANGE_VOLUME = "attribute:change:volume", e.ATTRIBUTE_CHANGE_MUTED = "attribute:change:muted", e.ATTRIBUTE_CHANGE_DEFAULT_MUTED = "attribute:change:defaultmuted", e.ATTRIBUTE_CHANGE_POSTER = "attribute:change:poster", e.ATTRIBUTE_CHANGE_DISABLE_PICTURE_IN_PICTURE = "attribute:change:disablepictureinpicture", e.ATTRIBUTE_CHANGE_PLAYSINLINE = "attribute:change:playsinline", e.ATTRIBUTE_CHANGE_DISABLE_ADAPTIVE = "attribute:change:disableadaptive", e.ATTRIBUTE_CHANGE_DISABLE_DOWNLOAD = "attribute:change:disabledownload", e.ATTRIBUTE_CHANGE_DISABLE_MASK = "attribute:change:disablemask", e.ATTRIBUTE_CHANGE_DISABLE_HOTKEY = "attribute:change:disablehotkey", e.ATTRIBUTE_CHANGE_DISABLE_DANMAKU = "attribute:change:disabledanmaku", e.ATTRIBUTE_CHANGE_DANMAKU_RENDERING = "attribute:change:danmakurendering", e.ATTRIBUTE_CHANGE_DANMAKU_CONTROLS_POS = "attribute:change:danmakucontrolspos", e.ATTRIBUTE_CHANGE_DANMAKU_CONTROLS_POS_FULLSCREEN = "attribute:change:danmakucontrolsposfullscreen", e.ATTRIBUTE_CHANGE_CURRENT_LEVEL = "attribute:change:currentlevel", e.ATTRIBUTE_CHANGE_NEXT_LEVEL = "attribute:change:nextlevel", e.ATTRIBUTE_CHANGE_CURRENT_FRAME = "attribute:change:currentframe", e.ATTRIBUTE_CHANGE_AUDIO_TRACK = "attribute:change:audiotrack", e.ATTRIBUTE_CHANGE_PREFETCH = "attribute:change:prefetch", e.ATTRIBUTE_CHANGE_SHOW_PROGRESS = "attribute:change:showprogress", e.ATTRIBUTE_CHANGE_SHOW_TIME = "attribute:change:showtime", e.ATTRIBUTE_CHANGE_SHOW_NEXT = "attribute:change:shownext", e.ATTRIBUTE_CHANGE_SHOW_PREV = "attribute:change:showprev", e.ATTRIBUTE_CHANGE_BIZ_DATA = "attribute:change:bizdata", e.ATTRIBUTE_CHANGE_LIVE_TIME = "attribute:change:livetime", e.ATTRIBUTE_CHANGE_SHOW_INFO_PANEL = "attribute:change:showinfopanel", e.CLICK_NEXT = "clicknext", e.CLICK_LOGIN = "clicklogin", e.CLICK_REGISTER = "clickregister", e.CLICK_VIP = "clickvip", e))(Je || {}), gs = /* @__PURE__ */ ((e) => (e.NONE = "none", e.KWAI = "kwai", e.KWAI2 = "kwai2", e))(gs || {}), Xn = /* @__PURE__ */ ((e) => (e.SYSTEM = "system", e.WINDOW = "window", e))(Xn || {}), qe = /* @__PURE__ */ ((e) => (e.PLAY = "play", e.PAUSE = "pause", e.REFRESH = "refresh", e.NEXT = "next", e.TURN_ON_LOOP = "turnOnLoop", e.TURN_OFF_LOOP = "turnOffLoop", e.LOOP = "loop", e.PLAYBACK_RATE_NORMAL = "playbackRateNromal", e.OPTIONS = "options", e.DOWNLOAD = "download", e.VIDEO_TRACK = "videoTrack", e.AUDIO_TRACK = "audioTrack", e.PLAYBACK_RATE = "playbackRate", e.PLAYBACK_RATE_SHORT = "playbackRateShort", e.PICTURE_IN_PICTURE = "pictureInPicture", e.EXIT_PICTURE_IN_PICTURE = "exitPictureInPicture", e.PLAY_INFO = "playInfo", e.MIRROR_IMAGE = "mirrorImage", e.ROTATE = "rotate", e.FULLSCREEN = "fullscreen", e.EXIT_FULLSCREEN = "exitFullscreen", e.WINDOW_FULLSCREEN = "windowFullscreen", e.EXIT_WINDOW_FULLSCREEN = "exitWindowFullscreen", e.AUTO = "auto", e.CURRENT_VOLUME = "currentVolume", e.CURRENTLY_MUTED = "currentlyMuted", e.SWITCH_TO_VIDEO = "switchToVideo", e.SWITCHING_TO_VIDEO = "switchingToVideo", e.SWITCHED_TO_VIDEO = "switchedToVideo", e.SWITCH_TO_AUDIO = "switchToAudio", e.SWITCHING_TO_AUDIO = "switchingToAudio", e.SWITCHED_TO_AUDIO = "switchedToAudio", e.FAIL = "fail", e.ERROR_PANEL_TITLE = "errorPanelTitle", e.ERROR_PANEL_RETRY_BTN = "errorPanelRetryBtn", e.LIVE = "live", e.RETURN_TO_LIVE = "returnToLive", e))(qe || {});
const Cg = {
play: "播放",
pause: "暂停",
refresh: "刷新",
next: "下一个",
turnOnLoop: "打开循环播放",
turnOffLoop: "关闭循环播放",
loop: "循环播放",
playbackRateNromal: "正常",
options: "选项",
download: "下载",
videoTrack: "视频轨",
audioTrack: "音频轨",
playbackRate: "播放速度",
playbackRateShort: "倍速",
pictureInPicture: "画中画",
exitPictureInPicture: "退出画中画",
playInfo: "视频信息",
mirrorImage: "镜像画面",
rotate: "旋转画面",
fullscreen: "全屏",
exitFullscreen: "退出全屏",
windowFullscreen: "网页全屏",
exitWindowFullscreen: "退出网页全屏",
auto: "自动",
currentVolume: "当前音量",
currentlyMuted: "当前静音",
switchToVideo: "切换到",
switchingToVideo: "正在切换",
switchedToVideo: "已切换",
switchToAudio: "切换到",
switchingToAudio: "正在切换",
switchedToAudio: "已切换",
fail: "失败",
errorPanelTitle: "播放出错了",
errorPanelRetryBtn: "点击重试",
live: "直播中",
returnToLive: "返回直播"
};
var ms = /* @__PURE__ */ ((e) => (e.VERSION = "version", e.LOOP = "loop", e.PLAY_INFO = "playInfo", e.MIRROR = "mirror", e.ROTATE = "rotate", e.PIP = "pip", e))(ms || {}), Wi = /* @__PURE__ */ ((e) => (e[e.DEFAULT = 0] = "DEFAULT", e[e.HOVER = 1] = "HOVER", e[e.DISABLED = 2] = "DISABLED", e))(Wi || {});
function La(e, r, n) {
const o = e.findIndex((s) => s.id === n.id);
o >= 0 && (e.splice(o, 1), r([...e]));
}
function Da(e, r, n, o) {
const s = e.findIndex((p) => p.id === n.id);
s < 0 ? (typeof o > "u" ? e.push(n) : e.splice(o, 0, n), r([...e])) : typeof o == "number" && o !== s && (e.splice(s, 1), e.splice(o, 0, n), r([...e]));
}
const Fs = za(void 0), Tg = "adaptive-btns-context", Ig = (e) => {
const { children: r, deps: n } = e, { player: o, text: s } = n, [p, g] = ot([
{
id: ms.VERSION,
name: o.packVersion,
handle: () => {
},
isChecked: !1
}
]), [C, y] = ot([]), [x] = ot([]), h = St({
id: ms.LOOP,
name: s(qe.LOOP),
handle: () => {
h.current.isChecked = o.loop = !o.loop, g([...p]), y([...C]);
},
isChecked: !1
}), F = St({
id: ms.PIP,
name: s(qe.PICTURE_IN_PICTURE),
handle: () => {
document.pictureInPictureElement ? document.exitPictureInPicture() : o.requestPictureInPicture(), y([...C]);
},
isChecked: !1
}), I = () => {
!Ut && o.isPictureInPictureAvailable() && !o.disablePictureInPicture ? (Da(C, y, F.current, 1), Da(p, g, F.current, 1)) : (La(C, y, F.current), La(p, g, F.current));
}, T = () => {
x.forEach((D) => {
D.btns.forEach((W) => {
W.active ? (Da(p, g, W.btn), Da(C, y, W.btn)) : (La(p, g, W.btn), La(C, y, W.btn));
});
});
};
return Un(() => {
o.logger.i(Tg, "init"), I();
const D = () => {
La(p, g, h.current), T();
}, W = () => {
I();
}, j = (z) => {
z.type === "mediaInfo" && !z.value.isLive && Da(p, g, h.current, 1);
}, O = () => {
F.current.isChecked = !0, F.current.name = s(qe.EXIT_PICTURE_IN_PICTURE), y([...C]);
}, K = () => {
F.current.isChecked = !1, F.current.name = s(qe.PICTURE_IN_PICTURE), y([...C]);
};
return o.on(Je.ATTRIBUTE_CHANGE_SRC, D), o.on(Je.ATTRIBUTE_CHANGE_DISABLE_PICTURE_IN_PICTURE, W), o.on(Je.REPORT, j), o.on(Je.ENTER_PICTURE_IN_PICTURE, O), o.on(Je.LEAVE_PICTURE_IN_PICTURE, K), o.getAllPlugins().forEach((z) => {
const B = z.getLabel(), J = x.find(($) => $.id === B), be = z.controlsSoltBtns;
if (J)
J.btns.forEach(($) => $.active = !1), be == null || be.forEach(($, ye) => {
if ($.slotPos === Ga.CONTEXT_MENU && $.getText) {
const Be = `${B}-${ye}`, Ve = J.btns.find((je) => je.btn.id === Be);
Ve && (Ve.active = !0);
}
});
else {
const $ = be == null ? void 0 : be.map((ye, Be) => {
var Ve;
if (ye.slotPos === Ga.CONTEXT_MENU && ye.getText) {
const je = () => {
we.isChecked = ye.getChecked ? ye.getChecked() : !1, g([...p]), y([...C]);
};
(Ve = ye.callback) == null || Ve.add(je);
const we = {
id: `${B}-${Be}`,
name: ye.getText(),
handle: ye.onClick,
isChecked: ye.getChecked ? ye.getChecked() : !1
};
return { btn: we, changeCallback: je, soltBtnInfo: ye, active: !0 };
}
}).filter((ye) => typeof ye < "u");
$ != null && $.length && x.push({
id: B,
btns: $
});
}
}), T(), () => {
o.off(Je.ATTRIBUTE_CHANGE_SRC, D), o.off(Je.ATTRIBUTE_CHANGE_DISABLE_PICTURE_IN_PICTURE, W), o.off(Je.REPORT, j), o.off(Je.ENTER_PICTURE_IN_PICTURE, O), o.off(Je.LEAVE_PICTURE_IN_PICTURE, K), x.forEach((z) => {
z.btns.forEach((B) => {
var J;
(J = B.soltBtnInfo.callback) == null || J.remove(B.changeCallback);
});
});
};
}, []), /* @__PURE__ */ De(
Fs.Provider,
{
value: {
player: o,
contextMenuItems: p,
overflowItems: C
},
children: r
}
);
}, Fn = za(void 0), tn = "controls-context", Rg = (e) => {
const { children: r, deps: n } = e, { player: o, text: s } = n, p = o.logger, [g, C] = ot(!1), [y, x] = ot([]), [h, F] = ot([]), [I, T] = ot(), [D, W] = ot(-1), [j, O] = ot(-1), [K, z] = ot(o.playbackRate), [B, J] = ot(!1), [be, $] = ot(o.muted), [ye, Be] = ot(o.volume), [Ve, je] = ot(!1), [we, ue] = ot(o.paused), [L, w] = ot(o.isFullscreen(Xn.SYSTEM)), [le, oe] = ot(o.isFullscreen(Xn.WINDOW)), [Re, Oe] = ot(!0), [de, X] = ot(o.loop), [ge, Pe] = ot(!1), [ae, q] = ot(!!o.controls), [m, ve] = ot(!!o.isLiveShift), [U, M] = ot(o.liveShiftType), [ne] = ot(o.isFullscreenAvailable()), [Le] = ot(n.options.showWindowFullScreen !== !1), [Ue, re] = ot(!!o.disablePictureInPicture), [k] = ot(n.options.showProgressTime === !0), [P] = ot(n.options.showContextMenu !== !1), Z = wi(() => (U === gs.KWAI || U === gs.KWAI2) && g ? !Ut : !1, [U, g]), he = wi(() => !o.src || !!I, [o.src, I]), Ie = wi(() => !g, [g]), Ee = wi(() => g, [g]), pe = wi(() => !Ut && o.isPictureInPictureAvailable() && !Ue && !Re && ge, [Re, ge, Ue]), G = wi(() => !g && !Ut && n.options.showPlaybackRate !== !1, [g]), te = wi(() => !g && n.options.showPlaybackRate !== !1, [g]), ie = wi(() => typeof o.showProgress > "u" && typeof n.options.showProgress > "u" ? !g || g && Z : (!g || g && Z) && !!(o.showProgress || n.options.showProgress), [g, Z, o.showProgress]), ee = wi(() => o.showTime !== !1 && n.options.showTime !== !1, [o.showTime]), Te = wi(() => !!(o.showNext || n.options.showNext), [g, o.showNext]), Se = wi(() => !!(o.showPrev || n.options.showPrev), [g, o.showPrev]);
Un(() => {
const wt = (Ei) => {
p.i(tn, "manifest parsed");
const qi = [];
if (Ei.levels.forEach((ai, Qt) => {
let rr = ai.qualityLabel || ai.qualityType;
rr || (ai.width && ai.height ? rr = `${Math.min(ai.width, ai.height)}P` : rr = Qt.toString()), qi.push({ val: Qt, label: rr, type: ai.qualityType || "" });
}), qi.reverse(), W(Ei.currentLevel), Ei.auto && qi.length > 1 && (qi.unshift({ val: -1, label: s(qe.AUTO), type: "" }), W(-1)), x(qi), !Ei.audioTracks)
return;
const ui = [];
Ei.audioTracks.forEach((ai, Qt) => {
ui.push({
val: Qt,
label: ai.qualityLabel || ai.qualityType || ai.lang || Qt.toString(),
type: ai.qualityType
});
}), h.reverse(), F(ui), O(Ei.audioTrack || 0), C(!!Ei.isLive);
}, pt = (Ei) => {
Ei.type === "mediaInfo" && C(!!Ei.value.isLive);
}, ri = (Ei) => {
T(Ei), je(!1);
}, yi = () => {
T(void 0), Oe(!!o.canvas);
}, Li = () => {
o.video.readyState > 2 && je(!1);
}, vi = () => {
isFinite(o.duration) && o.duration > 0 && U === gs.NONE && C(!1);
}, Ui = () => z(o.playbackRate), xt = () => J(!0), Ct = () => J(!1), Di = () => {
je(!1), Pe(!1), C(!1);
}, Dt = () => {
T(void 0), z(o.playbackRate);
}, yt = () => {
je(!0);
}, Pt = () => {
je(!0);
}, ei = () => {
je(!1);
}, ki = () => {
mt(), ue(o.paused), je(!1), Pe(!0);
}, Br = () => {
ue(o.paused);
}, mi = () => {
ue(o.paused), Pe(!0);
}, bi = () => {
ue(o.paused);
}, fr = () => {
mt();
}, mt = () => {
$(o.muted || o.volume === 0), Be(o.muted ? 0 : o.volume);
}, jt = ({ isFull: Ei, type: qi }) => {
qi === "window" ? oe(Ei) : (w(Ei), Ei || oe(!1));
}, Qr = () => {
Oe(!!o.canvas);
}, $t = () => {
X(o.loop);
}, si = () => {
q(!!o.controls);
}, Vr = () => {
W(o.currentLevel);
}, ir = () => {
O(o.audioTrack);
}, Zt = () => {
ve(!!o.isLiveShift);
}, Dn = () => {
M(o.liveShiftType);
}, vt = () => {
re(o.disablePictureInPicture);
};
return o.on(Je.ATTRIBUTE_CHANGE_SRC, Di), o.on(Je.EMPTIED, Dt), o.on(Je.WAITING, yt), o.on(Je.SEEKING, Pt), o.on(Je.SEEKED, ei), o.on(Je.PLAYING, ki), o.on(Je.PAUSE, Br), o.on(Je.CANPLAY, mi), o.on(Je.ENDED, bi), o.on(Je.VOLUMECHANGE, fr), o.on(Je.MANIFEST_PARSED, wt), o.on(Je.REPORT, pt), o.on(Je.ERROR, ri), o.on(Je.LOADEDDATA, yi), o.on(Je.TIMEUPDATE, Li), o.on(Je.DURATIONCHANGE, vi), o.on(Je.RATECHANGE, Ui), o.on(Je.ENTER_PICTURE_IN_PICTURE, xt), o.on(Je.LEAVE_PICTURE_IN_PICTURE, Ct), o.on(Je.FULLSCREEN_CHANGE, jt), o.on(Je.VIDEO_RENDERER_CHANGE, Qr), o.on(Je.LIVE_SHIFT_CHANGE, Zt), o.on(Je.LIVE_SHIFT_TYPE_CHANGE, Dn), o.on(Je.ATTRIBUTE_CHANGE_LOOP, $t), o.on(Je.ATTRIBUTE_CHANGE_CONTROLS, si), o.on(Je.ATTRIBUTE_CHANGE_CURRENT_LEVEL, Vr), o.on(Je.ATTRIBUTE_CHANGE_NEXT_LEVEL, Vr), o.on(Je.ATTRIBUTE_CHANGE_AUDIO_TRACK, ir), o.on(Je.ATTRIBUTE_CHANGE_DISABLE_PICTURE_IN_PICTURE, vt), () => {
o.off(Je.ATTRIBUTE_CHANGE_SRC, Di), o.off(Je.EMPTIED, Dt), o.off(Je.WAITING, yt), o.off(Je.SEEKING, Pt), o.off(Je.SEEKED, ei), o.off(Je.PLAYING, ki), o.off(Je.PAUSE, Br), o.off(Je.CANPLAY, mi), o.off(Je.ENDED, bi), o.off(Je.VOLUMECHANGE, fr), o.off(Je.MANIFEST_PARSED, wt), o.off(Je.REPORT, pt), o.off(Je.ERROR, ri), o.off(Je.LOADEDDATA, yi), o.off(Je.TIMEUPDATE, Li), o.off(Je.DURATIONCHANGE, vi), o.off(Je.RATECHANGE, Ui), o.off(Je.ENTER_PICTURE_IN_PICTURE, xt), o.off(Je.LEAVE_PICTURE_IN_PICTURE, Ct), o.off(Je.FULLSCREEN_CHANGE, jt), o.off(Je.VIDEO_RENDERER_CHANGE, Qr), o.off(Je.LIVE_SHIFT_CHANGE, Zt), o.off(Je.LIVE_SHIFT_TYPE_CHANGE, Dn), o.off(Je.ATTRIBUTE_CHANGE_LOOP, $t), o.off(Je.ATTRIBUTE_CHANGE_CONTROLS, si), o.off(Je.ATTRIBUTE_CHANGE_CURRENT_LEVEL, Vr), o.off(Je.ATTRIBUTE_CHANGE_NEXT_LEVEL, Vr), o.off(Je.ATTRIBUTE_CHANGE_AUDIO_TRACK, ir), o.off(Je.ATTRIBUTE_CHANGE_DISABLE_PICTURE_IN_PICTURE, vt);
};
}, []);
const Ye = (wt) => {
p.i(tn, "change level", wt), o.currentLevel = wt, W(wt);
}, ze = (wt) => {
p.i(tn, "change audio level", wt), o.audioTrack = wt, O(wt);
}, it = (wt) => {
p.i(tn, "change playback rate level", wt), o.playbackRate = wt;
}, ct = (wt) => {
o.muted = !1, o.volume = wt;
}, nt = () => {
p.i(tn, "change pip"), document.pictureInPictureElement ? document.exitPictureInPicture() : o.requestPictureInPicture();
}, zt = () => {
p.i(tn, "toggle muted", !o.muted), o.muted = !o.muted;
}, bt = () => {
p.i(tn, "toggle play", o.paused), o.paused ? o.play() : o.pause();
}, Mt = () => {
p.i(tn, "toggle fullscreen"), o.isFullscreen(Xn.SYSTEM) ? o.exitFullscreen() : o.requestFullscreen(Xn.SYSTEM);
}, Kt = () => {
p.i(tn, "toggle windows fullscreen"), o.isFullscreen(Xn.WINDOW) ? o.exitFullscreen() : o.requestFullscreen(Xn.WINDOW);
}, Xt = () => {
p.i(tn, "jump to live"), o.jumpToLive();
}, ni = () => {
p.i(tn, "refresh"), o.refresh();
};
return /* @__PURE__ */ De(
Fn.Provider,
{
value: {
text: s,
player: o,
isLive: g,
/*
* currentTime,
* duration,
* buffered,
*/
currentLevel: D,
currentAudioLevel: j,
levels: y,
audioLevels: h,
error: I,
playbackRate: K,
isInPIP: B,
muted: be,
volume: ye,
waiting: Ve,
paused: we,
isFullscreen: L,
isWindowFullscreen: le,
isCanvasRender: Re,
isLoop: de,
firstFrameReady: ge,
isLiveShift: m,
liveShiftType: U,
liveShiftEnabled: Z,
changeLevel: Ye,
changeAudioLevel: ze,
changePlaybackRate: it,
changeVolume: ct,
// seek,
changePIP: nt,
toggleMuted: zt,
togglePlay: bt,
toggleFullscreen: Mt,
toggleWindowFullscreen: Kt,
refresh: ni,
jumpToLive: Xt,
disabled: he,
controls: ae,
showLoop: Ie,
showRefresh: Ee,
showFullScreen: ne,
showWindowFullScreen: Le,
showPictureInPicture: pe,
showPlaybackRate: G,
showPlaybackRateOverflow: te,
showProgress: ie,
showProgressTime: k,
showTime: ee,
showNext: Te,
showPrev: Se,
showContextMenu: P,
deps: n
},
children: r
}
);
};
class wg {
constructor() {
Ni(this, "_observer"), Ni(this, "_target");
}
start(r, n, o) {
const s = r.getBoundingClientRect().width;
n.forEach((p) => this._updateFontSize(p, s)), this._observer || (this._observer = new Ps((p) => {
o && o(p), p.forEach((g) => {
const { width: C } = g.contentRect;
n.forEach((y) => this._updateFontSize(y, C));
});
}), this._observer.observe(r));
}
stop() {
this._observer && this._target && (this._observer.unobserve(this._target), this._observer.disconnect(), this._observer = void 0);
}
_updateFontSize(r, n) {
n >= 1280 ? r.style.fontSize = "24px" : n >= 640 ? r.style.fontSize = "18px" : n >= 200 ? r.style.fontSize = "12px" : r.style.fontSize = "11px";
}
}
const Lg = "_controls_azwg4_1", Dg = "_disabled_azwg4_97", Sg = "_timeline_azwg4_176", Og = "_thumb_azwg4_182", Ng = "_overlay_azwg4_249", kg = "_overflow_azwg4_258", xg = "_closed_azwg4_275", Mg = "_loading_azwg4_336", Pg = "_spinner_azwg4_355", Ug = "_text_azwg4_780", Bg = "_tooltip_azwg4_787", Vg = "_preview_azwg4_804", Xe = {
controls: Lg,
"video-area": "_video-area_azwg4_14",
"bottom-controls": "_bottom-controls_azwg4_20",
"bottom-controls-bg": "_bottom-controls-bg_azwg4_29",
"sending-area": "_sending-area_azwg4_39",
"sending-area-controls": "_sending-area-controls_azwg4_47",
"button-panel": "_button-panel_azwg4_51",
"button-panel-left": "_button-panel-left_azwg4_57",
"button-panel-right": "_button-panel-right_azwg4_58",
"button-panel-center": "_button-panel-center_azwg4_64",
"panel-button-margins-left": "_panel-button-margins-left_azwg4_75",
"panel-button-margins-right": "_panel-button-margins-right_azwg4_78",
"panel-button-wrapper": "_panel-button-wrapper_azwg4_81",
disabled: Dg,
"panel-button": "_panel-button_azwg4_75",
"panel-button-text": "_panel-button-text_azwg4_105",
"live-shift": "_live-shift_azwg4_111",
"live-shift-chips": "_live-shift-chips_azwg4_114",
"live-shift-button": "_live-shift-button_azwg4_128",
"panel-button-icon": "_panel-button-icon_azwg4_146",
"panel-button-icon-plugin": "_panel-button-icon-plugin_azwg4_150",
"current-time-display": "_current-time-display_azwg4_157",
"time-remaining-display": "_time-remaining-display_azwg4_166",
timeline: Sg,
thumb: Og,
"thumb-drag": "_thumb-drag_azwg4_185",
"segmented-track": "_segmented-track_azwg4_188",
"segmented-vertical-track": "_segmented-vertical-track_azwg4_189",
"thumb-vertical": "_thumb-vertical_azwg4_206",
"segment-background": "_segment-background_azwg4_221",
"segment-vertical-background": "_segment-vertical-background_azwg4_222",
"segment-highlight-before": "_segment-highlight-before_azwg4_231",
"segment-vertical-highlight-before": "_segment-vertical-highlight-before_azwg4_232",
"segment-highlight-after": "_segment-highlight-after_azwg4_237",
"segment-vertical-highlight-after": "_segment-vertical-highlight-after_azwg4_238",
overlay: Ng,
overflow: kg,
closed: xg,
"overflow-item": "_overflow-item_azwg4_280",
"error-retry": "_error-retry_azwg4_293",
"playback-rate": "_playback-rate_azwg4_300",
"overflow-icon": "_overflow-icon_azwg4_307",
"overflow-checkbox": "_overflow-checkbox_azwg4_313",
"overflow-content": "_overflow-content_azwg4_326",
loading: Mg,
spinner: Pg,
"container-rotate": "_container-rotate_azwg4_1",
"kwai-layer": "_kwai-layer_azwg4_378",
"fill-unfill-rotate": "_fill-unfill-rotate_azwg4_1",
"spinner-mask-1": "_spinner-mask-1_azwg4_391",
"spinner-mask-2": "_spinner-mask-2_azwg4_392",
"loading-spinner-frame": "_loading-spinner-frame_azwg4_427",
"loading-panel-spinner-frame": "_loading-panel-spinner-frame_azwg4_428",
"loading-spinner-mask-1-bg": "_loading-spinner-mask-1-bg_azwg4_434",
"loading-spinner-mask-2-bg": "_loading-spinner-mask-2-bg_azwg4_435",
"mask-1-spin": "_mask-1-spin_azwg4_1",
"mask-2-spin": "_mask-2-spin_azwg4_1",
"context-menu": "_context-menu_azwg4_508",
"context-menu-list": "_context-menu-list_azwg4_517",
"context-menu-item": "_context-menu-item_azwg4_520",
"context-menu-label": "_context-menu-label_azwg4_530",
"context-menu-checkbox": "_context-menu-checkbox_azwg4_538",
"error-alert": "_error-alert_azwg4_657",
"error-icon": "_error-icon_azwg4_669",
"error-title": "_error-title_azwg4_675",
"error-message": "_error-message_azwg4_681",
"error-retry-icon": "_error-retry-icon_azwg4_708",
"bottom-popup-layer": "_bottom-popup-layer_azwg4_721",
"panel-playback-list": "_panel-playback-list_azwg4_727",
"panel-volume-wrapper": "_panel-volume-wrapper_azwg4_748",
"volume-text": "_volume-text_azwg4_761",
"bottom-popup-layer-low-pos": "_bottom-popup-layer-low-pos_azwg4_767",
"panel-button-tip": "_panel-button-tip_azwg4_770",
text: Ug,
"panel-button-tip-low-pos": "_panel-button-tip-low-pos_azwg4_784",
tooltip: Bg,
"tooltip-low-pos": "_tooltip-low-pos_azwg4_801",
preview: Vg,
"preview-img": "_preview-img_azwg4_814",
"preview-time": "_preview-time_azwg4_820",
"preview-time-no-img": "_preview-time-no-img_azwg4_838"
}, Fg = Vs(function(e, r) {
const n = sr(Fs);
if (!n)
return /* @__PURE__ */ De(Yi, {});
const { contextMenuItems: o } = n, s = St(0), p = () => {
s.current = +setTimeout(() => {
e.onChangeShowContextMenu();
}, 300);
}, g = () => {
s.current && (clearTimeout(s.current), s.current = 0);
}, C = () => {
g();
}, y = (x) => {
e.onChangeShowContextMenu(), x();
};
return Ft(() => () => {
g();
}, []), /* @__PURE__ */ De(Yi, { children: o.length !== 0 && /* @__PURE__ */ De(
"div",
{
ref: r,
className: Xe["context-menu"],
style: {
left: e.left,
top: e.top,
visibility: e.visible ? "visible" : "hidden"
},
onMouseLeave: p,
onMouseEnter: C,
children: /* @__PURE__ */ De("div", { className: Xe["context-menu-list"], children: o.map(
(x, h) => /* @__PURE__ */ De(
"div",
{
onClick: () => {
y(x.handle);
},
className: Xe["context-menu-item"],
children: [
/* @__PURE__ */ De("div", { className: Xe["context-menu-label"], children: /* @__PURE__ */ De("span", { children: x.name }) }),
/* @__PURE__ */ De(
"input",
{
type: "checkbox",
checked: x.isChecked,
className: Xe["context-menu-checkbox"]
}
)
]
},
h
)
) })
}
) });
});
function jg(e) {
return /* @__PURE__ */ De("svg", { className: e.className, width: "38", height: "38", viewBox: "0 0 38 38", children: /* @__PURE__ */ De("path", { d: "M5.7 6.623v24.333a2.823 2.823 0 004.291 2.41l19.978-12.165a2.823 2.823 0 000-4.822L9.991 4.212A2.823 2.823 0 005.7 6.623z", fill: e.color || "#fff" }) });
}
function Hg(e) {
return /* @__PURE__ */ De("svg", { className: e.className, width: "38", height: "38", viewBox: "0 0 38 38", children: [
/* @__PURE__ */ De("rect", { x: "7", y: "6", width: "6", height: "26", rx: "2", fill: e.color || "#fff" }),
/* @__PURE__ */ De("rect", { x: "25", y: "6", width: "6", height: "26", rx: "2", fill: e.color || "#fff" })
] });
}
function Gg(e) {
return /* @__PURE__ */ De("svg", { className: e.className, width: "38", height: "38", viewBox: "0 0 38 38", children: /* @__PURE__ */ De("path", { d: "M16.808 5.665l-4.565 3.458-3.71.003a5.476 5.476 0 00-5.476 5.476v8.796a5.476 5.476 0 005.476 5.476l3.71.003 4.565 3.457a3.628 3.628 0 005.82-2.89V8.556a3.628 3.628 0 00-5.82-2.892zM19.88 7.39a.076.076 0 01.104.014l.011.02L20 30.303c0 .04-.033.072-.074.072a.076.076 0 01-.045-.015l-5.114-3.772a4.156 4.156 0 00-2.466-.807h-4.15C6.964 25.781 6 24.844 6 23.688v-9.626c0-1.156.963-2.093 2.152-2.093h4.15c.89 0 1.756-.284 2.465-.807l5.114-3.772zm10.485 1.365a1.781 1.781 0 012.354.895c1.39 3.098 2.092 6.219 2.092 9.35 0 3.131-.701 6.252-2.092 9.35a1.781 1.781 0 01-3.25-1.46c1.19-2.648 1.779-5.274 1.779-7.89 0-2.616-.59-5.242-1.779-7.89a1.781 1.781 0 01.896-2.355zm-4.554 3.606a1.781 1.781 0 012.202 1.224c.514 1.8.772 3.606.772 5.415 0 1.81-.258 3.616-.772 5.415a1.781 1.781 0 01-3.425-.979c.424-1.484.635-2.961.635-4.436s-.211-2.952-.635-4.437a1.781 1.781 0 011.223-2.202z", fill: e.color || "#fff" }) });
}
function zg(e) {
return /* @__PURE__ */ De("svg", { className: e.className, width: "38", height: "38", viewBox: "0 0 38 38", fill: "none", children: /* @__PURE__ */ De("path", { d: "M25.313 5.625h2.812a3.75 3.75 0 013.75 3.75v2.813M25.313 31.875h2.812a3.75 3.75 0 003.75-3.75v-2.813M12.188 5.625H9.374a3.75 3.75 0 00-3.75 3.75v2.813M7.5 7.5L15 15M30 7.5L22.5 15M7.5 30l7.5-7.5M30 30l-7.5-7.5M12.188 31.875H9.374a3.75 3.75 0 01-3.75-3.75v-2.813", stroke: e.color || "#fff", strokeWidth: "2.813", strokeLinecap: "round" }) });
}
function Kg(e) {
return /* @__PURE__ */ De("svg", { className: e.className, width: "38", height: "38", viewBox: "0 0 38 38", fill: "none", children: /* @__PURE__ */ De("path", { d: "M28.563 16.938H25.75a3.75 3.75 0 01-3.75-3.75v-2.813M28 21.375h-2.81a3.75 3.75 0 00-3.75 3.75v2.81M10 16.938h2.813a3.75 3.75 0 003.75-3.75v-2.813M7.5 7.5L15 15M30 7.5L22.5 15M7.5 30l7.5-7.5M30 30l-7.5-7.5M10 21.375h2.813a3.75 3.75 0 013.75 3.75v2.813", stroke: e.color || "#fff", strokeWidth: "2.5", strokeLinecap: "round" }) });
}
function Wg(e) {
return /* @__PURE__ */ De("svg", { className: e.className, width: "38", height: "38", viewBox: "0 0 38 38", fill: "none", children: /* @__PURE__ */ De("path", { d: "M25.313 5.625h2.812a3.75 3.75 0 013.75 3.75v2.813M25.313 31.875h2.812a3.75 3.75 0 003.75-3.75v-2.813M12.188 5.625H9.374a3.75 3.75 0 00-3.75 3.75v2.813M12.188 31.875H9.374a3.75 3.75 0 01-3.75-3.75v-2.813", stroke: e.color || "#fff", strokeWidth: "2.813", strokeLinecap: "round" }) });
}
function Yg(e) {
return /* @__PURE__ */ De("svg", { className: e.className, width: "38", height: "38", viewBox: "0 0 38 38", fill: "none", children: /* @__PURE__ */ De("path", { d: "M31.875 12.188h-2.813a3.75 3.75 0 01-3.75-3.75V5.624M31.875 25.313h-2.813a3.75 3.75 0 00-3.75 3.75v2.812M5.625 12.188h2.813a3.75 3.75 0 003.75-3.75V5.624M5.625 25.313h2.813a3.75 3.75 0 013.75 3.75v2.812", stroke: e.color || "#fff", strokeWidth: "2.5", strokeLinecap: "round" }) });
}
function Qg(e) {
return /* @__PURE__ */ De("svg", { className: e.className, width: "38", height: "38", viewBox: "0 0 38 38", children: /* @__PURE__ */ De("path", { d: "M8.438 18.75a2.813 2.813 0 11-5.626 0 2.813 2.813 0 015.626 0zm13.124 0a2.813 2.813 0 11-5.625 0 2.813 2.813 0 015.626 0zm10.313 2.813a2.813 2.813 0 100-5.626 2.813 2.813 0 000 5.626z", fill: e.color || "#fff" }) });
}
function Xg(e) {
const r = e.color || "#fff";
return /* @__PURE__ */ De("svg", { className: e.className, width: "38", height: "39", viewBox: "0 0 38 38", children: [
/* @__PURE__ */ De("path", { d: "M16.808 6.29l-4.565 3.458-3.71.003a5.476 5.476 0 00-5.476 5.476v8.796A5.476 5.476 0 008.533 29.5l3.71.003 4.565 3.457a3.628 3.628 0 005.82-2.89V9.181a3.628 3.628 0 00-5.82-2.892zm3.073 1.725a.076.076 0 01.104.014l.011.02L20 30.928c0 .04-.033.072-.074.072a.076.076 0 01-.045-.015l-5.114-3.772a4.156 4.156 0 00-2.466-.807h-4.15C6.964 26.406 6 25.47 6 24.313v-9.626c0-1.156.963-2.093 2.152-2.093h4.15c.89 0 1.756-.284 2.465-.807l5.114-3.772zM30.366 9.38a1.781 1.781 0 012.354.895c1.39 3.098 2.092 6.219 2.092 9.35 0 3.131-.701 6.252-2.092 9.35a1.781 1.781 0 01-3.25-1.46c1.19-2.648 1.779-5.274 1.779-7.89 0-2.616-.59-5.242-1.779-7.89a1.781 1.781 0 01.896-2.355zm-4.554 3.606a1.781 1.781 0 012.202 1.224c.514 1.8.772 3.606.772 5.415 0 1.81-.258 3.616-.772 5.415a1.781 1.781 0 01-3.425-.979c.424-1.484.635-2.961.635-4.436s-.211-2.952-.635-4.437a1.781 1.781 0 011.223-2.202z", fill: r }),
/* @__PURE__ */ De("path", { d: "M4 5l29.5 26.5", stroke: r, strokeWidth: "2.5", strokeLinecap: "round" })
] });
}
function $g(e) {
return /* @__PURE__ */ De("svg", { className: e.className, width: "38", height: "38", viewBox: "0 0 38 38", children: /* @__PURE__ */ De("path", { d: "M22.659 14.9l8.505.17a1.622 1.622 0 001.664-1.577L33 5.108a1.2 1.2 0 00-1.185-1.216l-.827-.017a1.202 1.202 0 00-1.233 1.168l-.077 3.75a15.432 15.432 0 00-10.404-4.037C10.852 4.756 4 11.51 4 19.816c0 8.303 6.852 15.059 15.274 15.059 2.683 0 5.323-.696 7.633-2.013a15.298 15.298 0 004.741-4.217 1.181 1.181 0 00-.359-1.718l-.99-.587a1.219 1.219 0 00-1.596.312 11.734 11.734 0 01-3.582 3.162 11.823 11.823 0 01-5.847 1.541c-6.453 0-11.704-5.177-11.704-11.54 0-6.363 5.25-11.54 11.704-11.54a11.82 11.82 0 018.419 3.525l-4.969-.099a1.202 1.202 0 00-1.233 1.168l-.017.815A1.2 1.2 0 0022.66 14.9z", fill: e.color || "#fff" }) });
}
function Zg(e) {
return /* @__PURE__ */ De("svg", { className: e.className, width: "30", height: "30", viewBox: "0 0 30 30", fill: "none", children: /* @__PURE__ */ De("path", { d: "M9.0625 12.0312H1.9375C1.46508 12.0312 1.01202 11.8436 0.677966 11.5095C0.343917 11.1755 0.15625 10.7224 0.15625 10.25V3.125C0.15625 2.65258 0.343917 2.19951 0.677966 1.86547C1.01202 1.53142 1.46508 1.34375 1.9375 1.34375C2.40992 1.34375 2.86299 1.53142 3.19703 1.86547C3.53108 2.19951 3.71875 2.65258 3.71875 3.125V5.18234C6.19023 2.74797 9.99617 0.15625 15 0.15625C21.5995 0.15625 25.5925 4.07352 25.7602 4.23977C26.0905 4.57413 26.2752 5.02546 26.2742 5.49542C26.2731 5.96538 26.0864 6.41589 25.7547 6.74879C25.423 7.0817 24.9731 7.27001 24.5032 7.27271C24.0332 7.27541 23.5812 7.09227 23.2457 6.7632C23.1804 6.70086 20.0469 3.71875 15 3.71875C10.6953 3.71875 7.43859 6.34313 5.5 8.46875H9.0625C9.53492 8.46875 9.98799 8.65642 10.322 8.99047C10.6561 9.32451 10.8437 9.77758 10.8438 10.25C10.8437 10.7224 10.6561 11.1755 10.322 11.5095C9.98799 11.8436 9.53492 12.0312 9.0625 12.0312ZM28.0625 17.9688H20.9375C20.4651 17.9688 20.012 18.1564 19.678 18.4905C19.3439 18.8245 19.1562 19.2776 19.1562 19.75C19.1562 20.2224 19.3439 20.6755 19.678 21.0095C20.012 21.3436 20.4651 21.5312 20.9375 21.5312H24.5C22.5703 23.6569 19.3047 26.2812 15 26.2812C9.95312 26.2812 6.81961 23.2991 6.7543 23.2353C6.41877 22.9062 5.96679 22.7231 5.49683 22.7258C5.02688 22.7285 4.57703 22.9168 4.2453 23.2497C3.91358 23.5826 3.72685 24.0331 3.72582 24.5031C3.72478 24.9731 3.90951 25.4244 4.23977 25.7587C4.4075 25.9265 8.40047 29.8438 15 29.8438C20.0038 29.8438 23.8098 27.252 26.2812 24.8177V26.875C26.2812 27.3474 26.4689 27.8005 26.803 28.1345C27.137 28.4686 27.5901 28.6562 28.0625 28.6562C28.5349 28.6562 28.988 28.4686 29.322 28.1345C29.6561 27.8005 29.8438 27.3474 29.8438 26.875V19.75C29.8438 19.2776 29.6561 18.8245 29.322 18.4905C28.988 18.1564 28.5349 17.9688 28.0625 17.9688Z", fill: e.color || "#fff" }) });
}
function qg(e) {
const r = e.color || "#fff";
return /* @__PURE__ */ De("svg", { className: e.className, width: "38", height: "38", viewBox: "0 0 38 38", fill: "none", children: [
/* @__PURE__ */ De("rect", { x: "16.15", y: "22.225", width: "19", height: "12.35", rx: "4", fill: r }),
/* @__PURE__ */ De("path", { d: "M32.3 18.426v-8.351a4 4 0 00-4-4H9.7a4 4 0 00-4 4v16.7a4 4 0 004 4h3.6M10.925 11.3l7.6 7.6m0 0v-5.7m0 5.7H13.3", stroke: r, strokeWidth: "2.5", strokeLinecap: "round" })
] });
}
function Jg(e) {
const r = e.color || "#fff";
return /* @__PURE__ */ De("svg", { className: e.className, width: "38", height: "38", viewBox: "0 0 38 38", fill: "none", children: [
/* @__PURE__ */ De("rect", { x: "16.15", y: "21.85", width: "19", height: "12.35", rx: "4", fill: r }),
/* @__PURE__ */ De("path", { d: "M32.3 18.05V9.7a4 4 0 00-4-4H9.7a4 4 0 00-4 4v16.7a4 4 0 004 4h3.6M18.525 18.525l-7.6-7.6m0 0v5.7m0-5.7h5.225", stroke: r, strokeWidth: "2.5", strokeLinecap: "round" })
] });
}
function em(e) {
return /* @__PURE__ */ De("svg", { className: e.className, width: "38", height: "38", viewBox: "0 0 38 38", fill: "none", children: /* @__PURE__ */ De("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M21.326 10H11.69a3.94 3.94 0 00-3.94 3.94v9.747a3.94 3.94 0 003.94 3.94h9.636l.27-.01a3.943 3.943 0 003.521-2.855l.075-.32 1.18.78a2.5 2.5 0 003.878-2.085V14.49a2.5 2.5 0 00-.415-1.379l-.142-.194a2.5 2.5 0 00-3.322-.512l-1.18.777-.005-.034A3.941 3.941 0 0021.326 10zm-9.636 2.563h9.636c.76 0 1.377.617 1.377 1.377l-.002 1.577.011.175a1.282 1.282 0 001.977.895l2.997-1.98v8.412l-2.997-1.98a1.282 1.282 0 00-1.988 1.07l.002 1.58c0 .758-.617 1.374-1.377 1.374H11.69c-.76 0-1.377-.616-1.377-1.376V13.94c0-.76.617-1.377 1.377-1.377zm2.81 5.687a1.5 1.5 0 100-3 1.5 1.5 0 000 3z", fill: e.color || "#fff" }) });
}
function tm(e) {
return /* @__PURE__ */ De("svg", { className: e.className, width: "38", height: "38", viewBox: "0 0 38 38", fill: "none", children: /* @__PURE__ */ De("path", { d: "M21.564 21.01c-.342 0-.692.017-1.061.038-.399.024-.824.05-1.3.05-.58 0-1.049.468-1.049 1.048v2.908L11.344 19l6.81-6.054v2.908c0 .58.469 1.049 1.049 1.049 4.5 0 7.043 3.02 7.884 6.477-2.407-1.99-3.87-2.37-5.523-2.37zm-2.361 7.427a1.047 1.047 0 001.049-1.049v-4.225c.127-.006.252-.015.375-.022 2.04-.12 3.17-.187 7.091 3.645a1.048 1.048 0 001.782-.75c0-5.285-3.171-10.632-9.249-11.183V10.61a1.047 1.047 0 00-1.745-.783L9.07 18.217a1.046 1.046 0 000 1.566l9.437 8.39c.196.173.445.265.697.265z", fill: e.color || "#fff" }) });
}
const iu = 64;
function im(e) {
const r = sr(Fn);
if (!r)
return /* @__PURE__ */ De(Yi, {});
const { deps: { text: n }, refresh: o } = r, s = () => {
o();
}, p = wi(() => e.message.length > iu ? e.message.substring(0, iu) : e.message, [e.message]);
return /* @__PURE__ */ De("div", { className: Xe["error-alert"], children: [
/* @__PURE__ */ De("div", { className: Xe["error-icon"] }),
/* @__PURE__ */ De("div", { className: Xe["error-title"], children: n(qe.ERROR_PANEL_TITLE) }),
/* @__PURE__ */ De("div", { className: Xe["error-message"], children: [
e.code,
" ",
p
] }),
/* @__PURE__ */ De("div", { className: Xe["error-retry"], onClick: s, children: [
/* @__PURE__ */ De(
Zg,
{
color: "#333",
className: Xe["error-retry-icon"]
}
),
/* @__PURE__ */ De("span", { children: n(qe.ERROR_PANEL_RETRY_BTN) })
] })
] });
}
function rm() {
return /* @__PURE__ */ De(
"div",
{
className: Xe.loading,
children: /* @__PURE__ */ De(
"div",
{
className: Xe["loading-spinner-frame"],
children: /* @__PURE__ */ De("div", { className: Xe.spinner, children: /* @__PURE__ */ De("div", { className: Xe["kwai-layer"], children: [
/* @__PURE__ */ De("div", { className: Xe["spinner-mask-1"], children: /* @__PURE__ */ De(
"div",
{
className: Xe["loading-spinner-mask-1-bg"]
}
) }),
/* @__PURE__ */ De("div", { className: Xe["spinner-mask-2"], children: /* @__PURE__ */ De(
"div",
{
className: Xe["loading-spinner-mask-2-bg"]
}
) })
] }) })
}
)
}
);
}
const Os = [
{ val: 2, label: "2.0" },
{ val: 1.5, label: "1.5" },
{ val: 1.25, label: "1.25" },
{ val: 1, label: "正常" },
{ val: 0.75, label: "0.75" },
{ val: 0.5, label: "0.5" }
], _c = za(void 0), nm = (e) => {
var r;
const { children: n, deps: { player: o } } = e, [s, p] = ot(o.currentTime), [g, C] = ot(o.duration), y = { st: 0, ed: 0 };
o.buffered && o.buffered.length && (y.st = o.buffered.start(0), y.ed = (r = o.buffered) == null ? void 0 : r.end(0));
const [x, h] = ot(y), F = wi(() => {
const B = Number.isFinite(g) && g || x.ed;
return B ? x.ed / B * 100 : 0;
}, [g, x]), I = wi(() => {
const B = Number.isFinite(g) && g || x.ed;
return B ? s / B * 100 : 0;
}, [s, g, x]), T = mr((B) => {
o.duration !== 1 / 0 && (o.currentTime = B, p(o.currentTime));
}, [o]), D = mr(() => {
C(o.duration);
}, [o]), W = mr(() => {
var B, J, be;
(B = o.buffered) != null && B.length && h({ st: (J = o.buffered) == null ? void 0 : J.start(0), ed: (be = o.buffered) == null ? void 0 : be.end(0) });
}, [o]), j = mr(() => {
p(o.currentTime);
}, [o]), O = mr(() => {
C(o.duration);
}, [o]), K = mr(() => {
p(0), C(0), h({ st: 0, ed: 0 });
}, [o]), z = mr(() => {
p(o.currentTime);
}, [o]);
return Un(() => (o.on(Je.ATTRIBUTE_CHANGE_SRC, K), o.on(Je.LOADEDDATA, D), o.on(Je.TIMEUPDATE, j), o.on(Je.PROGRESS, W), o.on(Je.DURATIONCHANGE, O), o.on(Je.SEEKING, z), () => {
o.off(Je.ATTRIBUTE_CHANGE_SRC, K), o.off(Je.LOADEDDATA, D), o.off(Je.TIMEUPDATE, j), o.off(Je.PROGRESS, W), o.off(Je.DURATIONCHANGE, O), o.off(Je.SEEKING, z);
}), []), /* @__PURE__ */ De(
_c.Provider,
{
value: {
player: o,
currentTime: s,
currentTimePercent: I,
duration: g,
buffered: x,
bufferedPercent: F,
seek: T
},
children: n
}
);
}, bd = za(void 0), am = (e) => /* @__PURE__ */ De(
bd.Provider,
{
value: {
panelHover: e.panelHover,
setPanelHover: e.setPanelHover,
dragProgress: e.dragProgress,
setDragProgress: e.setDragProgress,
floatLayerId: e.floatLayerId,
setFloatLayerId: e.setFloatLayerId,
height: e.height,
width: e.width,
container: e.container
},
children: e.children
}
), wn = "#FFF", sm = {
[Wi.DEFAULT]: [wn],
[Wi.HOVER]: ["#1280FF"],
[Wi.DISABLED]: [wn]
}, ii = (e) => e ? sm[e] || [wn] : [wn], om = Vs((e, r) => {
const n = sr(Fn);
if (!n)
return /* @__PURE__ */ De(Yi, {});
const { text: o, isLiveShift: s } = n, { disabled: p, className: g } = e, C = r && r ? r : St(null), [y, x] = ot(Wi.DEFAULT), [h, F] = ot(!1), I = () => {
n.jumpToLive();
}, T = () => {
e.disabled || Ut || (x(Wi.HOVER), F(!0));
}, D = () => {
x(Wi.DEFAULT), F(!1);
};
return Ft(() => {
p || x(Wi.DEFAULT);
}, [s]), Ft(() => {
p && x(Wi.DEFAULT);
}, [p]), /* @__PURE__ */ De(
"div",
{
ref: C,
"data-kp-role": e["data-kp-role"],
className: [g, p ? Xe.disabled : ""].join(" "),
children: [
!s && /* @__PURE__ */ De("div", { className: Xe["live-shift-chips"], children: [
/* @__PURE__ */ De(
em,
{
color: wn,
className: Xe["panel-button-icon"]
}
),
/* @__PURE__ */ De(
"div",
{
className: Xe["panel-button-text"],
style: { color: wn },
children: o(qe.LIVE)
}
)
] }),
s && /* @__PURE__ */ De(
"div",
{
className: [Xe["live-shift-button"], p ? Xe.disabled : ""].join(" "),
onMouseEnter: T,
onMouseLeave: D,
onClick: I,
style: y === Wi.HOVER ? { borderColor: ii(y)[0] } : {},
children: [
/* @__PURE__ */ De(
tm,
{
color: ii(y)[0] || wn,
className: Xe["panel-button-icon"]
}
),
/* @__PURE__ */ De(
"div",
{
className: Xe["panel-button-text"],
style: { color: ii(y)[0] || wn },
children: o(qe.RETURN_TO_LIVE)
}
)
]
}
)
]
}
);
}), cm = Vs(function(e, r) {
const n = sr(Fn), o = sr(Fs);
if (!n || !o)
return;
const { overflowItems: s } = o, p = r && r ? r : St(null), [g, C] = ot(!1), y = /* @__PURE__ */ De(
yo,
{
checkedValue: n.playbackRate,
onBack: () => C(!1),
levels: Os.map((B) => (B.val === 1 && (B.label = n.text(qe.PLAYBACK_RATE_NORMAL)), B)),
onCheck: (B) => {
O(B), C(!1), e.onClose();
},
text: n.text
}
), [x, h] = ot(!1), F = /* @__PURE__ */ De(
yo,
{
checkedValue: n.currentLevel,
onBack: () => h(!1),
levels: n.levels,
onCheck: (B) => {
K(B), h(!1), e.onClose();
},
text: n.text
}
), [I, T] = ot(!1), D = /* @__PURE__ */ De(
yo,
{
checkedValue: n.currentAudioLevel,
onBack: () => T(!1),
levels: n.audioLevels,
onCheck: (B) => {
z(B), T(!1), e.onClose();
},
text: n.text
}
), [W, j] = ot(!1);
Ft(() => {
const B = e.showOverflow && (g || x || I);
j(B);
const J = p;
if (B && J.current) {
const { height: be } = J.current.getBoundingClientRect();
let $ = 0;
g ? $ = Os.findIndex((ye) => ye.val === n.playbackRate) || 0 : x ? $ = n.levels.findIndex((ye) => ye.val === n.currentLevel) || 0 : I && ($ = n.audioLevels.findIndex((ye) => ye.val === n.currentAudioLevel) || 0), J.current.scrollTop = ($ + 1) * 50 - (be - 50) / 2;
}
!B && J.current && (J.current.scrollTop = 0);
}, [
e.showOverflow,
g,
x,
I
]), Ft(() => {
e.showOverflow || (C(!1), h(!1), T(!1));
}, [e.showOverflow]);
const O = (B) => {
n.changePlaybackRate(B), e.onClose();
}, K = (B) => {
n.changeLevel(B), e.onClose();
}, z = (B) => {
n.changeAudioLevel(B), e.onClose();
};
return /* @__PURE__ */ De(
"div",
{
className: [Xe.overflow, e.className].join(" "),
ref: p,
style: { maxHeight: e.overflowMaxheight },
"data-kp-role": "overflow",
children: [
g && y,
x && F,
I && D,
n.levels.length > 1 && !W && /* @__PURE__ */ De(
oa,
{
"data-kp-role": "video-btn",
onClick: (B) => {
B.stopPropagation(), h(!0);
},
children: [
n.text(qe.VIDEO_TRACK),
/* @__PURE__ */ De("span", { style: { paddingLeft: "18px" } })
]
}
),
n.audioLevels.length > 1 && !W && /* @__PURE__ */ De(
oa,
{
"data-kp-role": "audio-btn",
onClick: (B) => {
B.stopPropagation(), T(!0);
},
children: [
n.text(qe.AUDIO_TRACK),
/* @__PURE__ */ De("span", { style: { paddingLeft: "18px" } })
]
}
),
n.showPlaybackRateOverflow && !W && /* @__PURE__ */ De(
oa,
{
onClick: (B) => {
B.stopPropagation(), C(!0);
},
"data-kp-role": "rate-btn",
children: [
n.text(qe.PLAYBACK_RATE),
/* @__PURE__ */ De("span", { style: { paddingLeft: "18px" } })
]
}
),
s && !W && s.map((B, J) => /* @__PURE__ */ De(
oa,
{
"data-kp-role": "inline-btn",
onClick: () => {
e.onClose(), B.handle();
},
icon: B.icon ? B.icon() : "",
checked: B.isChecked,
type: "checkbox",
children: B.name
},
J
))
]
}
);
});
function yo(e) {
return /* @__PURE__ */ De(Yi, { children: [
/* @__PURE__ */ De(
oa,
{
onClick: (r) => {
r.stopPropagation(), e.onBack();
},
children: e.text(qe.OPTIONS)
},
0
)
].concat(
e.levels.map((r, n) => /* @__PURE__ */ De(
oa,
{
type: "checkbox",
checked: e.checkedValue === r.val,
onClick: () => {
e.onCheck(r.val);
},
children: r.label
},
n + 1
))
) });
}
function oa(e) {
return (
// role要传进来
/* @__PURE__ */ De(
"div",
{
className: Xe["overflow-item"],
onClick: e.onClick,
"data-kp-role": e["data-kp-role"],
children: [
/* @__PURE__ */ De("div", { className: Xe["overflow-content"], children: /* @__PURE__ */ De("span", { children: e.children }) }),
e.type === "checkbox" && /* @__PURE__ */ De(
"input",
{
type: "checkbox",
className: Xe["overflow-checkbox"],
checked: e.checked
}
)
]
}
)
);
}
const rn = Vs((e, r) => {
const { disabled: n, className: o, text: s, onChildrenVisibilityChange: p, tip: g, lowTipPos: C, resetOnClick: y, childrenVisibility: x } = e, h = r && r ? r : St(null), [F, I] = ot(Wi.DEFAULT), [T, D] = ot(!1), W = St(0), [j, O] = ot(!1);
Ft(() => {
e.childrenVisibility === !1 && O(!1);
}, [e.childrenVisibility]);
const K = () => {
W.current && (clearTimeout(W.current), W.current = 0);
}, z = St(null), B = (ye) => {
!n && e.onClick && e.onClick(ye), (y || z.current && ye.target && z.current.contains(ye.target)) && (D(!1), Ut || I(Wi.DEFAULT));
}, J = () => {
if (e.disabled)
return;
Ut || (I(Wi.HOVER), D(!0));
const ye = !j;
O(!0), e.children && ye && p && p(!0, e.id), K();
}, be = () => {
I(Wi.DEFAULT), D(!1), e.children && (W.current = +setTimeout(() => {
O(!1), p && p(!1, e.id);
}, 300));
}, $ = () => {
if (e.disabled)
return;
Ut || (I(Wi.HOVER), D(!0));
const ye = !j;
O(!0), e.children && ye && p && p(!0, e.id), K();
};
return Ft(() => {
const ye = (Be) => {
if (e.children && !("current" in h && h.current && (h.current === Be.target || h.current.contains(Be.target)))) {
const Ve = j;
O(!1), e.children && Ve && p && p(!1, e.id), I(Wi.DEFAULT);
}
};
return e.children && document.addEventListener("click", ye), () => e.children && document.removeEventListener("click", ye);
}, [j]), Ft(() => {
(n || !x) && I(Wi.DEFAULT);
}, [n, x]), Ft(() => () => {
K();
}, []), /* @__PURE__ */ De(
"div",
{
ref: h,
"data-kp-role": e["data-kp-role"],
onMouseEnter: J,
onMouseLeave: be,
onMouseMove: $,
onClick: B,
className: [Xe["panel-button-wrapper"], o, n ? Xe.disabled : ""].join(" "),
children: [
j && e.children,
g && T && /* @__PURE__ */ De("div", { "data-kp-role": e["data-kp-role"] ? `${e["data-kp-role"]}-tip` : "btn-tip", className: [Xe["panel-button-tip"], C ? Xe["panel-button-tip-low-pos"] : ""].join(" "), children: /* @__PURE__ */ De("div", { className: Xe.text, children: g }) }),
e.icon && e.icon(F),
s && /* @__PURE__ */ De(
"div",
{
className: Xe["panel-button-text"],
style: { color: e.color ? e.color(F) : wn },
children: s
}
)
]
}
);
});
function lm(e) {
const r = sr(Fn), n = sr(_c);
if (!r || !n)
return /* @__PURE__ */ De(Yi, {});
const { deps: { pluginRotate: o, pluginPreview: s } } = r, p = St(null), g = St(0), [C, y] = ot(0), [x, h] = ot(!1), [F, I] = ot(0);
Ft(() => {
if (j.current) {
const { width: ue } = j.current.getBoundingClientRect();
I(ue / 2);
}
}), Ft(() => {
e.previewVisibility === !1 && (D.current = !1, Be());
}, [e.previewVisibility]);
const T = (ue) => {
if (!D.current || e.disabled || !p)
return;
ue.defaultPrevented && ue.preventDefault();
const L = ue instanceof MouseEvent ? ue.clientX : ue.changedTouches[0].clientX, w = ue instanceof MouseEvent ? ue.clientY : ue.changedTouches[0].clientY, le = p.current, oe = p.current;
if ((D || ue instanceof PointerEvent || Ut && ue instanceof MouseEvent) && le && oe) {
let Re = 0;
const { top: Oe, left: de, width: X, height: ge } = oe.getBoundingClientRect();
(o == null ? void 0 : o.outerRotate) === 90 ? Re = (w - Oe) / ge : (o == null ? void 0 : o.outerRotate) === 180 ? Re = (X - (L - de)) / X : (o == null ? void 0 : o.outerRotate) === 270 ? Re = (ge - (w - Oe)) / ge : o != null && o.outerRotate || (Re = (L - de) / X), Re > 1 && (Re = 1), Re < 0 && (Re = 0), je(Re), g.current = Re, y(Re * 100), e.onChange && e.onChange(Re);
}
};
Ft(() => {
const ue = () => {
D.current && e.onChangeEnd && e.onChangeEnd(g.current), D.current = !1, W.current || Ve();
}, L = () => {
W.current = !1, ue();
}, w = (le) => {
T(le);
};
return document.addEventListener("mouseup", ue), document.addEventListener("mouseleave", L), document.addEventListener("touchend", ue), document.addEventListener("mousemove", w, !0), document.addEventListener("touchmove", w, !0), () => {
document.removeEventListener("mouseup", ue), document.removeEventListener("mouseleave", L), document.removeEventListener("touchend", ue), document.removeEventListener("mousemove", w, !0), document.removeEventListener("touchmove", w, !0);
};
}, [r, n]);
const D = St(!1), W = St(!1), j = St(null), O = (ue) => {
e.disabled || (D.current = !0, ue.stopImmediatePropagation(), T(ue));
}, K = (ue) => {
if (!e.disabled && ue instanceof MouseEvent) {
W.current = !0;
const L = ue.currentTarget, { left: w, width: le } = L.getBoundingClientRect(), oe = (ue.clientX - w) / le;
D.current || je(oe), e.onMouseMove && e.onMouseMove(oe, D.current);
}
}, z = () => {
W.current = !1, e.onMouseLeave && e.onMouseLeave(D.current), D.current || Ve();
}, B = St(null), J = St(null), [be, $] = ot(""), ye = St(0), Be = () => {
ye.current && (clearTimeout(ye.current), ye.current = 0);
}, Ve = () => {
Be();
const ue = B.current && B.current.style.visibility !== "hidden";
B.current && (B.current.style.visibility = "hidden", B.current.style.display = "block"), ue && e.onPreviewVisibilityChange && e.onPreviewVisibilityChange(!1, e.id);
}, je = (ue) => {
if (Ut || !(s != null && s.hasPreview) && !r.showProgressTime)
return;
const L = p.current, w = n.duration, le = s, oe = B.current;
if (!L || !Number.isFinite(w) || !oe || !J.current || o != null && o.outerRotate)
return;
const { width: Re } = L.getBoundingClientRect();
let Oe = ue * w;
Oe < 0 && (Oe = 0), Oe > w && (Oe = w);
let de;
if (s != null && s.hasPreview) {
if (de = le == null ? void 0 : le.getImgByTime(Oe), h(!!de), !de && !r.showProgressTime)
return;
} else
h(!1);
const X = Re * ue;
if (oe.style.visibility === "hidden") {
ye.current || (ye.current = +setTimeout(() => {
ye.current = 0, J.current && we(oe, J.current, de, Oe, X, Re);
}, 300));
return;
} else
we(oe, J.current, de, Oe, X, Re);
}, we = (ue, L, w, le, oe, Re) => {
if ($(zo(le, n.duration >= 3600)), w) {
const X = 144 / w.h;
ue.style.width = `${w.w * X / 24}em`, ue.style.height = `${w.h * X / 24}em`, L.style.transform = `scale(${ue.getBoundingClientRect().width / w.w})`, L.style.backgroundImage = `url(${w.url})`, L.style.height = `${w.h}px`, L.style.width = `${w.w}px`, L.style.backgroundPosition = `-${w.x}px -${w.y}px`;
} else
ue.style.width = "", ue.style.height = "", L.style.transform = "", L.style.backgroundImage = "", L.style.height = "", L.style.width = "", L.style.backgroundPosition = "";
const { width: Oe } = ue.getBoundingClientRect();
oe = oe - Oe / 2, oe < 0 ? oe = 0 : oe > Re - Oe && (oe = Re - Oe);
const de = ue.style.visibility === "visible";
ue.style.transform = `translateX(${oe}px)`, ue.style.visibility = "visible", de && e.onPreviewVisibilityChange && e.onPreviewVisibilityChange(!0, e.id);
};
return Ft(() => () => {
Be();
}, []), /* @__PURE__ */ De(
"div",
{
"data-kp-role": e["data-kp-role"],
className: [Xe["segmented-track"], e.disabled ? Xe.disabled : "", e.className].join(" "),
style: { cursor: Ut ? "default" : "" },
ref: p,
onMouseLeave: z,
onMouseDown: O,
onMouseMove: K,
onMouseEnter: K,
onTouchStart: O,
onTouchMove: K,
onTouchEnd: z,
onClick: K,
children: [
/* @__PURE__ */ De("div", { ref: B, style: { visibility: "hidden" }, className: Xe.preview, children: [
/* @__PURE__ */ De("div", { ref: J, className: Xe["preview-img"] }),
/* @__PURE__ */ De("div", { className: [Xe["preview-time"], x ? "" : Xe["preview-time-no-img"]].join(" "), children: /* @__PURE__ */ De("div", { children: be }) })
] }),
/* @__PURE__ */ De("div", { className: [Xe["segment-background"]].join(" "), children: [
/* @__PURE__ */ De(
"div",
{
className: Xe["segment-highlight-before"],
style: { width: `${n.bufferedPercent}%` }
}
),
/* @__PURE__ */ De(
"div",
{
className: Xe["segment-highlight-after"],
style: { width: `${D.current ? C : n.currentTimePercent}%` }
}
)
] }),
!e.disabled && /* @__PURE__ */ De(
"div",
{
className: [Xe.thumb, D.current ? Xe["thumb-drag"] : ""].join(" "),
ref: j,
style: { left: `calc(${D.current ? C : n.currentTimePercent}% - ${F}px)` }
}
)
]
}
);
}
function um(e) {
const r = sr(Fn);
if (!r)
return /* @__PURE__ */ De(Yi, {});
const { deps: { pluginRotate: n } } = r, o = St(null), s = St(null), p = wi(
() => 100 - e.leftWidth,
[e.beforeWidth, e.leftWidth]
), [g, C] = ot(!1), y = (I) => {
C(!0), x(I, !0);
}, x = (I, T = !1) => {
I.preventDefault();
const D = I instanceof MouseEvent ? I.clientX : I.changedTouches[0].clientX, W = I instanceof MouseEvent ? I.clientY : I.changedTouches[0].clientY, j = o.current, O = o.current;
if ((g || T || I instanceof PointerEvent || Ut && I instanceof MouseEvent) && j && O) {
const { left: K, right: z } = j.getBoundingClientRect();
if (D < K || D > z)
C(!1);
else {
let B = 0;
const { top: J, left: be, width: $, height: ye } = O.getBoundingClientRect();
(n == null ? void 0 : n.outerRotate) === 90 ? B = parseFloat((($ - (D - be)) / $).toFixed(2)) : (n == null ? void 0 : n.outerRotate) === 180 ? B = parseFloat(((ye - (W - J)) / ye).toFixed(2)) : (n == null ? void 0 : n.outerRotate) === 270 ? B = parseFloat(((D - be) / $).toFixed(2)) : B = parseFloat(((W - J) / ye).toFixed(2)), e.onChange && e.onChange(1 - B);
}
}
}, h = () => {
C(!1);
}, F = () => {
C(!1);
};
return /* @__PURE__ */ De(
"div",
{
"data-kp-role": e["data-kp-role"],
className: [Xe["segmented-vertical-track"], e.className].join(
" "
),
style: { cursor: Ut ? "default" : "pointer" },
ref: o,
onMouseUp: h,
onMouseLeave: F,
onMouseDown: y,
onMouseMove: x,
onTouchStart: y,
onTouchMove: x,
onTouchEnd: F,
onClick: x,
children: [
/* @__PURE__ */ De("div", { className: Xe["segment-vertical-background"], children: [
/* @__PURE__ */ De(
"div",
{
className: Xe["segment-vertical-highlight-before"],
style: { height: `${e.beforeWidth}%` }
}
),
/* @__PURE__ */ De(
"div",
{
className: Xe["segment-vertical-highlight-after"],
style: { height: `${e.leftWidth}%` }
}
)
] }),
/* @__PURE__ */ De(
"div",
{
className: Xe["thumb-vertical"],
ref: s,
style: { top: `${p}%` }
}
)
]
}
);
}
function hm(e) {
return /* @__PURE__ */ De("div", { className: [Xe.tooltip, e.lowTipPos ? Xe["tooltip-low-pos"] : ""].join(" "), children: /* @__PURE__ */ De("div", { children: e.text }) });
}
const dm = "ui-panel", fm = (e) => {
var r, n, o;
const s = sr(Fn), p = sr(_c), g = sr(bd), C = sr(Fs);
if (!s || !p || !g || !C)
return /* @__PURE__ */ De(Yi, {});
const { player: y, text: x, disabled: h, deps: { options: F } } = s, { setPanelHover: I, floatLayerId: T, setFloatLayerId: D, container: W } = g, j = St(null), O = wi(() => e.showPanel && !(Ut && s.error), [e.showPanel, s.error]);
Ft(() => {
s.deps.options.stateChange && s.deps.options.stateChange({ type: "controlsVisibility", value: O });
}, [O]), Ft(() => {
var re, k;
const P = (Ie) => {
var Ee;
(Ee = Pe.current) != null && Ee.contains(Ie.target) || D(0);
}, Z = () => {
Ut || I(!0);
}, he = () => {
I(!1);
};
return document.addEventListener("click", P), (re = j.current) == null || re.addEventListener("mouseenter", Z), (k = j.current) == null || k.addEventListener("mouseleave", he), () => {
var Ie, Ee;
document.removeEventListener("click", P), (Ie = j.current) == null || Ie.removeEventListener("mouseenter", Z), (Ee = j.current) == null || Ee.removeEventListener("mouseleave", he);
};
}, []);
const K = (re) => {
p.seek(re);
}, z = (re) => {
Number.isFinite(p.duration) && y.emit(Je.INTERACTION, { type: "progresschange", data: { time: re * p.duration } }), F.seekMode === "onDragChange" && K(re * p.duration);
}, B = (re) => {
F.seekMode !== "onDragChange" && K(re * p.duration);
}, J = St(null), be = St(null), $ = St(null), ye = St(null), Be = St(null), Ve = St(null), je = St(null), we = St(null), ue = St(null), L = St(null), w = St(null), le = St(null), oe = St(null), Re = () => {
if (g.width && be.current && J.current && Le.current && ne.current) {
const re = ne.current.getBoundingClientRect().width, k = [Le, ye, Be, Ve, w, le, je, $, we, ue, L, oe];
if (!J.current.getBoundingClientRect().width)
return;
k.forEach((Z) => {
Z.current && (Z.current.style.display = "");
});
let P = be.current.getBoundingClientRect().width + J.current.getBoundingClientRect().width + Le.current.getBoundingClientRect().width;
k.forEach((Z) => {
if (Z.current && P > re) {
const he = Z.current ? Math.ceil(Oe(Z.current) / 5) * 5 : 0;
P -= he, Z.current.style.display = "none";
}
});
}
}, Oe = (re) => {
const k = getComputedStyle(re);
return re.getBoundingClientRect().width + (parseFloat(k.marginLeft) || 0) + (parseFloat(k.marginRight) || 0);
}, de = wi(() => Ut && (s.audioLevels.length > 1 || s.levels.length > 1 || s.showPlaybackRateOverflow || C.overflowItems.length > 0), [s.audioLevels, s.levels, s.showPlaybackRate, C.overflowItems]);
Un(() => {
Re();
}, [g.width, s.levels, s.audioLevels, s.showFullScreen, s.showPlaybackRate, s.showProgress, s.showTime, s.showPictureInPicture, s.isLive, p.duration]), Ft(() => {
e.showPanel ? setTimeout(Re, 0) : D(0);
}, [e.showPanel]), Ft(() => {
D(0);
}, [s.error]);
const [X, ge] = ot(250);
Ft(() => {
if (w.current) {
const { top: re } = w.current.getBoundingClientRect(), { top: k } = W.getBoundingClientRect();
ge(Math.min(re - k - 15, 250));
return;
}
ge(250);
}, [g.height, T]);
const Pe = St(null), ae = (re) => {
Pe.current && (Pe.current === re.target || Pe.current.contains(re.target)) || s.toggleMuted();
}, [q, m] = ot(""), ve = St(0), U = () => {
ve.current && (clearTimeout(ve.current), ve.current = 0);
}, M = (re) => {
var k;
const P = y == null ? void 0 : y.getAllPlugins(), Z = [];
for (let he = 0; he < (P.length || 0); he++)
P[he].controlsSoltBtns && ((k = P[he].controlsSoltBtns) == null || k.forEach((Ie) => {
const Ee = Ie.svgRaw;
Ie.slotPos === re && Ee && Z.push(/* @__PURE__ */ De(
rn,
{
icon: (pe) => /* @__PURE__ */ De(
"div",
{
style: { color: ii(pe)[0] },
className: Xe["panel-button-icon-plugin"],
dangerouslySetInnerHTML: { __html: Ee }
}
),
className: Xe["panel-button-margins-left"],
color: (pe) => ii(pe)[0],
onClick: Ie.onClick,
disabled: h,
tip: Ie.getTips ? Ie.getTips() : "",
lowTipPos: !s.showProgress,
"data-kp-role": Ie.role
}
));
}));
return Z;
};
Ft(() => (q && (U(), ve.current = +setTimeout(() => {
m("");
}, 3e3)), () => {
U();
}), [q]), Ft(() => {
s.muted ? p.duration > 0 && m(x(qe.CURRENTLY_MUTED)) : m(`${x(qe.CURRENT_VOLUME)}:${Math.floor(s.volume * 100)}`);
}, [s.volume]), Un(() => {
const re = () => {
var Ie, Ee;
s.levels.length < 2 || (Ie = s.levels.find((pe) => pe.val === y.currentLevel)) != null && Ie.label && m(`${x(qe.SWITCHING_TO_VIDEO)} ${((Ee = s.levels.find((pe) => pe.val === s.currentLevel)) == null ? void 0 : Ee.label) || ""}`);
}, k = () => {
var Ie, Ee;
s.levels.length < 2 || (Ie = s.levels.find((pe) => pe.val === y.currentLevel)) != null && Ie.label && m(`${x(qe.SWITCH_TO_VIDEO)} ${((Ee = s.levels.find((pe) => pe.val === y.currentLevel)) == null ? void 0 : Ee.label) || ""} ${x(qe.FAIL)}`);
}, P = () => {
var Ie, Ee;
s.levels.length < 2 || (Ie = s.levels.find((pe) => pe.val === y.currentLevel)) != null && Ie.label && m(`${x(qe.SWITCHED_TO_VIDEO)} ${((Ee = s.levels.find((pe) => pe.val === y.currentLevel)) == null ? void 0 : Ee.label) || ""}`);
}, Z = (Ie) => {
var Ee;
s.audioLevels.length < 2 || m(`${x(qe.SWITCHING_TO_AUDIO)} ${((Ee = s.audioLevels.find((pe) => pe.val === Ie.level)) == null ? void 0 : Ee.label) || ""}`);
}, he = (Ie) => {
var Ee;
s.audioLevels.length < 2 || m(`${x(qe.SWITCHED_TO_AUDIO)} ${((Ee = s.audioLevels.find((pe) => pe.val === Ie.level)) == null ? void 0 : Ee.label) || ""}`);
};
return y.on(Je.LEVEL_SWITCHING, re), y.on(Je.LEVEL_SWITCH_FAILED, k), y.on(Je.LEVEL_SWITCH_PLAYING, P), y.on(Je.AUDIO_TRACKS_SWITCHING, Z), y.on(Je.AUDIO_TRACKS_SWITCHED, he), () => {
y.off(Je.LEVEL_SWITCHING, re), y.off(Je.LEVEL_SWITCH_FAILED, k), y.off(Je.LEVEL_SWITCH_PLAYING, P), y.off(Je.AUDIO_TRACKS_SWITCHING, Z), y.off(Je.AUDIO_TRACKS_SWITCHED, he);
};
}, [s.levels]);
const ne = St(null), Le = St(null);
Ft(() => {
const re = e.danmakuControls();
Le.current && re && (e.dankamuControlsActive ? Le.current.appendChild(re) : Le.current.innerHTML = "");
}, [e.dankamuControlsActive]);
const Ue = (re, k = 0) => {
D(re ? k : 0);
};
return Ft(() => () => {
U();
}, []), /* @__PURE__ */ De("div", { ref: j, style: {
opacity: O ? 1 : 0
}, className: Xe["bottom-controls"], children: [
/* @__PURE__ */ De("div", { className: Xe["bottom-controls-bg"] }),
s.showProgress && /* @__PURE__ */ De(
lm,
{
"data-kp-role": "timeline",
disabled: h,
className: Xe.timeline,
onChange: z,
onChangeEnd: B,
id: 1,
previewVisibility: T === 1,
onPreviewVisibilityChange: Ue
}
),
F.showBottomButtonBar && /* @__PURE__ */ De("div", { ref: ne, className: Xe["button-panel"], children: [
/* @__PURE__ */ De("div", { ref: J, className: Xe["button-panel-left"], children: [
/* @__PURE__ */ De(
rn,
{
icon: s.paused ? (re) => /* @__PURE__ */ De(
jg,
{
color: ii(re)[0],
className: Xe["panel-button-icon"]
}
) : (re) => /* @__PURE__ */ De(
Hg,
{
color: ii(re)[0],
className: Xe["panel-button-icon"]
}
),
color: (re) => ii(re)[0],
onClick: s.togglePlay,
disabled: h,
lowTipPos: !s.showProgress,
"data-kp-role": "play-btn"
}
),
s.showTime && /* @__PURE__ */ De("div", { ref: $, className: Xe["current-time-display"], children: /* @__PURE__ */ De("div", { children: zo(p.currentTime, p.duration >= 3600) }) }),
p.duration !== 1 / 0 && !isNaN(p.duration) && s.showTime && /* @__PURE__ */ De("div", { ref: je, className: Xe["time-remaining-display"], children: /* @__PURE__ */ De("div", { children: [
"/ ",
zo(p.duration, p.duration >= 3600)
] }) }),
s.liveShiftEnabled && /* @__PURE__ */ De(
om,
{
className: [Xe["panel-button-margins-left"], Xe["live-shift"]].join(" "),
"data-kp-role": "live-shift-btn",
disabled: h
}
),
M(Ga.PLAY_BAR_LEFT)
] }),
/* @__PURE__ */ De("div", { ref: Le, className: Xe["button-panel-center"] }),
/* @__PURE__ */ De("div", { ref: be, className: Xe["button-panel-right"], children: [
s.audioLevels.length > 1 && !Ut && /* @__PURE__ */ De(
rn,
{
ref: ye,
text: ((r = s.audioLevels.find((re) => re.val === s.currentAudioLevel)) == null ? void 0 : r.label) || "",
id: 4,
childrenVisibility: T === 4,
onChildrenVisibilityChange: Ue,
className: Xe["panel-button-margins-left"],
color: (re) => ii(re)[0],
children: /* @__PURE__ */ De("div", { className: Xe["bottom-popup-layer"], children: /* @__PURE__ */ De("div", { className: [Xe["panel-playback-list"], s.showProgress ? "" : Xe["bottom-popup-layer-low-pos"]].join(" "), children: s.audioLevels.map((re, k) => /* @__PURE__ */ De(
"div",
{
className: Xe["playback-rate"],
onClick: () => {
s.changeAudioLevel(re.val), D(0);
},
children: /* @__PURE__ */ De("div", { children: re.label })
},
k
)) }) })
}
),
s.levels.length > 1 && !Ut && /* @__PURE__ */ De(
rn,
{
ref: Be,
text: ((n = s.levels.find((re) => re.val === s.currentLevel)) == null ? void 0 : n.label) || "",
id: 3,
childrenVisibility: T === 3,
onChildrenVisibilityChange: Ue,
className: Xe["panel-button-margins-left"],
color: (re) => ii(re)[0],
children: /* @__PURE__ */ De("div", { className: Xe["bottom-popup-layer"], children: /* @__PURE__ */ De("div", { className: [Xe["panel-playback-list"], s.showProgress ? "" : Xe["bottom-popup-layer-low-pos"]].join(" "), children: s.levels.map((re, k) => /* @__PURE__ */ De(
"div",
{
className: Xe["playback-rate"],
onClick: () => {
s.changeLevel(re.val), D(0);
},
children: /* @__PURE__ */ De("div", { children: re.label })
},
k
)) }) })
}
),
s.showPlaybackRate && /* @__PURE__ */ De(
rn,
{
ref: Ve,
"data-kp-role": "play-rate",
id: 2,
childrenVisibility: T === 2,
onChildrenVisibilityChange: Ue,
text: s.playbackRate === 1 ? x(qe.PLAYBACK_RATE_SHORT) : ((o = Os.find(
(re) => re.val === s.playbackRate
)) == null ? void 0 : o.label) || s.playbackRate.toString(),
disabled: h,
className: Xe["panel-button-margins-left"],
color: (re) => ii(re)[0],
children: /* @__PURE__ */ De("div", { className: Xe["bottom-popup-layer"], children: /* @__PURE__ */ De("div", { className: [Xe["panel-playback-list"], s.showProgress ? "" : Xe["bottom-popup-layer-low-pos"]].join(" "), children: Os.map((re, k) => (re.val === 1 && (re.label = x(qe.PLAYBACK_RATE_NORMAL)), /* @__PURE__ */ De(
"div",
{
className: Xe["playback-rate"],
"data-kp-role": "playrate-item",
onClick: () => {
y.logger.i(dm, "playback rate", re.val), D(0), s.changePlaybackRate(re.val);
},
children: /* @__PURE__ */ De("div", { children: re.label })
},
k
))) }) })
}
),
s.showRefresh && /* @__PURE__ */ De(
rn,
{
ref: we,
icon: (re) => /* @__PURE__ */ De(
$g,
{
color: ii(re)[0],
className: Xe["panel-button-icon"]
}
),
color: (re) => ii(re)[0],
onClick: s.refresh,
tip: x(qe.REFRESH),
lowTipPos: !s.showProgress,
className: Xe["panel-button-margins-left"],
disabled: h,
"data-kp-role": "refresh-btn"
}
),
M(Ga.PLAY_BAR_RIGHT),
/* @__PURE__ */ De(
rn,
{
ref: oe,
icon: s.muted ? (re) => /* @__PURE__ */ De(
Xg,
{
color: ii(re)[0],
className: Xe["panel-button-icon"]
}
) : (re) => /* @__PURE__ */ De(
Gg,
{
color: ii(re)[0],
className: Xe["panel-button-icon"]
}
),
color: (re) => ii(re)[0],
"data-kp-role": "mute-btn",
id: 5,
childrenVisibility: T === 5,
onChildrenVisibilityChange: Ue,
onClick: ae,
className: Xe["panel-button-margins-left"],
disabled: h,
children: !Ut && /* @__PURE__ */ De("div", { className: Xe["bottom-popup-layer"], children: /* @__PURE__ */ De(
"div",
{
className: [Xe["panel-volume-wrapper"], s.showProgress ? "" : Xe["bottom-popup-layer-low-pos"]].join(" "),
ref: Pe,
"data-kp-role": "volume-panel",
children: [
/* @__PURE__ */ De("div", { className: Xe["volume-text"], children: (s.volume * 100).toFixed(0) }),
/* @__PURE__ */ De(
um,
{
"data-kp-role": "volume-track",
leftWidth: s.volume * 100,
beforeWidth: s.volume * 100,
onChange: s.changeVolume
}
)
]
}
) })
}
),
s.showPictureInPicture && /* @__PURE__ */ De(
rn,
{
ref: le,
icon: s.isInPIP ? (re) => /* @__PURE__ */ De(
Jg,
{
color: ii(re)[0],
className: Xe["panel-button-icon"]
}
) : (re) => /* @__PURE__ */ De(
qg,
{
color: ii(re)[0],
className: Xe["panel-button-icon"]
}
),
color: (re) => ii(re)[0],
onClick: s.changePIP,
disabled: h,
tip: s.isInPIP ? x(qe.EXIT_PICTURE_IN_PICTURE) : x(qe.PICTURE_IN_PICTURE),
lowTipPos: !s.showProgress,
className: Xe["panel-button-margins-left"],
"data-kp-role": "picture-in-picture-btn"
}
),
!s.isFullscreen && s.showWindowFullScreen && /* @__PURE__ */ De(
rn,
{
ref: L,
icon: s.isWindowFullscreen ? (re) => /* @__PURE__ */ De(
Yg,
{
color: ii(re)[0],
className: Xe["panel-button-icon"]
}
) : (re) => /* @__PURE__ */ De(
Wg,
{
color: ii(re)[0],
className: Xe["panel-button-icon"]
}
),
color: (re) => ii(re)[0],
onClick: s.toggleWindowFullscreen,
disabled: h,
tip: s.isWindowFullscreen ? x(qe.EXIT_WINDOW_FULLSCREEN) : x(qe.WINDOW_FULLSCREEN),
lowTipPos: !s.showProgress,
className: Xe["panel-button-margins-left"],
"data-kp-role": "window-fullscreen-btn",
resetOnClick: !0
}
),
s.showFullScreen && !Ut && /* @__PURE__ */ De(
rn,
{
ref: ue,
icon: s.isFullscreen ? (re) => /* @__PURE__ */ De(
Kg,
{
color: ii(re)[0],
className: Xe["panel-button-icon"]
}
) : (re) => /* @__PURE__ */ De(
zg,
{
color: ii(re)[0],
className: Xe["panel-button-icon"]
}
),
color: (re) => ii(re)[0],
onClick: s.toggleFullscreen,
disabled: h,
tip: s.isFullscreen ? x(qe.EXIT_FULLSCREEN) : x(qe.FULLSCREEN),
lowTipPos: !s.showProgress,
className: Xe["panel-button-margins-left"],
"data-kp-role": "fullscreen-btn",
resetOnClick: !0
}
),
de && /* @__PURE__ */ De(
rn,
{
ref: w,
icon: (re) => /* @__PURE__ */ De(
Qg,
{
color: ii(re)[0],
className: Xe["panel-button-icon"]
}
),
color: (re) => ii(re)[0],
"data-kp-role": "overflow-btn",
onClick: (re) => {
re.stopPropagation(), D(T === 6 ? 0 : 6);
},
className: Xe["panel-button-margins-left"],
disabled: h
}
),
Ut && /* @__PURE__ */ De(
cm,
{
className: `${Xe.overflow} ${T === 6 ? "" : Xe.closed}`,
overflowMaxheight: X,
showOverflow: T === 6,
onClose: () => D(0)
}
)
] })
] }),
q && /* @__PURE__ */ De(hm, { text: q, lowTipPos: !s.showProgress })
] });
};
function pm(e) {
const r = sr(Fn);
if (!r)
return /* @__PURE__ */ De(Yi, {});
const {
player: n,
text: o,
deps: {
options: s,
pluginVr: p,
pluginDanmaku: g
}
} = r, [C, y] = ot(!1), [x, h] = ot(!1), [F, I] = ot(""), [T, D] = ot(0), W = St(void 0), [j, O] = ot(e.container.getBoundingClientRect().width), [K, z] = ot(e.container.getBoundingClientRect().height);
Un(() => {
setTimeout(() => {
W.current = g == null ? void 0 : g.getControlPanelDom();
}, 0);
const ie = () => {
k(!1);
};
document.addEventListener("click", ie);
const ee = new wg();
return ee.start(e.container, [e.container], (Te) => Te.forEach((Se) => {
O(Se.contentRect.width), z(Se.contentRect.height);
})), B.current && e.videoLayer && e.videoInteractive && (B.current.insertAdjacentElement("afterbegin", e.videoInteractive), B.current.insertAdjacentElement("afterbegin", e.videoLayer)), () => {
document.removeEventListener("click", ie), W.current = void 0, ee.stop();
};
}, []);
const B = St(null), [J, be] = ot(!0);
Ft(() => (B.current && e.videoLayer && e.videoInteractive && (e.videoInteractive.addEventListener("click", L), e.videoInteractive.addEventListener("dblclick", w)), () => {
e.videoInteractive && (e.videoInteractive.removeEventListener("click", L), e.videoInteractive.removeEventListener("dblclick", w));
}), [r, J, T]), Ft(() => {
const ie = n.mainContainer;
ie && (r.isFullscreen ? ie.style.display = "flex" : ie.style.display = "");
}, [r.isFullscreen]);
const $ = St(0), [ye, Be] = ot(
2
/* stoped */
), Ve = () => {
Be(
2
/* stoped */
), $.current && (clearTimeout($.current), $.current = 0);
}, je = () => {
Ve(), Be(
0
/* running */
), $.current = +setTimeout(() => {
Be(
1
/* tick */
);
}, 3e3);
}, we = wi(
() => {
var ie;
return !r.paused && !r.error && !F && !T && !x && !((ie = B.current) != null && ie.contains(document.activeElement));
},
[r.paused, r.error, F, T, x]
);
Ft(() => {
ye === 1 && (we ? (Be(
2
/* stoped */
), be(!1)) : je());
}, [ye]), Ft(() => {
we && be(!1);
}, [r.error, F, x]), Ft(() => {
!C && we && be(!1);
}, [T]), Ft(() => {
we && ye === 2 && be(!1);
}, [r.paused]);
const ue = () => {
Ve(), be(!0);
};
Un(() => (je(), n.on(Je.PAUSE, ue), n.on(Je.ERROR, ue), () => {
n.off(Je.PAUSE, ue), n.off(Je.ERROR, ue);
}), []);
const L = () => {
!n.controls || m.current || (je(), Ut ? we && (J ? (be(!1), Ve()) : (be(!0), je())) : !r.disabled && !(p != null && p.active) && r.togglePlay());
}, w = () => {
var ie, ee;
n.controls && (r.toggleFullscreen(), window.getSelection ? (ie = window.getSelection()) == null || ie.removeAllRanges() : (ee = document.getSelection()) == null || ee.empty());
}, le = (ie) => {
Ut || (y(!0), ue(), je(), p != null && p.active && Re && (ie.preventDefault(), q(ie.clientX, ie.clientY)));
}, oe = () => {
y(!1), Oe(void 0), we && (Ve(), be(!1));
}, [Re, Oe] = ot(void 0), de = (ie) => {
p != null && p.active && Oe({
vrX: p.xAxis,
vrY: p.yAxis,
interactiveX: ie.clientX,
interactiveY: ie.clientY
});
}, X = () => {
Oe(void 0);
}, ge = (ie) => {
p != null && p.active && Oe({
vrX: p.xAxis,
vrY: p.yAxis,
interactiveX: ie.changedTouches[0].clientX,
interactiveY: ie.changedTouches[0].clientY
});
}, Pe = () => {
Oe(void 0);
}, ae = (ie) => {
ue(), je(), p != null && p.active && Re && (q(ie.changedTouches[0].clientX, ie.changedTouches[0].clientY), ie.preventDefault());
}, q = (ie, ee) => {
if (p != null && p.active && Re) {
const { width: Te, height: Se } = e.container.getBoundingClientRect();
p.yAxis = Re.vrY - (ie - Re.interactiveX) / Te * Math.PI / 2, p.xAxis = Re.vrX + (ee - Re.interactiveY) / Se * Math.PI / 2;
}
}, m = St(null), [ve, U] = ot(0), [M, ne] = ot(0), [Le, Ue] = ot(!1);
Ft(() => {
const ie = (ee) => {
var Te;
(Te = m.current) != null && Te.contains(ee.target) || (ee.preventDefault(), Ue(!1), k(!0), setTimeout(() => {
if (!m.current || !e.container)
return;
const { width: Se, height: Ye, left: ze, top: it } = e.container.getBoundingClientRect(), { width: ct, height: nt } = m.current.getBoundingClientRect();
U(Math.min(ee.clientX - ze + 5, Se - ct)), ne(Math.min(ee.clientY - it + 5, Ye - nt)), Ue(!0);
}, 0));
};
return r.controls && r.showContextMenu && e.container.addEventListener("contextmenu", ie), () => e.container.removeEventListener("contextmenu", ie);
}, [r.controls]);
const [re, k] = ot(!1), P = () => {
k(!re);
}, Z = () => !!(g && n.disableDanmaku !== !0), he = () => {
const ie = Z(), ee = r.isFullscreen || r.isWindowFullscreen, Te = s.danmakuControls, Se = s.danmakuControlsFull;
Ee(!Ut && ie && (ee ? Se === ta.PLAY_BAR : Te === ta.PLAY_BAR));
const Ye = !Ut && ie && (ee ? Se === ta.BOTTOM : Te === ta.BOTTOM);
te(Ye);
const ze = W.current;
ze && Ye && pe.current && g && (ze.classList.add(Xe["sending-area-controls"]), pe.current.appendChild(ze));
}, [Ie, Ee] = ot(!1), pe = St(null), [G, te] = ot(!1);
return Ft(() => (n.on(Je.ATTRIBUTE_CHANGE_DANMAKU_CONTROLS_POS, he), n.on(Je.ATTRIBUTE_CHANGE_DANMAKU_CONTROLS_POS_FULLSCREEN, he), n.on(Je.ATTRIBUTE_CHANGE_DISABLE_DANMAKU, he), () => {
n.off(Je.ATTRIBUTE_CHANGE_DANMAKU_CONTROLS_POS, he), n.off(Je.ATTRIBUTE_CHANGE_DANMAKU_CONTROLS_POS_FULLSCREEN, he), n.off(Je.ATTRIBUTE_CHANGE_DISABLE_DANMAKU, he);
}), []), Ft(he, [r.isFullscreen, r.isWindowFullscreen, Ut, G]), Ft(() => () => {
Ve();
}, []), /* @__PURE__ */ De(Yi, { children: [
/* @__PURE__ */ De(
"div",
{
ref: B,
className: Xe["video-area"],
onMouseDown: de,
onMouseUp: X,
onTouchStart: ge,
onTouchEnd: Pe,
onTouchMove: ae,
onMouseMove: le,
onMouseLeave: oe,
children: [
r.controls && r.waiting && /* @__PURE__ */ De(rm, {}),
r.controls && re && !Ut && /* @__PURE__ */ De(
Fg,
{
ref: m,
visible: Le,
onChangeShowContextMenu: P,
left: ve,
top: M
}
),
r.controls && r.error && /* @__PURE__ */ De(im, { text: o, code: r.error.code, message: r.error.message }),
r.controls && /* @__PURE__ */ De(
am,
{
panelHover: x,
setPanelHover: h,
dragProgress: F,
setDragProgress: I,
floatLayerId: T,
setFloatLayerId: D,
width: j,
height: K,
container: e.container,
children: /* @__PURE__ */ De(nm, { deps: r.deps, children: /* @__PURE__ */ De(
fm,
{
style: {},
dankamuControlsActive: Ie,
danmakuControls: () => W.current,
showPanel: J
}
) })
}
)
]
}
),
G && /* @__PURE__ */ De("div", { ref: pe, className: Xe["sending-area"] })
] });
}
class _m {
constructor(r, n) {
Ni(this, "_label"), Ni(this, "_player"), Ni(this, "_i18n"), Ni(this, "_rotate"), Ni(this, "_preview"), Ni(this, "_vr"), Ni(this, "_danmaku"), Ni(this, "_options", {}), Ni(this, "text", (o) => {
var s;
return ((s = this._i18n) == null ? void 0 : s.text(this._label, o)) || Cg[o] || "";
}), this._label = r, this._player = n, this._i18n = n.getPluginInstance(nd), this._rotate = n.getPluginInstance(ad), this._preview = n.getPluginInstance(sd), this._vr = n.getPluginInstance(od), this._danmaku = n.getPluginInstance(cd);
}
get player() {
return this._player;
}
get pluginRotate() {
return this._rotate;
}
get pluginPreview() {
return this._preview;
}
get pluginVr() {
return this._vr;
}
get pluginDanmaku() {
return this._danmaku;
}
set options(r) {
this._options = r;
}
get options() {
return this._options;
}
}
class Ed extends fg {
constructor() {
super(), Ni(this, "_player"), Ni(this, "container"), Ni(this, "_videoInteractive"), Ni(this, "_videoLayer"), Ni(this, "_danmaku"), Ni(this, "_deps"), Ni(this, "_onSrcChange", () => {
var r;
if (!this.container)
throw new Error("container is undefined");
const n = (r = this._player) == null ? void 0 : r.mainContainer;
n && this._videoLayer && (n == null || n.appendChild(this._videoLayer)), Ba(null, this.container), this._player && this._renderUI();
});
}
beforeInstall(r) {
this._player = r, this._deps = new _m(this.getLabel(), r), this._danmaku = this._deps.pluginDanmaku, r.on(Je.ATTRIBUTE_CHANGE_SRC, this._onSrcChange);
}
afterInstall(r, n) {
if (this._player = r, !r)
throw new Error("player is undefined");
if (this._deps && (this._deps.options = {
danmakuControls: !!this._danmaku && (n == null ? void 0 : n.danmakuControlsPos) || ta.NONE,
danmakuControlsFull: !!this._danmaku && (n == null ? void 0 : n.danmakuControlsPosFullscreen) || ta.PLAY_BAR,
showBottomButtonBar: (n == null ? void 0 : n.showBottomButtonBar) !== !1,
showProgress: n == null ? void 0 : n.showProgress,
showTime: (n == null ? void 0 : n.showTime) !== !1,
showNext: n == null ? void 0 : n.showNext,
showPrev: n == null ? void 0 : n.showPrev,
showWindowFullScreen: n == null ? void 0 : n.showWindowFullScreen,
seekMode: n == null ? void 0 : n.seekMode,
showProgressTime: n == null ? void 0 : n.showProgressTime,
showPlaybackRate: n == null ? void 0 : n.showPlaybackRate,
showContextMenu: n == null ? void 0 : n.showContextMenu,
stateChange: n == null ? void 0 : n.stateChange
}), this.container = r.createSubContainer(), this._videoInteractive = r.videoInteractiveLayer, this._videoLayer = r.videoLayer, !this.container)
throw new Error("container is undefined");
this.container.className = Xe.controls, this._renderUI();
}
beforeUninstall() {
this.container && Ba(null, this.container);
}
afterUninstall() {
this._player && this._player.off(Je.ATTRIBUTE_CHANGE_SRC, this._onSrcChange);
}
_renderUI() {
this.container && this._deps && Ba(
/* @__PURE__ */ De(Ig, { deps: this._deps, children: /* @__PURE__ */ De(Rg, { deps: this._deps, children: /* @__PURE__ */ De(
pm,
{
container: this.container,
videoLayer: this._videoLayer,
videoInteractive: this._videoInteractive
}
) }) }),
this.container
);
}
}
Ni(Ed, "version", "1.1.0-alpha.0");
const Am = [
{
lang: "en",
map: {
[Ko]: {
[qe.PLAY]: "Play",
[qe.PAUSE]: "Pause",
[qe.REFRESH]: "Refresh",
[qe.NEXT]: "Next",
[qe.TURN_ON_LOOP]: "Turn on loop",
[qe.TURN_OFF_LOOP]: "Turn off loop",
[qe.LOOP]: "Loop",
[qe.PLAYBACK_RATE_NORMAL]: "Normal",
[qe.OPTIONS]: "Options",
[qe.DOWNLOAD]: "Download",
[qe.VIDEO_TRACK]: "Video tracks",
[qe.AUDIO_TRACK]: "Audio tracks",
[qe.PLAYBACK_RATE]: "Playback speed",
[qe.PLAYBACK_RATE_SHORT]: "Speed",
[qe.PICTURE_IN_PICTURE]: "Picture in picture",
[qe.EXIT_PICTURE_IN_PICTURE]: "Exit picture in picture",
[qe.PLAY_INFO]: "Play info",
[qe.MIRROR_IMAGE]: "Mirror image",
[qe.ROTATE]: "Rotate",
[qe.FULLSCREEN]: "Fullscreen",
[qe.EXIT_FULLSCREEN]: "Exit fullscreen",
[qe.WINDOW_FULLSCREEN]: "Window fullscreen",
[qe.EXIT_WINDOW_FULLSCREEN]: "Exit window fullscreen",
[qe.AUTO]: "Auto",
[qe.CURRENT_VOLUME]: "Current volume",
[qe.CURRENTLY_MUTED]: "Currently muted",
[qe.SWITCH_TO_VIDEO]: "Switch to",
[qe.SWITCHING_TO_VIDEO]: "Switching to",
[qe.SWITCHED_TO_VIDEO]: "Switched to",
[qe.SWITCH_TO_AUDIO]: "Switch to",
[qe.SWITCHING_TO_AUDIO]: "Switching to",
[qe.SWITCHED_TO_AUDIO]: "Switched to",
[qe.FAIL]: "Fail",
[qe.ERROR_PANEL_TITLE]: "Video loading failed, please try again later.",
[qe.LIVE]: "Live",
[qe.RETURN_TO_LIVE]: "Return to Live",
[qe.ERROR_PANEL_RETRY_BTN]: "Click Retry"
}
}
},
{
lang: "es",
map: {
[Ko]: {
[qe.PLAY]: "Reproducir",
[qe.PAUSE]: "Pausa",
[qe.REFRESH]: "Actualizar",
[qe.NEXT]: "Siguiente",
[qe.TURN_ON_LOOP]: "Activar bucle",
[qe.TURN_OFF_LOOP]: "Desactivar bucle",
[qe.LOOP]: "Bucle",
[qe.PLAYBACK_RATE_NORMAL]: "Normal",
[qe.OPTIONS]: "Opciones",
[qe.DOWNLOAD]: "Descargar",
[qe.VIDEO_TRACK]: "Pistas de video",
[qe.AUDIO_TRACK]: "Pistas de audio",
[qe.PLAYBACK_RATE]: "Velocidad de reproducción",
[qe.PLAYBACK_RATE_SHORT]: "Velocidad",
[qe.PICTURE_IN_PICTURE]: "Imagen en imagen",
[qe.EXIT_PICTURE_IN_PICTURE]: "Salir de imagen en imagen",
[qe.PLAY_INFO]: "Información de reproducción",
[qe.MIRROR_IMAGE]: "Imagen espejo",
[qe.ROTATE]: "Rotar",
[qe.FULLSCREEN]: "Pantalla completa",
[qe.EXIT_FULLSCREEN]: "Salir de pantalla completa",
[qe.WINDOW_FULLSCREEN]: "Pantalla completa de ventana",
[qe.EXIT_WINDOW_FULLSCREEN]: "Salir de pantalla completa de ventana",
[qe.AUTO]: "Automático",
[qe.CURRENT_VOLUME]: "Volumen actual",
[qe.CURRENTLY_MUTED]: "Actualmente silenciado",
[qe.SWITCH_TO_VIDEO]: "Cambiar a video",
[qe.SWITCHING_TO_VIDEO]: "Cambiando a video",
[qe.SWITCHED_TO_VIDEO]: "Cambiado a video",
[qe.SWITCH_TO_AUDIO]: "Cambiar a audio",
[qe.SWITCHING_TO_AUDIO]: "Cambiando a audio",
[qe.SWITCHED_TO_AUDIO]: "Cambiado a audio",
[qe.FAIL]: "Error",
[qe.ERROR_PANEL_TITLE]: "Error al cargar el video, por favor inténtelo de nuevo más tarde.",
[qe.LIVE]: "En vivo",
[qe.RETURN_TO_LIVE]: "Volver a En vivo",
[qe.ERROR_PANEL_RETRY_BTN]: 'Haz clic en Reintentar"'
}
}
}
];
(function() {
try {
if (typeof document != "undefined") {
var e = document.createElement("style");
e.appendChild(document.createTextNode("._alpha-video_1qqo5_1{display:none!important}")), document.head.appendChild(e);
}
} catch (r) {
console.error("vite-plugin-css-injected-by-js", r);
}
})();
var vm = Object.defineProperty, gm = (e, r, n) => r in e ? vm(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, gt = (e, r, n) => (gm(e, typeof r != "symbol" ? r + "" : r, n), n);
(function() {
try {
if (typeof document < "u") {
var e = document.createElement("style");
e.appendChild(document.createTextNode("")), document.head.appendChild(e);
}
} catch (r) {
console.error("vite-plugin-css-injected-by-js", r);
}
})();
var mm = Object.defineProperty, bm = (e, r, n) => r in e ? mm(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, Tr = (e, r, n) => (bm(e, typeof r != "symbol" ? r + "" : r, n), n);
const Em = "ControlsPlugin", ym = "I18nPlugin", Cm = "LoggerPlugin", Tm = "HotkeyPlugin", Im = "PlayInfoPlugin", Rm = "RotatePlugin", wm = "PreviewPlugin", Lm = "MaskPlugin", Dm = "VRPlugin", Sm = "DanmakuPlugin";
let cr = class extends nn {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static isInstanceOfPlugin(r) {
return typeof r.beforeInstall == "function" && typeof r.afterInstall == "function" && typeof r.beforeUninstall == "function" && typeof r.afterUninstall == "function" && typeof r.getLabel == "function";
}
/**
* 控制条插槽按钮
*/
get controlsSoltBtns() {
}
/**
* 播放器实例化前钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
beforeInstall(r, n) {
}
/**
* 播放器实例化后钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
afterInstall(r, n) {
}
/**
* 播放器销毁前钩子
* @param player 播放器实例
*/
beforeUninstall(r) {
}
/**
* 播放器销毁后钩子
* @param player 播放器实例
*/
afterUninstall(r) {
}
};
Tr(cr, "label"), /**
* 版本
*/
Tr(cr, "version"), /**
* 当前环境是否支持
*/
Tr(cr, "isSupported");
const Om = class yd extends cr {
/**
* @override
*/
getLabel() {
return yd.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
};
Tr(Om, "label", Em);
const Nm = class Cd extends cr {
/**
* @override
*/
getLabel() {
return Cd.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
};
Tr(Nm, "label", ym);
const km = class Td extends cr {
/**
* @override
*/
getLabel() {
return Td.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
/**
* 增加业务相关数据
* @param key 上报数据key
* @param value 上报数据
*/
addBizLog(r, n) {
}
appendSummaryField(r, n) {
}
};
Tr(km, "label", Cm);
const xm = class Id extends cr {
/**
* @override
*/
getLabel() {
return Id.label;
}
};
Tr(xm, "label", Tm);
const Mm = class Rd extends cr {
/**
* @override
*/
getLabel() {
return Rd.label;
}
};
Tr(Mm, "label", Im);
const Pm = class wd extends cr {
/**
* @override
*/
getLabel() {
return wd.label;
}
};
Tr(Pm, "label", Rm);
const Um = class Ld extends cr {
/**
* @override
*/
getLabel() {
return Ld.label;
}
};
Tr(Um, "label", wm);
const Bm = class Dd extends cr {
/**
* @override
*/
getLabel() {
return Dd.label;
}
};
Tr(Bm, "label", Lm);
const Vm = class Sd extends cr {
/**
* @override
*/
getLabel() {
return Sd.label;
}
};
Tr(Vm, "label", Dm);
const Fm = class Od extends cr {
/**
* @override
*/
getLabel() {
return Od.label;
}
};
Tr(Fm, "label", Sm);
var gr = /* @__PURE__ */ ((e) => (e.ERROR = "error", e.MANIFEST_PARSED = "manifestparsed", e.LEVEL_SWITCHING = "levelswitching", e.LEVEL_SWITCHED = "levelswitched", e.LEVEL_SWITCH_PLAYING = "levelswitchplaying", e.LEVEL_SWITCH_FAILED = "levelswitchfailed", e.LEVEL_UPDATED = "levelupdated", e.AUDIO_TRACKS_SWITCHING = "audiotrackswitching", e.AUDIO_TRACKS_SWITCHED = "audiotrackswitched", e.LOADSTART = "loadstart", e.PROGRESS = "progress", e.SUSPEND = "suspend", e.ABORT = "abort", e.EMPTIED = "emptied", e.STALLED = "stalled", e.LOADEDMETADATA = "loadedmetadata", e.LOADEDDATA = "loadeddata", e.CANPLAY = "canplay", e.CANPLAYTHROUGH = "canplaythrough", e.PLAYING = "playing", e.WAITING = "waiting", e.SEEKING = "seeking", e.SEEKED = "seeked", e.ENDED = "ended", e.DURATIONCHANGE = "durationchange", e.TIMEUPDATE = "timeupdate", e.PLAY = "play", e.PAUSE = "pause", e.RATECHANGE = "ratechange", e.RESIZE = "resize", e.VOLUMECHANGE = "volumechange", e.ENTER_PICTURE_IN_PICTURE = "enterpictureinpicture", e.LEAVE_PICTURE_IN_PICTURE = "leavepictureinpicture", e.REPORT = "report", e.VIDEO_RENDERER_CHANGE = "videorendererchange", e.FULLSCREEN_CHANGE = "fullscreenchange", e.ATTRIBUTE_CHANGE = "attribute:change", e.INTERACTION = "interaction", e.LIVE_SHIFT_CHANGE = "liveshiftchange", e.LIVE_SHIFT_TYPE_CHANGE = "liveshifttypechange", e.OBJECT_FIT_CHANGE = "objectfitchange", e.ATTRIBUTE_CHANGE_CONFIG = "attribute:change:config", e.ATTRIBUTE_CHANGE_SRC = "attribute:change:src", e.ATTRIBUTE_CHANGE_VIDEO_ID = "attribute:change:videoid", e.ATTRIBUTE_CHANGE_PREVIEW_URL = "attribute:change:previewurl", e.ATTRIBUTE_CHANGE_MASK_URL = "attribute:change:maskurl", e.ATTRIBUTE_CHANGE_CROSS_ORIGIN = "attribute:change:crossorigin", e.ATTRIBUTE_CHANGE_PRELOAD = "attribute:change:preload", e.ATTRIBUTE_CHANGE_CURRENT_TIME = "attribute:change:currenttime", e.ATTRIBUTE_CHANGE_DEFAULT_PLAYBACK_RATE = "attribute:change:defaultplaybackrate", e.ATTRIBUTE_CHANGE_PLAYBACK_RATE = "attribute:change:playbackrate", e.ATTRIBUTE_CHANGE_AUTOPLAY = "attribute:change:autoplay", e.ATTRIBUTE_CHANGE_LOOP = "attribute:change:loop", e.ATTRIBUTE_CHANGE_CONTROLS = "attribute:change:controls", e.ATTRIBUTE_CHANGE_VOLUME = "attribute:change:volume", e.ATTRIBUTE_CHANGE_MUTED = "attribute:change:muted", e.ATTRIBUTE_CHANGE_DEFAULT_MUTED = "attribute:change:defaultmuted", e.ATTRIBUTE_CHANGE_POSTER = "attribute:change:poster", e.ATTRIBUTE_CHANGE_DISABLE_PICTURE_IN_PICTURE = "attribute:change:disablepictureinpicture", e.ATTRIBUTE_CHANGE_PLAYSINLINE = "attribute:change:playsinline", e.ATTRIBUTE_CHANGE_DISABLE_ADAPTIVE = "attribute:change:disableadaptive", e.ATTRIBUTE_CHANGE_DISABLE_DOWNLOAD = "attribute:change:disabledownload", e.ATTRIBUTE_CHANGE_DISABLE_MASK = "attribute:change:disablemask", e.ATTRIBUTE_CHANGE_DISABLE_HOTKEY = "attribute:change:disablehotkey", e.ATTRIBUTE_CHANGE_DISABLE_DANMAKU = "attribute:change:disabledanmaku", e.ATTRIBUTE_CHANGE_DANMAKU_RENDERING = "attribute:change:danmakurendering", e.ATTRIBUTE_CHANGE_DANMAKU_CONTROLS_POS = "attribute:change:danmakucontrolspos", e.ATTRIBUTE_CHANGE_DANMAKU_CONTROLS_POS_FULLSCREEN = "attribute:change:danmakucontrolsposfullscreen", e.ATTRIBUTE_CHANGE_CURRENT_LEVEL = "attribute:change:currentlevel", e.ATTRIBUTE_CHANGE_NEXT_LEVEL = "attribute:change:nextlevel", e.ATTRIBUTE_CHANGE_CURRENT_FRAME = "attribute:change:currentframe", e.ATTRIBUTE_CHANGE_AUDIO_TRACK = "attribute:change:audiotrack", e.ATTRIBUTE_CHANGE_PREFETCH = "attribute:change:prefetch", e.ATTRIBUTE_CHANGE_SHOW_PROGRESS = "attribute:change:showprogress", e.ATTRIBUTE_CHANGE_SHOW_TIME = "attribute:change:showtime", e.ATTRIBUTE_CHANGE_SHOW_NEXT = "attribute:change:shownext", e.ATTRIBUTE_CHANGE_SHOW_PREV = "attribute:change:showprev", e.ATTRIBUTE_CHANGE_BIZ_DATA = "attribute:change:bizdata", e.ATTRIBUTE_CHANGE_LIVE_TIME = "attribute:change:livetime", e.ATTRIBUTE_CHANGE_SHOW_INFO_PANEL = "attribute:change:showinfopanel", e.CLICK_NEXT = "clicknext", e.CLICK_LOGIN = "clicklogin", e.CLICK_REGISTER = "clickregister", e.CLICK_VIP = "clickvip", e))(gr || {}), Nd = /* @__PURE__ */ ((e) => (e.VIDEO = "video", e.VIDEO_INTERACTIVE = "videoInteractive", e.DEFAULT = "default", e))(Nd || {});
class jm {
constructor(r, n, o) {
gt(this, "type", "2:1"), gt(this, "videoWidth", 0), gt(this, "videoHeight", 0), gt(this, "objectFit", ""), gt(this, "_logger"), gt(this, "_player"), gt(this, "_view"), this._logger = r, this._player = n, this._view = o;
}
reset() {
this.videoWidth = this.videoHeight = 0;
}
get realVideoWidth() {
return this.type === "2:1" ? this.videoWidth / 3 * 2 : this.videoWidth / 2;
}
get targetR() {
return this.type === "2:1" ? this.videoWidth / 3 * 2 / this.videoHeight : this.videoWidth / 2 / this.videoHeight;
}
get view() {
return this._view;
}
get viewR() {
const r = this.viewRect;
return r.width / r.height;
}
get videoR() {
return this.videoWidth / this.videoHeight;
}
get viewRect() {
return this._view.getBoundingClientRect();
}
get player() {
return this._player;
}
get logger() {
return this._logger;
}
}
const $o = class Zo {
static setPixelRatioByDevice(r) {
Zo.pixelRatioByDevice = r, Zo.pixelRatio = r ? window.devicePixelRatio : 1;
}
};
gt($o, "pixelRatioByDevice", !0), gt($o, "pixelRatio", 1);
let qo = $o;
const ru = "renderer-basic";
let kd = class {
constructor(r, n) {
gt(this, "_logger"), gt(this, "_ctx"), gt(this, "_source"), gt(this, "_viewport", { x: 0, y: 0, w: 1, h: 1, scale: 1 }), this._logger = r, this._ctx = n;
}
draw() {
return fo(this, null, function* () {
const r = this._ctx.player;
if (!r)
return !1;
const n = r.canvas || r.video;
let o;
return n instanceof HTMLCanvasElement ? o = yield r.screenshot() : o = n, o ? Promise.resolve(this._drawImageData(o)) : !1;
});
}
setSource(r) {
this._logger.i(ru, "set source", r), this._source = r;
}
setType(r) {
}
clean() {
}
destroy() {
this._logger.i(ru, "destroy");
}
_drawImageData(r) {
return !0;
}
_updateViewSize() {
}
_updateViewport() {
const r = this._ctx.targetR, n = this._ctx.view.width, o = this._ctx.view.height, s = n / o, p = this._ctx, g = p.objectFit;
this._viewport.x = 0, this._viewport.y = 0, this._viewport.w = n, this._viewport.h = o, g === "fill" || (g === "cover" ? r >= p.viewR ? (this._viewport.w = this._viewport.h * r, this._viewport.x = -(this._viewport.w - n) / 2, this._viewport.scale = p.videoHeight / o) : (this._viewport.h = this._viewport.w / r, this._viewport.y = -(this._viewport.h - o) / 2, this._viewport.scale = p.realVideoWidth / n) : r > s ? (this._viewport.h = n / r, this._viewport.y = (o - this._viewport.h) / 2, this._viewport.scale = p.realVideoWidth / n) : (this._viewport.w = o * r, this._viewport.x = (n - this._viewport.w) / 2, this._viewport.scale = p.videoHeight / o));
}
};
function Jo(e, r) {
r = r || 1;
const n = e.clientWidth * r | 0, o = e.clientHeight * r | 0;
return n && o && (e.width !== n || e.height !== o) ? (e.width = n, e.height = o, !0) : !1;
}
function Hm(e, r, n, o, s) {
const p = s || xd, g = e.createProgram();
if (!g)
return null;
if (r.forEach(function(C) {
e.attachShader(g, C);
}), n && n.forEach(function(C, y) {
e.bindAttribLocation(
g,
o ? o[y] : y,
C
);
}), e.linkProgram(g), !e.getProgramParameter(g, e.LINK_STATUS)) {
const C = e.getProgramInfoLog(g);
return p(`Error in program linking:${C}`), e.deleteProgram(g), null;
}
return g;
}
function nu(e, r, n, o) {
const s = o || xd, p = e.createShader(n);
if (!p)
return null;
if (e.shaderSource(p, r), e.compileShader(p), !e.getShaderParameter(p, e.COMPILE_STATUS)) {
const g = e.getShaderInfoLog(p);
return s(`*** Error compiling shader '${p}':${g}`), e.deleteShader(p), null;
}
return p;
}
function Gm(e, r, n, o = [], s = [], p) {
const g = [], C = nu(e, r, e.VERTEX_SHADER, p), y = nu(e, n, e.FRAGMENT_SHADER, p);
return C && g.push(C), y && g.push(y), { program: Hm(e, g, o, s, p), vertexShader: C, fragmentShader: y };
}
function xd(e) {
console && (console.error ? console.error(e) : console.log && console.log(e));
}
function zm(e) {
const r = {
// Don't trigger discrete GPU in multi-GPU systems
preferLowPowerToHighPerformance: !0,
powerPreference: "default",
/*
* Don't try to use software GL rendering!
* failIfMajorPerformanceCaveat: true,
* In case we need to capture the resulting output.
*/
preserveDrawingBuffer: !0
};
return e.getContext("webgl", r);
}
let Co, To;
function Km(e = !1) {
if (e) {
if (typeof To < "u")
return To;
} else if (typeof Co < "u")
return Co;
let r = !1;
try {
const n = document.createElement("canvas"), o = {
// Don't trigger discrete GPU in multi-GPU systems
preferLowPowerToHighPerformance: !0,
// Don't try to use software GL rendering!
failIfMajorPerformanceCaveat: e,
// In case we need to capture the resulting output.
preserveDrawingBuffer: !0
};
if (typeof WebGLRenderingContext < "u") {
const s = n.getContext("webgl", o) || n.getContext("experimental-webgl", o);
if (s) {
const p = s.getExtension("WEBGL_lose_context");
p && p.loseContext(), r = !0;
} else
r = !1;
} else
r = !1;
} catch (n) {
}
return e ? To = r : Co = r, r;
}
const Io = "renderer-2d";
class Wm extends kd {
constructor() {
super(...arguments), gt(this, "_tmpCanvas"), gt(this, "_tmpCtx", null), gt(this, "_viewCtx", null);
}
_drawImageData(r) {
var n;
const o = this._ctx.view;
this._viewCtx || (this._viewCtx = o.getContext("2d", { willReadFrequently: !0 })), (n = this._viewCtx) == null || n.clearRect(0, 0, o.width, o.height), Jo(o, qo.pixelRatio), this._updateViewport();
let s;
this._tmpCanvas || (this._tmpCanvas = document.createElement("canvas"), this._tmpCtx = this._tmpCanvas.getContext("2d", { willReadFrequently: !0 }));
const p = this._tmpCtx, g = this._ctx;
if (!p)
return this._logger.i(Io, "create tmp ctx error."), !1;
r instanceof ImageData ? (s = this._tmpCanvas, s.width = r.width, s.height = r.height, p.putImageData(r, 0, 0)) : (s = this._tmpCanvas, s.width = g.videoWidth, s.height = g.videoHeight, p.drawImage(r, 0, 0));
const C = this._viewport, y = this._viewCtx, x = Math.round(g.realVideoWidth), h = Math.round(C.x), F = Math.round(C.y), I = Math.min(Math.round(C.w), o.width), T = Math.min(Math.round(C.h), o.height), D = h >= 0 ? 0 : -h * C.scale, W = F >= 0 ? 0 : -F * C.scale, j = D > 0 ? x - 2 * D : x, O = W > 0 ? g.videoHeight - 2 * W : g.videoHeight, K = g.type === "2:1" ? 2 : 1, z = Math.min(Math.round(j / K), g.videoWidth - x), B = Math.round(O / K);
if (!s || !y)
return !1;
y.drawImage(s, D, W, j, O, Math.max(0, h), Math.max(0, F), I, T);
const J = p.getImageData(x + D / K, W / K, z, B), be = y.getImageData(0, 0, o.width, o.height);
let $ = 0, ye = 0;
const Be = Math.max(0, h), Ve = Math.max(0, F);
for (let je = 0; je < be.height; je++)
for (let we = Be; we < Be + I; we++)
je < Ve || je > Ve + T || we < Be || we > Be + I || ($ = be.width * je + we << 2, ye = Math.round(Math.min(B - 1, Math.round((je - Ve) * B / T)) * z + Math.min(Math.round((we - Be) * z / I), z - 1)) << 2, be.data[$ + 3] = J.data[ye]);
return y.putImageData(be, 0, 0), !0;
}
clean() {
this._logger.i(Io, "clean");
const r = this._viewCtx;
r && r.clearRect(0, 0, r.canvas.width, r.canvas.height);
}
destroy() {
this._logger.i(Io, "destroy"), super.destroy(), this._tmpCtx = null, this._tmpCanvas && (this._tmpCanvas.width = 0, this._tmpCanvas.height = 0, this._tmpCanvas = void 0);
}
}
const au = {
vertex: `
attribute vec4 position;
attribute vec4 inputTextureCoordinate;
varying vec2 textureCoordinate;
void main() {
gl_Position = position;
textureCoordinate = inputTextureCoordinate.xy;
}
`,
fragment: `
precision highp float;
varying highp vec2 textureCoordinate;
uniform sampler2D inputImageTexture;
uniform int type;
void main() {
if (type == 2) {
float alphaX = 2.0 / 3.0;
vec3 colorRGB = texture2D(inputImageTexture, vec2(textureCoordinate.x * alphaX, textureCoordinate.y)).rgb;
vec2 rightTextureCoordinate = vec2(alphaX + (textureCoordinate.x / 3.0), textureCoordinate.y / 2.0);
float colorA = texture2D(inputImageTexture, vec2(alphaX + (textureCoordinate.x / 3.0), textureCoordinate.y / 2.0 + 0.5)).r;
gl_FragColor = vec4(colorRGB.rgb, colorA);
} else {
float alphaX = 0.5;
vec3 colorRGB = texture2D(inputImageTexture, vec2(textureCoordinate.x * alphaX, textureCoordinate.y)).rgb;
vec2 rightTextureCoordinate = vec2(alphaX + textureCoordinate.x / 2.0, textureCoordinate.y);
float colorA = texture2D(inputImageTexture, rightTextureCoordinate).r;
gl_FragColor = vec4(colorRGB.rgb, colorA);
}
}
`
}, Kn = "renderer-webgl";
class Ym extends kd {
constructor(r, n) {
r.i(Kn, "constructor"), super(r, n), gt(this, "_vShader", null), gt(this, "_fShader", null), gt(this, "_gl", null), gt(this, "_program", null), gt(this, "_positionBuffer", null), gt(this, "_texcoordBuffer", null), gt(this, "_texture", null), gt(this, "_typeUniform", null), gt(this, "_inputWidth", 0), gt(this, "_inputHeight", 0), gt(this, "_inputTextureUniform", null), gt(this, "_positionAttrib", 0), gt(this, "_inputTextureCoordinateAttrib", 0), this._gl = zm(n.view);
}
_init() {
this._logger.i(Kn, "init");
const r = this._gl;
if (!r)
return this._logger.e(Kn, "init error gl null."), !1;
const n = Gm(r, au.vertex, au.fragment);
this._vShader = n.vertexShader, this._fShader = n.fragmentShader;
const o = this._program = n.program;
return o ? (Jo(r.canvas, qo.pixelRatio), this._positionBuffer = r.createBuffer(), r.bindBuffer(r.ARRAY_BUFFER, this._positionBuffer), r.bufferData(r.ARRAY_BUFFER, new Float32Array([
-1,
-1,
1,
-1,
-1,
1,
1,
1
]), r.STATIC_DRAW), this._texcoordBuffer = r.createBuffer(), r.bindBuffer(r.ARRAY_BUFFER, this._texcoordBuffer), r.bufferData(r.ARRAY_BUFFER, new Float32Array([
0,
0,
1,
0,
0,
1,
1,
1
]), r.STATIC_DRAW), this._typeUniform = r.getUniformLocation(o, "type"), this._logger.i(Kn, "init complete."), !0) : (this._logger.e(Kn, "init error program null."), !1);
}
clean() {
this._logger.i(Kn, "clean");
const r = this._gl;
r && (r.viewport(0, 0, r.canvas.width, r.canvas.height), r.clearColor(0, 0, 0, 0), r.clear(r.COLOR_BUFFER_BIT));
}
destroy() {
if (this._logger.i(Kn, "destroy", !!this._gl), this._gl) {
this._gl.disableVertexAttribArray(this._positionAttrib), this._gl.disableVertexAttribArray(this._inputTextureCoordinateAttrib), this._positionBuffer && this._gl.deleteBuffer(this._positionBuffer), this._texcoordBuffer && this._gl.deleteBuffer(this._texcoordBuffer), this._texture && this._gl.deleteTexture(this._texture), this._program && this._gl.deleteProgram(this._program), this._vShader && this._gl.deleteShader(this._vShader), this._fShader && this._gl.deleteShader(this._fShader);
const r = this._gl.getExtension("WEBGL_lose_context");
r && r.loseContext(), this._gl = null;
}
super.destroy();
}
_drawImageData(r) {
const n = this._gl;
if (!n)
return !1;
if (!this._program) {
if (!this._init())
return !1;
this._active(), this._texture = this._createAndSetupTexture(n);
}
if (Jo(n.canvas, qo.pixelRatio), this.setType(this._ctx.type), r instanceof HTMLVideoElement) {
if ((r.videoWidth !== this._inputWidth || r.videoHeight !== this._inputHeight) && (this._inputWidth = r.videoWidth, this._inputHeight = r.videoHeight), r.readyState !== 4)
return !1;
} else
(r.width !== this._inputWidth || r.height !== this._inputHeight) && (this._inputWidth = r.width, this._inputHeight = r.height);
return this._updateSize(), n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL, 1), n.bindTexture(n.TEXTURE_2D, this._texture), n.texImage2D(n.TEXTURE_2D, 0, n.RGBA, n.RGBA, n.UNSIGNED_BYTE, r), n.clearColor(0, 0, 0, 0), n.clear(n.COLOR_BUFFER_BIT), n.drawArrays(n.TRIANGLE_STRIP, 0, 4), n.finish(), !0;
}
_createAndSetupTexture(r) {
const n = r.createTexture();
return r.bindTexture(r.TEXTURE_2D, n), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_S, r.CLAMP_TO_EDGE), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_T, r.CLAMP_TO_EDGE), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MIN_FILTER, r.LINEAR), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MAG_FILTER, r.LINEAR), n;
}
_updateSize() {
const r = this._gl;
r && (this._updateViewport(), r.viewport(this._viewport.x, this._viewport.y, this._viewport.w, this._viewport.h));
}
_active() {
const r = this._gl, n = this._program;
r && n && (r.useProgram(n), this._positionAttrib = r.getAttribLocation(n, "position"), this._inputTextureCoordinateAttrib = r.getAttribLocation(n, "inputTextureCoordinate"), r.enableVertexAttribArray(this._positionAttrib), r.bindBuffer(r.ARRAY_BUFFER, this._positionBuffer), r.vertexAttribPointer(this._positionAttrib, 2, r.FLOAT, !1, 0, 0), r.enableVertexAttribArray(this._inputTextureCoordinateAttrib), r.bindBuffer(r.ARRAY_BUFFER, this._texcoordBuffer), r.vertexAttribPointer(this._inputTextureCoordinateAttrib, 2, r.FLOAT, !1, 0, 0), this._inputTextureUniform = r.getUniformLocation(n, "inputImageTexture"));
}
setType(r) {
this._gl && this._gl.uniform1i(this._typeUniform, r === "2:1" ? 2 : 1);
}
}
const Ro = 60, vr = "renderer";
class Qm {
constructor(r, n, o, s) {
gt(this, "_ctx"), gt(this, "_logger"), gt(this, "_active", !1), gt(this, "_fps", Ro), gt(this, "_drawTime", 0), gt(this, "_animationFrameHandler", 0), gt(this, "_readyState", "idle"), gt(this, "_resizeObserver"), gt(this, "_r"), gt(this, "_loop", () => {
const p = this._ctx.player;
this._active && (p && !p.paused && !p.ended && this._loopDraw(), this._animationFrameHandler = requestAnimationFrame(this._loop));
}), gt(this, "_loopDraw", () => {
performance.now() - this._drawTime > 1e3 / this._fps && this._readyState === "idle" && this.draw();
}), r.i(vr, "constructor"), this._logger = r, this._ctx = new jm(r, n, o), Km(!1) ? (r.i(vr, "backend: webgl."), this._r = new Ym(r, this._ctx)) : (r.i(vr, "backend: canvas2d."), this._r = new Wm(r, this._ctx)), this._r.setType(this._ctx.type), this._resizeObserver = new Ps(() => {
this._active && (r.i(vr, "resize redraw"), this.draw());
}), this._resizeObserver.observe(s);
}
reset() {
this._logger.i(vr, "reset", this._r), this._r.clean(), this._fps = Ro, this._ctx.reset(), this.stop();
}
start() {
this._logger.i(vr, `start. active: ${this._active}`), this._active || (this._active = !0, this._animationFrameHandler = requestAnimationFrame(this._loop));
}
stop() {
this._logger.i(vr, "stop"), this._active = !1, cancelAnimationFrame(this._animationFrameHandler), this._animationFrameHandler = 0;
}
setInput(r) {
this._logger.i(vr, "set input", r), this._r.setSource(r);
}
updateVideoSize(r, n) {
this._logger.i(vr, "update video size", r, n), this._ctx.videoWidth = r, this._ctx.videoHeight = n;
}
updateFps(r) {
this._logger.i(vr, "update fps", r), this._fps = r || Ro;
}
updateType(r) {
this._logger.i(vr, "update type", r), this._ctx.type = r, this._r.setType(r), this._active && this.draw();
}
updateObjectFit(r) {
this._logger.i(vr, `update objectFit: ${r} active: ${this._active}`), this._ctx.objectFit = r, this._active && this.draw();
}
get readyState() {
return this._readyState;
}
get active() {
return this._active;
}
get ctx() {
return this._ctx;
}
draw() {
return fo(this, null, function* () {
try {
this._readyState = "running", this._drawTime = performance.now();
const r = yield this._r.draw();
return this._readyState = "idle", r;
} catch (r) {
return this._readyState = "idle", !1;
}
});
}
destroy() {
this._logger.i(vr, "destroy"), this.stop(), this._r.destroy(), this._resizeObserver && this._ctx.view && (this._resizeObserver.unobserve(this._ctx.view), this._resizeObserver.disconnect());
}
}
const ls = {
"alpha-video": "_alpha-video_1qqo5_1"
}, pn = "alpha-video", ec = class Md extends cr {
constructor() {
super(...arguments), gt(this, "_player"), gt(this, "_logger"), gt(this, "_dom"), gt(this, "_outputCanvas"), gt(this, "_renderer"), gt(this, "_active"), gt(this, "_typeFromMeta"), gt(this, "_supported", !0), gt(this, "_onRendererChange", () => {
var r;
this._player && ((r = this._renderer) == null || r.setInput(this._player.canvas || this._player.video));
}), gt(this, "_onObjectFitChange", () => {
var r, n, o, s;
(n = this._logger) == null || n.i(pn, `on objectFit change: ${(r = this._player) == null ? void 0 : r.objectFit}`), (s = this._renderer) == null || s.updateObjectFit(((o = this._player) == null ? void 0 : o.objectFit) || "");
}), gt(this, "_onManifest", (r) => {
var n;
(r.stereoType === 0 || typeof r.stereoType > "u") && this._player ? (this._player.crossOrigin = "anonymous", this._supported = !0) : this._supported = !1, (n = this._logger) == null || n.i(pn, `on manifest supported: ${this._supported} stereoType: ${r.stereoType}`);
}), gt(this, "_onSrcChange", () => {
var r;
this._typeFromMeta = void 0, (r = this._renderer) == null || r.reset(), this._stop();
}), gt(this, "_onLoadedMetadata", () => {
var r;
(r = this._logger) == null || r.i(pn, "on loaded metadata"), this._start();
}), gt(this, "_onReport", (r) => {
var n, o, s, p, g;
r.type === "mediaInfo" && r.value.fps ? ((n = this._renderer) == null || n.updateFps(r.value.fps), r.value.width && r.value.height && ((o = this._renderer) == null || o.updateVideoSize(r.value.width, r.value.height))) : r.type === "metadata" && typeof r.value.desc == "string" && ((s = this._logger) == null || s.i(pn, `media metadata desc: ${r.value.desc}`), r.value.desc.indexOf("alphaVideo_1") >= 0 ? (this._typeFromMeta = "1:1", (p = this._renderer) == null || p.updateType(this._typeFromMeta), this._start()) : r.value.desc.indexOf("alphaVideo_2") >= 0 && (this._typeFromMeta = "2:1", (g = this._renderer) == null || g.updateType(this._typeFromMeta), this._start()));
});
}
getLabel() {
return Md.label;
}
beforeInstall(r) {
this._player = r, this._logger = r.logger, r.on(gr.VIDEO_RENDERER_CHANGE, this._onRendererChange), r.on(gr.ATTRIBUTE_CHANGE_SRC, this._onSrcChange), r.on(gr.LOADEDMETADATA, this._onLoadedMetadata), r.on(gr.REPORT, this._onReport), r.on(gr.MANIFEST_PARSED, this._onManifest), r.on(gr.OBJECT_FIT_CHANGE, this._onObjectFitChange);
}
afterInstall(r, n) {
var o, s, p;
this._dom = r.createSubContainer(Nd.VIDEO), this._dom.style.position = "absolute", this._dom.style.top = "0", this._dom.style.left = "0", this._dom.style.width = "100%", this._dom.style.height = "100%", this._dom.style.visibility = "hidden", this._outputCanvas = document.createElement("canvas"), this._outputCanvas.style.width = "100%", this._outputCanvas.style.height = "100%", this._dom.appendChild(this._outputCanvas), (o = this._logger) == null || o.i(pn, "after install", n), !this._renderer && this._logger && (this._logger.i(pn, "renderer init"), this._renderer = new Qm(this._logger, r, this._outputCanvas, this._dom)), typeof (n == null ? void 0 : n.type) < "u" && this._renderer && (this._renderer.ctx.type = n.type), typeof (n == null ? void 0 : n.active) < "u" && (this._active = n.active), (p = this._renderer) == null || p.updateObjectFit(((s = this._player) == null ? void 0 : s.objectFit) || "");
}
afterUninstall(r) {
var n;
this._stop(), (n = this._renderer) == null || n.destroy(), this._renderer = void 0, this._player = void 0, this._logger = void 0, r.off(gr.VIDEO_RENDERER_CHANGE, this._onRendererChange), r.off(gr.ATTRIBUTE_CHANGE_SRC, this._onSrcChange), r.off(gr.LOADEDMETADATA, this._onLoadedMetadata), r.off(gr.REPORT, this._onReport), r.off(gr.MANIFEST_PARSED, this._onManifest), r.off(gr.OBJECT_FIT_CHANGE, this._onObjectFitChange), this.removeAllListeners();
}
set active(r) {
var n;
(n = this._logger) == null || n.i(pn, `set active: ${r}`), this._active = r, this._isActive ? this._start() : this._stop();
}
get active() {
var r;
return !!((r = this._renderer) != null && r.active && this._supported && this._isActive);
}
set type(r) {
var n, o, s;
(n = this._logger) == null || n.i(pn, `set type ${r}`), typeof r > "u" ? (o = this._renderer) == null || o.updateType(this._typeFromMeta || "2:1") : (s = this._renderer) == null || s.updateType(r);
}
/** @internal */
get _isActive() {
return this._active === !0 || typeof this._active > "u" && typeof this._typeFromMeta < "u";
}
/** @internal */
_start() {
var r, n;
(r = this._logger) == null || r.i(pn, `start active: ${this._active} typeFromMeta: ${this._typeFromMeta} supported: ${this._supported}`), this._isActive && this._supported && (this._dom && (this._dom.style.visibility = "visible"), this._player && (this._player.video.classList.add(ls["alpha-video"]), this._player.canvas && this._player.canvas.classList.add(ls["alpha-video"])), (n = this._renderer) == null || n.start());
}
/** @internal */
_stop() {
var r, n;
(r = this._logger) == null || r.i(pn, "stop", this._dom), this._dom && (this._dom.style.visibility = "hidden"), this._player && (this._player.video.classList.remove(ls["alpha-video"]), this._player.canvas && this._player.canvas.classList.remove(ls["alpha-video"])), (n = this._renderer) == null || n.stop();
}
};
gt(ec, "label", "AlphaVideoPlugin"), gt(ec, "version", "1.1.0-alpha.0");
let Xm = ec;
var $m = Object.defineProperty, Zm = (e, r, n) => r in e ? $m(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, Yr = (e, r, n) => (Zm(e, typeof r != "symbol" ? r + "" : r, n), n);
(function() {
try {
if (typeof document < "u") {
var e = document.createElement("style");
e.appendChild(document.createTextNode("")), document.head.appendChild(e);
}
} catch (r) {
console.error("vite-plugin-css-injected-by-js", r);
}
})();
var qm = Object.defineProperty, Jm = (e, r, n) => r in e ? qm(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, Ir = (e, r, n) => (Jm(e, typeof r != "symbol" ? r + "" : r, n), n);
const e1 = "ControlsPlugin", t1 = "I18nPlugin", i1 = "LoggerPlugin", r1 = "HotkeyPlugin", n1 = "PlayInfoPlugin", a1 = "RotatePlugin", s1 = "PreviewPlugin", o1 = "MaskPlugin", c1 = "VRPlugin", l1 = "DanmakuPlugin";
let Rr = class extends nn {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static isInstanceOfPlugin(r) {
return typeof r.beforeInstall == "function" && typeof r.afterInstall == "function" && typeof r.beforeUninstall == "function" && typeof r.afterUninstall == "function" && typeof r.getLabel == "function";
}
/**
* 控制条插槽按钮
*/
get controlsSoltBtns() {
}
/**
* 播放器实例化前钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
beforeInstall(r, n) {
}
/**
* 播放器实例化后钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
afterInstall(r, n) {
}
/**
* 播放器销毁前钩子
* @param player 播放器实例
*/
beforeUninstall(r) {
}
/**
* 播放器销毁后钩子
* @param player 播放器实例
*/
afterUninstall(r) {
}
};
Ir(Rr, "label"), /**
* 版本
*/
Ir(Rr, "version"), /**
* 当前环境是否支持
*/
Ir(Rr, "isSupported");
const u1 = class Pd extends Rr {
/**
* @override
*/
getLabel() {
return Pd.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
};
Ir(u1, "label", e1);
const h1 = class Ud extends Rr {
/**
* @override
*/
getLabel() {
return Ud.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
};
Ir(h1, "label", t1);
const d1 = class Bd extends Rr {
/**
* @override
*/
getLabel() {
return Bd.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
/**
* 增加业务相关数据
* @param key 上报数据key
* @param value 上报数据
*/
addBizLog(r, n) {
}
appendSummaryField(r, n) {
}
};
Ir(d1, "label", i1);
const Vd = class Fd extends Rr {
/**
* @override
*/
getLabel() {
return Fd.label;
}
};
Ir(Vd, "label", r1);
let f1 = Vd;
const p1 = class jd extends Rr {
/**
* @override
*/
getLabel() {
return jd.label;
}
};
Ir(p1, "label", n1);
const _1 = class Hd extends Rr {
/**
* @override
*/
getLabel() {
return Hd.label;
}
};
Ir(_1, "label", a1);
const A1 = class Gd extends Rr {
/**
* @override
*/
getLabel() {
return Gd.label;
}
};
Ir(A1, "label", s1);
const v1 = class zd extends Rr {
/**
* @override
*/
getLabel() {
return zd.label;
}
};
Ir(v1, "label", o1);
const g1 = class Kd extends Rr {
/**
* @override
*/
getLabel() {
return Kd.label;
}
};
Ir(g1, "label", c1);
const m1 = class Wd extends Rr {
/**
* @override
*/
getLabel() {
return Wd.label;
}
};
Ir(m1, "label", l1);
var Yd = /* @__PURE__ */ ((e) => (e.NONE = "none", e.KWAI = "kwai", e.KWAI2 = "kwai2", e))(Yd || {});
const na = {
KEEP_DOWN: "KEEP_DOWN",
KEEP_DOWN_END: "KEEP_DOWN_END",
SINGLE_DOWN: "SINGLE_DOWN"
}, tr = {
ArrowRight: "ArrowRight",
ArrowLeft: "ArrowLeft",
ArrowUp: "ArrowUp",
ArrowDown: "ArrowDown",
Space: " "
}, b1 = "hotkey-plugin";
let Qd = class extends f1 {
constructor() {
super(...arguments), Yr(this, "_player"), Yr(this, "_currentKey", ""), Yr(this, "_isKeepDown", !1), Yr(this, "_emitKeepDownInterval", 100), Yr(this, "_emitKeepDownLastTime", 0), Yr(this, "_disable", !1), Yr(this, "_onDown", (r) => {
!this._isValidInput(r) || this._disable || (this._currentKey && (this._isKeepDown = !0, Date.now() - this._emitKeepDownLastTime > this._emitKeepDownInterval && (this._emitKeepDownLastTime = Date.now(), this.emit(na.KEEP_DOWN, { key: r.key }))), this._currentKey = r.key);
}), Yr(this, "_onUp", (r) => {
!this._isValidInput(r) || this._disable || (this._isKeepDown ? this.emit(na.KEEP_DOWN_END, { key: r.key }) : this.emit(na.SINGLE_DOWN, { key: r.key }), this._currentKey = "", this._isKeepDown = !1);
}), Yr(this, "_onKeepDown", ({ key: r }) => {
if (this._player)
switch (r) {
case tr.Space: {
this._onSpaceDown();
break;
}
case tr.ArrowRight: {
this._onChangeRate(3);
break;
}
case tr.ArrowLeft: {
this._onSeek(-this._getSeekTickTime());
break;
}
case tr.ArrowUp: {
this._onChangeVolume(5);
break;
}
case tr.ArrowDown: {
this._onChangeVolume(-5);
break;
}
}
}), Yr(this, "_onKeepDownEnd", ({ key: r }) => {
if (this._player)
switch (r) {
case tr.Space: {
this._onSpaceDown();
break;
}
case tr.ArrowRight: {
this._onChangeRate(1);
break;
}
case tr.ArrowLeft: {
this._onSeek(-this._getSeekTickTime());
break;
}
case tr.ArrowUp: {
this._onChangeVolume(5);
break;
}
case tr.ArrowDown: {
this._onChangeVolume(-5);
break;
}
}
}), Yr(this, "_onSingleDown", ({ key: r }) => {
if (this._player)
switch (r) {
case tr.Space: {
this._onSpaceDown();
break;
}
case tr.ArrowRight: {
this._onSeek(10);
break;
}
case tr.ArrowLeft: {
this._onSeek(-this._getSeekTickTime());
break;
}
case tr.ArrowUp: {
this._onChangeVolume(5);
break;
}
case tr.ArrowDown: {
this._onChangeVolume(-5);
break;
}
}
});
}
afterInstall(r) {
this._player = r, document.addEventListener("keydown", this._onDown), document.addEventListener("keyup", this._onUp), this.on(na.KEEP_DOWN, this._onKeepDown), this.on(na.KEEP_DOWN_END, this._onKeepDownEnd), this.on(na.SINGLE_DOWN, this._onSingleDown), this._disable = r.disableHotkey === !0, r.logger.i(b1, `hotkey disable: ${this._disable}`);
}
beforeUninstall() {
this._player = void 0, document.removeEventListener("keydown", this._onDown), document.removeEventListener("keyup", this._onUp);
}
get disable() {
return this._disable;
}
_onSpaceDown() {
const r = this._player;
r && (r.paused ? r.play() : r.pause());
}
_onSeek(r) {
if (this._player) {
if (this._isNormalLive())
return;
this._player.currentTime += r;
}
}
_onChangeRate(r) {
if (this._player) {
if (this._isNormalLive())
return;
this._player.playbackRate = r;
}
}
_isNormalLive() {
return !!(this._player && this._player && !Number.isFinite(this._player.duration) && this._player.liveShiftType === Yd.NONE);
}
_onChangeVolume(r) {
if (this._player) {
this._player.muted && (this._player.muted = !1);
let n = r / 100 + this._player.volume;
n > 1 && (n = 1), n < 0 && (n = 0), this._player.volume = n;
}
}
_getSeekTickTime() {
if (!this._player)
return 0;
let r = this._player.duration / 200;
return r > 10 && (r = 10), r < 5 && (r = 5), r;
}
_isValidInput(r) {
var n;
if (r.isComposing || [
"INPUT",
"TEXTAREA"
// @ts-expect-error 2339
].find((s) => {
var p;
return s === ((p = r.target) == null ? void 0 : p.tagName);
}))
return !1;
const o = (n = this._player) == null ? void 0 : n.mainContainer;
if (o) {
const { left: s, top: p, width: g, height: C } = o.getBoundingClientRect(), [y, x] = [s + g, p + C];
if (innerHeight < p || s > innerWidth || y < 0 || x < 0)
return !1;
}
return !0;
}
};
Yr(Qd, "version", "1.1.0-alpha.0");
var E1 = Object.defineProperty, y1 = (e, r, n) => r in e ? E1(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, Va = (e, r, n) => (y1(e, typeof r != "symbol" ? r + "" : r, n), n);
(function() {
try {
if (typeof document < "u") {
var e = document.createElement("style");
e.appendChild(document.createTextNode("")), document.head.appendChild(e);
}
} catch (r) {
console.error("vite-plugin-css-injected-by-js", r);
}
})();
var C1 = Object.defineProperty, T1 = (e, r, n) => r in e ? C1(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, wr = (e, r, n) => (T1(e, typeof r != "symbol" ? r + "" : r, n), n);
const I1 = "ControlsPlugin", R1 = "I18nPlugin", w1 = "LoggerPlugin", L1 = "HotkeyPlugin", D1 = "PlayInfoPlugin", S1 = "RotatePlugin", O1 = "PreviewPlugin", N1 = "MaskPlugin", k1 = "VRPlugin", x1 = "DanmakuPlugin";
let Lr = class extends nn {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static isInstanceOfPlugin(r) {
return typeof r.beforeInstall == "function" && typeof r.afterInstall == "function" && typeof r.beforeUninstall == "function" && typeof r.afterUninstall == "function" && typeof r.getLabel == "function";
}
/**
* 控制条插槽按钮
*/
get controlsSoltBtns() {
}
/**
* 播放器实例化前钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
beforeInstall(r, n) {
}
/**
* 播放器实例化后钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
afterInstall(r, n) {
}
/**
* 播放器销毁前钩子
* @param player 播放器实例
*/
beforeUninstall(r) {
}
/**
* 播放器销毁后钩子
* @param player 播放器实例
*/
afterUninstall(r) {
}
};
wr(Lr, "label"), /**
* 版本
*/
wr(Lr, "version"), /**
* 当前环境是否支持
*/
wr(Lr, "isSupported");
const M1 = class Xd extends Lr {
/**
* @override
*/
getLabel() {
return Xd.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
};
wr(M1, "label", I1);
const $d = class Zd extends Lr {
/**
* @override
*/
getLabel() {
return Zd.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
};
wr($d, "label", R1);
let P1 = $d;
const U1 = class qd extends Lr {
/**
* @override
*/
getLabel() {
return qd.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
/**
* 增加业务相关数据
* @param key 上报数据key
* @param value 上报数据
*/
addBizLog(r, n) {
}
appendSummaryField(r, n) {
}
};
wr(U1, "label", w1);
const B1 = class Jd extends Lr {
/**
* @override
*/
getLabel() {
return Jd.label;
}
};
wr(B1, "label", L1);
const V1 = class ef extends Lr {
/**
* @override
*/
getLabel() {
return ef.label;
}
};
wr(V1, "label", D1);
const F1 = class tf extends Lr {
/**
* @override
*/
getLabel() {
return tf.label;
}
};
wr(F1, "label", S1);
const j1 = class rf extends Lr {
/**
* @override
*/
getLabel() {
return rf.label;
}
};
wr(j1, "label", O1);
const H1 = class nf extends Lr {
/**
* @override
*/
getLabel() {
return nf.label;
}
};
wr(H1, "label", N1);
const G1 = class af extends Lr {
/**
* @override
*/
getLabel() {
return af.label;
}
};
wr(G1, "label", k1);
const z1 = class sf extends Lr {
/**
* @override
*/
getLabel() {
return sf.label;
}
};
wr(z1, "label", x1);
const wo = "zh", K1 = "i18-plugin", tc = class ic extends P1 {
constructor() {
super(...arguments), Va(this, "_lang", wo), Va(this, "_langDict", []), Va(this, "_current");
}
beforeInstall() {
ic.defaultDict && (this._langDict = ic.defaultDict);
}
afterInstall(r, n) {
var o;
n != null && n.langDict && (n == null ? void 0 : n.langDict).forEach((s) => {
const p = this._getLocalDict(s.lang, !0);
p ? Object.assign(p, s.map) : this._langDict.unshift(s);
}), this._lang = (n == null ? void 0 : n.lang) || navigator.language || navigator.userLanguage || wo, this._current = this._getLocalDict(this._lang, !0) || this._getLocalDict(this._lang), (o = r.logger) == null || o.i(K1, `use lang: ${this._lang} ${!!this._current}.`);
}
text(r, n) {
return this._current && this._current[r] && this._current[r][n] || "";
}
addDict(r, n) {
n = n || wo;
const o = this._getLocalDict(n, !0);
o ? Object.keys(r).forEach((s) => {
o[s] || (o[s] = {}), Object.assign(o[s], r[s]);
}) : this._langDict.unshift({ lang: n, map: r });
}
_getLocalDict(r, n = !1) {
for (let o = 0; o < this._langDict.length; o++)
if (n && this._langDict[o].lang === r || !n && r.indexOf(this._langDict[o].lang) === 0)
return this._langDict[o].map;
}
};
Va(tc, "version", "1.1.0-alpha.0"), Va(tc, "defaultDict");
let of = tc;
var W1 = Object.defineProperty, Y1 = (e, r, n) => r in e ? W1(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, Vt = (e, r, n) => (Y1(e, typeof r != "symbol" ? r + "" : r, n), n);
const su = {
development: "./misc2",
production: "https://log-sdk.ksapisrv.com/rest/wd/common/log/collect/misc2",
oversea: "https://logsdk.kwai-pro.com/rest/wd/common/log/collect/misc2",
"logger-oversea": "https://data-track-sgp.corp.kuaishou.com/rest/wd/common/log/collect/misc2"
}, Q1 = 5e3;
var ua = /* @__PURE__ */ ((e) => (e.SUMMARY = "KP_WEB_SUMMARY", e.REALTIME = "KP_WEB_REALTIME", e.DOWNLOAD = "KP_WEB_DOWNLOAD", e.EVENT = "KP_WEB_EVENT", e))(ua || {});
const X1 = {
summary: "KP_WEB_SUMMARY",
realtimeBeacon: "KP_WEB_REALTIME",
download: "KP_WEB_DOWNLOAD",
event: "KP_WEB_EVENT"
/* EVENT */
}, cf = "production", $1 = "streamlake", ou = [
"summary",
"realtimeBeacon",
"download",
"event"
/* EVENT */
];
(function() {
try {
if (typeof document < "u") {
var e = document.createElement("style");
e.appendChild(document.createTextNode("")), document.head.appendChild(e);
}
} catch (r) {
console.error("vite-plugin-css-injected-by-js", r);
}
})();
var Z1 = Object.defineProperty, q1 = (e, r, n) => r in e ? Z1(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, Dr = (e, r, n) => (q1(e, typeof r != "symbol" ? r + "" : r, n), n);
const J1 = "ControlsPlugin", eb = "I18nPlugin", tb = "LoggerPlugin", ib = "HotkeyPlugin", rb = "PlayInfoPlugin", nb = "RotatePlugin", ab = "PreviewPlugin", sb = "MaskPlugin", ob = "VRPlugin", cb = "DanmakuPlugin";
let Sr = class extends nn {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static isInstanceOfPlugin(r) {
return typeof r.beforeInstall == "function" && typeof r.afterInstall == "function" && typeof r.beforeUninstall == "function" && typeof r.afterUninstall == "function" && typeof r.getLabel == "function";
}
/**
* 控制条插槽按钮
*/
get controlsSoltBtns() {
}
/**
* 播放器实例化前钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
beforeInstall(r, n) {
}
/**
* 播放器实例化后钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
afterInstall(r, n) {
}
/**
* 播放器销毁前钩子
* @param player 播放器实例
*/
beforeUninstall(r) {
}
/**
* 播放器销毁后钩子
* @param player 播放器实例
*/
afterUninstall(r) {
}
};
Dr(Sr, "label"), /**
* 版本
*/
Dr(Sr, "version"), /**
* 当前环境是否支持
*/
Dr(Sr, "isSupported");
const lb = class lf extends Sr {
/**
* @override
*/
getLabel() {
return lf.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
};
Dr(lb, "label", J1);
const ub = class uf extends Sr {
/**
* @override
*/
getLabel() {
return uf.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
};
Dr(ub, "label", eb);
const hf = class df extends Sr {
/**
* @override
*/
getLabel() {
return df.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
/**
* 增加业务相关数据
* @param key 上报数据key
* @param value 上报数据
*/
addBizLog(r, n) {
}
appendSummaryField(r, n) {
}
};
Dr(hf, "label", tb);
let hb = hf;
const db = class ff extends Sr {
/**
* @override
*/
getLabel() {
return ff.label;
}
};
Dr(db, "label", ib);
const fb = class pf extends Sr {
/**
* @override
*/
getLabel() {
return pf.label;
}
};
Dr(fb, "label", rb);
const pb = class _f extends Sr {
/**
* @override
*/
getLabel() {
return _f.label;
}
};
Dr(pb, "label", nb);
const _b = class Af extends Sr {
/**
* @override
*/
getLabel() {
return Af.label;
}
};
Dr(_b, "label", ab);
const Ab = class vf extends Sr {
/**
* @override
*/
getLabel() {
return vf.label;
}
};
Dr(Ab, "label", sb);
const vb = class gf extends Sr {
/**
* @override
*/
getLabel() {
return gf.label;
}
};
Dr(vb, "label", ob);
const gb = class mf extends Sr {
/**
* @override
*/
getLabel() {
return mf.label;
}
};
Dr(gb, "label", cb);
var $n = /* @__PURE__ */ ((e) => (e.ERROR = "error", e.MANIFEST_PARSED = "manifestparsed", e.LEVEL_SWITCHING = "levelswitching", e.LEVEL_SWITCHED = "levelswitched", e.LEVEL_SWITCH_PLAYING = "levelswitchplaying", e.LEVEL_SWITCH_FAILED = "levelswitchfailed", e.LEVEL_UPDATED = "levelupdated", e.AUDIO_TRACKS_SWITCHING = "audiotrackswitching", e.AUDIO_TRACKS_SWITCHED = "audiotrackswitched", e.LOADSTART = "loadstart", e.PROGRESS = "progress", e.SUSPEND = "suspend", e.ABORT = "abort", e.EMPTIED = "emptied", e.STALLED = "stalled", e.LOADEDMETADATA = "loadedmetadata", e.LOADEDDATA = "loadeddata", e.CANPLAY = "canplay", e.CANPLAYTHROUGH = "canplaythrough", e.PLAYING = "playing", e.WAITING = "waiting", e.SEEKING = "seeking", e.SEEKED = "seeked", e.ENDED = "ended", e.DURATIONCHANGE = "durationchange", e.TIMEUPDATE = "timeupdate", e.PLAY = "play", e.PAUSE = "pause", e.RATECHANGE = "ratechange", e.RESIZE = "resize", e.VOLUMECHANGE = "volumechange", e.ENTER_PICTURE_IN_PICTURE = "enterpictureinpicture", e.LEAVE_PICTURE_IN_PICTURE = "leavepictureinpicture", e.REPORT = "report", e.VIDEO_RENDERER_CHANGE = "videorendererchange", e.FULLSCREEN_CHANGE = "fullscreenchange", e.ATTRIBUTE_CHANGE = "attribute:change", e.INTERACTION = "interaction", e.LIVE_SHIFT_CHANGE = "liveshiftchange", e.LIVE_SHIFT_TYPE_CHANGE = "liveshifttypechange", e.OBJECT_FIT_CHANGE = "objectfitchange", e.ATTRIBUTE_CHANGE_CONFIG = "attribute:change:config", e.ATTRIBUTE_CHANGE_SRC = "attribute:change:src", e.ATTRIBUTE_CHANGE_VIDEO_ID = "attribute:change:videoid", e.ATTRIBUTE_CHANGE_PREVIEW_URL = "attribute:change:previewurl", e.ATTRIBUTE_CHANGE_MASK_URL = "attribute:change:maskurl", e.ATTRIBUTE_CHANGE_CROSS_ORIGIN = "attribute:change:crossorigin", e.ATTRIBUTE_CHANGE_PRELOAD = "attribute:change:preload", e.ATTRIBUTE_CHANGE_CURRENT_TIME = "attribute:change:currenttime", e.ATTRIBUTE_CHANGE_DEFAULT_PLAYBACK_RATE = "attribute:change:defaultplaybackrate", e.ATTRIBUTE_CHANGE_PLAYBACK_RATE = "attribute:change:playbackrate", e.ATTRIBUTE_CHANGE_AUTOPLAY = "attribute:change:autoplay", e.ATTRIBUTE_CHANGE_LOOP = "attribute:change:loop", e.ATTRIBUTE_CHANGE_CONTROLS = "attribute:change:controls", e.ATTRIBUTE_CHANGE_VOLUME = "attribute:change:volume", e.ATTRIBUTE_CHANGE_MUTED = "attribute:change:muted", e.ATTRIBUTE_CHANGE_DEFAULT_MUTED = "attribute:change:defaultmuted", e.ATTRIBUTE_CHANGE_POSTER = "attribute:change:poster", e.ATTRIBUTE_CHANGE_DISABLE_PICTURE_IN_PICTURE = "attribute:change:disablepictureinpicture", e.ATTRIBUTE_CHANGE_PLAYSINLINE = "attribute:change:playsinline", e.ATTRIBUTE_CHANGE_DISABLE_ADAPTIVE = "attribute:change:disableadaptive", e.ATTRIBUTE_CHANGE_DISABLE_DOWNLOAD = "attribute:change:disabledownload", e.ATTRIBUTE_CHANGE_DISABLE_MASK = "attribute:change:disablemask", e.ATTRIBUTE_CHANGE_DISABLE_HOTKEY = "attribute:change:disablehotkey", e.ATTRIBUTE_CHANGE_DISABLE_DANMAKU = "attribute:change:disabledanmaku", e.ATTRIBUTE_CHANGE_DANMAKU_RENDERING = "attribute:change:danmakurendering", e.ATTRIBUTE_CHANGE_DANMAKU_CONTROLS_POS = "attribute:change:danmakucontrolspos", e.ATTRIBUTE_CHANGE_DANMAKU_CONTROLS_POS_FULLSCREEN = "attribute:change:danmakucontrolsposfullscreen", e.ATTRIBUTE_CHANGE_CURRENT_LEVEL = "attribute:change:currentlevel", e.ATTRIBUTE_CHANGE_NEXT_LEVEL = "attribute:change:nextlevel", e.ATTRIBUTE_CHANGE_CURRENT_FRAME = "attribute:change:currentframe", e.ATTRIBUTE_CHANGE_AUDIO_TRACK = "attribute:change:audiotrack", e.ATTRIBUTE_CHANGE_PREFETCH = "attribute:change:prefetch", e.ATTRIBUTE_CHANGE_SHOW_PROGRESS = "attribute:change:showprogress", e.ATTRIBUTE_CHANGE_SHOW_TIME = "attribute:change:showtime", e.ATTRIBUTE_CHANGE_SHOW_NEXT = "attribute:change:shownext", e.ATTRIBUTE_CHANGE_SHOW_PREV = "attribute:change:showprev", e.ATTRIBUTE_CHANGE_BIZ_DATA = "attribute:change:bizdata", e.ATTRIBUTE_CHANGE_LIVE_TIME = "attribute:change:livetime", e.ATTRIBUTE_CHANGE_SHOW_INFO_PANEL = "attribute:change:showinfopanel", e.CLICK_NEXT = "clicknext", e.CLICK_LOGIN = "clicklogin", e.CLICK_REGISTER = "clickregister", e.CLICK_VIP = "clickvip", e))($n || {}), us, mb = new Uint8Array(16);
function bb() {
if (!us && (us = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto < "u" && typeof msCrypto.getRandomValues == "function" && msCrypto.getRandomValues.bind(msCrypto), !us))
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
return us(mb);
}
const Eb = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
function yb(e) {
return typeof e == "string" && Eb.test(e);
}
var Ki = [];
for (var Lo = 0; Lo < 256; ++Lo)
Ki.push((Lo + 256).toString(16).substr(1));
function Cb(e) {
var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n = (Ki[e[r + 0]] + Ki[e[r + 1]] + Ki[e[r + 2]] + Ki[e[r + 3]] + "-" + Ki[e[r + 4]] + Ki[e[r + 5]] + "-" + Ki[e[r + 6]] + Ki[e[r + 7]] + "-" + Ki[e[r + 8]] + Ki[e[r + 9]] + "-" + Ki[e[r + 10]] + Ki[e[r + 11]] + Ki[e[r + 12]] + Ki[e[r + 13]] + Ki[e[r + 14]] + Ki[e[r + 15]]).toLowerCase();
if (!yb(n))
throw TypeError("Stringified UUID is invalid");
return n;
}
function bf(e, r, n) {
e = e || {};
var o = e.random || (e.rng || bb)();
if (o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, r) {
n = n || 0;
for (var s = 0; s < 16; ++s)
r[n + s] = o[s];
return r;
}
return Cb(o);
}
const Do = "log-ctx";
class Tb {
constructor() {
Vt(this, "_env", cf), Vt(this, "_reportTypes", []), Vt(this, "_player"), Vt(this, "_logger"), Vt(this, "_logBaseInfo", this._getDefaultLogBaseInfo()), Vt(this, "_biz", {}), Vt(this, "_extraSummaryFields", {}), Vt(this, "_forceSendBeacon", !1);
}
setBaseInfo(r, n, o) {
this._player = r, this._logger = r.logger, this._logBaseInfo.env = this._env = n, this._reportTypes = o;
}
setBizData(r) {
var n, o;
if ((n = this._logger) == null || n.i(Do, "set biz", r), !r) {
this._logBaseInfo = this._getDefaultLogBaseInfo();
return;
}
const s = {};
Object.keys(r).forEach((p) => {
var g;
const C = this._underscoreToCamelCase(p), y = r[p];
if (["sessionId", "deviceId", "userId", "globalId", "networkType", "packageName", "versionName", "channel"].indexOf(C) >= 0 && (typeof y == "string" || typeof y == "number")) {
const x = this._val2String(r[p]).trim();
x && ((g = this._logger) == null || g.i(Do, "biz to log:", C, x), s[C] = x);
}
p !== "secretId" && p !== "secretKey" && (this._biz[p] = y);
}), Object.assign(this._logBaseInfo, s), s.deviceId && ((o = this._logger) == null || o.i(Do, `update did by bizData. ${s.deviceId}`), h0(this._logBaseInfo.deviceId));
}
preprocessingLog(r, n, o) {
var s, p;
if (n)
return n = Object.assign(n, {
player_version: ((s = this._player) == null ? void 0 : s.version) || "",
pack_version: ((p = this._player) == null ? void 0 : p.packVersion) || "",
biz: this._biz
}), r === ua.SUMMARY && typeof n == "object" && (o ? n.extra = Object.assign({}, this._extraSummaryFields, o) : n.extra = this._extraSummaryFields), n;
}
clearExtraSummary() {
this._extraSummaryFields = {};
}
appendSummaryField(r, n) {
this._extraSummaryFields[r] = n;
}
get reportTypes() {
return this._reportTypes;
}
get logBaseInfo() {
var r;
return (r = this._player) != null && r.productName && (this._logBaseInfo.productName = this._player.productName), this._logBaseInfo.deviceId || (this._logBaseInfo.deviceId = Is), this._logBaseInfo;
}
get player() {
return this._player;
}
set forceSendBeacon(r) {
this._forceSendBeacon = r;
}
get forceSendBeacon() {
return this._forceSendBeacon;
}
_getDefaultLogBaseInfo() {
let r = 10;
return Pn.os.name === "iOS" ? r = 9 : Pn.os.name === "Android" && (r = 8), {
env: this._env,
productName: $1,
sessionId: bf(),
platform: r,
deviceId: Is,
userId: "",
globalId: "",
networkType: "",
packageName: "",
versionName: "",
channel: ""
};
}
_underscoreToCamelCase(r) {
return r.replace(/_([a-z])/g, (n, o) => o.toUpperCase());
}
_val2String(r) {
return typeof r == "number" ? r.toString() : r || "";
}
}
const So = "kwai-player-web-log-temp", Ib = 3 * 24 * 3600 * 1e3, Rb = 5 * 1e3, cu = 1, Wn = "log-reissue";
class wb {
constructor(r, n, o) {
Vt(this, "_ctx"), Vt(this, "_logger"), Vt(this, "_webLogger"), Vt(this, "_active", !1), Vt(this, "_processingTs", 0), Vt(this, "_lc", new Lh()), Vt(this, "_timer", 0), Vt(this, "_checkMissing", !1), Vt(this, "_tick", () => {
if (!this._active || !this._ctx.player)
return;
this._checkMissing && (this._checkMissing = !1, this._checkMissingLog());
const s = performance.now();
if (s - this._processingTs >= Rb) {
this._processingTs = s;
const p = this._ctx.preprocessingLog(ua.SUMMARY, this._ctx.player.audienceStat, { reissue_log: 1 });
p && (this._logger.v(Wn, "write temp"), this._writeTemp(this._webLogger.generateFormData(this._ctx.logBaseInfo, [{ key: ua.SUMMARY, value: p }])));
}
}), Vt(this, "_startTimer", () => {
this._timer || (this._timer = +setInterval(this._tick, 1e3));
}), Vt(this, "_stopTimer", () => {
clearInterval(this._timer), this._timer = 0;
}), this._ctx = r, this._logger = n, this._webLogger = o, this._lc.timeout = Ib;
}
start() {
this._logger.i(Wn, "start"), this._active || (this._active = !0, this._processingTs = performance.now(), this._checkMissing = !0, this._startTimer());
}
stop() {
this._logger.i(Wn, "stop"), this._active = !1, this._clear(), this._stopTimer();
}
_checkMissingLog() {
const r = this._readTemp();
this._clear(), r ? (this._logger.i(Wn, "send missing log"), this._webLogger.send(this._ctx.logBaseInfo.env, ua.SUMMARY, r.value)) : this._logger.i(Wn, "no missing log");
}
_clear() {
try {
localStorage == null || localStorage.removeItem(So);
} catch (r) {
}
}
_writeTemp(r) {
if (!r)
return;
const n = {
version: cu,
value: r,
checkSum: this._fletcher16(r)
};
try {
this._lc.write(So, btoa(JSON.stringify(n)));
} catch (o) {
}
}
_readTemp() {
const r = this._lc.read(So, !0);
if (typeof r == "string")
try {
const n = JSON.parse(atob(r));
if (n.version === cu && typeof n.value == "string" && n.checkSum === this._fletcher16(n.value))
return this._logger.i(Wn, "read success"), n;
this._logger.i(Wn, "read failed", n);
} catch (n) {
}
}
_fletcher16(r) {
let n = 0, o = 0;
for (let s = 0; s < r.length; s++)
n = (n + r.charCodeAt(s)) % 255, o = (o + n) % 255;
return o << 8 | n;
}
}
const lu = {
unknown: 0,
none: 1,
wifi: 2,
"4g": 3,
"3g": 4,
"2g": 5,
"5g": 7,
"slow-2g": 5
}, Oo = (/* @__PURE__ */ new Date()).toString().match(/GMT\+\d+/);
let No = "";
function Lb() {
try {
return parseInt((localStorage == null ? void 0 : localStorage.getItem("kwai_player_client_increment_id")) || "") || 0;
} catch (e) {
}
return 0;
}
const aa = "web-logger", rc = class Zn {
constructor(r) {
Vt(this, "_waitingQueue", []), Vt(this, "_nextTickTimer"), Vt(this, "_logger"), this._logger = r;
}
sendLog(r, n, o, s = !1, p) {
this._logger.i(aa, "sendLog", r, n, o, `forceSendBeacon: ${s} immediately: ${p}`), o && (this._waitingQueue.push({ key: n, value: o }), p ? (this.send(r.env, r.productName, this.generateFormData(r, this._waitingQueue), s), this._waitingQueue.splice(0)) : this._nextTickTimer || (this._nextTickTimer = setTimeout(() => {
this._nextTickTimer = void 0, this.send(r.env, r.productName, this.generateFormData(r, this._waitingQueue), s), this._waitingQueue.splice(0);
}, 0)));
}
send(r, n, o, s = !1) {
if (this._logger.i(aa, "send", r, n, !!o, `forceSendBeacon: ${s}`), !o)
return;
let p = su[r] || su.production;
Zn._clientIncrementId++;
try {
localStorage && (localStorage.kwai_player_client_increment_id = Zn._clientIncrementId);
} catch (C) {
}
const g = new kl(p, !0);
if (g.query.v = "3.10.24", g.query.kpn = n, p = g.toString(), this._logger.i(aa, "send", r, n, !!o, p), s && navigator.sendBeacon) {
const C = navigator.sendBeacon(p, o);
this._logger.i(aa, "send data use sendBeacon.", C), C || this._sendByXhr(p, o);
} else
this._sendByXhr(p, o);
}
_sendByXhr(r, n) {
this._logger.i(aa, "send data use xhr.");
const o = new XMLHttpRequest();
o.open("POST", r), o.setRequestHeader("Content-Type", "text/plain;charset=UTF-8"), o.onerror = o.ontimeout = () => {
this._logger.i("sendLog error"), o.onerror = o.ontimeout = o.onload = null;
}, o.onload = () => {
o.onerror = o.ontimeout = o.onload = null;
}, o.timeout = Q1, o.send(n);
}
generateFormData(r, n) {
this._logger.i(aa, `device_id: ${r.deviceId}`);
const o = {
common: Zn._buildCommon(
r,
{
service_name: "KwaiPlayerWeb"
}
),
logs: n.map((s) => Zn._buildEvent(r, s.key, s.value))
};
return o.logs.length ? JSON.stringify(o) : "";
}
static _buildEvent(r, n, o) {
No || (No = bf());
const s = {
identity: No,
page: location.href,
hostname: location.hostname,
page_type: 2,
params: new kl(location.href, !0).query
};
return {
client_timestamp: Date.now(),
client_increment_id: Zn._clientIncrementId,
session_id: r.sessionId,
time_zone: Zn._timeZone,
stat_package: {
custom_stat_event: {
key: n,
value: JSON.stringify(Object.assign({}, o, { url_package: s }))
}
}
};
}
static _buildCommon(r, n) {
return Al({
identity_package: {
device_id: r.deviceId,
global_id: r.globalId,
user_id: r.userId
},
app_package: {
language: navigator.language,
platform: r.platform,
container: r.platform === 10 ? "WEB" : "H5",
package_name: r.packageName,
product_name: r.productName,
version_name: r.versionName,
channel: r.channel
},
device_package: {
os_version: Pn.os.version,
model: Pn.os.name,
ua: navigator.userAgent
},
need_encrypt: !1,
sdk_version: "",
h5_extra_attr: this._getH5ExtraAttr(r),
global_attr: "{}",
network_package: {
type: this._getNetworkType(r.networkType)
}
}, n);
}
static _getNetworkType(r) {
var n;
const o = r || ((n = (navigator == null ? void 0 : navigator.connection) || (navigator == null ? void 0 : navigator.mozConnection) || (navigator == null ? void 0 : navigator.webkitConnection)) == null ? void 0 : n.effectiveType);
return o && lu[o] || lu.unknown;
}
static _getH5ExtraAttr(r) {
const n = parseFloat(devicePixelRatio.toFixed(3)) || 1;
return JSON.stringify({
sdk_name: "",
sdk_version: "",
sdk_bundle: "",
app_version_name: r.versionName,
resolution: `${Math.floor(screen.width * n)}x${Math.floor(screen.height * n)}`,
screen_width: Math.floor(screen.width),
screen_height: Math.floor(screen.height),
device_pixel_ratio: n,
domain: location.origin,
fromIframe: self !== top
});
}
};
Vt(rc, "_clientIncrementId", Lb()), Vt(rc, "_timeZone", Oo && Oo[0] ? Oo[0] : "");
let Db = rc;
const Sa = "logger-plugin";
class Ef extends hb {
constructor() {
super(...arguments), Vt(this, "_summaryAlreadySend", !1), Vt(this, "_webLogger"), Vt(this, "_logger"), Vt(this, "_ctx", new Tb()), Vt(this, "_logReissue"), Vt(this, "_parseBizData", () => {
var r, n, o;
(n = this._logger) == null || n.i(Sa, "parse biz data", (r = this._ctx.player) == null ? void 0 : r.bizData), this._ctx.setBizData((o = this._ctx.player) == null ? void 0 : o.bizData);
}), Vt(this, "_onReport", (r) => {
var n, o;
if (this._ctx.reportTypes.indexOf(r.type) !== -1) {
const s = X1[r.type];
s ? ((n = this._logger) == null || n.i(Sa, "sendLog", this._ctx.logBaseInfo.productName, s), this._send(s, r.value)) : (o = this._logger) == null || o.i(Sa, "unknown weblogger key.");
}
}), Vt(this, "_onSrcChange", () => {
var r;
this._sendSummary(), this._summaryAlreadySend = !1, (r = this._logReissue) == null || r.start();
}), Vt(this, "_sendSummary", () => {
var r, n;
!this._ctx.player || this._summaryAlreadySend || !this._ctx.player.audienceStat || ((r = this._logReissue) == null || r.stop(), this._summaryAlreadySend = !0, (n = this._logger) == null || n.i(Sa, "send summary"), this._send(ua.SUMMARY, this._ctx.player.audienceStat, !0));
}), Vt(this, "_onBeforeunload", () => {
this._sendSummary();
});
}
beforeInstall(r, n) {
let o;
n && n.reportTypes && Array.isArray(n.reportTypes) && (o = n.reportTypes.filter((s) => ou.indexOf(s) >= 0)), n != null && n.productName && (r.productName = n.productName), typeof (n == null ? void 0 : n.forceSendBeacon) < "u" && (this._ctx.forceSendBeacon = n.forceSendBeacon), this._logger = r.logger, this._ctx.setBaseInfo(r, (n == null ? void 0 : n.env) || cf, o || ou), this._webLogger || (this._webLogger = new Db(r.logger)), this._logReissue = new wb(this._ctx, r.logger, this._webLogger), r.on($n.REPORT, this._onReport), r.on($n.ATTRIBUTE_CHANGE_SRC, this._onSrcChange), r.on($n.ATTRIBUTE_CHANGE_BIZ_DATA, this._parseBizData), window.addEventListener("beforeunload", this._onBeforeunload), Pn && Pn.device.type === "mobile" && window.addEventListener("unload", this._onBeforeunload), this._parseBizData();
}
beforeUninstall() {
this._sendSummary();
}
afterUninstall() {
var r, n, o;
(r = this._ctx.player) == null || r.off($n.REPORT, this._onReport), (n = this._ctx.player) == null || n.off($n.ATTRIBUTE_CHANGE_SRC, this._onSrcChange), (o = this._ctx.player) == null || o.off($n.ATTRIBUTE_CHANGE_BIZ_DATA, this._parseBizData), window.removeEventListener("beforeunload", this._onBeforeunload), window.removeEventListener("unload", this._onBeforeunload);
}
appendSummaryField(r, n) {
var o;
(o = this._logger) == null || o.i(Sa, "add summary field", r, n), this._ctx.appendSummaryField(r, n);
}
_send(r, n, o) {
var s;
n && ((s = this._webLogger) == null || s.sendLog(this._ctx.logBaseInfo, r, this._ctx.preprocessingLog(r, n), this._ctx.forceSendBeacon, o));
}
}
Vt(Ef, "version", "1.1.0-alpha.0");
(function() {
try {
if (typeof document != "undefined") {
var e = document.createElement("style");
e.appendChild(document.createTextNode("._container_afsrn_1{background-color:rgba(0,0,0,.5);border-radius:.375em;position:relative;color:#fff;font-size:12px;font-family:Arial,Roboto,Noto,sans-serif;box-sizing:border-box;padding:2em .625em .625em;overflow:auto;word-break:break-all;white-space:normal;max-width:500px;max-height:calc(100% - 10px);line-height:1.5;margin:.3125em}._container-h5_afsrn_19{background-color:rgba(0,0,0,.5);border-radius:.375em;position:relative;color:#fff;font-size:12px;font-family:Arial,Roboto,Noto,sans-serif;box-sizing:border-box;padding:2em .625em .625em;overflow:auto;word-break:break-all;white-space:normal;font-size:14px;width:100%;height:100%}._close-btn_afsrn_36{position:absolute;right:0;top:0;cursor:pointer;word-break:keep-all;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:.625em}._btn-tip_afsrn_49{background-color:rgba(0,0,0,.5);border-radius:.375em;position:absolute;left:50%;transform:translate(-50%);bottom:2.1875em;white-space:nowrap;padding:.5em}._actions_afsrn_60{display:flex;justify-content:flex-end;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:0}._actions_afsrn_60 ._copy-btn_afsrn_69{word-break:keep-all;cursor:pointer;padding:.625em 0 0 .625em}._info-item_afsrn_75{display:flex}._info-item-name_afsrn_79{width:20%;min-width:7.5em;text-align:right;margin-right:.625em;flex-shrink:0}._info-item-value_afsrn_87{flex-grow:1;text-align:left}._item-svg_afsrn_92{display:inline-block;width:60%;height:1em;margin-right:.625em;background:rgba(255,255,255,.2)}._item-value_afsrn_100{display:inline-block}@media (hover: hover){._close-btn_afsrn_36:hover,._copy-btn_afsrn_69:hover{color:#ccc}}")), document.head.appendChild(e);
}
} catch (r) {
console.error("vite-plugin-css-injected-by-js", r);
}
})();
var Sb = Object.defineProperty, Ob = (e, r, n) => r in e ? Sb(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, xn = (e, r, n) => (Ob(e, typeof r != "symbol" ? r + "" : r, n), n);
(function() {
try {
if (typeof document < "u") {
var e = document.createElement("style");
e.appendChild(document.createTextNode("")), document.head.appendChild(e);
}
} catch (r) {
console.error("vite-plugin-css-injected-by-js", r);
}
})();
var Nb = Object.defineProperty, kb = (e, r, n) => r in e ? Nb(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, lr = (e, r, n) => (kb(e, typeof r != "symbol" ? r + "" : r, n), n);
const xb = "ControlsPlugin", yf = "I18nPlugin", Mb = "LoggerPlugin", Pb = "HotkeyPlugin", Ub = "PlayInfoPlugin", Bb = "RotatePlugin", Vb = "PreviewPlugin", Fb = "MaskPlugin", jb = "VRPlugin", Hb = "DanmakuPlugin";
var nc = /* @__PURE__ */ ((e) => (e.PLAY_BAR_LEFT = "playBarLeft", e.PLAY_BAR_RIGHT = "playBarRight", e.CONTEXT_MENU = "contextMenu", e))(nc || {});
class Gb {
constructor() {
lr(this, "_callbacks", []);
}
add(r) {
this._callbacks.push(r);
}
remove(r) {
const n = this._callbacks.findIndex((o) => o === r);
n >= 0 && this._callbacks.splice(n, 1);
}
call(r) {
this._callbacks.forEach((n) => n(r));
}
destroy() {
this._callbacks.splice(0, this._callbacks.length);
}
}
let Or = class extends nn {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static isInstanceOfPlugin(r) {
return typeof r.beforeInstall == "function" && typeof r.afterInstall == "function" && typeof r.beforeUninstall == "function" && typeof r.afterUninstall == "function" && typeof r.getLabel == "function";
}
/**
* 控制条插槽按钮
*/
get controlsSoltBtns() {
}
/**
* 播放器实例化前钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
beforeInstall(r, n) {
}
/**
* 播放器实例化后钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
afterInstall(r, n) {
}
/**
* 播放器销毁前钩子
* @param player 播放器实例
*/
beforeUninstall(r) {
}
/**
* 播放器销毁后钩子
* @param player 播放器实例
*/
afterUninstall(r) {
}
};
lr(Or, "label"), /**
* 版本
*/
lr(Or, "version"), /**
* 当前环境是否支持
*/
lr(Or, "isSupported");
const zb = class Cf extends Or {
/**
* @override
*/
getLabel() {
return Cf.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
};
lr(zb, "label", xb);
const Kb = class Tf extends Or {
/**
* @override
*/
getLabel() {
return Tf.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
};
lr(Kb, "label", yf);
const Wb = class If extends Or {
/**
* @override
*/
getLabel() {
return If.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
/**
* 增加业务相关数据
* @param key 上报数据key
* @param value 上报数据
*/
addBizLog(r, n) {
}
appendSummaryField(r, n) {
}
};
lr(Wb, "label", Mb);
const Yb = class Rf extends Or {
/**
* @override
*/
getLabel() {
return Rf.label;
}
};
lr(Yb, "label", Pb);
const wf = class Lf extends Or {
/**
* @override
*/
getLabel() {
return Lf.label;
}
};
lr(wf, "label", Ub);
let Qb = wf;
const Xb = class Df extends Or {
/**
* @override
*/
getLabel() {
return Df.label;
}
};
lr(Xb, "label", Bb);
const $b = class Sf extends Or {
/**
* @override
*/
getLabel() {
return Sf.label;
}
};
lr($b, "label", Vb);
const Zb = class Of extends Or {
/**
* @override
*/
getLabel() {
return Of.label;
}
};
lr(Zb, "label", Fb);
const qb = class Nf extends Or {
/**
* @override
*/
getLabel() {
return Nf.label;
}
};
lr(qb, "label", jb);
const Jb = class kf extends Or {
/**
* @override
*/
getLabel() {
return kf.label;
}
};
lr(Jb, "label", Hb);
var gn = /* @__PURE__ */ ((e) => (e.ERROR = "error", e.MANIFEST_PARSED = "manifestparsed", e.LEVEL_SWITCHING = "levelswitching", e.LEVEL_SWITCHED = "levelswitched", e.LEVEL_SWITCH_PLAYING = "levelswitchplaying", e.LEVEL_SWITCH_FAILED = "levelswitchfailed", e.LEVEL_UPDATED = "levelupdated", e.AUDIO_TRACKS_SWITCHING = "audiotrackswitching", e.AUDIO_TRACKS_SWITCHED = "audiotrackswitched", e.LOADSTART = "loadstart", e.PROGRESS = "progress", e.SUSPEND = "suspend", e.ABORT = "abort", e.EMPTIED = "emptied", e.STALLED = "stalled", e.LOADEDMETADATA = "loadedmetadata", e.LOADEDDATA = "loadeddata", e.CANPLAY = "canplay", e.CANPLAYTHROUGH = "canplaythrough", e.PLAYING = "playing", e.WAITING = "waiting", e.SEEKING = "seeking", e.SEEKED = "seeked", e.ENDED = "ended", e.DURATIONCHANGE = "durationchange", e.TIMEUPDATE = "timeupdate", e.PLAY = "play", e.PAUSE = "pause", e.RATECHANGE = "ratechange", e.RESIZE = "resize", e.VOLUMECHANGE = "volumechange", e.ENTER_PICTURE_IN_PICTURE = "enterpictureinpicture", e.LEAVE_PICTURE_IN_PICTURE = "leavepictureinpicture", e.REPORT = "report", e.VIDEO_RENDERER_CHANGE = "videorendererchange", e.FULLSCREEN_CHANGE = "fullscreenchange", e.ATTRIBUTE_CHANGE = "attribute:change", e.INTERACTION = "interaction", e.LIVE_SHIFT_CHANGE = "liveshiftchange", e.LIVE_SHIFT_TYPE_CHANGE = "liveshifttypechange", e.OBJECT_FIT_CHANGE = "objectfitchange", e.ATTRIBUTE_CHANGE_CONFIG = "attribute:change:config", e.ATTRIBUTE_CHANGE_SRC = "attribute:change:src", e.ATTRIBUTE_CHANGE_VIDEO_ID = "attribute:change:videoid", e.ATTRIBUTE_CHANGE_PREVIEW_URL = "attribute:change:previewurl", e.ATTRIBUTE_CHANGE_MASK_URL = "attribute:change:maskurl", e.ATTRIBUTE_CHANGE_CROSS_ORIGIN = "attribute:change:crossorigin", e.ATTRIBUTE_CHANGE_PRELOAD = "attribute:change:preload", e.ATTRIBUTE_CHANGE_CURRENT_TIME = "attribute:change:currenttime", e.ATTRIBUTE_CHANGE_DEFAULT_PLAYBACK_RATE = "attribute:change:defaultplaybackrate", e.ATTRIBUTE_CHANGE_PLAYBACK_RATE = "attribute:change:playbackrate", e.ATTRIBUTE_CHANGE_AUTOPLAY = "attribute:change:autoplay", e.ATTRIBUTE_CHANGE_LOOP = "attribute:change:loop", e.ATTRIBUTE_CHANGE_CONTROLS = "attribute:change:controls", e.ATTRIBUTE_CHANGE_VOLUME = "attribute:change:volume", e.ATTRIBUTE_CHANGE_MUTED = "attribute:change:muted", e.ATTRIBUTE_CHANGE_DEFAULT_MUTED = "attribute:change:defaultmuted", e.ATTRIBUTE_CHANGE_POSTER = "attribute:change:poster", e.ATTRIBUTE_CHANGE_DISABLE_PICTURE_IN_PICTURE = "attribute:change:disablepictureinpicture", e.ATTRIBUTE_CHANGE_PLAYSINLINE = "attribute:change:playsinline", e.ATTRIBUTE_CHANGE_DISABLE_ADAPTIVE = "attribute:change:disableadaptive", e.ATTRIBUTE_CHANGE_DISABLE_DOWNLOAD = "attribute:change:disabledownload", e.ATTRIBUTE_CHANGE_DISABLE_MASK = "attribute:change:disablemask", e.ATTRIBUTE_CHANGE_DISABLE_HOTKEY = "attribute:change:disablehotkey", e.ATTRIBUTE_CHANGE_DISABLE_DANMAKU = "attribute:change:disabledanmaku", e.ATTRIBUTE_CHANGE_DANMAKU_RENDERING = "attribute:change:danmakurendering", e.ATTRIBUTE_CHANGE_DANMAKU_CONTROLS_POS = "attribute:change:danmakucontrolspos", e.ATTRIBUTE_CHANGE_DANMAKU_CONTROLS_POS_FULLSCREEN = "attribute:change:danmakucontrolsposfullscreen", e.ATTRIBUTE_CHANGE_CURRENT_LEVEL = "attribute:change:currentlevel", e.ATTRIBUTE_CHANGE_NEXT_LEVEL = "attribute:change:nextlevel", e.ATTRIBUTE_CHANGE_CURRENT_FRAME = "attribute:change:currentframe", e.ATTRIBUTE_CHANGE_AUDIO_TRACK = "attribute:change:audiotrack", e.ATTRIBUTE_CHANGE_PREFETCH = "attribute:change:prefetch", e.ATTRIBUTE_CHANGE_SHOW_PROGRESS = "attribute:change:showprogress", e.ATTRIBUTE_CHANGE_SHOW_TIME = "attribute:change:showtime", e.ATTRIBUTE_CHANGE_SHOW_NEXT = "attribute:change:shownext", e.ATTRIBUTE_CHANGE_SHOW_PREV = "attribute:change:showprev", e.ATTRIBUTE_CHANGE_BIZ_DATA = "attribute:change:bizdata", e.ATTRIBUTE_CHANGE_LIVE_TIME = "attribute:change:livetime", e.ATTRIBUTE_CHANGE_SHOW_INFO_PANEL = "attribute:change:showinfopanel", e.CLICK_NEXT = "clicknext", e.CLICK_LOGIN = "clicklogin", e.CLICK_REGISTER = "clickregister", e.CLICK_VIP = "clickvip", e))(gn || {});
const xf = za(void 0), uu = "kwai_player_ll_enabled", eE = "play-info-context", tE = (e) => {
const { children: r, player: n } = e, o = n.logger, s = new Rl(), p = Rl.isSupported() && !Ut, g = `${n.packVersion}(${n.version})`, C = new Lh(), [y, x] = ot(!1), h = (D, W = !1) => {
if (D = D && p, D ? (F(), n.outputLogger = s.getLoggerForAdd()) : n.outputLogger = void 0, x(D), W)
try {
C.write(uu, D ? "1" : "0");
} catch (j) {
}
}, F = () => {
try {
localStorage.setItem("kwai-kernel-log", JSON.stringify({ value: "i", time: Date.now() })), localStorage.setItem("kwai-player-log", JSON.stringify({ value: "i", time: Date.now() }));
} catch (D) {
}
}, I = () => {
h(!y, !0);
}, T = () => {
s.downloadLog();
};
try {
const D = (C.read(uu) == "1" || !1) && p;
x(D), D && h(D);
} catch (D) {
}
return Ft(() => () => {
o.i(eE, "destroy"), s.destroy();
}, []), /* @__PURE__ */ De(
xf.Provider,
{
value: {
player: n,
playerVersion: g,
localLogSwitch: y,
localLogEnabled: p,
toggleLocalLog: I,
downloadLocalLog: T
},
children: r
}
);
}, iE = "_container_afsrn_1", rE = "_actions_afsrn_60", Ri = {
container: iE,
"container-h5": "_container-h5_afsrn_19",
"close-btn": "_close-btn_afsrn_36",
"btn-tip": "_btn-tip_afsrn_49",
actions: rE,
"copy-btn": "_copy-btn_afsrn_69",
"info-item": "_info-item_afsrn_75",
"info-item-name": "_info-item-name_afsrn_79",
"info-item-value": "_info-item-value_afsrn_87",
"item-svg": "_item-svg_afsrn_92",
"item-value": "_item-value_afsrn_100"
};
function Kr(e) {
const { title: r, value: n } = e;
return /* @__PURE__ */ De("div", { className: Ri["info-item"], children: [
/* @__PURE__ */ De("div", { className: Ri["info-item-name"], children: [
r,
":"
] }),
/* @__PURE__ */ De("div", { className: Ri["info-item-value"], children: n })
] });
}
function nE(e) {
const { dataArray: r } = e, n = St(null), [o, s] = ot("");
return Ft(() => {
if (n != null && n.current) {
const { width: p, height: g } = n.current.getBoundingClientRect(), C = Math.max(...r) || 1, y = g - 2, x = p / r.length;
let h = `M0 ${y * (C - r[0]) / C + 1}`;
for (let F = 1; F < r.length; F++)
h += ` L${F * x} ${y * (C - r[F]) / C + 1}`;
s(h);
}
}, [r]), /* @__PURE__ */ De("svg", { ref: n, height: "100%", width: "100%", style: "display:block", children: /* @__PURE__ */ De("path", { fill: "none", stroke: "#fff", strokeWidth: "1", d: o }) });
}
function hs(e) {
const { title: r, suffix: n, value: o } = e, [s, p] = ot(0);
return Ft(() => {
p(o[o.length - 1] || 0);
}, [o]), /* @__PURE__ */ De("div", { className: Ri["info-item"], children: [
/* @__PURE__ */ De("div", { className: Ri["info-item-name"], children: [
r,
":"
] }),
/* @__PURE__ */ De("div", { className: Ri["info-item-value"], children: [
/* @__PURE__ */ De("div", { className: Ri["item-svg"], children: /* @__PURE__ */ De(nE, { dataArray: o }) }),
/* @__PURE__ */ De("div", { className: Ri["item-value"], children: n(s) })
] })
] });
}
function aE(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var sE = function() {
var e = document.getSelection();
if (!e.rangeCount)
return function() {
};
for (var r = document.activeElement, n = [], o = 0; o < e.rangeCount; o++)
n.push(e.getRangeAt(o));
switch (r.tagName.toUpperCase()) {
case "INPUT":
case "TEXTAREA":
r.blur();
break;
default:
r = null;
break;
}
return e.removeAllRanges(), function() {
e.type === "Caret" && e.removeAllRanges(), e.rangeCount || n.forEach(function(s) {
e.addRange(s);
}), r && r.focus();
};
}, oE = sE, hu = {
"text/plain": "Text",
"text/html": "Url",
default: "Text"
}, cE = "Copy to clipboard: #{key}, Enter";
function lE(e) {
var r = (/mac os x/i.test(navigator.userAgent) ? "⌘" : "Ctrl") + "+C";
return e.replace(/#{\s*key\s*}/g, r);
}
function uE(e, r) {
var n, o, s, p, g, C, y = !1;
r || (r = {}), n = r.debug || !1;
try {
s = oE(), p = document.createRange(), g = document.getSelection(), C = document.createElement("span"), C.textContent = e, C.ariaHidden = "true", C.style.all = "unset", C.style.position = "fixed", C.style.top = 0, C.style.clip = "rect(0, 0, 0, 0)", C.style.whiteSpace = "pre", C.style.webkitUserSelect = "text", C.style.MozUserSelect = "text", C.style.msUserSelect = "text", C.style.userSelect = "text", C.addEventListener("copy", function(h) {
if (h.stopPropagation(), r.format)
if (h.preventDefault(), typeof h.clipboardData > "u") {
n && console.warn("unable to use e.clipboardData"), n && console.warn("trying IE specific stuff"), window.clipboardData.clearData();
var F = hu[r.format] || hu.default;
window.clipboardData.setData(F, e);
} else
h.clipboardData.clearData(), h.clipboardData.setData(r.format, e);
r.onCopy && (h.preventDefault(), r.onCopy(h.clipboardData));
}), document.body.appendChild(C), p.selectNodeContents(C), g.addRange(p);
var x = document.execCommand("copy");
if (!x)
throw new Error("copy command was unsuccessful");
y = !0;
} catch (h) {
n && console.error("unable to copy using execCommand: ", h), n && console.warn("trying IE specific stuff");
try {
window.clipboardData.setData(r.format || "text", e), r.onCopy && r.onCopy(window.clipboardData), y = !0;
} catch (F) {
n && console.error("unable to copy using clipboardData: ", F), n && console.error("falling back to prompt"), o = lE("message" in r ? r.message : cE), window.prompt(o, e);
}
} finally {
g && (typeof g.removeRange == "function" ? g.removeRange(p) : g.removeAllRanges()), C && document.body.removeChild(C), s();
}
return y;
}
var hE = uE;
const dE = /* @__PURE__ */ aE(hE), du = 100, fE = "info-panel";
function pE(e) {
const r = sr(xf);
if (!r)
return /* @__PURE__ */ De(Yi, {});
const { player: n, playerVersion: o, localLogEnabled: s, localLogSwitch: p, toggleLocalLog: g, downloadLocalLog: C } = r, { onChangeShowEventLog: y } = e, x = Is, [h, F] = ot(""), [I, T] = ot(""), [D, W] = ot(""), [j, O] = ot(""), [K, z] = ot(""), [B, J] = ot(""), [be, $] = ot(0), [ye, Be] = ot(""), [Ve, je] = ot(""), [we, ue] = ot([]), [L, w] = ot([]), [le, oe] = ot([]), [Re, Oe] = ot([]), [de, X] = ot((/* @__PURE__ */ new Date()).toString()), ge = St(void 0);
Un(() => {
const k = () => {
T(""), W(""), O(""), z(""), J(""), $(0), Be(""), Re.splice(0, L.length), L.splice(0, L.length), le.splice(0, le.length), we.splice(0, we.length);
}, P = () => {
F(n.kernelType || "");
}, Z = (he) => {
if (he && he.type === "mediaInfo") {
ge.current = he.value, F(n.kernelType || ""), T(he.value.streamHost || ""), W(he.value.colorSpace || ""), Be(he.value.sid || ""), je(he.value.gpu || "");
const Ie = [];
he.value.coreType && Ie.push(he.value.coreType), he.value.box && (he.value.enhancedFlv ? Ie.push("enhanced-flv") : Ie.push(he.value.box)), he.value.videoCodecType && Ie.push(he.value.videoCodecType), he.value.videoDecoder && Ie.push(he.value.videoDecoder), he.value.width && he.value.height && Ie.push(`${he.value.width}x${he.value.height}`), he.value.sar && Ie.push(`[SAR ${he.value.sar.width}:${he.value.sar.height}]`), he.value.fps && Ie.push(`@${he.value.fps.toFixed(2)}`), O(Ie.join(" "));
const Ee = [];
he.value.videoCodec && Ee.push(he.value.videoCodec), he.value.audioCodec && Ee.push(he.value.audioCodec), z(Ee.join(","));
}
he && he.type === "heartbeat" && (he.value.decodedFrames && J(`${he.value.decodedFPS || 0}/${he.value.droppedFPS || 0} ${he.value.decodedFrames || 0}/${he.value.droppedFrames || 0}`), typeof he.value.totalReceive == "number" && $(he.value.totalReceive), U(he.value.videoBuffered || 0, L, w), U(he.value.audioBuffered || 0, le, oe), !L.length && !le.length && U(he.value.buffered || 0, Re, Oe), U(he.value.speed || 0, we, ue), X((/* @__PURE__ */ new Date()).toString()));
};
return n.on(gn.ATTRIBUTE_CHANGE_SRC, k), n.on(gn.REPORT, Z), n.on(gn.LOADEDMETADATA, P), () => {
n.off(gn.ATTRIBUTE_CHANGE_SRC, k), n.off(gn.REPORT, Z), n.off(gn.LOADEDMETADATA, P), ve.current && clearTimeout(ve.current);
};
}, []);
const [Pe, ae] = ot(""), [q, m] = ot(!1), ve = St(0), U = mr((k, P, Z) => {
typeof k == "number" && !isNaN(k) && (P.push(k), P.length > du ? P.shift() : P.length === 1 && (P.unshift(...new Array(du - 1)), P.forEach((he, Ie) => {
typeof he != "number" && (P[Ie] = 0);
})), Z([...P]));
}, []), M = mr(() => {
n.logger.i(fE, "click copy");
const k = { date: de };
x && (k.did = x), o && (k.playerVersion = o), ye && (k.sessionId = ye), I && (k.streamHost = I), D && (k.colorSpace = D), j && (k.res = j), K && (k.codec = K), Ve && (k.gpu = Ve), L.length && (k.vBuffer = L[L.length - 1]), le.length && (k.aBuffer = le[le.length - 1]), Re.length && (k.buffer = Re[Re.length - 1]), we.length && (k.speed = we[we.length - 1]), ge.current && (k.mediainfo = ge.current), k.userAgent = navigator.userAgent, k.summary = n.audienceStat;
const P = dE(JSON.stringify(k));
ae(P ? "已复制" : "复制失败"), m(!0), ve.current && clearTimeout(ve.current), ve.current = +setTimeout(() => {
m(!1), ve.current = 0;
}, 1e3);
}, []), ne = mr((k) => k > 1e9 ? `${(k / 1e9).toFixed(2)} GB` : k > 1e6 ? `${(k / 1e6).toFixed(2)} MB` : `${(k / 1e3).toFixed(2)} KB`, []), Le = mr((k) => k > 1e7 ? `${(k / 1e6).toFixed(2)} MB/s` : `${(k / 1e3).toFixed(2)} KB/s`, []), Ue = mr((k) => k > 1e3 ? `${(k / 1e3).toFixed(2)} s` : `${k} ms`, []), re = mr((k) => {
k.stopPropagation();
}, []);
return /* @__PURE__ */ De("div", { className: Ut ? Ri["container-h5"] : Ri.container, onContextMenu: re, children: [
x && /* @__PURE__ */ De(Kr, { title: "DeviceId", value: x }),
o && /* @__PURE__ */ De(Kr, { title: "PlayerVersion", value: o }),
h && /* @__PURE__ */ De(Kr, { title: "kernel", value: h }),
ye && /* @__PURE__ */ De(Kr, { title: "SessionId", value: ye }),
I && /* @__PURE__ */ De(Kr, { title: "StreamHost", value: I }),
j && /* @__PURE__ */ De(Kr, { title: "Res", value: j }),
D && /* @__PURE__ */ De(Kr, { title: "Color", value: D }),
K && /* @__PURE__ */ De(Kr, { title: "Codec", value: K }),
B && /* @__PURE__ */ De(Kr, { title: "Frames", value: B }),
!!Re.length && /* @__PURE__ */ De(hs, { title: "Buffered", value: Re, suffix: Ue }),
!!L.length && /* @__PURE__ */ De(hs, { title: "VideoBuffered", value: L, suffix: Ue }),
!!le.length && /* @__PURE__ */ De(hs, { title: "AudioBuffered", value: le, suffix: Ue }),
!!we.length && /* @__PURE__ */ De(
hs,
{
title: "Speed",
value: we,
suffix: Le
}
),
be > 0 && /* @__PURE__ */ De(Kr, { title: "TotalReceive", value: ne(be) }),
Ve && /* @__PURE__ */ De(Kr, { title: "GPU", value: Ve }),
/* @__PURE__ */ De(Kr, { title: "Date", value: de }),
/* @__PURE__ */ De("div", { className: [Ut ? Ri["h5-btn"] : "", Ri["close-btn"]].join(" "), onClick: y, children: "[X]" }),
/* @__PURE__ */ De("div", { className: Ri.actions, children: [
p && /* @__PURE__ */ De("div", { className: [Ut ? Ri["h5-btn"] : "", Ri["copy-btn"]].join(" "), onClick: C, children: "[Download Log]" }),
s && /* @__PURE__ */ De("div", { className: [Ut ? Ri["h5-btn"] : "", Ri["copy-btn"]].join(" "), onClick: g, children: [
"[Log ",
p ? "on" : "off",
"]"
] }),
/* @__PURE__ */ De("div", { className: [Ut ? Ri["h5-btn"] : "", Ri["copy-btn"]].join(" "), onClick: M, children: [
q && /* @__PURE__ */ De("div", { className: Ri["btn-tip"], children: Pe }),
/* @__PURE__ */ De("div", { children: "[Copy]" })
] })
] })
] });
}
const _E = "kwai-player-web-play-info", fu = "play-info-plugin", Mf = class ac extends Qb {
constructor() {
super(...arguments), xn(this, "_player"), xn(this, "_i18n"), xn(this, "_callback", new Gb()), xn(this, "_option", {
showInPlayBar: !1,
showInContextMenu: !0,
svgRaw: '<svg fill="currentColor" xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/></svg>'
}), xn(this, "_container"), xn(this, "_onChangeShowEventLog", () => {
this._container && (this.isShow = !this.isShow);
}), xn(this, "_onShowInfoPanelChange", () => {
var r;
this.isShow = !!((r = this._player) != null && r.showInfoPanel);
});
}
beforeInstall(r, n) {
n && (n.showInPlayBar === !0 && (this._option.showInPlayBar = !0), n.showInContextMenu === !1 && (this._option.showInContextMenu = !1), n.svgRaw && (this._option.svgRaw = n.svgRaw)), this._i18n = r.getPluginInstance(yf);
}
afterInstall(r, n) {
if (this._player = r, !this._player)
return;
this._container || (this._container = this._player.createSubContainer(), this._container.style.display = "none", this._container.style.position = "absolute", this._container.style.maxHeight = "100%", this._container.style.overflowY = "auto", this._container.style.top = "0", this._container.style.left = "0", Ut && (this._container.style.width = "100%"));
const o = r.logger;
if (Ba(
/* @__PURE__ */ De(tE, { player: r, children: /* @__PURE__ */ De(
pE,
{
onChangeShowEventLog: this._onChangeShowEventLog
}
) }),
this._container
), typeof r.showInfoPanel == "boolean")
this.isShow = r.showInfoPanel, o.i(fu, `set show by player: ${r.showInfoPanel}`);
else {
let s = _E;
typeof (n == null ? void 0 : n.keyInUrl) == "string" && (s = n == null ? void 0 : n.keyInUrl), location.href.indexOf(s) >= 0 && (this.isShow = !0, o.i(fu, "set show by url: true"));
}
r.on(gn.ATTRIBUTE_CHANGE_SHOW_INFO_PANEL, this._onShowInfoPanelChange);
}
beforeUninstall(r) {
this._callback.destroy();
}
afterUninstall(r) {
this._container && (Ba(
null,
this._container
), r.removeSubContainer(this._container)), this._player = void 0, r.off(gn.ATTRIBUTE_CHANGE_SHOW_INFO_PANEL, this._onShowInfoPanelChange), this.removeAllListeners();
}
set isShow(r) {
this._container && (this._container.style.display = r ? "block" : "none", this.emit(gn.ATTRIBUTE_CHANGE), this._callback.call(r));
}
get isShow() {
var r;
return ((r = this._container) == null ? void 0 : r.style.display) === "block";
}
get dom() {
return this._container;
}
getLabel() {
return ac.label;
}
get controlsSoltBtns() {
const r = [];
if (this._option.showInContextMenu) {
const n = {
role: "play-info-context-menu",
slotPos: nc.CONTEXT_MENU,
getChecked: () => this.isShow,
getText: () => this._text("playInfo"),
svgRaw: this._option.svgRaw,
onClick: () => this.isShow = !this.isShow,
callback: this._callback
};
r.push(n);
}
if (this._option.showInPlayBar && !Ut) {
const n = {
role: "play-info-btn",
slotPos: nc.PLAY_BAR_RIGHT,
getTips: () => this._text("playInfo"),
svgRaw: this._option.svgRaw,
onClick: () => this.isShow = !this.isShow,
callback: this._callback
};
r.push(n);
}
return r;
}
_text(r) {
var n;
return ((n = this._i18n) == null ? void 0 : n.text(ac.label, r)) || "视频信息";
}
};
xn(Mf, "version", "1.1.0-alpha.0");
let AE = Mf;
var vE = Object.defineProperty, gE = (e, r, n) => r in e ? vE(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, Fa = (e, r, n) => (gE(e, typeof r != "symbol" ? r + "" : r, n), n);
(function() {
try {
if (typeof document < "u") {
var e = document.createElement("style");
e.appendChild(document.createTextNode("")), document.head.appendChild(e);
}
} catch (r) {
console.error("vite-plugin-css-injected-by-js", r);
}
})();
var mE = Object.defineProperty, bE = (e, r, n) => r in e ? mE(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, Nr = (e, r, n) => (bE(e, typeof r != "symbol" ? r + "" : r, n), n);
const EE = "ControlsPlugin", yE = "I18nPlugin", Pf = "LoggerPlugin", CE = "HotkeyPlugin", TE = "PlayInfoPlugin", IE = "RotatePlugin", RE = "PreviewPlugin", wE = "MaskPlugin", LE = "VRPlugin", DE = "DanmakuPlugin";
let ur = class extends nn {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static isInstanceOfPlugin(r) {
return typeof r.beforeInstall == "function" && typeof r.afterInstall == "function" && typeof r.beforeUninstall == "function" && typeof r.afterUninstall == "function" && typeof r.getLabel == "function";
}
/**
* 控制条插槽按钮
*/
get controlsSoltBtns() {
}
/**
* 播放器实例化前钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
beforeInstall(r, n) {
}
/**
* 播放器实例化后钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
afterInstall(r, n) {
}
/**
* 播放器销毁前钩子
* @param player 播放器实例
*/
beforeUninstall(r) {
}
/**
* 播放器销毁后钩子
* @param player 播放器实例
*/
afterUninstall(r) {
}
};
Nr(ur, "label"), /**
* 版本
*/
Nr(ur, "version"), /**
* 当前环境是否支持
*/
Nr(ur, "isSupported");
const SE = class Uf extends ur {
/**
* @override
*/
getLabel() {
return Uf.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
};
Nr(SE, "label", EE);
const OE = class Bf extends ur {
/**
* @override
*/
getLabel() {
return Bf.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
};
Nr(OE, "label", yE);
const NE = class Vf extends ur {
/**
* @override
*/
getLabel() {
return Vf.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
/**
* 增加业务相关数据
* @param key 上报数据key
* @param value 上报数据
*/
addBizLog(r, n) {
}
appendSummaryField(r, n) {
}
};
Nr(NE, "label", Pf);
const kE = class Ff extends ur {
/**
* @override
*/
getLabel() {
return Ff.label;
}
};
Nr(kE, "label", CE);
const xE = class jf extends ur {
/**
* @override
*/
getLabel() {
return jf.label;
}
};
Nr(xE, "label", TE);
const ME = class Hf extends ur {
/**
* @override
*/
getLabel() {
return Hf.label;
}
};
Nr(ME, "label", IE);
const PE = class Gf extends ur {
/**
* @override
*/
getLabel() {
return Gf.label;
}
};
Nr(PE, "label", RE);
const UE = class zf extends ur {
/**
* @override
*/
getLabel() {
return zf.label;
}
};
Nr(UE, "label", wE);
const BE = class Kf extends ur {
/**
* @override
*/
getLabel() {
return Kf.label;
}
};
Nr(BE, "label", LE);
const VE = class Wf extends ur {
/**
* @override
*/
getLabel() {
return Wf.label;
}
};
Nr(VE, "label", DE);
var Yf = /* @__PURE__ */ ((e) => (e.ERROR = "error", e.MANIFEST_PARSED = "manifestparsed", e.LEVEL_SWITCHING = "levelswitching", e.LEVEL_SWITCHED = "levelswitched", e.LEVEL_SWITCH_PLAYING = "levelswitchplaying", e.LEVEL_SWITCH_FAILED = "levelswitchfailed", e.LEVEL_UPDATED = "levelupdated", e.AUDIO_TRACKS_SWITCHING = "audiotrackswitching", e.AUDIO_TRACKS_SWITCHED = "audiotrackswitched", e.LOADSTART = "loadstart", e.PROGRESS = "progress", e.SUSPEND = "suspend", e.ABORT = "abort", e.EMPTIED = "emptied", e.STALLED = "stalled", e.LOADEDMETADATA = "loadedmetadata", e.LOADEDDATA = "loadeddata", e.CANPLAY = "canplay", e.CANPLAYTHROUGH = "canplaythrough", e.PLAYING = "playing", e.WAITING = "waiting", e.SEEKING = "seeking", e.SEEKED = "seeked", e.ENDED = "ended", e.DURATIONCHANGE = "durationchange", e.TIMEUPDATE = "timeupdate", e.PLAY = "play", e.PAUSE = "pause", e.RATECHANGE = "ratechange", e.RESIZE = "resize", e.VOLUMECHANGE = "volumechange", e.ENTER_PICTURE_IN_PICTURE = "enterpictureinpicture", e.LEAVE_PICTURE_IN_PICTURE = "leavepictureinpicture", e.REPORT = "report", e.VIDEO_RENDERER_CHANGE = "videorendererchange", e.FULLSCREEN_CHANGE = "fullscreenchange", e.ATTRIBUTE_CHANGE = "attribute:change", e.INTERACTION = "interaction", e.LIVE_SHIFT_CHANGE = "liveshiftchange", e.LIVE_SHIFT_TYPE_CHANGE = "liveshifttypechange", e.OBJECT_FIT_CHANGE = "objectfitchange", e.ATTRIBUTE_CHANGE_CONFIG = "attribute:change:config", e.ATTRIBUTE_CHANGE_SRC = "attribute:change:src", e.ATTRIBUTE_CHANGE_VIDEO_ID = "attribute:change:videoid", e.ATTRIBUTE_CHANGE_PREVIEW_URL = "attribute:change:previewurl", e.ATTRIBUTE_CHANGE_MASK_URL = "attribute:change:maskurl", e.ATTRIBUTE_CHANGE_CROSS_ORIGIN = "attribute:change:crossorigin", e.ATTRIBUTE_CHANGE_PRELOAD = "attribute:change:preload", e.ATTRIBUTE_CHANGE_CURRENT_TIME = "attribute:change:currenttime", e.ATTRIBUTE_CHANGE_DEFAULT_PLAYBACK_RATE = "attribute:change:defaultplaybackrate", e.ATTRIBUTE_CHANGE_PLAYBACK_RATE = "attribute:change:playbackrate", e.ATTRIBUTE_CHANGE_AUTOPLAY = "attribute:change:autoplay", e.ATTRIBUTE_CHANGE_LOOP = "attribute:change:loop", e.ATTRIBUTE_CHANGE_CONTROLS = "attribute:change:controls", e.ATTRIBUTE_CHANGE_VOLUME = "attribute:change:volume", e.ATTRIBUTE_CHANGE_MUTED = "attribute:change:muted", e.ATTRIBUTE_CHANGE_DEFAULT_MUTED = "attribute:change:defaultmuted", e.ATTRIBUTE_CHANGE_POSTER = "attribute:change:poster", e.ATTRIBUTE_CHANGE_DISABLE_PICTURE_IN_PICTURE = "attribute:change:disablepictureinpicture", e.ATTRIBUTE_CHANGE_PLAYSINLINE = "attribute:change:playsinline", e.ATTRIBUTE_CHANGE_DISABLE_ADAPTIVE = "attribute:change:disableadaptive", e.ATTRIBUTE_CHANGE_DISABLE_DOWNLOAD = "attribute:change:disabledownload", e.ATTRIBUTE_CHANGE_DISABLE_MASK = "attribute:change:disablemask", e.ATTRIBUTE_CHANGE_DISABLE_HOTKEY = "attribute:change:disablehotkey", e.ATTRIBUTE_CHANGE_DISABLE_DANMAKU = "attribute:change:disabledanmaku", e.ATTRIBUTE_CHANGE_DANMAKU_RENDERING = "attribute:change:danmakurendering", e.ATTRIBUTE_CHANGE_DANMAKU_CONTROLS_POS = "attribute:change:danmakucontrolspos", e.ATTRIBUTE_CHANGE_DANMAKU_CONTROLS_POS_FULLSCREEN = "attribute:change:danmakucontrolsposfullscreen", e.ATTRIBUTE_CHANGE_CURRENT_LEVEL = "attribute:change:currentlevel", e.ATTRIBUTE_CHANGE_NEXT_LEVEL = "attribute:change:nextlevel", e.ATTRIBUTE_CHANGE_CURRENT_FRAME = "attribute:change:currentframe", e.ATTRIBUTE_CHANGE_AUDIO_TRACK = "attribute:change:audiotrack", e.ATTRIBUTE_CHANGE_PREFETCH = "attribute:change:prefetch", e.ATTRIBUTE_CHANGE_SHOW_PROGRESS = "attribute:change:showprogress", e.ATTRIBUTE_CHANGE_SHOW_TIME = "attribute:change:showtime", e.ATTRIBUTE_CHANGE_SHOW_NEXT = "attribute:change:shownext", e.ATTRIBUTE_CHANGE_SHOW_PREV = "attribute:change:showprev", e.ATTRIBUTE_CHANGE_BIZ_DATA = "attribute:change:bizdata", e.ATTRIBUTE_CHANGE_LIVE_TIME = "attribute:change:livetime", e.ATTRIBUTE_CHANGE_SHOW_INFO_PANEL = "attribute:change:showinfopanel", e.CLICK_NEXT = "clicknext", e.CLICK_LOGIN = "clicklogin", e.CLICK_REGISTER = "clickregister", e.CLICK_VIP = "clickvip", e))(Yf || {});
const sc = class Qf extends ur {
constructor() {
super(...arguments), Fa(this, "_player"), Fa(this, "_domainList", []), Fa(this, "_logger");
}
afterInstall(r) {
var n;
this._player = r, this._logger = r.getPluginInstance(Pf), r.on(Yf.ATTRIBUTE_CHANGE_SRC, () => {
var s;
(s = this._player) != null && s.src && this._check(this._player.src);
});
const o = this._player.src;
(n = this._logger) == null || n.appendSummaryField("prefetch", this._player.prefetch ? 1 : 0), o && this._check(o);
}
beforeUninstall() {
this._player = void 0;
}
getLabel() {
return Qf.label;
}
_check(r) {
var n, o, s, p, g, C;
if ((n = this._player) != null && n.autoplay || ((o = this._player) == null ? void 0 : o.preload) !== "none" || !this._player.prefetch) {
(s = this._logger) == null || s.appendSummaryField("prefetch_valid", 0);
return;
}
if ((p = this._logger) == null || p.appendSummaryField("prefetch_valid", 1), typeof r == "string") {
const y = this._getHostname(r);
y && this._domainList.indexOf(y) === -1 && (this._domainList.push(y), (g = this._logger) == null || g.appendSummaryField("prefetch_start_time", Date.now()), this._send(r));
}
if (typeof r == "object") {
const y = this._pickUrl(r), x = {};
let h = !1;
for (const F of y) {
const I = this._getHostname(F);
I && !x[I] && (x[I] = F, this._send(F), h || ((C = this._logger) == null || C.appendSummaryField("prefetch_start_time", Date.now()), h = !0));
}
}
}
_send(r, n) {
const o = new XMLHttpRequest();
o.open("HEAD", r), o.onreadystatechange = () => {
o.readyState === 3 && (o.abort(), n && n()), o.readyState === 4 && n && n();
}, o.timeout = 3e3, o.ontimeout = () => {
console.warn(`${r} timeout`), n && n();
}, o.onerror = () => {
console.warn(`${r} error`), n && n();
}, o.send();
}
_getHostname(r) {
const n = r.match("^(http|https)://[a-zA-Z0-9._-]+");
return n ? n[0] : "";
}
_pickUrl(r, n = []) {
const o = Object.keys(r);
for (let s = 0; s < o.length; s++) {
const p = o[s];
typeof r[p] == "string" && this._getHostname(r[p]) && n.push(r[p]), typeof r[p] == "object" && this._pickUrl(r[p], n);
}
return n;
}
};
Fa(sc, "version", "1.1.0-alpha.0"), Fa(sc, "label", "PrefetchPlugin");
let FE = sc;
var jE = Object.defineProperty, HE = (e, r, n) => r in e ? jE(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, mn = (e, r, n) => (HE(e, typeof r != "symbol" ? r + "" : r, n), n);
(function() {
try {
if (typeof document < "u") {
var e = document.createElement("style");
e.appendChild(document.createTextNode("")), document.head.appendChild(e);
}
} catch (r) {
console.error("vite-plugin-css-injected-by-js", r);
}
})();
var GE = Object.defineProperty, zE = (e, r, n) => r in e ? GE(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, kr = (e, r, n) => (zE(e, typeof r != "symbol" ? r + "" : r, n), n);
const KE = "ControlsPlugin", WE = "I18nPlugin", YE = "LoggerPlugin", QE = "HotkeyPlugin", XE = "PlayInfoPlugin", $E = "RotatePlugin", ZE = "PreviewPlugin", qE = "MaskPlugin", JE = "VRPlugin", ey = "DanmakuPlugin";
class xr extends nn {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static isInstanceOfPlugin(r) {
return typeof r.beforeInstall == "function" && typeof r.afterInstall == "function" && typeof r.beforeUninstall == "function" && typeof r.afterUninstall == "function" && typeof r.getLabel == "function";
}
/**
* 控制条插槽按钮
*/
get controlsSoltBtns() {
}
/**
* 播放器实例化前钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
beforeInstall(r, n) {
}
/**
* 播放器实例化后钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
afterInstall(r, n) {
}
/**
* 播放器销毁前钩子
* @param player 播放器实例
*/
beforeUninstall(r) {
}
/**
* 播放器销毁后钩子
* @param player 播放器实例
*/
afterUninstall(r) {
}
}
kr(xr, "label"), /**
* 版本
*/
kr(xr, "version"), /**
* 当前环境是否支持
*/
kr(xr, "isSupported");
const ty = class Xf extends xr {
/**
* @override
*/
getLabel() {
return Xf.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
};
kr(ty, "label", KE);
const iy = class $f extends xr {
/**
* @override
*/
getLabel() {
return $f.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
};
kr(iy, "label", WE);
const ry = class Zf extends xr {
/**
* @override
*/
getLabel() {
return Zf.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
/**
* 增加业务相关数据
* @param key 上报数据key
* @param value 上报数据
*/
addBizLog(r, n) {
}
appendSummaryField(r, n) {
}
};
kr(ry, "label", YE);
const ny = class qf extends xr {
/**
* @override
*/
getLabel() {
return qf.label;
}
};
kr(ny, "label", QE);
const ay = class Jf extends xr {
/**
* @override
*/
getLabel() {
return Jf.label;
}
};
kr(ay, "label", XE);
const sy = class ep extends xr {
/**
* @override
*/
getLabel() {
return ep.label;
}
};
kr(sy, "label", $E);
const tp = class ip extends xr {
/**
* @override
*/
getLabel() {
return ip.label;
}
};
kr(tp, "label", ZE);
let oy = tp;
const cy = class rp extends xr {
/**
* @override
*/
getLabel() {
return rp.label;
}
};
kr(cy, "label", qE);
const ly = class np extends xr {
/**
* @override
*/
getLabel() {
return np.label;
}
};
kr(ly, "label", JE);
const uy = class ap extends xr {
/**
* @override
*/
getLabel() {
return ap.label;
}
};
kr(uy, "label", ey);
var Ma = /* @__PURE__ */ ((e) => (e.ERROR = "error", e.MANIFEST_PARSED = "manifestparsed", e.LEVEL_SWITCHING = "levelswitching", e.LEVEL_SWITCHED = "levelswitched", e.LEVEL_SWITCH_PLAYING = "levelswitchplaying", e.LEVEL_SWITCH_FAILED = "levelswitchfailed", e.LEVEL_UPDATED = "levelupdated", e.AUDIO_TRACKS_SWITCHING = "audiotrackswitching", e.AUDIO_TRACKS_SWITCHED = "audiotrackswitched", e.LOADSTART = "loadstart", e.PROGRESS = "progress", e.SUSPEND = "suspend", e.ABORT = "abort", e.EMPTIED = "emptied", e.STALLED = "stalled", e.LOADEDMETADATA = "loadedmetadata", e.LOADEDDATA = "loadeddata", e.CANPLAY = "canplay", e.CANPLAYTHROUGH = "canplaythrough", e.PLAYING = "playing", e.WAITING = "waiting", e.SEEKING = "seeking", e.SEEKED = "seeked", e.ENDED = "ended", e.DURATIONCHANGE = "durationchange", e.TIMEUPDATE = "timeupdate", e.PLAY = "play", e.PAUSE = "pause", e.RATECHANGE = "ratechange", e.RESIZE = "resize", e.VOLUMECHANGE = "volumechange", e.ENTER_PICTURE_IN_PICTURE = "enterpictureinpicture", e.LEAVE_PICTURE_IN_PICTURE = "leavepictureinpicture", e.REPORT = "report", e.VIDEO_RENDERER_CHANGE = "videorendererchange", e.FULLSCREEN_CHANGE = "fullscreenchange", e.ATTRIBUTE_CHANGE = "attribute:change", e.INTERACTION = "interaction", e.LIVE_SHIFT_CHANGE = "liveshiftchange", e.LIVE_SHIFT_TYPE_CHANGE = "liveshifttypechange", e.OBJECT_FIT_CHANGE = "objectfitchange", e.ATTRIBUTE_CHANGE_CONFIG = "attribute:change:config", e.ATTRIBUTE_CHANGE_SRC = "attribute:change:src", e.ATTRIBUTE_CHANGE_VIDEO_ID = "attribute:change:videoid", e.ATTRIBUTE_CHANGE_PREVIEW_URL = "attribute:change:previewurl", e.ATTRIBUTE_CHANGE_MASK_URL = "attribute:change:maskurl", e.ATTRIBUTE_CHANGE_CROSS_ORIGIN = "attribute:change:crossorigin", e.ATTRIBUTE_CHANGE_PRELOAD = "attribute:change:preload", e.ATTRIBUTE_CHANGE_CURRENT_TIME = "attribute:change:currenttime", e.ATTRIBUTE_CHANGE_DEFAULT_PLAYBACK_RATE = "attribute:change:defaultplaybackrate", e.ATTRIBUTE_CHANGE_PLAYBACK_RATE = "attribute:change:playbackrate", e.ATTRIBUTE_CHANGE_AUTOPLAY = "attribute:change:autoplay", e.ATTRIBUTE_CHANGE_LOOP = "attribute:change:loop", e.ATTRIBUTE_CHANGE_CONTROLS = "attribute:change:controls", e.ATTRIBUTE_CHANGE_VOLUME = "attribute:change:volume", e.ATTRIBUTE_CHANGE_MUTED = "attribute:change:muted", e.ATTRIBUTE_CHANGE_DEFAULT_MUTED = "attribute:change:defaultmuted", e.ATTRIBUTE_CHANGE_POSTER = "attribute:change:poster", e.ATTRIBUTE_CHANGE_DISABLE_PICTURE_IN_PICTURE = "attribute:change:disablepictureinpicture", e.ATTRIBUTE_CHANGE_PLAYSINLINE = "attribute:change:playsinline", e.ATTRIBUTE_CHANGE_DISABLE_ADAPTIVE = "attribute:change:disableadaptive", e.ATTRIBUTE_CHANGE_DISABLE_DOWNLOAD = "attribute:change:disabledownload", e.ATTRIBUTE_CHANGE_DISABLE_MASK = "attribute:change:disablemask", e.ATTRIBUTE_CHANGE_DISABLE_HOTKEY = "attribute:change:disablehotkey", e.ATTRIBUTE_CHANGE_DISABLE_DANMAKU = "attribute:change:disabledanmaku", e.ATTRIBUTE_CHANGE_DANMAKU_RENDERING = "attribute:change:danmakurendering", e.ATTRIBUTE_CHANGE_DANMAKU_CONTROLS_POS = "attribute:change:danmakucontrolspos", e.ATTRIBUTE_CHANGE_DANMAKU_CONTROLS_POS_FULLSCREEN = "attribute:change:danmakucontrolsposfullscreen", e.ATTRIBUTE_CHANGE_CURRENT_LEVEL = "attribute:change:currentlevel", e.ATTRIBUTE_CHANGE_NEXT_LEVEL = "attribute:change:nextlevel", e.ATTRIBUTE_CHANGE_CURRENT_FRAME = "attribute:change:currentframe", e.ATTRIBUTE_CHANGE_AUDIO_TRACK = "attribute:change:audiotrack", e.ATTRIBUTE_CHANGE_PREFETCH = "attribute:change:prefetch", e.ATTRIBUTE_CHANGE_SHOW_PROGRESS = "attribute:change:showprogress", e.ATTRIBUTE_CHANGE_SHOW_TIME = "attribute:change:showtime", e.ATTRIBUTE_CHANGE_SHOW_NEXT = "attribute:change:shownext", e.ATTRIBUTE_CHANGE_SHOW_PREV = "attribute:change:showprev", e.ATTRIBUTE_CHANGE_BIZ_DATA = "attribute:change:bizdata", e.ATTRIBUTE_CHANGE_LIVE_TIME = "attribute:change:livetime", e.ATTRIBUTE_CHANGE_SHOW_INFO_PANEL = "attribute:change:showinfopanel", e.CLICK_NEXT = "clicknext", e.CLICK_LOGIN = "clicklogin", e.CLICK_REGISTER = "clickregister", e.CLICK_VIP = "clickvip", e))(Ma || {});
const hy = 3e3;
var sp = { exports: {} };
(function(e, r) {
(function(n) {
var o = /^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/, s = /^(?=([^\/?#]*))\1([^]*)$/, p = /(?:\/|^)\.(?=\/)/g, g = /(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g, C = {
// If opts.alwaysNormalize is true then the path will always be normalized even when it starts with / or //
// E.g
// With opts.alwaysNormalize = false (default, spec compliant)
// http://a.com/b/cd + /e/f/../g => http://a.com/e/f/../g
// With opts.alwaysNormalize = true (not spec compliant)
// http://a.com/b/cd + /e/f/../g => http://a.com/e/g
buildAbsoluteURL: function(y, x, h) {
if (h = h || {}, y = y.trim(), x = x.trim(), !x) {
if (!h.alwaysNormalize)
return y;
var F = C.parseURL(y);
if (!F)
throw new Error("Error trying to parse base URL.");
return F.path = C.normalizePath(
F.path
), C.buildURLFromParts(F);
}
var I = C.parseURL(x);
if (!I)
throw new Error("Error trying to parse relative URL.");
if (I.scheme)
return h.alwaysNormalize ? (I.path = C.normalizePath(I.path), C.buildURLFromParts(I)) : x;
var T = C.parseURL(y);
if (!T)
throw new Error("Error trying to parse base URL.");
if (!T.netLoc && T.path && T.path[0] !== "/") {
var D = s.exec(T.path);
T.netLoc = D[1], T.path = D[2];
}
T.netLoc && !T.path && (T.path = "/");
var W = {
// 2c) Otherwise, the embedded URL inherits the scheme of
// the base URL.
scheme: T.scheme,
netLoc: I.netLoc,
path: null,
params: I.params,
query: I.query,
fragment: I.fragment
};
if (!I.netLoc && (W.netLoc = T.netLoc, I.path[0] !== "/"))
if (!I.path)
W.path = T.path, I.params || (W.params = T.params, I.query || (W.query = T.query));
else {
var j = T.path, O = j.substring(0, j.lastIndexOf("/") + 1) + I.path;
W.path = C.normalizePath(O);
}
return W.path === null && (W.path = h.alwaysNormalize ? C.normalizePath(I.path) : I.path), C.buildURLFromParts(W);
},
parseURL: function(y) {
var x = o.exec(y);
return x ? {
scheme: x[1] || "",
netLoc: x[2] || "",
path: x[3] || "",
params: x[4] || "",
query: x[5] || "",
fragment: x[6] || ""
} : null;
},
normalizePath: function(y) {
for (y = y.split("").reverse().join("").replace(p, ""); y.length !== (y = y.replace(g, "")).length; )
;
return y.split("").reverse().join("");
},
buildURLFromParts: function(y) {
return y.scheme + y.netLoc + y.path + y.params + y.query + y.fragment;
}
};
e.exports = C;
})();
})(sp);
var dy = sp.exports;
const fy = /\r\n|\n\r|\n|\r/g, py = /^(?:(\d+):)?(\d{1,2}):(\d{1,2})(\.\d+)?/, _y = /\#xywh=(\d+),(\d+),(\d+),(\d+)/;
class Ay {
constructor() {
mn(this, "_url", ""), mn(this, "_xhr"), mn(this, "_imgList", []);
}
clear() {
this._destroyLoader(), this._imgList = [];
}
load(r) {
this._url = r, this._imgList = [], this._load((n) => {
this._destroyLoader(), this._imgList = this._parse(n);
}, () => {
this._destroyLoader(this._xhr);
}, r, hy, "text");
}
_load(r, n, o, s, p) {
this._destroyLoader();
const g = this._xhr = new XMLHttpRequest();
g.open("GET", o, !0), p && (g.responseType = p), g.timeout = s, g.onreadystatechange = () => {
g.readyState === 2 && (g.status < 200 || g.status > 299) && n && n(`xhr error: ${g.status}`);
}, g.ontimeout = g.onerror = () => {
n && n("xhr error");
}, g.onload = () => {
r(g.response);
}, g.send();
}
getImgByTime(r) {
if (this._imgList && this._imgList)
return c0.search(this._imgList, (n) => r < n.start ? -1 : r > n.end ? 1 : 0);
}
get hasPreview() {
return !!(this._imgList && this._imgList.length > 0);
}
_destroyLoader(r) {
r && (r.ontimeout = null, r.onload = null, r.onreadystatechange = null, r.onerror = null, r.onabort = null, r.abort());
}
_parse(r) {
if (!/^WEBVTT/.test(r))
throw new Error("Not webVTT");
const n = r.trim().replace(fy, `
`).split(`
`), o = [];
let s;
return n.forEach((p) => {
if (p.indexOf("-->") !== -1) {
const g = this._parseTimeStamp(p);
p = p.substring(p.indexOf("-->") + 3).trim();
const C = this._parseTimeStamp(p);
typeof g == "number" && typeof C == "number" && (s = {
start: g,
end: C,
x: 0,
y: 0,
w: 0,
h: 0,
url: ""
});
} else if (p) {
const g = p.match(_y);
if (g && s) {
s.x = parseInt(g[1]), s.y = parseInt(g[2]), s.w = parseInt(g[3]), s.h = parseInt(g[4]);
const C = new URL(dy.buildAbsoluteURL(this._url, p, { alwaysNormalize: !0 }));
C.hash = "", s.url = C.toString(), o.push(s);
}
}
}), o;
}
_parseTimeStamp(r) {
const n = r.match(py);
if (n)
return this._computeSeconds(n[1], n[2], n[3], n[4]);
}
_computeSeconds(r, n, o, s) {
return (parseInt(r) || 0) * 3600 + (parseInt(n) || 0) * 60 + (parseInt(o) || 0) + (parseFloat(s) || 0);
}
}
const vy = "preview-plugin";
class op extends oy {
constructor() {
super(...arguments), mn(this, "_player"), mn(this, "_logger"), mn(this, "_kwaiPreview", new Ay()), mn(this, "_isSupported", typeof Element.prototype.getBoundingClientRect < "u"), mn(this, "_onSrcChange", () => {
this._clear();
}), mn(this, "_onPreviewUrlChange", () => {
var r;
(r = this._player) != null && r.previewUrl ? this._load(this._player.previewUrl) : this._clear();
});
}
beforeInstall(r) {
this._player = r, this._logger = r.logger, r.on(Ma.ATTRIBUTE_CHANGE_SRC, this._onSrcChange), r.on(Ma.ATTRIBUTE_CHANGE_PREVIEW_URL, this._onPreviewUrlChange);
}
afterInstall(r) {
r.previewUrl && this._load(r.previewUrl);
}
afterUninstall(r) {
this._clear(), r.off(Ma.ATTRIBUTE_CHANGE_SRC, this._onSrcChange), r.off(Ma.ATTRIBUTE_CHANGE_PREVIEW_URL, this._onPreviewUrlChange);
}
getImgByTime(r) {
return this._kwaiPreview.getImgByTime(r);
}
get hasPreview() {
return !!this._kwaiPreview.hasPreview;
}
_load(r) {
var n;
(n = this._logger) == null || n.i(vy, `load: ${r}. is supported:${this._isSupported}`), this._isSupported && this._kwaiPreview.load(r);
}
_clear() {
this._destroyParser();
}
_destroyParser() {
this._kwaiPreview && this._kwaiPreview.clear();
}
}
mn(op, "version", "1.1.0-alpha.0");
(function() {
try {
if (typeof document != "undefined") {
var e = document.createElement("style");
e.appendChild(document.createTextNode("")), document.head.appendChild(e);
}
} catch (r) {
console.error("vite-plugin-css-injected-by-js", r);
}
})();
var gy = Object.defineProperty, my = (e, r, n) => r in e ? gy(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, Zi = (e, r, n) => (my(e, typeof r != "symbol" ? r + "" : r, n), n);
(function() {
try {
if (typeof document < "u") {
var e = document.createElement("style");
e.appendChild(document.createTextNode("")), document.head.appendChild(e);
}
} catch (r) {
console.error("vite-plugin-css-injected-by-js", r);
}
})();
var by = Object.defineProperty, Ey = (e, r, n) => r in e ? by(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, hr = (e, r, n) => (Ey(e, typeof r != "symbol" ? r + "" : r, n), n);
const yy = "ControlsPlugin", cp = "I18nPlugin", Cy = "LoggerPlugin", Ty = "HotkeyPlugin", Iy = "PlayInfoPlugin", Ry = "RotatePlugin", wy = "PreviewPlugin", Ly = "MaskPlugin", Dy = "VRPlugin", Sy = "DanmakuPlugin";
var qn = /* @__PURE__ */ ((e) => (e.PLAY_BAR_LEFT = "playBarLeft", e.PLAY_BAR_RIGHT = "playBarRight", e.CONTEXT_MENU = "contextMenu", e))(qn || {});
class pu {
constructor() {
hr(this, "_callbacks", []);
}
add(r) {
this._callbacks.push(r);
}
remove(r) {
const n = this._callbacks.findIndex((o) => o === r);
n >= 0 && this._callbacks.splice(n, 1);
}
call(r) {
this._callbacks.forEach((n) => n(r));
}
destroy() {
this._callbacks.splice(0, this._callbacks.length);
}
}
let Mr = class extends nn {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static isInstanceOfPlugin(r) {
return typeof r.beforeInstall == "function" && typeof r.afterInstall == "function" && typeof r.beforeUninstall == "function" && typeof r.afterUninstall == "function" && typeof r.getLabel == "function";
}
/**
* 控制条插槽按钮
*/
get controlsSoltBtns() {
}
/**
* 播放器实例化前钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
beforeInstall(r, n) {
}
/**
* 播放器实例化后钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
afterInstall(r, n) {
}
/**
* 播放器销毁前钩子
* @param player 播放器实例
*/
beforeUninstall(r) {
}
/**
* 播放器销毁后钩子
* @param player 播放器实例
*/
afterUninstall(r) {
}
};
hr(Mr, "label"), /**
* 版本
*/
hr(Mr, "version"), /**
* 当前环境是否支持
*/
hr(Mr, "isSupported");
const Oy = class lp extends Mr {
/**
* @override
*/
getLabel() {
return lp.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
};
hr(Oy, "label", yy);
const Ny = class up extends Mr {
/**
* @override
*/
getLabel() {
return up.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
};
hr(Ny, "label", cp);
const ky = class hp extends Mr {
/**
* @override
*/
getLabel() {
return hp.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
/**
* 增加业务相关数据
* @param key 上报数据key
* @param value 上报数据
*/
addBizLog(r, n) {
}
appendSummaryField(r, n) {
}
};
hr(ky, "label", Cy);
const xy = class dp extends Mr {
/**
* @override
*/
getLabel() {
return dp.label;
}
};
hr(xy, "label", Ty);
const My = class fp extends Mr {
/**
* @override
*/
getLabel() {
return fp.label;
}
};
hr(My, "label", Iy);
const pp = class _p extends Mr {
/**
* @override
*/
getLabel() {
return _p.label;
}
};
hr(pp, "label", Ry);
let Py = pp;
const Uy = class Ap extends Mr {
/**
* @override
*/
getLabel() {
return Ap.label;
}
};
hr(Uy, "label", wy);
const By = class vp extends Mr {
/**
* @override
*/
getLabel() {
return vp.label;
}
};
hr(By, "label", Ly);
const Vy = class gp extends Mr {
/**
* @override
*/
getLabel() {
return gp.label;
}
};
hr(Vy, "label", Dy);
const Fy = class mp extends Mr {
/**
* @override
*/
getLabel() {
return mp.label;
}
};
hr(Fy, "label", Sy);
var Rn = /* @__PURE__ */ ((e) => (e.ERROR = "error", e.MANIFEST_PARSED = "manifestparsed", e.LEVEL_SWITCHING = "levelswitching", e.LEVEL_SWITCHED = "levelswitched", e.LEVEL_SWITCH_PLAYING = "levelswitchplaying", e.LEVEL_SWITCH_FAILED = "levelswitchfailed", e.LEVEL_UPDATED = "levelupdated", e.AUDIO_TRACKS_SWITCHING = "audiotrackswitching", e.AUDIO_TRACKS_SWITCHED = "audiotrackswitched", e.LOADSTART = "loadstart", e.PROGRESS = "progress", e.SUSPEND = "suspend", e.ABORT = "abort", e.EMPTIED = "emptied", e.STALLED = "stalled", e.LOADEDMETADATA = "loadedmetadata", e.LOADEDDATA = "loadeddata", e.CANPLAY = "canplay", e.CANPLAYTHROUGH = "canplaythrough", e.PLAYING = "playing", e.WAITING = "waiting", e.SEEKING = "seeking", e.SEEKED = "seeked", e.ENDED = "ended", e.DURATIONCHANGE = "durationchange", e.TIMEUPDATE = "timeupdate", e.PLAY = "play", e.PAUSE = "pause", e.RATECHANGE = "ratechange", e.RESIZE = "resize", e.VOLUMECHANGE = "volumechange", e.ENTER_PICTURE_IN_PICTURE = "enterpictureinpicture", e.LEAVE_PICTURE_IN_PICTURE = "leavepictureinpicture", e.REPORT = "report", e.VIDEO_RENDERER_CHANGE = "videorendererchange", e.FULLSCREEN_CHANGE = "fullscreenchange", e.ATTRIBUTE_CHANGE = "attribute:change", e.INTERACTION = "interaction", e.LIVE_SHIFT_CHANGE = "liveshiftchange", e.LIVE_SHIFT_TYPE_CHANGE = "liveshifttypechange", e.OBJECT_FIT_CHANGE = "objectfitchange", e.ATTRIBUTE_CHANGE_CONFIG = "attribute:change:config", e.ATTRIBUTE_CHANGE_SRC = "attribute:change:src", e.ATTRIBUTE_CHANGE_VIDEO_ID = "attribute:change:videoid", e.ATTRIBUTE_CHANGE_PREVIEW_URL = "attribute:change:previewurl", e.ATTRIBUTE_CHANGE_MASK_URL = "attribute:change:maskurl", e.ATTRIBUTE_CHANGE_CROSS_ORIGIN = "attribute:change:crossorigin", e.ATTRIBUTE_CHANGE_PRELOAD = "attribute:change:preload", e.ATTRIBUTE_CHANGE_CURRENT_TIME = "attribute:change:currenttime", e.ATTRIBUTE_CHANGE_DEFAULT_PLAYBACK_RATE = "attribute:change:defaultplaybackrate", e.ATTRIBUTE_CHANGE_PLAYBACK_RATE = "attribute:change:playbackrate", e.ATTRIBUTE_CHANGE_AUTOPLAY = "attribute:change:autoplay", e.ATTRIBUTE_CHANGE_LOOP = "attribute:change:loop", e.ATTRIBUTE_CHANGE_CONTROLS = "attribute:change:controls", e.ATTRIBUTE_CHANGE_VOLUME = "attribute:change:volume", e.ATTRIBUTE_CHANGE_MUTED = "attribute:change:muted", e.ATTRIBUTE_CHANGE_DEFAULT_MUTED = "attribute:change:defaultmuted", e.ATTRIBUTE_CHANGE_POSTER = "attribute:change:poster", e.ATTRIBUTE_CHANGE_DISABLE_PICTURE_IN_PICTURE = "attribute:change:disablepictureinpicture", e.ATTRIBUTE_CHANGE_PLAYSINLINE = "attribute:change:playsinline", e.ATTRIBUTE_CHANGE_DISABLE_ADAPTIVE = "attribute:change:disableadaptive", e.ATTRIBUTE_CHANGE_DISABLE_DOWNLOAD = "attribute:change:disabledownload", e.ATTRIBUTE_CHANGE_DISABLE_MASK = "attribute:change:disablemask", e.ATTRIBUTE_CHANGE_DISABLE_HOTKEY = "attribute:change:disablehotkey", e.ATTRIBUTE_CHANGE_DISABLE_DANMAKU = "attribute:change:disabledanmaku", e.ATTRIBUTE_CHANGE_DANMAKU_RENDERING = "attribute:change:danmakurendering", e.ATTRIBUTE_CHANGE_DANMAKU_CONTROLS_POS = "attribute:change:danmakucontrolspos", e.ATTRIBUTE_CHANGE_DANMAKU_CONTROLS_POS_FULLSCREEN = "attribute:change:danmakucontrolsposfullscreen", e.ATTRIBUTE_CHANGE_CURRENT_LEVEL = "attribute:change:currentlevel", e.ATTRIBUTE_CHANGE_NEXT_LEVEL = "attribute:change:nextlevel", e.ATTRIBUTE_CHANGE_CURRENT_FRAME = "attribute:change:currentframe", e.ATTRIBUTE_CHANGE_AUDIO_TRACK = "attribute:change:audiotrack", e.ATTRIBUTE_CHANGE_PREFETCH = "attribute:change:prefetch", e.ATTRIBUTE_CHANGE_SHOW_PROGRESS = "attribute:change:showprogress", e.ATTRIBUTE_CHANGE_SHOW_TIME = "attribute:change:showtime", e.ATTRIBUTE_CHANGE_SHOW_NEXT = "attribute:change:shownext", e.ATTRIBUTE_CHANGE_SHOW_PREV = "attribute:change:showprev", e.ATTRIBUTE_CHANGE_BIZ_DATA = "attribute:change:bizdata", e.ATTRIBUTE_CHANGE_LIVE_TIME = "attribute:change:livetime", e.ATTRIBUTE_CHANGE_SHOW_INFO_PANEL = "attribute:change:showinfopanel", e.CLICK_NEXT = "clicknext", e.CLICK_LOGIN = "clicklogin", e.CLICK_REGISTER = "clickregister", e.CLICK_VIP = "clickvip", e))(Rn || {});
const bp = class Ep extends Py {
constructor() {
super(...arguments), Zi(this, "_player"), Zi(this, "_i18n"), Zi(this, "_callback", new pu()), Zi(this, "_mirrorCallback", new pu()), Zi(this, "_option", {
showInContextMenu: "always",
svgRaw: {
mirror: '<svg width="200" height="200" viewBox="0 0 1024 1024"><path d="M185.6 202.24l180.906667 46.933333v525.653334l-180.906667 46.933333V202.24zM166.4 139.093333a38.4 38.4 0 0 0-38.4 38.4v669.013334a38.4 38.4 0 0 0 38.4 38.4h9.813333l219.306667-56.746667a38.826667 38.826667 0 0 0 28.586667-37.546667V234.666667a38.826667 38.826667 0 0 0-28.586667-37.546667L176.213333 140.373333H166.4zM838.4 202.24v619.52l-180.906667-46.933333V249.173333l180.906667-46.933333z m19.2-63.146667a35.413333 35.413333 0 0 0-9.386667 0l-219.733333 58.026667a38.4 38.4 0 0 0-28.586667 37.546667v554.666666a38.4 38.4 0 0 0 28.586667 37.546667l219.733333 56.746667a35.413333 35.413333 0 0 0 9.386667 0 38.4 38.4 0 0 0 38.4-38.4V177.493333a38.4 38.4 0 0 0-38.4-38.4zM512 896a29.013333 29.013333 0 0 1-29.013333-28.586667V156.586667a29.013333 29.013333 0 0 1 58.026666 0v710.826666A29.013333 29.013333 0 0 1 512 896z" fill="currentColor" p-id="1609"></path></svg>',
counterClockwise: '<svg viewBox="0 0 1024 1024" width="200" height="200"><path d="M672 418H144c-17.7 0-32 14.3-32 32v414c0 17.7 14.3 32 32 32h528c17.7 0 32-14.3 32-32V450c0-17.7-14.3-32-32-32z m-44 402H188V494h440v326z m191.3-491.5c-78.8-100.7-196-153.6-314.6-154.2l-0.2-64c0-6.5-7.6-10.1-12.6-6.1l-128 101c-4 3.1-3.9 9.1 0 12.3L492 318.6c5.1 4 12.7 0.4 12.6-6.1v-63.9c12.9 0.1 25.9 0.9 38.8 2.5 42.1 5.2 82.1 18.2 119 38.7 38.1 21.2 71.2 49.7 98.4 84.3 27.1 34.7 46.7 73.7 58.1 115.8 11 40.7 14 82.7 8.9 124.8-0.7 5.4-1.4 10.8-2.4 16.1h74.9c14.8-103.6-11.3-213-81-302.3z" fill="currentColor" p-id="1311"></path></svg>',
clockwise: '<svg viewBox="0 0 1024 1024" version="1.1" width="200" height="200"><path d="M480.5 251.2c13-1.6 25.9-2.4 38.8-2.5v63.9c0 6.5 7.5 10.1 12.6 6.1L660 217.6c4-3.2 4-9.2 0-12.3l-128-101c-5.1-4-12.6-0.4-12.6 6.1l-0.2 64c-118.6 0.5-235.8 53.4-314.6 154.2-69.6 89.2-95.7 198.6-81.1 302.4h74.9c-0.9-5.3-1.7-10.7-2.4-16.1-5.1-42.1-2.1-84.1 8.9-124.8 11.4-42.2 31-81.1 58.1-115.8 27.2-34.7 60.3-63.2 98.4-84.3 37-20.6 76.9-33.6 119.1-38.8zM880 418H352c-17.7 0-32 14.3-32 32v414c0 17.7 14.3 32 32 32h528c17.7 0 32-14.3 32-32V450c0-17.7-14.3-32-32-32z m-44 402H396V494h440v326z" fill="currentColor" p-id="1460"></path></svg>'
}
}), Zi(this, "_mainContainer"), Zi(this, "_innerRotate", 0), Zi(this, "_outerRotate", 0), Zi(this, "_isMirror", !1), Zi(this, "_resizeLoop"), Zi(this, "_resizeObserver"), Zi(this, "_stereoType"), Zi(this, "_onPlayerRendererChange", () => {
this.innerRotate = this._innerRotate;
}), Zi(this, "_onPlayerSrcChanged", () => {
this._stereoType = 0;
}), Zi(this, "_onPlayerManifestParsed", (r) => {
this._stereoType = r.stereoType, this._stereoType === 1 && (this._isMirror = !1, this.innerRotate = 0);
});
}
beforeInstall(r, n) {
n != null && n.showInPlayBar && (this._option.showInPlayBar = typeof n.showInPlayBar == "string" ? n.showInPlayBar : Object.assign({}, n.showInPlayBar)), n != null && n.showInContextMenu && (this._option.showInContextMenu = typeof n.showInContextMenu == "string" ? n.showInContextMenu : Object.assign({}, n.showInContextMenu)), n != null && n.svgRaw && (this._option.svgRaw = Object.assign({}, this._option.svgRaw, n.svgRaw)), r && (this._player = r, this._i18n = r.getPluginInstance(cp));
}
afterInstall(r) {
r && (this._player = r, this._mainContainer = this._player.mainContainer), this._mainContainer && (this._resizeObserver = new Ps(() => {
this.innerRotate = this._innerRotate;
}), this._resizeObserver.observe(this._mainContainer)), r.on(Rn.ATTRIBUTE_CHANGE_SRC, this._onPlayerSrcChanged), r.on(Rn.MANIFEST_PARSED, this._onPlayerManifestParsed), r.on(Rn.VIDEO_RENDERER_CHANGE, this._onPlayerRendererChange);
}
beforeUninstall(r) {
this._callback.destroy(), this._mirrorCallback.destroy();
}
afterUninstall(r) {
this._resizeLoop && (clearInterval(this._resizeLoop), this._resizeLoop = void 0), this._resizeObserver && this._mainContainer && (this._resizeObserver.unobserve(this._mainContainer), this._resizeObserver.disconnect()), r.off(Rn.ATTRIBUTE_CHANGE_SRC, this._onPlayerSrcChanged), r.off(Rn.MANIFEST_PARSED, this._onPlayerManifestParsed), r.off(Rn.VIDEO_RENDERER_CHANGE, this._onPlayerRendererChange), this.removeAllListeners();
}
set innerRotate(r) {
r % 90 === 0 && (this._innerRotate = this._normalizeAngle(r), this._updateInnerRotate()), this.emit(Rn.ATTRIBUTE_CHANGE), this._callback.call(r === 0);
}
get innerRotate() {
return this._innerRotate;
}
set outerRotate(r) {
r % 90 === 0 && (this._outerRotate = this._normalizeAngle(r), this._mainContainer && this._setOuterRotate(this._mainContainer, this._outerRotate)), this.emit(Rn.ATTRIBUTE_CHANGE);
}
get outerRotate() {
return this._outerRotate;
}
set isMirror(r) {
this._isMirror = r, this._updateInnerRotate(), this._mirrorCallback.call(r);
}
get isMirror() {
return this._isMirror;
}
get controlsSoltBtns() {
var r, n, o, s, p, g;
const C = [];
if (this._stereoType === 1)
return C;
const y = this._option.showInContextMenu;
if (y && this._isShow(y, "counterClockwise")) {
const h = {
role: "rotate-counter-clockwise-context-menu",
slotPos: qn.CONTEXT_MENU,
getChecked: () => !1,
svgRaw: (r = this._option.svgRaw) == null ? void 0 : r.counterClockwise,
getText: () => this._text("rotateCounterClockwise") || "逆时针旋转画面",
getTips: () => this._text("rotateCounterClockwise") || "逆时针旋转画面",
onClick: () => this.innerRotate -= 90,
callback: this._callback
};
C.push(h);
}
if (y && this._isShow(y, "clockwise")) {
const h = {
role: "rotate-clockwise-context-menu",
slotPos: qn.CONTEXT_MENU,
getChecked: () => !1,
svgRaw: (n = this._option.svgRaw) == null ? void 0 : n.clockwise,
getText: () => this._text("rotateClockwise") || "顺时针旋转画面",
getTips: () => this._text("rotateClockwise") || "顺时针旋转画面",
onClick: () => this.innerRotate += 90,
callback: this._callback
};
C.push(h);
}
if (y && this._isShow(y, "mirror")) {
const h = {
role: "mirror-context-menu",
slotPos: qn.CONTEXT_MENU,
getChecked: () => this.isMirror,
getText: () => this._text("mirrorImage") || "镜像画面",
svgRaw: (o = this._option.svgRaw) == null ? void 0 : o.mirror,
onClick: () => this.isMirror = !this.isMirror,
callback: this._mirrorCallback
};
C.push(h);
}
const x = this._option.showInPlayBar;
if (x && this._isShow(x, "counterClockwise")) {
const h = {
role: "rotate-counter-clockwise-btn",
slotPos: qn.PLAY_BAR_RIGHT,
getChecked: () => !1,
svgRaw: (s = this._option.svgRaw) == null ? void 0 : s.counterClockwise,
getTips: () => this._text("rotateCounterClockwise") || "逆时针旋转画面",
onClick: () => this.innerRotate -= 90,
callback: this._callback
};
C.push(h);
}
if (x && this._isShow(x, "clockwise")) {
const h = {
role: "rotate-clockwise-btn",
slotPos: qn.PLAY_BAR_RIGHT,
getChecked: () => !1,
svgRaw: (p = this._option.svgRaw) == null ? void 0 : p.clockwise,
getTips: () => this._text("rotateClockwise") || "顺时针旋转画面",
onClick: () => this.innerRotate += 90,
callback: this._callback
};
C.push(h);
}
if (x && this._isShow(x, "mirror")) {
const h = {
role: "mirror-btn",
slotPos: qn.PLAY_BAR_RIGHT,
getTips: () => this._text("mirrorImage"),
svgRaw: (g = this._option.svgRaw) == null ? void 0 : g.mirror,
onClick: () => this.isMirror = !this.isMirror,
callback: this._mirrorCallback
};
C.push(h);
}
return C;
}
_text(r) {
var n;
return ((n = this._i18n) == null ? void 0 : n.text(Ep.label, r)) || "";
}
_isShow(r, n) {
const o = typeof r == "string" ? r : r[n];
return o === "always" || (Ut ? o === "mobile" : o === "pc");
}
_updateInnerRotate() {
const r = this._player, n = this._mainContainer, o = this._normalizeAngle(this._innerRotate);
if (o % 90 !== 0 || !n || !r || !r.video)
return;
const s = { transformOrigin: "left top" }, p = n.getBoundingClientRect().height, g = n.getBoundingClientRect().width;
o === 90 ? (s.width = s.maxWidth = `${p / g * 100}%`, s.height = s.maxHeight = `${g / p * 100}%`, s.transform = "rotate(90deg) translateY(-100%)", this._isMirror && (s.transform += " scaleX(-1) translateX(-100%)"), s.margin = "0") : o === 180 ? (s.width = s.maxWidth = "", s.height = s.maxHeight = "", this._isMirror ? s.transform = "rotate(180deg) translateY(-100%) scaleX(-1)" : s.transform = "rotate(180deg) translateY(-100%) translateX(-100%)", s.margin = "0") : o === 270 ? (s.width = s.maxWidth = `${p / g * 100}%`, s.height = s.maxHeight = `${g / p * 100}%`, this._isMirror ? s.transform = "rotate(270deg) scaleX(-1)" : s.transform = "rotate(270deg) translateX(-100%)", s.margin = "0") : (s.width = s.maxWidth = "", s.height = s.maxHeight = "", this._isMirror ? s.transform = "scaleX(-1) translateX(-100%)" : s.transform = "", s.margin = ""), r.canvas && Object.assign(r.canvas.style, s), r.video && Object.assign(r.video.style, s), r.yodaDom && Object.assign(r.yodaDom.style, s);
}
_setOuterRotate(r, n) {
n = this._normalizeAngle(n), n % 90 === 0 && (n === 90 ? (r.style.width = "100vh", r.style.height = "100vw", r.style.transformOrigin = "left top", r.style.transform = `rotate(${n}deg) translate(0, -100%)`) : n === 180 ? (r.style.width = "100vw", r.style.height = "100vh", r.style.transformOrigin = "left top", r.style.transform = `rotate(${n}deg) translate(-100%, -100%)`) : n === 270 ? (r.style.width = "100vh", r.style.height = "100vw", r.style.transformOrigin = "left top", r.style.transform = `rotate(${n}deg) translate(-100%, 0)`) : n === 0 && (r.style.width = "100vw", r.style.height = "100vh", r.style.transformOrigin = "", r.style.transform = ""));
}
_normalizeAngle(r) {
return (r % 360 + 360) % 360;
}
};
Zi(bp, "version", "1.1.0-alpha.0");
let jy = bp;
(function() {
try {
if (typeof document != "undefined") {
var e = document.createElement("style");
e.appendChild(document.createTextNode("._watermark-video-fit_1h6i8_1{position:absolute;display:block}._watermark-fill-fit_1h6i8_6{position:absolute;display:block;top:0;left:0;width:100%;height:100%}._watermark_1h6i8_1{position:absolute;top:0;left:0;width:100%;height:100%}")), document.head.appendChild(e);
}
} catch (r) {
console.error("vite-plugin-css-injected-by-js", r);
}
})();
var Hy = Object.defineProperty, Gy = (e, r, n) => r in e ? Hy(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, ea = (e, r, n) => (Gy(e, typeof r != "symbol" ? r + "" : r, n), n);
(function() {
try {
if (typeof document < "u") {
var e = document.createElement("style");
e.appendChild(document.createTextNode("")), document.head.appendChild(e);
}
} catch (r) {
console.error("vite-plugin-css-injected-by-js", r);
}
})();
var zy = Object.defineProperty, Ky = (e, r, n) => r in e ? zy(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, Pr = (e, r, n) => (Ky(e, typeof r != "symbol" ? r + "" : r, n), n);
const Wy = "ControlsPlugin", Yy = "I18nPlugin", Qy = "LoggerPlugin", Xy = "HotkeyPlugin", $y = "PlayInfoPlugin", Zy = "RotatePlugin", qy = "PreviewPlugin", Jy = "MaskPlugin", eC = "VRPlugin", tC = "DanmakuPlugin";
class dr extends nn {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static isInstanceOfPlugin(r) {
return typeof r.beforeInstall == "function" && typeof r.afterInstall == "function" && typeof r.beforeUninstall == "function" && typeof r.afterUninstall == "function" && typeof r.getLabel == "function";
}
/**
* 控制条插槽按钮
*/
get controlsSoltBtns() {
}
/**
* 播放器实例化前钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
beforeInstall(r, n) {
}
/**
* 播放器实例化后钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
afterInstall(r, n) {
}
/**
* 播放器销毁前钩子
* @param player 播放器实例
*/
beforeUninstall(r) {
}
/**
* 播放器销毁后钩子
* @param player 播放器实例
*/
afterUninstall(r) {
}
}
Pr(dr, "label"), /**
* 版本
*/
Pr(dr, "version"), /**
* 当前环境是否支持
*/
Pr(dr, "isSupported");
const iC = class yp extends dr {
/**
* @override
*/
getLabel() {
return yp.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
};
Pr(iC, "label", Wy);
const rC = class Cp extends dr {
/**
* @override
*/
getLabel() {
return Cp.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
};
Pr(rC, "label", Yy);
const nC = class Tp extends dr {
/**
* @override
*/
getLabel() {
return Tp.label;
}
beforeInstall(r, n) {
}
afterInstall(r, n) {
}
/**
* 增加业务相关数据
* @param key 上报数据key
* @param value 上报数据
*/
addBizLog(r, n) {
}
appendSummaryField(r, n) {
}
};
Pr(nC, "label", Qy);
const aC = class Ip extends dr {
/**
* @override
*/
getLabel() {
return Ip.label;
}
};
Pr(aC, "label", Xy);
const sC = class Rp extends dr {
/**
* @override
*/
getLabel() {
return Rp.label;
}
};
Pr(sC, "label", $y);
const oC = class wp extends dr {
/**
* @override
*/
getLabel() {
return wp.label;
}
};
Pr(oC, "label", Zy);
const cC = class Lp extends dr {
/**
* @override
*/
getLabel() {
return Lp.label;
}
};
Pr(cC, "label", qy);
const lC = class Dp extends dr {
/**
* @override
*/
getLabel() {
return Dp.label;
}
};
Pr(lC, "label", Jy);
const uC = class Sp extends dr {
/**
* @override
*/
getLabel() {
return Sp.label;
}
};
Pr(uC, "label", eC);
const hC = class Op extends dr {
/**
* @override
*/
getLabel() {
return Op.label;
}
};
Pr(hC, "label", tC);
var oc = /* @__PURE__ */ ((e) => (e.ERROR = "error", e.MANIFEST_PARSED = "manifestparsed", e.LEVEL_SWITCHING = "levelswitching", e.LEVEL_SWITCHED = "levelswitched", e.LEVEL_SWITCH_PLAYING = "levelswitchplaying", e.LEVEL_SWITCH_FAILED = "levelswitchfailed", e.LEVEL_UPDATED = "levelupdated", e.AUDIO_TRACKS_SWITCHING = "audiotrackswitching", e.AUDIO_TRACKS_SWITCHED = "audiotrackswitched", e.LOADSTART = "loadstart", e.PROGRESS = "progress", e.SUSPEND = "suspend", e.ABORT = "abort", e.EMPTIED = "emptied", e.STALLED = "stalled", e.LOADEDMETADATA = "loadedmetadata", e.LOADEDDATA = "loadeddata", e.CANPLAY = "canplay", e.CANPLAYTHROUGH = "canplaythrough", e.PLAYING = "playing", e.WAITING = "waiting", e.SEEKING = "seeking", e.SEEKED = "seeked", e.ENDED = "ended", e.DURATIONCHANGE = "durationchange", e.TIMEUPDATE = "timeupdate", e.PLAY = "play", e.PAUSE = "pause", e.RATECHANGE = "ratechange", e.RESIZE = "resize", e.VOLUMECHANGE = "volumechange", e.ENTER_PICTURE_IN_PICTURE = "enterpictureinpicture", e.LEAVE_PICTURE_IN_PICTURE = "leavepictureinpicture", e.REPORT = "report", e.VIDEO_RENDERER_CHANGE = "videorendererchange", e.FULLSCREEN_CHANGE = "fullscreenchange", e.ATTRIBUTE_CHANGE = "attribute:change", e.INTERACTION = "interaction", e.LIVE_SHIFT_CHANGE = "liveshiftchange", e.LIVE_SHIFT_TYPE_CHANGE = "liveshifttypechange", e.OBJECT_FIT_CHANGE = "objectfitchange", e.ATTRIBUTE_CHANGE_CONFIG = "attribute:change:config", e.ATTRIBUTE_CHANGE_SRC = "attribute:change:src", e.ATTRIBUTE_CHANGE_VIDEO_ID = "attribute:change:videoid", e.ATTRIBUTE_CHANGE_PREVIEW_URL = "attribute:change:previewurl", e.ATTRIBUTE_CHANGE_MASK_URL = "attribute:change:maskurl", e.ATTRIBUTE_CHANGE_CROSS_ORIGIN = "attribute:change:crossorigin", e.ATTRIBUTE_CHANGE_PRELOAD = "attribute:change:preload", e.ATTRIBUTE_CHANGE_CURRENT_TIME = "attribute:change:currenttime", e.ATTRIBUTE_CHANGE_DEFAULT_PLAYBACK_RATE = "attribute:change:defaultplaybackrate", e.ATTRIBUTE_CHANGE_PLAYBACK_RATE = "attribute:change:playbackrate", e.ATTRIBUTE_CHANGE_AUTOPLAY = "attribute:change:autoplay", e.ATTRIBUTE_CHANGE_LOOP = "attribute:change:loop", e.ATTRIBUTE_CHANGE_CONTROLS = "attribute:change:controls", e.ATTRIBUTE_CHANGE_VOLUME = "attribute:change:volume", e.ATTRIBUTE_CHANGE_MUTED = "attribute:change:muted", e.ATTRIBUTE_CHANGE_DEFAULT_MUTED = "attribute:change:defaultmuted", e.ATTRIBUTE_CHANGE_POSTER = "attribute:change:poster", e.ATTRIBUTE_CHANGE_DISABLE_PICTURE_IN_PICTURE = "attribute:change:disablepictureinpicture", e.ATTRIBUTE_CHANGE_PLAYSINLINE = "attribute:change:playsinline", e.ATTRIBUTE_CHANGE_DISABLE_ADAPTIVE = "attribute:change:disableadaptive", e.ATTRIBUTE_CHANGE_DISABLE_DOWNLOAD = "attribute:change:disabledownload", e.ATTRIBUTE_CHANGE_DISABLE_MASK = "attribute:change:disablemask", e.ATTRIBUTE_CHANGE_DISABLE_HOTKEY = "attribute:change:disablehotkey", e.ATTRIBUTE_CHANGE_DISABLE_DANMAKU = "attribute:change:disabledanmaku", e.ATTRIBUTE_CHANGE_DANMAKU_RENDERING = "attribute:change:danmakurendering", e.ATTRIBUTE_CHANGE_DANMAKU_CONTROLS_POS = "attribute:change:danmakucontrolspos", e.ATTRIBUTE_CHANGE_DANMAKU_CONTROLS_POS_FULLSCREEN = "attribute:change:danmakucontrolsposfullscreen", e.ATTRIBUTE_CHANGE_CURRENT_LEVEL = "attribute:change:currentlevel", e.ATTRIBUTE_CHANGE_NEXT_LEVEL = "attribute:change:nextlevel", e.ATTRIBUTE_CHANGE_CURRENT_FRAME = "attribute:change:currentframe", e.ATTRIBUTE_CHANGE_AUDIO_TRACK = "attribute:change:audiotrack", e.ATTRIBUTE_CHANGE_PREFETCH = "attribute:change:prefetch", e.ATTRIBUTE_CHANGE_SHOW_PROGRESS = "attribute:change:showprogress", e.ATTRIBUTE_CHANGE_SHOW_TIME = "attribute:change:showtime", e.ATTRIBUTE_CHANGE_SHOW_NEXT = "attribute:change:shownext", e.ATTRIBUTE_CHANGE_SHOW_PREV = "attribute:change:showprev", e.ATTRIBUTE_CHANGE_BIZ_DATA = "attribute:change:bizdata", e.ATTRIBUTE_CHANGE_LIVE_TIME = "attribute:change:livetime", e.ATTRIBUTE_CHANGE_SHOW_INFO_PANEL = "attribute:change:showinfopanel", e.CLICK_NEXT = "clicknext", e.CLICK_LOGIN = "clicklogin", e.CLICK_REGISTER = "clickregister", e.CLICK_VIP = "clickvip", e))(oc || {}), Np = /* @__PURE__ */ ((e) => (e.VIDEO = "video", e.VIDEO_INTERACTIVE = "videoInteractive", e.DEFAULT = "default", e))(Np || {});
const dC = "_watermark_1h6i8_1", _u = {
"watermark-video-fit": "_watermark-video-fit_1h6i8_1",
"watermark-fill-fit": "_watermark-fill-fit_1h6i8_6",
watermark: dC
};
var fC = /* @__PURE__ */ ((e) => (e.VIDEO = "video", e.FILL = "fill", e))(fC || {});
const cc = class kp extends dr {
constructor() {
super(...arguments), ea(this, "_player"), ea(this, "_container"), ea(this, "_fit", "video"), ea(this, "_observer"), ea(this, "_updateDomPosition", () => {
const r = this._player;
if (this._container && this._fit === "video" && r) {
this._container.style.display = this._getContainerDisplay();
const n = r.videoLayer, { width: o, height: s } = n.getBoundingClientRect(), p = r.videoWidth, g = r.videoHeight;
if (!p || !g)
return;
if (p / g > o / s) {
const C = (s - g / p * o) / 2;
this._container.style.top = `${C}px`, this._container.style.bottom = `${C}px`, this._container.style.left = "0", this._container.style.right = "0";
} else {
const C = (o - p / g * s) / 2;
this._container.style.left = `${C}px`, this._container.style.right = `${C}px`, this._container.style.top = "0", this._container.style.bottom = "0";
}
}
});
}
afterInstall(r) {
var n;
this._player = r;
const o = this._player.mainContainer, s = o == null ? void 0 : o.querySelector('[kwai-player-watermark=""]');
s && o && (this._container = this._player.createSubContainer(Np.VIDEO), this._applyClassName(this._container, this._fit), this._container.style.display = this._getContainerDisplay(), (n = this._container) == null || n.appendChild(s), this._observer = new Ps(() => {
this._updateDomPosition();
}), this._observer.observe(o)), r.on(oc.RESIZE, this._updateDomPosition);
}
beforeUninstall(r) {
this._container && (r == null || r.removeSubContainer(this._container)), r.off(oc.REPORT, this._updateDomPosition), this._player = void 0, this._container = void 0, this._observer && (this._observer.disconnect(), this._observer = void 0);
}
getLabel() {
return kp.label;
}
/**
* 设置水印区域
*/
set fit(r) {
this._fit === "video" && this._container && (this._container.style.top = "", this._container.style.bottom = "", this._container.style.left = "", this._container.style.right = ""), this._fit = r, this._container && (this._container.style.display = this._getContainerDisplay(), this._applyClassName(this._container, this._fit)), this._updateDomPosition();
}
get get() {
return this._fit;
}
_applyClassName(r, n) {
n === "video" ? r.className = _u["watermark-video-fit"] : r.className = _u["watermark-fill-fit"];
}
_getContainerDisplay() {
var r;
return !((r = this._player) != null && r.videoWidth) && this._fit === "video" ? "none" : "";
}
};
ea(cc, "version", "1.1.0-alpha.0"), ea(cc, "label", "WaterMarkPlugin");
let pC = cc;
of.defaultDict = Am;
Ur.register(of);
Ur.register(Ef);
Ur.register(pC);
Ur.register(Ed);
Ur.register(AE);
Ur.register(FE);
Ur.register(op);
Ur.register(Qd);
Ur.register(jy);
Ur.register(Xm);
Ur.packVersion = "1.1.19.vue2";
export {
AC as CallbackProxy,
qe as ControlsLangDictKey,
ev as ControlsPluginLabel,
vC as ControlsPluginModule,
dv as ControlsSlotPos,
hv as DanmakuControlsPos,
uv as DanmakuPluginDomStyle,
lv as DanmakuPluginLabel,
RC as DanmakuPluginModule,
_n as FullscreenType,
rv as HotkeyPluginLabel,
bC as HotkeyPluginModule,
tv as I18nPluginLabel,
gC as I18nPluginModule,
Ur as KwaiPlayer,
We as KwaiPlayerEvent,
fs as KwaiPlayerLayer,
wC as KwaiPlayerVue2,
Pa as LiveShiftType,
iv as LoggerPluginLabel,
mC as LoggerPluginModule,
ov as MaskPluginLabel,
TC as MaskPluginModule,
nv as PlayInfoPluginLabel,
EC as PlayInfoPluginModule,
or as PluginModule,
sv as PreviewPluginLabel,
CC as PreviewPluginModule,
av as RotatePluginLabel,
yC as RotatePluginModule,
cv as VRPluginLabel,
IC as VRPluginModule,
fC as WatermarkFit,
wC as default
};