UNPKG

@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)*

1,259 lines 1.45 MB
var uf = Object.defineProperty; var gc = Object.getOwnPropertySymbols; var lf = Object.prototype.hasOwnProperty, hf = Object.prototype.propertyIsEnumerable; var mc = (n, r, a) => r in n ? uf(n, r, { enumerable: !0, configurable: !0, writable: !0, value: a }) : n[r] = a, bc = (n, r) => { for (var a in r || (r = {})) lf.call(r, a) && mc(n, a, r[a]); if (gc) for (var a of gc(r)) hf.call(r, a) && mc(n, a, r[a]); return n; }; import { defineComponent as df, ref as ff, watch as Vt, onMounted as pf, onBeforeUnmount as _f, openBlock as Af, createElementBlock as vf, renderSlot as gf } from "vue"; Number.isFinite || (Number.isFinite = (n) => typeof n == "number" && isFinite(n)); Array.prototype.find || (Array.prototype.find = function(n, r) { if (this === null || this === void 0) throw new TypeError("Array.prototype.find called on null or undefined"); if (typeof n != "function") throw new TypeError("callback must be a function"); const a = Object(this), u = a.length >>> 0; for (let c = 0; c < u; c++) if (n.call(r, a[c], c, a)) return a[c]; }); Array.prototype.findIndex || (Array.prototype.findIndex = function(n, r) { if (this === null || this === void 0) throw new TypeError("Array.prototype.findIndex called on null or undefined"); if (typeof n != "function") throw new TypeError("callback must be a function"); const a = Object(this), u = a.length >>> 0; for (let c = 0; c < u; c++) if (c in a && n.call(r, a[c], c, a)) return c; return -1; }); Array.prototype.fill || (Array.prototype.fill = function(n, r = 0, a = this.length) { if (this === null || this === void 0) throw new TypeError("Array.prototype.fill called on null or undefined"); const u = Object(this), c = u.length >>> 0, _ = r >> 0, E = a >> 0, v = _ < 0 ? Math.max(c + _, 0) : Math.min(_, c), R = E < 0 ? Math.max(c + E, 0) : Math.min(E, c); for (let C = v; C < R; C++) u[C] = n; return u; }); var mf = Object.defineProperty, bf = (n, r, a) => r in n ? mf(n, r, { enumerable: !0, configurable: !0, writable: !0, value: a }) : n[r] = a, lu = (n, r, a) => (bf(n, typeof r != "symbol" ? r + "" : r, a), a), cn = function(n) { var r = {}; function a(u) { if (r[u]) return r[u].exports; var c = r[u] = { i: u, l: !1, exports: {} }; return n[u].call(c.exports, c, c.exports, a), c.l = !0, c.exports; } return a.m = n, a.c = r, a.d = function(u, c, _) { a.o(u, c) || Object.defineProperty(u, c, { enumerable: !0, get: _ }); }, a.r = function(u) { typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(u, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(u, "__esModule", { value: !0 }); }, a.t = function(u, c) { if (1 & c && (u = a(u)), 8 & c || 4 & c && typeof u == "object" && u && u.__esModule) return u; var _ = /* @__PURE__ */ Object.create(null); if (a.r(_), Object.defineProperty(_, "default", { enumerable: !0, value: u }), 2 & c && typeof u != "string") for (var E in u) a.d(_, E, function(v) { return u[v]; }.bind(null, E)); return _; }, a.n = function(u) { var c = u && u.__esModule ? function() { return u.default; } : function() { return u; }; return a.d(c, "a", c), c; }, a.o = function(u, c) { return Object.prototype.hasOwnProperty.call(u, c); }, a.p = "", a(a.s = 8); }([function(n, r, a) { var u = a(5); function c(_, E) { for (var v = 0; v < E.length; v++) { var R = E[v]; R.enumerable = R.enumerable || !1, R.configurable = !0, "value" in R && (R.writable = !0), Object.defineProperty(_, u(R.key), R); } } n.exports = function(_, E, v) { return E && c(_.prototype, E), v && c(_, v), Object.defineProperty(_, "prototype", { writable: !1 }), _; }, n.exports.__esModule = !0, n.exports.default = n.exports; }, function(n, r) { function a(u) { return n.exports = a = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(c) { return typeof c; } : function(c) { return c && typeof Symbol == "function" && c.constructor === Symbol && c !== Symbol.prototype ? "symbol" : typeof c; }, n.exports.__esModule = !0, n.exports.default = n.exports, a(u); } n.exports = a, n.exports.__esModule = !0, n.exports.default = n.exports; }, function(n, r, a) { var u = a(7)(); n.exports = u; try { regeneratorRuntime = u; } catch (c) { typeof globalThis == "object" ? globalThis.regeneratorRuntime = u : Function("r", "regeneratorRuntime = r")(u); } }, function(n, r) { function a() { return n.exports = a = Object.assign ? Object.assign.bind() : function(u) { for (var c = 1; c < arguments.length; c++) { var _ = arguments[c]; for (var E in _) Object.prototype.hasOwnProperty.call(_, E) && (u[E] = _[E]); } return u; }, n.exports.__esModule = !0, n.exports.default = n.exports, a.apply(this, arguments); } n.exports = a, n.exports.__esModule = !0, n.exports.default = n.exports; }, function(n, r) { function a(u, c, _, E, v, R, C) { try { var h = u[R](C), F = h.value; } catch (L) { return void _(L); } h.done ? c(F) : Promise.resolve(F).then(E, v); } n.exports = function(u) { return function() { var c = this, _ = arguments; return new Promise(function(E, v) { var R = u.apply(c, _); function C(F) { a(R, E, v, C, h, "next", F); } function h(F) { a(R, E, v, C, h, "throw", F); } C(void 0); }); }; }, n.exports.__esModule = !0, n.exports.default = n.exports; }, function(n, r, a) { var u = a(1).default, c = a(6); n.exports = function(_) { var E = c(_, "string"); return u(E) == "symbol" ? E : E + ""; }, n.exports.__esModule = !0, n.exports.default = n.exports; }, function(n, r, a) { var u = a(1).default; n.exports = function(c, _) { if (u(c) != "object" || !c) return c; var E = c[Symbol.toPrimitive]; if (E !== void 0) { var v = E.call(c, _ || "default"); if (u(v) != "object") return v; throw new TypeError("@@toPrimitive must return a primitive value."); } return (_ === "string" ? String : Number)(c); }, n.exports.__esModule = !0, n.exports.default = n.exports; }, function(n, r, a) { var u = a(1).default; function c() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ n.exports = c = function() { return E; }, n.exports.__esModule = !0, n.exports.default = n.exports; var _, E = {}, v = Object.prototype, R = v.hasOwnProperty, C = Object.defineProperty || function(he, X, ge) { he[X] = ge.value; }, h = typeof Symbol == "function" ? Symbol : {}, F = h.iterator || "@@iterator", L = h.asyncIterator || "@@asyncIterator", I = h.toStringTag || "@@toStringTag"; function N(he, X, ge) { return Object.defineProperty(he, X, { value: ge, enumerable: !0, configurable: !0, writable: !0 }), he[X]; } try { N({}, ""); } catch (he) { N = function(X, ge, Pe) { return X[ge] = Pe; }; } function Q(he, X, ge, Pe) { var ae = X && X.prototype instanceof te ? X : te, J = Object.create(ae.prototype), m = new Te(Pe || []); return C(J, "_invoke", { value: D(he, ge, m) }), J; } function j(he, X, ge) { try { return { type: "normal", arg: he.call(X, ge) }; } catch (Pe) { return { type: "throw", arg: Pe }; } } E.wrap = Q; var x = "suspendedStart", K = "executing", z = "completed", B = {}; function te() { } function ye() { } function Z() { } var Ce = {}; N(Ce, F, function() { return this; }); var Be = Object.getPrototypeOf, je = Be && Be(Be(Oe([]))); je && je !== v && R.call(je, F) && (Ce = je); var He = Z.prototype = te.prototype = Object.create(Ce); function De(he) { ["next", "throw", "return"].forEach(function(X) { N(he, X, function(ge) { return this._invoke(X, ge); }); }); } function ue(he, X) { function ge(ae, J, m, ve) { var V = j(he[ae], he, J); if (V.type !== "throw") { var k = V.arg, ne = k.value; return ne && u(ne) == "object" && R.call(ne, "__await") ? X.resolve(ne.__await).then(function(we) { ge("next", we, m, ve); }, function(we) { ge("throw", we, m, ve); }) : X.resolve(ne).then(function(we) { k.value = we, m(k); }, function(we) { return ge("throw", we, m, ve); }); } ve(V.arg); } var Pe; C(this, "_invoke", { value: function(ae, J) { function m() { return new X(function(ve, V) { ge(ae, J, ve, V); }); } return Pe = Pe ? Pe.then(m, m) : m(); } }); } function D(he, X, ge) { var Pe = x; return function(ae, J) { if (Pe === K) throw Error("Generator is already running"); if (Pe === z) { if (ae === "throw") throw J; return { value: _, done: !0 }; } for (ge.method = ae, ge.arg = J; ; ) { var m = ge.delegate; if (m) { var ve = w(m, ge); if (ve) { if (ve === B) continue; return ve; } } if (ge.method === "next") ge.sent = ge._sent = ge.arg; else if (ge.method === "throw") { if (Pe === x) throw Pe = z, ge.arg; ge.dispatchException(ge.arg); } else ge.method === "return" && ge.abrupt("return", ge.arg); Pe = K; var V = j(he, X, ge); if (V.type === "normal") { if (Pe = ge.done ? z : "suspendedYield", V.arg === B) continue; return { value: V.arg, done: ge.done }; } V.type === "throw" && (Pe = z, ge.method = "throw", ge.arg = V.arg); } }; } function w(he, X) { var ge = X.method, Pe = he.iterator[ge]; if (Pe === _) return X.delegate = null, ge === "throw" && he.iterator.return && (X.method = "return", X.arg = _, w(he, X), X.method === "throw") || ge !== "return" && (X.method = "throw", X.arg = new TypeError("The iterator does not provide a '" + ge + "' method")), B; var ae = j(Pe, he.iterator, X.arg); if (ae.type === "throw") return X.method = "throw", X.arg = ae.arg, X.delegate = null, B; var J = ae.arg; return J ? J.done ? (X[he.resultName] = J.value, X.next = he.nextLoc, X.method !== "return" && (X.method = "next", X.arg = _), X.delegate = null, B) : J : (X.method = "throw", X.arg = new TypeError("iterator result is not an object"), X.delegate = null, B); } function le(he) { var X = { tryLoc: he[0] }; 1 in he && (X.catchLoc = he[1]), 2 in he && (X.finallyLoc = he[2], X.afterLoc = he[3]), this.tryEntries.push(X); } function oe(he) { var X = he.completion || {}; X.type = "normal", delete X.arg, he.completion = X; } function Te(he) { this.tryEntries = [{ tryLoc: "root" }], he.forEach(le, this), this.reset(!0); } function Oe(he) { if (he || he === "") { var X = he[F]; if (X) return X.call(he); if (typeof he.next == "function") return he; if (!isNaN(he.length)) { var ge = -1, Pe = function ae() { for (; ++ge < he.length; ) if (R.call(he, ge)) return ae.value = he[ge], ae.done = !1, ae; return ae.value = _, ae.done = !0, ae; }; return Pe.next = Pe; } } throw new TypeError(u(he) + " is not iterable"); } return ye.prototype = Z, C(He, "constructor", { value: Z, configurable: !0 }), C(Z, "constructor", { value: ye, configurable: !0 }), ye.displayName = N(Z, I, "GeneratorFunction"), E.isGeneratorFunction = function(he) { var X = typeof he == "function" && he.constructor; return !!X && (X === ye || (X.displayName || X.name) === "GeneratorFunction"); }, E.mark = function(he) { return Object.setPrototypeOf ? Object.setPrototypeOf(he, Z) : (he.__proto__ = Z, N(he, I, "GeneratorFunction")), he.prototype = Object.create(He), he; }, E.awrap = function(he) { return { __await: he }; }, De(ue.prototype), N(ue.prototype, L, function() { return this; }), E.AsyncIterator = ue, E.async = function(he, X, ge, Pe, ae) { ae === void 0 && (ae = Promise); var J = new ue(Q(he, X, ge, Pe), ae); return E.isGeneratorFunction(X) ? J : J.next().then(function(m) { return m.done ? m.value : J.next(); }); }, De(He), N(He, I, "Generator"), N(He, F, function() { return this; }), N(He, "toString", function() { return "[object Generator]"; }), E.keys = function(he) { var X = Object(he), ge = []; for (var Pe in X) ge.push(Pe); return ge.reverse(), function ae() { for (; ge.length; ) { var J = ge.pop(); if (J in X) return ae.value = J, ae.done = !1, ae; } return ae.done = !0, ae; }; }, E.values = Oe, Te.prototype = { constructor: Te, reset: function(he) { if (this.prev = 0, this.next = 0, this.sent = this._sent = _, this.done = !1, this.delegate = null, this.method = "next", this.arg = _, this.tryEntries.forEach(oe), !he) for (var X in this) X.charAt(0) === "t" && R.call(this, X) && !isNaN(+X.slice(1)) && (this[X] = _); }, stop: function() { this.done = !0; var he = this.tryEntries[0].completion; if (he.type === "throw") throw he.arg; return this.rval; }, dispatchException: function(he) { if (this.done) throw he; var X = this; function ge(V, k) { return J.type = "throw", J.arg = he, X.next = V, k && (X.method = "next", X.arg = _), !!k; } for (var Pe = this.tryEntries.length - 1; Pe >= 0; --Pe) { var ae = this.tryEntries[Pe], J = ae.completion; if (ae.tryLoc === "root") return ge("end"); if (ae.tryLoc <= this.prev) { var m = R.call(ae, "catchLoc"), ve = R.call(ae, "finallyLoc"); if (m && ve) { if (this.prev < ae.catchLoc) return ge(ae.catchLoc, !0); if (this.prev < ae.finallyLoc) return ge(ae.finallyLoc); } else if (m) { if (this.prev < ae.catchLoc) return ge(ae.catchLoc, !0); } else { if (!ve) throw Error("try statement without catch or finally"); if (this.prev < ae.finallyLoc) return ge(ae.finallyLoc); } } } }, abrupt: function(he, X) { for (var ge = this.tryEntries.length - 1; ge >= 0; --ge) { var Pe = this.tryEntries[ge]; if (Pe.tryLoc <= this.prev && R.call(Pe, "finallyLoc") && this.prev < Pe.finallyLoc) { var ae = Pe; break; } } ae && (he === "break" || he === "continue") && ae.tryLoc <= X && X <= ae.finallyLoc && (ae = null); var J = ae ? ae.completion : {}; return J.type = he, J.arg = X, ae ? (this.method = "next", this.next = ae.finallyLoc, B) : this.complete(J); }, complete: function(he, X) { if (he.type === "throw") throw he.arg; return he.type === "break" || he.type === "continue" ? this.next = he.arg : he.type === "return" ? (this.rval = this.arg = he.arg, this.method = "return", this.next = "end") : he.type === "normal" && X && (this.next = X), B; }, finish: function(he) { for (var X = this.tryEntries.length - 1; X >= 0; --X) { var ge = this.tryEntries[X]; if (ge.finallyLoc === he) return this.complete(ge.completion, ge.afterLoc), oe(ge), B; } }, catch: function(he) { for (var X = this.tryEntries.length - 1; X >= 0; --X) { var ge = this.tryEntries[X]; if (ge.tryLoc === he) { var Pe = ge.completion; if (Pe.type === "throw") { var ae = Pe.arg; oe(ge); } return ae; } } throw Error("illegal catch attempt"); }, delegateYield: function(he, X, ge) { return this.delegate = { iterator: Oe(he), resultName: X, nextLoc: ge }, this.method === "next" && (this.arg = _), B; } }, E; } n.exports = c, n.exports.__esModule = !0, n.exports.default = n.exports; }, function(n, r, a) { a.r(r), a.d(r, "KwaiVideoLocalLog", function() { return He; }), a.d(r, "LogLevel", function() { return L; }), a.d(r, "DefaultLogger", function() { return j; }), a.d(r, "Logger", function() { return Q; }), a.d(r, "printVersion", function() { return R; }), a.d(r, "DEFAULT_LOG_LEVEL", function() { return I; }); var u = a(0), c = a.n(u), _ = a(3), E = a.n(_), v = { idbName: "kwai-video-local-log", idbMaxDataCount: 25e3, idbMaxFoldLog: 20, maxLogLen: 4096 }; function R(De, ue) { console.log("%c " + De + " %c " + ue + " %c", "background:#35495e ; padding: 1px; border-radius: 4px 0 0 4px; color: #fff", "background:#ffa483 ; padding: 1px; border-radius: 0 4px 4px 0; color: #fff", "background:transparent"); } var C = function() { function De() { this.timeout = 6048e5; } var ue = De.prototype; return ue.write = function(D, w) { if (De.available) try { localStorage.setItem(D, JSON.stringify({ value: w, time: Date.now() })); } catch (le) { } }, ue.read = function(D, w) { if (w === void 0 && (w = !0), De.available) try { var le = localStorage.getItem(D); if (le) { var oe = JSON.parse(le), Te = oe.value, Oe = oe.time, he = Oe === void 0 ? 0 : Oe; if (!w || Date.now() - he < (typeof w == "number" ? w : this.timeout)) return Te; } } catch (X) { } }, c()(De, null, [{ key: "available", get: function() { if (De._available === void 0) try { localStorage.setItem("alg", "test"), De._available = !0; } catch (D) { De._available = !1; } return De._available; } }]); }(); C._available = void 0; var h, F = C, L = function(De) { return De.NONE = "none", De.ERROR = "e", De.WARN = "w", De.INFO = "i", De.DEBUG = "d", De.VERBOSE = "v", De; }({}), I = L.ERROR, N = ((h = {})[L.NONE] = { value: 1, str: "N" }, h[L.ERROR] = { value: 100, str: "E" }, h[L.WARN] = { value: 200, str: "W" }, h[L.INFO] = { value: 300, str: "I" }, h[L.DEBUG] = { value: 400, str: "D" }, h[L.VERBOSE] = { value: 500, str: "V" }, h), Q = function() { function De(D) { if (this._name = "kwai-v", this._level = I, this._id = -1, this._output = void 0, this._workerTag = "main", typeof location < "u" && location.protocol === "blob:") { var w, le = location.href.split("/"), oe = (w = le[le.length - 1]) == null ? void 0 : w.match(/(\w+)-/); oe && (this._workerTag = D ? D + "-" + oe[1] : oe[1]); } else D && (this._workerTag = D); } De.loadLogLevel = function(D, w) { if (w === void 0 && (w = !0), location.href) { var le = new RegExp(D + "=([a-z]{1})"), oe = location.href.match(le); if (oe && oe.length > 1) { var Te = oe[1]; if (this._isValueInLevel(Te)) return Te; } } var Oe = new F().read(D, w); if (this._isValueInLevel(Oe)) return Oe; }, De.saveLogLevel = function(D, w) { this._isValueInLevel(w) && new F().write(D, w); }, De._isValueInLevel = function(D) { return Object.values(L).indexOf(D) !== -1; }; var ue = De.prototype; return ue.setOutput = function(D) { return this._output = D, this; }, ue.setLevel = function(D) { return this._level = D, this; }, ue.setId = function(D) { return this._id = D, this; }, ue.setName = function(D) { return this._name = D, this; }, ue.getLevel = function() { return this._level; }, ue.getOutput = function() { return this._output; }, ue.hasOutput = function() { return !!this._output; }, ue.e = function(D) { if (this._isLevelEnabled(this._level, L.ERROR)) { for (var w = arguments.length, le = new Array(w > 1 ? w - 1 : 0), oe = 1; oe < w; oe++) le[oe - 1] = arguments[oe]; var Te = this._printLog(L.ERROR, D, le); try { var Oe; (Oe = this._output) == null || Oe.e.apply(Oe, [Te].concat(le)); } catch (he) { } } }, ue.w = function(D) { if (this._isLevelEnabled(this._level, L.WARN)) { for (var w = arguments.length, le = new Array(w > 1 ? w - 1 : 0), oe = 1; oe < w; oe++) le[oe - 1] = arguments[oe]; var Te = this._printLog(L.WARN, D, le); try { var Oe; (Oe = this._output) == null || Oe.w.apply(Oe, [Te].concat(le)); } catch (he) { } } }, ue.i = function(D) { if (this._isLevelEnabled(this._level, L.INFO)) { for (var w = arguments.length, le = new Array(w > 1 ? w - 1 : 0), oe = 1; oe < w; oe++) le[oe - 1] = arguments[oe]; var Te = this._printLog(L.INFO, D, le); try { var Oe; (Oe = this._output) == null || Oe.i.apply(Oe, [Te].concat(le)); } catch (he) { } } }, ue.d = function(D) { if (this._isLevelEnabled(this._level, L.DEBUG)) { for (var w = arguments.length, le = new Array(w > 1 ? w - 1 : 0), oe = 1; oe < w; oe++) le[oe - 1] = arguments[oe]; var Te = this._printLog(L.DEBUG, D, le); try { var Oe; (Oe = this._output) == null || Oe.d.apply(Oe, [Te].concat(le)); } catch (he) { } } }, ue.v = function(D) { if (this._isLevelEnabled(this._level, L.VERBOSE)) { for (var w = arguments.length, le = new Array(w > 1 ? w - 1 : 0), oe = 1; oe < w; oe++) le[oe - 1] = arguments[oe]; var Te = this._printLog(L.VERBOSE, D, le); try { var Oe; (Oe = this._output) == null || Oe.v.apply(Oe, [Te].concat(le)); } catch (he) { } } }, ue._isLevelEnabled = function(D, w) { return N[D].value >= N[w].value; }, ue._printLog = function(D, w, le) { var oe, Te, Oe = typeof w; if (Oe === "object") w = ((Te = w) == null ? void 0 : Te.constructor.name) || "unknown"; else if (Oe === "function") { var he; w = ((he = Object.getOwnPropertyDescriptor(w, "name")) == null ? void 0 : he.value) || "unknown"; } var X, ge, Pe = (((oe = N[D]) == null ? void 0 : oe.str) || "") + "|" + this._name + "[" + (typeof this._id == "function" ? this._id() : this._id) + "][" + this._workerTag + "]::" + w; return D === L.ERROR ? (X = console).error.apply(X, [Pe].concat(le.slice(0))) : (ge = console).log.apply(ge, [Pe].concat(le.slice(0))), Pe; }, De; }(), j = new Q(), x = function() { return c()(function De(ue) { this._logger = void 0, this._id = 0, this._config = v, this._id = De._id, De._id++, this._logger = new Q().setId(this._id).setLevel(L.INFO), this._config = E()({}, v, ue); }, [{ key: "config", get: function() { return this._config; } }, { key: "logger", get: function() { return this._logger; } }, { key: "id", get: function() { return this._id; } }], [{ key: "packName", get: function() { return "ll_es"; } }, { key: "version", get: function() { return "1.0.13"; } }, { key: "buildTime", get: function() { return "Tue Oct 08 2024 17:18:49 GMT+0800 (中国标准时间)"; } }]); }(); x._id = 0; var K = a(4), z = a.n(K), B = a(2), te = a.n(B), ye = function() { function De(D, w, le, oe, Te) { var Oe = this; Te === void 0 && (Te = 1), this._logger = void 0, this._name = void 0, this._storeName = void 0, this._dbIndex = void 0, this._version = void 0, this._taskQueue = [], this._openReq = void 0, this._isTransactionActive = !1, this._runTaskQueue = function() { for (; Oe._taskQueue.length; ) { var he = Oe._taskQueue.shift(); he && Oe.run(he.task, he.mode); } }, this._logger = D, this._name = w, this._storeName = le, this._dbIndex = oe, this._version = Te; } var ue = De.prototype; return ue.init = function() { var D = this; if (!this._openReq && indexedDB) { var w = this._openReq = indexedDB.open(this._name, this._version); this._logger.i("idb-wrapper", "open", w), w.onerror = function() { D._logger.i("idb-wrapper", "open error."); }, w.onsuccess = function() { D._logger.i("idb-wrapper", "open success."), D._runTaskQueue(); }, w.onupgradeneeded = function() { D._logger.i("idb-wrapper", "open upgradeneeded."), w.result.objectStoreNames.contains(D._storeName) && w.result.deleteObjectStore(D._storeName); var le = w.result.createObjectStore(D._storeName, { keyPath: "id", autoIncrement: !0 }); D._dbIndex && D._dbIndex.forEach(function(oe) { le.createIndex(oe.name, oe.keyPath, oe.option); }); }; } }, ue.run = function(D, w) { if (w === void 0 && (w = "readwrite"), this.init(), this._openReq && this._openReq.readyState === "done" && !this._openReq.error) return this._doTask(D, w); this.state !== "error" && (this._taskQueue.push({ task: D, mode: w }), this._taskQueue.length > 1e3 && this._taskQueue.shift()); }, ue.close = function() { var D = 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() { D.close(); }); }, ue.destroy = function() { this._logger.i("idb-wrapper", "destroy"), this.close(), this._taskQueue = []; }, ue._doTask = function(D, w) { var le = this; if (w === void 0 && (w = "readwrite"), this._openReq && !this._openReq.error) try { this._isTransactionActive = !0; var oe = this._openReq.result.transaction(this._storeName, w), Te = void 0; oe.oncomplete = function() { le._isTransactionActive = !1, D.callback && D.callback(Te), le._runTaskQueue(); }, oe.onabort = oe.onerror = function() { le._isTransactionActive = !1, D.callback && D.callback(Te), le._runTaskQueue(); }, Te = D.exec(oe.objectStore(this._storeName)); } catch (Oe) { } else D.callback && D.callback(); }, c()(De, [{ key: "isTransactionActive", get: function() { return this._isTransactionActive; } }, { key: "state", get: function() { return this._openReq && this._openReq.readyState === "done" ? this._openReq.error ? "error" : "ready" : "idle"; } }]); }(), Z = [{ name: "id", keyPath: "id", option: { unique: !0 } }], Ce = [function() { function De(D) { this._ctx = void 0, this._idb = void 0, this._logCount = 0, this._saveCount = 0, this._reCountOnSaveCount = 100, this._reduceData = !1, this._ctx = D, this._idb = new ye(D.logger, D.config.idbName, D.config.idbName, Z), this._reCountOnSaveCount = Math.min(200, Math.max(50, Math.round(this._ctx.config.idbMaxDataCount / 10))), this._count(); } De.isSupported = function() { return typeof indexedDB < "u"; }; var ue = De.prototype; return ue.saveLog = function(D) { var w = this, le = { exec: function(oe) { return oe.add({ value: D }); }, callback: function(oe) { w._saveCount++, w._saveCount % w._reCountOnSaveCount == 0 && w._count(), oe != null && oe.error && w._ctx.logger.i("idb-backend", "save log err", oe.error); } }; this._idb.run(le); }, ue.exportLog = function() { var D = z()(te.a.mark(function w() { var le = this; return te.a.wrap(function(oe) { for (; ; ) switch (oe.prev = oe.next) { case 0: return oe.abrupt("return", new Promise(function(Te, Oe) { le._ctx.logger.i("idb-backend", "export start"); var he = { exec: function(X) { return X.getAll(); }, callback: function(X) { Te(X === void 0 ? "" : le._mergeGetAll(X.result)); } }; le._idb.run(he, "readonly"); })); case 1: case "end": return oe.stop(); } }, w); })); return function() { return D.apply(this, arguments); }; }(), ue.destroy = function() { this._idb.destroy(); }, ue.clean = function() { this._idb.run({ exec: function(D) { return D.clear(); } }); }, ue._count = function() { var D = this, w = { exec: function(le) { return le.count(); }, callback: function(le) { le != null && le.error || le == null || !le.result || (D._ctx.logger.i("idb-backend", "count: " + le.result + " max: " + D._ctx.config.idbMaxDataCount), D._logCount = le.result, D._logCount >= D._ctx.config.idbMaxDataCount && !D._reduceData && D._deleteFromHead(D._logCount - Math.round(D._ctx.config.idbMaxDataCount / 2))); } }; this._idb.run(w); }, ue._deleteFromHead = function(D) { var w = this; this._ctx.logger.i("idb-backend", "delete from head"), this._reduceData = !0; var le = { exec: function(oe) { return oe.openCursor(); }, callback: function(oe) { if (w._reduceData = !1, oe != null && oe.result) { var Te = IDBKeyRange.bound(oe.result.key, oe.result.key + D, !1, !1), Oe = { exec: function(he) { return w._ctx.logger.i("idb-backend", "del: " + Te.lower + "~" + Te.upper), he.delete(Te); }, callback: function(he) { w._ctx.logger.i("idb-backend", "del result: " + !(he == null || !he.error)); } }; w._idb.run(Oe); } } }; this._idb.run(le); }, ue._mergeGetAll = function(D) { return D.length ? D.reduce(function(w, le) { return "" + w + le.value + ` `; }, "") : ""; }, c()(De, [{ key: "isActive", get: function() { return this._idb.state !== "error"; } }]); }()]; function Be(De, ue, D) { var w = /* @__PURE__ */ new Date(); typeof De != "string" && (De = De.toString()); var le = w.toLocaleString() + "." + w.getMilliseconds().toString().padStart(3, "0") + "|" + De + "|"; return ue.forEach(function(oe) { le += typeof oe == "object" ? JSON.stringify(oe) + " " : oe + " "; }), le.length > D ? le.substring(0, D) : le; } function je(De) { return De.join(` `); } var He = function() { function De(D) { var w = this; this._ctx = void 0, this._backend = void 0, this._delayTimer = void 0, this._logCache = [], this._loggerForAdd = void 0, this._downloadHref = void 0, this._startDelay = function() { w._delayTimer = setInterval(function() { w._saveLog(!0); }, 1e3); }, this._stopDelay = function() { w._delayTimer && (clearTimeout(w._delayTimer), w._delayTimer = void 0); }, R("kwai-video-local-log", "1.0.13"), this._ctx = new x(D); var le = function(oe) { for (var Te = arguments.length, Oe = new Array(Te > 1 ? Te - 1 : 0), he = 1; he < Te; he++) Oe[he - 1] = arguments[he]; w.addLog.apply(w, [oe].concat(Oe)); }; this._loggerForAdd = { e: le, w: le, i: le, d: le, v: le }, this._ctx.logger.setOutput(this._loggerForAdd), this._ctx.logger.i("kwai-video-local-log", "constructor", D, this._ctx.config), this._backend = function(oe) { for (var Te = 0; Te < Ce.length; Te++) { var Oe = Ce[Te]; if (Oe != null && Oe.isSupported()) return new Oe(oe); } }(this._ctx), this._backend && this._startDelay(); } De.isSupported = function() { return function() { for (var D = 0; D < Ce.length; D++) { var w = Ce[D]; if (w != null && w.isSupported()) return !0; } return !1; }(); }; var ue = De.prototype; return ue.addLog = function(D) { for (var w = arguments.length, le = new Array(w > 1 ? w - 1 : 0), oe = 1; oe < w; oe++) le[oe - 1] = arguments[oe]; this._logCache.push(Be(D, le, this._ctx.config.maxLogLen)), this._saveLog(); }, ue.cleanLog = function() { var D; this._ctx.logger.i("kwai-video-local-log", "clean"), (D = this._backend) == null || D.clean(); }, ue.exportLog = function() { var D = this; return this._ctx.logger.i("kwai-video-local-log", "export log"), new Promise(function(w, le) { D._backend ? D._backend.exportLog().then(function(oe) { w(je([oe].concat(D._logCache))); }) : w(""); }); }, ue.downloadLog = function(D) { var w = this; this._ctx.logger.i("kwai-video-local-log", "download log: " + D), this._destroyDownloadHref(), this.exportLog().then(function(le) { var oe = new Blob([le], { type: "text/plain" }); if (document) { var Te = document.createElement("a"); w._downloadHref = Te.href = URL.createObjectURL(oe), Te.download = D || "Log_web_" + (/* @__PURE__ */ new Date()).toLocaleString() + ".log", document.body.appendChild(Te), Te.click(), Te.remove(); } else console.log("无document,当前是否在worker中"); }); }, ue.destroy = function() { var D; this._destroyDownloadHref(), (D = this._backend) == null || D.destroy(), this._stopDelay(); }, ue.getLoggerForAdd = function() { return this._loggerForAdd; }, ue._destroyDownloadHref = function() { try { this._downloadHref && (URL.revokeObjectURL(this._downloadHref), this._downloadHref = void 0); } catch (D) { } }, ue._saveLog = function(D) { if (D === void 0 && (D = !1), this._backend && this._backend.isActive && (this._logCache.length >= this._ctx.config.idbMaxFoldLog || this._logCache.length > 0 && D)) { var w = je(this._logCache); this._logCache.splice(0, this._logCache.length), w && this._backend.saveLog(w); } }, c()(De, null, [{ key: "version", get: function() { return "1.0.13"; } }]); }(); r.default = He; }]); cn === void 0 && console.error("esm-webpack-plugin: nothing exported!"); cn.KwaiVideoLocalLog; const hu = cn.LogLevel, Ti = cn.DefaultLogger, du = cn.Logger, yf = cn.printVersion; cn.DEFAULT_LOG_LEVEL; cn.default; var Ef = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function Cf(n) { return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n; } var fo = { exports: {} }, Ln = typeof Reflect == "object" ? Reflect : null, yc = Ln && typeof Ln.apply == "function" ? Ln.apply : function(n, r, a) { return Function.prototype.apply.call(n, r, a); }, Da; Ln && typeof Ln.ownKeys == "function" ? Da = Ln.ownKeys : Object.getOwnPropertySymbols ? Da = function(n) { return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n)); } : Da = function(n) { return Object.getOwnPropertyNames(n); }; function If(n) { console && console.warn && console.warn(n); } var fu = Number.isNaN || function(n) { return n !== n; }; function qt() { qt.init.call(this); } fo.exports = qt; fo.exports.once = Df; qt.EventEmitter = qt; qt.prototype._events = void 0; qt.prototype._eventsCount = 0; qt.prototype._maxListeners = void 0; var Ec = 10; function Qa(n) { if (typeof n != "function") throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof n); } Object.defineProperty(qt, "defaultMaxListeners", { enumerable: !0, get: function() { return Ec; }, set: function(n) { if (typeof n != "number" || n < 0 || fu(n)) throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + n + "."); Ec = n; } }); qt.init = function() { (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0; }; qt.prototype.setMaxListeners = function(n) { if (typeof n != "number" || n < 0 || fu(n)) throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + "."); return this._maxListeners = n, this; }; function pu(n) { return n._maxListeners === void 0 ? qt.defaultMaxListeners : n._maxListeners; } qt.prototype.getMaxListeners = function() { return pu(this); }; qt.prototype.emit = function(n) { for (var r = [], a = 1; a < arguments.length; a++) r.push(arguments[a]); var u = n === "error", c = this._events; if (c !== void 0) u = u && c.error === void 0; else if (!u) return !1; if (u) { var _; if (r.length > 0 && (_ = r[0]), _ instanceof Error) throw _; var E = new Error("Unhandled error." + (_ ? " (" + _.message + ")" : "")); throw E.context = _, E; } var v = c[n]; if (v === void 0) return !1; if (typeof v == "function") yc(v, this, r); else for (var R = v.length, C = mu(v, R), a = 0; a < R; ++a) yc(C[a], this, r); return !0; }; function _u(n, r, a, u) { var c, _, E; if (Qa(a), _ = n._events, _ === void 0 ? (_ = n._events = /* @__PURE__ */ Object.create(null), n._eventsCount = 0) : (_.newListener !== void 0 && (n.emit( "newListener", r, a.listener ? a.listener : a ), _ = n._events), E = _[r]), E === void 0) E = _[r] = a, ++n._eventsCount; else if (typeof E == "function" ? E = _[r] = u ? [a, E] : [E, a] : u ? E.unshift(a) : E.push(a), c = pu(n), c > 0 && E.length > c && !E.warned) { E.warned = !0; var v = new Error("Possible EventEmitter memory leak detected. " + E.length + " " + String(r) + " listeners added. Use emitter.setMaxListeners() to increase limit"); v.name = "MaxListenersExceededWarning", v.emitter = n, v.type = r, v.count = E.length, If(v); } return n; } qt.prototype.addListener = function(n, r) { return _u(this, n, r, !1); }; qt.prototype.on = qt.prototype.addListener; qt.prototype.prependListener = function(n, r) { return _u(this, n, r, !0); }; function Tf() { 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 Au(n, r, a) { var u = { fired: !1, wrapFn: void 0, target: n, type: r, listener: a }, c = Tf.bind(u); return c.listener = a, u.wrapFn = c, c; } qt.prototype.once = function(n, r) { return Qa(r), this.on(n, Au(this, n, r)), this; }; qt.prototype.prependOnceListener = function(n, r) { return Qa(r), this.prependListener(n, Au(this, n, r)), this; }; qt.prototype.removeListener = function(n, r) { var a, u, c, _, E; if (Qa(r), u = this._events, u === void 0) return this; if (a = u[n], a === void 0) return this; if (a === r || a.listener === r) --this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete u[n], u.removeListener && this.emit("removeListener", n, a.listener || r)); else if (typeof a != "function") { for (c = -1, _ = a.length - 1; _ >= 0; _--) if (a[_] === r || a[_].listener === r) { E = a[_].listener, c = _; break; } if (c < 0) return this; c === 0 ? a.shift() : Rf(a, c), a.length === 1 && (u[n] = a[0]), u.removeListener !== void 0 && this.emit("removeListener", n, E || r); } return this; }; qt.prototype.off = qt.prototype.removeListener; qt.prototype.removeAllListeners = function(n) { var r, a, u; if (a = this._events, a === void 0) return this; if (a.removeListener === void 0) return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : a[n] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete a[n]), this; if (arguments.length === 0) { var c = Object.keys(a), _; for (u = 0; u < c.length; ++u) _ = c[u], _ !== "removeListener" && this.removeAllListeners(_); return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this; } if (r = a[n], typeof r == "function") this.removeListener(n, r); else if (r !== void 0) for (u = r.length - 1; u >= 0; u--) this.removeListener(n, r[u]); return this; }; function vu(n, r, a) { var u = n._events; if (u === void 0) return []; var c = u[r]; return c === void 0 ? [] : typeof c == "function" ? a ? [c.listener || c] : [c] : a ? wf(c) : mu(c, c.length); } qt.prototype.listeners = function(n) { return vu(this, n, !0); }; qt.prototype.rawListeners = function(n) { return vu(this, n, !1); }; qt.listenerCount = function(n, r) { return typeof n.listenerCount == "function" ? n.listenerCount(r) : gu.call(n, r); }; qt.prototype.listenerCount = gu; function gu(n) { var r = this._events; if (r !== void 0) { var a = r[n]; if (typeof a == "function") return 1; if (a !== void 0) return a.length; } return 0; } qt.prototype.eventNames = function() { return this._eventsCount > 0 ? Da(this._events) : []; }; function mu(n, r) { for (var a = new Array(r), u = 0; u < r; ++u) a[u] = n[u]; return a; } function Rf(n, r) { for (; r + 1 < n.length; r++) n[r] = n[r + 1]; n.pop(); } function wf(n) { for (var r = new Array(n.length), a = 0; a < r.length; ++a) r[a] = n[a].listener || n[a]; return r; } function Df(n, r) { return new Promise(function(a, u) { function c(E) { n.removeListener(r, _), u(E); } function _() { typeof n.removeListener == "function" && n.removeListener("error", c), a([].slice.call(arguments)); } bu(n, r, _, { once: !0 }), r !== "error" && Sf(n, c, { once: !0 }); }); } function Sf(n, r, a) { typeof n.on == "function" && bu(n, "error", r, a); } function bu(n, r, a, u) { if (typeof n.on == "function") u.once ? n.once(r, a) : n.on(r, a); else if (typeof n.addEventListener == "function") n.addEventListener(r, function c(_) { u.once && n.removeEventListener(r, c), a(_); }); else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof n); } var Lf = fo.exports, yu = function() { if (typeof Map < "u") return Map; function n(r, a) { var u = -1; return r.some(function(c, _) { return c[0] === a ? (u = _, !0) : !1; }), u; } return ( /** @class */ function() { function r() { this.__entries__ = []; } return Object.defineProperty(r.prototype, "size", { /** * @returns {boolean} */ get: function() { return this.__entries__.length; }, enumerable: !0, configurable: !0 }), r.prototype.get = function(a) { var u = n(this.__entries__, a), c = this.__entries__[u]; return c && c[1]; }, r.prototype.set = function(a, u) { var c = n(this.__entries__, a); ~c ? this.__entries__[c][1] = u : this.__entries__.push([a, u]); }, r.prototype.delete = function(a) { var u = this.__entries__, c = n(u, a); ~c && u.splice(c, 1); }, r.prototype.has = function(a) { return !!~n(this.__entries__, a); }, r.prototype.clear = function() { this.__entries__.splice(0); }, r.prototype.forEach = function(a, u) { u === void 0 && (u = null); for (var c = 0, _ = this.__entries__; c < _.length; c++) { var E = _[c]; a.call(u, E[1], E[0]); } }, r; }() ); }(), Ks = typeof window < "u" && typeof document < "u" && window.document === document, Va = 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")(); }(), Of = function() { return typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(Va) : function(n) { return setTimeout(function() { return n(Date.now()); }, 1e3 / 60); }; }(), Nf = 2; function xf(n, r) { var a = !1, u = !1, c = 0; function _() { a && (a = !1, n()), u && v(); } function E() { Of(_); } function v() { var R = Date.now(); if (a) { if (R - c < Nf) return; u = !0; } else a = !0, u = !1, setTimeout(E, r); c = R; } return v; } var kf = 20, Mf = ["top", "right", "bottom", "left", "width", "height", "size", "weight"], Pf = typeof MutationObserver < "u", Vf = ( /** @class */ function() { function n() { this.connected_ = !1, this.mutationEventsAdded_ = !1, this.mutationsObserver_ = null, this.observers_ = [], this.onTransitionEnd_ = this.onTransitionEnd_.bind(this), this.refresh = xf(this.refresh.bind(this), kf); } return n.prototype.addObserver = function(r) { ~this.observers_.indexOf(r) || this.observers_.push(r), this.connected_ || this.connect_(); }, n.prototype.removeObserver = function(r) { var a = this.observers_, u = a.indexOf(r); ~u && a.splice(u, 1), !a.length && this.connected_ && this.disconnect_(); }, n.prototype.refresh = function() { var r = this.updateObservers_(); r && this.refresh(); }, n.prototype.updateObservers_ = function() { var r = this.observers_.filter(function(a) { return a.gatherActive(), a.hasActive(); }); return r.forEach(function(a) { return a.broadcastActive(); }), r.length > 0; }, n.prototype.connect_ = function() { !Ks || this.connected_ || (document.addEventListener("transitionend", this.onTransitionEnd_), window.addEventListener("resize", this.refresh), Pf ? (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); }, n.prototype.disconnect_ = function() { !Ks || !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); }, n.prototype.onTransitionEnd_ = function(r) { var a = r.propertyName, u = a === void 0 ? "" : a, c = Mf.some(function(_) { return !!~u.indexOf(_); }); c && this.refresh(); }, n.getInstance = function() { return this.instance_ || (this.instance_ = new n()), this.instance_; }, n.instance_ = null, n; }() ), Eu = function(n, r) { for (var a = 0, u = Object.keys(r); a < u.length; a++) { var c = u[a]; Object.defineProperty(n, c, { value: r[c], enumerable: !1, writable: !1, configurable: !0 }); } return n; }, kn = function(n) { var r = n && n.ownerDocument && n.ownerDocument.defaultView; return r || Va; }, Cu = Xa(0, 0, 0, 0); function Ua(n) { return parseFloat(n) || 0; } function Cc(n) { for (var r = [], a = 1; a < arguments.length; a++) r[a - 1] = arguments[a]; return r.reduce(function(u, c) { var _ = n["border-" + c + "-width"]; return u + Ua(_); }, 0); } function Uf(n) { for (var r = ["top", "right", "bottom", "left"], a = {}, u = 0, c = r; u < c.length; u++) { var _ = c[u], E = n["padding-" + _]; a[_] = Ua(E); } return a; } function Bf(n) { var r = n.getBBox(); return Xa(0, 0, r.width, r.height); } function jf(n) { var r = n.clientWidth, a = n.clientHeight; if (!r && !a) return Cu; var u = kn(n).getComputedStyle(n), c = Uf(u), _ = c.left + c.right, E = c.top + c.bottom, v = Ua(u.width), R = Ua(u.height); if (u.boxSizing === "border-box" && (Math.round(v + _) !== r && (v -= Cc(u, "left", "right") + _), Math.round(R + E) !== a && (R -= Cc(u, "top", "bottom") + E)), !Hf(n)) { var C = Math.round(v + _) - r, h = Math.round(R + E) - a; Math.abs(C) !== 1 && (v -= C), Math.abs(h) !== 1 && (R -= h); } return Xa(c.left, c.top, v, R); } var Ff = function() { return typeof SVGGraphicsElement < "u" ? function(n) { return n instanceof kn(n).SVGGraphicsElement; } : function(n) { return n instanceof kn(n).SVGElement && typeof n.getBBox == "function"; }; }(); function Hf(n) { return n === kn(n).document.documentElement; } function Gf(n) { return Ks ? Ff(n) ? Bf(n) : jf(n) : Cu; } function zf(n) { var r = n.x, a = n.y, u = n.width, c = n.height, _ = typeof DOMRectReadOnly < "u" ? DOMRectReadOnly : Object, E = Object.create(_.prototype); return Eu(E, { x: r, y: a, width: u, height: c, top: a, right: r + u, bottom: c + a, left: r }), E; } function Xa(n, r, a, u) { return { x: n, y: r, width: a, height: u }; } var Kf = ( /** @class */ funct