swarm-video-viewer
Version:
Swarm video viewer for any player
7,226 lines • 341 kB
JavaScript
var __defProp = Object.defineProperty;
var __typeError = (msg) => {
throw TypeError(msg);
};
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _callbacks, _createDefaultLoader, _defaultLoader, _core, _response, _segmentId, _FragmentLoaderBase_instances, handleError_fn, abortInternal_fn, _Ja, _defaultLoader2, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa, _Ta, _Ua;
(function(_0x16e577, _0x14ba40) {
var _0x5de4c6 = _0x436f, _0xd3da4f = _0x16e577();
while (!![]) {
try {
var _0x502da9 = -parseInt(_0x5de4c6(231)) / 1 + -parseInt(_0x5de4c6(238)) / 2 + parseInt(_0x5de4c6(237)) / 3 * (-parseInt(_0x5de4c6(236)) / 4) + parseInt(_0x5de4c6(235)) / 5 + parseInt(_0x5de4c6(229)) / 6 + -parseInt(_0x5de4c6(232)) / 7 * (-parseInt(_0x5de4c6(233)) / 8) + parseInt(_0x5de4c6(230)) / 9;
if (_0x502da9 === _0x14ba40) break;
else _0xd3da4f["push"](_0xd3da4f["shift"]());
} catch (_0x40334c) {
_0xd3da4f["push"](_0xd3da4f["shift"]());
}
}
})(_0x2c7e, 289835);
function _0x436f(_0x1ffa25, _0x45af00) {
var _0x2c7eda = _0x2c7e();
return _0x436f = function(_0x436f80, _0x37bdcf) {
_0x436f80 = _0x436f80 - 229;
var _0x52e112 = _0x2c7eda[_0x436f80];
return _0x52e112;
}, _0x436f(_0x1ffa25, _0x45af00);
}
function _0x2c7e() {
var _0x2de262 = ["1473498VJaNLu", "216165kuyDTc", "1901018HepXHo", "8oSknvZ", "start", "2587160hkYNmL", "4PgfRUr", "1447596qzXAAo", "951614jOiMBI", "3069666uFzFEv"];
_0x2c7e = function() {
return _0x2de262;
};
return _0x2c7e();
}
function getSegmentRuntimeId(_0xc1c19, _0xd76ff8) {
var _0x4dc7a1 = _0x436f;
if (!_0xd76ff8) return _0xc1c19;
return _0xc1c19 + "|" + _0xd76ff8[_0x4dc7a1(234)] + "-" + _0xd76ff8["end"];
}
function getByteRange(_0x3ead6e, _0x4e53dc) {
if (_0x3ead6e !== void 0 && _0x4e53dc !== void 0 && _0x3ead6e <= _0x4e53dc) return { "start": _0x3ead6e, "end": _0x4e53dc };
}
const _0x5b3789 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
getByteRange,
getSegmentRuntimeId
}, Symbol.toStringTag, { value: "Module" }));
var _0x28a6f9 = _0x33d5;
function _0x33d5(_0x2d5a51, _0x15978e) {
var _0x268746 = _0x2687();
return _0x33d5 = function(_0x33d51e, _0x481d68) {
_0x33d51e = _0x33d51e - 420;
var _0x503d98 = _0x268746[_0x33d51e];
return _0x503d98;
}, _0x33d5(_0x2d5a51, _0x15978e);
}
function _0x2687() {
var _0x2cb79e = ["3122104iWhRYx", "885486tYsevq", "4IataAF", "timestamp", "13898wHWsJV", "52236UjoFwE", "now", "4299450YtTbmA", "7UmYpMV", "30sWlhzj", "810393qVipRF", "5VgsOBi", "3881482rwZxsJ", "type"];
_0x2687 = function() {
return _0x2cb79e;
};
return _0x2687();
}
(function(_0x3d085c, _0x5f80ae) {
var _0xef11f6 = _0x33d5, _0x237610 = _0x3d085c();
while (!![]) {
try {
var _0x3f8c16 = -parseInt(_0xef11f6(427)) / 1 * (-parseInt(_0xef11f6(422)) / 2) + -parseInt(_0xef11f6(428)) / 3 * (-parseInt(_0xef11f6(420)) / 4) + -parseInt(_0xef11f6(429)) / 5 * (-parseInt(_0xef11f6(433)) / 6) + parseInt(_0xef11f6(426)) / 7 * (parseInt(_0xef11f6(432)) / 8) + parseInt(_0xef11f6(423)) / 9 + -parseInt(_0xef11f6(425)) / 10 + -parseInt(_0xef11f6(430)) / 11;
if (_0x3f8c16 === _0x5f80ae) break;
else _0x237610["push"](_0x237610["shift"]());
} catch (_0x515de1) {
_0x237610["push"](_0x237610["shift"]());
}
}
})(_0x2687, 239442);
class RequestError extends (_b = Error, _a = _0x28a6f9(421), _b) {
constructor(_0x470291, _0x254bfa) {
var _0x5940ad = _0x33d5;
super(_0x254bfa);
__publicField(this, _a);
this[_0x5940ad(431)] = _0x470291, this[_0x5940ad(421)] = performance[_0x5940ad(424)]();
}
}
class CoreRequestError extends Error {
constructor(_0x33db0b) {
var _0x11f180 = _0x28a6f9;
super(), this[_0x11f180(431)] = _0x33db0b;
}
}
const _0x285f8a = _0x5a67;
(function(_0x5b9b3e, _0xee9095) {
const _0x2be765 = _0x5a67, _0x4913f5 = _0x5b9b3e();
while (!![]) {
try {
const _0x392291 = -parseInt(_0x2be765(244)) / 1 * (-parseInt(_0x2be765(211)) / 2) + parseInt(_0x2be765(215)) / 3 * (-parseInt(_0x2be765(202)) / 4) + -parseInt(_0x2be765(230)) / 5 * (parseInt(_0x2be765(233)) / 6) + -parseInt(_0x2be765(226)) / 7 * (-parseInt(_0x2be765(205)) / 8) + parseInt(_0x2be765(207)) / 9 + -parseInt(_0x2be765(191)) / 10 * (-parseInt(_0x2be765(200)) / 11) + parseInt(_0x2be765(222)) / 12 * (-parseInt(_0x2be765(239)) / 13);
if (_0x392291 === _0xee9095) break;
else _0x4913f5["push"](_0x4913f5["shift"]());
} catch (_0x49b5a3) {
_0x4913f5["push"](_0x4913f5["shift"]());
}
}
})(_0x2c04, 382580);
function _0x5a67(_0x594397, _0xd7418f) {
const _0x2c04f0 = _0x2c04();
return _0x5a67 = function(_0x5a6784, _0xa6285d) {
_0x5a6784 = _0x5a6784 - 186;
let _0x297285 = _0x2c04f0[_0x5a6784];
return _0x297285;
}, _0x5a67(_0x594397, _0xd7418f);
}
class HttpRequestExecutor {
constructor(_0x271419, _0x1f4445, _0x1c17f3) {
__publicField(this, _f);
__publicField(this, _e, new AbortController());
__publicField(this, _d);
__publicField(this, _c);
__publicField(this, "onChunkDownloaded");
const _0x522da7 = _0x5a67;
this["request"] = _0x271419, this[_0x522da7(246)] = _0x1f4445, this[_0x522da7(198)] = _0x1c17f3[_0x522da7(242)](_0x522da7(198));
const { byteRange: _0xf766f4 } = this[_0x522da7(197)][_0x522da7(210)];
if (_0xf766f4) this[_0x522da7(194)] = { ..._0xf766f4 };
_0x271419["loadedBytes"] !== 0 && (this[_0x522da7(194)] = this[_0x522da7(194)] ?? { "start": 0 }, this["requestByteRange"][_0x522da7(227)] = this["requestByteRange"][_0x522da7(227)] + _0x271419[_0x522da7(209)]), this["request"]["totalBytes"] && (this[_0x522da7(186)] = this[_0x522da7(197)][_0x522da7(236)] - this[_0x522da7(197)][_0x522da7(209)]), this[_0x522da7(217)] = this[_0x522da7(197)][_0x522da7(227)]({ "downloadSource": _0x522da7(220) }, { "abort": () => this["abortController"][_0x522da7(231)](_0x522da7(231)), "notReceivingBytesTimeoutMs": this["httpConfig"][_0x522da7(243)] }), void this[_0x522da7(241)]();
}
async [(_f = _0x285f8a(217), _e = _0x285f8a(234), _d = _0x285f8a(186), _c = _0x285f8a(194), _0x285f8a(241))]() {
var _a2, _b2, _c2, _d2;
const _0x3973c4 = _0x285f8a, { segment: _0x41e659 } = this[_0x3973c4(197)];
try {
let _0x2dea89 = await ((_b2 = (_a2 = this[_0x3973c4(246)])[_0x3973c4(201)]) == null ? void 0 : _b2.call(_a2, _0x41e659[_0x3973c4(188)], _0x41e659[_0x3973c4(196)], this[_0x3973c4(234)][_0x3973c4(221)], this[_0x3973c4(194)]));
if (!_0x2dea89) {
const _0x3eacfc = new Headers(this[_0x3973c4(194)] ? { "Range": _0x3973c4(225) + this[_0x3973c4(194)][_0x3973c4(227)] + "-" + (this[_0x3973c4(194)][_0x3973c4(237)] ?? "") } : void 0);
_0x2dea89 = new Request(_0x41e659[_0x3973c4(188)], { "headers": _0x3eacfc, "signal": this[_0x3973c4(234)][_0x3973c4(221)] });
}
if (this[_0x3973c4(234)][_0x3973c4(221)][_0x3973c4(195)]) throw new DOMException(_0x3973c4(229), _0x3973c4(203));
const _0x12a803 = await window["fetch"](_0x2dea89);
this[_0x3973c4(245)](_0x12a803);
if (!_0x12a803[_0x3973c4(223)]) return;
const { requestControls: _0x2d7eec } = this;
_0x2d7eec[_0x3973c4(206)]();
const _0x197d6c = _0x12a803[_0x3973c4(223)][_0x3973c4(193)]();
for await (const _0x475aff of readStream(_0x197d6c)) {
this["requestControls"][_0x3973c4(208)](_0x475aff), this[_0x3973c4(198)](_0x475aff[_0x3973c4(224)], "http");
}
const _0x577098 = await ((_d2 = (_c2 = this[_0x3973c4(246)])[_0x3973c4(216)]) == null ? void 0 : _d2.call(_c2, _0x41e659["url"], _0x41e659[_0x3973c4(196)], this[_0x3973c4(197)][_0x3973c4(232)])) ?? !![];
if (!_0x577098) {
this["request"][_0x3973c4(190)]();
throw new RequestError(_0x3973c4(212));
}
_0x2d7eec["completeOnSuccess"]();
} catch (_0x2fdf29) {
this[_0x3973c4(187)](_0x2fdf29);
}
}
["handleResponseHeaders"](_0x63fac7) {
const _0x328194 = _0x285f8a;
if (!_0x63fac7["ok"]) {
if (_0x63fac7[_0x328194(204)] === 406) {
this["request"][_0x328194(190)]();
throw new RequestError(_0x328194(228), _0x63fac7[_0x328194(247)]);
} else throw new RequestError("http-error", _0x63fac7["statusText"]);
}
const { requestByteRange: _0x3b851c } = this;
if (_0x3b851c) {
if (_0x63fac7[_0x328194(204)] === 200) {
if (this["request"][_0x328194(210)][_0x328194(196)]) throw new RequestError(_0x328194(240));
else this["request"][_0x328194(190)]();
} else {
if (_0x63fac7["status"] !== 206) throw new RequestError("http-unexpected-status-code", _0x63fac7[_0x328194(247)]);
const _0x1aed78 = _0x63fac7[_0x328194(192)][_0x328194(214)](_0x328194(219));
if (_0x1aed78 && this[_0x328194(186)] !== void 0 && this[_0x328194(186)] !== +_0x1aed78) {
this[_0x328194(197)]["clearLoadedBytes"]();
throw new RequestError(_0x328194(228), _0x63fac7["statusText"]);
}
const _0xa1b7d7 = _0x63fac7[_0x328194(192)][_0x328194(214)](_0x328194(248)), _0x377caa = _0xa1b7d7 ? parseContentRangeHeader(_0xa1b7d7) : void 0;
if (_0x377caa) {
const { from: _0x1273ee, to: _0x5a25db } = _0x377caa, _0x369ab6 = _0x5a25db !== void 0 && _0x1273ee !== void 0 ? _0x5a25db - _0x1273ee + 1 : void 0;
if (_0x369ab6 !== void 0 && this[_0x328194(186)] !== _0x369ab6 || _0x1273ee !== void 0 && _0x3b851c[_0x328194(227)] !== _0x1273ee || _0x5a25db !== void 0 && _0x3b851c["end"] !== void 0 && _0x3b851c[_0x328194(237)] !== _0x5a25db) {
this["request"][_0x328194(190)]();
throw new RequestError(_0x328194(228), _0x63fac7["statusText"]);
}
}
}
}
if (_0x63fac7[_0x328194(204)] === 200 && this[_0x328194(197)][_0x328194(236)] === void 0) {
const _0x41fdc6 = _0x63fac7[_0x328194(192)]["get"](_0x328194(219));
if (_0x41fdc6) this["request"][_0x328194(199)](+_0x41fdc6);
}
}
[_0x285f8a(187)](_0x24c3a7) {
const _0x5a6602 = _0x285f8a;
if (_0x24c3a7 instanceof Error) {
if (_0x24c3a7[_0x5a6602(213)] !== _0x5a6602(231)) return;
const _0x17c977 = _0x24c3a7 instanceof RequestError ? _0x24c3a7 : new RequestError(_0x5a6602(238), _0x24c3a7[_0x5a6602(189)]);
this[_0x5a6602(217)]["abortOnError"](_0x17c977);
}
}
}
async function* readStream(_0x18dfc4) {
while (!![]) {
const { done: _0x54d13e, value: _0x24124a } = await _0x18dfc4["read"]();
if (_0x54d13e) break;
yield _0x24124a;
}
}
function _0x2c04() {
const _0x5ec80d = ["3636792KenRNp", "addLoadedChunk", "loadedBytes", "segment", "588278ANwoLV", "http-segment-validation-failed", "name", "get", "228729IaABaj", "validateHTTPSegment", "requestControls", "trim", "Content-Length", "http", "signal", "5556rBcuxM", "body", "byteLength", "bytes=", "49tifUwv", "start", "http-bytes-mismatch", "Request aborted before request fetch", "30110hppJmL", "abort", "data", "276tGHpMF", "abortController", "exec", "totalBytes", "end", "http-error", "9971PnbVUV", "http-unexpected-status-code", "fetch", "getEventDispatcher", "httpNotReceivingBytesTimeoutMs", "1IxkyPr", "handleResponseHeaders", "httpConfig", "statusText", "Content-Range", "expectedBytesLength", "handleError", "url", "message", "clearLoadedBytes", "1361270dvoRtw", "headers", "getReader", "requestByteRange", "aborted", "byteRange", "request", "onChunkDownloaded", "setTotalBytes", "44wHJJFR", "httpRequestSetup", "12xndZJw", "AbortError", "status", "808pJoYrU", "firstBytesReceived"];
_0x2c04 = function() {
return _0x5ec80d;
};
return _0x2c04();
}
const rangeHeaderRegex = /^bytes (?:(?:(\d+)|)-(?:(\d+)|)|\*)\/(?:(\d+)|\*)$/;
function parseContentRangeHeader(_0x1341fd) {
const _0x6290f8 = _0x285f8a, _0x474513 = rangeHeaderRegex[_0x6290f8(235)](_0x1341fd[_0x6290f8(218)]());
if (!_0x474513) return;
const [, _0x262b3a, _0x1124f7, _0x367650] = _0x474513;
return { "from": _0x262b3a ? parseInt(_0x262b3a) : void 0, "to": _0x1124f7 ? parseInt(_0x1124f7) : void 0, "total": _0x367650 ? parseInt(_0x367650) : void 0 };
}
function _0x2ca1(_0x164d4f, _0xf59c0a) {
var _0x25da8c = _0x25da();
return _0x2ca1 = function(_0x2ca1cb, _0x534c67) {
_0x2ca1cb = _0x2ca1cb - 360;
var _0x2b7b41 = _0x25da8c[_0x2ca1cb];
return _0x2b7b41;
}, _0x2ca1(_0x164d4f, _0xf59c0a);
}
var _0x1a42e = _0x2ca1;
(function(_0x5d9f2d, _0x24e147) {
var _0xfe6ade = _0x2ca1, _0x1d5f6d = _0x5d9f2d();
while (!![]) {
try {
var _0x27920c = parseInt(_0xfe6ade(369)) / 1 * (-parseInt(_0xfe6ade(364)) / 2) + -parseInt(_0xfe6ade(361)) / 3 + -parseInt(_0xfe6ade(383)) / 4 * (parseInt(_0xfe6ade(380)) / 5) + -parseInt(_0xfe6ade(373)) / 6 * (parseInt(_0xfe6ade(375)) / 7) + -parseInt(_0xfe6ade(379)) / 8 + -parseInt(_0xfe6ade(365)) / 9 + parseInt(_0xfe6ade(374)) / 10;
if (_0x27920c === _0x24e147) break;
else _0x1d5f6d["push"](_0x1d5f6d["shift"]());
} catch (_0x32be1e) {
_0x1d5f6d["push"](_0x1d5f6d["shift"]());
}
}
})(_0x25da, 914172);
var commonjsGlobal = typeof globalThis !== _0x1a42e(381) ? globalThis : typeof window !== _0x1a42e(381) ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
function _0x25da() {
var _0x2e95f7 = ["273oMbDnG", "get", "hasOwnProperty", "apply", "396tuuGJV", "39477060XPvOit", "1939TENRyV", "constructor", "prototype", "function", "5417464LjJHZf", "5VBFUbq", "undefined", "length", "2822444dyAelD", "default", "1364907DWnyaF", "call", "forEach", "96oaQztj", "10479465KhBkVU", "__esModule", "defineProperty", "keys"];
_0x25da = function() {
return _0x2e95f7;
};
return _0x25da();
}
function getDefaultExportFromCjs(_0x258b67) {
var _0x169600 = _0x1a42e;
return _0x258b67 && _0x258b67[_0x169600(366)] && Object[_0x169600(377)][_0x169600(371)][_0x169600(362)](_0x258b67, _0x169600(360)) ? _0x258b67["default"] : _0x258b67;
}
var browser = { exports: {} };
var ms;
var hasRequiredMs;
function requireMs() {
if (hasRequiredMs) return ms;
hasRequiredMs = 1;
var s = 1e3;
var m = s * 60;
var h = m * 60;
var d = h * 24;
var w = d * 7;
var y = d * 365.25;
ms = function(val, options) {
options = options || {};
var type = typeof val;
if (type === "string" && val.length > 0) {
return parse(val);
} else if (type === "number" && isFinite(val)) {
return options.long ? fmtLong(val) : fmtShort(val);
}
throw new Error(
"val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
);
};
function parse(str) {
str = String(str);
if (str.length > 100) {
return;
}
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
str
);
if (!match) {
return;
}
var n = parseFloat(match[1]);
var type = (match[2] || "ms").toLowerCase();
switch (type) {
case "years":
case "year":
case "yrs":
case "yr":
case "y":
return n * y;
case "weeks":
case "week":
case "w":
return n * w;
case "days":
case "day":
case "d":
return n * d;
case "hours":
case "hour":
case "hrs":
case "hr":
case "h":
return n * h;
case "minutes":
case "minute":
case "mins":
case "min":
case "m":
return n * m;
case "seconds":
case "second":
case "secs":
case "sec":
case "s":
return n * s;
case "milliseconds":
case "millisecond":
case "msecs":
case "msec":
case "ms":
return n;
default:
return void 0;
}
}
function fmtShort(ms2) {
var msAbs = Math.abs(ms2);
if (msAbs >= d) {
return Math.round(ms2 / d) + "d";
}
if (msAbs >= h) {
return Math.round(ms2 / h) + "h";
}
if (msAbs >= m) {
return Math.round(ms2 / m) + "m";
}
if (msAbs >= s) {
return Math.round(ms2 / s) + "s";
}
return ms2 + "ms";
}
function fmtLong(ms2) {
var msAbs = Math.abs(ms2);
if (msAbs >= d) {
return plural(ms2, msAbs, d, "day");
}
if (msAbs >= h) {
return plural(ms2, msAbs, h, "hour");
}
if (msAbs >= m) {
return plural(ms2, msAbs, m, "minute");
}
if (msAbs >= s) {
return plural(ms2, msAbs, s, "second");
}
return ms2 + " ms";
}
function plural(ms2, msAbs, n, name) {
var isPlural = msAbs >= n * 1.5;
return Math.round(ms2 / n) + " " + name + (isPlural ? "s" : "");
}
return ms;
}
var common;
var hasRequiredCommon;
function requireCommon() {
if (hasRequiredCommon) return common;
hasRequiredCommon = 1;
function setup(env) {
createDebug.debug = createDebug;
createDebug.default = createDebug;
createDebug.coerce = coerce;
createDebug.disable = disable;
createDebug.enable = enable;
createDebug.enabled = enabled;
createDebug.humanize = requireMs();
createDebug.destroy = destroy;
Object.keys(env).forEach((key) => {
createDebug[key] = env[key];
});
createDebug.names = [];
createDebug.skips = [];
createDebug.formatters = {};
function selectColor(namespace) {
let hash = 0;
for (let i = 0; i < namespace.length; i++) {
hash = (hash << 5) - hash + namespace.charCodeAt(i);
hash |= 0;
}
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
}
createDebug.selectColor = selectColor;
function createDebug(namespace) {
let prevTime;
let enableOverride = null;
let namespacesCache;
let enabledCache;
function debug2(...args) {
if (!debug2.enabled) {
return;
}
const self2 = debug2;
const curr = Number(/* @__PURE__ */ new Date());
const ms2 = curr - (prevTime || curr);
self2.diff = ms2;
self2.prev = prevTime;
self2.curr = curr;
prevTime = curr;
args[0] = createDebug.coerce(args[0]);
if (typeof args[0] !== "string") {
args.unshift("%O");
}
let index2 = 0;
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
if (match === "%%") {
return "%";
}
index2++;
const formatter = createDebug.formatters[format];
if (typeof formatter === "function") {
const val = args[index2];
match = formatter.call(self2, val);
args.splice(index2, 1);
index2--;
}
return match;
});
createDebug.formatArgs.call(self2, args);
const logFn = self2.log || createDebug.log;
logFn.apply(self2, args);
}
debug2.namespace = namespace;
debug2.useColors = createDebug.useColors();
debug2.color = createDebug.selectColor(namespace);
debug2.extend = extend;
debug2.destroy = createDebug.destroy;
Object.defineProperty(debug2, "enabled", {
enumerable: true,
configurable: false,
get: () => {
if (enableOverride !== null) {
return enableOverride;
}
if (namespacesCache !== createDebug.namespaces) {
namespacesCache = createDebug.namespaces;
enabledCache = createDebug.enabled(namespace);
}
return enabledCache;
},
set: (v) => {
enableOverride = v;
}
});
if (typeof createDebug.init === "function") {
createDebug.init(debug2);
}
return debug2;
}
function extend(namespace, delimiter) {
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
newDebug.log = this.log;
return newDebug;
}
function enable(namespaces) {
createDebug.save(namespaces);
createDebug.namespaces = namespaces;
createDebug.names = [];
createDebug.skips = [];
const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
for (const ns of split) {
if (ns[0] === "-") {
createDebug.skips.push(ns.slice(1));
} else {
createDebug.names.push(ns);
}
}
}
function matchesTemplate(search, template) {
let searchIndex = 0;
let templateIndex = 0;
let starIndex = -1;
let matchIndex = 0;
while (searchIndex < search.length) {
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
if (template[templateIndex] === "*") {
starIndex = templateIndex;
matchIndex = searchIndex;
templateIndex++;
} else {
searchIndex++;
templateIndex++;
}
} else if (starIndex !== -1) {
templateIndex = starIndex + 1;
matchIndex++;
searchIndex = matchIndex;
} else {
return false;
}
}
while (templateIndex < template.length && template[templateIndex] === "*") {
templateIndex++;
}
return templateIndex === template.length;
}
function disable() {
const namespaces = [
...createDebug.names,
...createDebug.skips.map((namespace) => "-" + namespace)
].join(",");
createDebug.enable("");
return namespaces;
}
function enabled(name) {
for (const skip of createDebug.skips) {
if (matchesTemplate(name, skip)) {
return false;
}
}
for (const ns of createDebug.names) {
if (matchesTemplate(name, ns)) {
return true;
}
}
return false;
}
function coerce(val) {
if (val instanceof Error) {
return val.stack || val.message;
}
return val;
}
function destroy() {
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
}
createDebug.enable(createDebug.load());
return createDebug;
}
common = setup;
return common;
}
var hasRequiredBrowser;
function requireBrowser() {
if (hasRequiredBrowser) return browser.exports;
hasRequiredBrowser = 1;
(function(module, exports) {
exports.formatArgs = formatArgs;
exports.save = save;
exports.load = load;
exports.useColors = useColors;
exports.storage = localstorage();
exports.destroy = /* @__PURE__ */ (() => {
let warned = false;
return () => {
if (!warned) {
warned = true;
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
}
};
})();
exports.colors = [
"#0000CC",
"#0000FF",
"#0033CC",
"#0033FF",
"#0066CC",
"#0066FF",
"#0099CC",
"#0099FF",
"#00CC00",
"#00CC33",
"#00CC66",
"#00CC99",
"#00CCCC",
"#00CCFF",
"#3300CC",
"#3300FF",
"#3333CC",
"#3333FF",
"#3366CC",
"#3366FF",
"#3399CC",
"#3399FF",
"#33CC00",
"#33CC33",
"#33CC66",
"#33CC99",
"#33CCCC",
"#33CCFF",
"#6600CC",
"#6600FF",
"#6633CC",
"#6633FF",
"#66CC00",
"#66CC33",
"#9900CC",
"#9900FF",
"#9933CC",
"#9933FF",
"#99CC00",
"#99CC33",
"#CC0000",
"#CC0033",
"#CC0066",
"#CC0099",
"#CC00CC",
"#CC00FF",
"#CC3300",
"#CC3333",
"#CC3366",
"#CC3399",
"#CC33CC",
"#CC33FF",
"#CC6600",
"#CC6633",
"#CC9900",
"#CC9933",
"#CCCC00",
"#CCCC33",
"#FF0000",
"#FF0033",
"#FF0066",
"#FF0099",
"#FF00CC",
"#FF00FF",
"#FF3300",
"#FF3333",
"#FF3366",
"#FF3399",
"#FF33CC",
"#FF33FF",
"#FF6600",
"#FF6633",
"#FF9900",
"#FF9933",
"#FFCC00",
"#FFCC33"
];
function useColors() {
if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
return true;
}
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
return false;
}
let m;
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
}
function formatArgs(args) {
args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
if (!this.useColors) {
return;
}
const c = "color: " + this.color;
args.splice(1, 0, c, "color: inherit");
let index2 = 0;
let lastC = 0;
args[0].replace(/%[a-zA-Z%]/g, (match) => {
if (match === "%%") {
return;
}
index2++;
if (match === "%c") {
lastC = index2;
}
});
args.splice(lastC, 0, c);
}
exports.log = console.debug || console.log || (() => {
});
function save(namespaces) {
try {
if (namespaces) {
exports.storage.setItem("debug", namespaces);
} else {
exports.storage.removeItem("debug");
}
} catch (error) {
}
}
function load() {
let r;
try {
r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
} catch (error) {
}
if (!r && typeof process !== "undefined" && "env" in process) {
r = process.env.DEBUG;
}
return r;
}
function localstorage() {
try {
return localStorage;
} catch (error) {
}
}
module.exports = requireCommon()(exports);
const { formatters } = module.exports;
formatters.j = function(v) {
try {
return JSON.stringify(v);
} catch (error) {
return "[UnexpectedJSONParseError]: " + error.message;
}
};
})(browser, browser.exports);
return browser.exports;
}
var browserExports = requireBrowser();
const _0x1bf98d = /* @__PURE__ */ getDefaultExportFromCjs(browserExports);
var eventemitter3 = { exports: {} };
var hasRequiredEventemitter3;
function requireEventemitter3() {
if (hasRequiredEventemitter3) return eventemitter3.exports;
hasRequiredEventemitter3 = 1;
(function(module) {
var has = Object.prototype.hasOwnProperty, prefix = "~";
function Events() {
}
if (Object.create) {
Events.prototype = /* @__PURE__ */ Object.create(null);
if (!new Events().__proto__) prefix = false;
}
function EE(fn, context, once2) {
this.fn = fn;
this.context = context;
this.once = once2 || false;
}
function addListener(emitter, event, fn, context, once2) {
if (typeof fn !== "function") {
throw new TypeError("The listener must be a function");
}
var listener = new EE(fn, context || emitter, once2), evt = prefix ? prefix + event : event;
if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
else emitter._events[evt] = [emitter._events[evt], listener];
return emitter;
}
function clearEvent(emitter, evt) {
if (--emitter._eventsCount === 0) emitter._events = new Events();
else delete emitter._events[evt];
}
function EventEmitter2() {
this._events = new Events();
this._eventsCount = 0;
}
EventEmitter2.prototype.eventNames = function eventNames() {
var names = [], events, name;
if (this._eventsCount === 0) return names;
for (name in events = this._events) {
if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
}
if (Object.getOwnPropertySymbols) {
return names.concat(Object.getOwnPropertySymbols(events));
}
return names;
};
EventEmitter2.prototype.listeners = function listeners(event) {
var evt = prefix ? prefix + event : event, handlers = this._events[evt];
if (!handlers) return [];
if (handlers.fn) return [handlers.fn];
for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
ee[i] = handlers[i].fn;
}
return ee;
};
EventEmitter2.prototype.listenerCount = function listenerCount(event) {
var evt = prefix ? prefix + event : event, listeners = this._events[evt];
if (!listeners) return 0;
if (listeners.fn) return 1;
return listeners.length;
};
EventEmitter2.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
var evt = prefix ? prefix + event : event;
if (!this._events[evt]) return false;
var listeners = this._events[evt], len = arguments.length, args, i;
if (listeners.fn) {
if (listeners.once) this.removeListener(event, listeners.fn, void 0, true);
switch (len) {
case 1:
return listeners.fn.call(listeners.context), true;
case 2:
return listeners.fn.call(listeners.context, a1), true;
case 3:
return listeners.fn.call(listeners.context, a1, a2), true;
case 4:
return listeners.fn.call(listeners.context, a1, a2, a3), true;
case 5:
return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
case 6:
return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
}
for (i = 1, args = new Array(len - 1); i < len; i++) {
args[i - 1] = arguments[i];
}
listeners.fn.apply(listeners.context, args);
} else {
var length = listeners.length, j;
for (i = 0; i < length; i++) {
if (listeners[i].once) this.removeListener(event, listeners[i].fn, void 0, true);
switch (len) {
case 1:
listeners[i].fn.call(listeners[i].context);
break;
case 2:
listeners[i].fn.call(listeners[i].context, a1);
break;
case 3:
listeners[i].fn.call(listeners[i].context, a1, a2);
break;
case 4:
listeners[i].fn.call(listeners[i].context, a1, a2, a3);
break;
default:
if (!args) for (j = 1, args = new Array(len - 1); j < len; j++) {
args[j - 1] = arguments[j];
}
listeners[i].fn.apply(listeners[i].context, args);
}
}
}
return true;
};
EventEmitter2.prototype.on = function on(event, fn, context) {
return addListener(this, event, fn, context, false);
};
EventEmitter2.prototype.once = function once2(event, fn, context) {
return addListener(this, event, fn, context, true);
};
EventEmitter2.prototype.removeListener = function removeListener(event, fn, context, once2) {
var evt = prefix ? prefix + event : event;
if (!this._events[evt]) return this;
if (!fn) {
clearEvent(this, evt);
return this;
}
var listeners = this._events[evt];
if (listeners.fn) {
if (listeners.fn === fn && (!once2 || listeners.once) && (!context || listeners.context === context)) {
clearEvent(this, evt);
}
} else {
for (var i = 0, events = [], length = listeners.length; i < length; i++) {
if (listeners[i].fn !== fn || once2 && !listeners[i].once || context && listeners[i].context !== context) {
events.push(listeners[i]);
}
}
if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
else clearEvent(this, evt);
}
return this;
};
EventEmitter2.prototype.removeAllListeners = function removeAllListeners(event) {
var evt;
if (event) {
evt = prefix ? prefix + event : event;
if (this._events[evt]) clearEvent(this, evt);
} else {
this._events = new Events();
this._eventsCount = 0;
}
return this;
};
EventEmitter2.prototype.off = EventEmitter2.prototype.removeListener;
EventEmitter2.prototype.addListener = EventEmitter2.prototype.on;
EventEmitter2.prefixed = prefix;
EventEmitter2.EventEmitter = EventEmitter2;
{
module.exports = EventEmitter2;
}
})(eventemitter3);
return eventemitter3.exports;
}
var eventemitter3Exports = requireEventemitter3();
const EventEmitter = /* @__PURE__ */ getDefaultExportFromCjs(eventemitter3Exports);
var once = { exports: {} };
var wrappy_1;
var hasRequiredWrappy;
function requireWrappy() {
if (hasRequiredWrappy) return wrappy_1;
hasRequiredWrappy = 1;
wrappy_1 = wrappy;
function wrappy(fn, cb) {
if (fn && cb) return wrappy(fn)(cb);
if (typeof fn !== "function")
throw new TypeError("need wrapper function");
Object.keys(fn).forEach(function(k) {
wrapper[k] = fn[k];
});
return wrapper;
function wrapper() {
var args = new Array(arguments.length);
for (var i = 0; i < args.length; i++) {
args[i] = arguments[i];
}
var ret = fn.apply(this, args);
var cb2 = args[args.length - 1];
if (typeof ret === "function" && ret !== cb2) {
Object.keys(cb2).forEach(function(k) {
ret[k] = cb2[k];
});
}
return ret;
}
}
return wrappy_1;
}
var hasRequiredOnce;
function requireOnce() {
if (hasRequiredOnce) return once.exports;
hasRequiredOnce = 1;
var wrappy = requireWrappy();
once.exports = wrappy(once$1);
once.exports.strict = wrappy(onceStrict);
once$1.proto = once$1(function() {
Object.defineProperty(Function.prototype, "once", {
value: function() {
return once$1(this);
},
configurable: true
});
Object.defineProperty(Function.prototype, "onceStrict", {
value: function() {
return onceStrict(this);
},
configurable: true
});
});
function once$1(fn) {
var f = function() {
if (f.called) return f.value;
f.called = true;
return f.value = fn.apply(this, arguments);
};
f.called = false;
return f;
}
function onceStrict(fn) {
var f = function() {
if (f.called)
throw new Error(f.onceError);
f.called = true;
return f.value = fn.apply(this, arguments);
};
var name = fn.name || "Function wrapped with `once`";
f.onceError = name + " shouldn't be called more than once";
f.called = false;
return f;
}
return once.exports;
}
var onceExports = requireOnce();
const _0x32e5ff = /* @__PURE__ */ getDefaultExportFromCjs(onceExports);
/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
var queueMicrotask_1;
var hasRequiredQueueMicrotask;
function requireQueueMicrotask() {
if (hasRequiredQueueMicrotask) return queueMicrotask_1;
hasRequiredQueueMicrotask = 1;
let promise;
queueMicrotask_1 = typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : commonjsGlobal) : (cb) => (promise || (promise = Promise.resolve())).then(cb).catch((err) => setTimeout(() => {
throw err;
}, 0));
return queueMicrotask_1;
}
/*! run-parallel. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
var runParallel_1;
var hasRequiredRunParallel;
function requireRunParallel() {
if (hasRequiredRunParallel) return runParallel_1;
hasRequiredRunParallel = 1;
runParallel_1 = runParallel;
const queueMicrotask2 = requireQueueMicrotask();
function runParallel(tasks, cb) {
let results, pending, keys;
let isSync = true;
if (Array.isArray(tasks)) {
results = [];
pending = tasks.length;
} else {
keys = Object.keys(tasks);
results = {};
pending = keys.length;
}
function done(err) {
function end() {
if (cb) cb(err, results);
cb = null;
}
if (isSync) queueMicrotask2(end);
else end();
}
function each(i, err, result) {
results[i] = result;
if (--pending === 0 || err) {
done(err);
}
}
if (!pending) {
done(null);
} else if (keys) {
keys.forEach(function(key) {
tasks[key](function(err, result) {
each(key, err, result);
});
});
} else {
tasks.forEach(function(task, i) {
task(function(err, result) {
each(i, err, result);
});
});
}
isSync = false;
}
return runParallel_1;
}
var runParallelExports = requireRunParallel();
const _0x2e9e5b = /* @__PURE__ */ getDefaultExportFromCjs(runParallelExports);
const scope$1 = typeof window !== "undefined" ? window : self;
const RTCPeerConnection = scope$1.RTCPeerConnection || scope$1.mozRTCPeerConnection || scope$1.webkitRTCPeerConnection;
const RTCSessionDescription = scope$1.RTCSessionDescription || scope$1.mozRTCSessionDescription || scope$1.webkitRTCSessionDescription;
const RTCIceCandidate = scope$1.RTCIceCandidate || scope$1.mozRTCIceCandidate || scope$1.webkitRTCIceCandidate;
var fixedSize;
var hasRequiredFixedSize;
function requireFixedSize() {
if (hasRequiredFixedSize) return fixedSize;
hasRequiredFixedSize = 1;
fixedSize = class FixedFIFO {
constructor(hwm) {
if (!(hwm > 0) || (hwm - 1 & hwm) !== 0) throw new Error("Max size for a FixedFIFO should be a power of two");
this.buffer = new Array(hwm);
this.mask = hwm - 1;
this.top = 0;
this.btm = 0;
this.next = null;
}
clear() {
this.top = this.btm = 0;
this.next = null;
this.buffer.fill(void 0);
}
push(data) {
if (this.buffer[this.top] !== void 0) return false;
this.buffer[this.top] = data;
this.top = this.top + 1 & this.mask;
return true;
}
shift() {
const last = this.buffer[this.btm];
if (last === void 0) return void 0;
this.buffer[this.btm] = void 0;
this.btm = this.btm + 1 & this.mask;
return last;
}
peek() {
return this.buffer[this.btm];
}
isEmpty() {
return this.buffer[this.btm] === void 0;
}
};
return fixedSize;
}
var fastFifo;
var hasRequiredFastFifo;
function requireFastFifo() {
if (hasRequiredFastFifo) return fastFifo;
hasRequiredFastFifo = 1;
const FixedFIFO = requireFixedSize();
fastFifo = class FastFIFO {
constructor(hwm) {
this.hwm = hwm || 16;
this.head = new FixedFIFO(this.hwm);
this.tail = this.head;
this.length = 0;
}
clear() {
this.head = this.tail;
this.head.clear();
this.length = 0;
}
push(val) {
this.length++;
if (!this.head.push(val)) {
const prev = this.head;
this.head = prev.next = new FixedFIFO(2 * this.head.buffer.length);
this.head.push(val);
}
}
shift() {
if (this.length !== 0) this.length--;
const val = this.tail.shift();
if (val === void 0 && this.tail.next) {
const next = this.tail.next;
this.tail.next = null;
this.tail = next;
return this.tail.shift();
}
return val;
}
peek() {
const val = this.tail.peek();
if (val === void 0 && this.tail.next) return this.tail.next.peek();
return val;
}
isEmpty() {
return this.length === 0;
}
};
return fastFifo;
}
var browserDecoder;
var hasRequiredBrowserDecoder;
function requireBrowserDecoder() {
if (hasRequiredBrowserDecoder) return browserDecoder;
hasRequiredBrowserDecoder = 1;
browserDecoder = class BrowserDecoder {
constructor(encoding) {
this.decoder = new TextDecoder(encoding === "utf16le" ? "utf16-le" : encoding);
}
get remaining() {
return -1;
}
decode(data) {
return this.decoder.decode(data, { stream: true });
}
flush() {
return this.decoder.decode(new Uint8Array(0));
}
};
return browserDecoder;
}
var textDecoder;
var hasRequiredTextDecoder;
function requireTextDecoder() {
if (hasRequiredTextDecoder) return textDecoder;
hasRequiredTextDecoder = 1;
const PassThroughDecoder = requireBrowserDecoder();
const UTF8Decoder = requireBrowserDecoder();
textDecoder = class TextDecoder {
constructor(encoding = "utf8") {
this.encoding = normalizeEncoding(encoding);
switch (this.encoding) {
case "utf8":
this.decoder = new UTF8Decoder();
break;
case "utf16le":
case "base64":
throw new Error("Unsupported encoding: " + this.encoding);
default:
this.decoder = new PassThroughDecoder(this.encoding);
}
}
get remaining() {
return this.decoder.remaining;
}
push(data) {
if (typeof data === "string") return data;
return this.decoder.decode(data);
}
// For Node.js compatibility
write(data) {
return this.push(data);
}
end(data) {
let result = "";
if (data) result = this.push(data);
result += this.decoder.flush();
return result;
}
};
function normalizeEncoding(encoding) {
encoding = encoding.toLowerCase();
switch (encoding) {
case "utf8":
case "utf-8":
return "utf8";
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return "utf16le";
case "latin1":
case "binary":
return "latin1";
case "base64":
case "ascii":
case "hex":
return encoding;
default:
throw new Error("Unknown encoding: " + encoding);
}
}
return textDecoder;
}
var streamx;
var hasRequiredStreamx;
function requireStreamx() {
if (hasRequiredStreamx) return streamx;
hasRequiredStreamx = 1;
const { EventEmitter: EventEmitter2 } = requireEventemitter3();
const STREAM_DESTROYED = new Error("Stream was destroyed");
const PREMATURE_CLOSE = new Error("Premature close");
const FIFO = requireFastFifo();
const TextDecoder2 = requireTextDecoder();
const MAX = (1 << 29) - 1;
const OPENING = 1;
const PREDESTROYING = 2;
const DESTROYING = 4;
const DESTROYED = 8;
const NOT_OPENING = MAX ^ OPENING;
const NOT_PREDESTROYING = MAX ^ PREDESTROYING;
const READ_ACTIVE = 1 << 4;
const READ_UPDATING = 2 << 4;
const READ_PRIMARY = 4 << 4;
const READ_QUEUED = 8 << 4;
const READ_RESUMED = 16 << 4;
const READ_PIPE_DRAINED = 32 << 4;
const READ_ENDING = 64 << 4;
const READ_EMIT_DATA = 128 << 4;
const READ_EMIT_READABLE = 256 << 4;
const READ_EMITTED_READABLE = 512 << 4;
const READ_DONE = 1024 << 4;
const READ_NEXT_TICK = 2048 << 4;
const READ_NEEDS_PUSH = 4096 << 4;
const READ_READ_AHEAD = 8192 << 4;
const READ_FLOWING = READ_RESUMED | READ_PIPE_DRAINED;
const READ_ACTIVE_AND_NEEDS_PUSH = READ_ACTIVE | READ_NEEDS_PUSH;
const READ_PRIMARY_AND_ACTIVE = READ_PRIMARY | READ_ACTIVE;
const READ_EMIT_READABLE_AND_QUEUED = READ_EMIT_READABLE | READ_QUEUED;
const READ_RESUMED_READ_AHEAD = READ_RESUMED | READ_READ_AHEAD;
const READ_NOT_ACTIVE = MAX ^ READ_ACTIVE;
const READ_NON_PRIMARY = MAX ^ READ_PRIMARY;
const READ_NON_PRIMARY_AND_PUSHED = MAX ^ (READ_PRIMARY | READ_NEEDS_PUSH);
const READ_PUSHED = MAX ^ READ_NEEDS_PUSH;
const READ_PAUSED = MAX ^ READ_RESUMED;
const READ_NOT_QUEUED = MAX ^ (READ_QUEUED | READ_EMITTED_READABLE);
const READ_NOT_ENDING = MAX ^ READ_ENDING;
const READ_PIPE_NOT_DRAINED = MAX ^ READ_FLOWING;
const READ_NOT_NEXT_TICK = MAX ^ READ_NEXT_TICK;
const READ_NOT_UPDATING = MAX ^ READ_UPDATING;
const READ_NO_READ_AHEAD = MAX ^ READ_READ_AHEAD;
const READ_PAUSED_NO_READ_AHEAD = MAX ^ READ_RESUMED_READ_AHEAD;
const WRITE_ACTIVE = 1 << 18;
const WRITE_UPDATING = 2 << 18;
const WRITE_PRIMARY = 4 << 18;
const WRITE_QUEUED = 8 << 18;
const WRITE_UNDRAINED = 16 << 18;
const WRITE_DONE = 32 << 18;
const WRITE_EMIT_DRAIN = 64 << 18;
const WRITE_NEXT_TICK = 128 << 18;
const WRITE_WRITING = 256 << 18;
const WRITE_FINISHING = 512 << 18;
const WRITE_CORKED = 1024 << 18;
const WRITE_NOT_ACTIVE = MAX ^ (WRITE_ACTIVE | WRITE_WRITING);
const WRITE_NON_PRIMARY = MAX ^ WRITE_PRIMARY;
const WRITE_NOT_FINISHING = MAX ^ (WRITE_ACTIVE | WRITE_FINISHING);
const WRITE_DRAINED = MAX ^ WRITE_UNDRAINED;
const WRITE_NOT_QUEUED = MAX ^ WRITE_QUEUED;
const WRITE_NOT_NEXT_TICK = MAX ^ WRITE_NEXT_TICK;
const WRITE_NOT_UPDATING = MAX ^ WRITE_UPDATING;
const WRITE_NOT_CORKED = MAX ^ WRITE_CORKED;
const ACTIVE = READ_ACTIVE | WRITE_ACTIVE;
const NOT_ACTIVE = MAX ^ ACTIVE;
const DONE = READ_DONE | WRITE_DONE;
const DESTROY_STATUS = DESTROYING | DESTROYED | PREDESTROYING;
const OPEN_STATUS = DESTROY_STATUS | OPENING;
const AUTO_DESTROY = DESTROY_STATUS | DONE;
const NON_PRIMARY = WRITE_NON_PRIMARY & READ_NON_PRIMARY;
const ACTIVE_OR_TICKING = WRITE_NEXT_TICK | READ_NEXT_TICK;
const TICKING = ACTIVE_OR_TICKING & NOT_ACTIVE;
const IS_OPENING = OPEN_STATUS | TICKING;
const READ_PRIMARY_STATUS = OPEN_STATUS | READ_ENDING | READ_DONE;
const READ_STATUS = OPEN_STATUS | READ_DONE | READ_QUEUED;
const READ_ENDING_STATUS = OPEN_STATUS | READ_ENDING | READ_QUEUED;
const READ_READABLE_STATUS = OPEN_STATUS | READ_EMIT_READABLE | READ_QUEUED | READ_EMITTED_READABLE;
const SHOULD_NOT_READ = OPEN_STATUS | READ_ACTIVE | READ_ENDING | READ_DONE | READ_NEEDS_PUSH | READ_READ_AHEAD;
const READ_BACKPRESSURE_STATUS = DESTROY_STATUS | READ_ENDING | READ_DONE;
const READ_UPDATE_SYNC_STATUS = READ_UPDATING | OPEN_STATUS | READ_NEXT_TICK | READ_PRIMARY;
const READ_NEXT_TICK_OR_OPENING = READ_NEXT_TICK | OPENING;
const WRITE_PRIMARY_STATUS = OPEN_STATUS | WRITE_FINISHING | WRITE_DONE;
const WRITE_QUEUED_AND_UNDRAINED = WRITE_QUEUED | WRITE_UNDRAINED;
const WRITE_QUEUED_AND_ACTIVE = WRITE_QUEUED | WRITE_ACTIVE;
const WRITE_DRAIN_STATUS = WRITE_QUEUED | WRITE_UNDRAINED | OPEN_STATUS | WRITE_ACTIVE;
const WRITE_STATUS = OPEN_STATUS | WRITE_ACTIVE | WRITE_QUEUED | WRITE_CORKED;
const WRITE_PRIMARY_AND_ACTIVE = WRITE_PRIMARY | WRITE_ACTIVE;
const WRITE_ACTIVE_AND_WRITING = WRITE_ACTIVE | WRITE_WRITING;
const WRITE_FINISHING_STATUS = OPEN_STATUS | WRITE_FINISHING | WRITE_QUEUED_AND_ACTIVE | WRITE_DONE;
const WRITE_BACKPRESSURE_STATUS = WRITE_UNDRAINED | DESTROY_STATUS | WRITE_FINISHING | WRITE_DONE;
const WRITE_UPDATE_SYNC_STATUS = WRITE_UPDATING | OPEN_STATUS | WRITE_NEXT_TICK | WRITE_PRIMARY;
const WRITE_DROP_DATA = WRITE_FINISHING | WRITE_DONE | DESTROY_STATUS;
const asyncIterator = Symbol.asyncIterator || Symbol("asyncIterator");
class WritableState {
constructor(stream, { highWaterMark = 16384, map = null, mapWritable, byteLength, byteLengthWritable } = {}) {
this.stream = stream;
this.queue = new FIFO();
this.highWaterMark = highWaterMark;
this.buffered = 0;
this.error = null;
this.pipeline = null;
this.drains = null;
this.byteLength = byteLengthWritable || byteLength || defaultByteLength;
this.map = mapWritable || map;
this.afterWrite = afterWrite.bind(this);
this.afterUpdateNextTick = updateWriteNT.bind(this);
}
get ended() {
return (this.stream._duplexState & WRITE_DONE) !== 0;
}
push(data) {
if ((this.stream._duplexState & WRITE_DROP_DATA) !== 0) return false;
if (this.map !== null) data = this.map(data);
this.buffered += this.byteLength(data);
this.queue.push(data);
if (this.buffered < this.highWaterMark) {
this.stream._duplexState |= WRITE_QUEUED;
return true;
}
this.stream._duplexState |= WRITE_QUEUED_AND_UNDRAINED;
return false;
}
shift() {
const data = this.queue.shift();
this.buffered -= this.byteLength(data);
if (this.buffered === 0) this.stream._duplexState &= WRITE_NOT_QUEUED;
return data;
}
end(data) {
if (typeof data === "function") this.stream.once("finish", data);
else if (data !== void 0 && data !== null) this.push(data);
this.stream._duplexState = (this.stream._duplexState | WRITE_FINISHING) & WRITE_NON_PRIMARY;
}
autoBatch(data, cb) {
const buffer = [];
const stream = this.stream;
buffer.push(data);
while ((stream._duplexState & WRITE_STATUS) === WRITE_QUEUED_AND_ACTIVE) {
buffer.push(stream._writableState.shift());
}
if ((stream._duplexState & OPEN_STATUS) !== 0) return cb(null);
stream._writev(buffer, cb);
}
update() {
const stream = this.stream;
stream._duplexState |= WRITE_UPDATING;
do {
while ((stream._duplexState & WRITE_STATUS) === WRITE_QUEUED) {
const data = this.shift();
stream._duplexState |= WRITE_ACTIVE_AND_WRITING;
stream._write(data, this.afterWrite);
}
if ((stream._duplexState & WRITE_PRIMARY_AND_ACTIVE) === 0) this.updateNonPrimary();
} while (this.continueUpdate() === true);
stream._duplexState &= WRITE_NOT_UPDATING;
}
updateNonPrimary() {
const stream = this.stream;
if ((stream._duplexState & WRITE_FINISHING_STATUS) === WRITE_FINISHING) {
stream._duplexState = stream._duplexState | WRITE_ACTIVE;
stream._final(afterFinal.bind(this));
return;
}
if ((stream._duplexState & DESTROY_STATUS) === DESTROYING) {
if ((stream._duplexState & ACTIVE_OR_TICKING) === 0) {
stream._duplexState |= ACTIVE;
stream._destroy(afterDestroy.bind(this));
}
return;
}
if ((stream._duplexState & IS_OPENING) === OPENING) {
stream._duplexState = (stream._duplexState | ACTIVE) & NOT_OPENING;
stream._open(afterOpen.bind(this));
}
}
continueUpdate() {
if ((this.stream._duplexState & WRITE_NEXT_TICK) === 0) return false;
this.stream._duplexState &= WRITE_NOT_NEXT_TICK;
return true;
}
updateCallback() {
if ((this.stream._duplexState & WRITE_UPDATE_SYNC_STATUS) === WRITE_PRIMARY) this.update();
else this.updateNextTick();
}
updateNextTick() {
if ((this.stream._duplexState & WRITE_NEXT_TICK) !== 0) return;
this.stream._duplexState |= WRITE_NEXT_TICK;
if ((this.stream._duplexState & WRITE_UPDATING) === 0) queueMicrotask(this.afterUpdateNextTick);
}
}
class ReadableState {
constructor(stream, { highWaterMark = 16384, map = null, mapReadable, byteLength, byteLengthReadable } = {}) {
this.stream = stream;
this.queue = new FIFO();
this.highWaterMark = highWaterMark === 0 ? 1 : highWaterMark;
this.buffered = 0;
this.readAhead = highWaterMark > 0;
this.error = null;
this.pipeline = null;
this.byteLength = byteLengthReadable || byteLength || defaultByteLength;
this.map = mapReadable || map;
this.pipeTo = null;
this.afterRead = afterRead.bind(this);
this.afterUpdateNextTick = updateReadNT.bind(this);
}
get ended() {
return (this.stream._duplexState & READ_DONE) !== 0;
}
pipe(pipeTo, cb) {
if (this.pipeTo !== null) throw new Error("Can only pipe to one destination");
if (typeof cb !== "function") cb = null;
this.stream._duplexState |= READ_PIPE_DRAINED;
this.pipeTo = pipeTo;
this.pipeline = new Pipeline(this.stream, pipeTo, cb);
if (cb) this.stream.on("error", noop2);
if (isStreamx(pipeTo)) {
pipeTo._writableState.pipeline = this.pipeline;
if (cb) pipeTo.on("error", noop2);
pipeTo.on("finish", this.pipeline.finished.bind(this.pipeline));
} else {
const onerror = this.pipeline.done.bind(this.pipeline, pipeTo);
const onclose = this.pipeline.done.bind(this.pipeline, pipeTo, null);
pipeTo.on("error", onerror);
pipeTo.on("close", onclose);
pipeTo.on("finish", this.pipeline.finished.bind(this.pipeline));
}
pipeTo.on("drain", afterDrain.bind(this));
this.stream.emit("piping", pipeTo);
pipeTo.emit("pipe", this.stream);
}
push(data) {
const stream = this.stream;
if (data === null) {
this.highWaterMark = 0;
stream._duplexState = (stream._duplexState | READ_ENDING) & READ_NON_PRIMARY_AND_PUSHED;
return false;
}
if (this.map !== null) {
data = this.map(data);
if (data === null) {
stream._duplexState &= READ_PUSHED;
return this.buffered < this.highWaterMark;
}
}
this.buffered += this.byteLength(data);
this.queue.push(data);
stream._duplexState = (stream._duplexState | READ_QUEUED) & READ_PUSHED;
return this.buffered < this.highWaterMark;
}
shift() {
const data = this.queue.shift();
this.buffered -= this.byteLength(data);
if (this.buffered === 0) this.stream._duplexState &= READ_NOT_QUEUED;
return data;
}
unshift(data) {
const pending = [this.map !== null ? this.map(data) : data];
while (this.buffered > 0) pending.push(this.shift());
for (let i = 0; i < pending.length - 1; i++) {
const data2 = pending[i];
this.buffered += this.byteLength(data2);
this.queue.push(data2);
}
this.push(pending[pending.length - 1]);
}
read() {
const stream = this.stream;
if ((stream._duplexState & READ_STATUS) === READ_QUEUED) {
const data = this.shift();
if (this.pipeTo !== null && this.pipeTo.write(data) === false) stream._duplexState &= READ_PIPE_NOT_DRAINED;
if ((stream._duplexState & READ_EMIT_DATA) !== 0) stream.emit("data", data);
return data;
}
if (this.readAhead === false) {
stream._duplexState |= READ_READ_AHEAD;
this.updateNextTick();
}
return null;
}
drain() {
const stream = this.stream;
while ((stream._duplexState & READ_STATUS) === READ_QUEUED && (stream._duplexState & READ_FLOWING) !== 0) {
const data = this.shift();
if (this.pipeTo !== null && this.pipeTo.write(data) === false) stream._duplexState &= READ_PIPE_NOT_DRAINED;
if ((stream._duplexState & READ_EMIT_DATA) !== 0) stream.emit("data", data);
}
}
update() {
const stream = this.stream;
stream._duplexState |= READ_UPDATING;
do {
this.drain();
while (this.buffered < this.highWaterMark && (stream._duplexState & SHOULD_NOT_READ) === READ_READ_AHEAD) {
stream._duplexState |= READ_ACTIVE_AND_NEEDS_PUSH;
stream._read(this.afterRead);
this.drain();
}
if ((stream._duplexState & READ_READABLE_STATUS) === READ_EMIT_READABLE_AND_QUEUED) {
stream._duplexState |= READ_EMITTED_READABLE;
stream.emit("readable");
}
if ((stream._duplexState & READ_PRIMARY_AND_ACTIVE) === 0) this.updateNonPrimary();
} while (this.continueUpdate() === true);
stream._duplexState &= READ_NOT_UPDATING;
}
updateNonPrimary() {
const stream = this.stream;
if ((stream._duplexState & READ_ENDING_STATUS) === READ_ENDING) {
stream._duplexState = (stream._duplexState | READ_DONE) & READ_NOT_ENDING;
stream.emit("end");
if ((stream._duplexState & AUTO_DESTROY) === DONE) stream._duplexState |= DESTROYING;
if (this.pipeTo !== null) this.pipeTo.end();
}
if ((stream._duplexState & DESTROY_STATUS) === DESTROYING) {
if ((stream._duplexState & ACTIVE_OR_TICKING) === 0) {
stream._duplexState |= ACTIVE;
stream._destroy(afterDestroy.bind(this));
}
return;
}
if ((stream._duplexState & IS_OPENING) === OPENING) {
stream._duplexState = (stream._duplexState | ACTIVE) & NOT_OPENING;
stream._open(afterOpen.bind(this));
}
}
continueUpdate() {
if ((this.stream._duplexState & READ_NEXT_TICK) === 0) return false;
this.stream._duplexState &= READ_NOT_NEXT_TICK;
return true;
}
updateCallback() {
if ((this.stream._duplexState & READ_UPDATE_SYNC_STATUS) === READ_PRIMARY) this.update();
else this.updateNextTick();
}
updateNextTickIfOpen() {
if ((this.stream._duplexState & READ_NEXT_TICK_OR_OPENING) !== 0) return;
this.stream._duplexState |= READ_NEXT_TICK;
if ((this.stream._duplexState & READ_UPDATING) === 0) queueMicrotask(this.afterUpdateNextTick);
}
updateNextTick() {
if ((this.stream._duplexState & READ_NEXT_TICK) !== 0) return;
this.stream._duplexState |= READ_NEXT_TICK;
if ((this.stream._duplexState & READ_UPDATING) === 0) queueMicrotask(this.afterUpdateNextTick);
}
}
class TransformState {
constructor(stream) {
this.data = null;
this.afterTransform = afterTransform.bind(stream);
this.afterFinal = null;
}
}
class Pipeline {
constructor(src, dst, cb) {
this.from = src;
this.to = dst;
this.afterPipe = cb;
this.error = null;
this.pipeToFinished = false;
}
finished() {
this.pipeToFinished = true;
}
done(stream, err) {
if (err) this.error = err;
if (stream === this.to) {
this.to = null;
if (this.from !== null) {
if ((this.from._duplexState & READ_DONE) === 0 || !this.pipeToFinished) {
this.from.destroy(this.error || new Error("Writable stream closed prematurely"));
}
return;
}
}
if (stream === this.from) {
this.from = null;
if (this.to !== null) {
if ((stream._duplexState & READ_DONE) === 0) {
this.to.destroy(this.error || new Error("Readable stream closed before ending"));
}
return;
}
}
if (this.afterPipe !== null) this.afterPipe(this.error);
this.to = this.from = this.afterPipe = null;
}
}
function afterDrain() {
this.stream._duplexState |= READ_PIPE_DRAINED;
this.updateCallback();
}
function afterFinal(err) {
const stream = this.stream;
if (err) stream.destroy(err);
if ((stream._duplexState & DESTROY_STATUS) === 0) {
stream._duplexState |= WRITE_DONE;
stream.emit("finish");
}
if ((stream._duplexState & AUTO_DESTROY) === DONE) {
stream._duplexState |= DESTROYING;
}
stream._duplexState &= WRITE_NOT_FINISHING;
if ((stream._duplexState & WRITE_UPDATING) === 0) this.update();
else this.updateNextTick();
}
function afterDestroy(err) {
const stream = this.stream;
if (!err && this.error !== STREAM_DESTROYED) err = this.error;
if (err) stream.emit("error", err);
stream._duplexState |= DESTROYED;
stream.emit("close");
const rs = stream._readableState;
const ws2 = stream._writableState;
if (rs !== null && rs.pipeline !== null) rs.pipeline.done(stream, err);
if (ws2 !== null) {
while (ws2.drains !== null && ws2.drains.length > 0) ws2.drains.shift().resolve(false);
if (ws2.pipeline !== null) ws2.pipeline.done(stream, err);
}
}
function afterWrite(err) {
const stream = this.stream;
if (err) stream.destroy(err);
stream._duplexState &= WRITE_NOT_ACTIVE;
if (this.drains !== null) tickDrains(this.drains);
if ((stream._duplexState & WRITE_DRAIN_STATUS) === WRITE_UNDRAINED) {
stream._duplexState &= WRITE_DRAINED;
if ((stream._duplexState & WRITE_EMIT_DRAIN) === WRITE_EMIT_DRAIN) {
stream.emit("drain");
}
}
this.updateCallback();
}
function afterRead(err) {
if (err) this.stream.destroy(err);
this.stream._duplexState &= READ_NOT_ACTIVE;
if (this.readAhead === false && (this.stream._duplexState & READ_RESUMED) === 0) this.stream._duplexState &= READ_NO_READ_AHEAD;
this.updateCallback();
}
function updateReadNT() {
if ((this.stream._duplexState & READ_UPDATING) === 0) {
this.stream._duplexState &= READ_NOT_NEXT_TICK;
this.update();
}
}
function updateWriteNT() {
if ((this.stream._duplexState & WRITE_UPDATING) === 0) {
this.stream._duplexState &= WRITE_NOT_NEXT_TICK;
this.update();
}
}
function tickDrains(drains) {
for (let i = 0; i < drains.length; i++) {
if (--drains[i].writes === 0) {
drains.shift().resolve(true);
i--;
}
}
}
function afterOpen(err) {
const stream = this.stream;
if (err) stream.destroy(err);
if ((stream._duplexState & DESTROYING) === 0) {
if ((stream._duplexState & READ_PRIMARY_STATUS) === 0) stream._duplexState |= READ_PRIMARY;
if ((stream._duplexState & WRITE_PRIMARY_STATUS) === 0) stream._duplexState |= WRITE_PRIMARY;
stream.emit("open");
}
stream._duplexState &= NOT_ACTIVE;
if (stream._writableState !== null) {
stream._writableState.updateCallback();
}
if (stream._readableState !== null) {
stream._readableState.updateCallback();
}
}
function afterTransform(err, data) {
if (data !== void 0 && data !== null) this.push(data);
this._writableState.afterWrite(err);
}
function newListener(name) {
if (this._readableState !== null) {
if (name === "data") {
this._duplexState |= READ_EMIT_DATA | READ_RESUMED_READ_AHEAD;
this._readableState.updateNextTick();
}
if (name === "readable") {
this._duplexState |= READ_EMIT_READABLE;
this._readableState.updateNextTick();
}
}
if (this._writableState !== null) {
if (name === "drain") {
this._duplexState |= WRITE_EMIT_DRAIN;
this._writableState.updateNextTick();
}
}
}
class Stream extends EventEmitter2 {
constructor(opts) {
super();
this._duplexState = 0;
this._readableState = null;
this._writableState = null;
if (opts) {
if (opts.open) this._open = opts.open;
if (opts.destroy) this._destroy = opts.destroy;
if (opts.predestroy) this._predestroy = opts.predestroy;
if (opts.signal) {
opts.signal.addEventListener("abort", abort.bind(this));
}
}
this.on("newListener", newListener);
}
_open(cb) {
cb(null);
}
_destroy(cb) {
cb(null);
}
_predestroy() {
}
get readable() {
return this._readableState !== null ? true : void 0;
}
get writable() {
return this._writableState !== null ? true : void 0;
}
get destroyed() {
return (this._duplexState & DESTROYED) !== 0;
}
get destroying() {
return (this._duplexState & DESTROY_STATUS) !== 0;
}
destroy(err) {
if ((this._duplexState & DESTROY_STATUS) === 0) {
if (!err) err = STREAM_DESTROYED;
this._duplexState = (this._duplexState | DESTROYING) & NON_PRIMARY;
if (this._readableState !== null) {
this._readableState.highWaterMark = 0;
this._readableState.error = err;
}
if (this._writableState !== null) {
this._writableState.highWaterMark = 0;
this._writableState.error = err;
}
this._duplexState |= PREDESTROYING;
this._predestroy();
this._duplexState &= NOT_PREDESTROYING;
if (this._readableState !== null) this._readableState.updateNextTick();
if (this._writableState !== null) this._writableState.updateNextTick();
}
}
}
class Readable extends Stream {
constructor(opts) {
super(opts);
this._duplexState |= OPENING | WRITE_DONE | READ_READ_AHEAD;
this._readableState = new ReadableState(this, opts);
if (opts) {
if (this._readableState.readAhead === false) this._duplexState &= READ_NO_READ_AHEAD;
if (opts.read) this._read = opts.read;
if (opts.eagerOpen) this._readableState.updateNextTick();
if (opts.encoding) this.setEncoding(opts.encoding);
}
}
setEncoding(encoding) {
const dec = new TextDecoder2(encoding);
const map = this._readableState.map || echo;
this._readableState.map = mapOrSkip;
return this;
function mapOrSkip(data) {
const next = dec.push(data);
return next === "" && (data.byteLength !== 0 || dec.remaining > 0) ? null : map(next);
}
}
_read(cb) {
cb(null);
}
pipe(dest, cb) {
this._readableState.updateNextTick();
this._readableState.pipe(dest, cb);
return dest;
}
read() {
this._readableState.updateNextTick();
return this._readableState.read();
}
push(data) {
this._readableState.updateNextTickIfOpen();
return this._readableState.push(data);
}
unshift(data) {
this._readableState.updateNextTickIfOpen();
return this._readableState.unshift(data);
}
resume() {
this._duplexState |= READ_RESUMED_READ_AHEAD;
this._readableState.updateNextTick();
return this;
}
pause() {
this._duplexState &= this._readableState.readAhead === false ? READ_PAUSED_NO_READ_AHEAD : READ_PAUSED;
return this;
}
static _fromAsyncIterator(ite, opts) {
let destroy;
const rs = new Readable({
...opts,
read(cb) {
ite.next().then(push).then(cb.bind(null, null)).catch(cb);
},
predestroy() {
destroy = ite.return();
},
destroy(cb) {
if (!destroy) return cb(null);
destroy.then(cb.bind(null, null)).catch(cb);
}
});
return rs;
function push(data) {
if (data.done) rs.push(null);
else rs.push(data.value);
}
}
static from(data, opts) {
if (isReadStreamx(data)) return data;
if (data[asyncIterator]) return this._fromAsyncIterator(data[asyncIterator](), opts);
if (!Array.isArray(data)) data = data === void 0 ? [] : [data];
let i = 0;
return new Readable({
...opts,
read(cb) {
this.push(i === data.length ? null : data[i++]);
cb(null);
}
});
}
static isBackpressured(rs) {
return (rs._duplexState & READ_BACKPRESSURE_STATUS) !== 0 || rs._readableState.buffered >= rs._readableState.highWaterMark;
}
static isPaused(rs) {
return (rs._duplexState & READ_RESUMED) === 0;
}
[asyncIterator]() {
const stream = this;
let error = null;
let promiseResolve = null;
let promiseReject = null;
this.on("error", (err) => {
error = err;
});
this.on("readable", onreadable);
this.on("close", onclose);
return {
[asyncIterator]() {
return this;
},
next() {
return new Promise(function(resolve, reject) {
promiseResolve = resolve;
promiseReject = reject;
const data = stream.read();
if (data !== null) ondata(data);
else if ((stream._duplexState & DESTROYED) !== 0) ondata(null);
});
},
return() {
return destroy(null);
},
throw(err) {
return destroy(err);
}
};
function onreadable() {
if (promiseResolve !== null) ondata(stream.read());
}
function onclose() {
if (promiseResolve !== null) ondata(null);
}
function ondata(data) {
if (promiseReject === null) return;
if (error) promiseReject(error);
else if (data === null && (stream._duplexState & READ_DONE) === 0) promiseReject(STREAM_DESTROYED);
else promiseResolve({ value: data, done: data === null });
promiseReject = promiseResolve = null;
}
function destroy(err) {
stream.destroy(err);
return new Promise((resolve, reject) => {
if (stream._duplexState & DESTROYED) return resolve({ value: void 0, done: true });
stream.once("close", function() {
if (err) reject(err);
else resolve({ value: void 0, done: true });
});
});
}
}
}
class Writable extends Stream {
constructor(opts) {
super(opts);
this._duplexState |= OPENING | READ_DONE;
this._writableState = new WritableState(this, opts);
if (opts) {
if (opts.writev) this._writev = opts.writev;
if (opts.write) this._write = opts.write;
if (opts.final) this._final = opts.final;
if (opts.eagerOpen) this._writableState.updateNextTick();
}
}
cork() {
this._duplexState |= WRITE_CORKED;
}
uncork() {
this._duplexState &= WRITE_NOT_CORKED;
this._writableState.updateNextTick();
}
_writev(batch, cb) {
cb(null);
}
_write(data, cb) {
this._writableState.autoBatch(data, cb);
}
_final(cb) {
cb(null);
}
static isBackpressured(ws2) {
return (ws2._duplexState & WRITE_BACKPRESSURE_STATUS) !== 0;
}
static drained(ws2) {
if (ws2.destroyed) return Promise.resolve(false);
const state = ws2._writableState;
const pending = isWritev(ws2) ? Math.min(1, state.queue.length) : state.queue.length;
const writes = pending + (ws2._duplexState & WRITE_WRITING ? 1 : 0);
if (writes === 0) return Promise.resolve(true);
if (state.drains === null) state.drains = [];
return new Promise((resolve) => {
state.drains.push({ writes, resolve });
});
}
write(data) {
this._writableState.updateNextTick();
return this._writableState.push(data);
}
end(data) {
this._writableState.updateNextTick();
this._writableState.end(data);
return this;
}
}
class Duplex extends Readable {
// and Writable
constructor(opts) {
super(opts);
this._duplexState = OPENING | this._duplexState & READ_READ_AHEAD;
this._writableState = new WritableState(this, opts);
if (opts) {
if (opts.writev) this._writev = opts.writev;
if (opts.write) this._write = opts.write;
if (opts.final) this._final = opts.final;
}
}
cork() {
this._duplexState |= WRITE_CORKED;
}
uncork() {
this._duplexState &= WRITE_NOT_CORKED;
this._writableState.updateNextTick();
}
_writev(batch, cb) {
cb(null);
}
_write(data, cb) {
this._writableState.autoBatch(data, cb);
}
_final(cb) {
cb(null);
}
write(data) {
this._writableState.updateNextTick();
return this._writableState.push(data);
}
end(data) {
this._writableState.updateNextTick();
this._writableState.end(data);
return this;
}
}
class Transform extends Duplex {
constructor(opts) {
super(opts);
this._transformState = new TransformState(this);
if (opts) {
if (opts.transform) this._transform = opts.transform;
if (opts.flush) this._flush = opts.flush;
}
}
_write(data, cb) {
if (this._readableState.buffered >= this._readableState.highWaterMark) {
this._transformState.data = data;
} else {
this._transform(data, this._transformState.afterTransform);
}
}
_read(cb) {
if (this._transformState.data !== null) {
const data = this._transformState.data;
this._transformState.data = null;
cb(null);
this._transform(data, this._transformState.afterTransform);
} else {
cb(null);
}
}
destroy(err) {
super.destroy(err);
if (this._transformState.data !== null) {
this._transformState.data = null;
this._transformState.afterTransform();
}
}
_transform(data, cb) {
cb(null, data);
}
_flush(cb) {
cb(null);
}
_final(cb) {
this._transformState.afterFinal = cb;
this._flush(transformAfterFlush.bind(this));
}
}
class PassThrough extends Transform {
}
function transformAfterFlush(err, data) {
const cb = this._transformState.afterFinal;
if (err) return cb(err);
if (data !== null && data !== void 0) this.push(data);
this.push(null);
cb(null);
}
function pipelinePromise(...streams) {
return new Promise((resolve, reject) => {
return pipeline(...streams, (err) => {
if (err) return reject(err);
resolve();
});
});
}
function pipeline(stream, ...streams) {
const all = Array.isArray(stream) ? [...stream, ...streams] : [stream, ...streams];
const done = all.length && typeof all[all.length - 1] === "function" ? all.pop() : null;
if (all.length < 2) throw new Error("Pipeline requires at least 2 streams");
let src = all[0];
let dest = null;
let error = null;
for (let i = 1; i < all.length; i++) {
dest = all[i];
if (isStreamx(src)) {
src.pipe(dest, onerror);
} else {
errorHandle(src, true, i > 1, onerror);
src.pipe(dest);
}
src = dest;
}
if (done) {
let fin = false;
const autoDestroy = isStreamx(dest) || !!(dest._writableState && dest._writableState.autoDestroy);
dest.on("error", (err) => {
if (error === null) error = err;
});
dest.on("finish", () => {
fin = true;
if (!autoDestroy) done(error);
});
if (autoDestroy) {
dest.on("close", () => done(error || (fin ? null : PREMATURE_CLOSE)));
}
}
return dest;
function errorHandle(s, rd, wr, onerror2) {
s.on("error", onerror2);
s.on("close", onclose);
function onclose() {
if (s._readableState && !s._readableState.ended) return onerror2(PREMATURE_CLOSE);
if (wr && s._writableState && !s._writableState.ended) return onerror2(PREMATURE_CLOSE);
}
}
function onerror(err) {
if (!err || error) return;
error = err;
for (const s of all) {
s.destroy(err);
}
}
}
function echo(s) {
return s;
}
function isStream(stream) {
return !!stream._readableState || !!stream._writableState;
}
function isStreamx(stream) {
return typeof stream._duplexState === "number" && isStream(stream);
}
function isEnded(stream) {
return !!stream._readableState && stream._readableState.ended;
}
function isFinished(stream) {
return !!stream._writableState && stream._writableState.ended;
}
function getStreamError(stream, opts = {}) {
const err = stream._readableState && stream._readableState.error || stream._writableState && stream._writableState.error;
return !opts.all && err === STREAM_DESTROYED ? null : err;
}
function isReadStreamx(stream) {
return isStreamx(stream) && stream.readable;
}
function isDisturbed(stream) {
return (stream._duplexState & OPENING) !== OPENING || (stream._duplexState & ACTIVE_OR_TICKING) !== 0;
}
function isTypedArray(data) {
return typeof data === "object" && data !== null && typeof data.byteLength === "number";
}
function defaultByteLength(data) {
return isTypedArray(data) ? data.byteLength : 1024;
}
function noop2() {
}
function abort() {
this.destroy(new Error("Stream aborted."));
}
function isWritev(s) {
return s._writev !== Writable.prototype._writev && s._writev !== Duplex.prototype._writev;
}
streamx = {
pipeline,
pipelinePromise,
isStream,
isStreamx,
isEnded,
isFinished,
isDisturbed,
getStreamError,
Stream,
Writable,
Readable,
Duplex,
Transform,
// Export PassThrough for compatibility with Node.js core's stream module
PassThrough
};
return streamx;
}
var streamxExports = requireStreamx();
var errCode$1;
var hasRequiredErrCode;
function requireErrCode() {
if (hasRequiredErrCode) return errCode$1;
hasRequiredErrCode = 1;
function assign(obj, props) {
for (const key in props) {
Object.defineProperty(obj, key, {
value: props[key],
enumerable: true,
configurable: true
});
}
return obj;
}
function createError(err, code, props) {
if (!err || typeof err === "string") {
throw new TypeError("Please pass an Error to err-code");
}
if (!props) {
props = {};
}
if (typeof code === "object") {
props = code;
code = "";
}
if (code) {
props.code = code;
}
try {
return assign(err, props);
} catch (_) {
props.message = err.message;
props.stack = err.stack;
const ErrClass = function() {
};
ErrClass.prototype = Object.create(Object.getPrototypeOf(err));
const output = assign(new ErrClass(), props);
return output;
}
}
errCode$1 = createError;
return errCode$1;
}
var errCodeExports = requireErrCode();
const errCode = /* @__PURE__ */ getDefaultExportFromCjs(errCodeExports);
/* Common package for dealing with hex/string/uint8 conversions (and sha1 hashing)
*
* @author Jimmy Wärting <jimmy@warting.se> (https://jimmy.warting.se/opensource)
* @license MIT
*/
const alphabet = "0123456789abcdef";
const encodeLookup = [];
const decodeLookup = [];
for (let i = 0; i < 256; i++) {
encodeLookup[i] = alphabet[i >> 4 & 15] + alphabet[i & 15];
if (i < 16) {
if (i < 10) {
decodeLookup[48 + i] = i;
} else {
decodeLookup[97 - 10 + i] = i;
}
}
}
const arr2hex = (data) => {
const length = data.length;
let string = "";
let i = 0;
while (i < length) {
string += encodeLookup[data[i++]];
}
return string;
};
const hex2arr = (str) => {
const sizeof = str.length >> 1;
const length = sizeof << 1;
const array = new Uint8Array(sizeof);
let n = 0;
let i = 0;
while (i < length) {
array[n++] = decodeLookup[str.charCodeAt(i++)] << 4 | decodeLookup[str.charCodeAt(i++)];
}
return array;
};
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
for (var i = 0; i < chars.length; i++) {
lookup[chars.charCodeAt(i)] = i;
}
const decoder = new TextDecoder();
const arr2text = (data, enc) => {
return decoder.decode(data);
};
const encoder = new TextEncoder();
const text2arr = (str) => encoder.encode(str);
const bin2hex = (str) => {
let res = "";
let c;
let i = 0;
const len = str.length;
while (i < len) {
c = str.charCodeAt(i++);
res += alphabet[c >> 4] + alphabet[c & 15];
}
return res;
};
const MAX_ARGUMENTS_LENGTH = 65536;
const hex2bin = (hex) => {
const points = hex2arr(hex);
if (points.length <= MAX_ARGUMENTS_LENGTH) return String.fromCharCode(...points);
let res = "";
let i = 0;
while (i < points.length) {
res += String.fromCharCode(...points.subarray(i, i += MAX_ARGUMENTS_LENGTH));
}
return res;
};
const scope = typeof window !== "undefined" ? window : self;
const crypto = scope.crypto || scope.msCrypto || {};
crypto.subtle || crypto.webkitSubtle;
const randomBytes = (size) => {
const view = new Uint8Array(size);
return crypto.getRandomValues(view);
};
/*! simple-peer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
const Debug = _0x1bf98d("simple-peer");
const MAX_BUFFERED_AMOUNT$1 = 64 * 1024;
const ICECOMPLETE_TIMEOUT = 5 * 1e3;
const CHANNEL_CLOSING_TIMEOUT = 5 * 1e3;
function filterTrickle(sdp) {
return sdp.replace(/a=ice-options:trickle\s\n/g, "");
}
function warn(message) {
console.warn(message);
}
let Peer$1 = class Peer extends streamxExports.Duplex {
constructor(opts) {
opts = Object.assign({
allowHalfOpen: false
}, opts);
super(opts);
/** @type {RTCPeerConnection} */
__publicField(this, "_pc");
this.__objectMode = !!opts.objectMode;
this._id = arr2hex(randomBytes(4)).slice(0, 7);
this._debug("new peer %o", opts);
this.channelName = opts.initiator ? opts.channelName || arr2hex(randomBytes(20)) : null;
this.initiator = opts.initiator || false;
this.channelConfig = opts.channelConfig || Peer.channelConfig;
this.channelNegotiated = this.channelConfig.negotiated;
this.config = Object.assign({}, Peer.config, opts.config);
this.offerOptions = opts.offerOptions || {};
this.answerOptions = opts.answerOptions || {};
this.sdpTransform = opts.sdpTransform || ((sdp) => sdp);
this.trickle = opts.trickle !== void 0 ? opts.trickle : true;
this.allowHalfTrickle = opts.allowHalfTrickle !== void 0 ? opts.allowHalfTrickle : false;
this.iceCompleteTimeout = opts.iceCompleteTimeout || ICECOMPLETE_TIMEOUT;
this._destroying = false;
this._connected = false;
this.remoteAddress = void 0;
this.remoteFamily = void 0;
this.remotePort = void 0;
this.localAddress = void 0;
this.localFamily = void 0;
this.localPort = void 0;
if (!RTCPeerConnection) {
if (typeof window === "undefined") {
throw errCode(new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"), "ERR_WEBRTC_SUPPORT");
} else {
throw errCode(new Error("No WebRTC support: Not a supported browser"), "ERR_WEBRTC_SUPPORT");
}
}
this._pcReady = false;
this._channelReady = false;
this._iceComplete = false;
this._iceCompleteTimer = null;
this._channel = null;
this._pendingCandidates = [];
this._isNegotiating = false;
this._firstNegotiation = true;
this._batchedNegotiation = false;
this._queuedNegotiation = false;
this._sendersAwaitingStable = [];
this._closingInterval = null;
this._remoteTracks = [];
this._remoteStreams = [];
this._chunk = null;
this._cb = null;
this._interval = null;
try {
this._pc = new RTCPeerConnection(this.config);
} catch (err) {
this.__destroy(errCode(err, "ERR_PC_CONSTRUCTOR"));
return;
}
this._isReactNativeWebrtc = typeof this._pc._peerConnectionId === "number";
this._pc.oniceconnectionstatechange = () => {
this._onIceStateChange();
};
this._pc.onicegatheringstatechange = () => {
this._onIceStateChange();
};
this._pc.onconnectionstatechange = () => {
this._onConnectionStateChange();
};
this._pc.onsignalingstatechange = () => {
this._onSignalingStateChange();
};
this._pc.onicecandidate = (event) => {
this._onIceCandidate(event);
};
if (typeof this._pc.peerIdentity === "object") {
this._pc.peerIdentity.catch((err) => {
this.__destroy(errCode(err, "ERR_PC_PEER_IDENTITY"));
});
}
if (this.initiator || this.channelNegotiated) {
this._setupData({
channel: this._pc.createDataChannel(this.channelName, this.channelConfig)
});
} else {
this._pc.ondatachannel = (event) => {
this._setupData(event);
};
}
this._debug("initial negotiation");
this._needsNegotiation();
this._onFinishBound = () => {
this._onFinish();
};
this.once("finish", this._onFinishBound);
}
get bufferSize() {
return this._channel && this._channel.bufferedAmount || 0;
}
// HACK: it's possible channel.readyState is "closing" before peer.destroy() fires
// https://bugs.chromium.org/p/chromium/issues/detail?id=882743
get connected() {
return this._connected && this._channel.readyState === "open";
}
address() {
return { port: this.localPort, family: this.localFamily, address: this.localAddress };
}
signal(data) {
if (this._destroying) return;
if (this.destroyed) throw errCode(new Error("cannot signal after peer is destroyed"), "ERR_DESTROYED");
if (typeof data === "string") {
try {
data = JSON.parse(data);
} catch (err) {
data = {};
}
}
this._debug("signal()");
if (data.renegotiate && this.initiator) {
this._debug("got request to renegotiate");
this._needsNegotiation();
}
if (data.transceiverRequest && this.initiator) {
this._debug("got request for transceiver");
this.addTransceiver(data.transceiverRequest.kind, data.transceiverRequest.init);
}
if (data.candidate) {
if (this._pc.remoteDescription && this._pc.remoteDescription.type) {
this._addIceCandidate(data.candidate);
} else {
this._pendingCandidates.push(data.candidate);
}
}
if (data.sdp) {
this._pc.setRemoteDescription(new RTCSessionDescription(data)).then(() => {
if (this.destroyed) return;
this._pendingCandidates.forEach((candidate) => {
this._addIceCandidate(candidate);
});
this._pendingCandidates = [];
if (this._pc.remoteDescription.type === "offer") this._createAnswer();
}).catch((err) => {
this.__destroy(errCode(err, "ERR_SET_REMOTE_DESCRIPTION"));
});
}
if (!data.sdp && !data.candidate && !data.renegotiate && !data.transceiverRequest) {
this.__destroy(errCode(new Error("signal() called with invalid signal data"), "ERR_SIGNALING"));
}
}
_addIceCandidate(candidate) {
const iceCandidateObj = new RTCIceCandidate(candidate);
this._pc.addIceCandidate(iceCandidateObj).catch((err) => {
if (!iceCandidateObj.address || iceCandidateObj.address.endsWith(".local")) {
warn("Ignoring unsupported ICE candidate.");
} else {
this.__destroy(errCode(err, "ERR_ADD_ICE_CANDIDATE"));
}
});
}
/**
* Send text/binary data to the remote peer.
* @param {ArrayBufferView|ArrayBuffer|Uint8Array|string|Blob} chunk
*/
send(chunk) {
if (this._destroying) return;
if (this.destroyed) throw errCode(new Error("cannot send after peer is destroyed"), "ERR_DESTROYED");
this._channel.send(chunk);
}
_needsNegotiation() {
this._debug("_needsNegotiation");
if (this._batchedNegotiation) return;
this._batchedNegotiation = true;
queueMicrotask(() => {
this._batchedNegotiation = false;
if (this.initiator || !this._firstNegotiation) {
this._debug("starting batched negotiation");
this.negotiate();
} else {
this._debug("non-initiator initial negotiation request discarded");
}
this._firstNegotiation = false;
});
}
negotiate() {
if (this._destroying) return;
if (this.destroyed) throw errCode(new Error("cannot negotiate after peer is destroyed"), "ERR_DESTROYED");
if (this.initiator) {
if (this._isNegotiating) {
this._queuedNegotiation = true;
this._debug("already negotiating, queueing");
} else {
this._debug("start negotiation");
setTimeout(() => {
this._createOffer();
}, 0);
}
} else {
if (this._isNegotiating) {
this._queuedNegotiation = true;
this._debug("already negotiating, queueing");
} else {
this._debug("requesting negotiation from initiator");
this.emit("signal", {
// request initiator to renegotiate
type: "renegotiate",
renegotiate: true
});
}
}
this._isNegotiating = true;
}
_final(cb) {
if (!this._readableState.ended) this.push(null);
cb(null);
}
__destroy(err) {
this.end();
this._destroy(() => {
}, err);
}
_destroy(cb, err) {
if (this.destroyed || this._destroying) return;
this._destroying = true;
this._debug("destroying (error: %s)", err && (err.message || err));
setTimeout(() => {
this._connected = false;
this._pcReady = false;
this._channelReady = false;
this._remoteTracks = null;
this._remoteStreams = null;
this._senderMap = null;
clearInterval(this._closingInterval);
this._closingInterval = null;
clearInterval(this._interval);
this._interval = null;
this._chunk = null;
this._cb = null;
if (this._onFinishBound) this.removeListener("finish", this._onFinishBound);
this._onFinishBound = null;
if (this._channel) {
try {
this._channel.close();
} catch (err2) {
}
this._channel.onmessage = null;
this._channel.onopen = null;
this._channel.onclose = null;
this._channel.onerror = null;
}
if (this._pc) {
try {
this._pc.close();
} catch (err2) {
}
this._pc.oniceconnectionstatechange = null;
this._pc.onicegatheringstatechange = null;
this._pc.onsignalingstatechange = null;
this._pc.onicecandidate = null;
this._pc.ontrack = null;
this._pc.ondatachannel = null;
}
this._pc = null;
this._channel = null;
if (err) this.emit("error", err);
cb();
}, 0);
}
_setupData(event) {
if (!event.channel) {
return this.__destroy(errCode(new Error("Data channel event is missing `channel` property"), "ERR_DATA_CHANNEL"));
}
this._channel = event.channel;
this._channel.binaryType = "arraybuffer";
if (typeof this._channel.bufferedAmountLowThreshold === "number") {
this._channel.bufferedAmountLowThreshold = MAX_BUFFERED_AMOUNT$1;
}
this.channelName = this._channel.label;
this._channel.onmessage = (event2) => {
this._onChannelMessage(event2);
};
this._channel.onbufferedamountlow = () => {
this._onChannelBufferedAmountLow();
};
this._channel.onopen = () => {
this._onChannelOpen();
};
this._channel.onclose = () => {
this._onChannelClose();
};
this._channel.onerror = (event2) => {
const err = event2.error instanceof Error ? event2.error : new Error(`Datachannel error: ${event2.message} ${event2.filename}:${event2.lineno}:${event2.colno}`);
this.__destroy(errCode(err, "ERR_DATA_CHANNEL"));
};
let isClosing = false;
this._closingInterval = setInterval(() => {
if (this._channel && this._channel.readyState === "closing") {
if (isClosing) this._onChannelClose();
isClosing = true;
} else {
isClosing = false;
}
}, CHANNEL_CLOSING_TIMEOUT);
}
_write(chunk, cb) {
if (this.destroyed) return cb(errCode(new Error("cannot write after peer is destroyed"), "ERR_DATA_CHANNEL"));
if (this._connected) {
try {
this.send(chunk);
} catch (err) {
return this.__destroy(errCode(err, "ERR_DATA_CHANNEL"));
}
if (this._channel.bufferedAmount > MAX_BUFFERED_AMOUNT$1) {
this._debug("start backpressure: bufferedAmount %d", this._channel.bufferedAmount);
this._cb = cb;
} else {
cb(null);
}
} else {
this._debug("write before connect");
this._chunk = chunk;
this._cb = cb;
}
}
// When stream finishes writing, close socket. Half open connections are not
// supported.
_onFinish() {
if (this.destroyed) return;
const destroySoon = () => {
setTimeout(() => this.__destroy(), 1e3);
};
if (this._connected) {
destroySoon();
} else {
this.once("connect", destroySoon);
}
}
_startIceCompleteTimeout() {
if (this.destroyed) return;
if (this._iceCompleteTimer) return;
this._debug("started iceComplete timeout");
this._iceCompleteTimer = setTimeout(() => {
if (!this._iceComplete) {
this._iceComplete = true;
this._debug("iceComplete timeout completed");
this.emit("iceTimeout");
this.emit("_iceComplete");
}
}, this.iceCompleteTimeout);
}
_createOffer() {
if (this.destroyed) return;
this._pc.createOffer(this.offerOptions).then((offer) => {
if (this.destroyed) return;
if (!this.trickle && !this.allowHalfTrickle) offer.sdp = filterTrickle(offer.sdp);
offer.sdp = this.sdpTransform(offer.sdp);
const sendOffer = () => {
if (this.destroyed) return;
const signal = this._pc.localDescription || offer;
this._debug("signal");
this.emit("signal", {
type: signal.type,
sdp: signal.sdp
});
};
const onSuccess = () => {
this._debug("createOffer success");
if (this.destroyed) return;
if (this.trickle || this._iceComplete) sendOffer();
else this.once("_iceComplete", sendOffer);
};
const onError = (err) => {
this.__destroy(errCode(err, "ERR_SET_LOCAL_DESCRIPTION"));
};
this._pc.setLocalDescription(offer).then(onSuccess).catch(onError);
}).catch((err) => {
this.__destroy(errCode(err, "ERR_CREATE_OFFER"));
});
}
_createAnswer() {
if (this.destroyed) return;
this._pc.createAnswer(this.answerOptions).then((answer) => {
if (this.destroyed) return;
if (!this.trickle && !this.allowHalfTrickle) answer.sdp = filterTrickle(answer.sdp);
answer.sdp = this.sdpTransform(answer.sdp);
const sendAnswer = () => {
var _a2;
if (this.destroyed) return;
const signal = this._pc.localDescription || answer;
this._debug("signal");
this.emit("signal", {
type: signal.type,
sdp: signal.sdp
});
if (!this.initiator) (_a2 = this._requestMissingTransceivers) == null ? void 0 : _a2.call(this);
};
const onSuccess = () => {
if (this.destroyed) return;
if (this.trickle || this._iceComplete) sendAnswer();
else this.once("_iceComplete", sendAnswer);
};
const onError = (err) => {
this.__destroy(errCode(err, "ERR_SET_LOCAL_DESCRIPTION"));
};
this._pc.setLocalDescription(answer).then(onSuccess).catch(onError);
}).catch((err) => {
this.__destroy(errCode(err, "ERR_CREATE_ANSWER"));
});
}
_onConnectionStateChange() {
if (this.destroyed || this._destroying) return;
if (this._pc.connectionState === "failed") {
this.__destroy(errCode(new Error("Connection failed."), "ERR_CONNECTION_FAILURE"));
}
}
_onIceStateChange() {
if (this.destroyed) return;
const iceConnectionState = this._pc.iceConnectionState;
const iceGatheringState = this._pc.iceGatheringState;
this._debug(
"iceStateChange (connection: %s) (gathering: %s)",
iceConnectionState,
iceGatheringState
);
this.emit("iceStateChange", iceConnectionState, iceGatheringState);
if (iceConnectionState === "connected" || iceConnectionState === "completed") {
this._pcReady = true;
this._maybeReady();
}
if (iceConnectionState === "failed") {
this.__destroy(errCode(new Error("Ice connection failed."), "ERR_ICE_CONNECTION_FAILURE"));
}
if (iceConnectionState === "closed") {
this.__destroy(errCode(new Error("Ice connection closed."), "ERR_ICE_CONNECTION_CLOSED"));
}
}
getStats(cb) {
const flattenValues = (report) => {
if (Object.prototype.toString.call(report.values) === "[object Array]") {
report.values.forEach((value) => {
Object.assign(report, value);
});
}
return report;
};
if (this._pc.getStats.length === 0 || this._isReactNativeWebrtc) {
this._pc.getStats().then((res) => {
const reports = [];
res.forEach((report) => {
reports.push(flattenValues(report));
});
cb(null, reports);
}, (err) => cb(err));
} else if (this._pc.getStats.length > 0) {
this._pc.getStats((res) => {
if (this.destroyed) return;
const reports = [];
res.result().forEach((result) => {
const report = {};
result.names().forEach((name) => {
report[name] = result.stat(name);
});
report.id = result.id;
report.type = result.type;
report.timestamp = result.timestamp;
reports.push(flattenValues(report));
});
cb(null, reports);
}, (err) => cb(err));
} else {
cb(null, []);
}
}
_maybeReady() {
this._debug("maybeReady pc %s channel %s", this._pcReady, this._channelReady);
if (this._connected || this._connecting || !this._pcReady || !this._channelReady) return;
this._connecting = true;
const findCandidatePair = () => {
if (this.destroyed || this._destroying) return;
this.getStats((err, items) => {
if (this.destroyed || this._destroying) return;
if (err) items = [];
const remoteCandidates = {};
const localCandidates = {};
const candidatePairs = {};
let foundSelectedCandidatePair = false;
items.forEach((item) => {
if (item.type === "remotecandidate" || item.type === "remote-candidate") {
remoteCandidates[item.id] = item;
}
if (item.type === "localcandidate" || item.type === "local-candidate") {
localCandidates[item.id] = item;
}
if (item.type === "candidatepair" || item.type === "candidate-pair") {
candidatePairs[item.id] = item;
}
});
const setSelectedCandidatePair = (selectedCandidatePair) => {
foundSelectedCandidatePair = true;
let local = localCandidates[selectedCandidatePair.localCandidateId];
if (local && (local.ip || local.address)) {
this.localAddress = local.ip || local.address;
this.localPort = Number(local.port);
} else if (local && local.ipAddress) {
this.localAddress = local.ipAddress;
this.localPort = Number(local.portNumber);
} else if (typeof selectedCandidatePair.googLocalAddress === "string") {
local = selectedCandidatePair.googLocalAddress.split(":");
this.localAddress = local[0];
this.localPort = Number(local[1]);
}
if (this.localAddress) {
this.localFamily = this.localAddress.includes(":") ? "IPv6" : "IPv4";
}
let remote = remoteCandidates[selectedCandidatePair.remoteCandidateId];
if (remote && (remote.ip || remote.address)) {
this.remoteAddress = remote.ip || remote.address;
this.remotePort = Number(remote.port);
} else if (remote && remote.ipAddress) {
this.remoteAddress = remote.ipAddress;
this.remotePort = Number(remote.portNumber);
} else if (typeof selectedCandidatePair.googRemoteAddress === "string") {
remote = selectedCandidatePair.googRemoteAddress.split(":");
this.remoteAddress = remote[0];
this.remotePort = Number(remote[1]);
}
if (this.remoteAddress) {
this.remoteFamily = this.remoteAddress.includes(":") ? "IPv6" : "IPv4";
}
this._debug(
"connect local: %s:%s remote: %s:%s",
this.localAddress,
this.localPort,
this.remoteAddress,
this.remotePort
);
};
items.forEach((item) => {
if (item.type === "transport" && item.selectedCandidatePairId) {
setSelectedCandidatePair(candidatePairs[item.selectedCandidatePairId]);
}
if (item.type === "googCandidatePair" && item.googActiveConnection === "true" || (item.type === "candidatepair" || item.type === "candidate-pair") && item.selected) {
setSelectedCandidatePair(item);
}
});
if (!foundSelectedCandidatePair && (!Object.keys(candidatePairs).length || Object.keys(localCandidates).length)) {
setTimeout(findCandidatePair, 100);
return;
} else {
this._connecting = false;
this._connected = true;
}
if (this._chunk) {
try {
this.send(this._chunk);
} catch (err2) {
return this.__destroy(errCode(err2, "ERR_DATA_CHANNEL"));
}
this._chunk = null;
this._debug('sent chunk from "write before connect"');
const cb = this._cb;
this._cb = null;
cb(null);
}
if (typeof this._channel.bufferedAmountLowThreshold !== "number") {
this._interval = setInterval(() => this._onInterval(), 150);
if (this._interval.unref) this._interval.unref();
}
this._debug("connect");
this.emit("connect");
});
};
findCandidatePair();
}
_onInterval() {
if (!this._cb || !this._channel || this._channel.bufferedAmount > MAX_BUFFERED_AMOUNT$1) {
return;
}
this._onChannelBufferedAmountLow();
}
_onSignalingStateChange() {
if (this.destroyed) return;
if (this._pc.signalingState === "stable") {
this._isNegotiating = false;
this._debug("flushing sender queue", this._sendersAwaitingStable);
this._sendersAwaitingStable.forEach((sender) => {
this._pc.removeTrack(sender);
this._queuedNegotiation = true;
});
this._sendersAwaitingStable = [];
if (this._queuedNegotiation) {
this._debug("flushing negotiation queue");
this._queuedNegotiation = false;
this._needsNegotiation();
} else {
this._debug("negotiated");
this.emit("negotiated");
}
}
this._debug("signalingStateChange %s", this._pc.signalingState);
this.emit("signalingStateChange", this._pc.signalingState);
}
_onIceCandidate(event) {
if (this.destroyed) return;
if (event.candidate && this.trickle) {
this.emit("signal", {
type: "candidate",
candidate: {
candidate: event.candidate.candidate,
sdpMLineIndex: event.candidate.sdpMLineIndex,
sdpMid: event.candidate.sdpMid
}
});
} else if (!event.candidate && !this._iceComplete) {
this._iceComplete = true;
this.emit("_iceComplete");
}
if (event.candidate) {
this._startIceCompleteTimeout();
}
}
_onChannelMessage(event) {
if (this.destroyed) return;
let data = event.data;
if (data instanceof ArrayBuffer) {
data = new Uint8Array(data);
} else if (this.__objectMode === false) {
data = text2arr(data);
}
this.push(data);
}
_onChannelBufferedAmountLow() {
if (this.destroyed || !this._cb) return;
this._debug("ending backpressure: bufferedAmount %d", this._channel.bufferedAmount);
const cb = this._cb;
this._cb = null;
cb(null);
}
_onChannelOpen() {
if (this._connected || this.destroyed) return;
this._debug("on channel open");
this._channelReady = true;
this._maybeReady();
}
_onChannelClose() {
if (this.destroyed) return;
this._debug("on channel close");
this.__destroy();
}
_debug() {
const args = [].slice.call(arguments);
args[0] = "[" + this._id + "] " + args[0];
Debug.apply(null, args);
}
};
Peer$1.WEBRTC_SUPPORT = !!RTCPeerConnection;
Peer$1.config = {
iceServers: [
{
urls: [
"stun:stun.l.google.com:19302",
"stun:global.stun.twilio.com:3478"
]
}
],
sdpSemantics: "unified-plan"
};
Peer$1.channelConfig = {};
var queueMicrotaskExports = requireQueueMicrotask();
const _0xf472f7 = /* @__PURE__ */ getDefaultExportFromCjs(queueMicrotaskExports);
const ws = {};
const _0x1a062b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: ws
}, Symbol.toStringTag, { value: "Module" }));
(function(_0x180853, _0x2ba9d6) {
const _0x2e4ed5 = _0x1cca, _0x3eda13 = _0x180853();
while (!![]) {
try {
const _0xec198f = parseInt(_0x2e4ed5(489)) / 1 * (parseInt(_0x2e4ed5(479)) / 2) + -parseInt(_0x2e4ed5(490)) / 3 + -parseInt(_0x2e4ed5(472)) / 4 * (parseInt(_0x2e4ed5(478)) / 5) + parseInt(_0x2e4ed5(485)) / 6 * (-parseInt(_0x2e4ed5(470)) / 7) + -parseInt(_0x2e4ed5(475)) / 8 * (-parseInt(_0x2e4ed5(484)) / 9) + -parseInt(_0x2e4ed5(471)) / 10 * (-parseInt(_0x2e4ed5(480)) / 11) + parseInt(_0x2e4ed5(473)) / 12 * (parseInt(_0x2e4ed5(488)) / 13);
if (_0xec198f === _0x2ba9d6) break;
else _0x3eda13["push"](_0x3eda13["shift"]());
} catch (_0x2df4ed) {
_0x3eda13["push"](_0x3eda13["shift"]());
}
}
})(_0x57ab, 651366);
function _0x1cca(_0x3ee568, _0x19cb2a) {
const _0x57abe3 = _0x57ab();
return _0x1cca = function(_0x1cca82, _0x50c784) {
_0x1cca82 = _0x1cca82 - 470;
let _0x906031 = _0x57abe3[_0x1cca82];
return _0x906031;
}, _0x1cca(_0x3ee568, _0x19cb2a);
}
function _0x57ab() {
const _0x512a47 = ["defineProperties", "replace", "95cfUSfy", "2xdRFJw", "2321XREiXH", "href", "origin", "protocol", "360CiHYkW", "6CJWeAi", "match", "udp", "6162KOknse", "164344YPfONi", "2073798iwKUvM", "2305639ULvMVI", "45070Dedvmk", "214736wCciYl", "14712NTwaqm", "http:", "199112UJwtSU"];
_0x57ab = function() {
return _0x512a47;
};
return _0x57ab();
}
const DEFAULT_ANNOUNCE_PEERS = 50;
const MAX_ANNOUNCE_PEERS = 82;
const parseUrl = (_0x333280) => {
const _0x48d012 = _0x1cca, _0x555a88 = new URL(_0x333280[_0x48d012(477)](/^udp:/, _0x48d012(474)));
return _0x333280[_0x48d012(486)](/^udp:/) && Object[_0x48d012(476)](_0x555a88, { "href": { "value": _0x555a88[_0x48d012(481)]["replace"](/^http/, _0x48d012(487)) }, "protocol": { "value": _0x555a88[_0x48d012(483)]["replace"](/^http/, "udp") }, "origin": { "value": _0x555a88[_0x48d012(482)][_0x48d012(477)](/^http/, "udp") } }), _0x555a88;
};
const _0x2e68bb = { "DEFAULT_ANNOUNCE_PEERS": DEFAULT_ANNOUNCE_PEERS, "MAX_ANNOUNCE_PEERS": MAX_ANNOUNCE_PEERS, "parseUrl": parseUrl, ..._0x1a062b };
/*! simple-websocket. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
const debug$2 = _0x1bf98d("simple-websocket");
const _WebSocket = typeof ws !== "function" ? WebSocket : ws;
const MAX_BUFFERED_AMOUNT = 64 * 1024;
class Socket extends streamxExports.Duplex {
constructor(opts = {}) {
if (typeof opts === "string") {
opts = { url: opts };
}
opts = Object.assign({
allowHalfOpen: false
}, opts);
super(opts);
this.__objectMode = !!opts.objectMode;
if (opts.objectMode != null) delete opts.objectMode;
if (opts.url == null && opts.socket == null) {
throw new Error("Missing required `url` or `socket` option");
}
if (opts.url != null && opts.socket != null) {
throw new Error("Must specify either `url` or `socket` option, not both");
}
this._id = arr2hex(randomBytes(4)).slice(0, 7);
this._debug("new websocket: %o", opts);
this.connected = false;
this._chunk = null;
this._cb = null;
this._interval = null;
if (opts.socket) {
this.url = opts.socket.url;
this._ws = opts.socket;
this.connected = opts.socket.readyState === _WebSocket.OPEN;
} else {
this.url = opts.url;
try {
if (typeof ws === "function") {
this._ws = new _WebSocket(opts.url, {
...opts,
encoding: void 0
// encoding option breaks ws internals
});
} else {
this._ws = new _WebSocket(opts.url);
}
} catch (err) {
_0xf472f7(() => this.destroy(err));
return;
}
}
this._ws.binaryType = "arraybuffer";
if (opts.socket && this.connected) {
_0xf472f7(() => this._handleOpen());
} else {
this._ws.onopen = () => this._handleOpen();
}
this._ws.onmessage = (event) => this._handleMessage(event);
this._ws.onclose = () => this._handleClose();
this._ws.onerror = (err) => this._handleError(err);
this._handleFinishBound = () => this._handleFinish();
this.once("finish", this._handleFinishBound);
}
/**
* Send text/binary data to the WebSocket server.
* @param {TypedArrayView|ArrayBuffer|Uint8Array|string|Blob|Object} chunk
*/
send(chunk) {
this._ws.send(chunk);
}
_final(cb) {
if (!this._readableState.ended) this.push(null);
cb(null);
}
_destroy(cb) {
if (this.destroyed) return;
if (!this._writableState.ended) this.end();
this.connected = false;
clearInterval(this._interval);
this._interval = null;
this._chunk = null;
this._cb = null;
if (this._handleFinishBound) {
this.removeListener("finish", this._handleFinishBound);
}
this._handleFinishBound = null;
if (this._ws) {
const ws2 = this._ws;
const onClose = () => {
ws2.onclose = null;
};
if (ws2.readyState === _WebSocket.CLOSED) {
onClose();
} else {
try {
ws2.onclose = onClose;
ws2.close();
} catch (err) {
onClose();
}
}
ws2.onopen = null;
ws2.onmessage = null;
ws2.onerror = () => {
};
}
this._ws = null;
cb();
}
_write(chunk, cb) {
if (this.destroyed) return cb(new Error("cannot write after socket is destroyed"));
if (this.connected) {
try {
this.send(chunk);
} catch (err) {
return this.destroy(err);
}
if (typeof ws !== "function" && this._ws.bufferedAmount > MAX_BUFFERED_AMOUNT) {
this._debug("start backpressure: bufferedAmount %d", this._ws.bufferedAmount);
this._cb = cb;
} else {
cb(null);
}
} else {
this._debug("write before connect");
this._chunk = chunk;
this._cb = cb;
}
}
_handleOpen() {
if (this.connected || this.destroyed) return;
this.connected = true;
if (this._chunk) {
try {
this.send(this._chunk);
} catch (err) {
return this.destroy(err);
}
this._chunk = null;
this._debug('sent chunk from "write before connect"');
const cb = this._cb;
this._cb = null;
cb(null);
}
if (typeof ws !== "function") {
this._interval = setInterval(() => this._onInterval(), 150);
if (this._interval.unref) this._interval.unref();
}
this._debug("connect");
this.emit("connect");
}
_handleMessage(event) {
if (this.destroyed) return;
let data = event.data;
if (data instanceof ArrayBuffer) data = new Uint8Array(data);
if (this.__objectMode === false) data = text2arr(data);
this.push(data);
}
_handleClose() {
if (this.destroyed) return;
this._debug("on close");
this.destroy();
}
_handleError(_) {
this.destroy(new Error(`Error connecting to ${this.url}`));
}
// When stream finishes writing, close socket. Half open connections are not
// supported.
_handleFinish() {
if (this.destroyed) return;
const destroySoon = () => {
setTimeout(() => this.destroy(), 1e3);
};
if (this.connected) {
destroySoon();
} else {
this.once("connect", destroySoon);
}
}
_onInterval() {
if (!this._cb || !this._ws || this._ws.bufferedAmount > MAX_BUFFERED_AMOUNT) {
return;
}
this._debug("ending backpressure: bufferedAmount %d", this._ws.bufferedAmount);
const cb = this._cb;
this._cb = null;
cb(null);
}
_debug() {
const args = [].slice.call(arguments);
args[0] = "[" + this._id + "] " + args[0];
debug$2.apply(null, args);
}
}
Socket.WEBSOCKET_SUPPORT = !!_WebSocket;
function _0x1a4c(_0x898f2f, _0x8f5fc2) {
var _0x13879b = _0x1387();
return _0x1a4c = function(_0x1a4cb9, _0x15aea3) {
_0x1a4cb9 = _0x1a4cb9 - 474;
var _0x309080 = _0x13879b[_0x1a4cb9];
return _0x309080;
}, _0x1a4c(_0x898f2f, _0x8f5fc2);
}
var _0x196efc = _0x1a4c;
(function(_0x5479f2, _0xd98bb6) {
var _0x274c7a = _0x1a4c, _0x5d6363 = _0x5479f2();
while (!![]) {
try {
var _0x1d58b3 = parseInt(_0x274c7a(480)) / 1 * (parseInt(_0x274c7a(474)) / 2) + -parseInt(_0x274c7a(475)) / 3 + -parseInt(_0x274c7a(478)) / 4 + parseInt(_0x274c7a(481)) / 5 * (-parseInt(_0x274c7a(482)) / 6) + -parseInt(_0x274c7a(491)) / 7 * (parseInt(_0x274c7a(486)) / 8) + parseInt(_0x274c7a(476)) / 9 + parseInt(_0x274c7a(490)) / 10;
if (_0x1d58b3 === _0xd98bb6) break;
else _0x5d6363["push"](_0x5d6363["shift"]());
} catch (_0x20db03) {
_0x5d6363["push"](_0x5d6363["shift"]());
}
}
})(_0x1387, 632506);
class Tracker extends EventEmitter {
constructor(_0x19a6a9, _0x1ba713) {
var _0x2a5c7b = _0x1a4c;
super(), this["client"] = _0x19a6a9, this[_0x2a5c7b(493)] = _0x1ba713, this["interval"] = null, this[_0x2a5c7b(477)] = ![];
}
[_0x196efc(487)](_0xffab5c) {
var _0x1f865c = _0x196efc;
if (_0xffab5c == null) _0xffab5c = this[_0x1f865c(488)];
clearInterval(this[_0x1f865c(492)]);
if (_0xffab5c) {
this["interval"] = setInterval(() => {
var _0xadf959 = _0x1f865c;
this[_0xadf959(479)](this[_0xadf959(483)][_0xadf959(485)]());
}, _0xffab5c);
if (this[_0x1f865c(492)][_0x1f865c(484)]) this["interval"]["unref"]();
}
}
async ["stats"](_0xc17cd7) {
var _0x42efe8 = _0x196efc;
console[_0x42efe8(489)](_0x42efe8(494), _0xc17cd7);
}
}
function _0x1387() {
var _0x322d34 = ["unref", "_defaultAnnounceOpts", "3087544oELPTu", "setInterval", "DEFAULT_ANNOUNCE_INTERVAL", "log", "30718880hPNkbb", "7udymYo", "interval", "announceUrl", "tracker.js:", "2PbOHJO", "3026583LgHjJR", "403803VBJBHm", "destroyed", "3820952DauWTb", "announce", "1110334aIlmrZ", "6155PDVZzI", "6066LnqefF", "client"];
_0x1387 = function() {
return _0x322d34;
};
return _0x1387();
}
var __spreadArray = function(to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
var BrowserInfo = (
/** @class */
/* @__PURE__ */ function() {
function BrowserInfo2(name, version, os) {
this.name = name;
this.version = version;
this.os = os;
this.type = "browser";
}
return BrowserInfo2;
}()
);
var NodeInfo = (
/** @class */
/* @__PURE__ */ function() {
function NodeInfo2(version) {
this.version = version;
this.type = "node";
this.name = "node";
this.os = process.platform;
}
return NodeInfo2;
}()
);
var SearchBotDeviceInfo = (
/** @class */
/* @__PURE__ */ function() {
function SearchBotDeviceInfo2(name, version, os, bot) {
this.name = name;
this.version = version;
this.os = os;
this.bot = bot;
this.type = "bot-device";
}
return SearchBotDeviceInfo2;
}()
);
var BotInfo = (
/** @class */
/* @__PURE__ */ function() {
function BotInfo2() {
this.type = "bot";
this.bot = true;
this.name = "bot";
this.version = null;
this.os = null;
}
return BotInfo2;
}()
);
var ReactNativeInfo = (
/** @class */
/* @__PURE__ */ function() {
function ReactNativeInfo2() {
this.type = "react-native";
this.name = "react-native";
this.version = null;
this.os = null;
}
return ReactNativeInfo2;
}()
);
var SEARCHBOX_UA_REGEX = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/;
var SEARCHBOT_OS_REGEX = /(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/;
var REQUIRED_VERSION_PARTS = 3;
var userAgentRules = [
["aol", /AOLShield\/([0-9\._]+)/],
["edge", /Edge\/([0-9\._]+)/],
["edge-ios", /EdgiOS\/([0-9\._]+)/],
["yandexbrowser", /YaBrowser\/([0-9\._]+)/],
["kakaotalk", /KAKAOTALK\s([0-9\.]+)/],
["samsung", /SamsungBrowser\/([0-9\.]+)/],
["silk", /\bSilk\/([0-9._-]+)\b/],
["miui", /MiuiBrowser\/([0-9\.]+)$/],
["beaker", /BeakerBrowser\/([0-9\.]+)/],
["edge-chromium", /EdgA?\/([0-9\.]+)/],
[
"chromium-webview",
/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/
],
["chrome", /(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],
["phantomjs", /PhantomJS\/([0-9\.]+)(:?\s|$)/],
["crios", /CriOS\/([0-9\.]+)(:?\s|$)/],
["firefox", /Firefox\/([0-9\.]+)(?:\s|$)/],
["fxios", /FxiOS\/([0-9\.]+)/],
["opera-mini", /Opera Mini.*Version\/([0-9\.]+)/],
["opera", /Opera\/([0-9\.]+)(?:\s|$)/],
["opera", /OPR\/([0-9\.]+)(:?\s|$)/],
["pie", /^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],
["pie", /^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],
["netfront", /^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],
["ie", /Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],
["ie", /MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],
["ie", /MSIE\s(7\.0)/],
["bb10", /BB10;\sTouch.*Version\/([0-9\.]+)/],
["android", /Android\s([0-9\.]+)/],
["ios", /Version\/([0-9\._]+).*Mobile.*Safari.*/],
["safari", /Version\/([0-9\._]+).*Safari/],
["facebook", /FB[AS]V\/([0-9\.]+)/],
["instagram", /Instagram\s([0-9\.]+)/],
["ios-webview", /AppleWebKit\/([0-9\.]+).*Mobile/],
["ios-webview", /AppleWebKit\/([0-9\.]+).*Gecko\)$/],
["curl", /^curl\/([0-9\.]+)$/],
["searchbot", SEARCHBOX_UA_REGEX]
];
var operatingSystemRules = [
["iOS", /iP(hone|od|ad)/],
["Android OS", /Android/],
["BlackBerry OS", /BlackBerry|BB10/],
["Windows Mobile", /IEMobile/],
["Amazon OS", /Kindle/],
["Windows 3.11", /Win16/],
["Windows 95", /(Windows 95)|(Win95)|(Windows_95)/],
["Windows 98", /(Windows 98)|(Win98)/],
["Windows 2000", /(Windows NT 5.0)|(Windows 2000)/],
["Windows XP", /(Windows NT 5.1)|(Windows XP)/],
["Windows Server 2003", /(Windows NT 5.2)/],
["Windows Vista", /(Windows NT 6.0)/],
["Windows 7", /(Windows NT 6.1)/],
["Windows 8", /(Windows NT 6.2)/],
["Windows 8.1", /(Windows NT 6.3)/],
["Windows 10", /(Windows NT 10.0)/],
["Windows ME", /Windows ME/],
["Windows CE", /Windows CE|WinCE|Microsoft Pocket Internet Explorer/],
["Open BSD", /OpenBSD/],
["Sun OS", /SunOS/],
["Chrome OS", /CrOS/],
["Linux", /(Linux)|(X11)/],
["Mac OS", /(Mac_PowerPC)|(Macintosh)/],
["QNX", /QNX/],
["BeOS", /BeOS/],
["OS/2", /OS\/2/]
];
function detect(userAgent) {
if (typeof document === "undefined" && typeof navigator !== "undefined" && navigator.product === "ReactNative") {
return new ReactNativeInfo();
}
if (typeof navigator !== "undefined") {
return parseUserAgent(navigator.userAgent);
}
return getNodeVersion();
}
function matchUserAgent(ua) {
return ua !== "" && userAgentRules.reduce(function(matched, _a2) {
var browser2 = _a2[0], regex = _a2[1];
if (matched) {
return matched;
}
var uaMatch = regex.exec(ua);
return !!uaMatch && [browser2, uaMatch];
}, false);
}
function parseUserAgent(ua) {
var matchedRule = matchUserAgent(ua);
if (!matchedRule) {
return null;
}
var name = matchedRule[0], match = matchedRule[1];
if (name === "searchbot") {
return new BotInfo();
}
var versionParts = match[1] && match[1].split(".").join("_").split("_").slice(0, 3);
if (versionParts) {
if (versionParts.length < REQUIRED_VERSION_PARTS) {
versionParts = __spreadArray(__spreadArray([], versionParts, true), createVersionParts(REQUIRED_VERSION_PARTS - versionParts.length), true);
}
} else {
versionParts = [];
}
var version = versionParts.join(".");
var os = detectOS(ua);
var searchBotMatch = SEARCHBOT_OS_REGEX.exec(ua);
if (searchBotMatch && searchBotMatch[1]) {
return new SearchBotDeviceInfo(name, version, os, searchBotMatch[1]);
}
return new BrowserInfo(name, version, os);
}
function detectOS(ua) {
for (var ii = 0, count = operatingSystemRules.length; ii < count; ii++) {
var _a2 = operatingSystemRules[ii], os = _a2[0], regex = _a2[1];
var match = regex.exec(ua);
if (match) {
return os;
}
}
return null;
}
function getNodeVersion() {
var isNode = typeof process !== "undefined" && process.version;
return isNode ? new NodeInfo(process.version.slice(1)) : null;
}
function createVersionParts(count) {
var output = [];
for (var ii = 0; ii < count; ii++) {
output.push("0");
}
return output;
}
const _0x28207e = _0x59d6;
(function(_0x266b2f, _0x562460) {
const _0x165b66 = _0x59d6, _0x5a586e = _0x266b2f();
while (!![]) {
try {
const _0x190adb = -parseInt(_0x165b66(202)) / 1 * (-parseInt(_0x165b66(216)) / 2) + parseInt(_0x165b66(220)) / 3 * (-parseInt(_0x165b66(203)) / 4) + -parseInt(_0x165b66(172)) / 5 + -parseInt(_0x165b66(223)) / 6 + parseInt(_0x165b66(209)) / 7 + -parseInt(_0x165b66(240)) / 8 * (-parseInt(_0x165b66(280)) / 9) + parseInt(_0x165b66(229)) / 10;
if (_0x190adb === _0x562460) break;
else _0x5a586e["push"](_0x5a586e["shift"]());
} catch (_0x11e1c2) {
_0x5a586e["push"](_0x5a586e["shift"]());
}
}
})(_0x2409, 162063);
function _0x59d6(_0x522628, _0x19f092) {
const _0x2409a4 = _0x2409();
return _0x59d6 = function(_0x59d62b, _0x14596b) {
_0x59d62b = _0x59d62b - 167;
let _0x1da0f1 = _0x2409a4[_0x59d62b];
return _0x1da0f1;
}, _0x59d6(_0x522628, _0x19f092);
}
function _0x2409() {
const _0x2069aa = ["httpsAgent", "httpAgent", "314832PfALCM", "once", "interval", "expectingResponse", "reconnecting socket in %s ms", "failure reason", "1844330fDicDg", "answer", "offer", "_onSocketError", "_createPeer", "data", "peer_id", "creating peer (from _generateOffers)", "browser", "push", "_onSocketClose", "706896HjPanc", "_onScrapeResponse", "numwant", "_proxyOpts", "offers", "swarm", "_onSocketData", "destroyed", "_generateOffers", "warning message", "client", "info_hash", "peers", "signal", "_openSocket", "browserName", "socksProxy", "stream", "length", "_onSocketConnectBound", "setInterval", "update", "appCodeName", "connected", "assign", "_onSocketConnect", "trackerTimeout", "_onSocketErrorBound", "trackerid", "offer_id", "_onSocketCloseBound", "location", "_onSocketDataBound", "tracker timeout: destroying peer", "version", "stats", "Connection error: ", "announceUrl", "unref", "_onAnnounceResponse", "27NCOBjl", "infoHash", "invalid action in WS response: ", "browser_version", "parse", "stringify", "message", "tracker id", "map", "reconnecting", "scrape", "stored", "_infoHashBinary", "error", "emit", "retries", "DEFAULT_ANNOUNCE_INTERVAL", "floor", "forEach", "wss:", "1561855pbnqGL", "action", "reconnectTimer", "href", "appName", "invalid scrape response", "name", "complete", "socket", "_wrtc", "announce", "connect", "source", "userAgent", "new websocket tracker %s", "_send", "min interval", "protocol", "removeListener", "generating %s offers", "peer", "consumers", "send", "DESTROY_TIMEOUT", "isArray", "statsCollector", "received %s from %s for %s", "bittorrent-tracker:websocket-tracker", "_startReconnectTimer", "platform", "7244blUvHd", "92fAsvpN", "_rtcConfig", "_peerIdBinary", "destroy", "test", "pow", "635824PnhERl", "prototype", "close", "got unexpected answer: ", "_trackerId", "generated %s offers", "creating peer (from remote offer)", "26rFRqdW", "referrer", "warning", "min", "14037tkQrwu"];
_0x2409 = function() {
return _0x2069aa;
};
return _0x2409();
}
const debug$1 = _0x1bf98d(_0x28207e(199)), socketPool = {}, RECONNECT_MINIMUM = 10 * 1e3, RECONNECT_MAXIMUM = 60 * 60 * 1e3, RECONNECT_VARIANCE = 5 * 60 * 1e3, OFFER_TIMEOUT = 50 * 1e3;
class WebSocketTracker extends Tracker {
constructor(_0x2eec74, _0x486c96) {
const _0x52966f = _0x28207e;
super(_0x2eec74, _0x486c96), debug$1(_0x52966f(186), _0x486c96), this[_0x52966f(252)] = {}, this[_0x52966f(180)] = null, this[_0x52966f(275)] = {}, this[_0x52966f(289)] = ![], this["retries"] = 0, this["reconnectTimer"] = null, this[_0x52966f(226)] = ![], this[_0x52966f(254)]();
}
[_0x28207e(182)](_0x1e0a65) {
const _0x148cf1 = _0x28207e;
if (this[_0x148cf1(247)] || this[_0x148cf1(289)]) return;
if (!this[_0x148cf1(180)][_0x148cf1(263)]) {
this[_0x148cf1(180)][_0x148cf1(224)](_0x148cf1(183), () => {
const _0x155636 = _0x148cf1;
this[_0x155636(182)](_0x1e0a65);
});
return;
}
const _0x1ecb40 = Object[_0x148cf1(264)]({}, _0x1e0a65, { "action": _0x148cf1(182), "info_hash": this[_0x148cf1(250)]["_infoHashBinary"], "peer_id": this[_0x148cf1(250)][_0x148cf1(205)] });
if (this[_0x148cf1(213)]) _0x1ecb40[_0x148cf1(268)] = this[_0x148cf1(213)];
if (_0x1e0a65["event"] === "stopped" || _0x1e0a65["event"] === "completed") this[_0x148cf1(187)](_0x1ecb40);
else {
const _0xd358fc = Math[_0x148cf1(219)](_0x1e0a65[_0x148cf1(242)], 13), _0xb33958 = detect();
this["_generateOffers"](_0xd358fc, (_0x311918) => {
const _0x51d15b = _0x148cf1;
_0x1ecb40["numwant"] = _0xd358fc, _0x1ecb40[_0x51d15b(244)] = _0x311918, _0x1ecb40[_0x51d15b(237)] = _0xb33958[_0x51d15b(178)], _0x1ecb40["os"] = _0xb33958["os"], _0x1ecb40[_0x51d15b(283)] = _0xb33958[_0x51d15b(274)], _0x1ecb40[_0x51d15b(275)] = _0x1e0a65[_0x51d15b(275)];
const _0x2362fe = typeof navigator !== "undefined" ? navigator : {};
_0x1ecb40[_0x51d15b(184)] = typeof document !== "undefined" ? document[_0x51d15b(217)] || "" : "", _0x1ecb40["href"] = typeof window !== "undefined" ? window[_0x51d15b(271)][_0x51d15b(175)] || "" : "";
if (_0x1e0a65[_0x51d15b(245)]) _0x1ecb40[_0x51d15b(245)] = _0x1e0a65[_0x51d15b(245)];
if (_0x1e0a65[_0x51d15b(257)]) _0x1ecb40[_0x51d15b(257)] = _0x1e0a65[_0x51d15b(257)];
if (_0x1e0a65[_0x51d15b(291)] != null) _0x1ecb40[_0x51d15b(291)] = _0x1e0a65[_0x51d15b(291)];
_0x1ecb40["ios"] = /iPad|iPhone|iPod/[_0x51d15b(207)](_0x2362fe[_0x51d15b(185)] || ""), _0x1ecb40["platform"] = _0x2362fe[_0x51d15b(201)] || "", _0x1ecb40["userAgent"] = _0x2362fe[_0x51d15b(185)] || "", _0x1ecb40["browserCodeName"] = _0x2362fe[_0x51d15b(262)] || "", _0x1ecb40[_0x51d15b(255)] = _0x2362fe[_0x51d15b(176)] || "", this["_send"](_0x1ecb40);
});
}
}
async [_0x28207e(197)](_0xec3266) {
const _0x22a742 = _0x28207e;
if (this[_0x22a742(247)] || this["reconnecting"]) return;
if (!this[_0x22a742(180)][_0x22a742(263)]) {
this[_0x22a742(180)][_0x22a742(224)](_0x22a742(183), () => {
const _0x1ddc14 = _0x22a742;
this[_0x1ddc14(197)](_0xec3266);
});
return;
}
const _0x500fc5 = { "action": _0x22a742(275), "info_hash": this[_0x22a742(250)]["_infoHashBinary"], "peer_id": this[_0x22a742(250)]["_peerIdBinary"], "data": _0xec3266 };
if (this[_0x22a742(213)]) _0x500fc5["trackerid"] = this[_0x22a742(213)];
this["_send"](_0x500fc5);
}
[_0x28207e(290)](_0x350fe2) {
const _0x14bc0f = _0x28207e;
if (this[_0x14bc0f(247)] || this[_0x14bc0f(289)]) return;
if (!this[_0x14bc0f(180)][_0x14bc0f(263)]) {
this[_0x14bc0f(180)]["once"]("connect", () => {
const _0x2a89ee = _0x14bc0f;
this[_0x2a89ee(290)](_0x350fe2);
});
return;
}
const _0x2b3127 = Array[_0x14bc0f(196)](_0x350fe2["infoHash"]) && _0x350fe2["infoHash"][_0x14bc0f(258)] > 0 ? _0x350fe2[_0x14bc0f(281)][_0x14bc0f(288)]((_0x34dc8e) => hex2bin(_0x34dc8e)) : _0x350fe2[_0x14bc0f(281)] && hex2bin(_0x350fe2[_0x14bc0f(281)]) || this["client"][_0x14bc0f(292)], _0x56522e = { "action": _0x14bc0f(290), "info_hash": _0x2b3127 };
this[_0x14bc0f(187)](_0x56522e);
}
[_0x28207e(206)](_0xbfd4de = noop) {
const _0x343b6a = _0x28207e;
if (this[_0x343b6a(247)]) return _0xbfd4de(null);
this[_0x343b6a(247)] = !![], clearInterval(this[_0x343b6a(225)]), clearTimeout(this[_0x343b6a(174)]);
for (const _0x5daea4 in this["peers"]) {
const _0x4ceb06 = this["peers"][_0x5daea4];
clearTimeout(_0x4ceb06[_0x343b6a(266)]), _0x4ceb06[_0x343b6a(206)]();
}
this[_0x343b6a(252)] = null;
this["socket"] && (this[_0x343b6a(180)][_0x343b6a(190)]("connect", this[_0x343b6a(259)]), this["socket"][_0x343b6a(190)]("data", this["_onSocketDataBound"]), this[_0x343b6a(180)]["removeListener"](_0x343b6a(211), this["_onSocketCloseBound"]), this[_0x343b6a(180)][_0x343b6a(190)](_0x343b6a(293), this["_onSocketErrorBound"]), this[_0x343b6a(180)] = null);
this[_0x343b6a(259)] = null, this[_0x343b6a(267)] = null, this[_0x343b6a(272)] = null, this["_onSocketCloseBound"] = null;
socketPool[this["announceUrl"]] && (socketPool[this["announceUrl"]][_0x343b6a(193)] -= 1);
if (socketPool[this[_0x343b6a(277)]][_0x343b6a(193)] > 0) return _0xbfd4de();
let _0xa056aa = socketPool[this[_0x343b6a(277)]];
delete socketPool[this[_0x343b6a(277)]], _0xa056aa["on"]("error", noop), _0xa056aa["once"](_0x343b6a(211), _0xbfd4de);
let _0x1dcb68;
if (!this[_0x343b6a(226)]) return _0x3e686f();
_0x1dcb68 = setTimeout(_0x3e686f, _0x2e68bb[_0x343b6a(195)]), _0xa056aa[_0x343b6a(224)](_0x343b6a(234), _0x3e686f);
function _0x3e686f() {
const _0x288bad = _0x343b6a;
_0x1dcb68 && (clearTimeout(_0x1dcb68), _0x1dcb68 = null), _0xa056aa[_0x288bad(190)](_0x288bad(234), _0x3e686f), _0xa056aa[_0x288bad(206)](), _0xa056aa = null;
}
}
[_0x28207e(254)]() {
const _0x136e52 = _0x28207e;
this[_0x136e52(247)] = ![];
if (!this["peers"]) this[_0x136e52(252)] = {};
this[_0x136e52(259)] = () => {
const _0x5e193d = _0x136e52;
this[_0x5e193d(265)]();
}, this["_onSocketErrorBound"] = (_0x28110a) => {
this["_onSocketError"](_0x28110a);
}, this["_onSocketDataBound"] = (_0x50b090) => {
const _0x497446 = _0x136e52;
this[_0x497446(246)](_0x50b090);
}, this[_0x136e52(270)] = () => {
const _0x392a84 = _0x136e52;
this[_0x392a84(239)]();
}, this[_0x136e52(180)] = socketPool[this[_0x136e52(277)]];
if (this["socket"]) socketPool[this[_0x136e52(277)]][_0x136e52(193)] += 1, this[_0x136e52(180)][_0x136e52(263)] && this[_0x136e52(259)]();
else {
const _0x2cb8bd = new URL(this["announceUrl"]);
let _0x3a854d;
this["client"][_0x136e52(243)] && (_0x3a854d = _0x2cb8bd[_0x136e52(189)] === _0x136e52(171) ? this["client"][_0x136e52(243)][_0x136e52(221)] : this["client"][_0x136e52(243)][_0x136e52(222)], !_0x3a854d && this["client"][_0x136e52(243)]["socksProxy"] && (_0x3a854d = this[_0x136e52(250)][_0x136e52(243)][_0x136e52(256)])), this[_0x136e52(180)] = socketPool[this[_0x136e52(277)]] = new Socket({ "url": this["announceUrl"], "agent": _0x3a854d }), this[_0x136e52(180)][_0x136e52(193)] = 1, this[_0x136e52(180)][_0x136e52(224)]("connect", this[_0x136e52(259)]);
}
this[_0x136e52(180)]["on"](_0x136e52(234), this[_0x136e52(272)]), this[_0x136e52(180)][_0x136e52(224)](_0x136e52(211), this["_onSocketCloseBound"]), this[_0x136e52(180)]["once"](_0x136e52(293), this[_0x136e52(267)]);
}
[_0x28207e(265)]() {
const _0x4d1f08 = _0x28207e;
if (this["destroyed"]) return;
this["reconnecting"] && (this["reconnecting"] = ![], this[_0x4d1f08(167)] = 0, this[_0x4d1f08(182)](this[_0x4d1f08(250)]["_defaultAnnounceOpts"]()));
}
[_0x28207e(246)](_0x44cdb7) {
const _0x53c7d1 = _0x28207e;
if (this[_0x53c7d1(247)]) return;
this[_0x53c7d1(226)] = ![];
try {
_0x44cdb7 = JSON[_0x53c7d1(284)](arr2text(_0x44cdb7));
} catch (_0x46e31d) {
this["client"][_0x53c7d1(294)](_0x53c7d1(218), new Error("Invalid tracker response"));
return;
}
if (_0x44cdb7[_0x53c7d1(173)] === _0x53c7d1(182)) this[_0x53c7d1(279)](_0x44cdb7);
else {
if (_0x44cdb7[_0x53c7d1(173)] === _0x53c7d1(290)) this[_0x53c7d1(241)](_0x44cdb7);
else _0x44cdb7[_0x53c7d1(173)] === _0x53c7d1(275) ? this["client"]["emit"](_0x53c7d1(275), _0x44cdb7) : this[_0x53c7d1(232)](new Error(_0x53c7d1(282) + _0x44cdb7[_0x53c7d1(173)]));
}
}
[_0x28207e(279)](_0x2769b7) {
const _0x466e99 = _0x28207e;
if (_0x2769b7["info_hash"] !== this[_0x466e99(250)]["_infoHashBinary"]) {
debug$1("ignoring websocket data from %s for %s (looking for %s: reused socket)", this[_0x466e99(277)], bin2hex(_0x2769b7[_0x466e99(251)]), this["client"][_0x466e99(281)]);
return;
}
if (_0x2769b7["peer_id"] && _0x2769b7[_0x466e99(235)] === this[_0x466e99(250)][_0x466e99(205)]) return;
debug$1(_0x466e99(198), JSON[_0x466e99(285)](_0x2769b7), this["announceUrl"], this[_0x466e99(250)][_0x466e99(281)]);
const _0x2a86b8 = _0x2769b7[_0x466e99(228)];
if (_0x2a86b8) return this[_0x466e99(250)]["emit"](_0x466e99(218), new Error(_0x2a86b8));
const _0x136881 = _0x2769b7[_0x466e99(249)];
if (_0x136881) this[_0x466e99(250)][_0x466e99(294)](_0x466e99(218), new Error(_0x136881));
const _0x486cf3 = _0x2769b7[_0x466e99(225)] || _0x2769b7[_0x466e99(188)];
if (_0x486cf3) this[_0x466e99(260)](_0x486cf3 * 1e3);
const _0x3345d8 = _0x2769b7[_0x466e99(287)];
_0x3345d8 && (this[_0x466e99(213)] = _0x3345d8);
if (_0x2769b7[_0x466e99(179)] != null) {
const _0x5bd7d0 = Object[_0x466e99(264)]({}, _0x2769b7, { "announce": this[_0x466e99(277)], "infoHash": bin2hex(_0x2769b7["info_hash"]) });
this[_0x466e99(250)][_0x466e99(294)](_0x466e99(261), _0x5bd7d0);
}
let _0x10b32d;
_0x2769b7["offer"] && _0x2769b7[_0x466e99(235)] && (debug$1(_0x466e99(215)), _0x10b32d = this[_0x466e99(233)](), _0x10b32d["id"] = bin2hex(_0x2769b7["peer_id"]), _0x10b32d[_0x466e99(224)](_0x466e99(253), (_0x3cfe59) => {
const _0x164709 = _0x466e99, _0x2273fc = { "action": _0x164709(182), "info_hash": this["client"][_0x164709(292)], "peer_id": this["client"][_0x164709(205)], "to_peer_id": _0x2769b7[_0x164709(235)], "answer": _0x3cfe59, "offer_id": _0x2769b7[_0x164709(269)] };
if (this[_0x164709(213)]) _0x2273fc["trackerid"] = this[_0x164709(213)];
this[_0x164709(187)](_0x2273fc);
}), this[_0x466e99(250)][_0x466e99(294)]("peer", _0x10b32d), _0x10b32d["signal"](_0x2769b7[_0x466e99(231)]));
if (_0x2769b7[_0x466e99(230)] && _0x2769b7[_0x466e99(235)]) {
const _0xfb8b9 = bin2hex(_0x2769b7[_0x466e99(269)]);
_0x10b32d = this[_0x466e99(252)][_0xfb8b9], _0x10b32d ? (_0x10b32d["id"] = bin2hex(_0x2769b7["peer_id"]), this["client"]["emit"](_0x466e99(192), _0x10b32d), _0x10b32d[_0x466e99(253)](_0x2769b7[_0x466e99(230)]), clearTimeout(_0x10b32d[_0x466e99(266)]), _0x10b32d["trackerTimeout"] = null, delete this[_0x466e99(252)][_0xfb8b9]) : debug$1(_0x466e99(212) + JSON[_0x466e99(285)](_0x2769b7[_0x466e99(230)]));
}
}
[_0x28207e(241)](_0x3c0150) {
const _0xde8337 = _0x28207e;
_0x3c0150 = _0x3c0150["files"] || {};
const _0x20bbf6 = Object["keys"](_0x3c0150);
if (_0x20bbf6[_0xde8337(258)] === 0) {
this[_0xde8337(250)]["emit"](_0xde8337(218), new Error(_0xde8337(177)));
return;
}
_0x20bbf6[_0xde8337(170)]((_0x2e4e14) => {
const _0x6a9a03 = _0xde8337, _0x44afaa = Object[_0x6a9a03(264)](_0x3c0150[_0x2e4e14], { "announce": this[_0x6a9a03(277)], "infoHash": bin2hex(_0x2e4e14) });
this[_0x6a9a03(250)][_0x6a9a03(294)]("scrape", _0x44afaa);
});
}
[_0x28207e(239)]() {
const _0x4e42fb = _0x28207e;
if (this["destroyed"]) return;
this["destroy"](), this[_0x4e42fb(200)]();
}
["_onSocketError"](_0x4ce4e0) {
const _0x3b30f2 = _0x28207e;
if (this["destroyed"]) return;
this[_0x3b30f2(206)](), this[_0x3b30f2(250)][_0x3b30f2(294)](_0x3b30f2(218), _0x4ce4e0), this[_0x3b30f2(200)]();
}
[_0x28207e(200)]() {
const _0x451675 = _0x28207e, _0x2533b9 = Math[_0x451675(169)](Math["random"]() * RECONNECT_VARIANCE) + Math[_0x451675(219)](Math[_0x451675(208)](2, this[_0x451675(167)]) * RECONNECT_MINIMUM, RECONNECT_MAXIMUM);
this[_0x451675(289)] = !![], clearTimeout(this[_0x451675(174)]), this["reconnectTimer"] = setTimeout(() => {
const _0x1ad94b = _0x451675;
this[_0x1ad94b(167)]++, this[_0x1ad94b(254)]();
}, _0x2533b9);
if (this["reconnectTimer"][_0x451675(278)]) this[_0x451675(174)][_0x451675(278)]();
debug$1(_0x451675(227), _0x2533b9);
}
[_0x28207e(187)](_0x1fe07d) {
const _0x411d58 = _0x28207e;
if (this["destroyed"]) return;
this[_0x411d58(226)] = !![];
const _0x368d4e = JSON[_0x411d58(285)](_0x1fe07d);
debug$1("send %s", _0x368d4e), this["socket"][_0x411d58(194)](_0x368d4e);
}
[_0x28207e(248)](_0x5a5ff7, _0x45ef8b) {
const _0x5e4059 = _0x28207e, _0x20bf6c = this, _0x227427 = [];
debug$1(_0x5e4059(191), _0x5a5ff7);
for (let _0x2d7507 = 0; _0x2d7507 < _0x5a5ff7; ++_0x2d7507) {
_0x15c0e0();
}
_0x2d7695();
function _0x15c0e0() {
const _0x56f130 = _0x5e4059, _0x55c55e = arr2hex(randomBytes(20));
debug$1(_0x56f130(236));
const _0x54c88b = _0x20bf6c[_0x56f130(252)][_0x55c55e] = _0x20bf6c[_0x56f130(233)]({ "initiator": !![] });
_0x54c88b[_0x56f130(224)](_0x56f130(253), (_0x10790d) => {
const _0x1ddb86 = _0x56f130;
_0x227427[_0x1ddb86(238)]({ "offer": _0x10790d, "offer_id": hex2bin(_0x55c55e) }), _0x2d7695();
}), _0x54c88b[_0x56f130(266)] = setTimeout(() => {
const _0x57fd01 = _0x56f130;
debug$1(_0x57fd01(273)), _0x54c88b[_0x57fd01(266)] = null, delete _0x20bf6c["peers"][_0x55c55e], _0x54c88b[_0x57fd01(206)]();
}, OFFER_TIMEOUT);
if (_0x54c88b[_0x56f130(266)]["unref"]) _0x54c88b[_0x56f130(266)]["unref"]();
}
function _0x2d7695() {
const _0x23ebc4 = _0x5e4059;
_0x227427[_0x23ebc4(258)] === _0x5a5ff7 && (debug$1(_0x23ebc4(214), _0x5a5ff7), _0x45ef8b(_0x227427));
}
}
[_0x28207e(233)](_0x365a8e) {
const _0x1187fc = _0x28207e, _0x38ced3 = this;
_0x365a8e = Object[_0x1187fc(264)]({ "trickle": ![], "config": _0x38ced3["client"][_0x1187fc(204)], "wrtc": _0x38ced3[_0x1187fc(250)][_0x1187fc(181)] }, _0x365a8e);
const _0x56e624 = new Peer$1(_0x365a8e);
_0x56e624[_0x1187fc(224)](_0x1187fc(293), _0x557ca8), _0x56e624[_0x1187fc(224)](_0x1187fc(183), _0x1c4e83);
return _0x56e624;
function _0x557ca8(_0x11822e) {
const _0x2a9f19 = _0x1187fc;
_0x38ced3["client"][_0x2a9f19(294)](_0x2a9f19(218), new Error(_0x2a9f19(276) + _0x11822e[_0x2a9f19(286)])), _0x56e624[_0x2a9f19(206)]();
}
function _0x1c4e83() {
const _0x3308f4 = _0x1187fc;
_0x56e624[_0x3308f4(190)](_0x3308f4(293), _0x557ca8), _0x56e624[_0x3308f4(190)](_0x3308f4(183), _0x1c4e83);
}
}
}
WebSocketTracker[_0x28207e(210)][_0x28207e(168)] = 30 * 1e3, WebSocketTracker["_socketPool"] = socketPool;
function noop() {
}
function _0x28a6(_0x539124, _0x1f5946) {
const _0x582455 = _0x5824();
return _0x28a6 = function(_0x28a64a, _0x18fe53) {
_0x28a64a = _0x28a64a - 199;
let _0x12aa26 = _0x582455[_0x28a64a];
return _0x12aa26;
}, _0x28a6(_0x539124, _0x1f5946);
}
const _0x34df2b = _0x28a6;
(function(_0xf6dfdf, _0x54c94a) {
const _0x57b1ec = _0x28a6, _0x3e0bcd = _0xf6dfdf();
while (!![]) {
try {
const _0x39e880 = parseInt(_0x57b1ec(211)) / 1 * (-parseInt(_0x57b1ec(227)) / 2) + -parseInt(_0x57b1ec(215)) / 3 + -parseInt(_0x57b1ec(236)) / 4 + parseInt(_0x57b1ec(242)) / 5 * (parseInt(_0x57b1ec(199)) / 6) + parseInt(_0x57b1ec(202)) / 7 + parseInt(_0x57b1ec(231)) / 8 + -parseInt(_0x57b1ec(218)) / 9;
if (_0x39e880 === _0x54c94a) break;
else _0x3e0bcd["push"](_0x3e0bcd["shift"]());
} catch (_0x201859) {
_0x3e0bcd["push"](_0x3e0bcd["shift"]());
}
}
})(_0x5824, 818327);
const debug = _0x1bf98d("bittorrent-tracker:client");
class Client extends EventEmitter {
constructor(_0x14b384 = {}) {
const _0x5b14a4 = _0x28a6;
super();
if (!_0x14b384[_0x5b14a4(212)]) throw new Error(_0x5b14a4(225));
if (!_0x14b384[_0x5b14a4(265)]) throw new Error("Option `infoHash` is required");
if (!_0x14b384[_0x5b14a4(233)]) throw new Error(_0x5b14a4(234));
if (![]) throw new Error("Option `port` is required");
this[_0x5b14a4(212)] = typeof _0x14b384["peerId"] === _0x5b14a4(251) ? _0x14b384[_0x5b14a4(212)] : arr2hex(_0x14b384[_0x5b14a4(212)]), this["_peerIdBuffer"] = hex2arr(this["peerId"]), this["_peerIdBinary"] = hex2bin(this[_0x5b14a4(212)]), this[_0x5b14a4(265)] = typeof _0x14b384["infoHash"] === _0x5b14a4(251) ? _0x14b384[_0x5b14a4(265)][_0x5b14a4(206)]() : arr2hex(_0x14b384[_0x5b14a4(265)]), this[_0x5b14a4(237)] = hex2arr(this[_0x5b14a4(265)]), this["_infoHashBinary"] = hex2bin(this[_0x5b14a4(265)]), debug("new client %s", this[_0x5b14a4(265)]), this["destroyed"] = ![], this[_0x5b14a4(205)] = _0x14b384[_0x5b14a4(238)], this["_getAnnounceOpts"] = _0x14b384[_0x5b14a4(245)], this["_rtcConfig"] = _0x14b384["rtcConfig"], this[_0x5b14a4(260)] = _0x14b384["userAgent"], this["_proxyOpts"] = _0x14b384[_0x5b14a4(221)], this[_0x5b14a4(203)] = typeof _0x14b384["wrtc"] === _0x5b14a4(230) ? _0x14b384[_0x5b14a4(254)]() : _0x14b384["wrtc"];
let _0x96998f = typeof _0x14b384[_0x5b14a4(233)] === _0x5b14a4(251) ? [_0x14b384[_0x5b14a4(233)]] : _0x14b384["announce"] == null ? [] : _0x14b384[_0x5b14a4(233)];
_0x96998f = _0x96998f[_0x5b14a4(256)]((_0x106c90) => {
const _0x1165cd = _0x5b14a4;
if (ArrayBuffer["isView"](_0x106c90)) _0x106c90 = arr2text(_0x106c90);
return _0x106c90[_0x106c90[_0x1165cd(259)] - 1] === "/" && (_0x106c90 = _0x106c90[_0x1165cd(244)](0, _0x106c90[_0x1165cd(259)] - 1)), _0x106c90;
}), _0x96998f = Array["from"](new Set(_0x96998f));
const _0x4b8849 = this["_wrtc"] !== ![] && (!!this["_wrtc"] || Peer$1[_0x5b14a4(207)]), _0x32167c = (_0x5a5182) => {
_0xf472f7(() => {
const _0x2da3ad = _0x28a6;
this["emit"](_0x2da3ad(252), _0x5a5182);
});
};
this[_0x5b14a4(255)] = _0x96998f[_0x5b14a4(256)]((_0x514a62) => {
const _0xe4e451 = _0x5b14a4;
let _0x3a7797;
try {
_0x3a7797 = _0x2e68bb[_0xe4e451(250)](_0x514a62);
} catch (_0x601b21) {
return _0x32167c(new Error(_0xe4e451(248) + _0x514a62)), null;
}
const _0x196581 = _0x3a7797["port"];
if (_0x196581 < 0 || _0x196581 > 65535) return _0x32167c(new Error(_0xe4e451(264) + _0x514a62)), null;
const _0x1191a7 = _0x3a7797[_0xe4e451(209)];
if ((_0x1191a7 === _0xe4e451(246) || _0x1191a7 === _0xe4e451(220)) && _0x4b8849) {
if (_0x1191a7 === _0xe4e451(246) && typeof window !== _0xe4e451(241) && window["location"][_0xe4e451(209)] === _0xe4e451(267)) return _0x32167c(new Error(_0xe4e451(258) + _0x514a62)), null;
return new WebSocketTracker(this, _0x514a62);
} else return _0x32167c(new Error("Unsupported tracker protocol: " + _0x514a62)), null;
})[_0x5b14a4(229)](Boolean);
}
[_0x34df2b(261)](_0x32a00c) {
const _0x47a85d = _0x34df2b;
_0x32a00c = this[_0x47a85d(249)](_0x32a00c), _0x32a00c[_0x47a85d(222)] = "started", debug(_0x47a85d(240), _0x32a00c), this[_0x47a85d(262)](_0x32a00c), this[_0x47a85d(255)][_0x47a85d(217)]((_0xfb1a41) => {
const _0x4bd3f5 = _0x47a85d;
_0xfb1a41[_0x4bd3f5(228)]();
});
}
[_0x34df2b(239)](_0x791e70) {
const _0x3a895e = _0x34df2b;
_0x791e70 = this[_0x3a895e(249)](_0x791e70), _0x791e70["event"] = _0x3a895e(257), debug("send `stop` %o", _0x791e70), this["_announce"](_0x791e70);
}
["complete"](_0x19fa05) {
const _0x471f64 = _0x34df2b;
if (!_0x19fa05) _0x19fa05 = {};
_0x19fa05 = this[_0x471f64(249)](_0x19fa05), _0x19fa05[_0x471f64(222)] = _0x471f64(213), debug("send `complete` %o", _0x19fa05), this[_0x471f64(262)](_0x19fa05);
}
[_0x34df2b(226)](_0x50a620) {
const _0x5f5d84 = _0x34df2b;
_0x50a620 = this[_0x5f5d84(249)](_0x50a620);
if (_0x50a620[_0x5f5d84(222)]) delete _0x50a620[_0x5f5d84(222)];
debug(_0x5f5d84(201), _0x50a620), this[_0x5f5d84(262)](_0x50a620);
}
async [_0x34df2b(263)](_0xd267fe) {
const _0x1b9bab = _0x34df2b, _0x3ba720 = this[_0x1b9bab(255)][0];
_0x3ba720 && typeof _0x3ba720[_0x1b9bab(263)] === "function" && _0x3ba720["statsCollector"](_0xd267fe);
}
["_announce"](_0x174288) {
const _0x23c954 = _0x34df2b;
this[_0x23c954(255)][_0x23c954(217)]((_0x3513e5) => {
const _0x74f6d6 = _0x23c954;
_0x3513e5[_0x74f6d6(233)](_0x174288);
});
}
[_0x34df2b(266)](_0x5c96a1) {
const _0x475978 = _0x34df2b;
debug(_0x475978(200));
if (!_0x5c96a1) _0x5c96a1 = {};
this[_0x475978(255)][_0x475978(217)]((_0x2db160) => {
const _0x535af0 = _0x475978;
_0x2db160[_0x535af0(266)](_0x5c96a1);
});
}
[_0x34df2b(228)](_0x1db6c4) {
const _0x4ae53c = _0x34df2b;
debug("setInterval %d", _0x1db6c4), this[_0x4ae53c(255)][_0x4ae53c(217)]((_0x4c3f2f) => {
const _0x4f4259 = _0x4ae53c;
_0x4c3f2f[_0x4f4259(228)](_0x1db6c4);
});
}
["destroy"](_0x4fd34d) {
const _0x391e5e = _0x34df2b;
if (this[_0x391e5e(223)]) return;
this[_0x391e5e(223)] = !![], debug(_0x391e5e(235));
const _0x59b5aa = this[_0x391e5e(255)][_0x391e5e(256)]((_0x3e5895) => (_0xf503a6) => {
const _0x418e6f = _0x391e5e;
_0x3e5895[_0x418e6f(235)](_0xf503a6);
});
_0x2e9e5b(_0x59b5aa, _0x4fd34d), this["_trackers"] = [], this[_0x391e5e(253)] = null;
}
[_0x34df2b(249)](_0x4b7d06 = {}) {
const _0x1999d5 = _0x34df2b;
if (_0x4b7d06[_0x1999d5(224)] == null) _0x4b7d06["numwant"] = _0x2e68bb[_0x1999d5(243)];
if (_0x4b7d06[_0x1999d5(219)] == null) _0x4b7d06[_0x1999d5(219)] = 0;
if (_0x4b7d06[_0x1999d5(210)] == null) _0x4b7d06[_0x1999d5(210)] = 0;
if (this[_0x1999d5(253)]) _0x4b7d06 = Object[_0x1999d5(247)]({}, _0x4b7d06, this["_getAnnounceOpts"]());
return _0x4b7d06;
}
}
Client[_0x34df2b(266)] = (_0x12e608, _0x5b5f52) => {
const _0x1f1bd1 = _0x34df2b;
_0x5b5f52 = _0x32e5ff(_0x5b5f52);
if (!_0x12e608[_0x1f1bd1(265)]) throw new Error(_0x1f1bd1(232));
if (!_0x12e608[_0x1f1bd1(233)]) throw new Error("Option `announce` is required");
const _0x419f31 = Object[_0x1f1bd1(247)]({}, _0x12e608, { "infoHash": Array[_0x1f1bd1(208)](_0x12e608["infoHash"]) ? _0x12e608[_0x1f1bd1(265)][0] : _0x12e608[_0x1f1bd1(265)], "peerId": text2arr(_0x1f1bd1(204)), "port": 6881 }), _0x526bbc = new Client(_0x419f31);
_0x526bbc["once"](_0x1f1bd1(216), _0x5b5f52), _0x526bbc["once"](_0x1f1bd1(252), _0x5b5f52);
let _0x23ab72 = Array["isArray"](_0x12e608["infoHash"]) ? _0x12e608[_0x1f1bd1(265)][_0x1f1bd1(259)] : 1;
const _0x460d0f = {};
return _0x526bbc["on"](_0x1f1bd1(266), (_0x2e60b9) => {
const _0x8bc0ef = _0x1f1bd1;
_0x23ab72 -= 1, _0x460d0f[_0x2e60b9[_0x8bc0ef(265)]] = _0x2e60b9;
if (_0x23ab72 === 0) {
_0x526bbc["destroy"]();
const _0x3958b8 = Object[_0x8bc0ef(214)](_0x460d0f);
_0x3958b8[_0x8bc0ef(259)] === 1 ? _0x5b5f52(null, _0x460d0f[_0x3958b8[0]]) : _0x5b5f52(null, _0x460d0f);
}
}), _0x526bbc[_0x1f1bd1(266)]({ "infoHash": _0x12e608[_0x1f1bd1(265)] }), _0x526bbc;
};
function _0x5824() {
const _0x4f0215 = ["scrape", "https:", "114vYYPWH", "send `scrape`", "send `update` %o", "10742914UOJyRQ", "_wrtc", "01234567890123456789", "_port", "toLowerCase", "WEBRTC_SUPPORT", "isArray", "protocol", "downloaded", "6ikpImi", "peerId", "completed", "keys", "1781790iYZSfH", "error", "forEach", "2041668pUdFGB", "uploaded", "wss:", "proxyOpts", "event", "destroyed", "numwant", "Option `peerId` is required", "update", "292348TnjihH", "setInterval", "filter", "function", "11116040pkmQLM", "Option `infoHash` is required", "announce", "Option `announce` is required", "destroy", "5034204zfbpVj", "_infoHashBuffer", "port", "stop", "send `start` %o", "undefined", "223815DarWOh", "DEFAULT_ANNOUNCE_PEERS", "substring", "getAnnounceOpts", "ws:", "assign", "Invalid tracker URL: ", "_defaultAnnounceOpts", "parseUrl", "string", "warning", "_getAnnounceOpts", "wrtc", "_trackers", "map", "stopped", "Unsupported tracker protocol: ", "length", "_userAgent", "start", "_announce", "statsCollector", "Invalid tracker port: ", "infoHash"];
_0x5824 = function() {
return _0x4f0215;
};
return _0x5824();
}
function _0x2f29(_0x1c0e89, _0x3bed3f) {
var _0x236188 = _0x2361();
return _0x2f29 = function(_0x2f2926, _0x23c0ff) {
_0x2f2926 = _0x2f2926 - 279;
var _0xa56446 = _0x236188[_0x2f2926];
return _0xa56446;
}, _0x2f29(_0x1c0e89, _0x3bed3f);
}
(function(_0x5da414, _0x1dbef1) {
var _0x464ef7 = _0x2f29, _0x33ed2e = _0x5da414();
while (!![]) {
try {
var _0x54c542 = parseInt(_0x464ef7(280)) / 1 + parseInt(_0x464ef7(286)) / 2 + -parseInt(_0x464ef7(281)) / 3 * (-parseInt(_0x464ef7(279)) / 4) + parseInt(_0x464ef7(283)) / 5 + -parseInt(_0x464ef7(285)) / 6 + parseInt(_0x464ef7(282)) / 7 * (parseInt(_0x464ef7(287)) / 8) + -parseInt(_0x464ef7(288)) / 9 * (parseInt(_0x464ef7(284)) / 10);
if (_0x54c542 === _0x1dbef1) break;
else _0x33ed2e["push"](_0x33ed2e["shift"]());
} catch (_0x56616f) {
_0x33ed2e["push"](_0x33ed2e["shift"]());
}
}
})(_0x2361, 402880);
function _0x2361() {
var _0x1c444f = ["15752WxyzCR", "9AhitkJ", "68vNUTJJ", "214717efDptz", "107997ADMAyx", "455iCVKsb", "1634930jyeXYJ", "12385370GoGvJP", "109998wHSbQm", "756158edxuHr"];
_0x2361 = function() {
return _0x1c444f;
};
return _0x2361();
}
var md5 = { exports: {} };
var hasRequiredMd5;
function requireMd5() {
if (hasRequiredMd5) return md5.exports;
hasRequiredMd5 = 1;
function FF(a, b, c, d, m, s, k) {
var n = a + (b & c | ~b & d) + (m >>> 0) + k;
return (n << s | n >>> 32 - s) + b;
}
function GG(a, b, c, d, m, s, k) {
var n = a + (b & d | c & ~d) + (m >>> 0) + k;
return (n << s | n >>> 32 - s) + b;
}
function HH(a, b, c, d, m, s, k) {
var n = a + (b ^ c ^ d) + (m >>> 0) + k;
return (n << s | n >>> 32 - s) + b;
}
function II(a, b, c, d, m, s, k) {
var n = a + (c ^ (b | ~d)) + (m >>> 0) + k;
return (n << s | n >>> 32 - s) + b;
}
function byteToHex(byte) {
return (256 + (byte & 255)).toString(16).substr(-2);
}
function bs(byte) {
return String.fromCharCode(byte & 255);
}
function wordToBytes(word) {
return bs(word) + bs(word >>> 8) + bs(word >>> 16) + bs(word >>> 24);
}
var utf8toBytes = function(utf8) {
return unescape(encodeURIComponent(utf8));
};
function bytesToWords(bytes) {
var bytes_count = bytes.length, bits_count = bytes_count << 3, words = new Uint32Array(bytes_count + 72 >>> 6 << 4);
for (var i = 0, n = bytes.length; i < n; ++i)
words[i >>> 2] |= bytes.charCodeAt(i) << ((i & 3) << 3);
words[bytes_count >> 2] |= 128 << (bits_count & 31);
words[words.length - 2] = bits_count;
return words;
}
var exports = md5.exports = function md52(utf8) {
return utf8toMD5(utf8).toHex();
};
var bytesToMD5 = exports.fromBytes = function(bytes) {
var words = bytesToWords(bytes), a = 1732584193, b = 4023233417, c = 2562383102, d = 271733878, S11 = 7, S12 = 12, S13 = 17, S14 = 22, S21 = 5, S22 = 9, S23 = 14, S24 = 20, S31 = 4, S32 = 11, S33 = 16, S34 = 23, S41 = 6, S42 = 10, S43 = 15, S44 = 21;
for (var i = 0, ws2 = words.length; i < ws2; i += 16) {
var AA = a, BB = b, CC = c, DD = d;
a = FF(a, b, c, d, words[i + 0], S11, 3614090360);
d = FF(d, a, b, c, words[i + 1], S12, 3905402710);
c = FF(c, d, a, b, words[i + 2], S13, 606105819);
b = FF(b, c, d, a, words[i + 3], S14, 3250441966);
a = FF(a, b, c, d, words[i + 4], S11, 4118548399);
d = FF(d, a, b, c, words[i + 5], S12, 1200080426);
c = FF(c, d, a, b, words[i + 6], S13, 2821735955);
b = FF(b, c, d, a, words[i + 7], S14, 4249261313);
a = FF(a, b, c, d, words[i + 8], S11, 1770035416);
d = FF(d, a, b, c, words[i + 9], S12, 2336552879);
c = FF(c, d, a, b, words[i + 10], S13, 4294925233);
b = FF(b, c, d, a, words[i + 11], S14, 2304563134);
a = FF(a, b, c, d, words[i + 12], S11, 1804603682);
d = FF(d, a, b, c, words[i + 13], S12, 4254626195);
c = FF(c, d, a, b, words[i + 14], S13, 2792965006);
b = FF(b, c, d, a, words[i + 15], S14, 1236535329);
a = GG(a, b, c, d, words[i + 1], S21, 4129170786);
d = GG(d, a, b, c, words[i + 6], S22, 3225465664);
c = GG(c, d, a, b, words[i + 11], S23, 643717713);
b = GG(b, c, d, a, words[i + 0], S24, 3921069994);
a = GG(a, b, c, d, words[i + 5], S21, 3593408605);
d = GG(d, a, b, c, words[i + 10], S22, 38016083);
c = GG(c, d, a, b, words[i + 15], S23, 3634488961);
b = GG(b, c, d, a, words[i + 4], S24, 3889429448);
a = GG(a, b, c, d, words[i + 9], S21, 568446438);
d = GG(d, a, b, c, words[i + 14], S22, 3275163606);
c = GG(c, d, a, b, words[i + 3], S23, 4107603335);
b = GG(b, c, d, a, words[i + 8], S24, 1163531501);
a = GG(a, b, c, d, words[i + 13], S21, 2850285829);
d = GG(d, a, b, c, words[i + 2], S22, 4243563512);
c = GG(c, d, a, b, words[i + 7], S23, 1735328473);
b = GG(b, c, d, a, words[i + 12], S24, 2368359562);
a = HH(a, b, c, d, words[i + 5], S31, 4294588738);
d = HH(d, a, b, c, words[i + 8], S32, 2272392833);
c = HH(c, d, a, b, words[i + 11], S33, 1839030562);
b = HH(b, c, d, a, words[i + 14], S34, 4259657740);
a = HH(a, b, c, d, words[i + 1], S31, 2763975236);
d = HH(d, a, b, c, words[i + 4], S32, 1272893353);
c = HH(c, d, a, b, words[i + 7], S33, 4139469664);
b = HH(b, c, d, a, words[i + 10], S34, 3200236656);
a = HH(a, b, c, d, words[i + 13], S31, 681279174);
d = HH(d, a, b, c, words[i + 0], S32, 3936430074);
c = HH(c, d, a, b, words[i + 3], S33, 3572445317);
b = HH(b, c, d, a, words[i + 6], S34, 76029189);
a = HH(a, b, c, d, words[i + 9], S31, 3654602809);
d = HH(d, a, b, c, words[i + 12], S32, 3873151461);
c = HH(c, d, a, b, words[i + 15], S33, 530742520);
b = HH(b, c, d, a, words[i + 2], S34, 3299628645);
a = II(a, b, c, d, words[i + 0], S41, 4096336452);
d = II(d, a, b, c, words[i + 7], S42, 1126891415);
c = II(c, d, a, b, words[i + 14], S43, 2878612391);
b = II(b, c, d, a, words[i + 5], S44, 4237533241);
a = II(a, b, c, d, words[i + 12], S41, 1700485571);
d = II(d, a, b, c, words[i + 3], S42, 2399980690);
c = II(c, d, a, b, words[i + 10], S43, 4293915773);
b = II(b, c, d, a, words[i + 1], S44, 2240044497);
a = II(a, b, c, d, words[i + 8], S41, 1873313359);
d = II(d, a, b, c, words[i + 15], S42, 4264355552);
c = II(c, d, a, b, words[i + 6], S43, 2734768916);
b = II(b, c, d, a, words[i + 13], S44, 1309151649);
a = II(a, b, c, d, words[i + 4], S41, 4149444226);
d = II(d, a, b, c, words[i + 11], S42, 3174756917);
c = II(c, d, a, b, words[i + 2], S43, 718787259);
b = II(b, c, d, a, words[i + 9], S44, 3951481745);
a = a + AA >>> 0;
b = b + BB >>> 0;
c = c + CC >>> 0;
d = d + DD >>> 0;
}
var hash_bytes = new String(wordToBytes(a) + wordToBytes(b) + wordToBytes(c) + wordToBytes(d));
hash_bytes.toHex = function() {
var hex = "";
for (var i2 = 0, n = hash_bytes.length; i2 < n; ++i2)
hex += byteToHex(hash_bytes.charCodeAt(i2));
return hex;
};
return hash_bytes;
};
var utf8toMD5 = exports.fromUtf8 = function(utf8) {
return bytesToMD5(utf8toBytes(utf8));
};
var b64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
function to64(u, n) {
for (var s = ""; --n >= 0; u >>>= 6)
s += b64.charAt(u & 63);
return s;
}
var MAX_KEY_LENGTH = 64, b64_map = [0, 6, 12, 1, 7, 13, 2, 8, 14, 3, 9, 15, 4, 10, 5, 11];
var gen_salt = exports.salt = function(n) {
var s = "";
if (!n)
n = 8;
do {
s += b64.charAt(64 * Math.random() >>> 0);
} while (--n);
return s;
};
exports.crypt = function(key, setting) {
if (key.length > MAX_KEY_LENGTH)
throw Error("too long key");
if (!setting)
setting = "$1$" + gen_salt();
key = utf8toBytes(key);
var salt = utf8toBytes(setting.replace(/^\$1\$([^$]+)(?:\$.*)?$/, "$1")), md = bytesToMD5(key + salt + key), s = key + "$1$" + salt;
for (var kl = key.length; kl > 16; kl -= 16)
s += md;
s += md.slice(0, kl);
for (var kl = key.length; kl; kl >>= 1)
s += kl & 1 ? "\0" : key.charAt(0);
md = bytesToMD5(s);
for (var i = 0; i < 1e3; ++i)
md = bytesToMD5((i & 1 ? key : md) + (i % 3 ? salt : "") + (i % 7 ? key : "") + (i & 1 ? md : key));
var h = "$1$" + salt + "$";
for (var i = 0; i < 15; i += 3)
h += to64(
md.charCodeAt(b64_map[i + 0]) << 16 | md.charCodeAt(b64_map[i + 1]) << 8 | md.charCodeAt(b64_map[i + 2]),
4
);
return h + to64(md.charCodeAt(b64_map[15]), 2);
};
return md5.exports;
}
var md5Exports = requireMd5();
const _0x5d7510 = /* @__PURE__ */ getDefaultExportFromCjs(md5Exports);
(function(_0x4af3e4, _0x265a24) {
const _0x5be1c2 = _0x3b70, _0x489076 = _0x4af3e4();
while (!![]) {
try {
const _0x42e3c1 = parseInt(_0x5be1c2(315)) / 1 + -parseInt(_0x5be1c2(318)) / 2 + -parseInt(_0x5be1c2(311)) / 3 + -parseInt(_0x5be1c2(313)) / 4 * (parseInt(_0x5be1c2(320)) / 5) + -parseInt(_0x5be1c2(316)) / 6 + parseInt(_0x5be1c2(317)) / 7 * (-parseInt(_0x5be1c2(319)) / 8) + parseInt(_0x5be1c2(314)) / 9 * (parseInt(_0x5be1c2(312)) / 10);
if (_0x42e3c1 === _0x265a24) break;
else _0x489076["push"](_0x489076["shift"]());
} catch (_0xfe3a4f) {
_0x489076["push"](_0x489076["shift"]());
}
}
})(_0x40d2, 656525);
function _0x3b70(_0x543f88, _0x391ec6) {
const _0x40d277 = _0x40d2();
return _0x3b70 = function(_0x3b700d, _0x338c3b) {
_0x3b700d = _0x3b700d - 311;
let _0x452473 = _0x40d277[_0x3b700d];
return _0x452473;
}, _0x3b70(_0x543f88, _0x391ec6);
}
const PACKAGE_VERSION = "2.1.0";
function _0x40d2() {
const _0x224561 = ["2708580sVyapV", "284pLMDHQ", "54BIgeLr", "1039726tTdmPM", "3253194pOgCTT", "14acLcwB", "384696gvJCvK", "1811768pvRrJY", "38150CnBWOI", "837390ywhLAH"];
_0x40d2 = function() {
return _0x224561;
};
return _0x40d2();
}
const _0x5af6ab = _0x56cc;
function _0x3810() {
const _0x16b550 = ["2cTxCSH", "1756lFjUZH", "1203lrBAxs", "-PM", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", "floor", "split", "padStart", "210040LwvZwW", "random", "42dFDgUJ", "11gyjvEg", "6081230NagSZO", "21870984nNvBVz", "9dGWBXT", "length", "651768SrdiKf", "3423565sUonJV", "push", "267036mHwWhk"];
_0x3810 = function() {
return _0x16b550;
};
return _0x3810();
}
(function(_0x35e6c3, _0x40edc1) {
const _0x1c7916 = _0x56cc, _0x3b045b = _0x35e6c3();
while (!![]) {
try {
const _0x488375 = -parseInt(_0x1c7916(463)) / 1 * (-parseInt(_0x1c7916(482)) / 2) + parseInt(_0x1c7916(465)) / 3 * (-parseInt(_0x1c7916(464)) / 4) + -parseInt(_0x1c7916(480)) / 5 + -parseInt(_0x1c7916(479)) / 6 + -parseInt(_0x1c7916(473)) / 7 * (parseInt(_0x1c7916(471)) / 8) + -parseInt(_0x1c7916(477)) / 9 * (parseInt(_0x1c7916(475)) / 10) + -parseInt(_0x1c7916(474)) / 11 * (-parseInt(_0x1c7916(476)) / 12);
if (_0x488375 === _0x40edc1) break;
else _0x3b045b["push"](_0x3b045b["shift"]());
} catch (_0x5d9ab2) {
_0x3b045b["push"](_0x3b045b["shift"]());
}
}
})(_0x3810, 354585);
function _0x56cc(_0x249104, _0x4fceb7) {
const _0x3810df = _0x3810();
return _0x56cc = function(_0x56cc66, _0x5d56f3) {
_0x56cc66 = _0x56cc66 - 463;
let _0x3fc0fe = _0x3810df[_0x56cc66];
return _0x3fc0fe;
}, _0x56cc(_0x249104, _0x4fceb7);
}
const TRACKER_CLIENT_VERSION_PREFIX = _0x5af6ab(466) + formatVersion(PACKAGE_VERSION) + "-";
const HASH_SYMBOLS = _0x5af6ab(467), PEER_ID_LENGTH = 20;
function getStreamHash(_0x4a22ec) {
const _0x5a3068 = _0x5d7510["fromUtf8"](_0x4a22ec)["slice"](1), _0x52d096 = btoa(_0x5a3068);
return _0x52d096;
}
function generatePeerId(_0x4c32db) {
const _0x13bb0d = _0x5af6ab, _0x159578 = [_0x4c32db], _0x4bde36 = PEER_ID_LENGTH - _0x4c32db[_0x13bb0d(478)];
for (let _0x37595d = 0; _0x37595d < _0x4bde36; _0x37595d++) {
_0x159578[_0x13bb0d(481)](HASH_SYMBOLS[Math[_0x13bb0d(468)](Math[_0x13bb0d(472)]() * HASH_SYMBOLS[_0x13bb0d(478)])]);
}
return _0x159578["join"]("");
}
function formatVersion(_0x1fd903) {
const _0x2dd687 = _0x5af6ab, _0x1cc280 = _0x1fd903[_0x2dd687(469)](".");
return "" + _0x1cc280[0][_0x2dd687(470)](2, "0") + _0x1cc280[1][_0x2dd687(470)](2, "0");
}
const _0x2d3222 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
TRACKER_CLIENT_VERSION_PREFIX,
generatePeerId,
getStreamHash
}, Symbol.toStringTag, { value: "Module" }));
function _0x56be(_0x1acd71, _0xa92c4f) {
const _0x2df60d = _0x2df6();
return _0x56be = function(_0x56be6e, _0x204ae1) {
_0x56be6e = _0x56be6e - 327;
let _0x22cf02 = _0x2df60d[_0x56be6e];
return _0x22cf02;
}, _0x56be(_0x1acd71, _0xa92c4f);
}
(function(_0x112658, _0x45bb71) {
const _0x518f9b = _0x56be, _0x172727 = _0x112658();
while (!![]) {
try {
const _0x5ea7b9 = parseInt(_0x518f9b(331)) / 1 + parseInt(_0x518f9b(330)) / 2 * (parseInt(_0x518f9b(334)) / 3) + parseInt(_0x518f9b(338)) / 4 + -parseInt(_0x518f9b(335)) / 5 * (parseInt(_0x518f9b(332)) / 6) + parseInt(_0x518f9b(333)) / 7 + -parseInt(_0x518f9b(337)) / 8 + parseInt(_0x518f9b(328)) / 9 * (parseInt(_0x518f9b(327)) / 10);
if (_0x5ea7b9 === _0x45bb71) break;
else _0x172727["push"](_0x172727["shift"]());
} catch (_0x335967) {
_0x172727["push"](_0x172727["shift"]());
}
}
})(_0x2df6, 423763);
function getStreamString(_0x1241c8) {
return _0x1241c8["type"] + "-" + _0x1241c8["index"];
}
function _0x2df6() {
const _0x38ac7c = ["258039SBXoLJ", "289284ykByNe", "2076858NkiynF", "885246lykDqC", "45qOuCzb", " | ", "3569048BkgPBR", "977476idqtmy", "http-window", "high-demand", "20sqJwyx", "943362LRywsM", "stream", "2udPQSk"];
_0x2df6 = function() {
return _0x38ac7c;
};
return _0x2df6();
}
function getSegmentString(_0x3958ee) {
const _0x2763ae = _0x56be, { externalId: _0x35126d } = _0x3958ee;
return "(" + getStreamString(_0x3958ee[_0x2763ae(329)]) + _0x2763ae(336) + _0x35126d + ")";
}
function getSegmentPlaybackStatusesString(_0x161b5a) {
const _0x198b26 = _0x56be, { isHighDemand: _0x1108d9, isHttpDownloadable: _0x4cd5aa, isP2PDownloadable: _0x5e2e64 } = _0x161b5a;
if (_0x1108d9) return _0x198b26(340);
if (_0x4cd5aa && _0x5e2e64) return "http-p2p-window";
if (_0x4cd5aa) return _0x198b26(339);
if (_0x5e2e64) return "p2p-window";
return "-";
}
const _0x4b750 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
getSegmentPlaybackStatusesString,
getSegmentString,
getStreamString
}, Symbol.toStringTag, { value: "Module" }));
(function(_0x1456b9, _0x41a42a) {
const _0x3d39c3 = _0x383f, _0x28bb1f = _0x1456b9();
while (!![]) {
try {
const _0x1a729f = parseInt(_0x3d39c3(218)) / 1 * (parseInt(_0x3d39c3(213)) / 2) + parseInt(_0x3d39c3(221)) / 3 * (parseInt(_0x3d39c3(208)) / 4) + -parseInt(_0x3d39c3(203)) / 5 * (parseInt(_0x3d39c3(227)) / 6) + -parseInt(_0x3d39c3(210)) / 7 + parseInt(_0x3d39c3(204)) / 8 + -parseInt(_0x3d39c3(219)) / 9 * (parseInt(_0x3d39c3(222)) / 10) + parseInt(_0x3d39c3(214)) / 11;
if (_0x1a729f === _0x41a42a) break;
else _0x28bb1f["push"](_0x28bb1f["shift"]());
} catch (_0x5e94c9) {
_0x28bb1f["push"](_0x28bb1f["shift"]());
}
}
})(_0x41cc, 584089);
function getControlledPromise() {
let _0x6c0841, _0x24901f;
const _0x163ebc = new Promise((_0x5ebace, _0x5f44c4) => {
_0x6c0841 = _0x5ebace, _0x24901f = _0x5f44c4;
});
return { "promise": _0x163ebc, "resolve": _0x6c0841, "reject": _0x24901f };
}
function joinChunksUint8Array(_0x1a3b70, _0x9f1fe2) {
const _0x32f754 = _0x383f;
_0x9f1fe2 === void 0 && (_0x9f1fe2 = _0x1a3b70[_0x32f754(201)]((_0x3e9fa7, _0x2f4ac2) => _0x3e9fa7 + _0x2f4ac2["byteLength"], 0));
const _0x14b78a = new Uint8Array(_0x9f1fe2);
let _0x30e9a5 = 0;
for (const _0x5bd680 of _0x1a3b70) {
_0x14b78a["set"](_0x5bd680, _0x30e9a5), _0x30e9a5 += _0x5bd680[_0x32f754(207)];
}
return _0x14b78a;
}
function joinChunksArrayBuffer(_0x27b288, _0x4ee395) {
const _0x27210e = _0x383f;
return joinChunks(_0x27b288, _0x4ee395)[_0x27210e(217)];
}
function joinChunks(_0x1b44d3, _0x4729c2) {
const _0x111977 = _0x383f;
_0x4729c2 === void 0 && (_0x4729c2 = _0x1b44d3[_0x111977(201)]((_0x4e4b4b, _0x523977) => _0x4e4b4b + _0x523977[_0x111977(207)], 0));
const _0x4aa8ff = new Uint8Array(_0x4729c2);
let _0x109be9 = 0;
for (const _0x54524d of _0x1b44d3) {
_0x4aa8ff["set"](_0x54524d, _0x109be9), _0x109be9 += _0x54524d[_0x111977(207)];
}
return _0x4aa8ff;
}
function getPercent(_0x20969f, _0x14938e) {
return _0x20969f / _0x14938e * 100;
}
function getRandomItem(_0x364ef9) {
const _0x182b35 = _0x383f;
return _0x364ef9[Math[_0x182b35(229)](Math["random"]() * _0x364ef9[_0x182b35(228)])];
}
function utf8ToUintArray(_0x188065) {
const _0x19dbf8 = _0x383f, _0x8e8768 = new TextEncoder(), _0xb67a01 = new Uint8Array(_0x188065[_0x19dbf8(228)]);
return _0x8e8768[_0x19dbf8(205)](_0x188065, _0xb67a01), _0xb67a01;
}
function hexToUtf8(_0x23e66f) {
const _0x896adc = _0x383f, _0x26c1fb = new Uint8Array(_0x23e66f[_0x896adc(228)] / 2);
for (let _0x25af85 = 0; _0x25af85 < _0x23e66f[_0x896adc(228)]; _0x25af85 += 2) {
_0x26c1fb[_0x25af85 / 2] = parseInt(_0x23e66f[_0x896adc(212)](_0x25af85, _0x25af85 + 2), 16);
}
const _0x14dd69 = new TextDecoder();
return _0x14dd69[_0x896adc(225)](_0x26c1fb);
}
function _0x383f(_0x51e908, _0x4409c3) {
const _0x41cc4f = _0x41cc();
return _0x383f = function(_0x383ff0, _0x5e362) {
_0x383ff0 = _0x383ff0 - 201;
let _0x188bd3 = _0x41cc4f[_0x383ff0];
return _0x188bd3;
}, _0x383f(_0x51e908, _0x4409c3);
}
function* arrayBackwards(_0x8e2098) {
const _0x310952 = _0x383f;
for (let _0x5509d2 = _0x8e2098[_0x310952(228)] - 1; _0x5509d2 >= 0; _0x5509d2--) {
yield _0x8e2098[_0x5509d2];
}
}
function isObject(_0x38e6e9) {
const _0x3f4f06 = _0x383f;
return !!_0x38e6e9 && typeof _0x38e6e9 === "object" && !Array[_0x3f4f06(215)](_0x38e6e9);
}
function isArray(_0x3cd753) {
const _0x25f681 = _0x383f;
return Array[_0x25f681(215)](_0x3cd753);
}
function filterUndefinedProps(_0x5f09d9) {
function _0x4306a2(_0x164277) {
const _0x206b97 = _0x383f;
if (isObject(_0x164277)) {
const _0x3c29e2 = {};
return Object[_0x206b97(216)](_0x164277)[_0x206b97(226)]((_0x8573f3) => {
if (_0x164277[_0x8573f3] !== void 0) {
const _0x3d5f91 = _0x4306a2(_0x164277[_0x8573f3]);
_0x3d5f91 !== void 0 && (_0x3c29e2[_0x8573f3] = _0x3d5f91);
}
}), _0x3c29e2;
} else return _0x164277;
}
return _0x4306a2(_0x5f09d9);
}
function deepCopy(_0x5eb27e) {
const _0x5580e9 = _0x383f;
if (isArray(_0x5eb27e)) return _0x5eb27e[_0x5580e9(223)]((_0x470a2b) => deepCopy(_0x470a2b));
else {
if (isObject(_0x5eb27e)) {
const _0x39b14f = {};
for (const _0x330e76 of Object["keys"](_0x5eb27e)) {
_0x39b14f[_0x330e76] = deepCopy(_0x5eb27e[_0x330e76]);
}
return _0x39b14f;
} else return _0x5eb27e;
}
}
function shuffleArray(_0x51e177) {
const _0x24664a = _0x383f;
for (let _0x1ac75f = _0x51e177[_0x24664a(228)] - 1; _0x1ac75f > 0; _0x1ac75f--) {
const _0x51a67c = Math[_0x24664a(229)](Math[_0x24664a(206)]() * (_0x1ac75f + 1));
[_0x51e177[_0x1ac75f], _0x51e177[_0x51a67c]] = [_0x51e177[_0x51a67c], _0x51e177[_0x1ac75f]];
}
return _0x51e177;
}
function overrideConfig(_0x3c6dfd, _0x335d1a, _0x26de72 = {}) {
const _0x1519c6 = _0x383f;
if (typeof _0x3c6dfd !== _0x1519c6(209) || _0x3c6dfd === null || typeof _0x335d1a !== _0x1519c6(209) || _0x335d1a === null) return _0x3c6dfd;
return Object[_0x1519c6(216)](_0x335d1a)[_0x1519c6(226)]((_0x335123) => {
const _0x3b4521 = _0x1519c6;
if (_0x335123 === _0x3b4521(211) || _0x335123 === _0x3b4521(220) || _0x335123 === _0x3b4521(202)) throw new Error(_0x3b4521(224) + String(_0x335123) + "'");
const _0x34304d = _0x335d1a[_0x335123], _0x14b901 = _0x26de72[_0x335123];
_0x335123 in _0x3c6dfd && (_0x34304d === void 0 ? _0x3c6dfd[_0x335123] = _0x14b901 === void 0 ? void 0 : _0x14b901 : _0x3c6dfd[_0x335123] = _0x34304d);
}), _0x3c6dfd;
}
function mergeAndFilterConfig(_0x179eb1) {
const _0x4207f2 = _0x383f, { defaultConfig: _0x3aa5b, baseConfig = {}, specificStreamConfig = {} } = _0x179eb1, _0x3161bb = deepCopy({ ..._0x3aa5b, ...baseConfig, ...specificStreamConfig }), _0x43c07d = Object[_0x4207f2(216)](_0x3aa5b), _0x42cc02 = {};
return _0x43c07d[_0x4207f2(226)]((_0x86b970) => {
_0x86b970 in _0x3161bb && (_0x42cc02[_0x86b970] = _0x3161bb[_0x86b970]);
}), _0x42cc02;
}
function _0x41cc() {
const _0x46520f = ["__proto__", "slice", "179534HVELtz", "6775857oCUkFX", "isArray", "keys", "buffer", "3TJDWiQ", "13833MNDKMB", "constructor", "6NaMynb", "2330Fjdnyj", "map", "Attempt to modify restricted property '", "decode", "forEach", "66opLxsw", "length", "floor", "reduce", "prototype", "15445msmcLI", "7367136xhTFSr", "encodeInto", "random", "byteLength", "504148gZDtqo", "object", "7574455vFoKuz"];
_0x41cc = function() {
return _0x46520f;
};
return _0x41cc();
}
const _0x2937c4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
arrayBackwards,
deepCopy,
filterUndefinedProps,
getControlledPromise,
getPercent,
getRandomItem,
hexToUtf8,
joinChunks,
joinChunksArrayBuffer,
joinChunksUint8Array,
mergeAndFilterConfig,
overrideConfig,
shuffleArray,
utf8ToUintArray
}, Symbol.toStringTag, { value: "Module" }));
function _0x29fc(_0x490414, _0x135aea) {
var _0x344ca6 = _0x344c();
return _0x29fc = function(_0x29fc90, _0x418348) {
_0x29fc90 = _0x29fc90 - 493;
var _0x4b4a1a = _0x344ca6[_0x29fc90];
return _0x4b4a1a;
}, _0x29fc(_0x490414, _0x135aea);
}
function _0x344c() {
var _0x1e96c8 = ["SegmentDataSendingCompleted", "2bUuJRZ", "645659AkUwSp", "16pXpZSI", "CancelSegmentRequest", "146145BzLZIa", "227663zefuiY", "SegmentAbsent", "SegmentData", "248OkTFCB", "2895321IoJLZh", "98541jVWGvR", "134604gcgkeH", "18CgAPPa", "3103920tktNNL", "SegmentsAnnouncement"];
_0x344c = function() {
return _0x1e96c8;
};
return _0x344c();
}
(function(_0x5e84db, _0x3ce81f) {
var _0x15539f = _0x29fc, _0x72042a = _0x5e84db();
while (!![]) {
try {
var _0x2cb5c2 = -parseInt(_0x15539f(497)) / 1 * (-parseInt(_0x15539f(508)) / 2) + -parseInt(_0x15539f(502)) / 3 + parseInt(_0x15539f(494)) / 4 * (-parseInt(_0x15539f(496)) / 5) + -parseInt(_0x15539f(504)) / 6 * (-parseInt(_0x15539f(493)) / 7) + -parseInt(_0x15539f(500)) / 8 * (-parseInt(_0x15539f(503)) / 9) + -parseInt(_0x15539f(505)) / 10 + -parseInt(_0x15539f(501)) / 11;
if (_0x2cb5c2 === _0x3ce81f) break;
else _0x72042a["push"](_0x72042a["shift"]());
} catch (_0x4a5b6b) {
_0x72042a["push"](_0x72042a["shift"]());
}
}
})(_0x344c, 244644);
var PeerCommandType$1 = ((_0x3687ce) => {
var _0x7ff731 = _0x29fc;
return _0x3687ce[_0x3687ce[_0x7ff731(506)] = 0] = _0x7ff731(506), _0x3687ce[_0x3687ce["SegmentRequest"] = 1] = "SegmentRequest", _0x3687ce[_0x3687ce[_0x7ff731(499)] = 2] = "SegmentData", _0x3687ce[_0x3687ce["SegmentDataSendingCompleted"] = 3] = _0x7ff731(507), _0x3687ce[_0x3687ce[_0x7ff731(498)] = 4] = _0x7ff731(498), _0x3687ce[_0x3687ce[_0x7ff731(495)] = 5] = _0x7ff731(495), _0x3687ce;
})(PeerCommandType$1 || {});
const _0x457566 = _0x4f2c;
(function(_0x338ea9, _0xcc92ab) {
const _0x2b457f = _0x4f2c, _0x1c169b = _0x338ea9();
while (!![]) {
try {
const _0x144b0b = parseInt(_0x2b457f(290)) / 1 + -parseInt(_0x2b457f(297)) / 2 + parseInt(_0x2b457f(276)) / 3 * (parseInt(_0x2b457f(283)) / 4) + parseInt(_0x2b457f(295)) / 5 * (-parseInt(_0x2b457f(292)) / 6) + parseInt(_0x2b457f(291)) / 7 * (parseInt(_0x2b457f(289)) / 8) + parseInt(_0x2b457f(300)) / 9 * (-parseInt(_0x2b457f(306)) / 10) + parseInt(_0x2b457f(303)) / 11 * (parseInt(_0x2b457f(288)) / 12);
if (_0x144b0b === _0xcc92ab) break;
else _0x1c169b["push"](_0x1c169b["shift"]());
} catch (_0x3c0bb9) {
_0x1c169b["push"](_0x1c169b["shift"]());
}
}
})(_0x4458, 912085);
var SerializedItem = ((_0x3bfc5e) => {
const _0x25e89b = _0x4f2c;
return _0x3bfc5e[_0x3bfc5e["Min"] = -1] = _0x25e89b(287), _0x3bfc5e[_0x3bfc5e[_0x25e89b(274)] = 0] = _0x25e89b(274), _0x3bfc5e[_0x3bfc5e[_0x25e89b(307)] = 1] = _0x25e89b(307), _0x3bfc5e[_0x3bfc5e[_0x25e89b(281)] = 2] = _0x25e89b(281), _0x3bfc5e[_0x3bfc5e["Max"] = 3] = _0x25e89b(296), _0x3bfc5e;
})(SerializedItem || {});
function _0x4458() {
const _0x278fe2 = ["toString", "push", "Trying to deserialize bytes (sting) with invalid serialized item code.", "Int", "get", "75741KSsSfS", "getBytesChunks", "bytes", "length", "Trying to deserialize similar int array with invalid serialized item code", "String", "addBytes", "268LgYSWZ", "_length", "size", "start", "Min", "23098476CPPKFg", "27536PTirvi", "32877SVkDZe", "1435jGdpCo", "19662KEVYqO", "encode", "utf8", "2445ifguQJ", "Max", "1446548kteORi", "unshift", "isArray", "747hZtLbc", "ceil", "decode", "11QCyYIC", "slice", "getBuffer", "134590emPeym", "SimilarIntArray", "Trying to deserialize integer with invalid serialized item code", "end"];
_0x4458 = function() {
return _0x278fe2;
};
return _0x4458();
}
function abs(_0x9a4790) {
return _0x9a4790 < 0 ? -_0x9a4790 : _0x9a4790;
}
function getRequiredBytesForInt(_0x24b81a) {
const _0x1761be = _0x4f2c, _0x3462a5 = _0x24b81a[_0x1761be(271)](2), _0x48557c = _0x24b81a < 0 ? _0x3462a5["length"] : _0x3462a5[_0x1761be(279)] + 1;
return Math[_0x1761be(301)](_0x48557c / 8);
}
function intToBytes(_0x5d230f) {
const _0x2bd323 = _0x5d230f < 0, _0x28f3ed = getRequiredBytesForInt(_0x5d230f), _0x289f86 = new Uint8Array(_0x28f3ed), _0x54e54e = BigInt(_0x28f3ed);
_0x5d230f = abs(_0x5d230f);
for (let _0x517038 = 0; _0x517038 < _0x28f3ed; _0x517038++) {
const _0x4327b7 = 0x8n * (_0x54e54e - 0x1n - BigInt(_0x517038)), _0x56f322 = _0x5d230f >> _0x4327b7 & 0xffn;
_0x289f86[_0x517038] = Number(_0x56f322);
}
if (_0x2bd323) _0x289f86[0] = _0x289f86[0] | 128;
return _0x289f86;
}
function bytesToInt(_0x205230) {
const _0x112b91 = _0x4f2c, _0x4c68ee = BigInt(_0x205230[_0x112b91(279)]), _0x257740 = (_0x2fa31a, _0xe4e4d) => {
const _0x40caa4 = 0x8n * (_0x4c68ee - 0x1n - BigInt(_0xe4e4d));
return BigInt(_0x2fa31a) << _0x40caa4;
};
let _0xcfda47 = _0x257740(_0x205230[0] & 127, 0);
for (let _0x363aa1 = 1; _0x363aa1 < _0x4c68ee; _0x363aa1++) {
_0xcfda47 = _0x257740(_0x205230[_0x363aa1], _0x363aa1) | _0xcfda47;
}
if ((_0x205230[0] & 128) >> 7 !== 0) _0xcfda47 = -_0xcfda47;
return _0xcfda47;
}
function serializeInt(_0x42f7bd) {
const _0x3d7590 = _0x4f2c, _0xe688f6 = intToBytes(_0x42f7bd), _0x5008d2 = 0 << 4 | _0xe688f6[_0x3d7590(279)];
return new Uint8Array([_0x5008d2, ..._0xe688f6]);
}
function _0x4f2c(_0xe41bf5, _0x1f89ce) {
const _0x4458a0 = _0x4458();
return _0x4f2c = function(_0x4f2c38, _0x390dae) {
_0x4f2c38 = _0x4f2c38 - 271;
let _0x31e205 = _0x4458a0[_0x4f2c38];
return _0x31e205;
}, _0x4f2c(_0xe41bf5, _0x1f89ce);
}
function deserializeInt(_0x276780) {
const _0x2b0e0f = _0x4f2c, _0x4132a3 = _0x276780[0], _0x437096 = _0x4132a3 >> 4;
if (_0x437096 !== 0) throw new Error(_0x2b0e0f(308));
const _0x10080f = _0x4132a3 & 15, _0x554eeb = 1, _0x595387 = _0x554eeb + _0x10080f;
return { "number": bytesToInt(_0x276780[_0x2b0e0f(304)](_0x554eeb, _0x595387)), "byteLength": _0x10080f + 1 };
}
function serializeSimilarIntArray(_0x172658) {
const _0x266a79 = _0x4f2c, _0x4c6597 = /* @__PURE__ */ new Map();
for (const _0x4e9847 of _0x172658) {
const _0x3451d5 = _0x4e9847 & ~0xffn, _0x324971 = _0x4e9847 & 0xffn, _0x4ceb09 = _0x4c6597[_0x266a79(275)](_0x3451d5) ?? new ResizableUint8Array();
if (!_0x4ceb09["length"]) _0x4c6597["set"](_0x3451d5, _0x4ceb09);
_0x4ceb09[_0x266a79(272)](Number(_0x324971));
}
const _0x38376e = new ResizableUint8Array();
_0x38376e[_0x266a79(272)]([1 << 4, _0x4c6597[_0x266a79(285)]]);
for (const [_0x3afd34, _0x2b59ac] of _0x4c6597) {
const { length: _0x119ff1 } = _0x2b59ac[_0x266a79(277)](), _0x4d98c0 = _0x3afd34 | BigInt(_0x119ff1) & 0xffn;
_0x2b59ac[_0x266a79(298)](serializeInt(_0x4d98c0)), _0x38376e[_0x266a79(272)](_0x2b59ac[_0x266a79(305)]());
}
return _0x38376e[_0x266a79(305)]();
}
function deserializeSimilarIntArray(_0x48fa11) {
const _0x24c561 = _0x4f2c, [_0x35d921, _0x39a7a7] = _0x48fa11, _0x472ff9 = _0x35d921 >> 4;
if (_0x472ff9 !== 1) throw new Error(_0x24c561(280));
let _0x2e7175 = 2;
const _0x313983 = [];
for (let _0x2bad8c = 0; _0x2bad8c < _0x39a7a7; _0x2bad8c++) {
const { number: _0x5b4a23, byteLength: _0x204fba } = deserializeInt(_0x48fa11[_0x24c561(304)](_0x2e7175));
_0x2e7175 += _0x204fba;
const _0x59fb55 = _0x5b4a23 & 0xffn, _0x23b731 = _0x5b4a23 & ~0xffn;
for (let _0x56f718 = 0; _0x56f718 < _0x59fb55; _0x56f718++) {
const _0x15da62 = BigInt(_0x48fa11[_0x2e7175]);
_0x313983[_0x24c561(272)](_0x23b731 | _0x15da62), _0x2e7175++;
}
}
return { "numbers": _0x313983, "byteLength": _0x2e7175 };
}
function serializeString(_0x2a497f) {
const _0xc09e82 = _0x4f2c, { length: _0x1ed63b } = _0x2a497f, _0x593709 = new ResizableUint8Array();
return _0x593709[_0xc09e82(272)]([2 << 4 | _0x1ed63b >> 8 & 15, _0x1ed63b & 255]), _0x593709[_0xc09e82(272)](new TextEncoder()[_0xc09e82(293)](_0x2a497f)), _0x593709[_0xc09e82(305)]();
}
function deserializeString(_0x282487) {
const _0x2e624f = _0x4f2c, [_0x360375, _0x78542f] = _0x282487, _0x19dbf8 = _0x360375 >> 4;
if (_0x19dbf8 !== 2) throw new Error(_0x2e624f(273));
const _0x532b9a = (_0x360375 & 15) << 8 | _0x78542f, _0x319350 = _0x282487[_0x2e624f(304)](2, _0x532b9a + 2), _0x368908 = new TextDecoder(_0x2e624f(294))[_0x2e624f(302)](_0x319350);
return { "string": _0x368908, "byteLength": _0x532b9a + 2 };
}
class ResizableUint8Array {
constructor() {
__publicField(this, _h, []);
__publicField(this, _g, 0);
}
[(_h = _0x457566(278), _g = _0x457566(284), _0x457566(272))](_0xb651b7) {
const _0x1aaaf8 = _0x457566;
this[_0x1aaaf8(282)](_0xb651b7, _0x1aaaf8(309));
}
["unshift"](_0x17bb3a) {
const _0x4e8174 = _0x457566;
this[_0x4e8174(282)](_0x17bb3a, _0x4e8174(286));
}
[_0x457566(282)](_0x5c2df9, _0x4f9dd2) {
const _0x3b4de3 = _0x457566;
let _0xa5b43e;
if (_0x5c2df9 instanceof Uint8Array) _0xa5b43e = _0x5c2df9;
else Array[_0x3b4de3(299)](_0x5c2df9) ? _0xa5b43e = new Uint8Array(_0x5c2df9) : _0xa5b43e = new Uint8Array([_0x5c2df9]);
this[_0x3b4de3(284)] += _0xa5b43e[_0x3b4de3(279)], this[_0x3b4de3(278)][_0x4f9dd2 === _0x3b4de3(286) ? _0x3b4de3(298) : _0x3b4de3(272)](_0xa5b43e);
}
["getBytesChunks"]() {
const _0x4b4a5a = _0x457566;
return this[_0x4b4a5a(278)];
}
[_0x457566(305)]() {
const _0x3320ad = _0x457566;
return joinChunks(this[_0x3320ad(278)], this["_length"]);
}
get [_0x457566(279)]() {
const _0x4b4edb = _0x457566;
return this[_0x4b4edb(284)];
}
}
const _0x58d9dd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
ResizableUint8Array,
SerializedItem,
deserializeInt,
deserializeSimilarIntArray,
deserializeString,
serializeInt,
serializeSimilarIntArray,
serializeString
}, Symbol.toStringTag, { value: "Module" }));
const _0x54a121 = _0x16d6;
(function(_0x1d2215, _0x283230) {
const _0x739248 = _0x16d6, _0x5c5416 = _0x1d2215();
while (!![]) {
try {
const _0xa5f639 = -parseInt(_0x739248(177)) / 1 * (-parseInt(_0x739248(208)) / 2) + -parseInt(_0x739248(189)) / 3 + -parseInt(_0x739248(166)) / 4 * (-parseInt(_0x739248(207)) / 5) + -parseInt(_0x739248(198)) / 6 * (parseInt(_0x739248(160)) / 7) + parseInt(_0x739248(196)) / 8 + -parseInt(_0x739248(183)) / 9 * (-parseInt(_0x739248(185)) / 10) + -parseInt(_0x739248(191)) / 11 * (parseInt(_0x739248(209)) / 12);
if (_0xa5f639 === _0x283230) break;
else _0x5c5416["push"](_0x5c5416["shift"]());
} catch (_0x1d063a) {
_0x5c5416["push"](_0x5c5416["shift"]());
}
}
})(_0x267d, 824143);
const FRAME_PART_LENGTH = 4, commandFrameStart = stringToUtf8CodesBuffer(_0x54a121(161), FRAME_PART_LENGTH), commandFrameEnd = stringToUtf8CodesBuffer("cend", FRAME_PART_LENGTH), commandDivFrameStart = stringToUtf8CodesBuffer(_0x54a121(159), FRAME_PART_LENGTH), commandDivFrameEnd = stringToUtf8CodesBuffer(_0x54a121(176), FRAME_PART_LENGTH), startFrames = [commandFrameStart, commandDivFrameStart], endFrames = [commandFrameEnd, commandDivFrameEnd], commandFramesLength = commandFrameStart["length"] + commandFrameEnd[_0x54a121(155)];
function isCommandChunk(_0x4c72f7) {
const _0x11c3b5 = _0x54a121, { length: _0x27cb47 } = commandFrameStart, _0x2f95a5 = _0x4c72f7[_0x11c3b5(199)](-_0x27cb47);
return startFrames[_0x11c3b5(163)]((_0xca0a25) => areBuffersEqual(_0x4c72f7, _0xca0a25, FRAME_PART_LENGTH)) && endFrames[_0x11c3b5(163)]((_0x600302) => areBuffersEqual(_0x2f95a5, _0x600302, FRAME_PART_LENGTH));
}
function _0x16d6(_0x3b4081, _0x445577) {
const _0x267d13 = _0x267d();
return _0x16d6 = function(_0x16d6b5, _0x439b03) {
_0x16d6b5 = _0x16d6b5 - 153;
let _0x4845d3 = _0x267d13[_0x16d6b5];
return _0x4845d3;
}, _0x16d6(_0x3b4081, _0x445577);
}
function isFirstCommandChunk(_0x21d06a) {
return areBuffersEqual(_0x21d06a, commandFrameStart, FRAME_PART_LENGTH);
}
function isLastCommandChunk(_0x482fa5) {
const _0x47a868 = _0x54a121;
return areBuffersEqual(_0x482fa5[_0x47a868(199)](-4), commandFrameEnd, FRAME_PART_LENGTH);
}
function _0x267d() {
const _0x1e11b1 = ["bytes", "getResultBuffers", "no-first-chunk", "SerializedItem", "set", "creating", "dend", "113767jpxVru", "fromCharCode", "String", "push", "ceil", "complete", "312831UAhCea", "serializeInt", "430lrVhwj", "type", "status", "incomplete-joining", "1084296fhnbOn", "deserializeSimilarIntArray", "267718vqUkVx", "unframeCommandChunk", "resultBuffers", "Min", "addInteger", "6100880GKLrrP", "Buffer is empty", "2246628pRNGNx", "slice", "serializeString", "serializeSimilarIntArray", "SimilarIntArray", "addCommandChunk", "onComplete", "getBuffer", "completed", "1189270HLgHYm", "4zXKbyb", "204uAxUTk", "Wrong string length", "maxChunkLength", "deserializeString", "length", "ResizableUint8Array", "addString", "charCodeAt", "dstr", "21NNWFTK", "cstr", "Not existing type", "some", "Command is not complete.", "joining", "4NcfWHT", "chunks", "map", "deserializeInt"];
_0x267d = function() {
return _0x1e11b1;
};
return _0x267d();
}
class BinaryCommandJoiningError extends Error {
constructor(_0x28e78c) {
const _0x334973 = _0x54a121;
super(), this[_0x334973(186)] = _0x28e78c;
}
}
class BinaryCommandChunksJoiner {
constructor(_0x132b65) {
__publicField(this, _j, new _0x58d9dd[_0x54a121(156)]());
__publicField(this, _i, _0x54a121(165));
const _0x2dbf54 = _0x54a121;
this[_0x2dbf54(204)] = _0x132b65;
}
[(_j = _0x54a121(167), _i = _0x54a121(187), _0x54a121(203))](_0x666c79) {
const _0x44ec2b = _0x54a121;
if (this[_0x44ec2b(187)] === "completed") return;
const _0x2c60e9 = isFirstCommandChunk(_0x666c79);
if (!this[_0x44ec2b(167)][_0x44ec2b(155)] && !_0x2c60e9) throw new BinaryCommandJoiningError(_0x44ec2b(172));
if (this[_0x44ec2b(167)][_0x44ec2b(155)] && _0x2c60e9) throw new BinaryCommandJoiningError(_0x44ec2b(188));
this["chunks"]["push"](this[_0x44ec2b(192)](_0x666c79));
if (!isLastCommandChunk(_0x666c79)) return;
this[_0x44ec2b(187)] = _0x44ec2b(206), this["onComplete"](this[_0x44ec2b(167)][_0x44ec2b(205)]());
}
["unframeCommandChunk"](_0x3066f4) {
const _0x19d7f1 = _0x54a121;
return _0x3066f4[_0x19d7f1(199)](FRAME_PART_LENGTH, _0x3066f4[_0x19d7f1(155)] - FRAME_PART_LENGTH);
}
}
class BinaryCommandCreator {
constructor(_0x3df7c6, _0x2516e2) {
__publicField(this, _l, new ResizableUint8Array());
__publicField(this, "resultBuffers", []);
__publicField(this, _k, _0x54a121(175));
const _0x9419b3 = _0x54a121;
this["maxChunkLength"] = _0x2516e2, this[_0x9419b3(170)][_0x9419b3(180)](_0x3df7c6);
}
[(_l = _0x54a121(170), _k = _0x54a121(187), _0x54a121(195))](_0x5dabb9, _0x10bb2e) {
const _0x19bd0e = _0x54a121;
this[_0x19bd0e(170)][_0x19bd0e(180)](_0x5dabb9[_0x19bd0e(158)](0));
const _0x3265d6 = _0x58d9dd[_0x19bd0e(184)](BigInt(_0x10bb2e));
this["bytes"][_0x19bd0e(180)](_0x3265d6);
}
["addSimilarIntArr"](_0x13745b, _0x5b623a) {
const _0x360e99 = _0x54a121;
this[_0x360e99(170)]["push"](_0x13745b[_0x360e99(158)](0));
const _0x63b0fe = _0x58d9dd[_0x360e99(201)](_0x5b623a["map"]((_0x59c831) => BigInt(_0x59c831)));
this[_0x360e99(170)][_0x360e99(180)](_0x63b0fe);
}
[_0x54a121(157)](_0x241e49, _0x3a3f08) {
const _0x5d9a2d = _0x54a121;
this[_0x5d9a2d(170)][_0x5d9a2d(180)](_0x241e49[_0x5d9a2d(158)](0));
const _0x2c3c47 = _0x58d9dd[_0x5d9a2d(200)](_0x3a3f08);
this[_0x5d9a2d(170)][_0x5d9a2d(180)](_0x2c3c47);
}
[_0x54a121(182)]() {
const _0x1b76ac = _0x54a121;
if (!this[_0x1b76ac(170)]["length"]) throw new Error(_0x1b76ac(197));
if (this[_0x1b76ac(187)] === _0x1b76ac(206)) return;
this[_0x1b76ac(187)] = _0x1b76ac(206);
const _0x5eb85e = this[_0x1b76ac(170)][_0x1b76ac(205)]();
if (_0x5eb85e[_0x1b76ac(155)] + commandFramesLength <= this[_0x1b76ac(153)]) {
this["resultBuffers"]["push"](frameBuffer(_0x5eb85e, commandFrameStart, commandFrameEnd));
return;
}
let _0x4d7699 = Math[_0x1b76ac(181)](_0x5eb85e[_0x1b76ac(155)] / this[_0x1b76ac(153)]);
Math["ceil"](_0x5eb85e[_0x1b76ac(155)] / _0x4d7699) + commandFramesLength > this["maxChunkLength"] && _0x4d7699++;
for (const [_0x21a206, _0x28abae] of splitBufferToEqualChunks(_0x5eb85e, _0x4d7699)) {
if (_0x21a206 === 0) this[_0x1b76ac(193)][_0x1b76ac(180)](frameBuffer(_0x28abae, commandFrameStart, commandDivFrameEnd));
else _0x21a206 === _0x4d7699 - 1 ? this[_0x1b76ac(193)][_0x1b76ac(180)](frameBuffer(_0x28abae, commandDivFrameStart, commandFrameEnd)) : this[_0x1b76ac(193)][_0x1b76ac(180)](frameBuffer(_0x28abae, commandDivFrameStart, commandDivFrameEnd));
}
}
[_0x54a121(171)]() {
const _0x477a4a = _0x54a121;
if (this[_0x477a4a(187)] === "creating" || !this[_0x477a4a(193)][_0x477a4a(155)]) throw new Error(_0x477a4a(164));
return this["resultBuffers"];
}
}
function deserializeCommand(_0x138b22) {
const _0xd27ed6 = _0x54a121, [_0x51b7f8] = _0x138b22, _0x541ccc = { "c": _0x51b7f8 };
let _0x4effad = 1;
while (_0x4effad < _0x138b22[_0xd27ed6(155)]) {
const _0x2aeb1a = String[_0xd27ed6(178)](_0x138b22[_0x4effad]);
_0x4effad++;
const _0xd00fda = getDataTypeFromByte(_0x138b22[_0x4effad]);
switch (_0xd00fda) {
case SerializedItem["Int"]:
{
const { number: _0x378944, byteLength: _0xb56423 } = _0x58d9dd[_0xd27ed6(169)](_0x138b22[_0xd27ed6(199)](_0x4effad));
_0x541ccc[_0x2aeb1a] = Number(_0x378944), _0x4effad += _0xb56423;
}
break;
case _0x58d9dd[_0xd27ed6(173)][_0xd27ed6(202)]:
{
const { numbers: _0x145635, byteLength: _0x26940f } = _0x58d9dd[_0xd27ed6(190)](_0x138b22["slice"](_0x4effad));
_0x541ccc[_0x2aeb1a] = _0x145635[_0xd27ed6(168)]((_0x3fb4df) => Number(_0x3fb4df)), _0x4effad += _0x26940f;
}
break;
case SerializedItem[_0xd27ed6(179)]:
{
const { string: _0x1f5f15, byteLength: _0x1bd8a2 } = _0x58d9dd[_0xd27ed6(154)](_0x138b22["slice"](_0x4effad));
_0x541ccc[_0x2aeb1a] = _0x1f5f15, _0x4effad += _0x1bd8a2;
}
break;
}
}
return _0x541ccc;
}
function getDataTypeFromByte(_0x5c4731) {
const _0x3d115b = _0x54a121, _0x254924 = _0x5c4731 >> 4;
if (_0x254924 <= SerializedItem[_0x3d115b(194)] || _0x254924 >= _0x58d9dd[_0x3d115b(173)]["Max"]) throw new Error(_0x3d115b(162));
return _0x254924;
}
function stringToUtf8CodesBuffer(_0x5d6025, _0x461181) {
const _0xd737ec = _0x54a121;
if (_0x5d6025[_0xd737ec(155)] !== _0x461181) throw new Error(_0xd737ec(210));
const _0x5e3274 = new Uint8Array(_0x461181);
for (let _0x374957 = 0; _0x374957 < _0x5d6025[_0xd737ec(155)]; _0x374957++) _0x5e3274[_0x374957] = _0x5d6025["charCodeAt"](_0x374957);
return _0x5e3274;
}
function* splitBufferToEqualChunks(_0x3c0886, _0xa034b6) {
const _0x4a3997 = _0x54a121, _0x208ea4 = Math[_0x4a3997(181)](_0x3c0886["length"] / _0xa034b6);
for (let _0x4f7752 = 0; _0x4f7752 < _0xa034b6; _0x4f7752++) {
yield [_0x4f7752, _0x3c0886["slice"](_0x4f7752 * _0x208ea4, (_0x4f7752 + 1) * _0x208ea4)];
}
}
function frameBuffer(_0x535607, _0x56c875, _0x144f16) {
const _0xfacbd0 = _0x54a121, _0x3c6b81 = new Uint8Array(_0x535607["length"] + _0x56c875[_0xfacbd0(155)] + _0x144f16[_0xfacbd0(155)]);
return _0x3c6b81["set"](_0x56c875), _0x3c6b81["set"](_0x535607, _0x56c875[_0xfacbd0(155)]), _0x3c6b81[_0xfacbd0(174)](_0x144f16, _0x56c875["length"] + _0x535607[_0xfacbd0(155)]), _0x3c6b81;
}
function areBuffersEqual(_0xacb97d, _0x32a753, _0x178f2d) {
for (let _0x1127fb = 0; _0x1127fb < _0x178f2d; _0x1127fb++) {
if (_0xacb97d[_0x1127fb] !== _0x32a753[_0x1127fb]) return ![];
}
return !![];
}
(function(_0x17eef5, _0x184cd8) {
const _0x2d6452 = _0x128d, _0xbf8da0 = _0x17eef5();
while (!![]) {
try {
const _0x3d1f33 = -parseInt(_0x2d6452(173)) / 1 + -parseInt(_0x2d6452(156)) / 2 + -parseInt(_0x2d6452(167)) / 3 + parseInt(_0x2d6452(157)) / 4 * (parseInt(_0x2d6452(158)) / 5) + parseInt(_0x2d6452(169)) / 6 * (parseInt(_0x2d6452(170)) / 7) + -parseInt(_0x2d6452(171)) / 8 + parseInt(_0x2d6452(165)) / 9;
if (_0x3d1f33 === _0x184cd8) break;
else _0xbf8da0["push"](_0xbf8da0["shift"]());
} catch (_0x4691d1) {
_0xbf8da0["push"](_0xbf8da0["shift"]());
}
}
})(_0x30ff, 882921);
function _0x30ff() {
const _0x160f6c = ["getResultBuffers", "255828SUECvA", "addInteger", "1062CJjVrl", "18438oiDyrE", "13475664XQIPal", "SegmentData", "982878owAdIa", "1988624zpjSrN", "2812aozlKP", "865BTEBAG", "SegmentsAnnouncement", "SegmentAbsent", "SegmentRequest", "addSimilarIntArr", "complete", "length", "36378072Grtjfp"];
_0x30ff = function() {
return _0x160f6c;
};
return _0x30ff();
}
function _0x128d(_0xcfa7a0, _0x3cedd0) {
const _0x30ff84 = _0x30ff();
return _0x128d = function(_0x128d5a, _0x4611f4) {
_0x128d5a = _0x128d5a - 156;
let _0x2c01f3 = _0x30ff84[_0x128d5a];
return _0x2c01f3;
}, _0x128d(_0xcfa7a0, _0x3cedd0);
}
function serializeSegmentAnnouncementCommand(_0x3788fb, _0xc4055) {
const _0x5ae027 = _0x128d, { c: _0x77dd95, p: _0x3c707a, l: _0x1c10fa } = _0x3788fb, _0x48f0f8 = new BinaryCommandCreator(_0x77dd95, _0xc4055);
if (_0x1c10fa == null ? void 0 : _0x1c10fa[_0x5ae027(164)]) _0x48f0f8[_0x5ae027(162)]("l", _0x1c10fa);
return (_0x3c707a == null ? void 0 : _0x3c707a[_0x5ae027(164)]) && _0x48f0f8[_0x5ae027(162)]("p", _0x3c707a), _0x48f0f8[_0x5ae027(163)](), _0x48f0f8[_0x5ae027(166)]();
}
function serializePeerSegmentCommand(_0x99721e, _0x539e27) {
const _0x42c7e2 = _0x128d, _0x2cc069 = new BinaryCommandCreator(_0x99721e["c"], _0x539e27);
return _0x2cc069[_0x42c7e2(168)]("i", _0x99721e["i"]), _0x2cc069[_0x42c7e2(168)]("r", _0x99721e["r"]), _0x2cc069[_0x42c7e2(163)](), _0x2cc069[_0x42c7e2(166)]();
}
function serializePeerSendSegmentCommand(_0x2e4fde, _0x35a306) {
const _0x56ddb8 = _0x128d, _0x45f513 = new BinaryCommandCreator(_0x2e4fde["c"], _0x35a306);
return _0x45f513["addInteger"]("i", _0x2e4fde["i"]), _0x45f513[_0x56ddb8(168)]("s", _0x2e4fde["s"]), _0x45f513[_0x56ddb8(168)]("r", _0x2e4fde["r"]), _0x45f513[_0x56ddb8(163)](), _0x45f513[_0x56ddb8(166)]();
}
function serializePeerSegmentRequestCommand(_0x58c4e5, _0x40da8e) {
const _0x144bc7 = _0x128d, _0x4a46cd = new BinaryCommandCreator(_0x58c4e5["c"], _0x40da8e);
_0x4a46cd[_0x144bc7(168)]("i", _0x58c4e5["i"]), _0x4a46cd["addInteger"]("r", _0x58c4e5["r"]);
if (_0x58c4e5["b"]) _0x4a46cd[_0x144bc7(168)]("b", _0x58c4e5["b"]);
return _0x4a46cd["complete"](), _0x4a46cd[_0x144bc7(166)]();
}
function serializePeerCommand(_0x1bd551, _0x5c99ef) {
const _0x1bad90 = _0x128d;
switch (_0x1bd551["c"]) {
case PeerCommandType$1["CancelSegmentRequest"]:
case PeerCommandType$1[_0x1bad90(160)]:
case PeerCommandType$1["SegmentDataSendingCompleted"]:
return serializePeerSegmentCommand(_0x1bd551, _0x5c99ef);
case PeerCommandType$1[_0x1bad90(161)]:
return serializePeerSegmentRequestCommand(_0x1bd551, _0x5c99ef);
case PeerCommandType$1[_0x1bad90(159)]:
return serializeSegmentAnnouncementCommand(_0x1bd551, _0x5c99ef);
case PeerCommandType$1[_0x1bad90(172)]:
return serializePeerSendSegmentCommand(_0x1bd551, _0x5c99ef);
}
}
function _0x5c49(_0x5da6fe, _0x384cf5) {
var _0x922108 = _0x9221();
return _0x5c49 = function(_0x5c493e, _0x37961e) {
_0x5c493e = _0x5c493e - 415;
var _0x212189 = _0x922108[_0x5c493e];
return _0x212189;
}, _0x5c49(_0x5da6fe, _0x384cf5);
}
(function(_0x17de7c, _0x159fe0) {
var _0x37b6af = _0x5c49, _0x5954de = _0x17de7c();
while (!![]) {
try {
var _0x52813c = parseInt(_0x37b6af(415)) / 1 * (parseInt(_0x37b6af(418)) / 2) + -parseInt(_0x37b6af(421)) / 3 + -parseInt(_0x37b6af(420)) / 4 * (-parseInt(_0x37b6af(424)) / 5) + -parseInt(_0x37b6af(416)) / 6 + -parseInt(_0x37b6af(417)) / 7 * (parseInt(_0x37b6af(423)) / 8) + parseInt(_0x37b6af(419)) / 9 + -parseInt(_0x37b6af(422)) / 10;
if (_0x52813c === _0x159fe0) break;
else _0x5954de["push"](_0x5954de["shift"]());
} catch (_0x47f2c5) {
_0x5954de["push"](_0x5954de["shift"]());
}
}
})(_0x9221, 875041);
function _0x9221() {
var _0x167681 = ["9208161XRfYkM", "1692FSbXOm", "1809594FgqfnW", "7388350ymRcWQ", "8881784EvLgHv", "18440VgNddi", "345kLRmMK", "1883826fMUCkz", "7VrRKCy", "6134QEqkNb"];
_0x9221 = function() {
return _0x167681;
};
return _0x9221();
}
const _0x19bb60 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
BinaryCommandChunksJoiner,
BinaryCommandJoiningError,
PeerCommandType: PeerCommandType$1,
deserializeCommand,
isCommandChunk,
serializePeerCommand
}, Symbol.toStringTag, { value: "Module" }));
const _0x1b7b48 = _0x18f3;
function _0x18f3(_0x3f7df6, _0x1395c8) {
const _0x3cbb7d = _0x3cbb();
return _0x18f3 = function(_0x18f37c, _0x333bc3) {
_0x18f37c = _0x18f37c - 152;
let _0xb330c1 = _0x3cbb7d[_0x18f37c];
return _0xb330c1;
}, _0x18f3(_0x3f7df6, _0x1395c8);
}
(function(_0x56809f, _0x1bfb68) {
const _0x2c62c4 = _0x18f3, _0x59372b = _0x56809f();
while (!![]) {
try {
const _0x448d3f = parseInt(_0x2c62c4(186)) / 1 * (parseInt(_0x2c62c4(155)) / 2) + -parseInt(_0x2c62c4(166)) / 3 * (parseInt(_0x2c62c4(164)) / 4) + parseInt(_0x2c62c4(194)) / 5 * (-parseInt(_0x2c62c4(187)) / 6) + -parseInt(_0x2c62c4(176)) / 7 + parseInt(_0x2c62c4(163)) / 8 + -parseInt(_0x2c62c4(196)) / 9 + parseInt(_0x2c62c4(169)) / 10;
if (_0x448d3f === _0x1bfb68) break;
else _0x59372b["push"](_0x59372b["shift"]());
} catch (_0x3629ed) {
_0x59372b["push"](_0x59372b["shift"]());
}
}
})(_0x3cbb, 248318);
class PeerProtocol {
constructor(_0x25fe31, _0x4b43f5, _0x53fa71, _0x2f7361) {
__publicField(this, "commandChunks");
__publicField(this, _n);
__publicField(this, "onChunkDownloaded");
__publicField(this, _m);
__publicField(this, "onDataReceived", (_0x2a4b38) => {
const _0x3be450 = _0x1b7b48;
isCommandChunk(_0x2a4b38) ? this[_0x3be450(161)](_0x2a4b38) : (this[_0x3be450(185)][_0x3be450(158)](_0x2a4b38), this[_0x3be450(159)](_0x2a4b38["byteLength"], _0x3be450(180), this[_0x3be450(181)][_0x3be450(153)]));
});
const _0x1e89f1 = _0x18f3;
this[_0x1e89f1(181)] = _0x25fe31, this[_0x1e89f1(188)] = _0x4b43f5, this[_0x1e89f1(185)] = _0x53fa71, this["onChunkDownloaded"] = _0x2f7361["getEventDispatcher"](_0x1e89f1(159)), this["onChunkUploaded"] = _0x2f7361[_0x1e89f1(189)]("onChunkUploaded"), _0x25fe31["on"](_0x1e89f1(193), this[_0x1e89f1(174)]);
}
[(_n = _0x1b7b48(179), _m = _0x1b7b48(171), _0x1b7b48(191))](_0x47a1f9) {
const _0x2f1c8d = _0x1b7b48, _0x286cce = _0x19bb60[_0x2f1c8d(192)](_0x47a1f9, this[_0x2f1c8d(188)][_0x2f1c8d(170)]);
for (const _0x22d1a8 of _0x286cce) {
this[_0x2f1c8d(181)]["write"](_0x22d1a8);
}
}
[_0x1b7b48(173)]() {
var _a2;
const _0x13e498 = _0x1b7b48;
(_a2 = this[_0x13e498(179)]) == null ? void 0 : _a2["stopUploading"](), this["uploadingContext"] = void 0;
}
[_0x1b7b48(165)]() {
var _a2;
const _0x9c2e0 = _0x1b7b48;
return (_a2 = this[_0x9c2e0(179)]) == null ? void 0 : _a2[_0x9c2e0(195)];
}
async [_0x1b7b48(152)](_0x2398a4, _0xaf2286) {
const _0xce5b32 = _0x1b7b48;
if (this[_0xce5b32(179)]) throw new Error(_0xce5b32(182));
const _0x4e5662 = _0x2398a4[_0xce5b32(172)][_0xce5b32(184)](_0x2398a4[_0xce5b32(157)], _0x2398a4[_0xce5b32(157)] + _0x2398a4[_0xce5b32(156)]);
if (!(_0x4e5662 instanceof ArrayBuffer)) throw new Error(_0xce5b32(197));
const _0x352f8d = getBufferChunks(_0x4e5662, this[_0xce5b32(188)][_0xce5b32(170)]), { promise: _0x43c01f, resolve: _0x1309d8, reject: _0x446d80 } = _0x2937c4[_0xce5b32(162)]();
let _0x17fd2e = ![];
const _0x3371aa = { "stopUploading": () => {
_0x17fd2e = ![];
}, "requestId": _0xaf2286 };
this[_0xce5b32(179)] = _0x3371aa;
const _0x5aaaa1 = () => {
const _0x27f708 = _0xce5b32;
if (!_0x17fd2e) {
_0x446d80();
return;
}
while (!![]) {
const _0xe1ba9d = _0x352f8d["next"]()["value"];
if (!_0xe1ba9d) {
_0x1309d8();
break;
}
const _0x32151d = this[_0x27f708(181)][_0x27f708(190)](_0xe1ba9d);
this["onChunkUploaded"](_0xe1ba9d[_0x27f708(156)], this[_0x27f708(181)][_0x27f708(153)]);
if (!_0x32151d) break;
}
};
try {
this["connection"]["on"](_0xce5b32(177), _0x5aaaa1), _0x17fd2e = !![], _0x5aaaa1(), await _0x43c01f;
} finally {
this[_0xce5b32(181)][_0xce5b32(168)](_0xce5b32(177), _0x5aaaa1), this["uploadingContext"] === _0x3371aa && (this[_0xce5b32(179)] = void 0);
}
}
["receivingCommandBytes"](_0x38b940) {
const _0x2978cc = _0x1b7b48;
!this[_0x2978cc(178)] && (this[_0x2978cc(178)] = new _0x19bb60[_0x2978cc(160)]((_0x14f646) => {
const _0xcd0aa = _0x2978cc;
this["commandChunks"] = void 0;
const _0x48692f = _0x19bb60[_0xcd0aa(183)](_0x14f646);
this[_0xcd0aa(185)][_0xcd0aa(167)](_0x48692f);
}));
try {
this["commandChunks"][_0x2978cc(154)](_0x38b940);
} catch (_0x55d561) {
if (!(_0x55d561 instanceof _0x19bb60[_0x2978cc(175)])) return;
this[_0x2978cc(178)] = void 0;
}
}
}
function _0x3cbb() {
const _0x3552ed = ["BinaryCommandJoiningError", "1237460ankNhy", "drain", "commandChunks", "uploadingContext", "p2p", "connection", "Some segment data is already uploading.", "deserializeCommand", "slice", "eventHandlers", "27943LUUnyB", "1535172UxcDPW", "peerConfig", "getEventDispatcher", "write", "sendCommand", "serializePeerCommand", "data", "5iRCOfS", "requestId", "3737871GZVijD", "Expected ArrayBuffer, got SharedArrayBuffer", "splitSegmentDataToChunksAndUploadAsync", "idUtf8", "addCommandChunk", "12usvfyC", "byteLength", "byteOffset", "onSegmentChunkReceived", "onChunkDownloaded", "BinaryCommandChunksJoiner", "receivingCommandBytes", "getControlledPromise", "1861128xlizgw", "17296QUXHux", "getUploadingRequestId", "291ETWGKj", "onCommandReceived", "off", "11154080evXYDB", "webRtcMaxMessageSize", "onChunkUploaded", "buffer", "stopUploadingSegmentData", "onDataReceived"];
_0x3cbb = function() {
return _0x3552ed;
};
return _0x3cbb();
}
function* getBufferChunks(_0x4eba8e, _0x2631b9) {
const _0x4ee12c = _0x1b7b48;
let _0x97c9b3 = _0x4eba8e[_0x4ee12c(156)];
while (_0x97c9b3 > 0) {
const _0x576cd4 = _0x97c9b3 >= _0x2631b9 ? _0x2631b9 : _0x97c9b3, _0x32e224 = _0x4eba8e[_0x4ee12c(156)] - _0x97c9b3, _0x3d826d = _0x4eba8e[_0x4ee12c(184)](_0x32e224, _0x32e224 + _0x576cd4);
_0x97c9b3 -= _0x576cd4, yield _0x3d826d;
}
}
const _0x49fa29 = _0x1469;
(function(_0x3c1b9d, _0x9f76ab) {
const _0x27ad11 = _0x1469, _0x2617db = _0x3c1b9d();
while (!![]) {
try {
const _0x473731 = parseInt(_0x27ad11(389)) / 1 * (-parseInt(_0x27ad11(338)) / 2) + -parseInt(_0x27ad11(356)) / 3 + parseInt(_0x27ad11(326)) / 4 * (parseInt(_0x27ad11(327)) / 5) + -parseInt(_0x27ad11(365)) / 6 * (parseInt(_0x27ad11(348)) / 7) + parseInt(_0x27ad11(364)) / 8 + -parseInt(_0x27ad11(323)) / 9 + parseInt(_0x27ad11(344)) / 10;
if (_0x473731 === _0x9f76ab) break;
else _0x2617db["push"](_0x2617db["shift"]());
} catch (_0x3a6605) {
_0x2617db["push"](_0x2617db["shift"]());
}
}
})(_0x5cce, 444800);
function _0x1469(_0x1b2ff0, _0xfbc646) {
const _0x5cce68 = _0x5cce();
return _0x1469 = function(_0x1469dd, _0x53119c) {
_0x1469dd = _0x1469dd - 320;
let _0x49b877 = _0x5cce68[_0x1469dd];
return _0x49b877;
}, _0x1469(_0x1b2ff0, _0xfbc646);
}
const { PeerCommandType } = _0x19bb60;
function _0x5cce() {
const _0x31a74c = ["eventTarget", "onSegmentRequested", "peer-protocol-violation", "883XDDjUI", "CancelSegmentRequest", "onCommandReceived", "validateP2PSegment", " has been sent to ", "totalBytes", "firstBytesReceived", "onSegmentsAnnouncement", " to ", "stopUploadingSegmentData", " %O", "bytes-receiving-timeout", "clearLoadedBytes", "SegmentData", "onPeerClosed", "close", "loadedBytes", "uploadSegmentData", "hexToUtf8", "cancel segment uploading ", "abortOnError", "streamType", "has", "requestId", "onSegmentChunkReceived", "sendCommand", "downloadingErrors", "6931404BsYMky", "SegmentRequest", "SegmentAbsent", "4qlsIWM", "260610NJlJVi", "addLoadedChunk", "peerProtocol", "getPeerIdFromConnection", "peer connection error ", "Some segment already is downloading", "downloadingContext", "sendCancelSegmentRequestCommand", "getUploadingRequestId", "destroy", "peer-closed", "1502DVryLM", "http-loading", "delete", "floor", "start", "peerConfig", "24625720oTEwEN", "segment ", "ERR_DATA_CHANNEL", "segment", "4379683FNzqiZ", "push", "cancel segment request ", "SegmentDataSendingCompleted", "data", "random", "p2pErrorRetries", "onConnectionError", "2315367aonVUG", "logger", "error", "end", "p2p", "sendSegmentsAnnouncementCommand", "externalId", "onPeerConnect", "6086824kEZHaE", "6goVEgw", "httpLoadingSegments", "SegmentsAnnouncement", "byteLength", "downloadingSegment", "peer-response-bytes-length-mismatch", "sendSegmentDataSendingCompletedCommand", "loadedSegments", "request", "onPeerConnectionClosed", "getSegmentStatus", "eventHandlers", "length", "completeOnSuccess", "downloadSegment", "splitSegmentDataToChunksAndUploadAsync", "filter", "peer-segment-absent", "getEventDispatcher", "cancelSegmentDownloading", "byteRange"];
_0x5cce = function() {
return _0x31a74c;
};
return _0x5cce();
}
class Peer2 {
constructor(_0x5d7ccc, _0x129b67, _0x1a985b, _0x11e112, _0x31e833) {
__publicField(this, "id");
__publicField(this, _v);
__publicField(this, _u);
__publicField(this, "loadedSegments", /* @__PURE__ */ new Set());
__publicField(this, "httpLoadingSegments", /* @__PURE__ */ new Set());
__publicField(this, "downloadingErrors", []);
__publicField(this, "logger", _0x1bf98d("p2pml-core:peer"));
__publicField(this, _t);
__publicField(this, _s, async (_0x295030) => {
var _a2, _b2, _c2;
const _0x10f871 = _0x49fa29;
switch (_0x295030["c"]) {
case PeerCommandType["SegmentsAnnouncement"]:
this[_0x10f871(372)] = new Set(_0x295030["l"]), this["httpLoadingSegments"] = new Set(_0x295030["p"]), this[_0x10f871(376)][_0x10f871(396)]();
break;
case PeerCommandType["SegmentRequest"]:
this[_0x10f871(329)][_0x10f871(398)](), this[_0x10f871(376)][_0x10f871(387)](this, _0x295030["i"], _0x295030["r"], _0x295030["b"]);
break;
case PeerCommandType["SegmentData"]:
{
if (!this[_0x10f871(333)]) break;
if (this[_0x10f871(333)]["isSegmentDataCommandReceived"]) break;
const { request: _0x1773f1, controls: _0x4105f2, requestId: _0x207ea3 } = this[_0x10f871(333)];
if (_0x1773f1[_0x10f871(347)][_0x10f871(362)] !== _0x295030["i"] || _0x207ea3 !== _0x295030["r"]) break;
this["downloadingContext"]["isSegmentDataCommandReceived"] = !![], _0x4105f2[_0x10f871(395)]();
if (_0x1773f1[_0x10f871(394)] === void 0) _0x1773f1["setTotalBytes"](_0x295030["s"]);
else _0x1773f1[_0x10f871(394)] - _0x1773f1["loadedBytes"] !== _0x295030["s"] && (_0x1773f1[_0x10f871(401)](), this[_0x10f871(334)](_0x1773f1[_0x10f871(347)], _0x207ea3), this["cancelSegmentDownloading"](_0x10f871(370)), this[_0x10f871(336)]());
}
break;
case PeerCommandType[_0x10f871(351)]: {
const { downloadingContext: _0x36b3fd } = this;
if (!(_0x36b3fd == null ? void 0 : _0x36b3fd["isSegmentDataCommandReceived"])) return;
const { request: _0x582861, controls: _0x44bcd5 } = _0x36b3fd, _0x538b11 = _0x36b3fd[_0x10f871(373)]["segment"][_0x10f871(362)] !== _0x295030["i"] || _0x36b3fd[_0x10f871(412)] !== _0x295030["r"];
if (_0x538b11) {
_0x582861[_0x10f871(401)](), this[_0x10f871(384)](_0x10f871(388)), this[_0x10f871(336)]();
return;
}
const _0x11d448 = _0x582861[_0x10f871(405)] !== _0x582861["totalBytes"];
if (_0x11d448) {
_0x582861[_0x10f871(401)](), this[_0x10f871(384)](_0x10f871(370)), this[_0x10f871(336)]();
return;
}
const _0x4522cd = await ((_b2 = (_a2 = this[_0x10f871(343)])[_0x10f871(392)]) == null ? void 0 : _b2.call(_a2, _0x582861["segment"]["url"], _0x582861[_0x10f871(347)][_0x10f871(385)], _0x582861[_0x10f871(352)])) ?? !![];
if (this[_0x10f871(333)] !== _0x36b3fd) return;
if (!_0x4522cd) {
_0x582861[_0x10f871(401)](), this[_0x10f871(384)]("p2p-segment-validation-failed"), this["destroy"]();
return;
}
this["downloadingErrors"] = [], _0x44bcd5[_0x10f871(378)](), this[_0x10f871(333)] = void 0;
break;
}
case PeerCommandType[_0x10f871(325)]:
((_c2 = this[_0x10f871(333)]) == null ? void 0 : _c2[_0x10f871(373)][_0x10f871(347)][_0x10f871(362)]) === _0x295030["i"] && this[_0x10f871(333)][_0x10f871(412)] === _0x295030["r"] && (this["cancelSegmentDownloading"](_0x10f871(382)), this[_0x10f871(372)][_0x10f871(340)](_0x295030["i"]));
break;
case PeerCommandType[_0x10f871(390)]: {
const _0x1d1b39 = this[_0x10f871(329)][_0x10f871(335)]();
if (_0x1d1b39 !== _0x295030["r"]) break;
this[_0x10f871(329)][_0x10f871(398)]();
break;
}
}
});
__publicField(this, _r, (_0x51d640) => {
var _a2;
const _0x1bd8b7 = _0x49fa29;
if (!((_a2 = this[_0x1bd8b7(333)]) == null ? void 0 : _a2["isSegmentDataCommandReceived"])) return;
const { request: _0x4995a3, controls: _0xfdd27 } = this[_0x1bd8b7(333)], _0x5c0b9c = _0x4995a3[_0x1bd8b7(394)] !== void 0 && _0x4995a3["loadedBytes"] + _0x51d640[_0x1bd8b7(368)] > _0x4995a3[_0x1bd8b7(394)];
if (_0x5c0b9c) {
_0x4995a3[_0x1bd8b7(401)](), this[_0x1bd8b7(384)](_0x1bd8b7(370)), this[_0x1bd8b7(336)]();
return;
}
_0xfdd27[_0x1bd8b7(328)](_0x51d640);
});
__publicField(this, _q, () => {
const _0x5a07ed = _0x49fa29;
this[_0x5a07ed(336)]();
});
__publicField(this, _p, (_0xea378) => {
const _0x2ec931 = _0x49fa29;
this["logger"](_0x2ec931(331) + this["id"] + _0x2ec931(399), _0xea378), this[_0x2ec931(386)]["getEventDispatcher"]("onPeerError")({ "peerId": this["id"], "streamType": this[_0x2ec931(410)], "error": _0xea378 });
const { code: _0x1b075c } = _0xea378;
if (_0x1b075c === _0x2ec931(346)) this[_0x2ec931(336)]();
else _0x1b075c === "ERR_CONNECTION_FAILURE" && this[_0x2ec931(336)]();
});
__publicField(this, _o, () => {
const _0x3f31 = _0x49fa29;
this[_0x3f31(384)](_0x3f31(337)), this["connection"][_0x3f31(336)](), this[_0x3f31(376)]["onPeerClosed"](this), this[_0x3f31(403)]({ "peerId": this["id"], "streamType": this[_0x3f31(410)] }), this[_0x3f31(357)]("peer closed " + this["id"]);
});
const _0xbaef80 = _0x1469;
this["connection"] = _0x5d7ccc, this[_0xbaef80(376)] = _0x129b67, this["peerConfig"] = _0x1a985b, this[_0xbaef80(410)] = _0x11e112, this[_0xbaef80(386)] = _0x31e833, this[_0xbaef80(403)] = _0x31e833[_0xbaef80(383)]("onPeerClose"), this["id"] = Peer2[_0xbaef80(330)](_0x5d7ccc), this["peerProtocol"] = new PeerProtocol(_0x5d7ccc, _0x1a985b, { "onSegmentChunkReceived": this["onSegmentChunkReceived"], "onCommandReceived": this[_0xbaef80(391)] }, _0x31e833), _0x31e833[_0xbaef80(383)](_0xbaef80(363))({ "peerId": this["id"], "streamType": _0x11e112 }), _0x5d7ccc["on"](_0xbaef80(358), this[_0xbaef80(355)]), _0x5d7ccc["on"](_0xbaef80(404), this[_0xbaef80(374)]), _0x5d7ccc["on"](_0xbaef80(359), this["onPeerConnectionClosed"]), _0x5d7ccc["on"]("finish", this["onPeerConnectionClosed"]);
}
get [(_v = _0x49fa29(329), _u = _0x49fa29(333), _t = _0x49fa29(403), _0x49fa29(369))]() {
var _a2;
const _0x284d0c = _0x49fa29;
return (_a2 = this[_0x284d0c(333)]) == null ? void 0 : _a2["request"]["segment"];
}
[_0x49fa29(375)](_0x1bb9a8) {
const _0x3524ad = _0x49fa29, { externalId: _0x4c7cdc } = _0x1bb9a8;
if (this[_0x3524ad(372)][_0x3524ad(411)](_0x4c7cdc)) return "loaded";
if (this[_0x3524ad(366)][_0x3524ad(411)](_0x4c7cdc)) return _0x3524ad(339);
}
[(_s = _0x49fa29(391), _r = _0x49fa29(320), _0x49fa29(379))](_0x3e3614) {
const _0x367ce8 = _0x49fa29;
if (this["downloadingContext"]) throw new Error(_0x367ce8(332));
this["downloadingContext"] = { "request": _0x3e3614, "requestId": Math[_0x367ce8(341)](Math[_0x367ce8(353)]() * 1e3), "isSegmentDataCommandReceived": ![], "controls": _0x3e3614[_0x367ce8(342)]({ "downloadSource": _0x367ce8(360), "peerId": this["id"] }, { "notReceivingBytesTimeoutMs": this["peerConfig"]["p2pNotReceivingBytesTimeoutMs"], "abort": (_0x1a2c7c) => {
const _0x1d63c9 = _0x367ce8;
if (!this[_0x1d63c9(333)]) return;
const { request: _0x5ead70, requestId: _0x291dbf } = this[_0x1d63c9(333)];
this["sendCancelSegmentRequestCommand"](_0x5ead70[_0x1d63c9(347)], _0x291dbf), this["downloadingErrors"][_0x1d63c9(349)](_0x1a2c7c), this["downloadingContext"] = void 0;
const _0x3b9958 = this[_0x1d63c9(322)][_0x1d63c9(381)]((_0x6727f5) => _0x6727f5["type"] === _0x1d63c9(400));
_0x3b9958[_0x1d63c9(377)] >= this[_0x1d63c9(343)][_0x1d63c9(354)] && this[_0x1d63c9(336)]();
} }) };
const _0x261b66 = { "c": PeerCommandType[_0x367ce8(324)], "r": this[_0x367ce8(333)][_0x367ce8(412)], "i": _0x3e3614[_0x367ce8(347)][_0x367ce8(362)] };
if (_0x3e3614["loadedBytes"]) _0x261b66["b"] = _0x3e3614[_0x367ce8(405)];
this[_0x367ce8(329)]["sendCommand"](_0x261b66);
}
async [_0x49fa29(406)](_0x519f30, _0x2e4edb, _0x8b7054) {
const _0x20a295 = _0x49fa29, { externalId: _0x3af5c4 } = _0x519f30;
this[_0x20a295(357)]("send segment " + _0x519f30[_0x20a295(362)] + _0x20a295(397) + this["id"]);
const _0x1f0e8e = { "c": PeerCommandType[_0x20a295(402)], "i": _0x3af5c4, "r": _0x2e4edb, "s": _0x8b7054[_0x20a295(368)] };
this["peerProtocol"][_0x20a295(321)](_0x1f0e8e);
try {
await this["peerProtocol"][_0x20a295(380)](new Uint8Array(_0x8b7054), _0x2e4edb), this[_0x20a295(371)](_0x519f30, _0x2e4edb), this["logger"](_0x20a295(345) + _0x3af5c4 + _0x20a295(393) + this["id"]);
} catch {
this[_0x20a295(357)](_0x20a295(408) + _0x3af5c4);
}
}
[_0x49fa29(384)](_0x3f54c0) {
const _0x51ef74 = _0x49fa29;
if (!this["downloadingContext"]) return;
const { request: _0x8e595b, controls: _0x19545f } = this[_0x51ef74(333)], { segment: _0x302413 } = _0x8e595b;
this["logger"](_0x51ef74(350) + _0x302413[_0x51ef74(362)] + " (" + _0x3f54c0 + ")");
const _0x9abc7d = new RequestError(_0x3f54c0);
_0x19545f[_0x51ef74(409)](_0x9abc7d), this[_0x51ef74(333)] = void 0, this[_0x51ef74(322)]["push"](_0x9abc7d);
}
[_0x49fa29(361)](_0x4a659e, _0x4bec06) {
const _0x29f023 = _0x49fa29, _0x490b83 = { "c": PeerCommandType[_0x29f023(367)], "p": _0x4bec06, "l": _0x4a659e };
this[_0x29f023(329)][_0x29f023(321)](_0x490b83);
}
["sendSegmentAbsentCommand"](_0x273161, _0x2b67a9) {
const _0x5b053d = _0x49fa29;
this["peerProtocol"][_0x5b053d(321)]({ "c": PeerCommandType[_0x5b053d(325)], "i": _0x273161, "r": _0x2b67a9 });
}
[_0x49fa29(334)](_0x399cfb, _0xb8f520) {
const _0x5d2fe4 = _0x49fa29;
this[_0x5d2fe4(329)][_0x5d2fe4(321)]({ "c": PeerCommandType[_0x5d2fe4(390)], "i": _0x399cfb[_0x5d2fe4(362)], "r": _0xb8f520 });
}
["sendSegmentDataSendingCompletedCommand"](_0x1897bb, _0xb0b478) {
const _0x2b32e4 = _0x49fa29;
this[_0x2b32e4(329)]["sendCommand"]({ "c": PeerCommandType[_0x2b32e4(351)], "r": _0xb0b478, "i": _0x1897bb["externalId"] });
}
static [(_q = _0x49fa29(374), _p = _0x49fa29(355), _o = _0x49fa29(336), _0x49fa29(330))](_0x4f4ada) {
const _0xdf95ad = _0x49fa29;
return _0x2937c4[_0xdf95ad(407)](_0x4f4ada["id"]);
}
}
const _0x56e586 = _0xd79c;
(function(_0x242b54, _0x2376d5) {
const _0x1fcd25 = _0xd79c, _0x37bc8a = _0x242b54();
while (!![]) {
try {
const _0x261eac = parseInt(_0x1fcd25(298)) / 1 * (-parseInt(_0x1fcd25(264)) / 2) + parseInt(_0x1fcd25(253)) / 3 + -parseInt(_0x1fcd25(295)) / 4 * (parseInt(_0x1fcd25(261)) / 5) + -parseInt(_0x1fcd25(263)) / 6 + parseInt(_0x1fcd25(312)) / 7 + -parseInt(_0x1fcd25(293)) / 8 + parseInt(_0x1fcd25(277)) / 9 * (parseInt(_0x1fcd25(254)) / 10);
if (_0x261eac === _0x2376d5) break;
else _0x37bc8a["push"](_0x37bc8a["shift"]());
} catch (_0x376801) {
_0x37bc8a["push"](_0x37bc8a["shift"]());
}
}
})(_0x1229, 780146);
function _0xd79c(_0x1cc004, _0x2d0bfb) {
const _0x12291d = _0x1229();
return _0xd79c = function(_0xd79c6d, _0x186540) {
_0xd79c6d = _0xd79c6d - 253;
let _0x148b4f = _0x12291d[_0xd79c6d];
return _0x148b4f;
}, _0xd79c(_0x1cc004, _0x2d0bfb);
}
function _0x1229() {
const _0x4769ec = ["onTrackerWarning", "warning", "announceTrackers", "eventTarget", "onSegmentRequested", "onReceivePeerConnection", "set", "destroy", "rtcConfig", "6416179VVArLp", "4669791AWbBXk", "10DmhjxU", "client", "_peers", "eventHandlers", "test", "onTrackerClientWarning", "get", "5kbTImu", "stream", "8379798NKHkbU", "642526aDTFAL", "connected with peer: ", "tracker warning (", "config", "values", "slice", "add", "connect", "generatePeerId", "onTrackerError", "statsCollector", "onPeerClosed", "getEventDispatcher", "23858001IcVZoY", "getStreamHash", "PEER_ID_BY_INFO_HASH", "type", "peer", "clear", "stats", "start", "\npeerId: ", "idUtf8", "; hash: ", "logger", "clearPeerIdCache", "error", "tracker error (", "streamShortId", "12390528ltrMcU", "peers", "3023848tvzXpx", "userAgent", "potentialConnections", "2XkJYTz", "onTrackerClientError", "getPeerIdFromConnection", "onPeerConnected", "create new client; \nstream: "];
_0x1229 = function() {
return _0x4769ec;
};
return _0x1229();
}
function isSafariOrWkWebview() {
const _0x550fc3 = _0xd79c, _0x3943ef = /^((?!chrome|android).)*safari/i[_0x550fc3(258)](navigator["userAgent"]), _0x425707 = /\b(iPad|iPhone|Macintosh).*AppleWebKit(?!.*Safari)/i[_0x550fc3(258)](navigator[_0x550fc3(296)]);
return _0x3943ef || _0x425707;
}
const _P2PTrackerClient = class _P2PTrackerClient {
constructor(_0x43fdbf, _0x2cf5bf, _0x123c73, _0x433cb6, _0xf80ab1) {
__publicField(this, _B);
__publicField(this, _A);
__publicField(this, _z, /* @__PURE__ */ new Map());
__publicField(this, _y, _0x1bf98d("p2pml-core:p2p-tracker-client"));
__publicField(this, "onReceivePeerConnection", (_0x4b92a4) => {
const _0x1e657c = _0x56e586, _0x411f3d = Peer2[_0x1e657c(300)](_0x4b92a4);
let _0x19897b = this[_0x1e657c(256)][_0x1e657c(260)](_0x411f3d);
if (_0x19897b == null ? void 0 : _0x19897b[_0x1e657c(281)]) {
_0x4b92a4[_0x1e657c(310)]();
return;
}
!_0x19897b && (_0x19897b = { "potentialConnections": /* @__PURE__ */ new Set() }, _0x4b92a4[_0x1e657c(286)] = _0x411f3d, this[_0x1e657c(256)][_0x1e657c(309)](_0x411f3d, _0x19897b)), _0x19897b[_0x1e657c(297)][_0x1e657c(270)](_0x4b92a4), _0x4b92a4["on"](_0x1e657c(271), () => {
const _0x132874 = _0x1e657c;
if (_0x19897b[_0x132874(281)]) return;
for (const _0xab8c1b of _0x19897b["potentialConnections"]) {
if (_0xab8c1b !== _0x4b92a4) _0xab8c1b[_0x132874(310)]();
}
_0x19897b[_0x132874(297)][_0x132874(282)](), _0x19897b[_0x132874(281)] = new Peer2(_0x4b92a4, { "onPeerClosed": this[_0x132874(275)], "onSegmentRequested": this["eventHandlers"][_0x132874(307)], "onSegmentsAnnouncement": this["eventHandlers"]["onSegmentsAnnouncement"] }, this[_0x132874(267)], this[_0x132874(262)][_0x132874(280)], this[_0x132874(306)]), this[_0x132874(288)](_0x132874(265) + _0x19897b[_0x132874(281)]["id"] + " " + this[_0x132874(292)]), this[_0x132874(257)][_0x132874(301)](_0x19897b["peer"]);
});
});
__publicField(this, _x, (_0x455bc1) => {
const _0x2efbc5 = _0x56e586;
this["logger"](_0x2efbc5(266) + this[_0x2efbc5(292)] + ": " + _0x455bc1 + ")"), this[_0x2efbc5(306)][_0x2efbc5(276)](_0x2efbc5(303))({ "streamType": this["stream"][_0x2efbc5(280)], "warning": _0x455bc1 });
});
__publicField(this, "onTrackerClientError", (_0x5dca92) => {
const _0x18ce66 = _0x56e586;
this[_0x18ce66(288)](_0x18ce66(291) + this[_0x18ce66(292)] + ": " + _0x5dca92 + ")"), this[_0x18ce66(306)][_0x18ce66(276)](_0x18ce66(273))({ "streamType": this["stream"][_0x18ce66(280)], "error": _0x5dca92 });
});
__publicField(this, _w, (_0x381501) => {
const _0x2d9b98 = _0x56e586;
this[_0x2d9b98(288)]("peer closed: " + _0x381501["id"]), this[_0x2d9b98(256)]["delete"](_0x381501["id"]);
});
const _0x2a9074 = _0xd79c;
this["stream"] = _0x2cf5bf, this[_0x2a9074(257)] = _0x123c73, this["config"] = _0x433cb6, this[_0x2a9074(306)] = _0xf80ab1;
const _0x491c0e = _0x2d3222[_0x2a9074(278)](_0x43fdbf);
this[_0x2a9074(292)] = getStreamString(_0x2cf5bf);
let _0xc9c775 = _P2PTrackerClient[_0x2a9074(279)][_0x2a9074(260)](_0x491c0e);
!_0xc9c775 && (_0xc9c775 = _0x2d3222[_0x2a9074(272)](_0x433cb6["trackerClientVersionPrefix"]), _P2PTrackerClient[_0x2a9074(279)]["set"](_0x491c0e, _0xc9c775)), this[_0x2a9074(255)] = new Client({ "infoHash": utf8ToUintArray(_0x491c0e), "peerId": utf8ToUintArray(_0xc9c775), "announce": isSafariOrWkWebview() ? _0x433cb6["announceTrackers"][_0x2a9074(269)](0, 1) : _0x433cb6[_0x2a9074(305)], "rtcConfig": this[_0x2a9074(267)][_0x2a9074(311)] }), this["client"]["on"]("peer", this[_0x2a9074(308)]), this[_0x2a9074(255)]["on"](_0x2a9074(304), this["onTrackerClientWarning"]), this["client"]["on"](_0x2a9074(290), this[_0x2a9074(299)]), this[_0x2a9074(288)](_0x2a9074(302) + this[_0x2a9074(292)] + _0x2a9074(287) + _0x491c0e + _0x2a9074(285) + _0xc9c775);
}
[(_C = _0x56e586(279), _B = _0x56e586(292), _A = _0x56e586(255), _z = _0x56e586(256), _y = _0x56e586(288), _0x56e586(284))]() {
this["client"]["start"]();
}
[_0x56e586(283)](_0x442124) {
const _0x426b8a = _0x56e586;
this[_0x426b8a(255)][_0x426b8a(274)](_0x442124);
}
[_0x56e586(310)]() {
const _0x38e9c2 = _0x56e586;
this[_0x38e9c2(255)]["destroy"]();
for (const { peer: _0x52faf0, potentialConnections: _0x30bc63 } of this["_peers"]["values"]()) {
_0x52faf0 == null ? void 0 : _0x52faf0[_0x38e9c2(310)]();
for (const _0x2e799c of _0x30bc63) {
_0x2e799c[_0x38e9c2(310)]();
}
}
this["_peers"][_0x38e9c2(282)](), this[_0x38e9c2(288)]("destroy client; stream: " + this[_0x38e9c2(292)]);
}
*[(_x = _0x56e586(259), _0x56e586(294))]() {
const _0x1075f1 = _0x56e586;
for (const _0x2a660c of this[_0x1075f1(256)][_0x1075f1(268)]()) {
if (_0x2a660c[_0x1075f1(281)]) yield _0x2a660c[_0x1075f1(281)];
}
}
static [(_w = _0x56e586(275), _0x56e586(289))]() {
_P2PTrackerClient["PEER_ID_BY_INFO_HASH"]["clear"]();
}
};
__publicField(_P2PTrackerClient, _C, /* @__PURE__ */ new Map());
let P2PTrackerClient = _P2PTrackerClient;
(function(_0xe08423, _0x38b216) {
const _0x1b88ad = _0x1640, _0x2757fe = _0xe08423();
while (!![]) {
try {
const _0x3e2875 = parseInt(_0x1b88ad(433)) / 1 * (parseInt(_0x1b88ad(436)) / 2) + parseInt(_0x1b88ad(437)) / 3 * (parseInt(_0x1b88ad(425)) / 4) + parseInt(_0x1b88ad(444)) / 5 * (parseInt(_0x1b88ad(435)) / 6) + -parseInt(_0x1b88ad(443)) / 7 * (-parseInt(_0x1b88ad(429)) / 8) + parseInt(_0x1b88ad(438)) / 9 * (-parseInt(_0x1b88ad(434)) / 10) + -parseInt(_0x1b88ad(439)) / 11 + parseInt(_0x1b88ad(430)) / 12;
if (_0x3e2875 === _0x38b216) break;
else _0x2757fe["push"](_0x2757fe["shift"]());
} catch (_0x54ba79) {
_0x2757fe["push"](_0x2757fe["shift"]());
}
}
})(_0x5b1f, 900159);
const PEER_PROTOCOL_VERSION = "v2";
function getStreamSwarmId(_0x51face, _0x14b931) {
return PEER_PROTOCOL_VERSION + "-" + _0x51face + "-" + getStreamId(_0x14b931);
}
function getSegmentFromStreamsMap(_0x2ee440, _0x535efc) {
const _0x178558 = _0x1640;
for (const _0x49ac0a of _0x2ee440[_0x178558(440)]()) {
const _0x2afbe5 = _0x49ac0a["segments"][_0x178558(426)](_0x535efc);
if (_0x2afbe5) return _0x2afbe5;
}
}
function getSegmentFromStreamByExternalId(_0x592afc, _0x53ae17) {
const _0x20042a = _0x1640;
for (const _0x7cb0e2 of _0x592afc[_0x20042a(431)][_0x20042a(440)]()) {
if (_0x7cb0e2[_0x20042a(428)] === _0x53ae17) return _0x7cb0e2;
}
}
function getStreamId(_0x3752a0) {
const _0xfddddd = _0x1640;
return _0x3752a0["type"] + "-" + _0x3752a0[_0xfddddd(441)];
}
function _0x1640(_0x32ef72, _0x1a0631) {
const _0x5b1fa0 = _0x5b1f();
return _0x1640 = function(_0x164043, _0xa8cbaf) {
_0x164043 = _0x164043 - 425;
let _0x5e480c = _0x5b1fa0[_0x164043];
return _0x5e480c;
}, _0x1640(_0x32ef72, _0x1a0631);
}
function getSegmentAvgDuration(_0x1f413b) {
const _0x47837b = _0x1640, { segments: _0xa9ad5b } = _0x1f413b;
let _0x331a5d = 0;
const { size: _0x5daf9c } = _0xa9ad5b;
for (const _0x1402e4 of _0xa9ad5b["values"]()) {
const _0xe88b90 = _0x1402e4["endTime"] - _0x1402e4[_0x47837b(432)];
_0x331a5d += _0xe88b90;
}
return _0x331a5d / _0x5daf9c;
}
function calculateTimeWindows(_0x19476a, _0x2d0ac0) {
const _0x2af87c = _0x1640, { highDemandTimeWindow: _0x48cdea, httpDownloadTimeWindow: _0x133614, p2pDownloadTimeWindow: _0x272be2 } = _0x19476a, _0x166d10 = { "highDemandTimeWindow": _0x48cdea, "httpDownloadTimeWindow": _0x133614, "p2pDownloadTimeWindow": _0x272be2 };
if (_0x2d0ac0 <= 5) _0x166d10[_0x2af87c(427)] = 0, _0x166d10["p2pDownloadTimeWindow"] = 0;
else _0x2d0ac0 <= 10 && (_0x166d10[_0x2af87c(442)] = _0x166d10[_0x2af87c(427)]);
return _0x166d10;
}
function getSegmentPlaybackStatuses(_0x4cb237, _0x4ca3b7, _0x416f67, _0x833fdd, _0x3766b3) {
const { highDemandTimeWindow: _0xf02892, httpDownloadTimeWindow: _0x5b416a, p2pDownloadTimeWindow: _0x4d3144 } = calculateTimeWindows(_0x416f67, _0x3766b3);
return { "isHighDemand": isSegmentInTimeWindow(_0x4cb237, _0x4ca3b7, _0xf02892), "isHttpDownloadable": isSegmentInTimeWindow(_0x4cb237, _0x4ca3b7, _0x5b416a), "isP2PDownloadable": isSegmentInTimeWindow(_0x4cb237, _0x4ca3b7, _0x4d3144) && _0x833fdd["isSegmentLoadingOrLoadedBySomeone"](_0x4cb237) };
}
function isSegmentInTimeWindow(_0x475a05, _0x20198b, _0x1d3e17) {
const { startTime: _0xb8a7d7, endTime: _0x5e21ac } = _0x475a05, { position: _0x5ea034, rate: _0x4b763f } = _0x20198b, _0x3c0d29 = _0x5ea034 + _0x1d3e17 * _0x4b763f;
return !(_0x3c0d29 < _0xb8a7d7 || _0x5ea034 > _0x5e21ac);
}
function _0x5b1f() {
const _0xa982bd = ["4801356riOIhE", "segments", "startTime", "1ichDJY", "10vSvegv", "76746HyfyWc", "1052294kpvOEJ", "1191grPoCa", "6067431OtjcaX", "14715360FytnGb", "values", "index", "p2pDownloadTimeWindow", "28ehheYo", "170xMroXc", "1152ojNssh", "get", "httpDownloadTimeWindow", "externalId", "2873176uadrGf"];
_0x5b1f = function() {
return _0xa982bd;
};
return _0x5b1f();
}
const _0x37c065 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
getSegmentAvgDuration,
getSegmentFromStreamByExternalId,
getSegmentFromStreamsMap,
getSegmentPlaybackStatuses,
getStreamId,
getStreamSwarmId
}, Symbol.toStringTag, { value: "Module" }));
const _0x34ec65 = _0x5f4a;
function _0x5f4a(_0x42f6ff, _0x2eb125) {
const _0x3e2abb = _0x3e2a();
return _0x5f4a = function(_0x5f4af6, _0x462fcd) {
_0x5f4af6 = _0x5f4af6 - 130;
let _0x2c3ceb = _0x3e2abb[_0x5f4af6];
return _0x2c3ceb;
}, _0x5f4a(_0x42f6ff, _0x2eb125);
}
(function(_0x57c7d4, _0x3e084b) {
const _0x5ee8e6 = _0x5f4a, _0x4ec39c = _0x57c7d4();
while (!![]) {
try {
const _0x49e211 = -parseInt(_0x5ee8e6(177)) / 1 + parseInt(_0x5ee8e6(146)) / 2 + -parseInt(_0x5ee8e6(133)) / 3 + -parseInt(_0x5ee8e6(162)) / 4 + -parseInt(_0x5ee8e6(148)) / 5 + -parseInt(_0x5ee8e6(167)) / 6 + parseInt(_0x5ee8e6(154)) / 7;
if (_0x49e211 === _0x3e084b) break;
else _0x4ec39c["push"](_0x4ec39c["shift"]());
} catch (_0x1736ba) {
_0x4ec39c["push"](_0x4ec39c["shift"]());
}
}
})(_0x3e2a, 677177);
function _0x3e2a() {
const _0x5468dc = ["removeEventListener", "push", "getSegmentsAnnouncement", "destroy", "27264349CVjXYJ", "sendSegmentsAnnouncementCommand", "sendSegmentsAnnouncement", "onSegmentAnnouncement", "loaded", "addEventListener", "onSegmentLoaded", "total", "1503468PszupV", "config", "streamManifestUrl", "start", "stats", "2086632eLgryZ", "onStorageUpdated-", "isSegmentLoadingOrLoadedBySomeone", "trackerClient", "statsCollector", "httpRequests", "downloadingSegment", "isAnnounceMicrotaskCreated", "get", "downloadSegment", "1140563zDadoA", "STATS_SEGMENTS_THRESHOLD", "segmentStorage", "statsSegmentsThreshold", "getStreamSwarmId", "peers", "connectedPeerCount", "dispatchEvent", "swarmId", "3912609HDkiUp", "broadcastAnnouncement", "statsSegmentsBuffer", "setSegmentChangeCallback", "requests", "getSegmentStatus", "http", "isSegmentLoadedBySomeone", "slice", "eventTarget", "p2p", "stream", "isP2PUploadDisabled", "1350642VJIbXf", "onSegmentRequested", "3623230fMCjsD", "runtimeId"];
_0x3e2a = function() {
return _0x5468dc;
};
return _0x3e2a();
}
class P2PLoader {
constructor(_0x5d6ed1, _0x526200, _0x50f8c3, _0x84d92b, _0x22cd2a, _0x39afc3, _0x437bef) {
__publicField(this, "trackerClient");
__publicField(this, _G, ![]);
__publicField(this, "stats", { "p2p": 0, "http": 0, "total": 0, "percentaje": 0 });
__publicField(this, "statsSegmentsBuffer", 0);
__publicField(this, _F);
__publicField(this, "onPeerConnected", (_0x5f0633) => {
const _0x470283 = _0x34ec65;
if (this["config"][_0x470283(145)]) return;
const { httpLoading: _0x333ec8, loaded: _0x5d5e5a } = this["getSegmentsAnnouncement"]();
_0x5f0633["sendSegmentsAnnouncementCommand"](_0x5d5e5a, _0x333ec8);
});
__publicField(this, "broadcastAnnouncement", (_0x23b64a = ![]) => {
const _0x1c4eb3 = _0x34ec65;
if (_0x23b64a) {
this[_0x1c4eb3(156)]([], []);
return;
}
if (this[_0x1c4eb3(174)] || this[_0x1c4eb3(163)][_0x1c4eb3(145)]) return;
const { loaded: _0x51754f, httpLoading: _0x45c8da } = this[_0x1c4eb3(152)]();
this[_0x1c4eb3(156)](_0x51754f, _0x45c8da);
});
__publicField(this, _E, (_0x59106d, _0x3b689f) => {
this["isAnnounceMicrotaskCreated"] = !![], queueMicrotask(() => {
const _0x382dea = _0x5f4a;
for (const _0x37cd8e of this[_0x382dea(170)][_0x382dea(182)]()) {
_0x37cd8e[_0x382dea(155)](_0x59106d, _0x3b689f);
}
this["isAnnounceMicrotaskCreated"] = ![];
});
});
__publicField(this, _D, async (_0x36017d, _0x1714f7, _0x31b17a, _0x8f4b70) => {
const _0x3511c7 = _0x34ec65, _0x16903d = getSegmentFromStreamByExternalId(this[_0x3511c7(144)], _0x1714f7);
if (!_0x16903d) return;
if (this[_0x3511c7(163)]["isP2PUploadDisabled"]) {
_0x36017d["sendSegmentAbsentCommand"](_0x1714f7, _0x31b17a);
return;
}
const _0x36ffce = this["config"][_0x3511c7(132)] ?? this["streamManifestUrl"], _0x312e5b = getStreamSwarmId(_0x36ffce, this[_0x3511c7(144)]), _0x192c99 = await this[_0x3511c7(179)]["getSegmentData"](_0x36ffce, _0x312e5b, _0x16903d["externalId"]);
if (!_0x192c99) {
_0x36017d["sendSegmentAbsentCommand"](_0x1714f7, _0x31b17a);
return;
}
await _0x36017d["uploadSegmentData"](_0x16903d, _0x31b17a, _0x8f4b70 !== void 0 ? _0x192c99[_0x3511c7(141)](_0x8f4b70) : _0x192c99);
});
const _0x259cbb = _0x5f4a;
this["streamManifestUrl"] = _0x5d6ed1, this["stream"] = _0x526200, this[_0x259cbb(137)] = _0x50f8c3, this[_0x259cbb(179)] = _0x84d92b, this["config"] = _0x22cd2a, this[_0x259cbb(142)] = _0x39afc3, this[_0x259cbb(157)] = _0x437bef, this[_0x259cbb(178)] = this[_0x259cbb(163)][_0x259cbb(180)] ?? 10;
const _0x5098b8 = this[_0x259cbb(163)][_0x259cbb(132)] ?? this[_0x259cbb(164)], _0x15725b = _0x37c065[_0x259cbb(181)](_0x5098b8, this[_0x259cbb(144)]);
this["trackerClient"] = new P2PTrackerClient(_0x15725b, this[_0x259cbb(144)], { "onPeerConnected": this["onPeerConnected"], "onSegmentRequested": this[_0x259cbb(147)], "onSegmentsAnnouncement": this[_0x259cbb(157)] }, this[_0x259cbb(163)], this[_0x259cbb(142)]), this["eventTarget"]["addEventListener"]("onStorageUpdated-" + _0x15725b, this[_0x259cbb(134)]), this[_0x259cbb(179)][_0x259cbb(136)]((_0x1479c4) => {
const _0x51e134 = _0x259cbb;
this[_0x51e134(142)][_0x51e134(131)]("onStorageUpdated-" + _0x1479c4);
}), this["trackerClient"][_0x259cbb(165)](), this["eventTarget"][_0x259cbb(159)](_0x259cbb(160), (_0x4fcbda) => {
const _0x3db15a = _0x259cbb, { bytesLength: _0x299f86, downloadSource: _0x2d6206 } = _0x4fcbda;
if (_0x2d6206 === _0x3db15a(143)) this[_0x3db15a(166)][_0x3db15a(143)] += _0x299f86;
if (_0x2d6206 === _0x3db15a(139)) this["stats"][_0x3db15a(139)] += _0x299f86;
this[_0x3db15a(166)][_0x3db15a(161)] = this[_0x3db15a(166)]["p2p"] + this[_0x3db15a(166)][_0x3db15a(139)], this[_0x3db15a(166)]["percentaje"] = this[_0x3db15a(166)][_0x3db15a(161)] ? this["stats"][_0x3db15a(143)] / this["stats"][_0x3db15a(161)] * 100 : 0, this[_0x3db15a(135)] += 1, this[_0x3db15a(135)] >= this[_0x3db15a(178)] && (this[_0x3db15a(170)]["client"][_0x3db15a(171)]({ ...this[_0x3db15a(166)] }), this[_0x3db15a(166)] = { "p2p": 0, "http": 0, "total": 0, "percentaje": 0 }, this[_0x3db15a(135)] = 0);
});
}
[(_G = _0x34ec65(174), _F = _0x34ec65(178), _0x34ec65(176))](_0x304890) {
const _0x428067 = _0x34ec65, _0x158a1b = [];
for (const _0x5949c9 of this["trackerClient"][_0x428067(182)]()) {
!_0x5949c9[_0x428067(173)] && _0x5949c9[_0x428067(138)](_0x304890) === _0x428067(158) && _0x158a1b[_0x428067(151)](_0x5949c9);
}
if (_0x158a1b["length"] === 0) return;
const _0x3aff76 = getRandomItem(_0x158a1b), _0x52ad48 = this[_0x428067(137)]["getOrCreateRequest"](_0x304890);
_0x3aff76[_0x428067(176)](_0x52ad48);
}
[_0x34ec65(169)](_0x4db44f) {
const _0x5c99d2 = _0x34ec65;
for (const _0x15f817 of this[_0x5c99d2(170)][_0x5c99d2(182)]()) {
if (_0x15f817[_0x5c99d2(138)](_0x4db44f)) return !![];
}
return ![];
}
[_0x34ec65(140)](_0x5d2cc1) {
const _0x328630 = _0x34ec65;
for (const _0x21eab4 of this[_0x328630(170)][_0x328630(182)]()) {
if (_0x21eab4["getSegmentStatus"](_0x5d2cc1) === _0x328630(158)) return !![];
}
return ![];
}
get [_0x34ec65(130)]() {
const _0x11e684 = _0x34ec65;
let _0x267976 = 0;
for (const _0x1aad22 of this[_0x11e684(170)][_0x11e684(182)]()) _0x267976++;
return _0x267976;
}
[_0x34ec65(152)]() {
const _0x4043d9 = _0x34ec65, _0x3a9dda = this[_0x4043d9(163)]["swarmId"] ?? this["streamManifestUrl"], _0x34c9f8 = _0x37c065[_0x4043d9(181)](_0x3a9dda, this[_0x4043d9(144)]), _0x442257 = this[_0x4043d9(179)]["getStoredSegmentIds"](_0x3a9dda, _0x34c9f8), _0x407622 = [];
for (const _0x4d3a37 of this["requests"][_0x4043d9(172)]()) {
const _0x3eda18 = this["stream"]["segments"][_0x4043d9(175)](_0x4d3a37["segment"][_0x4043d9(149)]);
if (!_0x3eda18) continue;
_0x407622[_0x4043d9(151)](_0x3eda18["externalId"]);
}
return { "loaded": _0x442257, "httpLoading": _0x407622 };
}
[(_E = _0x34ec65(156), _D = _0x34ec65(147), _0x34ec65(153))]() {
const _0x2e5ef6 = _0x34ec65, _0x1580a8 = this[_0x2e5ef6(163)]["swarmId"] ?? this[_0x2e5ef6(164)], _0xccef8 = _0x37c065[_0x2e5ef6(181)](_0x1580a8, this[_0x2e5ef6(144)]);
this[_0x2e5ef6(142)][_0x2e5ef6(150)](_0x2e5ef6(168) + _0xccef8, this[_0x2e5ef6(134)]), this[_0x2e5ef6(170)][_0x2e5ef6(153)]();
}
}
function _0x5eff(_0x3b77a8, _0x1c0208) {
const _0x1b07ea = _0x1b07();
return _0x5eff = function(_0x5eff76, _0x20761a) {
_0x5eff76 = _0x5eff76 - 315;
let _0x48ecbe = _0x1b07ea[_0x5eff76];
return _0x48ecbe;
}, _0x5eff(_0x3b77a8, _0x1c0208);
}
function _0x1b07() {
const _0x4750a3 = ["getStoredSegmentIds", "eventTarget", "Loader for this stream already exists", "logger", "destroy", "set", "get", "set current p2p loader: ", "currentLoader", "values", "1925961gfUHAF", "41196kCbmgb", "p2pInactiveLoaderDestroyTimeoutMs", "segmentStorage", "changeCurrentLoader", "destroyTimeoutId", "swarmId", "_currentLoaderItem", "1590200pIVQPZ", "loader", "getStreamString", "3243320ZZIpbk", "5226210VyVLPO", "findOrCreateLoaderForStream", "runtimeId", "delete", "loggerInfo", "streamManifestUrl", "setLoaderDestroyTimeout", "created new loader: ", "config", "requests", "loaders", "stream", "createLoader", "3086139zMjolp", "3154860IidLgP", "destroyAndRemoveLoader", "length", "setTimeout"];
_0x1b07 = function() {
return _0x4750a3;
};
return _0x1b07();
}
const _0x5922fc = _0x5eff;
(function(_0x358faf, _0x23e20b) {
const _0x4ebdf1 = _0x5eff, _0x410308 = _0x358faf();
while (!![]) {
try {
const _0x36e760 = parseInt(_0x4ebdf1(340)) / 1 + -parseInt(_0x4ebdf1(347)) / 2 + parseInt(_0x4ebdf1(339)) / 3 + parseInt(_0x4ebdf1(325)) / 4 + -parseInt(_0x4ebdf1(350)) / 5 + parseInt(_0x4ebdf1(351)) / 6 + -parseInt(_0x4ebdf1(324)) / 7;
if (_0x36e760 === _0x23e20b) break;
else _0x410308["push"](_0x410308["shift"]());
} catch (_0x56b3ca) {
_0x410308["push"](_0x410308["shift"]());
}
}
})(_0x1b07, 458292);
class P2PLoadersContainer {
constructor(_0xfa15b6, _0x567761, _0x354c5f, _0x5a3805, _0x38fbf3, _0x59dc57, _0x1bc214) {
__publicField(this, _J, /* @__PURE__ */ new Map());
__publicField(this, _I);
__publicField(this, _H, _0x1bf98d("p2pml-core:p2p-loaders-container"));
const _0x1da4a8 = _0x5eff;
this[_0x1da4a8(316)] = _0xfa15b6, this[_0x1da4a8(320)] = _0x354c5f, this[_0x1da4a8(342)] = _0x5a3805, this[_0x1da4a8(319)] = _0x38fbf3, this["eventTarget"] = _0x59dc57, this["onSegmentAnnouncement"] = _0x1bc214, this[_0x1da4a8(346)] = this[_0x1da4a8(352)](_0x567761), this[_0x1da4a8(332)](_0x1da4a8(336) + getStreamString(_0x567761));
}
["createLoader"](_0x221130) {
const _0x349196 = _0x5922fc;
if (this[_0x349196(321)]["has"](_0x221130["runtimeId"])) throw new Error(_0x349196(331));
const _0x454341 = new P2PLoader(this[_0x349196(316)], _0x221130, this[_0x349196(320)], this[_0x349196(342)], this[_0x349196(319)], this[_0x349196(330)], () => {
const _0x535c51 = _0x349196;
this[_0x535c51(346)][_0x535c51(348)] === _0x454341 && this["onSegmentAnnouncement"]();
}), _0x1c47a1 = _0x4b750[_0x349196(349)](_0x221130);
return this["logger"](_0x349196(318) + _0x1c47a1), { "loader": _0x454341, "stream": _0x221130, "loggerInfo": _0x4b750[_0x349196(349)](_0x221130) };
}
[(_J = _0x5922fc(321), _I = _0x5922fc(346), _H = _0x5922fc(332), _0x5922fc(352))](_0x4d64a1) {
const _0x363080 = _0x5922fc, _0x32b26d = this["loaders"][_0x363080(335)](_0x4d64a1[_0x363080(353)]);
if (_0x32b26d) return clearTimeout(_0x32b26d[_0x363080(344)]), _0x32b26d["destroyTimeoutId"] = void 0, _0x32b26d;
else {
const _0x250bc1 = this[_0x363080(323)](_0x4d64a1);
return this[_0x363080(321)][_0x363080(334)](_0x4d64a1["runtimeId"], _0x250bc1), _0x250bc1;
}
}
[_0x5922fc(343)](_0x590f59) {
const _0x36472d = _0x5922fc, _0x20feff = this[_0x36472d(319)][_0x36472d(345)] ?? this[_0x36472d(316)], _0x2bf7da = getStreamSwarmId(_0x20feff, this[_0x36472d(346)]["stream"]), _0x5046b0 = this[_0x36472d(342)][_0x36472d(329)](_0x20feff, _0x2bf7da);
if (!_0x5046b0[_0x36472d(327)]) this["destroyAndRemoveLoader"](this[_0x36472d(346)]);
else this[_0x36472d(317)](this["_currentLoaderItem"]);
this[_0x36472d(346)] = this[_0x36472d(352)](_0x590f59), this["logger"]("change current p2p loader: " + getStreamString(_0x590f59));
}
[_0x5922fc(317)](_0x58e6a0) {
const _0x550716 = _0x5922fc;
_0x58e6a0[_0x550716(344)] = window[_0x550716(328)](() => this["destroyAndRemoveLoader"](_0x58e6a0), this[_0x550716(319)][_0x550716(341)]);
}
[_0x5922fc(326)](_0x31fecc) {
const _0x43e80c = _0x5922fc;
_0x31fecc["loader"][_0x43e80c(333)](), this[_0x43e80c(321)][_0x43e80c(354)](_0x31fecc[_0x43e80c(322)][_0x43e80c(353)]), this[_0x43e80c(332)]("destroy p2p loader: ", _0x31fecc[_0x43e80c(315)]);
}
get [_0x5922fc(337)]() {
const _0x1c70e7 = _0x5922fc;
return this[_0x1c70e7(346)][_0x1c70e7(348)];
}
[_0x5922fc(333)]() {
const _0x392984 = _0x5922fc;
for (const { loader: _0x3f3dfc, destroyTimeoutId: _0x4f9c05 } of this[_0x392984(321)][_0x392984(338)]()) {
_0x3f3dfc[_0x392984(333)](), clearTimeout(_0x4f9c05);
}
this[_0x392984(321)]["clear"]();
}
}
const _0x4353bd = _0x1329;
function _0xf837() {
const _0x444520 = ["not-started", "httpAttemptsCount", "onSegmentAbort", "bytes-receiving-timeout", "_status", "clearLoadedBytes", "byteLength", "loadedBytes", "red", "endTime", "start", "runtimeId", "type", "finalData", "addBytes", "onSegmentLoaded", "bandwidthCalculators", "green", "restart", "now", "isHandledByProcessQueue", "markHandledByProcessQueue", "firstBytesReceived", "progress", "attempts", "timeoutId", "action", "255624zgKcJQ", "requestProcessQueueCallback", "aborted", "completeOnSuccess", "status", "Request ", "manageBandwidthCalculatorsState", "succeed", "getEventDispatcher", "p2pml-core:request-", "onSegmentError", "color", " started", "setTimeout", "161eWbCWG", "data", "add", "abort", "9453660QasZuT", "startLoading", "downloadSource", "reduce", "abortFromProcessQueue", "_abortRequestCallback", "p2p", "setStatus", "push", "4477434hkfGgB", "byteRange", "_isHandledByProcessQueue", "segment", "clear", "15ciXWjU", "externalId", "playbackConfig", " succeed", "328217CAKgGm", "_totalBytes", "27JEHzkR", "url", "_logger", "lastLoadedChunkTimestamp", "Request total bytes value is already set", " has been already succeed.", "687552flfiOU", "loading", " has been already started.", "logger", "notReceivingBytesTimeout", "onSegmentStart", "abortOnError", "stream", "_loadedBytes", "throwErrorIfNotLoadingStatus", " failed ", "bytes", "2OOuAlq", "currentAttempt", "joinChunksArrayBuffer", "addLoadedChunk", "638dmzLdm", "failed", "2207272lSLsnJ", "Request has been already ", "stop", "1585628mURdzr", "setTotalBytes", "http", "peerId", "Timeout is already started.", "playback", " aborted", "_failedAttempts"];
_0xf837 = function() {
return _0x444520;
};
return _0xf837();
}
(function(_0x581bab, _0x4ccd08) {
const _0x2a0a7e = _0x1329, _0x4c8a8c = _0x581bab();
while (!![]) {
try {
const _0x48c48d = -parseInt(_0x2a0a7e(176)) / 1 * (-parseInt(_0x2a0a7e(196)) / 2) + parseInt(_0x2a0a7e(167)) / 3 + parseInt(_0x2a0a7e(205)) / 4 * (parseInt(_0x2a0a7e(172)) / 5) + parseInt(_0x2a0a7e(240)) / 6 * (parseInt(_0x2a0a7e(254)) / 7) + -parseInt(_0x2a0a7e(202)) / 8 * (parseInt(_0x2a0a7e(178)) / 9) + parseInt(_0x2a0a7e(258)) / 10 + parseInt(_0x2a0a7e(200)) / 11 * (-parseInt(_0x2a0a7e(184)) / 12);
if (_0x48c48d === _0x4ccd08) break;
else _0x4c8a8c["push"](_0x4c8a8c["shift"]());
} catch (_0x47f008) {
_0x4c8a8c["push"](_0x4c8a8c["shift"]());
}
}
})(_0xf837, 784279);
function _0x1329(_0x3a1c31, _0x1a76c5) {
const _0xf837c3 = _0xf837();
return _0x1329 = function(_0x1329e4, _0x5b2af8) {
_0x1329e4 = _0x1329e4 - 159;
let _0x45b6cd = _0xf837c3[_0x1329e4];
return _0x45b6cd;
}, _0x1329(_0x3a1c31, _0x1a76c5);
}
function mapSegmentWithStreamToSegment(_0x3b2c20) {
const _0x119bbf = _0x1329;
return { "runtimeId": _0x3b2c20[_0x119bbf(224)], "externalId": _0x3b2c20[_0x119bbf(173)], "url": _0x3b2c20[_0x119bbf(179)], "byteRange": _0x3b2c20[_0x119bbf(168)], "startTime": _0x3b2c20["startTime"], "endTime": _0x3b2c20[_0x119bbf(222)] };
}
let Request$1 = class Request2 {
constructor(_0x30b530, _0x51ab9f, _0x2664f8, _0x56e34c, _0x231ded, _0x5600b6) {
__publicField(this, "currentAttempt");
__publicField(this, _Z, new FailedRequestAttempts());
__publicField(this, _Y);
__publicField(this, "bytes", []);
__publicField(this, _X, 0);
__publicField(this, _W);
__publicField(this, _V, _0x4353bd(213));
__publicField(this, "progress");
__publicField(this, _U);
__publicField(this, "_abortRequestCallback");
__publicField(this, _T);
__publicField(this, _S, ![]);
__publicField(this, _R);
__publicField(this, _Q);
__publicField(this, _P);
__publicField(this, _O);
__publicField(this, "abortOnTimeout", () => {
var _a2;
const _0x3b835e = _0x4353bd;
this[_0x3b835e(193)]();
if (!this[_0x3b835e(197)]) return;
this[_0x3b835e(165)](_0x3b835e(201));
const _0x196bf0 = new RequestError(_0x3b835e(216));
(_a2 = this["_abortRequestCallback"]) == null ? void 0 : _a2.call(this, _0x196bf0), this[_0x3b835e(187)](this[_0x3b835e(160)] + " " + this[_0x3b835e(170)][_0x3b835e(173)] + _0x3b835e(194) + _0x196bf0[_0x3b835e(225)]), this[_0x3b835e(212)]["add"]({ ...this[_0x3b835e(197)], "error": _0x196bf0 }), this[_0x3b835e(250)]({ "segment": mapSegmentWithStreamToSegment(this[_0x3b835e(170)]), "error": _0x196bf0, "downloadSource": this[_0x3b835e(197)][_0x3b835e(160)], "peerId": this[_0x3b835e(197)]["downloadSource"] === _0x3b835e(164) ? this[_0x3b835e(197)][_0x3b835e(208)] : void 0, "streamType": this["segment"][_0x3b835e(191)][_0x3b835e(225)] }), this["notReceivingBytesTimeout"][_0x3b835e(171)](), this["manageBandwidthCalculatorsState"]("stop"), this[_0x3b835e(241)]();
});
__publicField(this, _N, (_0x591f54) => {
const _0x42c61e = _0x4353bd;
this[_0x42c61e(193)]();
if (!this[_0x42c61e(197)]) return;
this["setStatus"]("failed"), this[_0x42c61e(187)](this["downloadSource"] + " " + this[_0x42c61e(170)][_0x42c61e(173)] + " failed " + _0x591f54[_0x42c61e(225)]), this["_failedAttempts"][_0x42c61e(256)]({ ...this[_0x42c61e(197)], "error": _0x591f54 }), this[_0x42c61e(250)]({ "segment": mapSegmentWithStreamToSegment(this["segment"]), "error": _0x591f54, "downloadSource": this[_0x42c61e(197)]["downloadSource"], "peerId": this[_0x42c61e(197)][_0x42c61e(160)] === _0x42c61e(164) ? this["currentAttempt"][_0x42c61e(208)] : void 0, "streamType": this[_0x42c61e(170)][_0x42c61e(191)][_0x42c61e(225)] }), this["notReceivingBytesTimeout"][_0x42c61e(171)](), this[_0x42c61e(246)](_0x42c61e(204)), this["requestProcessQueueCallback"]();
});
__publicField(this, _M, () => {
const _0xcb9413 = _0x4353bd;
this[_0xcb9413(193)]();
if (!this["currentAttempt"]) return;
this[_0xcb9413(246)](_0xcb9413(204)), this["notReceivingBytesTimeout"][_0xcb9413(171)](), this["setStatus"](_0xcb9413(247)), this["_totalBytes"] = this["_loadedBytes"], this[_0xcb9413(228)]({ "segmentUrl": this["segment"]["url"], "bytesLength": this[_0xcb9413(255)][_0xcb9413(219)], "downloadSource": this[_0xcb9413(197)][_0xcb9413(160)], "peerId": this[_0xcb9413(197)][_0xcb9413(160)] === "p2p" ? this[_0xcb9413(197)]["peerId"] : void 0, "streamType": this[_0xcb9413(170)][_0xcb9413(191)][_0xcb9413(225)] }), this["logger"](this[_0xcb9413(197)][_0xcb9413(160)] + " " + this[_0xcb9413(170)]["externalId"] + _0xcb9413(175)), this["requestProcessQueueCallback"]();
});
__publicField(this, _L, (_0x1aecc6) => {
const _0x5ab22e = _0x4353bd;
this[_0x5ab22e(193)]();
if (!this["currentAttempt"] || !this[_0x5ab22e(236)]) return;
this[_0x5ab22e(188)][_0x5ab22e(231)]();
const { byteLength: _0x439510 } = _0x1aecc6, { all: _0x6ed65b, http: _0x1935bf } = this[_0x5ab22e(229)];
_0x6ed65b[_0x5ab22e(227)](_0x439510), this[_0x5ab22e(197)][_0x5ab22e(160)] === "http" && _0x1935bf[_0x5ab22e(227)](_0x439510), this[_0x5ab22e(195)][_0x5ab22e(166)](_0x1aecc6), this["progress"][_0x5ab22e(181)] = performance[_0x5ab22e(232)](), this["progress"]["loadedBytes"] += _0x439510, this[_0x5ab22e(192)] += _0x439510;
});
__publicField(this, _K, () => {
const _0x308a68 = _0x4353bd;
this[_0x308a68(193)](), this["notReceivingBytesTimeout"][_0x308a68(231)]();
});
const _0x247db7 = _0x1329;
this[_0x247db7(170)] = _0x30b530, this[_0x247db7(241)] = _0x51ab9f, this[_0x247db7(229)] = _0x2664f8, this[_0x247db7(210)] = _0x56e34c, this[_0x247db7(174)] = _0x231ded, this["onSegmentError"] = _0x5600b6[_0x247db7(248)]("onSegmentError"), this[_0x247db7(215)] = _0x5600b6[_0x247db7(248)]("onSegmentAbort"), this["onSegmentStart"] = _0x5600b6[_0x247db7(248)](_0x247db7(189)), this[_0x247db7(228)] = _0x5600b6["getEventDispatcher"]("onSegmentLoaded");
const { byteRange: _0x263997 } = this[_0x247db7(170)];
if (_0x263997) {
const { end: _0x594ce8, start: _0x1bec5f } = _0x263997;
this[_0x247db7(177)] = _0x594ce8 - _0x1bec5f + 1;
}
this[_0x247db7(188)] = new Timeout(this["abortOnTimeout"]);
const { type: _0x2c8f9a } = this[_0x247db7(170)][_0x247db7(191)];
this[_0x247db7(180)] = _0x1bf98d(_0x247db7(249) + _0x2c8f9a);
}
[(_Z = _0x4353bd(212), _Y = _0x4353bd(226), _X = _0x4353bd(192), _W = _0x4353bd(177), _V = _0x4353bd(217), _U = _0x4353bd(188), _T = _0x4353bd(180), _S = _0x4353bd(169), _R = _0x4353bd(250), _Q = _0x4353bd(215), _P = _0x4353bd(189), _O = _0x4353bd(228), _0x4353bd(218))]() {
const _0xb27aeb = _0x4353bd;
this["_loadedBytes"] = 0, this[_0xb27aeb(195)] = [], this[_0xb27aeb(177)] = void 0, this[_0xb27aeb(226)] = void 0;
}
get [_0x4353bd(244)]() {
const _0xc230a6 = _0x4353bd;
return this[_0xc230a6(217)];
}
[_0x4353bd(165)](_0x23f85a) {
const _0x141d66 = _0x4353bd;
this[_0x141d66(217)] = _0x23f85a, this["_isHandledByProcessQueue"] = ![];
}
get [_0x4353bd(160)]() {
var _a2;
const _0xb62db8 = _0x4353bd;
return (_a2 = this[_0xb62db8(197)]) == null ? void 0 : _a2["downloadSource"];
}
get [_0x4353bd(220)]() {
const _0x29f471 = _0x4353bd;
return this[_0x29f471(192)];
}
get ["totalBytes"]() {
const _0x1f072c = _0x4353bd;
return this[_0x1f072c(177)];
}
get [_0x4353bd(255)]() {
const _0x5d249c = _0x4353bd;
if (!this["finalData"]) this[_0x5d249c(226)] = _0x2937c4[_0x5d249c(198)](this["bytes"]);
return this[_0x5d249c(226)];
}
get ["failedAttempts"]() {
const _0x282420 = _0x4353bd;
return this[_0x282420(212)];
}
get [_0x4353bd(233)]() {
const _0x1bd32e = _0x4353bd;
return this[_0x1bd32e(169)];
}
[_0x4353bd(234)]() {
const _0x18f2f0 = _0x4353bd;
this[_0x18f2f0(169)] = !![];
}
[_0x4353bd(206)](_0x49dfae) {
const _0x5df14a = _0x4353bd;
if (this[_0x5df14a(177)] !== void 0) throw new Error(_0x5df14a(182));
this[_0x5df14a(177)] = _0x49dfae;
}
["start"](_0x54b177, _0x2e3d87) {
const _0x3146a1 = _0x4353bd;
if (this[_0x3146a1(217)] === _0x3146a1(247)) throw new Error("Request " + this[_0x3146a1(170)][_0x3146a1(173)] + _0x3146a1(183));
if (this[_0x3146a1(217)] === "loading") throw new Error(_0x3146a1(245) + this[_0x3146a1(170)][_0x3146a1(173)] + _0x3146a1(186));
this[_0x3146a1(165)](_0x3146a1(185)), this[_0x3146a1(197)] = { ..._0x54b177 }, this[_0x3146a1(236)] = { "startFromByte": this["_loadedBytes"], "loadedBytes": 0, "startTimestamp": performance["now"]() }, this[_0x3146a1(246)](_0x3146a1(223));
const { notReceivingBytesTimeoutMs: _0x1c0e5e, abort: _0x2a15c4 } = _0x2e3d87;
return this[_0x3146a1(163)] = _0x2a15c4, _0x1c0e5e !== void 0 && this[_0x3146a1(188)][_0x3146a1(223)](_0x1c0e5e), this[_0x3146a1(187)](_0x54b177[_0x3146a1(160)] + " " + this[_0x3146a1(170)][_0x3146a1(173)] + _0x3146a1(252)), this["onSegmentStart"]({ "segment": mapSegmentWithStreamToSegment(this[_0x3146a1(170)]), "downloadSource": _0x54b177["downloadSource"], "peerId": _0x54b177["downloadSource"] === "p2p" ? _0x54b177[_0x3146a1(208)] : void 0 }), { "firstBytesReceived": this[_0x3146a1(235)], "addLoadedChunk": this["addLoadedChunk"], "completeOnSuccess": this["completeOnSuccess"], "abortOnError": this[_0x3146a1(190)] };
}
[_0x4353bd(162)]() {
var _a2, _b2, _c2, _d2;
const _0x2429c0 = _0x4353bd;
this[_0x2429c0(193)](), this["setStatus"](_0x2429c0(242)), this[_0x2429c0(187)](((_a2 = this[_0x2429c0(197)]) == null ? void 0 : _a2[_0x2429c0(160)]) + " " + this[_0x2429c0(170)]["externalId"] + _0x2429c0(211)), (_b2 = this[_0x2429c0(163)]) == null ? void 0 : _b2.call(this, new RequestError(_0x2429c0(257))), this[_0x2429c0(215)]({ "segment": mapSegmentWithStreamToSegment(this["segment"]), "downloadSource": (_c2 = this[_0x2429c0(197)]) == null ? void 0 : _c2["downloadSource"], "peerId": ((_d2 = this[_0x2429c0(197)]) == null ? void 0 : _d2[_0x2429c0(160)]) === _0x2429c0(164) ? this[_0x2429c0(197)][_0x2429c0(208)] : void 0, "streamType": this[_0x2429c0(170)][_0x2429c0(191)][_0x2429c0(225)] }), this["_abortRequestCallback"] = void 0, this[_0x2429c0(246)](_0x2429c0(204)), this[_0x2429c0(188)][_0x2429c0(171)]();
}
[(_N = _0x4353bd(190), _M = _0x4353bd(243), _L = _0x4353bd(199), _K = _0x4353bd(235), _0x4353bd(193))]() {
const _0x4bbb74 = _0x4353bd;
if (this[_0x4bbb74(217)] !== _0x4bbb74(185)) throw new Error(_0x4bbb74(203) + this[_0x4bbb74(244)] + ".");
}
[_0x4353bd(187)](_0x13db56) {
var _a2;
const _0x17668c = _0x4353bd;
this[_0x17668c(180)][_0x17668c(251)] = ((_a2 = this[_0x17668c(197)]) == null ? void 0 : _a2[_0x17668c(160)]) === "http" ? _0x17668c(230) : _0x17668c(221), this[_0x17668c(180)](_0x13db56), this[_0x17668c(180)][_0x17668c(251)] = "";
}
[_0x4353bd(246)](_0x496d5b) {
var _a2;
const _0xf86915 = _0x4353bd, { all: _0x188f3c, http: _0x46b5b1 } = this[_0xf86915(229)], _0x179b5c = _0x496d5b === "start" ? _0xf86915(159) : "stopLoading";
if (((_a2 = this["currentAttempt"]) == null ? void 0 : _a2[_0xf86915(160)]) === _0xf86915(207)) _0x46b5b1[_0x179b5c]();
_0x188f3c[_0x179b5c]();
}
};
class FailedRequestAttempts {
constructor() {
__publicField(this, __, []);
}
[(__ = _0x4353bd(237), _0x4353bd(256))](_0x22fff6) {
const _0x449962 = _0x4353bd;
this[_0x449962(237)][_0x449962(166)](_0x22fff6);
}
get [_0x4353bd(214)]() {
const _0x462d66 = _0x4353bd;
return this[_0x462d66(237)][_0x462d66(161)]((_0x197e15, _0x17e87e) => _0x17e87e[_0x462d66(160)] === "http" ? _0x197e15 + 1 : _0x197e15, 0);
}
get ["lastAttempt"]() {
const _0x163159 = _0x4353bd;
return this[_0x163159(237)][this[_0x163159(237)]["length"] - 1];
}
[_0x4353bd(171)]() {
this["attempts"] = [];
}
}
class Timeout {
constructor(_0x487c48) {
__publicField(this, _$);
__publicField(this, "ms");
this["action"] = _0x487c48;
}
[(_$ = _0x4353bd(238), _0x4353bd(223))](_0x39aa9d) {
const _0x2294af = _0x4353bd;
if (this["timeoutId"]) throw new Error(_0x2294af(209));
this["ms"] = _0x39aa9d, this[_0x2294af(238)] = window[_0x2294af(253)](this[_0x2294af(239)], this["ms"]);
}
[_0x4353bd(231)](_0x4c7e6a) {
const _0x2d15bd = _0x4353bd;
if (this[_0x2d15bd(238)]) clearTimeout(this["timeoutId"]);
if (_0x4c7e6a) this["ms"] = _0x4c7e6a;
if (!this["ms"]) return;
this["timeoutId"] = window[_0x2d15bd(253)](this[_0x2d15bd(239)], this["ms"]);
}
[_0x4353bd(171)]() {
const _0x34fdc8 = _0x4353bd;
clearTimeout(this[_0x34fdc8(238)]), this["timeoutId"] = void 0;
}
}
const _0x61e051 = _0x35cf;
(function(_0x4104c6, _0x50b934) {
const _0x27be15 = _0x35cf, _0x35ff7c = _0x4104c6();
while (!![]) {
try {
const _0x4cf282 = parseInt(_0x27be15(239)) / 1 * (-parseInt(_0x27be15(243)) / 2) + -parseInt(_0x27be15(254)) / 3 * (-parseInt(_0x27be15(256)) / 4) + parseInt(_0x27be15(244)) / 5 * (-parseInt(_0x27be15(236)) / 6) + parseInt(_0x27be15(250)) / 7 + parseInt(_0x27be15(255)) / 8 + parseInt(_0x27be15(238)) / 9 + -parseInt(_0x27be15(251)) / 10;
if (_0x4cf282 === _0x50b934) break;
else _0x35ff7c["push"](_0x35ff7c["shift"]());
} catch (_0x453d6c) {
_0x35ff7c["push"](_0x35ff7c["shift"]());
}
}
})(_0x337f, 180303);
function _0x35cf(_0x142812, _0x22c7ce) {
const _0x337fd6 = _0x337f();
return _0x35cf = function(_0x35cf49, _0x457ddc) {
_0x35cf49 = _0x35cf49 - 233;
let _0x4315d7 = _0x337fd6[_0x35cf49];
return _0x4315d7;
}, _0x35cf(_0x142812, _0x22c7ce);
}
class RequestsContainer {
constructor(_0x3e959d, _0x12eb4a, _0x1cc830, _0x132878, _0x31e4d6) {
__publicField(this, _aa, /* @__PURE__ */ new Map());
const _0x3aeb5a = _0x35cf;
this["requestProcessQueueCallback"] = _0x3e959d, this["bandwidthCalculators"] = _0x12eb4a, this[_0x3aeb5a(262)] = _0x1cc830, this[_0x3aeb5a(234)] = _0x132878, this[_0x3aeb5a(249)] = _0x31e4d6;
}
get [(_aa = _0x61e051(237), _0x61e051(248))]() {
const _0xad20cc = _0x61e051;
let _0x48fdc7 = 0;
for (const _0x215018 of this[_0xad20cc(246)]()) {
if (_0x215018[_0xad20cc(260)] === _0xad20cc(261)) _0x48fdc7++;
}
return _0x48fdc7;
}
get ["executingP2PCount"]() {
const _0x3e4dd6 = _0x61e051;
let _0x2442b3 = 0;
for (const _0x100915 of this[_0x3e4dd6(245)]()) {
if (_0x100915[_0x3e4dd6(260)] === _0x3e4dd6(261)) _0x2442b3++;
}
return _0x2442b3;
}
["get"](_0x3adc1f) {
return this["requests"]["get"](_0x3adc1f);
}
[_0x61e051(257)](_0x42022f) {
const _0x4bbca4 = _0x61e051;
let _0x25c181 = this[_0x4bbca4(237)]["get"](_0x42022f);
return !_0x25c181 && (_0x25c181 = new Request$1(_0x42022f, this[_0x4bbca4(259)], this[_0x4bbca4(240)], this[_0x4bbca4(262)], this[_0x4bbca4(234)], this[_0x4bbca4(249)]), this[_0x4bbca4(237)]["set"](_0x42022f, _0x25c181)), _0x25c181;
}
[_0x61e051(247)](_0x5f515a) {
const _0x198ec0 = _0x61e051;
this[_0x198ec0(237)][_0x198ec0(242)](_0x5f515a[_0x198ec0(241)]);
}
[_0x61e051(258)]() {
const _0x5d0e2f = _0x61e051;
return this[_0x5d0e2f(237)][_0x5d0e2f(253)]();
}
*["httpRequests"]() {
const _0x5bdc2e = _0x61e051;
for (const _0x28688f of this[_0x5bdc2e(237)][_0x5bdc2e(253)]()) {
if (_0x28688f[_0x5bdc2e(233)] === "http") yield _0x28688f;
}
}
*[_0x61e051(245)]() {
const _0x30fdd0 = _0x61e051;
for (const _0x3eae9a of this[_0x30fdd0(237)][_0x30fdd0(253)]()) {
if (_0x3eae9a["downloadSource"] === _0x30fdd0(252)) yield _0x3eae9a;
}
}
[_0x61e051(235)]() {
const _0x3a51ce = _0x61e051;
for (const _0x5e4bbd of this["requests"]["values"]()) {
if (_0x5e4bbd[_0x3a51ce(260)] !== _0x3a51ce(261)) continue;
_0x5e4bbd["abortFromProcessQueue"]();
}
this[_0x3a51ce(237)]["clear"]();
}
}
function _0x337f() {
const _0x5f7326 = ["698284jOzlrF", "getOrCreateRequest", "items", "requestProcessQueueCallback", "status", "loading", "playback", "downloadSource", "config", "destroy", "19506DonsOC", "requests", "796725YroWrz", "1xmffTW", "bandwidthCalculators", "segment", "delete", "118554JTcSVy", "90iedsMb", "p2pRequests", "httpRequests", "remove", "executingHttpCount", "eventTarget", "607453QkaIjW", "4293770AiHheH", "p2p", "values", "6cwHgLB", "1624232JIBPnN"];
_0x337f = function() {
return _0x5f7326;
};
return _0x337f();
}
function _0x1881() {
var _0x4619db = ["onSuccess", "markAsShouldBeStartedImmediately", "aborted", "_shouldBeStartedImmediately", "reject", "succeed", "3459150oPuJhB", "segment", "6149574rJPhRj", "engineCallbacks", "_status", "530440xzHgNt", "6312594KZNzrO", "failed", "pending", "resolve", "537cakMIF", "2206ocoKuA", "5843789PtUJtl", "8prYWWH", "365878BPpZgp", "status"];
_0x1881 = function() {
return _0x4619db;
};
return _0x1881();
}
function _0x536b(_0x4f0beb, _0x31da83) {
var _0x188192 = _0x1881();
return _0x536b = function(_0x536bb6, _0x1ff2b1) {
_0x536bb6 = _0x536bb6 - 282;
var _0x5e701d = _0x188192[_0x536bb6];
return _0x5e701d;
}, _0x536b(_0x4f0beb, _0x31da83);
}
var _0x33dd6c = _0x536b;
(function(_0x4246fc, _0x3f9c01) {
var _0xc20239 = _0x536b, _0xd4a995 = _0x4246fc();
while (!![]) {
try {
var _0x224f4d = parseInt(_0xc20239(284)) / 1 + -parseInt(_0xc20239(303)) / 2 * (parseInt(_0xc20239(302)) / 3) + parseInt(_0xc20239(297)) / 4 + parseInt(_0xc20239(292)) / 5 + parseInt(_0xc20239(298)) / 6 + -parseInt(_0xc20239(282)) / 7 + -parseInt(_0xc20239(283)) / 8 * (parseInt(_0xc20239(294)) / 9);
if (_0x224f4d === _0x3f9c01) break;
else _0xd4a995["push"](_0xd4a995["shift"]());
} catch (_0x5ca93) {
_0xd4a995["push"](_0xd4a995["shift"]());
}
}
})(_0x1881, 526867);
class EngineRequest {
constructor(_0x214143, _0x502ca6) {
__publicField(this, _ca, _0x33dd6c(300));
__publicField(this, _ba, ![]);
var _0x1e62fb = _0x536b;
this[_0x1e62fb(293)] = _0x214143, this[_0x1e62fb(295)] = _0x502ca6;
}
get [(_ca = _0x33dd6c(296), _ba = _0x33dd6c(289), _0x33dd6c(285))]() {
var _0x2c7453 = _0x33dd6c;
return this[_0x2c7453(296)];
}
get ["shouldBeStartedImmediately"]() {
var _0x124ec5 = _0x33dd6c;
return this[_0x124ec5(289)];
}
[_0x33dd6c(301)](_0x61f994, _0x317944) {
var _0x18155c = _0x33dd6c;
if (this["_status"] !== "pending") return;
this[_0x18155c(296)] = _0x18155c(291), this[_0x18155c(295)][_0x18155c(286)]({ "data": _0x61f994, "bandwidth": _0x317944 });
}
[_0x33dd6c(290)]() {
var _0x53b2dc = _0x33dd6c;
if (this["_status"] !== "pending") return;
this[_0x53b2dc(296)] = _0x53b2dc(299), this["engineCallbacks"]["onError"](new CoreRequestError("failed"));
}
["abort"]() {
var _0x46d5fb = _0x33dd6c;
if (this[_0x46d5fb(296)] !== "pending") return;
this["_status"] = _0x46d5fb(288), this[_0x46d5fb(295)]["onError"](new CoreRequestError("aborted"));
}
[_0x33dd6c(287)]() {
var _0x51571e = _0x33dd6c;
this[_0x51571e(289)] = !![];
}
}
(function(_0x1862c6, _0x2d9b3f) {
const _0x350b9a = _0x2b0c, _0x47e4bb = _0x1862c6();
while (!![]) {
try {
const _0x376545 = -parseInt(_0x350b9a(302)) / 1 * (parseInt(_0x350b9a(310)) / 2) + -parseInt(_0x350b9a(309)) / 3 * (parseInt(_0x350b9a(307)) / 4) + parseInt(_0x350b9a(317)) / 5 + parseInt(_0x350b9a(306)) / 6 + -parseInt(_0x350b9a(303)) / 7 + -parseInt(_0x350b9a(311)) / 8 + parseInt(_0x350b9a(305)) / 9 * (parseInt(_0x350b9a(312)) / 10);
if (_0x376545 === _0x2d9b3f) break;
else _0x47e4bb["push"](_0x47e4bb["shift"]());
} catch (_0x2e8a8f) {
_0x47e4bb["push"](_0x47e4bb["shift"]());
}
}
})(_0x208d, 366992);
function _0x2b0c(_0xf76cc8, _0x1c286d) {
const _0x208d42 = _0x208d();
return _0x2b0c = function(_0x2b0cf8, _0x3aa298) {
_0x2b0cf8 = _0x2b0cf8 - 301;
let _0xdf273 = _0x208d42[_0x2b0cf8];
return _0xdf273;
}, _0x2b0c(_0xf76cc8, _0x1c286d);
}
function* generateQueue(_0x32cca9, _0x44bf20, _0x56cee9, _0xe6fc7e, _0x655482) {
const _0x9299fd = _0x2b0c, { runtimeId: _0x18d586, stream: _0x3ab0cb } = _0x32cca9, _0x46b8bf = _0x3ab0cb[_0x9299fd(304)][_0x9299fd(301)](_0x18d586);
if (!_0x46b8bf) return;
const _0x44ddfc = _0x3ab0cb[_0x9299fd(304)][_0x9299fd(308)]();
let _0x5f2141;
do {
const _0x327744 = _0x44ddfc[_0x9299fd(316)]();
if (_0x327744[_0x9299fd(314)]) return;
_0x5f2141 = _0x327744[_0x9299fd(313)];
} while (_0x5f2141 !== _0x46b8bf);
const _0x3785ed = getSegmentPlaybackStatuses(_0x5f2141, _0x44bf20, _0x56cee9, _0xe6fc7e, _0x655482);
if (isNotActualStatuses(_0x3785ed)) {
const _0x4f519f = _0x44ddfc[_0x9299fd(316)]();
if (_0x4f519f[_0x9299fd(314)]) return;
const _0x170256 = _0x4f519f[_0x9299fd(313)], _0x3a3615 = getSegmentPlaybackStatuses(_0x170256, _0x44bf20, _0x56cee9, _0xe6fc7e, _0x655482);
if (isNotActualStatuses(_0x3a3615)) return;
_0x3785ed[_0x9299fd(315)] = !![], yield { "segment": _0x5f2141, "statuses": _0x3785ed }, yield { "segment": _0x170256, "statuses": _0x3a3615 };
} else yield { "segment": _0x5f2141, "statuses": _0x3785ed };
for (const _0x50c710 of _0x44ddfc) {
const _0x5249d9 = getSegmentPlaybackStatuses(_0x50c710, _0x44bf20, _0x56cee9, _0xe6fc7e, _0x655482);
if (isNotActualStatuses(_0x5249d9)) break;
yield { "segment": _0x50c710, "statuses": _0x5249d9 };
}
}
function isNotActualStatuses(_0x219cf6) {
const { isHighDemand = ![], isHttpDownloadable = ![], isP2PDownloadable = ![] } = _0x219cf6;
return !isHighDemand && !isHttpDownloadable && !isP2PDownloadable;
}
function _0x208d() {
const _0x174300 = ["619334LjsUiV", "2622688uXnlgq", "49990fYvcyc", "value", "done", "isHighDemand", "next", "2933925wqqlWl", "get", "1MGPoGV", "4071711Dvxgxy", "segments", "1566rzQFtn", "3918552Pltrog", "4pirdtY", "values", "1570605DGQyYS"];
_0x208d = function() {
return _0x174300;
};
return _0x208d();
}
const _0x1184eb = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
generateQueue
}, Symbol.toStringTag, { value: "Module" }));
const _0x66ca66 = _0x4ef6;
(function(_0x5efbf6, _0xf7675a) {
const _0x254556 = _0x4ef6, _0x5b161d = _0x5efbf6();
while (!![]) {
try {
const _0x4bedd5 = -parseInt(_0x254556(268)) / 1 * (parseInt(_0x254556(276)) / 2) + -parseInt(_0x254556(290)) / 3 * (parseInt(_0x254556(271)) / 4) + -parseInt(_0x254556(250)) / 5 * (-parseInt(_0x254556(237)) / 6) + -parseInt(_0x254556(291)) / 7 + parseInt(_0x254556(212)) / 8 + -parseInt(_0x254556(264)) / 9 * (-parseInt(_0x254556(193)) / 10) + parseInt(_0x254556(174)) / 11;
if (_0x4bedd5 === _0xf7675a) break;
else _0x5b161d["push"](_0x5b161d["shift"]());
} catch (_0x519d40) {
_0x5b161d["push"](_0x5b161d["shift"]());
}
}
})(_0x4d8a, 341008);
function _0x4d8a() {
const _0x51b4d5 = ["update stream: ", "storageCleanUpIntervalId", "getOrCreateRequest", "requests", "1060857YsRaqQ", "2375548RUPRkB", "loadRandomThroughHttp", "8066047VNavfX", "abortSegmentRequest", "length", "remove", "max", "loading", "p2pLoaders", "clear", "activeLevelBitrate", "generateQueue", "playback", "httpErrorRetries", "random", "failed", "endTime", "stream changed to ", "startTime", "lastRequestedSegment", "segment", "80ukcEIj", "rate", "updatePlayback", "reject", "status", "hasSegment", "httpAttemptsCount", "downloadSegment", "shuffleArray", "lastQueueProcessingTimeStamp", "connectedPeerCount", "updateStream", "isLive", "getUsage", "randomHttpDownloadInterval", "destroy", "p2pml-core:hybrid-loader-", "loadThroughP2P", "downloadSource", "2518768BpQmUf", "currentLoader", "abortLastP2PLoadingInQueueAfterItem", "min", "timestamp", "position significantly changed", "onSegmentRequested", "failedAttempts", "position", "isP2PDownloadable", "segments", "resolve", "eventTarget", "getAvailableStorageCapacityPercent", "bandwidthCalculators", "getBandwidth", "not-started", "levelChangedTimestamp", "setTimeout", "broadcastAnnouncement", "engineRequest", "p2p", "abortFromProcessQueue", "config", "getSegmentData", "8598UeRnll", "getSegmentAvgDuration", "coral", "pending", "executingP2PCount", "segmentStorage", "error", "notifyLevelChanged", "isProcessQueueMicrotaskCreated", "changeCurrentLoader", "getBandwidthLoadingOnly", "abortLastHttpLoadingInQueueAfterItem", "markHandledByProcessQueue", "1615AvJVoZ", "streamDetails", "arrayBackwards", "push", "swarmId", "http", "segmentAvgDuration", "stream", "streamManifestUrl", "abort", "requests: ", "logger", "storeSegment", "runtimeId", "14814aasiDg", "processQueue", "setIntervalLoading", "requestProcessQueueMicrotask", "1oqngdz", "get", "processRequests", "4ukbBKX", "sendBroadcastAnnouncement", "type", "executingHttpCount", "succeed", "980318VtqqFu", "abs", "now", "externalId", "isSegmentLoadedBySomeone", "from", "loadThroughHttp", "add", "getStreamSwarmId", "getSegmentString"];
_0x4d8a = function() {
return _0x51b4d5;
};
return _0x4d8a();
}
function _0x4ef6(_0x4f601a, _0x47898f) {
const _0x4d8af6 = _0x4d8a();
return _0x4ef6 = function(_0x4ef67a, _0x290137) {
_0x4ef67a = _0x4ef67a - 174;
let _0x1e9f94 = _0x4d8af6[_0x4ef67a];
return _0x1e9f94;
}, _0x4ef6(_0x4f601a, _0x47898f);
}
const FAILED_ATTEMPTS_CLEAR_INTERVAL = 6e4, PEER_UPDATE_LATENCY = 1e3;
class HybridLoader {
constructor(_0xd95c91, _0x17b754, _0xba6d5, _0x332d96, _0x1ddb04, _0x4651a1, _0x95d38b) {
__publicField(this, _ka);
__publicField(this, _ja);
__publicField(this, "p2pLoaders");
__publicField(this, "playback");
__publicField(this, _ia);
__publicField(this, _ha);
__publicField(this, _ga);
__publicField(this, "levelChangedTimestamp");
__publicField(this, _fa);
__publicField(this, "randomHttpDownloadInterval");
__publicField(this, _ea, ![]);
__publicField(this, _da, (_0x2453f1 = !![]) => {
const _0x5beebc = _0x66ca66, _0x2e4032 = performance["now"]();
if (!_0x2453f1 && this[_0x5beebc(202)] !== void 0 && _0x2e4032 - this[_0x5beebc(202)] <= 1e3 || this[_0x5beebc(245)]) return;
this[_0x5beebc(245)] = !![], queueMicrotask(() => {
const _0x2d99c1 = _0x5beebc;
try {
this[_0x2d99c1(265)](), this[_0x2d99c1(202)] = _0x2e4032;
} finally {
this[_0x2d99c1(245)] = ![];
}
});
});
const _0x1383f2 = _0x4ef6;
this["streamManifestUrl"] = _0xd95c91, this[_0x1383f2(191)] = _0x17b754, this[_0x1383f2(251)] = _0xba6d5, this["config"] = _0x332d96, this[_0x1383f2(226)] = _0x1ddb04, this["segmentStorage"] = _0x4651a1, this["eventTarget"] = _0x95d38b;
const _0x308c05 = this[_0x1383f2(191)][_0x1383f2(257)];
this[_0x1383f2(184)] = { "position": this[_0x1383f2(191)]["startTime"], "rate": 1 }, this[_0x1383f2(256)] = _0x37c065[_0x1383f2(238)](_0x308c05), this[_0x1383f2(289)] = new RequestsContainer(this[_0x1383f2(267)], this[_0x1383f2(226)], this[_0x1383f2(184)], this[_0x1383f2(235)], this[_0x1383f2(224)]), this[_0x1383f2(180)] = new P2PLoadersContainer(this[_0x1383f2(258)], this["lastRequestedSegment"][_0x1383f2(257)], this[_0x1383f2(289)], this[_0x1383f2(242)], this[_0x1383f2(235)], this[_0x1383f2(224)], this[_0x1383f2(267)]), this[_0x1383f2(261)] = _0x1bf98d(_0x1383f2(209) + _0x308c05[_0x1383f2(273)]), this[_0x1383f2(261)]["color"] = _0x1383f2(239), this[_0x1383f2(266)]();
}
[(_ka = _0x66ca66(289), _ja = _0x66ca66(232), _ia = _0x66ca66(256), _ha = _0x66ca66(261), _ga = _0x66ca66(287), _fa = _0x66ca66(202), _ea = _0x66ca66(245), _0x66ca66(266))]() {
const _0x401e4d = _0x66ca66, _0x44f419 = this[_0x401e4d(180)][_0x401e4d(213)][_0x401e4d(203)], _0xc039d8 = Math[_0x401e4d(186)]() * PEER_UPDATE_LATENCY * _0x44f419 + PEER_UPDATE_LATENCY;
this["randomHttpDownloadInterval"] = window[_0x401e4d(230)](() => {
const _0x255cf4 = _0x401e4d;
this[_0x255cf4(292)](), this[_0x255cf4(266)]();
}, _0xc039d8);
}
async ["loadSegment"](_0x36d2c3, _0x5eae94) {
var _a2;
const _0x2dbd9a = _0x66ca66;
this[_0x2dbd9a(261)](_0x2dbd9a(260) + _0x4b750[_0x2dbd9a(285)](_0x36d2c3));
const { stream: _0x9493a7 } = _0x36d2c3;
_0x9493a7 !== this["lastRequestedSegment"][_0x2dbd9a(257)] && (this[_0x2dbd9a(261)](_0x2dbd9a(189) + getStreamString(_0x9493a7)), this["p2pLoaders"][_0x2dbd9a(246)](_0x9493a7));
this[_0x2dbd9a(191)] = _0x36d2c3;
const _0x542993 = this[_0x2dbd9a(235)][_0x2dbd9a(254)] ?? this[_0x2dbd9a(258)], _0x313748 = getStreamSwarmId(_0x542993, _0x9493a7);
this["segmentStorage"][_0x2dbd9a(218)](_0x542993, _0x313748, _0x36d2c3[_0x2dbd9a(279)], _0x36d2c3[_0x2dbd9a(190)], _0x36d2c3[_0x2dbd9a(188)], _0x9493a7[_0x2dbd9a(273)], this[_0x2dbd9a(251)]["isLive"]);
const _0x4319e5 = new EngineRequest(_0x36d2c3, _0x5eae94);
try {
const _0x44df2e = this["segmentStorage"][_0x2dbd9a(198)](_0x542993, _0x313748, _0x36d2c3[_0x2dbd9a(279)]);
if (_0x44df2e) {
const _0x3ca65e = await this[_0x2dbd9a(242)][_0x2dbd9a(236)](_0x542993, _0x313748, _0x36d2c3[_0x2dbd9a(279)]);
if (_0x3ca65e) {
const { queueDownloadRatio: _0x3ba139 } = this[_0x2dbd9a(183)]();
_0x4319e5["resolve"](_0x3ca65e, this[_0x2dbd9a(227)](_0x3ba139));
return;
}
}
(_a2 = this[_0x2dbd9a(232)]) == null ? void 0 : _a2[_0x2dbd9a(259)](), this[_0x2dbd9a(232)] = _0x4319e5;
} catch {
_0x4319e5[_0x2dbd9a(196)]();
} finally {
this[_0x2dbd9a(267)]();
}
}
[(_da = _0x66ca66(267), _0x66ca66(270))](_0x8b0a11, _0x3761e2) {
var _a2;
const _0x30d78a = _0x66ca66, { stream: _0x4cf21a } = this["lastRequestedSegment"], { httpErrorRetries: _0x39bd08 } = this["config"], _0xefef06 = performance[_0x30d78a(278)]();
for (const _0x253629 of this["requests"]["items"]()) {
const { downloadSource: _0x5d371d, status: _0x277077, segment: _0x41a6a6, isHandledByProcessQueue: _0x10897f } = _0x253629, _0x26c634 = ((_a2 = this["engineRequest"]) == null ? void 0 : _a2["segment"]) === _0x41a6a6 ? this[_0x30d78a(232)] : void 0;
switch (_0x277077) {
case _0x30d78a(179):
!_0x8b0a11["has"](_0x41a6a6[_0x30d78a(263)]) && !_0x26c634 && (_0x253629[_0x30d78a(234)](), this[_0x30d78a(289)]["remove"](_0x253629));
break;
case _0x30d78a(275): {
if (!_0x5d371d) break;
_0x5d371d === _0x30d78a(255) && this["p2pLoaders"][_0x30d78a(213)]["broadcastAnnouncement"]();
_0x26c634 && (_0x26c634[_0x30d78a(223)](_0x253629["data"], this[_0x30d78a(227)](_0x3761e2)), this[_0x30d78a(232)] = void 0);
this[_0x30d78a(289)][_0x30d78a(177)](_0x253629);
const _0x2ad608 = this[_0x30d78a(235)][_0x30d78a(254)] ?? this[_0x30d78a(258)], _0x2367f1 = getStreamSwarmId(_0x2ad608, _0x4cf21a);
void this[_0x30d78a(242)][_0x30d78a(262)](_0x2ad608, _0x2367f1, _0x41a6a6["externalId"], _0x253629["data"], _0x41a6a6["startTime"], _0x41a6a6["endTime"], _0x41a6a6[_0x30d78a(257)][_0x30d78a(273)], this["streamDetails"][_0x30d78a(205)]);
break;
}
case _0x30d78a(187):
_0x5d371d === "http" && !_0x10897f && this[_0x30d78a(180)][_0x30d78a(213)][_0x30d78a(231)]();
!_0x26c634 && !_0x4cf21a[_0x30d78a(222)]["has"](_0x253629[_0x30d78a(192)][_0x30d78a(263)]) && this[_0x30d78a(289)][_0x30d78a(177)](_0x253629);
_0x253629[_0x30d78a(219)][_0x30d78a(199)] >= _0x39bd08 && _0x26c634 && (this[_0x30d78a(232)] = void 0, _0x26c634["reject"]());
break;
case "not-started":
this[_0x30d78a(289)][_0x30d78a(177)](_0x253629);
break;
case "aborted":
this[_0x30d78a(289)][_0x30d78a(177)](_0x253629);
break;
}
_0x253629[_0x30d78a(249)]();
const { lastAttempt: _0x184316 } = _0x253629["failedAttempts"];
_0x184316 && _0xefef06 - _0x184316[_0x30d78a(243)][_0x30d78a(216)] > FAILED_ATTEMPTS_CLEAR_INTERVAL && _0x253629[_0x30d78a(219)][_0x30d78a(181)]();
}
}
[_0x66ca66(265)]() {
var _a2;
const _0x2eeb34 = _0x66ca66, { queue: _0x27a7aa, queueSegmentIds: _0x99adef, queueDownloadRatio: _0x1d4521 } = this[_0x2eeb34(183)]();
this[_0x2eeb34(270)](_0x99adef, _0x1d4521);
const { simultaneousHttpDownloads: _0x3bb3f7, simultaneousP2PDownloads: _0x2b269a, httpErrorRetries: _0x1113d7 } = this["config"];
if (((_a2 = this[_0x2eeb34(232)]) == null ? void 0 : _a2["shouldBeStartedImmediately"]) && this[_0x2eeb34(232)][_0x2eeb34(197)] === _0x2eeb34(240) && this[_0x2eeb34(289)][_0x2eeb34(274)] < _0x3bb3f7) {
const { segment: _0x1c553b } = this[_0x2eeb34(232)], _0x2bb7e7 = this["requests"]["get"](_0x1c553b);
(!_0x2bb7e7 || _0x2bb7e7[_0x2eeb34(197)] === _0x2eeb34(228) || _0x2bb7e7[_0x2eeb34(197)] === _0x2eeb34(187) && _0x2bb7e7[_0x2eeb34(219)][_0x2eeb34(199)] < this[_0x2eeb34(235)][_0x2eeb34(185)]) && this[_0x2eeb34(282)](_0x1c553b);
}
for (const _0xbc8f87 of _0x27a7aa) {
const { statuses: _0x498dc9, segment: _0x34455b } = _0xbc8f87, _0x6e2e0a = this[_0x2eeb34(289)][_0x2eeb34(269)](_0x34455b);
if (_0x498dc9["isHighDemand"]) {
if ((_0x6e2e0a == null ? void 0 : _0x6e2e0a[_0x2eeb34(211)]) === _0x2eeb34(255) && _0x6e2e0a[_0x2eeb34(197)] === "loading") continue;
if ((_0x6e2e0a == null ? void 0 : _0x6e2e0a[_0x2eeb34(211)]) === _0x2eeb34(255) && _0x6e2e0a["status"] === _0x2eeb34(187) && _0x6e2e0a[_0x2eeb34(219)]["httpAttemptsCount"] >= _0x1113d7) continue;
const _0x4ab83d = (_0x6e2e0a == null ? void 0 : _0x6e2e0a[_0x2eeb34(197)]) === _0x2eeb34(179) && _0x6e2e0a["downloadSource"] === _0x2eeb34(233);
if (this[_0x2eeb34(289)][_0x2eeb34(274)] < _0x3bb3f7) {
if (_0x4ab83d) _0x6e2e0a[_0x2eeb34(234)]();
this[_0x2eeb34(282)](_0x34455b);
continue;
}
if (this["abortLastHttpLoadingInQueueAfterItem"](_0x27a7aa, _0x34455b) && this["requests"]["executingHttpCount"] < _0x3bb3f7) {
if (_0x4ab83d) _0x6e2e0a[_0x2eeb34(234)]();
this[_0x2eeb34(282)](_0x34455b);
continue;
}
if (_0x4ab83d) continue;
if (this[_0x2eeb34(289)]["executingP2PCount"] < _0x2b269a) {
this[_0x2eeb34(210)](_0x34455b);
continue;
}
if (this[_0x2eeb34(214)](_0x27a7aa, _0x34455b) && this["requests"][_0x2eeb34(241)] < _0x2b269a) {
this[_0x2eeb34(210)](_0x34455b);
continue;
}
} else {
if (_0x498dc9[_0x2eeb34(221)]) {
if ((_0x6e2e0a == null ? void 0 : _0x6e2e0a["status"]) === "loading") continue;
if (this["requests"][_0x2eeb34(241)] < _0x2b269a) this[_0x2eeb34(210)](_0x34455b);
else this[_0x2eeb34(180)][_0x2eeb34(213)][_0x2eeb34(280)](_0x34455b) && (this[_0x2eeb34(214)](_0x27a7aa, _0x34455b) && this["requests"]["executingP2PCount"] < _0x2b269a && this["loadThroughP2P"](_0x34455b));
}
}
}
}
[_0x66ca66(175)](_0x84a38f) {
var _a2;
const _0x1261c7 = _0x66ca66;
if (((_a2 = this[_0x1261c7(232)]) == null ? void 0 : _a2["segment"][_0x1261c7(263)]) !== _0x84a38f) return;
this[_0x1261c7(232)][_0x1261c7(259)](), this[_0x1261c7(261)]("abort: ", _0x4b750[_0x1261c7(285)](this["engineRequest"][_0x1261c7(192)])), this["engineRequest"] = void 0, this[_0x1261c7(267)]();
}
["loadThroughHttp"](_0x424521) {
const _0x3c3b5a = _0x66ca66, _0xcc2e05 = this[_0x3c3b5a(289)][_0x3c3b5a(288)](_0x424521);
new HttpRequestExecutor(_0xcc2e05, this[_0x3c3b5a(235)], this[_0x3c3b5a(224)]), this[_0x3c3b5a(180)][_0x3c3b5a(213)][_0x3c3b5a(231)]();
}
[_0x66ca66(210)](_0x48e398) {
const _0x23fe76 = _0x66ca66;
this[_0x23fe76(180)][_0x23fe76(213)][_0x23fe76(200)](_0x48e398);
}
[_0x66ca66(292)]() {
const _0x22a6cb = _0x66ca66, _0x1c5288 = this[_0x22a6cb(225)]();
if (_0x1c5288 <= 10) return;
const { simultaneousHttpDownloads: _0x10dd94, httpErrorRetries: _0x2a4991 } = this[_0x22a6cb(235)], _0x263b37 = this["p2pLoaders"]["currentLoader"];
if (this[_0x22a6cb(289)]["executingHttpCount"] >= _0x10dd94 || !_0x263b37[_0x22a6cb(203)]) return;
const _0x4d3f5e = [];
for (const { segment: _0x1bf69f, statuses: _0x4805a5 } of _0x1184eb[_0x22a6cb(183)](this[_0x22a6cb(191)], this[_0x22a6cb(184)], this["config"], this[_0x22a6cb(180)][_0x22a6cb(213)], _0x1c5288)) {
const _0x5b5021 = this["config"][_0x22a6cb(254)] ?? this["streamManifestUrl"], _0x34e3c9 = _0x37c065[_0x22a6cb(284)](_0x5b5021, _0x1bf69f["stream"]);
if (!_0x4805a5["isHttpDownloadable"] || _0x4805a5[_0x22a6cb(221)] || this[_0x22a6cb(242)][_0x22a6cb(198)](_0x5b5021, _0x34e3c9, _0x1bf69f[_0x22a6cb(279)])) continue;
const _0x50508e = this[_0x22a6cb(289)][_0x22a6cb(269)](_0x1bf69f);
if (_0x50508e && (_0x50508e[_0x22a6cb(197)] === "loading" || _0x50508e[_0x22a6cb(197)] === _0x22a6cb(275) || _0x50508e[_0x22a6cb(219)][_0x22a6cb(199)] >= _0x2a4991)) continue;
_0x4d3f5e[_0x22a6cb(253)](_0x1bf69f);
}
if (!_0x4d3f5e[_0x22a6cb(176)]) return;
const _0x10eab6 = _0x10dd94 - this["requests"][_0x22a6cb(274)];
if (_0x10eab6 === 0) return;
const _0x2b5e5e = _0x263b37["connectedPeerCount"] + 1, _0x2c270e = Math[_0x22a6cb(215)](_0x4d3f5e[_0x22a6cb(176)], _0x10dd94 * _0x2b5e5e), _0x59e09f = _0x2937c4[_0x22a6cb(201)](Array[_0x22a6cb(281)]({ "length": _0x2c270e }, (_0x4d5ad9, _0x374e27) => _0x374e27));
let _0x5ed074 = _0x2c270e / _0x2b5e5e;
for (const _0x2c3e8d of _0x59e09f) {
if (this[_0x22a6cb(289)]["executingHttpCount"] >= _0x10dd94) break;
if (_0x5ed074 >= 1 || Math[_0x22a6cb(186)]() <= _0x5ed074) {
const _0x253151 = _0x4d3f5e[_0x2c3e8d];
this[_0x22a6cb(282)](_0x253151);
}
_0x5ed074--;
if (_0x5ed074 <= 0) break;
}
}
[_0x66ca66(248)](_0x35db4a, _0x461577) {
const _0x356f2d = _0x66ca66;
for (const { segment: _0x3c300a } of arrayBackwards(_0x35db4a)) {
if (_0x3c300a === _0x461577) break;
const _0x3c1d54 = this[_0x356f2d(289)][_0x356f2d(269)](_0x3c300a);
if ((_0x3c1d54 == null ? void 0 : _0x3c1d54[_0x356f2d(211)]) === _0x356f2d(255) && _0x3c1d54[_0x356f2d(197)] === _0x356f2d(179)) return _0x3c1d54[_0x356f2d(234)](), !![];
}
return ![];
}
[_0x66ca66(214)](_0x2beb00, _0xbc8d3e) {
const _0x525ad4 = _0x66ca66;
for (const { segment: _0xf5d5e1 } of _0x2937c4[_0x525ad4(252)](_0x2beb00)) {
if (_0xf5d5e1 === _0xbc8d3e) break;
const _0xe5ef64 = this["requests"][_0x525ad4(269)](_0xf5d5e1);
if ((_0xe5ef64 == null ? void 0 : _0xe5ef64[_0x525ad4(211)]) === "p2p" && _0xe5ef64[_0x525ad4(197)] === _0x525ad4(179)) return _0xe5ef64[_0x525ad4(234)](), !![];
}
return ![];
}
[_0x66ca66(225)]() {
const _0x137ab3 = _0x66ca66, { totalCapacity: _0x103772, usedCapacity: _0x13fb00 } = this[_0x137ab3(242)][_0x137ab3(206)]();
return 100 - _0x13fb00 / _0x103772 * 100;
}
[_0x66ca66(183)]() {
var _a2;
const _0x361d34 = _0x66ca66, _0x3869b1 = [], _0x9d4c76 = /* @__PURE__ */ new Set();
let _0x2ac065 = 0, _0x56d7a6 = 0;
const _0x48e4c6 = this[_0x361d34(225)]();
for (const _0x1b9ddd of _0x1184eb[_0x361d34(183)](this[_0x361d34(191)], this[_0x361d34(184)], this[_0x361d34(235)], this["p2pLoaders"][_0x361d34(213)], _0x48e4c6)) {
_0x2ac065++;
const { segment: _0x37e359 } = _0x1b9ddd, _0x813985 = this["config"][_0x361d34(254)] ?? this[_0x361d34(258)], _0x488131 = getStreamSwarmId(_0x813985, _0x37e359["stream"]);
if (this[_0x361d34(242)][_0x361d34(198)](_0x813985, _0x488131, _0x37e359[_0x361d34(279)]) || ((_a2 = this[_0x361d34(289)][_0x361d34(269)](_0x37e359)) == null ? void 0 : _a2[_0x361d34(197)]) === "succeed") {
_0x56d7a6++;
continue;
}
_0x3869b1["push"](_0x1b9ddd), _0x9d4c76[_0x361d34(283)](_0x37e359[_0x361d34(263)]);
}
return { "queue": _0x3869b1, "queueSegmentIds": _0x9d4c76, "maxPossibleLength": _0x2ac065, "alreadyLoadedCount": _0x56d7a6, "queueDownloadRatio": _0x2ac065 !== 0 ? _0x56d7a6 / _0x2ac065 : 0 };
}
["getBandwidth"](_0x201ced) {
const _0x3776c5 = _0x66ca66, { http: _0x3ec8b4, all: _0x21a49e } = this[_0x3776c5(226)], { activeLevelBitrate: _0x5d3cf5 } = this["streamDetails"];
if (this[_0x3776c5(251)][_0x3776c5(182)] === 0) return _0x21a49e[_0x3776c5(247)](3);
const _0x3576c2 = Math[_0x3776c5(178)](_0x21a49e[_0x3776c5(227)](30, this[_0x3776c5(229)]), _0x21a49e[_0x3776c5(227)](60, this[_0x3776c5(229)]), _0x21a49e["getBandwidth"](90, this[_0x3776c5(229)]));
if (_0x201ced >= 0.8 || _0x3576c2 >= _0x5d3cf5 * 0.9) return Math[_0x3776c5(178)](_0x21a49e["getBandwidthLoadingOnly"](1), _0x21a49e[_0x3776c5(247)](3), _0x21a49e[_0x3776c5(247)](5));
const _0x33053f = Math[_0x3776c5(178)](_0x3ec8b4[_0x3776c5(247)](1), _0x3ec8b4[_0x3776c5(247)](3), _0x3ec8b4[_0x3776c5(247)](5));
return Math[_0x3776c5(178)](_0x3576c2, _0x33053f);
}
[_0x66ca66(244)]() {
const _0x380dbe = _0x66ca66;
this[_0x380dbe(229)] = performance[_0x380dbe(278)]();
}
[_0x66ca66(272)](_0x11d537 = ![]) {
const _0x43dce6 = _0x66ca66;
this[_0x43dce6(180)][_0x43dce6(213)][_0x43dce6(231)](_0x11d537);
}
[_0x66ca66(195)](_0x3b399b, _0x14f83a) {
var _a2;
const _0x4a9b1b = _0x66ca66, _0x2bdcac = this["playback"][_0x4a9b1b(194)] !== _0x14f83a, _0x55585a = this["playback"][_0x4a9b1b(220)] !== _0x3b399b;
if (!_0x2bdcac && !_0x55585a) return;
const _0x59ee49 = Math[_0x4a9b1b(277)](_0x3b399b - this[_0x4a9b1b(184)][_0x4a9b1b(220)]) / this["segmentAvgDuration"] > 0.5;
if (_0x55585a) this[_0x4a9b1b(184)][_0x4a9b1b(220)] = _0x3b399b;
if (_0x2bdcac && _0x14f83a !== 0) this[_0x4a9b1b(184)]["rate"] = _0x14f83a;
_0x59ee49 && (this[_0x4a9b1b(261)](_0x4a9b1b(217)), (_a2 = this[_0x4a9b1b(232)]) == null ? void 0 : _a2["markAsShouldBeStartedImmediately"]()), this[_0x4a9b1b(242)]["onPlaybackUpdated"](_0x3b399b, _0x14f83a), this["requestProcessQueueMicrotask"](_0x59ee49);
}
[_0x66ca66(204)](_0x32aec7) {
const _0x31e56e = _0x66ca66;
if (_0x32aec7 !== this[_0x31e56e(191)][_0x31e56e(257)]) return;
this[_0x31e56e(261)](_0x31e56e(286) + getStreamString(_0x32aec7)), this["requestProcessQueueMicrotask"]();
}
["destroy"]() {
var _a2;
const _0xfa665a = _0x66ca66;
clearInterval(this[_0xfa665a(287)]), clearInterval(this[_0xfa665a(207)]), this["storageCleanUpIntervalId"] = void 0, (_a2 = this["engineRequest"]) == null ? void 0 : _a2["abort"](), this[_0xfa665a(289)]["destroy"](), this[_0xfa665a(180)][_0xfa665a(208)]();
}
}
const _0x12b707 = _0x125e;
(function(_0x33071a, _0x465394) {
const _0x1bbc74 = _0x125e, _0x5b07db = _0x33071a();
while (!![]) {
try {
const _0x47f786 = -parseInt(_0x1bbc74(198)) / 1 + parseInt(_0x1bbc74(180)) / 2 * (-parseInt(_0x1bbc74(176)) / 3) + parseInt(_0x1bbc74(179)) / 4 * (parseInt(_0x1bbc74(181)) / 5) + -parseInt(_0x1bbc74(185)) / 6 + -parseInt(_0x1bbc74(175)) / 7 * (-parseInt(_0x1bbc74(190)) / 8) + parseInt(_0x1bbc74(186)) / 9 * (-parseInt(_0x1bbc74(201)) / 10) + -parseInt(_0x1bbc74(202)) / 11 * (-parseInt(_0x1bbc74(178)) / 12);
if (_0x47f786 === _0x465394) break;
else _0x5b07db["push"](_0x5b07db["shift"]());
} catch (_0x202861) {
_0x5b07db["push"](_0x5b07db["shift"]());
}
}
})(_0x57ba, 758871);
function _0x125e(_0x2a357a, _0x58400f) {
const _0x57ba19 = _0x57ba();
return _0x125e = function(_0x125e4d, _0x108f23) {
_0x125e4d = _0x125e4d - 175;
let _0x5f4f3b = _0x57ba19[_0x125e4d];
return _0x5f4f3b;
}, _0x125e(_0x2a357a, _0x58400f);
}
function _0x57ba() {
const _0x4bc35e = ["1386936oiviYA", "bytes", "length", "9950190NMWKJM", "11HbcHDJ", "9959292IVoAAI", "3twBkLo", "splice", "15394836ijlGRd", "2008cAEDqN", "972082xVBPHN", "13615lySxKN", "timestamps", "push", "addBytes", "2674428SZtDaH", "9qfaOHX", "noLoadingsTime", "loadingsStoppedAt", "loadingOnlyTimestamps", "8xyJYAh", "getBandwidthLoadingOnly", "clearThresholdMs", "loadingsCount", "stopLoading", "clearStale", "NEGATIVE_INFINITY", "startLoading"];
_0x57ba = function() {
return _0x4bc35e;
};
return _0x57ba();
}
class BandwidthCalculator {
constructor(_0x4ebdda = 2e4) {
__publicField(this, _oa, 0);
__publicField(this, _na, []);
__publicField(this, "loadingOnlyTimestamps", []);
__publicField(this, "timestamps", []);
__publicField(this, _ma, 0);
__publicField(this, _la, 0);
const _0x45e9c4 = _0x125e;
this[_0x45e9c4(192)] = _0x4ebdda;
}
[(_oa = _0x12b707(193), _na = _0x12b707(199), _ma = _0x12b707(187), _la = _0x12b707(188), _0x12b707(184))](_0x5f2541, _0x192c15 = performance["now"]()) {
const _0x1aaedb = _0x12b707;
this["bytes"][_0x1aaedb(183)](_0x5f2541), this[_0x1aaedb(189)][_0x1aaedb(183)](_0x192c15 - this[_0x1aaedb(187)]), this["timestamps"][_0x1aaedb(183)](_0x192c15);
}
[_0x12b707(197)](_0x6511f1 = performance["now"]()) {
const _0x4cf252 = _0x12b707;
this[_0x4cf252(195)](), this["loadingsCount"] === 0 && this[_0x4cf252(188)] !== 0 && (this[_0x4cf252(187)] += _0x6511f1 - this[_0x4cf252(188)]), this[_0x4cf252(193)]++;
}
[_0x12b707(194)](_0x8f6f53 = performance["now"]()) {
const _0x1f80d7 = _0x12b707;
if (this[_0x1f80d7(193)] > 0) {
this[_0x1f80d7(193)]--;
if (this["loadingsCount"] === 0) this[_0x1f80d7(188)] = _0x8f6f53;
}
}
[_0x12b707(191)](_0x4f5e91, _0xb961e4 = Number[_0x12b707(196)]) {
const _0x524822 = _0x12b707;
if (!this[_0x524822(189)][_0x524822(200)]) return 0;
const _0x1795d0 = _0x4f5e91 * 1e3, _0x43571a = this[_0x524822(189)][this[_0x524822(189)][_0x524822(200)] - 1];
let _0x179c33 = _0x43571a;
const _0x2dde32 = _0x43571a - _0x1795d0;
let _0x3d2a5c = 0;
for (let _0x2f18ae = this["bytes"][_0x524822(200)] - 1; _0x2f18ae >= 0; _0x2f18ae--) {
const _0x4b66d = this[_0x524822(189)][_0x2f18ae];
if (_0x4b66d < _0x2dde32 || this[_0x524822(182)][_0x2f18ae] < _0xb961e4) break;
_0x179c33 = _0x4b66d, _0x3d2a5c += this[_0x524822(199)][_0x2f18ae];
}
return _0x3d2a5c * 8e3 / (_0x43571a - _0x179c33);
}
["getBandwidth"](_0x494a47, _0x48feac = Number["NEGATIVE_INFINITY"], _0x5c6a1b = performance["now"]()) {
const _0x1feb20 = _0x12b707;
if (!this[_0x1feb20(182)]["length"]) return 0;
const _0x2fe37d = _0x494a47 * 1e3, _0x10bd25 = _0x5c6a1b - _0x2fe37d;
let _0x1e98e5 = _0x5c6a1b, _0x50932b = 0;
for (let _0x560bbf = this[_0x1feb20(199)][_0x1feb20(200)] - 1; _0x560bbf >= 0; _0x560bbf--) {
const _0x27ec3a = this[_0x1feb20(182)][_0x560bbf];
if (_0x27ec3a < _0x10bd25 || _0x27ec3a < _0x48feac) break;
_0x1e98e5 = _0x27ec3a, _0x50932b += this[_0x1feb20(199)][_0x560bbf];
}
return _0x50932b * 8e3 / (_0x5c6a1b - _0x1e98e5);
}
[_0x12b707(195)]() {
const _0x4494a3 = _0x12b707;
if (!this[_0x4494a3(189)][_0x4494a3(200)]) return;
const _0x20c612 = this[_0x4494a3(189)][this["loadingOnlyTimestamps"][_0x4494a3(200)] - 1] - this[_0x4494a3(192)];
let _0x26262c = 0;
for (const _0x2f2a4e of this[_0x4494a3(189)]) {
if (_0x2f2a4e > _0x20c612) break;
_0x26262c++;
}
this["bytes"]["splice"](0, _0x26262c), this[_0x4494a3(189)][_0x4494a3(177)](0, _0x26262c), this[_0x4494a3(182)][_0x4494a3(177)](0, _0x26262c);
}
}
const _0x3bcd4a = _0x5182;
(function(_0xec50eb, _0x432fe5) {
const _0x42641c = _0x5182, _0x19566f = _0xec50eb();
while (!![]) {
try {
const _0x3496eb = -parseInt(_0x42641c(437)) / 1 * (parseInt(_0x42641c(428)) / 2) + parseInt(_0x42641c(427)) / 3 + -parseInt(_0x42641c(436)) / 4 + parseInt(_0x42641c(429)) / 5 + parseInt(_0x42641c(435)) / 6 * (parseInt(_0x42641c(431)) / 7) + -parseInt(_0x42641c(432)) / 8 * (-parseInt(_0x42641c(433)) / 9) + -parseInt(_0x42641c(434)) / 10;
if (_0x3496eb === _0x432fe5) break;
else _0x19566f["push"](_0x19566f["shift"]());
} catch (_0x98db1) {
_0x19566f["push"](_0x19566f["shift"]());
}
}
})(_0x1e14, 193524);
const getStorageItemId = (_0x41d0d9, _0xaf326a) => _0x41d0d9 + "|" + _0xaf326a;
const isAndroid = (_0x2cb203) => /Android/i[_0x3bcd4a(430)](_0x2cb203);
function _0x1e14() {
const _0x4eedb7 = ["4BDWaAi", "1751680cHPhBh", "test", "1553174YlujrG", "72XkIAWl", "134217kOjFff", "4290250SvCnLf", "6jeZHcL", "385740eBUjOM", "2786rorlmK", "54363KUEaoD"];
_0x1e14 = function() {
return _0x4eedb7;
};
return _0x1e14();
}
function _0x5182(_0x4150fc, _0x42b9e7) {
const _0x1e1470 = _0x1e14();
return _0x5182 = function(_0x5182db, _0x1f60e4) {
_0x5182db = _0x5182db - 427;
let _0x157eba = _0x1e1470[_0x5182db];
return _0x157eba;
}, _0x5182(_0x4150fc, _0x42b9e7);
}
const isIPadOrIPhone = (_0x573a6f) => /iPad|iPhone/i[_0x3bcd4a(430)](_0x573a6f);
const isAndroidWebview = (_0x1eb0b2) => /Android/i["test"](_0x1eb0b2) && !/Chrome|Firefox/i[_0x3bcd4a(430)](_0x1eb0b2);
const _0xff8ec6 = _0x58fc;
(function(_0x163b3d, _0xea6edb) {
const _0x1a968a = _0x58fc, _0x4df924 = _0x163b3d();
while (!![]) {
try {
const _0x372314 = parseInt(_0x1a968a(398)) / 1 + -parseInt(_0x1a968a(392)) / 2 * (parseInt(_0x1a968a(437)) / 3) + parseInt(_0x1a968a(442)) / 4 * (parseInt(_0x1a968a(405)) / 5) + parseInt(_0x1a968a(446)) / 6 * (-parseInt(_0x1a968a(444)) / 7) + -parseInt(_0x1a968a(404)) / 8 + parseInt(_0x1a968a(420)) / 9 * (parseInt(_0x1a968a(396)) / 10) + -parseInt(_0x1a968a(414)) / 11;
if (_0x372314 === _0xea6edb) break;
else _0x4df924["push"](_0x4df924["shift"]());
} catch (_0x3acba5) {
_0x4df924["push"](_0x4df924["shift"]());
}
}
})(_0x1048, 173483);
function _0x58fc(_0x2a630d, _0x560c0d) {
const _0x1048d2 = _0x1048();
return _0x58fc = function(_0x58fc77, _0x102539) {
_0x58fc77 = _0x58fc77 - 389;
let _0x318ced = _0x1048d2[_0x58fc77];
return _0x318ced;
}, _0x58fc(_0x2a630d, _0x560c0d);
}
function _0x1048() {
const _0xd0e09d = ["coreConfig", "onPlaybackUpdated", "set", "cache", "get", "onSegmentRequested", "Removed segment ", "sendUpdatesToAffectedStreams", "isMemoryLimitReached", "668046oMknTe", "segmentChangeCallback", "values", "size", "userAgent", "1338596uFJHkf", "RebeccaPurple", "56AERoLx", "add", "167130hdnVhd", "setSegmentChangeCallback", "from", "byteLength", " to ", "p2pml-core:segment-memory-storage", "getSegmentData", "2dRsmKj", "destroy", "shouldRemoveSegment", "setMemoryStorageLimit", "2518430qSGSZY", "initialized", "297795XNbbZH", "decreaseStorageUsage", "add segment: ", "logger", "initialize", "forEach", "284248VzwMxr", "5RmrbsG", "currentStorageUsage", "increaseStorageUsage", "highDemandTimeWindow", "mainStreamConfig", "storeSegment", "segmentMemoryStorageLimit", "lastRequestedSegment", "push", "2527261eKFgVH", " from stream ", "dispatchStorageUpdatedEvent is not set", "getStreamTimeWindow", "position", "startTime", "9UbSnjH", "currentPlayback", "getStoredSegmentIds", "secondaryStreamConfig", "clear", "sort", "color", "data"];
_0x1048 = function() {
return _0xd0e09d;
};
return _0x1048();
}
const BYTES_PER_MiB = 1048576;
class SegmentMemoryStorage {
constructor() {
__publicField(this, _va, navigator["userAgent"]);
__publicField(this, "segmentMemoryStorageLimit", 4 * 1024);
__publicField(this, "currentStorageUsage", 0);
__publicField(this, "cache", /* @__PURE__ */ new Map());
__publicField(this, _ua);
__publicField(this, _ta);
__publicField(this, _sa);
__publicField(this, _ra);
__publicField(this, _qa);
__publicField(this, _pa);
__publicField(this, "segmentChangeCallback");
const _0x2f013c = _0xff8ec6;
this[_0x2f013c(401)] = _0x1bf98d(_0x2f013c(390)), this[_0x2f013c(401)][_0x2f013c(426)] = _0x2f013c(443);
}
async [(_va = _0xff8ec6(441), _ua = _0xff8ec6(401), _ta = _0xff8ec6(428), _sa = _0xff8ec6(409), _ra = _0xff8ec6(423), _qa = _0xff8ec6(421), _pa = _0xff8ec6(412), _0xff8ec6(402))](_0x16423b, _0x33adee, _0x68eddd) {
const _0x45d4b3 = _0xff8ec6;
this[_0x45d4b3(428)] = _0x16423b, this[_0x45d4b3(409)] = _0x33adee, this[_0x45d4b3(423)] = _0x68eddd, this[_0x45d4b3(395)](), this[_0x45d4b3(401)](_0x45d4b3(397));
}
[_0xff8ec6(429)](_0x31394e, _0x2c51da) {
const _0x34eafb = _0xff8ec6;
this[_0x34eafb(421)] = { "position": _0x31394e, "rate": _0x2c51da };
}
[_0xff8ec6(433)](_0x33c8e1, _0x232494, _0x16621e, _0x31202e, _0x3df5d1, _0x516b8f, _0x572142) {
const _0x5c628b = _0xff8ec6;
this[_0x5c628b(412)] = { "streamId": _0x232494, "segmentId": _0x16621e, "startTime": _0x31202e, "endTime": _0x3df5d1, "swarmId": _0x33c8e1, "streamType": _0x516b8f, "isLiveStream": _0x572142 };
}
async [_0xff8ec6(410)](_0x51819c, _0x4e3d98, _0x56e8d4, _0x20a3f3, _0x18a905, _0x4c99dd, _0x3ad00, _0x490e1f) {
const _0x116b51 = _0xff8ec6;
this["clear"](_0x490e1f, _0x20a3f3[_0x116b51(449)]);
const _0x4fad2b = getStorageItemId(_0x4e3d98, _0x56e8d4);
this[_0x116b51(431)][_0x116b51(430)](_0x4fad2b, { "data": _0x20a3f3, "segmentId": _0x56e8d4, "streamId": _0x4e3d98, "startTime": _0x18a905, "endTime": _0x4c99dd, "streamType": _0x3ad00 }), this[_0x116b51(407)](_0x20a3f3[_0x116b51(449)]), this["logger"](_0x116b51(400) + _0x56e8d4 + _0x116b51(389) + _0x4e3d98);
if (!this[_0x116b51(438)]) throw new Error(_0x116b51(416));
this[_0x116b51(438)](_0x4e3d98);
}
async [_0xff8ec6(391)](_0x5b64d5, _0xa313bd, _0x4773d0) {
const _0x14bde0 = _0xff8ec6, _0x1cc604 = getStorageItemId(_0xa313bd, _0x4773d0), _0x1950e7 = this[_0x14bde0(431)][_0x14bde0(432)](_0x1cc604);
if (_0x1950e7 === void 0) return void 0;
return _0x1950e7[_0x14bde0(427)];
}
["getUsage"]() {
const _0x2a7585 = _0xff8ec6;
if (!this[_0x2a7585(412)] || !this["currentPlayback"]) return { "totalCapacity": this["segmentMemoryStorageLimit"], "usedCapacity": this[_0x2a7585(406)] };
const _0x2894ff = this["currentPlayback"][_0x2a7585(418)];
let _0x396331 = 0;
for (const { endTime: _0x2d7944, data: _0xeed138 } of this[_0x2a7585(431)]["values"]()) {
if (_0x2894ff > _0x2d7944) continue;
_0x396331 += _0xeed138[_0x2a7585(449)];
}
return { "totalCapacity": this[_0x2a7585(411)], "usedCapacity": _0x396331 / BYTES_PER_MiB };
}
["hasSegment"](_0x2c74b4, _0x5735cf, _0x4ec544) {
const _0x305fa = _0xff8ec6, _0x2bbbcb = getStorageItemId(_0x5735cf, _0x4ec544), _0x1fd7bb = this[_0x305fa(431)][_0x305fa(432)](_0x2bbbcb);
return _0x1fd7bb !== void 0;
}
[_0xff8ec6(422)](_0x933f37, _0x258499) {
const _0x2fdbb1 = _0xff8ec6, _0x1f4ead = [];
for (const { segmentId: _0x596e6d, streamId: _0x53820a } of this[_0x2fdbb1(431)][_0x2fdbb1(439)]()) {
if (_0x53820a !== _0x258499) continue;
_0x1f4ead[_0x2fdbb1(413)](_0x596e6d);
}
return _0x1f4ead;
}
["clear"](_0xcf9e79, _0x11d9a2) {
const _0x395bf0 = _0xff8ec6;
if (!this["currentPlayback"] || !this[_0x395bf0(409)] || !this[_0x395bf0(423)] || !this[_0x395bf0(428)]) return;
const _0x4793c8 = this[_0x395bf0(436)](_0x11d9a2);
if (!_0x4793c8 && !_0xcf9e79) return;
const _0x2907eb = /* @__PURE__ */ new Set(), _0xeee165 = Array[_0x395bf0(448)](this[_0x395bf0(431)][_0x395bf0(439)]())[_0x395bf0(425)]((_0x4beeef, _0x286796) => _0x4beeef[_0x395bf0(419)] - _0x286796[_0x395bf0(419)]);
for (const _0x20f48c of _0xeee165) {
const { streamId: _0x434fe7, segmentId: _0x244591, data: _0x522df1 } = _0x20f48c, _0x5ec60d = getStorageItemId(_0x434fe7, _0x244591), _0x42452d = this[_0x395bf0(394)](_0x20f48c, _0xcf9e79, this[_0x395bf0(421)][_0x395bf0(418)]);
if (!_0x42452d) continue;
this["cache"]["delete"](_0x5ec60d), _0x2907eb[_0x395bf0(445)](_0x434fe7), this["decreaseStorageUsage"](_0x522df1[_0x395bf0(449)]), this[_0x395bf0(401)](_0x395bf0(434) + _0x244591 + _0x395bf0(415) + _0x434fe7);
if (!this[_0x395bf0(436)](_0x11d9a2) && !_0xcf9e79) break;
}
this[_0x395bf0(435)](_0x2907eb);
}
[_0xff8ec6(436)](_0x4b0099) {
const _0xfcd694 = _0xff8ec6;
return this[_0xfcd694(406)] + _0x4b0099 / BYTES_PER_MiB > this[_0xfcd694(411)];
}
[_0xff8ec6(447)](_0xfdb6e7) {
const _0x321f0f = _0xff8ec6;
this[_0x321f0f(438)] = _0xfdb6e7;
}
[_0xff8ec6(435)](_0x182b3c) {
const _0x5049fe = _0xff8ec6;
if (_0x182b3c[_0x5049fe(440)] === 0) return;
_0x182b3c[_0x5049fe(403)]((_0x34e804) => {
const _0x358c1a = _0x5049fe;
if (!this[_0x358c1a(438)]) throw new Error("dispatchStorageUpdatedEvent is not set");
this[_0x358c1a(438)](_0x34e804);
});
}
[_0xff8ec6(394)](_0x3aaeb8, _0x1a25c6, _0x5ad8d1) {
const _0x5bdb86 = _0xff8ec6, { endTime: _0x25532d, streamType: _0x4c7b52 } = _0x3aaeb8, _0x3b57d6 = this[_0x5bdb86(417)](_0x4c7b52, _0x5bdb86(408));
if (_0x5ad8d1 <= _0x25532d) return ![];
if (_0x1a25c6) return _0x5ad8d1 > _0x3b57d6 + _0x25532d;
return !![];
}
[_0xff8ec6(407)](_0x309ff9) {
const _0x27e0e4 = _0xff8ec6;
this[_0x27e0e4(406)] += _0x309ff9 / BYTES_PER_MiB;
}
[_0xff8ec6(399)](_0x41b0fd) {
const _0x3a823d = _0xff8ec6;
this[_0x3a823d(406)] -= _0x41b0fd / BYTES_PER_MiB;
}
[_0xff8ec6(395)]() {
var _a2;
const _0x43a0c6 = _0xff8ec6;
if ((_a2 = this["coreConfig"]) == null ? void 0 : _a2[_0x43a0c6(411)]) {
this["segmentMemoryStorageLimit"] = this["coreConfig"][_0x43a0c6(411)];
return;
}
if (isAndroidWebview(this["userAgent"]) || isIPadOrIPhone(this[_0x43a0c6(441)])) this[_0x43a0c6(411)] = 1024;
else isAndroid(this["userAgent"]) && (this[_0x43a0c6(411)] = 2 * 1024);
}
[_0xff8ec6(417)](_0x5b08c6, _0x27dd42) {
const _0x38f39e = _0xff8ec6, _0x5cf30b = _0x5b08c6 === "main" ? this[_0x38f39e(409)] : this["secondaryStreamConfig"];
return (_0x5cf30b == null ? void 0 : _0x5cf30b[_0x27dd42]) ?? 0;
}
[_0xff8ec6(393)]() {
const _0xf9a8ff = _0xff8ec6;
this[_0xf9a8ff(431)][_0xf9a8ff(424)]();
}
}
const _0x4c00a2 = _0x251f;
function _0x5241() {
const _0xb91967 = ["1xBDPrG", "2865jOligo", "splice", "set", "3142869RtUUve", "dispatchEvent", "events", "285858LMtCyI", "indexOf", "1076CXNKGm", "removeEventListener", "11002481TpzCmy", "324070AlKQeH", "getEventDispatcher", "get", "4024GvhYYq", "4005fqPHCE", "addEventListener", "push", "6699190jpxopL"];
_0x5241 = function() {
return _0xb91967;
};
return _0x5241();
}
function _0x251f(_0x5e9082, _0x3be77c) {
const _0x524109 = _0x5241();
return _0x251f = function(_0x251fa1, _0x43b6e1) {
_0x251fa1 = _0x251fa1 - 268;
let _0x569c6d = _0x524109[_0x251fa1];
return _0x569c6d;
}, _0x251f(_0x5e9082, _0x3be77c);
}
(function(_0x55fce6, _0x39a6ba) {
const _0x59ad37 = _0x251f, _0x1c302c = _0x55fce6();
while (!![]) {
try {
const _0x2573cf = parseInt(_0x59ad37(271)) / 1 * (parseInt(_0x59ad37(283)) / 2) + -parseInt(_0x59ad37(275)) / 3 + parseInt(_0x59ad37(280)) / 4 * (-parseInt(_0x59ad37(272)) / 5) + -parseInt(_0x59ad37(278)) / 6 + parseInt(_0x59ad37(282)) / 7 + -parseInt(_0x59ad37(286)) / 8 * (parseInt(_0x59ad37(287)) / 9) + parseInt(_0x59ad37(270)) / 10;
if (_0x2573cf === _0x39a6ba) break;
else _0x1c302c["push"](_0x1c302c["shift"]());
} catch (_0x294a8e) {
_0x1c302c["push"](_0x1c302c["shift"]());
}
}
})(_0x5241, 930499);
class EventTarget {
constructor() {
__publicField(this, _wa, /* @__PURE__ */ new Map());
}
[(_wa = _0x4c00a2(277), _0x4c00a2(276))](_0x31611b, ..._0x4c9d9b) {
const _0x484eda = _0x4c00a2, _0x33cc62 = this["events"][_0x484eda(285)](_0x31611b);
if (!_0x33cc62) return;
for (const _0x5e6bb4 of _0x33cc62) {
_0x5e6bb4(..._0x4c9d9b);
}
}
[_0x4c00a2(284)](_0x14ae38) {
const _0x1223e1 = _0x4c00a2;
let _0x4fd013 = this["events"][_0x1223e1(285)](_0x14ae38);
!_0x4fd013 && (_0x4fd013 = [], this[_0x1223e1(277)][_0x1223e1(274)](_0x14ae38, _0x4fd013));
const _0x134243 = _0x4fd013;
return (..._0x370789) => {
for (const _0x17edb6 of _0x134243) {
_0x17edb6(..._0x370789);
}
};
}
[_0x4c00a2(268)](_0xb1da16, _0x530c69) {
const _0x23d83f = _0x4c00a2, _0x165ab0 = this[_0x23d83f(277)][_0x23d83f(285)](_0xb1da16);
!_0x165ab0 ? this[_0x23d83f(277)][_0x23d83f(274)](_0xb1da16, [_0x530c69]) : _0x165ab0[_0x23d83f(269)](_0x530c69);
}
[_0x4c00a2(281)](_0x5b37e3, _0x589fbc) {
const _0x27d2ae = _0x4c00a2, _0x4a4235 = this[_0x27d2ae(277)][_0x27d2ae(285)](_0x5b37e3);
if (_0x4a4235) {
const _0x12b052 = _0x4a4235[_0x27d2ae(279)](_0x589fbc);
_0x12b052 !== -1 && _0x4a4235[_0x27d2ae(273)](_0x12b052, 1);
}
}
}
const _0x2c24b8 = _0x170b;
(function(_0x179a6f, _0xe1b421) {
const _0x205d63 = _0x170b, _0x27422e = _0x179a6f();
while (!![]) {
try {
const _0x4be1bd = parseInt(_0x205d63(507)) / 1 + -parseInt(_0x205d63(480)) / 2 + -parseInt(_0x205d63(525)) / 3 * (-parseInt(_0x205d63(529)) / 4) + -parseInt(_0x205d63(470)) / 5 * (-parseInt(_0x205d63(499)) / 6) + parseInt(_0x205d63(467)) / 7 + -parseInt(_0x205d63(476)) / 8 + parseInt(_0x205d63(530)) / 9 * (parseInt(_0x205d63(503)) / 10);
if (_0x4be1bd === _0xe1b421) break;
else _0x27422e["push"](_0x27422e["shift"]());
} catch (_0x5e5fe3) {
_0x27422e["push"](_0x27422e["shift"]());
}
}
})(_0x2635, 310679);
function _0x2635() {
const _0x20a032 = ["mainStreamConfig", "DEFAULT_COMMON_CORE_CONFIG", "processSpecificDynamicConfigParams", "delete", "updateStream", "1116227sOeQag", "segments", "Segment storage is not initialized", "40715LRkZgu", "initializeSegmentStorage", "segmentStorage", "getSegmentFromStreamsMap", "secondaryStreamLoader", "split", "4784416BZfSFa", "has", "get", "secondaryStream", "1050730zHtsps", "runtimeId", "destroy", "destroyStreamLoader", "activeLevelBitrate", "bandwidthCalculators", "updatePlayback", "isP2PUploadDisabled", "initialize", "streams", "getStream", "getUpdatedStreamProperty", "hasSegment", "getStreamHybridLoader", "loadSegment", "isSegmentLoadable", "setManifestResponseUrl", "manifestResponseUrl", "wss://v2.swarm.video", "240JaIxZt", "sendBroadcastAnnouncement", "applyDynamicConfig", "setActiveLevelBitrate", "1601220FDfdXO", "set", "Manifest response url is not defined", "notifyLevelChanged", "46468pKeUem", "abortSegmentRequest", "mainStreamLoader", "customSegmentStorageFactory", "secondary", "commonCoreConfig", "eventTarget", "overrideAllConfigs", "createNewHybridLoader", "function", "stun:stun.l.google.com:19302", "isLive", "addEventListener", "clear", "Manifest response url is undefined", "mainStream", "type", "clearPeerIdCache", "3YVpNvW", "DEFAULT_STREAM_CONFIG", "main", "secondaryStreamConfig", "1688324ajknGY", "27zihaDQ", "Storage configuration is invalid", "streamDetails", "isP2PDisabled", "Not found segment with id: ", "stream", "identifySegment"];
_0x2635 = function() {
return _0x20a032;
};
return _0x2635();
}
function _0x170b(_0x4351fb, _0x39053c) {
const _0x263585 = _0x2635();
return _0x170b = function(_0x170bee, _0x516e03) {
_0x170bee = _0x170bee - 464;
let _0x22ecf3 = _0x263585[_0x170bee];
return _0x22ecf3;
}, _0x170b(_0x4351fb, _0x39053c);
}
const _Core = class _Core {
constructor(_0x5cda8e) {
__publicField(this, "eventTarget", new EventTarget());
__publicField(this, _Da);
__publicField(this, _Ca, /* @__PURE__ */ new Map());
__publicField(this, "mainStreamConfig");
__publicField(this, _Ba);
__publicField(this, _Aa);
__publicField(this, _za, { "all": new BandwidthCalculator(), "http": new BandwidthCalculator() });
__publicField(this, "segmentStorage");
__publicField(this, "mainStreamLoader");
__publicField(this, _ya);
__publicField(this, _xa, { "isLive": ![], "activeLevelBitrate": 0 });
const _0x5380ad = _0x2c24b8, _0x5223d1 = filterUndefinedProps(_0x5cda8e ?? {});
this[_0x5380ad(512)] = mergeAndFilterConfig({ "defaultConfig": _Core[_0x5380ad(538)], "baseConfig": _0x5223d1 }), this[_0x5380ad(537)] = mergeAndFilterConfig({ "defaultConfig": _Core[_0x5380ad(526)], "baseConfig": _0x5223d1, "specificStreamConfig": _0x5223d1[_0x5380ad(522)] }), this["secondaryStreamConfig"] = mergeAndFilterConfig({ "defaultConfig": _Core[_0x5380ad(526)], "baseConfig": _0x5223d1, "specificStreamConfig": _0x5223d1[_0x5380ad(479)] });
}
["getConfig"]() {
const _0x195c03 = _0x2c24b8;
return { ...deepCopy(this[_0x195c03(512)]), "mainStream": deepCopy(this[_0x195c03(537)]), "secondaryStream": deepCopy(this[_0x195c03(528)]) };
}
[(_Fa = _0x2c24b8(538), _Ea = _0x2c24b8(526), _Da = _0x2c24b8(497), _Ca = _0x2c24b8(489), _Ba = _0x2c24b8(528), _Aa = _0x2c24b8(512), _za = _0x2c24b8(485), _ya = _0x2c24b8(474), _xa = _0x2c24b8(532), _0x2c24b8(501))](_0x26aec7) {
const _0x2266ec = _0x2c24b8, { mainStream: _0x2ef7a7, secondaryStream: _0xd9e0df } = _0x26aec7, _0xa038e = deepCopy(this[_0x2266ec(537)]), _0x409536 = deepCopy(this[_0x2266ec(528)]);
this[_0x2266ec(514)](_0x26aec7, _0x2ef7a7, _0xd9e0df), this[_0x2266ec(464)](_0xa038e, _0x26aec7, "main"), this[_0x2266ec(464)](_0x409536, _0x26aec7, _0x2266ec(511));
}
[_0x2c24b8(464)](_0x5693b4, _0x3df05a, _0x5cb3a7) {
const _0x3057e4 = _0x2c24b8, _0x3e004d = this["getUpdatedStreamProperty"]("isP2PDisabled", _0x3df05a, _0x5cb3a7);
_0x3e004d && _0x5693b4[_0x3057e4(533)] !== _0x3e004d && this["destroyStreamLoader"](_0x5cb3a7);
const _0x4c35be = this["getUpdatedStreamProperty"]("isP2PUploadDisabled", _0x3df05a, _0x5cb3a7);
if (_0x4c35be !== void 0 && _0x5693b4[_0x3057e4(487)] !== _0x4c35be) {
const _0x3db290 = _0x5cb3a7 === _0x3057e4(527) ? this[_0x3057e4(509)] : this[_0x3057e4(474)];
_0x3db290 == null ? void 0 : _0x3db290[_0x3057e4(500)](_0x4c35be);
}
}
[_0x2c24b8(491)](_0x2aac36, _0x4e4655, _0x1019d7) {
const _0x224a5d = _0x2c24b8, _0x144fa7 = _0x1019d7 === "main" ? _0x4e4655[_0x224a5d(522)] : _0x4e4655["secondaryStream"];
return (_0x144fa7 == null ? void 0 : _0x144fa7[_0x2aac36]) ?? _0x4e4655[_0x2aac36];
}
[_0x2c24b8(519)](_0x3d2fa8, _0xbf3c2c) {
const _0x58440a = _0x2c24b8;
this[_0x58440a(513)]["addEventListener"](_0x3d2fa8, _0xbf3c2c);
}
["removeEventListener"](_0x151bb7, _0x40ab07) {
this["eventTarget"]["removeEventListener"](_0x151bb7, _0x40ab07);
}
[_0x2c24b8(496)](_0x134793) {
const _0x44a2ad = _0x2c24b8;
this["manifestResponseUrl"] = _0x134793[_0x44a2ad(475)]("?")[0];
}
[_0x2c24b8(492)](_0x2088ab) {
const _0x52f69e = _0x2c24b8;
return !!_0x37c065[_0x52f69e(473)](this["streams"], _0x2088ab);
}
[_0x2c24b8(490)](_0x4297f3) {
const _0x1ccec4 = _0x2c24b8;
return this[_0x1ccec4(489)][_0x1ccec4(478)](_0x4297f3);
}
["addStreamIfNoneExists"](_0x1ababe) {
const _0xd241ee = _0x2c24b8;
if (this[_0xd241ee(489)][_0xd241ee(477)](_0x1ababe["runtimeId"])) return;
this[_0xd241ee(489)][_0xd241ee(504)](_0x1ababe[_0xd241ee(481)], { ..._0x1ababe, "segments": /* @__PURE__ */ new Map() });
}
["updateStream"](_0x4e84e3, _0x1b616e, _0x5ec279) {
var _a2, _b2;
const _0x1830db = _0x2c24b8, _0x2fd1eb = this["streams"]["get"](_0x4e84e3);
if (!_0x2fd1eb) return;
if (_0x1b616e) for (const _0x2bcafe of _0x1b616e) {
if (_0x2fd1eb[_0x1830db(468)][_0x1830db(477)](_0x2bcafe["runtimeId"])) continue;
_0x2fd1eb["segments"]["set"](_0x2bcafe[_0x1830db(481)], { ..._0x2bcafe, "stream": _0x2fd1eb });
}
if (_0x5ec279) for (const _0xfdcb32 of _0x5ec279) {
_0x2fd1eb["segments"][_0x1830db(465)](_0xfdcb32);
}
(_a2 = this[_0x1830db(509)]) == null ? void 0 : _a2["updateStream"](_0x2fd1eb), (_b2 = this["secondaryStreamLoader"]) == null ? void 0 : _b2[_0x1830db(466)](_0x2fd1eb);
}
async ["loadSegment"](_0x4b12f2, _0x11fc53) {
const _0x20c703 = _0x2c24b8;
if (!this[_0x20c703(497)]) throw new Error(_0x20c703(505));
await this[_0x20c703(471)]();
const _0x4e0a22 = this[_0x20c703(536)](_0x4b12f2), _0x3818e0 = this[_0x20c703(493)](_0x4e0a22);
void _0x3818e0[_0x20c703(494)](_0x4e0a22, _0x11fc53);
}
["abortSegmentLoading"](_0x6f922d) {
var _a2, _b2;
const _0x5e7e3f = _0x2c24b8;
(_a2 = this["mainStreamLoader"]) == null ? void 0 : _a2[_0x5e7e3f(508)](_0x6f922d), (_b2 = this[_0x5e7e3f(474)]) == null ? void 0 : _b2[_0x5e7e3f(508)](_0x6f922d);
}
[_0x2c24b8(486)](_0x924f31, _0x26dfad) {
var _a2, _b2;
const _0x5e49fb = _0x2c24b8;
(_a2 = this[_0x5e49fb(509)]) == null ? void 0 : _a2[_0x5e49fb(486)](_0x924f31, _0x26dfad), (_b2 = this[_0x5e49fb(474)]) == null ? void 0 : _b2[_0x5e49fb(486)](_0x924f31, _0x26dfad);
}
[_0x2c24b8(502)](_0x4a9d8c) {
var _a2, _b2;
const _0x375ee4 = _0x2c24b8;
_0x4a9d8c !== this["streamDetails"][_0x375ee4(484)] && (this[_0x375ee4(532)][_0x375ee4(484)] = _0x4a9d8c, (_a2 = this[_0x375ee4(509)]) == null ? void 0 : _a2["notifyLevelChanged"](), (_b2 = this[_0x375ee4(474)]) == null ? void 0 : _b2[_0x375ee4(506)]());
}
["setIsLive"](_0x27d6f5) {
const _0x316ef3 = _0x2c24b8;
this[_0x316ef3(532)][_0x316ef3(518)] = _0x27d6f5;
}
[_0x2c24b8(495)](_0x4a56df) {
const _0x2472f8 = _0x2c24b8;
try {
const _0x36259c = this["identifySegment"](_0x4a56df);
if (_0x36259c["stream"][_0x2472f8(523)] === "main" && this[_0x2472f8(537)]["isP2PDisabled"]) return ![];
if (_0x36259c[_0x2472f8(535)]["type"] === "secondary" && this[_0x2472f8(528)][_0x2472f8(533)]) return ![];
return !![];
} catch {
return ![];
}
}
[_0x2c24b8(482)]() {
var _a2, _b2, _c2;
const _0x579d23 = _0x2c24b8;
this["streams"][_0x579d23(520)](), (_a2 = this[_0x579d23(509)]) == null ? void 0 : _a2[_0x579d23(482)](), (_b2 = this[_0x579d23(474)]) == null ? void 0 : _b2[_0x579d23(482)](), (_c2 = this["segmentStorage"]) == null ? void 0 : _c2[_0x579d23(482)](), this[_0x579d23(509)] = void 0, this[_0x579d23(474)] = void 0, this[_0x579d23(472)] = void 0, this[_0x579d23(497)] = void 0, this[_0x579d23(532)] = { "isLive": ![], "activeLevelBitrate": 0 }, P2PTrackerClient[_0x579d23(524)]();
}
async [_0x2c24b8(471)]() {
const _0x4a77e0 = _0x2c24b8;
if (this[_0x4a77e0(472)]) return;
const { isLive: _0x8482cb } = this["streamDetails"], _0x250410 = this[_0x4a77e0(512)][_0x4a77e0(510)];
if (_0x250410 && typeof _0x250410 !== _0x4a77e0(516)) throw new Error(_0x4a77e0(531));
const _0x37f66f = _0x250410 ? _0x250410(_0x8482cb) : new SegmentMemoryStorage();
await _0x37f66f[_0x4a77e0(488)](this[_0x4a77e0(512)], this[_0x4a77e0(537)], this[_0x4a77e0(528)]), this["segmentStorage"] = _0x37f66f;
}
[_0x2c24b8(536)](_0x5688ed) {
const _0x3bdbde = _0x2c24b8;
if (!this[_0x3bdbde(497)]) throw new Error(_0x3bdbde(521));
const _0x1e9437 = _0x37c065[_0x3bdbde(473)](this["streams"], _0x5688ed);
if (!_0x1e9437) throw new Error(_0x3bdbde(534) + _0x5688ed);
return _0x1e9437;
}
[_0x2c24b8(514)](_0x15c55a, _0x32403f, _0x5e201a) {
const _0x1009be = _0x2c24b8;
overrideConfig(this[_0x1009be(512)], _0x15c55a), overrideConfig(this[_0x1009be(537)], _0x15c55a), overrideConfig(this["secondaryStreamConfig"], _0x15c55a), _0x32403f && overrideConfig(this[_0x1009be(537)], _0x32403f), _0x5e201a && overrideConfig(this[_0x1009be(528)], _0x5e201a);
}
[_0x2c24b8(483)](_0x4c8889) {
var _a2, _b2;
const _0x5ece35 = _0x2c24b8;
_0x4c8889 === _0x5ece35(527) ? ((_a2 = this[_0x5ece35(509)]) == null ? void 0 : _a2[_0x5ece35(482)](), this[_0x5ece35(509)] = void 0) : ((_b2 = this["secondaryStreamLoader"]) == null ? void 0 : _b2[_0x5ece35(482)](), this["secondaryStreamLoader"] = void 0);
}
[_0x2c24b8(493)](_0x2bdcb6) {
const _0x469efa = _0x2c24b8;
return _0x2bdcb6["stream"][_0x469efa(523)] === _0x469efa(527) ? (this["mainStreamLoader"] ?? (this["mainStreamLoader"] = this[_0x469efa(515)](_0x2bdcb6)), this[_0x469efa(509)]) : (this["secondaryStreamLoader"] ?? (this["secondaryStreamLoader"] = this[_0x469efa(515)](_0x2bdcb6)), this["secondaryStreamLoader"]);
}
[_0x2c24b8(515)](_0x2f5ad7) {
const _0x49045c = _0x2c24b8;
if (!this[_0x49045c(497)]) throw new Error(_0x49045c(505));
if (!this[_0x49045c(472)]) throw new Error(_0x49045c(469));
const _0x57eaae = _0x2f5ad7[_0x49045c(535)][_0x49045c(523)] === _0x49045c(527) ? this[_0x49045c(537)] : this[_0x49045c(528)];
return new HybridLoader(this[_0x49045c(497)], _0x2f5ad7, this[_0x49045c(532)], _0x57eaae, this["bandwidthCalculators"], this[_0x49045c(472)], this[_0x49045c(513)]);
}
};
__publicField(_Core, _Fa, { "segmentMemoryStorageLimit": void 0, "customSegmentStorageFactory": void 0 });
__publicField(_Core, _Ea, { "isP2PUploadDisabled": ![], "isP2PDisabled": ![], "simultaneousHttpDownloads": 1, "simultaneousP2PDownloads": 5, "highDemandTimeWindow": 15, "httpDownloadTimeWindow": 3e3, "p2pDownloadTimeWindow": 6e3, "webRtcMaxMessageSize": 64 * 1024 - 1, "p2pNotReceivingBytesTimeoutMs": 2900, "p2pInactiveLoaderDestroyTimeoutMs": 30 * 1e3, "httpNotReceivingBytesTimeoutMs": 3e3, "httpErrorRetries": 100, "p2pErrorRetries": 1, "trackerClientVersionPrefix": TRACKER_CLIENT_VERSION_PREFIX, "announceTrackers": [_0x2c24b8(498)], "rtcConfig": { "iceServers": [{ "urls": _0x2c24b8(517) }, { "urls": "stun:global.stun.twilio.com:3478" }] }, "validateP2PSegment": void 0, "validateHTTPSegment": void 0, "httpRequestSetup": void 0, "statsSegmentsThreshold": 10, "swarmId": void 0 });
let Core = _Core;
(function(_0x37614c, _0xce032b) {
var _0x1daa94 = _0x5bc3, _0x4074e3 = _0x37614c();
while (!![]) {
try {
var _0x3994fd = parseInt(_0x1daa94(278)) / 1 + -parseInt(_0x1daa94(275)) / 2 + -parseInt(_0x1daa94(273)) / 3 * (parseInt(_0x1daa94(277)) / 4) + -parseInt(_0x1daa94(279)) / 5 + parseInt(_0x1daa94(274)) / 6 + -parseInt(_0x1daa94(272)) / 7 + parseInt(_0x1daa94(276)) / 8;
if (_0x3994fd === _0xce032b) break;
else _0x4074e3["push"](_0x4074e3["shift"]());
} catch (_0x128cfd) {
_0x4074e3["push"](_0x4074e3["shift"]());
}
}
})(_0x2375, 802857);
function _0x2375() {
var _0x31397d = ["401432UXrBsm", "601216zyGKcH", "7399540lblJiA", "3621863DYjnqX", "15kwowNg", "7296480QAEIPQ", "1617232HqMvEZ", "18346272GEgnoC"];
_0x2375 = function() {
return _0x31397d;
};
return _0x2375();
}
function _0x5bc3(_0x1ac266, _0x509800) {
var _0x2375eb = _0x2375();
return _0x5bc3 = function(_0x5bc337, _0x4ffbe5) {
_0x5bc337 = _0x5bc337 - 272;
var _0x136b7b = _0x2375eb[_0x5bc337];
return _0x136b7b;
}, _0x5bc3(_0x1ac266, _0x509800);
}
const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
Core,
CoreRequestError,
RequestError,
debug: browserExports.debug
}, Symbol.toStringTag, { value: "Module" }));
const _0x2ca41b = _0x2c65;
function _0x2c65(_0x1c7e5d, _0x1279b6) {
const _0xaf576c = _0xaf57();
return _0x2c65 = function(_0x2c65e8, _0x6caedc) {
_0x2c65e8 = _0x2c65e8 - 106;
let _0x5c1adf = _0xaf576c[_0x2c65e8];
return _0x5c1adf;
}, _0x2c65(_0x1c7e5d, _0x1279b6);
}
(function(_0x592278, _0x21e976) {
const _0x550123 = _0x2c65, _0x43d2af = _0x592278();
while (!![]) {
try {
const _0xaaa828 = -parseInt(_0x550123(109)) / 1 * (-parseInt(_0x550123(106)) / 2) + parseInt(_0x550123(138)) / 3 * (parseInt(_0x550123(128)) / 4) + -parseInt(_0x550123(118)) / 5 * (-parseInt(_0x550123(142)) / 6) + -parseInt(_0x550123(123)) / 7 + -parseInt(_0x550123(141)) / 8 + parseInt(_0x550123(116)) / 9 + parseInt(_0x550123(130)) / 10;
if (_0xaaa828 === _0x21e976) break;
else _0x43d2af["push"](_0x43d2af["shift"]());
} catch (_0x36e8bb) {
_0x43d2af["push"](_0x43d2af["shift"]());
}
}
})(_0xaf57, 432276);
function _0xaf57() {
const _0xf441b9 = ["loading", "3KcWhFG", "isSegmentLoadable", "type", "6789456GxCnHh", "1608blxVQg", "44bICkdJ", "loaded", "url", "14177AbZVjs", "getSegmentRuntimeId", "loader", "destroy", "abort", "total", "onError", "82026qqMxgC", "bandwidth", "10460hMSBCr", "text", "onProgress", "stats", "load", "3424372GvwBbU", "aborted", "abortSegmentLoading", "config", "onAbort", "3424228wBGunS", "now", "324330socqSv", "data", "message", "byteLength", "hasSegment", "context", "getByteRange"];
_0xaf57 = function() {
return _0xf441b9;
};
return _0xaf57();
}
const DEFAULT_DOWNLOAD_LATENCY = 10;
class FragmentLoaderBase {
constructor(_0x4502e0, _0x4effda) {
__privateAdd(this, _FragmentLoaderBase_instances);
__publicField(this, _Ia);
__publicField(this, _Ha);
__publicField(this, _Ga);
__privateAdd(this, _callbacks);
__privateAdd(this, _createDefaultLoader);
__privateAdd(this, _defaultLoader);
__privateAdd(this, _core);
__privateAdd(this, _response);
__privateAdd(this, _segmentId);
const _0x155ee0 = _0x2ca41b;
__privateSet(this, _core, _0x4effda), __privateSet(this, _createDefaultLoader, () => new _0x4502e0[_0x155ee0(111)](_0x4502e0)), this[_0x155ee0(121)] = { "aborted": ![], "chunkCount": 0, "loading": { "start": 0, "first": 0, "end": 0 }, "buffering": { "start": 0, "first": 0, "end": 0 }, "parsing": { "start": 0, "end": 0 }, "total": 1, "loaded": 1, "bwEstimate": 0, "retry": 0 };
}
["load"](_0x44f260, _0x5bf2c7, _0x4d90ca) {
const _0x55a17e = _0x2ca41b;
this[_0x55a17e(135)] = _0x44f260, this["config"] = _0x5bf2c7, __privateSet(this, _callbacks, _0x4d90ca);
const { stats: _0x5cc8be } = this, { rangeStart: _0xdde61a, rangeEnd: _0x38b0b4 } = _0x44f260, _0xd968fc = _0x5b3789[_0x55a17e(136)](_0xdde61a, _0x38b0b4 !== void 0 ? _0x38b0b4 - 1 : void 0);
__privateSet(this, _segmentId, _0x5b3789[_0x55a17e(110)](_0x44f260["url"], _0xd968fc));
const _0x568246 = __privateGet(this, _core)[_0x55a17e(139)](__privateGet(this, _segmentId));
if (!__privateGet(this, _core)[_0x55a17e(134)](__privateGet(this, _segmentId)) || !_0x568246) {
__privateSet(this, _defaultLoader, __privateGet(this, _createDefaultLoader).call(this)), __privateGet(this, _defaultLoader)[_0x55a17e(121)] = this["stats"], __privateGet(this, _defaultLoader)[_0x55a17e(122)](_0x44f260, _0x5bf2c7, _0x4d90ca);
return;
}
const _0x35d06e = (_0x5dffe5) => {
const _0x14bde5 = _0x55a17e;
__privateSet(this, _response, _0x5dffe5);
const _0x1581e7 = __privateGet(this, _response)[_0x14bde5(131)][_0x14bde5(133)];
_0x5cc8be[_0x14bde5(137)] = getLoadingStat(__privateGet(this, _response)[_0x14bde5(117)], _0x1581e7, performance[_0x14bde5(129)]()), _0x5cc8be[_0x14bde5(114)] = _0x1581e7, _0x5cc8be[_0x14bde5(107)] = _0x1581e7, _0x4d90ca[_0x14bde5(120)] && _0x4d90ca[_0x14bde5(120)](this[_0x14bde5(121)], _0x44f260, __privateGet(this, _response)[_0x14bde5(131)], void 0), _0x4d90ca["onSuccess"]({ "data": __privateGet(this, _response)[_0x14bde5(131)], "url": _0x44f260[_0x14bde5(108)] }, this[_0x14bde5(121)], _0x44f260, void 0);
}, _0x1044b4 = (_0x578b21) => {
const _0x503f44 = _0x55a17e;
if (_0x578b21 instanceof CoreRequestError && _0x578b21[_0x503f44(140)] === _0x503f44(124) && this[_0x503f44(121)][_0x503f44(124)]) return;
__privateMethod(this, _FragmentLoaderBase_instances, handleError_fn).call(this, _0x578b21);
};
void __privateGet(this, _core)["loadSegment"](__privateGet(this, _segmentId), { "onSuccess": _0x35d06e, "onError": _0x1044b4 });
}
[(_Ia = _0x2ca41b(135), _Ha = _0x2ca41b(126), _Ga = _0x2ca41b(121), _0x2ca41b(113))]() {
var _a2, _b2;
const _0x2a9fe3 = _0x2ca41b;
__privateGet(this, _defaultLoader) ? __privateGet(this, _defaultLoader)[_0x2a9fe3(113)]() : (__privateMethod(this, _FragmentLoaderBase_instances, abortInternal_fn).call(this), (_b2 = (_a2 = __privateGet(this, _callbacks)) == null ? void 0 : _a2[_0x2a9fe3(127)]) == null ? void 0 : _b2.call(_a2, this["stats"], this["context"], {}));
}
[_0x2ca41b(112)]() {
const _0x360233 = _0x2ca41b;
if (__privateGet(this, _defaultLoader)) __privateGet(this, _defaultLoader)[_0x360233(112)]();
else {
if (!this["stats"][_0x360233(124)]) __privateMethod(this, _FragmentLoaderBase_instances, abortInternal_fn).call(this);
__privateSet(this, _callbacks, null), this["config"] = null;
}
}
}
_callbacks = new WeakMap();
_createDefaultLoader = new WeakMap();
_defaultLoader = new WeakMap();
_core = new WeakMap();
_response = new WeakMap();
_segmentId = new WeakMap();
_FragmentLoaderBase_instances = new WeakSet();
handleError_fn = function(_0x517246) {
var _a2;
const _0x11442d = _0x2ca41b, _0x1b55a7 = { "code": 0, "text": "" };
if (_0x517246 instanceof CoreRequestError && _0x517246[_0x11442d(140)] === "failed") _0x1b55a7[_0x11442d(119)] = _0x517246[_0x11442d(132)];
else _0x517246 instanceof Error && (_0x1b55a7[_0x11442d(119)] = _0x517246[_0x11442d(132)]);
(_a2 = __privateGet(this, _callbacks)) == null ? void 0 : _a2[_0x11442d(115)](_0x1b55a7, this["context"], null, this[_0x11442d(121)]);
};
abortInternal_fn = function() {
const _0x4aab94 = _0x2ca41b;
!__privateGet(this, _response) && __privateGet(this, _segmentId) && (this["stats"]["aborted"] = !![], __privateGet(this, _core)[_0x4aab94(125)](__privateGet(this, _segmentId)));
};
function getLoadingStat(_0x34c876, _0x5c2407, _0xa96069) {
const _0x31cb78 = _0x5c2407 * 8e3 / _0x34c876, _0x394736 = _0xa96069 - _0x31cb78, _0x5e2cad = _0x394736 - DEFAULT_DOWNLOAD_LATENCY;
return { "start": _0x5e2cad, "first": _0x394736, "end": _0xa96069 };
}
var _0x51f314 = _0x470c;
(function(_0x3a8d73, _0x50605) {
var _0xce7291 = _0x470c, _0x559cbe = _0x3a8d73();
while (!![]) {
try {
var _0x3654e0 = parseInt(_0xce7291(451)) / 1 + -parseInt(_0xce7291(440)) / 2 + -parseInt(_0xce7291(436)) / 3 * (-parseInt(_0xce7291(445)) / 4) + parseInt(_0xce7291(446)) / 5 * (parseInt(_0xce7291(448)) / 6) + -parseInt(_0xce7291(447)) / 7 * (parseInt(_0xce7291(450)) / 8) + -parseInt(_0xce7291(435)) / 9 + -parseInt(_0xce7291(437)) / 10 * (-parseInt(_0xce7291(444)) / 11);
if (_0x3654e0 === _0x50605) break;
else _0x559cbe["push"](_0x559cbe["shift"]());
} catch (_0x3e54f8) {
_0x559cbe["push"](_0x559cbe["shift"]());
}
}
})(_0x9c33, 792175);
function _0x470c(_0x5ed2bb, _0x492934) {
var _0x9c3350 = _0x9c33();
return _0x470c = function(_0x470c51, _0x24201e) {
_0x470c51 = _0x470c51 - 435;
var _0x13256d = _0x9c3350[_0x470c51];
return _0x13256d;
}, _0x470c(_0x5ed2bb, _0x492934);
}
class PlaylistLoaderBase {
constructor(_0x67f75e) {
__privateAdd(this, _defaultLoader2);
__publicField(this, _Ja);
__publicField(this, "stats");
var _0x5ebbd7 = _0x51f314;
__privateSet(this, _defaultLoader2, new _0x67f75e[_0x5ebbd7(443)](_0x67f75e)), this["stats"] = __privateGet(this, _defaultLoader2)[_0x5ebbd7(439)], this[_0x5ebbd7(449)] = __privateGet(this, _defaultLoader2)["context"];
}
[(_Ja = _0x51f314(449), _0x51f314(438))](_0x2db157, _0x427b1e, _0x1b0262) {
var _0x20718f = _0x51f314;
__privateGet(this, _defaultLoader2)[_0x20718f(438)](_0x2db157, _0x427b1e, _0x1b0262);
}
[_0x51f314(442)]() {
var _0x144820 = _0x51f314;
__privateGet(this, _defaultLoader2)[_0x144820(442)]();
}
[_0x51f314(441)]() {
__privateGet(this, _defaultLoader2)["destroy"]();
}
}
_defaultLoader2 = new WeakMap();
function _0x9c33() {
var _0x1d0408 = ["26523iWFSlt", "71328UmzwqO", "context", "2648DmjIhy", "792025eskDww", "9591084gCZgOF", "1764684yUbcjN", "40ZOPapt", "load", "stats", "1066454WrCnko", "destroy", "abort", "loader", "3319118yMThdW", "4oNfRRx", "445uKpFml"];
_0x9c33 = function() {
return _0x1d0408;
};
return _0x9c33();
}
function _0x2e49() {
const _0x13973e = ["push", "3382068WeBrOx", "has", "isArray", "main", "1463861hLgQIy", "2393150OaGkEi", "6234780UwyMVW", "5540560VfPczW", "11uVAxFP", "19268PDKYDu", "addStreamIfNoneExists", "size", "toString", "updateStream", "initSegment", "secondary", "length", "7388397moDckE", "forEach", "segments", "getByteRange", "updatePlaylist", "entries", "6OPRJLs", "delete", "keys", "3tlykcE", "getSegmentRuntimeId", "core"];
_0x2e49 = function() {
return _0x13973e;
};
return _0x2e49();
}
const _0x1415a4 = _0x5600;
function _0x5600(_0x5153f7, _0x54853d) {
const _0x2e4974 = _0x2e49();
return _0x5600 = function(_0x5600b4, _0x132b51) {
_0x5600b4 = _0x5600b4 - 389;
let _0x3a3c46 = _0x2e4974[_0x5600b4];
return _0x3a3c46;
}, _0x5600(_0x5153f7, _0x54853d);
}
(function(_0x39aca3, _0xe15bda) {
const _0x6ff388 = _0x5600, _0x2bb70f = _0x39aca3();
while (!![]) {
try {
const _0x4eff92 = parseInt(_0x6ff388(413)) / 1 * (parseInt(_0x6ff388(414)) / 2) + parseInt(_0x6ff388(401)) / 3 * (parseInt(_0x6ff388(405)) / 4) + parseInt(_0x6ff388(411)) / 5 * (parseInt(_0x6ff388(398)) / 6) + parseInt(_0x6ff388(409)) / 7 + -parseInt(_0x6ff388(412)) / 8 + -parseInt(_0x6ff388(392)) / 9 + -parseInt(_0x6ff388(410)) / 10;
if (_0x4eff92 === _0xe15bda) break;
else _0x2bb70f["push"](_0x2bb70f["shift"]());
} catch (_0x267464) {
_0x2bb70f["push"](_0x2bb70f["shift"]());
}
}
})(_0x2e49, 654752);
class SegmentManager {
constructor(_0x33edcc) {
__publicField(this, _Ka);
const _0xcb4a9a = _0x1415a4;
this[_0xcb4a9a(403)] = _0x33edcc;
}
["processMainManifest"](_0x496527) {
const _0x3c04c0 = _0x1415a4, { levels: _0x43a305, audioTracks: _0x5365a9 } = _0x496527;
for (const [_0x702048, _0x12b88b] of _0x43a305["entries"]()) {
const { url: _0x1c4b3b } = _0x12b88b;
this[_0x3c04c0(403)][_0x3c04c0(415)]({ "runtimeId": Array["isArray"](_0x1c4b3b) ? _0x1c4b3b[0] : _0x1c4b3b, "type": _0x3c04c0(408), "index": _0x702048 });
}
for (const [_0x5f127a, _0x67b9cc] of _0x5365a9[_0x3c04c0(397)]()) {
const { url: _0x48e662 } = _0x67b9cc;
this[_0x3c04c0(403)][_0x3c04c0(415)]({ "runtimeId": Array[_0x3c04c0(407)](_0x48e662) ? _0x48e662[0] : _0x48e662, "type": _0x3c04c0(390), "index": _0x5f127a });
}
}
[(_Ka = _0x1415a4(403), _0x1415a4(396))](_0x176498) {
const _0x4f6972 = _0x1415a4, { details: { url: _0x8f7406, fragments: _0xa38f85, live: _0x4a32e5 } } = _0x176498, _0x554d16 = this[_0x4f6972(403)]["getStream"](_0x8f7406);
if (!_0x554d16) return;
const _0x49e0bc = new Set(_0x554d16[_0x4f6972(394)][_0x4f6972(400)]()), _0x1cc6ff = [];
_0xa38f85[_0x4f6972(393)]((_0x230f6d, _0x304a3c) => {
const _0x43b4c9 = _0x4f6972, { url: _0x314745, byteRange: _0x57ab56, sn: _0x1cf5d1, start: _0x126ead, end: _0x446a78 } = _0x230f6d;
if (_0x1cf5d1[_0x43b4c9(417)]() === _0x43b4c9(389)) return;
const [_0x66abbf, _0x1b0211] = _0x57ab56, _0x23a287 = _0x5b3789[_0x43b4c9(395)](_0x66abbf, _0x1b0211 !== void 0 ? _0x1b0211 - 1 : void 0), _0x5cd269 = _0x5b3789[_0x43b4c9(402)](_0x314745, _0x23a287);
_0x49e0bc[_0x43b4c9(399)](_0x5cd269);
if (_0x554d16["segments"][_0x43b4c9(406)](_0x5cd269)) return;
_0x1cc6ff[_0x43b4c9(404)]({ "runtimeId": _0x5cd269, "url": _0x314745, "externalId": _0x4a32e5 ? _0x1cf5d1 : _0x304a3c, "byteRange": _0x23a287, "startTime": _0x126ead, "endTime": _0x446a78 });
});
if (!_0x1cc6ff[_0x4f6972(391)] && !_0x49e0bc[_0x4f6972(416)]) return;
this["core"][_0x4f6972(418)](_0x8f7406, _0x1cc6ff, _0x49e0bc["values"]());
}
}
(function(_0x51c03c, _0x17b52d) {
const _0x19dd21 = _0x16a7, _0x355862 = _0x51c03c();
while (!![]) {
try {
const _0x297238 = -parseInt(_0x19dd21(409)) / 1 * (-parseInt(_0x19dd21(406)) / 2) + parseInt(_0x19dd21(403)) / 3 * (-parseInt(_0x19dd21(402)) / 4) + parseInt(_0x19dd21(405)) / 5 + parseInt(_0x19dd21(407)) / 6 * (parseInt(_0x19dd21(410)) / 7) + parseInt(_0x19dd21(411)) / 8 * (-parseInt(_0x19dd21(414)) / 9) + parseInt(_0x19dd21(412)) / 10 + parseInt(_0x19dd21(404)) / 11;
if (_0x297238 === _0x17b52d) break;
else _0x355862["push"](_0x355862["shift"]());
} catch (_0x408b74) {
_0x355862["push"](_0x355862["shift"]());
}
}
})(_0x5b1a, 764256);
function _0x16a7(_0x1f84f3, _0x538e5d) {
const _0x5b1ac9 = _0x5b1a();
return _0x16a7 = function(_0x16a772, _0x3ed118) {
_0x16a772 = _0x16a772 - 402;
let _0x509c30 = _0x5b1ac9[_0x16a772];
return _0x509c30;
}, _0x16a7(_0x1f84f3, _0x538e5d);
}
function _0x5b1a() {
const _0x1e6aca = ["onHlsJsCreated", "41020CoAyAp", "5306DMPjyI", "199200ZmvRxS", "5156580jxjYmm", "getConfigForHlsJs", "189lZISpz", "p2pEngine", "5708zBXzka", "3192VwyPmU", "3239577Zswfvm", "3173105xdRFAO", "2xtouhC", "10446mGRzEg"];
_0x5b1a = function() {
return _0x1e6aca;
};
return _0x5b1a();
}
function injectMixin(_0x3c1fec) {
var _p2pEngine, _a2;
const _0x5bd42a = _0x16a7;
return _a2 = class extends _0x3c1fec {
constructor(..._0x458deb) {
var _a3;
const _0x495424 = _0x5bd42a, _0x204447 = _0x458deb[0], { p2p: _0xe1d071, ..._0x2704f8 } = _0x204447 ?? {}, _0x4bc75d = new HlsJsP2PEngine(_0xe1d071);
super({ ..._0x2704f8, ..._0x4bc75d[_0x495424(413)]() });
__privateAdd(this, _p2pEngine);
_0x4bc75d["bindHls"](this), __privateSet(this, _p2pEngine, _0x4bc75d), (_a3 = _0xe1d071 == null ? void 0 : _0xe1d071[_0x495424(408)]) == null ? void 0 : _a3.call(_0xe1d071, this);
}
get [_0x5bd42a(415)]() {
return __privateGet(this, _p2pEngine);
}
}, _p2pEngine = new WeakMap(), _a2;
}
const _0x31dc11 = _0x237d;
(function(_0x53eba6, _0x1ad7a2) {
const _0x56d503 = _0x237d, _0x20eeff = _0x53eba6();
while (!![]) {
try {
const _0x278a2d = parseInt(_0x56d503(152)) / 1 * (-parseInt(_0x56d503(105)) / 2) + parseInt(_0x56d503(161)) / 3 + -parseInt(_0x56d503(141)) / 4 + parseInt(_0x56d503(122)) / 5 + -parseInt(_0x56d503(165)) / 6 + parseInt(_0x56d503(142)) / 7 + parseInt(_0x56d503(135)) / 8;
if (_0x278a2d === _0x1ad7a2) break;
else _0x20eeff["push"](_0x20eeff["shift"]());
} catch (_0x1a914a) {
_0x20eeff["push"](_0x20eeff["shift"]());
}
}
})(_0x13ed, 392742);
function _0x237d(_0x131b4b, _0x10d8b1) {
const _0x13ed85 = _0x13ed();
return _0x237d = function(_0x237d9d, _0x121f40) {
_0x237d9d = _0x237d9d - 103;
let _0x282b77 = _0x13ed85[_0x237d9d];
return _0x282b77;
}, _0x237d(_0x131b4b, _0x10d8b1);
}
const MAX_LIVE_SYNC_DURATION = 120;
class HlsJsP2PEngine {
constructor(_0x246763) {
__publicField(this, _Ua);
__publicField(this, _Ta);
__publicField(this, _Sa);
__publicField(this, _Ra);
__publicField(this, _Qa, browserExports.debug(_0x31dc11(111)));
__publicField(this, "updateMediaElementEventHandlers", (_0x3bf2bd) => {
var _a2;
const _0x4f7ecf = _0x31dc11, _0x56261e = (_a2 = this["currentHlsInstance"]) == null ? void 0 : _a2["media"];
if (!_0x56261e) return;
const _0x19da96 = _0x3bf2bd === _0x4f7ecf(169) ? _0x4f7ecf(107) : _0x4f7ecf(153);
_0x56261e[_0x19da96](_0x4f7ecf(118), this["handlePlaybackUpdate"]), _0x56261e[_0x19da96](_0x4f7ecf(129), this["handlePlaybackUpdate"]), _0x56261e[_0x19da96](_0x4f7ecf(163), this[_0x4f7ecf(136)]);
});
__publicField(this, "handleManifestLoaded", (_0x20d707, _0x318dda) => {
const _0x43b6d4 = _0x31dc11, _0x3ee0ba = _0x318dda["networkDetails"];
if (_0x3ee0ba instanceof XMLHttpRequest) this[_0x43b6d4(104)][_0x43b6d4(157)](_0x3ee0ba[_0x43b6d4(108)]);
else _0x3ee0ba instanceof Response && this[_0x43b6d4(104)]["setManifestResponseUrl"](_0x3ee0ba["url"]);
this["segmentManager"][_0x43b6d4(134)](_0x318dda);
});
__publicField(this, _Pa, (_0x11f5f1, _0x413ed8) => {
const _0x5a01e7 = _0x31dc11;
if (_0x413ed8[_0x5a01e7(146)]) this[_0x5a01e7(104)][_0x5a01e7(151)](_0x413ed8[_0x5a01e7(146)]);
});
__publicField(this, "handleLevelUpdated", (_0x45809c, _0x4996bd) => {
const _0x58b888 = _0x31dc11;
this["currentHlsInstance"] && _0x4996bd["details"]["live"] && _0x4996bd[_0x58b888(128)][_0x58b888(119)][0][_0x58b888(167)] === "main" && !this["currentHlsInstance"]["userConfig"][_0x58b888(120)] && !this["currentHlsInstance"][_0x58b888(139)][_0x58b888(132)] && _0x4996bd[_0x58b888(128)][_0x58b888(119)][_0x58b888(143)] > 4 && this["updateLiveSyncDurationCount"](_0x4996bd), this[_0x58b888(104)][_0x58b888(115)](_0x4996bd["details"][_0x58b888(154)]), this[_0x58b888(150)][_0x58b888(159)](_0x4996bd);
});
__publicField(this, _Oa, () => {
const _0x100d29 = _0x31dc11;
this["updateMediaElementEventHandlers"](_0x100d29(169));
});
__publicField(this, _Na, () => {
const _0x37be0c = _0x31dc11;
this[_0x37be0c(145)](_0x37be0c(124));
});
__publicField(this, _Ma, (_0x4ae76b) => {
const _0x4bcd2e = _0x31dc11, _0x4d000a = _0x4ae76b[_0x4bcd2e(131)];
this[_0x4bcd2e(104)][_0x4bcd2e(156)](_0x4d000a[_0x4bcd2e(172)], _0x4d000a[_0x4bcd2e(170)]);
});
__publicField(this, "destroyCore", () => this[_0x31dc11(104)][_0x31dc11(133)]());
__publicField(this, _La, () => {
const _0x4cf3ec = _0x31dc11;
this["destroyCore"](), this[_0x4cf3ec(112)](_0x4cf3ec(124)), this[_0x4cf3ec(145)](_0x4cf3ec(124)), this[_0x4cf3ec(123)] = void 0;
});
const _0x82e9b8 = _0x31dc11;
this[_0x82e9b8(104)] = new Core(_0x246763 == null ? void 0 : _0x246763[_0x82e9b8(104)]), this["segmentManager"] = new SegmentManager(this["core"]);
}
static [(_Ua = _0x31dc11(104), _Ta = _0x31dc11(150), _Sa = _0x31dc11(138), _Ra = _0x31dc11(123), _Qa = _0x31dc11(103), _0x31dc11(164))](_0x11043d) {
return injectMixin(_0x11043d);
}
["addEventListener"](_0x6bb7c2, _0x13f85f) {
const _0x391b81 = _0x31dc11;
this[_0x391b81(104)][_0x391b81(107)](_0x6bb7c2, _0x13f85f);
}
[_0x31dc11(153)](_0x5f4465, _0x47ffed) {
const _0x4f8df5 = _0x31dc11;
this[_0x4f8df5(104)][_0x4f8df5(153)](_0x5f4465, _0x47ffed);
}
["getConfigForHlsJs"]() {
const _0x5ee104 = _0x31dc11;
return { "fLoader": this[_0x5ee104(130)](), "pLoader": this[_0x5ee104(144)]() };
}
["getConfig"]() {
const _0x1b3d24 = _0x31dc11;
return { "core": this[_0x1b3d24(104)][_0x1b3d24(147)]() };
}
[_0x31dc11(162)](_0x5e087d) {
const _0x35aada = _0x31dc11;
if (_0x5e087d[_0x35aada(104)]) this[_0x35aada(104)][_0x35aada(162)](_0x5e087d[_0x35aada(104)]);
}
[_0x31dc11(158)](_0x57a8fb) {
const _0x3b911f = _0x31dc11;
this[_0x3b911f(138)] = typeof _0x57a8fb === "function" ? _0x57a8fb : () => _0x57a8fb;
}
[_0x31dc11(109)]() {
var _a2;
const _0x4d074f = _0x31dc11, _0x51426a = (_a2 = this["hlsInstanceGetter"]) == null ? void 0 : _a2.call(this);
if (this[_0x4d074f(123)] === _0x51426a) return;
if (this[_0x4d074f(123)]) this[_0x4d074f(133)]();
this[_0x4d074f(123)] = _0x51426a, this[_0x4d074f(112)]("register"), this[_0x4d074f(145)]("register");
}
[_0x31dc11(112)](_0x5a051f) {
const _0x12d324 = _0x31dc11, _0x383f7a = this["currentHlsInstance"];
if (!_0x383f7a) return;
const _0x3a42b6 = _0x5a051f === "register" ? "on" : "off";
_0x383f7a[_0x3a42b6](_0x12d324(126), this[_0x12d324(166)]), _0x383f7a[_0x3a42b6](_0x12d324(168), this[_0x12d324(171)]), _0x383f7a[_0x3a42b6](_0x12d324(121), this[_0x12d324(155)]), _0x383f7a[_0x3a42b6](_0x12d324(114), this[_0x12d324(155)]), _0x383f7a[_0x3a42b6]("hlsDestroying", this["destroy"]), _0x383f7a[_0x3a42b6](_0x12d324(149), this[_0x12d324(125)]), _0x383f7a[_0x3a42b6](_0x12d324(137), this[_0x12d324(125)]), _0x383f7a[_0x3a42b6](_0x12d324(106), this[_0x12d324(127)]), _0x383f7a[_0x3a42b6](_0x12d324(140), this["handleMediaAttached"]);
}
["updateLiveSyncDurationCount"](_0x1d574d) {
const _0x591da6 = _0x31dc11, _0x2ed18e = _0x1d574d[_0x591da6(128)][_0x591da6(113)], _0x3f8c50 = Math[_0x591da6(117)](MAX_LIVE_SYNC_DURATION / _0x2ed18e), _0x484adb = Math["min"](_0x1d574d[_0x591da6(128)][_0x591da6(119)][_0x591da6(143)] - 1, _0x3f8c50);
this[_0x591da6(123)] && this["currentHlsInstance"]["config"][_0x591da6(132)] !== _0x484adb && (this[_0x591da6(103)](_0x591da6(148) + _0x484adb), this["currentHlsInstance"][_0x591da6(116)][_0x591da6(132)] = _0x484adb);
}
[(_Pa = _0x31dc11(171), _Oa = _0x31dc11(110), _Na = _0x31dc11(127), _Ma = _0x31dc11(136), _La = _0x31dc11(133), _0x31dc11(130))]() {
const _0x15b2f8 = _0x31dc11, { core: _0x823541 } = this, _0x2d01b5 = this;
return class _0x12ed47 extends FragmentLoaderBase {
constructor(_0x28b89a) {
super(_0x28b89a, _0x823541);
}
static [_0x15b2f8(160)]() {
return _0x2d01b5;
}
};
}
["createPlaylistLoaderClass"]() {
const _0xbf8f40 = this;
return class _0x1a5dfd extends PlaylistLoaderBase {
constructor(_0x301541) {
const _0x3c6954 = _0x237d;
super(_0x301541), _0xbf8f40[_0x3c6954(109)]();
}
};
}
}
function _0x13ed() {
const _0x1509a9 = ["unregister", "destroyCore", "hlsManifestLoaded", "handleMediaDetached", "details", "seeking", "createFragmentLoaderClass", "target", "liveSyncDurationCount", "destroy", "processMainManifest", "1658824qhwjAa", "handlePlaybackUpdate", "hlsManifestLoading", "hlsInstanceGetter", "userConfig", "hlsMediaAttached", "863040IAHdwd", "2930361EXEpuj", "length", "createPlaylistLoaderClass", "updateMediaElementEventHandlers", "bitrate", "getConfig", "Setting liveSyncDurationCount to ", "hlsMediaAttaching", "segmentManager", "setActiveLevelBitrate", "1ZqrGLf", "removeEventListener", "live", "handleLevelUpdated", "updatePlayback", "setManifestResponseUrl", "bindHls", "updatePlaylist", "getEngine", "1956297LaZMfy", "applyDynamicConfig", "ratechange", "injectMixin", "4162836lCpGer", "handleManifestLoaded", "type", "hlsLevelSwitching", "register", "playbackRate", "handleLevelSwitching", "currentTime", "debug", "core", "1042552WtzSCB", "hlsMediaDetached", "addEventListener", "responseURL", "initHlsEvents", "handleMediaAttached", "swarm-viewer:engine", "updateHlsEventsHandlers", "targetduration", "hlsAudioTrackLoaded", "setIsLive", "config", "floor", "timeupdate", "fragments", "liveSyncDuration", "hlsLevelUpdated", "2727545kAeMlr", "currentHlsInstance"];
_0x13ed = function() {
return _0x1509a9;
};
return _0x13ed();
}
(function(_0x25d1db, _0x5955b0) {
var _0x1a6efe = _0x5c57, _0x2979fa = _0x25d1db();
while (!![]) {
try {
var _0x2a1808 = parseInt(_0x1a6efe(129)) / 1 + -parseInt(_0x1a6efe(130)) / 2 * (parseInt(_0x1a6efe(127)) / 3) + -parseInt(_0x1a6efe(132)) / 4 * (parseInt(_0x1a6efe(135)) / 5) + -parseInt(_0x1a6efe(128)) / 6 * (parseInt(_0x1a6efe(131)) / 7) + parseInt(_0x1a6efe(136)) / 8 * (-parseInt(_0x1a6efe(134)) / 9) + parseInt(_0x1a6efe(133)) / 10 + parseInt(_0x1a6efe(126)) / 11;
if (_0x2a1808 === _0x5955b0) break;
else _0x2979fa["push"](_0x2979fa["shift"]());
} catch (_0x18ebc5) {
_0x2979fa["push"](_0x2979fa["shift"]());
}
}
})(_0x4882, 552845);
function _0x4882() {
var _0x230dc0 = ["160074hhnTMJ", "75nhwBfj", "88mUmErs", "24536578cBlLlT", "1587lvnBVq", "78AXmFAu", "101094dkxyFh", "1198TQramp", "356503oSyiKK", "232468nRZUMK", "2675020BvlRZA"];
_0x4882 = function() {
return _0x230dc0;
};
return _0x4882();
}
function _0x5c57(_0x4f2825, _0x494668) {
var _0x488277 = _0x4882();
return _0x5c57 = function(_0x5c577b, _0x24f2b7) {
_0x5c577b = _0x5c577b - 126;
var _0x4a59cc = _0x488277[_0x5c577b];
return _0x4a59cc;
}, _0x5c57(_0x4f2825, _0x494668);
}
export {
HlsJsP2PEngine,
index as core
};