UNPKG

swarm-video-viewer

Version:

Swarm video viewer for any player

4,683 lines 218 kB
var Ia = Object.defineProperty;
var Qs = (n) => {
  throw TypeError(n);
};
var va = (n, t, e) => t in n ? Ia(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
var f = (n, t, e) => va(n, typeof t != "symbol" ? t + "" : t, e), Ze = (n, t, e) => t.has(n) || Qs("Cannot " + e);
var M = (n, t, e) => (Ze(n, t, "read from private field"), e ? e.call(n) : t.get(n)), it = (n, t, e) => t.has(n) ? Qs("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), ot = (n, t, e, s) => (Ze(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e), de = (n, t, e) => (Ze(n, t, "access private method"), e);
function bn(n, t) {
  var e = wn();
  return (bn = function(s, r) {
    return e[s -= 239];
  })(n, t);
}
function wn() {
  var n = ["92085sQFAGS", "end", "5531496RItRVT", "115668NleMyz", "3895976lHQevU", "3MKpEUI", "1936244aSNsgb", "441YgixvN", "44nKjRMd", "start", "67130IxZFmc", "1KONSju", "1181042hfFqBK", "84oPweOA"];
  return (wn = function() {
    return n;
  })();
}
(function() {
  for (var n = bn, t = wn(); ; ) try {
    if (-parseInt(n(245)) / 1 * (-parseInt(n(246)) / 2) + -parseInt(n(239)) / 3 * (-parseInt(n(240)) / 4) + -parseInt(n(248)) / 5 * (-parseInt(n(247)) / 6) + parseInt(n(251)) / 7 + parseInt(n(252)) / 8 + -parseInt(n(241)) / 9 * (-parseInt(n(244)) / 10) + parseInt(n(242)) / 11 * (-parseInt(n(250)) / 12) === 321046) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
const ve = Object.freeze(Object.defineProperty({ __proto__: null, getByteRange: function(n, t) {
  if (n !== void 0 && t !== void 0 && n <= t) return { start: n, end: t };
}, getSegmentRuntimeId: function(n, t) {
  var e = bn;
  return t ? n + "|" + t[e(243)] + "-" + t[e(249)] : n;
} }, Symbol.toStringTag, { value: "Module" }));
(function() {
  for (var n = Le, t = In(); ; ) try {
    if (-parseInt(n(190)) / 1 * (-parseInt(n(188)) / 2) + parseInt(n(180)) / 3 + parseInt(n(187)) / 4 + parseInt(n(186)) / 5 * (parseInt(n(184)) / 6) + -parseInt(n(181)) / 7 * (parseInt(n(183)) / 8) + parseInt(n(179)) / 9 + -parseInt(n(182)) / 10 === 946228) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
class V extends Error {
  constructor(e, s) {
    var r = Le;
    super(s);
    f(this, "timestamp");
    this.type = e, this.timestamp = performance[r(185)]();
  }
}
function In() {
  var n = ["1405323mZoMyr", "2823129sEwXpO", "5067874Plstes", "29420280bGAAZK", "8aDfADR", "31116aPABuy", "now", "1645BsJYOK", "1075124uLqxjE", "3080146gCUQYo", "type", "1eEamCg"];
  return (In = function() {
    return n;
  })();
}
function Le(n, t) {
  var e = In();
  return (Le = function(s, r) {
    return e[s -= 179];
  })(n, t);
}
class te extends Error {
  constructor(t) {
    var e = Le;
    super(), this[e(189)] = t;
  }
}
const at = Oe;
function Oe(n, t) {
  const e = vn();
  return (Oe = function(s, r) {
    return e[s -= 287];
  })(n, t);
}
(function() {
  const n = Oe, t = vn();
  for (; ; ) try {
    if (-parseInt(n(338)) / 1 * (parseInt(n(299)) / 2) + -parseInt(n(326)) / 3 * (parseInt(n(307)) / 4) + -parseInt(n(306)) / 5 * (parseInt(n(311)) / 6) + -parseInt(n(295)) / 7 * (-parseInt(n(316)) / 8) + -parseInt(n(302)) / 9 * (-parseInt(n(289)) / 10) + parseInt(n(297)) / 11 + parseInt(n(328)) / 12 === 583741) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
var Lr, Or, Mr;
class Ca {
  constructor(t, e, s) {
    f(this, "requestControls");
    f(this, Mr, new AbortController());
    f(this, Or);
    f(this, "requestByteRange");
    f(this, Lr);
    const r = Oe;
    this[r(346)] = t, this[r(339)] = e, this[r(323)] = s[r(293)](r(323));
    const { byteRange: i } = this[r(346)][r(327)];
    i && (this[r(324)] = { ...i }), t.loadedBytes !== 0 && (this[r(324)] = this[r(324)] ?? { start: 0 }, this[r(324)].start = this.requestByteRange[r(317)] + t[r(345)]), this[r(346)][r(287)] && (this[r(312)] = this[r(346)][r(287)] - this[r(346)].loadedBytes), this[r(334)] = this[r(346)][r(317)]({ downloadSource: "http" }, { abort: () => this[r(300)][r(332)](r(332)), notReceivingBytesTimeoutMs: this[r(339)][r(308)] }), this.fetch();
  }
  async [(Mr = at(300), Or = at(312), Lr = at(323), at(335))]() {
    var s, r, i, o;
    const t = at, { segment: e } = this[t(346)];
    try {
      let a = await ((r = (s = this.httpConfig).httpRequestSetup) == null ? void 0 : r.call(s, e.url, e[t(337)], this[t(300)][t(294)], this[t(324)]));
      if (!a) {
        const l = new Headers(this[t(324)] ? { Range: t(341) + this.requestByteRange[t(317)] + "-" + (this[t(324)][t(304)] ?? "") } : void 0);
        a = new Request(e[t(344)], { headers: l, signal: this.abortController[t(294)] });
      }
      if (this[t(300)][t(294)][t(291)]) throw new DOMException(t(305), t(292));
      const h = await window[t(335)](a);
      if (this[t(330)](h), !h[t(298)]) return;
      const { requestControls: d } = this;
      d[t(313)]();
      const u = h.body[t(331)]();
      for await (const l of async function* (m) {
        for (; ; ) {
          const { done: v, value: w } = await m.read();
          if (v) break;
          yield w;
        }
      }(u)) this[t(334)][t(303)](l), this.onChunkDownloaded(l.byteLength, t(342));
      if (!(await ((o = (i = this[t(339)])[t(290)]) == null ? void 0 : o.call(i, e.url, e[t(337)], this[t(346)][t(340)])) ?? !0)) throw this[t(346)][t(315)](), new V(t(319));
      d[t(336)]();
    } catch (a) {
      this[t(314)](a);
    }
  }
  [at(330)](t) {
    const e = at;
    if (!t.ok) throw t[e(301)] === 406 ? (this[e(346)][e(315)](), new V(e(321), t.statusText)) : new V(e(288), t[e(309)]);
    const { requestByteRange: s } = this;
    if (s) if (t[e(301)] === 200) {
      if (this[e(346)][e(327)][e(337)]) throw new V("http-unexpected-status-code");
      this[e(346)].clearLoadedBytes();
    } else {
      if (t[e(301)] !== 206) throw new V(e(322), t[e(309)]);
      const r = t[e(318)][e(320)](e(333));
      if (r && this[e(312)] !== void 0 && this[e(312)] !== +r) throw this.request.clearLoadedBytes(), new V("http-bytes-mismatch", t[e(309)]);
      const i = t.headers.get(e(343)), o = i ? function(a) {
        const h = ka[at(329)](a.trim());
        if (!h) return;
        const [, d, u, l] = h;
        return { from: d ? parseInt(d) : void 0, to: u ? parseInt(u) : void 0, total: l ? parseInt(l) : void 0 };
      }(i) : void 0;
      if (o) {
        const { from: a, to: h } = o, d = h !== void 0 && a !== void 0 ? h - a + 1 : void 0;
        if (d !== void 0 && this[e(312)] !== d || a !== void 0 && s[e(317)] !== a || h !== void 0 && s[e(304)] !== void 0 && s[e(304)] !== h) throw this[e(346)].clearLoadedBytes(), new V(e(321), t[e(309)]);
      }
    }
    if (t[e(301)] === 200 && this.request[e(287)] === void 0) {
      const r = t.headers.get(e(333));
      r && this[e(346)][e(310)](+r);
    }
  }
  [at(314)](t) {
    const e = at;
    if (t instanceof Error) {
      if (t[e(325)] !== "abort") return;
      const s = t instanceof V ? t : new V(e(288), t[e(296)]);
      this[e(334)].abortOnError(s);
    }
  }
}
const ka = /^bytes (?:(?:(\d+)|)-(?:(\d+)|)|\*)\/(?:(\d+)|\*)$/;
function vn() {
  const n = ["get", "http-bytes-mismatch", "http-unexpected-status-code", "onChunkDownloaded", "requestByteRange", "name", "1527rQMhRP", "segment", "5177664IcStMx", "exec", "handleResponseHeaders", "getReader", "abort", "Content-Length", "requestControls", "fetch", "completeOnSuccess", "byteRange", "992753wtSTfy", "httpConfig", "data", "bytes=", "http", "Content-Range", "url", "loadedBytes", "request", "totalBytes", "http-error", "10FdSgQA", "validateHTTPSegment", "aborted", "AbortError", "getEventDispatcher", "signal", "7050939QDDFSu", "message", "9454335tSeQkW", "body", "2ibVmHy", "abortController", "status", "3391641xLZIod", "addLoadedChunk", "end", "Request aborted before request fetch", "5LGCLQc", "6544hcGsNd", "httpNotReceivingBytesTimeoutMs", "statusText", "setTotalBytes", "1595190hfCFwE", "expectedBytesLength", "firstBytesReceived", "handleError", "clearLoadedBytes", "8cBSJyC", "start", "headers", "http-segment-validation-failed"];
  return (vn = function() {
    return n;
  })();
}
function Cn() {
  var n = ["constructor", "180207QNRxsi", "keys", "4uILBlJ", "default", "prototype", "construct", "3805foQIAV", "length", "473576YMPiEJ", "126vuyabj", "function", "1266622TPeJUe", "defineProperty", "1021361SvIIZJ", "forEach", "call", "1391596NQTopE", "get", "474aBvHdX", "__esModule", "1dKTMOK", "100oYmURL", "6286440JPNMQc", "undefined", "hasOwnProperty", "apply"];
  return (Cn = function() {
    return n;
  })();
}
var Xt = kn;
(function() {
  for (var n = kn, t = Cn(); ; ) try {
    if (parseInt(n(173)) / 1 * (-parseInt(n(169)) / 2) + -parseInt(n(180)) / 3 * (-parseInt(n(182)) / 4) + -parseInt(n(186)) / 5 * (-parseInt(n(171)) / 6) + -parseInt(n(191)) / 7 + -parseInt(n(188)) / 8 * (-parseInt(n(189)) / 9) + parseInt(n(174)) / 10 * (parseInt(n(193)) / 11) + -parseInt(n(175)) / 12 === 476842) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
var xa = typeof globalThis !== Xt(176) ? globalThis : typeof window !== Xt(176) ? window : typeof global !== Xt(176) ? global : typeof self !== Xt(176) ? self : {};
function kn(n, t) {
  var e = Cn();
  return (kn = function(s, r) {
    return e[s -= 169];
  })(n, t);
}
function Bt(n) {
  var t = Xt;
  return n && n[t(172)] && Object[t(184)][t(177)][t(195)](n, t(183)) ? n[t(183)] : n;
}
var Js, Ys, Gs, Xs, Ks, $e = { exports: {} };
function Ta() {
  if (Ys) return Js;
  Ys = 1;
  var n = 1e3, t = 60 * n, e = 60 * t, s = 24 * e, r = 7 * s, i = 365.25 * s;
  function o(a, h, d, u) {
    var l = h >= 1.5 * d;
    return Math.round(a / d) + " " + u + (l ? "s" : "");
  }
  return Js = function(a, h) {
    h = h || {};
    var d = typeof a;
    if (d === "string" && a.length > 0) return function(u) {
      if (!((u = String(u)).length > 100)) {
        var l = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);
        if (l) {
          var m = parseFloat(l[1]);
          switch ((l[2] || "ms").toLowerCase()) {
            case "years":
            case "year":
            case "yrs":
            case "yr":
            case "y":
              return m * i;
            case "weeks":
            case "week":
            case "w":
              return m * r;
            case "days":
            case "day":
            case "d":
              return m * s;
            case "hours":
            case "hour":
            case "hrs":
            case "hr":
            case "h":
              return m * e;
            case "minutes":
            case "minute":
            case "mins":
            case "min":
            case "m":
              return m * t;
            case "seconds":
            case "second":
            case "secs":
            case "sec":
            case "s":
              return m * n;
            case "milliseconds":
            case "millisecond":
            case "msecs":
            case "msec":
            case "ms":
              return m;
            default:
              return;
          }
        }
      }
    }(a);
    if (d === "number" && isFinite(a)) return h.long ? function(u) {
      var l = Math.abs(u);
      return l >= s ? o(u, l, s, "day") : l >= e ? o(u, l, e, "hour") : l >= t ? o(u, l, t, "minute") : l >= n ? o(u, l, n, "second") : u + " ms";
    }(a) : function(u) {
      var l = Math.abs(u);
      return l >= s ? Math.round(u / s) + "d" : l >= e ? Math.round(u / e) + "h" : l >= t ? Math.round(u / t) + "m" : l >= n ? Math.round(u / n) + "s" : u + "ms";
    }(a);
    throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(a));
  };
}
var xn = (Ks || (Ks = 1, function(n, t) {
  t.formatArgs = function(s) {
    if (s[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + s[0] + (this.useColors ? "%c " : " ") + "+" + n.exports.humanize(this.diff), !this.useColors) return;
    const r = "color: " + this.color;
    s.splice(1, 0, r, "color: inherit");
    let i = 0, o = 0;
    s[0].replace(/%[a-zA-Z%]/g, (a) => {
      a !== "%%" && (i++, a === "%c" && (o = i));
    }), s.splice(o, 0, r);
  }, t.save = function(s) {
    try {
      s ? t.storage.setItem("debug", s) : t.storage.removeItem("debug");
    } catch {
    }
  }, t.load = function() {
    let s;
    try {
      s = t.storage.getItem("debug") || t.storage.getItem("DEBUG");
    } catch {
    }
    return !s && typeof process < "u" && "env" in process && (s = process.env.DEBUG), s;
  }, t.useColors = function() {
    if (typeof window < "u" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) return !0;
    if (typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return !1;
    let s;
    return typeof document < "u" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window < "u" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator < "u" && navigator.userAgent && (s = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(s[1], 10) >= 31 || typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
  }, t.storage = function() {
    try {
      return localStorage;
    } catch {
    }
  }(), t.destroy = /* @__PURE__ */ (() => {
    let s = !1;
    return () => {
      s || (s = !0, console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."));
    };
  })(), t.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"], t.log = console.debug || console.log || (() => {
  }), n.exports = (Xs || (Xs = 1, Gs = function(s) {
    function r(a) {
      let h, d, u, l = null;
      function m(...v) {
        if (!m.enabled) return;
        const w = m, y = Number(/* @__PURE__ */ new Date()), g = y - (h || y);
        w.diff = g, w.prev = h, w.curr = y, h = y, v[0] = r.coerce(v[0]), typeof v[0] != "string" && v.unshift("%O");
        let p = 0;
        v[0] = v[0].replace(/%([a-zA-Z%])/g, (_, S) => {
          if (_ === "%%") return "%";
          p++;
          const I = r.formatters[S];
          if (typeof I == "function") {
            const H = v[p];
            _ = I.call(w, H), v.splice(p, 1), p--;
          }
          return _;
        }), r.formatArgs.call(w, v), (w.log || r.log).apply(w, v);
      }
      return m.namespace = a, m.useColors = r.useColors(), m.color = r.selectColor(a), m.extend = i, m.destroy = r.destroy, Object.defineProperty(m, "enabled", { enumerable: !0, configurable: !1, get: () => l !== null ? l : (d !== r.namespaces && (d = r.namespaces, u = r.enabled(a)), u), set: (v) => {
        l = v;
      } }), typeof r.init == "function" && r.init(m), m;
    }
    function i(a, h) {
      const d = r(this.namespace + (h === void 0 ? ":" : h) + a);
      return d.log = this.log, d;
    }
    function o(a, h) {
      let d = 0, u = 0, l = -1, m = 0;
      for (; d < a.length; ) if (u < h.length && (h[u] === a[d] || h[u] === "*")) h[u] === "*" ? (l = u, m = d, u++) : (d++, u++);
      else {
        if (l === -1) return !1;
        u = l + 1, m++, d = m;
      }
      for (; u < h.length && h[u] === "*"; ) u++;
      return u === h.length;
    }
    return r.debug = r, r.default = r, r.coerce = function(a) {
      return a instanceof Error ? a.stack || a.message : a;
    }, r.disable = function() {
      const a = [...r.names, ...r.skips.map((h) => "-" + h)].join(",");
      return r.enable(""), a;
    }, r.enable = function(a) {
      r.save(a), r.namespaces = a, r.names = [], r.skips = [];
      const h = (typeof a == "string" ? a : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
      for (const d of h) d[0] === "-" ? r.skips.push(d.slice(1)) : r.names.push(d);
    }, r.enabled = function(a) {
      for (const h of r.skips) if (o(a, h)) return !1;
      for (const h of r.names) if (o(a, h)) return !0;
      return !1;
    }, r.humanize = Ta(), r.destroy = function() {
      console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
    }, Object.keys(s).forEach((a) => {
      r[a] = s[a];
    }), r.names = [], r.skips = [], r.formatters = {}, r.selectColor = function(a) {
      let h = 0;
      for (let d = 0; d < a.length; d++) h = (h << 5) - h + a.charCodeAt(d), h |= 0;
      return r.colors[Math.abs(h) % r.colors.length];
    }, r.enable(r.load()), r;
  }), Gs)(t);
  const { formatters: e } = n.exports;
  e.j = function(s) {
    try {
      return JSON.stringify(s);
    } catch (r) {
      return "[UnexpectedJSONParseError]: " + r.message;
    }
  };
}($e, $e.exports)), $e.exports);
const ut = Bt(xn);
var Vs, Zs = { exports: {} };
function Bo() {
  return Vs || (Vs = 1, function(n) {
    var t = Object.prototype.hasOwnProperty, e = "~";
    function s() {
    }
    function r(h, d, u) {
      this.fn = h, this.context = d, this.once = u || !1;
    }
    function i(h, d, u, l, m) {
      if (typeof u != "function") throw new TypeError("The listener must be a function");
      var v = new r(u, l || h, m), w = e ? e + d : d;
      return h._events[w] ? h._events[w].fn ? h._events[w] = [h._events[w], v] : h._events[w].push(v) : (h._events[w] = v, h._eventsCount++), h;
    }
    function o(h, d) {
      --h._eventsCount === 0 ? h._events = new s() : delete h._events[d];
    }
    function a() {
      this._events = new s(), this._eventsCount = 0;
    }
    Object.create && (s.prototype = /* @__PURE__ */ Object.create(null), new s().__proto__ || (e = !1)), a.prototype.eventNames = function() {
      var h, d, u = [];
      if (this._eventsCount === 0) return u;
      for (d in h = this._events) t.call(h, d) && u.push(e ? d.slice(1) : d);
      return Object.getOwnPropertySymbols ? u.concat(Object.getOwnPropertySymbols(h)) : u;
    }, a.prototype.listeners = function(h) {
      var d = e ? e + h : h, u = this._events[d];
      if (!u) return [];
      if (u.fn) return [u.fn];
      for (var l = 0, m = u.length, v = new Array(m); l < m; l++) v[l] = u[l].fn;
      return v;
    }, a.prototype.listenerCount = function(h) {
      var d = e ? e + h : h, u = this._events[d];
      return u ? u.fn ? 1 : u.length : 0;
    }, a.prototype.emit = function(h, d, u, l, m, v) {
      var w = e ? e + h : h;
      if (!this._events[w]) return !1;
      var y, g, p = this._events[w], _ = arguments.length;
      if (p.fn) {
        switch (p.once && this.removeListener(h, p.fn, void 0, !0), _) {
          case 1:
            return p.fn.call(p.context), !0;
          case 2:
            return p.fn.call(p.context, d), !0;
          case 3:
            return p.fn.call(p.context, d, u), !0;
          case 4:
            return p.fn.call(p.context, d, u, l), !0;
          case 5:
            return p.fn.call(p.context, d, u, l, m), !0;
          case 6:
            return p.fn.call(p.context, d, u, l, m, v), !0;
        }
        for (g = 1, y = new Array(_ - 1); g < _; g++) y[g - 1] = arguments[g];
        p.fn.apply(p.context, y);
      } else {
        var S, I = p.length;
        for (g = 0; g < I; g++) switch (p[g].once && this.removeListener(h, p[g].fn, void 0, !0), _) {
          case 1:
            p[g].fn.call(p[g].context);
            break;
          case 2:
            p[g].fn.call(p[g].context, d);
            break;
          case 3:
            p[g].fn.call(p[g].context, d, u);
            break;
          case 4:
            p[g].fn.call(p[g].context, d, u, l);
            break;
          default:
            if (!y) for (S = 1, y = new Array(_ - 1); S < _; S++) y[S - 1] = arguments[S];
            p[g].fn.apply(p[g].context, y);
        }
      }
      return !0;
    }, a.prototype.on = function(h, d, u) {
      return i(this, h, d, u, !1);
    }, a.prototype.once = function(h, d, u) {
      return i(this, h, d, u, !0);
    }, a.prototype.removeListener = function(h, d, u, l) {
      var m = e ? e + h : h;
      if (!this._events[m]) return this;
      if (!d) return o(this, m), this;
      var v = this._events[m];
      if (v.fn) v.fn !== d || l && !v.once || u && v.context !== u || o(this, m);
      else {
        for (var w = 0, y = [], g = v.length; w < g; w++) (v[w].fn !== d || l && !v[w].once || u && v[w].context !== u) && y.push(v[w]);
        y.length ? this._events[m] = y.length === 1 ? y[0] : y : o(this, m);
      }
      return this;
    }, a.prototype.removeAllListeners = function(h) {
      var d;
      return h ? (d = e ? e + h : h, this._events[d] && o(this, d)) : (this._events = new s(), this._eventsCount = 0), this;
    }, a.prototype.off = a.prototype.removeListener, a.prototype.addListener = a.prototype.on, a.prefixed = e, a.EventEmitter = a, n.exports = a;
  }(Zs)), Zs.exports;
}
const No = Bt(Bo());
var $s, tr, er, le = { exports: {} }, Ea = function() {
  if (er) return le.exports;
  er = 1;
  var n = (tr || (tr = 1, $s = function s(r, i) {
    if (r && i) return s(r)(i);
    if (typeof r != "function") throw new TypeError("need wrapper function");
    return Object.keys(r).forEach(function(a) {
      o[a] = r[a];
    }), o;
    function o() {
      for (var a = new Array(arguments.length), h = 0; h < a.length; h++) a[h] = arguments[h];
      var d = r.apply(this, a), u = a[a.length - 1];
      return typeof d == "function" && d !== u && Object.keys(u).forEach(function(l) {
        d[l] = u[l];
      }), d;
    }
  }), $s);
  function t(s) {
    var r = function() {
      return r.called ? r.value : (r.called = !0, r.value = s.apply(this, arguments));
    };
    return r.called = !1, r;
  }
  function e(s) {
    var r = function() {
      if (r.called) throw new Error(r.onceError);
      return r.called = !0, r.value = s.apply(this, arguments);
    }, i = s.name || "Function wrapped with `once`";
    return r.onceError = i + " shouldn't be called more than once", r.called = !1, r;
  }
  return le.exports = n(t), le.exports.strict = n(e), t.proto = t(function() {
    Object.defineProperty(Function.prototype, "once", { value: function() {
      return t(this);
    }, configurable: !0 }), Object.defineProperty(Function.prototype, "onceStrict", { value: function() {
      return e(this);
    }, configurable: !0 });
  }), le.exports;
}();
const Aa = Bt(Ea);
var nr, sr, tn, rr;
function Do() {
  if (sr) return nr;
  let n;
  return sr = 1, nr = typeof queueMicrotask == "function" ? queueMicrotask.bind(typeof window < "u" ? window : xa) : (t) => (n || (n = Promise.resolve())).then(t).catch((e) => setTimeout(() => {
    throw e;
  }, 0));
}
var Ra = function() {
  if (rr) return tn;
  rr = 1, tn = function(t, e) {
    let s, r, i, o = !0;
    Array.isArray(t) ? (s = [], r = t.length) : (i = Object.keys(t), s = {}, r = i.length);
    function a(d) {
      function u() {
        e && e(d, s), e = null;
      }
      o ? n(u) : u();
    }
    function h(d, u, l) {
      s[d] = l, (--r === 0 || u) && a(u);
    }
    r ? i ? i.forEach(function(d) {
      t[d](function(u, l) {
        h(d, u, l);
      });
    }) : t.forEach(function(d, u) {
      d(function(l, m) {
        h(u, l, m);
      });
    }) : a(null), o = !1;
  };
  const n = Do();
  return tn;
}();
const Pa = Bt(Ra), bt = typeof window < "u" ? window : self, on = bt.RTCPeerConnection || bt.mozRTCPeerConnection || bt.webkitRTCPeerConnection, La = bt.RTCSessionDescription || bt.mozRTCSessionDescription || bt.webkitRTCSessionDescription, Oa = bt.RTCIceCandidate || bt.mozRTCIceCandidate || bt.webkitRTCIceCandidate;
var ir, or, ar, hr, cr, ur, dr, lr, pr, fr;
function Ma() {
  if (hr) return ar;
  hr = 1;
  const n = or ? ir : (or = 1, ir = class {
    constructor(t) {
      if (!(t > 0) || t - 1 & t) throw new Error("Max size for a FixedFIFO should be a power of two");
      this.buffer = new Array(t), this.mask = t - 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(t) {
      return this.buffer[this.top] === void 0 && (this.buffer[this.top] = t, this.top = this.top + 1 & this.mask, !0);
    }
    shift() {
      const t = this.buffer[this.btm];
      if (t !== void 0) return this.buffer[this.btm] = void 0, this.btm = this.btm + 1 & this.mask, t;
    }
    peek() {
      return this.buffer[this.btm];
    }
    isEmpty() {
      return this.buffer[this.btm] === void 0;
    }
  });
  return ar = class {
    constructor(t) {
      this.hwm = t || 16, this.head = new n(this.hwm), this.tail = this.head, this.length = 0;
    }
    clear() {
      this.head = this.tail, this.head.clear(), this.length = 0;
    }
    push(t) {
      if (this.length++, !this.head.push(t)) {
        const e = this.head;
        this.head = e.next = new n(2 * this.head.buffer.length), this.head.push(t);
      }
    }
    shift() {
      this.length !== 0 && this.length--;
      const t = this.tail.shift();
      if (t === void 0 && this.tail.next) {
        const e = this.tail.next;
        return this.tail.next = null, this.tail = e, this.tail.shift();
      }
      return t;
    }
    peek() {
      const t = this.tail.peek();
      return t === void 0 && this.tail.next ? this.tail.next.peek() : t;
    }
    isEmpty() {
      return this.length === 0;
    }
  };
}
function gr() {
  return ur ? cr : (ur = 1, cr = class {
    constructor(n) {
      this.decoder = new TextDecoder(n === "utf16le" ? "utf16-le" : n);
    }
    get remaining() {
      return -1;
    }
    decode(n) {
      return this.decoder.decode(n, { stream: !0 });
    }
    flush() {
      return this.decoder.decode(new Uint8Array(0));
    }
  });
}
function Ba() {
  if (lr) return dr;
  lr = 1;
  const n = gr(), t = gr();
  return dr = class {
    constructor(e = "utf8") {
      switch (this.encoding = function(s) {
        switch (s = s.toLowerCase()) {
          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 s;
          default:
            throw new Error("Unknown encoding: " + s);
        }
      }(e), this.encoding) {
        case "utf8":
          this.decoder = new t();
          break;
        case "utf16le":
        case "base64":
          throw new Error("Unsupported encoding: " + this.encoding);
        default:
          this.decoder = new n(this.encoding);
      }
    }
    get remaining() {
      return this.decoder.remaining;
    }
    push(e) {
      return typeof e == "string" ? e : this.decoder.decode(e);
    }
    write(e) {
      return this.push(e);
    }
    end(e) {
      let s = "";
      return e && (s = this.push(e)), s += this.decoder.flush(), s;
    }
  };
}
var mr, yr, Fo = function() {
  if (fr) return pr;
  fr = 1;
  const { EventEmitter: n } = Bo(), t = new Error("Stream was destroyed"), e = new Error("Premature close"), s = Ma(), r = Ba(), i = 536870911, o = 1 ^ i, a = 2 ^ i, h = 32, d = 64, u = 128, l = 256, m = 1024, v = 2048, w = 4096, y = 8192, g = 16384, p = 32768, _ = 131072, S = 131328, I = 16 ^ i, H = 536805375, oe = 768 ^ i, ae = 536838143, he = 536739839, Qe = 1 << 18, dt = 2 << 18, lt = 4 << 18, rt = 8 << 18, Nt = 16 << 18, wt = 32 << 18, pt = 64 << 18, zt = 128 << 18, sa = 256 << 18, As = 512 << 18, Rs = 1024 << 18, ra = 535822335, Ps = 503316479, Ls = 268435455, ce = 262160, ia = 536608751, Os = 8404992, Qt = 14, oa = 15, Ms = 8405006, Je = 33587200, Bs = 33587215, aa = 2359296, Ns = 270794767, ue = Symbol.asyncIterator || Symbol("asyncIterator");
  class Ds {
    constructor(c, { highWaterMark: b = 16384, map: T = null, mapWritable: R, byteLength: N, byteLengthWritable: F } = {}) {
      this.stream = c, this.queue = new s(), this.highWaterMark = b, this.buffered = 0, this.error = null, this.pipeline = null, this.drains = null, this.byteLength = F || N || Ws, this.map = R || T, this.afterWrite = pa.bind(this), this.afterUpdateNextTick = ma.bind(this);
    }
    get ended() {
      return (this.stream._duplexState & wt) !== 0;
    }
    push(c) {
      return !(142606350 & this.stream._duplexState) && (this.map !== null && (c = this.map(c)), this.buffered += this.byteLength(c), this.queue.push(c), this.buffered < this.highWaterMark ? (this.stream._duplexState |= rt, !0) : (this.stream._duplexState |= 6291456, !1));
    }
    shift() {
      const c = this.queue.shift();
      return this.buffered -= this.byteLength(c), this.buffered === 0 && (this.stream._duplexState &= 534773759), c;
    }
    end(c) {
      typeof c == "function" ? this.stream.once("finish", c) : c != null && this.push(c), this.stream._duplexState = (this.stream._duplexState | As) & ra;
    }
    autoBatch(c, b) {
      const T = [], R = this.stream;
      for (T.push(c); (R._duplexState & Ns) === aa; ) T.push(R._writableState.shift());
      if ((R._duplexState & oa) !== 0) return b(null);
      R._writev(T, b);
    }
    update() {
      const c = this.stream;
      c._duplexState |= dt;
      do {
        for (; (c._duplexState & Ns) === rt; ) {
          const b = this.shift();
          c._duplexState |= 67371008, c._write(b, this.afterWrite);
        }
        1310720 & c._duplexState || this.updateNonPrimary();
      } while (this.continueUpdate() === !0);
      c._duplexState &= 536346623;
    }
    updateNonPrimary() {
      const c = this.stream;
      if ((144965647 & c._duplexState) === As) return c._duplexState = c._duplexState | Qe, void c._final(la.bind(this));
      (c._duplexState & Qt) !== 4 ? (c._duplexState & Bs) === 1 && (c._duplexState = (c._duplexState | ce) & o, c._open(Us.bind(this))) : (c._duplexState & Je) === 0 && (c._duplexState |= ce, c._destroy(Fs.bind(this)));
    }
    continueUpdate() {
      return (this.stream._duplexState & zt) !== 0 && (this.stream._duplexState &= Ps, !0);
    }
    updateCallback() {
      (35127311 & this.stream._duplexState) === lt ? this.update() : this.updateNextTick();
    }
    updateNextTick() {
      (this.stream._duplexState & zt) === 0 && (this.stream._duplexState |= zt, (this.stream._duplexState & dt) === 0 && queueMicrotask(this.afterUpdateNextTick));
    }
  }
  class ha {
    constructor(c, { highWaterMark: b = 16384, map: T = null, mapReadable: R, byteLength: N, byteLengthReadable: F } = {}) {
      this.stream = c, this.queue = new s(), this.highWaterMark = b === 0 ? 1 : b, this.buffered = 0, this.readAhead = b > 0, this.error = null, this.pipeline = null, this.byteLength = F || N || Ws, this.map = R || T, this.pipeTo = null, this.afterRead = fa.bind(this), this.afterUpdateNextTick = ga.bind(this);
    }
    get ended() {
      return (this.stream._duplexState & g) !== 0;
    }
    pipe(c, b) {
      if (this.pipeTo !== null) throw new Error("Can only pipe to one destination");
      if (typeof b != "function" && (b = null), this.stream._duplexState |= 512, this.pipeTo = c, this.pipeline = new ua(this.stream, c, b), b && this.stream.on("error", zs), Yt(c)) c._writableState.pipeline = this.pipeline, b && c.on("error", zs), c.on("finish", this.pipeline.finished.bind(this.pipeline));
      else {
        const T = this.pipeline.done.bind(this.pipeline, c), R = this.pipeline.done.bind(this.pipeline, c, null);
        c.on("error", T), c.on("close", R), c.on("finish", this.pipeline.finished.bind(this.pipeline));
      }
      c.on("drain", da.bind(this)), this.stream.emit("piping", c), c.emit("pipe", this.stream);
    }
    push(c) {
      const b = this.stream;
      return c === null ? (this.highWaterMark = 0, b._duplexState = 536805311 & b._duplexState | 1024, !1) : this.map !== null && (c = this.map(c)) === null ? (b._duplexState &= H, this.buffered < this.highWaterMark) : (this.buffered += this.byteLength(c), this.queue.push(c), b._duplexState = (b._duplexState | u) & H, this.buffered < this.highWaterMark);
    }
    shift() {
      const c = this.queue.shift();
      return this.buffered -= this.byteLength(c), this.buffered === 0 && (this.stream._duplexState &= 536862591), c;
    }
    unshift(c) {
      const b = [this.map !== null ? this.map(c) : c];
      for (; this.buffered > 0; ) b.push(this.shift());
      for (let T = 0; T < b.length - 1; T++) {
        const R = b[T];
        this.buffered += this.byteLength(R), this.queue.push(R);
      }
      this.push(b[b.length - 1]);
    }
    read() {
      const c = this.stream;
      if ((16527 & c._duplexState) === u) {
        const b = this.shift();
        return this.pipeTo !== null && this.pipeTo.write(b) === !1 && (c._duplexState &= oe), (c._duplexState & v) !== 0 && c.emit("data", b), b;
      }
      return this.readAhead === !1 && (c._duplexState |= _, this.updateNextTick()), null;
    }
    drain() {
      const c = this.stream;
      for (; (16527 & c._duplexState) === u && 768 & c._duplexState; ) {
        const b = this.shift();
        this.pipeTo !== null && this.pipeTo.write(b) === !1 && (c._duplexState &= oe), (c._duplexState & v) !== 0 && c.emit("data", b);
      }
    }
    update() {
      const c = this.stream;
      c._duplexState |= h;
      do {
        for (this.drain(); this.buffered < this.highWaterMark && (214047 & c._duplexState) === _; ) c._duplexState |= 65552, c._read(this.afterRead), this.drain();
        (12431 & c._duplexState) == 4224 && (c._duplexState |= y, c.emit("readable")), 80 & c._duplexState || this.updateNonPrimary();
      } while (this.continueUpdate() === !0);
      c._duplexState &= 536870879;
    }
    updateNonPrimary() {
      const c = this.stream;
      (1167 & c._duplexState) === m && (c._duplexState = 536869887 & c._duplexState | 16384, c.emit("end"), (c._duplexState & Ms) === Os && (c._duplexState |= 4), this.pipeTo !== null && this.pipeTo.end()), (c._duplexState & Qt) !== 4 ? (c._duplexState & Bs) === 1 && (c._duplexState = (c._duplexState | ce) & o, c._open(Us.bind(this))) : (c._duplexState & Je) === 0 && (c._duplexState |= ce, c._destroy(Fs.bind(this)));
    }
    continueUpdate() {
      return (this.stream._duplexState & p) !== 0 && (this.stream._duplexState &= ae, !0);
    }
    updateCallback() {
      (32879 & this.stream._duplexState) === d ? this.update() : this.updateNextTick();
    }
    updateNextTickIfOpen() {
      32769 & this.stream._duplexState || (this.stream._duplexState |= p, (this.stream._duplexState & h) === 0 && queueMicrotask(this.afterUpdateNextTick));
    }
    updateNextTick() {
      (this.stream._duplexState & p) === 0 && (this.stream._duplexState |= p, (this.stream._duplexState & h) === 0 && queueMicrotask(this.afterUpdateNextTick));
    }
  }
  class ca {
    constructor(c) {
      this.data = null, this.afterTransform = ya.bind(c), this.afterFinal = null;
    }
  }
  class ua {
    constructor(c, b, T) {
      this.from = c, this.to = b, this.afterPipe = T, this.error = null, this.pipeToFinished = !1;
    }
    finished() {
      this.pipeToFinished = !0;
    }
    done(c, b) {
      b && (this.error = b), c !== this.to || (this.to = null, this.from === null) ? c !== this.from || (this.from = null, this.to === null) ? (this.afterPipe !== null && this.afterPipe(this.error), this.to = this.from = this.afterPipe = null) : (c._duplexState & g) === 0 && this.to.destroy(this.error || new Error("Readable stream closed before ending")) : (this.from._duplexState & g) !== 0 && this.pipeToFinished || this.from.destroy(this.error || new Error("Writable stream closed prematurely"));
    }
  }
  function da() {
    this.stream._duplexState |= 512, this.updateCallback();
  }
  function la(k) {
    const c = this.stream;
    k && c.destroy(k), (c._duplexState & Qt) === 0 && (c._duplexState |= wt, c.emit("finish")), (c._duplexState & Ms) === Os && (c._duplexState |= 4), c._duplexState &= 402391039, (c._duplexState & dt) === 0 ? this.update() : this.updateNextTick();
  }
  function Fs(k) {
    const c = this.stream;
    k || this.error === t || (k = this.error), k && c.emit("error", k), c._duplexState |= 8, c.emit("close");
    const b = c._readableState, T = c._writableState;
    if (b !== null && b.pipeline !== null && b.pipeline.done(c, k), T !== null) {
      for (; T.drains !== null && T.drains.length > 0; ) T.drains.shift().resolve(!1);
      T.pipeline !== null && T.pipeline.done(c, k);
    }
  }
  function pa(k) {
    const c = this.stream;
    k && c.destroy(k), c._duplexState &= 469499903, this.drains !== null && function(b) {
      for (let T = 0; T < b.length; T++) --b[T].writes === 0 && (b.shift().resolve(!0), T--);
    }(this.drains), (6553615 & c._duplexState) === Nt && (c._duplexState &= 532676607, (c._duplexState & pt) === pt && c.emit("drain")), this.updateCallback();
  }
  function fa(k) {
    k && this.stream.destroy(k), this.stream._duplexState &= I, this.readAhead === !1 && (this.stream._duplexState & l) === 0 && (this.stream._duplexState &= he), this.updateCallback();
  }
  function ga() {
    (this.stream._duplexState & h) === 0 && (this.stream._duplexState &= ae, this.update());
  }
  function ma() {
    (this.stream._duplexState & dt) === 0 && (this.stream._duplexState &= Ps, this.update());
  }
  function Us(k) {
    const c = this.stream;
    k && c.destroy(k), 4 & c._duplexState || (17423 & c._duplexState || (c._duplexState |= d), 142606351 & c._duplexState || (c._duplexState |= lt), c.emit("open")), c._duplexState &= ia, c._writableState !== null && c._writableState.updateCallback(), c._readableState !== null && c._readableState.updateCallback();
  }
  function ya(k, c) {
    c != null && this.push(c), this._writableState.afterWrite(k);
  }
  function _a(k) {
    this._readableState !== null && (k === "data" && (this._duplexState |= 133376, this._readableState.updateNextTick()), k === "readable" && (this._duplexState |= w, this._readableState.updateNextTick())), this._writableState !== null && k === "drain" && (this._duplexState |= pt, this._writableState.updateNextTick());
  }
  class Ye extends n {
    constructor(c) {
      super(), this._duplexState = 0, this._readableState = null, this._writableState = null, c && (c.open && (this._open = c.open), c.destroy && (this._destroy = c.destroy), c.predestroy && (this._predestroy = c.predestroy), c.signal && c.signal.addEventListener("abort", wa.bind(this))), this.on("newListener", _a);
    }
    _open(c) {
      c(null);
    }
    _destroy(c) {
      c(null);
    }
    _predestroy() {
    }
    get readable() {
      return this._readableState !== null || void 0;
    }
    get writable() {
      return this._writableState !== null || void 0;
    }
    get destroyed() {
      return !!(8 & this._duplexState);
    }
    get destroying() {
      return (this._duplexState & Qt) !== 0;
    }
    destroy(c) {
      (this._duplexState & Qt) === 0 && (c || (c = t), this._duplexState = 535822271 & this._duplexState | 4, this._readableState !== null && (this._readableState.highWaterMark = 0, this._readableState.error = c), this._writableState !== null && (this._writableState.highWaterMark = 0, this._writableState.error = c), this._duplexState |= 2, this._predestroy(), this._duplexState &= a, this._readableState !== null && this._readableState.updateNextTick(), this._writableState !== null && this._writableState.updateNextTick());
    }
  }
  class Jt extends Ye {
    constructor(c) {
      super(c), this._duplexState |= 8519681, this._readableState = new ha(this, c), c && (this._readableState.readAhead === !1 && (this._duplexState &= he), c.read && (this._read = c.read), c.eagerOpen && this._readableState.updateNextTick(), c.encoding && this.setEncoding(c.encoding));
    }
    setEncoding(c) {
      const b = new r(c), T = this._readableState.map || ba;
      return this._readableState.map = function(R) {
        const N = b.push(R);
        return N === "" && (R.byteLength !== 0 || b.remaining > 0) ? null : T(N);
      }, this;
    }
    _read(c) {
      c(null);
    }
    pipe(c, b) {
      return this._readableState.updateNextTick(), this._readableState.pipe(c, b), c;
    }
    read() {
      return this._readableState.updateNextTick(), this._readableState.read();
    }
    push(c) {
      return this._readableState.updateNextTickIfOpen(), this._readableState.push(c);
    }
    unshift(c) {
      return this._readableState.updateNextTickIfOpen(), this._readableState.unshift(c);
    }
    resume() {
      return this._duplexState |= S, this._readableState.updateNextTick(), this;
    }
    pause() {
      return this._duplexState &= this._readableState.readAhead === !1 ? 536739583 : 536870655, this;
    }
    static _fromAsyncIterator(c, b) {
      let T;
      const R = new Jt({ ...b, read(F) {
        c.next().then(N).then(F.bind(null, null)).catch(F);
      }, predestroy() {
        T = c.return();
      }, destroy(F) {
        if (!T) return F(null);
        T.then(F.bind(null, null)).catch(F);
      } });
      return R;
      function N(F) {
        F.done ? R.push(null) : R.push(F.value);
      }
    }
    static from(c, b) {
      if (Yt(T = c) && T.readable) return c;
      var T;
      if (c[ue]) return this._fromAsyncIterator(c[ue](), b);
      Array.isArray(c) || (c = c === void 0 ? [] : [c]);
      let R = 0;
      return new Jt({ ...b, read(N) {
        this.push(R === c.length ? null : c[R++]), N(null);
      } });
    }
    static isBackpressured(c) {
      return !!(17422 & c._duplexState) || c._readableState.buffered >= c._readableState.highWaterMark;
    }
    static isPaused(c) {
      return (c._duplexState & l) === 0;
    }
    [ue]() {
      const c = this;
      let b = null, T = null, R = null;
      return this.on("error", (Y) => {
        b = Y;
      }), this.on("readable", function() {
        T !== null && N(c.read());
      }), this.on("close", function() {
        T !== null && N(null);
      }), { [ue]() {
        return this;
      }, next: () => new Promise(function(Y, Et) {
        T = Y, R = Et;
        const U = c.read();
        U !== null ? N(U) : 8 & c._duplexState && N(null);
      }), return: () => F(null), throw: (Y) => F(Y) };
      function N(Y) {
        R !== null && (b ? R(b) : Y === null && (c._duplexState & g) === 0 ? R(t) : T({ value: Y, done: Y === null }), R = T = null);
      }
      function F(Y) {
        return c.destroy(Y), new Promise((Et, U) => {
          if (8 & c._duplexState) return Et({ value: void 0, done: !0 });
          c.once("close", function() {
            Y ? U(Y) : Et({ value: void 0, done: !0 });
          });
        });
      }
    }
  }
  class Ge extends Ye {
    constructor(c) {
      super(c), this._duplexState |= 16385, this._writableState = new Ds(this, c), c && (c.writev && (this._writev = c.writev), c.write && (this._write = c.write), c.final && (this._final = c.final), c.eagerOpen && this._writableState.updateNextTick());
    }
    cork() {
      this._duplexState |= Rs;
    }
    uncork() {
      this._duplexState &= Ls, this._writableState.updateNextTick();
    }
    _writev(c, b) {
      b(null);
    }
    _write(c, b) {
      this._writableState.autoBatch(c, b);
    }
    _final(c) {
      c(null);
    }
    static isBackpressured(c) {
      return !!(146800654 & c._duplexState);
    }
    static drained(c) {
      if (c.destroyed) return Promise.resolve(!1);
      const b = c._writableState;
      var T;
      const R = ((T = c)._writev !== Ge.prototype._writev && T._writev !== Xe.prototype._writev ? Math.min(1, b.queue.length) : b.queue.length) + (c._duplexState & sa ? 1 : 0);
      return R === 0 ? Promise.resolve(!0) : (b.drains === null && (b.drains = []), new Promise((N) => {
        b.drains.push({ writes: R, resolve: N });
      }));
    }
    write(c) {
      return this._writableState.updateNextTick(), this._writableState.push(c);
    }
    end(c) {
      return this._writableState.updateNextTick(), this._writableState.end(c), this;
    }
  }
  class Xe extends Jt {
    constructor(c) {
      super(c), this._duplexState = 1 | this._duplexState & _, this._writableState = new Ds(this, c), c && (c.writev && (this._writev = c.writev), c.write && (this._write = c.write), c.final && (this._final = c.final));
    }
    cork() {
      this._duplexState |= Rs;
    }
    uncork() {
      this._duplexState &= Ls, this._writableState.updateNextTick();
    }
    _writev(c, b) {
      b(null);
    }
    _write(c, b) {
      this._writableState.autoBatch(c, b);
    }
    _final(c) {
      c(null);
    }
    write(c) {
      return this._writableState.updateNextTick(), this._writableState.push(c);
    }
    end(c) {
      return this._writableState.updateNextTick(), this._writableState.end(c), this;
    }
  }
  class qs extends Xe {
    constructor(c) {
      super(c), this._transformState = new ca(this), c && (c.transform && (this._transform = c.transform), c.flush && (this._flush = c.flush));
    }
    _write(c, b) {
      this._readableState.buffered >= this._readableState.highWaterMark ? this._transformState.data = c : this._transform(c, this._transformState.afterTransform);
    }
    _read(c) {
      if (this._transformState.data !== null) {
        const b = this._transformState.data;
        this._transformState.data = null, c(null), this._transform(b, this._transformState.afterTransform);
      } else c(null);
    }
    destroy(c) {
      super.destroy(c), this._transformState.data !== null && (this._transformState.data = null, this._transformState.afterTransform());
    }
    _transform(c, b) {
      b(null, c);
    }
    _flush(c) {
      c(null);
    }
    _final(c) {
      this._transformState.afterFinal = c, this._flush(Sa.bind(this));
    }
  }
  function Sa(k, c) {
    const b = this._transformState.afterFinal;
    if (k) return b(k);
    c != null && this.push(c), this.push(null), b(null);
  }
  function js(k, ...c) {
    const b = Array.isArray(k) ? [...k, ...c] : [k, ...c], T = b.length && typeof b[b.length - 1] == "function" ? b.pop() : null;
    if (b.length < 2) throw new Error("Pipeline requires at least 2 streams");
    let R = b[0], N = null, F = null;
    for (let U = 1; U < b.length; U++) N = b[U], Yt(R) ? R.pipe(N, Et) : (Y(R, !0, U > 1, Et), R.pipe(N)), R = N;
    if (T) {
      let U = !1;
      const Gt = Yt(N) || !(!N._writableState || !N._writableState.autoDestroy);
      N.on("error", (Ke) => {
        F === null && (F = Ke);
      }), N.on("finish", () => {
        U = !0, Gt || T(F);
      }), Gt && N.on("close", () => T(F || (U ? null : e)));
    }
    return N;
    function Y(U, Gt, Ke, Ve) {
      U.on("error", Ve), U.on("close", function() {
        if (U._readableState && !U._readableState.ended || Ke && U._writableState && !U._writableState.ended) return Ve(e);
      });
    }
    function Et(U) {
      if (U && !F) {
        F = U;
        for (const Gt of b) Gt.destroy(U);
      }
    }
  }
  function ba(k) {
    return k;
  }
  function Hs(k) {
    return !!k._readableState || !!k._writableState;
  }
  function Yt(k) {
    return typeof k._duplexState == "number" && Hs(k);
  }
  function Ws(k) {
    return function(c) {
      return typeof c == "object" && c !== null && typeof c.byteLength == "number";
    }(k) ? k.byteLength : 1024;
  }
  function zs() {
  }
  function wa() {
    this.destroy(new Error("Stream aborted."));
  }
  return pr = { pipeline: js, pipelinePromise: function(...k) {
    return new Promise((c, b) => js(...k, (T) => {
      if (T) return b(T);
      c();
    }));
  }, isStream: Hs, isStreamx: Yt, isEnded: function(k) {
    return !!k._readableState && k._readableState.ended;
  }, isFinished: function(k) {
    return !!k._writableState && k._writableState.ended;
  }, isDisturbed: function(k) {
    return !!(1 & ~k._duplexState) || (k._duplexState & Je) !== 0;
  }, getStreamError: function(k, c = {}) {
    const b = k._readableState && k._readableState.error || k._writableState && k._writableState.error;
    return c.all || b !== t ? b : null;
  }, Stream: Ye, Writable: Ge, Readable: Jt, Duplex: Xe, Transform: qs, PassThrough: class extends qs {
  } };
}();
const q = Bt(function() {
  if (yr) return mr;
  function n(t, e) {
    for (const s in e) Object.defineProperty(t, s, { value: e[s], enumerable: !0, configurable: !0 });
    return t;
  }
  return yr = 1, mr = function(t, e, s) {
    if (!t || typeof t == "string") throw new TypeError("Please pass an Error to err-code");
    s || (s = {}), typeof e == "object" && (s = e, e = ""), e && (s.code = e);
    try {
      return n(t, s);
    } catch {
      s.message = t.message, s.stack = t.stack;
      const i = function() {
      };
      return i.prototype = Object.create(Object.getPrototypeOf(t)), n(new i(), s);
    }
  };
}()), Ce = "0123456789abcdef", Uo = [], ke = [];
for (let n = 0; n < 256; n++) Uo[n] = Ce[n >> 4 & 15] + Ce[15 & n], n < 16 && (n < 10 ? ke[48 + n] = n : ke[87 + n] = n);
const Ht = (n) => {
  const t = n.length;
  let e = "", s = 0;
  for (; s < t; ) e += Uo[n[s++]];
  return e;
}, an = (n) => {
  const t = n.length >> 1, e = t << 1, s = new Uint8Array(t);
  let r = 0, i = 0;
  for (; i < e; ) s[r++] = ke[n.charCodeAt(i++)] << 4 | ke[n.charCodeAt(i++)];
  return s;
};
for (var Na = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Da = typeof Uint8Array > "u" ? [] : new Uint8Array(256), pe = 0; pe < 64; pe++) Da[Na.charCodeAt(pe)] = pe;
const Fa = new TextDecoder(), qo = (n, t) => Fa.decode(n), Ua = new TextEncoder(), Tn = (n) => Ua.encode(n), Dt = (n) => {
  let t, e = "", s = 0;
  const r = n.length;
  for (; s < r; ) t = n.charCodeAt(s++), e += Ce[t >> 4] + Ce[15 & t];
  return e;
}, Zt = (n) => {
  const t = an(n);
  if (t.length <= 65536) return String.fromCharCode(...t);
  let e = "", s = 0;
  for (; s < t.length; ) e += String.fromCharCode(...t.subarray(s, s += 65536));
  return e;
}, _r = typeof window < "u" ? window : self, hn = _r.crypto || _r.msCrypto || {};
hn.subtle || hn.webkitSubtle;
const xe = (n) => {
  const t = new Uint8Array(n);
  return hn.getRandomValues(t);
}, qa = ut("simple-peer"), en = 65536;
function Sr(n) {
  return n.replace(/a=ice-options:trickle\s\n/g, "");
}
let $t = class cn extends Fo.Duplex {
  constructor(e) {
    super(e = Object.assign({ allowHalfOpen: !1 }, e));
    f(this, "_pc");
    if (this.__objectMode = !!e.objectMode, this._id = Ht(xe(4)).slice(0, 7), this._debug("new peer %o", e), this.channelName = e.initiator ? e.channelName || Ht(xe(20)) : null, this.initiator = e.initiator || !1, this.channelConfig = e.channelConfig || cn.channelConfig, this.channelNegotiated = this.channelConfig.negotiated, this.config = Object.assign({}, cn.config, e.config), this.offerOptions = e.offerOptions || {}, this.answerOptions = e.answerOptions || {}, this.sdpTransform = e.sdpTransform || ((s) => s), this.trickle = e.trickle === void 0 || e.trickle, this.allowHalfTrickle = e.allowHalfTrickle !== void 0 && e.allowHalfTrickle, this.iceCompleteTimeout = e.iceCompleteTimeout || 5e3, this._destroying = !1, this._connected = !1, this.remoteAddress = void 0, this.remoteFamily = void 0, this.remotePort = void 0, this.localAddress = void 0, this.localFamily = void 0, this.localPort = void 0, !on) throw q(typeof window > "u" ? new Error("No WebRTC support: Specify `opts.wrtc` option in this environment") : new Error("No WebRTC support: Not a supported browser"), "ERR_WEBRTC_SUPPORT");
    this._pcReady = !1, this._channelReady = !1, this._iceComplete = !1, this._iceCompleteTimer = null, this._channel = null, this._pendingCandidates = [], this._isNegotiating = !1, this._firstNegotiation = !0, this._batchedNegotiation = !1, this._queuedNegotiation = !1, this._sendersAwaitingStable = [], this._closingInterval = null, this._remoteTracks = [], this._remoteStreams = [], this._chunk = null, this._cb = null, this._interval = null;
    try {
      this._pc = new on(this.config);
    } catch (s) {
      return void this.__destroy(q(s, "ERR_PC_CONSTRUCTOR"));
    }
    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 = (s) => {
      this._onIceCandidate(s);
    }, typeof this._pc.peerIdentity == "object" && this._pc.peerIdentity.catch((s) => {
      this.__destroy(q(s, "ERR_PC_PEER_IDENTITY"));
    }), this.initiator || this.channelNegotiated ? this._setupData({ channel: this._pc.createDataChannel(this.channelName, this.channelConfig) }) : this._pc.ondatachannel = (s) => {
      this._setupData(s);
    }, this._debug("initial negotiation"), this._needsNegotiation(), this._onFinishBound = () => {
      this._onFinish();
    }, this.once("finish", this._onFinishBound);
  }
  get bufferSize() {
    return this._channel && this._channel.bufferedAmount || 0;
  }
  get connected() {
    return this._connected && this._channel.readyState === "open";
  }
  address() {
    return { port: this.localPort, family: this.localFamily, address: this.localAddress };
  }
  signal(e) {
    if (!this._destroying) {
      if (this.destroyed) throw q(new Error("cannot signal after peer is destroyed"), "ERR_DESTROYED");
      if (typeof e == "string") try {
        e = JSON.parse(e);
      } catch {
        e = {};
      }
      this._debug("signal()"), e.renegotiate && this.initiator && (this._debug("got request to renegotiate"), this._needsNegotiation()), e.transceiverRequest && this.initiator && (this._debug("got request for transceiver"), this.addTransceiver(e.transceiverRequest.kind, e.transceiverRequest.init)), e.candidate && (this._pc.remoteDescription && this._pc.remoteDescription.type ? this._addIceCandidate(e.candidate) : this._pendingCandidates.push(e.candidate)), e.sdp && this._pc.setRemoteDescription(new La(e)).then(() => {
        this.destroyed || (this._pendingCandidates.forEach((s) => {
          this._addIceCandidate(s);
        }), this._pendingCandidates = [], this._pc.remoteDescription.type === "offer" && this._createAnswer());
      }).catch((s) => {
        this.__destroy(q(s, "ERR_SET_REMOTE_DESCRIPTION"));
      }), e.sdp || e.candidate || e.renegotiate || e.transceiverRequest || this.__destroy(q(new Error("signal() called with invalid signal data"), "ERR_SIGNALING"));
    }
  }
  _addIceCandidate(e) {
    const s = new Oa(e);
    this._pc.addIceCandidate(s).catch((r) => {
      var i;
      !s.address || s.address.endsWith(".local") ? (i = "Ignoring unsupported ICE candidate.", console.warn(i)) : this.__destroy(q(r, "ERR_ADD_ICE_CANDIDATE"));
    });
  }
  send(e) {
    if (!this._destroying) {
      if (this.destroyed) throw q(new Error("cannot send after peer is destroyed"), "ERR_DESTROYED");
      this._channel.send(e);
    }
  }
  _needsNegotiation() {
    this._debug("_needsNegotiation"), this._batchedNegotiation || (this._batchedNegotiation = !0, queueMicrotask(() => {
      this._batchedNegotiation = !1, this.initiator || !this._firstNegotiation ? (this._debug("starting batched negotiation"), this.negotiate()) : this._debug("non-initiator initial negotiation request discarded"), this._firstNegotiation = !1;
    }));
  }
  negotiate() {
    if (!this._destroying) {
      if (this.destroyed) throw q(new Error("cannot negotiate after peer is destroyed"), "ERR_DESTROYED");
      this.initiator ? this._isNegotiating ? (this._queuedNegotiation = !0, this._debug("already negotiating, queueing")) : (this._debug("start negotiation"), setTimeout(() => {
        this._createOffer();
      }, 0)) : this._isNegotiating ? (this._queuedNegotiation = !0, this._debug("already negotiating, queueing")) : (this._debug("requesting negotiation from initiator"), this.emit("signal", { type: "renegotiate", renegotiate: !0 })), this._isNegotiating = !0;
    }
  }
  _final(e) {
    this._readableState.ended || this.push(null), e(null);
  }
  __destroy(e) {
    this.end(), this._destroy(() => {
    }, e);
  }
  _destroy(e, s) {
    this.destroyed || this._destroying || (this._destroying = !0, this._debug("destroying (error: %s)", s && (s.message || s)), setTimeout(() => {
      if (this._connected = !1, this._pcReady = !1, this._channelReady = !1, 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, this._onFinishBound && this.removeListener("finish", this._onFinishBound), this._onFinishBound = null, this._channel) {
        try {
          this._channel.close();
        } catch {
        }
        this._channel.onmessage = null, this._channel.onopen = null, this._channel.onclose = null, this._channel.onerror = null;
      }
      if (this._pc) {
        try {
          this._pc.close();
        } catch {
        }
        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, s && this.emit("error", s), e();
    }, 0));
  }
  _setupData(e) {
    if (!e.channel) return this.__destroy(q(new Error("Data channel event is missing `channel` property"), "ERR_DATA_CHANNEL"));
    this._channel = e.channel, this._channel.binaryType = "arraybuffer", typeof this._channel.bufferedAmountLowThreshold == "number" && (this._channel.bufferedAmountLowThreshold = en), this.channelName = this._channel.label, this._channel.onmessage = (r) => {
      this._onChannelMessage(r);
    }, this._channel.onbufferedamountlow = () => {
      this._onChannelBufferedAmountLow();
    }, this._channel.onopen = () => {
      this._onChannelOpen();
    }, this._channel.onclose = () => {
      this._onChannelClose();
    }, this._channel.onerror = (r) => {
      const i = r.error instanceof Error ? r.error : new Error(`Datachannel error: ${r.message} ${r.filename}:${r.lineno}:${r.colno}`);
      this.__destroy(q(i, "ERR_DATA_CHANNEL"));
    };
    let s = !1;
    this._closingInterval = setInterval(() => {
      this._channel && this._channel.readyState === "closing" ? (s && this._onChannelClose(), s = !0) : s = !1;
    }, 5e3);
  }
  _write(e, s) {
    if (this.destroyed) return s(q(new Error("cannot write after peer is destroyed"), "ERR_DATA_CHANNEL"));
    if (this._connected) {
      try {
        this.send(e);
      } catch (r) {
        return this.__destroy(q(r, "ERR_DATA_CHANNEL"));
      }
      this._channel.bufferedAmount > en ? (this._debug("start backpressure: bufferedAmount %d", this._channel.bufferedAmount), this._cb = s) : s(null);
    } else this._debug("write before connect"), this._chunk = e, this._cb = s;
  }
  _onFinish() {
    if (this.destroyed) return;
    const e = () => {
      setTimeout(() => this.__destroy(), 1e3);
    };
    this._connected ? e() : this.once("connect", e);
  }
  _startIceCompleteTimeout() {
    this.destroyed || this._iceCompleteTimer || (this._debug("started iceComplete timeout"), this._iceCompleteTimer = setTimeout(() => {
      this._iceComplete || (this._iceComplete = !0, this._debug("iceComplete timeout completed"), this.emit("iceTimeout"), this.emit("_iceComplete"));
    }, this.iceCompleteTimeout));
  }
  _createOffer() {
    this.destroyed || this._pc.createOffer(this.offerOptions).then((e) => {
      if (this.destroyed) return;
      this.trickle || this.allowHalfTrickle || (e.sdp = Sr(e.sdp)), e.sdp = this.sdpTransform(e.sdp);
      const s = () => {
        if (this.destroyed) return;
        const r = this._pc.localDescription || e;
        this._debug("signal"), this.emit("signal", { type: r.type, sdp: r.sdp });
      };
      this._pc.setLocalDescription(e).then(() => {
        this._debug("createOffer success"), this.destroyed || (this.trickle || this._iceComplete ? s() : this.once("_iceComplete", s));
      }).catch((r) => {
        this.__destroy(q(r, "ERR_SET_LOCAL_DESCRIPTION"));
      });
    }).catch((e) => {
      this.__destroy(q(e, "ERR_CREATE_OFFER"));
    });
  }
  _createAnswer() {
    this.destroyed || this._pc.createAnswer(this.answerOptions).then((e) => {
      if (this.destroyed) return;
      this.trickle || this.allowHalfTrickle || (e.sdp = Sr(e.sdp)), e.sdp = this.sdpTransform(e.sdp);
      const s = () => {
        var i;
        if (this.destroyed) return;
        const r = this._pc.localDescription || e;
        this._debug("signal"), this.emit("signal", { type: r.type, sdp: r.sdp }), this.initiator || ((i = this._requestMissingTransceivers) == null || i.call(this));
      };
      this._pc.setLocalDescription(e).then(() => {
        this.destroyed || (this.trickle || this._iceComplete ? s() : this.once("_iceComplete", s));
      }).catch((r) => {
        this.__destroy(q(r, "ERR_SET_LOCAL_DESCRIPTION"));
      });
    }).catch((e) => {
      this.__destroy(q(e, "ERR_CREATE_ANSWER"));
    });
  }
  _onConnectionStateChange() {
    this.destroyed || this._destroying || this._pc.connectionState === "failed" && this.__destroy(q(new Error("Connection failed."), "ERR_CONNECTION_FAILURE"));
  }
  _onIceStateChange() {
    if (this.destroyed) return;
    const e = this._pc.iceConnectionState, s = this._pc.iceGatheringState;
    this._debug("iceStateChange (connection: %s) (gathering: %s)", e, s), this.emit("iceStateChange", e, s), e !== "connected" && e !== "completed" || (this._pcReady = !0, this._maybeReady()), e === "failed" && this.__destroy(q(new Error("Ice connection failed."), "ERR_ICE_CONNECTION_FAILURE")), e === "closed" && this.__destroy(q(new Error("Ice connection closed."), "ERR_ICE_CONNECTION_CLOSED"));
  }
  getStats(e) {
    const s = (r) => (Object.prototype.toString.call(r.values) === "[object Array]" && r.values.forEach((i) => {
      Object.assign(r, i);
    }), r);
    this._pc.getStats.length === 0 || this._isReactNativeWebrtc ? this._pc.getStats().then((r) => {
      const i = [];
      r.forEach((o) => {
        i.push(s(o));
      }), e(null, i);
    }, (r) => e(r)) : this._pc.getStats.length > 0 ? this._pc.getStats((r) => {
      if (this.destroyed) return;
      const i = [];
      r.result().forEach((o) => {
        const a = {};
        o.names().forEach((h) => {
          a[h] = o.stat(h);
        }), a.id = o.id, a.type = o.type, a.timestamp = o.timestamp, i.push(s(a));
      }), e(null, i);
    }, (r) => e(r)) : e(null, []);
  }
  _maybeReady() {
    if (this._debug("maybeReady pc %s channel %s", this._pcReady, this._channelReady), this._connected || this._connecting || !this._pcReady || !this._channelReady) return;
    this._connecting = !0;
    const e = () => {
      this.destroyed || this._destroying || this.getStats((s, r) => {
        if (this.destroyed || this._destroying) return;
        s && (r = []);
        const i = {}, o = {}, a = {};
        let h = !1;
        r.forEach((u) => {
          u.type !== "remotecandidate" && u.type !== "remote-candidate" || (i[u.id] = u), u.type !== "localcandidate" && u.type !== "local-candidate" || (o[u.id] = u), u.type !== "candidatepair" && u.type !== "candidate-pair" || (a[u.id] = u);
        });
        const d = (u) => {
          h = !0;
          let l = o[u.localCandidateId];
          l && (l.ip || l.address) ? (this.localAddress = l.ip || l.address, this.localPort = Number(l.port)) : l && l.ipAddress ? (this.localAddress = l.ipAddress, this.localPort = Number(l.portNumber)) : typeof u.googLocalAddress == "string" && (l = u.googLocalAddress.split(":"), this.localAddress = l[0], this.localPort = Number(l[1])), this.localAddress && (this.localFamily = this.localAddress.includes(":") ? "IPv6" : "IPv4");
          let m = i[u.remoteCandidateId];
          m && (m.ip || m.address) ? (this.remoteAddress = m.ip || m.address, this.remotePort = Number(m.port)) : m && m.ipAddress ? (this.remoteAddress = m.ipAddress, this.remotePort = Number(m.portNumber)) : typeof u.googRemoteAddress == "string" && (m = u.googRemoteAddress.split(":"), this.remoteAddress = m[0], this.remotePort = Number(m[1])), 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);
        };
        if (r.forEach((u) => {
          u.type === "transport" && u.selectedCandidatePairId && d(a[u.selectedCandidatePairId]), (u.type === "googCandidatePair" && u.googActiveConnection === "true" || (u.type === "candidatepair" || u.type === "candidate-pair") && u.selected) && d(u);
        }), h || Object.keys(a).length && !Object.keys(o).length) {
          if (this._connecting = !1, this._connected = !0, this._chunk) {
            try {
              this.send(this._chunk);
            } catch (l) {
              return this.__destroy(q(l, "ERR_DATA_CHANNEL"));
            }
            this._chunk = null, this._debug('sent chunk from "write before connect"');
            const u = this._cb;
            this._cb = null, u(null);
          }
          typeof this._channel.bufferedAmountLowThreshold != "number" && (this._interval = setInterval(() => this._onInterval(), 150), this._interval.unref && this._interval.unref()), this._debug("connect"), this.emit("connect");
        } else setTimeout(e, 100);
      });
    };
    e();
  }
  _onInterval() {
    !this._cb || !this._channel || this._channel.bufferedAmount > en || this._onChannelBufferedAmountLow();
  }
  _onSignalingStateChange() {
    this.destroyed || (this._pc.signalingState === "stable" && (this._isNegotiating = !1, this._debug("flushing sender queue", this._sendersAwaitingStable), this._sendersAwaitingStable.forEach((e) => {
      this._pc.removeTrack(e), this._queuedNegotiation = !0;
    }), this._sendersAwaitingStable = [], this._queuedNegotiation ? (this._debug("flushing negotiation queue"), this._queuedNegotiation = !1, this._needsNegotiation()) : (this._debug("negotiated"), this.emit("negotiated"))), this._debug("signalingStateChange %s", this._pc.signalingState), this.emit("signalingStateChange", this._pc.signalingState));
  }
  _onIceCandidate(e) {
    this.destroyed || (e.candidate && this.trickle ? this.emit("signal", { type: "candidate", candidate: { candidate: e.candidate.candidate, sdpMLineIndex: e.candidate.sdpMLineIndex, sdpMid: e.candidate.sdpMid } }) : e.candidate || this._iceComplete || (this._iceComplete = !0, this.emit("_iceComplete")), e.candidate && this._startIceCompleteTimeout());
  }
  _onChannelMessage(e) {
    if (this.destroyed) return;
    let s = e.data;
    s instanceof ArrayBuffer ? s = new Uint8Array(s) : this.__objectMode === !1 && (s = Tn(s)), this.push(s);
  }
  _onChannelBufferedAmountLow() {
    if (this.destroyed || !this._cb) return;
    this._debug("ending backpressure: bufferedAmount %d", this._channel.bufferedAmount);
    const e = this._cb;
    this._cb = null, e(null);
  }
  _onChannelOpen() {
    this._connected || this.destroyed || (this._debug("on channel open"), this._channelReady = !0, this._maybeReady());
  }
  _onChannelClose() {
    this.destroyed || (this._debug("on channel close"), this.__destroy());
  }
  _debug() {
    const e = [].slice.call(arguments);
    e[0] = "[" + this._id + "] " + e[0], qa.apply(null, e);
  }
};
$t.WEBRTC_SUPPORT = !!on, $t.config = { iceServers: [{ urls: ["stun:stun.l.google.com:19302", "stun:global.stun.twilio.com:3478"] }], sdpSemantics: "unified-plan" }, $t.channelConfig = {};
const un = Bt(Do()), ja = {}, Ha = Object.freeze(Object.defineProperty({ __proto__: null, default: ja }, Symbol.toStringTag, { value: "Module" }));
(function() {
  const n = En, t = An();
  for (; ; ) try {
    if (-parseInt(n(176)) / 1 * (-parseInt(n(169)) / 2) + parseInt(n(182)) / 3 + -parseInt(n(181)) / 4 + parseInt(n(174)) / 5 * (-parseInt(n(171)) / 6) + -parseInt(n(170)) / 7 * (parseInt(n(184)) / 8) + parseInt(n(183)) / 9 + -parseInt(n(172)) / 10 * (-parseInt(n(178)) / 11) === 649971) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
function En(n, t) {
  const e = An();
  return (En = function(s, r) {
    return e[s -= 168];
  })(n, t);
}
const dn = { DEFAULT_ANNOUNCE_PEERS: 50, MAX_ANNOUNCE_PEERS: 82, parseUrl: (n) => {
  const t = En, e = new URL(n[t(168)](/^udp:/, t(175)));
  return n[t(179)](/^udp:/) && Object[t(173)](e, { href: { value: e[t(177)].replace(/^http/, t(180)) }, protocol: { value: e.protocol[t(168)](/^http/, t(180)) }, origin: { value: e.origin[t(168)](/^http/, t(180)) } }), e;
}, ...Ha };
function An() {
  const n = ["http:", "66JuxNPP", "href", "11hPvqxS", "match", "udp", "3754704lEaoCD", "1549764IhoTrR", "8447526RvzUDG", "5424mrRfpE", "replace", "16454EXObCB", "12782ZMxAUT", "42njyedL", "13579570avteea", "defineProperties", "378190JVIOLS"];
  return (An = function() {
    return n;
  })();
}
const Wa = ut("simple-websocket"), be = WebSocket;
class jo extends Fo.Duplex {
  constructor(t = {}) {
    if (typeof t == "string" && (t = { url: t }), super(t = Object.assign({ allowHalfOpen: !1 }, t)), this.__objectMode = !!t.objectMode, t.objectMode != null && delete t.objectMode, t.url == null && t.socket == null) throw new Error("Missing required `url` or `socket` option");
    if (t.url != null && t.socket != null) throw new Error("Must specify either `url` or `socket` option, not both");
    if (this._id = Ht(xe(4)).slice(0, 7), this._debug("new websocket: %o", t), this.connected = !1, this._chunk = null, this._cb = null, this._interval = null, t.socket) this.url = t.socket.url, this._ws = t.socket, this.connected = t.socket.readyState === be.OPEN;
    else {
      this.url = t.url;
      try {
        this._ws = new be(t.url);
      } catch (e) {
        return void un(() => this.destroy(e));
      }
    }
    this._ws.binaryType = "arraybuffer", t.socket && this.connected ? un(() => this._handleOpen()) : this._ws.onopen = () => this._handleOpen(), this._ws.onmessage = (e) => this._handleMessage(e), this._ws.onclose = () => this._handleClose(), this._ws.onerror = (e) => this._handleError(e), this._handleFinishBound = () => this._handleFinish(), this.once("finish", this._handleFinishBound);
  }
  send(t) {
    this._ws.send(t);
  }
  _final(t) {
    this._readableState.ended || this.push(null), t(null);
  }
  _destroy(t) {
    if (!this.destroyed) {
      if (this._writableState.ended || this.end(), this.connected = !1, clearInterval(this._interval), this._interval = null, this._chunk = null, this._cb = null, this._handleFinishBound && this.removeListener("finish", this._handleFinishBound), this._handleFinishBound = null, this._ws) {
        const e = this._ws, s = () => {
          e.onclose = null;
        };
        if (e.readyState === be.CLOSED) s();
        else try {
          e.onclose = s, e.close();
        } catch {
          s();
        }
        e.onopen = null, e.onmessage = null, e.onerror = () => {
        };
      }
      this._ws = null, t();
    }
  }
  _write(t, e) {
    if (this.destroyed) return e(new Error("cannot write after socket is destroyed"));
    if (this.connected) {
      try {
        this.send(t);
      } catch (s) {
        return this.destroy(s);
      }
      this._ws.bufferedAmount > 65536 ? (this._debug("start backpressure: bufferedAmount %d", this._ws.bufferedAmount), this._cb = e) : e(null);
    } else this._debug("write before connect"), this._chunk = t, this._cb = e;
  }
  _handleOpen() {
    if (!this.connected && !this.destroyed) {
      if (this.connected = !0, this._chunk) {
        try {
          this.send(this._chunk);
        } catch (e) {
          return this.destroy(e);
        }
        this._chunk = null, this._debug('sent chunk from "write before connect"');
        const t = this._cb;
        this._cb = null, t(null);
      }
      this._interval = setInterval(() => this._onInterval(), 150), this._interval.unref && this._interval.unref(), this._debug("connect"), this.emit("connect");
    }
  }
  _handleMessage(t) {
    if (this.destroyed) return;
    let e = t.data;
    e instanceof ArrayBuffer && (e = new Uint8Array(e)), this.__objectMode === !1 && (e = Tn(e)), this.push(e);
  }
  _handleClose() {
    this.destroyed || (this._debug("on close"), this.destroy());
  }
  _handleError(t) {
    this.destroy(new Error(`Error connecting to ${this.url}`));
  }
  _handleFinish() {
    if (this.destroyed) return;
    const t = () => {
      setTimeout(() => this.destroy(), 1e3);
    };
    this.connected ? t() : this.once("connect", t);
  }
  _onInterval() {
    if (!this._cb || !this._ws || this._ws.bufferedAmount > 65536) return;
    this._debug("ending backpressure: bufferedAmount %d", this._ws.bufferedAmount);
    const t = this._cb;
    this._cb = null, t(null);
  }
  _debug() {
    const t = [].slice.call(arguments);
    t[0] = "[" + this._id + "] " + t[0], Wa.apply(null, t);
  }
}
jo.WEBSOCKET_SUPPORT = !!be;
var fe = Me;
function Me(n, t) {
  var e = Rn();
  return (Me = function(s, r) {
    return e[s -= 177];
  })(n, t);
}
(function() {
  for (var n = Me, t = Rn(); ; ) try {
    if (-parseInt(n(190)) / 1 * (parseInt(n(187)) / 2) + -parseInt(n(178)) / 3 * (parseInt(n(197)) / 4) + -parseInt(n(179)) / 5 + -parseInt(n(189)) / 6 + parseInt(n(177)) / 7 + -parseInt(n(185)) / 8 * (-parseInt(n(192)) / 9) + -parseInt(n(191)) / 10 === 572133) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
class za extends No {
  constructor(t, e) {
    var s = Me;
    super(), this[s(186)] = t, this[s(181)] = e, this[s(196)] = null, this.destroyed = !1;
  }
  [fe(193)](t) {
    var e = fe;
    t == null && (t = this[e(188)]), clearInterval(this[e(196)]), t && (this.interval = setInterval(() => {
      var s = e;
      this[s(183)](this[s(186)][s(184)]());
    }, t), this.interval[e(180)] && this[e(196)][e(180)]());
  }
  async [fe(182)](t) {
    var e = fe;
    console[e(194)](e(195), t);
  }
}
function Rn() {
  var n = ["3BpXiwP", "1125230hkdhLU", "unref", "announceUrl", "stats", "announce", "_defaultAnnounceOpts", "296xidklR", "client", "743514egUuMp", "DEFAULT_ANNOUNCE_INTERVAL", "1727976YSxPeh", "1sTwARH", "721630ejTbEe", "162207jYbKtz", "setInterval", "log", "tracker.js:", "interval", "762044FtnJwo", "7369285OScKsd"];
  return (Rn = function() {
    return n;
  })();
}
var br = function(n, t, e) {
  if (e || arguments.length === 2) for (var s, r = 0, i = t.length; r < i; r++) !s && r in t || (s || (s = Array.prototype.slice.call(t, 0, r)), s[r] = t[r]);
  return n.concat(s || Array.prototype.slice.call(t));
}, Qa = function(n, t, e) {
  this.name = n, this.version = t, this.os = e, this.type = "browser";
}, Ja = function(n) {
  this.version = n, this.type = "node", this.name = "node", this.os = process.platform;
}, Ya = function(n, t, e, s) {
  this.name = n, this.version = t, this.os = e, this.bot = s, this.type = "bot-device";
}, Ga = function() {
  this.type = "bot", this.bot = !0, this.name = "bot", this.version = null, this.os = null;
}, Xa = function() {
  this.type = "react-native", this.name = "react-native", this.version = null, this.os = null;
}, Ka = /(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/, Va = [["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", /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]], wr = [["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 Za(n) {
  return typeof document > "u" && typeof navigator < "u" && navigator.product === "ReactNative" ? new Xa() : typeof navigator < "u" ? function(t) {
    var e = function(d) {
      return d !== "" && Va.reduce(function(u, l) {
        var m = l[0], v = l[1];
        if (u) return u;
        var w = v.exec(d);
        return !!w && [m, w];
      }, !1);
    }(t);
    if (!e) return null;
    var s = e[0], r = e[1];
    if (s === "searchbot") return new Ga();
    var i = r[1] && r[1].split(".").join("_").split("_").slice(0, 3);
    i ? i.length < 3 && (i = br(br([], i, !0), function(d) {
      for (var u = [], l = 0; l < d; l++) u.push("0");
      return u;
    }(3 - i.length), !0)) : i = [];
    var o = i.join("."), a = function(d) {
      for (var u = 0, l = wr.length; u < l; u++) {
        var m = wr[u], v = m[0];
        if (m[1].exec(d)) return v;
      }
      return null;
    }(t), h = Ka.exec(t);
    return h && h[1] ? new Ya(s, o, a, h[1]) : new Qa(s, o, a);
  }(navigator.userAgent) : typeof process < "u" && process.version ? new Ja(process.version.slice(1)) : null;
}
const L = Ln;
function Pn() {
  const n = ["ignoring websocket data from %s for %s (looking for %s: reused socket)", "peer_id", "_onSocketData", "signal", "min interval", "interval", "httpsAgent", "unref", "completed", "_onAnnounceResponse", "_generateOffers", "destroyed", "got unexpected answer: ", "platform", "map", "scrape", "_peerIdBinary", "creating peer (from _generateOffers)", "assign", "error", "statsCollector", "reconnectTimer", "stats", "browser_version", "creating peer (from remote offer)", "length", "239911EybzeQ", "setInterval", "info_hash", "_proxyOpts", "_onSocketClose", "send %s", "generating %s offers", "DEFAULT_ANNOUNCE_INTERVAL", "numwant", "538282bBeygb", "min", "_startReconnectTimer", "_onSocketDataBound", "6MwzoiQ", "announce", "3667125kjjIPL", "action", "failure reason", "stored", "3096536tiYxGd", "ios", "1725676RKZQtv", "stream", "_onSocketConnectBound", "invalid action in WS response: ", "_openSocket", "consumers", "Connection error: ", "reconnecting socket in %s ms", "href", "new websocket tracker %s", "undefined", "trackerTimeout", "answer", "_trackerId", "offer_id", "emit", "version", "close", "received %s from %s for %s", "_send", "_onSocketErrorBound", "peers", "destroy", "socksProxy", "trackerid", "forEach", "_onSocketCloseBound", "_defaultAnnounceOpts", "warning", "tracker id", "update", "connected", "_wrtc", "stopped", "message", "keys", "event", "userAgent", "files", "source", "connect", "_onScrapeResponse", "reconnecting", "referrer", "27wXahyM", "location", "_infoHashBinary", "client", "once", "expectingResponse", "pow", "removeListener", "_socketPool", "test", "socket", "2183544rjpMYg", "stringify", "complete", "warning message", "_onSocketConnect", "bittorrent-tracker:websocket-tracker", "infoHash", "3520545BSYRDf", "floor", "_createPeer", "offer", "swarm", "retries", "announceUrl", "data", "DESTROY_TIMEOUT", "_onSocketError", "peer"];
  return (Pn = function() {
    return n;
  })();
}
function Ln(n, t) {
  const e = Pn();
  return (Ln = function(s, r) {
    return e[s -= 387];
  })(n, t);
}
(function() {
  const n = Ln, t = Pn();
  for (; ; ) try {
    if (-parseInt(n(439)) / 1 + -parseInt(n(448)) / 2 * (-parseInt(n(452)) / 3) + parseInt(n(460)) / 4 + parseInt(n(454)) / 5 + -parseInt(n(395)) / 6 + parseInt(n(402)) / 7 + -parseInt(n(458)) / 8 * (parseInt(n(504)) / 9) === 441025) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
const tt = ut(L(400)), gt = {};
class ln extends za {
  constructor(t, e) {
    const s = L;
    super(t, e), tt(s(469), e), this.peers = {}, this.socket = null, this.stats = {}, this[s(502)] = !1, this[s(407)] = 0, this[s(434)] = null, this.expectingResponse = !1, this[s(464)]();
  }
  [L(453)](t) {
    const e = L;
    if (this.destroyed || this[e(502)]) return;
    if (!this.socket[e(491)]) return void this.socket[e(388)]("connect", () => {
      this[e(453)](t);
    });
    const s = Object[e(431)]({}, t, { action: e(453), info_hash: this[e(387)][e(506)], peer_id: this[e(387)]._peerIdBinary });
    if (this._trackerId && (s[e(484)] = this[e(473)]), t[e(496)] === e(493) || t.event === e(421)) this._send(s);
    else {
      const r = Math[e(449)](t[e(447)], 13), i = Za();
      this._generateOffers(r, (o) => {
        const a = e;
        s[a(447)] = r, s.offers = o, s.browser = i.name, s.os = i.os, s[a(436)] = i[a(476)], s[a(435)] = t[a(435)];
        const h = typeof navigator < "u" ? navigator : {};
        s[a(499)] = typeof document !== a(470) && document[a(503)] || "", s[a(468)] = typeof window !== a(470) && window[a(505)][a(468)] || "", t.swarm && (s[a(406)] = t.swarm), t.stream && (s[a(461)] = t[a(461)]), t.stored != null && (s[a(457)] = t[a(457)]), s[a(459)] = /iPad|iPhone|iPod/[a(393)](h[a(497)] || ""), s[a(426)] = h.platform || "", s.userAgent = h[a(497)] || "", s.browserCodeName = h.appCodeName || "", s.browserName = h.appName || "", this._send(s);
      });
    }
  }
  async [L(433)](t) {
    const e = L;
    if (this[e(424)] || this[e(502)]) return;
    if (!this.socket[e(491)]) return void this[e(394)][e(388)](e(500), () => {
      this[e(433)](t);
    });
    const s = { action: e(435), info_hash: this[e(387)][e(506)], peer_id: this.client[e(429)], data: t };
    this[e(473)] && (s[e(484)] = this[e(473)]), this[e(479)](s);
  }
  [L(428)](t) {
    const e = L;
    if (this.destroyed || this.reconnecting) return;
    if (!this[e(394)][e(491)]) return void this.socket[e(388)]("connect", () => {
      this[e(428)](t);
    });
    const s = Array.isArray(t[e(401)]) && t[e(401)][e(438)] > 0 ? t[e(401)][e(427)]((i) => Zt(i)) : t[e(401)] && Zt(t[e(401)]) || this[e(387)][e(506)], r = { action: e(428), info_hash: s };
    this[e(479)](r);
  }
  [L(482)](t = Ir) {
    const e = L;
    if (this[e(424)]) return t(null);
    this.destroyed = !0, clearInterval(this[e(418)]), clearTimeout(this[e(434)]);
    for (const o in this.peers) {
      const a = this[e(481)][o];
      clearTimeout(a[e(471)]), a[e(482)]();
    }
    if (this[e(481)] = null, this[e(394)] && (this[e(394)][e(391)]("connect", this[e(462)]), this[e(394)].removeListener("data", this[e(451)]), this[e(394)][e(391)]("close", this._onSocketCloseBound), this.socket.removeListener("error", this[e(480)]), this[e(394)] = null), this[e(462)] = null, this[e(480)] = null, this[e(451)] = null, this._onSocketCloseBound = null, gt[this[e(408)]] && (gt[this[e(408)]][e(465)] -= 1), gt[this.announceUrl].consumers > 0) return t();
    let s, r = gt[this.announceUrl];
    if (delete gt[this[e(408)]], r.on(e(432), Ir), r[e(388)](e(477), t), !this.expectingResponse) return i();
    function i() {
      const o = e;
      s && (clearTimeout(s), s = null), r[o(391)](o(409), i), r[o(482)](), r = null;
    }
    s = setTimeout(i, dn[e(410)]), r[e(388)](e(409), i);
  }
  [L(464)]() {
    const t = L;
    if (this[t(424)] = !1, this.peers || (this.peers = {}), this[t(462)] = () => {
      this._onSocketConnect();
    }, this[t(480)] = (e) => {
      this[t(411)](e);
    }, this[t(451)] = (e) => {
      this[t(415)](e);
    }, this[t(486)] = () => {
      this[t(443)]();
    }, this[t(394)] = gt[this[t(408)]], this[t(394)]) gt[this[t(408)]][t(465)] += 1, this[t(394)].connected && this._onSocketConnectBound();
    else {
      const e = new URL(this[t(408)]);
      let s;
      this[t(387)][t(442)] && (s = e.protocol === "wss:" ? this[t(387)][t(442)][t(419)] : this[t(387)][t(442)].httpAgent, !s && this[t(387)][t(442)][t(483)] && (s = this[t(387)][t(442)][t(483)])), this[t(394)] = gt[this[t(408)]] = new jo({ url: this.announceUrl, agent: s }), this[t(394)].consumers = 1, this[t(394)].once(t(500), this[t(462)]);
    }
    this[t(394)].on(t(409), this[t(451)]), this[t(394)][t(388)](t(477), this[t(486)]), this.socket[t(388)](t(432), this[t(480)]);
  }
  [L(399)]() {
    const t = L;
    this[t(424)] || this[t(502)] && (this[t(502)] = !1, this[t(407)] = 0, this[t(453)](this[t(387)][t(487)]()));
  }
  [L(415)](t) {
    const e = L;
    if (!this[e(424)]) {
      this[e(389)] = !1;
      try {
        t = JSON.parse(qo(t));
      } catch {
        return void this[e(387)].emit(e(488), new Error("Invalid tracker response"));
      }
      t[e(455)] === "announce" ? this[e(422)](t) : t[e(455)] === e(428) ? this[e(501)](t) : t[e(455)] === e(435) ? this[e(387)][e(475)](e(435), t) : this[e(411)](new Error(e(463) + t.action));
    }
  }
  [L(422)](t) {
    const e = L;
    if (t.info_hash !== this.client[e(506)]) return void tt(e(413), this.announceUrl, Dt(t[e(441)]), this[e(387)][e(401)]);
    if (t.peer_id && t[e(414)] === this[e(387)][e(429)]) return;
    tt(e(478), JSON[e(396)](t), this[e(408)], this[e(387)][e(401)]);
    const s = t[e(456)];
    if (s) return this.client[e(475)](e(488), new Error(s));
    const r = t[e(398)];
    r && this[e(387)][e(475)](e(488), new Error(r));
    const i = t[e(418)] || t[e(417)];
    i && this[e(440)](1e3 * i);
    const o = t[e(489)];
    if (o && (this[e(473)] = o), t[e(397)] != null) {
      const h = Object.assign({}, t, { announce: this[e(408)], infoHash: Dt(t.info_hash) });
      this.client[e(475)](e(490), h);
    }
    let a;
    if (t.offer && t[e(414)] && (tt(e(437)), a = this[e(404)](), a.id = Dt(t[e(414)]), a[e(388)](e(416), (h) => {
      const d = e, u = { action: "announce", info_hash: this[d(387)][d(506)], peer_id: this[d(387)][d(429)], to_peer_id: t[d(414)], answer: h, offer_id: t[d(474)] };
      this[d(473)] && (u.trackerid = this[d(473)]), this._send(u);
    }), this[e(387)][e(475)](e(412), a), a[e(416)](t[e(405)])), t.answer && t[e(414)]) {
      const h = Dt(t[e(474)]);
      a = this.peers[h], a ? (a.id = Dt(t[e(414)]), this.client[e(475)](e(412), a), a[e(416)](t[e(472)]), clearTimeout(a.trackerTimeout), a.trackerTimeout = null, delete this[e(481)][h]) : tt(e(425) + JSON[e(396)](t.answer));
    }
  }
  _onScrapeResponse(t) {
    const e = L;
    t = t[e(498)] || {};
    const s = Object[e(495)](t);
    s[e(438)] !== 0 ? s[e(485)]((r) => {
      const i = e, o = Object[i(431)](t[r], { announce: this[i(408)], infoHash: Dt(r) });
      this.client[i(475)](i(428), o);
    }) : this[e(387)][e(475)](e(488), new Error("invalid scrape response"));
  }
  [L(443)]() {
    const t = L;
    this.destroyed || (this[t(482)](), this[t(450)]());
  }
  [L(411)](t) {
    const e = L;
    this[e(424)] || (this.destroy(), this[e(387)].emit(e(488), t), this._startReconnectTimer());
  }
  _startReconnectTimer() {
    const t = L, e = Math[t(403)](3e5 * Math.random()) + Math[t(449)](1e4 * Math[t(390)](2, this[t(407)]), 36e5);
    this[t(502)] = !0, clearTimeout(this.reconnectTimer), this[t(434)] = setTimeout(() => {
      this[t(407)]++, this._openSocket();
    }, e), this[t(434)][t(420)] && this[t(434)][t(420)](), tt(t(467), e);
  }
  [L(479)](t) {
    const e = L;
    if (this[e(424)]) return;
    this[e(389)] = !0;
    const s = JSON[e(396)](t);
    tt(e(444), s), this[e(394)].send(s);
  }
  [L(423)](t, e) {
    const s = L, r = this, i = [];
    tt(s(445), t);
    for (let h = 0; h < t; ++h) o();
    function o() {
      const h = s, d = Ht(xe(20));
      tt(h(430));
      const u = r[h(481)][d] = r._createPeer({ initiator: !0 });
      u.once(h(416), (l) => {
        i.push({ offer: l, offer_id: Zt(d) }), a();
      }), u[h(471)] = setTimeout(() => {
        const l = h;
        tt("tracker timeout: destroying peer"), u[l(471)] = null, delete r[l(481)][d], u.destroy();
      }, 5e4), u[h(471)].unref && u[h(471)][h(420)]();
    }
    function a() {
      i[s(438)] === t && (tt("generated %s offers", t), e(i));
    }
    a();
  }
  [L(404)](t) {
    const e = L, s = this;
    t = Object.assign({ trickle: !1, config: s[e(387)]._rtcConfig, wrtc: s[e(387)][e(492)] }, t);
    const r = new $t(t);
    return r[e(388)]("error", i), r.once("connect", function o() {
      const a = e;
      r[a(391)](a(432), i), r[a(391)]("connect", o);
    }), r;
    function i(o) {
      const a = e;
      s[a(387)].emit(a(488), new Error(a(466) + o[a(494)])), r[a(482)]();
    }
  }
}
function Ir() {
}
ln.prototype[L(446)] = 3e4, ln[L(392)] = gt;
const j = Be;
function Be(n, t) {
  const e = On();
  return (Be = function(s, r) {
    return e[s -= 454];
  })(n, t);
}
(function() {
  const n = Be, t = On();
  for (; ; ) try {
    if (-parseInt(n(458)) / 1 + -parseInt(n(463)) / 2 * (parseInt(n(499)) / 3) + parseInt(n(495)) / 4 + parseInt(n(455)) / 5 + parseInt(n(511)) / 6 + parseInt(n(468)) / 7 + -parseInt(n(460)) / 8 * (parseInt(n(487)) / 9) === 580850) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
const It = ut(j(519));
class pn extends No {
  constructor(t = {}) {
    const e = j;
    if (super(), !t[e(486)]) throw new Error("Option `peerId` is required");
    if (!t.infoHash) throw new Error(e(464));
    if (!t[e(502)]) throw new Error(e(497));
    this[e(486)] = typeof t[e(486)] === e(510) ? t[e(486)] : Ht(t[e(486)]), this[e(508)] = an(this.peerId), this[e(461)] = Zt(this.peerId), this.infoHash = typeof t[e(478)] == "string" ? t[e(478)].toLowerCase() : Ht(t.infoHash), this[e(471)] = an(this.infoHash), this[e(457)] = Zt(this[e(478)]), It(e(501), this[e(478)]), this[e(485)] = !1, this._port = t[e(518)], this[e(484)] = t[e(516)], this._rtcConfig = t[e(523)], this[e(527)] = t[e(498)], this[e(507)] = t.proxyOpts, this[e(480)] = typeof t[e(467)] == "function" ? t[e(467)]() : t.wrtc;
    let s = typeof t.announce == "string" ? [t[e(502)]] : t[e(502)] == null ? [] : t[e(502)];
    s = s[e(494)]((o) => {
      const a = e;
      return ArrayBuffer[a(513)](o) && (o = qo(o)), o[o[a(505)] - 1] === "/" && (o = o[a(470)](0, o[a(505)] - 1)), o;
    }), s = Array[e(476)](new Set(s));
    const r = this[e(480)] !== !1 && (!!this[e(480)] || $t[e(477)]), i = (o) => {
      un(() => {
        this[Be(483)]("warning", o);
      });
    };
    this[e(469)] = s.map((o) => {
      const a = e;
      let h;
      try {
        h = dn[a(479)](o);
      } catch {
        return i(new Error(a(492) + o)), null;
      }
      const d = h[a(518)];
      if (d < 0 || d > 65535) return i(new Error("Invalid tracker port: " + o)), null;
      const u = h.protocol;
      return u !== a(500) && u !== a(488) || !r || u === a(500) && typeof window !== a(520) && window.location[a(512)] === a(506) ? (i(new Error(a(462) + o)), null) : new ln(this, o);
    })[e(525)](Boolean);
  }
  [j(474)](t) {
    const e = j;
    (t = this._defaultAnnounceOpts(t))[e(526)] = "started", It("send `start` %o", t), this[e(491)](t), this[e(469)][e(496)]((s) => {
      s[e(515)]();
    });
  }
  [j(521)](t) {
    const e = j;
    (t = this[e(490)](t))[e(526)] = e(529), It(e(456), t), this._announce(t);
  }
  [j(503)](t) {
    const e = j;
    t || (t = {}), (t = this[e(490)](t))[e(526)] = "completed", It("send `complete` %o", t), this[e(491)](t);
  }
  [j(459)](t) {
    const e = j;
    (t = this[e(490)](t))[e(526)] && delete t[e(526)], It(e(517), t), this[e(491)](t);
  }
  async [j(524)](t) {
    const e = j, s = this._trackers[0];
    s && typeof s[e(524)] === e(473) && s[e(524)](t);
  }
  [j(491)](t) {
    const e = j;
    this._trackers[e(496)]((s) => {
      s[e(502)](t);
    });
  }
  scrape(t) {
    const e = j;
    It(e(504)), t || (t = {}), this._trackers[e(496)]((s) => {
      s[e(489)](t);
    });
  }
  [j(515)](t) {
    const e = j;
    It("setInterval %d", t), this[e(469)][e(496)]((s) => {
      s[e(515)](t);
    });
  }
  [j(466)](t) {
    const e = j;
    if (this[e(485)]) return;
    this.destroyed = !0, It("destroy");
    const s = this[e(469)].map((r) => (i) => {
      r[e(466)](i);
    });
    Pa(s, t), this[e(469)] = [], this[e(484)] = null;
  }
  [j(490)](t = {}) {
    const e = j;
    return t.numwant == null && (t[e(493)] = dn[e(481)]), t.uploaded == null && (t[e(522)] = 0), t[e(475)] == null && (t[e(475)] = 0), this[e(484)] && (t = Object[e(454)]({}, t, this._getAnnounceOpts())), t;
  }
}
function On() {
  const n = ["setInterval", "getAnnounceOpts", "send `update` %o", "port", "bittorrent-tracker:client", "undefined", "stop", "uploaded", "rtcConfig", "statsCollector", "filter", "event", "_userAgent", "isArray", "stopped", "assign", "2395845zcYbvf", "send `stop` %o", "_infoHashBinary", "292726sLAPbV", "update", "342840VMEBkf", "_peerIdBinary", "Unsupported tracker protocol: ", "22PoIFBS", "Option `infoHash` is required", "Option `port` is required", "destroy", "wrtc", "1276548xkVHbT", "_trackers", "substring", "_infoHashBuffer", "warning", "function", "start", "downloaded", "from", "WEBRTC_SUPPORT", "infoHash", "parseUrl", "_wrtc", "DEFAULT_ANNOUNCE_PEERS", "error", "emit", "_getAnnounceOpts", "destroyed", "peerId", "81QwBFSf", "wss:", "scrape", "_defaultAnnounceOpts", "_announce", "Invalid tracker URL: ", "numwant", "map", "4285796xghvqN", "forEach", "Option `announce` is required", "userAgent", "244884ljkUdn", "ws:", "new client %s", "announce", "complete", "send `scrape`", "length", "https:", "_proxyOpts", "_peerIdBuffer", "once", "string", "2545182wWoPiW", "protocol", "isView", "01234567890123456789"];
  return (On = function() {
    return n;
  })();
}
function Ho(n, t) {
  var e = Mn();
  return (Ho = function(s, r) {
    return e[s -= 127];
  })(n, t);
}
function Mn() {
  var n = ["72904XYrhtH", "39CEkQGh", "135puXRmu", "8YsJEZT", "24XRuyeu", "351laTnNc", "15585HKaGYk", "12997ziaRxp", "1858857qtSUzh", "1548KWcQcg", "119378dAmrkd", "367301TtEdfX", "956150RMUzFJ", "46ldyqmr"];
  return (Mn = function() {
    return n;
  })();
}
pn.scrape = (n, t) => {
  const e = j;
  if (t = Aa(t), !n[e(478)]) throw new Error(e(464));
  if (!n[e(502)]) throw new Error("Option `announce` is required");
  const s = Object[e(454)]({}, n, { infoHash: Array[e(528)](n[e(478)]) ? n[e(478)][0] : n[e(478)], peerId: Tn(e(514)), port: 6881 }), r = new pn(s);
  r[e(509)](e(482), t), r.once(e(472), t);
  let i = Array.isArray(n[e(478)]) ? n[e(478)][e(505)] : 1;
  const o = {};
  return r.on(e(489), (a) => {
    const h = e;
    if (i -= 1, o[a[h(478)]] = a, i === 0) {
      r[h(466)]();
      const d = Object.keys(o);
      d.length === 1 ? t(null, o[d[0]]) : t(null, o);
    }
  }), r.scrape({ infoHash: n[e(478)] }), r;
}, function() {
  for (var n = Ho, t = Mn(); ; ) try {
    if (-parseInt(n(139)) / 1 * (-parseInt(n(131)) / 2) + -parseInt(n(133)) / 3 * (parseInt(n(132)) / 4) + -parseInt(n(138)) / 5 * (parseInt(n(127)) / 6) + -parseInt(n(140)) / 7 * (-parseInt(n(135)) / 8) + parseInt(n(134)) / 9 * (parseInt(n(130)) / 10) + -parseInt(n(129)) / 11 * (-parseInt(n(136)) / 12) + -parseInt(n(137)) / 13 * (parseInt(n(128)) / 14) === 794136) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
}();
var vr, nn = { exports: {} }, $a = function() {
  if (vr) return nn.exports;
  function n(w, y, g, p, _, S, I) {
    var H = w + (y & g | ~y & p) + (_ >>> 0) + I;
    return (H << S | H >>> 32 - S) + y;
  }
  function t(w, y, g, p, _, S, I) {
    var H = w + (y & p | g & ~p) + (_ >>> 0) + I;
    return (H << S | H >>> 32 - S) + y;
  }
  function e(w, y, g, p, _, S, I) {
    var H = w + (y ^ g ^ p) + (_ >>> 0) + I;
    return (H << S | H >>> 32 - S) + y;
  }
  function s(w, y, g, p, _, S, I) {
    var H = w + (g ^ (y | ~p)) + (_ >>> 0) + I;
    return (H << S | H >>> 32 - S) + y;
  }
  function r(w) {
    return String.fromCharCode(255 & w);
  }
  function i(w) {
    return r(w) + r(w >>> 8) + r(w >>> 16) + r(w >>> 24);
  }
  vr = 1;
  var o = function(w) {
    return unescape(encodeURIComponent(w));
  }, a = nn.exports = function(w) {
    return d(w).toHex();
  }, h = a.fromBytes = function(w) {
    for (var y = function(lt) {
      for (var rt = lt.length, Nt = rt << 3, wt = new Uint32Array(rt + 72 >>> 6 << 4), pt = 0, zt = lt.length; pt < zt; ++pt) wt[pt >>> 2] |= lt.charCodeAt(pt) << ((3 & pt) << 3);
      return wt[rt >> 2] |= 128 << (31 & Nt), wt[wt.length - 2] = Nt, wt;
    }(w), g = 1732584193, p = 4023233417, _ = 2562383102, S = 271733878, I = 0, H = y.length; I < H; I += 16) {
      var oe = g, ae = p, he = _, Qe = S;
      g = n(g, p, _, S, y[I + 0], 7, 3614090360), S = n(S, g, p, _, y[I + 1], 12, 3905402710), _ = n(_, S, g, p, y[I + 2], 17, 606105819), p = n(p, _, S, g, y[I + 3], 22, 3250441966), g = n(g, p, _, S, y[I + 4], 7, 4118548399), S = n(S, g, p, _, y[I + 5], 12, 1200080426), _ = n(_, S, g, p, y[I + 6], 17, 2821735955), p = n(p, _, S, g, y[I + 7], 22, 4249261313), g = n(g, p, _, S, y[I + 8], 7, 1770035416), S = n(S, g, p, _, y[I + 9], 12, 2336552879), _ = n(_, S, g, p, y[I + 10], 17, 4294925233), p = n(p, _, S, g, y[I + 11], 22, 2304563134), g = n(g, p, _, S, y[I + 12], 7, 1804603682), S = n(S, g, p, _, y[I + 13], 12, 4254626195), _ = n(_, S, g, p, y[I + 14], 17, 2792965006), g = t(g, p = n(p, _, S, g, y[I + 15], 22, 1236535329), _, S, y[I + 1], 5, 4129170786), S = t(S, g, p, _, y[I + 6], 9, 3225465664), _ = t(_, S, g, p, y[I + 11], 14, 643717713), p = t(p, _, S, g, y[I + 0], 20, 3921069994), g = t(g, p, _, S, y[I + 5], 5, 3593408605), S = t(S, g, p, _, y[I + 10], 9, 38016083), _ = t(_, S, g, p, y[I + 15], 14, 3634488961), p = t(p, _, S, g, y[I + 4], 20, 3889429448), g = t(g, p, _, S, y[I + 9], 5, 568446438), S = t(S, g, p, _, y[I + 14], 9, 3275163606), _ = t(_, S, g, p, y[I + 3], 14, 4107603335), p = t(p, _, S, g, y[I + 8], 20, 1163531501), g = t(g, p, _, S, y[I + 13], 5, 2850285829), S = t(S, g, p, _, y[I + 2], 9, 4243563512), _ = t(_, S, g, p, y[I + 7], 14, 1735328473), g = e(g, p = t(p, _, S, g, y[I + 12], 20, 2368359562), _, S, y[I + 5], 4, 4294588738), S = e(S, g, p, _, y[I + 8], 11, 2272392833), _ = e(_, S, g, p, y[I + 11], 16, 1839030562), p = e(p, _, S, g, y[I + 14], 23, 4259657740), g = e(g, p, _, S, y[I + 1], 4, 2763975236), S = e(S, g, p, _, y[I + 4], 11, 1272893353), _ = e(_, S, g, p, y[I + 7], 16, 4139469664), p = e(p, _, S, g, y[I + 10], 23, 3200236656), g = e(g, p, _, S, y[I + 13], 4, 681279174), S = e(S, g, p, _, y[I + 0], 11, 3936430074), _ = e(_, S, g, p, y[I + 3], 16, 3572445317), p = e(p, _, S, g, y[I + 6], 23, 76029189), g = e(g, p, _, S, y[I + 9], 4, 3654602809), S = e(S, g, p, _, y[I + 12], 11, 3873151461), _ = e(_, S, g, p, y[I + 15], 16, 530742520), g = s(g, p = e(p, _, S, g, y[I + 2], 23, 3299628645), _, S, y[I + 0], 6, 4096336452), S = s(S, g, p, _, y[I + 7], 10, 1126891415), _ = s(_, S, g, p, y[I + 14], 15, 2878612391), p = s(p, _, S, g, y[I + 5], 21, 4237533241), g = s(g, p, _, S, y[I + 12], 6, 1700485571), S = s(S, g, p, _, y[I + 3], 10, 2399980690), _ = s(_, S, g, p, y[I + 10], 15, 4293915773), p = s(p, _, S, g, y[I + 1], 21, 2240044497), g = s(g, p, _, S, y[I + 8], 6, 1873313359), S = s(S, g, p, _, y[I + 15], 10, 4264355552), _ = s(_, S, g, p, y[I + 6], 15, 2734768916), p = s(p, _, S, g, y[I + 13], 21, 1309151649), g = s(g, p, _, S, y[I + 4], 6, 4149444226), S = s(S, g, p, _, y[I + 11], 10, 3174756917), _ = s(_, S, g, p, y[I + 2], 15, 718787259), p = s(p, _, S, g, y[I + 9], 21, 3951481745), g = g + oe >>> 0, p = p + ae >>> 0, _ = _ + he >>> 0, S = S + Qe >>> 0;
    }
    var dt = new String(i(g) + i(p) + i(_) + i(S));
    return dt.toHex = function() {
      for (var lt = "", rt = 0, Nt = dt.length; rt < Nt; ++rt) lt += (256 + (255 & dt.charCodeAt(rt))).toString(16).substr(-2);
      return lt;
    }, dt;
  }, d = a.fromUtf8 = function(w) {
    return h(o(w));
  }, u = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
  function l(w, y) {
    for (var g = ""; --y >= 0; w >>>= 6) g += u.charAt(63 & w);
    return g;
  }
  var m = [0, 6, 12, 1, 7, 13, 2, 8, 14, 3, 9, 15, 4, 10, 5, 11], v = a.salt = function(w) {
    var y = "";
    w || (w = 8);
    do
      y += u.charAt(64 * Math.random() >>> 0);
    while (--w);
    return y;
  };
  return a.crypt = function(w, y) {
    if (w.length > 64) throw Error("too long key");
    y || (y = "$1$" + v()), w = o(w);
    for (var g = o(y.replace(/^\$1\$([^$]+)(?:\$.*)?$/, "$1")), p = h(w + g + w), _ = w + "$1$" + g, S = w.length; S > 16; S -= 16) _ += p;
    for (_ += p.slice(0, S), S = w.length; S; S >>= 1) _ += 1 & S ? "\0" : w.charAt(0);
    p = h(_);
    for (var I = 0; I < 1e3; ++I) p = h((1 & I ? w : p) + (I % 3 ? g : "") + (I % 7 ? w : "") + (1 & I ? p : w));
    var H = "$1$" + g + "$";
    for (I = 0; I < 15; I += 3) H += l(p.charCodeAt(m[I + 0]) << 16 | p.charCodeAt(m[I + 1]) << 8 | p.charCodeAt(m[I + 2]), 4);
    return H + l(p.charCodeAt(m[15]), 2);
  }, nn.exports;
}();
const th = Bt($a), eh = Bn;
function Bn(n, t) {
  const e = Nn();
  return (Bn = function(s, r) {
    return e[s -= 298];
  })(n, t);
}
(function() {
  const n = Bn, t = Nn();
  for (; ; ) try {
    if (parseInt(n(298)) / 1 * (parseInt(n(301)) / 2) + parseInt(n(311)) / 3 * (-parseInt(n(299)) / 4) + parseInt(n(304)) / 5 * (-parseInt(n(302)) / 6) + -parseInt(n(300)) / 7 * (-parseInt(n(306)) / 8) + -parseInt(n(307)) / 9 * (-parseInt(n(305)) / 10) + -parseInt(n(308)) / 11 + -parseInt(n(310)) / 12 * (parseInt(n(309)) / 13) === 742763) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
const nh = eh(303);
function Nn() {
  const n = ["1109288xATAbx", "9TKerfJ", "12800073QRaevf", "13KqdquJ", "3312324dSugLX", "73479fnNWUR", "47LkIPpy", "232TfLLWj", "63HWmhka", "46028YMBYOs", "6nypvTb", "2.1.0", "750655LDdJzh", "14235510TnNBOk"];
  return (Nn = function() {
    return n;
  })();
}
const Te = Dn;
function Dn(n, t) {
  const e = Fn();
  return (Dn = function(s, r) {
    return e[s -= 451];
  })(n, t);
}
(function() {
  const n = Dn, t = Fn();
  for (; ; ) try {
    if (parseInt(n(457)) / 1 + parseInt(n(451)) / 2 + -parseInt(n(458)) / 3 + -parseInt(n(452)) / 4 * (parseInt(n(459)) / 5) + -parseInt(n(462)) / 6 + -parseInt(n(456)) / 7 * (parseInt(n(464)) / 8) + -parseInt(n(453)) / 9 * (-parseInt(n(454)) / 10) === 511263) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
const Wo = "-PM" + function(n) {
  const t = Te, e = n[t(466)](".");
  return "" + e[0].padStart(2, "0") + e[1][t(463)](2, "0");
}(nh) + "-";
function Fn() {
  const n = ["1310268aIFYXx", "480DoTYmk", "floor", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", "4653114oxyeFZ", "padStart", "2657848zUEtBL", "random", "split", "fromUtf8", "928526CUhLNR", "18992JmrTXh", "63GaSyMV", "3265390zWFPGO", "push", "21NMRmUr", "426003qQCWwM"];
  return (Fn = function() {
    return n;
  })();
}
const Cr = Te(461), kr = Object.freeze(Object.defineProperty({ __proto__: null, TRACKER_CLIENT_VERSION_PREFIX: Wo, generatePeerId: function(n) {
  const t = Te, e = [n], s = 20 - n.length;
  for (let r = 0; r < s; r++) e[t(455)](Cr[Math[t(460)](Math[t(465)]() * Cr.length)]);
  return e.join("");
}, getStreamHash: function(n) {
  const t = th[Te(467)](n).slice(1);
  return btoa(t);
} }, Symbol.toStringTag, { value: "Module" }));
function zo(n) {
  return n.type + "-" + n.index;
}
function Un(n, t) {
  const e = qn();
  return (Un = function(s, r) {
    return e[s -= 297];
  })(n, t);
}
function Qo(n) {
  const { externalId: t } = n;
  return "(" + zo(n.stream) + " | " + t + ")";
}
function qn() {
  const n = ["3390vHCUSB", "http-p2p-window", "p2p-window", "1284828PllQBt", "11353016lqOreP", "3764oYAuDh", "4280269XJCUAf", "259215TpQxVr", "http-window", "1677663NMXzQb", "high-demand", "710070bXlRdj"];
  return (qn = function() {
    return n;
  })();
}
(function() {
  const n = Un, t = qn();
  for (; ; ) try {
    if (-parseInt(n(298)) / 1 + -parseInt(n(302)) / 2 + parseInt(n(300)) / 3 + parseInt(n(308)) / 4 * (-parseInt(n(303)) / 5) + parseInt(n(306)) / 6 + -parseInt(n(297)) / 7 + parseInt(n(307)) / 8 === 328771) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
const xt = Object.freeze(Object.defineProperty({ __proto__: null, getSegmentPlaybackStatusesString: function(n) {
  const t = Un, { isHighDemand: e, isHttpDownloadable: s, isP2PDownloadable: r } = n;
  return e ? t(301) : s && r ? t(304) : s ? t(299) : r ? t(305) : "-";
}, getSegmentString: Qo, getStreamString: zo }, Symbol.toStringTag, { value: "Module" }));
function fn(n, t) {
  const e = J;
  t === void 0 && (t = n.reduce((i, o) => i + o[e(139)], 0));
  const s = new Uint8Array(t);
  let r = 0;
  for (const i of n) s.set(i, r), r += i[e(139)];
  return s;
}
function jn() {
  const n = ["156ACZecK", "1358441dSceGF", "isArray", "object", "keys", "floor", "1361330CSiZQb", "11811976YZSqEI", "__proto__", "set", "byteLength", "prototype", "130955wqmDnx", "buffer", "14LXYSlp", "181483bTrxtu", "encodeInto", "forEach", "63fwgKBT", "map", "911324LrfBIj", "3013284vdoDcv", "random", "length"];
  return (jn = function() {
    return n;
  })();
}
function J(n, t) {
  const e = jn();
  return (J = function(s, r) {
    return e[s -= 129];
  })(n, t);
}
function gn(n) {
  const t = J, e = new TextEncoder(), s = new Uint8Array(n.length);
  return e[t(145)](n, s), s;
}
function Jo(n) {
  const t = J, e = new Uint8Array(n[t(152)] / 2);
  for (let s = 0; s < n[t(152)]; s += 2) e[s / 2] = parseInt(n.slice(s, s + 2), 16);
  return new TextDecoder().decode(e);
}
function Yo(n) {
  return !!n && typeof n === J(132) && !Array.isArray(n);
}
function Go(n) {
  return function t(e) {
    const s = J;
    if (Yo(e)) {
      const r = {};
      return Object[s(133)](e)[s(146)]((i) => {
        if (e[i] !== void 0) {
          const o = t(e[i]);
          o !== void 0 && (r[i] = o);
        }
      }), r;
    }
    return e;
  }(n);
}
function St(n) {
  const t = J;
  if (e = n, Array[J(131)](e)) return n[t(148)]((s) => St(s));
  if (Yo(n)) {
    const s = {};
    for (const r of Object[t(133)](n)) s[r] = St(n[r]);
    return s;
  }
  return n;
  var e;
}
function Xo(n) {
  const t = J;
  for (let e = n[t(152)] - 1; e > 0; e--) {
    const s = Math[t(134)](Math[t(151)]() * (e + 1));
    [n[e], n[s]] = [n[s], n[e]];
  }
  return n;
}
function Ut(n, t, e = {}) {
  const s = J;
  return typeof n !== s(132) || n === null || typeof t !== s(132) || t === null || Object[s(133)](t).forEach((r) => {
    const i = s;
    if (r === i(137) || r === "constructor" || r === i(140)) throw new Error("Attempt to modify restricted property '" + String(r) + "'");
    const o = t[r], a = e[r];
    r in n && (n[r] = o === void 0 ? a === void 0 ? void 0 : a : o);
  }), n;
}
function we(n) {
  const t = J, { defaultConfig: e, baseConfig: s = {}, specificStreamConfig: r = {} } = n, i = St({ ...e, ...s, ...r }), o = Object.keys(e), a = {};
  return o[t(146)]((h) => {
    h in i && (a[h] = i[h]);
  }), a;
}
(function() {
  const n = J, t = jn();
  for (; ; ) try {
    if (-parseInt(n(144)) / 1 * (parseInt(n(143)) / 2) + -parseInt(n(150)) / 3 + -parseInt(n(149)) / 4 + -parseInt(n(141)) / 5 * (-parseInt(n(129)) / 6) + parseInt(n(130)) / 7 + parseInt(n(136)) / 8 + parseInt(n(147)) / 9 * (parseInt(n(135)) / 10) === 801817) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
const ee = Object.freeze(Object.defineProperty({ __proto__: null, arrayBackwards: function* (n) {
  for (let t = n[J(152)] - 1; t >= 0; t--) yield n[t];
}, deepCopy: St, filterUndefinedProps: Go, getControlledPromise: function() {
  let n, t;
  return { promise: new Promise((e, s) => {
    n = e, t = s;
  }), resolve: n, reject: t };
}, getPercent: function(n, t) {
  return n / t * 100;
}, getRandomItem: function(n) {
  const t = J;
  return n[Math.floor(Math[t(151)]() * n[t(152)])];
}, hexToUtf8: Jo, joinChunks: fn, joinChunksArrayBuffer: function(n, t) {
  const e = J;
  return fn(n, t)[e(142)];
}, joinChunksUint8Array: function(n, t) {
  const e = J;
  t === void 0 && (t = n.reduce((i, o) => i + o.byteLength, 0));
  const s = new Uint8Array(t);
  let r = 0;
  for (const i of n) s[e(138)](i, r), r += i[e(139)];
  return s;
}, mergeAndFilterConfig: we, overrideConfig: Ut, shuffleArray: Xo, utf8ToUintArray: gn }, Symbol.toStringTag, { value: "Module" }));
function Hn(n, t) {
  var e = Wn();
  return (Hn = function(s, r) {
    return e[s -= 365];
  })(n, t);
}
function Wn() {
  var n = ["SegmentDataSendingCompleted", "3098474PTDuPM", "2611zscSJU", "SegmentsAnnouncement", "SegmentAbsent", "SegmentRequest", "7896690pjbnMu", "12zXAsGO", "5944635UGmUbJ", "70Zwzzlv", "1096732uyjJjZ", "14728eqpQYh", "SegmentData", "7286928oMJdoM", "136296OiXOqz", "CancelSegmentRequest"];
  return (Wn = function() {
    return n;
  })();
}
(function() {
  for (var n = Hn, t = Wn(); ; ) try {
    if (parseInt(n(366)) / 1 + -parseInt(n(373)) / 2 + parseInt(n(379)) / 3 * (parseInt(n(370)) / 4) + -parseInt(n(378)) / 5 + -parseInt(n(369)) / 6 + -parseInt(n(374)) / 7 * (parseInt(n(367)) / 8) + parseInt(n(380)) / 9 * (parseInt(n(365)) / 10) === 826877) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
var X, et, Ct = ((X = Ct || {})[X[(et = Hn)(375)] = 0] = "SegmentsAnnouncement", X[X[et(377)] = 1] = et(377), X[X[et(368)] = 2] = et(368), X[X[et(372)] = 3] = et(372), X[X[et(376)] = 4] = et(376), X[X[et(371)] = 5] = et(371), X);
const nt = ct;
(function() {
  const n = ct, t = Qn();
  for (; ; ) try {
    if (-parseInt(n(475)) / 1 * (-parseInt(n(510)) / 2) + parseInt(n(494)) / 3 * (parseInt(n(486)) / 4) + -parseInt(n(502)) / 5 + -parseInt(n(490)) / 6 * (-parseInt(n(499)) / 7) + parseInt(n(487)) / 8 * (-parseInt(n(493)) / 9) + -parseInt(n(477)) / 10 * (-parseInt(n(480)) / 11) + parseInt(n(496)) / 12 * (-parseInt(n(508)) / 13) === 735751) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
var zn = ((n) => {
  const t = ct;
  return n[n[t(478)] = -1] = t(478), n[n.Int = 0] = t(497), n[n[t(498)] = 1] = t(498), n[n.String = 2] = t(495), n[n[t(505)] = 3] = t(505), n;
})(zn || {});
function ct(n, t) {
  const e = Qn();
  return (ct = function(s, r) {
    return e[s -= 471];
  })(n, t);
}
function sh(n) {
  const t = n < 0, e = function(o) {
    const a = ct, h = o[a(488)](2), d = o < 0 ? h[a(509)] : h.length + 1;
    return Math[a(479)](d / 8);
  }(n), s = new Uint8Array(e), r = BigInt(e);
  var i;
  n = (i = n) < 0 ? -i : i;
  for (let o = 0; o < e; o++) {
    const a = n >> 0x8n * (r - 0x1n - BigInt(o)) & 0xffn;
    s[o] = Number(a);
  }
  return t && (s[0] = 128 | s[0]), s;
}
function rh(n) {
  const t = BigInt(n.length), e = (r, i) => {
    const o = 0x8n * (t - 0x1n - BigInt(i));
    return BigInt(r) << o;
  };
  let s = e(127 & n[0], 0);
  for (let r = 1; r < t; r++) s = e(n[r], r) | s;
  return (128 & n[0]) >> 7 && (s = -s), s;
}
function xr(n) {
  const t = sh(n), e = 0 | t.length;
  return new Uint8Array([e, ...t]);
}
function Qn() {
  const n = ["63VEewYy", "3993dEikfl", "String", "613848OuktDO", "Int", "SimilarIntArray", "257684xlIEVa", "end", "isArray", "4705230FHbHPt", "addBytes", "utf8", "Max", "unshift", "Trying to deserialize bytes (sting) with invalid serialized item code.", "260lUTRXh", "length", "12242hKnJKJ", "Trying to deserialize integer with invalid serialized item code", "set", "_length", "getBuffer", "43FGRryX", "bytes", "150kSZVNk", "Min", "ceil", "959739OjOmoZ", "decode", "start", "Trying to deserialize similar int array with invalid serialized item code", "encode", "slice", "3160FWcvSA", "711976xyYBTf", "toString", "getBytesChunks", "114GFOtbl", "push", "get"];
  return (Qn = function() {
    return n;
  })();
}
function Tr(n) {
  const t = ct, e = n[0];
  if (e >> 4 !== 0) throw new Error(t(471));
  const s = 15 & e, r = 1 + s;
  return { number: rh(n.slice(1, r)), byteLength: s + 1 };
}
var Br;
class Kt {
  constructor() {
    f(this, Br, []);
    f(this, "_length", 0);
  }
  [(Br = nt(476), nt(491))](t) {
    const e = nt;
    this[e(503)](t, e(500));
  }
  [nt(506)](t) {
    const e = nt;
    this[e(503)](t, e(482));
  }
  addBytes(t, e) {
    const s = nt;
    let r;
    r = t instanceof Uint8Array ? t : Array[s(501)](t) ? new Uint8Array(t) : new Uint8Array([t]), this._length += r.length, this[s(476)][e === s(482) ? s(506) : "push"](r);
  }
  [nt(489)]() {
    return this[nt(476)];
  }
  [nt(474)]() {
    return fn(this.bytes, this._length);
  }
  get [nt(509)]() {
    return this[nt(473)];
  }
}
const st = Object.freeze(Object.defineProperty({ __proto__: null, ResizableUint8Array: Kt, SerializedItem: zn, deserializeInt: Tr, deserializeSimilarIntArray: function(n) {
  const t = ct, [e, s] = n;
  if (e >> 4 !== 1) throw new Error(t(483));
  let r = 2;
  const i = [];
  for (let o = 0; o < s; o++) {
    const { number: a, byteLength: h } = Tr(n[t(485)](r));
    r += h;
    const d = 0xffn & a, u = -256n & a;
    for (let l = 0; l < d; l++) {
      const m = BigInt(n[r]);
      i.push(u | m), r++;
    }
  }
  return { numbers: i, byteLength: r };
}, deserializeString: function(n) {
  const t = ct, [e, s] = n;
  if (e >> 4 !== 2) throw new Error(t(507));
  const r = (15 & e) << 8 | s, i = n[t(485)](2, r + 2);
  return { string: new TextDecoder(t(504))[t(481)](i), byteLength: r + 2 };
}, serializeInt: xr, serializeSimilarIntArray: function(n) {
  const t = ct, e = /* @__PURE__ */ new Map();
  for (const r of n) {
    const i = -256n & r, o = 0xffn & r, a = e[t(492)](i) ?? new Kt();
    a[t(509)] || e[t(472)](i, a), a[t(491)](Number(o));
  }
  const s = new Kt();
  s[t(491)]([16, e.size]);
  for (const [r, i] of e) {
    const { length: o } = i.getBytesChunks(), a = r | 0xffn & BigInt(o);
    i[t(506)](xr(a)), s[t(491)](i[t(474)]());
  }
  return s.getBuffer();
}, serializeString: function(n) {
  const t = ct, { length: e } = n, s = new Kt();
  return s[t(491)]([32 | e >> 8 & 15, 255 & e]), s[t(491)](new TextEncoder()[t(484)](n)), s.getBuffer();
} }, Symbol.toStringTag, { value: "Module" })), B = Jn;
(function() {
  const n = Jn, t = Yn();
  for (; ; ) try {
    if (parseInt(n(365)) / 1 * (parseInt(n(339)) / 2) + parseInt(n(353)) / 3 + parseInt(n(349)) / 4 + -parseInt(n(328)) / 5 * (-parseInt(n(337)) / 6) + parseInt(n(343)) / 7 * (-parseInt(n(346)) / 8) + -parseInt(n(323)) / 9 * (-parseInt(n(332)) / 10) + parseInt(n(356)) / 11 * (-parseInt(n(317)) / 12) === 355242) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
const Wt = Ne(B(359), 4), ne = Ne("cend", 4), mn = Ne("dstr", 4), yn = Ne("dend", 4), ih = [Wt, mn], oh = [ne, yn], Er = Wt.length + ne.length;
class _n extends Error {
  constructor(t) {
    const e = B;
    super(), this[e(335)] = t;
  }
}
var Nr, Dr;
class ah {
  constructor(t) {
    f(this, Dr, new st[B(360)]());
    f(this, Nr, B(347));
    this[B(358)] = t;
  }
  [(Dr = B(331), Nr = B(325), B(354))](t) {
    const e = B;
    if (this[e(325)] === e(314)) return;
    const s = Ee(t, Wt, 4);
    if (!this[e(331)][e(334)] && !s) throw new _n(e(355));
    if (this[e(331)][e(334)] && s) throw new _n("incomplete-joining");
    this.chunks[e(333)](this[e(361)](t)), Ee(t[B(320)](-4), ne, 4) && (this[e(325)] = e(314), this.onComplete(this[e(331)].getBuffer()));
  }
  [B(361)](t) {
    const e = B;
    return t.slice(4, t[e(334)] - 4);
  }
}
var Fr, Ur;
class ge {
  constructor(t, e) {
    f(this, "bytes", new Kt());
    f(this, Ur, []);
    f(this, Fr, B(364));
    const s = B;
    this[s(316)] = e, this.bytes[s(333)](t);
  }
  addInteger(t, e) {
    const s = B;
    this.bytes[s(333)](t[s(338)](0));
    const r = st[s(318)](BigInt(e));
    this[s(326)][s(333)](r);
  }
  [(Ur = B(327), Fr = B(325), B(321))](t, e) {
    const s = B;
    this.bytes.push(t.charCodeAt(0));
    const r = st[s(336)](e[s(315)]((i) => BigInt(i)));
    this[s(326)].push(r);
  }
  addString(t, e) {
    const s = B;
    this[s(326)][s(333)](t[s(338)](0));
    const r = st[s(342)](e);
    this.bytes[s(333)](r);
  }
  [B(348)]() {
    const t = B;
    if (!this[t(326)][t(334)]) throw new Error("Buffer is empty");
    if (this[t(325)] === t(314)) return;
    this[t(325)] = "completed";
    const e = this[t(326)][t(313)]();
    if (e[t(334)] + Er <= this[t(316)]) return void this.resultBuffers[t(333)](me(e, Wt, ne));
    let s = Math[t(340)](e[t(334)] / this[t(316)]);
    Math[t(340)](e[t(334)] / s) + Er > this[t(316)] && s++;
    for (const [r, i] of function* (o, a) {
      const h = B, d = Math[h(340)](o[h(334)] / a);
      for (let u = 0; u < a; u++) yield [u, o[h(320)](u * d, (u + 1) * d)];
    }(e, s)) r === 0 ? this.resultBuffers.push(me(i, Wt, yn)) : r === s - 1 ? this[t(327)].push(me(i, mn, ne)) : this[t(327)][t(333)](me(i, mn, yn));
  }
  [B(366)]() {
    const t = B;
    if (this[t(325)] === "creating" || !this[t(327)][t(334)]) throw new Error(t(319));
    return this[t(327)];
  }
}
function Jn(n, t) {
  const e = Yn();
  return (Jn = function(s, r) {
    return e[s -= 313];
  })(n, t);
}
function hh(n) {
  const t = B, e = n >> 4;
  if (e <= zn[t(322)] || e >= st[t(330)][t(345)]) throw new Error(t(362));
  return e;
}
function Ne(n, t) {
  const e = B;
  if (n[e(334)] !== t) throw new Error(e(344));
  const s = new Uint8Array(t);
  for (let r = 0; r < n[e(334)]; r++) s[r] = n[e(338)](r);
  return s;
}
function Yn() {
  const n = ["ceil", "Int", "serializeString", "170737EloCZX", "Wrong string length", "Max", "64MJnRhe", "joining", "complete", "2692324yfUYMd", "deserializeInt", "fromCharCode", "deserializeString", "647046IcDdqg", "addCommandChunk", "no-first-chunk", "120527IOIiPH", "SimilarIntArray", "onComplete", "cstr", "ResizableUint8Array", "unframeCommandChunk", "Not existing type", "set", "creating", "568318cTKhkf", "getResultBuffers", "getBuffer", "completed", "map", "maxChunkLength", "2004JPbFBe", "serializeInt", "Command is not complete.", "slice", "addSimilarIntArr", "Min", "8766mWHdgd", "some", "status", "bytes", "resultBuffers", "1885WImoTt", "deserializeSimilarIntArray", "SerializedItem", "chunks", "6590KRnKyE", "push", "length", "type", "serializeSimilarIntArray", "4476hFqIpz", "charCodeAt", "2mIERRq"];
  return (Yn = function() {
    return n;
  })();
}
function me(n, t, e) {
  const s = B, r = new Uint8Array(n[s(334)] + t.length + e.length);
  return r[s(363)](t), r.set(n, t[s(334)]), r[s(363)](e, t[s(334)] + n[s(334)]), r;
}
function Ee(n, t, e) {
  for (let s = 0; s < e; s++) if (n[s] !== t[s]) return !1;
  return !0;
}
function Gn() {
  const n = ["5MVXwUD", "length", "2wCRtZp", "3425096VWQcII", "11022057ekbItI", "SegmentDataSendingCompleted", "1324365xtaBjp", "SegmentRequest", "SegmentData", "11OeGWJU", "addSimilarIntArr", "2529284whzRJN", "getResultBuffers", "5875368WMxQWq", "21ZmJARr", "7929410GHiPdq", "1090696hvfPKy", "CancelSegmentRequest", "addInteger", "SegmentAbsent", "SegmentsAnnouncement", "complete"];
  return (Gn = function() {
    return n;
  })();
}
function Rt(n, t) {
  const e = Gn();
  return (Rt = function(s, r) {
    return e[s -= 238];
  })(n, t);
}
function Ko(n, t) {
  const e = Rt;
  switch (n.c) {
    case Ct[e(254)]:
    case Ct[e(256)]:
    case Ct[e(242)]:
      return function(s, r) {
        const i = Rt, o = new ge(s.c, r);
        return o[i(255)]("i", s.i), o[i(255)]("r", s.r), o[i(258)](), o.getResultBuffers();
      }(n, t);
    case Ct[e(244)]:
      return function(s, r) {
        const i = Rt, o = new ge(s.c, r);
        return o[i(255)]("i", s.i), o[i(255)]("r", s.r), s.b && o[i(255)]("b", s.b), o[i(258)](), o[i(249)]();
      }(n, t);
    case Ct[e(257)]:
      return function(s, r) {
        const i = Rt, { c: o, p: a, l: h } = s, d = new ge(o, r);
        return h != null && h[i(238)] && d[i(247)]("l", h), a != null && a.length && d[i(247)]("p", a), d[i(258)](), d.getResultBuffers();
      }(n, t);
    case Ct[e(245)]:
      return function(s, r) {
        const i = Rt, o = new ge(s.c, r);
        return o.addInteger("i", s.i), o[i(255)]("s", s.s), o[i(255)]("r", s.r), o.complete(), o[i(249)]();
      }(n, t);
  }
}
function Vo(n, t) {
  var e = Xn();
  return (Vo = function(s, r) {
    return e[s -= 302];
  })(n, t);
}
function Xn() {
  var n = ["588FuhMon", "1808792TJDPjS", "20245LaeBNt", "2187gWkEsz", "1326339luxefa", "350OuhmoP", "381359uUoWwn", "1734408pTukAJ", "7VZMQnR", "562zbNutd", "2912940PXRdyP"];
  return (Xn = function() {
    return n;
  })();
}
(function() {
  const n = Rt, t = Gn();
  for (; ; ) try {
    if (-parseInt(n(239)) / 1 * (-parseInt(n(253)) / 2) + parseInt(n(243)) / 3 + parseInt(n(248)) / 4 * (-parseInt(n(259)) / 5) + -parseInt(n(250)) / 6 + parseInt(n(251)) / 7 * (-parseInt(n(240)) / 8) + parseInt(n(241)) / 9 + parseInt(n(252)) / 10 * (parseInt(n(246)) / 11) === 653805) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})(), function() {
  for (var n = Vo, t = Xn(); ; ) try {
    if (parseInt(n(303)) / 1 * (parseInt(n(309)) / 2) + parseInt(n(304)) / 3 + parseInt(n(311)) / 4 * (parseInt(n(302)) / 5) + -parseInt(n(310)) / 6 + -parseInt(n(308)) / 7 * (-parseInt(n(312)) / 8) + parseInt(n(307)) / 9 + parseInt(n(305)) / 10 * (-parseInt(n(306)) / 11) === 371769) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
}();
const Vt = Object.freeze(Object.defineProperty({ __proto__: null, BinaryCommandChunksJoiner: ah, BinaryCommandJoiningError: _n, PeerCommandType: Ct, deserializeCommand: function(n) {
  const t = B, [e] = n, s = { c: e };
  let r = 1;
  for (; r < n[t(334)]; ) {
    const i = String[t(351)](n[r]);
    switch (r++, hh(n[r])) {
      case st[t(330)][t(341)]:
        {
          const { number: o, byteLength: a } = st[t(350)](n[t(320)](r));
          s[i] = Number(o), r += a;
        }
        break;
      case st[t(330)][t(357)]:
        {
          const { numbers: o, byteLength: a } = st[t(329)](n[t(320)](r));
          s[i] = o[t(315)]((h) => Number(h)), r += a;
        }
        break;
      case st[t(330)].String: {
        const { string: o, byteLength: a } = st[t(352)](n[t(320)](r));
        s[i] = o, r += a;
      }
    }
  }
  return s;
}, isCommandChunk: function(n) {
  const t = B, { length: e } = Wt, s = n[t(320)](-e);
  return ih.some((r) => Ee(n, r, 4)) && oh[t(324)]((r) => Ee(s, r, 4));
}, serializePeerCommand: Ko }, Symbol.toStringTag, { value: "Module" }));
function De(n, t) {
  const e = Kn();
  return (De = function(s, r) {
    return e[s -= 473];
  })(n, t);
}
const K = De;
function Kn() {
  const n = ["1492270zJxKtu", "BinaryCommandJoiningError", "drain", "stopUploading", "splitSegmentDataToChunksAndUploadAsync", "1936948FpyAcw", "byteOffset", "Expected ArrayBuffer, got SharedArrayBuffer", "sendCommand", "1229172aGrZHE", "Some segment data is already uploading.", "onSegmentChunkReceived", "4288711gOvwCz", "connection", "deserializeCommand", "onCommandReceived", "p2p", "eventHandlers", "getEventDispatcher", "onDataReceived", "1334271SKNPlo", "8YmjOUo", "uploadingContext", "addCommandChunk", "getControlledPromise", "isCommandChunk", "value", "commandChunks", "onChunkDownloaded", "idUtf8", "buffer", "peerConfig", "write", "61101igcKhy", "receivingCommandBytes", "next", "5EUixHA", "byteLength", "data", "730iDmjMJ", "416355aoxRER", "webRtcMaxMessageSize", "BinaryCommandChunksJoiner", "stopUploadingSegmentData", "onChunkUploaded", "off"];
  return (Kn = function() {
    return n;
  })();
}
(function() {
  const n = De, t = Kn();
  for (; ; ) try {
    if (-parseInt(n(478)) / 1 + parseInt(n(484)) / 2 + -parseInt(n(504)) / 3 + parseInt(n(489)) / 4 * (parseInt(n(474)) / 5) + parseInt(n(493)) / 6 + -parseInt(n(496)) / 7 * (parseInt(n(505)) / 8) + -parseInt(n(517)) / 9 * (-parseInt(n(477)) / 10) === 457046) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
var qr, jr, Hr;
class ch {
  constructor(t, e, s, r) {
    f(this, Hr);
    f(this, jr);
    f(this, "onChunkDownloaded");
    f(this, qr);
    f(this, "onDataReceived", (t) => {
      const e = K;
      Vt[e(509)](t) ? this[e(518)](t) : (this[e(501)][e(495)](t), this[e(512)](t[e(475)], e(500), this[e(497)].idUtf8));
    });
    const i = De;
    this[i(497)] = t, this[i(515)] = e, this.eventHandlers = s, this[i(512)] = r.getEventDispatcher(i(512)), this[i(482)] = r[i(502)](i(482)), t.on(i(476), this[i(503)]);
  }
  [(Hr = K(511), jr = K(506), qr = K(482), K(492))](t) {
    const e = K, s = Ko(t, this[e(515)][e(479)]);
    for (const r of s) this[e(497)][e(516)](r);
  }
  [K(481)]() {
    var e;
    const t = K;
    (e = this[t(506)]) == null || e[t(487)](), this.uploadingContext = void 0;
  }
  getUploadingRequestId() {
    var e;
    return (e = this[K(506)]) == null ? void 0 : e.requestId;
  }
  async [K(488)](t, e) {
    const s = K;
    if (this[s(506)]) throw new Error(s(494));
    const r = t[s(514)].slice(t[s(490)], t.byteOffset + t[s(475)]);
    if (!(r instanceof ArrayBuffer)) throw new Error(s(491));
    const i = function* (m, v) {
      const w = K;
      let y = m[w(475)];
      for (; y > 0; ) {
        const g = y >= v ? v : y, p = m[w(475)] - y, _ = m.slice(p, p + g);
        y -= g, yield _;
      }
    }(r, this[s(515)].webRtcMaxMessageSize), { promise: o, resolve: a, reject: h } = ee[s(508)]();
    let d = !1;
    const u = { stopUploading: () => {
      d = !1;
    }, requestId: e };
    this[s(506)] = u;
    const l = () => {
      const m = s;
      if (d) for (; ; ) {
        const v = i[m(473)]()[m(510)];
        if (!v) {
          a();
          break;
        }
        const w = this.connection.write(v);
        if (this[m(482)](v.byteLength, this.connection[m(513)]), !w) break;
      }
      else h();
    };
    try {
      this.connection.on(s(486), l), d = !0, l(), await o;
    } finally {
      this.connection[s(483)](s(486), l), this.uploadingContext === u && (this[s(506)] = void 0);
    }
  }
  receivingCommandBytes(t) {
    const e = K;
    !this[e(511)] && (this[e(511)] = new Vt[e(480)]((s) => {
      const r = e;
      this[r(511)] = void 0;
      const i = Vt[r(498)](s);
      this.eventHandlers[r(499)](i);
    }));
    try {
      this.commandChunks[e(507)](t);
    } catch (s) {
      if (!(s instanceof Vt[e(485)])) return;
      this[e(511)] = void 0;
    }
  }
}
function Fe(n, t) {
  const e = Vn();
  return (Fe = function(s, r) {
    return e[s -= 226];
  })(n, t);
}
function Vn() {
  const n = ["getSegmentStatus", "connection", "requestId", "sendSegmentAbsentCommand", "getPeerIdFromConnection", "request", "destroy", "eventTarget", "streamType", "Some segment already is downloading", "onPeerClosed", "2357721GosekE", "finish", "onPeerConnectionClosed", "peer-closed", "loadedSegments", "10KnPSXy", "peerConfig", "SegmentData", "SegmentRequest", "getEventDispatcher", "push", "onSegmentChunkReceived", "splitSegmentDataToChunksAndUploadAsync", "p2p-segment-validation-failed", "send segment ", "isSegmentDataCommandReceived", "p2pErrorRetries", "downloadingContext", "3882508zKiKbU", "peer-response-bytes-length-mismatch", "filter", "start", "floor", "stopUploadingSegmentData", "sendSegmentDataSendingCompletedCommand", "segment", "onSegmentsAnnouncement", "314025vrITat", "data", "peerProtocol", "downloadingErrors", "cancel segment request ", "SegmentDataSendingCompleted", "SegmentAbsent", "close", "setTotalBytes", "onPeerClose", "ERR_CONNECTION_FAILURE", "3326PBUdLM", "httpLoadingSegments", "has", "onCommandReceived", "p2pml-core:peer", "p2pNotReceivingBytesTimeoutMs", "8340521frjJnk", "externalId", "16Wvmmvf", "length", "peer connection error ", "segment ", "eventHandlers", "293424UftIXp", "onSegmentRequested", "107MXghTS", "byteLength", "end", "cancelSegmentDownloading", "20786340pYJqlG", "delete", "clearLoadedBytes", " to ", "onPeerError", "sendSegmentsAnnouncementCommand", "cancel segment uploading ", "loadedBytes", "addLoadedChunk", "url", "sendCommand", "downloadingSegment", "totalBytes", "logger", "onConnectionError", "CancelSegmentRequest", " %O"];
  return (Vn = function() {
    return n;
  })();
}
const O = Fe;
(function() {
  const n = Fe, t = Vn();
  for (; ; ) try {
    if (-parseInt(n(256)) / 1 * (-parseInt(n(241)) / 2) + parseInt(n(230)) / 3 + -parseInt(n(306)) / 4 + -parseInt(n(293)) / 5 * (parseInt(n(254)) / 6) + -parseInt(n(247)) / 7 + parseInt(n(249)) / 8 * (parseInt(n(288)) / 9) + parseInt(n(260)) / 10 === 625250) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
const { PeerCommandType: Z } = Vt;
var Wr, zr, Qr, Jr, Yr, Gr, Xr, Kr, Vr, Zr;
class Ae {
  constructor(t, e, s, r, i) {
    f(this, "id");
    f(this, Zr);
    f(this, Vr);
    f(this, Kr, /* @__PURE__ */ new Set());
    f(this, Xr, /* @__PURE__ */ new Set());
    f(this, Gr, []);
    f(this, Yr, ut(O(245)));
    f(this, Jr);
    f(this, Qr, async (t) => {
      var s, r, i;
      const e = O;
      switch (t.c) {
        case Z.SegmentsAnnouncement:
          this[e(292)] = new Set(t.l), this[e(242)] = new Set(t.p), this[e(253)][e(229)]();
          break;
        case Z[e(296)]:
          this[e(232)][e(226)](), this[e(253)][e(255)](this, t.i, t.r, t.b);
          break;
        case Z[e(295)]:
          {
            if (!this.downloadingContext || this[e(305)].isSegmentDataCommandReceived) break;
            const { request: o, controls: a, requestId: h } = this[e(305)];
            if (o[e(228)][e(248)] !== t.i || h !== t.r) break;
            this[e(305)][e(303)] = !0, a.firstBytesReceived(), o.totalBytes === void 0 ? o[e(238)](t.s) : o[e(272)] - o[e(267)] !== t.s && (o[e(262)](), this.sendCancelSegmentRequestCommand(o.segment, h), this[e(259)](e(307)), this.destroy());
          }
          break;
        case Z[e(235)]: {
          const { downloadingContext: o } = this;
          if (!(o != null && o[e(303)])) return;
          const { request: a, controls: h } = o;
          if (o[e(282)][e(228)].externalId !== t.i || o[e(279)] !== t.r) return a[e(262)](), this[e(259)]("peer-protocol-violation"), void this[e(283)]();
          if (a[e(267)] !== a[e(272)]) return a[e(262)](), this.cancelSegmentDownloading("peer-response-bytes-length-mismatch"), void this.destroy();
          const d = await ((r = (s = this[e(294)]).validateP2PSegment) == null ? void 0 : r.call(s, a[e(228)][e(269)], a.segment.byteRange, a[e(231)])) ?? !0;
          if (this.downloadingContext !== o) return;
          if (!d) return a.clearLoadedBytes(), this.cancelSegmentDownloading(e(301)), void this[e(283)]();
          this[e(233)] = [], h.completeOnSuccess(), this.downloadingContext = void 0;
          break;
        }
        case Z[e(236)]:
          ((i = this.downloadingContext) == null ? void 0 : i.request[e(228)].externalId) === t.i && this.downloadingContext[e(279)] === t.r && (this.cancelSegmentDownloading("peer-segment-absent"), this.loadedSegments[e(261)](t.i));
          break;
        case Z[e(275)]:
          if (this[e(232)].getUploadingRequestId() !== t.r) break;
          this[e(232)][e(226)]();
          break;
      }
    });
    f(this, "onSegmentChunkReceived", (t) => {
      var i;
      const e = O;
      if (!((i = this[e(305)]) != null && i[e(303)])) return;
      const { request: s, controls: r } = this[e(305)];
      if (s.totalBytes !== void 0 && s.loadedBytes + t[e(257)] > s[e(272)]) return s[e(262)](), this[e(259)]("peer-response-bytes-length-mismatch"), void this[e(283)]();
      r[e(268)](t);
    });
    f(this, zr, () => {
      this.destroy();
    });
    f(this, Wr, (t) => {
      const e = O;
      this[e(273)](e(251) + this.id + e(276), t), this.eventTarget[e(297)](e(264))({ peerId: this.id, streamType: this[e(285)], error: t });
      const { code: s } = t;
      (s === "ERR_DATA_CHANNEL" || s === e(240)) && this[e(283)]();
    });
    f(this, "destroy", () => {
      const t = O;
      this.cancelSegmentDownloading(t(291)), this[t(278)][t(283)](), this.eventHandlers[t(287)](this), this[t(287)]({ peerId: this.id, streamType: this[t(285)] }), this[t(273)]("peer closed " + this.id);
    });
    const o = Fe;
    this[o(278)] = t, this.eventHandlers = e, this[o(294)] = s, this[o(285)] = r, this[o(284)] = i, this.onPeerClosed = i[o(297)](o(239)), this.id = Ae[o(281)](t), this[o(232)] = new ch(t, s, { onSegmentChunkReceived: this[o(299)], onCommandReceived: this[o(244)] }, i), i[o(297)]("onPeerConnect")({ peerId: this.id, streamType: r }), t.on("error", this[o(274)]), t.on(o(237), this.onPeerConnectionClosed), t.on(o(258), this[o(290)]), t.on(o(289), this[o(290)]);
  }
  get [(Zr = O(232), Vr = O(305), Kr = O(292), Xr = O(242), Gr = O(233), Yr = O(273), Jr = O(287), O(271))]() {
    var e;
    const t = O;
    return (e = this.downloadingContext) == null ? void 0 : e[t(282)][t(228)];
  }
  [O(277)](t) {
    const e = O, { externalId: s } = t;
    return this[e(292)][e(243)](s) ? "loaded" : this[e(242)][e(243)](s) ? "http-loading" : void 0;
  }
  downloadSegment(t) {
    const e = O;
    if (this[e(305)]) throw new Error(e(286));
    this.downloadingContext = { request: t, requestId: Math[e(310)](1e3 * Math.random()), isSegmentDataCommandReceived: !1, controls: t[e(309)]({ downloadSource: "p2p", peerId: this.id }, { notReceivingBytesTimeoutMs: this[e(294)][e(246)], abort: (r) => {
      const i = e;
      if (!this.downloadingContext) return;
      const { request: o, requestId: a } = this[i(305)];
      this.sendCancelSegmentRequestCommand(o[i(228)], a), this.downloadingErrors.push(r), this[i(305)] = void 0, this.downloadingErrors[i(308)]((h) => h.type === "bytes-receiving-timeout")[i(250)] >= this.peerConfig[i(304)] && this.destroy();
    } }) };
    const s = { c: Z[e(296)], r: this[e(305)][e(279)], i: t[e(228)].externalId };
    t[e(267)] && (s.b = t.loadedBytes), this[e(232)][e(270)](s);
  }
  async uploadSegmentData(t, e, s) {
    const r = O, { externalId: i } = t;
    this[r(273)](r(302) + t.externalId + r(263) + this.id);
    const o = { c: Z[r(295)], i, r: e, s: s[r(257)] };
    this[r(232)][r(270)](o);
    try {
      await this[r(232)][r(300)](new Uint8Array(s), e), this[r(227)](t, e), this.logger(r(252) + i + " has been sent to " + this.id);
    } catch {
      this[r(273)](r(266) + i);
    }
  }
  [(Qr = O(244), O(259))](t) {
    const e = O;
    if (!this[e(305)]) return;
    const { request: s, controls: r } = this[e(305)], { segment: i } = s;
    this[e(273)](e(234) + i[e(248)] + " (" + t + ")");
    const o = new V(t);
    r.abortOnError(o), this[e(305)] = void 0, this[e(233)][e(298)](o);
  }
  [O(265)](t, e) {
    const s = O, r = { c: Z.SegmentsAnnouncement, p: e, l: t };
    this[s(232)][s(270)](r);
  }
  [O(280)](t, e) {
    const s = O;
    this.peerProtocol.sendCommand({ c: Z[s(236)], i: t, r: e });
  }
  sendCancelSegmentRequestCommand(t, e) {
    const s = O;
    this[s(232)][s(270)]({ c: Z.CancelSegmentRequest, i: t.externalId, r: e });
  }
  [O(227)](t, e) {
    const s = O;
    this[s(232)][s(270)]({ c: Z[s(235)], r: e, i: t[s(248)] });
  }
  static [(zr = O(290), Wr = O(274), O(281))](t) {
    return Jo(t.id);
  }
}
const W = re;
function re(n, t) {
  const e = Zn();
  return (re = function(s, r) {
    return e[s -= 434];
  })(n, t);
}
function Zn() {
  const n = ["slice", "27210FJaQdq", "onPeerClosed", "set", "start", "onTrackerClientWarning", "onPeerConnected", `
peerId: `, "6108420rYcIFD", "eventHandlers", "stats", "values", "18771hsdrZH", "2881719DtyUUX", "warning", "stream", "56vbtmaM", "onReceivePeerConnection", "getStreamHash", "PEER_ID_BY_INFO_HASH", "streamShortId", "getStreamString", "peer", "clear", "config", "onTrackerError", "connected with peer: ", "announceTrackers", "onSegmentRequested", "159019SgxOrn", "192CQicGS", "159163Gttsyt", "peer closed: ", "destroy", "_peers", "connect", "tracker error (", "745oNJxaX", "type", "logger", "tracker warning (", "generatePeerId", "eventTarget", "getPeerIdFromConnection", "getEventDispatcher", "clearPeerIdCache", "rtcConfig", "trackerClientVersionPrefix", "onTrackerClientError", "get", "client", "potentialConnections", "userAgent", "345674MviSUI", "statsCollector", "onSegmentsAnnouncement", "test"];
  return (Zn = function() {
    return n;
  })();
}
function uh() {
  const n = re, t = /^((?!chrome|android).)*safari/i[n(488)](navigator[n(484)]), e = /\b(iPad|iPhone|Macintosh).*AppleWebKit(?!.*Safari)/i.test(navigator[n(484)]);
  return t || e;
}
(function() {
  const n = re, t = Zn();
  for (; ; ) try {
    if (parseInt(n(463)) / 1 + -parseInt(n(485)) / 2 + -parseInt(n(444)) / 3 * (-parseInt(n(462)) / 4) + parseInt(n(469)) / 5 * (-parseInt(n(490)) / 6) + parseInt(n(461)) / 7 * (-parseInt(n(448)) / 8) + parseInt(n(445)) / 9 + parseInt(n(440)) / 10 === 382961) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
var $r, ti, ei, ni, si, ri, ii, oi;
const qt = class qt {
  constructor(t, e, s, r, i) {
    f(this, ii);
    f(this, ri);
    f(this, "_peers", /* @__PURE__ */ new Map());
    f(this, si, ut("p2pml-core:p2p-tracker-client"));
    f(this, ni, (t) => {
      const e = W, s = Ae[e(475)](t);
      let r = this[e(466)].get(s);
      r != null && r[e(454)] ? t[e(465)]() : (!r && (r = { potentialConnections: /* @__PURE__ */ new Set() }, t.idUtf8 = s, this._peers[e(435)](s, r)), r[e(483)].add(t), t.on(e(467), () => {
        const i = e;
        if (!r[i(454)]) {
          for (const o of r[i(483)]) o !== t && o.destroy();
          r.potentialConnections[i(455)](), r[i(454)] = new Ae(t, { onPeerClosed: this[i(434)], onSegmentRequested: this.eventHandlers[i(460)], onSegmentsAnnouncement: this[i(441)][i(487)] }, this[i(456)], this.stream.type, this[i(474)]), this[i(471)](i(458) + r[i(454)].id + " " + this[i(452)]), this.eventHandlers[i(438)](r[i(454)]);
        }
      }));
    });
    f(this, ei, (t) => {
      const e = W;
      this[e(471)](e(472) + this.streamShortId + ": " + t + ")"), this[e(474)].getEventDispatcher("onTrackerWarning")({ streamType: this[e(447)][e(470)], warning: t });
    });
    f(this, ti, (t) => {
      const e = W;
      this[e(471)](e(468) + this[e(452)] + ": " + t + ")"), this[e(474)][e(476)](e(457))({ streamType: this.stream[e(470)], error: t });
    });
    f(this, $r, (t) => {
      const e = W;
      this.logger(e(464) + t.id), this[e(466)].delete(t.id);
    });
    const o = re;
    this[o(447)] = e, this[o(441)] = s, this[o(456)] = r, this[o(474)] = i;
    const a = kr[o(450)](t);
    this[o(452)] = xt[o(453)](e);
    let h = qt[o(451)][o(481)](a);
    !h && (h = kr[o(473)](r[o(479)]), qt[o(451)][o(435)](a, h)), this[o(482)] = new pn({ infoHash: gn(a), peerId: gn(h), announce: uh() ? r[o(459)][o(489)](0, 1) : r[o(459)], rtcConfig: this[o(456)][o(478)] }), this.client.on(o(454), this[o(449)]), this[o(482)].on(o(446), this[o(437)]), this.client.on("error", this.onTrackerClientError), this[o(471)](`create new client; 
stream: ` + this[o(452)] + "; hash: " + a + o(439) + h);
  }
  [(oi = W(451), ii = W(452), ri = W(482), si = W(471), W(436))]() {
    const t = W;
    this[t(482)][t(436)]();
  }
  [W(442)](t) {
    const e = W;
    this[e(482)][e(486)](t);
  }
  destroy() {
    const t = W;
    this.client.destroy();
    for (const { peer: e, potentialConnections: s } of this[t(466)][t(443)]()) {
      e == null || e.destroy();
      for (const r of s) r[t(465)]();
    }
    this[t(466)][t(455)](), this[t(471)]("destroy client; stream: " + this[t(452)]);
  }
  *peers() {
    const t = W;
    for (const e of this[t(466)][t(443)]()) e[t(454)] && (yield e.peer);
  }
  static [(ni = W(449), ei = W(437), ti = W(480), $r = W(434), W(477))]() {
    const t = W;
    qt[t(451)][t(455)]();
  }
};
f(qt, oi, /* @__PURE__ */ new Map());
let Re = qt;
(function() {
  const n = Ot, t = $n();
  for (; ; ) try {
    if (parseInt(n(490)) / 1 * (-parseInt(n(480)) / 2) + -parseInt(n(492)) / 3 + parseInt(n(496)) / 4 * (-parseInt(n(482)) / 5) + -parseInt(n(493)) / 6 + -parseInt(n(486)) / 7 * (-parseInt(n(495)) / 8) + parseInt(n(491)) / 9 + parseInt(n(494)) / 10 === 225972) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
function jt(n, t) {
  return "v2-" + n + "-" + Zo(t);
}
function Ot(n, t) {
  const e = $n();
  return (Ot = function(s, r) {
    return e[s -= 478];
  })(n, t);
}
function Zo(n) {
  const t = Ot;
  return n[t(483)] + "-" + n[t(485)];
}
function $n() {
  const n = ["startTime", "11Xasdyj", "3644694loYiZv", "824532pkeSHT", "1037262xACfRS", "6196450jAdegP", "32lBgEly", "4kNIEpz", "externalId", "segments", "37070fxpDvk", "values", "798685nUQxJd", "type", "get", "index", "22232xeaAhJ", "endTime", "p2pDownloadTimeWindow"];
  return ($n = function() {
    return n;
  })();
}
function Ie(n, t, e, s, r) {
  const { highDemandTimeWindow: i, httpDownloadTimeWindow: o, p2pDownloadTimeWindow: a } = function(h, d) {
    const u = Ot, { highDemandTimeWindow: l, httpDownloadTimeWindow: m, p2pDownloadTimeWindow: v } = h, w = { highDemandTimeWindow: l, httpDownloadTimeWindow: m, p2pDownloadTimeWindow: v };
    return d <= 5 ? (w.httpDownloadTimeWindow = 0, w[u(488)] = 0) : d <= 10 && (w.p2pDownloadTimeWindow = w.httpDownloadTimeWindow), w;
  }(e, r);
  return { isHighDemand: sn(n, t, i), isHttpDownloadable: sn(n, t, o), isP2PDownloadable: sn(n, t, a) && s.isSegmentLoadingOrLoadedBySomeone(n) };
}
function sn(n, t, e) {
  const { startTime: s, endTime: r } = n, { position: i, rate: o } = t;
  return !(i + e * o < s || i > r);
}
const Tt = Object.freeze(Object.defineProperty({ __proto__: null, getSegmentAvgDuration: function(n) {
  const t = Ot, { segments: e } = n;
  let s = 0;
  const { size: r } = e;
  for (const i of e[t(481)]())
    s += i[t(487)] - i[t(489)];
  return s / r;
}, getSegmentFromStreamByExternalId: function(n, t) {
  const e = Ot;
  for (const s of n.segments[e(481)]()) if (s[e(478)] === t) return s;
}, getSegmentFromStreamsMap: function(n, t) {
  const e = Ot;
  for (const s of n.values()) {
    const r = s[e(479)][e(484)](t);
    if (r) return r;
  }
}, getSegmentPlaybackStatuses: Ie, getStreamId: Zo, getStreamSwarmId: jt }, Symbol.toStringTag, { value: "Module" })), D = Ue;
function Ue(n, t) {
  const e = ts();
  return (Ue = function(s, r) {
    return e[s -= 351];
  })(n, t);
}
function ts() {
  const n = ["runtimeId", "length", "sendSegmentsAnnouncementCommand", "2eJWifB", "onStorageUpdated-", "httpRequests", "statsSegmentsThreshold", "630776KLWUxC", "isAnnounceMicrotaskCreated", "downloadingSegment", "onSegmentAnnouncement", "sendSegmentAbsentCommand", "stats", "onSegmentRequested", "addEventListener", "downloadSegment", "broadcastAnnouncement", "percentaje", "getOrCreateRequest", "isP2PUploadDisabled", "isSegmentLoadingOrLoadedBySomeone", "statsCollector", "requests", "getStreamSwarmId", "getSegmentStatus", "loaded", "664695lONYUP", "sendSegmentsAnnouncement", "getSegmentData", "35730Pbpwuj", "setSegmentChangeCallback", "uploadSegmentData", "get", "slice", "destroy", "http", "trackerClient", "eventTarget", "203946nzTbNd", "STATS_SEGMENTS_THRESHOLD", "streamManifestUrl", "externalId", "statsSegmentsBuffer", "config", "getSegmentFromStreamByExternalId", "total", "isSegmentLoadedBySomeone", "connectedPeerCount", "onPeerConnected", "2817594clQxwi", "528DznOUq", "peers", "segmentStorage", "client", "getSegmentsAnnouncement", "getRandomItem", "2483957KCxcyS", "swarmId", "10AZbMYf", "stream", "push", "4vDQkQR", "segment", "segments", "p2p", "23768723QHiGMf"];
  return (ts = function() {
    return n;
  })();
}
(function() {
  const n = Ue, t = ts();
  for (; ; ) try {
    if (-parseInt(n(355)) / 1 * (parseInt(n(390)) / 2) + parseInt(n(378)) / 3 * (-parseInt(n(413)) / 4) + parseInt(n(381)) / 5 * (-parseInt(n(402)) / 6) + -parseInt(n(408)) / 7 + -parseInt(n(359)) / 8 + -parseInt(n(401)) / 9 * (parseInt(n(410)) / 10) + parseInt(n(351)) / 11 === 359670) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
var ai, hi, ci, ui, di, li, pi, fi, gi;
class dh {
  constructor(t, e, s, r, i, o, a) {
    f(this, gi);
    f(this, fi, !1);
    f(this, pi, { p2p: 0, http: 0, total: 0, percentaje: 0 });
    f(this, li, 0);
    f(this, di);
    f(this, ui, (t) => {
      const e = D;
      if (this[e(395)][e(371)]) return;
      const { httpLoading: s, loaded: r } = this[e(406)]();
      t[e(354)](r, s);
    });
    f(this, ci, (t = !1) => {
      const e = D;
      if (t) return void this[e(379)]([], []);
      if (this.isAnnounceMicrotaskCreated || this.config[e(371)]) return;
      const { loaded: s, httpLoading: r } = this[e(406)]();
      this[e(379)](s, r);
    });
    f(this, hi, (t, e) => {
      const s = D;
      this[s(360)] = !0, queueMicrotask(() => {
        const r = s;
        for (const i of this[r(388)][r(403)]()) i[r(354)](t, e);
        this[r(360)] = !1;
      });
    });
    f(this, ai, async (t, e, s, r) => {
      const i = D, o = Tt[i(396)](this[i(411)], e);
      if (!o) return;
      if (this[i(395)][i(371)]) return void t[i(363)](e, s);
      const a = this[i(395)][i(409)] ?? this[i(392)], h = jt(a, this.stream), d = await this[i(404)][i(380)](a, h, o[i(393)]);
      d ? await t[i(383)](o, s, r !== void 0 ? d[i(385)](r) : d) : t[i(363)](e, s);
    });
    const h = Ue;
    this.streamManifestUrl = t, this[h(411)] = e, this[h(374)] = s, this[h(404)] = r, this[h(395)] = i, this.eventTarget = o, this.onSegmentAnnouncement = a, this[h(391)] = this.config[h(358)] ?? 10;
    const d = jt(this[h(395)][h(409)] ?? this[h(392)], this[h(411)]);
    this[h(388)] = new Re(d, this[h(411)], { onPeerConnected: this.onPeerConnected, onSegmentRequested: this.onSegmentRequested, onSegmentsAnnouncement: this[h(362)] }, this[h(395)], this.eventTarget), this[h(389)][h(366)](h(356) + d, this[h(368)]), this[h(404)][h(382)]((u) => {
      this.eventTarget.dispatchEvent("onStorageUpdated-" + u);
    }), this[h(388)].start(), this[h(389)][h(366)]("onSegmentLoaded", (u) => {
      const l = h, { bytesLength: m, downloadSource: v } = u;
      v === l(416) && (this[l(364)][l(416)] += m), v === l(387) && (this.stats[l(387)] += m), this.stats.total = this[l(364)][l(416)] + this[l(364)].http, this[l(364)][l(369)] = this[l(364)][l(397)] ? this[l(364)][l(416)] / this.stats[l(397)] * 100 : 0, this[l(394)] += 1, this[l(394)] >= this[l(391)] && (this.trackerClient[l(405)][l(373)]({ ...this[l(364)] }), this[l(364)] = { p2p: 0, http: 0, total: 0, percentaje: 0 }, this[l(394)] = 0);
    });
  }
  downloadSegment(t) {
    const e = D, s = [];
    for (const o of this[e(388)][e(403)]()) !o[e(361)] && o[e(376)](t) === "loaded" && s.push(o);
    if (s[e(353)] === 0) return;
    const r = ee[e(407)](s), i = this.requests[e(370)](t);
    r[e(367)](i);
  }
  [(gi = D(388), fi = D(360), pi = D(364), li = D(394), di = D(391), D(372))](t) {
    const e = D;
    for (const s of this[e(388)][e(403)]()) if (s[e(376)](t)) return !0;
    return !1;
  }
  [D(398)](t) {
    const e = D;
    for (const s of this[e(388)].peers()) if (s.getSegmentStatus(t) === e(377)) return !0;
    return !1;
  }
  get [D(399)]() {
    const t = D;
    let e = 0;
    for (const s of this[t(388)].peers()) e++;
    return e;
  }
  [D(406)]() {
    const t = D, e = this[t(395)][t(409)] ?? this.streamManifestUrl, s = Tt[t(375)](e, this[t(411)]), r = this[t(404)].getStoredSegmentIds(e, s), i = [];
    for (const o of this[t(374)][t(357)]()) {
      const a = this.stream[t(415)][t(384)](o[t(414)][t(352)]);
      a && i[t(412)](a[t(393)]);
    }
    return { loaded: r, httpLoading: i };
  }
  [(ui = D(400), ci = D(368), hi = D(379), ai = D(365), D(386))]() {
    const t = D, e = jt(this.config[t(409)] ?? this.streamManifestUrl, this[t(411)]);
    this.eventTarget.removeEventListener("onStorageUpdated-" + e, this[t(368)]), this[t(388)][t(386)]();
  }
}
function es() {
  const n = ["setLoaderDestroyTimeout", "52Fzjxts", "stream", "getStreamString", "3070XjgSbS", "streamManifestUrl", "onSegmentAnnouncement", "_currentLoaderItem", "2065JuvsvF", "loader", "eventTarget", "p2pml-core:p2p-loaders-container", "loaders", "destroy", "config", "runtimeId", "168230JtUpyw", "destroyAndRemoveLoader", "clear", "logger", "271048xkRymj", "swarmId", "244201BYWeko", "426JPOsUQ", "createLoader", "set", "get", "created new loader: ", "destroy p2p loader: ", "Loader for this stream already exists", "81609bFrUMr", "segmentStorage", "changeCurrentLoader", "loggerInfo", "2223idZnVZ", "getStoredSegmentIds", "1571635KzLagm", "setTimeout", "findOrCreateLoaderForStream", "getStreamSwarmId", "set current p2p loader: ", "destroyTimeoutId", "requests"];
  return (es = function() {
    return n;
  })();
}
const G = qe;
function qe(n, t) {
  const e = es();
  return (qe = function(s, r) {
    return e[s -= 427];
  })(n, t);
}
(function() {
  const n = qe, t = es();
  for (; ; ) try {
    if (parseInt(n(431)) / 1 + -parseInt(n(468)) / 2 + -parseInt(n(439)) / 3 * (-parseInt(n(453)) / 4) + -parseInt(n(445)) / 5 + -parseInt(n(432)) / 6 * (-parseInt(n(460)) / 7) + parseInt(n(429)) / 8 + -parseInt(n(443)) / 9 * (parseInt(n(456)) / 10) === 178395) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
var mi, yi, _i;
class lh {
  constructor(t, e, s, r, i, o, a) {
    f(this, _i, /* @__PURE__ */ new Map());
    f(this, yi);
    f(this, mi, ut(G(463)));
    const h = qe;
    this.streamManifestUrl = t, this.requests = s, this.segmentStorage = r, this.config = i, this.eventTarget = o, this[h(458)] = a, this[h(459)] = this[h(447)](e), this[h(428)](h(449) + xt[h(455)](e));
  }
  createLoader(t) {
    const e = G;
    if (this[e(464)].has(t[e(467)])) throw new Error(e(438));
    const s = new dh(this[e(457)], t, this[e(451)], this[e(440)], this[e(466)], this[e(462)], () => {
      const i = e;
      this[i(459)][i(461)] === s && this.onSegmentAnnouncement();
    }), r = xt[e(455)](t);
    return this[e(428)](e(436) + r), { loader: s, stream: t, loggerInfo: xt[e(455)](t) };
  }
  [(_i = G(464), yi = G(459), mi = G(428), G(447))](t) {
    const e = G, s = this[e(464)][e(435)](t.runtimeId);
    if (s) return clearTimeout(s[e(450)]), s.destroyTimeoutId = void 0, s;
    {
      const r = this[e(433)](t);
      return this[e(464)][e(434)](t[e(467)], r), r;
    }
  }
  [G(441)](t) {
    const e = G, s = this.config[e(430)] ?? this[e(457)], r = Tt[e(448)](s, this[e(459)].stream);
    this.segmentStorage[e(444)](s, r).length ? this[e(452)](this._currentLoaderItem) : this[e(469)](this[e(459)]), this[e(459)] = this.findOrCreateLoaderForStream(t), this[e(428)]("change current p2p loader: " + xt[e(455)](t));
  }
  [G(452)](t) {
    const e = G;
    t[e(450)] = window[e(446)](() => this.destroyAndRemoveLoader(t), this[e(466)].p2pInactiveLoaderDestroyTimeoutMs);
  }
  [G(469)](t) {
    const e = G;
    t[e(461)][e(465)](), this.loaders.delete(t[e(454)][e(467)]), this.logger(e(437), t[e(442)]);
  }
  get currentLoader() {
    const t = G;
    return this[t(459)][t(461)];
  }
  destroy() {
    const t = G;
    for (const { loader: e, destroyTimeoutId: s } of this[t(464)].values()) e.destroy(), clearTimeout(s);
    this[t(464)][t(427)]();
  }
}
const C = ie;
function ns() {
  const n = ["now", "succeed", "push", "byteLength", "totalBytes", "setStatus", " succeed", "requestProcessQueueCallback", "loadedBytes", " failed ", "byteRange", "clear", "_status", "Request total bytes value is already set", "currentAttempt", "Request ", "completeOnSuccess", "firstBytesReceived", " aborted", "httpAttemptsCount", "type", "logger", "add", " started", "bandwidthCalculators", "_totalBytes", "length", "loading", "startLoading", "runtimeId", "stream", "finalData", "segment", "setTotalBytes", " has been already succeed.", "red", "onSegmentStart", "getEventDispatcher", "onSegmentLoaded", "url", "externalId", "lastLoadedChunkTimestamp", "failed", "abortFromProcessQueue", "status", "3820aNGqOA", "aborted", "30Godeev", "447238VHHxcx", "stop", "playback", "timeoutId", "_logger", "_abortRequestCallback", "onSegmentAbort", "p2pml-core:request-", "_failedAttempts", "progress", "restart", "bytes", "throwErrorIfNotLoadingStatus", "data", "http", "1487704wqmFtt", "addLoadedChunk", "136086MfEJqg", "904792OZapFH", "p2p", "addBytes", "Request has been already ", "attempts", "abortOnError", "isHandledByProcessQueue", "color", "notReceivingBytesTimeout", "onSegmentError", "_loadedBytes", "259656udlpwm", "peerId", "downloadSource", "774952DZrnxO", " has been already started.", "manageBandwidthCalculatorsState", "joinChunksArrayBuffer", "bytes-receiving-timeout", "Timeout is already started.", "1tkxjdz", "abort", "11871Gylhvq", "abortOnTimeout", "start", "reduce", "action", "_isHandledByProcessQueue", "lastAttempt", "setTimeout"];
  return (ns = function() {
    return n;
  })();
}
function ie(n, t) {
  const e = ns();
  return (ie = function(s, r) {
    return e[s -= 266];
  })(n, t);
}
function ye(n) {
  const t = ie;
  return { runtimeId: n[t(293)], externalId: n[t(304)], url: n[t(303)], byteRange: n[t(274)], startTime: n.startTime, endTime: n.endTime };
}
(function() {
  const n = ie, t = ns();
  for (; ; ) try {
    if (parseInt(n(350)) / 1 * (-parseInt(n(312)) / 2) + -parseInt(n(341)) / 3 + parseInt(n(327)) / 4 + parseInt(n(311)) / 5 * (-parseInt(n(329)) / 6) + -parseInt(n(330)) / 7 + -parseInt(n(344)) / 8 + -parseInt(n(352)) / 9 * (-parseInt(n(309)) / 10) === 203402) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
var Si, bi, wi, Ii, vi, Ci, ki, xi, Ti, Ei, Ai, Ri, Pi, Li, Oi, Mi, Bi, Ni, Di;
let ph = class {
  constructor(n, t, e, s, r, i) {
    f(this, Di);
    f(this, Ni, new fh());
    f(this, Bi);
    f(this, Mi, []);
    f(this, Oi, 0);
    f(this, Li);
    f(this, Pi, "not-started");
    f(this, Ri);
    f(this, Ai);
    f(this, Ei);
    f(this, Ti);
    f(this, xi, !1);
    f(this, ki);
    f(this, Ci);
    f(this, "onSegmentStart");
    f(this, vi);
    f(this, Ii, () => {
      var e;
      const n = C;
      if (this[n(324)](), !this[n(278)]) return;
      this[n(269)](n(306));
      const t = new V(n(348));
      (e = this._abortRequestCallback) == null || e.call(this, t), this[n(285)](this[n(343)] + " " + this[n(296)].externalId + n(273) + t.type), this[n(320)][n(286)]({ ...this.currentAttempt, error: t }), this[n(339)]({ segment: ye(this[n(296)]), error: t, downloadSource: this[n(278)][n(343)], peerId: this[n(278)][n(343)] === "p2p" ? this[n(278)][n(342)] : void 0, streamType: this.segment[n(294)][n(284)] }), this[n(338)][n(275)](), this[n(346)]("stop"), this[n(271)]();
    });
    f(this, wi, (n) => {
      const t = C;
      this.throwErrorIfNotLoadingStatus(), this.currentAttempt && (this[t(269)](t(306)), this[t(285)](this[t(343)] + " " + this[t(296)].externalId + " failed " + n[t(284)]), this[t(320)][t(286)]({ ...this.currentAttempt, error: n }), this[t(339)]({ segment: ye(this[t(296)]), error: n, downloadSource: this[t(278)].downloadSource, peerId: this.currentAttempt.downloadSource === t(331) ? this.currentAttempt[t(342)] : void 0, streamType: this[t(296)][t(294)][t(284)] }), this[t(338)][t(275)](), this[t(346)](t(313)), this[t(271)]());
    });
    f(this, "completeOnSuccess", () => {
      const n = C;
      this[n(324)](), this[n(278)] && (this[n(346)](n(313)), this.notReceivingBytesTimeout[n(275)](), this.setStatus(n(361)), this[n(289)] = this[n(340)], this.onSegmentLoaded({ segmentUrl: this[n(296)].url, bytesLength: this[n(325)][n(267)], downloadSource: this.currentAttempt[n(343)], peerId: this.currentAttempt[n(343)] === n(331) ? this[n(278)].peerId : void 0, streamType: this[n(296)][n(294)][n(284)] }), this[n(285)](this[n(278)][n(343)] + " " + this[n(296)][n(304)] + n(270)), this[n(271)]());
    });
    f(this, bi, (n) => {
      const t = C;
      if (this[t(324)](), !this[t(278)] || !this.progress) return;
      this.notReceivingBytesTimeout.restart();
      const { byteLength: e } = n, { all: s, http: r } = this[t(288)];
      s[t(332)](e), this[t(278)][t(343)] === "http" && r[t(332)](e), this[t(323)].push(n), this[t(321)][t(305)] = performance[t(360)](), this[t(321)][t(272)] += e, this._loadedBytes += e;
    });
    f(this, Si, () => {
      const n = C;
      this.throwErrorIfNotLoadingStatus(), this[n(338)][n(322)]();
    });
    const o = ie;
    this[o(296)] = n, this[o(271)] = t, this[o(288)] = e, this[o(314)] = s, this.playbackConfig = r, this[o(339)] = i[o(301)](o(339)), this[o(318)] = i[o(301)](o(318)), this.onSegmentStart = i[o(301)](o(300)), this[o(302)] = i.getEventDispatcher(o(302));
    const { byteRange: a } = this[o(296)];
    if (a) {
      const { end: d, start: u } = a;
      this[o(289)] = d - u + 1;
    }
    this[o(338)] = new gh(this[o(353)]);
    const { type: h } = this.segment[o(294)];
    this[o(316)] = ut(o(319) + h);
  }
  clearLoadedBytes() {
    const n = C;
    this[n(340)] = 0, this[n(323)] = [], this[n(289)] = void 0, this.finalData = void 0;
  }
  get [(Di = C(278), Ni = C(320), Bi = C(295), Mi = C(323), Oi = C(340), Li = C(289), Pi = C(276), Ri = C(321), Ai = C(338), Ei = C(317), Ti = C(316), xi = C(357), ki = C(339), Ci = C(318), vi = C(302), C(308))]() {
    return this._status;
  }
  [C(269)](n) {
    const t = C;
    this[t(276)] = n, this[t(357)] = !1;
  }
  get [C(343)]() {
    var t;
    return (t = this[C(278)]) == null ? void 0 : t.downloadSource;
  }
  get [C(272)]() {
    return this[C(340)];
  }
  get [C(268)]() {
    return this._totalBytes;
  }
  get [C(325)]() {
    const n = C;
    return this[n(295)] || (this[n(295)] = ee[n(347)](this[n(323)])), this[n(295)];
  }
  get failedAttempts() {
    return this[C(320)];
  }
  get [C(336)]() {
    return this[C(357)];
  }
  markHandledByProcessQueue() {
    this[C(357)] = !0;
  }
  [C(297)](n) {
    const t = C;
    if (this._totalBytes !== void 0) throw new Error(t(277));
    this[t(289)] = n;
  }
  [C(354)](n, t) {
    const e = C;
    if (this._status === e(361)) throw new Error("Request " + this[e(296)][e(304)] + e(298));
    if (this[e(276)] === e(291)) throw new Error(e(279) + this[e(296)][e(304)] + e(345));
    this.setStatus(e(291)), this.currentAttempt = { ...n }, this[e(321)] = { startFromByte: this[e(340)], loadedBytes: 0, startTimestamp: performance[e(360)]() }, this[e(346)]("start");
    const { notReceivingBytesTimeoutMs: s, abort: r } = t;
    return this[e(317)] = r, s !== void 0 && this[e(338)][e(354)](s), this[e(285)](n[e(343)] + " " + this[e(296)].externalId + e(287)), this[e(300)]({ segment: ye(this.segment), downloadSource: n[e(343)], peerId: n[e(343)] === e(331) ? n[e(342)] : void 0 }), { firstBytesReceived: this[e(281)], addLoadedChunk: this[e(328)], completeOnSuccess: this[e(280)], abortOnError: this[e(335)] };
  }
  [C(307)]() {
    var t, e, s, r;
    const n = C;
    this[n(324)](), this[n(269)](n(310)), this[n(285)](((t = this.currentAttempt) == null ? void 0 : t.downloadSource) + " " + this[n(296)].externalId + n(282)), (e = this._abortRequestCallback) == null || e.call(this, new V(n(351))), this[n(318)]({ segment: ye(this[n(296)]), downloadSource: (s = this[n(278)]) == null ? void 0 : s[n(343)], peerId: ((r = this.currentAttempt) == null ? void 0 : r.downloadSource) === n(331) ? this[n(278)][n(342)] : void 0, streamType: this.segment.stream.type }), this[n(317)] = void 0, this.manageBandwidthCalculatorsState(n(313)), this[n(338)].clear();
  }
  [(Ii = C(353), wi = C(335), bi = C(328), Si = C(281), C(324))]() {
    const n = C;
    if (this[n(276)] !== n(291)) throw new Error(n(333) + this[n(308)] + ".");
  }
  [C(285)](n) {
    var e;
    const t = C;
    this._logger[t(337)] = ((e = this[t(278)]) == null ? void 0 : e[t(343)]) === "http" ? "green" : t(299), this[t(316)](n), this[t(316)][t(337)] = "";
  }
  [C(346)](n) {
    var i;
    const t = C, { all: e, http: s } = this[t(288)], r = n === "start" ? t(292) : "stopLoading";
    ((i = this[t(278)]) == null ? void 0 : i[t(343)]) === t(326) && s[r](), e[r]();
  }
};
var Fi;
class fh {
  constructor() {
    f(this, Fi, []);
  }
  [(Fi = C(334), C(286))](t) {
    const e = C;
    this[e(334)][e(266)](t);
  }
  get [C(283)]() {
    const t = C;
    return this[t(334)][t(355)]((e, s) => s[t(343)] === "http" ? e + 1 : e, 0);
  }
  get [C(358)]() {
    const t = C;
    return this[t(334)][this.attempts[t(290)] - 1];
  }
  [C(275)]() {
    this[C(334)] = [];
  }
}
var Ui;
class gh {
  constructor(t) {
    f(this, Ui);
    f(this, "ms");
    this[C(356)] = t;
  }
  [(Ui = C(315), C(354))](t) {
    const e = C;
    if (this[e(315)]) throw new Error(e(349));
    this.ms = t, this[e(315)] = window.setTimeout(this[e(356)], this.ms);
  }
  restart(t) {
    const e = C;
    this[e(315)] && clearTimeout(this[e(315)]), t && (this.ms = t), this.ms && (this[e(315)] = window[e(359)](this.action, this.ms));
  }
  [C(275)]() {
    const t = C;
    clearTimeout(this[t(315)]), this[t(315)] = void 0;
  }
}
function ss() {
  const n = ["destroy", "remove", "get", "values", "playback", "executingP2PCount", "17AcayqZ", "config", "7265XzZMzj", "607158IaTdPt", "loading", "26744WoykNg", "downloadSource", "bandwidthCalculators", "segment", "executingHttpCount", "1141665nGqzrr", "42338oFDgzd", "804piqjGl", "requests", "eventTarget", "5672670nANoVE", "set", "httpRequests", "status", "765uUKHUh", "getOrCreateRequest", "p2p", "requestProcessQueueCallback", "p2pRequests", "4034975eJzwzw", "items", "delete"];
  return (ss = function() {
    return n;
  })();
}
function je(n, t) {
  const e = ss();
  return (je = function(s, r) {
    return e[s -= 121];
  })(n, t);
}
const Q = je;
(function() {
  const n = je, t = ss();
  for (; ; ) try {
    if (-parseInt(n(147)) / 1 * (parseInt(n(125)) / 2) + -parseInt(n(124)) / 3 + -parseInt(n(126)) / 4 * (parseInt(n(149)) / 5) + parseInt(n(150)) / 6 + parseInt(n(138)) / 7 + parseInt(n(152)) / 8 * (parseInt(n(133)) / 9) + parseInt(n(129)) / 10 === 496559) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
var qi;
class mh {
  constructor(t, e, s, r, i) {
    f(this, qi, /* @__PURE__ */ new Map());
    const o = je;
    this[o(136)] = t, this[o(121)] = e, this.playback = s, this[o(148)] = r, this[o(128)] = i;
  }
  get [(qi = Q(127), Q(123))]() {
    const t = Q;
    let e = 0;
    for (const s of this[t(131)]()) s[t(132)] === t(151) && e++;
    return e;
  }
  get [Q(146)]() {
    const t = Q;
    let e = 0;
    for (const s of this[t(137)]()) s.status === t(151) && e++;
    return e;
  }
  get(t) {
    const e = Q;
    return this[e(127)][e(143)](t);
  }
  [Q(134)](t) {
    const e = Q;
    let s = this[e(127)].get(t);
    return !s && (s = new ph(t, this[e(136)], this[e(121)], this[e(145)], this[e(148)], this[e(128)]), this[e(127)][e(130)](t, s)), s;
  }
  [Q(142)](t) {
    const e = Q;
    this[e(127)][e(140)](t[e(122)]);
  }
  [Q(139)]() {
    return this[Q(127)].values();
  }
  *[Q(131)]() {
    const t = Q;
    for (const e of this.requests.values()) e[t(153)] === "http" && (yield e);
  }
  *p2pRequests() {
    const t = Q;
    for (const e of this[t(127)][t(144)]()) e.downloadSource === t(135) && (yield e);
  }
  [Q(141)]() {
    const t = Q;
    for (const e of this[t(127)][t(144)]()) e.status === t(151) && e.abortFromProcessQueue();
    this.requests.clear();
  }
}
var $ = He;
function He(n, t) {
  var e = rs();
  return (He = function(s, r) {
    return e[s -= 338];
  })(n, t);
}
(function() {
  for (var n = He, t = rs(); ; ) try {
    if (parseInt(n(343)) / 1 * (-parseInt(n(353)) / 2) + -parseInt(n(352)) / 3 + -parseInt(n(348)) / 4 + -parseInt(n(356)) / 5 + parseInt(n(358)) / 6 + parseInt(n(351)) / 7 + -parseInt(n(360)) / 8 * (-parseInt(n(357)) / 9) === 591165) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
var ji, Hi;
class yh {
  constructor(t, e) {
    f(this, Hi, $(354));
    f(this, ji, !1);
    var s = He;
    this[s(339)] = t, this[s(355)] = e;
  }
  get [(Hi = $(342), ji = $(359), $(344))]() {
    return this[$(342)];
  }
  get [$(338)]() {
    return this._shouldBeStartedImmediately;
  }
  [$(345)](t, e) {
    var s = $;
    this[s(342)] === "pending" && (this[s(342)] = s(341), this[s(355)][s(347)]({ data: t, bandwidth: e }));
  }
  [$(346)]() {
    var t = $;
    this[t(342)] === t(354) && (this[t(342)] = t(349), this[t(355)][t(350)](new te(t(349))));
  }
  abort() {
    var t = $;
    this._status === t(354) && (this[t(342)] = t(340), this[t(355)][t(350)](new te(t(340))));
  }
  [$(361)]() {
    this._shouldBeStartedImmediately = !0;
  }
}
function rs() {
  var n = ["16853rPVftw", "status", "resolve", "reject", "onSuccess", "2664552dHWsOk", "failed", "onError", "6768678wxKofm", "2485719HEFzOb", "14pvOpBQ", "pending", "engineCallbacks", "4582895pStYpM", "1422UaeSXV", "5024940BxuYGs", "_shouldBeStartedImmediately", "66632itZWaQ", "markAsShouldBeStartedImmediately", "shouldBeStartedImmediately", "segment", "aborted", "succeed", "_status"];
  return (rs = function() {
    return n;
  })();
}
function is() {
  const n = ["652250BUaiWX", "558bFaKnD", "segments", "get", "46632ptqrwb", "done", "546618optTvL", "53254Fcaqsf", "546240LPbKjb", "2147229UoPYiC", "next", "949100XHpfQV", "10deHSug", "value"];
  return (is = function() {
    return n;
  })();
}
function os(n, t) {
  const e = is();
  return (os = function(s, r) {
    return e[s -= 203];
  })(n, t);
}
function rn(n) {
  const { isHighDemand: t = !1, isHttpDownloadable: e = !1, isP2PDownloadable: s = !1 } = n;
  return !t && !e && !s;
}
(function() {
  const n = os, t = is();
  for (; ; ) try {
    if (parseInt(n(207)) / 1 * (-parseInt(n(216)) / 2) + parseInt(n(215)) / 3 + parseInt(n(206)) / 4 + -parseInt(n(209)) / 5 + parseInt(n(203)) / 6 + -parseInt(n(204)) / 7 + parseInt(n(213)) / 8 * (parseInt(n(210)) / 9) === 168452) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
const Ar = Object.freeze(Object.defineProperty({ __proto__: null, generateQueue: function* (n, t, e, s, r) {
  const i = os, { runtimeId: o, stream: a } = n, h = a[i(211)][i(212)](o);
  if (!h) return;
  const d = a[i(211)].values();
  let u;
  do {
    const m = d[i(205)]();
    if (m[i(214)]) return;
    u = m.value;
  } while (u !== h);
  const l = Ie(u, t, e, s, r);
  if (rn(l)) {
    const m = d[i(205)]();
    if (m[i(214)]) return;
    const v = m[i(208)], w = Ie(v, t, e, s, r);
    if (rn(w)) return;
    l.isHighDemand = !0, yield { segment: u, statuses: l }, yield { segment: v, statuses: w };
  } else yield { segment: u, statuses: l };
  for (const m of d) {
    const v = Ie(m, t, e, s, r);
    if (rn(v)) break;
    yield { segment: m, statuses: v };
  }
} }, Symbol.toStringTag, { value: "Module" })), A = We;
function We(n, t) {
  const e = as();
  return (We = function(s, r) {
    return e[s -= 365];
  })(n, t);
}
function as() {
  const n = ["requests: ", "now", "eventTarget", "stream changed to ", "getSegmentString", "13395aYvhKw", "position", "284LlPFjP", "update stream: ", "position significantly changed", "min", "isHighDemand", "pending", "getSegmentAvgDuration", "data", "httpErrorRetries", "http", "has", "abortSegmentRequest", "failed", "markAsShouldBeStartedImmediately", "setIntervalLoading", "p2p", "abort: ", "clear", "engineRequest", "182610ZBPVzq", "streamDetails", "isP2PDownloadable", "executingHttpCount", "getUsage", "3tBvFUO", "timestamp", "getSegmentData", "stream", "502280UukTdm", "coral", "loadThroughHttp", "startTime", "abortLastP2PLoadingInQueueAfterItem", "requestProcessQueueMicrotask", "swarmId", "updatePlayback", "failedAttempts", "endTime", "requests", "abortLastHttpLoadingInQueueAfterItem", "storeSegment", "logger", "segmentAvgDuration", "lastRequestedSegment", "updateStream", "storageCleanUpIntervalId", "isSegmentLoadedBySomeone", "length", "max", "abs", "processQueue", "push", "segmentStorage", "levelChangedTimestamp", "items", "isLive", "3187557AdMCST", "type", "getBandwidth", "add", "httpAttemptsCount", "runtimeId", "changeCurrentLoader", "loadThroughP2P", "getOrCreateRequest", "processRequests", "p2pml-core:hybrid-loader-", "loading", "221740bOgiPo", "destroy", "getBandwidthLoadingOnly", "isHttpDownloadable", "config", "rate", "segment", "getAvailableStorageCapacityPercent", "broadcastAnnouncement", "abort", "random", "abortFromProcessQueue", "currentLoader", "streamManifestUrl", "aborted", "84954OgnslW", "downloadSegment", "1126139aJClaV", "loadRandomThroughHttp", "randomHttpDownloadInterval", "externalId", "error", "10TuCXrk", "bandwidthCalculators", "get", "sendBroadcastAnnouncement", "arrayBackwards", "status", "isProcessQueueMicrotaskCreated", "markHandledByProcessQueue", "succeed", "getStreamSwarmId", "executingP2PCount", "downloadSource", "onSegmentRequested", "generateQueue", "hasSegment", "getStreamString", "p2pLoaders", "lastQueueProcessingTimeStamp", "playback", "not-started", "reject", "resolve", "remove", "connectedPeerCount", "onPlaybackUpdated"];
  return (as = function() {
    return n;
  })();
}
(function() {
  const n = We, t = as();
  for (; ; ) try {
    if (-parseInt(n(456)) / 1 + -parseInt(n(407)) / 2 * (-parseInt(n(412)) / 3) + parseInt(n(388)) / 4 * (-parseInt(n(386)) / 5) + -parseInt(n(471)) / 6 + parseInt(n(473)) / 7 + -parseInt(n(416)) / 8 + -parseInt(n(444)) / 9 * (-parseInt(n(478)) / 10) === 117462) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
var Wi, zi, Qi, Ji, Yi, Gi, Xi, Ki, Vi;
class _h {
  constructor(t, e, s, r, i, o, a) {
    f(this, "requests");
    f(this, "engineRequest");
    f(this, Vi);
    f(this, Ki);
    f(this, Xi);
    f(this, "logger");
    f(this, Gi);
    f(this, Yi);
    f(this, Ji);
    f(this, Qi);
    f(this, zi, !1);
    f(this, Wi, (t = !0) => {
      const e = A, s = performance[e(382)]();
      !t && this[e(373)] !== void 0 && s - this[e(373)] <= 1e3 || this[e(484)] || (this[e(484)] = !0, queueMicrotask(() => {
        const r = e;
        try {
          this[r(438)](), this[r(373)] = s;
        } finally {
          this[r(484)] = !1;
        }
      }));
    });
    const h = We;
    this[h(469)] = t, this[h(431)] = e, this[h(408)] = s, this[h(460)] = r, this[h(479)] = i, this[h(440)] = o, this[h(383)] = a;
    const d = this[h(431)][h(415)];
    this[h(374)] = { position: this.lastRequestedSegment[h(419)], rate: 1 }, this[h(430)] = Tt[h(394)](d), this[h(426)] = new mh(this[h(421)], this[h(479)], this[h(374)], this[h(460)], this[h(383)]), this[h(372)] = new lh(this.streamManifestUrl, this.lastRequestedSegment.stream, this[h(426)], this[h(440)], this[h(460)], this[h(383)], this[h(421)]), this.logger = ut(h(454) + d[h(445)]), this[h(429)].color = h(417), this.setIntervalLoading();
  }
  [(Vi = A(372), Ki = A(374), Xi = A(430), Gi = A(433), Yi = A(441), Ji = A(373), Qi = A(475), zi = A(484), A(402))]() {
    const t = A, e = this[t(372)][t(468)][t(379)], s = 1e3 * Math[t(466)]() * e + 1e3;
    this[t(475)] = window.setTimeout(() => {
      this[t(474)](), this.setIntervalLoading();
    }, s);
  }
  async loadSegment(t, e) {
    var h;
    const s = A;
    this[s(429)](s(381) + xt[s(385)](t));
    const { stream: r } = t;
    r !== this[s(431)][s(415)] && (this.logger(s(384) + xt[s(371)](r)), this[s(372)][s(450)](r)), this[s(431)] = t;
    const i = this[s(460)].swarmId ?? this.streamManifestUrl, o = Tt[s(365)](i, r);
    this[s(440)][s(368)](i, o, t[s(476)], t[s(419)], t[s(425)], r.type, this.streamDetails[s(443)]);
    const a = new yh(t, e);
    try {
      if (this[s(440)][s(370)](i, o, t.externalId)) {
        const d = await this[s(440)][s(414)](i, o, t[s(476)]);
        if (d) {
          const { queueDownloadRatio: u } = this[s(369)]();
          return void a[s(377)](d, this.getBandwidth(u));
        }
      }
      (h = this.engineRequest) == null || h.abort(), this[s(406)] = a;
    } catch {
      a.reject();
    } finally {
      this[s(421)]();
    }
  }
  processRequests(t, e) {
    var a;
    const s = A, { stream: r } = this.lastRequestedSegment, { httpErrorRetries: i } = this[s(460)], o = performance[s(382)]();
    for (const h of this[s(426)][s(442)]()) {
      const { downloadSource: d, status: u, segment: l, isHandledByProcessQueue: m } = h, v = ((a = this[s(406)]) == null ? void 0 : a[s(462)]) === l ? this[s(406)] : void 0;
      switch (u) {
        case "loading":
          !t[s(398)](l.runtimeId) && !v && (h[s(467)](), this.requests.remove(h));
          break;
        case "succeed": {
          if (!d) break;
          d === s(397) && this[s(372)][s(468)][s(464)](), v && (v.resolve(h[s(395)], this[s(446)](e)), this[s(406)] = void 0), this[s(426)].remove(h);
          const y = this[s(460)][s(422)] ?? this[s(469)], g = Tt[s(365)](y, r);
          this[s(440)][s(428)](y, g, l[s(476)], h[s(395)], l[s(419)], l[s(425)], l[s(415)][s(445)], this.streamDetails[s(443)]);
          break;
        }
        case "failed":
          d === s(397) && !m && this[s(372)].currentLoader[s(464)](), !v && !r.segments[s(398)](h[s(462)].runtimeId) && this[s(426)].remove(h), h[s(424)][s(448)] >= i && v && (this[s(406)] = void 0, v[s(376)]());
          break;
        case s(375):
          this.requests.remove(h);
          break;
        case s(470):
          this[s(426)][s(378)](h);
      }
      h[s(485)]();
      const { lastAttempt: w } = h[s(424)];
      w && o - w[s(477)][s(413)] > 6e4 && h[s(424)][s(405)]();
    }
  }
  processQueue() {
    var h;
    const t = A, { queue: e, queueSegmentIds: s, queueDownloadRatio: r } = this[t(369)]();
    this[t(453)](s, r);
    const { simultaneousHttpDownloads: i, simultaneousP2PDownloads: o, httpErrorRetries: a } = this[t(460)];
    if ((h = this[t(406)]) != null && h.shouldBeStartedImmediately && this[t(406)][t(483)] === t(393) && this[t(426)][t(410)] < i) {
      const { segment: d } = this[t(406)], u = this[t(426)][t(480)](d);
      (!u || u.status === t(375) || u.status === t(400) && u.failedAttempts.httpAttemptsCount < this[t(460)][t(396)]) && this[t(418)](d);
    }
    for (const d of e) {
      const { statuses: u, segment: l } = d, m = this.requests[t(480)](l);
      if (u[t(392)]) {
        if ((m == null ? void 0 : m[t(367)]) === t(397) && m[t(483)] === t(455) || (m == null ? void 0 : m[t(367)]) === "http" && m[t(483)] === t(400) && m[t(424)][t(448)] >= a) continue;
        const v = (m == null ? void 0 : m[t(483)]) === t(455) && m[t(367)] === "p2p";
        if (this[t(426)][t(410)] < i) {
          v && m[t(467)](), this.loadThroughHttp(l);
          continue;
        }
        if (this[t(427)](e, l) && this[t(426)][t(410)] < i) {
          v && m[t(467)](), this[t(418)](l);
          continue;
        }
        if (v) continue;
        if (this[t(426)][t(366)] < o) {
          this[t(451)](l);
          continue;
        }
        if (this[t(420)](e, l) && this.requests.executingP2PCount < o) {
          this[t(451)](l);
          continue;
        }
      } else if (u.isP2PDownloadable) {
        if ((m == null ? void 0 : m[t(483)]) === t(455)) continue;
        (this[t(426)][t(366)] < o || this[t(372)][t(468)][t(434)](l) && this.abortLastP2PLoadingInQueueAfterItem(e, l) && this.requests[t(366)] < o) && this[t(451)](l);
      }
    }
  }
  [(Wi = A(421), A(399))](t) {
    var s;
    const e = A;
    ((s = this[e(406)]) == null ? void 0 : s[e(462)][e(449)]) === t && (this[e(406)][e(465)](), this[e(429)](e(404), Qo(this[e(406)][e(462)])), this[e(406)] = void 0, this[e(421)]());
  }
  [A(418)](t) {
    const e = A, s = this.requests[e(452)](t);
    new Ca(s, this[e(460)], this.eventTarget), this.p2pLoaders[e(468)][e(464)]();
  }
  [A(451)](t) {
    const e = A;
    this[e(372)][e(468)][e(472)](t);
  }
  loadRandomThroughHttp() {
    const t = A, e = this[t(463)]();
    if (e <= 10) return;
    const { simultaneousHttpDownloads: s, httpErrorRetries: r } = this[t(460)], i = this.p2pLoaders[t(468)];
    if (this[t(426)].executingHttpCount >= s || !i[t(379)]) return;
    const o = [];
    for (const { segment: l, statuses: m } of Ar[t(369)](this[t(431)], this[t(374)], this[t(460)], this[t(372)][t(468)], e)) {
      const v = this[t(460)][t(422)] ?? this[t(469)], w = jt(v, l[t(415)]);
      if (!m[t(459)] || m[t(409)] || this[t(440)].hasSegment(v, w, l.externalId)) continue;
      const y = this[t(426)][t(480)](l);
      y && (y[t(483)] === t(455) || y.status === t(486) || y[t(424)][t(448)] >= r) || o.push(l);
    }
    if (!o[t(435)] || s - this[t(426)][t(410)] === 0) return;
    const a = i[t(379)] + 1, h = Math[t(391)](o[t(435)], s * a), d = Xo(Array.from({ length: h }, (l, m) => m));
    let u = h / a;
    for (const l of d) {
      if (this[t(426)][t(410)] >= s) break;
      if (u >= 1 || Math[t(466)]() <= u) {
        const m = o[l];
        this[t(418)](m);
      }
      if (u--, u <= 0) break;
    }
  }
  abortLastHttpLoadingInQueueAfterItem(t, e) {
    const s = A;
    for (const { segment: r } of ee[s(482)](t)) {
      if (r === e) break;
      const i = this[s(426)][s(480)](r);
      if ((i == null ? void 0 : i[s(367)]) === "http" && i[s(483)] === s(455)) return i.abortFromProcessQueue(), !0;
    }
    return !1;
  }
  [A(420)](t, e) {
    const s = A;
    for (const { segment: r } of ee[s(482)](t)) {
      if (r === e) break;
      const i = this.requests[s(480)](r);
      if ((i == null ? void 0 : i.downloadSource) === s(403) && i.status === "loading") return i.abortFromProcessQueue(), !0;
    }
    return !1;
  }
  [A(463)]() {
    const t = A, { totalCapacity: e, usedCapacity: s } = this.segmentStorage[t(411)]();
    return 100 - s / e * 100;
  }
  [A(369)]() {
    var a;
    const t = A, e = [], s = /* @__PURE__ */ new Set();
    let r = 0, i = 0;
    const o = this.getAvailableStorageCapacityPercent();
    for (const h of Ar[t(369)](this.lastRequestedSegment, this.playback, this[t(460)], this[t(372)].currentLoader, o)) {
      r++;
      const { segment: d } = h, u = this[t(460)].swarmId ?? this[t(469)], l = jt(u, d[t(415)]);
      this[t(440)].hasSegment(u, l, d.externalId) || ((a = this.requests[t(480)](d)) == null ? void 0 : a[t(483)]) === t(486) ? i++ : (e[t(439)](h), s[t(447)](d.runtimeId));
    }
    return { queue: e, queueSegmentIds: s, maxPossibleLength: r, alreadyLoadedCount: i, queueDownloadRatio: r !== 0 ? i / r : 0 };
  }
  getBandwidth(t) {
    const e = A, { http: s, all: r } = this[e(479)], { activeLevelBitrate: i } = this[e(408)];
    if (this[e(408)].activeLevelBitrate === 0) return r[e(458)](3);
    const o = Math[e(436)](r[e(446)](30, this.levelChangedTimestamp), r[e(446)](60, this[e(441)]), r[e(446)](90, this.levelChangedTimestamp));
    if (t >= 0.8 || o >= 0.9 * i) return Math.max(r[e(458)](1), r.getBandwidthLoadingOnly(3), r.getBandwidthLoadingOnly(5));
    const a = Math.max(s[e(458)](1), s[e(458)](3), s[e(458)](5));
    return Math[e(436)](o, a);
  }
  notifyLevelChanged() {
    const t = A;
    this[t(441)] = performance[t(382)]();
  }
  [A(481)](t = !1) {
    const e = A;
    this[e(372)][e(468)][e(464)](t);
  }
  [A(423)](t, e) {
    var a;
    const s = A, r = this[s(374)][s(461)] !== e, i = this[s(374)][s(387)] !== t;
    if (!r && !i) return;
    const o = Math[s(437)](t - this.playback[s(387)]) / this[s(430)] > 0.5;
    i && (this[s(374)][s(387)] = t), r && e !== 0 && (this.playback[s(461)] = e), o && (this[s(429)](s(390)), (a = this.engineRequest) == null || a[s(401)]()), this[s(440)][s(380)](t, e), this[s(421)](o);
  }
  [A(432)](t) {
    const e = A;
    t === this[e(431)][e(415)] && (this[e(429)](e(389) + xt[e(371)](t)), this[e(421)]());
  }
  [A(457)]() {
    var e;
    const t = A;
    clearInterval(this[t(433)]), clearInterval(this[t(475)]), this.storageCleanUpIntervalId = void 0, (e = this[t(406)]) == null || e.abort(), this[t(426)][t(457)](), this[t(372)][t(457)]();
  }
}
const z = hs;
function hs(n, t) {
  const e = cs();
  return (hs = function(s, r) {
    return e[s -= 106];
  })(n, t);
}
(function() {
  const n = hs, t = cs();
  for (; ; ) try {
    if (parseInt(n(107)) / 1 * (-parseInt(n(109)) / 2) + parseInt(n(118)) / 3 + -parseInt(n(115)) / 4 * (parseInt(n(124)) / 5) + -parseInt(n(129)) / 6 + parseInt(n(123)) / 7 * (parseInt(n(116)) / 8) + -parseInt(n(108)) / 9 + parseInt(n(126)) / 10 === 323911) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
var Zi, $i, to, eo, no;
class Rr {
  constructor(t = 2e4) {
    f(this, no, 0);
    f(this, eo, []);
    f(this, to, []);
    f(this, $i, []);
    f(this, "noLoadingsTime", 0);
    f(this, Zi, 0);
    this.clearThresholdMs = t;
  }
  addBytes(t, e = performance.now()) {
    const s = z;
    this[s(130)][s(122)](t), this[s(121)][s(122)](e - this[s(112)]), this.timestamps[s(122)](e);
  }
  [(no = z(114), eo = z(130), to = z(121), $i = z(128), Zi = z(127), z(120))](t = performance.now()) {
    const e = z;
    this[e(110)](), this.loadingsCount === 0 && this[e(127)] !== 0 && (this[e(112)] += t - this[e(127)]), this[e(114)]++;
  }
  [z(111)](t = performance[z(106)]()) {
    const e = z;
    this.loadingsCount > 0 && (this.loadingsCount--, this.loadingsCount === 0 && (this[e(127)] = t));
  }
  [z(125)](t, e = Number[z(119)]) {
    const s = z;
    if (!this[s(121)].length) return 0;
    const r = 1e3 * t, i = this.loadingOnlyTimestamps[this[s(121)][s(113)] - 1];
    let o = i;
    const a = i - r;
    let h = 0;
    for (let d = this[s(130)][s(113)] - 1; d >= 0; d--) {
      const u = this[s(121)][d];
      if (u < a || this[s(128)][d] < e) break;
      o = u, h += this.bytes[d];
    }
    return 8e3 * h / (i - o);
  }
  getBandwidth(t, e = Number[z(119)], s = performance[z(106)]()) {
    const r = z;
    if (!this[r(128)].length) return 0;
    const i = s - 1e3 * t;
    let o = s, a = 0;
    for (let h = this[r(130)][r(113)] - 1; h >= 0; h--) {
      const d = this[r(128)][h];
      if (d < i || d < e) break;
      o = d, a += this[r(130)][h];
    }
    return 8e3 * a / (s - o);
  }
  clearStale() {
    const t = z;
    if (!this.loadingOnlyTimestamps.length) return;
    const e = this.loadingOnlyTimestamps[this.loadingOnlyTimestamps[t(113)] - 1] - this.clearThresholdMs;
    let s = 0;
    for (const r of this[t(121)]) {
      if (r > e) break;
      s++;
    }
    this.bytes[t(117)](0, s), this.loadingOnlyTimestamps[t(117)](0, s), this[t(128)].splice(0, s);
  }
}
function cs() {
  const n = ["splice", "736191TBkMIQ", "NEGATIVE_INFINITY", "startLoading", "loadingOnlyTimestamps", "push", "7Ggluym", "80oQKCPG", "getBandwidthLoadingOnly", "17182950iaadvf", "loadingsStoppedAt", "timestamps", "3224250UOGooc", "bytes", "now", "343378HxhbZo", "5041638kAcwdH", "2YuYMWJ", "clearStale", "stopLoading", "noLoadingsTime", "length", "loadingsCount", "155148HpduBW", "3373968mZJGLP"];
  return (cs = function() {
    return n;
  })();
}
function us() {
  const n = ["3776320PDOxeV", "27804WLgOrb", "test", "272436IlXjGg", "9yUWXuL", "393CjetNr", "10977728cPsomY", "1382754EvyeEw", "5002844aVMsUv", "86229WSTAVF"];
  return (us = function() {
    return n;
  })();
}
const Pr = ds;
(function() {
  const n = ds, t = us();
  for (; ; ) try {
    if (parseInt(n(451)) / 1 + parseInt(n(455)) / 2 + -parseInt(n(457)) / 3 * (parseInt(n(453)) / 4) + parseInt(n(452)) / 5 + -parseInt(n(459)) / 6 + -parseInt(n(460)) / 7 + parseInt(n(458)) / 8 * (parseInt(n(456)) / 9) === 494195) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
const _e = (n, t) => n + "|" + t;
function ds(n, t) {
  const e = us();
  return (ds = function(s, r) {
    return e[s -= 451];
  })(n, t);
}
const E = ls;
function ls(n, t) {
  const e = ps();
  return (ls = function(s, r) {
    return e[s -= 401];
  })(n, t);
}
(function() {
  const n = ls, t = ps();
  for (; ; ) try {
    if (-parseInt(n(428)) / 1 * (parseInt(n(450)) / 2) + -parseInt(n(403)) / 3 * (parseInt(n(451)) / 4) + -parseInt(n(457)) / 5 + -parseInt(n(407)) / 6 * (parseInt(n(458)) / 7) + parseInt(n(430)) / 8 * (-parseInt(n(421)) / 9) + parseInt(n(411)) / 10 * (-parseInt(n(422)) / 11) + parseInt(n(444)) / 12 === 847053) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
const Se = 1048576;
function ps() {
  const n = ["get", "3877350QfKOmu", "currentPlayback", "shouldRemoveSegment", "p2pml-core:segment-memory-storage", "from", "size", "initialize", "values", "set", "storeSegment", "9TIXwqu", "11wqSFLn", "getSegmentData", "onSegmentRequested", "RebeccaPurple", "currentStorageUsage", "add", "34756duUNhg", "clear", "9013016IJbdfC", "dispatchStorageUpdatedEvent is not set", "Removed segment ", "sendUpdatesToAffectedStreams", "isMemoryLimitReached", "position", "destroy", "increaseStorageUsage", "startTime", "add segment: ", "push", "forEach", "userAgent", "segmentChangeCallback", "45687384wFnkKR", "mainStreamConfig", "color", "lastRequestedSegment", "onPlaybackUpdated", "getStreamTimeWindow", "14HHRzeb", "852XwnOoy", "segmentMemoryStorageLimit", "data", "delete", "initialized", "setMemoryStorageLimit", "4580755ZyPYAf", "3248OffKcf", "logger", "secondaryStreamConfig", "cache", "1224WbXPLP", "coreConfig", "decreaseStorageUsage", "byteLength", "2580hZYyQL", "sort", " from stream "];
  return (ps = function() {
    return n;
  })();
}
var so, ro, io, oo, ao, ho, co, uo, lo;
class Sh {
  constructor() {
    f(this, lo, navigator[E(442)]);
    f(this, uo, 4096);
    f(this, co, 0);
    f(this, "cache", /* @__PURE__ */ new Map());
    f(this, ho);
    f(this, ao);
    f(this, oo);
    f(this, io);
    f(this, ro);
    f(this, so);
    f(this, "segmentChangeCallback");
    const t = E;
    this[t(459)] = ut(t(414)), this[t(459)][t(446)] = t(425);
  }
  async [(lo = E(442), uo = E(452), co = E(426), ho = E(459), ao = E(404), oo = E(445), io = E(401), ro = E(412), so = E(447), E(417))](t, e, s) {
    const r = E;
    this[r(404)] = t, this[r(445)] = e, this[r(401)] = s, this[r(456)](), this.logger(r(455));
  }
  [E(448)](t, e) {
    this[E(412)] = { position: t, rate: e };
  }
  [E(424)](t, e, s, r, i, o, a) {
    this.lastRequestedSegment = { streamId: e, segmentId: s, startTime: r, endTime: i, swarmId: t, streamType: o, isLiveStream: a };
  }
  async [E(420)](t, e, s, r, i, o, a, h) {
    const d = E;
    this.clear(h, r[d(406)]);
    const u = _e(e, s);
    if (this.cache[d(419)](u, { data: r, segmentId: s, streamId: e, startTime: i, endTime: o, streamType: a }), this[d(437)](r[d(406)]), this[d(459)](d(439) + s + " to " + e), !this[d(443)]) throw new Error("dispatchStorageUpdatedEvent is not set");
    this[d(443)](e);
  }
  async [E(423)](t, e, s) {
    const r = E, i = _e(e, s), o = this[r(402)][r(410)](i);
    if (o !== void 0) return o[r(453)];
  }
  getUsage() {
    const t = E;
    if (!this[t(447)] || !this[t(412)]) return { totalCapacity: this[t(452)], usedCapacity: this.currentStorageUsage };
    const e = this[t(412)][t(435)];
    let s = 0;
    for (const { endTime: r, data: i } of this.cache[t(418)]()) e > r || (s += i[t(406)]);
    return { totalCapacity: this.segmentMemoryStorageLimit, usedCapacity: s / Se };
  }
  hasSegment(t, e, s) {
    const r = E, i = _e(e, s);
    return this[r(402)].get(i) !== void 0;
  }
  getStoredSegmentIds(t, e) {
    const s = E, r = [];
    for (const { segmentId: i, streamId: o } of this[s(402)][s(418)]()) o === e && r[s(440)](i);
    return r;
  }
  [E(429)](t, e) {
    const s = E;
    if (!(this[s(412)] && this[s(445)] && this[s(401)] && this[s(404)]) || !this.isMemoryLimitReached(e) && !t) return;
    const r = /* @__PURE__ */ new Set(), i = Array[s(415)](this[s(402)].values())[s(408)]((o, a) => o[s(438)] - a.startTime);
    for (const o of i) {
      const { streamId: a, segmentId: h, data: d } = o, u = _e(a, h);
      if (this[s(413)](o, t, this.currentPlayback[s(435)]) && (this.cache[s(454)](u), r[s(427)](a), this.decreaseStorageUsage(d[s(406)]), this[s(459)](s(432) + h + s(409) + a), !this[s(434)](e) && !t)) break;
    }
    this[s(433)](r);
  }
  [E(434)](t) {
    const e = E;
    return this.currentStorageUsage + t / Se > this[e(452)];
  }
  setSegmentChangeCallback(t) {
    this.segmentChangeCallback = t;
  }
  [E(433)](t) {
    const e = E;
    t[e(416)] !== 0 && t[e(441)]((s) => {
      const r = e;
      if (!this[r(443)]) throw new Error(r(431));
      this.segmentChangeCallback(s);
    });
  }
  [E(413)](t, e, s) {
    const { endTime: r, streamType: i } = t, o = this.getStreamTimeWindow(i, "highDemandTimeWindow");
    return !(s <= r) && (!e || s > o + r);
  }
  [E(437)](t) {
    this[E(426)] += t / Se;
  }
  [E(405)](t) {
    this[E(426)] -= t / Se;
  }
  [E(456)]() {
    var i;
    const t = E;
    var e, s, r;
    (i = this[t(404)]) != null && i[t(452)] ? this[t(452)] = this[t(404)].segmentMemoryStorageLimit : (r = this[t(442)], /Android/i.test(r) && !/Chrome|Firefox/i[Pr(454)](r) || (s = this[t(442)], /iPad|iPhone/i[Pr(454)](s)) ? this[t(452)] = 1024 : (e = this.userAgent, /Android/i.test(e) && (this.segmentMemoryStorageLimit = 2048)));
  }
  [E(449)](t, e) {
    const s = E, r = t === "main" ? this[s(445)] : this[s(401)];
    return (r == null ? void 0 : r[e]) ?? 0;
  }
  [E(436)]() {
    const t = E;
    this[t(402)][t(429)]();
  }
}
const vt = fs;
function fs(n, t) {
  const e = gs();
  return (fs = function(s, r) {
    return e[s -= 156];
  })(n, t);
}
(function() {
  const n = fs, t = gs();
  for (; ; ) try {
    if (-parseInt(n(160)) / 1 * (parseInt(n(172)) / 2) + -parseInt(n(170)) / 3 * (-parseInt(n(174)) / 4) + parseInt(n(164)) / 5 * (parseInt(n(157)) / 6) + -parseInt(n(163)) / 7 * (-parseInt(n(176)) / 8) + -parseInt(n(162)) / 9 + parseInt(n(169)) / 10 * (-parseInt(n(167)) / 11) + -parseInt(n(161)) / 12 * (-parseInt(n(171)) / 13) === 211733) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
var po;
class bh {
  constructor() {
    f(this, po, /* @__PURE__ */ new Map());
  }
  dispatchEvent(t, ...e) {
    const s = vt, r = this[s(159)][s(156)](t);
    if (r) for (const i of r) i(...e);
  }
  [(po = vt(159), vt(166))](t) {
    const e = vt;
    let s = this.events[e(156)](t);
    !s && (s = [], this.events.set(t, s));
    const r = s;
    return (...i) => {
      for (const o of r) o(...i);
    };
  }
  [vt(165)](t, e) {
    const s = vt, r = this.events.get(t);
    r ? r[s(168)](e) : this[s(159)].set(t, [e]);
  }
  [vt(175)](t, e) {
    const s = vt, r = this.events[s(156)](t);
    if (r) {
      const i = r[s(173)](e);
      i !== -1 && r[s(158)](i, 1);
    }
  }
}
function gs() {
  const n = ["events", "2EiWszk", "60juQuQp", "1625679lfHiZJ", "361550BifdWO", "126880bYRvSX", "addEventListener", "getEventDispatcher", "3247871fOVrwD", "push", "10kxYiEM", "284190AvAKtZ", "1951417atcEsX", "310804vAgrHw", "indexOf", "4AtDORl", "removeEventListener", "8gYOmIL", "get", "24tiYSrB", "splice"];
  return (gs = function() {
    return n;
  })();
}
const x = ys;
function ms() {
  const n = ["secondary", "735230HVMUpS", "mainStreamLoader", "abortSegmentLoading", "get", "function", "getUpdatedStreamProperty", "processSpecificDynamicConfigParams", "segmentStorage", "secondaryStreamConfig", "Manifest response url is undefined", "Not found segment with id: ", "29YCEIMV", "stream", "destroyStreamLoader", "533030yvZpGM", "removeEventListener", "getConfig", "manifestResponseUrl", "set", "updatePlayback", "split", "27GFPtxY", "58545tUFdjs", "sendBroadcastAnnouncement", "isLive", "notifyLevelChanged", "4VdouUt", "createNewHybridLoader", "Manifest response url is not defined", "streamDetails", "stun:global.stun.twilio.com:3478", "520548zfcaSz", "customSegmentStorageFactory", "eventTarget", "activeLevelBitrate", "getStreamHybridLoader", "segments", "updateStream", "runtimeId", "7926ECcnAB", "abortSegmentRequest", "bandwidthCalculators", "getSegmentFromStreamsMap", "getStream", "addEventListener", "initialize", "DEFAULT_COMMON_CORE_CONFIG", "141832eXrKWC", "clear", "commonCoreConfig", "isP2PUploadDisabled", "initializeSegmentStorage", "loadSegment", "setIsLive", "type", "applyDynamicConfig", "clearPeerIdCache", "stun:stun.l.google.com:19302", "main", "isP2PDisabled", "setActiveLevelBitrate", "streams", "identifySegment", "secondaryStream", "1925035xnQvni", "overrideAllConfigs", "mainStream", "destroy", "DEFAULT_STREAM_CONFIG", "hasSegment", "secondaryStreamLoader", "mainStreamConfig"];
  return (ms = function() {
    return n;
  })();
}
function ys(n, t) {
  const e = ms();
  return (ys = function(s, r) {
    return e[s -= 473];
  })(n, t);
}
(function() {
  const n = ys, t = ms();
  for (; ; ) try {
    if (parseInt(n(525)) / 1 * (-parseInt(n(480)) / 2) + -parseInt(n(536)) / 3 + -parseInt(n(540)) / 4 * (parseInt(n(528)) / 5) + -parseInt(n(545)) / 6 + parseInt(n(505)) / 7 + -parseInt(n(488)) / 8 + -parseInt(n(535)) / 9 * (-parseInt(n(514)) / 10) === 150039) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
var fo, go, mo, yo, _o, So, bo, wo;
const Pt = class Pt {
  constructor(t) {
    f(this, "eventTarget", new bh());
    f(this, So);
    f(this, _o, /* @__PURE__ */ new Map());
    f(this, yo);
    f(this, "secondaryStreamConfig");
    f(this, mo);
    f(this, "bandwidthCalculators", { all: new Rr(), http: new Rr() });
    f(this, "segmentStorage");
    f(this, go);
    f(this, fo);
    f(this, "streamDetails", { isLive: !1, activeLevelBitrate: 0 });
    const e = x, s = Go(t ?? {});
    this[e(490)] = we({ defaultConfig: Pt[e(487)], baseConfig: s }), this[e(512)] = we({ defaultConfig: Pt.DEFAULT_STREAM_CONFIG, baseConfig: s, specificStreamConfig: s[e(507)] }), this.secondaryStreamConfig = we({ defaultConfig: Pt.DEFAULT_STREAM_CONFIG, baseConfig: s, specificStreamConfig: s.secondaryStream });
  }
  [(wo = x(487), bo = x(509), So = x(531), _o = x(502), yo = x(512), mo = x(490), go = x(515), fo = x(511), x(530))]() {
    const t = x;
    return { ...St(this[t(490)]), mainStream: St(this[t(512)]), secondaryStream: St(this[t(522)]) };
  }
  [x(496)](t) {
    const e = x, { mainStream: s, secondaryStream: r } = t, i = St(this[e(512)]), o = St(this[e(522)]);
    this[e(506)](t, s, r), this[e(520)](i, t, "main"), this.processSpecificDynamicConfigParams(o, t, e(513));
  }
  processSpecificDynamicConfigParams(t, e, s) {
    const r = x, i = this[r(519)](r(500), e, s);
    i && t[r(500)] !== i && this[r(527)](s);
    const o = this[r(519)](r(491), e, s);
    if (o !== void 0 && t.isP2PUploadDisabled !== o) {
      const a = s === "main" ? this[r(515)] : this[r(511)];
      a == null || a[r(537)](o);
    }
  }
  [x(519)](t, e, s) {
    const r = x, i = s === r(499) ? e[r(507)] : e[r(504)];
    return (i == null ? void 0 : i[t]) ?? e[t];
  }
  [x(485)](t, e) {
    this[x(474)].addEventListener(t, e);
  }
  [x(529)](t, e) {
    const s = x;
    this[s(474)][s(529)](t, e);
  }
  setManifestResponseUrl(t) {
    const e = x;
    this[e(531)] = t[e(534)]("?")[0];
  }
  [x(510)](t) {
    const e = x;
    return !!Tt[e(483)](this[e(502)], t);
  }
  [x(484)](t) {
    const e = x;
    return this[e(502)][e(517)](t);
  }
  addStreamIfNoneExists(t) {
    const e = x;
    this[e(502)].has(t[e(479)]) || this[e(502)].set(t[e(479)], { ...t, segments: /* @__PURE__ */ new Map() });
  }
  updateStream(t, e, s) {
    var o, a;
    const r = x, i = this.streams[r(517)](t);
    if (i) {
      if (e) for (const h of e) i[r(477)].has(h[r(479)]) || i[r(477)][r(532)](h[r(479)], { ...h, stream: i });
      if (s) for (const h of s) i.segments.delete(h);
      (o = this[r(515)]) == null || o[r(478)](i), (a = this[r(511)]) == null || a[r(478)](i);
    }
  }
  async [x(493)](t, e) {
    const s = x;
    if (!this[s(531)]) throw new Error("Manifest response url is not defined");
    await this[s(492)]();
    const r = this.identifySegment(t);
    this.getStreamHybridLoader(r)[s(493)](r, e);
  }
  [x(516)](t) {
    var s, r;
    const e = x;
    (s = this[e(515)]) == null || s[e(481)](t), (r = this[e(511)]) == null || r[e(481)](t);
  }
  [x(533)](t, e) {
    var r, i;
    const s = x;
    (r = this.mainStreamLoader) == null || r[s(533)](t, e), (i = this[s(511)]) == null || i[s(533)](t, e);
  }
  [x(501)](t) {
    var s, r;
    const e = x;
    t !== this[e(543)][e(475)] && (this[e(543)][e(475)] = t, (s = this.mainStreamLoader) == null || s[e(539)](), (r = this[e(511)]) == null || r[e(539)]());
  }
  [x(494)](t) {
    const e = x;
    this.streamDetails[e(538)] = t;
  }
  isSegmentLoadable(t) {
    const e = x;
    try {
      const s = this[e(503)](t);
      return (s[e(526)][e(495)] !== e(499) || !this[e(512)][e(500)]) && (s[e(526)][e(495)] !== e(513) || !this[e(522)][e(500)]);
    } catch {
      return !1;
    }
  }
  [x(508)]() {
    var e, s, r;
    const t = x;
    this[t(502)][t(489)](), (e = this[t(515)]) == null || e[t(508)](), (s = this[t(511)]) == null || s.destroy(), (r = this[t(521)]) == null || r[t(508)](), this[t(515)] = void 0, this.secondaryStreamLoader = void 0, this.segmentStorage = void 0, this[t(531)] = void 0, this[t(543)] = { isLive: !1, activeLevelBitrate: 0 }, Re[t(497)]();
  }
  async [x(492)]() {
    const t = x;
    if (this.segmentStorage) return;
    const { isLive: e } = this[t(543)], s = this[t(490)][t(473)];
    if (s && typeof s !== t(518)) throw new Error("Storage configuration is invalid");
    const r = s ? s(e) : new Sh();
    await r[t(486)](this[t(490)], this[t(512)], this[t(522)]), this.segmentStorage = r;
  }
  [x(503)](t) {
    const e = x;
    if (!this[e(531)]) throw new Error(e(523));
    const s = Tt[e(483)](this.streams, t);
    if (!s) throw new Error(e(524) + t);
    return s;
  }
  [x(506)](t, e, s) {
    const r = x;
    Ut(this[r(490)], t), Ut(this[r(512)], t), Ut(this[r(522)], t), e && Ut(this[r(512)], e), s && Ut(this[r(522)], s);
  }
  destroyStreamLoader(t) {
    var s, r;
    const e = x;
    t === "main" ? ((s = this[e(515)]) == null || s[e(508)](), this[e(515)] = void 0) : ((r = this.secondaryStreamLoader) == null || r[e(508)](), this.secondaryStreamLoader = void 0);
  }
  [x(476)](t) {
    var s, r;
    const e = x;
    return t[e(526)][e(495)] === e(499) ? (this[s = e(515)] ?? (this[s] = this[e(541)](t)), this[e(515)]) : (this[r = e(511)] ?? (this[r] = this[e(541)](t)), this[e(511)]);
  }
  [x(541)](t) {
    const e = x;
    if (!this[e(531)]) throw new Error(e(542));
    if (!this[e(521)]) throw new Error("Segment storage is not initialized");
    const s = t[e(526)][e(495)] === e(499) ? this.mainStreamConfig : this[e(522)];
    return new _h(this[e(531)], t, this[e(543)], s, this[e(482)], this[e(521)], this[e(474)]);
  }
};
f(Pt, wo, { segmentMemoryStorageLimit: void 0, customSegmentStorageFactory: void 0 }), f(Pt, bo, { isP2PUploadDisabled: !1, isP2PDisabled: !1, simultaneousHttpDownloads: 1, simultaneousP2PDownloads: 5, highDemandTimeWindow: 15, httpDownloadTimeWindow: 3e3, p2pDownloadTimeWindow: 6e3, webRtcMaxMessageSize: 65535, p2pNotReceivingBytesTimeoutMs: 2900, p2pInactiveLoaderDestroyTimeoutMs: 3e4, httpNotReceivingBytesTimeoutMs: 3e3, httpErrorRetries: 100, p2pErrorRetries: 1, trackerClientVersionPrefix: Wo, announceTrackers: ["wss://v2.swarm.video"], rtcConfig: { iceServers: [{ urls: x(498) }, { urls: x(544) }] }, validateP2PSegment: void 0, validateHTTPSegment: void 0, httpRequestSetup: void 0, statsSegmentsThreshold: 10, swarmId: void 0 });
let Pe = Pt;
function _s() {
  var n = ["531fjwRer", "10236gmvihw", "40220HCmYbM", "82UscnyX", "786UTOVlF", "23996BFojNy", "56947BGwYBO", "16435UsybUA", "19719LvUIeh", "1089608DNAbAs", "424CjFBJB", "2148NZIaZr"];
  return (_s = function() {
    return n;
  })();
}
function $o(n, t) {
  var e = _s();
  return ($o = function(s, r) {
    return e[s -= 324];
  })(n, t);
}
(function() {
  for (var n = $o, t = _s(); ; ) try {
    if (-parseInt(n(333)) / 1 * (parseInt(n(331)) / 2) + -parseInt(n(326)) / 3 + -parseInt(n(327)) / 4 + parseInt(n(325)) / 5 * (parseInt(n(334)) / 6) + parseInt(n(335)) / 7 * (-parseInt(n(328)) / 8) + -parseInt(n(330)) / 9 * (parseInt(n(332)) / 10) + -parseInt(n(324)) / 11 * (-parseInt(n(329)) / 12) === 239647) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
const kh = Object.freeze(Object.defineProperty({ __proto__: null, Core: Pe, CoreRequestError: te, RequestError: V, debug: xn.debug }, Symbol.toStringTag, { value: "Module" })), ft = bs;
function Ss() {
  const n = ["30517212VSTtfN", "onSuccess", "getByteRange", "config", "1160SAYwpQ", "now", "onAbort", "21zbbYwj", "abort", "failed", "stats", "url", "onProgress", "33tkpjEg", "2pdcsBZ", "loading", "loader", "aborted", "total", "text", "loadSegment", "onError", "1571082cQbaWk", "data", "640311XpWlIw", "4527910BZEssZ", "getSegmentRuntimeId", "isSegmentLoadable", "byteLength", "context", "123052kUHxBT", "30IjJLsp", "abortSegmentLoading", "type", "destroy", "message", "60363JPaDhC", "1656717NWWmvF", "hasSegment"];
  return (Ss = function() {
    return n;
  })();
}
(function() {
  const n = bs, t = Ss();
  for (; ; ) try {
    if (-parseInt(n(262)) / 1 * (-parseInt(n(252)) / 2) + -parseInt(n(236)) / 3 + parseInt(n(268)) / 4 * (parseInt(n(230)) / 5) + -parseInt(n(260)) / 6 * (-parseInt(n(245)) / 7) + parseInt(n(242)) / 8 * (parseInt(n(235)) / 9) + parseInt(n(263)) / 10 * (parseInt(n(251)) / 11) + -parseInt(n(238)) / 12 === 845978) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
var Io, vo, Lt, se, ht, kt, mt, yt, Mt, ta, Sn;
class wh {
  constructor(t, e) {
    it(this, Mt);
    f(this, vo);
    f(this, Io);
    f(this, "stats");
    it(this, Lt);
    it(this, se);
    it(this, ht);
    it(this, kt);
    it(this, mt);
    it(this, yt);
    const s = ft;
    ot(this, kt, e), ot(this, se, () => new t[s(254)](t)), this[s(248)] = { aborted: !1, 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(t, e, s) {
    const r = ft;
    this[r(267)] = t, this[r(241)] = e, ot(this, Lt, s);
    const { stats: i } = this, { rangeStart: o, rangeEnd: a } = t, h = ve[r(240)](o, a !== void 0 ? a - 1 : void 0);
    ot(this, yt, ve[r(264)](t[r(249)], h));
    const d = M(this, kt)[r(265)](M(this, yt));
    if (!M(this, kt)[r(237)](M(this, yt)) || !d) return ot(this, ht, M(this, se).call(this)), M(this, ht).stats = this[r(248)], void M(this, ht).load(t, e, s);
    M(this, kt)[r(258)](M(this, yt), { onSuccess: (u) => {
      const l = r;
      ot(this, mt, u);
      const m = M(this, mt)[l(261)][l(266)];
      i[l(253)] = function(v, w, y) {
        const g = y - 8e3 * w / v;
        return { start: g - 10, first: g, end: y };
      }(M(this, mt).bandwidth, m, performance[l(243)]()), i[l(256)] = m, i.loaded = m, s[l(250)] && s[l(250)](this[l(248)], t, M(this, mt)[l(261)], void 0), s[l(239)]({ data: M(this, mt).data, url: t[l(249)] }, this.stats, t, void 0);
    }, onError: (u) => {
      const l = r;
      u instanceof te && u[l(232)] === l(255) && this.stats[l(255)] || de(this, Mt, ta).call(this, u);
    } });
  }
  [(vo = ft(267), Io = ft(241), ft(246))]() {
    var e, s;
    const t = ft;
    M(this, ht) ? M(this, ht)[t(246)]() : (de(this, Mt, Sn).call(this), (s = (e = M(this, Lt)) == null ? void 0 : e[t(244)]) == null || s.call(e, this[t(248)], this[t(267)], {}));
  }
  destroy() {
    const t = ft;
    M(this, ht) ? M(this, ht)[t(233)]() : (this[t(248)][t(255)] || de(this, Mt, Sn).call(this), ot(this, Lt, null), this[t(241)] = null);
  }
}
Lt = new WeakMap(), se = new WeakMap(), ht = new WeakMap(), kt = new WeakMap(), mt = new WeakMap(), yt = new WeakMap(), Mt = new WeakSet(), ta = function(t) {
  var r;
  const e = ft, s = { code: 0, text: "" };
  t instanceof te && t[e(232)] === e(247) ? s.text = t[e(234)] : t instanceof Error && (s[e(257)] = t[e(234)]), (r = M(this, Lt)) == null || r[e(259)](s, this[e(267)], null, this.stats);
}, Sn = function() {
  const t = ft;
  !M(this, mt) && M(this, yt) && (this[t(248)][t(255)] = !0, M(this, kt)[t(231)](M(this, yt)));
};
function bs(n, t) {
  const e = Ss();
  return (bs = function(s, r) {
    return e[s -= 230];
  })(n, t);
}
function ws(n, t) {
  var e = Is();
  return (ws = function(s, r) {
    return e[s -= 442];
  })(n, t);
}
function Is() {
  var n = ["context", "67898lZpqdu", "4509036qVgEoc", "10nRiguD", "2130BHIydS", "load", "356hhUzWG", "4895OIexOq", "abort", "24020tjikfX", "279anFmTc", "stats", "647643LlIJQx", "destroy", "2410zjkncT", "3241WyYjzg", "54440ZcFxWv"];
  return (Is = function() {
    return n;
  })();
}
var At = ws;
(function() {
  for (var n = ws, t = Is(); ; ) try {
    if (parseInt(n(453)) / 1 * (parseInt(n(455)) / 2) + parseInt(n(447)) / 3 + parseInt(n(458)) / 4 * (-parseInt(n(444)) / 5) + -parseInt(n(456)) / 6 * (parseInt(n(450)) / 7) + parseInt(n(451)) / 8 * (-parseInt(n(445)) / 9) + parseInt(n(449)) / 10 * (parseInt(n(442)) / 11) + parseInt(n(454)) / 12 === 235493) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
var Co, _t;
class Ih {
  constructor(t) {
    it(this, _t);
    f(this, Co);
    f(this, "stats");
    var e = At;
    ot(this, _t, new t.loader(t)), this[e(446)] = M(this, _t)[e(446)], this[e(452)] = M(this, _t).context;
  }
  load(t, e, s) {
    var r = At;
    M(this, _t)[r(457)](t, e, s);
  }
  [(Co = At(452), At(443))]() {
    var t = At;
    M(this, _t)[t(443)]();
  }
  [At(448)]() {
    var t = At;
    M(this, _t)[t(448)]();
  }
}
_t = new WeakMap();
const Ft = vs;
function vs(n, t) {
  const e = Cs();
  return (vs = function(s, r) {
    return e[s -= 214];
  })(n, t);
}
function Cs() {
  const n = ["180042Tiddph", "segments", "84196furptW", "core", "882834VyOqXE", "getStream", "updateStream", "push", "length", "639252dkWsTk", "main", "112bynGUV", "values", "entries", "5zWkVKL", "delete", "22450jrWjaT", "processMainManifest", "getByteRange", "isArray", "5189GgmiGu", "has", "addStreamIfNoneExists", "getSegmentRuntimeId", "updatePlaylist", "1350189ioNWPG", "3dwaaOF", "secondary"];
  return (Cs = function() {
    return n;
  })();
}
(function() {
  const n = vs, t = Cs();
  for (; ; ) try {
    if (parseInt(n(231)) / 1 + parseInt(n(239)) / 2 + -parseInt(n(237)) / 3 * (parseInt(n(220)) / 4) + -parseInt(n(225)) / 5 * (-parseInt(n(215)) / 6) + -parseInt(n(241)) / 7 * (-parseInt(n(222)) / 8) + -parseInt(n(236)) / 9 + parseInt(n(227)) / 10 === 103152) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
var ko;
class vh {
  constructor(t) {
    f(this, ko);
    this[Ft(214)] = t;
  }
  [(ko = Ft(214), Ft(228))](t) {
    const e = Ft, { levels: s, audioTracks: r } = t;
    for (const [i, o] of s[e(224)]()) {
      const { url: a } = o;
      this[e(214)][e(233)]({ runtimeId: Array[e(230)](a) ? a[0] : a, type: e(221), index: i });
    }
    for (const [i, o] of r[e(224)]()) {
      const { url: a } = o;
      this.core[e(233)]({ runtimeId: Array.isArray(a) ? a[0] : a, type: e(238), index: i });
    }
  }
  [Ft(235)](t) {
    const e = Ft, { details: { url: s, fragments: r, live: i } } = t, o = this.core[e(216)](s);
    if (!o) return;
    const a = new Set(o[e(240)].keys()), h = [];
    r.forEach((d, u) => {
      const l = e, { url: m, byteRange: v, sn: w, start: y, end: g } = d;
      if (w.toString() === "initSegment") return;
      const [p, _] = v, S = ve[l(229)](p, _ !== void 0 ? _ - 1 : void 0), I = ve[l(234)](m, S);
      a[l(226)](I), o.segments[l(232)](I) || h[l(218)]({ runtimeId: I, url: m, externalId: i ? w : u, byteRange: S, startTime: y, endTime: g });
    }), (h[e(219)] || a.size) && this[e(214)][e(217)](s, h, a[e(223)]());
  }
}
function ks(n, t) {
  const e = xs();
  return (ks = function(s, r) {
    return e[s -= 200];
  })(n, t);
}
function xs() {
  const n = ["getConfigForHlsJs", "4489816kaMkAA", "1601306Qecywe", "1076372aGEYua", "54epHotk", "558440TVVPqm", "542684lcrMaI", "bindHls", "2000440ckHDWl", "3685962QbSuqF", "onHlsJsCreated", "3PBBVSG"];
  return (xs = function() {
    return n;
  })();
}
(function() {
  const n = ks, t = xs();
  for (; ; ) try {
    if (-parseInt(n(209)) / 1 + parseInt(n(200)) / 2 * (-parseInt(n(205)) / 3) + -parseInt(n(211)) / 4 + -parseInt(n(202)) / 5 + -parseInt(n(203)) / 6 + -parseInt(n(208)) / 7 + -parseInt(n(207)) / 8 * (-parseInt(n(210)) / 9) === 636865) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
const P = ze;
function Ts() {
  const n = ["media", "getConfigForHlsJs", "handlePlaybackUpdate", "liveSyncDurationCount", "initHlsEvents", "length", "core", "injectMixin", "addEventListener", "3265180DKmBtF", "target", "seeking", "handleManifestLoaded", "handleLevelUpdated", "min", "register", "applyDynamicConfig", "8cbLAwO", "updateMediaElementEventHandlers", "1315242xRZntj", "segmentManager", "config", "hlsDestroying", "123017EcELkS", "playbackRate", "fragments", "getConfig", "createFragmentLoaderClass", "currentHlsInstance", "handleMediaDetached", "targetduration", "updatePlaylist", "userConfig", "hlsMediaDetached", "416848zyTcwv", "function", "setIsLive", "updatePlayback", "handleMediaAttached", "2206194eXinhj", "timeupdate", "destroy", "handleLevelSwitching", "2FFoAAl", "updateHlsEventsHandlers", "type", "522275lOgsRd", "1035054HmPFza", "hlsManifestLoading", "unregister", "hlsInstanceGetter", "14sIGubo", "main", "hlsAudioTrackLoaded", "bitrate", "debug", "liveSyncDuration", "url", "updateLiveSyncDurationCount", "currentTime", "floor", "details", "createPlaylistLoaderClass", "ratechange", "setActiveLevelBitrate", "swarm-viewer:engine", "destroyCore", "networkDetails", "setManifestResponseUrl", "removeEventListener", "off"];
  return (Ts = function() {
    return n;
  })();
}
function ze(n, t) {
  const e = Ts();
  return (ze = function(s, r) {
    return e[s -= 400];
  })(n, t);
}
(function() {
  const n = ze, t = Ts();
  for (; ; ) try {
    if (-parseInt(n(441)) / 1 * (-parseInt(n(461)) / 2) + -parseInt(n(465)) / 3 + -parseInt(n(435)) / 4 * (-parseInt(n(464)) / 5) + -parseInt(n(457)) / 6 + parseInt(n(469)) / 7 * (parseInt(n(452)) / 8) + parseInt(n(437)) / 9 + parseInt(n(427)) / 10 === 196078) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
var xo, To, Eo, Ao, Ro, Po, Lo, Oo, Mo;
class ea {
  constructor(t) {
    f(this, "core");
    f(this, Mo);
    f(this, "hlsInstanceGetter");
    f(this, "currentHlsInstance");
    f(this, Oo, xn.debug(P(412)));
    f(this, "updateMediaElementEventHandlers", (t) => {
      var i;
      const e = P, s = (i = this[e(446)]) == null ? void 0 : i[e(418)];
      if (!s) return;
      const r = t === "register" ? "addEventListener" : e(416);
      s[r](e(458), this[e(420)]), s[r](e(429), this.handlePlaybackUpdate), s[r](e(410), this[e(420)]);
    });
    f(this, "handleManifestLoaded", (t, e) => {
      const s = P, r = e[s(414)];
      r instanceof XMLHttpRequest ? this[s(424)][s(415)](r.responseURL) : r instanceof Response && this[s(424)].setManifestResponseUrl(r[s(404)]), this.segmentManager.processMainManifest(e);
    });
    f(this, Lo, (t, e) => {
      const s = P;
      e[s(401)] && this[s(424)][s(411)](e[s(401)]);
    });
    f(this, Po, (t, e) => {
      const s = P;
      this.currentHlsInstance && e[s(408)].live && e[s(408)][s(443)][0][s(463)] === s(470) && !this.currentHlsInstance[s(450)][s(403)] && !this[s(446)][s(450)][s(421)] && e[s(408)].fragments[s(423)] > 4 && this[s(405)](e), this[s(424)][s(454)](e[s(408)].live), this[s(438)][s(449)](e);
    });
    f(this, Ro, () => {
      this[P(436)]("register");
    });
    f(this, Ao, () => {
      this[P(436)]("unregister");
    });
    f(this, Eo, (t) => {
      const e = P, s = t[e(428)];
      this.core[e(455)](s[e(406)], s[e(442)]);
    });
    f(this, To, () => this.core.destroy());
    f(this, xo, () => {
      const t = P;
      this.destroyCore(), this.updateHlsEventsHandlers(t(467)), this.updateMediaElementEventHandlers(t(467)), this[t(446)] = void 0;
    });
    const e = P;
    this.core = new Pe(t == null ? void 0 : t[e(424)]), this[e(438)] = new vh(this.core);
  }
  static [(Mo = P(438), Oo = P(402), P(425))](t) {
    var s, r;
    return e = t, r = class extends e {
      constructor(...o) {
        var m;
        const a = ks, h = o[0], { p2p: d, ...u } = h ?? {}, l = new ea(d);
        super({ ...u, ...l[a(206)]() });
        it(this, s);
        l[a(201)](this), ot(this, s, l), (m = d == null ? void 0 : d[a(204)]) == null || m.call(d, this);
      }
      get p2pEngine() {
        return M(this, s);
      }
    }, s = new WeakMap(), r;
    var e;
  }
  [P(426)](t, e) {
    this[P(424)].addEventListener(t, e);
  }
  removeEventListener(t, e) {
    const s = P;
    this.core[s(416)](t, e);
  }
  [P(419)]() {
    const t = P;
    return { fLoader: this.createFragmentLoaderClass(), pLoader: this[t(409)]() };
  }
  [P(444)]() {
    const t = P;
    return { core: this[t(424)][t(444)]() };
  }
  applyDynamicConfig(t) {
    const e = P;
    t.core && this[e(424)][e(434)](t.core);
  }
  bindHls(t) {
    const e = P;
    this[e(468)] = typeof t === e(453) ? t : () => t;
  }
  [P(422)]() {
    var s;
    const t = P, e = (s = this[t(468)]) == null ? void 0 : s.call(this);
    this.currentHlsInstance !== e && (this[t(446)] && this[t(459)](), this[t(446)] = e, this[t(462)]("register"), this.updateMediaElementEventHandlers(t(433)));
  }
  [P(462)](t) {
    const e = P, s = this[e(446)];
    if (!s) return;
    const r = t === e(433) ? "on" : e(417);
    s[r]("hlsManifestLoaded", this[e(430)]), s[r]("hlsLevelSwitching", this[e(460)]), s[r]("hlsLevelUpdated", this.handleLevelUpdated), s[r](e(400), this[e(431)]), s[r](e(440), this.destroy), s[r]("hlsMediaAttaching", this[e(413)]), s[r](e(466), this[e(413)]), s[r](e(451), this[e(447)]), s[r]("hlsMediaAttached", this[e(456)]);
  }
  [(Lo = P(460), Po = P(431), P(405))](t) {
    const e = P, s = t[e(408)][e(448)], r = Math[e(407)](120 / s), i = Math[e(432)](t[e(408)][e(443)].length - 1, r);
    this[e(446)] && this[e(446)].config[e(421)] !== i && (this[e(402)]("Setting liveSyncDurationCount to " + i), this[e(446)][e(439)][e(421)] = i);
  }
  [(Ro = P(456), Ao = P(447), Eo = P(420), To = P(413), xo = P(459), P(445))]() {
    const { core: t } = this, e = this;
    return class extends wh {
      constructor(s) {
        super(s, t);
      }
      static getEngine() {
        return e;
      }
    };
  }
  [P(409)]() {
    const t = this;
    return class extends Ih {
      constructor(e) {
        const s = ze;
        super(e), t[s(422)]();
      }
    };
  }
}
function na(n, t) {
  var e = Es();
  return (na = function(s, r) {
    return e[s -= 271];
  })(n, t);
}
function Es() {
  var n = ["1270DtbMQt", "2555384gEfVDz", "498vvydhG", "222633jchbUc", "7grMzye", "403HxEoUu", "592735jFKqaC", "100YoKlkH", "162198MBEope", "16TRJzOm", "34215XfhQvO", "3967800RkiUVh"];
  return (Es = function() {
    return n;
  })();
}
(function() {
  for (var n = na, t = Es(); ; ) try {
    if (-parseInt(n(282)) / 1 * (-parseInt(n(277)) / 2) + -parseInt(n(273)) / 3 * (parseInt(n(274)) / 4) + -parseInt(n(275)) / 5 * (-parseInt(n(279)) / 6) + -parseInt(n(281)) / 7 * (-parseInt(n(278)) / 8) + parseInt(n(280)) / 9 * (-parseInt(n(272)) / 10) + -parseInt(n(271)) / 11 + -parseInt(n(276)) / 12 === 295128) break;
    t.push(t.shift());
  } catch {
    t.push(t.shift());
  }
})();
export {
  ea as HlsJsP2PEngine,
  kh as core
};