@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)*
13,919 lines • 617 kB
JavaScript
var mu = Object.defineProperty;
var wo = Object.getOwnPropertySymbols;
var gu = Object.prototype.hasOwnProperty, yu = Object.prototype.propertyIsEnumerable;
var To = (e, t, r) => t in e ? mu(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Ro = (e, t) => {
for (var r in t || (t = {}))
gu.call(t, r) && To(e, r, t[r]);
if (wo)
for (var r of wo(t))
yu.call(t, r) && To(e, r, t[r]);
return e;
};
Number.isFinite || (Number.isFinite = (e) => typeof e == "number" && isFinite(e));
Array.prototype.find || (Array.prototype.find = function(e, t) {
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 r = Object(this), s = r.length >>> 0;
for (let l = 0; l < s; l++)
if (e.call(t, r[l], l, r))
return r[l];
});
Array.prototype.findIndex || (Array.prototype.findIndex = function(e, t) {
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 r = Object(this), s = r.length >>> 0;
for (let l = 0; l < s; l++)
if (l in r && e.call(t, r[l], l, r))
return l;
return -1;
});
Array.prototype.fill || (Array.prototype.fill = function(e, t = 0, r = this.length) {
if (this === null || this === void 0)
throw new TypeError("Array.prototype.fill called on null or undefined");
const s = Object(this), l = s.length >>> 0, d = t >> 0, h = r >> 0, p = d < 0 ? Math.max(l + d, 0) : Math.min(d, l), E = h < 0 ? Math.max(l + h, 0) : Math.min(h, l);
for (let x = p; x < E; x++)
s[x] = e;
return s;
});
var bu = Object.defineProperty, Eu = (e, t, r) => t in e ? bu(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, da = (e, t, r) => (Eu(e, typeof t != "symbol" ? t + "" : t, r), r), Yt = function(e) {
var t = {};
function r(s) {
if (t[s])
return t[s].exports;
var l = t[s] = { i: s, l: !1, exports: {} };
return e[s].call(l.exports, l, l.exports, r), l.l = !0, l.exports;
}
return r.m = e, r.c = t, r.d = function(s, l, d) {
r.o(s, l) || Object.defineProperty(s, l, { enumerable: !0, get: d });
}, r.r = function(s) {
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(s, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(s, "__esModule", { value: !0 });
}, r.t = function(s, l) {
if (1 & l && (s = r(s)), 8 & l || 4 & l && typeof s == "object" && s && s.__esModule)
return s;
var d = /* @__PURE__ */ Object.create(null);
if (r.r(d), Object.defineProperty(d, "default", { enumerable: !0, value: s }), 2 & l && typeof s != "string")
for (var h in s)
r.d(d, h, function(p) {
return s[p];
}.bind(null, h));
return d;
}, r.n = function(s) {
var l = s && s.__esModule ? function() {
return s.default;
} : function() {
return s;
};
return r.d(l, "a", l), l;
}, r.o = function(s, l) {
return Object.prototype.hasOwnProperty.call(s, l);
}, r.p = "", r(r.s = 8);
}([function(e, t, r) {
var s = r(5);
function l(d, h) {
for (var p = 0; p < h.length; p++) {
var E = h[p];
E.enumerable = E.enumerable || !1, E.configurable = !0, "value" in E && (E.writable = !0), Object.defineProperty(d, s(E.key), E);
}
}
e.exports = function(d, h, p) {
return h && l(d.prototype, h), p && l(d, p), Object.defineProperty(d, "prototype", { writable: !1 }), d;
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t) {
function r(s) {
return e.exports = r = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(l) {
return typeof l;
} : function(l) {
return l && typeof Symbol == "function" && l.constructor === Symbol && l !== Symbol.prototype ? "symbol" : typeof l;
}, e.exports.__esModule = !0, e.exports.default = e.exports, r(s);
}
e.exports = r, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t, r) {
var s = r(7)();
e.exports = s;
try {
regeneratorRuntime = s;
} catch (l) {
typeof globalThis == "object" ? globalThis.regeneratorRuntime = s : Function("r", "regeneratorRuntime = r")(s);
}
}, function(e, t) {
function r() {
return e.exports = r = Object.assign ? Object.assign.bind() : function(s) {
for (var l = 1; l < arguments.length; l++) {
var d = arguments[l];
for (var h in d)
Object.prototype.hasOwnProperty.call(d, h) && (s[h] = d[h]);
}
return s;
}, e.exports.__esModule = !0, e.exports.default = e.exports, r.apply(this, arguments);
}
e.exports = r, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t) {
function r(s, l, d, h, p, E, x) {
try {
var v = s[E](x), O = v.value;
} catch (A) {
return void d(A);
}
v.done ? l(O) : Promise.resolve(O).then(h, p);
}
e.exports = function(s) {
return function() {
var l = this, d = arguments;
return new Promise(function(h, p) {
var E = s.apply(l, d);
function x(O) {
r(E, h, p, x, v, "next", O);
}
function v(O) {
r(E, h, p, x, v, "throw", O);
}
x(void 0);
});
};
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t, r) {
var s = r(1).default, l = r(6);
e.exports = function(d) {
var h = l(d, "string");
return s(h) == "symbol" ? h : h + "";
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t, r) {
var s = r(1).default;
e.exports = function(l, d) {
if (s(l) != "object" || !l)
return l;
var h = l[Symbol.toPrimitive];
if (h !== void 0) {
var p = h.call(l, d || "default");
if (s(p) != "object")
return p;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (d === "string" ? String : Number)(l);
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t, r) {
var s = r(1).default;
function l() {
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
e.exports = l = function() {
return h;
}, e.exports.__esModule = !0, e.exports.default = e.exports;
var d, h = {}, p = Object.prototype, E = p.hasOwnProperty, x = Object.defineProperty || function(C, M, F) {
C[M] = F.value;
}, v = typeof Symbol == "function" ? Symbol : {}, O = v.iterator || "@@iterator", A = v.asyncIterator || "@@asyncIterator", k = v.toStringTag || "@@toStringTag";
function m(C, M, F) {
return Object.defineProperty(C, M, { value: F, enumerable: !0, configurable: !0, writable: !0 }), C[M];
}
try {
m({}, "");
} catch (C) {
m = function(M, F, Z) {
return M[F] = Z;
};
}
function b(C, M, F, Z) {
var K = M && M.prototype instanceof I ? M : I, se = Object.create(K.prototype), Ae = new J(Z || []);
return x(se, "_invoke", { value: R(C, F, Ae) }), se;
}
function L(C, M, F) {
try {
return { type: "normal", arg: C.call(M, F) };
} catch (Z) {
return { type: "throw", arg: Z };
}
}
h.wrap = b;
var g = "suspendedStart", w = "executing", _ = "completed", y = {};
function I() {
}
function P() {
}
function G() {
}
var H = {};
m(H, O, function() {
return this;
});
var Q = Object.getPrototypeOf, ue = Q && Q(Q(Y([])));
ue && ue !== p && E.call(ue, O) && (H = ue);
var de = G.prototype = I.prototype = Object.create(H);
function j(C) {
["next", "throw", "return"].forEach(function(M) {
m(C, M, function(F) {
return this._invoke(M, F);
});
});
}
function B(C, M) {
function F(K, se, Ae, he) {
var we = L(C[K], C, se);
if (we.type !== "throw") {
var ee = we.arg, We = ee.value;
return We && s(We) == "object" && E.call(We, "__await") ? M.resolve(We.__await).then(function(Le) {
F("next", Le, Ae, he);
}, function(Le) {
F("throw", Le, Ae, he);
}) : M.resolve(We).then(function(Le) {
ee.value = Le, Ae(ee);
}, function(Le) {
return F("throw", Le, Ae, he);
});
}
he(we.arg);
}
var Z;
x(this, "_invoke", { value: function(K, se) {
function Ae() {
return new M(function(he, we) {
F(K, se, he, we);
});
}
return Z = Z ? Z.then(Ae, Ae) : Ae();
} });
}
function R(C, M, F) {
var Z = g;
return function(K, se) {
if (Z === w)
throw Error("Generator is already running");
if (Z === _) {
if (K === "throw")
throw se;
return { value: d, done: !0 };
}
for (F.method = K, F.arg = se; ; ) {
var Ae = F.delegate;
if (Ae) {
var he = D(Ae, F);
if (he) {
if (he === y)
continue;
return he;
}
}
if (F.method === "next")
F.sent = F._sent = F.arg;
else if (F.method === "throw") {
if (Z === g)
throw Z = _, F.arg;
F.dispatchException(F.arg);
} else
F.method === "return" && F.abrupt("return", F.arg);
Z = w;
var we = L(C, M, F);
if (we.type === "normal") {
if (Z = F.done ? _ : "suspendedYield", we.arg === y)
continue;
return { value: we.arg, done: F.done };
}
we.type === "throw" && (Z = _, F.method = "throw", F.arg = we.arg);
}
};
}
function D(C, M) {
var F = M.method, Z = C.iterator[F];
if (Z === d)
return M.delegate = null, F === "throw" && C.iterator.return && (M.method = "return", M.arg = d, D(C, M), M.method === "throw") || F !== "return" && (M.method = "throw", M.arg = new TypeError("The iterator does not provide a '" + F + "' method")), y;
var K = L(Z, C.iterator, M.arg);
if (K.type === "throw")
return M.method = "throw", M.arg = K.arg, M.delegate = null, y;
var se = K.arg;
return se ? se.done ? (M[C.resultName] = se.value, M.next = C.nextLoc, M.method !== "return" && (M.method = "next", M.arg = d), M.delegate = null, y) : se : (M.method = "throw", M.arg = new TypeError("iterator result is not an object"), M.delegate = null, y);
}
function U(C) {
var M = { tryLoc: C[0] };
1 in C && (M.catchLoc = C[1]), 2 in C && (M.finallyLoc = C[2], M.afterLoc = C[3]), this.tryEntries.push(M);
}
function N(C) {
var M = C.completion || {};
M.type = "normal", delete M.arg, C.completion = M;
}
function J(C) {
this.tryEntries = [{ tryLoc: "root" }], C.forEach(U, this), this.reset(!0);
}
function Y(C) {
if (C || C === "") {
var M = C[O];
if (M)
return M.call(C);
if (typeof C.next == "function")
return C;
if (!isNaN(C.length)) {
var F = -1, Z = function K() {
for (; ++F < C.length; )
if (E.call(C, F))
return K.value = C[F], K.done = !1, K;
return K.value = d, K.done = !0, K;
};
return Z.next = Z;
}
}
throw new TypeError(s(C) + " is not iterable");
}
return P.prototype = G, x(de, "constructor", { value: G, configurable: !0 }), x(G, "constructor", { value: P, configurable: !0 }), P.displayName = m(G, k, "GeneratorFunction"), h.isGeneratorFunction = function(C) {
var M = typeof C == "function" && C.constructor;
return !!M && (M === P || (M.displayName || M.name) === "GeneratorFunction");
}, h.mark = function(C) {
return Object.setPrototypeOf ? Object.setPrototypeOf(C, G) : (C.__proto__ = G, m(C, k, "GeneratorFunction")), C.prototype = Object.create(de), C;
}, h.awrap = function(C) {
return { __await: C };
}, j(B.prototype), m(B.prototype, A, function() {
return this;
}), h.AsyncIterator = B, h.async = function(C, M, F, Z, K) {
K === void 0 && (K = Promise);
var se = new B(b(C, M, F, Z), K);
return h.isGeneratorFunction(M) ? se : se.next().then(function(Ae) {
return Ae.done ? Ae.value : se.next();
});
}, j(de), m(de, k, "Generator"), m(de, O, function() {
return this;
}), m(de, "toString", function() {
return "[object Generator]";
}), h.keys = function(C) {
var M = Object(C), F = [];
for (var Z in M)
F.push(Z);
return F.reverse(), function K() {
for (; F.length; ) {
var se = F.pop();
if (se in M)
return K.value = se, K.done = !1, K;
}
return K.done = !0, K;
};
}, h.values = Y, J.prototype = { constructor: J, reset: function(C) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = d, this.done = !1, this.delegate = null, this.method = "next", this.arg = d, this.tryEntries.forEach(N), !C)
for (var M in this)
M.charAt(0) === "t" && E.call(this, M) && !isNaN(+M.slice(1)) && (this[M] = d);
}, stop: function() {
this.done = !0;
var C = this.tryEntries[0].completion;
if (C.type === "throw")
throw C.arg;
return this.rval;
}, dispatchException: function(C) {
if (this.done)
throw C;
var M = this;
function F(we, ee) {
return se.type = "throw", se.arg = C, M.next = we, ee && (M.method = "next", M.arg = d), !!ee;
}
for (var Z = this.tryEntries.length - 1; Z >= 0; --Z) {
var K = this.tryEntries[Z], se = K.completion;
if (K.tryLoc === "root")
return F("end");
if (K.tryLoc <= this.prev) {
var Ae = E.call(K, "catchLoc"), he = E.call(K, "finallyLoc");
if (Ae && he) {
if (this.prev < K.catchLoc)
return F(K.catchLoc, !0);
if (this.prev < K.finallyLoc)
return F(K.finallyLoc);
} else if (Ae) {
if (this.prev < K.catchLoc)
return F(K.catchLoc, !0);
} else {
if (!he)
throw Error("try statement without catch or finally");
if (this.prev < K.finallyLoc)
return F(K.finallyLoc);
}
}
}
}, abrupt: function(C, M) {
for (var F = this.tryEntries.length - 1; F >= 0; --F) {
var Z = this.tryEntries[F];
if (Z.tryLoc <= this.prev && E.call(Z, "finallyLoc") && this.prev < Z.finallyLoc) {
var K = Z;
break;
}
}
K && (C === "break" || C === "continue") && K.tryLoc <= M && M <= K.finallyLoc && (K = null);
var se = K ? K.completion : {};
return se.type = C, se.arg = M, K ? (this.method = "next", this.next = K.finallyLoc, y) : this.complete(se);
}, complete: function(C, M) {
if (C.type === "throw")
throw C.arg;
return C.type === "break" || C.type === "continue" ? this.next = C.arg : C.type === "return" ? (this.rval = this.arg = C.arg, this.method = "return", this.next = "end") : C.type === "normal" && M && (this.next = M), y;
}, finish: function(C) {
for (var M = this.tryEntries.length - 1; M >= 0; --M) {
var F = this.tryEntries[M];
if (F.finallyLoc === C)
return this.complete(F.completion, F.afterLoc), N(F), y;
}
}, catch: function(C) {
for (var M = this.tryEntries.length - 1; M >= 0; --M) {
var F = this.tryEntries[M];
if (F.tryLoc === C) {
var Z = F.completion;
if (Z.type === "throw") {
var K = Z.arg;
N(F);
}
return K;
}
}
throw Error("illegal catch attempt");
}, delegateYield: function(C, M, F) {
return this.delegate = { iterator: Y(C), resultName: M, nextLoc: F }, this.method === "next" && (this.arg = d), y;
} }, h;
}
e.exports = l, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t, r) {
r.r(t), r.d(t, "KwaiVideoLocalLog", function() {
return de;
}), r.d(t, "LogLevel", function() {
return A;
}), r.d(t, "DefaultLogger", function() {
return L;
}), r.d(t, "Logger", function() {
return b;
}), r.d(t, "printVersion", function() {
return E;
}), r.d(t, "DEFAULT_LOG_LEVEL", function() {
return k;
});
var s = r(0), l = r.n(s), d = r(3), h = r.n(d), p = { idbName: "kwai-video-local-log", idbMaxDataCount: 25e3, idbMaxFoldLog: 20, maxLogLen: 4096 };
function E(j, B) {
console.log("%c " + j + " %c " + B + " %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 j() {
this.timeout = 6048e5;
}
var B = j.prototype;
return B.write = function(R, D) {
if (j.available)
try {
localStorage.setItem(R, JSON.stringify({ value: D, time: Date.now() }));
} catch (U) {
}
}, B.read = function(R, D) {
if (D === void 0 && (D = !0), j.available)
try {
var U = localStorage.getItem(R);
if (U) {
var N = JSON.parse(U), J = N.value, Y = N.time, C = Y === void 0 ? 0 : Y;
if (!D || Date.now() - C < (typeof D == "number" ? D : this.timeout))
return J;
}
} catch (M) {
}
}, l()(j, null, [{ key: "available", get: function() {
if (j._available === void 0)
try {
localStorage.setItem("alg", "test"), j._available = !0;
} catch (R) {
j._available = !1;
}
return j._available;
} }]);
}();
x._available = void 0;
var v, O = x, A = function(j) {
return j.NONE = "none", j.ERROR = "e", j.WARN = "w", j.INFO = "i", j.DEBUG = "d", j.VERBOSE = "v", j;
}({}), k = A.ERROR, m = ((v = {})[A.NONE] = { value: 1, str: "N" }, v[A.ERROR] = { value: 100, str: "E" }, v[A.WARN] = { value: 200, str: "W" }, v[A.INFO] = { value: 300, str: "I" }, v[A.DEBUG] = { value: 400, str: "D" }, v[A.VERBOSE] = { value: 500, str: "V" }, v), b = function() {
function j(R) {
if (this._name = "kwai-v", this._level = k, this._id = -1, this._output = void 0, this._workerTag = "main", typeof location < "u" && location.protocol === "blob:") {
var D, U = location.href.split("/"), N = (D = U[U.length - 1]) == null ? void 0 : D.match(/(\w+)-/);
N && (this._workerTag = R ? R + "-" + N[1] : N[1]);
} else
R && (this._workerTag = R);
}
j.loadLogLevel = function(R, D) {
if (D === void 0 && (D = !0), location.href) {
var U = new RegExp(R + "=([a-z]{1})"), N = location.href.match(U);
if (N && N.length > 1) {
var J = N[1];
if (this._isValueInLevel(J))
return J;
}
}
var Y = new O().read(R, D);
if (this._isValueInLevel(Y))
return Y;
}, j.saveLogLevel = function(R, D) {
this._isValueInLevel(D) && new O().write(R, D);
}, j._isValueInLevel = function(R) {
return Object.values(A).indexOf(R) !== -1;
};
var B = j.prototype;
return B.setOutput = function(R) {
return this._output = R, this;
}, B.setLevel = function(R) {
return this._level = R, this;
}, B.setId = function(R) {
return this._id = R, this;
}, B.setName = function(R) {
return this._name = R, this;
}, B.getLevel = function() {
return this._level;
}, B.getOutput = function() {
return this._output;
}, B.hasOutput = function() {
return !!this._output;
}, B.e = function(R) {
if (this._isLevelEnabled(this._level, A.ERROR)) {
for (var D = arguments.length, U = new Array(D > 1 ? D - 1 : 0), N = 1; N < D; N++)
U[N - 1] = arguments[N];
var J = this._printLog(A.ERROR, R, U);
try {
var Y;
(Y = this._output) == null || Y.e.apply(Y, [J].concat(U));
} catch (C) {
}
}
}, B.w = function(R) {
if (this._isLevelEnabled(this._level, A.WARN)) {
for (var D = arguments.length, U = new Array(D > 1 ? D - 1 : 0), N = 1; N < D; N++)
U[N - 1] = arguments[N];
var J = this._printLog(A.WARN, R, U);
try {
var Y;
(Y = this._output) == null || Y.w.apply(Y, [J].concat(U));
} catch (C) {
}
}
}, B.i = function(R) {
if (this._isLevelEnabled(this._level, A.INFO)) {
for (var D = arguments.length, U = new Array(D > 1 ? D - 1 : 0), N = 1; N < D; N++)
U[N - 1] = arguments[N];
var J = this._printLog(A.INFO, R, U);
try {
var Y;
(Y = this._output) == null || Y.i.apply(Y, [J].concat(U));
} catch (C) {
}
}
}, B.d = function(R) {
if (this._isLevelEnabled(this._level, A.DEBUG)) {
for (var D = arguments.length, U = new Array(D > 1 ? D - 1 : 0), N = 1; N < D; N++)
U[N - 1] = arguments[N];
var J = this._printLog(A.DEBUG, R, U);
try {
var Y;
(Y = this._output) == null || Y.d.apply(Y, [J].concat(U));
} catch (C) {
}
}
}, B.v = function(R) {
if (this._isLevelEnabled(this._level, A.VERBOSE)) {
for (var D = arguments.length, U = new Array(D > 1 ? D - 1 : 0), N = 1; N < D; N++)
U[N - 1] = arguments[N];
var J = this._printLog(A.VERBOSE, R, U);
try {
var Y;
(Y = this._output) == null || Y.v.apply(Y, [J].concat(U));
} catch (C) {
}
}
}, B._isLevelEnabled = function(R, D) {
return m[R].value >= m[D].value;
}, B._printLog = function(R, D, U) {
var N, J, Y = typeof D;
if (Y === "object")
D = ((J = D) == null ? void 0 : J.constructor.name) || "unknown";
else if (Y === "function") {
var C;
D = ((C = Object.getOwnPropertyDescriptor(D, "name")) == null ? void 0 : C.value) || "unknown";
}
var M, F, Z = (((N = m[R]) == null ? void 0 : N.str) || "") + "|" + this._name + "[" + (typeof this._id == "function" ? this._id() : this._id) + "][" + this._workerTag + "]::" + D;
return R === A.ERROR ? (M = console).error.apply(M, [Z].concat(U.slice(0))) : (F = console).log.apply(F, [Z].concat(U.slice(0))), Z;
}, j;
}(), L = new b(), g = function() {
return l()(function j(B) {
this._logger = void 0, this._id = 0, this._config = p, this._id = j._id, j._id++, this._logger = new b().setId(this._id).setLevel(A.INFO), this._config = h()({}, p, B);
}, [{ 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 (中国标准时间)";
} }]);
}();
g._id = 0;
var w = r(4), _ = r.n(w), y = r(2), I = r.n(y), P = function() {
function j(R, D, U, N, J) {
var Y = this;
J === void 0 && (J = 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 (; Y._taskQueue.length; ) {
var C = Y._taskQueue.shift();
C && Y.run(C.task, C.mode);
}
}, this._logger = R, this._name = D, this._storeName = U, this._dbIndex = N, this._version = J;
}
var B = j.prototype;
return B.init = function() {
var R = this;
if (!this._openReq && indexedDB) {
var D = this._openReq = indexedDB.open(this._name, this._version);
this._logger.i("idb-wrapper", "open", D), D.onerror = function() {
R._logger.i("idb-wrapper", "open error.");
}, D.onsuccess = function() {
R._logger.i("idb-wrapper", "open success."), R._runTaskQueue();
}, D.onupgradeneeded = function() {
R._logger.i("idb-wrapper", "open upgradeneeded."), D.result.objectStoreNames.contains(R._storeName) && D.result.deleteObjectStore(R._storeName);
var U = D.result.createObjectStore(R._storeName, { keyPath: "id", autoIncrement: !0 });
R._dbIndex && R._dbIndex.forEach(function(N) {
U.createIndex(N.name, N.keyPath, N.option);
});
};
}
}, B.run = function(R, D) {
if (D === void 0 && (D = "readwrite"), this.init(), this._openReq && this._openReq.readyState === "done" && !this._openReq.error)
return this._doTask(R, D);
this.state !== "error" && (this._taskQueue.push({ task: R, mode: D }), this._taskQueue.length > 1e3 && this._taskQueue.shift());
}, B.close = function() {
var R = 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() {
R.close();
});
}, B.destroy = function() {
this._logger.i("idb-wrapper", "destroy"), this.close(), this._taskQueue = [];
}, B._doTask = function(R, D) {
var U = this;
if (D === void 0 && (D = "readwrite"), this._openReq && !this._openReq.error)
try {
this._isTransactionActive = !0;
var N = this._openReq.result.transaction(this._storeName, D), J = void 0;
N.oncomplete = function() {
U._isTransactionActive = !1, R.callback && R.callback(J), U._runTaskQueue();
}, N.onabort = N.onerror = function() {
U._isTransactionActive = !1, R.callback && R.callback(J), U._runTaskQueue();
}, J = R.exec(N.objectStore(this._storeName));
} catch (Y) {
}
else
R.callback && R.callback();
}, l()(j, [{ key: "isTransactionActive", get: function() {
return this._isTransactionActive;
} }, { key: "state", get: function() {
return this._openReq && this._openReq.readyState === "done" ? this._openReq.error ? "error" : "ready" : "idle";
} }]);
}(), G = [{ name: "id", keyPath: "id", option: { unique: !0 } }], H = [function() {
function j(R) {
this._ctx = void 0, this._idb = void 0, this._logCount = 0, this._saveCount = 0, this._reCountOnSaveCount = 100, this._reduceData = !1, this._ctx = R, this._idb = new P(R.logger, R.config.idbName, R.config.idbName, G), this._reCountOnSaveCount = Math.min(200, Math.max(50, Math.round(this._ctx.config.idbMaxDataCount / 10))), this._count();
}
j.isSupported = function() {
return typeof indexedDB < "u";
};
var B = j.prototype;
return B.saveLog = function(R) {
var D = this, U = { exec: function(N) {
return N.add({ value: R });
}, callback: function(N) {
D._saveCount++, D._saveCount % D._reCountOnSaveCount == 0 && D._count(), N != null && N.error && D._ctx.logger.i("idb-backend", "save log err", N.error);
} };
this._idb.run(U);
}, B.exportLog = function() {
var R = _()(I.a.mark(function D() {
var U = this;
return I.a.wrap(function(N) {
for (; ; )
switch (N.prev = N.next) {
case 0:
return N.abrupt("return", new Promise(function(J, Y) {
U._ctx.logger.i("idb-backend", "export start");
var C = { exec: function(M) {
return M.getAll();
}, callback: function(M) {
J(M === void 0 ? "" : U._mergeGetAll(M.result));
} };
U._idb.run(C, "readonly");
}));
case 1:
case "end":
return N.stop();
}
}, D);
}));
return function() {
return R.apply(this, arguments);
};
}(), B.destroy = function() {
this._idb.destroy();
}, B.clean = function() {
this._idb.run({ exec: function(R) {
return R.clear();
} });
}, B._count = function() {
var R = this, D = { exec: function(U) {
return U.count();
}, callback: function(U) {
U != null && U.error || U == null || !U.result || (R._ctx.logger.i("idb-backend", "count: " + U.result + " max: " + R._ctx.config.idbMaxDataCount), R._logCount = U.result, R._logCount >= R._ctx.config.idbMaxDataCount && !R._reduceData && R._deleteFromHead(R._logCount - Math.round(R._ctx.config.idbMaxDataCount / 2)));
} };
this._idb.run(D);
}, B._deleteFromHead = function(R) {
var D = this;
this._ctx.logger.i("idb-backend", "delete from head"), this._reduceData = !0;
var U = { exec: function(N) {
return N.openCursor();
}, callback: function(N) {
if (D._reduceData = !1, N != null && N.result) {
var J = IDBKeyRange.bound(N.result.key, N.result.key + R, !1, !1), Y = { exec: function(C) {
return D._ctx.logger.i("idb-backend", "del: " + J.lower + "~" + J.upper), C.delete(J);
}, callback: function(C) {
D._ctx.logger.i("idb-backend", "del result: " + !(C == null || !C.error));
} };
D._idb.run(Y);
}
} };
this._idb.run(U);
}, B._mergeGetAll = function(R) {
return R.length ? R.reduce(function(D, U) {
return "" + D + U.value + `
`;
}, "") : "";
}, l()(j, [{ key: "isActive", get: function() {
return this._idb.state !== "error";
} }]);
}()];
function Q(j, B, R) {
var D = /* @__PURE__ */ new Date();
typeof j != "string" && (j = j.toString());
var U = D.toLocaleString() + "." + D.getMilliseconds().toString().padStart(3, "0") + "|" + j + "|";
return B.forEach(function(N) {
U += typeof N == "object" ? JSON.stringify(N) + " " : N + " ";
}), U.length > R ? U.substring(0, R) : U;
}
function ue(j) {
return j.join(`
`);
}
var de = function() {
function j(R) {
var D = 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() {
D._delayTimer = setInterval(function() {
D._saveLog(!0);
}, 1e3);
}, this._stopDelay = function() {
D._delayTimer && (clearTimeout(D._delayTimer), D._delayTimer = void 0);
}, E("kwai-video-local-log", "1.0.13"), this._ctx = new g(R);
var U = function(N) {
for (var J = arguments.length, Y = new Array(J > 1 ? J - 1 : 0), C = 1; C < J; C++)
Y[C - 1] = arguments[C];
D.addLog.apply(D, [N].concat(Y));
};
this._loggerForAdd = { e: U, w: U, i: U, d: U, v: U }, this._ctx.logger.setOutput(this._loggerForAdd), this._ctx.logger.i("kwai-video-local-log", "constructor", R, this._ctx.config), this._backend = function(N) {
for (var J = 0; J < H.length; J++) {
var Y = H[J];
if (Y != null && Y.isSupported())
return new Y(N);
}
}(this._ctx), this._backend && this._startDelay();
}
j.isSupported = function() {
return function() {
for (var R = 0; R < H.length; R++) {
var D = H[R];
if (D != null && D.isSupported())
return !0;
}
return !1;
}();
};
var B = j.prototype;
return B.addLog = function(R) {
for (var D = arguments.length, U = new Array(D > 1 ? D - 1 : 0), N = 1; N < D; N++)
U[N - 1] = arguments[N];
this._logCache.push(Q(R, U, this._ctx.config.maxLogLen)), this._saveLog();
}, B.cleanLog = function() {
var R;
this._ctx.logger.i("kwai-video-local-log", "clean"), (R = this._backend) == null || R.clean();
}, B.exportLog = function() {
var R = this;
return this._ctx.logger.i("kwai-video-local-log", "export log"), new Promise(function(D, U) {
R._backend ? R._backend.exportLog().then(function(N) {
D(ue([N].concat(R._logCache)));
}) : D("");
});
}, B.downloadLog = function(R) {
var D = this;
this._ctx.logger.i("kwai-video-local-log", "download log: " + R), this._destroyDownloadHref(), this.exportLog().then(function(U) {
var N = new Blob([U], { type: "text/plain" });
if (document) {
var J = document.createElement("a");
D._downloadHref = J.href = URL.createObjectURL(N), J.download = R || "Log_web_" + (/* @__PURE__ */ new Date()).toLocaleString() + ".log", document.body.appendChild(J), J.click(), J.remove();
} else
console.log("无document,当前是否在worker中");
});
}, B.destroy = function() {
var R;
this._destroyDownloadHref(), (R = this._backend) == null || R.destroy(), this._stopDelay();
}, B.getLoggerForAdd = function() {
return this._loggerForAdd;
}, B._destroyDownloadHref = function() {
try {
this._downloadHref && (URL.revokeObjectURL(this._downloadHref), this._downloadHref = void 0);
} catch (R) {
}
}, B._saveLog = function(R) {
if (R === void 0 && (R = !1), this._backend && this._backend.isActive && (this._logCache.length >= this._ctx.config.idbMaxFoldLog || this._logCache.length > 0 && R)) {
var D = ue(this._logCache);
this._logCache.splice(0, this._logCache.length), D && this._backend.saveLog(D);
}
}, l()(j, null, [{ key: "version", get: function() {
return "1.0.13";
} }]);
}();
t.default = de;
}]);
Yt === void 0 && console.error("esm-webpack-plugin: nothing exported!");
Yt.KwaiVideoLocalLog;
const ha = Yt.LogLevel, Qe = Yt.DefaultLogger, fa = Yt.Logger, wu = Yt.printVersion;
Yt.DEFAULT_LOG_LEVEL;
Yt.default;
var Tu = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function Ru(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var pn = { exports: {} }, ci = typeof Reflect == "object" ? Reflect : null, So = ci && typeof ci.apply == "function" ? ci.apply : function(e, t, r) {
return Function.prototype.apply.call(e, t, r);
}, Ki;
ci && typeof ci.ownKeys == "function" ? Ki = ci.ownKeys : Object.getOwnPropertySymbols ? Ki = function(e) {
return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e));
} : Ki = function(e) {
return Object.getOwnPropertyNames(e);
};
function Su(e) {
console && console.warn && console.warn(e);
}
var pa = Number.isNaN || function(e) {
return e !== e;
};
function Ue() {
Ue.init.call(this);
}
pn.exports = Ue;
pn.exports.once = xu;
Ue.EventEmitter = Ue;
Ue.prototype._events = void 0;
Ue.prototype._eventsCount = 0;
Ue.prototype._maxListeners = void 0;
var Lo = 10;
function ur(e) {
if (typeof e != "function")
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof e);
}
Object.defineProperty(Ue, "defaultMaxListeners", {
enumerable: !0,
get: function() {
return Lo;
},
set: function(e) {
if (typeof e != "number" || e < 0 || pa(e))
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + e + ".");
Lo = e;
}
});
Ue.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;
};
Ue.prototype.setMaxListeners = function(e) {
if (typeof e != "number" || e < 0 || pa(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 Aa(e) {
return e._maxListeners === void 0 ? Ue.defaultMaxListeners : e._maxListeners;
}
Ue.prototype.getMaxListeners = function() {
return Aa(this);
};
Ue.prototype.emit = function(e) {
for (var t = [], r = 1; r < arguments.length; r++)
t.push(arguments[r]);
var s = e === "error", l = this._events;
if (l !== void 0)
s = s && l.error === void 0;
else if (!s)
return !1;
if (s) {
var d;
if (t.length > 0 && (d = t[0]), d instanceof Error)
throw d;
var h = new Error("Unhandled error." + (d ? " (" + d.message + ")" : ""));
throw h.context = d, h;
}
var p = l[e];
if (p === void 0)
return !1;
if (typeof p == "function")
So(p, this, t);
else
for (var E = p.length, x = ya(p, E), r = 0; r < E; ++r)
So(x[r], this, t);
return !0;
};
function va(e, t, r, s) {
var l, d, h;
if (ur(r), d = e._events, d === void 0 ? (d = e._events = /* @__PURE__ */ Object.create(null), e._eventsCount = 0) : (d.newListener !== void 0 && (e.emit(
"newListener",
t,
r.listener ? r.listener : r
), d = e._events), h = d[t]), h === void 0)
h = d[t] = r, ++e._eventsCount;
else if (typeof h == "function" ? h = d[t] = s ? [r, h] : [h, r] : s ? h.unshift(r) : h.push(r), l = Aa(e), l > 0 && h.length > l && !h.warned) {
h.warned = !0;
var p = new Error("Possible EventEmitter memory leak detected. " + h.length + " " + String(t) + " listeners added. Use emitter.setMaxListeners() to increase limit");
p.name = "MaxListenersExceededWarning", p.emitter = e, p.type = t, p.count = h.length, Su(p);
}
return e;
}
Ue.prototype.addListener = function(e, t) {
return va(this, e, t, !1);
};
Ue.prototype.on = Ue.prototype.addListener;
Ue.prototype.prependListener = function(e, t) {
return va(this, e, t, !0);
};
function Lu() {
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 _a(e, t, r) {
var s = { fired: !1, wrapFn: void 0, target: e, type: t, listener: r }, l = Lu.bind(s);
return l.listener = r, s.wrapFn = l, l;
}
Ue.prototype.once = function(e, t) {
return ur(t), this.on(e, _a(this, e, t)), this;
};
Ue.prototype.prependOnceListener = function(e, t) {
return ur(t), this.prependListener(e, _a(this, e, t)), this;
};
Ue.prototype.removeListener = function(e, t) {
var r, s, l, d, h;
if (ur(t), s = this._events, s === void 0)
return this;
if (r = s[e], r === void 0)
return this;
if (r === t || r.listener === t)
--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete s[e], s.removeListener && this.emit("removeListener", e, r.listener || t));
else if (typeof r != "function") {
for (l = -1, d = r.length - 1; d >= 0; d--)
if (r[d] === t || r[d].listener === t) {
h = r[d].listener, l = d;
break;
}
if (l < 0)
return this;
l === 0 ? r.shift() : ku(r, l), r.length === 1 && (s[e] = r[0]), s.removeListener !== void 0 && this.emit("removeListener", e, h || t);
}
return this;
};
Ue.prototype.off = Ue.prototype.removeListener;
Ue.prototype.removeAllListeners = function(e) {
var t, r, s;
if (r = this._events, r === void 0)
return this;
if (r.removeListener === void 0)
return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : r[e] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete r[e]), this;
if (arguments.length === 0) {
var l = Object.keys(r), d;
for (s = 0; s < l.length; ++s)
d = l[s], d !== "removeListener" && this.removeAllListeners(d);
return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this;
}
if (t = r[e], typeof t == "function")
this.removeListener(e, t);
else if (t !== void 0)
for (s = t.length - 1; s >= 0; s--)
this.removeListener(e, t[s]);
return this;
};
function ma(e, t, r) {
var s = e._events;
if (s === void 0)
return [];
var l = s[t];
return l === void 0 ? [] : typeof l == "function" ? r ? [l.listener || l] : [l] : r ? Iu(l) : ya(l, l.length);
}
Ue.prototype.listeners = function(e) {
return ma(this, e, !0);
};
Ue.prototype.rawListeners = function(e) {
return ma(this, e, !1);
};
Ue.listenerCount = function(e, t) {
return typeof e.listenerCount == "function" ? e.listenerCount(t) : ga.call(e, t);
};
Ue.prototype.listenerCount = ga;
function ga(e) {
var t = this._events;
if (t !== void 0) {
var r = t[e];
if (typeof r == "function")
return 1;
if (r !== void 0)
return r.length;
}
return 0;
}
Ue.prototype.eventNames = function() {
return this._eventsCount > 0 ? Ki(this._events) : [];
};
function ya(e, t) {
for (var r = new Array(t), s = 0; s < t; ++s)
r[s] = e[s];
return r;
}
function ku(e, t) {
for (; t + 1 < e.length; t++)
e[t] = e[t + 1];
e.pop();
}
function Iu(e) {
for (var t = new Array(e.length), r = 0; r < t.length; ++r)
t[r] = e[r].listener || e[r];
return t;
}
function xu(e, t) {
return new Promise(function(r, s) {
function l(h) {
e.removeListener(t, d), s(h);
}
function d() {
typeof e.removeListener == "function" && e.removeListener("error", l), r([].slice.call(arguments));
}
ba(e, t, d, { once: !0 }), t !== "error" && Cu(e, l, { once: !0 });
});
}
function Cu(e, t, r) {
typeof e.on == "function" && ba(e, "error", t, r);
}
function ba(e, t, r, s) {
if (typeof e.on == "function")
s.once ? e.once(t, r) : e.on(t, r);
else if (typeof e.addEventListener == "function")
e.addEventListener(t, function l(d) {
s.once && e.removeEventListener(t, l), r(d);
});
else
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof e);
}
var Du = pn.exports, Ea = function() {
if (typeof Map < "u")
return Map;
function e(t, r) {
var s = -1;
return t.some(function(l, d) {
return l[0] === r ? (s = d, !0) : !1;
}), s;
}
return (
/** @class */
function() {
function t() {
this.__entries__ = [];
}
return Object.defineProperty(t.prototype, "size", {
/**
* @returns {boolean}
*/
get: function() {
return this.__entries__.length;
},
enumerable: !0,
configurable: !0
}), t.prototype.get = function(r) {
var s = e(this.__entries__, r), l = this.__entries__[s];
return l && l[1];
}, t.prototype.set = function(r, s) {
var l = e(this.__entries__, r);
~l ? this.__entries__[l][1] = s : this.__entries__.push([r, s]);
}, t.prototype.delete = function(r) {
var s = this.__entries__, l = e(s, r);
~l && s.splice(l, 1);
}, t.prototype.has = function(r) {
return !!~e(this.__entries__, r);
}, t.prototype.clear = function() {
this.__entries__.splice(0);
}, t.prototype.forEach = function(r, s) {
s === void 0 && (s = null);
for (var l = 0, d = this.__entries__; l < d.length; l++) {
var h = d[l];
r.call(s, h[1], h[0]);
}
}, t;
}()
);
}(), zr = typeof window < "u" && typeof document < "u" && window.document === document, Xi = 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")();
}(), Ou = function() {
return typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(Xi) : function(e) {
return setTimeout(function() {
return e(Date.now());
}, 1e3 / 60);
};
}(), Mu = 2;
function Nu(e, t) {
var r = !1, s = !1, l = 0;
function d() {
r && (r = !1, e()), s && p();
}
function h() {
Ou(d);
}
function p() {
var E = Date.now();
if (r) {
if (E - l < Mu)
return;
s = !0;
} else
r = !0, s = !1, setTimeout(h, t);
l = E;
}
return p;
}
var Pu = 20, Uu = ["top", "right", "bottom", "left", "width", "height", "size", "weight"], Bu = typeof MutationObserver < "u", Fu = (
/** @class */
function() {
function e() {
this.connected_ = !1, this.mutationEventsAdded_ = !1, this.mutationsObserver_ = null, this.observers_ = [], this.onTransitionEnd_ = this.onTransitionEnd_.bind(this), this.refresh = Nu(this.refresh.bind(this), Pu);
}
return e.prototype.addObserver = function(t) {
~this.observers_.indexOf(t) || this.observers_.push(t), this.connected_ || this.connect_();
}, e.prototype.removeObserver = function(t) {
var r = this.observers_, s = r.indexOf(t);
~s && r.splice(s, 1), !r.length && this.connected_ && this.disconnect_();
}, e.prototype.refresh = function() {
var t = this.updateObservers_();
t && this.refresh();
}, e.prototype.updateObservers_ = function() {
var t = this.observers_.filter(function(r) {
return r.gatherActive(), r.hasActive();
});
return t.forEach(function(r) {
return r.broadcastActive();
}), t.length > 0;
}, e.prototype.connect_ = function() {
!zr || this.connected_ || (document.addEventListener("transitionend", this.onTransitionEnd_), window.addEventListener("resize", this.refresh), Bu ? (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() {
!zr || !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(t) {
var r = t.propertyName, s = r === void 0 ? "" : r, l = Uu.some(function(d) {
return !!~s.indexOf(d);
});
l && this.refresh();
}, e.getInstance = function() {
return this.instance_ || (this.instance_ = new e()), this.instance_;
}, e.instance_ = null, e;
}()
), wa = function(e, t) {
for (var r = 0, s = Object.keys(t); r < s.length; r++) {
var l = s[r];
Object.defineProperty(e, l, {
value: t[l],
enumerable: !1,
writable: !1,
configurable: !0
});
}
return e;
}, fi = function(e) {
var t = e && e.ownerDocument && e.ownerDocument.defaultView;
return t || Xi;
}, Ta = cr(0, 0, 0, 0);
function er(e) {
return parseFloat(e) || 0;
}
function ko(e) {
for (var t = [], r = 1; r < arguments.length; r++)
t[r - 1] = arguments[r];
return t.reduce(function(s, l) {
var d = e["border-" + l + "-width"];
return s + er(d);
}, 0);
}
function Hu(e) {
for (var t = ["top", "right", "bottom", "left"], r = {}, s = 0, l = t; s < l.length; s++) {
var d = l[s], h = e["padding-" + d];
r[d] = er(h);
}
return r;
}
function Vu(e) {
var t = e.getBBox();
return cr(0, 0, t.width, t.height);
}
function Gu(e) {
var t = e.clientWidth, r = e.clientHeight;
if (!t && !r)
return Ta;
var s = fi(e).getComputedStyle(e), l = Hu(s), d = l.left + l.right, h = l.top + l.bottom, p = er(s.width), E = er(s.height);
if (s.boxSizing === "border-box" && (Math.round(p + d) !== t && (p -= ko(s, "left", "right") + d), Math.round(E + h) !== r && (E -= ko(s, "top", "bottom") + h)), !ju(e)) {
var x = Math.round(p + d) - t, v = Math.round(E + h) - r;
Math.abs(x) !== 1 && (p -= x), Math.abs(v) !== 1 && (E -= v);
}
return cr(l.left, l.top, p, E);
}
var Wu = function() {
return typeof SVGGraphicsElement < "u" ? function(e) {
return e instanceof fi(e).SVGGraphicsElement;
} : function(e) {
return e instanceof fi(e).SVGElement && typeof e.getBBox == "function";
};
}();
function ju(e) {
return e === fi(e).document.documentElement;
}
function Ku(e) {
return zr ? Wu(e) ? Vu(e) : Gu(e) : Ta;
}
function Ju(e) {
var t = e.x, r = e.y, s = e.width, l = e.height, d = typeof DOMRectReadOnly < "u" ? DOMRectReadOnly : Object, h = Object.create(d.prototype);
return wa(h, {
x: t,
y: r,
width: s,
height: l,
top: r,
right: t + s,
bottom: l + r,
left: t
}), h;
}
function cr(e, t, r, s) {
return { x: e, y: t, width: r, height: s };
}
var zu = (
/** @class */
function() {
function e(t) {
this.broadcastWidth = 0, this.broadcastHeight = 0, this.contentRect_ = cr(0, 0, 0, 0), this.target = t;
}
return e.prototype.isActive = function() {
var t = Ku(this.target);
return this.contentRect_ = t, t.width !== this.broadcastWidth || t.height !== this.broadcastHeight;
}, e.prototype.broadcastRect = function() {
var t = this.contentRect_;
return this.broadcastWidth = t.width, this.broadcastHeight = t.height, t;
}, e;
}()
), $u = (
/** @class */
function() {
function e(t, r) {
var s = Ju(r);
wa(this, { target: t, contentRect: s });
}
return e;
}()
), qu = (
/** @class */
function() {
function e(t, r, s) {
if (this.activeObservations_ = [], this.observations_ = new Ea(), typeof t != "function")
throw new TypeError("The callback provided as parameter 1 is not a function.");
this.callback_ = t, this.controller_ = r, this.callbackCtx_ = s;
}
return e.prototype.observe = function(t) {
if (!arguments.length)
throw new TypeError("1 argument required, but only 0 present.");
if (!(typeof Element > "u" || !(Element instanceof Object))) {
if (!(t instanceof fi(t).Element))
throw new TypeError('parameter 1 is not of type "Element".');
var r = this.observations_;
r.has(t) || (r.set(t, new zu(t)), this.controller_.addObserver(this), this.controller_.refresh());
}
}, e.prototype.unobserve = function(t) {
if (!arguments.length)
throw new TypeError("1 argument required, but only 0 present.");
if (!(typeof Element > "u" || !(Element instanceof Object))) {
if (!(t instanceof fi(t).Element))
throw new TypeError('parameter 1 is not of type "Element".');
var r = this.observations_;
r.has(t) && (r.delete(t), r.size || this.controller_.removeObserver(this));
}
}, e.prototype.disconnect = function() {
this.clearActive(), this.observations_.clear(), this.controller_.removeObserver(this);
}, e.prototype.gatherActive = function() {
var t = this;
this.clearActive(), this.observations_.forEach(function(r) {
r.isActive() && t.activeObservations_.push(r);
});
}, e.prototype.broadcastActive = function() {
if (this.hasActive()) {
var t = this.callbackCtx_, r = this.activeObservations_.map(function(s) {
return new $u(s.target, s.broadcastRect());
});
this.callback_.call(t, r, t), this.clearActive();
}
}, e.prototype.clearActive = function() {
this.activeObservations_.splice(0);
}, e.prototype.hasActive = function() {
return this.activeObservations_.length > 0;
}, e;
}()
), Ra = typeof WeakMap < "u" ? /* @__PURE__ */ new WeakMap() : new Ea(), Sa = (
/** @class */
function() {
function e(t) {
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 r = Fu.getInstance(), s = new qu(t, r, this);
Ra.set(this, s);
}
return e;
}()
);
[
"observe",
"unobserve",
"disconnect"
].forEach(function(e) {
Sa.prototype[e] = function() {
var t;
return (t = Ra.get(this))[e].apply(t, arguments);
};
});
(function() {
return typeof Xi.ResizeObserver < "u" ? Xi.ResizeObserver : Sa;
})();
var La = {}, Yu = Object.prototype.hasOwnProperty, Qu;
function Io(e) {
try {
return decodeURIComponent(e.replace(/\+/g, " "));
} catch (t) {
return null;
}
}
function xo(e) {
try {
return encodeURIComponent(e);
} catch (t) {
return null;
}
}
function Zu(e) {
for (var t = /([^=?#&]+)=?([^&]*)/g, r = {}, s; s = t.exec(e); ) {
var l = Io(s[1]), d = Io(s[2]);
l === null || d === null || l in r || (r[l] = d);
}
return r;
}
function Xu(e, t) {
t = t || "";
var r = [], s, l;
typeof t != "string" && (t = "?");
for (l in e)
if (Yu.call(e, l)) {
if (s = e[l], !s && (s === null || s === Qu || isNaN(s)) && (s = ""), l = xo(l), s = xo(s), l === null || s === null)
continue;
r.push(l + "=" + s);
}
return r.length ? t + r.join("&") : "";
}
La.stringify = Xu;
La.parse = Zu;
var Ai = function(e) {
var t = {};
function r(s) {
if (t[s])
return t[s].exports;
var l = t[s] = { i: s, l: !1, exports: {} };
return e[s].call(l.exports, l, l.exports, r), l.l = !0, l.exports;
}
return r.m = e, r.c = t, r.d = function(s, l, d) {
r.o(s, l) || Object.defineProperty(s, l, { enumerable: !0, get: d });
}, r.r = function(s) {
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(s, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(s, "__esModule", { value: !0 });
}, r.t = function(s, l) {
if (1 & l && (s = r(s)), 8 & l || 4 & l && typeof s == "object" && s && s.__esModule)
return s;
var d = /* @__PURE__ */ Object.create(null);
if (r.r(d), Object.defineProperty(d, "default", { enumerable: !0, value: s }), 2 & l && typeof s != "string")
for (var h in s)
r.d(d, h, function(p) {
return s[p];
}.bind(null, h));
return d;
}, r.n = function(s) {
var l = s && s.__esModule ? function() {
return s.default;
} : function() {
return s;
};
return r.d(l, "a", l), l;
}, r.o = function(s, l) {
return Object.prototype.hasOwnProperty.call(s, l);
}, r.p = "", r(r.s = 4);
}([function(e, t) {
function r(s) {
return e.exports = r = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(l) {
return typeof l;
} : function(l) {
return l && typeof Symbol == "function" && l.constructor === Symbol && l !== Symbol.prototype ? "symbol" : typeof l;
}, e.exports.__esModule = !0, e.exports.default = e.exports, r(s);
}
e.exports = r, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t, r) {
var s = r(2);
function l(d, h) {
for (var p = 0; p < h.length; p++) {
var E = h[p];
E.enumerable = E.enumerable || !1, E.configurable = !0, "value" in E && (E.writable = !0), Object.defineProperty(d, s(E.key), E);
}
}
e.exports = function(d, h, p) {
return h && l(d.prototype, h), p && l(d, p), Object.defineProperty(d, "prototype", { writable: !1 }), d;
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t, r) {
var s = r(0).default, l = r(3);
e.exports = function(d) {
var h = l(d, "string");
return s(h) == "symbol" ? h : h + "";
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t, r) {
var s = r(0).default;
e.exports = function(l, d) {
if (s(l) != "object" || !l)
return l;
var h = l[Symbol.toPrimitive];
if (h !== void 0) {
var p = h.call(l, d || "default");
if (s(p) != "object")
return p;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (d === "string" ? String : Number)(l);
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t, r) {
function s(m, b) {
console.log("%c " + m + " %c " + b + " %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");
}
r.r(t), r.d(t, "LogLevel", function() {
return x;
}), r.d(t, "DefaultLogger", function() {
return k;
}), r.d(t, "Logger", function() {
return A;
}), r.d(t, "printVersion", function() {
return s;
}), r.d(t, "DEFAULT_LOG_LEVEL", function() {
return v;
});
var l = r(1), d = r.n(l), h = function() {
function m() {
this.timeout = 6048e5;
}
var b = m.prototype;
return b.write = function(L, g) {
if (m.available)
try {
localStorage.setItem(L, JSON.stringify({ value: g, time: Date.now() }));
} catch (w) {
}
}, b.read = function(L, g) {
if (g === void 0 && (g = !0), m.available)
try {
var w = localStorage.getItem(L);
if (w) {
var _ = JSON.parse(w), y = _.value, I = _.time, P = I === void 0 ? 0 : I;
if (!g || Date.now() - P < (typeof g == "number" ? g : this.timeout))
return y;
}
} catch (G) {
}
}, d()(m, null, [{ key: "available", get: function() {
if (m._available === void 0)
try {
localStorage.setItem("alg", "test"), m._available = !0;
} catch (L) {
m._available = !1;
}
return m._available;
} }]);
}();
h._available = void 0;
var p, E = h, x = function(m) {
return m.NONE = "none", m.ERROR = "e", m.WARN = "w", m.INFO = "i", m.DEBUG = "d", m.VERBOSE = "v", m;
}({}), v = x.ERROR, O = ((p = {})[x.NONE] = { value: 1, str: "N" }, p[x.ERROR] = { value: 100, str: "E" }, p[x.WARN] = { value: 200, str: "W" }, p[x.INFO] = { value: 300, str: "I" }, p[x.DEBUG] = { value: 400, str: "D" }, p[x.VERBOSE] = { value: 500, str: "V" }, p), A = function() {
function m(L) {
if (this._name = "kwai-v", this._level = v, this._id = -1, this._output = void 0, this._workerTag = "main", typeof location < "u" && location.protocol === "blob:") {
var g, w = location.href.split("/"), _ = (g = w[w.length - 1]) == null ? void 0 : g.match(/(\w+)-/);
_ && (this._workerTag = L ? L + "-" + _[1] : _[1]);
} else
L && (this._workerTag = L);
}
m.loadLogLevel = function(L, g) {
if (g === void 0 && (g = !0), location.href) {
var w = new RegExp(L + "=([a-z]{1})"), _ = location.href.match(w);
if (_ && _.length > 1) {
var y = _[1];
if (this._isValueInLevel(y))
return y;
}
}
var I = new E().read(L, g);
if (this._isValueInLevel(I))
return I;
}, m.saveLogLevel = function(L, g) {
this._isValueInLevel(g) && new E().write(L, g);
}, m._isValueInLevel = function(L) {
return Object.values(x).indexOf(L) !== -1;
};
var b = m.prototype;
return b.setOutput = function(L) {
return this._output = L, this;
}, b.setLevel = function(L) {
return this._level = L, this;
}, b.setId = function(L) {
return this._id = L, this;
}, b.setName = function(L) {
return this._name = L, this;
}, b.getLevel = function() {
return this._level;
}, b.getOutput = function() {
return this._output;
}, b.hasOutput = function() {
return !!this._output;
}, b.e = function(L) {
if (this._isLevelEnabled(this._level, x.ERROR)) {
for (var g = arguments.length, w = new Array(g > 1 ? g - 1 : 0), _ = 1; _ < g; _++)
w[_ - 1] = arguments[_];
var y = this._printLog(x.ERROR, L, w);
try {
var I;
(I = this._output) == null || I.e.apply(I, [y].concat(w));
} catch (P) {
}
}
}, b.w = function(L) {
if (this._isLevelEnabled(this._level, x.WARN)) {
for (var g = arguments.length, w = new Array(g > 1 ? g - 1 : 0), _ = 1; _ < g; _++)
w[_ - 1] = arguments[_];
var y = this._printLog(x.WARN, L, w);
try {
var I;
(I = this._output) == null || I.w.apply(I, [y].concat(w));
} catch (P) {
}
}
}, b.i = function(L) {
if (this._isLevelEnabled(this._level, x.INFO)) {
for (var g = arguments.length, w = new Array(g > 1 ? g - 1 : 0), _ = 1; _ < g; _++)
w[_ - 1] = arguments[_];
var y = this._printLog(x.INFO, L, w);
try {
var I;
(I = this._output) == null || I.i.apply(I, [y].concat(w));
} catch (P) {
}
}
}, b.d = function(L) {
if (this._isLevelEnabled(this._level, x.DEBUG)) {
for (var g = arguments.length, w = new Array(g > 1 ? g - 1 : 0), _ = 1; _ < g; _++)
w[_ - 1] = arguments[_];
var y = this._printLog(x.DEBUG, L, w);
try {
var I;
(I = this._output) == null || I.d.apply(I, [y].concat(w));
} catch (P) {
}
}
}, b.v = function(L) {
if (this._isLevelEnabled(this._level, x.VERBOSE)) {
for (var g = arguments.length, w = new Array(g > 1 ? g - 1 : 0), _ = 1; _ < g; _++)
w[_ - 1] = arguments[_];
var y = this._printLog(x.VERBOSE, L, w);
try {
var I;
(I = this._output) == null || I.v.apply(I, [y].concat(w));
} catch (P) {
}
}
}, b._isLevelEnabled = function(L, g) {
return O[L].value >= O[g].value;
}, b._printLog = function(L, g, w) {
var _, y, I = typeof g;
if (I === "object")
g = ((y = g) == null ? void 0 : y.constructor.name) || "unknown";
else if (I === "function") {
var P;
g = ((P = Object.getOwnPropertyDescriptor(g, "name")) == null ? void 0 : P.value) || "unknown";
}
var G, H, Q = (((_ = O[L]) == null ? void 0 : _.str) || "") + "|" + this._name + "[" + (typeof this._id == "function" ? this._id() : this._id) + "][" + this._workerTag + "]::" + g;
return L === x.ERROR ? (G = console).error.apply(G, [Q].concat(w.slice(0))) : (H = console).log.apply(H, [Q].concat(w.slice(0))), Q;
}, m;
}(), k = new A();
}]);
Ai === void 0 && console.error("esm-webpack-plugin: nothing exported!");
Ai.LogLevel;
const wi = Ai.DefaultLogger;
Ai.Logger;
Ai.printVersion;
Ai.DEFAULT_LOG_LEVEL;
/*! js-cookie v3.0.5 | MIT */
function Hi(e) {
for (var t = 1; t < arguments.length; t++) {
var r = arguments[t];
for (var s in r)
e[s] = r[s];
}
return e;
}
var ec = {
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 $r(e, t) {
function r(l, d, h) {
if (!(typeof document > "u")) {
h = Hi({}, t, h), typeof h.expires == "number" && (h.expires = new Date(Date.now() + h.expires * 864e5)), h.expires && (h.expires = h.expires.toUTCString()), l = encodeURIComponent(l).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
var p = "";
for (var E in h)
h[E] && (p += "; " + E, h[E] !== !0 && (p += "=" + h[E].split(";")[0]));
return document.cookie = l + "=" + e.write(d, l) + p;
}
}
function s(l) {
if (!(typeof document > "u" || arguments.length && !l)) {
for (var d = document.cookie ? document.cookie.split("; ") : [], h = {}, p = 0; p < d.length; p++) {
var E = d[p].split("="), x = E.slice(1).join("=");
try {
var v = decodeURIComponent(E[0]);
if (h[v] = e.read(x, v), l === v)
break;
} catch (O) {
}
}
return l ? h[l] : h;
}
}
return Object.create(
{
set: r,
get: s,
remove: function(l, d) {
r(
l,
"",
Hi({}, d, {
expires: -1
})
);
},
withAttributes: function(l) {
return $r(this.converter, Hi({}, this.attributes, l));
},
withConverter: function(l) {
return $r(Hi({}, this.converter, l), this.attributes);
}
},
{
attributes: { value: Object.freeze(t) },
converter: { value: Object.freeze(e) }
}
);
}
var Nr = $r(ec, { path: "/" });
const Ti = "did", Pr = "kwai_player_device_id";
function Co() {
try {
const e = Math.random() * 1e9 >>> 0, t = [], r = "0123456789ABCDEF";
for (let l = 0; l < 7; l++)
t.push(r.charAt(Math.random() * 16));
const s = `web_${e}${t.join("")}`;
return wi.i(Ti, "generate nanoId", s), s;
} catch (e) {
}
return "web_did_generation_failed";
}
function tc() {
let e = "";
try {
e = (Nr.get("did") || Nr.get("_did") || Nr.get("weblogger_did") || "").trim(), wi.i(Ti, "generate deviceId from cookie", e);
} catch (t) {
wi.i(Ti, "generate deviceId from cookie err", t);
}
try {
e ? localStorage == null || localStorage.setItem(Pr, e) : (e = ((localStorage == null ? void 0 : localStorage.getItem(Pr)) || "").trim(), wi.i(Ti, "generate deviceId from ls", e)), e || (e = Co(), localStorage == null || localStorage.setItem(Pr, e));
} catch (t) {
wi.i(Ti, "generate deviceId from ls err", t);
}
return e || Co();
}
tc();
const ka = class ti {
constructor() {
da(this, "timeout", 7 * 24 * 3600 * 1e3);
}
write(t, r) {
if (ti.available)
try {
localStorage.setItem(
t,
JSON.stringify({ value: r, time: Date.now() })
);
} catch (s) {
}
}
read(t, r = !0) {
if (ti.available)
try {
const s = localStorage.getItem(t);
if (s) {
const { value: l, time: d = 0 } = JSON.parse(s);
if (!r || Date.now() - d < (typeof r == "number" ? r : this.timeout))
return l;
}
} catch (s) {
}
}
static get available() {
if (typeof ti._available > "u")
try {
localStorage.setItem("alg", "test"), ti._available = !0;
} catch (t) {
ti._available = !1;
}
return ti._available;
}
};
da(ka, "_available");
let Ia = ka;
var qr = { exports: {} };
(function(e, t) {
(function(r, s) {
var l = "1.0.2", d = "", h = "?", p = "function", E = "undefined", x = "object", v = "string", O = "major", A = "model", k = "name", m = "type", b = "vendor", L = "version", g = "architecture", w = "console", _ = "mobile", y = "tablet", I = "smarttv", P = "wearable", G = "embedded", H = 255, Q = "Amazon", ue = "Apple", de = "ASUS", j = "BlackBerry", B = "Browser", R = "Chrome", D = "Edge", U = "Firefox", N = "Google", J = "Huawei", Y = "LG", C = "Microsoft", M = "Motorola", F = "Opera", Z = "Samsung", K = "Sony", se = "Xiaomi", Ae = "Zebra", he = "Facebook", we = function(oe, le) {
var ne = {};
for (var me in oe)
le[me] && le[me].length % 2 === 0 ? ne[me] = le[me].concat(oe[me]) : ne[me] = oe[me];
return ne;
}, ee = function(oe) {
for (var le = {}, ne = 0; ne < oe.length; ne++)
le[oe[ne].toUpperCase()] = oe[ne];
return le;
}, We = function(oe, le) {
return typeof oe === v ? Le(le).indexOf(Le(oe)) !== -1 : !1;
}, Le = function(oe) {
return oe.toLowerCase();
}, Ft = function(oe) {
return typeof oe === v ? oe.replace(/[^\d\.]/g, d).split(".")[0] : s;
}, tt = function(oe, le) {
if (typeof oe === v)
return oe = oe.replace(/^\s\s*/, d).replace(/\s\s*$/, d), typeof le === E ? oe : oe.substring(0, H);
}, fe = function(oe, le) {
for (var ne = 0, me, ae, Et, pe, Xe, ze; ne < le.length && !Xe; ) {
var wt = le[ne], Zt = le[ne + 1];
for (me = ae = 0; me < wt.length && !Xe; )
if (Xe = wt[me++].exec(oe), Xe)
for (Et = 0; Et < Zt.length; Et++)
ze = Xe[++ae], pe = Zt[Et], typeof pe === x && pe.length > 0 ? pe.length === 2 ? typeof pe[1] == p ? this[pe[0]] = pe[1].call(this, ze) : this[pe[0]] = pe[1] : pe.length === 3 ? typeof pe[1] === p && !(pe[1].exec && pe[1].test) ? this[pe[0]] = ze ? pe[1].call(this, ze, pe[2]) : s : this[pe[0]] = ze ? ze.replace(pe[1], pe[2]) : s : pe.length === 4 && (this[pe[0]] = ze ? pe[3].call(this, ze.replace(pe[1], pe[2])) : s) : this[pe] = ze || s;
ne += 2;
}
}, Fe = function(oe, le) {
for (var ne in le)
if (typeof le[ne] === x && le[ne].length > 0) {
for (var me = 0; me < le[ne].length; me++)
if (We(le[ne][me], oe))
return ne === h ? s : ne;
} else if (We(le[ne], oe))
return ne === h ? s : ne;
return oe;
}, St = {
"1.0": "/8",
"1.2": "/1",
"1.3": "/3",
"2.0": "/412",
"2.0.2": "/416",
"2.0.3": "/417",
"2.0.4": "/419",
"?": "/"
}, ce = {
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"
}, He = {
browser: [
[
/\b(?:crmo|crios)\/([\w\.]+)/i
// Chrome for Android/iOS
],
[L, [k, "Chrome"]],
[
/edg(?:e|ios|a)?\/([\w\.]+)/i
// Microsoft Edge
],
[L, [k, "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
],
[k, L],
[
/opios[\/ ]+([\w\.]+)/i
// Opera mini on iphone >= 8.0
],
[L, [k, F + " Mini"]],
[
/\bopr\/([\w\.]+)/i
// Opera Webkit
],
[L, [k, F]],
[
// 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
],
[k, L],
[
/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i
// UCBrowser
],
[L, [k, "UC" + B]],
[
/\bqbcore\/([\w\.]+)/i
// WeChat Desktop for Windows Built-in Browser
],
[L, [k, "WeChat(Win) Desktop"]],
[
/micromessenger\/([\w\.]+)/i
// WeChat
],
[L, [k, "WeChat"]],
[
/konqueror\/([\w\.]+)/i
// Konqueror
],
[L, [k, "Konqueror"]],
[
/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i
// IE11
],
[L, [k, "IE"]],
[
/yabrowser\/([\w\.]+)/i
// Yandex
],
[L, [k, "Yandex"]],
[
/(avast|avg)\/([\w\.]+)/i
// Avast/AVG Secure Browser
],
[[k, /(.+)/, "$1 Secure " + B], L],
[
/\bfocus\/([\w\.]+)/i
// Firefox Focus
],
[L, [k, U + " Focus"]],
[
/\bopt\/([\w\.]+)/i
// Opera Touch
],
[L, [k, F + " Touch"]],
[
/coc_coc\w+\/([\w\.]+)/i
// Coc Coc Browser
],
[L, [k, "Coc Coc"]],
[
/dolfin\/([\w\.]+)/i
// Dolphin
],
[L, [k, "Dolphin"]],
[
/coast\/([\w\.]+)/i
// Opera Coast
],
[L, [k, F + " Coast"]],
[
/miuibrowser\/([\w\.]+)/i
// MIUI Browser
],
[L, [k, "MIUI " + B]],
[
/fxios\/([-\w\.]+)/i
// Firefox for iOS
],
[L, [k, U]],
[
/\bqihu|(qi?ho?o?|360)browser/i
// 360
],
[[k, "360 " + B]],
[
/(oculus|samsung|sailfish)browser\/([\w\.]+)/i
],
[[k, /(.+)/, "$1 " + B], L],
[
// Oculus/Samsung/Sailfish Browser
/(comodo_dragon)\/([\w\.]+)/i
// Comodo Dragon
],
[[k, /_/g, " "], L],
[
/(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
],
[k, L],
[
/(metasr)[\/ ]?([\w\.]+)/i,
// SouGouBrowser
/(lbbrowser)/i
// LieBao Browser
],
[k],
[
// WebView
/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i
// Facebook App for iOS & Android
],
[[k, he], L],
[
/safari (line)\/([\w\.]+)/i,
// Line App for iOS
/\b(line)\/([\w\.]+)\/iab/i,
// Line App for Android
/(chromium|instagram)[\/ ]([-\w\.]+)/i
// Chromium/Instagram
],
[k, L],
[
/\bgsa\/([\w\.]+) .*safari\//i
// Google Search Appliance on iOS
],
[L, [k, "GSA"]],
[
/headlesschrome(?:\/([\w\.]+)| )/i
// Chrome Headless
],
[L, [k, R + " Headless"]],
[
/ wv\).+(chrome)\/([\w\.]+)/i
// Chrome WebView
],
[[k, R + " WebView"], L],
[
/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i
// Android Browser
],
[L, [k, "Android " + B]],
[
/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i
// Chrome/OmniWeb/Arora/Tizen/Nokia
],
[k, L],
[
/version\/([\w\.]+) .*mobile\/\w+ (safari)/i
// Mobile Safari
],
[L, [k, "Mobile Safari"]],
[
/version\/([\w\.]+) .*(mobile ?safari|safari)/i
// Safari & Safari Mobile
],
[L, k],
[
/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i
// Safari < 3.0
],
[k, [L, Fe, St]],
[
/(webkit|khtml)\/([\w\.]+)/i
],
[k, L],
[
// Gecko based
/(navigator|netscape\d?)\/([-\w\.]+)/i
// Netscape
],
[[k, "Netscape"], L],
[
/mobile vr; rv:([\w\.]+)\).+firefox/i
// Firefox Reality
],
[L, [k, U + " 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
],
[k, L]
],
cpu: [
[
/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i
// AMD64 (x64)
],
[[g, "amd64"]],
[
/(ia32(?=;))/i
// IA32 (quicktime)
],
[[g, Le]],
[
/((?:i[346]|x)86)[;\)]/i
// IA32 (x86)
],
[[g, "ia32"]],
[
/\b(aarch64|arm(v?8e?l?|_?64))\b/i
// ARM64
],
[[g, "arm64"]],
[
/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i
// ARMHF
],
[[g, "armhf"]],
[
// PocketPC mistakenly identified as PowerPC
/windows (ce|mobile); ppc;/i
],
[[g, "arm"]],
[
/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i
// PowerPC
],
[[g, /ower/, d, Le]],
[
/(sun4\w)[;\)]/i
// SPARC
],
[[g, "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
],
[[g, 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
],
[A, [b, Z], [m, y]],
[
/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,
/samsung[- ]([-\w]+)/i,
/sec-(sgh\w+)/i
],
[A, [b, Z], [m, _]],
[
// Apple
/\((ip(?:hone|od)[\w ]*);/i
// iPod/iPhone
],
[A, [b, ue], [m, _]],
[
/\((ipad);[-\w\),; ]+apple/i,
// iPad
/applecoremedia\/[\w\.]+ \((ipad)/i,
/\b(ipad)\d\d?,\d\d?[;\]].+ios/i
],
[A, [b, ue], [m, y]],
[
// Huawei
/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i
],
[A, [b, J], [m, y]],
[
/(?:huawei|honor)([-\w ]+)[;\)]/i,
/\b(nexus 6p|\w{2,4}-[atu]?[ln][01259x][012359][an]?)\b(?!.+d\/s)/i
],
[A, [b, J], [m, _]],
[
// 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
],
[[A, /_/g, " "], [b, se], [m, _]],
[
/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i
// Mi Pad tablets
],
[[A, /_/g, " "], [b, se], [m, y]],
[
// OPPO
/; (\w+) bui.+ oppo/i,
/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i
],
[A, [b, "OPPO"], [m, _]],
[
// Vivo
/vivo (\w+)(?: bui|\))/i,
/\b(v[12]\d{3}\w?[at])(?: bui|;)/i
],
[A, [b, "Vivo"], [m, _]],
[
// Realme
/\b(rmx[12]\d{3})(?: bui|;|\))/i
],
[A, [b, "Realme"], [m, _]],
[
// 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
],
[A, [b, M], [m, _]],
[
/\b(mz60\d|xoom[2 ]{0,2}) build\//i
],
[A, [b, M], [m, y]],
[
// LG
/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i
],
[A, [b, Y], [m, y]],
[
/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,
/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,
/\blg-?([\d\w]+) bui/i
],
[A, [b, Y], [m, _]],
[
// Lenovo
/(ideatab[-\w ]+)/i,
/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i
],
[A, [b, "Lenovo"], [m, y]],
[
// Nokia
/(?:maemo|nokia).*(n900|lumia \d+)/i,
/nokia[-_ ]?([-\w\.]*)/i
],
[[A, /_/g, " "], [b, "Nokia"], [m, _]],
[
// Google
/(pixel c)\b/i
// Google Pixel C
],
[A, [b, N], [m, y]],
[
/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i
// Google Pixel
],
[A, [b, N], [m, _]],
[
// Sony
/droid.+ ([c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i
],
[A, [b, K], [m, _]],
[
/sony tablet [ps]/i,
/\b(?:sony)?sgp\w+(?: bui|\))/i
],
[[A, "Xperia Tablet"], [b, K], [m, y]],
[
// OnePlus
/ (kb2005|in20[12]5|be20[12][59])\b/i,
/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i
],
[A, [b, "OnePlus"], [m, _]],
[
// Amazon
/(alexa)webm/i,
/(kf[a-z]{2}wi)( bui|\))/i,
// Kindle Fire without Silk
/(kf[a-z]+)( bui|\)).+silk\//i
// Kindle Fire HD
],
[A, [b, Q], [m, y]],
[
/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i
// Fire Phone
],
[[A, /(.+)/g, "Fire Phone $1"], [b, Q], [m, _]],
[
// BlackBerry
/(playbook);[-\w\),; ]+(rim)/i
// BlackBerry PlayBook
],
[A, b, [m, y]],
[
/\b((?:bb[a-f]|st[hv])100-\d)/i,
/\(bb10; (\w+)/i
// BlackBerry 10
],
[A, [b, j], [m, _]],
[
// Asus
/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i
],
[A, [b, de], [m, y]],
[
/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i
],
[A, [b, de], [m, _]],
[
// HTC
/(nexus 9)/i
// HTC Nexus 9
],
[A, [b, "HTC"], [m, y]],
[
/(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
],
[b, [A, /_/g, " "], [m, _]],
[
// Acer
/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i
],
[A, [b, "Acer"], [m, y]],
[
// Meizu
/droid.+; (m[1-5] note) bui/i,
/\bmz-([-\w]{2,})/i
],
[A, [b, "Meizu"], [m, _]],
[
// Sharp
/\b(sh-?[altvz]?\d\d[a-ekm]?)/i
],
[A, [b, "Sharp"], [m, _]],
[
// 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
],
[b, A, [m, _]],
[
/(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
],
[b, A, [m, y]],
[
/(surface duo)/i
// Surface Duo
],
[A, [b, C], [m, y]],
[
/droid [\d\.]+; (fp\du?)(?: b|\))/i
// Fairphone
],
[A, [b, "Fairphone"], [m, _]],
[
/(u304aa)/i
// AT&T
],
[A, [b, "AT&T"], [m, _]],
[
/\bsie-(\w*)/i
// Siemens
],
[A, [b, "Siemens"], [m, _]],
[
/\b(rct\w+) b/i
// RCA Tablets
],
[A, [b, "RCA"], [m, y]],
[
/\b(venue[\d ]{2,7}) b/i
// Dell Venue Tablets
],
[A, [b, "Dell"], [m, y]],
[
/\b(q(?:mv|ta)\w+) b/i
// Verizon Tablet
],
[A, [b, "Verizon"], [m, y]],
[
/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i
// Barnes & Noble Tablet
],
[A, [b, "Barnes & Noble"], [m, y]],
[
/\b(tm\d{3}\w+) b/i
],
[A, [b, "NuVision"], [m, y]],
[
/\b(k88) b/i
// ZTE K Series Tablet
],
[A, [b, "ZTE"], [m, y]],
[
/\b(nx\d{3}j) b/i
// ZTE Nubia
],
[A, [b, "ZTE"], [m, _]],
[
/\b(gen\d{3}) b.+49h/i
// Swiss GEN Mobile
],
[A, [b, "Swiss"], [m, _]],
[
/\b(zur\d{3}) b/i
// Swiss ZUR Tablet
],
[A, [b, "Swiss"], [m, y]],
[
/\b((zeki)?tb.*\b) b/i
// Zeki Tablets
],
[A, [b, "Zeki"], [m, y]],
[
/\b([yr]\d{2}) b/i,
/\b(dragon[- ]+touch |dt)(\w{5}) b/i
// Dragon Touch Tablet
],
[[b, "Dragon Touch"], A, [m, y]],
[
/\b(ns-?\w{0,9}) b/i
// Insignia Tablets
],
[A, [b, "Insignia"], [m, y]],
[
/\b((nxa|next)-?\w{0,9}) b/i
// NextBook Tablets
],
[A, [b, "NextBook"], [m, y]],
[
/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i
// Voice Xtreme Phones
],
[[b, "Voice"], A, [m, _]],
[
/\b(lvtel\-)?(v1[12]) b/i
// LvTel Phones
],
[[b, "LvTel"], A, [m, _]],
[
/\b(ph-1) /i
// Essential PH-1
],
[A, [b, "Essential"], [m, _]],
[
/\b(v(100md|700na|7011|917g).*\b) b/i
// Envizen Tablets
],
[A, [b, "Envizen"], [m, y]],
[
/\b(trio[-\w\. ]+) b/i
// MachSpeed Tablets
],
[A, [b, "MachSpeed"], [m, y]],
[
/\btu_(1491) b/i
// Rotor Tablets
],
[A, [b, "Rotor"], [m, y]],
[
/(shield[\w ]+) b/i
// Nvidia Shield Tablets
],
[A, [b, "Nvidia"], [m, y]],
[
/(sprint) (\w+)/i
// Sprint Phones
],
[b, A, [m, _]],
[
/(kin\.[onetw]{3})/i
// Microsoft Kin
],
[[A, /\./g, " "], [b, C], [m, _]],
[
/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i
// Zebra
],
[A, [b, Ae], [m, y]],
[
/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i
],
[A, [b, Ae], [m, _]],
[
///////////////////
// CONSOLES
///////////////////
/(ouya)/i,
// Ouya
/(nintendo) ([wids3utch]+)/i
// Nintendo
],
[b, A, [m, w]],
[
/droid.+; (shield) bui/i
// Nvidia
],
[A, [b, "Nvidia"], [m, w]],
[
/(playstation [345portablevi]+)/i
// Playstation
],
[A, [b, K], [m, w]],
[
/\b(xbox(?: one)?(?!; xbox))[\); ]/i
// Microsoft Xbox
],
[A, [b, C], [m, w]],
[
///////////////////
// SMARTTVS
///////////////////
/smart-tv.+(samsung)/i
// Samsung
],
[b, [m, I]],
[
/hbbtv.+maple;(\d+)/i
],
[[A, /^/, "SmartTV"], [b, Z], [m, I]],
[
/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i
// LG SmartTV
],
[[b, Y], [m, I]],
[
/(apple) ?tv/i
// Apple TV
],
[b, [A, ue + " TV"], [m, I]],
[
/crkey/i
// Google Chromecast
],
[[A, R + "cast"], [b, N], [m, I]],
[
/droid.+aft(\w)( bui|\))/i
// Fire TV
],
[A, [b, Q], [m, I]],
[
/\(dtv[\);].+(aquos)/i
// Sharp
],
[A, [b, "Sharp"], [m, I]],
[
/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,
// Roku
/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i
// HbbTV devices
],
[[b, tt], [A, tt], [m, I]],
[
/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i
// SmartTV from Unidentified Vendors
],
[[m, I]],
[
///////////////////
// WEARABLES
///////////////////
/((pebble))app/i
// Pebble
],
[b, A, [m, P]],
[
/droid.+; (glass) \d/i
// Google Glass
],
[A, [b, N], [m, P]],
[
/droid.+; (wt63?0{2,3})\)/i
],
[A, [b, Ae], [m, P]],
[
/(quest( 2)?)/i
// Oculus Quest
],
[A, [b, he], [m, P]],
[
///////////////////
// EMBEDDED
///////////////////
/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i
// Tesla
],
[b, [m, G]],
[
////////////////////
// MIXED (GENERIC)
///////////////////
/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i
// Android Phones from Unidentified Vendors
],
[A, [m, _]],
[
/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i
// Android Tablets from Unidentified Vendors
],
[A, [m, y]],
[
/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i
// Unidentifiable Tablet
],
[[m, y]],
[
/(phone|mobile(?:[;\/]| safari)|pda(?=.+windows ce))/i
// Unidentifiable Mobile
],
[[m, _]],
[
/(android[-\w\. ]{0,9});.+buil/i
// Generic Android Device
],
[A, [b, "Generic"]]
],
engine: [
[
/windows.+ edge\/([\w\.]+)/i
// EdgeHTML
],
[L, [k, D + "HTML"]],
[
/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i
// Blink
],
[L, [k, "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
],
[k, L],
[
/rv\:([\w\.]{1,9})\b.+(gecko)/i
// Gecko
],
[L, k]
],
os: [
[
// Windows
/microsoft (windows) (vista|xp)/i
// Windows (iTunes)
],
[k, L],
[
/(windows) nt 6\.2; (arm)/i,
// Windows RT
/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,
// Windows Phone
/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i
],
[k, [L, Fe, ce]],
[
/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i
],
[[k, "Windows"], [L, Fe, ce]],
[
// iOS/macOS
/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,
// iOS
/cfnetwork\/.+darwin/i
],
[[L, /_/g, "."], [k, "iOS"]],
[
/(mac os x) ?([\w\. ]*)/i,
/(macintosh|mac_powerpc\b)(?!.+haiku)/i
// Mac OS
],
[[k, "Mac OS"], [L, /_/g, "."]],
[
// Mobile OSes
/droid ([\w\.]+)\b.+(android[- ]x86)/i
// Android-x86
],
[L, k],
[
// 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
],
[k, L],
[
/\(bb(10);/i
// BlackBerry 10
],
[L, [k, j]],
[
/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i
// Symbian
],
[L, [k, "Symbian"]],
[
/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i
// Firefox OS
],
[L, [k, U + " OS"]],
[
/web0s;.+rt(tv)/i,
/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i
// WebOS
],
[L, [k, "webOS"]],
[
// Google Chromecast
/crkey\/([\d\.]+)/i
// Google Chromecast
],
[L, [k, R + "cast"]],
[
/(cros) [\w]+ ([\w\.]+\w)/i
// Chromium OS
],
[[k, "Chromium OS"], L],
[
// 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
],
[k, L],
[
/(sunos) ?([\w\.\d]*)/i
// Solaris
],
[[k, "Solaris"], L],
[
/((?: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
],
[k, L]
]
}, Me = function(oe, le) {
if (typeof oe === x && (le = oe, oe = s), !(this instanceof Me))
return new Me(oe, le).getResult();
var ne = oe || (typeof r !== E && r.navigator && r.navigator.userAgent ? r.navigator.userAgent : d), me = le ? we(He, le) : He;
return this.getBrowser = function() {
var ae = {};
return ae[k] = s, ae[L] = s, fe.call(ae, ne, me.browser), ae.major = Ft(ae.version), ae;
}, this.getCPU = function() {
var ae = {};
return ae[g] = s, fe.call(ae, ne, me.cpu), ae;
}, this.getDevice = function() {
var ae = {};
return ae[b] = s, ae[A] = s, ae[m] = s, fe.call(ae, ne, me.device), ae;
}, this.getEngine = function() {
var ae = {};
return ae[k] = s, ae[L] = s, fe.call(ae, ne, me.engine), ae;
}, this.getOS = function() {
var ae = {};
return ae[k] = s, ae[L] = s, fe.call(ae, ne, me.os), ae;
}, 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 ne;
}, this.setUA = function(ae) {
return ne = typeof ae === v && ae.length > H ? tt(ae, H) : ae, this;
}, this.setUA(ne), this;
};
Me.VERSION = l, Me.BROWSER = ee([k, L, O]), Me.CPU = ee([g]), Me.DEVICE = ee([A, b, m, w, _, I, y, P, G]), Me.ENGINE = Me.OS = ee([k, L]), e.exports && (t = e.exports = Me), t.UAParser = Me;
var Pe = typeof r !== E && (r.jQuery || r.Zepto);
if (Pe && !Pe.ua) {
var ge = new Me();
Pe.ua = ge.getResult(), Pe.ua.get = function() {
return ge.getUA();
}, Pe.ua.set = function(oe) {
ge.setUA(oe);
var le = ge.getResult();
for (var ne in le)
Pe.ua[ne] = le[ne];
};
}
})(typeof window == "object" ? window : Tu);
})(qr, qr.exports);
var ic = qr.exports;
const rc = /* @__PURE__ */ Ru(ic);
let Vi = 0;
function nc() {
return Vi = Vi ? Vi + 1 : Date.now(), `c-${Vi}`;
}
const Nt = rc(), tr = Nt.os.name, oc = tr && tr.toLowerCase().indexOf("android") >= 0, ac = tr && tr.toLowerCase().indexOf("ios") >= 0, ui = Nt.device.type === "mobile" || oc || ac, xa = "kwai-p";
let Yr = ha.ERROR;
typeof location < "u" && (Yr = fa.loadLogLevel("kwai-player-log") || ha.ERROR, Qe.setLevel(Yr).setName(xa));
const Ca = Du.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 (t) {
console.error("vite-plugin-css-injected-by-js", t);
}
})();
var sc = Object.defineProperty, lc = (e, t, r) => t in e ? sc(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, X = (e, t, r) => (lc(e, typeof t != "symbol" ? t + "" : t, r), r), Li = /* @__PURE__ */ ((e) => (e.NONE = "none", e.KWAI = "kwai", e.KWAI2 = "kwai2", e))(Li || {}), Ot = /* @__PURE__ */ ((e) => (e.SYSTEM = "system", e.WINDOW = "window", e))(Ot || {}), Ji = /* @__PURE__ */ ((e) => (e.VIDEO = "video", e.VIDEO_INTERACTIVE = "videoInteractive", e.DEFAULT = "default", e))(Ji || {}), z = /* @__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))(z || {}), Je = function(e) {
var t = {};
function r(s) {
if (t[s])
return t[s].exports;
var l = t[s] = { i: s, l: !1, exports: {} };
return e[s].call(l.exports, l, l.exports, r), l.l = !0, l.exports;
}
return r.m = e, r.c = t, r.d = function(s, l, d) {
r.o(s, l) || Object.defineProperty(s, l, { enumerable: !0, get: d });
}, r.r = function(s) {
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(s, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(s, "__esModule", { value: !0 });
}, r.t = function(s, l) {
if (1 & l && (s = r(s)), 8 & l || 4 & l && typeof s == "object" && s && s.__esModule)
return s;
var d = /* @__PURE__ */ Object.create(null);
if (r.r(d), Object.defineProperty(d, "default", { enumerable: !0, value: s }), 2 & l && typeof s != "string")
for (var h in s)
r.d(d, h, function(p) {
return s[p];
}.bind(null, h));
return d;
}, r.n = function(s) {
var l = s && s.__esModule ? function() {
return s.default;
} : function() {
return s;
};
return r.d(l, "a", l), l;
}, r.o = function(s, l) {
return Object.prototype.hasOwnProperty.call(s, l);
}, r.p = "", r(r.s = 16);
}([function(e, t, r) {
var s = r(10);
function l(d, h) {
for (var p = 0; p < h.length; p++) {
var E = h[p];
E.enumerable = E.enumerable || !1, E.configurable = !0, "value" in E && (E.writable = !0), Object.defineProperty(d, s(E.key), E);
}
}
e.exports = function(d, h, p) {
return h && l(d.prototype, h), p && l(d, p), Object.defineProperty(d, "prototype", { writable: !1 }), d;
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t) {
function r() {
return e.exports = r = Object.assign ? Object.assign.bind() : function(s) {
for (var l = 1; l < arguments.length; l++) {
var d = arguments[l];
for (var h in d)
Object.prototype.hasOwnProperty.call(d, h) && (s[h] = d[h]);
}
return s;
}, e.exports.__esModule = !0, e.exports.default = e.exports, r.apply(this, arguments);
}
e.exports = r, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t, r) {
var s = r(12);
e.exports = function(l, d) {
l.prototype = Object.create(d.prototype), l.prototype.constructor = l, s(l, d);
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t) {
e.exports = void 0;
}, function(e, t, r) {
var s = r(14), l = r(15), d = /^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/, h = /[\n\r\t]/g, p = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//, E = /:\d+$/, x = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i, v = /^[a-zA-Z]:/;
function O(w) {
return (w || "").toString().replace(d, "");
}
var A = [["#", "hash"], ["?", "query"], function(w, _) {
return b(_.protocol) ? w.replace(/\\/g, "/") : w;
}, ["/", "pathname"], ["@", "auth", 1], [NaN, "host", void 0, 1, 1], [/:(\d*)$/, "port", void 0, 1], [NaN, "hostname", void 0, 1, 1]], k = { hash: 1, query: 1 };
function m(w) {
var _, y = (typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}).location || {}, I = {}, P = typeof (w = w || y);
if (w.protocol === "blob:")
I = new g(unescape(w.pathname), {});
else if (P === "string")
for (_ in I = new g(w, {}), k)
delete I[_];
else if (P === "object") {
for (_ in w)
_ in k || (I[_] = w[_]);
I.slashes === void 0 && (I.slashes = p.test(w.href));
}
return I;
}
function b(w) {
return w === "file:" || w === "ftp:" || w === "http:" || w === "https:" || w === "ws:" || w === "wss:";
}
function L(w, _) {
w = (w = O(w)).replace(h, ""), _ = _ || {};
var y, I = x.exec(w), P = I[1] ? I[1].toLowerCase() : "", G = !!I[2], H = !!I[3], Q = 0;
return G ? H ? (y = I[2] + I[3] + I[4], Q = I[2].length + I[3].length) : (y = I[2] + I[4], Q = I[2].length) : H ? (y = I[3] + I[4], Q = I[3].length) : y = I[4], P === "file:" ? Q >= 2 && (y = y.slice(2)) : b(P) ? y = I[4] : P ? G && (y = y.slice(2)) : Q >= 2 && b(_.protocol) && (y = I[4]), { protocol: P, slashes: G || b(P), slashesCount: Q, rest: y };
}
function g(w, _, y) {
if (w = (w = O(w)).replace(h, ""), !(this instanceof g))
return new g(w, _, y);
var I, P, G, H, Q, ue, de = A.slice(), j = typeof _, B = this, R = 0;
for (j !== "object" && j !== "string" && (y = _, _ = null), y && typeof y != "function" && (y = l.parse), I = !(P = L(w || "", _ = m(_))).protocol && !P.slashes, B.slashes = P.slashes || I && _.slashes, B.protocol = P.protocol || _.protocol || "", w = P.rest, (P.protocol === "file:" && (P.slashesCount !== 2 || v.test(w)) || !P.slashes && (P.protocol || P.slashesCount < 2 || !b(B.protocol))) && (de[3] = [/(.*)/, "pathname"]); R < de.length; R++)
typeof (H = de[R]) != "function" ? (G = H[0], ue = H[1], G != G ? B[ue] = w : typeof G == "string" ? ~(Q = G === "@" ? w.lastIndexOf(G) : w.indexOf(G)) && (typeof H[2] == "number" ? (B[ue] = w.slice(0, Q), w = w.slice(Q + H[2])) : (B[ue] = w.slice(Q), w = w.slice(0, Q))) : (Q = G.exec(w)) && (B[ue] = Q[1], w = w.slice(0, Q.index)), B[ue] = B[ue] || I && H[3] && _[ue] || "", H[4] && (B[ue] = B[ue].toLowerCase())) : w = H(w, B);
y && (B.query = y(B.query)), I && _.slashes && B.pathname.charAt(0) !== "/" && (B.pathname !== "" || _.pathname !== "") && (B.pathname = function(D, U) {
if (D === "")
return U;
for (var N = (U || "/").split("/").slice(0, -1).concat(D.split("/")), J = N.length, Y = N[J - 1], C = !1, M = 0; J--; )
N[J] === "." ? N.splice(J, 1) : N[J] === ".." ? (N.splice(J, 1), M++) : M && (J === 0 && (C = !0), N.splice(J, 1), M--);
return C && N.unshift(""), Y !== "." && Y !== ".." || N.push(""), N.join("/");
}(B.pathname, _.pathname)), B.pathname.charAt(0) !== "/" && b(B.protocol) && (B.pathname = "/" + B.pathname), s(B.port, B.protocol) || (B.host = B.hostname, B.port = ""), B.username = B.password = "", B.auth && (~(Q = B.auth.indexOf(":")) ? (B.username = B.auth.slice(0, Q), B.username = encodeURIComponent(decodeURIComponent(B.username)), B.password = B.auth.slice(Q + 1), B.password = encodeURIComponent(decodeURIComponent(B.password))) : B.username = encodeURIComponent(decodeURIComponent(B.auth)), B.auth = B.password ? B.username + ":" + B.password : B.username), B.origin = B.protocol !== "file:" && b(B.protocol) && B.host ? B.protocol + "//" + B.host : "null", B.href = B.toString();
}
g.prototype = { set: function(w, _, y) {
var I = this;
switch (w) {
case "query":
typeof _ == "string" && _.length && (_ = (y || l.parse)(_)), I[w] = _;
break;
case "port":
I[w] = _, s(_, I.protocol) ? _ && (I.host = I.hostname + ":" + _) : (I.host = I.hostname, I[w] = "");
break;
case "hostname":
I[w] = _, I.port && (_ += ":" + I.port), I.host = _;
break;
case "host":
I[w] = _, E.test(_) ? (_ = _.split(":"), I.port = _.pop(), I.hostname = _.join(":")) : (I.hostname = _, I.port = "");
break;
case "protocol":
I.protocol = _.toLowerCase(), I.slashes = !y;
break;
case "pathname":
case "hash":
if (_) {
var P = w === "pathname" ? "/" : "#";
I[w] = _.charAt(0) !== P ? P + _ : _;
} else
I[w] = _;
break;
case "username":
case "password":
I[w] = encodeURIComponent(_);
break;
case "auth":
var G = _.indexOf(":");
~G ? (I.username = _.slice(0, G), I.username = encodeURIComponent(decodeURIComponent(I.username)), I.password = _.slice(G + 1), I.password = encodeURIComponent(decodeURIComponent(I.password))) : I.username = encodeURIComponent(decodeURIComponent(_));
}
for (var H = 0; H < A.length; H++) {
var Q = A[H];
Q[4] && (I[Q[1]] = I[Q[1]].toLowerCase());
}
return I.auth = I.password ? I.username + ":" + I.password : I.username, I.origin = I.protocol !== "file:" && b(I.protocol) && I.host ? I.protocol + "//" + I.host : "null", I.href = I.toString(), I;
}, toString: function(w) {
w && typeof w == "function" || (w = l.stringify);
var _, y = this, I = y.host, P = y.protocol;
P && P.charAt(P.length - 1) !== ":" && (P += ":");
var G = P + (y.protocol && y.slashes || b(y.protocol) ? "//" : "");
return y.username ? (G += y.username, y.password && (G += ":" + y.password), G += "@") : y.password ? (G += ":" + y.password, G += "@") : y.protocol !== "file:" && b(y.protocol) && !I && y.pathname !== "/" && (G += "@"), (I[I.length - 1] === ":" || E.test(y.hostname) && !y.port) && (I += ":"), G += I + y.pathname, (_ = typeof y.query == "object" ? w(y.query) : y.query) && (G += _.charAt(0) !== "?" ? "?" + _ : _), y.hash && (G += y.hash), G;
} }, g.extractProtocol = L, g.location = m, g.trimLeft = O, g.qs = l, e.exports = g;
}, function(e, t, r) {
var s, l, d, h, p;
s = /^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/, l = /^(?=([^\/?#]*))\1([^]*)$/, d = /(?:\/|^)\.(?=\/)/g, h = /(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g, p = { buildAbsoluteURL: function(E, x, v) {
if (v = v || {}, E = E.trim(), !(x = x.trim())) {
if (!v.alwaysNormalize)
return E;
var O = p.parseURL(E);
if (!O)
throw new Error("Error trying to parse base URL.");
return O.path = p.normalizePath(O.path), p.buildURLFromParts(O);
}
var A = p.parseURL(x);
if (!A)
throw new Error("Error trying to parse relative URL.");
if (A.scheme)
return v.alwaysNormalize ? (A.path = p.normalizePath(A.path), p.buildURLFromParts(A)) : x;
var k = p.parseURL(E);
if (!k)
throw new Error("Error trying to parse base URL.");
if (!k.netLoc && k.path && k.path[0] !== "/") {
var m = l.exec(k.path);
k.netLoc = m[1], k.path = m[2];
}
k.netLoc && !k.path && (k.path = "/");
var b = { scheme: k.scheme, netLoc: A.netLoc, path: null, params: A.params, query: A.query, fragment: A.fragment };
if (!A.netLoc && (b.netLoc = k.netLoc, A.path[0] !== "/"))
if (A.path) {
var L = k.path, g = L.substring(0, L.lastIndexOf("/") + 1) + A.path;
b.path = p.normalizePath(g);
} else
b.path = k.path, A.params || (b.params = k.params, A.query || (b.query = k.query));
return b.path === null && (b.path = v.alwaysNormalize ? p.normalizePath(A.path) : A.path), p.buildURLFromParts(b);
}, parseURL: function(E) {
var x = s.exec(E);
return x ? { scheme: x[1] || "", netLoc: x[2] || "", path: x[3] || "", params: x[4] || "", query: x[5] || "", fragment: x[6] || "" } : null;
}, normalizePath: function(E) {
for (E = E.split("").reverse().join("").replace(d, ""); E.length !== (E = E.replace(h, "")).length; )
;
return E.split("").reverse().join("");
}, buildURLFromParts: function(E) {
return E.scheme + E.netLoc + E.path + E.params + E.query + E.fragment;
} }, e.exports = p;
}, function(e, t, r) {
e.exports = function(s) {
var l = {};
function d(h) {
if (l[h])
return l[h].exports;
var p = l[h] = { i: h, l: !1, exports: {} };
return s[h].call(p.exports, p, p.exports, d), p.l = !0, p.exports;
}
return d.m = s, d.c = l, d.d = function(h, p, E) {
d.o(h, p) || Object.defineProperty(h, p, { enumerable: !0, get: E });
}, d.r = function(h) {
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(h, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(h, "__esModule", { value: !0 });
}, d.t = function(h, p) {
if (1 & p && (h = d(h)), 8 & p || 4 & p && typeof h == "object" && h && h.__esModule)
return h;
var E = /* @__PURE__ */ Object.create(null);
if (d.r(E), Object.defineProperty(E, "default", { enumerable: !0, value: h }), 2 & p && typeof h != "string")
for (var x in h)
d.d(E, x, function(v) {
return h[v];
}.bind(null, x));
return E;
}, d.n = function(h) {
var p = h && h.__esModule ? function() {
return h.default;
} : function() {
return h;
};
return d.d(p, "a", p), p;
}, d.o = function(h, p) {
return Object.prototype.hasOwnProperty.call(h, p);
}, d.p = "", d(d.s = 4);
}([function(s, l) {
function d(h) {
return s.exports = d = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(p) {
return typeof p;
} : function(p) {
return p && typeof Symbol == "function" && p.constructor === Symbol && p !== Symbol.prototype ? "symbol" : typeof p;
}, s.exports.__esModule = !0, s.exports.default = s.exports, d(h);
}
s.exports = d, s.exports.__esModule = !0, s.exports.default = s.exports;
}, function(s, l, d) {
var h = d(2);
function p(E, x) {
for (var v = 0; v < x.length; v++) {
var O = x[v];
O.enumerable = O.enumerable || !1, O.configurable = !0, "value" in O && (O.writable = !0), Object.defineProperty(E, h(O.key), O);
}
}
s.exports = function(E, x, v) {
return x && p(E.prototype, x), v && p(E, v), Object.defineProperty(E, "prototype", { writable: !1 }), E;
}, s.exports.__esModule = !0, s.exports.default = s.exports;
}, function(s, l, d) {
var h = d(0).default, p = d(3);
s.exports = function(E) {
var x = p(E, "string");
return h(x) == "symbol" ? x : x + "";
}, s.exports.__esModule = !0, s.exports.default = s.exports;
}, function(s, l, d) {
var h = d(0).default;
s.exports = function(p, E) {
if (h(p) != "object" || !p)
return p;
var x = p[Symbol.toPrimitive];
if (x !== void 0) {
var v = x.call(p, E || "default");
if (h(v) != "object")
return v;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (E === "string" ? String : Number)(p);
}, s.exports.__esModule = !0, s.exports.default = s.exports;
}, function(s, l, d) {
function h(g, w) {
console.log("%c " + g + " %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");
}
d.r(l), d.d(l, "LogLevel", function() {
return A;
}), d.d(l, "DefaultLogger", function() {
return L;
}), d.d(l, "Logger", function() {
return b;
}), d.d(l, "printVersion", function() {
return h;
}), d.d(l, "DEFAULT_LOG_LEVEL", function() {
return k;
});
var p = d(1), E = d.n(p), x = function() {
function g() {
this.timeout = 6048e5;
}
var w = g.prototype;
return w.write = function(_, y) {
if (g.available)
try {
localStorage.setItem(_, JSON.stringify({ value: y, time: Date.now() }));
} catch (I) {
}
}, w.read = function(_, y) {
if (y === void 0 && (y = !0), g.available)
try {
var I = localStorage.getItem(_);
if (I) {
var P = JSON.parse(I), G = P.value, H = P.time, Q = H === void 0 ? 0 : H;
if (!y || Date.now() - Q < (typeof y == "number" ? y : this.timeout))
return G;
}
} catch (ue) {
}
}, E()(g, null, [{ key: "available", get: function() {
if (g.A === void 0)
try {
localStorage.setItem("alg", "test"), g.A = !0;
} catch (_) {
g.A = !1;
}
return g.A;
} }]);
}();
x.A = void 0;
var v, O = x, A = function(g) {
return g.NONE = "none", g.ERROR = "e", g.WARN = "w", g.INFO = "i", g.DEBUG = "d", g.VERBOSE = "v", g;
}({}), k = A.ERROR, m = ((v = {})[A.NONE] = { value: 1, str: "N" }, v[A.ERROR] = { value: 100, str: "E" }, v[A.WARN] = { value: 200, str: "W" }, v[A.INFO] = { value: 300, str: "I" }, v[A.DEBUG] = { value: 400, str: "D" }, v[A.VERBOSE] = { value: 500, str: "V" }, v), b = function() {
function g(_) {
if (this.h = "kwai-v", this.M = k, this._ = -1, this.R = void 0, this.D = "main", typeof location < "u" && location.protocol === "blob:") {
var y, I = location.href.split("/"), P = (y = I[I.length - 1]) == null ? void 0 : y.match(/(\w+)-/);
P && (this.D = _ ? _ + "-" + P[1] : P[1]);
} else
_ && (this.D = _);
}
g.loadLogLevel = function(_, y) {
if (y === void 0 && (y = !0), location.href) {
var I = new RegExp(_ + "=([a-z]{1})"), P = location.href.match(I);
if (P && P.length > 1) {
var G = P[1];
if (this.T(G))
return G;
}
}
var H = new O().read(_, y);
if (this.T(H))
return H;
}, g.saveLogLevel = function(_, y) {
this.T(y) && new O().write(_, y);
}, g.T = function(_) {
return Object.values(A).indexOf(_) !== -1;
};
var w = g.prototype;
return w.setOutput = function(_) {
return this.R = _, this;
}, w.setLevel = function(_) {
return this.M = _, this;
}, w.setId = function(_) {
return this._ = _, this;
}, w.setName = function(_) {
return this.h = _, this;
}, w.getLevel = function() {
return this.M;
}, w.getOutput = function() {
return this.R;
}, w.hasOutput = function() {
return !!this.R;
}, w.e = function(_) {
if (this.S(this.M, A.ERROR)) {
for (var y = arguments.length, I = new Array(y > 1 ? y - 1 : 0), P = 1; P < y; P++)
I[P - 1] = arguments[P];
var G = this.O(A.ERROR, _, I);
try {
var H;
(H = this.R) == null || H.e.apply(H, [G].concat(I));
} catch (Q) {
}
}
}, w.w = function(_) {
if (this.S(this.M, A.WARN)) {
for (var y = arguments.length, I = new Array(y > 1 ? y - 1 : 0), P = 1; P < y; P++)
I[P - 1] = arguments[P];
var G = this.O(A.WARN, _, I);
try {
var H;
(H = this.R) == null || H.w.apply(H, [G].concat(I));
} catch (Q) {
}
}
}, w.i = function(_) {
if (this.S(this.M, A.INFO)) {
for (var y = arguments.length, I = new Array(y > 1 ? y - 1 : 0), P = 1; P < y; P++)
I[P - 1] = arguments[P];
var G = this.O(A.INFO, _, I);
try {
var H;
(H = this.R) == null || H.i.apply(H, [G].concat(I));
} catch (Q) {
}
}
}, w.d = function(_) {
if (this.S(this.M, A.DEBUG)) {
for (var y = arguments.length, I = new Array(y > 1 ? y - 1 : 0), P = 1; P < y; P++)
I[P - 1] = arguments[P];
var G = this.O(A.DEBUG, _, I);
try {
var H;
(H = this.R) == null || H.d.apply(H, [G].concat(I));
} catch (Q) {
}
}
}, w.v = function(_) {
if (this.S(this.M, A.VERBOSE)) {
for (var y = arguments.length, I = new Array(y > 1 ? y - 1 : 0), P = 1; P < y; P++)
I[P - 1] = arguments[P];
var G = this.O(A.VERBOSE, _, I);
try {
var H;
(H = this.R) == null || H.v.apply(H, [G].concat(I));
} catch (Q) {
}
}
}, w.S = function(_, y) {
return m[_].value >= m[y].value;
}, w.O = function(_, y, I) {
var P, G, H = typeof y;
if (H === "object")
y = ((G = y) == null ? void 0 : G.constructor.name) || "unknown";
else if (H === "function") {
var Q;
y = ((Q = Object.getOwnPropertyDescriptor(y, "name")) == null ? void 0 : Q.value) || "unknown";
}
var ue, de, j = (((P = m[_]) == null ? void 0 : P.str) || "") + "|" + this.h + "[" + (typeof this._ == "function" ? this._() : this._) + "][" + this.D + "]::" + y;
return _ === A.ERROR ? (ue = console).error.apply(ue, [j].concat(I.slice(0))) : (de = console).log.apply(de, [j].concat(I.slice(0))), j;
}, g;
}(), L = new b();
}]);
}, function(e, t, r) {
var s, l = typeof Reflect == "object" ? Reflect : null, d = l && typeof l.apply == "function" ? l.apply : function(w, _, y) {
return Function.prototype.apply.call(w, _, y);
};
s = l && typeof l.ownKeys == "function" ? l.ownKeys : Object.getOwnPropertySymbols ? function(w) {
return Object.getOwnPropertyNames(w).concat(Object.getOwnPropertySymbols(w));
} : function(w) {
return Object.getOwnPropertyNames(w);
};
var h = Number.isNaN || function(w) {
return w != w;
};
function p() {
p.init.call(this);
}
e.exports = p, e.exports.once = function(w, _) {
return new Promise(function(y, I) {
function P(H) {
w.removeListener(_, G), I(H);
}
function G() {
typeof w.removeListener == "function" && w.removeListener("error", P), y([].slice.call(arguments));
}
g(w, _, G, { once: !0 }), _ !== "error" && function(H, Q, ue) {
typeof H.on == "function" && g(H, "error", Q, ue);
}(w, P, { once: !0 });
});
}, p.EventEmitter = p, p.prototype.C = void 0, p.prototype.L = 0, p.prototype.N = void 0;
var E = 10;
function x(w) {
if (typeof w != "function")
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof w);
}
function v(w) {
return w.N === void 0 ? p.defaultMaxListeners : w.N;
}
function O(w, _, y, I) {
var P, G, H, Q;
if (x(y), (G = w.C) === void 0 ? (G = w.C = /* @__PURE__ */ Object.create(null), w.L = 0) : (G.newListener !== void 0 && (w.emit("newListener", _, y.listener ? y.listener : y), G = w.C), H = G[_]), H === void 0)
H = G[_] = y, ++w.L;
else if (typeof H == "function" ? H = G[_] = I ? [y, H] : [H, y] : I ? H.unshift(y) : H.push(y), (P = v(w)) > 0 && H.length > P && !H.warned) {
H.warned = !0;
var ue = new Error("Possible EventEmitter memory leak detected. " + H.length + " " + String(_) + " listeners added. Use emitter.setMaxListeners() to increase limit");
ue.name = "MaxListenersExceededWarning", ue.emitter = w, ue.type = _, ue.count = H.length, Q = ue, console && console.warn && console.warn(Q);
}
return w;
}
function A() {
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 k(w, _, y) {
var I = { fired: !1, wrapFn: void 0, target: w, type: _, listener: y }, P = A.bind(I);
return P.listener = y, I.wrapFn = P, P;
}
function m(w, _, y) {
var I = w.C;
if (I === void 0)
return [];
var P = I[_];
return P === void 0 ? [] : typeof P == "function" ? y ? [P.listener || P] : [P] : y ? function(G) {
for (var H = new Array(G.length), Q = 0; Q < H.length; ++Q)
H[Q] = G[Q].listener || G[Q];
return H;
}(P) : L(P, P.length);
}
function b(w) {
var _ = this.C;
if (_ !== void 0) {
var y = _[w];
if (typeof y == "function")
return 1;
if (y !== void 0)
return y.length;
}
return 0;
}
function L(w, _) {
for (var y = new Array(_), I = 0; I < _; ++I)
y[I] = w[I];
return y;
}
function g(w, _, y, I) {
if (typeof w.on == "function")
I.once ? w.once(_, y) : w.on(_, y);
else {
if (typeof w.addEventListener != "function")
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof w);
w.addEventListener(_, function P(G) {
I.once && w.removeEventListener(_, P), y(G);
});
}
}
Object.defineProperty(p, "defaultMaxListeners", { enumerable: !0, get: function() {
return E;
}, set: function(w) {
if (typeof w != "number" || w < 0 || h(w))
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + w + ".");
E = w;
} }), p.init = function() {
this.C !== void 0 && this.C !== Object.getPrototypeOf(this).C || (this.C = /* @__PURE__ */ Object.create(null), this.L = 0), this.N = this.N || void 0;
}, p.prototype.setMaxListeners = function(w) {
if (typeof w != "number" || w < 0 || h(w))
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + w + ".");
return this.N = w, this;
}, p.prototype.getMaxListeners = function() {
return v(this);
}, p.prototype.emit = function(w) {
for (var _ = [], y = 1; y < arguments.length; y++)
_.push(arguments[y]);
var I = w === "error", P = this.C;
if (P !== void 0)
I = I && P.error === void 0;
else if (!I)
return !1;
if (I) {
var G;
if (_.length > 0 && (G = _[0]), G instanceof Error)
throw G;
var H = new Error("Unhandled error." + (G ? " (" + G.message + ")" : ""));
throw H.context = G, H;
}
var Q = P[w];
if (Q === void 0)
return !1;
if (typeof Q == "function")
d(Q, this, _);
else {
var ue = Q.length, de = L(Q, ue);
for (y = 0; y < ue; ++y)
d(de[y], this, _);
}
return !0;
}, p.prototype.addListener = function(w, _) {
return O(this, w, _, !1);
}, p.prototype.on = p.prototype.addListener, p.prototype.prependListener = function(w, _) {
return O(this, w, _, !0);
}, p.prototype.once = function(w, _) {
return x(_), this.on(w, k(this, w, _)), this;
}, p.prototype.prependOnceListener = function(w, _) {
return x(_), this.prependListener(w, k(this, w, _)), this;
}, p.prototype.removeListener = function(w, _) {
var y, I, P, G, H;
if (x(_), (I = this.C) === void 0)
return this;
if ((y = I[w]) === void 0)
return this;
if (y === _ || y.listener === _)
--this.L == 0 ? this.C = /* @__PURE__ */ Object.create(null) : (delete I[w], I.removeListener && this.emit("removeListener", w, y.listener || _));
else if (typeof y != "function") {
for (P = -1, G = y.length - 1; G >= 0; G--)
if (y[G] === _ || y[G].listener === _) {
H = y[G].listener, P = G;
break;
}
if (P < 0)
return this;
P === 0 ? y.shift() : function(Q, ue) {
for (; ue + 1 < Q.length; ue++)
Q[ue] = Q[ue + 1];
Q.pop();
}(y, P), y.length === 1 && (I[w] = y[0]), I.removeListener !== void 0 && this.emit("removeListener", w, H || _);
}
return this;
}, p.prototype.off = p.prototype.removeListener, p.prototype.removeAllListeners = function(w) {
var _, y, I;
if ((y = this.C) === void 0)
return this;
if (y.removeListener === void 0)
return arguments.length === 0 ? (this.C = /* @__PURE__ */ Object.create(null), this.L = 0) : y[w] !== void 0 && (--this.L == 0 ? this.C = /* @__PURE__ */ Object.create(null) : delete y[w]), this;
if (arguments.length === 0) {
var P, G = Object.keys(y);
for (I = 0; I < G.length; ++I)
(P = G[I]) !== "removeListener" && this.removeAllListeners(P);
return this.removeAllListeners("removeListener"), this.C = /* @__PURE__ */ Object.create(null), this.L = 0, this;
}
if (typeof (_ = y[w]) == "function")
this.removeListener(w, _);
else if (_ !== void 0)
for (I = _.length - 1; I >= 0; I--)
this.removeListener(w, _[I]);
return this;
}, p.prototype.listeners = function(w) {
return m(this, w, !0);
}, p.prototype.rawListeners = function(w) {
return m(this, w, !1);
}, p.listenerCount = function(w, _) {
return typeof w.listenerCount == "function" ? w.listenerCount(_) : b.call(w, _);
}, p.prototype.listenerCount = b, p.prototype.eventNames = function() {
return this.L > 0 ? s(this.C) : [];
};
}, function(e, t) {
function r(s) {
return e.exports = r = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(l) {
return typeof l;
} : function(l) {
return l && typeof Symbol == "function" && l.constructor === Symbol && l !== Symbol.prototype ? "symbol" : typeof l;
}, e.exports.__esModule = !0, e.exports.default = e.exports, r(s);
}
e.exports = r, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t, r) {
function s(x) {
var v = {};
function O(k) {
if (v[k])
return v[k].exports;
var m = v[k] = { i: k, l: !1, exports: {} };
return x[k].call(m.exports, m, m.exports, O), m.l = !0, m.exports;
}
O.m = x, O.c = v, O.i = function(k) {
return k;
}, O.d = function(k, m, b) {
O.o(k, m) || Object.defineProperty(k, m, { configurable: !1, enumerable: !0, get: b });
}, O.r = function(k) {
Object.defineProperty(k, "__esModule", { value: !0 });
}, O.n = function(k) {
var m = k && k.__esModule ? function() {
return k.default;
} : function() {
return k;
};
return O.d(m, "a", m), m;
}, O.o = function(k, m) {
return Object.prototype.hasOwnProperty.call(k, m);
}, O.p = "/", O.oe = function(k) {
throw console.error(k), k;
};
var A = O(O.s = ENTRY_MODULE);
return A.default || A;
}
var l = "[\\.|\\-|\\+|\\w|/|@]+", d = "\\(\\s*(/\\*.*?\\*/)?\\s*.*?(" + l + ").*?\\)";
function h(x) {
return (x + "").replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&");
}
function p(x, v, O) {
var A = {};
A[O] = [];
var k = v.toString(), m = k.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);
if (!m)
return A;
for (var b, L = m[1], g = new RegExp("(\\\\n|\\W)" + h(L) + d, "g"); b = g.exec(k); )
b[3] !== "dll-reference" && A[O].push(b[3]);
for (g = new RegExp("\\(" + h(L) + '\\("(dll-reference\\s(' + l + '))"\\)\\)' + d, "g"); b = g.exec(k); )
x[b[2]] || (A[O].push(b[1]), x[b[2]] = r(b[1]).m), A[b[2]] = A[b[2]] || [], A[b[2]].push(b[4]);
for (var w, _ = Object.keys(A), y = 0; y < _.length; y++)
for (var I = 0; I < A[_[y]].length; I++)
w = A[_[y]][I], isNaN(1 * w) || (A[_[y]][I] = 1 * A[_[y]][I]);
return A;
}
function E(x) {
return Object.keys(x).reduce(function(v, O) {
return v || x[O].length > 0;
}, !1);
}
e.exports = function(x, v) {
v = v || {};
var O = { main: r.m }, A = v.all ? { main: Object.keys(O.main) } : function(g, w) {
for (var _ = { main: [w] }, y = { main: [] }, I = { main: {} }; E(_); )
for (var P = Object.keys(_), G = 0; G < P.length; G++) {
var H = P[G], Q = _[H].pop();
if (I[H] = I[H] || {}, !I[H][Q] && g[H][Q]) {
I[H][Q] = !0, y[H] = y[H] || [], y[H].push(Q);
for (var ue = p(g, g[H][Q], H), de = Object.keys(ue), j = 0; j < de.length; j++)
_[de[j]] = _[de[j]] || [], _[de[j]] = _[de[j]].concat(ue[de[j]]);
}
}
return y;
}(O, x), k = "";
Object.keys(A).filter(function(g) {
return g !== "main";
}).forEach(function(g) {
for (var w = 0; A[g][w]; )
w++;
A[g].push(w), O[g][w] = "(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })", k = k + "var " + g + " = (" + s.toString().replace("ENTRY_MODULE", JSON.stringify(w)) + ")({" + A[g].map(function(_) {
return JSON.stringify(_) + ": " + O[g][_].toString();
}).join(",") + `});
`;
}), k = k + "new ((" + s.toString().replace("ENTRY_MODULE", JSON.stringify(x)) + ")({" + A.main.map(function(g) {
return JSON.stringify(g) + ": " + O.main[g].toString();
}).join(",") + "}))(self);";
var m = new window.Blob([k], { type: "text/javascript" });
if (v.bare)
return m;
var b = (window.URL || window.webkitURL || window.mozURL || window.msURL).createObjectURL(m), L = new window.Worker(b);
return L.objectURL = b, L;
};
}, function(e, t, r) {
var s = r(8).default, l = r(11);
e.exports = function(d) {
var h = l(d, "string");
return s(h) === "symbol" ? h : String(h);
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t, r) {
var s = r(8).default;
e.exports = function(l, d) {
if (s(l) !== "object" || l === null)
return l;
var h = l[Symbol.toPrimitive];
if (h !== void 0) {
var p = h.call(l, d || "default");
if (s(p) !== "object")
return p;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (d === "string" ? String : Number)(l);
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t) {
function r(s, l) {
return e.exports = r = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(d, h) {
return d.__proto__ = h, d;
}, e.exports.__esModule = !0, e.exports.default = e.exports, r(s, l);
}
e.exports = r, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t) {
Number.isFinite || (Number.isFinite = function(r) {
return typeof r == "number" && isFinite(r);
}), Number.MAX_SAFE_INTEGER || (Number.MAX_SAFE_INTEGER = Math.pow(2, 53) - 1), Object.values || (Object.values = function(r) {
if (r == null)
throw new TypeError("Cannot convert undefined or null to object");
var s = [];
for (var l in r)
Object.prototype.hasOwnProperty.call(r, l) && s.push(r[l]);
return s;
});
}, function(e, t, r) {
e.exports = function(s, l) {
if (l = l.split(":")[0], !(s = +s))
return !1;
switch (l) {
case "http":
case "ws":
return s !== 80;
case "https":
case "wss":
return s !== 443;
case "ftp":
return s !== 21;
case "gopher":
return s !== 70;
case "file":
return !1;
}
return s !== 0;
};
}, function(e, t, r) {
var s = Object.prototype.hasOwnProperty;
function l(h) {
try {
return decodeURIComponent(h.replace(/\+/g, " "));
} catch (p) {
return null;
}
}
function d(h) {
try {
return encodeURIComponent(h);
} catch (p) {
return null;
}
}
t.stringify = function(h, p) {
p = p || "";
var E, x, v = [];
for (x in typeof p != "string" && (p = "?"), h)
if (s.call(h, x)) {
if ((E = h[x]) || E != null && !isNaN(E) || (E = ""), x = d(x), E = d(E), x === null || E === null)
continue;
v.push(x + "=" + E);
}
return v.length ? p + v.join("&") : "";
}, t.parse = function(h) {
for (var p, E = /([^=?#&]+)=?([^&]*)/g, x = {}; p = E.exec(h); ) {
var v = l(p[1]), O = l(p[2]);
v === null || O === null || v in x || (x[v] = O);
}
return x;
};
}, function(e, t, r) {
r.r(t), r.d(t, "default", function() {
return bo;
}), r.d(t, "createKernel", function() {
return pu;
}), r.d(t, "AbstractDestroyable", function() {
return R;
}), r.d(t, "CanvasContextType", function() {
return m;
}), r.d(t, "CodecType", function() {
return v;
}), r.d(t, "DestroyableList", function() {
return B;
}), r.d(t, "Decoder", function() {
return b;
}), r.d(t, "DemuxerType", function() {
return He;
}), r.d(t, "DownloadStatus", function() {
return ml;
}), r.d(t, "ErrorDetails", function() {
return ge;
}), r.d(t, "ErrorTypes", function() {
return Pe;
}), r.d(t, "HttpRangeType", function() {
return I;
}), r.d(t, "KEvents", function() {
return q;
}), r.d(t, "LiveShiftType", function() {
return de;
}), r.d(t, "LogLevel", function() {
return mi.LogLevel;
}), r.d(t, "MediaBox", function() {
return g;
}), r.d(t, "ReportTypes", function() {
return dt;
}), r.d(t, "StereoType", function() {
return Q;
}), r.d(t, "VideoDecBlockPolicy", function() {
return y;
}), r.d(t, "VideoDropFramePolicy", function() {
return _;
}), r.d(t, "VideoRendererType", function() {
return k;
}), r.d(t, "WasmDecoder", function() {
return A;
});
var s = r(1), l = r.n(s), d = r(0), h = r.n(d), p = r(2), E = r.n(p), x = (r(13), r(7)), v = function(n) {
return n.unknown = "unknown", n.h264 = "h264", n.hevc = "hevc", n.av1 = "av1", n.kvc3 = "kvc3", n.kvc4 = "kvc4", n.kvc5 = "kvc5", n.kvc6 = "kvc6", n.aac = "aac", n.mp3 = "mp3", n.opus = "opus", n.yuv = "yuv", n.rawvideo = "rawvideo", n.vvc = "vvc", n.bvc2 = "bvc2", n.kvc30 = "kvc30", n;
}({}), O = function(n) {
return n.UNKNOWN = "unknown", n.FHD = "fhd", n.UHD_4K = "4k", n;
}({}), A = function(n) {
return n.kvc3 = "kvc3", n.kvc4 = "kvc4", n.kvc5 = "kvc5", n.kvc6 = "kvc6", n.h265 = "h265", n.kw265 = "kw265", n.kvc30 = "kvc30", n;
}({}), k = function(n) {
return n.video = "video", n.canvas = "canvas", n;
}({}), m = function(n) {
return n.canvas2d = "canvas2d", n.webgl = "webgl", n;
}({}), b = function(n) {
return n.buildin = "buildin", n.wasm = "wasm", n.none = "none", n.unsupported = "unsupported", n;
}({}), L = function(n) {
return n.KWAI_FLV_ABR = "kwaiFlvAbr", n.KWAI_FLV_MP = "kwaiFlvMultipart", n.KWAI = "kwai", n.FILE = "file", n.OTHERS = "others", n;
}({}), g = function(n) {
return n.flv = "flv", n.hls = "hls", n.hls_ts = "hls_ts", n.hls_fmp4 = "hls_fmp4", n.webrtc = "webrtc", n.mp4 = "mp4", n.raw = "raw", n.mp3 = "mp3", n.wav = "wav", n.aac = "aac", n.matroska = "matroska", n.ts = "ts", n.ivf = "ivf", n.yuv = "yuv", n.unknown = "unknown", n;
}({}), w = function(n) {
return n.RTC = "rtc_retry", n.BACKUP = "backup", n.FALLBACK = "fallback", n.LOADER = "loader", n;
}({}), _ = function(n) {
return n.AUTO = "auto", n.MIN = "min", n;
}({}), y = function(n) {
return n.NONE = "none", n.WAITING = "waiting", n;
}({}), I = function(n) {
return n.STANDARD = "standard", n.QUERY_START_END = "queryStartEnd", n;
}({}), P = function(n) {
return n.MAIN = "main", n.AUDIO = "audio", n.SUBTITLE = "subtitle", n;
}({}), G = function(n) {
return n.VIDEO = "video", n.AUDIO = "audio", n;
}({}), H = function(n) {
return n.unknown = "unknown", n.native = "native", n.mse = "mse", n.rtc = "rtc", n;
}({}), Q = function(n) {
return n[n.Normal = 0] = "Normal", n[n.V360 = 1] = "V360", n[n.V180 = 2] = "V180", n;
}({}), ue = function(n) {
return n[n.normal = 0] = "normal", n[n.internal = 1] = "internal", n[n.retry = 2] = "retry", n;
}({}), de = function(n) {
return n.NONE = "none", n.KWAI = "kwai", n.KWAI2 = "kwai2", n;
}({}), j = function(n) {
return n.UNKNOWN = "", n.PROBABLY = "probably", n;
}({}), B = function() {
function n() {
var a;
this.I = [], (a = this.I).push.apply(a, arguments);
}
var c = n.prototype;
return c.push = function() {
var a;
(a = this.I).push.apply(a, arguments);
}, c.destroyItem = function(a) {
for (var i = 0; i < this.I.length; i++)
if (this.I[i] === a)
return this.I.splice(i, 1), void a.destroy();
}, c.destroy = function() {
for (; this.I.length; ) {
var a = this.I.shift();
a && a.destroy();
}
}, h()(n, [{ key: "destroyed", get: function() {
return !!this.I.length;
} }]);
}(), R = function() {
function n() {
this.F = new B();
}
return n.prototype.destroy = function() {
this.F.destroy();
}, n;
}(), D = function(n) {
return n.LOADER_CONNECT_TIMEOUT = "connectTimeout", n.LOADER_TRANS_TIMEOUT = "transTimeout", n.HANDLING_DATA_ERROR = "handlingDataError", n;
}({}), U = function(n) {
return n.XHR_ERROR_NAME = "XHRError", n.FETCH_ERROR_NAME = "FetchError", n.FETCH_READ_ERROR_NAME = "ReadError", n.SLICE_UNPACK_ERROR_NAME = "SliceUnpackError", n;
}({}), N = function(n) {
return n.UNKNOWN = "unknown", n.FETCH = "fetch", n.XHR = "xhr", n;
}({}), J = 255, Y = 20;
function C(n, c, a) {
if (n[c] === void 0)
n[c] = a;
else {
var i = n[c];
Array.isArray(i) ? i.push(a) : typeof i == "string" && (n[c] = [i, a]);
}
}
function M(n) {
var c = {};
return typeof n == "string" ? n.trim().split(/[\r\n]+/).forEach(function(a) {
var i = a.split(": "), o = i.shift(), u = i.join(":");
o && C(c, o, u);
}) : n && n.forEach(function(a, i) {
a.split(",").forEach(function(o) {
C(c, i, o);
});
}), c;
}
function F(n) {
var c = [];
if (n)
for (var a in n) {
var i = n[a];
i && c.push(a + ": " + (Array.isArray(i) ? i.join(",") : i).slice(0, J));
}
if (c.length)
return c.length > Y ? (c.sort(function(o, u) {
return Z(u) - Z(o);
}), c.slice(0, Y)) : c;
}
var Z = function(n) {
return n.toLowerCase().indexOf("kwaisign") === 0 || n.toLowerCase().indexOf("x-ks-") === 0 ? 1 : 0;
}, K = function(n) {
return n.MOZ_CHUNK = "moz-chunked-arraybuffer", n.UNKNOW = "unknow", n.UNSUPPORT = "", n;
}({}), se = function() {
function n() {
var a = this;
this.tag = "xhr", this.B = null, this.j = void 0, this.U = null, this.P = K.UNKNOW, this.V = function() {
if (a.B) {
var i = a.B;
i.readyState === 2 && (a.j.responseUrl = i.responseURL, a.j.responseHeader = M(i.getAllResponseHeaders()), a.U && a.U.onConnect && a.U.onConnect(a.j, i.status), (i.status < 200 || i.status > 299) && a.H());
}
}, this.W = function() {
if (a.B) {
var i = a.B.response;
a.U && a.U.onProgress && i && a.U.onProgress(a.j, i);
}
}, this.G = function() {
var i = null, o = a.B;
!a.P && o && (i = o.response), a.U && a.U.onEnd(a.j, i);
}, this.H = function() {
var i;
if (a.U && a.U.onError) {
var o = new Error("xhr load error.");
o.name = U.XHR_ERROR_NAME, a.U.onError(o);
}
(i = a.B) == null || i.abort();
}, this.B = null;
}
n.isSupportChunk = function() {
if (n.Y !== K.UNKNOW)
return n.Y;
try {
var a = new XMLHttpRequest();
if (a.open("GET", "https://example.com", !0), a.responseType = K.MOZ_CHUNK, a.responseType === K.MOZ_CHUNK)
return n.Y = K.MOZ_CHUNK, n.Y;
} catch (i) {
n.Y = K.UNSUPPORT;
}
return K.UNSUPPORT;
};
var c = n.prototype;
return c.load = function(a, i) {
this.U = i, this.j = a, this.P = K.UNSUPPORT, a.progress && a.responseType === "arraybuffer" && (this.P = n.isSupportChunk());
var o = this.B = new XMLHttpRequest();
o.open(a.requestMethod ? a.requestMethod : "GET", this.j.url, !0), this.P === K.MOZ_CHUNK ? (o.responseType = K.MOZ_CHUNK, o.onprogress = this.W, o.onload = this.G) : (o.responseType = a.responseType || "arraybuffer", o.onload = this.G), o.onreadystatechange = this.V, o.onerror = this.H, o.withCredentials = !!a.credentials, a.range && o.setRequestHeader("Range", a.range), a.headers && a.headers.forEach(function(u) {
o.setRequestHeader(u.header, u.value);
}), o.send(a.requestBody);
}, c.abort = function() {
this.B && (this.B.onreadystatechange = null, this.B.onprogress = null, this.B.onload = null, this.B.onerror = null, this.B.abort(), this.B = null);
}, c.destroy = function() {
this.U = null, this.abort();
}, n;
}();
se.Y = K.UNKNOW;
var Ae = [g.hls, g.hls_ts, g.hls_fmp4];
function he(n) {
return !!n && Ae.indexOf(n) !== -1;
}
var we = { version: { major: 0, string: "" } };
(function(n) {
if (typeof navigator < "u") {
n = n ? n.toLowerCase() : navigator.userAgent.toLowerCase();
var c = /(edge)\/([\w.]+)/.exec(n) || /(edg)\/([\w.]+)/.exec(n) || /(opr)[/]([\w.]+)/.exec(n) || /(chrome)[ /]([\w.]+)/.exec(n) || /(iemobile)[/]([\w.]+)/.exec(n) || /(version)(applewebkit)[ /]([\w.]+).*(safari)[ /]([\w.]+)/.exec(n) || /(webkit)[ /]([\w.]+).*(version)[ /]([\w.]+).*(safari)[ /]([\w.]+)/.exec(n) || /(webkit)[ /]([\w.]+)/.exec(n) || /(opera)(?:.*version|)[ /]([\w.]+)/.exec(n) || /(msie) ([\w.]+)/.exec(n) || n.indexOf("trident") >= 0 && /(rv)(?::| )([\w.]+)/.exec(n) || n.indexOf("compatible") < 0 && /(firefox)[ /]([\w.]+)/.exec(n) || [], a = /(ipad)/.exec(n) || /(ipod)/.exec(n) || /(windows phone)/.exec(n) || /(iphone)/.exec(n) || /(kindle)/.exec(n) || /(android)/.exec(n) || /(windows)/.exec(n) || /(mac)/.exec(n) || /(linux)/.exec(n) || /(cros)/.exec(n) || [], i = /(?:iphone|ipad|cpu) os (\d+)[._]\d+/.exec(n) || /android ([\d.]+)/.exec(n) || [], o = { browser: c[5] || c[3] || c[1] || "", version: c[2] || c[4] || "0", majorVersion: c[4] || c[2] || "0", platform: a[0] || "", platformVersion: i[1] || "" }, u = { x5: / tbs\//.test(n), xweb: / xweb\//.test(n), version: { major: 0, string: "" } };
if (o.browser) {
u[o.browser] = !0;
var f = o.majorVersion.split(".");
u.version = { major: parseInt(o.majorVersion, 10), string: o.version }, f.length > 1 && (u.version.minor = parseInt(f[1], 10)), f.length > 2 && (u.version.build = parseInt(f[2], 10));
}
if (o.platform && (u[o.platform] = !0), (u.chrome || u.opr || u.safari) && (u.webkit = !0), u.rv || u.iemobile) {
u.rv && delete u.rv;
var T = "msie";
o.browser = T, u[T] = !0;
}
if (u.edg || u.edge) {
delete u.edg, delete u.edge;
var S = "msedge";
o.browser = S, u[S] = !0;
}
if (u.opr) {
var V = "opera";
o.browser = V, u[V] = !0;
}
if (u.safari && u.android) {
var W = "android";
o.browser = W, u[W] = !0;
}
if (u.android) {
var $ = n.match(/android[\s0-9.]+;([\w\s-]+)(build)?/);
if ($)
try {
var te;
u.model = (te = $[1].split("build")[0]) == null ? void 0 : te.trim();
} catch (ie) {
}
} else
u.ipad ? u.model = "ipad" : u.iphone && (u.model = "iphone");
for (var be in (u.android || u.iphone || u.ipad) && (u.mobile = !0), u.ios = u.iphone || u.ipad, u.name = o.browser, u.platform = o.platform, u.platformVersion = o.platformVersion, we)
Object.prototype.hasOwnProperty.call(we, be) && delete we[be];
l()(we, u);
}
})();
var ee = we;
function We(n, c) {
var a = n.toString();
return a.toLowerCase().indexOf("[native code]") !== -1 && a.indexOf(c) !== -1 ? j.UNKNOWN : j.PROBABLY;
}
var Le = function() {
function n(a) {
this.tag = "fetch", this.J = void 0, this.j = void 0, this.U = null, this.Z = null, this.K = null, this.q = !1, this.J = a;
}
n.isSupported = function() {
return typeof fetch < "u" && typeof ReadableStream < "u";
};
var c = n.prototype;
return c.load = function(a, i) {
var o = this;
this.j = a, this.U = i;
var u = new Headers();
a.headers && a.headers.forEach(function(V) {
u.append(V.header, V.value);
}), a.range && u.append("Range", a.range);
var f = { method: a.requestMethod ? a.requestMethod : "GET", headers: u, mode: "cors", cache: "default", referrerPolicy: "no-referrer-when-downgrade", signal: this.X() };
a.requestBody && (f.body = a.requestBody), a.credentials && (f.credentials = "include");
var T = fetch;
if (a.preferNative === !0) {
var S = this.$();
T = S.func, a.monkeyPatched = S.patched, a.useResetNativeFetch = S == null ? void 0 : S.resetNativeFetch;
} else
a.monkeyPatched = We(T, "fetch");
T(a.url, f).then(function(V) {
if (a.responseUrl = V.url, a.redirected = V.redirected, a.responseHeader = M(V.headers), o.U && o.U.onConnect && o.U.onConnect(a, V.status), V.ok)
return o.q ? void (V.body && V.body.getReader().cancel().catch(function($) {
return o.J.i(o.tag, $);
})) : a.responseType === "arraybuffer" ? a.progress ? void (V.body && (o.K = V.body.getReader(), o.tt(o.K))) : void V.arrayBuffer().then(function($) {
o.it(a, $);
}).catch(function($) {
if (!o.q) {
var te = new Error("arraybuffer error. " + V.status + " " + $);
te.name = U.FETCH_ERROR_NAME, o.H(te);
}
}) : void V.text().then(function($) {
o.it(a, $);
}).catch(function($) {
if (!o.q) {
var te = new Error("text error. " + V.status + " " + $);
te.name = U.FETCH_ERROR_NAME, o.H(te);
}
});
var W = new Error("res not ok. " + V.status + " " + V.statusText);
W.name = U.FETCH_ERROR_NAME, o.H(W);
}).catch(function(V) {
V.name !== "AbortError" && o.H(V);
});
}, c.abort = function() {
this.Z && (this.Z.abort(), this.Z = null), this.K && (this.K.cancel().catch(function() {
}), this.K = null), this.q = !0;
}, c.destroy = function() {
this.U = null, this.abort();
}, c.W = function(a, i) {
this.U && this.U.onProgress && this.U.onProgress(a, i);
}, c.it = function(a, i) {
this.U && this.U.onEnd && (this.K = null, this.Z = null, this.U.onEnd(a, i));
}, c.H = function(a) {
this.U && this.U.onError && this.U.onError(a);
}, c.tt = function(a) {
var i = this;
a.read().then(function(o) {
if (i.q)
return a.cancel(), null;
if (o.done)
return i.it(i.j, null), null;
var u = o.value.buffer;
return i.j.useResetNativeFetch && ee.safari && (u = new Uint8Array(new Uint8Array(u).subarray()).buffer), i.W(i.j, u), i.tt(a);
}).catch(function(o) {
o.name !== "AbortError" && (o.name = U.FETCH_READ_ERROR_NAME, i.H(o));
});
}, c.X = function() {
try {
if (AbortController)
return this.Z = new AbortController(), this.Z.signal;
} catch (a) {
return null;
}
return null;
}, c.$ = function() {
if (n.et !== void 0)
return n.et;
if (We(fetch, "fetch") === j.PROBABLY) {
var a = function(i) {
var o, u, f = document.createElement("iframe");
document.body.appendChild(f);
var T = (o = ((u = f.contentWindow) == null ? void 0 : u.fetch) || null) == null ? void 0 : o.bind(i);
return document.body.removeChild(f), T;
}(window);
this.J.i(this.tag, "detected io monkey patched. get native io, fetch: " + !!a), n.et = a ? { func: a, patched: j.PROBABLY, resetNativeFetch: !0 } : { func: fetch, patched: j.PROBABLY, resetNativeFetch: !1 };
} else
n.et = { func: fetch, patched: j.UNKNOWN, resetNativeFetch: !1 };
return n.et;
}, n;
}();
Le.et = void 0;
var Ft = r(3), tt = r.n(Ft), fe = 536870912, Fe = { 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: I.STANDARD, enableAacPriv: !1, mseDecErrSkip: 2, maxAudioFramesDrift: 5, forceKeyFrameOnDiscontinuity: !1, videoDropFramePolicy: _.AUTO, videoDecBlockPolicy: y.WAITING, videoFrameBufferSize: fe, maxVideoDecThreads: 8, mainThreadRendering: !1, mainThreadDecoding: !1, wasmDecoderEnabled: !ee.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: de.NONE, preferNativeLoader: void 0, playbackAbilityCacheTimeout: 864e5, adjustFragTime: !0 }, St = { maxRetry: 1, retryDelay: 100, connectionTimeout: 1e4, levelConnectionTimeout: 1e4, manifestConnectionTimeout: 1e4 }, ce = function() {
function n() {
}
return n.isStreamingSupported = function() {
return n.nt === void 0 && (n.nt = Le.isSupported() || !!se.isSupportChunk()), n.nt;
}, n.processConfig = function(c) {
if (c) {
var a = c.src, i = c.preprocessUrl, o = c.logger;
c = l()(JSON.parse(JSON.stringify(c)), { src: a, preprocessUrl: i, logger: o });
}
c.isLive ? Fe.videoFrameBufferSize = 104857600 : Fe.videoFrameBufferSize = fe;
var u = he(c.box) ? l()({}, Fe, St) : l()({}, Fe);
return l()(u, c), u.wasmDecoderEnabled = u.wasmDecoderEnabled && !!tt.a, u.startPlayBufferSec = Math.min(5, Math.max(0, u.startPlayBufferSec)), this.rt(u), Worker || (u.webWorker = !1), u;
}, n.rt = function(c) {
var a = c.autoPlaybackRateConf;
if (a) {
var i = a.rule;
if (i && Array.isArray(i) && ((i = i.filter(function(o) {
return o.upper > o.lower && o.rate > 0;
})).sort(function(o, u) {
return u.rate - o.rate;
}), i.length > 1))
return a.rule = i, void (c.autoPlaybackRateConf = a);
}
}, n;
}();
ce.nt = void 0;
var He = function(n) {
return n.UNKNOWN = "unknown", n.FLV = "flv", n.FMP4 = "fmp4", n.TS = "ts", n.MP4 = "mp4", n.RAW = "raw", n.IVF = "ivf", n.YUV = "yuv", n;
}({}), Me = function(n) {
return n.MANIFEST = "manifest", n.LEVEL = "level", n.AUDIO_TRACK = "audioTrack", n.SUBTITLE_TRACK = "subtitleTrack", n;
}({}), Pe = function(n) {
return n.NETWORK_ERROR = "networkError", n.MEDIA_ERROR = "mediaError", n.KEY_SYSTEM_ERROR = "keySystemError", n.MUX_ERROR = "muxError", n.OTHER_ERROR = "otherError", n.MSE_ERROR = "mseError", n.DECODER_ERROR = "decoderError", n.RENDERER_ERROR = "rendererError", n;
}({}), ge = function(n) {
return n[n.LOAD_ERROR = 10] = "LOAD_ERROR", n[n.MANIFEST_LOAD_ERROR = 11] = "MANIFEST_LOAD_ERROR", n[n.LEVEL_LOAD_ERROR = 12] = "LEVEL_LOAD_ERROR", n[n.AUDIO_TRACK_LOAD_ERROR = 13] = "AUDIO_TRACK_LOAD_ERROR", n[n.KEY_LOAD_ERROR = 14] = "KEY_LOAD_ERROR", n[n.KEY_SYSTEM_LICENSE_REQUEST_FAILED = 15] = "KEY_SYSTEM_LICENSE_REQUEST_FAILED", n[n.DEC_LIB_LOAD_ERROR = 16] = "DEC_LIB_LOAD_ERROR", n[n.RTC_SDP_LOAD_ERROR = 17] = "RTC_SDP_LOAD_ERROR", n[n.SUBTITLE_TRACK_LOAD_ERROR = 18] = "SUBTITLE_TRACK_LOAD_ERROR", n[n.CANNOT_SEEK = 100] = "CANNOT_SEEK", n[n.VIDEO_ERROR = 101] = "VIDEO_ERROR", n[n.UNSUPPORTED = 102] = "UNSUPPORTED", n[n.CONFIG_ERROR = 103] = "CONFIG_ERROR", n[n.OTHER = 104] = "OTHER", n[n.UNKNOWN = 105] = "UNKNOWN", n[n.CANNOT_SEEK_BY_FRAME_INDEX = 106] = "CANNOT_SEEK_BY_FRAME_INDEX", n[n.SRC_EMPTY = 107] = "SRC_EMPTY", n[n.VIDEO_NO_SIZE = 108] = "VIDEO_NO_SIZE", n[n.NO_TRACKS_AVAILABLE = 109] = "NO_TRACKS_AVAILABLE", n[n.VIDEO_ERROR_1 = 111] = "VIDEO_ERROR_1", n[n.VIDEO_ERROR_2 = 112] = "VIDEO_ERROR_2", n[n.VIDEO_ERROR_3 = 113] = "VIDEO_ERROR_3", n[n.VIDEO_ERROR_4 = 114] = "VIDEO_ERROR_4", n[n.MEDIASOURCE_ERROR = 200] = "MEDIASOURCE_ERROR", n[n.ADDSOURCEBUFFER_ERROR = 201] = "ADDSOURCEBUFFER_ERROR", n[n.SOURCEBUFFER_ERROR = 202] = "SOURCEBUFFER_ERROR", n[n.ENDOFSTREAM_ERROR = 203] = "ENDOFSTREAM_ERROR", n[n.APPENDBUFFER_ERROR = 204] = "APPENDBUFFER_ERROR", n[n.CHANGETYPE_ERROR = 205] = "CHANGETYPE_ERROR", n[n.MSE_CAPABILITY_ERROR = 206] = "MSE_CAPABILITY_ERROR", n[n.MSE_SOURCE_BUFFER_CLOSE_ERROR = 207] = "MSE_SOURCE_BUFFER_CLOSE_ERROR", n[n.PARSING_ERROR = 301] = "PARSING_ERROR", n[n.REMUX_ERROR = 302] = "REMUX_ERROR", n[n.REMUX_ALLOC_ERROR = 303] = "REMUX_ALLOC_ERROR", n[n.REMUX_WORKER_ERROR = 304] = "REMUX_WORKER_ERROR", n[n.DEMUX_NOT_FOUND = 305] = "DEMUX_NOT_FOUND", n[n.MANIFEST_PARSING_ERROR = 400] = "MANIFEST_PARSING_ERROR", n[n.LEVEL_NO_UPDATE_ERROR = 402] = "LEVEL_NO_UPDATE_ERROR", n[n.KEY_SYSTEM_NO_ACCESS = 500] = "KEY_SYSTEM_NO_ACCESS", n[n.KEY_SYSTEM_NO_SESSION = 501] = "KEY_SYSTEM_NO_SESSION", n[n.KEY_SYSTEM_URL_ERROR = 502] = "KEY_SYSTEM_URL_ERROR", n[n.KEY_SYSTEM_NO_KEYS = 505] = "KEY_SYSTEM_NO_KEYS", n[n.FRAG_DECRYPT_ERROR = 506] = "FRAG_DECRYPT_ERROR", n[n.KEY_SYSTEM_NO_INIT_DATA = 507] = "KEY_SYSTEM_NO_INIT_DATA", n[n.KEY_SYSTEM_UNSUPPORTED = 508] = "KEY_SYSTEM_UNSUPPORTED", n[n.DECODER_LOAD_ERROR = 600] = "DECODER_LOAD_ERROR", n[n.DECODER_INIT_ERROR = 601] = "DECODER_INIT_ERROR", n[n.DECODER_DRAW_ERROR = 602] = "DECODER_DRAW_ERROR", n[n.DECODER_WEBGL_ERROR = 603] = "DECODER_WEBGL_ERROR", n[n.DECODER_UNSUPPORTED = 604] = "DECODER_UNSUPPORTED", n[n.DECODER_COPY_YUV_ERROR = 605] = "DECODER_COPY_YUV_ERROR", n[n.DECODER_DEC_ERROR = 606] = "DECODER_DEC_ERROR", n[n.DECODER_2D_ERROR = 607] = "DECODER_2D_ERROR", n[n.SCREENSHOT_INIT_ERROR = 700] = "SCREENSHOT_INIT_ERROR", n[n.SCREENSHOT_EMPTY_DATA_ERROR = 701] = "SCREENSHOT_EMPTY_DATA_ERROR", n[n.SCREENSHOT_CREATE_IMG_ERROR = 702] = "SCREENSHOT_CREATE_IMG_ERROR", n[n.LIVE_DISCONNECTED_ERROR = 1009] = "LIVE_DISCONNECTED_ERROR", n[n.WEBRTC_DISCONNECTED_ERROR = 1010] = "WEBRTC_DISCONNECTED_ERROR", n[n.WEBRTC_FAILED_ERROR = 1011] = "WEBRTC_FAILED_ERROR", n[n.WEBRTC_CLOSED_ERROR = 1012] = "WEBRTC_CLOSED_ERROR", n[n.WEBRTC_ICE_CANDIDATE_ERROR = 1013] = "WEBRTC_ICE_CANDIDATE_ERROR", n[n.WEBRTC_ICE_CONNECTION_ERROR = 1014] = "WEBRTC_ICE_CONNECTION_ERROR", n[n.WEBRTC_OFFER_ERROR = 1015] = "WEBRTC_OFFER_ERROR", n[n.WEBRTC_ANSWER_ERROR = 1016] = "WEBRTC_ANSWER_ERROR", n[n.WEBRTC_TRANSMISSION_DATA_NULL = 1017] = "WEBRTC_TRANSMISSION_DATA_NULL", n[n.WEBRTC_CONNECT_TIMEOUT = 1018] = "WEBRTC_CONNECT_TIMEOUT", n[n.WEBRTC_CONNECT_FAILED = 1019] = "WEBRTC_CONNECT_FAILED", n;
}({}), oe = [ge.VIDEO_ERROR, ge.VIDEO_ERROR_1, ge.VIDEO_ERROR_2, ge.VIDEO_ERROR_3, ge.VIDEO_ERROR_4];
function le(n, c, a, i) {
var o = { type: n, details: c, code: 0, fatal: !0, reason: a };
if (i)
for (var u in i) {
var f = i[u];
f !== void 0 && (o[u] = f);
}
return o;
}
var ne = { other4xx: "05", serverError: "06", timeoutOpen: "07", timeoutIO: "08", handlingDataError: "10", other: "99" }, me = { 400: "01", 401: "02", 403: "03", 404: "04", 200: "09", 206: "09" };
function ae(n, c, a) {
if (a === void 0 && (a = 0), n >= 100)
return n;
var i = "00";
return function(o) {
return o.indexOf(D.LOADER_CONNECT_TIMEOUT) >= 0;
}(c) ? i = ne.timeoutOpen : function(o) {
return o.indexOf(D.LOADER_TRANS_TIMEOUT) >= 0;
}(c) ? i = ne.timeoutIO : function(o) {
return o.indexOf(D.HANDLING_DATA_ERROR) >= 0;
}(c) ? i = ne.handlingDataError : Object.prototype.hasOwnProperty.call(me, a) ? i = a !== 200 && a !== 206 || !c ? me[a] || "00" : ne.other : /^4\d{2}$/.test(a.toString()) ? i = ne.other4xx : /^5\d{2}$/.test(a.toString()) && (i = ne.serverError), parseInt(n + i, 10);
}
var Et = /\.[^./\\?#]+(?=$|[?#])/i, pe = { ".mp4": g.mp4, ".m4s": g.mp4, ".mov": g.mp4, ".m4a": g.mp4, ".flv": g.flv, ".m3u8": g.hls, ".sdp": g.webrtc, ".webm": g.matroska, ".mkv": g.matroska, ".mka": g.matroska, ".mp3": g.mp3, ".wav": g.wav, ".aac": g.aac, ".ts": g.ts, ".yuv": g.yuv, ".slice": g.flv };
function Xe(n) {
var c = function(a) {
var i = a.toLocaleLowerCase().match(Et);
return i ? i[0] : "";
}(n);
return c && pe[c] || g.unknown;
}
var ze = r(4), wt = r.n(ze), Zt = /^[^_][A-Za-z0-9_-]*$/, Al = /_([A-Za-z0-9]+)_/;
function vl(n) {
var c = new wt.a(n).pathname, a = Xe(n), i = a === g.flv || he(a) || a === g.ts, o = "", u = "", f = c.split("/"), T = f[f.length - 1] || "";
if (i) {
try {
var S = c.lastIndexOf("/");
S >= 0 && (c = c.slice(S + 1));
var V = c.split(".")[0].split("_");
V.length === 1 ? (o = ai(V[0]), u = bn(n)) : V.length === 2 ? (o = ai(V[0]), u = ai(V[1])) : V.length > 2 && (o = ai(V.slice(0, V.length - 1).join("_")), u = ai(V[V.length - 1]));
} catch (W) {
}
return { streamID: o, transcodingTpl: u, filename: T };
}
return { streamID: "", transcodingTpl: bn(n), filename: T };
}
var bn = function(n) {
var c = n.match(Al), a = "";
return c != null && c.length && c.length > 1 && (a = c[1]), ai(a);
}, ai = function(n) {
return Zt.test(n) ? n : "";
};
function _l(n) {
var c;
performance.addEventListener && (c = n, performance && (typeof performance.setResourceTimingBufferSize == "function" ? performance.setResourceTimingBufferSize(c) : typeof performance.webkitSetResourceTimingBufferSize == "function" && performance.webkitSetResourceTimingBufferSize(c)), performance.addEventListener("resourcetimingbufferfull", En));
}
var Oi, En = function() {
performance && (typeof performance.clearResourceTimings == "function" ? performance.clearResourceTimings() : typeof performance.webkitClearResourceTimings == "function" && performance.webkitClearResourceTimings());
}, ml = function(n) {
return n.FAIL = "FAIL", n.ABORT = "ABORT", n.SUCCESS = "SUCCESS", n.CONNECTED = "CONNECTED", n;
}({});
(Oi = {})[Me.MANIFEST] = ge.MANIFEST_LOAD_ERROR, Oi[Me.LEVEL] = ge.LEVEL_LOAD_ERROR, Oi[Me.AUDIO_TRACK] = ge.AUDIO_TRACK_LOAD_ERROR, Oi[Me.SUBTITLE_TRACK] = ge.SUBTITLE_TRACK_LOAD_ERROR;
var Mi, it, Ar, wn = function(n) {
return n.METADATA = "metadata", n.MEDIA_INFO = "mediaInfo", n.PARSING_INIT_SEGMENT = "parsingInitSegment", n.PARSING_DATA = "parsingData", n.PARSED_DATA = "parsedData", n.SCRIPT_PARSED = "scriptParsed", n.KEY_FRAME_INDEXS = "keyFrameIndexs", n.VIDEO_FRAME_INFO = "videoFrameInfo", n.DISCONTINUITY = "discontinuity", n.REPORT = "report", n.LOAD_END = "loadEnd", n.ERROR = "error", n.MANIFEST_LOADED = "manifestLoaded", n.MANIFEST_PARSED = "manifestParsed", n.LEVEL_SWITCHING = "levelSwitching", n.LEVEL_SWITCHED = "levelSwitched", n.LEVEL_SWITCH_PLAYING = "levelSwitchPlaying", n.LEVEL_SWITCH_FAILED = "levelSwitchFailed", n.LEVEL_LOADED = "levelLoaded", n.LEVEL_UPDATED = "levelUpdated", n.AUDIO_TRACK_SWITCHING = "audioTrackSwitching", n.AUDIO_TRACK_SWITCHED = "audioTrackSwitched", n.AUDIO_TRACK_UPDATED = "audioTrackUpdated", n.AUDIO_TRACK_SWITCH_FAILED = "audioTrackSwitchFailed", n.HLS_MANIFEST_PARSED = "hlsManifestParsed", n.HLS_KEY_LOADED = "hlsKeyLoaded", n.AUDIO_TRACK_LOADED = "audioLoaded", n.SUBTITLE_TRACK_LOADED = "subtitleTrackLoaded", n.SUBTITLE_LOADED = "subtitleLoaded", n.SUBTITLE_TRACK_SWITCHED = "subtitleTrackSwitched", n.SUBTITLE_TRACK_UPDATED = "subtitleTrackUpdated", n.BUFFER_CLEANING = "bufferCleaning", n.VIDEO_SEEK = "vdeoSeek", n.ABR_NEXT = "abrNext", n.PRIV_NAL = "privNal", n.SEI = "sei", n.AAC_PRIV = "aacPriv", n.RAW_DATA = "rawData", n.MP4_NOT_FASTSTART = "mp4NotFaststart", n.VIDEO_CODEC_DETECTED = "videoCodecChange", n.H265_DETECTED = "h265Detected", n.VIDEO_RENDERER_CHANGE = "videoRendererChange", n.DEC_LIB_LOADED = "decLibLoaded", n.DEC_INIT_COMPLETE = "decoderInitComplete", n.DEC_VIDEO_READY = "decVideoReady", n.STEP = "step", n.RENDERER_INIT_COMPLETE = "rendererInitComplete", n.RENDERER_BUF_EXPIRED = "rendererBufExpired", n.RENDERER_SEEK = "rendererSeek", n.RENDERER_BUF_UPDATE = "rendererBufUpdate", n.RENDERER_DRAW = "rendererDraw", n.RENDERER_WAITING = "rendererWaiting", n.RENDERER_WAITING_END = "rendererWaitingEnd", n.DECODER_FRAME = "decoderFrame", n.DECODER_IMG = "decoderImg", n.DECODER_SEEK = "decoderSeek", n.DECODER_SEEK_ABORT = "decoderSeekAbort", n.DECODER_WAITING = "decoderWaiting", n.DECODER_DATA_END = "decoderDataEnd", n.DECODER_BUF_LOW = "decoderDataEmpty", n.DECODER_DROP_FRAME = "decocerDropFrame", n.DECODER_MEDIA_INFO = "decoderMediaInfo", n.MEDIA_CONNECTED = "mediaConnected", n.LOADER_CHUNK_ARRIVAL = "loaderChunkArrival", n.DEMUXER_DETECTED = "demuxerDetected", n.MEDIA_DEMUX = "mediaDemux", n.KEY_FRAME = "keyFrame", n.USE_BACKUP = "useBackup", n.NEW_SOURCE = "newSource", n.DOWNLOAD = "download", n.STOP_LOAD = "stopLoad", n.LOAD = "load", n.WAITING = "waiting", n.LOADEDMETADATA = "loadedmetadata", n.LOADEDDATA = "loadeddata", n.CANPLAY = "canplay", n.SEEKING = "seeking", n.SEEK_WITH_LOAD = "seekWithLoad", n.SEEKED = "seeked", n.PLAYING = "playing", n.PAUSE = "pause", n.PLAY = "play", n.ENDED = "ended", n.TIMEUPDATE = "timeupdate", n.PROGRESS = "progress", n.RATE_CHANGE = "ratechange", n.DURATION_CHANGE = "durationchange", n.HEARTBEAT = "heartbeat", n.MSE_UPDATE = "mseUpdate", n.MSE_BUFFER_FULL = "mseBufferFull", n.MSE_SOURCE_CLOSE = "mseSourceClose", n.RETRY = "retry", n.WORKER_LOG = "workerLog", n.VISIBILITY_CHANGE = "visibilityChange", n.SCREENSHOT = "screenshot", n;
}(wn || {}), q = wn, vr = "event-bus-consumer-manager", gl = function() {
function n(a, i) {
this.J = void 0, this.At = [], this.ot = void 0, a.i(vr, "constructor"), this.J = a, this.ot = i, this.st();
}
var c = n.prototype;
return c.destroy = function() {
this.J.i(vr, "destroy"), this.ot.removeAllListeners(), this.At.splice(0, this.At.length);
}, c.register = function(a, i) {
i === void 0 && (i = !1), this.J.i(vr, "register", a.getName()), i ? this.At.unshift(a) : this.At.push(a), a.setEvtEmitter(this.ot);
}, c.unregister = function(a) {
for (var i = this.At.length - 1; i >= 0; i--)
a === this.At[i] && this.At.splice(i, 1);
}, c.st = function() {
var a = this;
Object.values(q).forEach(function(i) {
var o = "on" + i.charAt(0).toUpperCase() + i.slice(1);
a.ot.on(i, function() {
for (var u = arguments.length, f = new Array(u), T = 0; T < u; T++)
f[T] = arguments[T];
for (var S = 0; S < a.At.length; S++) {
var V = a.At[S];
if (V && o in V) {
var W, $ = (W = V[o]).call.apply(W, [V].concat(f));
if ($ != null && $.stop)
break;
}
}
});
});
}, h()(n, [{ key: "evt", get: function() {
return this.ot;
} }]);
}(), _r = function(n) {
function c() {
for (var i, o = arguments.length, u = new Array(o), f = 0; f < o; f++)
u[f] = arguments[f];
return (i = n.call.apply(n, [this].concat(u)) || this).ot = void 0, i;
}
E()(c, n);
var a = c.prototype;
return a.getName = function() {
throw new Error("getName method must be override.");
}, a.setEvtEmitter = function(i) {
this.ot = i;
}, a.emit = function(i, o) {
var u;
return ((u = this.ot) == null ? void 0 : u.emit(i, o)) || !1;
}, a.onWorkerLog = function(i) {
}, c;
}(R), Tn = "exposed-event", yl = function(n) {
function c(i, o) {
var u;
return (u = n.call(this) || this).ut = void 0, u.J = void 0, u.ht = void 0, u.ut = i, u.J = i.logger, u.ht = o, u;
}
E()(c, n);
var a = c.prototype;
return a.onReport = function(i) {
this.ht.emit(q.REPORT, i);
}, a.onError = function(i) {
if ((i == null || !i.preventFollowUp) && i.fatal) {
var o = l()({}, i);
if (this.ut.stat.coreType === H.native) {
var u = this.ut.stat.retryInfo.getLastMseError();
u && (this.J.i(Tn, "replace error info by mse error."), l()(o, { type: u.type, details: u.details, reason: u.reason, code: u.code }), u.url !== void 0 && (o.url = u.url), u.statusCode !== void 0 && (o.statusCode = u.statusCode));
}
this.ht.emit(q.ERROR, o);
}
}, a.onManifestParsed = function(i) {
i != null && i.preventFollowUp || this.ht.emit(q.MANIFEST_PARSED, i);
}, a.onLevelSwitching = function(i) {
this.ht.emit(q.LEVEL_SWITCHING, i);
}, a.onLevelSwitched = function(i) {
this.ht.emit(q.LEVEL_SWITCHED, i);
}, a.onLevelSwitchFailed = function() {
this.ht.emit(q.LEVEL_SWITCH_FAILED);
}, a.onLevelUpdated = function(i) {
this.ht.emit(q.LEVEL_UPDATED, i);
}, a.onLevelSwitchPlaying = function(i) {
this.ht.emit(q.LEVEL_SWITCH_PLAYING, i);
}, a.onAudioTrackSwitching = function(i) {
this.ht.emit(q.AUDIO_TRACK_SWITCHING, i);
}, a.onAudioTrackSwitched = function(i) {
this.ht.emit(q.AUDIO_TRACK_SWITCHED, i);
}, a.onAudioTrackUpdated = function(i) {
this.ht.emit(q.AUDIO_TRACK_UPDATED, i);
}, a.onAudioTrackSwitchFailed = function() {
this.ht.emit(q.AUDIO_TRACK_SWITCH_FAILED);
}, a.onSubtitleTrackSwitched = function(i) {
this.ht.emit(q.SUBTITLE_TRACK_SWITCHED, i);
}, a.onLoadEnd = function(i) {
i != null && i.preventFollowUp || this.ht.emit(q.LOAD_END);
}, a.onVideoRendererChange = function(i) {
this.ht.emit(q.VIDEO_RENDERER_CHANGE, i);
}, a.onH265Detected = function(i) {
this.ht.emit(q.H265_DETECTED, i);
}, a.onScreenshot = function(i) {
i.pts === -1 && (i.pts = this.ut.video ? 1e3 * this.ut.video.currentTime : 0), this.ht.emit(q.SCREENSHOT, i);
}, a.getName = function() {
return Tn;
}, c;
}(_r), Rn = "fallback", mr = function(n) {
function c(i) {
var o;
return (o = n.call(this) || this).ut = void 0, o.J = void 0, o.ct = !1, o.ft = void 0, o.ut = i, o.J = i.logger, o;
}
E()(c, n);
var a = c.prototype;
return a.reset = function() {
return this.J.i(Rn, "reset"), this.ct = !1, this;
}, a.stop = function() {
return this;
}, a.setRetryFunc = function(i) {
return this.ft = i, this;
}, a.destroy = function() {
this.J.i(Rn, "fallback: " + this.constructor.name + " destroy."), this.ft = void 0, n.prototype.destroy.call(this);
}, a.getAvailable = function() {
return !(!this.ft || this.ct);
}, a.vt = function(i) {
if (this.ft && this.ft() !== !1)
return this.ct = !0, i;
}, a.emit = function(i, o) {
return this.ut.evt.emit(i, o);
}, c;
}(R), Ie = function(n) {
return n.FLV_LIVE_RELOAD = "flvLiveReload", n.USE_BACKUP = "useBackup", n.USE_BACKUP_MULTIPART = "useBackupMultipart", n.NO_WORKER = "noWorker", n.SWAP_REMUX_TYPE = "swapRemuxType", n.SWAP_AUDIO_CODECSTR = "swapAudioCodecStr", n.NEXT_DESC = "nextDesc", n.SWAP_WASM_DECODER = "swapWasmDecoder", n.SWAP_CORE = "swapCore", n.SWAP_264 = "swap264", n.RELOAD_WASM = "reloadWasm", n.DROP_V_FRAME = "dropVFrame", n;
}({}), Ht = "fallback", bl = function(n) {
function c(i) {
var o;
return (o = n.call(this) || this).ut = void 0, o.J = void 0, o.dt = {}, o.lt = void 0, o.H = function(u) {
if (o.J.i(Ht, "on error", u, Object.keys(o.dt)), o.lt || (o.lt = o.yt()), u.fatal) {
o.J.i(Ht, "error. type: " + u.type + " details: " + u.details + " reason: " + u.reason);
for (var f = 0; f < o.lt.actions.length; f++) {
var T = o.lt.actions[f];
if (T) {
var S = o.dt[T.type];
if (S != null && S.getAvailable()) {
var V = o.ut.stat.coreType, W = S.run(u);
if (W)
return o.J.i(Ht, "fallback run. type: " + T.type + " " + f + "/" + o.lt.actions.length + ". reason: " + u.reason), u.preventFollowUp = !0, W.code = ae(u.details, u.reason, u.statusCode), W.errorData = l()({}, u), W.core = V, o.ut.evt.emit(q.RETRY, W), void o.Mt(f);
}
}
}
o.J.i(Ht, "no fallback matched. reason: " + u.reason);
}
}, o.ut = i, o.J = i.logger, o.F.push(o.ut.evt.prependListener(q.ERROR, o.H)), o;
}
E()(c, n);
var a = c.prototype;
return a.register = function(i, o) {
var u = this;
return this.J.i(Ht, "register " + i + " " + o.constructor.name), this.dt[i] && (this.J.i(Ht, i + " existed."), this.F.destroyItem(o)), this.dt[i] = o, this.F.push(o), { destroy: function() {
return u.unregisterAndDestroy(i);
} };
}, a.unregisterAndDestroy = function(i) {
var o = this.dt[i];
return o && (this.F.destroyItem(o), o.destroy(), delete this.dt[i], this.J.i(Ht, "unregisterAndDestroy " + i)), this;
}, a.hasFallback = function(i) {
return !!this.dt[i];
}, a.reset = function() {
for (var i in this.J.i(Ht, "reset"), this.dt)
this.unregisterAndDestroy(i);
this.dt = {}, this.lt = void 0;
}, a.stop = function() {
for (var i in this.dt)
this.dt[i].stop();
}, a.Mt = function(i) {
if (this.lt) {
var o = this.lt.actions[i];
!o || o.type !== Ie.SWAP_CORE && o.type !== Ie.NO_WORKER || (this.wt(Ie.USE_BACKUP), this.wt(Ie.USE_BACKUP_MULTIPART), this.wt(Ie.FLV_LIVE_RELOAD));
}
}, a.yt = function() {
this.J.i(Ht, "generate fallback policy.");
var i = this.ut, o = (ee.mobile, { core: i.stat.coreType, actions: [] });
return i.stat.coreType === H.mse ? o.actions.push({ type: Ie.RELOAD_WASM }, { type: Ie.FLV_LIVE_RELOAD }, { type: Ie.USE_BACKUP_MULTIPART }, { type: Ie.USE_BACKUP }, { type: Ie.NO_WORKER }, { type: Ie.DROP_V_FRAME }, { type: Ie.SWAP_REMUX_TYPE }, { type: Ie.SWAP_AUDIO_CODECSTR }, { type: Ie.SWAP_264 }, { type: Ie.NEXT_DESC }, { type: Ie.SWAP_WASM_DECODER }, { type: Ie.SWAP_CORE }) : i.stat.coreType === H.native && o.actions.push({ type: Ie.USE_BACKUP }, { type: Ie.SWAP_264 }, { type: Ie.NEXT_DESC }, { type: Ie.SWAP_CORE }, { type: Ie.RELOAD_WASM }, { type: Ie.FLV_LIVE_RELOAD }, { type: Ie.USE_BACKUP_MULTIPART }, { type: Ie.NO_WORKER }, { type: Ie.SWAP_REMUX_TYPE }, { type: Ie.SWAP_AUDIO_CODECSTR }, { type: Ie.SWAP_WASM_DECODER }), o;
}, a.wt = function(i) {
var o;
(o = this.dt[i]) == null || o.reset();
}, c;
}(R), El = function(n) {
function c() {
return n.apply(this, arguments) || this;
}
return E()(c, n), c.prototype.run = function(a) {
if (this.getAvailable() && this.ut.hasNextMediaDesc() && (this.ut.stat.coreType === H.mse || this.ut.stat.coreType === H.native) && (this.J.i("fallback-next-desc", "run"), this.ut.nextMediaDesc()))
return this.vt({ type: w.FALLBACK, message: "use next media description.", fallback: Ie.NEXT_DESC });
}, c;
}(mr), wl = { preferLowPowerToHighPerformance: !0, preserveDrawingBuffer: !0 };
function Sn() {
return typeof HTMLCanvasElement > "u" ? new OffscreenCanvas(1, 1) : document.createElement("canvas");
}
function gr() {
if (!Mi) {
var n = Sn();
Ln(n, Mi = { webGL: !1, performance: !1 }, !0) || Ln(n, Mi, !1);
}
return Mi;
}
function Ln(n, c, a) {
a === void 0 && (a = !1);
var i = !1, o = l()({ failIfMajorPerformanceCaveat: a }, wl);
try {
var u = n.getContext("webgl", o);
if (u) {
var f = u.getExtension("WEBGL_debug_renderer_info");
c.webGL = !0, c.performance = a, f != null && f.UNMASKED_VENDOR_WEBGL && (c.vendor = u.getParameter(f == null ? void 0 : f.UNMASKED_VENDOR_WEBGL)), f != null && f.UNMASKED_RENDERER_WEBGL && (c.renderer = u.getParameter(f == null ? void 0 : f.UNMASKED_RENDERER_WEBGL)), i = !0;
var T = u.getExtension("WEBGL_lose_context");
T && T.loseContext();
}
} catch (S) {
}
return i;
}
function Ni() {
return typeof navigator > "u" ? 0 : navigator.hardwareConcurrency || 0;
}
function ct() {
return typeof window != "object" || typeof document != "object" || typeof document.createElement != "function";
}
function yr() {
var n, c, a;
if (!ct())
return ((n = window) == null ? void 0 : n.ManagedMediaSource) || ((c = window) == null ? void 0 : c.MediaSource) || ((a = window) == null ? void 0 : a.WebKitMediaSource);
}
function kn() {
var n, c, a;
if (!ct())
return ((n = window) == null ? void 0 : n.ManagedSourceBuffer) || ((c = window) == null ? void 0 : c.SourceBuffer) || ((a = window) == null ? void 0 : a.WebKitSourceBuffer);
}
var Tl = { 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"'] }, Rl = { 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"'] }, Sl = { 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"'] }, Ll = { 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"'] }, kl = { 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"] }, Lt = function() {
function n() {
}
return n.isMSEAvailable = function() {
if (n.bt !== void 0)
return n.bt;
if (!tt.a)
return n.bt = !1, !1;
var c = yr(), a = kn();
if (n.gt = !!(c && a && a.prototype && typeof a.prototype.appendBuffer == "function" && typeof a.prototype.remove == "function"), c && ee.mobile && n.gt)
try {
var i = new c(), o = document.createElement("video");
o.src = URL.createObjectURL(i), URL.revokeObjectURL(o.src), n.bt = !0;
} catch (u) {
n.bt = !1;
}
else
n.bt = n.gt;
return n.bt;
}, n.isMSECodecCapabilityNormal = function() {
return n.isMSEAvailable() && n.TYPE_SUPPORTED.h264;
}, n.isSupported = function(c) {
return c === void 0 && (c = v.h264), n.isMSECodecSupported(c) && n.isMSEAvailable();
}, n.isMSECodecSupported = function(c, a, i) {
if (c === void 0 && (c = v.h264), a === void 0 && (a = O.FHD), i === void 0 && (i = !1), ee.msedge && ee.platform === "windows" || ee.msie)
return n.isMSEAvailable() && c === v.h264;
if (n.kt(c, a) === !1)
return !1;
var o = n._t(c, a, i);
return !!o && o.reduce(function(u, f) {
return u || n.isMSECodecStrSupported(f);
}, !1);
}, n.isVideoCodecSupported = function(c, a, i) {
if (c === void 0 && (c = v.h264), a === void 0 && (a = O.FHD), i === void 0 && (i = !1), ee.msedge && ee.platform === "windows" || ee.msie)
return c === v.h264;
if (n.kt(c, a) === !1)
return !1;
var o = n._t(c, a, i);
if (!o)
return !1;
var u = n.Et();
return o.reduce(function(f, T) {
return f || !(!u || !u.canPlayType(T));
}, !0);
}, n.isVideoBoxSupported = function(c) {
if (c === void 0 && (c = g.mp4), c === g.unknown)
return !0;
var a = kl[c];
if (!a)
return !1;
var i = n.Et();
return a.reduce(function(o, u) {
return o || !(!i || !i.canPlayType(u));
}, !1);
}, n.isVideoCodecStrSupportedInMp4 = function(c, a) {
a === void 0 && (a = "");
try {
var i = n.Et();
return !(!i || !i.canPlayType((a || "video") + '/mp4;codecs="' + c + '"'));
} catch (o) {
}
return !1;
}, n.isWebRTCSupported = function() {
return "RTCPeerConnection" in window && "RTCRtpTransceiver" in window;
}, n.isMSECodecStrSupportedInMp4 = function(c, a) {
var i;
return a === void 0 && (a = ""), !((i = yr()) == null || !i.isTypeSupported((a || "video") + '/mp4;codecs="' + c + '"'));
}, n.isMSECodecStrSupported = function(c) {
var a = yr();
return !(!a || typeof a.isTypeSupported != "function" || !a.isTypeSupported(c));
}, n.isChangeTypeSupported = function() {
if (n.Rt === void 0) {
var c = kn();
n.Rt = !(!c || c.prototype.changeType === void 0);
}
return n.Rt;
}, n.getVideoCodecCompatibilityByCodec = function(c, a, i) {
a === void 0 && (a = O.FHD), i === void 0 && (i = !1);
var o = b.unsupported, u = !0;
c === v.h264 ? o = a === O.UHD_4K ? (i ? n.TYPE_SUPPORTED.h264Hdr4k : n.TYPE_SUPPORTED.h2644k) ? b.buildin : b.unsupported : (i ? n.TYPE_SUPPORTED.h264Hdr : n.TYPE_SUPPORTED.h264) ? b.buildin : b.unsupported : c === v.av1 ? (o = a === O.UHD_4K ? (i ? n.TYPE_SUPPORTED.av1Hdr4k : n.TYPE_SUPPORTED.av14k) ? b.buildin : b.unsupported : (i ? n.TYPE_SUPPORTED.av1Hdr : n.TYPE_SUPPORTED.av1) ? b.buildin : b.unsupported, u = Ni() >= 2) : c === v.hevc ? (o = a === O.UHD_4K ? (i ? n.TYPE_SUPPORTED.hevcHdr4k : n.TYPE_SUPPORTED.hevc4k) ? b.buildin : b.unsupported : (i ? n.TYPE_SUPPORTED.hevcHdr : n.TYPE_SUPPORTED.hevc) ? b.buildin : b.unsupported) === b.buildin ? (ee.msedge && ee.platform === "windows" && (o = b.unsupported), u = !!(Ni() >= 2 || ee.safari)) : u = n.wasmSmooth : c !== v.kvc3 && c !== v.kvc4 && c !== v.kvc5 && c !== v.kvc6 && c !== v.vvc && c !== v.kvc30 && c !== v.bvc2 || (o = typeof WebAssembly < "u" ? b.wasm : b.unsupported, u = n.wasmSmooth);
var f = !1;
return o === b.buildin && (f = n.isChangeTypeSupported(), c === v.hevc && n.kt(c, a) === !1 && (o = b.wasm)), { decoder: o, smooth: o !== b.unsupported && u, mix: f };
}, n.getPlayTestDefinition = function(c) {
if (typeof c.width == "number" && typeof c.height == "number") {
if ((c == null ? void 0 : c.width) > 1920 || (c == null ? void 0 : c.height) > 1920)
return O.UHD_4K;
} else if (c.qualityType.toLowerCase().indexOf("4k") !== -1)
return O.UHD_4K;
return O.FHD;
}, n._t = function(c, a, i) {
a === void 0 && (a = O.FHD), i === void 0 && (i = !1), c === v.unknown && (c = v.h264);
var o = i ? Rl : Tl, u = i ? Ll : Sl;
return a === O.UHD_4K && u[c] || o[c];
}, n.kt = function(c, a) {
if (a === void 0 && (a = O.FHD), c === v.hevc && n.playHEVCTest && (a === O.UHD_4K && n.playHEVCTest[a] === !1 || a !== O.UHD_4K && n.playHEVCTest[O.FHD] === !1))
return !1;
}, n.Et = function() {
return Ar || ct() || (Ar = document.createElement("video")), Ar;
}, n.Dt = 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 (c) {
return !1;
}
}, n.Tt = 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]));
}, h()(n, null, [{ key: "isSupportSimd", get: function() {
return n.St === void 0 && (n.St = n.Tt()), n.St;
} }, { key: "isSupportThreads", get: function() {
return n.Ot === void 0 && (n.Ot = n.Dt()), n.Ot;
} }, { key: "wasmSmooth", get: function() {
if (n.Ct === void 0) {
var c = Ni();
n.Ct = !!(n.isSupportHW && n.isSupportThreads && c && c >= 6);
}
return n.Ct;
} }, { key: "isSupportHW", get: function() {
return !!gr().performance;
} }, { key: "playHEVCTest", get: function() {
return this.Lt;
}, set: function(c) {
this.Lt = c;
} }]);
}();
it = Lt, Lt.Rt = void 0, Lt.bt = void 0, Lt.gt = void 0, Lt.St = void 0, Lt.Ot = void 0, Lt.Ct = void 0, Lt.Lt = void 0, Lt.TYPE_SUPPORTED = { mpeg: it.isMSECodecStrSupported("audio/mpeg"), mp3: it.isMSECodecSupported(v.mp3), opus: it.isMSECodecSupported(v.opus), aac: it.isMSECodecSupported(v.aac), hevc: it.isMSECodecSupported(v.hevc), hevc4k: it.isMSECodecSupported(v.hevc, O.UHD_4K), hevcHdr: it.isMSECodecSupported(v.hevc, O.FHD, !0), hevcHdr4k: it.isMSECodecSupported(v.hevc, O.UHD_4K, !0), av1: it.isMSECodecSupported(v.av1), av14k: it.isMSECodecSupported(v.av1, O.UHD_4K), av1Hdr: it.isMSECodecSupported(v.av1, O.FHD, !0), av1Hdr4k: it.isMSECodecSupported(v.av1, O.UHD_4K, !0), h264: it.isMSECodecSupported(v.h264), h2644k: it.isMSECodecSupported(v.h264, O.UHD_4K), h264Hdr: it.isMSECodecSupported(v.h264, O.FHD, !0), h264Hdr4k: it.isMSECodecSupported(v.h264, O.UHD_4K, !0) };
var _e = Lt, In = "fallback-swap-to-264", Il = function(n) {
function c() {
return n.apply(this, arguments) || this;
}
return E()(c, n), c.prototype.run = function(a) {
var i;
if (this.getAvailable() && a.type === Pe.MEDIA_ERROR && (a.details === ge.VIDEO_ERROR || a.details === ge.VIDEO_ERROR_3 || a.details === ge.VIDEO_ERROR_4 || a.details === ge.VIDEO_NO_SIZE) && this.ut.canCodecFallback && this.ut.video instanceof HTMLVideoElement && (this.ut.stat.coreType === H.mse || this.ut.stat.coreType === H.native && ((i = this.ut.video) == null || !i.videoWidth)) && this.ut.stat.codecType !== v.h264 && this.ut.stat.decoder === b.buildin) {
var o = "metadata video size: " + this.ut.video.videoWidth + ". fallback 264";
this.J.i(In, "run"), this.ut.reProcessSrc(v.h264, this.ut.stat.native);
var u = this.vt({ type: w.FALLBACK, message: o, fallback: Ie.SWAP_264 });
return _e.playHEVCTest === void 0 && (this.J.i(In, "play hevc test start"), this.ut.hevcTest.start()), u;
}
}, c;
}(mr), mi = r(6), Kt = "ios-compatible", xl = function(n) {
function c(i, o) {
var u;
return (u = n.call(this) || this).ut = void 0, u.J = void 0, u.xt = void 0, u.Nt = !1, u.It = void 0, u.Ft = function() {
var f = u.ut.video;
u.It = setTimeout(function() {
u.J.i(Kt, "fix play stuck", f == null ? void 0 : f.currentTime), f && u.xt((f == null ? void 0 : f.currentTime) + 1e-3);
}, 1e3);
}, u.Bt = function() {
u.It && (clearTimeout(u.It), u.It = void 0);
}, u.ut = i, u.J = i.logger, u.xt = o, u.J.i(Kt, "constructor"), u;
}
E()(c, n);
var a = c.prototype;
return a.onLoad = function() {
this.jt();
}, a.destroy = function() {
this.J.i(Kt, "destroy"), this.jt();
}, a.onVisibilityChange = function(i) {
this.J.i(Kt, "onVisibilityChange", i.hidden), !i.hidden && ee.ios && (this.J.i(Kt, "ios hidden false. play stuck detector on."), this.Nt = !0);
}, a.onPlay = function() {
this.Nt && (this.J.i(Kt, "on play. start detector timer."), this.Nt = !1, this.Ft());
}, a.onTimeupdate = function() {
this.It && this.jt();
}, a.getName = function() {
return Kt;
}, a.jt = function() {
this.J.i(Kt, "reset"), this.Nt = !1, this.Bt();
}, c;
}(_r), dt = function(n) {
return n.METADATA = "metadata", n.MEDIA_INFO = "mediaInfo", n.HEARTBEAT = "heartbeat", n.DOWNLOAD = "download", n.REALTIME_BEACON = "realtimeBeacon", n.DISCONTINUITY = "discontinuity", n.KEY_FRAME = "keyFrame", n.PRIV_NAL = "privNal", n.SEI = "sei", n.AAC_PRIV = "aacPriv", n;
}({}), Cl = function(n) {
function c() {
return n.apply(this, arguments) || this;
}
return E()(c, n), c.prototype.run = function(a) {
if (this.getAvailable() && (this.ut.stat.coreType === H.mse && a.type === Pe.NETWORK_ERROR && a.details !== ge.DEC_LIB_LOAD_ERROR && a.details !== ge.KEY_SYSTEM_LICENSE_REQUEST_FAILED && !this.ut.stat.multipart || this.ut.stat.coreType === H.native && a.details !== ge.KEY_SYSTEM_UNSUPPORTED)) {
var i = this.ut.lctx.current;
if (i && i.urlId < i.url.length - 1)
return this.J.i("fallback-backup", "run"), i.urlId++, this.vt({ type: w.BACKUP, message: "trans error. use backup url.", fallback: Ie.USE_BACKUP });
}
}, c;
}(mr), Dl = function() {
function n() {
var a = this;
this.Ut = void 0, this.B = void 0, this.Pt = void 0, this.it = function() {
a.Vt();
}, this.Ht = function() {
a.B && a.B.readyState >= 2 && a.Vt();
}, this.Vt = function() {
a.B && a.Pt && a.Pt(a.B.status), a.stop();
};
}
var c = n.prototype;
return c.start = function(a, i) {
this.Pt = i, this.B && this.stop();
var o = this.B = new XMLHttpRequest();
o.open("GET", a, !0), o.onreadystatechange = this.Ht, o.onerror = this.it, o.onload = this.it, o.send(), this.Ut = setTimeout(this.Vt, 1e3);
}, c.stop = function() {
this.Ut && (clearTimeout(this.Ut), this.Ut = void 0), this.B && (this.B.onreadystatechange = null, this.B.onload = null, this.B.onerror = null, this.B.abort(), this.B = void 0), this.Pt = void 0;
}, n;
}(), Ol = { 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 xn(n) {
var c = {};
return (n || "").split(/[ ,]+/).forEach(function(a) {
a.indexOf("avc1") !== 0 && a.indexOf("hev1") !== 0 && a.indexOf("av01") !== 0 && a.indexOf("kvc") !== 0 || (c.video = a), a.indexOf("mp4a") === 0 && (c.audio = a);
}), c;
}
function Ml(n, c) {
var a = [].concat(n.split(/[ ,]+/));
["video", "audio"].forEach(function(i) {
var o = a.filter(function(f) {
return function(T, S) {
var V = Ol[S];
return !!V && V[T.slice(0, 4)] === !0;
}(f, i);
});
if (o.length) {
var u = o.filter(function(f) {
return f.lastIndexOf("avc1", 0) === 0 || f.lastIndexOf("av01", 0) === 0 || f.lastIndexOf("hev1", 0) === 0 || f.lastIndexOf("hvc1", 0) === 0 || f.lastIndexOf("mp4a", 0) === 0;
});
c[i + "Codec"] = u.length > 0 ? u[0] : o[0], a = a.filter(function(f) {
return o.indexOf(f) === -1;
});
}
}), c.codec = a.join(",");
}
function Cn(n) {
return n.indexOf("avc1") === 0 ? v.h264 : n.indexOf("hev1") === 0 || n.indexOf("hvc1") === 0 ? v.hevc : n.indexOf("av01") === 0 ? v.av1 : v.unknown;
}
var Vt = 1e3;
function Dn(n, c, a) {
return a === void 0 ? { width: n, height: c } : a.width > a.height ? { width: Math.round(a.width / a.height * n), height: c } : a.width < a.height ? { width: n, height: Math.round(c * a.height / a.width) } : { width: n, height: c };
}
var Nl = function(n) {
function c(i) {
var o;
return (o = n.call(this) || this).J = void 0, o.Wt = void 0, o.Gt = void 0, o.J = i, o;
}
E()(c, n);
var a = c.prototype;
return a.copyImageData = function(i, o, u, f) {
var T;
this.Wt || (this.Wt = Sn());
var S = { willReadFrequently: !0 };
f && (S.colorSpace = f), this.Gt || (this.Gt = this.Wt.getContext("2d", S));
var V, W, $ = 0, te = 0, be = typeof window < "u" && i instanceof HTMLVideoElement;
if (be)
$ = i.videoWidth, te = i.videoHeight;
else if (u === 90 || u === 270) {
var ie = Dn(i.height, i.width, o);
$ = ie.height, te = ie.width;
} else {
var Te = Dn(i.width, i.height, o);
$ = Te.width, te = Te.height;
}
return this.Wt.width = $, this.Wt.height = te, be ? (V = this.Gt) == null || V.drawImage(i, 0, 0) : (W = this.Gt) == null || W.drawImage(i, 0, 0, i.width, i.height, 0, 0, this.Wt.width, this.Wt.height), (T = this.Gt) == null ? void 0 : T.getImageData(0, 0, $, te, S);
}, a.destroy = function() {
this.J.i("image-data-copier", "destrpy"), this.Wt = void 0, this.Gt = void 0;
}, c;
}(R), Gt = function(n) {
return n[n.NONE = 0] = "NONE", n[n.WAITING = 1] = "WAITING", n[n.SEEK = 2] = "SEEK", n[n.SELECT_BITRATE = 3] = "SELECT_BITRATE", n[n.INIT = 4] = "INIT", n[n.LOADING = 5] = "LOADING", n;
}({}), $e = "kernel-base", je = "kernel-native", Pl = function(n) {
function c(i) {
var o;
return (o = n.call(this, i) || this).Qt = void 0, o.Yt = !1, o.F.push(o.ut.fallback.register(Ie.USE_BACKUP, new Cl(i).setRetryFunc(o.Jt.bind(o)))), o;
}
E()(c, n);
var a = c.prototype;
return a.Jt = function(i) {
this.Zt(ue.retry);
}, a.load = function(i) {
var o;
this.J.i(je, "load", this.ut.stat.startFromSec);
var u = this.ut.lctx.levels;
if (u.length || this.emit(q.ERROR, le(Pe.OTHER_ERROR, ge.MANIFEST_PARSING_ERROR, "manifest parse error. core: native")), this.ut.stat.drm)
this.emit(q.ERROR, le(Pe.KEY_SYSTEM_ERROR, ge.KEY_SYSTEM_UNSUPPORTED, "DRM unsupported."));
else {
var f = this.ut.lctx.default, T = this.ut.lctx.startIdx;
typeof T == "number" && T >= 0 && T < u.length && (f = T, this.J.i(je, "set level from level startIdx.")), this.J.i(je, "level: " + f + " " + ((o = u[f]) == null ? void 0 : o.qualityType)), this.ut.lctx.currentIdx = this.ut.lctx.nextIdx = f, this.ut.lctx.abr = !1, this.emit(q.MANIFEST_PARSED, { levels: [], currentLevel: 0 }), this.Zt(i);
}
}, a.onAbrLevelsUpdated = function() {
}, a.refresh = function() {
var i, o = this;
this.ut.stat.startFromSec = this.zt.currentTime, this.Zt(ue.retry), (i = this.zt.play()) == null || i.catch(function(u) {
return o.J.i(je, "refresh. call play() fail.", u);
});
}, a.stopLoad = function() {
this.emit(q.STOP_LOAD), this.Kt();
}, a.setCurrentLevel = function(i) {
var o = this;
this.J.i(je, "set current level: " + i + " @ " + this.zt.currentTime);
var u = this.ut;
if (u.lctx.levels.length) {
if (i >= 0 && i < u.lctx.levels.length && u.lctx.currentIdx !== i) {
u.lctx.currentIdx = u.lctx.nextIdx = i;
var f = u.lctx.current;
if (f) {
var T;
return this.qt = Gt.SELECT_BITRATE, u.stat.startFromSec = this.zt.currentTime, this.Xt++, this.emit(q.LEVEL_SWITCHING, { time: u.currentTime, bitrate: f.bitrate, level: i, smooth: !1, auto: !1, id: this.Xt }), this.$t(u.lctx.currentIdx), !this.zt.paused && ((T = this.zt.play()) == null || T.catch(function(S) {
return o.J.i(je, "set current level, call play() fail.", S);
})), void this.emit(q.LEVEL_SWITCHED, { time: u.currentTime, bitrate: f.bitrate, level: i, smooth: !1, auto: !1, id: this.Xt });
}
}
this.emit(q.LEVEL_SWITCH_FAILED);
} else
u.lctx.currentIdx = u.lctx.nextIdx = i;
}, a.setNextLevel = function(i) {
this.setCurrentLevel(i);
}, a.liveEnd = function() {
}, a.destroy = function() {
this.J.i(je, "destroy"), this.Qt && (this.Qt.stop(), this.Qt = void 0), n.prototype.destroy.call(this), this.zt.src = "";
}, a.ti = function() {
this.ii || this.zt.src || this.load(), n.prototype.ti.call(this);
}, a.ei = function() {
var i = this.ut, o = i.lctx.current;
o && this.qt === Gt.SELECT_BITRATE && this.emit(q.LEVEL_SWITCH_PLAYING, { time: i.currentTime, bitrate: o.bitrate, level: i.lctx.currentIdx, smooth: !1, auto: !1, id: this.Xt }), this.qt !== Gt.NONE && (this.qt = Gt.NONE), n.prototype.ei.call(this);
}, a.ni = function() {
var i = this.ut;
n.prototype.ni.call(this), this.Yt && (this.J.i(je, "timeupdate start from: " + i.stat.startFromSec), this.ri(), this.Yt = !1);
}, a.Ai = function() {
this.J.i(je, "video waiting"), this.qt = this.qt || Gt.WAITING;
var i = this.ut.bufferedSec, o = !this.zt.ended && !this.zt.seeking && this.qt === Gt.WAITING;
this.emit(q.WAITING, { block: o, bufferedSec: i });
}, a.oi = function() {
var i;
(ee.android || this.ut.stat.isLive === void 0 || ((i = this.si) == null ? void 0 : i.width) === 0) && this.si && this.zt.duration > 0 && (this.si.isLive = this.ut.stat.isLive = !isFinite(this.zt.duration), this.zt instanceof HTMLVideoElement && (this.si.width = this.zt.videoWidth, this.si.height = this.zt.videoHeight), this.emit(q.MEDIA_INFO, this.si)), this.ui() && this.zt.duration > 0 && (this.J.i(je, "check video dec failed. on android wechat hls duration change."), this.ai()), n.prototype.oi.call(this);
}, a.hi = function() {
if (this.J.i(je, "video loadeddata. duration: " + this.zt.duration + " box: " + this.ut.stat.box), !(!this.ui() && this.zt instanceof HTMLVideoElement && (this.J.i(je, "check video dec failed. on video loaded data."), this.ai()))) {
this.ut.stat.isLive === void 0 && this.zt.duration > 0 && (this.ut.stat.isLive = !isFinite(this.zt.duration)), this.si = { videoDecoder: b.buildin }, this.zt instanceof HTMLVideoElement && (this.J.i(je, "video loadeddata. width: " + this.zt.videoWidth + " height: " + this.zt.videoHeight), this.si.width = this.zt.videoWidth, this.si.height = this.zt.videoHeight);
var i = this.ut, o = i.lctx.current;
if (o && o.codec) {
var u = xn(o.codec);
this.si.audioCodec = u.audio, this.si.videoCodec = u.video, u.video && (i.stat.codecType = Cn(u.video));
}
this.si.videoCodecType = i.stat.codecType, ee.android ? i.stat.startFromSec && (this.Yt = !0) : this.ri(), this.emit(q.MEDIA_INFO, this.si);
}
}, a.ci = function() {
this.J.i(je, "seeking " + this.zt.currentTime);
var i = this.zt.currentTime;
this.fi ? this.fi = !1 : (this.emit(q.SEEKING), this.ut.isTimeinBuffered(i) || this.emit(q.SEEK_WITH_LOAD));
}, a.di = function(i) {
var o, u = this;
this.J.i(je, "video error", i);
var f = ((o = this.zt.error) == null ? void 0 : o.code) || 0, T = ae(oe[f] || ge.VIDEO_ERROR, "video error");
if (f === 4 && this.ut.canCodecFallback)
this.emit(q.ERROR, le(Pe.MEDIA_ERROR, T, "buildin " + this.ut.stat.codecType + " dec error. video error: " + f));
else {
var S = "video error";
this.zt && this.zt.error && (S += " code:" + f + " message:" + this.zt.error.message);
var V = le(Pe.MEDIA_ERROR, (f ? oe[f] : ge.VIDEO_ERROR) || ge.VIDEO_ERROR, S, { url: this.zt.src });
f === 2 || f === 4 ? (this.Qt || (this.Qt = new Dl()), this.J.i(je, "video error start detect status code."), this.Qt.start(this.zt.src, function(W) {
u.J.i(je, "video error check http status code:", W), (f === 2 || f === 4 && W > 0) && (W < 200 || W > 299) ? u.emit(q.ERROR, le(Pe.NETWORK_ERROR, ge.LOAD_ERROR, S, { statusCode: W, url: u.zt.src })) : (W === 0 && (V.statusCode = 0), u.emit(q.ERROR, V));
})) : this.emit(q.ERROR, V);
}
}, a.Zt = function(i) {
this.J.i(je, "_load type: " + i), this.si = void 0, this.ii = void 0, this.ut.isLiveShift ? this.emit(q.ERROR, le(Pe.OTHER_ERROR, ge.UNSUPPORTED, "unsupported. core: " + this.type + " liveShift: " + this.ut.stat.liveShiftType)) : (this.qt = Gt.LOADING, n.prototype.Zt.call(this, i), this.emit(q.LOAD, { type: i }), this.$t(this.ut.lctx.currentIdx), this.li());
}, a.$t = function(i) {
var o = this.ut, u = o.lctx.current;
if (u) {
var f;
this.J.i(je, "level", i);
var T, S = u.currentUrl;
this.emit(q.NEW_SOURCE, { sync: o.stat.startFromSec || 0 }), (f = this.ut.config.preprocessUrl) != null && f.stream && (this.J.d(je, "preprocessUrl stream"), S = (T = this.ut.config.preprocessUrl) == null ? void 0 : T.stream(S)), this.J.i(je, "play: " + S), this.zt.src = S;
}
}, a.ri = function() {
var i = this.ut;
i.stat.startFromSec > 0 && (this.J.i(je, "start from: " + i.stat.startFromSec), this.zt.currentTime = i.stat.startFromSec, i.stat.startFromSec = 0);
}, a.ai = function() {
return this.J.i(je, "check video dec failed."), !!(this.zt instanceof HTMLVideoElement && !this.zt.videoWidth && this.ut.canCodecFallback) && (this.emit(q.ERROR, le(Pe.MEDIA_ERROR, ge.VIDEO_NO_SIZE, "buildin " + this.ut.stat.codecType + " dec no width.")), !0);
}, a.ui = function() {
return ee.android && (ee.xweb || ee.x5) && he(this.ut.stat.box);
}, h()(c, [{ key: "type", get: function() {
return H.native;
} }]);
}(function(n) {
function c(i) {
var o;
if ((o = n.call(this) || this).ut = void 0, o.J = void 0, o.zt = void 0, o.ii = void 0, o.pi = void 0, o.qt = Gt.INIT, o.si = void 0, o.Xt = 0, o.mi = [], o.yi = void 0, o.Mi = void 0, o.fi = !1, o.wi = void 0, !i.video)
throw new Error("video is null");
return o.ut = i, o.J = i.logger, o.zt = i.video, o.Mi = { loadedmetadata: o.bi.bind(o), loadeddata: o.hi.bind(o), canplay: o.ei.bind(o), seeking: o.ci.bind(o), seeked: o.gi.bind(o), waiting: o.Ai.bind(o), playing: o.ki.bind(o), pause: o._i.bind(o), play: o.ti.bind(o), error: o.di.bind(o), ended: o.Ei.bind(o), ratechange: o.Ri.bind(o), durationchange: o.oi.bind(o), timeupdate: o.ni.bind(o), progress: o.Di.bind(o), emptied: o.Ti.bind(o), resize: o.Si.bind(o) }, o.Oi(), o;
}
E()(c, n);
var a = c.prototype;
return a.destroy = function() {
this.J.i($e, "destroy"), this.fi = !1, this.Kt(), this.Ci(), n.prototype.destroy.call(this);
}, a.getTrackBufInfo = function() {
}, a.load = function() {
this.zt.load();
}, a.resume = function() {
var i, o = this;
this.zt.paused && ((i = this.zt.play()) == null || i.catch(function(u) {
return o.J.i($e, "resume, call play() fail.", u);
}));
}, a.refresh = function() {
}, a.stopLoad = function() {
}, a.Li = function() {
var i = this.si && this.si.fps ? this.si.fps : 30;
return this.zt.duration && !this.zt.ended ? this.zt.currentTime + 1 / i : -1;
}, a.xi = function() {
var i = this.si && this.si.fps ? this.si.fps : 30;
return this.zt.duration && this.zt.currentTime - 1 / i >= 0 ? this.zt.currentTime - 1 / i : -1;
}, a.Oi = function() {
if (this.zt)
for (var i in this.Mi)
this.zt.addEventListener(i, this.Mi[i]);
}, a.Ci = function() {
if (this.zt)
for (var i in this.Mi)
this.zt.removeEventListener(i, this.Mi[i]);
}, a.bi = function() {
this.J.i($e, "loadedmetadata"), this.emit(q.LOADEDMETADATA);
}, a.hi = function() {
this.J.i($e, "loadeddata"), this.emit(q.LOADEDDATA);
}, a.ei = function() {
this.J.i($e, "canplay " + !!this.qt), this.emit(q.CANPLAY);
}, a.ci = function() {
this.J.i($e, "seeking " + this.zt.currentTime), this.emit(q.SEEKING);
}, a.gi = function() {
this.J.i($e, "seeked"), this.emit(q.SEEKED);
}, a.Ai = function() {
this.J.i($e, "video waiting");
}, a.ki = function() {
this.J.i($e, "playing"), this.ii || (this.qt = Gt.NONE, this.li(), this.emit(q.PLAYING));
}, a._i = function() {
this.J.i($e, "pause. seeking: " + this.zt.seeking), this.zt.ended || this.emit(q.PAUSE);
}, a.ti = function() {
this.J.i($e, "play", this.ii), this.emit(q.PLAY), ee.safari && this.zt.currentTime >= this.zt.duration && this.zt.loop && (this.J.i($e, "safari loop fix. seek 0. loop: " + this.zt.loop + " " + this.zt.currentTime + "/" + this.zt.duration + "."), this.zt.currentTime = 0);
}, a.di = function(i) {
this.J.i($e, "error", i);
}, a.Ei = function() {
this.J.i($e, "ended"), this.fi = !1, this.emit(q.ENDED), this.Kt();
}, a.Ri = function() {
this.J.i($e, "ratechange " + this.zt.playbackRate), this.emit(q.RATE_CHANGE);
}, a.oi = function() {
this.J.i($e, "durationchange " + this.zt.duration), this.emit(q.DURATION_CHANGE);
}, a.ni = function() {
this.emit(q.TIMEUPDATE);
}, a.Di = function() {
this.emit(q.PROGRESS);
}, a.Ti = function() {
this.J.i($e, "video emptied");
}, a.Si = function() {
this.J.i($e, "video resize");
}, a.Ni = function() {
this.emit(q.HEARTBEAT);
}, a.li = function() {
this.pi || (this.pi = setInterval(this.Ni.bind(this), 1e3));
}, a.Kt = function() {
this.pi && (clearInterval(this.pi), this.pi = void 0);
}, a.Zt = function(i) {
this.fi = !1;
}, a.emit = function(i, o) {
if (i === q.ERROR) {
var u = o;
u.fatal && (this.ii = u), this.J.i($e, "error", u);
}
return this.ut.evt.emit(i, o);
}, a.internalSeek = function(i) {
this.fi = !0;
try {
this.zt.currentTime = i;
} catch (o) {
this.J.i($e, "internal seek err.", o);
}
}, a.screenshot = function(i) {
var o = 1e3 * this.zt.currentTime;
if (this.zt instanceof HTMLVideoElement && this.zt.videoWidth) {
this.wi || (this.wi = new Nl(this.J), this.F.push(this.wi));
var u = this.wi.copyImageData(this.zt, void 0, 0, i == null ? void 0 : i.colorSpace);
u && this.emit(q.SCREENSHOT, { pts: o, id: i == null ? void 0 : i.id, image: u });
} else
this.emit(q.SCREENSHOT, { pts: o, id: i == null ? void 0 : i.id, errorCode: ge.SCREENSHOT_CREATE_IMG_ERROR, errorMessage: "no video" });
}, h()(c, [{ key: "type", get: function() {
return H.unknown;
} }]);
}(R)), On = function() {
function n() {
this.timeout = 6048e5;
}
var c = n.prototype;
return c.write = function(a, i) {
if (n.available)
try {
return localStorage.setItem(a, JSON.stringify({ value: i, time: Date.now() })), !0;
} catch (o) {
}
return !1;
}, c.read = function(a, i) {
if (i === void 0 && (i = !0), n.available)
try {
var o = localStorage.getItem(a);
if (o) {
var u = JSON.parse(o), f = u.value, T = u.time, S = T === void 0 ? 0 : T;
if (!i || Date.now() - S < (typeof i == "number" ? i : this.timeout))
return f;
}
} catch (V) {
}
}, h()(n, null, [{ key: "available", get: function() {
if (n.A === void 0)
try {
localStorage.setItem("alg", "test"), n.A = !0;
} catch (a) {
n.A = !1;
}
return n.A;
} }]);
}();
On.A = void 0;
var br = On, Er = "kwai-kernel-id", wr = function() {
function n() {
}
return n.next = function() {
if (br.available) {
var c = n.Ii.read(Er, !1), a = n._;
return typeof c == "number" ? (a = this.getNextId(c), this.Ii.write(Er, a)) : (a = this.getNextId(a), this.Ii.write(Er, a)), n._ = a, a;
}
return n._ = n.getNextId(n._), n._;
}, n.getNextId = function(c) {
return ++c > n.MAX_ID ? 0 : c;
}, h()(n, null, [{ key: "MAX_ID", get: function() {
return 999;
} }]);
}();
wr._ = 0, wr.Ii = new br();
var Mn = "sei-time", Ul = function(n) {
function c(a) {
var i;
return (i = n.call(this) || this).ut = void 0, i.Fi = 0, i.J = void 0, i.Bi = { idx: 0, data: [], name: "sei" }, i.ji = { idx: 0, data: [], name: "aacPriv" }, i.Ui = { idx: 0, data: [], name: "privNal" }, i.Pi = function(o) {
o.segments.forEach(function(u) {
u.type === G.VIDEO ? (u.sei && i.Vi(u.sei, i.Bi), u.privNal && i.Vi(u.privNal, i.Ui)) : u.type === G.AUDIO && u.aacPriv && i.Vi(u.aacPriv, i.ji);
}), i.Hi();
}, i.Wi = function(o) {
o.sei && i.Vi(o.sei, i.Bi), i.Hi();
}, i.Gi = function() {
var o;
if ((o = i.ut.video) == null || !o.seeking) {
var u = 1e3 * i.ut.currentTime, f = i.Qi(u, i.Bi);
f == null || f.forEach(function(V) {
i.ut.evt.emit(q.SEI, V);
});
var T = i.Qi(u, i.ji);
T == null || T.forEach(function(V) {
i.ut.evt.emit(q.AAC_PRIV, V);
});
var S = i.Qi(u, i.Ui);
S == null || S.forEach(function(V) {
i.ut.evt.emit(q.PRIV_NAL, V);
});
}
}, i.Qi = function(o, u) {
if (u.data.length && u.idx < u.data.length) {
for (var f = [], T = 0, S = u.idx; S < u.data.length; S++) {
var V;
if (!(o >= (((V = u.data[S]) == null ? void 0 : V.time) || 0)))
break;
f.push(u.data[S]), T = S;
}
if (f.length)
return u.idx = T + 1, f;
}
}, i.Yi = function() {
i.J.i(Mn, "seek with load. remove all sei"), i.Bi.data.splice(0), i.Bi.idx = 0, i.ji.data.splice(0), i.ji.idx = 0, i.Ui.data.splice(0), i.Ui.idx = 0, i.Fi = 0;
}, i.Ji = function() {
var o = 1e3 * i.ut.currentTime;
i.Zi(o, i.Bi), i.Zi(o, i.ji), i.Zi(o, i.Ui);
}, i.Zi = function(o, u) {
for (var f = 0; f < u.data.length; f++)
if (u.data[f].time >= o) {
u.idx = f;
break;
}
}, i.Vi = function(o, u) {
o.forEach(function(f) {
f && typeof f.streamTimestamp == "number" && (f.time = i.ut.streamTime.getLocalTime(f.streamTimestamp / 1e3), typeof f.time == "number" && (f.time = Math.round(1e3 * f.time), u.data.push(f)));
}), u.data.sort(function(f, T) {
return f.time - T.time;
});
}, i.Hi = function() {
var o = i.ut.video;
if (i.Fi > 20 && o && o.buffered.length) {
var u = 1e3 * o.buffered.start(0);
i.zi(u, i.Bi), i.zi(u, i.ji), i.zi(u, i.Ui), i.Fi = 0;
}
i.Fi++;
}, i.zi = function(o, u) {
if (u.data.length && o > u.data[0].time) {
for (var f = 0; f < Math.min(u.idx, u.data.length); f++)
if (u.data[f].time >= o) {
u.data.splice(0, f), u.idx = Math.max(0, u.idx - f), i.J.i(Mn, "remove " + f + " " + u.name + " info @" + o + ". remain " + u.data.length);
break;
}
}
}, i.ut = a, i.J = a.logger, i.F.push(i.ut.evt.on(q.PARSING_DATA, i.Pi), i.ut.evt.on(q.RAW_DATA, i.Wi), i.ut.evt.on(q.TIMEUPDATE, i.Gi), i.ut.evt.on(q.SEEK_WITH_LOAD, i.Yi), i.ut.evt.on(q.SEEKING, i.Ji)), i;
}
return E()(c, n), h()(c, [{ key: "seiLength", get: function() {
return this.Bi.data.length;
} }, { key: "seiIdx", get: function() {
return this.Bi.idx;
} }, { key: "aacPrivLength", get: function() {
return this.ji.data.length;
} }, { key: "aacPrivIdx", get: function() {
return this.ji.idx;
} }, { key: "privNalLength", get: function() {
return this.Ui.data.length;
} }, { key: "privNalIdx", get: function() {
return this.Ui.idx;
} }]);
}(R), Bl = { search: function(n, c) {
for (var a = 0, i = n.length - 1, o = null, u = null; a <= i; ) {
var f = c(u = n[o = (a + i) / 2 | 0]);
if (f > 0)
a = o + 1;
else {
if (!(f < 0))
return u;
i = o - 1;
}
}
return null;
}, searchIndex: function(n, c) {
for (var a = 0, i = n.length - 1, o = null; a <= i; ) {
var u = c(n[o = (a + i) / 2 | 0]);
if (u > 0)
a = o + 1;
else {
if (!(u < 0))
return o;
i = o - 1;
}
}
return -1;
} }, Xt = "stream-time", Fl = function(n) {
function c(i) {
var o;
return (o = n.call(this) || this).J = void 0, o.ut = void 0, o.Ki = [], o.qi = void 0, o.Xi = function(u) {
u.expired || u.segments.forEach(function(f) {
var T;
f.type === G.VIDEO && f.keyTime && (f.keyTime.forEach(function(S) {
S.key && o.ut.evt.emit(q.KEY_FRAME, { pts: S.pts, cts: S.cts });
}), (T = o.Ki).push.apply(T, f.keyTime.map(function(S) {
return l()({ frag: u.frag }, S);
})), o.Ki.sort(function(S, V) {
return S.pts - V.pts;
})), f.type === G.AUDIO && f.originFirstDTS && (o.qi = f.originFirstDTS - f.startDTS);
});
}, o.Wi = function(u) {
var f;
u.keyTime && !u.expired && (f = o.Ki).push.apply(f, u.keyTime.map(function(T) {
return l()({ frag: u.frag }, T);
}));
}, o.Yi = function() {
var u, f = ((u = o.ut.video) == null ? void 0 : u.currentTime) || 0, T = o.ut.lctx.current, S = 0;
if (o.J.i(Xt, "on seek with load. current time: " + o.ut.currentTime), o.ut.stat.multipart && Object.prototype.hasOwnProperty.call(T, "fragments")) {
var V = function(te, be) {
return be ? Bl.search(be, function(ie) {
return te < ie.start ? -1 : te > ie.start + ie.duration ? 1 : 0;
}) : null;
}(f, T.fragments);
if (!V)
return o.J.i(Xt, "no frag. clear video key time."), void o.Ki.splice(0, o.Ki.length);
for (var W = o.Ki.length - 1; W >= 0; W--) {
var $;
if ((($ = o.Ki[W].frag) == null ? void 0 : $.sn) === V.sn || o.Ki[W].originPTS < f) {
S = W;
break;
}
}
}
o.J.i(Xt, "clear video key time. st: " + S), o.Ki.splice(S, o.Ki.length - S);
}, i.logger.i(Xt, "constructor"), o.ut = i, o.J = i.logger, o.F.push(o.ut.evt.on(q.PARSING_DATA, o.Xi), o.ut.evt.on(q.RAW_DATA, o.Wi), o.ut.evt.on(q.SEEK_WITH_LOAD, o.Yi)), o;
}
E()(c, n);
var a = c.prototype;
return a.reset = function() {
this.J.i(Xt, "reset"), this.qi = void 0, this.Ki = [];
}, a.getLocalTime = function(i) {
if (!(i < 0)) {
if (this.Ki.length) {
var o = this.$i(i, this.Ki);
if (o)
return i - o.originPTS + o.pts;
}
return typeof this.qi == "number" ? i - this.qi : void 0;
}
}, a.getStreamTime = function(i) {
if (!(i < 0)) {
if (this.Ki.length) {
var o, u = this.te(i, this.Ki);
if (u)
return this.J.i(Xt, "get stream time by video. local: " + i + " pts: " + u.info.pts + " originPTS: " + u.info.originPTS + " sn: " + ((o = u.info.frag) == null ? void 0 : o.sn) + " key: " + this.Ki.length), i - u.info.pts + u.info.originPTS;
}
return this.J.i(Xt, "get local time by audio. local: " + i + " offset: " + this.qi), typeof this.qi == "number" ? i + this.qi : void 0;
}
}, a.getKeyFrameTime = function(i, o) {
if (o === void 0 && (o = 0), this.Ki.length) {
var u = this.te(i, this.Ki);
return u ? this.Ki[u.idx + o] : void 0;
}
}, a.te = function(i, o) {
if (o) {
for (var u = o.length - 1; u >= 0; u--)
if (o[u].pts <= i)
return { info: o[u], idx: u };
}
}, a.$i = function(i, o) {
if (o) {
for (var u = o.length - 1; u >= 0; u--)
if (o[u].originPTS <= i)
return o[u];
}
}, h()(c, [{ key: "localTimeOffset", get: function() {
return this.qi;
}, set: function(i) {
this.qi = i;
} }]);
}(R), Hl = "playback-rate";
function Nn(n, c, a, i, o) {
a === void 0 && (a = 3), c = Math.round(c), !i || i.startDelay === c || c <= 0 || (i.startDelay = typeof o == "number" ? o : c, i.rule = [{ rate: 1.5, lower: c + 2 * a + 1, upper: Number.MAX_SAFE_INTEGER }, { rate: 1.25, lower: c + a + 1, upper: c + 2 * a }, { rate: 1.1, lower: c + 1, upper: c + a }, { rate: 1, lower: 0, upper: c }], n.i(Hl, "update auto playbackRate delay: " + c + ", step: " + a + " startDelay: " + o, JSON.stringify(i)));
}
var rt = function(n) {
return n.SERIES_12 = "15_pro_max/15_plus/14_pro_max", n.SERIES_11 = "15_pro/15/14_pro", n.SERIES_10 = "14_plus/13_pro_max/12_pro_max", n.SERIES_9 = "14/13/13_pro/12/12_pro", n.SERIES_8 = "se_3/se_2/8/7/6s/6", n.SERIES_7 = "13_mini/12/11_pro/xs/x", n.SERIES_6 = "11_pro_max/xs_max", n.SERIES_5 = "11/xr", n.SERIES_4 = "8_plus/7_plus/6s_plus/6_plus", n.SERIES_3 = "se/5c/5s/5", n.SERIES_2 = "4s/4", n.SERIES_1 = "3gs/3g/1", n;
}({}), Vl = { "430_932_3": rt.SERIES_12, "393_852_3": rt.SERIES_11, "428_926_3": rt.SERIES_10, "390_844_3": rt.SERIES_9, "375_667_2": rt.SERIES_8, "375_812_3": rt.SERIES_7, "414_896_3": rt.SERIES_6, "414_896_2": rt.SERIES_5, "414_736_3": rt.SERIES_4, "320_568_2": rt.SERIES_3, "320_480_2": rt.SERIES_2, "320_480_1": rt.SERIES_1 };
function Pn() {
if (ee.iphone && typeof window < "u" && window.screen) {
var n = window.screen.width + "_" + window.screen.height + "_" + window.devicePixelRatio;
return Vl[n] || "unknown";
}
return "unknown";
}
var Pi, Un = function() {
function n() {
this.I = [];
}
var c = n.prototype;
return c.append = function(a) {
this.I.push(a);
}, c.clear = function() {
this.I = [];
}, c.getLastMseError = function() {
for (var a = this.I.length - 1; a >= 0; a--) {
var i = this.I[a];
if (i && i.core === H.mse) {
var o = i.errorData;
return o && (o.code = ae(o.details, o.reason, o.statusCode)), o;
}
}
}, c.ie = function(a) {
return a.map(function(i) {
var o = { message: i.message, pos: i.pos, ts: i.ts };
return i.code !== void 0 && (o.code = i.code), i.core !== void 0 && (o.core = i.core), i.count !== void 0 && (o.count = i.count), i.fallback !== void 0 && (o.fallback = i.fallback), o;
});
}, h()(n, [{ key: "hasData", get: function() {
return !!this.I.length;
} }, { key: "retryCount", get: function() {
return this.I.reduce(function(a, i) {
return (typeof i.count == "number" && i.count > 0 ? i.count : 1) + a;
}, 0);
} }, { key: "mergedBeacon", get: function() {
var a = [];
return this.I.forEach(function(i) {
var o;
if (a.length && i.type === w.LOADER && ((o = a[a.length - 1]) == null ? void 0 : o.type) === w.LOADER) {
var u = a[a.length - 1].count;
a[a.length - 1].count = u ? u + 1 : 2;
} else
a.push(l()({}, i));
}), this.ie(a.slice(-10));
} }, { key: "beacon", get: function() {
return this.ie(this.I.slice(-10));
} }]);
}(), Gl = function() {
function n() {
this.coreType = H.unknown, this.native = !1, this.codecType = v.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 = 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 Un(), this.mainThreadRendering = void 0, this.stereoType = void 0, this.decoder = b.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.ee = !1, this.ne = de.NONE;
}
return n.prototype.reset = function() {
this.coreType = H.unknown, this.codecType = v.unknown, this.audioCodec = "", this.recoverSwapRemux = !1, this.recoverSwapAudioCodec = !1, this.box = g.unknown, this.autoLazyLoad = !0, this.firstFrameLoaded = !1, this.isNetworkInUse = !1, this.srcType = L.OTHERS, this.retryInfo.clear(), this.decoder = b.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.ee = !1, this.ne = de.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;
}, h()(n, [{ key: "liveShiftActive", get: function() {
return this.liveShiftType !== de.NONE && this.ee;
}, set: function(c) {
this.ee = c;
} }, { key: "liveShiftType", get: function() {
return this.isLive && (this.ne !== de.KWAI && this.ne !== de.KWAI2 || !ee.mobile) && he(this.box) ? this.ne : de.NONE;
}, set: function(c) {
this.ne = c;
} }]);
}(), Wl = function() {
function n() {
this.re = 0, this.Ae = 0, this.se = 0, this.ue = 0, this.ae = 0;
}
var c = n.prototype;
return c.reset = function() {
this.se = performance.now(), this.re = this.Ae = this.ue = this.ae = 0;
}, c.getFPS = function(a) {
if (a) {
var i, o = performance.now(), u = a.totalVideoFrames, f = a.droppedVideoFrames;
if (u) {
u < this.Ae && (this.Ae = 0, this.re = 0);
var T = o - this.se, S = f - this.re, V = u - this.Ae, W = 0, $ = 0;
this.se && (W = parseFloat((1e3 * S / T).toFixed(2)), $ = parseFloat((1e3 * V / T).toFixed(2))), this.ue = this.ue += V, this.ae = this.ae += S, this.se = o, this.re = f, this.Ae = u, i = { decoded: this.ue, dropped: this.ae, decodedFPS: $, droppedFPS: W };
}
return this.se = o, i;
}
}, n;
}(), jl = function() {
function n() {
this._$evt = new x.EventEmitter();
}
var c = n.prototype;
return c.on = function(a, i) {
var o = this;
return this._$evt.on(a, i), { destroy: function() {
return o._$evt.off(a, i);
} };
}, c.prependListener = function(a, i) {
var o = this;
return this._$evt.prependListener(a, i), { destroy: function() {
return o._$evt.off(a, i);
} };
}, c.removeAllListeners = function(a) {
this._$evt.removeAllListeners(a);
}, c.off = function(a, i) {
this._$evt.off(a, i);
}, c.listeners = function(a) {
return this._$evt.listeners(a);
}, c.emit = function(a, i) {
return this._$evt.emit(a, i);
}, c.listenerCount = function(a) {
return this._$evt.listenerCount(a);
}, n;
}(), Bn = "level-ctx", Fn = function() {
function n(a, i) {
this.J = void 0, this.he = void 0, this.ce = void 0, this.fe = !1, this.ve = -1, this.de = 0, this.le = 0, this.pe = [], this.me = 0, this.ye = [], this.Me = 0, this.we = [], this.be = [], this.ge = void 0, this.ke = void 0, a.i(Bn, "constructor abr:" + i), this.J = a, this.fe = i;
}
var c = n.prototype;
return c.getLevel = function(a) {
return a === void 0 && (a = P.MAIN), a === P.MAIN ? this.pe[this.de] : a === P.AUDIO ? this.ye[this.me] : a === P.SUBTITLE ? this.we[this.Me] : void 0;
}, c.setLevelIdx = function(a, i) {
i === void 0 && (i = P.MAIN), i === P.MAIN ? this.currentIdx = a : i === P.AUDIO ? this.audioIdx = a : i === P.SUBTITLE && (this.subtitleIdx = a);
}, c.getLevelIdx = function(a) {
return a === void 0 && (a = P.MAIN), a === P.MAIN ? this.de : a === P.AUDIO ? this.me : a === P.SUBTITLE ? this.Me : -1;
}, c.setNextIdx = function(a, i) {
i === void 0 && (i = P.MAIN), i === P.MAIN && (this.nextIdx = a);
}, c.getNextIdx = function(a) {
return a === void 0 && (a = P.MAIN), a === P.MAIN ? this.le : -1;
}, c.clearFrag = function() {
this.J.i(Bn, "clear"), [this.pe, this.ye, this.we].forEach(function(a) {
a.forEach(function(i) {
var o = i;
o.fragments && o.clear();
});
});
}, c.verifyLevelIdx = function(a) {
return this.pe.length > 0 && a < this.pe.length && a >= -1;
}, c.verifyAudioTrackIdx = function(a) {
return this.ye.length > 0 && a < this.ye.length && a >= 0;
}, c.verifySubtitleTracksIdx = function(a) {
return this.we.length > 0 && a < this.we.length && a >= 0;
}, c.abrIndexToOrign = function(a) {
var i = this.be[a];
return i ? i.index : 0;
}, c.orignIndexToAbr = function(a) {
var i = 0;
return this.be.forEach(function(o, u) {
o.index !== a || (i = u);
}), i;
}, c._e = function() {
var a = this, i = this.ke;
this.ge = 0, this.be = [], this.pe.forEach(function(o, u) {
o.default && !i && (a.ge = u), o.enableAdaptive && (!i || i && i.indexOf(u) !== -1) && a.be.push(o);
}), this.be.sort(function(o, u) {
return o.bitrate - u.bitrate;
});
}, h()(n, [{ key: "hasAudio", get: function() {
return this.he;
}, set: function(a) {
this.he = a;
} }, { key: "hasVideo", get: function() {
return this.ce;
}, set: function(a) {
this.ce = a;
} }, { key: "abr", get: function() {
return this.fe;
}, set: function(a) {
this.fe = a;
} }, { key: "startIdx", get: function() {
return this.ve;
}, set: function(a) {
this.ve = a;
} }, { key: "currentIdx", get: function() {
return this.de;
}, set: function(a) {
a >= 0 && (this.de = a);
} }, { key: "nextIdx", get: function() {
return this.le;
}, set: function(a) {
a >= 0 && (this.le = a);
} }, { key: "levels", get: function() {
return this.pe;
}, set: function(a) {
this.pe = a, this._e();
} }, { key: "current", get: function() {
return this.pe[this.de];
} }, { key: "currentUrl", get: function() {
var a = this.pe[this.de];
return (a == null ? void 0 : a.currentUrl) || "";
} }, { key: "audioIdx", get: function() {
return this.me;
}, set: function(a) {
a >= 0 && (this.me = a);
} }, { key: "audioTracks", get: function() {
return this.ye;
}, set: function(a) {
this.ye = a;
} }, { key: "audio", get: function() {
return this.ye[this.me];
} }, { key: "subtitleIdx", get: function() {
return this.Me;
}, set: function(a) {
a >= 0 && (this.Me = a);
} }, { key: "subtitleTracks", get: function() {
return this.we;
}, set: function(a) {
this.we = a;
} }, { key: "subtitle", get: function() {
return this.we[this.Me];
} }, { key: "abrLevels", get: function() {
return this.be;
} }, { key: "availableList", set: function(a) {
this.ke = a, this._e();
} }, { key: "default", get: function() {
return this.ge || 0;
}, set: function(a) {
this.ge = a;
} }, { key: "abrDefault", get: function() {
var a = 0;
return this.be.forEach(function(i, o) {
i.default && (a = o);
}), a;
} }]);
}(), Kl = 0, kt = "loader", Hn = function() {
function n(a) {
var i = this;
this.J = void 0, this.j = void 0, this.Ee = void 0, this.U = null, this.Re = void 0, this.De = void 0, this.Te = void 0, this.Se = 0, this.Oe = !1, this.Ce = !1, this.Le = void 0, this.xe = void 0, this.Ne = void 0, this.Ie = void 0, this.Fe = 0, this.Be = 0, this.je = function() {
var o;
i.Oe = !0, i.Ce = !1;
var u = i.Te, f = i.j;
(o = i.U) != null && o.onLoad && i.U.onLoad(f, u), u.code = 0, u.tfirst = 0, u.loaded = 0, i.Ue(), i.Ee = new (i.Pe())(i.J), u.type = i.Ee instanceof Le ? N.FETCH : N.XHR, i.Ee && (u.id = i.Ee.tag + "-" + i.Be, i.Re.connectionTimeout && (i.Le = setTimeout(function() {
return i.Ve(D.LOADER_CONNECT_TIMEOUT);
}, i.Re.connectionTimeout)), i.He(f), u.tsload = Date.now(), u.tstart = performance.now(), i.J.i(kt, "[" + i.Be + "]load: " + i.Ee.tag + " " + f.url + " progress: " + f.progress + " type: " + f.type + " responseType: " + f.responseType + " range: " + f.range), i.Ee.load(f, i.De));
}, this.We = function(o, u) {
i.Ge();
var f = i.Te;
i.Qe(o, f), i.Ye(), f.code = u, f.tfirst = Math.max(f.trequest, performance.now()), i.J.i(kt, "[" + i.Be + "]connect code: " + u + " len: " + f.contentLength + " totalLength: " + f.contentTotalLength), i.U && i.U.onConnect && i.U.onConnect(o, f), typeof o.rangeStart == "number" && o.rangeStart > 0 && f.code !== 206 && i.U && i.U.onError && setTimeout(function() {
i.H(new Error("range error. " + o.range + " statu code:" + f.code));
}, 0);
}, this.W = function(o, u) {
try {
var f = i.Te;
if (i.Fe = performance.now(), !o.breakpointContinuation && f.output > f.loaded) {
if (f.loaded + u.byteLength - f.output > 0) {
var T = u.slice(f.output - f.loaded);
i.Je(i.j, T, f);
}
f.loaded += u.byteLength;
} else
f.loaded += u.byteLength, i.Je(i.j, u, f);
} catch (S) {
i.J.i(kt, "handling data error. ", S), i.H(new Error(D.HANDLING_DATA_ERROR + ". " + S));
}
}, this.H = function(o) {
i.Ze(), i.ze();
var u, f = i.Te, T = i.Re, S = i.j, V = f.type === N.FETCH && S.monkeyPatched && S.preferNative === void 0;
i.Oe = !1, i.J.i(kt, "[" + i.Be + "]error: " + o.name + " " + (o == null ? void 0 : o.message) + " code: " + f.code + " retry: " + f.retry + "/" + T.maxRetry + " " + (V ? "monkeyPatchedFetch" : "")), i.j.breakpointContinuation && f.code === 416 || V && i.Te.output === f.loaded && f.loaded > 0 ? (u = i.U) != null && u.onEnd && i.U.onEnd(i.j, null, f) : (f.fatal = !T.maxRetry || f.retry >= T.maxRetry || !T.maxRetry, f.errName = o.name, f.errMessage = o.name + ": " + o.message + ". status: " + f.code, V && (o.name === U.FETCH_READ_ERROR_NAME && !i.Te.loaded || o.message === D.LOADER_TRANS_TIMEOUT && !i.Te.loaded || o.message === D.LOADER_CONNECT_TIMEOUT || !i.Te.code) && (i.j.preferNative = !0, i.J.i(kt, "monkey patched fetch error. switch to native fetch.")), i.U && i.U.onError && i.U.onError(i.j, f), f.fatal || (T.breakpointContinuation && i.Te.contentTotalLength && (i.J.i(kt, "[" + i.Be + "]breakpointContinuation. " + i.Te.loaded + " / " + i.Te.contentTotalLength), i.Te.output && i.Te.loaded > 0 ? (i.Ie ? i.j.rangeStart = i.Ie + i.Te.output : i.j.rangeStart = i.Te.output, i.j.breakpointContinuation = !0) : (i.j.rangeStart = i.Ie, i.j.breakpointContinuation = !1)), f.retry++, i.U && (i.Se ? (i.Ne = setTimeout(i.je, i.Se), i.Se = 2 * i.Se) : i.je())));
}, this.Ve = function(o) {
i.Oe = !1, i.Ke();
var u = new Error(o);
i.H(u);
}, this.J = a, this.Be = Kl += 1, this.J.i(kt, "[" + this.Be + "]constructor"), this.Ee = null, this.Re = { connectionTimeout: 0, transmissionTimeout: 0, maxRetry: 0, retryDelay: 0 }, this.De = { onConnect: this.We, onProgress: this.W, onEnd: this.it.bind(this), onError: this.H };
}
var c = n.prototype;
return c.Pe = function() {
return n.qe !== void 0 || (n.qe = se, ee.msie || ee.msedge ? se.isSupportChunk() ? n.qe = se : Le.isSupported() && (n.qe = Le) : Le.isSupported() ? n.qe = Le : se.isSupportChunk() && (n.qe = se)), n.qe;
}, c.load = function(a, i, o) {
this.Xe(a, i, o), this.je();
}, c.destroy = function() {
this.Ee && this.J.i(kt, "[" + this.Be + "]destroy."), this.Ze(), this.Ke(!1), this.ze(), this.U = null;
}, c.abort = function() {
this.J.i(kt, "[" + this.Be + "]abort"), this.Ze(), this.Ke();
}, c.Xe = function(a, i, o) {
this.j = a, this.Ie = a.rangeStart, this.U = i, this.Re = o || this.Re, this.Te = { id: "", type: N.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.Re.retryDelay && (this.Se = this.Re.retryDelay);
}, c.ze = function() {
this.Ee && (this.Ee.destroy(), this.Ee = null);
}, c.Ke = function(a) {
a === void 0 && (a = !0), a && this.U && this.U.onAbort && !this.Ce && this.Oe && this.U.onAbort(this.j, this.Te), this.Ce = !0, this.Ee && this.Ee.abort();
}, c.Ze = function() {
this.Ge(), this.Ue(), this.$e();
}, c.Je = function(a, i, o) {
this.Te.output += i.byteLength, this.U && this.U.onProgress && this.U.onProgress(a, i, o);
}, c.it = function(a, i) {
this.Ze();
var o = this.Te;
this.Qe(a, o), o.total = i ? o.loaded = typeof i == "string" ? i.length || 0 : i.byteLength || 0 : o.loaded, o.tload = Math.max(o.tfirst, performance.now()), this.Oe = !1, o.output = 0, this.J.i(kt, "[" + this.Be + "]end size: " + o.total + " duration: " + o.trequest + "-" + o.tload), this.U && this.U.onEnd(a, i, o);
}, c.Ye = function() {
var a = this;
this.$e(), this.Fe = performance.now();
var i = this.Re.transmissionTimeout || 0;
i && (this.xe = setInterval(function() {
performance.now() - a.Fe > i && a.Ve(D.LOADER_TRANS_TIMEOUT);
}, 1e3));
}, c.$e = function() {
this.xe && (clearInterval(this.xe), this.xe = void 0);
}, c.Ge = function() {
this.Le && (clearTimeout(this.Le), this.Le = void 0);
}, c.Ue = function() {
this.Ne && (clearTimeout(this.Ne), this.Ne = void 0);
}, c.He = function(a) {
if (a.rangeEnd || a.rangeStart)
if (a.rangeType && a.rangeType !== I.STANDARD && typeof a.url == "string") {
var i = new wt.a(a.url, !0);
a.rangeEnd ? (i.query.start = (a.rangeStart || 0).toString(), i.query.end = (a.rangeEnd - 1).toString()) : a.rangeStart && (i.query.start = a.rangeStart.toString()), a.url = i.toString();
} else
a.rangeEnd ? a.range = "bytes=" + (a.rangeStart || 0) + "-" + (a.rangeEnd - 1) : a.rangeStart && (a.range = "bytes=" + a.rangeStart + "-");
}, c.Qe = function(a, i) {
if (!i.contentTotalLength || !i.contentLength) {
var o = a.responseHeader;
if (o) {
if (a.range || typeof a.rangeStart == "number") {
var u = o["content-range"];
u && (i.contentTotalLength = parseInt((Array.isArray(u) ? u[0] || "0" : u).split("/")[1] || "0") || 0);
}
var f = o["content-length"];
f && (i.contentLength = parseInt(Array.isArray(f) ? f[0] || "0" : f) || 0);
}
}
}, h()(n, [{ key: "context", get: function() {
return this.j;
} }, { key: "config", get: function() {
return this.Re;
} }]);
}();
Hn.qe = void 0;
var Wt = { local: 0, server: 0 }, Ui = "live-time", Tt = function(n) {
function c(i) {
var o;
return (o = n.call(this) || this).J = void 0, o.tn = { abst: 0, originDTS: 0 }, o.en = void 0, o.nn = void 0, c.J = o.J = i, i.i(Ui, "constructor"), c.rn = { onError: c.An, onEnd: c.un }, c.an = { connectionTimeout: 5e3 }, o;
}
E()(c, n), c.load = function(i, o) {
c.hn();
var u = { url: "https://ntp.nc.gifshow.com/", responseType: "text", progress: !1, preferNative: o };
(c.Ee = new Hn(i)).load(u, c.rn, c.an);
};
var a = c.prototype;
return a.ntpSync = function(i) {
this.J.i(Ui, "sync. state:", c.cn);
var o = performance.now();
(c.cn === "suspend" || o - c.fn > 18e5) && (this.J.i(Ui, "sync start."), c.fn = o, c.cn = "loading", c.load(this.J, i));
}, a.onPrivNal = function(i) {
var o = this;
i.info.forEach(function(u) {
typeof u.abst == "number" && typeof i.streamTimestamp == "number" && (o.tn.abst = u.abst / 1e3, o.tn.originDTS = i.streamTimestamp / 1e3);
});
}, a.onParsing = function(i) {
var o = this;
i.segments.forEach(function(u) {
u.type === G.VIDEO ? o.en = { dts: u.startDTS, originDTS: u.originFirstDTS, parseTime: u.firstParseTime } : u.type === G.AUDIO && (o.nn = { dts: u.startDTS, originDTS: u.originFirstDTS, parseTime: u.firstParseTime });
});
}, a.destroy = function() {
c.hn();
}, a.getDisplayDelay = function(i) {
return this.vn(i, this.en);
}, a.getAudioRenderDelay = function(i) {
return this.vn(i, this.nn);
}, a.getRecDelay = function() {
var i = this.en;
if (this.serverNowMs && i != null && i.parseTime) {
var o = this.tn, u = this.serverMs(1e3 * i.parseTime + c.dn);
if (u && o.originDTS && o.abst)
return Math.round(u - 1e3 * (i.originDTS - o.originDTS + o.abst));
}
return 0;
}, a.serverMs = function(i) {
return Wt.server ? i - Wt.local + Wt.server : null;
}, a.vn = function(i, o) {
var u = this.serverNowMs, f = this.tn;
return u && o && f.abst && f.originDTS ? Math.round(1e3 * (o.dts - i - (o.originDTS - f.originDTS + f.abst)) + u) : 0;
}, c.hn = function() {
c.Ee && c.Ee.destroy();
}, h()(c, [{ key: "syncState", get: function() {
return c.cn;
} }, { key: "time", get: function() {
return l()({}, Wt);
} }, { key: "now", get: function() {
return this.serverNowMs || Date.now();
} }, { key: "serverNowMs", get: function() {
return Wt.server ? performance.now() - Wt.local + Wt.server : null;
} }], [{ key: "workerTimeOffset", set: function(i) {
c.dn = i;
} }]);
}(R);
Pi = Tt, Tt.dn = 0, Tt.Ee = void 0, Tt.rn = void 0, Tt.an = void 0, Tt.cn = "suspend", Tt.J = void 0, Tt.fn = void 0, Tt.An = function() {
Pi.J.i(Ui, "ntp sync load error."), Pi.hn();
}, Tt.un = function(n, c) {
if (Pi.hn(), typeof c == "string") {
Wt.local = performance.now();
var a = c.split(",");
a.length > 1 && (Wt.server = 1e3 * parseFloat(a[0]) + parseInt(a[1], 10) / 1e3 / 2);
}
};
var Vn = Tt, Gn = function() {
function n() {
this.ln = 0, this.pn = [], this.mn = [], this.yn = {}, this.Mn = {}, this.wn = void 0, this.bn = 0, this.gn = 0, this.kn = 0, this._n = 0, this.En = 0, this.Rn = 0, this.Dn = 0;
}
var c = n.prototype;
return c.onStreamOpen = function(a, i, o, u) {
if (this.pn.length > 10) {
var f = this.pn.shift();
if (f) {
this.yn[f.vCodecType] = (this.yn[f.vCodecType] || 0) + f.traffic;
var T = f.qualityType || "unknown";
this.Mn[T] = (this.Mn[T] || 0) + f.traffic;
}
}
var S = this.wn ? this.wn.index + 1 : 0;
this.wn = { index: S, startPos: a, url: i, bitrate: o, qualityType: u, traffic: 0, loadTimeCost: 0, keyFrame: 0, videoDataRate: 0, audioDataRate: 0, speed: 0, vCodecType: v.unknown, segments: [] }, this.pn.push(this.wn);
}, c.onMediaInfo = function(a) {
var i = this.pn[this.pn.length - 1];
i && (a.videoCodecType && (i.vCodecType = a.videoCodecType), i.mediaInfo = l()({}, a));
}, c.setRTCStats = function(a) {
var i = this.wn;
i && (i.traffic = a.totalReceive, i.audioDataRate = a.audioDataRate, i.videoDataRate = a.videoDataRate, i.speed = a.speed, i.keyFrame = a.key, this.ln = i.traffic);
}, c.onDataReceive = function(a) {
this.ln += a.byteLength;
var i = this.mn;
i.length > 200 && i.pop(), i.unshift(a);
var o = this.wn;
o && (o.traffic += a.byteLength, o.loadTimeCost += a.timeCost, o.speed = Math.round(o.traffic / o.loadTimeCost * 1e3) || 0);
}, c.onParsing = function(a) {
var i = this;
a.segments.forEach(function(o) {
if (i.Tn(o.type, 1e3 * (o.endDTS - o.startDTS), o.payload.byteLength), o.type === G.VIDEO) {
var u = o.endDTS - o.startDTS;
isNaN(u) || (i.kn += Math.round(1e3 * u)), o.fillDuration && (i.En += Math.round(1e3 * o.fillDuration)), o.droppedDuration && (i.Dn += Math.round(1e3 * o.droppedDuration));
}
if (o.type === G.AUDIO) {
var f = o.endDTS - o.startDTS;
isNaN(f) || (i.gn += Math.round(1e3 * f)), o.fillDuration && (i._n += Math.round(1e3 * o.fillDuration)), o.droppedDuration && (i.Rn += Math.round(1e3 * o.droppedDuration));
}
});
}, c.onRaw = function(a) {
if (a.samples.length) {
var i = a.samples.reduce(function(u, f) {
return f.yuv ? u + f.yuv.y.bytes.length + f.yuv.u.bytes.length + f.yuv.v.bytes.length : u + f.units.reduce(function(T, S) {
return T + S.data.byteLength;
}, 0);
}, 0), o = a.samples[a.samples.length - 1].dts - a.samples[0].dts + (a.samples[a.samples.length - 1].duration || 0);
this.Tn(G.VIDEO, o / 90, i);
}
}, c.downloadInfoByRange = function(a) {
a === void 0 && (a = 1e3);
var i = { size: 0, timeCost: 0 };
if (this.mn.length)
for (var o = performance.now(), u = 0; u < this.mn.length; u++) {
var f = this.mn[u];
if (!(f && f.ts > o - a))
break;
i.size += f.byteLength, i.timeCost += f.timeCost;
}
return i;
}, c.Tn = function(a, i, o) {
var u = this.pn[this.pn.length - 1];
if (u) {
var f = u.segments;
f.push({ type: a, duration: i, byteLength: o }), f.length > 200 && f.shift();
for (var T = 0, S = 0, V = 0; V < f.length; V++) {
var W = f[V];
W && W.type === a && (S += W.byteLength, T += W.duration);
}
T > 0 && (a === G.VIDEO ? u.videoDataRate = Math.round(8 * S / T) : a === G.AUDIO && (u.audioDataRate = Math.round(8 * S / T)));
}
}, h()(n, [{ key: "smoothedDownloadSpeed", get: function() {
var a = this.mn, i = a[0];
return i && !i.progress ? i.byteLength / i.timeCost * 1e3 : 1e3 * a.reduceRight(function(o, u) {
var f = u.byteLength / u.timeCost;
return o > 0 ? f * (1 - 0.9) + 0.9 * o : f;
}, 0);
} }, { key: "trafficGroupedByVCodecType", get: function() {
var a = l()({}, this.yn);
return a.total = this.ln, this.pn.forEach(function(i) {
a[i.vCodecType] = (a[i.vCodecType] || 0) + i.traffic;
}), a;
} }, { key: "trafficGroupedByLevel", get: function() {
var a = l()({}, this.Mn);
return a.total = this.ln, this.pn.forEach(function(i) {
var o = i.qualityType || "unknown";
a[o] = (a[o] || 0) + i.traffic;
}), a;
} }, { key: "traffic", get: function() {
return this.ln;
} }, { key: "speed", get: function() {
var a = this.wn, i = this.downloadInfoByRange();
return this.mn.length ? i.timeCost ? Math.round(i.size / i.timeCost * 1e3) : 0 : (a == null ? void 0 : a.speed) || 0;
} }, { key: "currentLoad", get: function() {
return this.wn;
} }, { key: "streams", get: function() {
return this.pn;
} }, { key: "contentLen", get: function() {
return this.bn;
}, set: function(a) {
this.bn = a;
} }, { key: "muxA", get: function() {
return this.gn;
} }, { key: "muxV", get: function() {
return this.kn;
} }, { key: "fillA", get: function() {
return this._n;
} }, { key: "fillV", get: function() {
return this.En;
} }, { key: "droppedA", get: function() {
return this.Rn;
} }, { key: "droppedV", get: function() {
return this.Dn;
} }]);
}(), Bi = r(5), Jl = function(n) {
return n.WIDEVINE = "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed", n;
}({});
!ct() && window.navigator && window.navigator.requestMediaKeySystemAccess && window.navigator.requestMediaKeySystemAccess.bind(window.navigator);
function Wn(n) {
return !n.drmSchemaId || n.drmSchemaId === Jl.WIDEVINE;
}
var zl = new RegExp('codecs="((/w|.)+)"'), Tr = [{ k: "video/mp4", v: g.mp4 }, { k: "video/quicktime", v: g.mp4 }, { k: "video/x-flv", v: g.flv }, { k: "video/webm", v: g.matroska }, { k: "video/x-matroska", v: g.matroska }, { k: "video/mp2t", v: g.ts }, { k: "audio/x-matroska", v: g.matroska }, { k: "audio/mp4", v: g.mp4 }, { k: "audio/mpeg", v: g.mp3 }, { k: "audio/aac", v: g.aac }, { k: "application/vnd.apple.mpegurl", v: g.hls }, { k: "application/x-mpegurl", v: g.hls }, { k: "audio/wave", v: g.wav }, { k: "audio/wav", v: g.wav }, { k: "audio/x-wav", v: g.wav }, { k: "audio/x-pn-wav", v: g.wav }];
function jn(n) {
for (var c = { type: n, box: g.unknown, vCodec: v.unknown }, a = 0; a < Tr.length; a++)
if (n.toLocaleLowerCase().indexOf(Tr[a].k) === 0) {
c.box = Tr[a].v;
var i = n.match(zl);
i && i.length > 2 && i[1].split(",").forEach(function(o) {
o.indexOf("avc1") === 0 ? c.vCodec = v.h264 : o.indexOf("av01") === 0 ? c.vCodec = v.av1 : o.indexOf("hev1") !== 0 && o.indexOf("hvc1") !== 0 || (c.vCodec = v.hevc);
});
break;
}
return c;
}
var gi = function() {
function n(c) {
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 = v.unknown, this.meta = void 0, this.fileName = void 0, this.fileSize = void 0, this.dropVideo = [], this.url = [c], this.urlId = 0;
}
return n.prototype.getKLevel = function() {
return { width: this.width, height: this.height, qualityLabel: this.qualityLabel, qualityType: this.qualityType, bitrate: this.bitrate, maxBitrate: this.maxBitrate };
}, h()(n, [{ key: "currentUrl", get: function() {
return this.url[this.urlId] || "";
} }]);
}(), Kn = function() {
function n() {
}
return n.verify = function(c) {
return !!(c && Object.prototype.hasOwnProperty.call(c, "version") && Object.prototype.hasOwnProperty.call(c, "adaptationSet") && Object.prototype.hasOwnProperty.call(c.adaptationSet, "representation") && Array.isArray(c.adaptationSet.representation) && c.adaptationSet.representation.length > 0) && c.adaptationSet.representation.reduce(function(a, i) {
return !!(a && i.url && i.bitrate && i.qualityType);
}, !0);
}, n.parse = function(c) {
var a, i = [];
return n.verify(c) && c.adaptationSet.representation.forEach(function(o, u) {
var f = new gi(o.url);
f.id = o.id || u, f.maxBitrate = o.bitrate || 0, f.bitrate = o.averageBitrate || f.maxBitrate, f.qualityType = o.qualityType || "", f.qualityLabel = o.name || "", f.codec = o.codec || "", f.hidden = o.hidden || !1, f.enableAdaptive = o.enableAdaptive === void 0 || !!o.enableAdaptive, f.default = o.defaultSelect || !1, f.index = u, i.push(f), f.default && a === void 0 && (a = u);
}), { levels: i, def: a || 0, srcType: L.KWAI_FLV_ABR };
}, n;
}(), $l = function() {
return h()(function(n, c) {
this.Sn = null, this.baseuri = void 0, this.reluri = void 0, this.method = null, this.key = null, this.iv = void 0, this.baseuri = n, this.reluri = c;
}, [{ key: "uri", get: function() {
return !this.Sn && this.reluri && (this.Sn = Object(Bi.buildAbsoluteURL)(this.baseuri, this.reluri, { alwaysNormalize: !0 })), this.Sn;
} }]);
}(), Jn = function(n) {
return n.AUDIO = "audio", n.VIDEO = "video", n;
}({}), zn = function() {
function n() {
var a;
this.On = "", this.Cn = null, this.Ln = null, this.xn = ((a = {})[Jn.AUDIO] = !1, a[Jn.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 c = n.prototype;
return c.setByteRange = function(a, i) {
var o = a.split("@", 2), u = [];
o.length === 1 ? u[0] = i ? i.byteRangeEndOffset : 0 : u[0] = parseInt(o[1], 10), u[1] = parseInt(o[0], 10) + u[0], this.Cn = u;
}, c.addElementaryStream = function(a) {
this.xn[a] = !0;
}, c.hasElementaryStream = function(a) {
return this.xn[a] === !0;
}, c.createInitializationVector = function(a) {
for (var i = new Uint8Array(16), o = 12; o < 16; o++)
i[o] = a >> 8 * (15 - o) & 255;
return i;
}, c.setDecryptDataFromLevelKey = function(a, i) {
var o = a;
return a && a.method && a.uri && !a.iv && ((o = new $l(a.baseuri, a.reluri)).method = a.method, o.iv = this.createInitializationVector(i)), o;
}, h()(n, [{ key: "url", get: function() {
return !this.On && this.relurl && (this.On = Object(Bi.buildAbsoluteURL)(this.baseurl, this.relurl, { alwaysNormalize: !0 })), this.On;
}, set: function(a) {
this.On = a;
} }, { key: "byteRange", get: function() {
return this.Cn ? this.Cn : [];
} }, { key: "byteRangeStartOffset", get: function() {
return this.byteRange[0];
} }, { key: "byteRangeEndOffset", get: function() {
return this.byteRange[1];
} }, { key: "decryptdata", get: function() {
if (!this.levelkey && !this.Ln)
return null;
if (!this.Ln && this.levelkey) {
var a = this.sn;
typeof a != "number" && (a = 0), this.Ln = this.setDecryptDataFromLevelKey(this.levelkey, a);
}
return this.Ln;
} }, { 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);
} }]);
}(), Fi = function(n) {
function c(i) {
var o;
return (o = n.call(this, i) || this).startSN = 0, o.endSN = 0, o.fragments = [], o.initSegment = null, o.live = !0, o.needSidxRanges = !1, o.startTimeOffset = null, o.targetduration = 0, o.totalduration = 0, o.type = null, o.version = null, o.ptsKnown = !1, o.m3u8Slice = void 0, o.audioGroupIds = void 0, o.attrs = void 0, o.averagetargetduration = void 0, o.name = void 0, o.lang = void 0, o.groupId = "", o.instreamId = "", o.autoselect = void 0, o.forced = void 0, o.size = 0, o.partOfData = !1, o.http416 = 0, o;
}
E()(c, n);
var a = c.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(i, o) {
if (o === void 0 && (o = !1), i.fragments.length) {
var u = this.endSN;
if (this.endSN = i.endSN, i.partOfData || (i.initSegment && !this.initSegment && (this.initSegment = i.initSegment), this.live = i.live, this.needSidxRanges = i.needSidxRanges, this.targetduration = i.targetduration, this.ptsKnown = i.ptsKnown, this.averagetargetduration = i.averagetargetduration, this.hasFrag || (this.m3u8Slice = i.m3u8Slice, this.audioGroupIds = i.audioGroupIds, this.attrs = i.attrs, this.name = i.name, this.lang = i.lang, this.groupId = i.groupId, this.instreamId = i.instreamId, this.autoselect = i.autoselect, this.forced = i.forced)), o && this.fragments.length) {
for (var f, T = i.fragments.length, S = 0; S < i.fragments.length; S++) {
var V = i.fragments[S].sn;
if (typeof V == "number" && V > u) {
T = S;
break;
}
}
if (this.fragments.length && i.fragments.splice(0, T), i.partOfData) {
var W = this.fragments[this.fragments.length - 1], $ = W.endPTS, te = W.cc;
$ && i.fragments.forEach(function(be) {
be.start = be.startPTS = $, be.endPTS = be.startPTS + be.duration, $ = be.endPTS, be.cc = te + be.cc;
});
}
(f = this.fragments).push.apply(f, i.fragments), this.totalduration = this.fragments.reduce(function(be, ie) {
return be + ie.duration;
}, 0), i.partOfData ? this.size += i.size : this.size = i.size;
} else
this.startSN = i.startSN, this.fragments = i.fragments, this.totalduration = i.totalduration, this.size = i.size;
}
}, a.getTimeInfoAfter = function(i) {
i === void 0 && (i = 0);
var o, u, f = [], T = [];
return this.fragments.forEach(function(S) {
typeof S.sn == "number" && (S.sn >= i && typeof u == "number" && u !== S.cc && (o ? o.push({ sn: S.sn, start: S.start }) : o = [{ sn: S.sn, start: S.start }]), u = S.cc, S.sn >= i && (f.push(S.start), typeof S.programDateTime == "number" && T.push(S.programDateTime)));
}), { live: this.live, startSn: this.startSN, endSn: this.endSN, duration: this.totalduration, times: f, utcs: T, discontinuity: o, targetduration: this.targetduration };
}, h()(c, [{ 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;
} }]);
}(gi), $n = function() {
function n() {
}
return n.verify = function(c) {
return !!(c && Object.prototype.hasOwnProperty.call(c, "segments") && Array.isArray(c.segments) && c.segments.length > 0) && (c.segments.forEach(function(a) {
if (!a.url || !a.duration || !a.time)
return !1;
}), !0);
}, n.parse = function(c, a) {
a === void 0 && (a = "");
var i = [], o = { levels: i, withCredentials: !1, hasVideo: !0, hasAudio: !0 };
if (n.verify(c)) {
var u = new Fi("");
i.push(u);
var f = c;
o.withCredentials = !!f.withCredentials, f.hasAudio !== void 0 && (o.hasAudio = !!f.hasAudio), f.hasVideo !== void 0 && (o.hasVideo = !!f.hasVideo);
var T = 0, S = 0, V = 0, W = 0, $ = 0;
f.segments.forEach(function(te, be) {
var ie = new zn();
ie.sn = be, typeof te.startUtcTime == "string" ? ie.programDateTime = parseInt(te.startUtcTime) : typeof te.startUtcTime == "number" && (ie.programDateTime = te.startUtcTime), typeof te.duration == "string" ? ie.duration = (parseFloat(te.duration) || 0) / 1e3 : ie.duration = (te.duration || 0) / 1e3, ie.start = T, ie.baseurl = a, ie.relurl = te.url, te.filesize && ($ += te.filesize), ie.duration > W && (W = ie.duration), T += ie.duration, be > 0 && V !== te.periodId && (ie.tagList.push(["DIS"]), S++), ie.cc = S, V = te.periodId, u.fragments.push(ie);
}), u.bitrate = 8 * $ / 1024 / u.totalduration, u.live = !1, u.type = P.MAIN, u.startSN = 0, u.endSN = u.fragments.length - 1, u.totalduration = T, u.targetduration = W, u.averagetargetduration = T / u.fragments.length;
}
return o;
}, n;
}(), qn = function() {
function n() {
}
return n.verify = function(c) {
return !!(c && c.adaptationSet && c.adaptationSet.representation && c.adaptationSet.representation.length) && c.adaptationSet.representation.reduce(function(a, i) {
return !!(i.url && i.bandwidth && a);
}, !0);
}, n.parse = function(c) {
var a = [];
return n.verify(c) && c.adaptationSet.representation.forEach(function(i) {
if (i && (i.url || i.m3u8)) {
var o = new Fi(i.baseUrl ? Object(Bi.buildAbsoluteURL)(i.baseUrl, i.url, { alwaysNormalize: !0 }) : i.url);
o.bitrate = Math.floor(i.bandwidth / 1e3), o.maxBitrate = Math.floor(i.bandwidth / 1e3), o.qualityType = i.qualityType || "", o.qualityLabel = i.qualityLabel || "", i.width && i.height && (o.width = i.width, o.height = i.height), Ml(i.codecs || "", o), o.audioCodec = "", o.m3u8Slice = i.m3u8 || i.m3u8Slice, o.totalduration = i.duration, i.backupUrl && i.backupUrl.length && (o.url = o.url.concat(i.backupUrl)), o.default = i.defaultSelect || !1, o.urlId = 0, a.push(o);
}
}), { levels: a, def: 0 };
}, n;
}(), ql = function(n) {
return n[n.LongVideo = 1] = "LongVideo", n[n.ShortVideo = 2] = "ShortVideo", n[n.LiveGame = 3] = "LiveGame", n[n.LiveShow = 4] = "LiveShow", n[n.LivePlayBack = 5] = "LivePlayBack", n;
}({}), Yl = { 1: g.hls_ts, 2: g.mp4, 3: g.flv, 4: g.hls_fmp4 }, Yn = { avc: v.h264, hevc: v.hevc, av1: v.av1, kvc3: v.kvc3, kvc4: v.kvc4, kvc5: v.kvc5, kvc6: v.kvc6, kvc30: v.kvc30 };
function Qn(n) {
var c = g.unknown;
if (n && n.length < 2048)
for (var a = n.split(`
`), i = 0; i < a.length; i++) {
var o = a[i].trim();
o && o.indexOf("#") !== 0 && (c = Xe(o));
}
return c === g.ts ? g.hls_ts : c === g.mp4 ? g.hls_fmp4 : g.unknown;
}
var Rr, Zn = function() {
function n() {
}
return n.verify = function(c) {
return !!(c && c.adaptationSet && c.adaptationSet.length) && c.adaptationSet.reduce(function(a, i) {
return !!(a && i.representation && i.representation.length);
}, !0);
}, n.parse = function(c, a) {
a === void 0 && (a = !1);
var i, o, u, f, T, S, V, W, $, te = [], be = !1, ie = 0, Te = [], Re = {};
if (n.verify(c)) {
var ve = c;
S = Yl[ve.mediaType], V = ve.stereoType === 1 ? Q.V360 : Q.Normal, ve.businessType !== void 0 && (W = ve.businessType >= 3 && ve.businessType <= 5), ve.businessType === ql.LivePlayBack && ($ = !0), ve.version && (Re.version = ve.version), ve.videoId && (Re.videoId = ve.videoId), ve.videoBaseFeature && (Re.videoBaseFeature = ve.videoBaseFeature), ve.videoAestheticFeature && (Re.videoAestheticFeature = ve.videoAestheticFeature), ve.videoFeature && (Re.videoFeature = ve.videoFeature), typeof ve.programStartTime == "number" && (Re.programStartTime = ve.programStartTime), ve.adaptationSet.forEach(function(Ye) {
var Dt = Ye.duration / 1e3;
W === void 0 && Dt && (W = !1), !ie && Dt && (ie = Dt);
var Au = Ye.drmSchemaId, vu = Ye.drmToken;
Ye.drmSchemaId && (be = !0);
var gt = P.MAIN;
if (Ye.mimeType && (Ye.mimeType.indexOf("video") !== -1 ? Re.videoMimeType = Ye.mimeType : Ye.mimeType.indexOf("audio") !== -1 ? (Re.audioMimeType = Ye.mimeType, gt = P.AUDIO) : Ye.mimeType === "text/vtt" ? (Re.subtitleMimeType = Ye.mimeType, gt = P.SUBTITLE) : gt = void 0), gt) {
gt === P.MAIN ? Re.videoDuration = Ye.duration : gt === P.AUDIO && (Re.audioDuration = Ye.duration);
var Mr = Ye.representation.map(function(xe, bi) {
var ke;
if (!S && xe.m3u8Slice && (S = Qn(xe.m3u8Slice)), S || (S = Xe(xe.url)), he(S) ? ((ke = new Fi(xe.url)).lang = Ye.language || "", ke.default = !!xe.defaultSelect, ke.id = xe.id || bi, ke.m3u8Slice = xe.m3u8Slice, ke.totalduration = Dt || ie) : ke = new gi(xe.url), typeof xe.fileSize == "number" && (ke.fileSize = xe.fileSize), ke.vCodecType = v.unknown, ke.hdr = xe.hdrType || 0, ke.maxBitrate = xe.maxBitrate || 0, ke.bitrate = xe.avgBitrate || ke.maxBitrate, ke.qualityType = xe.qualityType || "", ke.qualityLabel = xe.qualityLabel || "", ke.codec = xe.codecs || "", ke.codec) {
var _u = xn(ke.codec);
ke.videoCodec = _u.video || "", ke.vCodecType = Cn(ke.videoCodec);
}
return xe.videoCodec && Yn[xe.videoCodec] && (ke.vCodecType = Yn[xe.videoCodec] || v.unknown), Te.push(ke.vCodecType), ve.adaptationSet.length === 1 && (ke.audioCodec = ""), xe.width && xe.height && (ke.width = xe.width, ke.height = xe.height), ke.hidden = xe.hidden || !1, ke.enableAdaptive = xe.disableAdaptive === void 0 || !xe.disableAdaptive, ke.default = xe.defaultSelect || !1, ke.index = bi, ke.drmSchemaId = xe.drmSchemaId || Au, ke.drmToken = xe.drmToken || vu, ke.drmSchemaId && (be = !0), xe.backupUrl && xe.backupUrl.length && (ke.url = ke.url.concat(xe.backupUrl)), ke.urlId = 0, ke.default && u === void 0 && (gt === P.MAIN ? u = bi : gt === P.AUDIO ? f = bi : gt === P.SUBTITLE && (T = bi)), (xe.comment || xe.kvqScore) && (ke.meta = { comment: xe.comment, kvqScore: xe.kvqScore }), ke;
});
gt === P.MAIN ? te = te.concat(Mr) : gt === P.AUDIO ? (i || (i = []), i = i.concat(Mr)) : gt === P.SUBTITLE && (o || (o = []), o = o.concat(Mr));
}
});
}
if (o && n.processingSubtitleType(o, ie), a)
return [{ codecType: Te.length === 1 ? Te[0] : v.unknown, mediaLevels: { levels: te, def: u || 0, audioTracks: i, defAudio: f || 0, subtitleTracks: o, defSubtitle: T || 0, drm: be, box: S, stereoType: V, isLive: W, meta: Re } }];
var Ne = {};
te.forEach(function(Ye) {
var Dt = Ne[Ye.vCodecType];
Dt || (Ne[Ye.vCodecType] = Dt = { def: 0, levels: [] }), Ye.default && (Dt.def = Dt.levels.length), Dt.levels.push(Ye);
});
var qe = Object.keys(Ne).length, st = [];
for (var yi in Ne) {
var Ct = Ne[yi];
if (Ct) {
var Or = Ct.levels[0];
if (qe > 1 && Or && Or.m3u8Slice) {
var Eo = Qn(Or.m3u8Slice);
he(Eo) && (S = Eo);
}
st.push({ codecType: yi, mediaLevels: { levels: Ct.levels, def: Ct.def, audioTracks: i, defAudio: f || 0, subtitleTracks: o, defSubtitle: T || 0, drm: be, box: S, stereoType: V, isLive: W, isLiveShift: $, meta: Re } });
}
}
return st;
}, n.processingSubtitleType = function(c, a) {
c.forEach(function(i, o) {
if (Xe(i.currentUrl) === g.hls) {
i.live = !1, i.index = o, i.totalduration = a, i.targetduration = a, i.endSN = 1;
var u = new zn();
u.type = P.SUBTITLE, u.start = 0, u.sn = 1, u.level = o, u.cc = 0, u.url = i.currentUrl, u.duration = a, i.fragments = [u];
}
});
}, n.getAdaptationIdxByType = function(c, a) {
for (var i = 0; i < c.adaptationSet.length; i++) {
var o = c.adaptationSet[i];
if (o) {
var u;
if (o.mimeType === void 0)
return a === "video" ? 0 : -1;
if (((u = o.mimeType) == null ? void 0 : u.indexOf(a)) === 0)
return i;
}
}
return -1;
}, n;
}(), Xn = new RegExp("^((http|https)://)|blob:"), Ql = [g.matroska, g.mp3, g.aac], Zl = [g.flv, g.raw, g.webrtc, g.ivf], Xl = [g.mp4, g.flv, g.hls, g.raw, g.hls_fmp4, g.hls_ts, g.ts, g.ivf], eo = Object.values(v), Ce = "media-src", to = function() {
function n() {
}
return n.verifyMix = function(c) {
var a = 0;
for (var i in c)
eo.indexOf(i) !== -1 && a++;
return a > 0;
}, n.isSrcEmpty = function(c) {
try {
if (typeof c == "string") {
if (!(c = c.trim()))
return !0;
if (!Xn.test(c))
return Object.keys(JSON.parse(c)).length === 0;
} else if (!(c instanceof Blob))
return !c || Object.keys(c).length === 0;
} catch (a) {
}
return !1;
}, n.filteringLevels = function(c, a, i) {
i === void 0 && (i = !1), c.i(Ce, "filteringLevels. input: " + a.levels.length + ". mse: " + _e.isMSEAvailable() + " mixCodec: " + i);
var o = ee.chrome || ee.firefox;
a.levels.forEach(function(T) {
o && T.audioCodec && T.audioCodec.indexOf("mp4a.40.34") !== -1 && (T.audioCodec = "");
});
var u = _e.isMSEAvailable() ? _e.isMSECodecStrSupportedInMp4 : _e.isVideoCodecStrSupportedInMp4, f = _e.isMSEAvailable() ? _e.isMSECodecSupported : _e.isVideoCodecSupported;
return a.levels = a.levels.filter(function(T) {
var S = !T.audioCodec || u(T.audioCodec, "audio"), V = typeof T.hdr == "number" && T.hdr > 0, W = !0;
(i || T.vCodecType === v.av1 || ee.mobile) && ((W = T.videoCodec ? u(T.videoCodec) : T.vCodecType === v.unknown || f(T.vCodecType, _e.getPlayTestDefinition(T), V)) || c.i(Ce, "filteringLevels. " + T.qualityType + " v unsupported. codec: " + T.vCodecType + " hdr: " + V), T.qualityType.toLocaleLowerCase().indexOf("4k") >= 0 && (ee.mobile && (W = !1), W || c.i(Ce, "filteringLevels. " + T.qualityType + " v unsupported. mobile: " + ee.mobile)));
var $ = Wn(T);
return $ || c.i(Ce, "filteringLevels. " + T.qualityType + " v unsupported. drm: " + T.drmSchemaId), S && W && $;
}), a.audioTracks && (a.audioTracks = a.audioTracks.filter(function(T) {
var S = !T.audioCodec || u(T.audioCodec, "audio");
S || c.i(Ce, "filteringLevels. " + T.qualityType + " a unsupported. codec: " + T.audioCodec);
var V = Wn(T);
return V || c.i(Ce, "filteringLevels. " + T.qualityType + " a unsupported. drm: " + T.drmSchemaId), S && V;
}), a.audioTracks.forEach(function(T) {
o && T.audioCodec && T.audioCodec.indexOf("mp4a.40.34") !== -1 && (T.audioCodec = "");
})), n.initLevelsDefault(c, a), a;
}, n.initLevelsDefault = function(c, a) {
return c.i(Ce, "init level default"), a.def = -1, a.levels.forEach(function(i, o) {
i.index = o, i.default && (a.def = o);
}), a.def < 0 && (a.def = a.levels.reduce(function(i, o, u) {
return o.bitrate < a.levels[i].bitrate ? u : i;
}, 0), c.i(Ce, "no default main level, select lowest bit rate idx: " + a.def)), c.i(Ce, "audio level default: " + a.def), a.audioTracks && a.audioTracks.length && (a.defAudio = void 0, a.audioTracks.forEach(function(i, o) {
i.index = o, i.default && (a.defAudio = o);
}), a.defAudio === void 0 && (a.defAudio = 0), c.i(Ce, "audio level default: " + a.defAudio)), a.subtitleTracks && a.subtitleTracks.length && (a.subtitleTracks.forEach(function(i, o) {
i.index = o, i.default && (a.defSubtitle = o);
}), a.defSubtitle === void 0 && (a.defSubtitle = 0), c.i(Ce, "subtitle level default: " + a.defSubtitle)), a;
}, n.preParse = function(c, a, i, o, u) {
if (u === void 0 && (u = ""), c.i(Ce, "pre parse. native: " + i + ", codecType: " + o + ", baseUrl: " + u), typeof a == "string") {
var f = this.Nn(c, a);
if (!f)
return [{ src: a, box: g.unknown, srcType: L.OTHERS }];
a = f;
} else
a instanceof Blob || (a = JSON.parse(JSON.stringify(a)));
if (Array.isArray(a)) {
c.i(Ce, "input mix container.", a.length);
var T = [], S = [];
a.forEach(function($) {
if ($ != null && $.src) {
var te = { info: n.In(c, $.src, i, o, u), priority: 0, mime: void 0 };
T.push(te.info.box), $.type && (te.mime = jn($.type)), S.push(te);
}
});
for (var V = 0; V < S.length; V++) {
var W = S[V];
if (W.info && W.info.src) {
if (W.mime && (W.mime.box !== g.unknown && (W.info.box = W.mime.box), W.mime.vCodec !== v.unknown && (W.info.codecType = W.mime.vCodec)), i !== void 0 && i !== W.info.nativeFirst || W.priority++, W.info.nativeFirst)
W.priority += W.info.box === g.unknown ? 1 : _e.isVideoBoxSupported(W.info.box) ? 2 : -100, W.priority += W.info.codecType === v.unknown ? 1 : o && o === W.info.codecType || _e.isVideoCodecSupported(W.info.codecType) ? 2 : -100;
else {
if (!_e.isMSEAvailable())
continue;
W.priority += W.info.box === g.unknown ? 1 : Xl.indexOf(W.info.box) >= 0 ? 2 : -100, W.priority += W.info.codecType === v.unknown ? 1 : o && o === W.info.codecType || _e.isMSECodecSupported(W.info.codecType) ? 2 : -100;
}
c.i(Ce, "input mix container. media desc " + V + ". box: " + W.info.box + " codec: " + W.info.codecType + " priority: " + W.priority);
}
}
return S.sort(function($, te) {
return te.priority - $.priority;
}).filter(function($) {
return $.priority > 0;
}).map(function($) {
return $.info;
});
}
return [n.In(c, a, i, o, u)];
}, n.In = function(c, a, i, o, u) {
if (u === void 0 && (u = ""), c.i(Ce, "parse media desc. native: " + i + " codecType: " + o), typeof a == "string") {
var f = this.Nn(c, a);
if (!f)
return { src: a, box: g.unknown, srcType: L.OTHERS };
a = f;
}
var T, S = _e.isMSEAvailable();
if (n.verifyMix(a)) {
c.i(Ce, "input mix codec.", Object.keys(a));
var V = a, W = [];
for (var $ in V) {
var te = $;
if (eo.indexOf(te) !== -1) {
var be = V[te];
if (typeof be == "string" && (be = be.trim()), !be) {
c.i(Ce, $ + " src is empty.");
continue;
}
var ie = this.Fn(c, be, u, te, !0), Te = Array.isArray(ie) ? this.Bn(ie, te) || ie[0] : ie;
if (!Te)
continue;
Te.codecType = te, W.push(Te);
}
}
T = this.jn(c, W, i, o);
} else {
var Re = this.Fn(c, a, u);
Array.isArray(Re) ? Re.length > 1 ? (c.i(Ce, "input aas v2 mix codec."), T = this.jn(c, Re, i, o)) : Re.length === 1 && ((T = Re[0]).nativeFirst = this.Un(c, T.box, S, i)) : (T = Re).nativeFirst = this.Un(c, T.box, S, i);
}
return T || (T = { src: a, box: g.unknown, srcType: L.OTHERS }), T;
}, n.jn = function(c, a, i, o) {
var u, f, T = this, S = {}, V = {}, W = [], $ = _e.isMSEAvailable();
a.forEach(function(ve) {
var Ne = ve.codecType;
if (Ne)
if (ve.nativeFirst = T.Un(c, ve.box, $, i), W.push(Ne), $ && !ve.nativeFirst) {
var qe = _e.getVideoCodecCompatibilityByCodec(Ne);
V[Ne] = qe.decoder, Ne === v.h264 && (qe.decoder = b.buildin, qe.smooth = !0), qe.smooth && qe.decoder === b.buildin && ve.mediaLevels && (ve.compatibility = qe, S[Ne] = ve);
} else {
var st = _e.isVideoCodecSupported(Ne);
V[Ne] = st ? b.buildin : b.unsupported, (Ne === v.h264 || st) && (ve.compatibility = { decoder: b.buildin, smooth: !0, mix: !1 }, S[Ne] = ve);
}
});
var te, be, ie = (u = S[v.hevc]) != null && u.mediaLevels && S[v.hevc].mediaLevels.levels.length ? S[v.hevc] : void 0, Te = (f = S[v.av1]) != null && f.mediaLevels && S[v.av1].mediaLevels.levels.length ? S[v.av1] : void 0, Re = S[v.h264];
return c.i(Ce, "input vcodec. hevc: " + !!ie + " av1: " + !!Te + " h264: " + !!Re), o && S[o] && (te = S[o], c.i(Ce, "selected the specified codec: " + o)), te || ((te = Te || ie || Re) && (te.nativeFirst = this.Un(c, te.box, $, i)), c.i(Ce, "selected src: " + ((be = te) == null ? void 0 : be.codecType), te)), te && (W.length && (te.mixCodecInput = W), te.mixCodecAvailable = V), te;
}, n.Bn = function(c, a) {
for (var i = 0; i < c.length; i++)
if (c[i].codecType === a)
return c[i];
}, n.Un = function(c, a, i, o) {
if (!i || Ql.indexOf(a) !== -1)
return c.i(Ce, "get native first true. box: " + a + " mse: " + i), !0;
if (Zl.indexOf(a) !== -1 || !_e.isVideoBoxSupported(a))
return c.i(Ce, "get native first false. box: " + a), !1;
if (!ee.mobile) {
if (o) {
var u = _e.isVideoBoxSupported(a), f = !!u;
return c.i(Ce, "get native first pc " + f + ". box: " + a + " nativeFirstParams: true video box supported: " + u), f;
}
if (o === void 0) {
var T = _e.isMSEAvailable(), S = !T;
return c.i(Ce, "get native first pc " + S + ". box: " + a + " nativeFirstParams: undefined mse supported: " + T), S;
}
return c.i(Ce, "get native first pc false. nativeFirstParams: false"), !1;
}
if (a === g.mp4 || a === g.hls || a === g.hls_ts || a === g.ts) {
if (o === void 0 || o) {
var V = _e.isVideoBoxSupported(a), W = !!V;
return c.i(Ce, "get native first mobile " + W + ". box: " + a + " nativeFirstParams: " + o + " video box supported: " + V), W;
}
return c.i(Ce, "get native first mobile false. nativeFirstParams: " + o), !1;
}
if (a === g.hls_fmp4) {
if (o === void 0 || o) {
var $ = _e.isVideoBoxSupported(a), te = !(!$ || !ee.x5 && !ee.xweb);
return c.i(Ce, "get native first mobile " + te + ". box: " + a + " nativeFirstParams: " + o + " video box supported: " + $ + " x5: " + ee.x5 + " xweb: " + ee.xweb), te;
}
return c.i(Ce, "get native first mobile false. nativeFirstParams: " + o), !1;
}
}, n.Fn = function(c, a, i, o, u) {
var f = this;
i === void 0 && (i = ""), o === void 0 && (o = v.unknown), u === void 0 && (u = !1);
var T = { src: a, box: g.unknown, srcType: L.OTHERS };
if (typeof a == "string") {
var S = new gi(a);
S.vCodecType = o, T.box = Xe(a), T.mediaLevels = { levels: [S], def: 0 }, T.isLive = this.Pn(T.box);
} else if (a instanceof Blob) {
var V = "unknow";
a instanceof File ? (T.box = Xe(a.name), V = a.name) : T.box = jn(a.type).box;
var W = he(T.box) ? new Fi(URL.createObjectURL(a)) : new gi(URL.createObjectURL(a));
W.vCodecType = o, W.fileName = V, T.mediaLevels = { levels: [W], def: 0 }, T.srcType = L.FILE, T.isLive = !1;
} else {
if (Zn.verify(a)) {
var $ = Zn.parse(a);
return c.i(Ce, "kwai manifest"), $.map(function(ie) {
var Te, Re;
c.i(Ce, "kwai manifest codec: " + ie.codecType + " meta:", ie.mediaLevels.meta), n.Vn(ie.mediaLevels.levels, o);
var ve = { meta: ie.mediaLevels.meta, mediaLevels: n.filteringLevels(c, ie.mediaLevels, u || $.length > 1), src: a, box: ie.mediaLevels.box || Xe(((Te = ie.mediaLevels.levels[0]) == null ? void 0 : Te.url[0]) || ""), srcType: L.KWAI, isLive: f.Pn(T.box), isLiveShift: ie.mediaLevels.isLiveShift, codecType: ie.codecType };
return typeof ((Re = ve.mediaLevels) == null ? void 0 : Re.isLive) == "boolean" && (ve.isLive = ve.mediaLevels.isLive), he(ve.box) && (ve.multipart = !0), ve;
});
}
if (Kn.verify(a)) {
c.i(Ce, "flv abr manifest", o);
var te = Kn.parse(a);
n.Vn(te.levels, o), T.mediaLevels = n.filteringLevels(c, te, u), T.box = g.flv, T.isLive = !0, T.srcType = L.KWAI_FLV_ABR;
} else if ($n.verify(a)) {
c.i(Ce, "flv multipart");
var be = $n.parse(a, i);
T.mediaLevels = l()({ def: 0 }, be), n.Vn(T.mediaLevels.levels, o), T.box = g.flv, T.isLive = !1, T.multipart = !0, T.srcType = L.KWAI_FLV_MP;
} else
qn.verify(a) && (T.mediaLevels = n.filteringLevels(c, qn.parse(a), u), T.box = g.hls, T.srcType = L.KWAI);
}
return he(T.box) && (T.multipart = !0), T;
}, n.Vn = function(c, a) {
a === void 0 && (a = v.unknown), c.forEach(function(i) {
i.vCodecType === v.unknown && a !== v.unknown && (i.vCodecType = a);
});
}, n.Pn = function(c) {
var a;
return [g.flv, g.hls, g.unknown, g.ivf, g.yuv].indexOf(c) === -1 && (a = !1), c === g.webrtc && (a = !0), a;
}, n.Nn = function(c, a) {
var i = a.trim();
if (i) {
if (!Xn.test(i)) {
try {
i = JSON.parse(i);
} catch (o) {
c.i(Ce, "formatStrData error", o);
}
typeof i == "string" && (i = Object(Bi.buildAbsoluteURL)(location.href, i, { alwaysNormalize: !0 }));
}
return i;
}
}, n;
}(), eu = ((Rr = {})[O.FHD] = "data:video/mp4;base64,AAAAHGZ0eXBpc29tAAACAGlzb21pc28ybXA0MQAAA1Btb292AAAAbG12aGQAAAAAAAAAAAAAAAAAAAPoAAADmAABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAACenRyYWsAAABcdGtoZAAAAAMAAAAAAAAAAAAAAAEAAAAAAAADmAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAHgAAABDgAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAA5gAAXcAAAEAAAAAAfJtZGlhAAAAIG1kaGQAAAAAAAAAAAAAAAAAEk+AABJPgFXEAAAAAAAhaGRscgAAAAAAAAAAdmlkZQAAAAAAAAAAAAAAAAAAAAGpbWluZgAAABR2bWhkAAAAAQAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAABaXN0YmwAAAEFc3RzZAAAAAAAAAABAAAA9Wh2YzEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAHgAQ4AEgAAABIAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY//8AAAB7aHZjQwEBYAAAAJAAAAAAAHjwAPz9+PgAAA8DoAABABhAAQwB//8BYAAAAwCQAAADAAADAHiVmAmhAAEALkIBAQFgAAADAJAAAAMAAAMAeKADwIAQ5ZZWaSTK8BagIIBAgAAAAwCAAAADAISiAAEAB0QBwXK0YkAAAAAQcGFzcAAAAAEAAAABAAAAFGJ0cnQAAAAAAAAV+AAAFfgAAAAYc3R0cwAAAAAAAAABAAAAAQAST4AAAAAcc3RzYwAAAAAAAAABAAAAAQAAAAEAAAABAAAAFHN0c3oAAAAAAAACvwAAAAEAAAAUc3RjbwAAAAAAAAABAAADfAAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNjAuMTYuMTAwAAAACGZyZWUAAALHbWRhdAAAABhAAQwB//8BYAAAAwCQAAADAAADAHiVmAkAAAAuQgEBAWAAAAMAkAAAAwAAAwB4oAPAgBDlllZpJMrwFqAggECAAAADAIAAAAMAhAAAAAdEAcFytGJAAAACYigBrxMImujggedddccbbbbbbuZo4//8Qs/H9kAtWJjtrvgCQAzQ8gAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwFbpe9yuAXAHyJgAAADAAADAAADAAADAAADAAADAAADAAADAAFJkwKEKkAAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAZEhwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwPuAAADAAADAAADAAADAAADAAADAAADAAADAAADAAAHpAAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwABzQAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAUMAAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwBsQAAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwGHAAADAAADAAADAAADAAADAAADAAADAAADAAADAtoAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAWMAAADAAADAAADAAADAAADAAADAAADAAADAAAJCAAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAADygAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAABawAAADAAADAAADAAADAAADAAADAAADAAADAAAhYAAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAALeAFwEAAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAUUA=", Rr[O.UHD_4K] = "data:video/mp4;base64,AAAAHGZ0eXBpc29tAAACAGlzb21pc28ybXA0MQAAA1Ftb292AAAAbG12aGQAAAAAAAAAAAAAAAAAAAPoAAADmAABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAACe3RyYWsAAABcdGtoZAAAAAMAAAAAAAAAAAAAAAEAAAAAAAADmAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAPAAAACHAAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAA5gAAXcAAAEAAAAAAfNtZGlhAAAAIG1kaGQAAAAAAAAAAAAAAAAAEk+AABJPgFXEAAAAAAAhaGRscgAAAAAAAAAAdmlkZQAAAAAAAAAAAAAAAAAAAAGqbWluZgAAABR2bWhkAAAAAQAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAABanN0YmwAAAEGc3RzZAAAAAAAAAABAAAA9mh2YzEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAPAAhwAEgAAABIAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY//8AAAB8aHZjQwEBYAAAAJAAAAAAAJbwAPz9+PgAAA8DoAABABhAAQwB//8BYAAAAwCQAAADAAADAJaVmAmhAAEAL0IBAQFgAAADAJAAAAMAAAMAlqAB4CACHFllZpJMrwFqAggECAAAAwAIAAADAAhAogABAAdEAcFytGJAAAAAEHBhc3AAAAABAAAAAQAAABRidHJ0AAAAAAAAQGgAAEBoAAAAGHN0dHMAAAAAAAAAAQAAAAEAEk+AAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAABRzdHN6AAAAAAAACA0AAAABAAAAFHN0Y28AAAAAAAAAAQAAA30AAABidWR0YQAAAFptZXRhAAAAAAAAACFoZGxyAAAAAAAAAABtZGlyYXBwbAAAAAAAAAAAAAAAAC1pbHN0AAAAJal0b28AAAAdZGF0YQAAAAEAAAAATGF2ZjYwLjE2LjEwMAAAAAhmcmVlAAAIFW1kYXQAAAAYQAEMAf//AWAAAAMAkAAAAwAAAwCWlZgJAAAAL0IBAQFgAAADAJAAAAMAAAMAlqAB4CACHFllZpJMrwFqAggECAAAAwAIAAADAAhAAAAAB0QBwXK0YkAAAAevKAGvEwRHlP3jty4cOG7Zs2bNmzZs2bNWrVq1atWrVq1atWvmaOP//ELPx/ZALViY7a74AkAM0PIAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAX8Cl73K4BcAfImAAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAIWAkwKEKkAAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMDMocAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMCkgAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAABgwAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAasAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAFZAAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAg4AAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMCJgAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAABFQAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAkIAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAAPqAAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAHJAAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAACugAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAABDQAAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAX8AAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAIqAAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAADAAC2gAAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAAAwAA54AAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAASkAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAXUAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAdMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAhYAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAmoAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAq4AAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAvoAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAA04AAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAA5IAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAA84AAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAA+oAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMABCwAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMABEwAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMABHQAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAAAMAgIA=", Rr), io = "kwai-kernel-hevc", It = "playback-hevc-test", ro = function() {
function n(a) {
var i = this;
this.J = void 0, this.Ii = new br(), this.Hn = void 0, this.Wn = [O.FHD, O.UHD_4K], this.Gn = 0, this.Qn = void 0, this.Yn = function() {
var o, u;
i.J.i(It, "on video event. " + ((o = n.Jn) == null ? void 0 : o.videoWidth) + " " + ((u = n.Jn) == null ? void 0 : u.error)), i.Qn ? (i.Qn[i.Wn[i.Gn]] = !!n.Jn && n.Jn.videoWidth > 0 && !n.Jn.error, i.Gn++, i.Gn < i.Wn.length ? (i.Zn(), i.zn(i.Wn[i.Gn])) : i.Kn()) : i.Kn();
}, this.J = a;
}
var c = n.prototype;
return c.init = function(a) {
if (this.J.i(It, "init"), a > 0) {
var i = this.Ii.read(io, a);
this.J.i(It, "load from ls", i);
try {
i !== void 0 && Object.prototype.hasOwnProperty.call(i, O.FHD) && Object.prototype.hasOwnProperty.call(i, O.UHD_4K) && (_e.playHEVCTest = i, this.Qn = _e.playHEVCTest);
} catch (o) {
this.J.i(It, "load ls error");
}
}
}, c.start = function() {
var a;
this.J.i(It, "start");
var i = this.Qn !== void 0 || n.Jn;
this.J.i(It, "start. tested: " + i), i || (a = n.Jn) != null && a.src || this.qn();
}, c.destroy = function() {
this.Ze(), this.Zn();
}, c.Kn = function() {
this.J.i(It, "complete result:", this.Qn, performance.now()), this.Ze(), this.Zn(), _e.playHEVCTest = this.Qn, this.Ii.write(io, this.Qn);
}, c.qn = function() {
var a;
this.J.i(It, "start video test"), ct() ? this.Kn() : (this.Xn(), this.Qn = ((a = {})[O.FHD] = !1, a[O.UHD_4K] = !1, a), this.Gn = 0, this.zn(this.Wn[0]));
}, c.zn = function(a) {
this.J.i(It, "test: " + a), n.Jn || (n.Jn = document.createElement("video")), n.Jn.preload = "metadata", n.Jn.addEventListener("error", this.Yn), n.Jn.addEventListener("loadeddata", this.Yn), n.Jn.addEventListener("loadedmetadata", this.Yn), n.Jn.src = eu[a], n.Jn.play().catch(function() {
});
}, c.Zn = function() {
n.Jn && (n.Jn.removeEventListener("error", this.Yn), n.Jn.removeEventListener("loadeddata", this.Yn), n.Jn.removeEventListener("loadedmetadata", this.Yn), n.Jn.src = "");
}, c.Xn = function() {
var a = this;
this.Ze(), this.Hn = setTimeout(function() {
a.J.i(It, "timeout"), a.Kn();
}, 1e3);
}, c.Ze = function() {
this.Hn && (clearTimeout(this.Hn), this.Hn = void 0);
}, n;
}();
ro.Jn = void 0;
var tu = ro, iu = r(9), ru = r.n(iu), Ke = "av-ctx", no = function(n) {
function c(i, o) {
var u;
return (u = n.call(this) || this).video = void 0, u.mse = void 0, u.stat = new Gl(), u.loadRec = void 0, u.lctx = void 0, u.$n = [], u.tr = 0, u.ir = 0, u.er = void 0, u.Re = void 0, u.nr = !1, u.rr = !1, u.Ar = void 0, u.sr = void 0, u.ur = new Wl(), u.ar = void 0, u.hr = void 0, u._ = void 0, u.J = void 0, u.ot = void 0, u.cr = void 0, u.vr = void 0, u.dr = void 0, u._ = wr.next(), u.J = new mi.Logger().setName("kwai-k").setId(u._), u.ot = new jl(), u.video = o, u.sr = new Vn(u.J), u.hr = new tu(u.J), u.lctx = new Fn(u.J, !0), u.cr = new bl(u), u.vr = new Fl(u), u.dr = new Ul(u), u.lr(ce.processConfig(i)), u.sr && u.F.push(u.sr), u.F.push(u.hr, u.cr, u.vr, u.dr), u;
}
E()(c, n);
var a = c.prototype;
return a.destroy = function() {
var i;
this.logger.i(Ke, "destroy"), (i = this.stat.muxWorker) == null || i.terminate(), this.pr(), this.mr(), this.ot.removeAllListeners(), n.prototype.destroy.call(this);
}, a.updateVideoPlaybackQuality = function(i, o) {
this.stat.videoPlaybackQuality ? (this.stat.videoPlaybackQuality.droppedVideoFrames = o, this.stat.videoPlaybackQuality.totalVideoFrames = i) : this.stat.videoPlaybackQuality = { corruptedVideoFrames: 0, creationTime: 0, droppedVideoFrames: o, totalVideoFrames: i };
}, a.isTimeinBuffered = function(i) {
if (this.video) {
for (var o = this.video.buffered, u = 0; u < o.length; u++)
if (i >= o.start(u) && i < o.end(u))
return !0;
}
return !1;
}, a.currentBuffer = function(i) {
if (this.video)
for (var o = this.video.buffered, u = 0; u < o.length; u++) {
var f = o.start(u), T = o.end(u);
if (f <= i && i < T)
return { start: f, end: T };
}
}, a.nextBuffer = function(i) {
if (this.video)
for (var o = this.video.buffered, u = 0; u < o.length; u++) {
var f = o.start(u), T = o.end(u);
if (f > i)
return { start: f, end: T };
}
}, a.getLiveShiftKwai2OffsetUTC = function(i) {
return this.stat.liveStartTime + i;
}, a.getLiveShiftKwai2Duration = function() {
return (this.sr.now - this.stat.liveStartTime) / 1e3;
}, a.getKwai2LiveShiftReloadInterval = function() {
var i = this.lctx.current;
if (i) {
if (i.fragments.length > 1 && typeof this.stat.liveShiftOffset == "number") {
var o = i.fragments[i.fragments.length - 2];
return Math.max((i.averagetargetduration || i.targetduration) * Vt, (this.stat.liveShiftOffsetAligned || this.stat.liveShiftOffset) + o.start * Vt - this.currentTime * Vt) / this.playbackRate;
}
return (i.averagetargetduration || i.targetduration) * Vt / this.playbackRate;
}
return 1e4 / this.playbackRate;
}, a.getKwai2LiveShiftUrl = function(i) {
var o = this.lctx.current, u = wt()(i, !0), f = this.stat.liveShiftKwai2Params;
if (this.sr) {
if (f.paramName === "seqId") {
var T = o.fragments[o.fragments.length - 1], S = f.seqId || (T == null ? void 0 : T.sn);
if (typeof S == "number")
return u.query.seqID = S.toString(), u.toString();
}
return f.time = Math.round(this.getLiveShiftKwai2OffsetUTC(this.stat.liveShiftOffset || 0)), u.query.startTime = f.time.toString(), u.toString();
}
return u.toString();
}, a.getLiveDelay = function() {
var i = this.stat, o = this.Re, u = 10;
if (i.multipart) {
var f = this.lctx.current;
u = (f == null ? void 0 : f.averagetargetduration) || (f == null ? void 0 : f.targetduration) || u;
}
return i.box === g.flv ? -this.Re.defaultSpts : he(i.box) ? this.isLiveShift ? o.liveShiftDelaySec * Vt : u * Vt * (o.liveDelayFragNum || 1) : -this.Re.defaultSpts;
}, a.initLiveShiftKwai2StartSec = function() {
if (this.isLiveShiftKwai2) {
var i = this.stat.startFromSec >= 0 ? this.stat.startFromSec : this.liveLocalTime;
this.J.i(Ke, "init liveshift kwai2 start from sec: " + i + " startFromSec: " + this.stat.startFromSec + " live: " + this.liveLocalTime + " duration: " + this.getLiveShiftKwai2Duration()), i > 0 && (this.stat.startFromSec = i, this.stat.liveShiftOffset = 1e3 * i, this.stat.liveShiftOffsetAligned = void 0, this.updateLiveShiftStatuByTime(i));
}
}, a.getRemuxConfig = function() {
var i = this.Re, o = { isLive: this.stat.isLive, logLevel: i.logLevel, enableSoftwareAES: i.enableSoftwareAES, gopRemux: this.stat.gopRemux, preferDecoder: i.preferDecoder, streamingMux: this.streamingMux, ensureVideo: i.ensureVideo, maxAudioFramesDrift: i.maxAudioFramesDrift, forceKeyFrameOnDiscontinuity: i.forceKeyFrameOnDiscontinuity, wasmDecoderEnabled: i.wasmDecoderEnabled, enableAacPriv: i.enableAacPriv, audioEnabled: i.audioEnabled, videoEnabled: i.videoEnabled, mseDecErrSkip: i.mseDecErrSkip, adjustFragTime: i.adjustFragTime };
return this.video instanceof HTMLAudioElement && (this.J.i(Ke, "HTMLAudioElement. set videoEnabled false."), o.videoEnabled = !1), o.preferDecoder = void 0, o;
}, a.getDecConfig = function() {
var i = this.Re;
return { logLevel: i.logLevel, videoDropFramePolicy: i.videoDropFramePolicy, videoFrameBufferSize: i.videoFrameBufferSize, videoDecBlockPolicy: i.videoDecBlockPolicy, maxVideoDecThreads: i.maxVideoDecThreads, mainThreadRendering: i.mainThreadRendering, mainThreadDecoding: i.mainThreadDecoding, preferCanvasType: i.preferCanvasType, preferCanvasColorSpace: i.preferCanvasColorSpace };
}, a.setSrc = function(i, o) {
this.logger.i(Ke, "set src", i), i && (this.jt(), this.resetStreamingEnabled(), this.ar = void 0, this.loadRec = new Gn()), this.yr(i, o);
}, a.reProcessSrc = function(i, o) {
this.logger.i(Ke, "reprocess src. codecType: " + i + " native: " + o + ", has origin src: " + !!this.er), this.er && this.Mr(this.er, i, o);
}, a.updateLiveShiftStatuByTime = function(i) {
var o;
if (this.isLiveShift && (i === void 0 && (i = (o = this.video) == null ? void 0 : o.currentTime), this.lctx.current && typeof i == "number" && Number.isFinite(i))) {
var u = this.liveLocalTime;
u > 0 && (this.stat.liveShiftActive = !!(u && i < u - 5), this.J.i(Ke, "update live shift statu by time. type: " + this.stat.liveShiftType + " " + this.stat.liveShiftActive + ", time: " + i + " ed: " + u));
}
}, a.resetStreamingEnabled = function() {
var i = this.Re;
this.nr = this.rr = !(!i.streamingMux || !ce.isStreamingSupported() || ee.msie || ee.safari && (this.stat.isLive === !1 || this.stat.multipart) || ee.msedge && ee.version.major < 88 && (this.stat.isLive === !1 || this.stat.multipart)), this.logger.i(Ke, "resetStreamingEnabled: " + this.nr);
}, a.resetGopRemux = function() {
this.stat.multipart && !this.nr ? this.stat.gopRemux = !1 : this.stat.gopRemux = !!(ee.safari || ee.opera && ee.version.major < 37), this.logger.i(Ke, "resetGopRemux: " + this.stat.gopRemux);
}, a.hasNextMediaDesc = function() {
return this.tr + 1 < this.$n.length;
}, a.nextMediaDesc = function() {
if (this.hasNextMediaDesc()) {
this.tr++;
var i = this.$n[this.tr];
if (i)
return this.J.i(Ke, "next media desc."), this.wr(i), !0;
}
return !1;
}, a.lr = function(i) {
if (this.Re = i, !i.logLevel) {
var o = mi.Logger.loadLogLevel("kwai-kernel-log");
i.logLevel = o || mi.DEFAULT_LOG_LEVEL;
}
var u;
if (i.logger && this.J.setOutput(i.logger), this.J.setLevel(i.logLevel), this.J.getLevel() !== mi.LogLevel.NONE && (u = c.version, ee.msie || console.log("%c kwai-player-kernel %c " + u + " %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(Ke, "logger init."), this.logger.i(Ke, "set config"), this.hr.init(this.Re.playbackAbilityCacheTimeout), this.resetStreamingEnabled(), this.logger.i(Ke, "browser", JSON.stringify(ee)), ct() || this.logger.i(Ke, "ua", navigator.userAgent), this.jt(), this.ar = void 0, this.stat.startFromSec = i.startFromSec >= 0 ? i.startFromSec : typeof i.startFrom == "number" && i.startFrom >= 0 ? i.startFrom / 1e3 : -1, this.stat.webWorker = i.webWorker && !!tt.a, typeof i.preferNativeLoader == "boolean" && (this.stat.preferNativeLoader = i.preferNativeLoader), this.Re.autoPlaybackRateConf)
this.logger.i(Ke, "use config.autoPlaybackRateConf", this.Re.autoPlaybackRateConf), this.stat.autoPlaybackRateConf = this.Re.autoPlaybackRateConf;
else {
var f = -Math.floor(this.Re.defaultSpts / Vt);
this.stat.autoPlaybackRateConf = function(T, S, V) {
V === void 0 && (V = 3);
var W = { startDelay: 0, interval: 0.6, rule: [] };
return Nn(T, S, V, W), W;
}(this.J, f), this.logger.i(Ke, "use default autoPlaybackRateConf", this.stat.autoPlaybackRateConf), this.J.i(Ke, "get by delay: " + f);
}
try {
this.stat.webWorker && (this.stat.muxWorker = ru()(3)), Vn.workerTimeOffset = performance.now(), this.logger.i(Ke, "init mux worker");
} catch (T) {
}
i.lazyLoadMaxDuration > 0 && i.lazyLoadRecoverDuration > 0 && i.lazyLoadMaxDuration >= i.lazyLoadRecoverDuration && (this.stat.lazyLoadMaxDuration = i.lazyLoadMaxDuration, this.stat.lazyLoadRecoverDuration = i.lazyLoadRecoverDuration), this.loadRec = new Gn(), i.src && this.yr(i.src);
}, a.jt = function() {
this.logger.i(Ke, "reset stat");
var i = this.Re, o = this.stat;
this.rr = this.nr;
var u = o.preferNativeLoader;
o.reset(), this.resetGopRemux(), this.vr.reset(), this.cr.reset(), o.isLive = i.isLive, o.native = i.nativeFirst, o.liveShiftType = this.Re.liveShiftType, o.preferNativeLoader = u, this.stat = o;
}, a.yr = function(i, o) {
this.tr = 0, this.ir = Date.now(), this.Mr(i, o);
}, a.Mr = function(i, o, u) {
this.J.i(Ke, "process src. codec: " + o + " native: " + u), i && (this.er = i);
var f = this.config;
this.$n = to.preParse(this.J, i, typeof u == "boolean" ? u : f.nativeFirst, o, f.baseURL);
var T = this.$n[this.tr];
T && this.wr(T);
}, a.wr = function(i) {
var o, u, f, T, S, V, W = this.config, $ = this.stat;
(o = this.Ar) == null || o.reset(), this.stat.srcType === L.FILE && this.pr();
var te, be, ie = this.lctx = new Fn(this.J, W.adaptive);
if ($.codecType = i.codecType ? i.codecType : v.unknown, $.box = W.box || i.box || g.unknown, $.srcType = i.srcType, $.mixContainerInput = i.mixContainerInput, $.mixCodecInput = i.mixCodecInput, $.mixCodecAvailable = i.mixCodecAvailable, $.multipart = i.multipart, $.stereoType = (u = i.mediaLevels) == null ? void 0 : u.stereoType, (f = i.mediaLevels) != null && f.meta && ($.srcMeta = (te = i.mediaLevels) == null ? void 0 : te.meta, this.liveTime && typeof i.mediaLevels.meta.programStartTime == "number" && (this.stat.liveStartTime = i.mediaLevels.meta.programStartTime)), W.liveDelayFragNum && W.liveDelayFragNum > 0 && $.multipart && !W.autoPlaybackRateConf) {
var Te = this.getLiveDelay();
Nn(this.J, Te / 1e3, 10, $.autoPlaybackRateConf), this.J.i(Ke, "update by delay: " + Te + ".", W);
}
i.nativeFirst !== void 0 && ($.native = i.nativeFirst), typeof i.isLive == "boolean" && ($.isLive = i.isLive), i.isLiveShift === !0 && ($.liveShiftType = de.KWAI2), typeof ((T = i.mediaLevels) == null ? void 0 : T.isLive) == "boolean" && ($.isLive = i.mediaLevels.isLive), ie.hasAudio = (S = i.mediaLevels) == null ? void 0 : S.hasAudio, ie.hasVideo = (V = i.mediaLevels) == null ? void 0 : V.hasVideo, !i.mediaLevels || i.srcType === L.OTHERS && he($.box) && !$.native || (this.J.i(Ke, "src. get levels from src."), $.drm = i.mediaLevels.drm, this.lctx.levels = i.mediaLevels.levels, this.lctx.default = this.lctx.currentIdx = i.mediaLevels.def, i.mediaLevels.audioTracks && (this.lctx.audioTracks = i.mediaLevels.audioTracks, this.lctx.audioIdx = i.mediaLevels.defAudio || 0), i.mediaLevels.subtitleTracks && (this.lctx.subtitleTracks = i.mediaLevels.subtitleTracks, this.lctx.subtitleIdx = i.mediaLevels.defSubtitle || 0)), this.lctx.default = function(Re) {
if (!ee.mobile || Re.levels.length <= 1 || Re.levels[0].vCodecType !== v.hevc)
return Re.default;
var ve, Ne;
if (Re.levels.forEach(function(st, yi) {
if (st.width && st.height) {
var Ct = Math.min(st.width, st.height);
Ct > 720 ? Ne = Ne && Ct > Ne.minWH ? Ne : { idx: yi, minWH: Ct } : ve = ve && ve.minWH > Ct ? ve : { idx: yi, minWH: Ct };
}
}), !ve || !Ne)
return Re.default;
if (ee.android)
return parseFloat(ee.platformVersion || "") >= 10 ? Ne.idx : ve.idx;
if (ee.iphone) {
var qe = Pn();
return qe === "unknown" ? typeof window < "u" && window.screen && (window.screen.width > 400 || window.devicePixelRatio > 2) ? Ne.idx : ve.idx : [rt.SERIES_1, rt.SERIES_2, rt.SERIES_3, rt.SERIES_4, rt.SERIES_8].indexOf(qe) === -1 ? Ne.idx : ve.idx;
}
return Re.default;
}(this.lctx), this.config.ntp && this.stat.isLive !== !1 && this.stat.box === g.flv && ((be = this.sr) == null || be.ntpSync(this.stat.preferNativeLoader)), this.resetStreamingEnabled(), this.resetGopRemux(), this.logger.i(Ke, "use media desc complete. box: " + $.box + " live: " + $.isLive + " native: " + $.native + " mobile: " + !!ee.mobile + " gopRemux: " + $.gopRemux + " streamingMux: " + this.streamingMux + " liveShift: " + $.liveShiftType + " mixCodec: " + $.mixCodecInput + " levelCnt: " + ie.levels.length + " hasVideo: " + ie.hasVideo + " hasAudio: " + ie.hasAudio);
}, a.pr = function() {
this.lctx && this.lctx.levels.forEach(function(i) {
i.url.forEach(function(o) {
o.indexOf("blob:") === 0 && URL.revokeObjectURL(o);
});
});
}, a.mr = function() {
this.Ar && (this.Ar.destroy(), this.Ar = void 0);
}, h()(c, [{ key: "isLiveShiftKwai2", get: function() {
return this.stat.liveShiftType === de.KWAI2;
} }, { key: "isLiveShift", get: function() {
return this.stat.liveShiftType !== de.NONE;
} }, { key: "logger", get: function() {
return this.J;
} }, { key: "id", get: function() {
return this._;
} }, { 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 i = this.lctx.current;
if (this.isLiveShift) {
var o, u, f = Number.isFinite((o = this.video) == null ? void 0 : o.duration) ? (u = this.video) == null ? void 0 : u.duration : this.isLiveShiftKwai2 ? this.getLiveShiftKwai2Duration() : (i == null ? void 0 : i.totalduration) || 0;
if (f)
return f - (this.getLiveDelay() / Vt + 0.1);
} else if (i && i.totalduration)
return i.totalduration - (this.getLiveDelay() / Vt + 0.1);
return 0;
} }, { key: "yuvParams", get: function() {
return this.ar;
} }, { key: "canCodecFallback", get: function() {
return !(!this.stat.mixCodecInput || this.stat.codecType === v.h264 || this.stat.mixCodecInput.indexOf(v.h264) === -1 || this.stat.decoder !== b.buildin);
} }, { key: "fps", get: function() {
return this.ur;
} }, { key: "liveTime", get: function() {
return this.sr;
} }, { key: "cOutput", get: function() {
if (tt.a)
return this.Ar || (this.Ar = new tt.a(this.J, this.Re)), this.Ar;
} }, { key: "isAbrAvailable", get: function() {
return this.Re.adaptive && this.lctx.levels.length > 1 && !this.isSwitchLevelByReload && !this.isLiveShift;
} }, { key: "isSwitchLevelByReload", get: function() {
return !(this.stat.box === g.flv && this.stat.isLive !== !1 && !ee.firefox && this.Re.videoEnabled !== !1 || he(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.Re;
} }, { key: "src", get: function() {
var i;
return ((i = this.$n[this.tr]) == null ? void 0 : i.src) || "";
} }, { key: "srcUpdateTime", get: function() {
return this.ir;
} }, { key: "originSrc", get: function() {
return this.er;
} }, { 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(i) {
this.logger.i(Ke, "set demuxer type", i);
var o = this.stat;
if (i !== o.demuxerType) {
var u = o.box === void 0 || o.box === g.unknown;
i === He.RAW ? (o.box = g.raw, o.isLive = !1) : i === He.FLV ? (o.box = g.flv, o.multipart && (o.isLive = !1)) : i === He.MP4 || i === He.FMP4 ? (u && (o.box = g.mp4), o.multipart || (o.isLive = !1)) : i === He.TS ? u && (o.box = g.ts) : i === He.IVF && (o.box = g.ivf, o.isLive = !1), o.demuxerType = i, this.resetGopRemux();
}
} }, { key: "streamingMuxEnabled", get: function() {
return this.nr && !(this.src instanceof Blob);
}, set: function(i) {
this.nr = i;
} }, { key: "streamingMux", get: function() {
return this.stat.box === g.flv && this.stat.isLive !== !1 || this.streamingMuxEnabled && this.rr;
}, set: function(i) {
this.rr = i;
} }, { key: "hevcTest", get: function() {
return this.hr;
} }, { key: "evt", get: function() {
return this.ot;
} }, { key: "fallback", get: function() {
return this.cr;
} }, { key: "streamTime", get: function() {
return this.vr;
} }], [{ key: "packName", get: function() {
return "mini_es";
} }, { key: "version", get: function() {
return "3.3.37";
} }, { key: "buildTime", get: function() {
return "Mon Jan 20 2025 18:07:08 GMT+0800 (中国标准时间)";
} }]);
}(R);
no.instanceCount = 0;
var vt = no, Rt = function(n) {
return n.NORMEL = "normal", n.SEEK = "seek", n.END = "end", n.LEVEL_SWITCH = "levelSwitch", n.FIRST_FRAME = "firstFrame", n.LOAD = "load", n.BACKUP = "backup", n;
}({}), Ve = function(n) {
return n.START = "start", n.MANIFEST = "manifest", n.LEVEL = "level", n.STREAM_CONNECTED = "streamConnected", n.DATA = "data", n.DEMUX = "demux", n.SEGMENT = "segment", n.CANPLAY = "canplay", n.LOADEDMETADATA = "loadedmetadata", n.LOADEDDATA = "loadeddata", n.SEEKED = "seeked", n;
}(Ve || {}), oo = [{ event: Ve.START, detailName: "first-loader-open" }, { event: Ve.MANIFEST, detailName: "manifest-duration" }, { event: Ve.LEVEL, detailName: "level-duration" }, { event: Ve.STREAM_CONNECTED, detailName: "stream-connected-duration" }, { event: Ve.DATA, detailName: "first-package-duration" }, { event: Ve.DEMUX, detailName: "first-remux-duration" }, { event: Ve.SEGMENT, detailName: "first-segment-duration" }, { event: Ve.LOADEDMETADATA, detailName: "first-meta-duration" }, { event: [Ve.LOADEDDATA, Ve.CANPLAY, Ve.SEEKED], detailName: "first-frame-duration" }], Sr = "first-frame", nu = function() {
function n(a) {
this.br = 0, this.gr = 0, this.C = void 0, this.kr = 0, this._r = 0, this.Er = {}, this.ut = void 0, this.J = void 0, this.C = oo.slice(0), this.ut = a, this.J = a.logger;
}
var c = n.prototype;
return c.start = function() {
this.J.i(Sr, "start"), this.br = 0, this.kr = performance.now(), this.gr = 0, this.C = oo.slice(0), this._r = 0, this.Er = {}, this.process(Ve.START, this.kr);
}, c.process = function(a, i) {
var o;
if (i === void 0 && (i = 0), this.J.i(Sr, "process type: " + a + " " + i + " complete: " + this.br), this.br)
return !1;
var u = this.C, f = -1;
i = i || performance.now();
for (var T = 0; T < u.length; T++) {
var S = u[T];
if (Array.isArray(S.event)) {
if (S.event.indexOf(a) !== -1) {
f = T;
break;
}
} else if (S.event === a) {
f = T;
break;
}
}
if (f === -1)
return !1;
var V = u.splice(0, f + 1).pop(), W = ((o = this.ut.mse) == null ? void 0 : o.readyState) === "closed";
if ((u.length === 0 || W && a === Ve.SEGMENT) && (this.gr = i - this.kr, this.br = Date.now(), this.J.i(Sr, "complete " + this.gr + " " + this.br)), V) {
var $ = Math.round(i - this._r);
this._r === 0 && ($ = Date.now()), this._r = i, this.Er[V.detailName] = $;
}
return !!this.br;
}, c.onDownloadError = function() {
this.Er.download_retry ? this.Er.download_retry++ : this.Er.download_retry = 1;
}, c.onRetry = function() {
this.Er.retry ? this.Er.retry++ : this.Er.retry = 1;
}, h()(n, [{ key: "complete", get: function() {
return this.br;
} }, { key: "duration", get: function() {
return this.gr;
} }, { key: "details", get: function() {
return this.Er;
} }]);
}(), ao = [/headless/, /spider/, /[a-z0-9]+bot[^a-z0-9]/], xt = function(n) {
return n.none = "", n.probably = "probably", n.maybe = "maybe", n;
}(xt || {}), so = function() {
if (ct())
return xt.none;
if (navigator.webdriver)
return xt.probably;
for (var n = navigator.userAgent.toLowerCase(), c = 0; c < ao.length; c++)
if (ao[c].test(n))
return xt.probably;
if (window.innerWidth <= 0 && window.innerHeight <= 0)
return xt.probably;
if (_e.isMSEAvailable() && !_e.isMSECodecCapabilityNormal())
return xt.maybe;
try {
var a = document.createElement("canvas");
a.width = 4, a.width = 4;
var i = a.getContext("2d");
if (i) {
i.fillStyle = "#FFFFFF", i == null || i.fillRect(0, 0, a.width, a.height);
for (var o = i.getImageData(0, 0, a.width, a.height).data, u = 0; u < o.length; u++)
if (o[u] !== 0)
return xt.none;
return xt.maybe;
}
} catch (f) {
return xt.probably;
}
return xt.none;
}(), Lr, _t = {};
try {
var lo;
(lo = navigator.userAgentData) == null || lo.getHighEntropyValues(["architecture", "bitness", "model", "platform", "platformVersion"]).then(function(n) {
l()(_t, n);
});
} catch (n) {
}
var ou = new Uint8Array(16);
function au() {
if (!Lr && !(Lr = 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 Lr(ou);
}
for (var su = /^(?:[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, lu = function(n) {
return typeof n == "string" && su.test(n);
}, nt = [], kr = 0; kr < 256; ++kr)
nt.push((kr + 256).toString(16).substr(1));
var uu = function(n) {
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, a = (nt[n[c + 0]] + nt[n[c + 1]] + nt[n[c + 2]] + nt[n[c + 3]] + "-" + nt[n[c + 4]] + nt[n[c + 5]] + "-" + nt[n[c + 6]] + nt[n[c + 7]] + "-" + nt[n[c + 8]] + nt[n[c + 9]] + "-" + nt[n[c + 10]] + nt[n[c + 11]] + nt[n[c + 12]] + nt[n[c + 13]] + nt[n[c + 14]] + nt[n[c + 15]]).toLowerCase();
if (!lu(a))
throw TypeError("Stringified UUID is invalid");
return a;
}, Ir, cu = function(n, c, a) {
var i = (n = n || {}).random || (n.rng || au)();
if (i[6] = 15 & i[6] | 64, i[8] = 63 & i[8] | 128, c) {
a = a || 0;
for (var o = 0; o < 16; ++o)
c[a + o] = i[o];
return c;
}
return uu(i);
}, du = (/* @__PURE__ */ new Date()).getTimezoneOffset() / -60;
function xr() {
return Ir || (Ir = { support_mse: _e.isMSEAvailable() ? 1 : 0, support_aac_mse: _e.TYPE_SUPPORTED.aac ? 1 : 0, support_aac: _e.isVideoCodecSupported(v.aac) ? 1 : 0, support_h264_mse: _e.TYPE_SUPPORTED.h264 ? 1 : 0, support_h264: _e.isVideoCodecSupported(v.h264) ? 1 : 0, support_h265_mse: _e.TYPE_SUPPORTED.hevc ? 1 : 0, support_h265: _e.isVideoCodecSupported(v.hevc) ? 1 : 0, support_av1_mse: _e.TYPE_SUPPORTED.av1 ? 1 : 0, support_simd: _e.isSupportSimd ? 1 : 0, support_thread: _e.isSupportThreads ? 1 : 0, support_hw: _e.isSupportHW ? 1 : 0, support_change_type: _e.isChangeTypeSupported() ? 1 : 0, support_streaming: ce.isStreamingSupported() ? 1 : 0, hardware_concurrency: Ni() || 0, wasm_dec_smooth: _e.wasmSmooth ? 1 : 0 }), Ir;
}
function uo(n, c) {
var a, i;
return typeof navigator < "u" && (navigator.webdriver && (a = navigator.webdriver ? 1 : 0), navigator.onLine !== void 0 && (i = navigator.onLine ? 1 : 0)), { session_id: c.sessionId, kernel_version: vt.version, pack_name: vt.packName, creation_time: c.creationTime, time_zone: du, src_update_time: n.srcUpdateTime, load_start_time: c.loadStartTime, instance_count: vt.instanceCount, webdriver: a, on_line: i };
}
function co() {
var n = {};
if (typeof navigator < "u") {
navigator.onLine !== void 0 && (n.network_on_line = navigator.onLine ? 1 : 0);
var c = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
(c == null ? void 0 : c.rtt) !== void 0 && (n.network_rtt = c.rtt), (c == null ? void 0 : c.rtt) !== void 0 && (n.network_downlink = c.downlink), (c == null ? void 0 : c.effectiveType) !== void 0 && (n.network_effective_type = c.effectiveType), (c == null ? void 0 : c.saveData) !== void 0 && (n.network_save_data = c.saveData ? 1 : 0);
}
return n;
}
function ho(n, c) {
var a, i, o, u = (a = n.video) == null ? void 0 : a.duration, f = n.lctx.current, T = (f == null ? void 0 : f.currentUrl) || "", S = l()({ play_url: (f == null ? void 0 : f.fileName) || T, url_id: (f == null ? void 0 : f.urlId) || 0, stream_host: T ? new wt.a(T).host : "", reuse: c.reuse, metadata_time: c.metadataTime, play_start_time: c.playStartTime, playing_start_time: c.playingStartTime, stream_duration: Math.round(1e3 * (u && Number.isFinite(u) ? u : 0)), max_bitrate: (f == null ? void 0 : f.maxBitrate) || 0, codec: c.codecs, play_pos: c.playPos || 0, v_data_rate: Math.round(((i = n.loadRec.currentLoad) == null ? void 0 : i.videoDataRate) || 0), a_data_rate: Math.round(((o = n.loadRec.currentLoad) == null ? void 0 : o.audioDataRate) || 0), drm: n.stat.drm ? 1 : 0, adaptive_multi_rate: n.lctx.abr ? 1 : 0, use_backup: c.useBackup, play_to_end: c.playToEnd, v_decoder: n.stat.decoder, video_codec_type: n.stat.codecType || v.unknown, start_codec: c.startCodec, demuxer: n.stat.demuxerType || He.UNKNOWN, core_type: n.stat.coreType, mms: n.stat.mms ? 1 : 0, box: n.stat.box, kwai_slice: n.stat.isKwaiSlice ? 1 : 0, monkey_patched_fetch: c.monkeyPatchedFetch }, uo(n, c), co(), function($) {
var te = $.video;
return te ? { elem_crossorigin: te.crossOrigin, elem_autoplay: te.autoplay ? 1 : 0, elem_loop: te.loop ? 1 : 0, elem_volume: te.volume, elem_muted: te.muted ? 1 : 0, elem_preload: te.preload, elem_controls: te.controls ? 1 : 0, elem_ready_state: te.readyState, elem_network_state: te.networkState, elem_playback_rate: te.playbackRate, elem_paused: te.paused ? 1 : 0, elem_ended: te.ended ? 1 : 0, elem_seeking: te.seeking ? 1 : 0, elem_tag_name: te.tagName } : {};
}(n));
n.stat.flvAbrNotAligned && (S.flv_abr_not_aligned = 1), typeof _e.playHEVCTest == "boolean" && (S.play_hevc_test = _e.playHEVCTest ? 1 : 0), n.stat.isLive !== void 0 && (S.live = n.stat.isLive ? 1 : 0), S.live_shift_type = n.stat.liveShiftType;
var V = vl((f == null ? void 0 : f.fileName) || T);
n.stat.box === g.flv && n.stat.isLive !== !1 && (S.stream_id = V.streamID), c.httpHeader && (S.response_header = F(c.httpHeader)), f != null && f.bitrate && (S.bitrate = Math.round(f.bitrate)), f != null && f.qualityType && (S.quality_type = f.qualityType), f != null && f.qualityLabel && (S.quality_label = f.qualityLabel), c.startQualityType && (S.start_quality_type = c.startQualityType), V.transcodingTpl && (S.transcoding_template = V.transcodingTpl), V.filename && (S.filename = V.filename), typeof navigator < "u" && navigator.deviceMemory && (S.device_memory = navigator.deviceMemory);
var W = gr();
return W.renderer && (S.gpu_renderer = W.renderer), so && (S.bot = so), c.canvasCtxType && (S.canvas_ctx = c.canvasCtxType), n.stat.wasmDecoder && (S.wasm_dec = n.stat.wasmDecoder, S.wasm_dec_simd = n.stat.wasmSimd ? 1 : 0, S.wasm_dec_threads = n.stat.wasmThreads || 0), S;
}
function fo(n) {
var c = {};
if (n.metadata)
for (var a in n.metadata) {
if (Object.keys(c).length > 50)
break;
var i = n.metadata[a];
typeof i == "string" ? c[a] = i.substring(0, 50) : typeof i != "number" && typeof i != "boolean" || (c[a] = i);
}
return c;
}
function Cr() {
var n = {};
return _t && (_t.architecture && (n.architecture = _t.architecture), _t.bitness && (n.bitness = _t.bitness), _t.model && (n.model = _t.model), _t.platform && (n.platform = _t.platform), _t.platformVersion && (n.platform_version = _t.platformVersion)), n;
}
function Dr() {
var n = {};
return ee.platformVersion && (n.platform = ee.platform || "", n.platform_version = ee.platformVersion || 0), ee.iphone ? n.model = Pn() : ee.model && (n.model = ee.model), ee.version && (n.browser_name = ee.name || "", n.browser_major = ee.version.major || 0), n;
}
function po() {
var n, c, a, i = {};
return ct() || ((n = window.screen) != null && n.width && (i.screen_w = window.screen.width), (c = window.screen) != null && c.height && (i.screen_h = window.screen.height), (a = window.screen) != null && a.colorDepth && (i.screen_color_depth = window.screen.colorDepth), i.device_pixel_ratio = window.devicePixelRatio || 1), i;
}
function Ao(n) {
var c = {};
return n && (n.fps && (c.fps = Math.round(1e3 * n.fps) / 1e3), n.width && (c.width = n.width), n.height && (c.height = n.height), n.codedWidth && (c.coded_width = n.codedWidth), n.codedHeight && (c.coded_height = n.codedHeight), n.sar && n.sar.width !== n.sar.height && (c.sar = n.sar), n.enhancedFlv && (c.enhanced_flv = n.enhancedFlv ? 1 : 0)), c;
}
function vo(n) {
var c = { src_type: n.stat.srcType };
return n.stat.stereoType && (c.stereo_type = n.stat.stereoType), n.stat.mixCodecInput && n.stat.mixCodecInput.length && (c.mix_codec_input = n.stat.mixCodecInput), n.stat.mixContainerInput && n.stat.mixContainerInput.length && (c.mix_container_input = n.stat.mixContainerInput), n.stat.mixCodecAvailable && (c.mix_codec_available = n.stat.mixCodecAvailable), c;
}
function _o(n) {
var c = {};
return n.stat.srcMeta && (c.src_meta = n.stat.srcMeta), c;
}
function mo(n) {
var c, a, i, o = {};
return (c = n.lctx.current) != null && c.meta && (o.current_level_meta = n.lctx.current.meta, n.lctx.current.meta.comment && n.lctx.current.meta.comment.split("/").forEach(function(u) {
u.indexOf("tt=") === 0 && (o.transcoding_template = u.substring(3)), u.indexOf("ttExplain=") === 0 && (o.transcoding_template_explain = u.substring(10));
})), (a = n.lctx.current) != null && a.fileSize && (o.filesize = (i = n.lctx.current) == null ? void 0 : i.fileSize), o;
}
function go(n) {
var c = performance.now();
return { play: Math.round(n.playDuration + (n.playStartMS ? c - n.playStartMS : 0)), actualPlay: Math.round(n.actualPlayDuration + (n.actualPlayStartMS ? c - n.actualPlayStartMS : 0)), pause: Math.round(n.pauseDuration + (n.pauseStartMS ? c - n.pauseStartMS : 0)), buffer: Math.round(n.bufferTime + (n.bufferingStartMS ? c - n.bufferingStartMS : 0)) };
}
function yo() {
return document.hidden || document.webkitHidden || document.mozHidden || !0;
}
var hu = function() {
function n(a, i) {
this.Rr = void 0, this.ut = void 0, this.Dr = void 0, this.Tr = 1, this.Sr = 0, this.Or = 0, this.Cr = !0, this.Lr = void 0, this.Nr = void 0, this.Ir = 0, this.Fr = 0, this.Br = "", this.jr = new Un(), this.Rr = a, this.ut = i, this.Tr = 1, this.Dr = { 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.Ur();
}
var c = n.prototype;
return c.Pr = function(a, i) {
var o = {};
for (var u in i) {
var f = a[u], T = i[u];
typeof f == "number" && typeof T == "number" && (o[u] = f - T, i[u] = f);
}
return o;
}, c.Ur = function() {
this.Sr = performance.now(), this.Or = Date.now(), this.Nr = void 0, this.Lr = void 0, this.Fr = 0, this.Br = "";
}, c.setFirstScreenDuration = function(a, i, o) {
this.Nr = Math.round(a), this.Lr = i, this.Cr = !0, this.Ir = o;
}, c.setError = function(a, i) {
this.Fr = a, this.Br = i;
}, c.build = function() {
var a, i = this.Rr, o = this.ut, u = this.ut.stat, f = performance.now(), T = Math.round(f - this.Sr), S = this.Pr(i, this.Dr), V = o.mse ? this.Pr((a = o.mse) == null ? void 0 : a.stat, this.Dr) : void 0, W = this.Pr(go(this.Rr), this.Dr), $ = this.Pr(this.ut.loadRec, this.Dr), te = this.ut.loadRec.downloadInfoByRange(T), be = te.timeCost ? Math.round(te.size / te.timeCost * 1e3) : 0, ie = { tick_index: this.Tr, tick_start: this.Or, tick_duration: T, error_code: this.Fr, error_message: this.Br, block_cnt: S.blockCount || 0, render_block_cnt: S.renderBlockCount || 0, decoded_video_frames: S.decodedFrames || 0, dropped_video_frames: (S.droppedFrames || 0) + (S.muxDroppedFrames || 0), segment_cnt: S.segment || 0, play_duration: W.play || 0, buffer_time: W.buffer || 0, actual_play_duration: W.actualPlay || 0, played_video_duration: W.play || 0, traffic: Math.round((($ == null ? void 0 : $.traffic) || 0) / 1024), hidden: yo() ? 1 : 0, download: S.download, download_speed: be, seek_cnt: S.seekCnt, seek_load_cnt: S.seekLoadCnt, pause_duration: W.pause, pause_cnt: S.pauseCnt, on_line_change: S.onLineChange, visibility_change: S.visibilityChange, heartbeat_timeout: S.heartbeatTimeout, load_cnt: S.loadCnt, refresh_cnt: S.refreshCnt, media_buffered_a: i.bufferedEndA, media_buffered_v: i.bufferedEndV };
return l()(ie, xr(), ho(o, i), Dr(), Cr(), function(Te) {
var Re, ve, Ne, qe, st;
return Te.mse ? (qe = Te.mse.bufferedByType(G.VIDEO), st = Te.mse.bufferedByType(G.AUDIO)) : qe = st = Te.mediaBufferedSec, { a_buf_start: Math.round(1e3 * st.start) || 0, a_buf_end: Math.round(1e3 * st.end) || 0, a_buf_len: Math.round(1e3 * Math.max(0, st.end - Te.currentTime)) || 0, a_buf_slices: ((Re = Te.mse) == null ? void 0 : Re.bufferSliceNumByType(G.AUDIO)) || Te.bufferSliceNum || 0, v_buf_start: Math.round(1e3 * qe.start) || 0, v_buf_end: Math.round(1e3 * qe.end) || 0, v_buf_len: Math.round(1e3 * Math.max(0, qe.end - Te.currentTime)) || 0, v_buf_slices: ((ve = Te.mse) == null ? void 0 : ve.bufferSliceNumByType(G.VIDEO)) || Te.bufferSliceNum || 0, buffer_queue_cnt: ((Ne = Te.mse) == null ? void 0 : Ne.pendingNum()) || 0 };
}(o), function(Te) {
if (Te.stat.isLive && Te.stat.box === g.flv) {
var Re, ve, Ne, qe = (Re = Te.liveTime) == null ? void 0 : Re.getDisplayDelay(Te.currentTime);
if (qe)
return { v_rec_delay: (ve = Te.liveTime) == null ? void 0 : ve.getRecDelay(), v_render_delay: qe || 0, a_render_delay: ((Ne = Te.liveTime) == null ? void 0 : Ne.getAudioRenderDelay(Te.currentTime)) || 0 };
}
return {};
}(o), mo(o)), this.jr.hasData && (ie.retry_record = this.jr.beacon, ie.retry_cnt = this.jr.retryCount, this.jr.clear()), S.wasmDecErr && (ie.wasm_dec_err = S.wasmDecErr), $.muxA && (ie.mux_a = $.muxA), $.muxV && (ie.mux_v = $.muxV), $.fillA && (ie.fill_a = $.fillA), $.fillV && (ie.fill_v = $.fillV), $.droppedA && (ie.dropped_a = $.droppedA), $.droppedV && (ie.dropped_v = $.droppedV), S.muxDroppedFrames && (ie.mux_dropped_video_frames = S.muxDroppedFrames), u.coreType === H.mse && (ie.mse_update_cnt = (V == null ? void 0 : V.mseUpdate) || 0, ie.mse_remove_cnt = (V == null ? void 0 : V.mseRemove) || 0, ie.key_frame_cnt = S.keyFrame, u.isLive ? (ie.live_shift_type = o.stat.liveShiftType, o.isLiveShift && (ie.live_shift = o.stat.liveShiftActive ? 1 : 0)) : (ie.lazyload_min = Math.floor(u.lazyLoadRecoverDuration), ie.lazyload_max = Math.floor(u.lazyLoadMaxDuration)), S.audioRemuxSampleCount && (ie.a_remux_sample_cnt = S.audioRemuxSampleCount), S.videoRemuxSampleCount && (ie.v_remux_sample_cnt = S.videoRemuxSampleCount), S.audioRemuxDuration && (ie.a_remux_duration = Math.floor(1e3 * S.audioRemuxDuration)), S.videoRemuxDuration && (ie.v_remux_duration = Math.floor(1e3 * S.videoRemuxDuration))), this.Cr && (this.Nr === void 0 ? ie.first_screen_total_duration = 0 : (ie.first_screen_total_duration = this.Nr, ie.first_screen_details = this.Lr, u.coreType === H.mse && u.box === g.mp4 && (ie.mp4_moov_size = i.mp4MoovSize, i.mp4FastStart !== void 0 && (ie.mp4_fast_start = i.mp4FastStart ? 0 : 1)), this.Lr = void 0, this.Nr = void 0, this.Cr = !1)), typeof this.Ir == "number" && i.playStartTime && (ie.click_to_first_frame = this.Ir, this.Ir > 0 && (this.Ir = void 0)), this.Tr === 1 && l()(ie, xr(), vo(this.ut), po()), this.Ur(), this.Tr++, ie;
}, n;
}(), mt = "monitor", fu = function(n) {
function c(i) {
var o;
return (o = n.call(this) || this).Vr = void 0, o.Hr = void 0, o.Wr = void 0, o.ut = void 0, o.J = void 0, o.Gr = void 0, o.Rr = void 0, o.Qr = void 0, o.Yr = !1, o.Jr = !1, o.Zr = !1, o.zr = !1, o.Kr = function() {
o.Rr.onLineChange++;
}, o.qr = function(u) {
var f;
u === void 0 && (u = Rt.NORMEL);
try {
var T;
f = (T = o.Qr) == null ? void 0 : T.build();
} catch (V) {
}
if (f) {
var S;
u === Rt.NORMEL && f.first_screen_total_duration > 0 ? (f.type = Rt.FIRST_FRAME, f.metadata = fo(o.data)) : (u === Rt.LOAD && l()(f, _o(o.ut)), f.type = u), o.zr && (l()(f, Ao((S = o.ut.loadRec.currentLoad) == null ? void 0 : S.mediaInfo)), o.zr = !1), o.ut.stat.isLive || (f.seek_record = o.Rr.seekRecord.slice(0), o.Rr.seekRecord = []), o.J.i(mt, "realtime beacon", f), o.emit(q.REPORT, { type: dt.REALTIME_BEACON, value: f });
}
}, o.Wr = performance.now(), o.Hr = Date.now(), o.Gr = new nu(i), o.ut = i, o.J = i.logger, o.Xr(), ct || (window.addEventListener("online", o.Kr), window.addEventListener("offline", o.Kr)), o;
}
E()(c, n);
var a = c.prototype;
return a.getName = function() {
return mt;
}, a.Xr = function() {
var i;
this.Jr = !1, this.Zr = !1, this.zr = !1, this.Rr = (i = { decodedFrames: 0, droppedFrames: 0, muxDroppedFrames: 0, sessionId: cu(), 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 }, Le.isSupported() && (i.monkeyPatchedFetch = We(fetch, "fetch")), i), this.Rr.creationTime = this.Hr, this.J.i(mt, "reset", this.Rr.sessionId), this.ut.fps.reset(), this.ut.fps.getFPS(this.ut.videoPlaybackQuality);
}, a.onRendererInitComplete = function(i) {
this.J.i(mt, "renderer init complete. type: " + i.type), this.data.canvasCtxType = i.type;
}, a.onLoaderChunkArrival = function(i) {
this.ut.loadRec.onDataReceive(i), this.$r(Ve.DATA);
}, a.onMediaConnected = function(i) {
i.headers && (this.Rr.httpHeader = i.headers), this.$r(Ve.STREAM_CONNECTED);
}, a.onMediaDemux = function() {
this.$r(Ve.DEMUX, performance.now());
}, a.onKeyFrame = function(i) {
this.ut.loadRec.currentLoad && this.ut.loadRec.currentLoad.keyFrame++, this.data.keyFrame++, i && this.emit(q.REPORT, { type: dt.KEY_FRAME, value: i });
}, a.onDecLibLoaded = function(i) {
this.Rr.decLibLoadDuration = i.duration, this.Rr.decLibCacheHit = i.hitCache;
}, a.onNewSource = function(i) {
var o = this.Rr, u = this.ut.lctx.current;
u ? (this.ut.loadRec.onStreamOpen(i.sync, u.currentUrl, u.bitrate, u.qualityType), o.level = this.ut.lctx.currentIdx, o.startQualityType || (o.startQualityType = u.qualityType)) : this.ut.loadRec.onStreamOpen(i.sync, "", 0, "unknown");
}, a.onDiscontinuity = function(i) {
this.emit(q.REPORT, { type: dt.DISCONTINUITY, value: i });
}, a.onDownload = function(i) {
var o = this, u = this.Rr;
i.error_code && !this.Gr.complete && this.Gr.onDownloadError(), u.download++;
var f = l()({ use_backup: u.useBackup, first_screen: u.firstScreenTotalDuration ? 1 : 0 }, uo(this.ut, u), Dr(), Cr(), co(), i);
i.error_code === 1009 ? setTimeout(function() {
o.emit(q.REPORT, { type: dt.DOWNLOAD, value: f });
}, 0) : this.emit(q.REPORT, { type: dt.DOWNLOAD, value: f });
}, a.onHeartbeat = function() {
var i, o, u = this.Rr, f = this.ut, T = f.fps.getFPS(this.ut.videoPlaybackQuality), S = {}, V = f.loadRec, W = performance.now();
u.lastHeartbeatTime && W - u.lastHeartbeatTime > 1500 && u.heartbeatTimeout++, u.lastHeartbeatTime = performance.now(), (f.stat.coreType === H.mse || f.stat.coreType === H.rtc) && (S.totalReceive = V.traffic, S.speed = V.speed, S.videoDataRate = ((i = V.currentLoad) == null ? void 0 : i.videoDataRate) || 0, S.audioDataRate = ((o = V.currentLoad) == null ? void 0 : o.audioDataRate) || 0), f.mse && (S.videoBuffered = u.bufferedEndV = Math.round(Math.max(0, 1e3 * (f.mse.bufferedEndByType(G.VIDEO) - f.currentTime))), S.audioBuffered = u.bufferedEndA = Math.round(Math.max(0, 1e3 * (f.mse.bufferedEndByType(G.AUDIO) - f.currentTime))), S.fillAudio = V.fillA, S.fillVideo = V.fillV, S.keyFrame = u.keyFrame, f.stat.isLive ? (S.isLive = f.stat.isLive, f.stat.liveShiftType && (S.liveShift = f.stat.liveShiftActive)) : (S.lazyloadMin = f.stat.lazyLoadRecoverDuration, S.lazyloadMax = f.stat.lazyLoadMaxDuration)), S.buffered = Math.round(1e3 * f.bufferedSec), S.decodedFPS = (T == null ? void 0 : T.decodedFPS) || 0, S.droppedFPS = (T == null ? void 0 : T.droppedFPS) || 0, u.decodedFrames = S.decodedFrames = (T == null ? void 0 : T.decoded) || 0, u.droppedFrames = S.droppedFrames = ((T == null ? void 0 : T.dropped) || 0) + u.muxDroppedFrames, f.stat.isLive && f.stat.box === g.flv && f.liveTime && (S.audioRenderDelay = f.liveTime.getAudioRenderDelay(f.currentTime), S.displayDelay = f.liveTime.getDisplayDelay(f.currentTime), S.recDelay = f.liveTime.getRecDelay()), f.stat.decoder === b.wasm && (S.wasmFrameBufLen = f.stat.frameBufLen), S.playPos = 1e3 * f.currentTime, this.J.i(mt, "heartbeat", S), this.emit(q.REPORT, { type: dt.HEARTBEAT, value: S });
}, a.destroy = function() {
this.J.i(mt, "destroy"), this.qr(Rt.END), this.tA(), ct() || (window.removeEventListener("online", this.Kr), window.removeEventListener("offline", this.Kr)), n.prototype.destroy.call(this);
}, a.onLoad = function(i) {
if (this.J.i(mt, "on load: " + i.type), this.Rr.loadCnt++, this.Rr.metadata = void 0, i.type)
i.type !== ue.internal && i.type !== ue.retry || this.Gr.complete || this.Gr.start(), this.Rr.errorCode = 0, this.Rr.errorMessage = "";
else {
var o;
if ((o = this.ut.lctx.current) == null || o.currentUrl, this.Rr.startTime) {
var u = this.Rr.reuse;
this.Xr(), this.Rr.reuse = u + 1;
}
this.Rr.startTime = performance.now(), this.Rr.loadStartTime = Date.now(), this.Gr.start(), this.Yr = yo(), this.tA(), this.Qr = new hu(this.Rr, this.ut), this.qr(Rt.LOAD);
}
}, a.onStopLoad = function() {
this.qr(Rt.END), this.tA(), this.iA();
}, a.onManifestParsed = function(i) {
this.J.i(mt, "on manifest:", i);
var o = this.ut.lctx.current;
o && (this.Rr.startBitrate || (this.Rr.startBitrate = o.bitrate)), this.$r(Ve.MANIFEST);
}, a.onLevelUpdated = function(i) {
this.$r(Ve.LEVEL);
}, a.onAudioTrackUpdated = function() {
}, a.onMediaInfo = function(i) {
var o, u, f, T = this.ut;
(i = i || {}).box = T.stat.box, i.tagName = (o = T.video) == null ? void 0 : o.tagName, T.stat.srcMeta && (i.srcMeta = T.stat.srcMeta), (u = T.lctx.current) != null && u.meta && (i.currentLevelMeta = (f = T.lctx.current) == null ? void 0 : f.meta), typeof T.stat.isLive == "boolean" && (i.isLive = T.stat.isLive), i.liveShiftEnabled = T.isLiveShift, i.liveShiftType = T.stat.liveShiftType, i.packName = vt.packName, T.loadRec.onMediaInfo(i);
var S = [];
i.videoCodec && S.push(i.videoCodec), i.audioCodec && S.push(i.audioCodec), this.Rr.codecs = S.join(","), this.Rr.startCodec || (this.Rr.startCodec = this.Rr.codecs), i.sid = this.Rr.sessionId, i.hardwareAccelerated = _e.isSupportHW, i.coreType = T.stat.coreType, !i.streamHost && T.lctx.currentUrl && (i.streamHost = new wt.a(T.lctx.currentUrl).host);
var V, W = gr();
W.renderer && (i.gpu = W.renderer), T.loadRec.currentLoad && (T.loadRec.currentLoad.mediaInfo = i), T.config.ntp && T.stat.isLive !== !1 && T.stat.box === g.flv && ((V = T.liveTime) == null || V.ntpSync(T.stat.preferNativeLoader)), T.stat.isKwaiSlice && (i.isKwaiSlice = T.stat.isKwaiSlice);
var $ = JSON.stringify(i);
this.J.i(mt, "mediainfo", $), this.zr = !0, this.emit(q.REPORT, { type: dt.MEDIA_INFO, value: JSON.parse($) });
}, a.onParsingData = function(i) {
var o = this.Rr;
i.extra && i.extra.stat && (o.unknownTSPacketCount = o.unknownTSPacketCount || i.extra.stat.unknownTSPacketCount || 0, o.audioNonMonotonous = o.audioNonMonotonous || i.extra.stat.audioNonMonotonous || 0, o.aacOverhead = o.aacOverhead || i.extra.stat.aacOverhead || 0), i.segments.forEach(function(u) {
u.type === G.VIDEO ? (u.droppedFrames && (o.muxDroppedFrames += u.droppedFrames), o.videoRemuxSampleCount += u.sampleCount, o.videoRemuxDuration += u.endDTS - u.startDTS) : u.type === G.AUDIO && (o.audioRemuxSampleCount += u.sampleCount, o.audioRemuxDuration += u.endDTS - u.startDTS);
}), this.$r(Ve.SEGMENT);
}, a.onPrivNal = function(i) {
var o;
(o = this.ut.liveTime) == null || o.onPrivNal(i), this.emit(q.REPORT, { type: dt.PRIV_NAL, value: i });
}, a.onSei = function(i) {
this.emit(q.REPORT, { type: dt.SEI, value: i });
}, a.onAacPriv = function(i) {
this.emit(q.REPORT, { type: dt.AAC_PRIV, value: i });
}, a.onPlay = function() {
this.Rr.playStartTime || (this.Rr.playStartTime = Date.now()), this.eA();
}, a.onLoadedmetadata = function() {
this.$r(Ve.LOADEDMETADATA), this.Rr.metadataTime || (this.Rr.metadataTime = Date.now());
}, a.onLoadeddata = function() {
this.$r(Ve.LOADEDDATA), this.iA();
}, a.onCanplay = function() {
this.$r(Ve.CANPLAY), ee.safari && this.ut.stat.coreType !== H.mse || this.iA();
}, a.onPlaying = function() {
var i;
ee.ios && ((i = this.ut.video) == null ? void 0 : i.readyState) !== 4 || (this.Jr || (this.Jr = !0), this.nA(), this.rA(), this.iA());
}, a.onPause = function() {
var i;
(i = this.ut.video) != null && i.seeking || !this.Jr || (this.AA(), this.oA(), this.Jr = !1);
}, a.onEnded = function() {
this.Rr.playToEnd++, this.Jr = !1, this.AA(), this.rA(), this.iA(), this.qr(Rt.END), this.tA();
}, a.onWaiting = function(i) {
this.Rr.playPos = Math.round(1e3 * this.ut.currentTime), this.Jr && this.Gr.complete && i.block && this.sA(i.bufferedSec);
}, a.onSeeking = function(i) {
this.Rr.seekRecord.push({ from: this.Rr.playPos, to: Math.round(1e3 * this.ut.currentTime), time: Date.now() }), this.Rr.seekRecord.length > 50 && this.Rr.seekRecord.shift(), this.ut.stat.isLive || i != null && i.internal || (this.Rr.seekStartTime = performance.now());
}, a.onSeekWithLoad = function() {
this.Gr.complete && (this.qr(Rt.SEEK), this.uA(), this.Zr = !0);
}, a.onSeeked = function() {
if (this.ut.fps.getFPS(this.ut.videoPlaybackQuality), this.Rr.seekStartTime) {
this.Rr.seekCnt++;
var i = Math.round(performance.now() - this.Rr.seekStartTime);
this.Rr.seekDuration += i, this.Rr.seekStartTime = 0, this.Zr && (this.Rr.seekLoadCnt++, this.Rr.seekLoadDuration += i);
}
this.Zr = !1, this.Gr.complete || this.ut.stat.coreType === H.mse || !ee.safari && !ee.msie || this.$r(Ve.SEEKED);
}, a.onTimeupdate = function() {
var i, o, u = this.ut, f = u.video;
if (f) {
f.loop && !u.stat.isLive && u.currentTime === 0 && Number.isFinite(f.duration) && f.duration > 0 && f.duration - this.Rr.playPos / 1e3 < 1 && this.Rr.playToEnd++;
var T = Math.round(1e3 * u.currentTime);
ee.msie && u.stat.coreType !== H.mse && this.Rr.bufferingStartMS && this.Rr.playPos !== T && this.onPlaying(), this.Rr.playPos = T, !ee.ios || typeof this.Rr.bufferingStartMS != "number" || ((i = this.ut.video) == null ? void 0 : i.readyState) !== 4 || (o = this.ut.video) != null && o.paused || this.onPlaying();
}
}, a.onProgress = function() {
var i;
ee.safari && this.ut.stat.coreType !== H.mse && this.Rr.bufferingStartMS && ((i = this.ut.video) == null ? void 0 : i.readyState) === 4 && this.iA();
}, a.mediaCapabilities = function(i) {
this.Rr.smoothBitrate = i;
}, a.onLevelSwitching = function(i) {
i.smooth || (this.qr(Rt.LEVEL_SWITCH), this.uA());
}, a.onRetry = function(i) {
this.ut.stat.retryInfo.append(i), i.type === w.BACKUP && (this.Rr.useBackup = 1), this.Gr.onRetry(), i.type === w.BACKUP && (this.Qr && this.Qr.setError(i.code || 0, i.message || ""), this.qr(Rt.BACKUP), this.Qr && this.Qr.setError(0, ""));
}, a.onRefresh = function() {
this.Rr.refreshCnt++;
}, a.onMetadata = function(i) {
this.Rr.metadata || (this.Rr.metadata = i), i.mp4MoovSize && (this.Rr.mp4MoovSize = i.mp4MoovSize), typeof i.mp4FastStart == "boolean" && (this.Rr.mp4FastStart = i.mp4FastStart), typeof i.mp4MoovNoPs == "boolean" && (this.Rr.mp4MoovNoPs = i.mp4MoovNoPs), typeof i.compatible_brands == "string" && (this.Rr.mp4CompatibleBrands = i.compatible_brands), this.J.i(mt, "metadata", i), this.emit(q.REPORT, { type: dt.METADATA, value: i });
}, a.onVisibilityChange = function() {
this.Rr.visibilityChange++;
}, a.onError = function(i) {
i.preventFollowUp || (i.fatal ? (this.J.i(mt, "error", i), this.Rr.errorCode = i.code, this.Rr.errorMessage = i.reason, this.Qr && this.Qr.setError(i.code, i.reason), this.AA(), this.rA(), this.iA()) : i.details === ge.DECODER_DEC_ERROR && this.Rr.wasmDecErr++);
}, a.$r = function(i, o) {
o === void 0 && (o = 0), !this.Gr.complete && this.Gr.process(i, o) && this.aA();
}, a.nA = function() {
this.Rr.playingStartTime || (this.Rr.playingStartTime = Date.now()), this.Rr.playStartMS = this.Rr.playStartMS || performance.now(), this.Rr.actualPlayStartMS = this.Rr.actualPlayStartMS || performance.now();
}, a.AA = function() {
this.Rr.playStartMS && (this.Rr.playDuration += performance.now() - this.Rr.playStartMS), this.Rr.actualPlayStartMS && (this.Rr.actualPlayDuration += performance.now() - this.Rr.actualPlayStartMS), this.Rr.playStartMS = void 0, this.Rr.actualPlayStartMS = void 0;
}, a.oA = function() {
this.Rr.pauseCnt++, this.Rr.pauseStartMS = this.Rr.pauseStartMS || performance.now();
}, a.rA = function() {
this.Rr.pauseStartMS && (this.Rr.pauseDuration += performance.now() - this.Rr.pauseStartMS), this.Rr.pauseStartMS = void 0;
}, a.sA = function(i) {
this.Rr.bufferingStartMS || (this.Rr.blockCount++, this.Rr.bufferingStartMS = performance.now(), i > 0.6 && this.Rr.renderBlockCount++), this.Rr.actualPlayStartMS && (this.Rr.actualPlayDuration += performance.now() - this.Rr.actualPlayStartMS), this.Rr.actualPlayStartMS = void 0;
}, a.iA = function() {
this.Rr.bufferingStartMS && (this.Rr.bufferTime += performance.now() - this.Rr.bufferingStartMS, this.Rr.bufferingStartMS = void 0);
}, a.aA = function() {
this.J.i(mt, "first frame"), this.ut.stat.firstFrameLoaded = !0;
var i = this.Rr;
i.firstScreenTotalDuration = i.firstScreenTotalDuration || Math.round(this.Gr.duration), i.firstScreenDetails = i.firstScreenDetails || this.Gr.details, i.playStartTime && this.Gr.complete ? i.clickToFirstFrame = i.clickToFirstFrame || Math.max(1, this.Gr.complete - i.playStartTime) : i.clickToFirstFrame = 1, this.Qr && this.Qr.setFirstScreenDuration(this.Gr.duration, this.Gr.details, i.clickToFirstFrame), this.ut.video && !this.ut.video.paused && this.nA();
}, a.eA = function() {
this.Vr === void 0 && (this.Vr = setInterval(this.qr, 1e4));
}, a.tA = function() {
this.Vr && (clearTimeout(this.Vr), this.Vr = void 0);
}, a.uA = function() {
this.tA(), this.eA();
}, h()(c, [{ key: "runningStartTime", get: function() {
return this.Wr;
} }, { key: "sid", get: function() {
return this.Rr.sessionId;
} }, { key: "snapshot", get: function() {
var i = this.ut.loadRec, o = this.ut.stat;
return l()({ streams: i.streams, live: o.isLive, liveShift: o.liveShiftActive, demuxer: o.demuxerType, decSimd: o.wasmSimd, decThreads: o.wasmThreads, decoderType: o.wasmDecoder }, this.Rr);
} }, { key: "data", get: function() {
return this.Rr;
} }, { key: "audienceStat", get: function() {
var i, o = this.Rr, u = go(o), f = this.ut.stat, T = this.ut.loadRec, S = { play_duration: u.play, actual_play_duration: u.actualPlay, traffic: Math.round(T.traffic / 1024), buffer_time: u.buffer, block_cnt: o.blockCount, render_block_cnt: o.renderBlockCount, click_to_first_frame: o.playStartTime && o.clickToFirstFrame || 0, first_screen_total_duration: Math.round(o.firstScreenTotalDuration) || 0, first_screen_details: o.firstScreenDetails || this.Gr.details || null, error_code: o.errorCode || 0, error_message: o.errorMessage || "", remux_process_type: (this.ut.streamingMuxEnabled ? 1 : 0) + (f.gopRemux ? 1 : 0), hidden_start: this.Yr ? 1 : 0, current_running_time: Math.round(performance.now() - o.startTime), running_time: Math.round(performance.now() - this.Wr), smooth_bitrate: o.smoothBitrate, start_bitrate: o.startBitrate || 0, abr: this.ut.config.adaptive ? 1 : 0, pause_cnt: o.pauseCnt, traffic_vcodec: T.trafficGroupedByVCodecType, traffic_level: T.trafficGroupedByLevel, decoded_video_frames: o.decodedFrames, dropped_video_frames: o.droppedFrames + o.muxDroppedFrames, pause_duration: u.pause, seek_cnt: o.seekCnt, seek_duration: o.seekDuration, seek_load_cnt: o.seekLoadCnt, seek_load_duration: o.seekLoadDuration, start_sec: f.isLive ? 0 : Math.round(this.ut.config.startFromSec || 0), on_line_change: o.onLineChange, visibility_change: o.visibilityChange, heartbeat_timeout: o.heartbeatTimeout, load_cnt: o.loadCnt, refresh_cnt: o.refreshCnt, media_buffered_v: o.bufferedEndV, media_buffered_a: o.bufferedEndA, remux_worker: this.ut.stat.webWorker ? 1 : 0, av_separated: this.ut.stat.avSeparated ? 1 : 0 };
if (f.retryInfo.hasData && (S.retry_record = f.retryInfo.mergedBeacon, S.retry_cnt = f.retryInfo.retryCount), o.wasmDecErr && (S.wasm_dec_err = o.wasmDecErr), l()(S, xr(), ho(this.ut, o), Dr(), Cr(), Ao((i = this.ut.loadRec.currentLoad) == null ? void 0 : i.mediaInfo), vo(this.ut), _o(this.ut), mo(this.ut), po()), S.metadata = fo(o), f.coreType === H.mse && this.ut.mse && (S.mse_buffer_full = this.ut.mse.stat.mseBufferFull, S.mse_remove = this.ut.mse.stat.mseRemove, S.key_frame_cnt = o.keyFrame, f.box === g.mp4 && (S.mp4_moov_size = o.mp4MoovSize, o.mp4CompatibleBrands !== void 0 && (S.mp4_compatible_brands = o.mp4CompatibleBrands), o.mp4FastStart !== void 0 && (S.mp4_fast_start = o.mp4FastStart ? 1 : 0), o.mp4MoovNoPs !== void 0 && (S.mp4_moov_no_ps = o.mp4MoovNoPs ? 1 : 0)), S.a_remux_sample_cnt = o.audioRemuxSampleCount, S.v_remux_sample_cnt = o.videoRemuxSampleCount, S.a_remux_duration = Math.floor(1e3 * o.audioRemuxDuration), S.v_remux_duration = Math.floor(1e3 * o.videoRemuxDuration)), typeof this.ut.config.audioEnabled == "boolean" && (S.a_enabled = this.ut.config.audioEnabled ? 1 : 0), typeof this.ut.config.videoEnabled == "boolean" && (S.v_enabled = this.ut.config.videoEnabled ? 1 : 0), T.muxA && (S.mux_a = T.muxA), T.muxV && (S.mux_v = T.muxV), T.fillA && (S.fill_a = T.fillA), T.fillV && (S.fill_v = T.fillV), T.droppedA && (S.dropped_a = T.droppedA), T.droppedV && (S.dropped_v = T.droppedV), o.muxDroppedFrames && (S.mux_dropped_video_frames = o.muxDroppedFrames), he(f.box) && (S.unknown_ts_packet_count = o.unknownTSPacketCount, S.audio_non_monotonous = o.audioNonMonotonous, S.aac_overhead = o.aacOverhead), typeof o.decLibLoadDuration == "number" && (S.dec_lib_load_duration = Math.round(o.decLibLoadDuration), S.dec_lib_hit = o.decLibCacheHit || ""), this.ut.stat.coreType === H.native) {
var V = this.ut.stat.retryInfo.getLastMseError();
V && (S.last_error_code = o.errorCode, S.last_error_message = o.errorMessage, S.error_code = V.code, S.error_message = V.reason);
}
return S;
} }]);
}(_r), ye = "kernel", bo = function(n) {
function c(i, o) {
var u;
return (u = n.call(this) || this).zt = void 0, u.ut = void 0, u.hA = void 0, u.ii = void 0, u.cA = new x.EventEmitter(), u.J = void 0, u.fA = !1, u.vA = void 0, u.ot = void 0, u.dA = void 0, u.lA = function(f) {
var T = u.ut;
f.levels = T.lctx.levels.map(function(W) {
return W.getKLevel();
}), f.currentLevel = T.lctx.currentIdx, f.auto = T.lctx.abr, f.levels = T.lctx.levels.map(function(W) {
return W.getKLevel();
});
var S = T.lctx.audioTracks;
S && S.length && (f.audioTrack = T.lctx.audioIdx, f.audioTracks = S.map(function(W) {
return { lang: W.lang, qualityLabel: W.qualityLabel, qualityType: W.qualityType, bitrate: W.bitrate, groupId: W.groupId };
}));
var V = T.lctx.subtitleTracks;
V && V.length && (f.subtitleTrack = T.lctx.subtitleIdx, f.subtitleTracks = V.map(function(W) {
return { lang: W.lang, name: W.name, groupId: W.groupId };
})), f.currentLevel = T.lctx.currentIdx, f.auto = T.lctx.abr, f.isLive = T.stat.isLive, T.stat.stereoType !== void 0 && (f.stereoType = T.stat.stereoType);
}, u.pA = function(f) {
u.mA(f);
}, u.yA = function(f) {
f.type === ue.retry && (u.ii = void 0);
}, u.MA = function(f) {
f.pos = Math.floor(u.zt.currentTime), f.ts = Math.floor(performance.now());
}, u.H = function(f) {
if (u.J.i(ye, "on error", f), !f.preventFollowUp) {
var T = u.ut;
if (f.details === ge.MANIFEST_PARSING_ERROR)
try {
to.isSrcEmpty(u.ut.src) && (u.J.i(ye, "src empty", u.ut.src), f.details = ge.SRC_EMPTY), T.src ? typeof T.src == "string" ? f.reason += "src str:" + T.src.slice(0, 1024) : T.src instanceof Blob ? f.reason += "src: blob" : f.reason += "src other:" + JSON.stringify(T.src).slice(0, 1024) : f.reason += "src:" + T.src;
} catch (V) {
f.reason += V.message;
}
var S = ae(f.details, f.reason, f.statusCode || 0);
f.code = S, u.ii || (u.ii = f), f.fatal && u.stopLoad();
}
}, u.wA = function(f) {
u.J.i(ye, "window error:", f.message);
try {
u.J.i(ye, "window error stack:", f.error.stack);
} catch (T) {
}
}, u.bA = function() {
u.ut.evt.emit(q.VISIBILITY_CHANGE, { hidden: document.hidden });
}, u.zt = i, u.ut = new vt(o || {}, u.zt), u.gA(), u.J = u.ut.logger, typeof location < "u" && u.J.i(ye, "href: " + location.href), u.J.i(ye, vt.packName + ", " + vt.version + " build: " + vt.buildTime + " cors: " + (i == null ? void 0 : i.crossOrigin) + " autoplay: " + (i == null ? void 0 : i.autoplay) + " dom: " + i.tagName, o), (!u.ut.config || u.ut.config.audioEnabled === !1 && u.ut.config.videoEnabled === !1) && setTimeout(function() {
u.kA(le(Pe.OTHER_ERROR, ge.CONFIG_ERROR, "config data error"));
}, 0), u.hA = new fu(u.ut), u.ut.config.src && (u.dA = u._A()), u.vA = new xl(u.ut, function(f) {
var T;
return (T = u.dA) == null ? void 0 : T.internalSeek(f);
}), u.ot = new gl(u.J, u.ut.evt), u.ot.register(u.vA), u.ot.register(u.hA), u.ot.register(new yl(u.ut, u.cA)), u.F.push(u.ot, u.vA, u.hA), u.J.i(ye, "config", u.ut.config), vt.instanceCount++, ct() || (window.addEventListener("error", u.wA), document.addEventListener("visibilitychange", u.bA)), u;
}
E()(c, n), c.isSupport = function(i) {
if (g.webrtc === (i == null ? void 0 : i.box))
return _e.isWebRTCSupported();
if (i != null && i.nativeFirst)
return _e.isVideoBoxSupported(i == null ? void 0 : i.box);
var o = _e.isSupported();
if (o) {
var u = !0;
i && (u = !(!i.isLive || i.box !== g.flv));
var f = !u || ce.isStreamingSupported();
return o && !!f;
}
return _e.isVideoBoxSupported(i == null ? void 0 : i.box);
}, c.videoCodecCapabilities = function(i) {
return _e.getVideoCodecCompatibilityByCodec(i);
};
var a = c.prototype;
return a.on = function(i, o) {
this.J.i(ye, "call on " + i), this.cA.on(i, o);
}, a.once = function(i, o) {
this.J.i(ye, "call once " + i), this.cA.once(i, o);
}, a.removeAllListeners = function(i) {
this.J.i(ye, "call removeAllListeners"), this.cA.removeAllListeners(i);
}, a.off = function(i, o) {
this.J.i(ye, "call off " + i), this.cA.off(i, o);
}, a.listeners = function(i) {
return this.cA.listeners(i);
}, a.emit = function(i, o) {
return this.cA.emit(i, o);
}, a.listenerCount = function(i) {
return this.cA.listenerCount(i);
}, a.prependListener = function(i, o) {
this.cA.prependListener(i, o);
}, a.prependOnceListener = function(i, o) {
this.cA.prependOnceListener(i, o);
}, a.load = function(i, o) {
var u, f = this;
if (this.J.i(ye, "call kernel load", i, o), this.hA.data.startTime > 0 && this.J.i(ye, "play summary data:", this.hA.audienceStat), i && this.ut.setSrc(i), this.ut.src)
if (c.isSupport({ box: this.ut.stat.box, isLive: this.ut.stat.isLive, nativeFirst: this.ut.stat.native })) {
var T, S;
typeof (o == null ? void 0 : o.startFromSec) == "number" ? this.ut.stat.startFromSec = o.startFromSec : i && (this.ut.stat.startFromSec = -1), this.ut.stat.multipart && this.ut.config.resourceBuffer && _l(this.ut.config.resourceBufferSize), i && ((u = this.dA) == null ? void 0 : u.type) !== ((S = this.ut).stat.box === g.webrtc ? H.rtc : S.stat.native ? H.native : H.mse) && ((T = this.dA) == null || T.destroy(), this.dA = void 0), this.ut.fallback.register(Ie.NEXT_DESC, new El(this.ut).setRetryFunc(this.EA.bind(this))), this.ut.fallback.register(Ie.SWAP_264, new Il(this.ut).setRetryFunc(this.EA.bind(this))), this.Zt();
} else
setTimeout(function() {
f.kA(le(Pe.OTHER_ERROR, ge.UNSUPPORTED, "unsupported: " + f.ut.stat.box + " live: " + f.ut.stat.isLive + " native: " + f.ut.stat.native));
}, 0);
else
this.kA(le(Pe.OTHER_ERROR, ge.SRC_EMPTY, "url empty"));
}, a.getTimeNow = function() {
var i;
return ((i = this.ut.liveTime) == null ? void 0 : i.serverNowMs) || null;
}, a.setAvailableAbrLevels = function(i) {
this.J.i(ye, "setAvailableAbrLevels", i), this.ut.lctx.availableList = i.splice(0), this.dA && "onAbrLevelsUpdated" in this.dA && this.dA.onAbrLevelsUpdated();
}, a.preload = function(i, o) {
this.J.i(ye, "call preload");
}, a.isTimeinBuffered = function(i) {
return this.ut.stat.box !== g.webrtc && this.ut.isTimeinBuffered(i);
}, a.resume = function() {
var i, o, u = this;
this.J.i(ye, "call resume"), (i = this.dA) == null || i.resume(), this.zt.paused && ((o = this.zt.play()) == null || o.catch(function(f) {
return u.J.i(ye, "resume, call play() fail.", f);
}));
}, a.destroy = function() {
var i;
this.J.i(ye, "call kernel destroy. play summary data:", this.hA.audienceStat), this.fA && (vt.instanceCount--, this.fA = !0), performance.removeEventListener && performance.removeEventListener("resourcetimingbufferfull", En), this.ut.fallback.unregisterAndDestroy(Ie.NEXT_DESC), this.ut.fallback.unregisterAndDestroy(Ie.SWAP_264), this.ut.fallback.unregisterAndDestroy(Ie.SWAP_CORE), n.prototype.destroy.call(this), (i = this.dA) == null || i.destroy(), this.ut.destroy(), this.removeAllListeners(), ct() || (window.removeEventListener("error", this.wA), document.removeEventListener("visibilitychange", this.bA));
}, a.refresh = function() {
var i, o;
this.J.i(ye, "call kernel refresh"), this.hA.onRefresh(), this.ii = void 0, (i = this.ut.cOutput) == null || i.reset(), (o = this.dA) == null || o.refresh();
}, a.stopLoad = function() {
var i;
this.J.i(ye, "call kernel stopLoad"), (i = this.dA) == null || i.stopLoad();
}, a.getStreamTime = function(i) {
var o = this.ut.streamTime.getStreamTime(i / 1e3);
return o ? 1e3 * o : NaN;
}, a.getAudienceStat = function() {
return this.hA.audienceStat;
}, a.getMediaInfo = function() {
var i;
return l()({}, (i = this.ut.loadRec.currentLoad) == null ? void 0 : i.mediaInfo);
}, a.experiment = function(i) {
this.J.i(ye, "experiment", i);
}, a.liveEnd = function() {
this.J.i(ye, "call liveEnd"), this.dA && "liveEnd" in this.dA && this.dA.liveEnd();
}, a.seekToNextFrame = function() {
this.J.i(ye, "call seekToNextFrame"), this.dA && "seekToNextFrame" in this.dA ? this.dA.seekToNextFrame() : this.RA();
}, a.seekToPrevFrame = function() {
this.J.i(ye, "call seekToPrevFrame"), this.dA && "seekToPrevFrame" in this.dA ? this.dA.seekToPrevFrame() : this.RA();
}, a.seekByFrameIndex = function(i) {
if (this.J.i(ye, "call seekByFrameIndex", i), this.dA && "setCurretVideoFrame" in this.dA)
return this.dA.setCurretVideoFrame(i);
this.RA();
}, a.screenshot = function(i) {
var o;
i && (i = JSON.parse(JSON.stringify(i))), this.J.i(ye, "call screenshot", i), (o = this.dA) == null || o.screenshot(i);
}, a.Zt = function(i) {
this.ii = void 0, this.dA || (this.dA = this._A()), this.dA && (this.dA.load(i), this.ut.stat.coreType = this.dA.type);
}, a._A = function() {
var i = this.ut, o = function(u) {
return u.stat.native ? new Pl(u) : u.stat.box !== g.webrtc && tt.a || u.stat.box === g.webrtc && tt.a ? new tt.a(u) : void 0;
}(i);
if (o)
return this.J.i(ye, "init av core. type: " + o.type), i.stat.coreType = o.type, o;
this.kA(le(Pe.OTHER_ERROR, ge.UNSUPPORTED, "init core error. " + i.stat.box + " native: " + i.stat.native + " unsupported."));
}, a.DA = function() {
this.EA(H.native);
}, a.TA = function() {
this.EA(H.mse);
}, a.EA = function(i) {
var o, u, f = this, T = this.zt.paused;
!this.ut.live && this.ut.stat.startFromSec <= 0 && (this.ut.stat.startFromSec = this.zt.currentTime), (o = this.dA) == null || o.destroy(), this.dA = void 0, i !== void 0 && (this.ut.stat.native = i !== H.mse), this.ut.stat.demuxerType = void 0, this.Zt(ue.retry), T || (u = this.zt.play()) == null || u.catch(function(S) {
return f.J.i(ye, "recover, call play() fail.", S);
});
}, a.mA = function(i) {
var o = this.ut.cOutput;
o && (i === void 0 && (i = { enabled: !0, type: o.rendererType, canvas: o.rendererType === k.canvas && o.canvas ? o.canvas : void 0 }), this.J.i(ye, "video renderer change", i), i.canvas && this.emit(q.H265_DETECTED, { canvas: i.canvas, message: "", enabled: i.enabled, decoder: b.wasm }));
}, a.RA = function() {
this.kA(le(Pe.MEDIA_ERROR, ge.CANNOT_SEEK_BY_FRAME_INDEX, "unsupported", { fatal: !1 }));
}, a.kA = function(i) {
this.ut.evt.emit(q.ERROR, i);
}, a.gA = function() {
var i = this.ut.evt;
i.on(q.ERROR, this.H), i.on(q.MANIFEST_PARSED, this.lA), i.on(q.VIDEO_RENDERER_CHANGE, this.pA), i.on(q.LOAD, this.yA), i.on(q.RETRY, this.MA);
}, h()(c, [{ key: "liveShiftType", get: function() {
return this.ut.stat.liveShiftType;
} }, { key: "liveShift", get: function() {
return this.ut.stat.liveShiftActive;
} }, { key: "liveShiftDelaySec", get: function() {
return this.ut.config.liveShiftDelaySec;
} }, { key: "currentVideoFrame", get: function() {
return this.dA && "getCurrentVideoFrame" in this.dA ? this.dA.getCurrentVideoFrame() : 0;
}, set: function(i) {
this.J.i(ye, "call set currentVideoFrame", i), this.dA && "setCurretVideoFrame" in this.dA && this.dA.setCurretVideoFrame(i);
} }, { key: "totalVideoFrames", get: function() {
return this.dA && "getTotalVideoFrames" in this.dA ? this.dA.getTotalVideoFrames() : 0;
} }, { key: "audioTrack", get: function() {
return this.ut.lctx.audioIdx || 0;
}, set: function(i) {
var o;
this.J.i(ye, "call set audioTrack", i), this.ut.config.audioEnabled === !1 && (this.J.i(ye, "set audioTrack failed. conf audio enabled false"), this.emit(q.AUDIO_TRACK_SWITCH_FAILED)), this.dA && "setAudioTrack" in this.dA && ((o = this.dA) == null || o.setAudioTrack(i));
} }, { key: "subtitleTrack", get: function() {
return this.ut.lctx.subtitleIdx || 0;
}, set: function(i) {
var o;
this.J.i(ye, "call set subtitleTrack", i), this.dA && "setSubtitleTrack" in this.dA && ((o = this.dA) == null || o.setSubtitleTrack(i));
} }, { key: "currentLevel", get: function() {
return this.ut.lctx.currentIdx || 0;
}, set: function(i) {
if (this.J.i(ye, "call set currentLevel from: " + this.ut.lctx.currentIdx + " to: " + i + " ", this.ut.lctx.abr), this.dA && "setCurrentLevel" in this.dA)
if (i < 0 && !this.ut.isAbrAvailable)
this.J.i(ye, "set currentLevel failed. unsupported auto"), this.emit(q.LEVEL_SWITCH_FAILED);
else if (this.ut.config.videoEnabled === !1)
this.J.i(ye, "set currentLevel failed. conf video enabled false"), this.emit(q.LEVEL_SWITCH_FAILED);
else {
var o;
(o = this.dA) == null || o.setCurrentLevel(i);
}
else
this.J.i(ye, "set nextLevel failed. unsupported"), this.emit(q.LEVEL_SWITCH_FAILED);
} }, { key: "nextLevel", get: function() {
return this.ut.lctx.nextIdx || 0;
}, set: function(i) {
if (this.J.i(ye, "call set nextLevel from: " + this.ut.lctx.nextIdx + " to " + i), this.dA && "setNextLevel" in this.dA)
if (i < 0 && !this.ut.isAbrAvailable)
this.J.i(ye, "set nextLevel failed. unsupported auto"), this.emit(q.LEVEL_SWITCH_FAILED);
else if (this.ut.config.videoEnabled === !1)
this.J.i(ye, "set nextLevel failed. conf video enabled false"), this.emit(q.LEVEL_SWITCH_FAILED);
else {
var o;
(o = this.dA) == null || o.setNextLevel(i);
}
else
this.J.i(ye, "set nextLevel failed. unsupported"), this.emit(q.LEVEL_SWITCH_FAILED);
} }, { key: "startLevel", get: function() {
return this.ut.lctx.startIdx || 0;
}, set: function(i) {
this.J.i(ye, "call set startLevel", i), this.ut.lctx.startIdx = i;
} }, { key: "outputLog", get: function() {
return this.ut.logger.getOutput();
}, set: function(i) {
this.J.i(ye, "call set output log", i), this.ut.logger.setOutput(i);
} }, { key: "autoLevelEnabled", get: function() {
return this.ut.lctx.abr;
} }, { key: "monitorData", get: function() {
return this.hA && this.dA ? l()(this.hA.snapshot, { trackBufInfo: this.dA.getTrackBufInfo() }) : null;
} }, { key: "currentLevelTimeInfo", get: function() {
var i = this.ut.lctx.current;
if (i && i.timeInfo)
return i.timeInfo;
} }, { key: "instanceId", get: function() {
return this.ut.id;
} }], [{ key: "version", get: function() {
return vt.version;
} }, { key: "buildTime", get: function() {
return vt.buildTime;
} }, { key: "MediaBox", get: function() {
return g;
} }, { key: "Events", get: function() {
return { REPORT: q.REPORT, ERROR: q.ERROR, LEVEL_SWITCHING: q.LEVEL_SWITCHING, LEVEL_SWITCHED: q.LEVEL_SWITCHED, LEVEL_SWITCH_PLAYING: q.LEVEL_SWITCH_PLAYING, LEVEL_SWITCH_FAILED: q.LEVEL_SWITCH_FAILED, AUDIO_TRACK_SWITCHING: q.AUDIO_TRACK_SWITCHING, AUDIO_TRACK_SWITCHED: q.AUDIO_TRACK_SWITCHED, AUDIO_TRACK_UPDATED: q.AUDIO_TRACK_UPDATED, SUBTITLE_TRACK_SWITCHED: q.SUBTITLE_TRACK_SWITCHED, MANIFEST_PARSED: q.MANIFEST_PARSED, LEVEL_UPDATED: q.LEVEL_UPDATED, LOAD_END: q.LOAD_END, VIDEO_RENDERER_CHANGE: q.VIDEO_RENDERER_CHANGE, SCREENSHOT: q.SCREENSHOT };
} }, { key: "Reports", get: function() {
return l()({}, dt);
} }]);
}(R);
function pu(n, c) {
return ct() ? void 0 : new bo(n, c);
}
}]);
Je === void 0 && console.error("esm-webpack-plugin: nothing exported!");
const uc = Je.default;
Je.createKernel;
Je.AbstractDestroyable;
Je.CanvasContextType;
Je.CodecType;
Je.DestroyableList;
Je.Decoder;
Je.DemuxerType;
Je.DownloadStatus;
Je.ErrorDetails;
Je.ErrorTypes;
Je.HttpRangeType;
const ht = Je.KEvents;
Je.LiveShiftType;
Je.LogLevel;
Je.MediaBox;
Je.ReportTypes;
Je.StereoType;
Je.VideoDecBlockPolicy;
Je.VideoDropFramePolicy;
Je.VideoRendererType;
Je.WasmDecoder;
const Mt = {
"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"
}, Ur = "kwai-player-id", Qr = class jt {
static next() {
if (Ia.available) {
const t = jt._ls.read(Ur, !1);
let r = jt._id;
return typeof t == "number" ? (r = this.getNextId(t), this._ls.write(Ur, r)) : (r = this.getNextId(r), this._ls.write(Ur, r)), jt._id = r, r;
} else
return jt._id = jt.getNextId(jt._id), jt._id;
}
static get MAX_ID() {
return 999;
}
static getNextId(t) {
return t++, t > jt.MAX_ID ? 0 : t;
}
};
X(Qr, "_id", 0), X(Qr, "_ls", new Ia());
let cc = Qr, Zr = class Xr {
static verify(t) {
return !!(t && t.liveStreamId && (Array.isArray(t.liveAdaptiveManifest) && t.liveAdaptiveManifest.length || Array.isArray(t.multiResolutionPlayUrls) && t.multiResolutionPlayUrls.length || Array.isArray(t.playUrls) && t.playUrls.length || t.hlsPlayUrl));
}
static parse(t) {
if (Xr.verify(t)) {
let r;
return t.liveAdaptiveManifest && t.liveAdaptiveManifest.length ? r = t.liveAdaptiveManifest[0] : t.multiResolutionPlayUrls && t.multiResolutionPlayUrls.length && (r = Xr._multiResolution2Manifest(t.multiResolutionPlayUrls)), ui && t.hlsPlayUrl ? r ? [{ src: r }, { src: t.hlsPlayUrl }] : t.hlsPlayUrl : r;
}
}
static _multiResolution2Manifest(t) {
return {
version: "1",
adaptationSet: {
representation: t.map((r, s) => {
var l;
return {
id: s,
url: (l = r.urls[0]) == null ? void 0 : l.url,
name: r.name,
bitrate: 0,
qualityType: r.type,
defaultSelect: r.defaultSelect
};
}).filter((r) => r.url)
}
};
}
};
var Da = /* @__PURE__ */ ((e) => (e[e.CTOR_ERROR = 1e4] = "CTOR_ERROR", e))(Da || {});
class dc {
/**
* 验证数据有效性
* @param data - 待验证数据
*/
static verify(t) {
return t && Object.prototype.hasOwnProperty.call(t, "version") && Object.prototype.hasOwnProperty.call(t, "adaptationSet") && Object.prototype.hasOwnProperty.call(t.adaptationSet, "representation") && Array.isArray(t.adaptationSet.representation) && t.adaptationSet.representation.length > 0 ? t.adaptationSet.representation.reduce((r, s) => !!(r && s.url && s.bitrate && s.qualityType), !0) : !1;
}
}
class hc {
/**
* 验证数据有效性
* @param data - 待验证数据
*/
static verify(t) {
return t && t.adaptationSet && t.adaptationSet.length ? t.adaptationSet.reduce((r, s) => !!(r && s.representation && s.representation.length), !0) : !1;
}
}
const fc = /\.[^./\\?#]+(?=$|[?#])/i;
function pc(e) {
const t = e.toLocaleLowerCase().match(fc);
return t ? t[0] : "";
}
let Ac = class zi {
static parse(t) {
if (typeof t == "string")
try {
return t = JSON.parse(t), zi._parseManifest(t);
} catch (r) {
return zi._parseUrl(t);
}
else if (typeof t == "object")
return zi._parseManifest(t);
}
static _parseUrl(t) {
return pc(t) === ".flv" ? {
isLive: !0,
src: {
liveStreamId: "",
playUrls: [{
url: t
}]
}
} : {
isLive: !1,
src: [{ url: t }]
};
}
static _parseManifest(t) {
return hc.verify(t) ? {
isLive: !1,
src: t
} : dc.verify(t) ? {
isLive: !0,
src: {
liveStreamId: "",
liveAdaptiveManifest: [t]
}
} : Zr.verify(t) ? {
isLive: !0,
src: t
} : {
isLive: !1
};
}
};
const Do = typeof document > "u" ? void 0 : document.createElement("video");
function vc() {
return !!(Do != null && Do.requestPictureInPicture);
}
const Oo = "fullscreen";
class _c {
constructor(t, r) {
X(this, "_evt"), X(this, "_logger"), X(this, "_element"), X(this, "_isFillWindow", !1), X(this, "_originStyle"), X(this, "_isSupportFullscreen", !0), X(this, "_onFullscreenChange", () => {
this._logger.i(Oo, "_onFullscreenChange", this.isFull()), this.isFull() || (this._recoverStyle(), document.body.classList.remove(Mt["kwai-player-disable-scroll"])), this._isFillWindow = !1, this._evt.emit("fullChange", {
type: Ot.SYSTEM,
isFull: this.isFull()
});
}), this._evt = t, this._logger = r, !(typeof document > "u") && (this._isSupportFullscreen = typeof this._getExitFullscreenFunc() < "u" && !(Nt.os.name === "iOS" && Nt.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(t, r) {
r === Ot.SYSTEM ? this.requestFullscreen(t) : r === Ot.WINDOW ? this.requestFillWindow(t) : this._isSupportFullscreen ? this.requestFullscreen(t) : this.requestFillWindow(t);
}
/**
* 退出全屏或网页全屏
*/
exitFull(t) {
if (t === Ot.SYSTEM)
return this.exitFullscreen();
if (t === Ot.WINDOW)
return this.exitFillWindow();
this.isFull(Ot.SYSTEM) ? this.exitFullscreen() : this.exitFillWindow();
}
/**
* 是否是全屏或网页全屏状态
* @returns 全屏状态
*/
isFull(t) {
return t === Ot.SYSTEM ? this.isFullScreen() : t === Ot.WINDOW ? this.isFillWindow() : this.isFullScreen() || this.isFillWindow();
}
/**
* 全屏
* @param element 需要全屏的元素
* @returns
*/
requestFullscreen(t) {
this._element = t, this._originStyle || this._saveOriginStyle(t), (Nt.os.name === "Mac OS" || Nt.browser.name === "IE" || Nt.os.name === "iOS" && Nt.device.type !== "mobile") && (t.style.width = "100%", t.style.height = "100%", t.style.background = "black");
const r = t;
let s;
r.requestFullscreen ? s = r.requestFullscreen() : r.mozRequestFullscreen ? s = r.mozRequestFullscreen() : r.mozRequestFullScreen ? s = r.mozRequestFullScreen() : r.webkitRequestFullscreen ? s = r.webkitRequestFullscreen() : r.webkitRequestFullScreen ? s = r.webkitRequestFullScreen() : r.msRequestFullscreen && (s = r.msRequestFullscreen()), typeof Promise < "u" && s instanceof Promise && s.catch((l) => this._logger.e(Oo, l));
}
/**
* 退出全屏
*/
exitFullscreen() {
this._recoverStyle(), this._element = void 0;
const t = document;
t.exitFullscreen ? t.exitFullscreen() : t.webkitCancelFullScreen ? t.webkitCancelFullScreen() : t.mozCancelFullScreen ? t.mozCancelFullScreen() : t.msExitFullscreen && t.msExitFullscreen();
}
/**
* 当前是否是全屏状态
* @returns 全屏状态
*/
isFullScreen() {
const t = document;
return !!(t.fullscreen || t.fullscreenElement || t.isFullScreen || t.webkitIsFullScreen || t.mozFullScreen || t.msFullscreenElement);
}
/**
* 网页全屏
* @param element 需要全屏的元素
* @returns
*/
requestFillWindow(t) {
this._element = t, this._originStyle || this._saveOriginStyle(t), t.style.width = "100%", t.style.height = "100%", t.style.background = "black", t.style.position = "fixed", t.style.left = "0", t.style.top = "0", t.style.zIndex = "99999", document.body.classList.add(Mt["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(Mt["kwai-player-disable-scroll"]), this._evt.emit("fullChange", {
type: "window",
isFull: !1
});
}
/**
* 当前是否是网页全屏状态
* @returns 网页全屏状态
*/
isFillWindow() {
return this._isFillWindow;
}
isFullscreenAvailable(t) {
return t !== Ot.WINDOW && typeof document < "u" ? !!document.body.requestFullscreen || !!document.body.webkitRequestFullscreen || !!document.body.msRequestFullscreen || !!document.body.mozRequestFullscreen : !0;
}
_getExitFullscreenFunc() {
const t = document;
return t.exitFullscreen || t.webkitCancelFullScreen || t.mozCancelFullScreen || t.msExitFullscreen;
}
_saveOriginStyle(t) {
this._originStyle = {
position: t.style.position,
background: t.style.background,
width: t.style.width,
height: t.style.height,
left: t.style.left,
right: t.style.right
};
}
_recoverStyle() {
if (this._element)
for (const t in this._originStyle)
this._element.style[t] = this._originStyle[t];
this._originStyle = void 0;
}
}
const mc = "ControlsPlugin", gc = "I18nPlugin", yc = "LoggerPlugin", bc = "HotkeyPlugin", Ec = "PlayInfoPlugin", wc = "RotatePlugin", Tc = "PreviewPlugin", Rc = "MaskPlugin", Sc = "VRPlugin", Lc = "DanmakuPlugin";
var kc = /* @__PURE__ */ ((e) => (e.DARK = "dark", e.LIGHT = "light", e))(kc || {}), Ic = /* @__PURE__ */ ((e) => (e.BOTTOM = "bottom", e.PLAY_BAR = "playBar", e.NONE = "none", e))(Ic || {}), xc = /* @__PURE__ */ ((e) => (e.PLAY_BAR_LEFT = "playBarLeft", e.PLAY_BAR_RIGHT = "playBarRight", e.CONTEXT_MENU = "contextMenu", e))(xc || {});
class gf {
constructor() {
X(this, "_callbacks", []);
}
add(t) {
this._callbacks.push(t);
}
remove(t) {
const r = this._callbacks.findIndex((s) => s === t);
r >= 0 && this._callbacks.splice(r, 1);
}
call(t) {
this._callbacks.forEach((r) => r(t));
}
destroy() {
this._callbacks.splice(0, this._callbacks.length);
}
}
let lt = class extends Ca {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static isInstanceOfPlugin(t) {
return typeof t.beforeInstall == "function" && typeof t.afterInstall == "function" && typeof t.beforeUninstall == "function" && typeof t.afterUninstall == "function" && typeof t.getLabel == "function";
}
/**
* 控制条插槽按钮
*/
get controlsSoltBtns() {
}
/**
* 播放器实例化前钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
beforeInstall(t, r) {
}
/**
* 播放器实例化后钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
afterInstall(t, r) {
}
/**
* 播放器销毁前钩子
* @param player 播放器实例
*/
beforeUninstall(t) {
}
/**
* 播放器销毁后钩子
* @param player 播放器实例
*/
afterUninstall(t) {
}
};
X(lt, "label"), /**
* 版本
*/
X(lt, "version"), /**
* 当前环境是否支持
*/
X(lt, "isSupported");
const Oa = class Ma extends lt {
/**
* @override
*/
getLabel() {
return Ma.label;
}
beforeInstall(t, r) {
}
afterInstall(t, r) {
}
};
X(Oa, "label", mc);
let bf = Oa;
const Na = class Pa extends lt {
/**
* @override
*/
getLabel() {
return Pa.label;
}
beforeInstall(t, r) {
}
afterInstall(t, r) {
}
};
X(Na, "label", gc);
let Ef = Na;
const Ua = class Ba extends lt {
/**
* @override
*/
getLabel() {
return Ba.label;
}
beforeInstall(t, r) {
}
afterInstall(t, r) {
}
/**
* 增加业务相关数据
* @param key 上报数据key
* @param value 上报数据
*/
addBizLog(t, r) {
}
appendSummaryField(t, r) {
}
};
X(Ua, "label", yc);
let wf = Ua;
const Fa = class Ha extends lt {
/**
* @override
*/
getLabel() {
return Ha.label;
}
};
X(Fa, "label", bc);
let Tf = Fa;
const Va = class Ga extends lt {
/**
* @override
*/
getLabel() {
return Ga.label;
}
};
X(Va, "label", Ec);
let Rf = Va;
const Wa = class ja extends lt {
/**
* @override
*/
getLabel() {
return ja.label;
}
};
X(Wa, "label", wc);
let Sf = Wa;
const Ka = class Ja extends lt {
/**
* @override
*/
getLabel() {
return Ja.label;
}
};
X(Ka, "label", Tc);
let Lf = Ka;
const za = class $a extends lt {
/**
* @override
*/
getLabel() {
return $a.label;
}
};
X(za, "label", Rc);
let kf = za;
const qa = class Ya extends lt {
/**
* @override
*/
getLabel() {
return Ya.label;
}
};
X(qa, "label", Sc);
let If = qa;
const Qa = class Za extends lt {
/**
* @override
*/
getLabel() {
return Za.label;
}
};
X(Qa, "label", Lc);
let xf = Qa;
const ot = "pluginBase", Xa = class es {
constructor() {
X(this, "_instances", []);
}
static register(t, r = "append") {
Qe.i(ot, "register", t.label, t.version), t.label || Qe.i(ot, "register plugin label is empty.");
const s = this._plugins.findIndex((l) => l.label === t.label);
s >= 0 ? (Qe.i(ot, `register plugin label: ${t.label} exists.`), this._plugins.splice(s, 1, t)) : r === "append" ? this._plugins.push(t) : this._plugins.unshift(t);
}
static deregister(t) {
if (typeof t == "string") {
Qe.i(ot, "deregister", t);
const r = this._plugins.findIndex((s) => s.label === t);
if (r === -1) {
Qe.i(`${t} plugin unregistered`);
return;
}
this._plugins.splice(r, 1);
} else {
Qe.i(ot, "deregister", t.label);
const r = this._plugins.indexOf(t);
if (r === -1) {
Qe.i(`${t.label} plugin unregistered`);
return;
}
this._plugins.splice(r, 1);
}
}
initialize(t) {
const r = this._instances;
for (const s of es._plugins)
try {
if (t && t[s.label] === !1)
continue;
if (s.isSupported === !1) {
Qe.i(ot, `initialize ${s.label}, ${s.version}. The current browser does not support this plugin.`);
continue;
}
Qe.i(ot, "initialize", s.label, s.version, t);
const l = new s();
lt.isInstanceOfPlugin(l) ? r.push(l) : Qe.e(ot, `plugin type error: ${l}`);
} catch (l) {
Qe.e(ot, "plugin initialize error", l);
}
}
beforeInstallPlugins(t, r) {
for (const s of this._instances) {
const l = s.getLabel();
Qe.i(ot, "beforeInstallPlugins", r, l);
try {
if (!s.beforeInstall)
continue;
r && typeof r[l] == "object" ? s.beforeInstall(t, r[l]) : s.beforeInstall(t);
} catch (d) {
Qe.e(ot, "beforeInstallPlugins error", d);
}
}
}
afterInstallPlugins(t, r) {
for (const s of this._instances) {
const l = s.getLabel();
Qe.i(ot, "afterInstallPlugins", l, r);
try {
if (!s.afterInstall)
continue;
r && typeof r[l] == "object" ? s.afterInstall(t, r[l]) : s.afterInstall(t);
} catch (d) {
Qe.e(ot, "afterInstallPlugins error", d);
}
}
}
beforeUninstallPlugins(t) {
for (const r of this._instances)
try {
if (Qe.i(ot, "beforeUninstallPlugins", r.getLabel()), !r.beforeUninstall)
continue;
r.beforeUninstall.call(r, t);
} catch (s) {
Qe.e(ot, "plugin beforeUninstall error", s);
}
}
afterUninstallPlugins(t) {
for (const r of this._instances)
try {
if (Qe.i(ot, "afterUninstallPlugins", r.getLabel()), !r.afterUninstall)
continue;
r.afterUninstall.call(r, t);
} catch (s) {
Qe.e(ot, "plugin afterUninstall error", s);
}
this._instances = [];
}
getPlugin(t) {
for (let r = 0; r < this._instances.length; r++)
if (this._instances[r].getLabel() === t)
return this._instances[r];
}
getAllPlugins() {
return this._instances;
}
};
X(Xa, "_plugins", []);
let Br = Xa;
const Cc = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAC1JREFUWEft0EERAAAAAUH6lxbDZxU4s815PffjAAECBAgQIECAAAECBAgQIDAaPwAh6O5R/QAAAABJRU5ErkJggg==", re = "kwai-player", en = class bt {
constructor(t, r) {
X(this, "_pluginBase", new Br()), X(this, "_eventHandlers"), X(this, "_evt"), X(this, "_mainDom"), X(this, "_video"), X(this, "_kernel"), X(this, "_error"), X(this, "_config"), X(this, "_src", ""), X(this, "_autoplay", !1), X(this, "_preload", "none"), X(this, "_poster", ""), X(this, "_controls", "default"), X(this, "_videoWidth", 0), X(this, "_videoHeight", 0), X(this, "_kernelLoaded", !1), X(this, "_livePaused", !1), X(this, "_canvas"), X(this, "_mediaInfo"), X(this, "_logger"), X(this, "_isLiveShift", !1), X(this, "_full"), X(this, "_subContainerNumber", 0), X(this, "_data"), X(this, "_id"), X(this, "_videoLayer"), X(this, "_videoInteractiveLayer"), X(this, "_posterLayer"), X(this, "_preprocessSrcFunc"), X(this, "_preprocessURL"), X(this, "_kernelStartTimeout", 0), X(this, "_instanceId"), X(this, "_yodaDom"), X(this, "_yoda"), X(this, "_kernelType", "unknown"), X(this, "_outputLogger"), X(this, "_yodaEnabled", !0), X(this, "_screenshotId", 1), X(this, "_screenshotQueue", []), X(this, "_observer"), X(this, "_objectFit", ""), X(this, "requestFullscreen", (h) => {
if (this._logger.i(re, "requestFullscreen"), !!this._mainDom) {
if (this._yoda) {
this._yoda.isFullscreen() || this._yoda.fullScreen("portrait");
return;
}
this._full.isFull(h) || this._full.requestFull(this._mainDom, h);
}
}), X(this, "exitFullscreen", (h) => {
if (this._logger.i(re, "exitFullscreen"), !!this._mainDom) {
if (this._yoda) {
this._yoda.exitFullScreen();
return;
}
this._full.isFull(h) && this._full.exitFull(h);
}
}), X(this, "_onFullscreenchange", (h) => {
this.emit(z.FULLSCREEN_CHANGE, h);
}), X(this, "_onMutedChange", (h) => {
this._video && (this._video.muted = h);
}), X(this, "_onVideoLoadstart", () => {
this.emit(z.LOADSTART);
}), X(this, "_onVideoProgress", () => {
this.emit(z.PROGRESS);
}), X(this, "_onVideoSuspend", () => {
this.emit(z.SUSPEND);
}), X(this, "_onVideoAbort", () => {
this.emit(z.ABORT);
}), X(this, "_onVideoEmptied", () => {
this.emit(z.EMPTIED);
}), X(this, "_onVideoStalled", () => {
this.emit(z.STALLED);
}), X(this, "_onVideoLoadedmetadata", () => {
this.emit(z.LOADEDMETADATA);
}), X(this, "_onVideoLoadeddata", () => {
this.emit(z.LOADEDDATA);
}), X(this, "_onVideoCanplay", () => {
this.emit(z.CANPLAY);
}), X(this, "_onVideoCanplaythrough", () => {
this.emit(z.CANPLAYTHROUGH);
}), X(this, "_onVideoPlaying", () => {
Nt.os.name !== "iOS" && Nt.os.name !== "Android" && this._hidePosterDom(), this.emit(z.PLAYING);
}), X(this, "_onVideoWaiting", () => {
this.emit(z.WAITING);
}), X(this, "_onVideoSeeking", () => {
this.emit(z.SEEKING);
}), X(this, "_onVideoSeeked", () => {
this.emit(z.SEEKED), this.kernel && this._updateIsLiveShift(this.kernel.liveShift);
}), X(this, "_onVideoEnded", () => {
this.emit(z.ENDED);
}), X(this, "_onVideoDurationchange", () => {
this.emit(z.DURATIONCHANGE);
}), X(this, "_onVideoTimeupdate", () => {
var h, p;
this._posterLayer.style.display !== "none" && ((h = this._video) == null ? void 0 : h.readyState) === 4 && !((p = this._video) != null && p.paused) && this._hidePosterDom(), this.emit(z.TIMEUPDATE);
}), X(this, "_onVideoPlay", () => {
this.emit(z.PLAY);
}), X(this, "_onVideoPause", () => {
this.emit(z.PAUSE);
}), X(this, "_onVideoRatechange", () => {
this.emit(z.RATECHANGE);
}), X(this, "_onVideoResize", () => {
this.emit(z.RESIZE);
}), X(this, "_onVideoVolumechange", () => {
this.emit(z.VOLUMECHANGE);
}), X(this, "_onVideoEnterpictureinpicture", () => {
this.emit(z.ENTER_PICTURE_IN_PICTURE);
}), X(this, "_onVideoLeavepictureinpicture", () => {
this.emit(z.LEAVE_PICTURE_IN_PICTURE);
});
var s;
if (this._instanceId = cc.next(), this._logger = new fa().setLevel(Yr).setName(xa).setId(this._instanceId), r != null && r.logger && this._logger.setOutput(r.logger), wu("kwai-player", bt.packVersion), this._logger.i(re, bt.packVersion, bt.version, this._instanceId, t.toString(), r), this._data = r || {}, typeof t == "string" ? (this._id = t, this._mainDom = document.querySelector(t)) : (this._id = `kp_${Math.random() * 1e3 | 0}`, this._mainDom = t), this._evt = new Ca(), this._evt.setMaxListeners(30), this._full = new _c(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
}, r && typeof r.controls < "u" && (this.controls = r.controls), this._videoLayer = document.createElement("div"), this._videoLayer.className = Mt["kwai-player-video"], this._posterLayer = document.createElement("div"), this._posterLayer.className = Mt["kwai-player-poster"], this._posterLayer.dataset.kpRole = "poster", this._videoLayer.appendChild(this._posterLayer), this._videoInteractiveLayer = document.createElement("div"), this._videoInteractiveLayer.className = Mt["kwai-player-video-interactive"], this._video = document.createElement("video"), !this._mainDom) {
this._logger.i(re, `container not found.${t}`), this._setError({ code: Da.CTOR_ERROR, message: `container not found.${t}` });
return;
}
this._observer = new MutationObserver((h) => {
for (const p of h)
p.type === "attributes" && p.attributeName === "style" && this._applyObjectFit();
});
const l = { attributes: !0, attributeFilter: ["style"] };
this._observer.observe(this._mainDom, l), this._applyObjectFit(), this._mainDom.className = this._mainDom.className ? `${this._mainDom.className} ${Mt["kwai-player"]}` : Mt["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), bt._yodaClass && (this._yodaDom = document.createElement("div"), this._yodaDom.className = Mt["kwai-player-yoda"], this._videoLayer.appendChild(this._yodaDom)), this._bindVideo(), this._pluginBase.initialize(r == null ? void 0 : r.plugins), this._pluginBase.beforeInstallPlugins(this, r == null ? void 0 : r.plugins), r && this._parseData(r);
const d = ((s = this._config) == null ? void 0 : s.src) || this._src;
d && this._initKernel(!1), this._pluginBase.afterInstallPlugins(this, r == null ? void 0 : r.plugins), d && (this._kernelStartTimeout = +setTimeout(() => {
this._clearKernelStartTimer(), this._kernelStart();
}, 0)), this._logger.i(re, "constructor completed.");
}
static get version() {
return "1.1.0";
}
/**
* 获取版本号
*/
get version() {
return bt.version;
}
/**
* 获取包版本号
*/
get packVersion() {
return bt.packVersion;
}
/**
* 实例ID
*/
get instanceId() {
return this._instanceId;
}
/**
* 获取内核类型
*/
get kernelType() {
return this._kernelType;
}
/**
* 本地日志实例
*/
get logger() {
return this._logger;
}
get outputLogger() {
return this._outputLogger;
}
set outputLogger(t) {
this._logger.i(re, "call set output logger", t), this._outputLogger = t, this._logger.setOutput(t), this._kernel && (this._kernel.outputLog = t);
}
/**
* 配置
*/
get config() {
return this._logger.i(re, "call get config", this._config), this._config;
}
set config(t) {
this._logger.i(re, "call set config", t), this._config = t, this._yoda || (this._initKernel(), this.emit(z.ATTRIBUTE_CHANGE_CONFIG));
}
/**
* 获取当前错误
*/
get error() {
return this._logger.i(re, "call get error", this._error), this._error;
}
/**
* videoId
*/
get videoId() {
var t;
return (t = this._data) == null ? void 0 : t.videoId;
}
set videoId(t) {
this._data && (this._data.videoId = t, this.emit(z.ATTRIBUTE_CHANGE_VIDEO_ID));
}
/**
* 设置预览图url
* @remark 依赖预览图插件
*/
get previewUrl() {
var t;
return (t = this._data) == null ? void 0 : t.previewUrl;
}
set previewUrl(t) {
this._logger.i(re, "call set previewUrl", t), this._data && (this._data.previewUrl = t, this.emit(z.ATTRIBUTE_CHANGE_PREVIEW_URL));
}
/**
* 设置弹幕防挡url
* @remark 依赖弹幕防挡插件
*/
get maskUrl() {
var t;
return (t = this._data) == null ? void 0 : t.maskUrl;
}
set maskUrl(t) {
this._logger.i(re, "call set maskUrl", t), this._data && (this._data.maskUrl = t, this.emit(z.ATTRIBUTE_CHANGE_MASK_URL));
}
/**
* 禁用弹幕防挡url
*/
get disableMask() {
var t;
return (t = this._data) == null ? void 0 : t.disableMask;
}
set disableMask(t) {
this._logger.i(re, "call set disableMask", t), this._data && (this._data.disableMask = t, this.emit(z.ATTRIBUTE_CHANGE_DISABLE_MASK));
}
/**
* 获取播放地址
*/
get src() {
return this._logger.v(re, "call get src", this._src), this._src;
}
set src(t) {
this._logger.i(re, "call set src", t), this._src = this._preprocessSrcFunc ? this._preprocessSrcFunc(t) : t, this._destroyKernel(), this.emit(z.ATTRIBUTE_CHANGE_SRC), this._initKernel();
}
/**
* 获取当前是否时移回放
*/
get isLiveShift() {
return this._isLiveShift;
}
set liveShiftType(t) {
this._logger.i(re, "call set liveShiftType", t), this._data && (this._data.liveShiftType = t, this.emit(z.LIVE_SHIFT_TYPE_CHANGE));
}
/**
* 直播时移类型
*/
get liveShiftType() {
var t;
return ((t = this._data) == null ? void 0 : t.liveShiftType) || Li.NONE;
}
set crossOrigin(t) {
this._logger.i(re, "call set crossOrigin", t), this._video && (this._video.crossOrigin = t), this.emit(z.ATTRIBUTE_CHANGE_CROSS_ORIGIN);
}
/**
* 跨域配置
*/
get crossOrigin() {
var t;
return this._logger.v(re, "call get crossOrigin", (t = this._video) == null ? void 0 : t.crossOrigin), this._video ? this._video.crossOrigin : null;
}
/**
* 网络状态
*/
get networkState() {
var t;
return this._logger.v(re, "call get networkState", (t = this._video) == null ? void 0 : t.networkState), this._video ? this._video.networkState : 0;
}
/**
* 预加载配置
*/
get preload() {
return this._logger.v(re, "call get preload", this._preload), this._preload;
}
set preload(t) {
this._logger.i(re, "call set preload", t), this._preload = t, this._video.preload = t, this.emit(z.ATTRIBUTE_CHANGE_PRELOAD);
}
/**
* 获取预加载配置
*/
get buffered() {
var t;
if (!this._yoda)
return (t = this._video) == null ? void 0 : t.buffered;
}
/**
* 获取video元素readyState
*/
get readyState() {
return this._yoda ? this._yoda.readyState : this._video ? this._video.readyState : 0;
}
/**
* 获取video元素seeking状态
*/
get seeking() {
var t;
return this._yoda ? this._yoda.seeking : !!((t = this._video) != null && t.seeking);
}
/**
* 获取video播放时间
*/
get currentTime() {
return this._yoda ? this._yoda.currentTime : this._video ? this._video.currentTime : 0;
}
set currentTime(t) {
this._logger.i(re, "call set currentTime", t);
try {
this._yoda && (this._yoda.currentTime = t), this._video && (this._video.currentTime = t), this.emit(z.ATTRIBUTE_CHANGE_CURRENT_TIME);
} catch (r) {
}
}
/**
* 获取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 t;
return this._logger.v(re, "call get defaultPlaybackRate", (t = this._video) == null ? void 0 : t.defaultPlaybackRate), this._video ? this._video.defaultPlaybackRate : 1;
}
set defaultPlaybackRate(t) {
this._logger.i(re, "call set defaultPlaybackRate", t), this._yoda && (this._yoda.defaultPlaybackRate = t), this._video && (this._video.defaultPlaybackRate = t), this.emit(z.ATTRIBUTE_CHANGE_DEFAULT_PLAYBACK_RATE);
}
/**
* 获取当前倍速
*/
get playbackRate() {
return this._video ? this._video.playbackRate : 1;
}
set playbackRate(t) {
this._logger.i(re, "call set playbackRate", t), this._yoda && (this._yoda.playbackRate = t), this._video && (this._video.playbackRate = t), this.emit(z.ATTRIBUTE_CHANGE_PLAYBACK_RATE);
}
/**
* 获取是否播放
* yoda返回undefined
*/
get played() {
var t;
if (!this._yoda)
return (t = this._video) == null ? void 0 : t.played;
}
/**
* 获取是否可以seek
* yoda返回undefined
*/
get seekable() {
var t;
if (!this._yoda)
return (t = this._video) == null ? void 0 : t.seekable;
}
/**
* 获取是否播放完成
*/
get ended() {
return this._yoda ? this._yoda.ended : this._video ? this._video.ended : !1;
}
/**
* 获取是否自动播放
*/
get autoplay() {
return this._autoplay;
}
set autoplay(t) {
this._logger.i(re, "call set autoplay", t), this._autoplay = t, this._yoda && (this._yoda.autoplay = t), this.emit(z.ATTRIBUTE_CHANGE_AUTOPLAY);
}
/**
* 获取是否循环播放
*/
get loop() {
return this._yoda ? this._yoda.loop : this._video ? this._video.loop : !1;
}
set loop(t) {
this._logger.i(re, "call set loop", t), this._video && (this._video.loop = t), this.emit(z.ATTRIBUTE_CHANGE_LOOP);
}
/**
* 获取是否显示控制条
*/
get controls() {
return this._controls;
}
set controls(t) {
this._logger.i(re, "call set controls", t), t !== this._controls && (this._controls = t), this.emit(z.ATTRIBUTE_CHANGE_CONTROLS);
}
/**
* 音量
* yoda始终返回1
*/
get volume() {
return this._yoda ? 1 : this._video ? this._video.volume : 1;
}
set volume(t) {
this._video && (this._video.volume = t < 0 ? 0 : t > 1 ? 1 : t, this.emit(z.ATTRIBUTE_CHANGE_VOLUME));
}
/**
* 获取静音状态
*/
get muted() {
return this._yoda ? this._yoda.muted : this._video ? this._video.muted : !1;
}
set muted(t) {
this._logger.i(re, `call set muted: ${t}, hasVideo: ${!!this._video}`), this._yoda && (this._yoda.muted = t), this._video && (this._video.muted = t), this.emit(z.ATTRIBUTE_CHANGE_MUTED);
}
/**
* 获取默认静音状态
*/
get defaultMuted() {
return this._yoda ? this._yoda.defaultMuted : this._video ? this._video.defaultMuted : !1;
}
set defaultMuted(t) {
this._logger.i(re, "call set defaultMuted", t), this._yoda && (this._yoda.defaultMuted = t), this._video && (this._video.defaultMuted = t), this.emit(z.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 t;
return this._videoWidth || ((t = this._video) == null ? void 0 : t.videoWidth);
}
/**
* 获取视频高
*/
get videoHeight() {
var t;
return this._videoHeight || ((t = this._video) == null ? void 0 : t.videoHeight);
}
/**
* 获取封面图
*/
get poster() {
return this._poster;
}
set poster(t) {
this._logger.i(re, "call set poster", t), this._poster = t, this._updatePosterDom(), this.emit(z.ATTRIBUTE_CHANGE_POSTER);
}
/**
* 获取禁用画中画状态
* yoda无效
*/
get disablePictureInPicture() {
var t;
return this._yoda ? !0 : !!((t = this._video) != null && t.disablePictureInPicture);
}
set disablePictureInPicture(t) {
this._logger.i(re, "call set disablePictureInPicture", t), !this._yoda && this._video && (this._video.disablePictureInPicture = t, this.emit(z.ATTRIBUTE_CHANGE_DISABLE_PICTURE_IN_PICTURE));
}
/**
* UI中是否展示下载按钮
*/
get disableDownload() {
var t;
return (t = this._data) == null ? void 0 : t.disableDownload;
}
set disableDownload(t) {
this._logger.i(re, "call set disableDownload", t), this._data && (this._data.disableDownload = t, this.emit(z.ATTRIBUTE_CHANGE_DISABLE_DOWNLOAD));
}
/**
* 获取是否内联(inline)播放
*/
get playsinline() {
var t;
return !!((t = this._video) != null && t.hasAttribute("playsinline"));
}
set playsinline(t) {
this._logger.i(re, "call set playsinline", t), this._video && (this._video.playsInline = t, this._video.webKitPlaysInline = t, t ? (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(z.ATTRIBUTE_CHANGE_PLAYSINLINE));
}
/**
* 获取自适应码率开关状态
*/
get disableAdaptive() {
var t;
return (t = this._data) == null ? void 0 : t.disableAdaptive;
}
set disableAdaptive(t) {
this._logger.i(re, "call set disableAdaptive", t), this._data && (this._data.disableAdaptive = t, this.emit(z.ATTRIBUTE_CHANGE_DISABLE_ADAPTIVE));
}
/**
* 获取当前视频轨id
*/
get currentLevel() {
var t;
return ((t = this._kernel) == null ? void 0 : t.currentLevel) || 0;
}
set currentLevel(t) {
var r, s, l;
if (this._logger.i(re, "call set currentLevel", t, !!this._kernel, this._livePaused), this._kernel) {
const d = this._video.paused;
this._livePaused ? ((r = this._kernel) == null || r.refresh(), this._kernel.currentLevel = t) : (this._kernel.currentLevel = t, this.emit(z.ATTRIBUTE_CHANGE_CURRENT_LEVEL)), !d && this._video.paused && (this._logger.i(re, "set level. play"), (l = (s = this._video) == null ? void 0 : s.play()) == null || l.catch((h) => this._logger.i(re, "set current level, call play() fail.", h)));
}
}
/**
* 获取即将切换的视频轨id
*/
get nextLevel() {
var t;
return ((t = this._kernel) == null ? void 0 : t.nextLevel) || 0;
}
set nextLevel(t) {
var r, s, l;
if (this._logger.i(re, "call set nextLevel", t), this._kernel) {
const d = this._video.paused;
this._livePaused ? ((r = this._kernel) == null || r.refresh(), this._kernel.currentLevel = t) : (this._kernel.nextLevel = t, this.emit(z.ATTRIBUTE_CHANGE_NEXT_LEVEL)), !d && this._video.paused && (this._logger.i(re, "set next level. play"), (l = (s = this._video) == null ? void 0 : s.play()) == null || l.catch((h) => this._logger.i(re, "set next level, call play() fail.", h)));
}
}
/**
* 获取当前播放帧数
*/
get currentVideoFrame() {
var t;
return ((t = this._kernel) == null ? void 0 : t.currentVideoFrame) || 0;
}
set currentVideoFrame(t) {
this._kernel && (this._kernel.currentVideoFrame = t, this.emit(z.ATTRIBUTE_CHANGE_CURRENT_FRAME));
}
/**
* 获取当前视频总帧数
*/
get totalVideoFrames() {
var t;
return ((t = this._kernel) == null ? void 0 : t.totalVideoFrames) || 0;
}
/**
* 当前清晰度时间信息
*/
get currentLevelTimeInfo() {
var t;
return (t = this._kernel) == null ? void 0 : t.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(t) {
this._logger.i(re, "call set audioTrack", t), this._kernel && (this._kernel.audioTrack = t, this.emit(z.ATTRIBUTE_CHANGE_AUDIO_TRACK));
}
/**
* 产品ID,用于上报
*/
get productName() {
var t;
return (t = this._data) == null ? void 0 : t.productName;
}
set productName(t) {
this._logger.i(re, "call set productName", t), this._data && (this._data.productName = t);
}
/**
* 获取当前是否开启连接预热
* @remarks 依赖预加载插件
*/
get prefetch() {
var t;
return (t = this._data) == null ? void 0 : t.prefetch;
}
set prefetch(t) {
this._logger.i(re, "call set prefetch", t), this._data && (this._data.prefetch = t, this.emit(z.ATTRIBUTE_CHANGE_PREFETCH));
}
/**
* 获取是否显示进度条
* @remarks 依赖控制条插件
*/
get showProgress() {
var t;
return (t = this._data) == null ? void 0 : t.showProgress;
}
set showProgress(t) {
this._logger.i(re, "call set showProgress", t), this._data && (this._data.showProgress = t, this.emit(z.ATTRIBUTE_CHANGE_SHOW_PROGRESS));
}
/**
* 是否显示时间
* @remarks 依赖控制条插件
*/
get showTime() {
var t;
return (t = this._data) == null ? void 0 : t.showTime;
}
set showTime(t) {
this._logger.i(re, "call set showTime", t), this._data && (this._data.showTime = t, this.emit(z.ATTRIBUTE_CHANGE_SHOW_TIME));
}
/**
* 获取是否启用热键
* @remarks 依赖热键插件
*/
get disableHotkey() {
var t;
return (t = this._data) == null ? void 0 : t.disableHotkey;
}
set disableHotkey(t) {
this._logger.i(re, "call set disableHotkey", t), this._data && (this._data.disableHotkey = t, this.emit(z.ATTRIBUTE_CHANGE_DISABLE_HOTKEY));
}
/**
* 弹幕是否可用
* @remark 依赖弹幕插件
*/
get disableDanmaku() {
var t;
return (t = this._data) == null ? void 0 : t.disableDanmaku;
}
set disableDanmaku(t) {
this._logger.i(re, "call set disableDanmaku", t), this._data && (this._data.disableDanmaku = t, this.emit(z.ATTRIBUTE_CHANGE_DISABLE_DANMAKU));
}
/**
* 是否渲染弹幕
* @remark 依赖弹幕插件
*/
get danmakuRendering() {
var t;
return (t = this._data) == null ? void 0 : t.danmakuRendering;
}
set danmakuRendering(t) {
this._logger.i(re, "call set danmakuRendering", t), this._data && (this._data.danmakuRendering = t, this.emit(z.ATTRIBUTE_CHANGE_DANMAKU_RENDERING));
}
/**
* 设置是否显示信息面板
* @remarks 依赖信息面板插件
*/
get showInfoPanel() {
var t;
return (t = this._data) == null ? void 0 : t.showInfoPanel;
}
set showInfoPanel(t) {
this._logger.i(re, "call set showInfoPanel", t), this._data && (this._data.showInfoPanel = t, this.emit(z.ATTRIBUTE_CHANGE_SHOW_INFO_PANEL));
}
/**
* 是否显示下一个按钮,与UI相关
*/
get showNext() {
var t;
return (t = this._data) == null ? void 0 : t.showNext;
}
set showNext(t) {
this._logger.i(re, "call set showNext", t), this._data && (this._data.showNext = t, this.emit(z.ATTRIBUTE_CHANGE_SHOW_NEXT));
}
/**
* 是否显示上一个按钮,与UI相关
*/
get showPrev() {
var t;
return (t = this._data) == null ? void 0 : t.showPrev;
}
set showPrev(t) {
this._logger.i(re, "call set showPrev", t), this._data && (this._data.showPrev = t, this.emit(z.ATTRIBUTE_CHANGE_SHOW_PREV));
}
/**
* 业务参数
*/
get bizData() {
var t;
return (t = this._data) == null ? void 0 : t.bizData;
}
set bizData(t) {
this._logger.i(re, "set biz data", t), this._data && (this._data.bizData = t), this._yoda && this._yoda.updateUserConfig({ biz: JSON.parse(JSON.stringify(t)) }), this.emit(z.ATTRIBUTE_CHANGE_BIZ_DATA);
}
/**
* 当前场次直播时间信息,配合直播时移功能
* @alpha
*/
get liveTime() {
var t;
return (t = this._data) != null && t.liveTime ? { start: this._data.liveTime.start, end: this._data.liveTime.end } : void 0;
}
set liveTime(t) {
this._logger.i(re, "set live time", t), this._data && (this._data.liveTime = Object.assign({}, t)), this.emit(z.ATTRIBUTE_CHANGE_LIVE_TIME);
}
get objectFit() {
return this._objectFit;
}
/**
* 返回当前的内核实例
*/
get kernel() {
return this._kernel;
}
setPreprocessURL(t) {
this._preprocessURL = t;
}
setPreprocessSrcFunc(t) {
this._preprocessSrcFunc = t;
}
/**
* 加载视频
*/
load() {
var t;
this._logger.i(re, "call load"), (t = this._kernel) == null || t.load(), this._kernelLoaded = !0;
}
/**
* 播放视频
*/
play() {
var t, r, s, l, d;
return this._logger.i(re, "call play", this._kernelLoaded, this._livePaused), this._yoda ? ((r = (t = this._video) == null ? void 0 : t.play()) == null || r.catch((h) => this._logger.i(re, "play, call play() fail.", h)), this._yoda.play()) : (this._livePaused && !this._isLiveShiftMode() ? (s = this._kernel) == null || s.refresh() : this._kernelLoaded || this.load(), this._video.paused ? (d = (l = this._video) == null ? void 0 : l.play()) == null ? void 0 : d.catch((h) => this._logger.i(re, "play, call play() fail.", h)) : Promise.resolve());
}
/**
* 暂停视频
*/
pause() {
var t, r, s;
if (this._logger.i(re, "call pause", (t = this._mediaInfo) == null ? void 0 : t.isLive), this._yoda) {
this._yoda.pause();
return;
}
return this._kernel && (r = this._mediaInfo) != null && r.isLive && !this._isLiveShiftMode() && (this._logger.i(re, "live stop load"), this._kernel.stopLoad(), this._livePaused = !0), this._isLiveShiftMode() && !this._isLiveShift && this._updateIsLiveShift(!0), (s = this._video) == null ? void 0 : s.pause();
}
/**
* 开启画中画
*/
requestPictureInPicture() {
return this._logger.i(re, "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 : vc();
}
/**
* 销毁播放器
*/
destroy() {
var t, r, s;
this._logger.i(re, "call destroy"), (t = this._observer) == null || t.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(), (r = this._videoLayer.parentElement) == null || r.removeChild(this._videoLayer), (s = this._videoLayer.parentElement) == null || s.removeChild(this._videoInteractiveLayer), this.removeAllListeners(), this._pluginBase.afterUninstallPlugins(this);
}
/**
* 重新加载视频
*/
refresh() {
var t;
this._logger.i(re, "call refresh"), (t = this._kernel) == null || t.refresh();
}
/**
* 支持时移时回到直播状态
*/
jumpToLive() {
var t, r;
this._logger.i(re, `call jumpToLive type: ${(t = this._data) == null ? void 0 : t.liveShiftType}`), this.kernel && (r = this._data) != null && r.liveShiftType && this._isLiveShiftMode() && (this.video.currentTime = this.video.duration - this.kernel.liveShiftDelaySec, this.kernel && this._updateIsLiveShift(!0));
}
/**
* 获取流时间
* @param val 播放时间,ms
* @returns 播放时间对应的流时间,ms
*/
getStreamTime(t) {
var r;
return this._yoda ? 0 : ((r = this._kernel) == null ? void 0 : r.getStreamTime(t)) || 0;
}
/**
* 注册播放器插件
* @param plugin plugin需继承自PluginModule
*/
static register(t, r = "append") {
Br.register(t, r);
}
/**
* 注销播放器插件
* @param plugin 插件或插件名称
*/
static deregister(t) {
Br.deregister(t);
}
/**
* 设置yoda kernel 定义
* @param val yoda kernel
*/
static setYoda(t) {
bt._yodaClass = t;
}
/**
* 根据插件名获取插件实例
* @param label 插件名
* @returns plugin
*/
getPluginInstance(t) {
return this._pluginBase.getPlugin(t);
}
/**
* 获取所有的插件实例
* @returns 所有的插件实例
*/
getAllPlugins() {
return this._pluginBase.getAllPlugins();
}
/**
* 创建一个子容器
* @returns HTMLDivELement
*/
createSubContainer(t = Ji.DEFAULT) {
const r = document.createElement("div");
r.id = `${this._id}-sub-${Math.round(this._subContainerNumber++)}`;
let s = this._mainDom;
if (t === Ji.VIDEO && (s = this._videoLayer), t === Ji.VIDEO_INTERACTIVE && (s = this._videoInteractiveLayer), s)
s.children.length ? s.children[s.children.length - 1].insertAdjacentElement("afterend", r) : s.appendChild(r);
else
throw new Error("cteate sub container error. no parent found.");
return r;
}
/**
* 是否全屏
* @returns boolean
*/
isFullscreen(t) {
return this._yoda ? this._yoda.isFullscreen() : this._full.isFull(t);
}
isFullscreenAvailable(t) {
return this._yoda ? !0 : this._full.isFullscreenAvailable(t);
}
_applyObjectFit() {
var t;
const r = ((t = this._mainDom) == null ? void 0 : t.style.objectFit) || "";
this._logger.i(re, `apply objectFit: ${r}`), this._video.style.objectFit = r, this._canvas && (this._canvas.style.objectFit = r), this._yoda && (this._yoda.objectFit = r || "contain"), this._objectFit = r, this.emit(z.OBJECT_FIT_CHANGE);
}
removeSubContainer(t) {
t.parentElement && t.parentElement.removeChild(t);
}
/**
* 当前画面截图
* yoda暂不支持截图
* @returns 截图
*/
screenshot() {
const t = this._kernel;
return this._yoda ? (this._logger.i(re, "screenshot yoda"), this._yoda.screenshot()) : t ? (this._screenshotId++, new Promise((r) => {
const s = this._screenshotId.toString();
this._screenshotQueue.push({
id: s,
timer: setTimeout(() => {
this._logger.i(re, `screenshot[${s}] timeout.`), this._resolveScreenShotFromQueue(s);
}, 500),
callback: r
}), t.screenshot({ id: s }), this._logger.i(re, `screenshot[${s}] kernel`);
})) : (this._logger.i(re, "screenshot player not ready."), Promise.resolve());
}
_resolveScreenShotFromQueue(t, r) {
for (let s = 0; s < this._screenshotQueue.length; s++)
if (t === this._screenshotQueue[s].id) {
clearTimeout(this._screenshotQueue[s].timer), this._screenshotQueue[s].callback(r), this._screenshotQueue.splice(s, 1);
return;
}
this._logger.i(re, `screenshot[${t}] not found.`);
}
/**
* 获取主容器
* @returns
*/
get mainContainer() {
return this._mainDom;
}
get videoLayer() {
return this._videoLayer;
}
get videoInteractiveLayer() {
return this._videoInteractiveLayer;
}
/**
* 获取当前QOS信息
* @returns
*/
get audienceStat() {
var t;
return (t = this._kernel) == null ? void 0 : t.getAudienceStat();
}
/** @internal */
_updatePosterDom() {
ui ? (this._video.poster = this._poster || "", this._hidePosterDom()) : this._poster ? (this._video.poster = Cc, this._posterLayer.className = Mt["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(t) {
this._video && (this._video.style.display = t ? "none" : "block");
}
/** @internal */
_setError(t) {
this._error = t, this._error && setTimeout(() => {
try {
this.emit(z.ERROR, this._error);
} catch (r) {
}
}, 0);
}
/** @internal */
_resetPlayerStat() {
if (this._canvas) {
try {
this._videoLayer.removeChild(this._canvas);
} catch (t) {
}
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(t) {
if (this._logger.i(re, "yoda init"), !bt._yodaClass || !this._yodaDom || !this._src)
return !1;
const r = Ac.parse(this._src);
return r && r.src ? (this._yoda || (this._logger.i(re, "yoda new instance."), this._yoda = new bt._yodaClass(this._yodaDom, this._logger, t), this._bindYoda(this._yoda), this._kernelType = "yoda"), this._logger.i(re, "yoda instance already exists. try update conf"), r.isLive ? this._yoda.src = { isLive: r.isLive, src: r.src } : this._yoda.src = { isLive: r.isLive, src: r.src }, this.emit(z.ATTRIBUTE_CHANGE_MUTED), !0) : !1;
}
/** @internal */
_bindYoda(t) {
this._logger.i(re, "yoda bind event."), t.on("play", this._onVideoPlay), t.on("playing", this._onVideoPlaying), t.on("pause", this._onVideoPause), t.on("loadedmetadata", () => {
this._onVideoLoadedmetadata(), this._onVideoDurationchange();
}), t.on("timeupdate", this._onVideoTimeupdate), t.on("ended", this._onVideoEnded), t.on("waiting", this._onVideoWaiting), t.on("seeked", this._onVideoSeeked), t.on("seeking", this._onVideoSeeking), t.on("resize", (r) => {
this._videoWidth = r.data.width, this._videoHeight = r.data.height, this._onVideoResize();
}), t.on("error", (r) => {
if (r.data.type === "initFailed" || r.data.type === "canNotInsert" || r.data.type === "internal" || r.data.type === "domLost") {
const s = t.actionOnReady === "play";
this._destroyYoda(), this._yodaEnabled = !1, this._initKernel(), s && this.play();
return;
}
this._setError(Object.assign({ code: 0 }, r.data.originalError));
});
}
/** @internal */
_bindVideo() {
if (this._video)
for (const t in this._eventHandlers)
this._video.addEventListener(t, this._eventHandlers[t]);
}
/** @internal */
_unbindVideo() {
if (this._video)
for (const t in this._eventHandlers)
this._video.removeEventListener(t, this._eventHandlers[t]);
}
/** @internal */
_parseData(t) {
this._logger.i(re, "parse data.", t), t.src && (this._src = this._preprocessSrcFunc ? this._preprocessSrcFunc(t.src) : t.src), t.config && (this._config = t.config), t.crossOrigin && (this.crossOrigin = t.crossOrigin), typeof t.preload < "u" && (this.preload = t.preload), typeof t.defaultPlaybackRate == "number" && (this.defaultPlaybackRate = t.defaultPlaybackRate), typeof t.playbackRate == "number" && (this.playbackRate = t.playbackRate), typeof t.autoplay < "u" && (this.autoplay = t.autoplay), typeof t.loop < "u" && (this.loop = t.loop), typeof t.controls < "u" && (this.controls = t.controls), typeof t.volume == "number" && (this.volume = t.volume), typeof t.muted < "u" && (this.muted = t.muted), typeof t.defaultMuted < "u" && (this.defaultMuted = t.defaultMuted), typeof t.disablePictureInPicture < "u" && (this.disablePictureInPicture = t.disablePictureInPicture), typeof t.disableAdaptive < "u" && (this.disableAdaptive = t.disableAdaptive), typeof t.playsinline < "u" && (this.playsinline = t.playsinline), typeof t.liveShiftType < "u" && (this.liveShiftType = t.liveShiftType), typeof t.logger < "u" && (this._outputLogger = t.logger), this.poster = t.poster || "";
}
/** @internal */
_initKernel(t = !0) {
var r, s, l, d, h;
if (this._logger.i(re, "init kernel"), !this._video)
return;
if (this._posterLayer.style.display = ui ? "none" : "block", this._destroyKernel(), !this._src && !((r = this._config) != null && r.src)) {
this._video.src = "", this._resetPlayerStat();
return;
}
this._config || (this._config = {});
const p = Object.assign({}, this._config, {
adaptive: ((s = this._data) == null ? void 0 : s.disableAdaptive) === !1,
liveShiftType: (l = this._data) == null ? void 0 : l.liveShiftType,
ntp: !1
});
if (Zr.verify(this._src) ? (this._logger.i(re, "live feed to media desc"), p.src = Zr.parse(this._src)) : p.src = this._src, this._preprocessURL && (p.preprocessUrl = this._preprocessURL), typeof p.nativeFirst > "u" && ui && (p.nativeFirst = !0), this._isLiveShiftMode() && (p.catchUpPausedLive = !1), (d = this._data) != null && d.logger && (p.logger = this._data.logger), this._resetPlayerStat(), this._logger.i(re, `yoda check mobile: ${ui} liveshift: ${this.liveShiftType} class: ${!!bt._yodaClass}`), ui && this._yodaEnabled && this.liveShiftType === Li.NONE && bt._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: (h = this._data) == null ? void 0 : h.bizData
};
if (this._initYodaKernel(x)) {
t && this._clearKernelStartTimer();
return;
}
} else
this._destroyYoda();
this._kernelType = "kwai-player-kernel", this._logger.i(re, "init kernel", this._kernelType);
const E = this._kernel = new uc(this._video, p);
E.on(ht.VIDEO_RENDERER_CHANGE, (x) => {
const v = this._videoLayer;
if (x.type === "canvas" && (this._setIsUseCanvas(!0), this._canvas = x.canvas, this._canvas && v.insertAdjacentElement("afterbegin", this._canvas)), x.type === "video") {
this._setIsUseCanvas(!1);
try {
this._canvas && v.removeChild(this._canvas);
} catch (O) {
}
this._canvas = void 0;
}
this._applyObjectFit(), this.emit(z.VIDEO_RENDERER_CHANGE, x);
}), E.on(ht.MANIFEST_PARSED, (x) => {
this._logger.i(re, ht.MANIFEST_PARSED, x), this.emit(z.MANIFEST_PARSED, x);
}), E.on(ht.LEVEL_SWITCHING, (x) => {
this.emit(z.LEVEL_SWITCHING, x);
}), E.on(ht.LEVEL_SWITCHED, (x) => {
this.emit(z.LEVEL_SWITCHED, x);
}), E.on(ht.LEVEL_SWITCH_PLAYING, (x) => {
this.emit(z.LEVEL_SWITCH_PLAYING, x);
}), E.on(ht.LEVEL_SWITCH_FAILED, () => {
this.emit(z.LEVEL_SWITCH_FAILED);
}), E.on(ht.LEVEL_UPDATED, (x) => {
this.emit(z.LEVEL_UPDATED, x);
}), E.on(ht.AUDIO_TRACK_SWITCHING, (x) => {
this.emit(z.AUDIO_TRACKS_SWITCHING, x);
}), E.on(ht.AUDIO_TRACK_SWITCHED, (x) => {
this.emit(z.AUDIO_TRACKS_SWITCHED, x);
}), E.on(ht.ERROR, (x) => {
this._setError({ code: x.code, message: x.reason });
}), E.on(ht.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(z.REPORT, x);
}), E.on(ht.SCREENSHOT, (x) => {
this._logger.i(re, `screenshot[${x.id}] kernel evt. id: ${x.id} img: ${!!x.image}`), x.id && this._resolveScreenShotFromQueue(x.id, x.image);
}), t && (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 t = this._video.play();
t instanceof Promise && t.catch(() => {
var r;
this._logger.i(re, "autoplay fail, retry."), this._onMutedChange(!0), (r = this._video) == null || r.play().catch(() => {
});
});
}
}
/** @internal */
_updateIsLiveShift(t) {
t !== this._isLiveShift && (this._isLiveShift = t, this.emit(z.LIVE_SHIFT_CHANGE));
}
/** @internal */
_isLiveShiftMode() {
var t;
return !!((t = this._data) != null && t.liveShiftType) && this._data.liveShiftType !== Li.NONE;
}
on(t, r) {
this._evt.on(t, r);
}
once(t, r) {
this._evt.once(t, r);
}
removeAllListeners(t) {
this._logger.i(re, "call removeAllListeners"), this._evt.removeAllListeners(t);
}
off(t, r) {
this._evt.off(t, r);
}
listeners(t) {
return this._evt.listeners(t);
}
emit(t, r) {
return this._evt.emit(t, r);
}
listenerCount(t) {
return this._evt.listenerCount(t);
}
};
X(en, "packVersion", "1.1.0"), /** @internal */
X(en, "_yodaClass");
let ki = en;
const Oe = "vue2", Dc = [
z.LOADSTART,
z.PROGRESS,
z.SUSPEND,
z.ABORT,
z.ERROR,
z.EMPTIED,
z.STALLED,
z.LOADEDMETADATA,
z.LOADEDDATA,
z.CANPLAY,
z.CANPLAYTHROUGH,
z.PLAYING,
z.WAITING,
z.SEEKING,
z.SEEKED,
z.ENDED,
z.DURATIONCHANGE,
z.TIMEUPDATE,
z.PLAY,
z.PAUSE,
z.RATECHANGE,
z.RESIZE,
z.VOLUMECHANGE,
z.MANIFEST_PARSED,
z.LEVEL_SWITCHING,
z.LEVEL_SWITCHED,
z.LEVEL_SWITCH_PLAYING,
z.LEVEL_SWITCH_FAILED,
z.AUDIO_TRACKS_SWITCHING,
z.AUDIO_TRACKS_SWITCHED,
z.FULLSCREEN_CHANGE,
z.LEVEL_UPDATED,
z.CLICK_NEXT,
z.CLICK_REGISTER,
z.CLICK_LOGIN,
z.CLICK_VIP,
z.INTERACTION,
z.ATTRIBUTE_CHANGE,
z.REPORT
], Oc = {
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(Oe, "call set config", e), this.player.config = e);
},
controls: function(e) {
this.player && (this.player.logger.i(Oe, "call set controls", e), this.player.controls = e);
},
videoId: function(e) {
this.player && (this.player.logger.i(Oe, "call set videoId", e), this.player.videoId = e);
},
src: function(e) {
this.player && (this.player.logger.i(Oe, "call set src", e), this.player.src = e);
},
autoplay: function(e) {
this.player && (this.player.logger.i(Oe, "call set autoplay", e), this.player.autoplay = e);
},
crossOrigin: function(e) {
this.player && (this.player.logger.i(Oe, "call set crossOrigin", e), this.player.crossOrigin = e);
},
defaultMuted: function(e) {
this.player && (this.player.logger.i(Oe, "call set defaultMuted", e), this.player.defaultMuted = e);
},
defaultPlaybackRate: function(e) {
this.player && (this.player.logger.i(Oe, "call set defaultPlaybackRate", e), this.player.defaultPlaybackRate = e);
},
loop: function(e) {
this.player && (this.player.logger.i(Oe, "call set loop", e), this.player.loop = e);
},
muted: function(e) {
this.player && (this.player.logger.i(Oe, "call set muted", e), this.player.muted = e);
},
preload: function(e) {
this.player && (this.player.logger.i(Oe, "call set preload", e), this.player.preload = e || "none");
},
poster: function(e) {
this.player && (this.player.logger.i(Oe, "call set poster", e), this.player.poster = e || "");
},
currentTime: function(e) {
this.player && (this.player.logger.i(Oe, "call set currentTime", e), this.player.currentTime = e);
},
playbackRate: function(e) {
this.player && (this.player.logger.i(Oe, "call set playbackRate", e), this.player.playbackRate = e);
},
volume: function(e) {
this.player && (this.player.logger.i(Oe, "call set volume", e), this.player.volume = e);
},
disablePictureInPicture: function(e) {
this.player && (this.player.logger.i(Oe, "call set disablePictureInPicture", e), this.player.disablePictureInPicture = e);
},
playsinline: function(e) {
this.player && (this.player.logger.i(Oe, "call set playsinline", e), this.player.playsinline = e);
},
disableDownload: function(e) {
this.player && (this.player.logger.i(Oe, "call set disableDownload", e), this.player.disableDownload = e);
},
disableAdaptive: function(e) {
this.player && (this.player.logger.i(Oe, "call set disableAdaptive", e), this.player.disableAdaptive = e);
},
disableHotkey: function(e) {
this.player && (this.player.logger.i(Oe, "call set disableHotkey", e), this.player.disableHotkey = e);
},
disableMask: function(e) {
this.player && (this.player.logger.i(Oe, "call set disableMask", e), this.player.disableMask = e);
},
currentLevel: function(e) {
this.player && (this.player.logger.i(Oe, "call set currentLevel", e), this.player.currentLevel = e);
},
nextLevel: function(e) {
this.player && (this.player.logger.i(Oe, "call set nextLevel", e), this.player.nextLevel = e);
},
audioTrack: function(e) {
this.player && (this.player.logger.i(Oe, "call set audioTrack", e), this.player.audioTrack = e);
},
currentVideoFrame: function(e) {
this.player && (this.player.logger.i(Oe, "call set currentVideoFrame", e), this.player.currentVideoFrame = e);
},
showProgress: function(e) {
this.player && (this.player.logger.i(Oe, "call set showProgress", e), this.player.showProgress = e);
},
showTime: function(e) {
this.player && (this.player.logger.i(Oe, "call set showTime", e), this.player.showTime = e);
},
prefetch: function(e) {
this.player && (this.player.logger.i(Oe, "call set prefetch", e), this.player.prefetch = e);
},
showInfoPanel: function(e) {
this.player && (this.player.logger.i(Oe, "call set showInfoPanel", e), this.player.showInfoPanel = e);
},
previewUrl: function(e) {
this.player && (this.player.logger.i(Oe, "call set previewUrl", e), this.player.previewUrl = e);
},
maskUrl: function(e) {
this.player && (this.player.logger.i(Oe, "call set maskUrl", e), this.player.maskUrl = e);
},
disableDanmaku: function(e) {
this.player && (this.player.logger.i(Oe, "call set disableDanmaku", e), this.player.disableDanmaku = e);
},
danmakuRendering: function(e) {
this.player && (this.player.logger.i(Oe, "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 t;
return (t = this.player) == null ? void 0 : t.isFullscreen(e);
},
requestFullscreen(e) {
var t;
(t = this.player) == null || t.requestFullscreen(e);
},
exitFullscreen(e) {
var t;
(t = this.player) == null || t.exitFullscreen(e);
},
isFullscreenAvailable(e) {
var t;
return (t = this.player) == null ? void 0 : t.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 t;
return ((t = this.player) == null ? void 0 : t.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) || Li.NONE;
},
setLiveShiftType(e) {
this.player && (this.player.liveShiftType = e);
},
getVersion() {
return ki.version;
},
getPluginInstance(e) {
var t;
return (t = this.player) == null ? void 0 : t.getPluginInstance(e);
},
getAllPlugins() {
var e;
return (e = this.player) == null ? void 0 : e.getAllPlugins();
}
},
created() {
this.cid = this.id || nc();
},
mounted() {
const e = this.player = new ki(`#${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(Oe, "mounted"), Dc.forEach((t) => {
e.on(t, (r) => {
this.$emit(t, r);
});
});
},
beforeUnmount() {
this.player.destroy();
}
};
var Mc = function() {
var e = this, t = e.$createElement, r = e._self._c || t;
return r("div", {
attrs: {
id: e.cid
}
}, [e._t("watermark")], 2);
}, Nc = [];
function Pc(e, t, r, s, l, d, h, p) {
var E = typeof e == "function" ? e.options : e;
t && (E.render = t, E.staticRenderFns = r, E._compiled = !0), s && (E.functional = !0), d && (E._scopeId = "data-v-" + d);
var x;
if (h ? (x = function(A) {
A = A || // cached call
this.$vnode && this.$vnode.ssrContext || // stateful
this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !A && typeof __VUE_SSR_CONTEXT__ < "u" && (A = __VUE_SSR_CONTEXT__), l && l.call(this, A), A && A._registeredComponents && A._registeredComponents.add(h);
}, E._ssrRegister = x) : l && (x = p ? function() {
l.call(
this,
(E.functional ? this.parent : this).$root.$options.shadowRoot
);
} : l), x)
if (E.functional) {
E._injectStyles = x;
var v = E.render;
E.render = function(A, k) {
return x.call(k), v(A, k);
};
} else {
var O = E.beforeCreate;
E.beforeCreate = O ? [].concat(O, x) : [x];
}
return {
exports: e,
options: E
};
}
const Mo = {};
var Uc = /* @__PURE__ */ Pc(
Oc,
Mc,
Nc,
!1,
Bc,
null,
null,
null
);
function Bc(e) {
for (let t in Mo)
this[t] = Mo[t];
}
const Cf = /* @__PURE__ */ function() {
return Uc.exports;
}();
var Fc = Object.defineProperty, Hc = (e, t, r) => t in e ? Fc(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, ts = (e, t, r) => (Hc(e, typeof t != "symbol" ? t + "" : t, r), r), Qt = function(e) {
var t = {};
function r(s) {
if (t[s])
return t[s].exports;
var l = t[s] = { i: s, l: !1, exports: {} };
return e[s].call(l.exports, l, l.exports, r), l.l = !0, l.exports;
}
return r.m = e, r.c = t, r.d = function(s, l, d) {
r.o(s, l) || Object.defineProperty(s, l, { enumerable: !0, get: d });
}, r.r = function(s) {
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(s, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(s, "__esModule", { value: !0 });
}, r.t = function(s, l) {
if (1 & l && (s = r(s)), 8 & l || 4 & l && typeof s == "object" && s && s.__esModule)
return s;
var d = /* @__PURE__ */ Object.create(null);
if (r.r(d), Object.defineProperty(d, "default", { enumerable: !0, value: s }), 2 & l && typeof s != "string")
for (var h in s)
r.d(d, h, function(p) {
return s[p];
}.bind(null, h));
return d;
}, r.n = function(s) {
var l = s && s.__esModule ? function() {
return s.default;
} : function() {
return s;
};
return r.d(l, "a", l), l;
}, r.o = function(s, l) {
return Object.prototype.hasOwnProperty.call(s, l);
}, r.p = "", r(r.s = 8);
}([function(e, t, r) {
var s = r(5);
function l(d, h) {
for (var p = 0; p < h.length; p++) {
var E = h[p];
E.enumerable = E.enumerable || !1, E.configurable = !0, "value" in E && (E.writable = !0), Object.defineProperty(d, s(E.key), E);
}
}
e.exports = function(d, h, p) {
return h && l(d.prototype, h), p && l(d, p), Object.defineProperty(d, "prototype", { writable: !1 }), d;
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t) {
function r(s) {
return e.exports = r = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(l) {
return typeof l;
} : function(l) {
return l && typeof Symbol == "function" && l.constructor === Symbol && l !== Symbol.prototype ? "symbol" : typeof l;
}, e.exports.__esModule = !0, e.exports.default = e.exports, r(s);
}
e.exports = r, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t, r) {
var s = r(7)();
e.exports = s;
try {
regeneratorRuntime = s;
} catch (l) {
typeof globalThis == "object" ? globalThis.regeneratorRuntime = s : Function("r", "regeneratorRuntime = r")(s);
}
}, function(e, t) {
function r() {
return e.exports = r = Object.assign ? Object.assign.bind() : function(s) {
for (var l = 1; l < arguments.length; l++) {
var d = arguments[l];
for (var h in d)
Object.prototype.hasOwnProperty.call(d, h) && (s[h] = d[h]);
}
return s;
}, e.exports.__esModule = !0, e.exports.default = e.exports, r.apply(this, arguments);
}
e.exports = r, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t) {
function r(s, l, d, h, p, E, x) {
try {
var v = s[E](x), O = v.value;
} catch (A) {
return void d(A);
}
v.done ? l(O) : Promise.resolve(O).then(h, p);
}
e.exports = function(s) {
return function() {
var l = this, d = arguments;
return new Promise(function(h, p) {
var E = s.apply(l, d);
function x(O) {
r(E, h, p, x, v, "next", O);
}
function v(O) {
r(E, h, p, x, v, "throw", O);
}
x(void 0);
});
};
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t, r) {
var s = r(1).default, l = r(6);
e.exports = function(d) {
var h = l(d, "string");
return s(h) == "symbol" ? h : h + "";
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t, r) {
var s = r(1).default;
e.exports = function(l, d) {
if (s(l) != "object" || !l)
return l;
var h = l[Symbol.toPrimitive];
if (h !== void 0) {
var p = h.call(l, d || "default");
if (s(p) != "object")
return p;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (d === "string" ? String : Number)(l);
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t, r) {
var s = r(1).default;
function l() {
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
e.exports = l = function() {
return h;
}, e.exports.__esModule = !0, e.exports.default = e.exports;
var d, h = {}, p = Object.prototype, E = p.hasOwnProperty, x = Object.defineProperty || function(C, M, F) {
C[M] = F.value;
}, v = typeof Symbol == "function" ? Symbol : {}, O = v.iterator || "@@iterator", A = v.asyncIterator || "@@asyncIterator", k = v.toStringTag || "@@toStringTag";
function m(C, M, F) {
return Object.defineProperty(C, M, { value: F, enumerable: !0, configurable: !0, writable: !0 }), C[M];
}
try {
m({}, "");
} catch (C) {
m = function(M, F, Z) {
return M[F] = Z;
};
}
function b(C, M, F, Z) {
var K = M && M.prototype instanceof I ? M : I, se = Object.create(K.prototype), Ae = new J(Z || []);
return x(se, "_invoke", { value: R(C, F, Ae) }), se;
}
function L(C, M, F) {
try {
return { type: "normal", arg: C.call(M, F) };
} catch (Z) {
return { type: "throw", arg: Z };
}
}
h.wrap = b;
var g = "suspendedStart", w = "executing", _ = "completed", y = {};
function I() {
}
function P() {
}
function G() {
}
var H = {};
m(H, O, function() {
return this;
});
var Q = Object.getPrototypeOf, ue = Q && Q(Q(Y([])));
ue && ue !== p && E.call(ue, O) && (H = ue);
var de = G.prototype = I.prototype = Object.create(H);
function j(C) {
["next", "throw", "return"].forEach(function(M) {
m(C, M, function(F) {
return this._invoke(M, F);
});
});
}
function B(C, M) {
function F(K, se, Ae, he) {
var we = L(C[K], C, se);
if (we.type !== "throw") {
var ee = we.arg, We = ee.value;
return We && s(We) == "object" && E.call(We, "__await") ? M.resolve(We.__await).then(function(Le) {
F("next", Le, Ae, he);
}, function(Le) {
F("throw", Le, Ae, he);
}) : M.resolve(We).then(function(Le) {
ee.value = Le, Ae(ee);
}, function(Le) {
return F("throw", Le, Ae, he);
});
}
he(we.arg);
}
var Z;
x(this, "_invoke", { value: function(K, se) {
function Ae() {
return new M(function(he, we) {
F(K, se, he, we);
});
}
return Z = Z ? Z.then(Ae, Ae) : Ae();
} });
}
function R(C, M, F) {
var Z = g;
return function(K, se) {
if (Z === w)
throw Error("Generator is already running");
if (Z === _) {
if (K === "throw")
throw se;
return { value: d, done: !0 };
}
for (F.method = K, F.arg = se; ; ) {
var Ae = F.delegate;
if (Ae) {
var he = D(Ae, F);
if (he) {
if (he === y)
continue;
return he;
}
}
if (F.method === "next")
F.sent = F._sent = F.arg;
else if (F.method === "throw") {
if (Z === g)
throw Z = _, F.arg;
F.dispatchException(F.arg);
} else
F.method === "return" && F.abrupt("return", F.arg);
Z = w;
var we = L(C, M, F);
if (we.type === "normal") {
if (Z = F.done ? _ : "suspendedYield", we.arg === y)
continue;
return { value: we.arg, done: F.done };
}
we.type === "throw" && (Z = _, F.method = "throw", F.arg = we.arg);
}
};
}
function D(C, M) {
var F = M.method, Z = C.iterator[F];
if (Z === d)
return M.delegate = null, F === "throw" && C.iterator.return && (M.method = "return", M.arg = d, D(C, M), M.method === "throw") || F !== "return" && (M.method = "throw", M.arg = new TypeError("The iterator does not provide a '" + F + "' method")), y;
var K = L(Z, C.iterator, M.arg);
if (K.type === "throw")
return M.method = "throw", M.arg = K.arg, M.delegate = null, y;
var se = K.arg;
return se ? se.done ? (M[C.resultName] = se.value, M.next = C.nextLoc, M.method !== "return" && (M.method = "next", M.arg = d), M.delegate = null, y) : se : (M.method = "throw", M.arg = new TypeError("iterator result is not an object"), M.delegate = null, y);
}
function U(C) {
var M = { tryLoc: C[0] };
1 in C && (M.catchLoc = C[1]), 2 in C && (M.finallyLoc = C[2], M.afterLoc = C[3]), this.tryEntries.push(M);
}
function N(C) {
var M = C.completion || {};
M.type = "normal", delete M.arg, C.completion = M;
}
function J(C) {
this.tryEntries = [{ tryLoc: "root" }], C.forEach(U, this), this.reset(!0);
}
function Y(C) {
if (C || C === "") {
var M = C[O];
if (M)
return M.call(C);
if (typeof C.next == "function")
return C;
if (!isNaN(C.length)) {
var F = -1, Z = function K() {
for (; ++F < C.length; )
if (E.call(C, F))
return K.value = C[F], K.done = !1, K;
return K.value = d, K.done = !0, K;
};
return Z.next = Z;
}
}
throw new TypeError(s(C) + " is not iterable");
}
return P.prototype = G, x(de, "constructor", { value: G, configurable: !0 }), x(G, "constructor", { value: P, configurable: !0 }), P.displayName = m(G, k, "GeneratorFunction"), h.isGeneratorFunction = function(C) {
var M = typeof C == "function" && C.constructor;
return !!M && (M === P || (M.displayName || M.name) === "GeneratorFunction");
}, h.mark = function(C) {
return Object.setPrototypeOf ? Object.setPrototypeOf(C, G) : (C.__proto__ = G, m(C, k, "GeneratorFunction")), C.prototype = Object.create(de), C;
}, h.awrap = function(C) {
return { __await: C };
}, j(B.prototype), m(B.prototype, A, function() {
return this;
}), h.AsyncIterator = B, h.async = function(C, M, F, Z, K) {
K === void 0 && (K = Promise);
var se = new B(b(C, M, F, Z), K);
return h.isGeneratorFunction(M) ? se : se.next().then(function(Ae) {
return Ae.done ? Ae.value : se.next();
});
}, j(de), m(de, k, "Generator"), m(de, O, function() {
return this;
}), m(de, "toString", function() {
return "[object Generator]";
}), h.keys = function(C) {
var M = Object(C), F = [];
for (var Z in M)
F.push(Z);
return F.reverse(), function K() {
for (; F.length; ) {
var se = F.pop();
if (se in M)
return K.value = se, K.done = !1, K;
}
return K.done = !0, K;
};
}, h.values = Y, J.prototype = { constructor: J, reset: function(C) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = d, this.done = !1, this.delegate = null, this.method = "next", this.arg = d, this.tryEntries.forEach(N), !C)
for (var M in this)
M.charAt(0) === "t" && E.call(this, M) && !isNaN(+M.slice(1)) && (this[M] = d);
}, stop: function() {
this.done = !0;
var C = this.tryEntries[0].completion;
if (C.type === "throw")
throw C.arg;
return this.rval;
}, dispatchException: function(C) {
if (this.done)
throw C;
var M = this;
function F(we, ee) {
return se.type = "throw", se.arg = C, M.next = we, ee && (M.method = "next", M.arg = d), !!ee;
}
for (var Z = this.tryEntries.length - 1; Z >= 0; --Z) {
var K = this.tryEntries[Z], se = K.completion;
if (K.tryLoc === "root")
return F("end");
if (K.tryLoc <= this.prev) {
var Ae = E.call(K, "catchLoc"), he = E.call(K, "finallyLoc");
if (Ae && he) {
if (this.prev < K.catchLoc)
return F(K.catchLoc, !0);
if (this.prev < K.finallyLoc)
return F(K.finallyLoc);
} else if (Ae) {
if (this.prev < K.catchLoc)
return F(K.catchLoc, !0);
} else {
if (!he)
throw Error("try statement without catch or finally");
if (this.prev < K.finallyLoc)
return F(K.finallyLoc);
}
}
}
}, abrupt: function(C, M) {
for (var F = this.tryEntries.length - 1; F >= 0; --F) {
var Z = this.tryEntries[F];
if (Z.tryLoc <= this.prev && E.call(Z, "finallyLoc") && this.prev < Z.finallyLoc) {
var K = Z;
break;
}
}
K && (C === "break" || C === "continue") && K.tryLoc <= M && M <= K.finallyLoc && (K = null);
var se = K ? K.completion : {};
return se.type = C, se.arg = M, K ? (this.method = "next", this.next = K.finallyLoc, y) : this.complete(se);
}, complete: function(C, M) {
if (C.type === "throw")
throw C.arg;
return C.type === "break" || C.type === "continue" ? this.next = C.arg : C.type === "return" ? (this.rval = this.arg = C.arg, this.method = "return", this.next = "end") : C.type === "normal" && M && (this.next = M), y;
}, finish: function(C) {
for (var M = this.tryEntries.length - 1; M >= 0; --M) {
var F = this.tryEntries[M];
if (F.finallyLoc === C)
return this.complete(F.completion, F.afterLoc), N(F), y;
}
}, catch: function(C) {
for (var M = this.tryEntries.length - 1; M >= 0; --M) {
var F = this.tryEntries[M];
if (F.tryLoc === C) {
var Z = F.completion;
if (Z.type === "throw") {
var K = Z.arg;
N(F);
}
return K;
}
}
throw Error("illegal catch attempt");
}, delegateYield: function(C, M, F) {
return this.delegate = { iterator: Y(C), resultName: M, nextLoc: F }, this.method === "next" && (this.arg = d), y;
} }, h;
}
e.exports = l, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t, r) {
r.r(t), r.d(t, "KwaiVideoLocalLog", function() {
return de;
}), r.d(t, "LogLevel", function() {
return A;
}), r.d(t, "DefaultLogger", function() {
return L;
}), r.d(t, "Logger", function() {
return b;
}), r.d(t, "printVersion", function() {
return E;
}), r.d(t, "DEFAULT_LOG_LEVEL", function() {
return k;
});
var s = r(0), l = r.n(s), d = r(3), h = r.n(d), p = { idbName: "kwai-video-local-log", idbMaxDataCount: 25e3, idbMaxFoldLog: 20, maxLogLen: 4096 };
function E(j, B) {
console.log("%c " + j + " %c " + B + " %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 j() {
this.timeout = 6048e5;
}
var B = j.prototype;
return B.write = function(R, D) {
if (j.available)
try {
localStorage.setItem(R, JSON.stringify({ value: D, time: Date.now() }));
} catch (U) {
}
}, B.read = function(R, D) {
if (D === void 0 && (D = !0), j.available)
try {
var U = localStorage.getItem(R);
if (U) {
var N = JSON.parse(U), J = N.value, Y = N.time, C = Y === void 0 ? 0 : Y;
if (!D || Date.now() - C < (typeof D == "number" ? D : this.timeout))
return J;
}
} catch (M) {
}
}, l()(j, null, [{ key: "available", get: function() {
if (j._available === void 0)
try {
localStorage.setItem("alg", "test"), j._available = !0;
} catch (R) {
j._available = !1;
}
return j._available;
} }]);
}();
x._available = void 0;
var v, O = x, A = function(j) {
return j.NONE = "none", j.ERROR = "e", j.WARN = "w", j.INFO = "i", j.DEBUG = "d", j.VERBOSE = "v", j;
}({}), k = A.ERROR, m = ((v = {})[A.NONE] = { value: 1, str: "N" }, v[A.ERROR] = { value: 100, str: "E" }, v[A.WARN] = { value: 200, str: "W" }, v[A.INFO] = { value: 300, str: "I" }, v[A.DEBUG] = { value: 400, str: "D" }, v[A.VERBOSE] = { value: 500, str: "V" }, v), b = function() {
function j(R) {
if (this._name = "kwai-v", this._level = k, this._id = -1, this._output = void 0, this._workerTag = "main", typeof location < "u" && location.protocol === "blob:") {
var D, U = location.href.split("/"), N = (D = U[U.length - 1]) == null ? void 0 : D.match(/(\w+)-/);
N && (this._workerTag = R ? R + "-" + N[1] : N[1]);
} else
R && (this._workerTag = R);
}
j.loadLogLevel = function(R, D) {
if (D === void 0 && (D = !0), location.href) {
var U = new RegExp(R + "=([a-z]{1})"), N = location.href.match(U);
if (N && N.length > 1) {
var J = N[1];
if (this._isValueInLevel(J))
return J;
}
}
var Y = new O().read(R, D);
if (this._isValueInLevel(Y))
return Y;
}, j.saveLogLevel = function(R, D) {
this._isValueInLevel(D) && new O().write(R, D);
}, j._isValueInLevel = function(R) {
return Object.values(A).indexOf(R) !== -1;
};
var B = j.prototype;
return B.setOutput = function(R) {
return this._output = R, this;
}, B.setLevel = function(R) {
return this._level = R, this;
}, B.setId = function(R) {
return this._id = R, this;
}, B.setName = function(R) {
return this._name = R, this;
}, B.getLevel = function() {
return this._level;
}, B.getOutput = function() {
return this._output;
}, B.hasOutput = function() {
return !!this._output;
}, B.e = function(R) {
if (this._isLevelEnabled(this._level, A.ERROR)) {
for (var D = arguments.length, U = new Array(D > 1 ? D - 1 : 0), N = 1; N < D; N++)
U[N - 1] = arguments[N];
var J = this._printLog(A.ERROR, R, U);
try {
var Y;
(Y = this._output) == null || Y.e.apply(Y, [J].concat(U));
} catch (C) {
}
}
}, B.w = function(R) {
if (this._isLevelEnabled(this._level, A.WARN)) {
for (var D = arguments.length, U = new Array(D > 1 ? D - 1 : 0), N = 1; N < D; N++)
U[N - 1] = arguments[N];
var J = this._printLog(A.WARN, R, U);
try {
var Y;
(Y = this._output) == null || Y.w.apply(Y, [J].concat(U));
} catch (C) {
}
}
}, B.i = function(R) {
if (this._isLevelEnabled(this._level, A.INFO)) {
for (var D = arguments.length, U = new Array(D > 1 ? D - 1 : 0), N = 1; N < D; N++)
U[N - 1] = arguments[N];
var J = this._printLog(A.INFO, R, U);
try {
var Y;
(Y = this._output) == null || Y.i.apply(Y, [J].concat(U));
} catch (C) {
}
}
}, B.d = function(R) {
if (this._isLevelEnabled(this._level, A.DEBUG)) {
for (var D = arguments.length, U = new Array(D > 1 ? D - 1 : 0), N = 1; N < D; N++)
U[N - 1] = arguments[N];
var J = this._printLog(A.DEBUG, R, U);
try {
var Y;
(Y = this._output) == null || Y.d.apply(Y, [J].concat(U));
} catch (C) {
}
}
}, B.v = function(R) {
if (this._isLevelEnabled(this._level, A.VERBOSE)) {
for (var D = arguments.length, U = new Array(D > 1 ? D - 1 : 0), N = 1; N < D; N++)
U[N - 1] = arguments[N];
var J = this._printLog(A.VERBOSE, R, U);
try {
var Y;
(Y = this._output) == null || Y.v.apply(Y, [J].concat(U));
} catch (C) {
}
}
}, B._isLevelEnabled = function(R, D) {
return m[R].value >= m[D].value;
}, B._printLog = function(R, D, U) {
var N, J, Y = typeof D;
if (Y === "object")
D = ((J = D) == null ? void 0 : J.constructor.name) || "unknown";
else if (Y === "function") {
var C;
D = ((C = Object.getOwnPropertyDescriptor(D, "name")) == null ? void 0 : C.value) || "unknown";
}
var M, F, Z = (((N = m[R]) == null ? void 0 : N.str) || "") + "|" + this._name + "[" + (typeof this._id == "function" ? this._id() : this._id) + "][" + this._workerTag + "]::" + D;
return R === A.ERROR ? (M = console).error.apply(M, [Z].concat(U.slice(0))) : (F = console).log.apply(F, [Z].concat(U.slice(0))), Z;
}, j;
}(), L = new b(), g = function() {
return l()(function j(B) {
this._logger = void 0, this._id = 0, this._config = p, this._id = j._id, j._id++, this._logger = new b().setId(this._id).setLevel(A.INFO), this._config = h()({}, p, B);
}, [{ 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 (中国标准时间)";
} }]);
}();
g._id = 0;
var w = r(4), _ = r.n(w), y = r(2), I = r.n(y), P = function() {
function j(R, D, U, N, J) {
var Y = this;
J === void 0 && (J = 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 (; Y._taskQueue.length; ) {
var C = Y._taskQueue.shift();
C && Y.run(C.task, C.mode);
}
}, this._logger = R, this._name = D, this._storeName = U, this._dbIndex = N, this._version = J;
}
var B = j.prototype;
return B.init = function() {
var R = this;
if (!this._openReq && indexedDB) {
var D = this._openReq = indexedDB.open(this._name, this._version);
this._logger.i("idb-wrapper", "open", D), D.onerror = function() {
R._logger.i("idb-wrapper", "open error.");
}, D.onsuccess = function() {
R._logger.i("idb-wrapper", "open success."), R._runTaskQueue();
}, D.onupgradeneeded = function() {
R._logger.i("idb-wrapper", "open upgradeneeded."), D.result.objectStoreNames.contains(R._storeName) && D.result.deleteObjectStore(R._storeName);
var U = D.result.createObjectStore(R._storeName, { keyPath: "id", autoIncrement: !0 });
R._dbIndex && R._dbIndex.forEach(function(N) {
U.createIndex(N.name, N.keyPath, N.option);
});
};
}
}, B.run = function(R, D) {
if (D === void 0 && (D = "readwrite"), this.init(), this._openReq && this._openReq.readyState === "done" && !this._openReq.error)
return this._doTask(R, D);
this.state !== "error" && (this._taskQueue.push({ task: R, mode: D }), this._taskQueue.length > 1e3 && this._taskQueue.shift());
}, B.close = function() {
var R = 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() {
R.close();
});
}, B.destroy = function() {
this._logger.i("idb-wrapper", "destroy"), this.close(), this._taskQueue = [];
}, B._doTask = function(R, D) {
var U = this;
if (D === void 0 && (D = "readwrite"), this._openReq && !this._openReq.error)
try {
this._isTransactionActive = !0;
var N = this._openReq.result.transaction(this._storeName, D), J = void 0;
N.oncomplete = function() {
U._isTransactionActive = !1, R.callback && R.callback(J), U._runTaskQueue();
}, N.onabort = N.onerror = function() {
U._isTransactionActive = !1, R.callback && R.callback(J), U._runTaskQueue();
}, J = R.exec(N.objectStore(this._storeName));
} catch (Y) {
}
else
R.callback && R.callback();
}, l()(j, [{ key: "isTransactionActive", get: function() {
return this._isTransactionActive;
} }, { key: "state", get: function() {
return this._openReq && this._openReq.readyState === "done" ? this._openReq.error ? "error" : "ready" : "idle";
} }]);
}(), G = [{ name: "id", keyPath: "id", option: { unique: !0 } }], H = [function() {
function j(R) {
this._ctx = void 0, this._idb = void 0, this._logCount = 0, this._saveCount = 0, this._reCountOnSaveCount = 100, this._reduceData = !1, this._ctx = R, this._idb = new P(R.logger, R.config.idbName, R.config.idbName, G), this._reCountOnSaveCount = Math.min(200, Math.max(50, Math.round(this._ctx.config.idbMaxDataCount / 10))), this._count();
}
j.isSupported = function() {
return typeof indexedDB < "u";
};
var B = j.prototype;
return B.saveLog = function(R) {
var D = this, U = { exec: function(N) {
return N.add({ value: R });
}, callback: function(N) {
D._saveCount++, D._saveCount % D._reCountOnSaveCount == 0 && D._count(), N != null && N.error && D._ctx.logger.i("idb-backend", "save log err", N.error);
} };
this._idb.run(U);
}, B.exportLog = function() {
var R = _()(I.a.mark(function D() {
var U = this;
return I.a.wrap(function(N) {
for (; ; )
switch (N.prev = N.next) {
case 0:
return N.abrupt("return", new Promise(function(J, Y) {
U._ctx.logger.i("idb-backend", "export start");
var C = { exec: function(M) {
return M.getAll();
}, callback: function(M) {
J(M === void 0 ? "" : U._mergeGetAll(M.result));
} };
U._idb.run(C, "readonly");
}));
case 1:
case "end":
return N.stop();
}
}, D);
}));
return function() {
return R.apply(this, arguments);
};
}(), B.destroy = function() {
this._idb.destroy();
}, B.clean = function() {
this._idb.run({ exec: function(R) {
return R.clear();
} });
}, B._count = function() {
var R = this, D = { exec: function(U) {
return U.count();
}, callback: function(U) {
U != null && U.error || U == null || !U.result || (R._ctx.logger.i("idb-backend", "count: " + U.result + " max: " + R._ctx.config.idbMaxDataCount), R._logCount = U.result, R._logCount >= R._ctx.config.idbMaxDataCount && !R._reduceData && R._deleteFromHead(R._logCount - Math.round(R._ctx.config.idbMaxDataCount / 2)));
} };
this._idb.run(D);
}, B._deleteFromHead = function(R) {
var D = this;
this._ctx.logger.i("idb-backend", "delete from head"), this._reduceData = !0;
var U = { exec: function(N) {
return N.openCursor();
}, callback: function(N) {
if (D._reduceData = !1, N != null && N.result) {
var J = IDBKeyRange.bound(N.result.key, N.result.key + R, !1, !1), Y = { exec: function(C) {
return D._ctx.logger.i("idb-backend", "del: " + J.lower + "~" + J.upper), C.delete(J);
}, callback: function(C) {
D._ctx.logger.i("idb-backend", "del result: " + !(C == null || !C.error));
} };
D._idb.run(Y);
}
} };
this._idb.run(U);
}, B._mergeGetAll = function(R) {
return R.length ? R.reduce(function(D, U) {
return "" + D + U.value + `
`;
}, "") : "";
}, l()(j, [{ key: "isActive", get: function() {
return this._idb.state !== "error";
} }]);
}()];
function Q(j, B, R) {
var D = /* @__PURE__ */ new Date();
typeof j != "string" && (j = j.toString());
var U = D.toLocaleString() + "." + D.getMilliseconds().toString().padStart(3, "0") + "|" + j + "|";
return B.forEach(function(N) {
U += typeof N == "object" ? JSON.stringify(N) + " " : N + " ";
}), U.length > R ? U.substring(0, R) : U;
}
function ue(j) {
return j.join(`
`);
}
var de = function() {
function j(R) {
var D = 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() {
D._delayTimer = setInterval(function() {
D._saveLog(!0);
}, 1e3);
}, this._stopDelay = function() {
D._delayTimer && (clearTimeout(D._delayTimer), D._delayTimer = void 0);
}, E("kwai-video-local-log", "1.0.13"), this._ctx = new g(R);
var U = function(N) {
for (var J = arguments.length, Y = new Array(J > 1 ? J - 1 : 0), C = 1; C < J; C++)
Y[C - 1] = arguments[C];
D.addLog.apply(D, [N].concat(Y));
};
this._loggerForAdd = { e: U, w: U, i: U, d: U, v: U }, this._ctx.logger.setOutput(this._loggerForAdd), this._ctx.logger.i("kwai-video-local-log", "constructor", R, this._ctx.config), this._backend = function(N) {
for (var J = 0; J < H.length; J++) {
var Y = H[J];
if (Y != null && Y.isSupported())
return new Y(N);
}
}(this._ctx), this._backend && this._startDelay();
}
j.isSupported = function() {
return function() {
for (var R = 0; R < H.length; R++) {
var D = H[R];
if (D != null && D.isSupported())
return !0;
}
return !1;
}();
};
var B = j.prototype;
return B.addLog = function(R) {
for (var D = arguments.length, U = new Array(D > 1 ? D - 1 : 0), N = 1; N < D; N++)
U[N - 1] = arguments[N];
this._logCache.push(Q(R, U, this._ctx.config.maxLogLen)), this._saveLog();
}, B.cleanLog = function() {
var R;
this._ctx.logger.i("kwai-video-local-log", "clean"), (R = this._backend) == null || R.clean();
}, B.exportLog = function() {
var R = this;
return this._ctx.logger.i("kwai-video-local-log", "export log"), new Promise(function(D, U) {
R._backend ? R._backend.exportLog().then(function(N) {
D(ue([N].concat(R._logCache)));
}) : D("");
});
}, B.downloadLog = function(R) {
var D = this;
this._ctx.logger.i("kwai-video-local-log", "download log: " + R), this._destroyDownloadHref(), this.exportLog().then(function(U) {
var N = new Blob([U], { type: "text/plain" });
if (document) {
var J = document.createElement("a");
D._downloadHref = J.href = URL.createObjectURL(N), J.download = R || "Log_web_" + (/* @__PURE__ */ new Date()).toLocaleString() + ".log", document.body.appendChild(J), J.click(), J.remove();
} else
console.log("无document,当前是否在worker中");
});
}, B.destroy = function() {
var R;
this._destroyDownloadHref(), (R = this._backend) == null || R.destroy(), this._stopDelay();
}, B.getLoggerForAdd = function() {
return this._loggerForAdd;
}, B._destroyDownloadHref = function() {
try {
this._downloadHref && (URL.revokeObjectURL(this._downloadHref), this._downloadHref = void 0);
} catch (R) {
}
}, B._saveLog = function(R) {
if (R === void 0 && (R = !1), this._backend && this._backend.isActive && (this._logCache.length >= this._ctx.config.idbMaxFoldLog || this._logCache.length > 0 && R)) {
var D = ue(this._logCache);
this._logCache.splice(0, this._logCache.length), D && this._backend.saveLog(D);
}
}, l()(j, null, [{ key: "version", get: function() {
return "1.0.13";
} }]);
}();
t.default = de;
}]);
Qt === void 0 && console.error("esm-webpack-plugin: nothing exported!");
const No = Qt.KwaiVideoLocalLog, is = Qt.LogLevel, Vc = Qt.DefaultLogger, Gc = Qt.Logger;
Qt.printVersion;
Qt.DEFAULT_LOG_LEVEL;
Qt.default;
var tn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function rs(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var An = { exports: {} }, di = typeof Reflect == "object" ? Reflect : null, Po = di && typeof di.apply == "function" ? di.apply : function(e, t, r) {
return Function.prototype.apply.call(e, t, r);
}, $i;
di && typeof di.ownKeys == "function" ? $i = di.ownKeys : Object.getOwnPropertySymbols ? $i = function(e) {
return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e));
} : $i = function(e) {
return Object.getOwnPropertyNames(e);
};
function Wc(e) {
console && console.warn && console.warn(e);
}
var ns = Number.isNaN || function(e) {
return e !== e;
};
function Be() {
Be.init.call(this);
}
An.exports = Be;
An.exports.once = zc;
Be.EventEmitter = Be;
Be.prototype._events = void 0;
Be.prototype._eventsCount = 0;
Be.prototype._maxListeners = void 0;
var Uo = 10;
function dr(e) {
if (typeof e != "function")
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof e);
}
Object.defineProperty(Be, "defaultMaxListeners", {
enumerable: !0,
get: function() {
return Uo;
},
set: function(e) {
if (typeof e != "number" || e < 0 || ns(e))
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + e + ".");
Uo = e;
}
});
Be.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;
};
Be.prototype.setMaxListeners = function(e) {
if (typeof e != "number" || e < 0 || ns(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 os(e) {
return e._maxListeners === void 0 ? Be.defaultMaxListeners : e._maxListeners;
}
Be.prototype.getMaxListeners = function() {
return os(this);
};
Be.prototype.emit = function(e) {
for (var t = [], r = 1; r < arguments.length; r++)
t.push(arguments[r]);
var s = e === "error", l = this._events;
if (l !== void 0)
s = s && l.error === void 0;
else if (!s)
return !1;
if (s) {
var d;
if (t.length > 0 && (d = t[0]), d instanceof Error)
throw d;
var h = new Error("Unhandled error." + (d ? " (" + d.message + ")" : ""));
throw h.context = d, h;
}
var p = l[e];
if (p === void 0)
return !1;
if (typeof p == "function")
Po(p, this, t);
else
for (var E = p.length, x = cs(p, E), r = 0; r < E; ++r)
Po(x[r], this, t);
return !0;
};
function as(e, t, r, s) {
var l, d, h;
if (dr(r), d = e._events, d === void 0 ? (d = e._events = /* @__PURE__ */ Object.create(null), e._eventsCount = 0) : (d.newListener !== void 0 && (e.emit(
"newListener",
t,
r.listener ? r.listener : r
), d = e._events), h = d[t]), h === void 0)
h = d[t] = r, ++e._eventsCount;
else if (typeof h == "function" ? h = d[t] = s ? [r, h] : [h, r] : s ? h.unshift(r) : h.push(r), l = os(e), l > 0 && h.length > l && !h.warned) {
h.warned = !0;
var p = new Error("Possible EventEmitter memory leak detected. " + h.length + " " + String(t) + " listeners added. Use emitter.setMaxListeners() to increase limit");
p.name = "MaxListenersExceededWarning", p.emitter = e, p.type = t, p.count = h.length, Wc(p);
}
return e;
}
Be.prototype.addListener = function(e, t) {
return as(this, e, t, !1);
};
Be.prototype.on = Be.prototype.addListener;
Be.prototype.prependListener = function(e, t) {
return as(this, e, t, !0);
};
function jc() {
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 ss(e, t, r) {
var s = { fired: !1, wrapFn: void 0, target: e, type: t, listener: r }, l = jc.bind(s);
return l.listener = r, s.wrapFn = l, l;
}
Be.prototype.once = function(e, t) {
return dr(t), this.on(e, ss(this, e, t)), this;
};
Be.prototype.prependOnceListener = function(e, t) {
return dr(t), this.prependListener(e, ss(this, e, t)), this;
};
Be.prototype.removeListener = function(e, t) {
var r, s, l, d, h;
if (dr(t), s = this._events, s === void 0)
return this;
if (r = s[e], r === void 0)
return this;
if (r === t || r.listener === t)
--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete s[e], s.removeListener && this.emit("removeListener", e, r.listener || t));
else if (typeof r != "function") {
for (l = -1, d = r.length - 1; d >= 0; d--)
if (r[d] === t || r[d].listener === t) {
h = r[d].listener, l = d;
break;
}
if (l < 0)
return this;
l === 0 ? r.shift() : Kc(r, l), r.length === 1 && (s[e] = r[0]), s.removeListener !== void 0 && this.emit("removeListener", e, h || t);
}
return this;
};
Be.prototype.off = Be.prototype.removeListener;
Be.prototype.removeAllListeners = function(e) {
var t, r, s;
if (r = this._events, r === void 0)
return this;
if (r.removeListener === void 0)
return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : r[e] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete r[e]), this;
if (arguments.length === 0) {
var l = Object.keys(r), d;
for (s = 0; s < l.length; ++s)
d = l[s], d !== "removeListener" && this.removeAllListeners(d);
return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this;
}
if (t = r[e], typeof t == "function")
this.removeListener(e, t);
else if (t !== void 0)
for (s = t.length - 1; s >= 0; s--)
this.removeListener(e, t[s]);
return this;
};
function ls(e, t, r) {
var s = e._events;
if (s === void 0)
return [];
var l = s[t];
return l === void 0 ? [] : typeof l == "function" ? r ? [l.listener || l] : [l] : r ? Jc(l) : cs(l, l.length);
}
Be.prototype.listeners = function(e) {
return ls(this, e, !0);
};
Be.prototype.rawListeners = function(e) {
return ls(this, e, !1);
};
Be.listenerCount = function(e, t) {
return typeof e.listenerCount == "function" ? e.listenerCount(t) : us.call(e, t);
};
Be.prototype.listenerCount = us;
function us(e) {
var t = this._events;
if (t !== void 0) {
var r = t[e];
if (typeof r == "function")
return 1;
if (r !== void 0)
return r.length;
}
return 0;
}
Be.prototype.eventNames = function() {
return this._eventsCount > 0 ? $i(this._events) : [];
};
function cs(e, t) {
for (var r = new Array(t), s = 0; s < t; ++s)
r[s] = e[s];
return r;
}
function Kc(e, t) {
for (; t + 1 < e.length; t++)
e[t] = e[t + 1];
e.pop();
}
function Jc(e) {
for (var t = new Array(e.length), r = 0; r < t.length; ++r)
t[r] = e[r].listener || e[r];
return t;
}
function zc(e, t) {
return new Promise(function(r, s) {
function l(h) {
e.removeListener(t, d), s(h);
}
function d() {
typeof e.removeListener == "function" && e.removeListener("error", l), r([].slice.call(arguments));
}
ds(e, t, d, { once: !0 }), t !== "error" && $c(e, l, { once: !0 });
});
}
function $c(e, t, r) {
typeof e.on == "function" && ds(e, "error", t, r);
}
function ds(e, t, r, s) {
if (typeof e.on == "function")
s.once ? e.once(t, r) : e.on(t, r);
else if (typeof e.addEventListener == "function")
e.addEventListener(t, function l(d) {
s.once && e.removeEventListener(t, l), r(d);
});
else
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof e);
}
var qc = An.exports, hs = function() {
if (typeof Map < "u")
return Map;
function e(t, r) {
var s = -1;
return t.some(function(l, d) {
return l[0] === r ? (s = d, !0) : !1;
}), s;
}
return (
/** @class */
function() {
function t() {
this.__entries__ = [];
}
return Object.defineProperty(t.prototype, "size", {
/**
* @returns {boolean}
*/
get: function() {
return this.__entries__.length;
},
enumerable: !0,
configurable: !0
}), t.prototype.get = function(r) {
var s = e(this.__entries__, r), l = this.__entries__[s];
return l && l[1];
}, t.prototype.set = function(r, s) {
var l = e(this.__entries__, r);
~l ? this.__entries__[l][1] = s : this.__entries__.push([r, s]);
}, t.prototype.delete = function(r) {
var s = this.__entries__, l = e(s, r);
~l && s.splice(l, 1);
}, t.prototype.has = function(r) {
return !!~e(this.__entries__, r);
}, t.prototype.clear = function() {
this.__entries__.splice(0);
}, t.prototype.forEach = function(r, s) {
s === void 0 && (s = null);
for (var l = 0, d = this.__entries__; l < d.length; l++) {
var h = d[l];
r.call(s, h[1], h[0]);
}
}, t;
}()
);
}(), rn = typeof window < "u" && typeof document < "u" && window.document === document, ir = 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")();
}(), Yc = function() {
return typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(ir) : function(e) {
return setTimeout(function() {
return e(Date.now());
}, 1e3 / 60);
};
}(), Qc = 2;
function Zc(e, t) {
var r = !1, s = !1, l = 0;
function d() {
r && (r = !1, e()), s && p();
}
function h() {
Yc(d);
}
function p() {
var E = Date.now();
if (r) {
if (E - l < Qc)
return;
s = !0;
} else
r = !0, s = !1, setTimeout(h, t);
l = E;
}
return p;
}
var Xc = 20, ed = ["top", "right", "bottom", "left", "width", "height", "size", "weight"], td = typeof MutationObserver < "u", id = (
/** @class */
function() {
function e() {
this.connected_ = !1, this.mutationEventsAdded_ = !1, this.mutationsObserver_ = null, this.observers_ = [], this.onTransitionEnd_ = this.onTransitionEnd_.bind(this), this.refresh = Zc(this.refresh.bind(this), Xc);
}
return e.prototype.addObserver = function(t) {
~this.observers_.indexOf(t) || this.observers_.push(t), this.connected_ || this.connect_();
}, e.prototype.removeObserver = function(t) {
var r = this.observers_, s = r.indexOf(t);
~s && r.splice(s, 1), !r.length && this.connected_ && this.disconnect_();
}, e.prototype.refresh = function() {
var t = this.updateObservers_();
t && this.refresh();
}, e.prototype.updateObservers_ = function() {
var t = this.observers_.filter(function(r) {
return r.gatherActive(), r.hasActive();
});
return t.forEach(function(r) {
return r.broadcastActive();
}), t.length > 0;
}, e.prototype.connect_ = function() {
!rn || this.connected_ || (document.addEventListener("transitionend", this.onTransitionEnd_), window.addEventListener("resize", this.refresh), td ? (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() {
!rn || !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(t) {
var r = t.propertyName, s = r === void 0 ? "" : r, l = ed.some(function(d) {
return !!~s.indexOf(d);
});
l && this.refresh();
}, e.getInstance = function() {
return this.instance_ || (this.instance_ = new e()), this.instance_;
}, e.instance_ = null, e;
}()
), fs = function(e, t) {
for (var r = 0, s = Object.keys(t); r < s.length; r++) {
var l = s[r];
Object.defineProperty(e, l, {
value: t[l],
enumerable: !1,
writable: !1,
configurable: !0
});
}
return e;
}, pi = function(e) {
var t = e && e.ownerDocument && e.ownerDocument.defaultView;
return t || ir;
}, ps = hr(0, 0, 0, 0);
function rr(e) {
return parseFloat(e) || 0;
}
function Bo(e) {
for (var t = [], r = 1; r < arguments.length; r++)
t[r - 1] = arguments[r];
return t.reduce(function(s, l) {
var d = e["border-" + l + "-width"];
return s + rr(d);
}, 0);
}
function rd(e) {
for (var t = ["top", "right", "bottom", "left"], r = {}, s = 0, l = t; s < l.length; s++) {
var d = l[s], h = e["padding-" + d];
r[d] = rr(h);
}
return r;
}
function nd(e) {
var t = e.getBBox();
return hr(0, 0, t.width, t.height);
}
function od(e) {
var t = e.clientWidth, r = e.clientHeight;
if (!t && !r)
return ps;
var s = pi(e).getComputedStyle(e), l = rd(s), d = l.left + l.right, h = l.top + l.bottom, p = rr(s.width), E = rr(s.height);
if (s.boxSizing === "border-box" && (Math.round(p + d) !== t && (p -= Bo(s, "left", "right") + d), Math.round(E + h) !== r && (E -= Bo(s, "top", "bottom") + h)), !sd(e)) {
var x = Math.round(p + d) - t, v = Math.round(E + h) - r;
Math.abs(x) !== 1 && (p -= x), Math.abs(v) !== 1 && (E -= v);
}
return hr(l.left, l.top, p, E);
}
var ad = function() {
return typeof SVGGraphicsElement < "u" ? function(e) {
return e instanceof pi(e).SVGGraphicsElement;
} : function(e) {
return e instanceof pi(e).SVGElement && typeof e.getBBox == "function";
};
}();
function sd(e) {
return e === pi(e).document.documentElement;
}
function ld(e) {
return rn ? ad(e) ? nd(e) : od(e) : ps;
}
function ud(e) {
var t = e.x, r = e.y, s = e.width, l = e.height, d = typeof DOMRectReadOnly < "u" ? DOMRectReadOnly : Object, h = Object.create(d.prototype);
return fs(h, {
x: t,
y: r,
width: s,
height: l,
top: r,
right: t + s,
bottom: l + r,
left: t
}), h;
}
function hr(e, t, r, s) {
return { x: e, y: t, width: r, height: s };
}
var cd = (
/** @class */
function() {
function e(t) {
this.broadcastWidth = 0, this.broadcastHeight = 0, this.contentRect_ = hr(0, 0, 0, 0), this.target = t;
}
return e.prototype.isActive = function() {
var t = ld(this.target);
return this.contentRect_ = t, t.width !== this.broadcastWidth || t.height !== this.broadcastHeight;
}, e.prototype.broadcastRect = function() {
var t = this.contentRect_;
return this.broadcastWidth = t.width, this.broadcastHeight = t.height, t;
}, e;
}()
), dd = (
/** @class */
function() {
function e(t, r) {
var s = ud(r);
fs(this, { target: t, contentRect: s });
}
return e;
}()
), hd = (
/** @class */
function() {
function e(t, r, s) {
if (this.activeObservations_ = [], this.observations_ = new hs(), typeof t != "function")
throw new TypeError("The callback provided as parameter 1 is not a function.");
this.callback_ = t, this.controller_ = r, this.callbackCtx_ = s;
}
return e.prototype.observe = function(t) {
if (!arguments.length)
throw new TypeError("1 argument required, but only 0 present.");
if (!(typeof Element > "u" || !(Element instanceof Object))) {
if (!(t instanceof pi(t).Element))
throw new TypeError('parameter 1 is not of type "Element".');
var r = this.observations_;
r.has(t) || (r.set(t, new cd(t)), this.controller_.addObserver(this), this.controller_.refresh());
}
}, e.prototype.unobserve = function(t) {
if (!arguments.length)
throw new TypeError("1 argument required, but only 0 present.");
if (!(typeof Element > "u" || !(Element instanceof Object))) {
if (!(t instanceof pi(t).Element))
throw new TypeError('parameter 1 is not of type "Element".');
var r = this.observations_;
r.has(t) && (r.delete(t), r.size || this.controller_.removeObserver(this));
}
}, e.prototype.disconnect = function() {
this.clearActive(), this.observations_.clear(), this.controller_.removeObserver(this);
}, e.prototype.gatherActive = function() {
var t = this;
this.clearActive(), this.observations_.forEach(function(r) {
r.isActive() && t.activeObservations_.push(r);
});
}, e.prototype.broadcastActive = function() {
if (this.hasActive()) {
var t = this.callbackCtx_, r = this.activeObservations_.map(function(s) {
return new dd(s.target, s.broadcastRect());
});
this.callback_.call(t, r, t), this.clearActive();
}
}, e.prototype.clearActive = function() {
this.activeObservations_.splice(0);
}, e.prototype.hasActive = function() {
return this.activeObservations_.length > 0;
}, e;
}()
), As = typeof WeakMap < "u" ? /* @__PURE__ */ new WeakMap() : new hs(), vs = (
/** @class */
function() {
function e(t) {
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 r = id.getInstance(), s = new hd(t, r, this);
As.set(this, s);
}
return e;
}()
);
[
"observe",
"unobserve",
"disconnect"
].forEach(function(e) {
vs.prototype[e] = function() {
var t;
return (t = As.get(this))[e].apply(t, arguments);
};
});
(function() {
return typeof ir.ResizeObserver < "u" ? ir.ResizeObserver : vs;
})();
var fd = function(e, t) {
if (t = t.split(":")[0], e = +e, !e)
return !1;
switch (t) {
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;
}, vn = {}, pd = Object.prototype.hasOwnProperty, Ad;
function Fo(e) {
try {
return decodeURIComponent(e.replace(/\+/g, " "));
} catch (t) {
return null;
}
}
function Ho(e) {
try {
return encodeURIComponent(e);
} catch (t) {
return null;
}
}
function vd(e) {
for (var t = /([^=?#&]+)=?([^&]*)/g, r = {}, s; s = t.exec(e); ) {
var l = Fo(s[1]), d = Fo(s[2]);
l === null || d === null || l in r || (r[l] = d);
}
return r;
}
function _d(e, t) {
t = t || "";
var r = [], s, l;
typeof t != "string" && (t = "?");
for (l in e)
if (pd.call(e, l)) {
if (s = e[l], !s && (s === null || s === Ad || isNaN(s)) && (s = ""), l = Ho(l), s = Ho(s), l === null || s === null)
continue;
r.push(l + "=" + s);
}
return r.length ? t + r.join("&") : "";
}
vn.stringify = _d;
vn.parse = vd;
var _s = fd, fr = vn, md = /^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/, ms = /[\n\r\t]/g, gd = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//, gs = /:\d+$/, yd = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i, bd = /^[a-zA-Z]:/;
function _n(e) {
return (e || "").toString().replace(md, "");
}
var nn = [
["#", "hash"],
// Extract from the back.
["?", "query"],
// Extract from the back.
function(e, t) {
return Ut(t.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.
], Vo = { hash: 1, query: 1 };
function ys(e) {
var t;
typeof window < "u" ? t = window : typeof tn < "u" ? t = tn : typeof self < "u" ? t = self : t = {};
var r = t.location || {};
e = e || r;
var s = {}, l = typeof e, d;
if (e.protocol === "blob:")
s = new Bt(unescape(e.pathname), {});
else if (l === "string") {
s = new Bt(e, {});
for (d in Vo)
delete s[d];
} else if (l === "object") {
for (d in e)
d in Vo || (s[d] = e[d]);
s.slashes === void 0 && (s.slashes = gd.test(e.href));
}
return s;
}
function Ut(e) {
return e === "file:" || e === "ftp:" || e === "http:" || e === "https:" || e === "ws:" || e === "wss:";
}
function bs(e, t) {
e = _n(e), e = e.replace(ms, ""), t = t || {};
var r = yd.exec(e), s = r[1] ? r[1].toLowerCase() : "", l = !!r[2], d = !!r[3], h = 0, p;
return l ? d ? (p = r[2] + r[3] + r[4], h = r[2].length + r[3].length) : (p = r[2] + r[4], h = r[2].length) : d ? (p = r[3] + r[4], h = r[3].length) : p = r[4], s === "file:" ? h >= 2 && (p = p.slice(2)) : Ut(s) ? p = r[4] : s ? l && (p = p.slice(2)) : h >= 2 && Ut(t.protocol) && (p = r[4]), {
protocol: s,
slashes: l || Ut(s),
slashesCount: h,
rest: p
};
}
function Ed(e, t) {
if (e === "")
return t;
for (var r = (t || "/").split("/").slice(0, -1).concat(e.split("/")), s = r.length, l = r[s - 1], d = !1, h = 0; s--; )
r[s] === "." ? r.splice(s, 1) : r[s] === ".." ? (r.splice(s, 1), h++) : h && (s === 0 && (d = !0), r.splice(s, 1), h--);
return d && r.unshift(""), (l === "." || l === "..") && r.push(""), r.join("/");
}
function Bt(e, t, r) {
if (e = _n(e), e = e.replace(ms, ""), !(this instanceof Bt))
return new Bt(e, t, r);
var s, l, d, h, p, E, x = nn.slice(), v = typeof t, O = this, A = 0;
for (v !== "object" && v !== "string" && (r = t, t = null), r && typeof r != "function" && (r = fr.parse), t = ys(t), l = bs(e || "", t), s = !l.protocol && !l.slashes, O.slashes = l.slashes || s && t.slashes, O.protocol = l.protocol || t.protocol || "", e = l.rest, (l.protocol === "file:" && (l.slashesCount !== 2 || bd.test(e)) || !l.slashes && (l.protocol || l.slashesCount < 2 || !Ut(O.protocol))) && (x[3] = [/(.*)/, "pathname"]); A < x.length; A++) {
if (h = x[A], typeof h == "function") {
e = h(e, O);
continue;
}
d = h[0], E = h[1], d !== d ? O[E] = e : typeof d == "string" ? (p = d === "@" ? e.lastIndexOf(d) : e.indexOf(d), ~p && (typeof h[2] == "number" ? (O[E] = e.slice(0, p), e = e.slice(p + h[2])) : (O[E] = e.slice(p), e = e.slice(0, p)))) : (p = d.exec(e)) && (O[E] = p[1], e = e.slice(0, p.index)), O[E] = O[E] || s && h[3] && t[E] || "", h[4] && (O[E] = O[E].toLowerCase());
}
r && (O.query = r(O.query)), s && t.slashes && O.pathname.charAt(0) !== "/" && (O.pathname !== "" || t.pathname !== "") && (O.pathname = Ed(O.pathname, t.pathname)), O.pathname.charAt(0) !== "/" && Ut(O.protocol) && (O.pathname = "/" + O.pathname), _s(O.port, O.protocol) || (O.host = O.hostname, O.port = ""), O.username = O.password = "", O.auth && (p = O.auth.indexOf(":"), ~p ? (O.username = O.auth.slice(0, p), O.username = encodeURIComponent(decodeURIComponent(O.username)), O.password = O.auth.slice(p + 1), O.password = encodeURIComponent(decodeURIComponent(O.password))) : O.username = encodeURIComponent(decodeURIComponent(O.auth)), O.auth = O.password ? O.username + ":" + O.password : O.username), O.origin = O.protocol !== "file:" && Ut(O.protocol) && O.host ? O.protocol + "//" + O.host : "null", O.href = O.toString();
}
function wd(e, t, r) {
var s = this;
switch (e) {
case "query":
typeof t == "string" && t.length && (t = (r || fr.parse)(t)), s[e] = t;
break;
case "port":
s[e] = t, _s(t, s.protocol) ? t && (s.host = s.hostname + ":" + t) : (s.host = s.hostname, s[e] = "");
break;
case "hostname":
s[e] = t, s.port && (t += ":" + s.port), s.host = t;
break;
case "host":
s[e] = t, gs.test(t) ? (t = t.split(":"), s.port = t.pop(), s.hostname = t.join(":")) : (s.hostname = t, s.port = "");
break;
case "protocol":
s.protocol = t.toLowerCase(), s.slashes = !r;
break;
case "pathname":
case "hash":
if (t) {
var l = e === "pathname" ? "/" : "#";
s[e] = t.charAt(0) !== l ? l + t : t;
} else
s[e] = t;
break;
case "username":
case "password":
s[e] = encodeURIComponent(t);
break;
case "auth":
var d = t.indexOf(":");
~d ? (s.username = t.slice(0, d), s.username = encodeURIComponent(decodeURIComponent(s.username)), s.password = t.slice(d + 1), s.password = encodeURIComponent(decodeURIComponent(s.password))) : s.username = encodeURIComponent(decodeURIComponent(t));
}
for (var h = 0; h < nn.length; h++) {
var p = nn[h];
p[4] && (s[p[1]] = s[p[1]].toLowerCase());
}
return s.auth = s.password ? s.username + ":" + s.password : s.username, s.origin = s.protocol !== "file:" && Ut(s.protocol) && s.host ? s.protocol + "//" + s.host : "null", s.href = s.toString(), s;
}
function Td(e) {
(!e || typeof e != "function") && (e = fr.stringify);
var t, r = this, s = r.host, l = r.protocol;
l && l.charAt(l.length - 1) !== ":" && (l += ":");
var d = l + (r.protocol && r.slashes || Ut(r.protocol) ? "//" : "");
return r.username ? (d += r.username, r.password && (d += ":" + r.password), d += "@") : r.password ? (d += ":" + r.password, d += "@") : r.protocol !== "file:" && Ut(r.protocol) && !s && r.pathname !== "/" && (d += "@"), (s[s.length - 1] === ":" || gs.test(r.hostname) && !r.port) && (s += ":"), d += s + r.pathname, t = typeof r.query == "object" ? e(r.query) : r.query, t && (d += t.charAt(0) !== "?" ? "?" + t : t), r.hash && (d += r.hash), d;
}
Bt.prototype = { set: wd, toString: Td };
Bt.extractProtocol = bs;
Bt.location = ys;
Bt.trimLeft = _n;
Bt.qs = fr;
var Rd = Bt;
const Go = /* @__PURE__ */ rs(Rd);
var vi = function(e) {
var t = {};
function r(s) {
if (t[s])
return t[s].exports;
var l = t[s] = { i: s, l: !1, exports: {} };
return e[s].call(l.exports, l, l.exports, r), l.l = !0, l.exports;
}
return r.m = e, r.c = t, r.d = function(s, l, d) {
r.o(s, l) || Object.defineProperty(s, l, { enumerable: !0, get: d });
}, r.r = function(s) {
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(s, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(s, "__esModule", { value: !0 });
}, r.t = function(s, l) {
if (1 & l && (s = r(s)), 8 & l || 4 & l && typeof s == "object" && s && s.__esModule)
return s;
var d = /* @__PURE__ */ Object.create(null);
if (r.r(d), Object.defineProperty(d, "default", { enumerable: !0, value: s }), 2 & l && typeof s != "string")
for (var h in s)
r.d(d, h, function(p) {
return s[p];
}.bind(null, h));
return d;
}, r.n = function(s) {
var l = s && s.__esModule ? function() {
return s.default;
} : function() {
return s;
};
return r.d(l, "a", l), l;
}, r.o = function(s, l) {
return Object.prototype.hasOwnProperty.call(s, l);
}, r.p = "", r(r.s = 4);
}([function(e, t) {
function r(s) {
return e.exports = r = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(l) {
return typeof l;
} : function(l) {
return l && typeof Symbol == "function" && l.constructor === Symbol && l !== Symbol.prototype ? "symbol" : typeof l;
}, e.exports.__esModule = !0, e.exports.default = e.exports, r(s);
}
e.exports = r, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t, r) {
var s = r(2);
function l(d, h) {
for (var p = 0; p < h.length; p++) {
var E = h[p];
E.enumerable = E.enumerable || !1, E.configurable = !0, "value" in E && (E.writable = !0), Object.defineProperty(d, s(E.key), E);
}
}
e.exports = function(d, h, p) {
return h && l(d.prototype, h), p && l(d, p), Object.defineProperty(d, "prototype", { writable: !1 }), d;
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t, r) {
var s = r(0).default, l = r(3);
e.exports = function(d) {
var h = l(d, "string");
return s(h) == "symbol" ? h : h + "";
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t, r) {
var s = r(0).default;
e.exports = function(l, d) {
if (s(l) != "object" || !l)
return l;
var h = l[Symbol.toPrimitive];
if (h !== void 0) {
var p = h.call(l, d || "default");
if (s(p) != "object")
return p;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (d === "string" ? String : Number)(l);
}, e.exports.__esModule = !0, e.exports.default = e.exports;
}, function(e, t, r) {
function s(m, b) {
console.log("%c " + m + " %c " + b + " %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");
}
r.r(t), r.d(t, "LogLevel", function() {
return x;
}), r.d(t, "DefaultLogger", function() {
return k;
}), r.d(t, "Logger", function() {
return A;
}), r.d(t, "printVersion", function() {
return s;
}), r.d(t, "DEFAULT_LOG_LEVEL", function() {
return v;
});
var l = r(1), d = r.n(l), h = function() {
function m() {
this.timeout = 6048e5;
}
var b = m.prototype;
return b.write = function(L, g) {
if (m.available)
try {
localStorage.setItem(L, JSON.stringify({ value: g, time: Date.now() }));
} catch (w) {
}
}, b.read = function(L, g) {
if (g === void 0 && (g = !0), m.available)
try {
var w = localStorage.getItem(L);
if (w) {
var _ = JSON.parse(w), y = _.value, I = _.time, P = I === void 0 ? 0 : I;
if (!g || Date.now() - P < (typeof g == "number" ? g : this.timeout))
return y;
}
} catch (G) {
}
}, d()(m, null, [{ key: "available", get: function() {
if (m._available === void 0)
try {
localStorage.setItem("alg", "test"), m._available = !0;
} catch (L) {
m._available = !1;
}
return m._available;
} }]);
}();
h._available = void 0;
var p, E = h, x = function(m) {
return m.NONE = "none", m.ERROR = "e", m.WARN = "w", m.INFO = "i", m.DEBUG = "d", m.VERBOSE = "v", m;
}({}), v = x.ERROR, O = ((p = {})[x.NONE] = { value: 1, str: "N" }, p[x.ERROR] = { value: 100, str: "E" }, p[x.WARN] = { value: 200, str: "W" }, p[x.INFO] = { value: 300, str: "I" }, p[x.DEBUG] = { value: 400, str: "D" }, p[x.VERBOSE] = { value: 500, str: "V" }, p), A = function() {
function m(L) {
if (this._name = "kwai-v", this._level = v, this._id = -1, this._output = void 0, this._workerTag = "main", typeof location < "u" && location.protocol === "blob:") {
var g, w = location.href.split("/"), _ = (g = w[w.length - 1]) == null ? void 0 : g.match(/(\w+)-/);
_ && (this._workerTag = L ? L + "-" + _[1] : _[1]);
} else
L && (this._workerTag = L);
}
m.loadLogLevel = function(L, g) {
if (g === void 0 && (g = !0), location.href) {
var w = new RegExp(L + "=([a-z]{1})"), _ = location.href.match(w);
if (_ && _.length > 1) {
var y = _[1];
if (this._isValueInLevel(y))
return y;
}
}
var I = new E().read(L, g);
if (this._isValueInLevel(I))
return I;
}, m.saveLogLevel = function(L, g) {
this._isValueInLevel(g) && new E().write(L, g);
}, m._isValueInLevel = function(L) {
return Object.values(x).indexOf(L) !== -1;
};
var b = m.prototype;
return b.setOutput = function(L) {
return this._output = L, this;
}, b.setLevel = function(L) {
return this._level = L, this;
}, b.setId = function(L) {
return this._id = L, this;
}, b.setName = function(L) {
return this._name = L, this;
}, b.getLevel = function() {
return this._level;
}, b.getOutput = function() {
return this._output;
}, b.hasOutput = function() {
return !!this._output;
}, b.e = function(L) {
if (this._isLevelEnabled(this._level, x.ERROR)) {
for (var g = arguments.length, w = new Array(g > 1 ? g - 1 : 0), _ = 1; _ < g; _++)
w[_ - 1] = arguments[_];
var y = this._printLog(x.ERROR, L, w);
try {
var I;
(I = this._output) == null || I.e.apply(I, [y].concat(w));
} catch (P) {
}
}
}, b.w = function(L) {
if (this._isLevelEnabled(this._level, x.WARN)) {
for (var g = arguments.length, w = new Array(g > 1 ? g - 1 : 0), _ = 1; _ < g; _++)
w[_ - 1] = arguments[_];
var y = this._printLog(x.WARN, L, w);
try {
var I;
(I = this._output) == null || I.w.apply(I, [y].concat(w));
} catch (P) {
}
}
}, b.i = function(L) {
if (this._isLevelEnabled(this._level, x.INFO)) {
for (var g = arguments.length, w = new Array(g > 1 ? g - 1 : 0), _ = 1; _ < g; _++)
w[_ - 1] = arguments[_];
var y = this._printLog(x.INFO, L, w);
try {
var I;
(I = this._output) == null || I.i.apply(I, [y].concat(w));
} catch (P) {
}
}
}, b.d = function(L) {
if (this._isLevelEnabled(this._level, x.DEBUG)) {
for (var g = arguments.length, w = new Array(g > 1 ? g - 1 : 0), _ = 1; _ < g; _++)
w[_ - 1] = arguments[_];
var y = this._printLog(x.DEBUG, L, w);
try {
var I;
(I = this._output) == null || I.d.apply(I, [y].concat(w));
} catch (P) {
}
}
}, b.v = function(L) {
if (this._isLevelEnabled(this._level, x.VERBOSE)) {
for (var g = arguments.length, w = new Array(g > 1 ? g - 1 : 0), _ = 1; _ < g; _++)
w[_ - 1] = arguments[_];
var y = this._printLog(x.VERBOSE, L, w);
try {
var I;
(I = this._output) == null || I.v.apply(I, [y].concat(w));
} catch (P) {
}
}
}, b._isLevelEnabled = function(L, g) {
return O[L].value >= O[g].value;
}, b._printLog = function(L, g, w) {
var _, y, I = typeof g;
if (I === "object")
g = ((y = g) == null ? void 0 : y.constructor.name) || "unknown";
else if (I === "function") {
var P;
g = ((P = Object.getOwnPropertyDescriptor(g, "name")) == null ? void 0 : P.value) || "unknown";
}
var G, H, Q = (((_ = O[L]) == null ? void 0 : _.str) || "") + "|" + this._name + "[" + (typeof this._id == "function" ? this._id() : this._id) + "][" + this._workerTag + "]::" + g;
return L === x.ERROR ? (G = console).error.apply(G, [Q].concat(w.slice(0))) : (H = console).log.apply(H, [Q].concat(w.slice(0))), Q;
}, m;
}(), k = new A();
}]);
vi === void 0 && console.error("esm-webpack-plugin: nothing exported!");
vi.LogLevel;
const Ri = vi.DefaultLogger;
vi.Logger;
vi.printVersion;
vi.DEFAULT_LOG_LEVEL;
/*! js-cookie v3.0.5 | MIT */
function Gi(e) {
for (var t = 1; t < arguments.length; t++) {
var r = arguments[t];
for (var s in r)
e[s] = r[s];
}
return e;
}
var Sd = {
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 on(e, t) {
function r(l, d, h) {
if (!(typeof document > "u")) {
h = Gi({}, t, h), typeof h.expires == "number" && (h.expires = new Date(Date.now() + h.expires * 864e5)), h.expires && (h.expires = h.expires.toUTCString()), l = encodeURIComponent(l).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
var p = "";
for (var E in h)
h[E] && (p += "; " + E, h[E] !== !0 && (p += "=" + h[E].split(";")[0]));
return document.cookie = l + "=" + e.write(d, l) + p;
}
}
function s(l) {
if (!(typeof document > "u" || arguments.length && !l)) {
for (var d = document.cookie ? document.cookie.split("; ") : [], h = {}, p = 0; p < d.length; p++) {
var E = d[p].split("="), x = E.slice(1).join("=");
try {
var v = decodeURIComponent(E[0]);
if (h[v] = e.read(x, v), l === v)
break;
} catch (O) {
}
}
return l ? h[l] : h;
}
}
return Object.create(
{
set: r,
get: s,
remove: function(l, d) {
r(
l,
"",
Gi({}, d, {
expires: -1
})
);
},
withAttributes: function(l) {
return on(this.converter, Gi({}, this.attributes, l));
},
withConverter: function(l) {
return on(Gi({}, this.converter, l), this.attributes);
}
},
{
attributes: { value: Object.freeze(t) },
converter: { value: Object.freeze(e) }
}
);
}
var Fr = on(Sd, { path: "/" });
const Si = "did", Hr = "kwai_player_device_id";
function Wo() {
try {
const e = Math.random() * 1e9 >>> 0, t = [], r = "0123456789ABCDEF";
for (let l = 0; l < 7; l++)
t.push(r.charAt(Math.random() * 16));
const s = `web_${e}${t.join("")}`;
return Ri.i(Si, "generate nanoId", s), s;
} catch (e) {
}
return "web_did_generation_failed";
}
function Ld() {
let e = "";
try {
e = (Fr.get("did") || Fr.get("_did") || Fr.get("weblogger_did") || "").trim(), Ri.i(Si, "generate deviceId from cookie", e);
} catch (t) {
Ri.i(Si, "generate deviceId from cookie err", t);
}
try {
e ? localStorage == null || localStorage.setItem(Hr, e) : (e = ((localStorage == null ? void 0 : localStorage.getItem(Hr)) || "").trim(), Ri.i(Si, "generate deviceId from ls", e)), e || (e = Wo(), localStorage == null || localStorage.setItem(Hr, e));
} catch (t) {
Ri.i(Si, "generate deviceId from ls err", t);
}
return e || Wo();
}
function kd(e) {
nr = e;
}
let nr = Ld();
const Es = class ii {
constructor() {
ts(this, "timeout", 7 * 24 * 3600 * 1e3);
}
write(t, r) {
if (ii.available)
try {
localStorage.setItem(
t,
JSON.stringify({ value: r, time: Date.now() })
);
} catch (s) {
}
}
read(t, r = !0) {
if (ii.available)
try {
const s = localStorage.getItem(t);
if (s) {
const { value: l, time: d = 0 } = JSON.parse(s);
if (!r || Date.now() - d < (typeof r == "number" ? r : this.timeout))
return l;
}
} catch (s) {
}
}
static get available() {
if (typeof ii._available > "u")
try {
localStorage.setItem("alg", "test"), ii._available = !0;
} catch (t) {
ii._available = !1;
}
return ii._available;
}
};
ts(Es, "_available");
let ws = Es;
var an = { exports: {} };
(function(e, t) {
(function(r, s) {
var l = "1.0.2", d = "", h = "?", p = "function", E = "undefined", x = "object", v = "string", O = "major", A = "model", k = "name", m = "type", b = "vendor", L = "version", g = "architecture", w = "console", _ = "mobile", y = "tablet", I = "smarttv", P = "wearable", G = "embedded", H = 255, Q = "Amazon", ue = "Apple", de = "ASUS", j = "BlackBerry", B = "Browser", R = "Chrome", D = "Edge", U = "Firefox", N = "Google", J = "Huawei", Y = "LG", C = "Microsoft", M = "Motorola", F = "Opera", Z = "Samsung", K = "Sony", se = "Xiaomi", Ae = "Zebra", he = "Facebook", we = function(oe, le) {
var ne = {};
for (var me in oe)
le[me] && le[me].length % 2 === 0 ? ne[me] = le[me].concat(oe[me]) : ne[me] = oe[me];
return ne;
}, ee = function(oe) {
for (var le = {}, ne = 0; ne < oe.length; ne++)
le[oe[ne].toUpperCase()] = oe[ne];
return le;
}, We = function(oe, le) {
return typeof oe === v ? Le(le).indexOf(Le(oe)) !== -1 : !1;
}, Le = function(oe) {
return oe.toLowerCase();
}, Ft = function(oe) {
return typeof oe === v ? oe.replace(/[^\d\.]/g, d).split(".")[0] : s;
}, tt = function(oe, le) {
if (typeof oe === v)
return oe = oe.replace(/^\s\s*/, d).replace(/\s\s*$/, d), typeof le === E ? oe : oe.substring(0, H);
}, fe = function(oe, le) {
for (var ne = 0, me, ae, Et, pe, Xe, ze; ne < le.length && !Xe; ) {
var wt = le[ne], Zt = le[ne + 1];
for (me = ae = 0; me < wt.length && !Xe; )
if (Xe = wt[me++].exec(oe), Xe)
for (Et = 0; Et < Zt.length; Et++)
ze = Xe[++ae], pe = Zt[Et], typeof pe === x && pe.length > 0 ? pe.length === 2 ? typeof pe[1] == p ? this[pe[0]] = pe[1].call(this, ze) : this[pe[0]] = pe[1] : pe.length === 3 ? typeof pe[1] === p && !(pe[1].exec && pe[1].test) ? this[pe[0]] = ze ? pe[1].call(this, ze, pe[2]) : s : this[pe[0]] = ze ? ze.replace(pe[1], pe[2]) : s : pe.length === 4 && (this[pe[0]] = ze ? pe[3].call(this, ze.replace(pe[1], pe[2])) : s) : this[pe] = ze || s;
ne += 2;
}
}, Fe = function(oe, le) {
for (var ne in le)
if (typeof le[ne] === x && le[ne].length > 0) {
for (var me = 0; me < le[ne].length; me++)
if (We(le[ne][me], oe))
return ne === h ? s : ne;
} else if (We(le[ne], oe))
return ne === h ? s : ne;
return oe;
}, St = {
"1.0": "/8",
"1.2": "/1",
"1.3": "/3",
"2.0": "/412",
"2.0.2": "/416",
"2.0.3": "/417",
"2.0.4": "/419",
"?": "/"
}, ce = {
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"
}, He = {
browser: [
[
/\b(?:crmo|crios)\/([\w\.]+)/i
// Chrome for Android/iOS
],
[L, [k, "Chrome"]],
[
/edg(?:e|ios|a)?\/([\w\.]+)/i
// Microsoft Edge
],
[L, [k, "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
],
[k, L],
[
/opios[\/ ]+([\w\.]+)/i
// Opera mini on iphone >= 8.0
],
[L, [k, F + " Mini"]],
[
/\bopr\/([\w\.]+)/i
// Opera Webkit
],
[L, [k, F]],
[
// 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
],
[k, L],
[
/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i
// UCBrowser
],
[L, [k, "UC" + B]],
[
/\bqbcore\/([\w\.]+)/i
// WeChat Desktop for Windows Built-in Browser
],
[L, [k, "WeChat(Win) Desktop"]],
[
/micromessenger\/([\w\.]+)/i
// WeChat
],
[L, [k, "WeChat"]],
[
/konqueror\/([\w\.]+)/i
// Konqueror
],
[L, [k, "Konqueror"]],
[
/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i
// IE11
],
[L, [k, "IE"]],
[
/yabrowser\/([\w\.]+)/i
// Yandex
],
[L, [k, "Yandex"]],
[
/(avast|avg)\/([\w\.]+)/i
// Avast/AVG Secure Browser
],
[[k, /(.+)/, "$1 Secure " + B], L],
[
/\bfocus\/([\w\.]+)/i
// Firefox Focus
],
[L, [k, U + " Focus"]],
[
/\bopt\/([\w\.]+)/i
// Opera Touch
],
[L, [k, F + " Touch"]],
[
/coc_coc\w+\/([\w\.]+)/i
// Coc Coc Browser
],
[L, [k, "Coc Coc"]],
[
/dolfin\/([\w\.]+)/i
// Dolphin
],
[L, [k, "Dolphin"]],
[
/coast\/([\w\.]+)/i
// Opera Coast
],
[L, [k, F + " Coast"]],
[
/miuibrowser\/([\w\.]+)/i
// MIUI Browser
],
[L, [k, "MIUI " + B]],
[
/fxios\/([-\w\.]+)/i
// Firefox for iOS
],
[L, [k, U]],
[
/\bqihu|(qi?ho?o?|360)browser/i
// 360
],
[[k, "360 " + B]],
[
/(oculus|samsung|sailfish)browser\/([\w\.]+)/i
],
[[k, /(.+)/, "$1 " + B], L],
[
// Oculus/Samsung/Sailfish Browser
/(comodo_dragon)\/([\w\.]+)/i
// Comodo Dragon
],
[[k, /_/g, " "], L],
[
/(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
],
[k, L],
[
/(metasr)[\/ ]?([\w\.]+)/i,
// SouGouBrowser
/(lbbrowser)/i
// LieBao Browser
],
[k],
[
// WebView
/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i
// Facebook App for iOS & Android
],
[[k, he], L],
[
/safari (line)\/([\w\.]+)/i,
// Line App for iOS
/\b(line)\/([\w\.]+)\/iab/i,
// Line App for Android
/(chromium|instagram)[\/ ]([-\w\.]+)/i
// Chromium/Instagram
],
[k, L],
[
/\bgsa\/([\w\.]+) .*safari\//i
// Google Search Appliance on iOS
],
[L, [k, "GSA"]],
[
/headlesschrome(?:\/([\w\.]+)| )/i
// Chrome Headless
],
[L, [k, R + " Headless"]],
[
/ wv\).+(chrome)\/([\w\.]+)/i
// Chrome WebView
],
[[k, R + " WebView"], L],
[
/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i
// Android Browser
],
[L, [k, "Android " + B]],
[
/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i
// Chrome/OmniWeb/Arora/Tizen/Nokia
],
[k, L],
[
/version\/([\w\.]+) .*mobile\/\w+ (safari)/i
// Mobile Safari
],
[L, [k, "Mobile Safari"]],
[
/version\/([\w\.]+) .*(mobile ?safari|safari)/i
// Safari & Safari Mobile
],
[L, k],
[
/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i
// Safari < 3.0
],
[k, [L, Fe, St]],
[
/(webkit|khtml)\/([\w\.]+)/i
],
[k, L],
[
// Gecko based
/(navigator|netscape\d?)\/([-\w\.]+)/i
// Netscape
],
[[k, "Netscape"], L],
[
/mobile vr; rv:([\w\.]+)\).+firefox/i
// Firefox Reality
],
[L, [k, U + " 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
],
[k, L]
],
cpu: [
[
/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i
// AMD64 (x64)
],
[[g, "amd64"]],
[
/(ia32(?=;))/i
// IA32 (quicktime)
],
[[g, Le]],
[
/((?:i[346]|x)86)[;\)]/i
// IA32 (x86)
],
[[g, "ia32"]],
[
/\b(aarch64|arm(v?8e?l?|_?64))\b/i
// ARM64
],
[[g, "arm64"]],
[
/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i
// ARMHF
],
[[g, "armhf"]],
[
// PocketPC mistakenly identified as PowerPC
/windows (ce|mobile); ppc;/i
],
[[g, "arm"]],
[
/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i
// PowerPC
],
[[g, /ower/, d, Le]],
[
/(sun4\w)[;\)]/i
// SPARC
],
[[g, "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
],
[[g, 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
],
[A, [b, Z], [m, y]],
[
/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,
/samsung[- ]([-\w]+)/i,
/sec-(sgh\w+)/i
],
[A, [b, Z], [m, _]],
[
// Apple
/\((ip(?:hone|od)[\w ]*);/i
// iPod/iPhone
],
[A, [b, ue], [m, _]],
[
/\((ipad);[-\w\),; ]+apple/i,
// iPad
/applecoremedia\/[\w\.]+ \((ipad)/i,
/\b(ipad)\d\d?,\d\d?[;\]].+ios/i
],
[A, [b, ue], [m, y]],
[
// Huawei
/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i
],
[A, [b, J], [m, y]],
[
/(?:huawei|honor)([-\w ]+)[;\)]/i,
/\b(nexus 6p|\w{2,4}-[atu]?[ln][01259x][012359][an]?)\b(?!.+d\/s)/i
],
[A, [b, J], [m, _]],
[
// 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
],
[[A, /_/g, " "], [b, se], [m, _]],
[
/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i
// Mi Pad tablets
],
[[A, /_/g, " "], [b, se], [m, y]],
[
// OPPO
/; (\w+) bui.+ oppo/i,
/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i
],
[A, [b, "OPPO"], [m, _]],
[
// Vivo
/vivo (\w+)(?: bui|\))/i,
/\b(v[12]\d{3}\w?[at])(?: bui|;)/i
],
[A, [b, "Vivo"], [m, _]],
[
// Realme
/\b(rmx[12]\d{3})(?: bui|;|\))/i
],
[A, [b, "Realme"], [m, _]],
[
// 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
],
[A, [b, M], [m, _]],
[
/\b(mz60\d|xoom[2 ]{0,2}) build\//i
],
[A, [b, M], [m, y]],
[
// LG
/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i
],
[A, [b, Y], [m, y]],
[
/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,
/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,
/\blg-?([\d\w]+) bui/i
],
[A, [b, Y], [m, _]],
[
// Lenovo
/(ideatab[-\w ]+)/i,
/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i
],
[A, [b, "Lenovo"], [m, y]],
[
// Nokia
/(?:maemo|nokia).*(n900|lumia \d+)/i,
/nokia[-_ ]?([-\w\.]*)/i
],
[[A, /_/g, " "], [b, "Nokia"], [m, _]],
[
// Google
/(pixel c)\b/i
// Google Pixel C
],
[A, [b, N], [m, y]],
[
/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i
// Google Pixel
],
[A, [b, N], [m, _]],
[
// Sony
/droid.+ ([c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i
],
[A, [b, K], [m, _]],
[
/sony tablet [ps]/i,
/\b(?:sony)?sgp\w+(?: bui|\))/i
],
[[A, "Xperia Tablet"], [b, K], [m, y]],
[
// OnePlus
/ (kb2005|in20[12]5|be20[12][59])\b/i,
/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i
],
[A, [b, "OnePlus"], [m, _]],
[
// Amazon
/(alexa)webm/i,
/(kf[a-z]{2}wi)( bui|\))/i,
// Kindle Fire without Silk
/(kf[a-z]+)( bui|\)).+silk\//i
// Kindle Fire HD
],
[A, [b, Q], [m, y]],
[
/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i
// Fire Phone
],
[[A, /(.+)/g, "Fire Phone $1"], [b, Q], [m, _]],
[
// BlackBerry
/(playbook);[-\w\),; ]+(rim)/i
// BlackBerry PlayBook
],
[A, b, [m, y]],
[
/\b((?:bb[a-f]|st[hv])100-\d)/i,
/\(bb10; (\w+)/i
// BlackBerry 10
],
[A, [b, j], [m, _]],
[
// Asus
/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i
],
[A, [b, de], [m, y]],
[
/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i
],
[A, [b, de], [m, _]],
[
// HTC
/(nexus 9)/i
// HTC Nexus 9
],
[A, [b, "HTC"], [m, y]],
[
/(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
],
[b, [A, /_/g, " "], [m, _]],
[
// Acer
/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i
],
[A, [b, "Acer"], [m, y]],
[
// Meizu
/droid.+; (m[1-5] note) bui/i,
/\bmz-([-\w]{2,})/i
],
[A, [b, "Meizu"], [m, _]],
[
// Sharp
/\b(sh-?[altvz]?\d\d[a-ekm]?)/i
],
[A, [b, "Sharp"], [m, _]],
[
// 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
],
[b, A, [m, _]],
[
/(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
],
[b, A, [m, y]],
[
/(surface duo)/i
// Surface Duo
],
[A, [b, C], [m, y]],
[
/droid [\d\.]+; (fp\du?)(?: b|\))/i
// Fairphone
],
[A, [b, "Fairphone"], [m, _]],
[
/(u304aa)/i
// AT&T
],
[A, [b, "AT&T"], [m, _]],
[
/\bsie-(\w*)/i
// Siemens
],
[A, [b, "Siemens"], [m, _]],
[
/\b(rct\w+) b/i
// RCA Tablets
],
[A, [b, "RCA"], [m, y]],
[
/\b(venue[\d ]{2,7}) b/i
// Dell Venue Tablets
],
[A, [b, "Dell"], [m, y]],
[
/\b(q(?:mv|ta)\w+) b/i
// Verizon Tablet
],
[A, [b, "Verizon"], [m, y]],
[
/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i
// Barnes & Noble Tablet
],
[A, [b, "Barnes & Noble"], [m, y]],
[
/\b(tm\d{3}\w+) b/i
],
[A, [b, "NuVision"], [m, y]],
[
/\b(k88) b/i
// ZTE K Series Tablet
],
[A, [b, "ZTE"], [m, y]],
[
/\b(nx\d{3}j) b/i
// ZTE Nubia
],
[A, [b, "ZTE"], [m, _]],
[
/\b(gen\d{3}) b.+49h/i
// Swiss GEN Mobile
],
[A, [b, "Swiss"], [m, _]],
[
/\b(zur\d{3}) b/i
// Swiss ZUR Tablet
],
[A, [b, "Swiss"], [m, y]],
[
/\b((zeki)?tb.*\b) b/i
// Zeki Tablets
],
[A, [b, "Zeki"], [m, y]],
[
/\b([yr]\d{2}) b/i,
/\b(dragon[- ]+touch |dt)(\w{5}) b/i
// Dragon Touch Tablet
],
[[b, "Dragon Touch"], A, [m, y]],
[
/\b(ns-?\w{0,9}) b/i
// Insignia Tablets
],
[A, [b, "Insignia"], [m, y]],
[
/\b((nxa|next)-?\w{0,9}) b/i
// NextBook Tablets
],
[A, [b, "NextBook"], [m, y]],
[
/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i
// Voice Xtreme Phones
],
[[b, "Voice"], A, [m, _]],
[
/\b(lvtel\-)?(v1[12]) b/i
// LvTel Phones
],
[[b, "LvTel"], A, [m, _]],
[
/\b(ph-1) /i
// Essential PH-1
],
[A, [b, "Essential"], [m, _]],
[
/\b(v(100md|700na|7011|917g).*\b) b/i
// Envizen Tablets
],
[A, [b, "Envizen"], [m, y]],
[
/\b(trio[-\w\. ]+) b/i
// MachSpeed Tablets
],
[A, [b, "MachSpeed"], [m, y]],
[
/\btu_(1491) b/i
// Rotor Tablets
],
[A, [b, "Rotor"], [m, y]],
[
/(shield[\w ]+) b/i
// Nvidia Shield Tablets
],
[A, [b, "Nvidia"], [m, y]],
[
/(sprint) (\w+)/i
// Sprint Phones
],
[b, A, [m, _]],
[
/(kin\.[onetw]{3})/i
// Microsoft Kin
],
[[A, /\./g, " "], [b, C], [m, _]],
[
/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i
// Zebra
],
[A, [b, Ae], [m, y]],
[
/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i
],
[A, [b, Ae], [m, _]],
[
///////////////////
// CONSOLES
///////////////////
/(ouya)/i,
// Ouya
/(nintendo) ([wids3utch]+)/i
// Nintendo
],
[b, A, [m, w]],
[
/droid.+; (shield) bui/i
// Nvidia
],
[A, [b, "Nvidia"], [m, w]],
[
/(playstation [345portablevi]+)/i
// Playstation
],
[A, [b, K], [m, w]],
[
/\b(xbox(?: one)?(?!; xbox))[\); ]/i
// Microsoft Xbox
],
[A, [b, C], [m, w]],
[
///////////////////
// SMARTTVS
///////////////////
/smart-tv.+(samsung)/i
// Samsung
],
[b, [m, I]],
[
/hbbtv.+maple;(\d+)/i
],
[[A, /^/, "SmartTV"], [b, Z], [m, I]],
[
/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i
// LG SmartTV
],
[[b, Y], [m, I]],
[
/(apple) ?tv/i
// Apple TV
],
[b, [A, ue + " TV"], [m, I]],
[
/crkey/i
// Google Chromecast
],
[[A, R + "cast"], [b, N], [m, I]],
[
/droid.+aft(\w)( bui|\))/i
// Fire TV
],
[A, [b, Q], [m, I]],
[
/\(dtv[\);].+(aquos)/i
// Sharp
],
[A, [b, "Sharp"], [m, I]],
[
/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,
// Roku
/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i
// HbbTV devices
],
[[b, tt], [A, tt], [m, I]],
[
/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i
// SmartTV from Unidentified Vendors
],
[[m, I]],
[
///////////////////
// WEARABLES
///////////////////
/((pebble))app/i
// Pebble
],
[b, A, [m, P]],
[
/droid.+; (glass) \d/i
// Google Glass
],
[A, [b, N], [m, P]],
[
/droid.+; (wt63?0{2,3})\)/i
],
[A, [b, Ae], [m, P]],
[
/(quest( 2)?)/i
// Oculus Quest
],
[A, [b, he], [m, P]],
[
///////////////////
// EMBEDDED
///////////////////
/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i
// Tesla
],
[b, [m, G]],
[
////////////////////
// MIXED (GENERIC)
///////////////////
/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i
// Android Phones from Unidentified Vendors
],
[A, [m, _]],
[
/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i
// Android Tablets from Unidentified Vendors
],
[A, [m, y]],
[
/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i
// Unidentifiable Tablet
],
[[m, y]],
[
/(phone|mobile(?:[;\/]| safari)|pda(?=.+windows ce))/i
// Unidentifiable Mobile
],
[[m, _]],
[
/(android[-\w\. ]{0,9});.+buil/i
// Generic Android Device
],
[A, [b, "Generic"]]
],
engine: [
[
/windows.+ edge\/([\w\.]+)/i
// EdgeHTML
],
[L, [k, D + "HTML"]],
[
/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i
// Blink
],
[L, [k, "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
],
[k, L],
[
/rv\:([\w\.]{1,9})\b.+(gecko)/i
// Gecko
],
[L, k]
],
os: [
[
// Windows
/microsoft (windows) (vista|xp)/i
// Windows (iTunes)
],
[k, L],
[
/(windows) nt 6\.2; (arm)/i,
// Windows RT
/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,
// Windows Phone
/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i
],
[k, [L, Fe, ce]],
[
/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i
],
[[k, "Windows"], [L, Fe, ce]],
[
// iOS/macOS
/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,
// iOS
/cfnetwork\/.+darwin/i
],
[[L, /_/g, "."], [k, "iOS"]],
[
/(mac os x) ?([\w\. ]*)/i,
/(macintosh|mac_powerpc\b)(?!.+haiku)/i
// Mac OS
],
[[k, "Mac OS"], [L, /_/g, "."]],
[
// Mobile OSes
/droid ([\w\.]+)\b.+(android[- ]x86)/i
// Android-x86
],
[L, k],
[
// 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
],
[k, L],
[
/\(bb(10);/i
// BlackBerry 10
],
[L, [k, j]],
[
/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i
// Symbian
],
[L, [k, "Symbian"]],
[
/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i
// Firefox OS
],
[L, [k, U + " OS"]],
[
/web0s;.+rt(tv)/i,
/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i
// WebOS
],
[L, [k, "webOS"]],
[
// Google Chromecast
/crkey\/([\d\.]+)/i
// Google Chromecast
],
[L, [k, R + "cast"]],
[
/(cros) [\w]+ ([\w\.]+\w)/i
// Chromium OS
],
[[k, "Chromium OS"], L],
[
// 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
],
[k, L],
[
/(sunos) ?([\w\.\d]*)/i
// Solaris
],
[[k, "Solaris"], L],
[
/((?: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
],
[k, L]
]
}, Me = function(oe, le) {
if (typeof oe === x && (le = oe, oe = s), !(this instanceof Me))
return new Me(oe, le).getResult();
var ne = oe || (typeof r !== E && r.navigator && r.navigator.userAgent ? r.navigator.userAgent : d), me = le ? we(He, le) : He;
return this.getBrowser = function() {
var ae = {};
return ae[k] = s, ae[L] = s, fe.call(ae, ne, me.browser), ae.major = Ft(ae.version), ae;
}, this.getCPU = function() {
var ae = {};
return ae[g] = s, fe.call(ae, ne, me.cpu), ae;
}, this.getDevice = function() {
var ae = {};
return ae[b] = s, ae[A] = s, ae[m] = s, fe.call(ae, ne, me.device), ae;
}, this.getEngine = function() {
var ae = {};
return ae[k] = s, ae[L] = s, fe.call(ae, ne, me.engine), ae;
}, this.getOS = function() {
var ae = {};
return ae[k] = s, ae[L] = s, fe.call(ae, ne, me.os), ae;
}, 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 ne;
}, this.setUA = function(ae) {
return ne = typeof ae === v && ae.length > H ? tt(ae, H) : ae, this;
}, this.setUA(ne), this;
};
Me.VERSION = l, Me.BROWSER = ee([k, L, O]), Me.CPU = ee([g]), Me.DEVICE = ee([A, b, m, w, _, I, y, P, G]), Me.ENGINE = Me.OS = ee([k, L]), e.exports && (t = e.exports = Me), t.UAParser = Me;
var Pe = typeof r !== E && (r.jQuery || r.Zepto);
if (Pe && !Pe.ua) {
var ge = new Me();
Pe.ua = ge.getResult(), Pe.ua.get = function() {
return ge.getUA();
}, Pe.ua.set = function(oe) {
ge.setUA(oe);
var le = ge.getResult();
for (var ne in le)
Pe.ua[ne] = le[ne];
};
}
})(typeof window == "object" ? window : tn);
})(an, an.exports);
var Id = an.exports;
const xd = /* @__PURE__ */ rs(Id), qt = xd(), or = qt.os.name, Cd = or && or.toLowerCase().indexOf("android") >= 0, Dd = or && or.toLowerCase().indexOf("ios") >= 0, zt = qt.device.type === "mobile" || Cd || Dd, Od = "kwai-p";
let jo = is.ERROR;
typeof location < "u" && (jo = Gc.loadLogLevel("kwai-player-log") || is.ERROR, Vc.setLevel(jo).setName(Od));
const Ts = qc.EventEmitter;
var Md = Object.defineProperty, Nd = (e, t, r) => t in e ? Md(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, De = (e, t, r) => (Nd(e, typeof t != "symbol" ? t + "" : t, r), r);
const Ko = {
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"
}, Pd = 5e3;
var hi = /* @__PURE__ */ ((e) => (e.SUMMARY = "KP_WEB_SUMMARY", e.REALTIME = "KP_WEB_REALTIME", e.DOWNLOAD = "KP_WEB_DOWNLOAD", e.EVENT = "KP_WEB_EVENT", e))(hi || {});
const Ud = {
summary: "KP_WEB_SUMMARY",
realtimeBeacon: "KP_WEB_REALTIME",
download: "KP_WEB_DOWNLOAD",
event: "KP_WEB_EVENT"
/* EVENT */
}, Rs = "production", Bd = "streamlake", Jo = [
"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 (t) {
console.error("vite-plugin-css-injected-by-js", t);
}
})();
var Fd = Object.defineProperty, Hd = (e, t, r) => t in e ? Fd(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, ft = (e, t, r) => (Hd(e, typeof t != "symbol" ? t + "" : t, r), r);
const Vd = "ControlsPlugin", Gd = "I18nPlugin", Wd = "LoggerPlugin", jd = "HotkeyPlugin", Kd = "PlayInfoPlugin", Jd = "RotatePlugin", zd = "PreviewPlugin", $d = "MaskPlugin", qd = "VRPlugin", Yd = "DanmakuPlugin";
let pt = class extends Ts {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static isInstanceOfPlugin(t) {
return typeof t.beforeInstall == "function" && typeof t.afterInstall == "function" && typeof t.beforeUninstall == "function" && typeof t.afterUninstall == "function" && typeof t.getLabel == "function";
}
/**
* 控制条插槽按钮
*/
get controlsSoltBtns() {
}
/**
* 播放器实例化前钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
beforeInstall(t, r) {
}
/**
* 播放器实例化后钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
afterInstall(t, r) {
}
/**
* 播放器销毁前钩子
* @param player 播放器实例
*/
beforeUninstall(t) {
}
/**
* 播放器销毁后钩子
* @param player 播放器实例
*/
afterUninstall(t) {
}
};
ft(pt, "label"), /**
* 版本
*/
ft(pt, "version"), /**
* 当前环境是否支持
*/
ft(pt, "isSupported");
const Qd = class Ss extends pt {
/**
* @override
*/
getLabel() {
return Ss.label;
}
beforeInstall(t, r) {
}
afterInstall(t, r) {
}
};
ft(Qd, "label", Vd);
const Zd = class Ls extends pt {
/**
* @override
*/
getLabel() {
return Ls.label;
}
beforeInstall(t, r) {
}
afterInstall(t, r) {
}
};
ft(Zd, "label", Gd);
const ks = class Is extends pt {
/**
* @override
*/
getLabel() {
return Is.label;
}
beforeInstall(t, r) {
}
afterInstall(t, r) {
}
/**
* 增加业务相关数据
* @param key 上报数据key
* @param value 上报数据
*/
addBizLog(t, r) {
}
appendSummaryField(t, r) {
}
};
ft(ks, "label", Wd);
let Xd = ks;
const eh = class xs extends pt {
/**
* @override
*/
getLabel() {
return xs.label;
}
};
ft(eh, "label", jd);
const th = class Cs extends pt {
/**
* @override
*/
getLabel() {
return Cs.label;
}
};
ft(th, "label", Kd);
const ih = class Ds extends pt {
/**
* @override
*/
getLabel() {
return Ds.label;
}
};
ft(ih, "label", Jd);
const rh = class Os extends pt {
/**
* @override
*/
getLabel() {
return Os.label;
}
};
ft(rh, "label", zd);
const nh = class Ms extends pt {
/**
* @override
*/
getLabel() {
return Ms.label;
}
};
ft(nh, "label", $d);
const oh = class Ns extends pt {
/**
* @override
*/
getLabel() {
return Ns.label;
}
};
ft(oh, "label", qd);
const ah = class Ps extends pt {
/**
* @override
*/
getLabel() {
return Ps.label;
}
};
ft(ah, "label", Yd);
var ri = /* @__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))(ri || {}), Wi, sh = new Uint8Array(16);
function lh() {
if (!Wi && (Wi = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto < "u" && typeof msCrypto.getRandomValues == "function" && msCrypto.getRandomValues.bind(msCrypto), !Wi))
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
return Wi(sh);
}
const uh = /^(?:[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 ch(e) {
return typeof e == "string" && uh.test(e);
}
var at = [];
for (var Vr = 0; Vr < 256; ++Vr)
at.push((Vr + 256).toString(16).substr(1));
function dh(e) {
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, r = (at[e[t + 0]] + at[e[t + 1]] + at[e[t + 2]] + at[e[t + 3]] + "-" + at[e[t + 4]] + at[e[t + 5]] + "-" + at[e[t + 6]] + at[e[t + 7]] + "-" + at[e[t + 8]] + at[e[t + 9]] + "-" + at[e[t + 10]] + at[e[t + 11]] + at[e[t + 12]] + at[e[t + 13]] + at[e[t + 14]] + at[e[t + 15]]).toLowerCase();
if (!ch(r))
throw TypeError("Stringified UUID is invalid");
return r;
}
function Us(e, t, r) {
e = e || {};
var s = e.random || (e.rng || lh)();
if (s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128, t) {
r = r || 0;
for (var l = 0; l < 16; ++l)
t[r + l] = s[l];
return t;
}
return dh(s);
}
const Gr = "log-ctx";
class hh {
constructor() {
De(this, "_env", Rs), De(this, "_reportTypes", []), De(this, "_player"), De(this, "_logger"), De(this, "_logBaseInfo", this._getDefaultLogBaseInfo()), De(this, "_biz", {}), De(this, "_extraSummaryFields", {}), De(this, "_forceSendBeacon", !1);
}
setBaseInfo(t, r, s) {
this._player = t, this._logger = t.logger, this._logBaseInfo.env = this._env = r, this._reportTypes = s;
}
setBizData(t) {
var r, s;
if ((r = this._logger) == null || r.i(Gr, "set biz", t), !t) {
this._logBaseInfo = this._getDefaultLogBaseInfo();
return;
}
const l = {};
Object.keys(t).forEach((d) => {
var h;
const p = this._underscoreToCamelCase(d), E = t[d];
if (["sessionId", "deviceId", "userId", "globalId", "networkType", "packageName", "versionName", "channel"].indexOf(p) >= 0 && (typeof E == "string" || typeof E == "number")) {
const x = this._val2String(t[d]).trim();
x && ((h = this._logger) == null || h.i(Gr, "biz to log:", p, x), l[p] = x);
}
d !== "secretId" && d !== "secretKey" && (this._biz[d] = E);
}), Object.assign(this._logBaseInfo, l), l.deviceId && ((s = this._logger) == null || s.i(Gr, `update did by bizData. ${l.deviceId}`), kd(this._logBaseInfo.deviceId));
}
preprocessingLog(t, r, s) {
var l, d;
if (r)
return r = Object.assign(r, {
player_version: ((l = this._player) == null ? void 0 : l.version) || "",
pack_version: ((d = this._player) == null ? void 0 : d.packVersion) || "",
biz: this._biz
}), t === hi.SUMMARY && typeof r == "object" && (s ? r.extra = Object.assign({}, this._extraSummaryFields, s) : r.extra = this._extraSummaryFields), r;
}
clearExtraSummary() {
this._extraSummaryFields = {};
}
appendSummaryField(t, r) {
this._extraSummaryFields[t] = r;
}
get reportTypes() {
return this._reportTypes;
}
get logBaseInfo() {
var t;
return (t = this._player) != null && t.productName && (this._logBaseInfo.productName = this._player.productName), this._logBaseInfo.deviceId || (this._logBaseInfo.deviceId = nr), this._logBaseInfo;
}
get player() {
return this._player;
}
set forceSendBeacon(t) {
this._forceSendBeacon = t;
}
get forceSendBeacon() {
return this._forceSendBeacon;
}
_getDefaultLogBaseInfo() {
let t = 10;
return qt.os.name === "iOS" ? t = 9 : qt.os.name === "Android" && (t = 8), {
env: this._env,
productName: Bd,
sessionId: Us(),
platform: t,
deviceId: nr,
userId: "",
globalId: "",
networkType: "",
packageName: "",
versionName: "",
channel: ""
};
}
_underscoreToCamelCase(t) {
return t.replace(/_([a-z])/g, (r, s) => s.toUpperCase());
}
_val2String(t) {
return typeof t == "number" ? t.toString() : t || "";
}
}
const Wr = "kwai-player-web-log-temp", fh = 3 * 24 * 3600 * 1e3, ph = 5 * 1e3, zo = 1, ei = "log-reissue";
class Ah {
constructor(t, r, s) {
De(this, "_ctx"), De(this, "_logger"), De(this, "_webLogger"), De(this, "_active", !1), De(this, "_processingTs", 0), De(this, "_lc", new ws()), De(this, "_timer", 0), De(this, "_checkMissing", !1), De(this, "_tick", () => {
if (!this._active || !this._ctx.player)
return;
this._checkMissing && (this._checkMissing = !1, this._checkMissingLog());
const l = performance.now();
if (l - this._processingTs >= ph) {
this._processingTs = l;
const d = this._ctx.preprocessingLog(hi.SUMMARY, this._ctx.player.audienceStat, { reissue_log: 1 });
d && (this._logger.v(ei, "write temp"), this._writeTemp(this._webLogger.generateFormData(this._ctx.logBaseInfo, [{ key: hi.SUMMARY, value: d }])));
}
}), De(this, "_startTimer", () => {
this._timer || (this._timer = +setInterval(this._tick, 1e3));
}), De(this, "_stopTimer", () => {
clearInterval(this._timer), this._timer = 0;
}), this._ctx = t, this._logger = r, this._webLogger = s, this._lc.timeout = fh;
}
start() {
this._logger.i(ei, "start"), this._active || (this._active = !0, this._processingTs = performance.now(), this._checkMissing = !0, this._startTimer());
}
stop() {
this._logger.i(ei, "stop"), this._active = !1, this._clear(), this._stopTimer();
}
_checkMissingLog() {
const t = this._readTemp();
this._clear(), t ? (this._logger.i(ei, "send missing log"), this._webLogger.send(this._ctx.logBaseInfo.env, hi.SUMMARY, t.value)) : this._logger.i(ei, "no missing log");
}
_clear() {
try {
localStorage == null || localStorage.removeItem(Wr);
} catch (t) {
}
}
_writeTemp(t) {
if (!t)
return;
const r = {
version: zo,
value: t,
checkSum: this._fletcher16(t)
};
try {
this._lc.write(Wr, btoa(JSON.stringify(r)));
} catch (s) {
}
}
_readTemp() {
const t = this._lc.read(Wr, !0);
if (typeof t == "string")
try {
const r = JSON.parse(atob(t));
if (r.version === zo && typeof r.value == "string" && r.checkSum === this._fletcher16(r.value))
return this._logger.i(ei, "read success"), r;
this._logger.i(ei, "read failed", r);
} catch (r) {
}
}
_fletcher16(t) {
let r = 0, s = 0;
for (let l = 0; l < t.length; l++)
r = (r + t.charCodeAt(l)) % 255, s = (s + r) % 255;
return s << 8 | r;
}
}
const $o = {
unknown: 0,
none: 1,
wifi: 2,
"4g": 3,
"3g": 4,
"2g": 5,
"5g": 7,
"slow-2g": 5
}, jr = (/* @__PURE__ */ new Date()).toString().match(/GMT\+\d+/);
let Kr = "";
function vh() {
try {
return parseInt((localStorage == null ? void 0 : localStorage.getItem("kwai_player_client_increment_id")) || "") || 0;
} catch (e) {
}
return 0;
}
const si = "web-logger", sn = class ni {
constructor(t) {
De(this, "_waitingQueue", []), De(this, "_nextTickTimer"), De(this, "_logger"), this._logger = t;
}
sendLog(t, r, s, l = !1, d) {
this._logger.i(si, "sendLog", t, r, s, `forceSendBeacon: ${l} immediately: ${d}`), s && (this._waitingQueue.push({ key: r, value: s }), d ? (this.send(t.env, t.productName, this.generateFormData(t, this._waitingQueue), l), this._waitingQueue.splice(0)) : this._nextTickTimer || (this._nextTickTimer = setTimeout(() => {
this._nextTickTimer = void 0, this.send(t.env, t.productName, this.generateFormData(t, this._waitingQueue), l), this._waitingQueue.splice(0);
}, 0)));
}
send(t, r, s, l = !1) {
if (this._logger.i(si, "send", t, r, !!s, `forceSendBeacon: ${l}`), !s)
return;
let d = Ko[t] || Ko.production;
ni._clientIncrementId++;
try {
localStorage && (localStorage.kwai_player_client_increment_id = ni._clientIncrementId);
} catch (p) {
}
const h = new Go(d, !0);
if (h.query.v = "3.10.24", h.query.kpn = r, d = h.toString(), this._logger.i(si, "send", t, r, !!s, d), l && navigator.sendBeacon) {
const p = navigator.sendBeacon(d, s);
this._logger.i(si, "send data use sendBeacon.", p), p || this._sendByXhr(d, s);
} else
this._sendByXhr(d, s);
}
_sendByXhr(t, r) {
this._logger.i(si, "send data use xhr.");
const s = new XMLHttpRequest();
s.open("POST", t), s.setRequestHeader("Content-Type", "text/plain;charset=UTF-8"), s.onerror = s.ontimeout = () => {
this._logger.i("sendLog error"), s.onerror = s.ontimeout = s.onload = null;
}, s.onload = () => {
s.onerror = s.ontimeout = s.onload = null;
}, s.timeout = Pd, s.send(r);
}
generateFormData(t, r) {
this._logger.i(si, `device_id: ${t.deviceId}`);
const s = {
common: ni._buildCommon(
t,
{
service_name: "KwaiPlayerWeb"
}
),
logs: r.map((l) => ni._buildEvent(t, l.key, l.value))
};
return s.logs.length ? JSON.stringify(s) : "";
}
static _buildEvent(t, r, s) {
Kr || (Kr = Us());
const l = {
identity: Kr,
page: location.href,
hostname: location.hostname,
page_type: 2,
params: new Go(location.href, !0).query
};
return {
client_timestamp: Date.now(),
client_increment_id: ni._clientIncrementId,
session_id: t.sessionId,
time_zone: ni._timeZone,
stat_package: {
custom_stat_event: {
key: r,
value: JSON.stringify(Object.assign({}, s, { url_package: l }))
}
}
};
}
static _buildCommon(t, r) {
return Ro({
identity_package: {
device_id: t.deviceId,
global_id: t.globalId,
user_id: t.userId
},
app_package: {
language: navigator.language,
platform: t.platform,
container: t.platform === 10 ? "WEB" : "H5",
package_name: t.packageName,
product_name: t.productName,
version_name: t.versionName,
channel: t.channel
},
device_package: {
os_version: qt.os.version,
model: qt.os.name,
ua: navigator.userAgent
},
need_encrypt: !1,
sdk_version: "",
h5_extra_attr: this._getH5ExtraAttr(t),
global_attr: "{}",
network_package: {
type: this._getNetworkType(t.networkType)
}
}, r);
}
static _getNetworkType(t) {
var r;
const s = t || ((r = (navigator == null ? void 0 : navigator.connection) || (navigator == null ? void 0 : navigator.mozConnection) || (navigator == null ? void 0 : navigator.webkitConnection)) == null ? void 0 : r.effectiveType);
return s && $o[s] || $o.unknown;
}
static _getH5ExtraAttr(t) {
const r = parseFloat(devicePixelRatio.toFixed(3)) || 1;
return JSON.stringify({
sdk_name: "",
sdk_version: "",
sdk_bundle: "",
app_version_name: t.versionName,
resolution: `${Math.floor(screen.width * r)}x${Math.floor(screen.height * r)}`,
screen_width: Math.floor(screen.width),
screen_height: Math.floor(screen.height),
device_pixel_ratio: r,
domain: location.origin,
fromIframe: self !== top
});
}
};
De(sn, "_clientIncrementId", vh()), De(sn, "_timeZone", jr && jr[0] ? jr[0] : "");
let _h = sn;
const Ei = "logger-plugin";
class Bs extends Xd {
constructor() {
super(...arguments), De(this, "_summaryAlreadySend", !1), De(this, "_webLogger"), De(this, "_logger"), De(this, "_ctx", new hh()), De(this, "_logReissue"), De(this, "_parseBizData", () => {
var t, r, s;
(r = this._logger) == null || r.i(Ei, "parse biz data", (t = this._ctx.player) == null ? void 0 : t.bizData), this._ctx.setBizData((s = this._ctx.player) == null ? void 0 : s.bizData);
}), De(this, "_onReport", (t) => {
var r, s;
if (this._ctx.reportTypes.indexOf(t.type) !== -1) {
const l = Ud[t.type];
l ? ((r = this._logger) == null || r.i(Ei, "sendLog", this._ctx.logBaseInfo.productName, l), this._send(l, t.value)) : (s = this._logger) == null || s.i(Ei, "unknown weblogger key.");
}
}), De(this, "_onSrcChange", () => {
var t;
this._sendSummary(), this._summaryAlreadySend = !1, (t = this._logReissue) == null || t.start();
}), De(this, "_sendSummary", () => {
var t, r;
!this._ctx.player || this._summaryAlreadySend || !this._ctx.player.audienceStat || ((t = this._logReissue) == null || t.stop(), this._summaryAlreadySend = !0, (r = this._logger) == null || r.i(Ei, "send summary"), this._send(hi.SUMMARY, this._ctx.player.audienceStat, !0));
}), De(this, "_onBeforeunload", () => {
this._sendSummary();
});
}
beforeInstall(t, r) {
let s;
r && r.reportTypes && Array.isArray(r.reportTypes) && (s = r.reportTypes.filter((l) => Jo.indexOf(l) >= 0)), r != null && r.productName && (t.productName = r.productName), typeof (r == null ? void 0 : r.forceSendBeacon) < "u" && (this._ctx.forceSendBeacon = r.forceSendBeacon), this._logger = t.logger, this._ctx.setBaseInfo(t, (r == null ? void 0 : r.env) || Rs, s || Jo), this._webLogger || (this._webLogger = new _h(t.logger)), this._logReissue = new Ah(this._ctx, t.logger, this._webLogger), t.on(ri.REPORT, this._onReport), t.on(ri.ATTRIBUTE_CHANGE_SRC, this._onSrcChange), t.on(ri.ATTRIBUTE_CHANGE_BIZ_DATA, this._parseBizData), window.addEventListener("beforeunload", this._onBeforeunload), qt && qt.device.type === "mobile" && window.addEventListener("unload", this._onBeforeunload), this._parseBizData();
}
beforeUninstall() {
this._sendSummary();
}
afterUninstall() {
var t, r, s;
(t = this._ctx.player) == null || t.off(ri.REPORT, this._onReport), (r = this._ctx.player) == null || r.off(ri.ATTRIBUTE_CHANGE_SRC, this._onSrcChange), (s = this._ctx.player) == null || s.off(ri.ATTRIBUTE_CHANGE_BIZ_DATA, this._parseBizData), window.removeEventListener("beforeunload", this._onBeforeunload), window.removeEventListener("unload", this._onBeforeunload);
}
appendSummaryField(t, r) {
var s;
(s = this._logger) == null || s.i(Ei, "add summary field", t, r), this._ctx.appendSummaryField(t, r);
}
_send(t, r, s) {
var l;
r && ((l = this._webLogger) == null || l.sendLog(this._ctx.logBaseInfo, t, this._ctx.preprocessingLog(t, r), this._ctx.forceSendBeacon, s));
}
}
De(Bs, "version", "1.1.0-alpha.0");
var pr, Ee, Fs, oi, qo, Hs, ln, Vs, ar = {}, Gs = [], mh = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
function $t(e, t) {
for (var r in t)
e[r] = t[r];
return e;
}
function Ws(e) {
var t = e.parentNode;
t && t.removeChild(e);
}
function gh(e, t, r) {
var s, l, d, h = {};
for (d in t)
d == "key" ? s = t[d] : d == "ref" ? l = t[d] : h[d] = t[d];
if (arguments.length > 2 && (h.children = arguments.length > 3 ? pr.call(arguments, 2) : r), typeof e == "function" && e.defaultProps != null)
for (d in e.defaultProps)
h[d] === void 0 && (h[d] = e.defaultProps[d]);
return qi(e, h, s, l, null);
}
function qi(e, t, r, s, l) {
var d = { type: e, props: t, key: r, ref: s, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, __h: null, constructor: void 0, __v: l == null ? ++Fs : l };
return l == null && Ee.vnode != null && Ee.vnode(d), d;
}
function Ci(e) {
return e.children;
}
function Yi(e, t) {
this.props = e, this.context = t;
}
function Ii(e, t) {
if (t == null)
return e.__ ? Ii(e.__, e.__.__k.indexOf(e) + 1) : null;
for (var r; t < e.__k.length; t++)
if ((r = e.__k[t]) != null && r.__e != null)
return r.__e;
return typeof e.type == "function" ? Ii(e) : null;
}
function js(e) {
var t, r;
if ((e = e.__) != null && e.__c != null) {
for (e.__e = e.__c.base = null, t = 0; t < e.__k.length; t++)
if ((r = e.__k[t]) != null && r.__e != null) {
e.__e = e.__c.base = r.__e;
break;
}
return js(e);
}
}
function un(e) {
(!e.__d && (e.__d = !0) && oi.push(e) && !sr.__r++ || qo !== Ee.debounceRendering) && ((qo = Ee.debounceRendering) || Hs)(sr);
}
function sr() {
var e, t, r, s, l, d, h, p;
for (oi.sort(ln); e = oi.shift(); )
e.__d && (t = oi.length, s = void 0, l = void 0, h = (d = (r = e).__v).__e, (p = r.__P) && (s = [], (l = $t({}, d)).__v = d.__v + 1, mn(p, d, l, r.__n, p.ownerSVGElement !== void 0, d.__h != null ? [h] : null, s, h == null ? Ii(d) : h, d.__h), qs(s, d), d.__e != h && js(d)), oi.length > t && oi.sort(ln));
sr.__r = 0;
}
function Ks(e, t, r, s, l, d, h, p, E, x) {
var v, O, A, k, m, b, L, g = s && s.__k || Gs, w = g.length;
for (r.__k = [], v = 0; v < t.length; v++)
if ((k = r.__k[v] = (k = t[v]) == null || typeof k == "boolean" || typeof k == "function" ? null : typeof k == "string" || typeof k == "number" || typeof k == "bigint" ? qi(null, k, null, null, k) : Array.isArray(k) ? qi(Ci, { children: k }, null, null, null) : k.__b > 0 ? qi(k.type, k.props, k.key, k.ref ? k.ref : null, k.__v) : k) != null) {
if (k.__ = r, k.__b = r.__b + 1, (A = g[v]) === null || A && k.key == A.key && k.type === A.type)
g[v] = void 0;
else
for (O = 0; O < w; O++) {
if ((A = g[O]) && k.key == A.key && k.type === A.type) {
g[O] = void 0;
break;
}
A = null;
}
mn(e, k, A = A || ar, l, d, h, p, E, x), m = k.__e, (O = k.ref) && A.ref != O && (L || (L = []), A.ref && L.push(A.ref, null, k), L.push(O, k.__c || m, k)), m != null ? (b == null && (b = m), typeof k.type == "function" && k.__k === A.__k ? k.__d = E = Js(k, E, e) : E = zs(e, k, A, g, m, E), typeof r.type == "function" && (r.__d = E)) : E && A.__e == E && E.parentNode != e && (E = Ii(A));
}
for (r.__e = b, v = w; v--; )
g[v] != null && (typeof r.type == "function" && g[v].__e != null && g[v].__e == r.__d && (r.__d = $s(s).nextSibling), Qs(g[v], g[v]));
if (L)
for (v = 0; v < L.length; v++)
Ys(L[v], L[++v], L[++v]);
}
function Js(e, t, r) {
for (var s, l = e.__k, d = 0; l && d < l.length; d++)
(s = l[d]) && (s.__ = e, t = typeof s.type == "function" ? Js(s, t, r) : zs(r, s, s, l, s.__e, t));
return t;
}
function zs(e, t, r, s, l, d) {
var h, p, E;
if (t.__d !== void 0)
h = t.__d, t.__d = void 0;
else if (r == null || l != d || l.parentNode == null)
e:
if (d == null || d.parentNode !== e)
e.appendChild(l), h = null;
else {
for (p = d, E = 0; (p = p.nextSibling) && E < s.length; E += 1)
if (p == l)
break e;
e.insertBefore(l, d), h = d;
}
return h !== void 0 ? h : l.nextSibling;
}
function $s(e) {
var t, r, s;
if (e.type == null || typeof e.type == "string")
return e.__e;
if (e.__k) {
for (t = e.__k.length - 1; t >= 0; t--)
if ((r = e.__k[t]) && (s = $s(r)))
return s;
}
return null;
}
function yh(e, t, r, s, l) {
var d;
for (d in r)
d === "children" || d === "key" || d in t || lr(e, d, null, r[d], s);
for (d in t)
l && typeof t[d] != "function" || d === "children" || d === "key" || d === "value" || d === "checked" || r[d] === t[d] || lr(e, d, t[d], r[d], s);
}
function Yo(e, t, r) {
t[0] === "-" ? e.setProperty(t, r == null ? "" : r) : e[t] = r == null ? "" : typeof r != "number" || mh.test(t) ? r : r + "px";
}
function lr(e, t, r, s, l) {
var d;
e:
if (t === "style")
if (typeof r == "string")
e.style.cssText = r;
else {
if (typeof s == "string" && (e.style.cssText = s = ""), s)
for (t in s)
r && t in r || Yo(e.style, t, "");
if (r)
for (t in r)
s && r[t] === s[t] || Yo(e.style, t, r[t]);
}
else if (t[0] === "o" && t[1] === "n")
d = t !== (t = t.replace(/Capture$/, "")), t = t.toLowerCase() in e ? t.toLowerCase().slice(2) : t.slice(2), e.l || (e.l = {}), e.l[t + d] = r, r ? s || e.addEventListener(t, d ? Zo : Qo, d) : e.removeEventListener(t, d ? Zo : Qo, d);
else if (t !== "dangerouslySetInnerHTML") {
if (l)
t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
else if (t !== "width" && t !== "height" && t !== "href" && t !== "list" && t !== "form" && t !== "tabIndex" && t !== "download" && t in e)
try {
e[t] = r == null ? "" : r;
break e;
} catch (h) {
}
typeof r == "function" || (r == null || r === !1 && t[4] !== "-" ? e.removeAttribute(t) : e.setAttribute(t, r));
}
}
function Qo(e) {
return this.l[e.type + !1](Ee.event ? Ee.event(e) : e);
}
function Zo(e) {
return this.l[e.type + !0](Ee.event ? Ee.event(e) : e);
}
function mn(e, t, r, s, l, d, h, p, E) {
var x, v, O, A, k, m, b, L, g, w, _, y, I, P, G, H = t.type;
if (t.constructor !== void 0)
return null;
r.__h != null && (E = r.__h, p = t.__e = r.__e, t.__h = null, d = [p]), (x = Ee.__b) && x(t);
try {
e:
if (typeof H == "function") {
if (L = t.props, g = (x = H.contextType) && s[x.__c], w = x ? g ? g.props.value : x.__ : s, r.__c ? b = (v = t.__c = r.__c).__ = v.__E : ("prototype" in H && H.prototype.render ? t.__c = v = new H(L, w) : (t.__c = v = new Yi(L, w), v.constructor = H, v.render = Eh), g && g.sub(v), v.props = L, v.state || (v.state = {}), v.context = w, v.__n = s, O = v.__d = !0, v.__h = [], v._sb = []), v.__s == null && (v.__s = v.state), H.getDerivedStateFromProps != null && (v.__s == v.state && (v.__s = $t({}, v.__s)), $t(v.__s, H.getDerivedStateFromProps(L, v.__s))), A = v.props, k = v.state, v.__v = t, O)
H.getDerivedStateFromProps == null && v.componentWillMount != null && v.componentWillMount(), v.componentDidMount != null && v.__h.push(v.componentDidMount);
else {
if (H.getDerivedStateFromProps == null && L !== A && v.componentWillReceiveProps != null && v.componentWillReceiveProps(L, w), !v.__e && v.shouldComponentUpdate != null && v.shouldComponentUpdate(L, v.__s, w) === !1 || t.__v === r.__v) {
for (t.__v !== r.__v && (v.props = L, v.state = v.__s, v.__d = !1), v.__e = !1, t.__e = r.__e, t.__k = r.__k, t.__k.forEach(function(Q) {
Q && (Q.__ = t);
}), _ = 0; _ < v._sb.length; _++)
v.__h.push(v._sb[_]);
v._sb = [], v.__h.length && h.push(v);
break e;
}
v.componentWillUpdate != null && v.componentWillUpdate(L, v.__s, w), v.componentDidUpdate != null && v.__h.push(function() {
v.componentDidUpdate(A, k, m);
});
}
if (v.context = w, v.props = L, v.__P = e, y = Ee.__r, I = 0, "prototype" in H && H.prototype.render) {
for (v.state = v.__s, v.__d = !1, y && y(t), x = v.render(v.props, v.state, v.context), P = 0; P < v._sb.length; P++)
v.__h.push(v._sb[P]);
v._sb = [];
} else
do
v.__d = !1, y && y(t), x = v.render(v.props, v.state, v.context), v.state = v.__s;
while (v.__d && ++I < 25);
v.state = v.__s, v.getChildContext != null && (s = $t($t({}, s), v.getChildContext())), O || v.getSnapshotBeforeUpdate == null || (m = v.getSnapshotBeforeUpdate(A, k)), G = x != null && x.type === Ci && x.key == null ? x.props.children : x, Ks(e, Array.isArray(G) ? G : [G], t, r, s, l, d, h, p, E), v.base = t.__e, t.__h = null, v.__h.length && h.push(v), b && (v.__E = v.__ = null), v.__e = !1;
} else
d == null && t.__v === r.__v ? (t.__k = r.__k, t.__e = r.__e) : t.__e = bh(r.__e, t, r, s, l, d, h, E);
(x = Ee.diffed) && x(t);
} catch (Q) {
t.__v = null, (E || d != null) && (t.__e = p, t.__h = !!E, d[d.indexOf(p)] = null), Ee.__e(Q, t, r);
}
}
function qs(e, t) {
Ee.__c && Ee.__c(t, e), e.some(function(r) {
try {
e = r.__h, r.__h = [], e.some(function(s) {
s.call(r);
});
} catch (s) {
Ee.__e(s, r.__v);
}
});
}
function bh(e, t, r, s, l, d, h, p) {
var E, x, v, O = r.props, A = t.props, k = t.type, m = 0;
if (k === "svg" && (l = !0), d != null) {
for (; m < d.length; m++)
if ((E = d[m]) && "setAttribute" in E == !!k && (k ? E.localName === k : E.nodeType === 3)) {
e = E, d[m] = null;
break;
}
}
if (e == null) {
if (k === null)
return document.createTextNode(A);
e = l ? document.createElementNS("http://www.w3.org/2000/svg", k) : document.createElement(k, A.is && A), d = null, p = !1;
}
if (k === null)
O === A || p && e.data === A || (e.data = A);
else {
if (d = d && pr.call(e.childNodes), x = (O = r.props || ar).dangerouslySetInnerHTML, v = A.dangerouslySetInnerHTML, !p) {
if (d != null)
for (O = {}, m = 0; m < e.attributes.length; m++)
O[e.attributes[m].name] = e.attributes[m].value;
(v || x) && (v && (x && v.__html == x.__html || v.__html === e.innerHTML) || (e.innerHTML = v && v.__html || ""));
}
if (yh(e, A, O, l, p), v)
t.__k = [];
else if (m = t.props.children, Ks(e, Array.isArray(m) ? m : [m], t, r, s, l && k !== "foreignObject", d, h, d ? d[0] : r.__k && Ii(r, 0), p), d != null)
for (m = d.length; m--; )
d[m] != null && Ws(d[m]);
p || ("value" in A && (m = A.value) !== void 0 && (m !== e.value || k === "progress" && !m || k === "option" && m !== O.value) && lr(e, "value", m, O.value, !1), "checked" in A && (m = A.checked) !== void 0 && m !== e.checked && lr(e, "checked", m, O.checked, !1));
}
return e;
}
function Ys(e, t, r) {
try {
typeof e == "function" ? e(t) : e.current = t;
} catch (s) {
Ee.__e(s, r);
}
}
function Qs(e, t, r) {
var s, l;
if (Ee.unmount && Ee.unmount(e), (s = e.ref) && (s.current && s.current !== e.__e || Ys(s, null, t)), (s = e.__c) != null) {
if (s.componentWillUnmount)
try {
s.componentWillUnmount();
} catch (d) {
Ee.__e(d, t);
}
s.base = s.__P = null, e.__c = void 0;
}
if (s = e.__k)
for (l = 0; l < s.length; l++)
s[l] && Qs(s[l], t, r || typeof e.type != "function");
r || e.__e == null || Ws(e.__e), e.__ = e.__e = e.__d = void 0;
}
function Eh(e, t, r) {
return this.constructor(e, r);
}
function Xo(e, t, r) {
var s, l, d;
Ee.__ && Ee.__(e, t), l = (s = typeof r == "function") ? null : r && r.__k || t.__k, d = [], mn(t, e = (!s && r || t).__k = gh(Ci, null, [e]), l || ar, ar, t.ownerSVGElement !== void 0, !s && r ? [r] : l ? null : t.firstChild ? pr.call(t.childNodes) : null, d, !s && r ? r : l ? l.__e : t.firstChild, s), qs(d, e);
}
function wh(e, t) {
var r = { __c: t = "__cC" + Vs++, __: e, Consumer: function(s, l) {
return s.children(l);
}, Provider: function(s) {
var l, d;
return this.getChildContext || (l = [], (d = {})[t] = this, this.getChildContext = function() {
return d;
}, this.shouldComponentUpdate = function(h) {
this.props.value !== h.value && l.some(function(p) {
p.__e = !0, un(p);
});
}, this.sub = function(h) {
l.push(h);
var p = h.componentWillUnmount;
h.componentWillUnmount = function() {
l.splice(l.indexOf(h), 1), p && p.call(h);
};
}), s.children;
} };
return r.Provider.__ = r.Consumer.contextType = r;
}
pr = Gs.slice, Ee = { __e: function(e, t, r, s) {
for (var l, d, h; t = t.__; )
if ((l = t.__c) && !l.__)
try {
if ((d = l.constructor) && d.getDerivedStateFromError != null && (l.setState(d.getDerivedStateFromError(e)), h = l.__d), l.componentDidCatch != null && (l.componentDidCatch(e, s || {}), h = l.__d), h)
return l.__E = l;
} catch (p) {
e = p;
}
throw e;
} }, Fs = 0, Yi.prototype.setState = function(e, t) {
var r;
r = this.__s != null && this.__s !== this.state ? this.__s : this.__s = $t({}, this.state), typeof e == "function" && (e = e($t({}, r), this.props)), e && $t(r, e), e != null && this.__v && (t && this._sb.push(t), un(this));
}, Yi.prototype.forceUpdate = function(e) {
this.__v && (this.__e = !0, e && this.__h.push(e), un(this));
}, Yi.prototype.render = Ci, oi = [], Hs = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, ln = function(e, t) {
return e.__v.__b - t.__v.__b;
}, sr.__r = 0, Vs = 0;
var Th = 0;
function Se(e, t, r, s, l, d) {
var h, p, E = {};
for (p in t)
p == "ref" ? h = t[p] : E[p] = t[p];
var x = { type: e, props: E, key: r, ref: h, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, __h: null, constructor: void 0, __v: --Th, __source: l, __self: d };
if (typeof e == "function" && (h = e.defaultProps))
for (p in h)
E[p] === void 0 && (E[p] = h[p]);
return Ee.vnode && Ee.vnode(x), x;
}
var _i, Ge, Jr, ea, xi = 0, Zs = [], Qi = [], ta = Ee.__b, ia = Ee.__r, ra = Ee.diffed, na = Ee.__c, oa = Ee.unmount;
function Di(e, t) {
Ee.__h && Ee.__h(Ge, e, xi || t), xi = 0;
var r = Ge.__H || (Ge.__H = { __: [], __h: [] });
return e >= r.__.length && r.__.push({ __V: Qi }), r.__[e];
}
function et(e) {
return xi = 1, Rh(el, e);
}
function Rh(e, t, r) {
var s = Di(_i++, 2);
if (s.t = e, !s.__c && (s.__ = [r ? r(t) : el(void 0, t), function(p) {
var E = s.__N ? s.__N[0] : s.__[0], x = s.t(E, p);
E !== x && (s.__N = [x, s.__[1]], s.__c.setState({}));
}], s.__c = Ge, !Ge.u)) {
var l = function(p, E, x) {
if (!s.__c.__H)
return !0;
var v = s.__c.__H.__.filter(function(A) {
return A.__c;
});
if (v.every(function(A) {
return !A.__N;
}))
return !d || d.call(this, p, E, x);
var O = !1;
return v.forEach(function(A) {
if (A.__N) {
var k = A.__[0];
A.__ = A.__N, A.__N = void 0, k !== A.__[0] && (O = !0);
}
}), !(!O && s.__c.props === p) && (!d || d.call(this, p, E, x));
};
Ge.u = !0;
var d = Ge.shouldComponentUpdate, h = Ge.componentWillUpdate;
Ge.componentWillUpdate = function(p, E, x) {
if (this.__e) {
var v = d;
d = void 0, l(p, E, x), d = v;
}
h && h.call(this, p, E, x);
}, Ge.shouldComponentUpdate = l;
}
return s.__N || s.__;
}
function gn(e, t) {
var r = Di(_i++, 3);
!Ee.__s && yn(r.__H, t) && (r.__ = e, r.i = t, Ge.__H.__h.push(r));
}
function Sh(e, t) {
var r = Di(_i++, 4);
!Ee.__s && yn(r.__H, t) && (r.__ = e, r.i = t, Ge.__h.push(r));
}
function cn(e) {
return xi = 5, Xs(function() {
return { current: e };
}, []);
}
function Xs(e, t) {
var r = Di(_i++, 7);
return yn(r.__H, t) ? (r.__V = e(), r.i = t, r.__h = e, r.__V) : r.__;
}
function li(e, t) {
return xi = 8, Xs(function() {
return e;
}, t);
}
function Lh(e) {
var t = Ge.context[e.__c], r = Di(_i++, 9);
return r.c = e, t ? (r.__ == null && (r.__ = !0, t.sub(Ge)), t.props.value) : e.__;
}
function kh() {
for (var e; e = Zs.shift(); )
if (e.__P && e.__H)
try {
e.__H.__h.forEach(Zi), e.__H.__h.forEach(dn), e.__H.__h = [];
} catch (t) {
e.__H.__h = [], Ee.__e(t, e.__v);
}
}
Ee.__b = function(e) {
Ge = null, ta && ta(e);
}, Ee.__r = function(e) {
ia && ia(e), _i = 0;
var t = (Ge = e.__c).__H;
t && (Jr === Ge ? (t.__h = [], Ge.__h = [], t.__.forEach(function(r) {
r.__N && (r.__ = r.__N), r.__V = Qi, r.__N = r.i = void 0;
})) : (t.__h.forEach(Zi), t.__h.forEach(dn), t.__h = [])), Jr = Ge;
}, Ee.diffed = function(e) {
ra && ra(e);
var t = e.__c;
t && t.__H && (t.__H.__h.length && (Zs.push(t) !== 1 && ea === Ee.requestAnimationFrame || ((ea = Ee.requestAnimationFrame) || Ih)(kh)), t.__H.__.forEach(function(r) {
r.i && (r.__H = r.i), r.__V !== Qi && (r.__ = r.__V), r.i = void 0, r.__V = Qi;
})), Jr = Ge = null;
}, Ee.__c = function(e, t) {
t.some(function(r) {
try {
r.__h.forEach(Zi), r.__h = r.__h.filter(function(s) {
return !s.__ || dn(s);
});
} catch (s) {
t.some(function(l) {
l.__h && (l.__h = []);
}), t = [], Ee.__e(s, r.__v);
}
}), na && na(e, t);
}, Ee.unmount = function(e) {
oa && oa(e);
var t, r = e.__c;
r && r.__H && (r.__H.__.forEach(function(s) {
try {
Zi(s);
} catch (l) {
t = l;
}
}), r.__H = void 0, t && Ee.__e(t, r.__v));
};
var aa = typeof requestAnimationFrame == "function";
function Ih(e) {
var t, r = function() {
clearTimeout(s), aa && cancelAnimationFrame(t), setTimeout(e);
}, s = setTimeout(r, 100);
aa && (t = requestAnimationFrame(r));
}
function Zi(e) {
var t = Ge, r = e.__c;
typeof r == "function" && (e.__c = void 0, r()), Ge = t;
}
function dn(e) {
var t = Ge;
e.__c = e.__(), Ge = t;
}
function yn(e, t) {
return !e || e.length !== t.length || t.some(function(r, s) {
return r !== e[s];
});
}
function el(e, t) {
return typeof t == "function" ? t(e) : t;
}
(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 (t) {
console.error("vite-plugin-css-injected-by-js", t);
}
})();
var xh = Object.defineProperty, Ch = (e, t, r) => t in e ? xh(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Jt = (e, t, r) => (Ch(e, typeof t != "symbol" ? t + "" : t, r), r);
(function() {
try {
if (typeof document < "u") {
var e = document.createElement("style");
e.appendChild(document.createTextNode("")), document.head.appendChild(e);
}
} catch (t) {
console.error("vite-plugin-css-injected-by-js", t);
}
})();
var Dh = Object.defineProperty, Oh = (e, t, r) => t in e ? Dh(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, ut = (e, t, r) => (Oh(e, typeof t != "symbol" ? t + "" : t, r), r);
const Mh = "ControlsPlugin", tl = "I18nPlugin", Nh = "LoggerPlugin", Ph = "HotkeyPlugin", Uh = "PlayInfoPlugin", Bh = "RotatePlugin", Fh = "PreviewPlugin", Hh = "MaskPlugin", Vh = "VRPlugin", Gh = "DanmakuPlugin";
var hn = /* @__PURE__ */ ((e) => (e.PLAY_BAR_LEFT = "playBarLeft", e.PLAY_BAR_RIGHT = "playBarRight", e.CONTEXT_MENU = "contextMenu", e))(hn || {});
class Wh {
constructor() {
ut(this, "_callbacks", []);
}
add(t) {
this._callbacks.push(t);
}
remove(t) {
const r = this._callbacks.findIndex((s) => s === t);
r >= 0 && this._callbacks.splice(r, 1);
}
call(t) {
this._callbacks.forEach((r) => r(t));
}
destroy() {
this._callbacks.splice(0, this._callbacks.length);
}
}
class At extends Ts {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static isInstanceOfPlugin(t) {
return typeof t.beforeInstall == "function" && typeof t.afterInstall == "function" && typeof t.beforeUninstall == "function" && typeof t.afterUninstall == "function" && typeof t.getLabel == "function";
}
/**
* 控制条插槽按钮
*/
get controlsSoltBtns() {
}
/**
* 播放器实例化前钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
beforeInstall(t, r) {
}
/**
* 播放器实例化后钩子
* @param player 播放器实例
* @param options 实例化播放器时指定的当前插件的参数
*/
afterInstall(t, r) {
}
/**
* 播放器销毁前钩子
* @param player 播放器实例
*/
beforeUninstall(t) {
}
/**
* 播放器销毁后钩子
* @param player 播放器实例
*/
afterUninstall(t) {
}
}
ut(At, "label"), /**
* 版本
*/
ut(At, "version"), /**
* 当前环境是否支持
*/
ut(At, "isSupported");
const jh = class il extends At {
/**
* @override
*/
getLabel() {
return il.label;
}
beforeInstall(t, r) {
}
afterInstall(t, r) {
}
};
ut(jh, "label", Mh);
const Kh = class rl extends At {
/**
* @override
*/
getLabel() {
return rl.label;
}
beforeInstall(t, r) {
}
afterInstall(t, r) {
}
};
ut(Kh, "label", tl);
const Jh = class nl extends At {
/**
* @override
*/
getLabel() {
return nl.label;
}
beforeInstall(t, r) {
}
afterInstall(t, r) {
}
/**
* 增加业务相关数据
* @param key 上报数据key
* @param value 上报数据
*/
addBizLog(t, r) {
}
appendSummaryField(t, r) {
}
};
ut(Jh, "label", Nh);
const zh = class ol extends At {
/**
* @override
*/
getLabel() {
return ol.label;
}
};
ut(zh, "label", Ph);
const al = class sl extends At {
/**
* @override
*/
getLabel() {
return sl.label;
}
};
ut(al, "label", Uh);
let $h = al;
const qh = class ll extends At {
/**
* @override
*/
getLabel() {
return ll.label;
}
};
ut(qh, "label", Bh);
const Yh = class ul extends At {
/**
* @override
*/
getLabel() {
return ul.label;
}
};
ut(Yh, "label", Fh);
const Qh = class cl extends At {
/**
* @override
*/
getLabel() {
return cl.label;
}
};
ut(Qh, "label", Hh);
const Zh = class dl extends At {
/**
* @override
*/
getLabel() {
return dl.label;
}
};
ut(Zh, "label", Vh);
const Xh = class hl extends At {
/**
* @override
*/
getLabel() {
return hl.label;
}
};
ut(Xh, "label", Gh);
var Pt = /* @__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))(Pt || {});
const fl = wh(void 0), sa = "kwai_player_ll_enabled", ef = "play-info-context", tf = (e) => {
const { children: t, player: r } = e, s = r.logger, l = new No(), d = No.isSupported() && !zt, h = `${r.packVersion}(${r.version})`, p = new ws(), [E, x] = et(!1), v = (m, b = !1) => {
if (m = m && d, m ? (O(), r.outputLogger = l.getLoggerForAdd()) : r.outputLogger = void 0, x(m), b)
try {
p.write(sa, m ? "1" : "0");
} catch (L) {
}
}, O = () => {
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 (m) {
}
}, A = () => {
v(!E, !0);
}, k = () => {
l.downloadLog();
};
try {
const m = (p.read(sa) == "1" || !1) && d;
x(m), m && v(m);
} catch (m) {
}
return gn(() => () => {
s.i(ef, "destroy"), l.destroy();
}, []), /* @__PURE__ */ Se(
fl.Provider,
{
value: {
player: r,
playerVersion: h,
localLogSwitch: E,
localLogEnabled: d,
toggleLocalLog: A,
downloadLocalLog: k
},
children: t
}
);
}, rf = "_container_afsrn_1", nf = "_actions_afsrn_60", Ze = {
container: rf,
"container-h5": "_container-h5_afsrn_19",
"close-btn": "_close-btn_afsrn_36",
"btn-tip": "_btn-tip_afsrn_49",
actions: nf,
"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 yt(e) {
const { title: t, value: r } = e;
return /* @__PURE__ */ Se("div", { className: Ze["info-item"], children: [
/* @__PURE__ */ Se("div", { className: Ze["info-item-name"], children: [
t,
":"
] }),
/* @__PURE__ */ Se("div", { className: Ze["info-item-value"], children: r })
] });
}
function of(e) {
const { dataArray: t } = e, r = cn(null), [s, l] = et("");
return gn(() => {
if (r != null && r.current) {
const { width: d, height: h } = r.current.getBoundingClientRect(), p = Math.max(...t) || 1, E = h - 2, x = d / t.length;
let v = `M0 ${E * (p - t[0]) / p + 1}`;
for (let O = 1; O < t.length; O++)
v += ` L${O * x} ${E * (p - t[O]) / p + 1}`;
l(v);
}
}, [t]), /* @__PURE__ */ Se("svg", { ref: r, height: "100%", width: "100%", style: "display:block", children: /* @__PURE__ */ Se("path", { fill: "none", stroke: "#fff", strokeWidth: "1", d: s }) });
}
function ji(e) {
const { title: t, suffix: r, value: s } = e, [l, d] = et(0);
return gn(() => {
d(s[s.length - 1] || 0);
}, [s]), /* @__PURE__ */ Se("div", { className: Ze["info-item"], children: [
/* @__PURE__ */ Se("div", { className: Ze["info-item-name"], children: [
t,
":"
] }),
/* @__PURE__ */ Se("div", { className: Ze["info-item-value"], children: [
/* @__PURE__ */ Se("div", { className: Ze["item-svg"], children: /* @__PURE__ */ Se(of, { dataArray: s }) }),
/* @__PURE__ */ Se("div", { className: Ze["item-value"], children: r(l) })
] })
] });
}
function af(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var sf = function() {
var e = document.getSelection();
if (!e.rangeCount)
return function() {
};
for (var t = document.activeElement, r = [], s = 0; s < e.rangeCount; s++)
r.push(e.getRangeAt(s));
switch (t.tagName.toUpperCase()) {
case "INPUT":
case "TEXTAREA":
t.blur();
break;
default:
t = null;
break;
}
return e.removeAllRanges(), function() {
e.type === "Caret" && e.removeAllRanges(), e.rangeCount || r.forEach(function(l) {
e.addRange(l);
}), t && t.focus();
};
}, lf = sf, la = {
"text/plain": "Text",
"text/html": "Url",
default: "Text"
}, uf = "Copy to clipboard: #{key}, Enter";
function cf(e) {
var t = (/mac os x/i.test(navigator.userAgent) ? "⌘" : "Ctrl") + "+C";
return e.replace(/#{\s*key\s*}/g, t);
}
function df(e, t) {
var r, s, l, d, h, p, E = !1;
t || (t = {}), r = t.debug || !1;
try {
l = lf(), d = document.createRange(), h = document.getSelection(), p = document.createElement("span"), p.textContent = e, p.ariaHidden = "true", p.style.all = "unset", p.style.position = "fixed", p.style.top = 0, p.style.clip = "rect(0, 0, 0, 0)", p.style.whiteSpace = "pre", p.style.webkitUserSelect = "text", p.style.MozUserSelect = "text", p.style.msUserSelect = "text", p.style.userSelect = "text", p.addEventListener("copy", function(v) {
if (v.stopPropagation(), t.format)
if (v.preventDefault(), typeof v.clipboardData > "u") {
r && console.warn("unable to use e.clipboardData"), r && console.warn("trying IE specific stuff"), window.clipboardData.clearData();
var O = la[t.format] || la.default;
window.clipboardData.setData(O, e);
} else
v.clipboardData.clearData(), v.clipboardData.setData(t.format, e);
t.onCopy && (v.preventDefault(), t.onCopy(v.clipboardData));
}), document.body.appendChild(p), d.selectNodeContents(p), h.addRange(d);
var x = document.execCommand("copy");
if (!x)
throw new Error("copy command was unsuccessful");
E = !0;
} catch (v) {
r && console.error("unable to copy using execCommand: ", v), r && console.warn("trying IE specific stuff");
try {
window.clipboardData.setData(t.format || "text", e), t.onCopy && t.onCopy(window.clipboardData), E = !0;
} catch (O) {
r && console.error("unable to copy using clipboardData: ", O), r && console.error("falling back to prompt"), s = cf("message" in t ? t.message : uf), window.prompt(s, e);
}
} finally {
h && (typeof h.removeRange == "function" ? h.removeRange(d) : h.removeAllRanges()), p && document.body.removeChild(p), l();
}
return E;
}
var hf = df;
const ff = /* @__PURE__ */ af(hf), ua = 100, pf = "info-panel";
function Af(e) {
const t = Lh(fl);
if (!t)
return /* @__PURE__ */ Se(Ci, {});
const { player: r, playerVersion: s, localLogEnabled: l, localLogSwitch: d, toggleLocalLog: h, downloadLocalLog: p } = t, { onChangeShowEventLog: E } = e, x = nr, [v, O] = et(""), [A, k] = et(""), [m, b] = et(""), [L, g] = et(""), [w, _] = et(""), [y, I] = et(""), [P, G] = et(0), [H, Q] = et(""), [ue, de] = et(""), [j, B] = et([]), [R, D] = et([]), [U, N] = et([]), [J, Y] = et([]), [C, M] = et((/* @__PURE__ */ new Date()).toString()), F = cn(void 0);
Sh(() => {
const fe = () => {
k(""), b(""), g(""), _(""), I(""), G(0), Q(""), J.splice(0, R.length), R.splice(0, R.length), U.splice(0, U.length), j.splice(0, j.length);
}, Fe = () => {
O(r.kernelType || "");
}, St = (ce) => {
if (ce && ce.type === "mediaInfo") {
F.current = ce.value, O(r.kernelType || ""), k(ce.value.streamHost || ""), b(ce.value.colorSpace || ""), Q(ce.value.sid || ""), de(ce.value.gpu || "");
const He = [];
ce.value.coreType && He.push(ce.value.coreType), ce.value.box && (ce.value.enhancedFlv ? He.push("enhanced-flv") : He.push(ce.value.box)), ce.value.videoCodecType && He.push(ce.value.videoCodecType), ce.value.videoDecoder && He.push(ce.value.videoDecoder), ce.value.width && ce.value.height && He.push(`${ce.value.width}x${ce.value.height}`), ce.value.sar && He.push(`[SAR ${ce.value.sar.width}:${ce.value.sar.height}]`), ce.value.fps && He.push(`@${ce.value.fps.toFixed(2)}`), g(He.join(" "));
const Me = [];
ce.value.videoCodec && Me.push(ce.value.videoCodec), ce.value.audioCodec && Me.push(ce.value.audioCodec), _(Me.join(","));
}
ce && ce.type === "heartbeat" && (ce.value.decodedFrames && I(`${ce.value.decodedFPS || 0}/${ce.value.droppedFPS || 0} ${ce.value.decodedFrames || 0}/${ce.value.droppedFrames || 0}`), typeof ce.value.totalReceive == "number" && G(ce.value.totalReceive), we(ce.value.videoBuffered || 0, R, D), we(ce.value.audioBuffered || 0, U, N), !R.length && !U.length && we(ce.value.buffered || 0, J, Y), we(ce.value.speed || 0, j, B), M((/* @__PURE__ */ new Date()).toString()));
};
return r.on(Pt.ATTRIBUTE_CHANGE_SRC, fe), r.on(Pt.REPORT, St), r.on(Pt.LOADEDMETADATA, Fe), () => {
r.off(Pt.ATTRIBUTE_CHANGE_SRC, fe), r.off(Pt.REPORT, St), r.off(Pt.LOADEDMETADATA, Fe), he.current && clearTimeout(he.current);
};
}, []);
const [Z, K] = et(""), [se, Ae] = et(!1), he = cn(0), we = li((fe, Fe, St) => {
typeof fe == "number" && !isNaN(fe) && (Fe.push(fe), Fe.length > ua ? Fe.shift() : Fe.length === 1 && (Fe.unshift(...new Array(ua - 1)), Fe.forEach((ce, He) => {
typeof ce != "number" && (Fe[He] = 0);
})), St([...Fe]));
}, []), ee = li(() => {
r.logger.i(pf, "click copy");
const fe = { date: C };
x && (fe.did = x), s && (fe.playerVersion = s), H && (fe.sessionId = H), A && (fe.streamHost = A), m && (fe.colorSpace = m), L && (fe.res = L), w && (fe.codec = w), ue && (fe.gpu = ue), R.length && (fe.vBuffer = R[R.length - 1]), U.length && (fe.aBuffer = U[U.length - 1]), J.length && (fe.buffer = J[J.length - 1]), j.length && (fe.speed = j[j.length - 1]), F.current && (fe.mediainfo = F.current), fe.userAgent = navigator.userAgent, fe.summary = r.audienceStat;
const Fe = ff(JSON.stringify(fe));
K(Fe ? "已复制" : "复制失败"), Ae(!0), he.current && clearTimeout(he.current), he.current = +setTimeout(() => {
Ae(!1), he.current = 0;
}, 1e3);
}, []), We = li((fe) => fe > 1e9 ? `${(fe / 1e9).toFixed(2)} GB` : fe > 1e6 ? `${(fe / 1e6).toFixed(2)} MB` : `${(fe / 1e3).toFixed(2)} KB`, []), Le = li((fe) => fe > 1e7 ? `${(fe / 1e6).toFixed(2)} MB/s` : `${(fe / 1e3).toFixed(2)} KB/s`, []), Ft = li((fe) => fe > 1e3 ? `${(fe / 1e3).toFixed(2)} s` : `${fe} ms`, []), tt = li((fe) => {
fe.stopPropagation();
}, []);
return /* @__PURE__ */ Se("div", { className: zt ? Ze["container-h5"] : Ze.container, onContextMenu: tt, children: [
x && /* @__PURE__ */ Se(yt, { title: "DeviceId", value: x }),
s && /* @__PURE__ */ Se(yt, { title: "PlayerVersion", value: s }),
v && /* @__PURE__ */ Se(yt, { title: "kernel", value: v }),
H && /* @__PURE__ */ Se(yt, { title: "SessionId", value: H }),
A && /* @__PURE__ */ Se(yt, { title: "StreamHost", value: A }),
L && /* @__PURE__ */ Se(yt, { title: "Res", value: L }),
m && /* @__PURE__ */ Se(yt, { title: "Color", value: m }),
w && /* @__PURE__ */ Se(yt, { title: "Codec", value: w }),
y && /* @__PURE__ */ Se(yt, { title: "Frames", value: y }),
!!J.length && /* @__PURE__ */ Se(ji, { title: "Buffered", value: J, suffix: Ft }),
!!R.length && /* @__PURE__ */ Se(ji, { title: "VideoBuffered", value: R, suffix: Ft }),
!!U.length && /* @__PURE__ */ Se(ji, { title: "AudioBuffered", value: U, suffix: Ft }),
!!j.length && /* @__PURE__ */ Se(
ji,
{
title: "Speed",
value: j,
suffix: Le
}
),
P > 0 && /* @__PURE__ */ Se(yt, { title: "TotalReceive", value: We(P) }),
ue && /* @__PURE__ */ Se(yt, { title: "GPU", value: ue }),
/* @__PURE__ */ Se(yt, { title: "Date", value: C }),
/* @__PURE__ */ Se("div", { className: [zt ? Ze["h5-btn"] : "", Ze["close-btn"]].join(" "), onClick: E, children: "[X]" }),
/* @__PURE__ */ Se("div", { className: Ze.actions, children: [
d && /* @__PURE__ */ Se("div", { className: [zt ? Ze["h5-btn"] : "", Ze["copy-btn"]].join(" "), onClick: p, children: "[Download Log]" }),
l && /* @__PURE__ */ Se("div", { className: [zt ? Ze["h5-btn"] : "", Ze["copy-btn"]].join(" "), onClick: h, children: [
"[Log ",
d ? "on" : "off",
"]"
] }),
/* @__PURE__ */ Se("div", { className: [zt ? Ze["h5-btn"] : "", Ze["copy-btn"]].join(" "), onClick: ee, children: [
se && /* @__PURE__ */ Se("div", { className: Ze["btn-tip"], children: Z }),
/* @__PURE__ */ Se("div", { children: "[Copy]" })
] })
] })
] });
}
const vf = "kwai-player-web-play-info", ca = "play-info-plugin", pl = class fn extends $h {
constructor() {
super(...arguments), Jt(this, "_player"), Jt(this, "_i18n"), Jt(this, "_callback", new Wh()), Jt(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>'
}), Jt(this, "_container"), Jt(this, "_onChangeShowEventLog", () => {
this._container && (this.isShow = !this.isShow);
}), Jt(this, "_onShowInfoPanelChange", () => {
var t;
this.isShow = !!((t = this._player) != null && t.showInfoPanel);
});
}
beforeInstall(t, r) {
r && (r.showInPlayBar === !0 && (this._option.showInPlayBar = !0), r.showInContextMenu === !1 && (this._option.showInContextMenu = !1), r.svgRaw && (this._option.svgRaw = r.svgRaw)), this._i18n = t.getPluginInstance(tl);
}
afterInstall(t, r) {
if (this._player = t, !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", zt && (this._container.style.width = "100%"));
const s = t.logger;
if (Xo(
/* @__PURE__ */ Se(tf, { player: t, children: /* @__PURE__ */ Se(
Af,
{
onChangeShowEventLog: this._onChangeShowEventLog
}
) }),
this._container
), typeof t.showInfoPanel == "boolean")
this.isShow = t.showInfoPanel, s.i(ca, `set show by player: ${t.showInfoPanel}`);
else {
let l = vf;
typeof (r == null ? void 0 : r.keyInUrl) == "string" && (l = r == null ? void 0 : r.keyInUrl), location.href.indexOf(l) >= 0 && (this.isShow = !0, s.i(ca, "set show by url: true"));
}
t.on(Pt.ATTRIBUTE_CHANGE_SHOW_INFO_PANEL, this._onShowInfoPanelChange);
}
beforeUninstall(t) {
this._callback.destroy();
}
afterUninstall(t) {
this._container && (Xo(
null,
this._container
), t.removeSubContainer(this._container)), this._player = void 0, t.off(Pt.ATTRIBUTE_CHANGE_SHOW_INFO_PANEL, this._onShowInfoPanelChange), this.removeAllListeners();
}
set isShow(t) {
this._container && (this._container.style.display = t ? "block" : "none", this.emit(Pt.ATTRIBUTE_CHANGE), this._callback.call(t));
}
get isShow() {
var t;
return ((t = this._container) == null ? void 0 : t.style.display) === "block";
}
get dom() {
return this._container;
}
getLabel() {
return fn.label;
}
get controlsSoltBtns() {
const t = [];
if (this._option.showInContextMenu) {
const r = {
role: "play-info-context-menu",
slotPos: hn.CONTEXT_MENU,
getChecked: () => this.isShow,
getText: () => this._text("playInfo"),
svgRaw: this._option.svgRaw,
onClick: () => this.isShow = !this.isShow,
callback: this._callback
};
t.push(r);
}
if (this._option.showInPlayBar && !zt) {
const r = {
role: "play-info-btn",
slotPos: hn.PLAY_BAR_RIGHT,
getTips: () => this._text("playInfo"),
svgRaw: this._option.svgRaw,
onClick: () => this.isShow = !this.isShow,
callback: this._callback
};
t.push(r);
}
return t;
}
_text(t) {
var r;
return ((r = this._i18n) == null ? void 0 : r.text(fn.label, t)) || "视频信息";
}
};
Jt(pl, "version", "1.1.0-alpha.0");
let _f = pl;
ki.register(Bs);
ki.register(_f);
ki.packVersion = "1.1.19.vue2-mini";
export {
gf as CallbackProxy,
mc as ControlsPluginLabel,
bf as ControlsPluginModule,
xc as ControlsSlotPos,
Ic as DanmakuControlsPos,
kc as DanmakuPluginDomStyle,
Lc as DanmakuPluginLabel,
xf as DanmakuPluginModule,
Ot as FullscreenType,
bc as HotkeyPluginLabel,
Tf as HotkeyPluginModule,
gc as I18nPluginLabel,
Ef as I18nPluginModule,
ki as KwaiPlayer,
z as KwaiPlayerEvent,
Ji as KwaiPlayerLayer,
Cf as KwaiPlayerVue2,
Li as LiveShiftType,
yc as LoggerPluginLabel,
wf as LoggerPluginModule,
Rc as MaskPluginLabel,
kf as MaskPluginModule,
Ec as PlayInfoPluginLabel,
Rf as PlayInfoPluginModule,
lt as PluginModule,
Tc as PreviewPluginLabel,
Lf as PreviewPluginModule,
wc as RotatePluginLabel,
Sf as RotatePluginModule,
Sc as VRPluginLabel,
If as VRPluginModule,
Cf as default
};