@byteplus/vepusher 2.0.1 → 2.0.4-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,7 +1,7 @@
1
- var Zs = Object.defineProperty;
2
- var Qs = (r, e, t) => e in r ? Zs(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var m = (r, e, t) => Qs(r, typeof e != "symbol" ? e + "" : e, t);
4
- function en(r, e) {
1
+ var Qs = Object.defineProperty;
2
+ var en = (r, e, t) => e in r ? Qs(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var m = (r, e, t) => en(r, typeof e != "symbol" ? e + "" : e, t);
4
+ function tn(r, e) {
5
5
  for (var t = 0; t < e.length; t++) {
6
6
  const i = e[t];
7
7
  if (typeof i != "string" && !Array.isArray(i)) {
@@ -20,62 +20,62 @@ function en(r, e) {
20
20
  function Ge(r) {
21
21
  return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
22
22
  }
23
- var st = { exports: {} }, br;
24
- function tn() {
23
+ var nt = { exports: {} }, br;
24
+ function rn() {
25
25
  return br || (br = 1, function(r) {
26
26
  var e = Object.prototype.hasOwnProperty, t = "~";
27
27
  function i() {
28
28
  }
29
29
  Object.create && (i.prototype = /* @__PURE__ */ Object.create(null), new i().__proto__ || (t = !1));
30
- function s(u, c, d) {
31
- this.fn = u, this.context = c, this.once = d || !1;
30
+ function s(u, d, c) {
31
+ this.fn = u, this.context = d, this.once = c || !1;
32
32
  }
33
- function n(u, c, d, h, p) {
34
- if (typeof d != "function")
33
+ function n(u, d, c, h, p) {
34
+ if (typeof c != "function")
35
35
  throw new TypeError("The listener must be a function");
36
- var l = new s(d, h || u, p), f = t ? t + c : c;
36
+ var l = new s(c, h || u, p), f = t ? t + d : d;
37
37
  return u._events[f] ? u._events[f].fn ? u._events[f] = [u._events[f], l] : u._events[f].push(l) : (u._events[f] = l, u._eventsCount++), u;
38
38
  }
39
- function a(u, c) {
40
- --u._eventsCount === 0 ? u._events = new i() : delete u._events[c];
39
+ function a(u, d) {
40
+ --u._eventsCount === 0 ? u._events = new i() : delete u._events[d];
41
41
  }
42
42
  function o() {
43
43
  this._events = new i(), this._eventsCount = 0;
44
44
  }
45
45
  o.prototype.eventNames = function() {
46
- var c = [], d, h;
47
- if (this._eventsCount === 0) return c;
48
- for (h in d = this._events)
49
- e.call(d, h) && c.push(t ? h.slice(1) : h);
50
- return Object.getOwnPropertySymbols ? c.concat(Object.getOwnPropertySymbols(d)) : c;
51
- }, o.prototype.listeners = function(c) {
52
- var d = t ? t + c : c, h = this._events[d];
46
+ var d = [], c, h;
47
+ if (this._eventsCount === 0) return d;
48
+ for (h in c = this._events)
49
+ e.call(c, h) && d.push(t ? h.slice(1) : h);
50
+ return Object.getOwnPropertySymbols ? d.concat(Object.getOwnPropertySymbols(c)) : d;
51
+ }, o.prototype.listeners = function(d) {
52
+ var c = t ? t + d : d, h = this._events[c];
53
53
  if (!h) return [];
54
54
  if (h.fn) return [h.fn];
55
55
  for (var p = 0, l = h.length, f = new Array(l); p < l; p++)
56
56
  f[p] = h[p].fn;
57
57
  return f;
58
- }, o.prototype.listenerCount = function(c) {
59
- var d = t ? t + c : c, h = this._events[d];
58
+ }, o.prototype.listenerCount = function(d) {
59
+ var c = t ? t + d : d, h = this._events[c];
60
60
  return h ? h.fn ? 1 : h.length : 0;
61
- }, o.prototype.emit = function(c, d, h, p, l, f) {
62
- var g = t ? t + c : c;
61
+ }, o.prototype.emit = function(d, c, h, p, l, f) {
62
+ var g = t ? t + d : d;
63
63
  if (!this._events[g]) return !1;
64
64
  var _ = this._events[g], T = arguments.length, b, v;
65
65
  if (_.fn) {
66
- switch (_.once && this.removeListener(c, _.fn, void 0, !0), T) {
66
+ switch (_.once && this.removeListener(d, _.fn, void 0, !0), T) {
67
67
  case 1:
68
68
  return _.fn.call(_.context), !0;
69
69
  case 2:
70
- return _.fn.call(_.context, d), !0;
70
+ return _.fn.call(_.context, c), !0;
71
71
  case 3:
72
- return _.fn.call(_.context, d, h), !0;
72
+ return _.fn.call(_.context, c, h), !0;
73
73
  case 4:
74
- return _.fn.call(_.context, d, h, p), !0;
74
+ return _.fn.call(_.context, c, h, p), !0;
75
75
  case 5:
76
- return _.fn.call(_.context, d, h, p, l), !0;
76
+ return _.fn.call(_.context, c, h, p, l), !0;
77
77
  case 6:
78
- return _.fn.call(_.context, d, h, p, l, f), !0;
78
+ return _.fn.call(_.context, c, h, p, l, f), !0;
79
79
  }
80
80
  for (v = 1, b = new Array(T - 1); v < T; v++)
81
81
  b[v - 1] = arguments[v];
@@ -83,18 +83,18 @@ function tn() {
83
83
  } else {
84
84
  var U = _.length, R;
85
85
  for (v = 0; v < U; v++)
86
- switch (_[v].once && this.removeListener(c, _[v].fn, void 0, !0), T) {
86
+ switch (_[v].once && this.removeListener(d, _[v].fn, void 0, !0), T) {
87
87
  case 1:
88
88
  _[v].fn.call(_[v].context);
89
89
  break;
90
90
  case 2:
91
- _[v].fn.call(_[v].context, d);
91
+ _[v].fn.call(_[v].context, c);
92
92
  break;
93
93
  case 3:
94
- _[v].fn.call(_[v].context, d, h);
94
+ _[v].fn.call(_[v].context, c, h);
95
95
  break;
96
96
  case 4:
97
- _[v].fn.call(_[v].context, d, h, p);
97
+ _[v].fn.call(_[v].context, c, h, p);
98
98
  break;
99
99
  default:
100
100
  if (!b) for (R = 1, b = new Array(T - 1); R < T; R++)
@@ -103,63 +103,63 @@ function tn() {
103
103
  }
104
104
  }
105
105
  return !0;
106
- }, o.prototype.on = function(c, d, h) {
107
- return n(this, c, d, h, !1);
108
- }, o.prototype.once = function(c, d, h) {
109
- return n(this, c, d, h, !0);
110
- }, o.prototype.removeListener = function(c, d, h, p) {
111
- var l = t ? t + c : c;
106
+ }, o.prototype.on = function(d, c, h) {
107
+ return n(this, d, c, h, !1);
108
+ }, o.prototype.once = function(d, c, h) {
109
+ return n(this, d, c, h, !0);
110
+ }, o.prototype.removeListener = function(d, c, h, p) {
111
+ var l = t ? t + d : d;
112
112
  if (!this._events[l]) return this;
113
- if (!d)
113
+ if (!c)
114
114
  return a(this, l), this;
115
115
  var f = this._events[l];
116
116
  if (f.fn)
117
- f.fn === d && (!p || f.once) && (!h || f.context === h) && a(this, l);
117
+ f.fn === c && (!p || f.once) && (!h || f.context === h) && a(this, l);
118
118
  else {
119
119
  for (var g = 0, _ = [], T = f.length; g < T; g++)
120
- (f[g].fn !== d || p && !f[g].once || h && f[g].context !== h) && _.push(f[g]);
120
+ (f[g].fn !== c || p && !f[g].once || h && f[g].context !== h) && _.push(f[g]);
121
121
  _.length ? this._events[l] = _.length === 1 ? _[0] : _ : a(this, l);
122
122
  }
123
123
  return this;
124
- }, o.prototype.removeAllListeners = function(c) {
125
- var d;
126
- return c ? (d = t ? t + c : c, this._events[d] && a(this, d)) : (this._events = new i(), this._eventsCount = 0), this;
124
+ }, o.prototype.removeAllListeners = function(d) {
125
+ var c;
126
+ return d ? (c = t ? t + d : d, this._events[c] && a(this, c)) : (this._events = new i(), this._eventsCount = 0), this;
127
127
  }, o.prototype.off = o.prototype.removeListener, o.prototype.addListener = o.prototype.on, o.prefixed = t, o.EventEmitter = o, r.exports = o;
128
- }(st)), st.exports;
128
+ }(nt)), nt.exports;
129
129
  }
130
- var rn = tn();
131
- const te = /* @__PURE__ */ Ge(rn);
132
- var S = /* @__PURE__ */ ((r) => (r.Camera = "camera", r.Screen = "screen", r.VideoFile = "videoFile", r.Microphone = "microphone", r.AudioFile = "audioFile", r.Image = "image", r.MixAudio = "mixAudio", r.MixVideo = "mixVideo", r.CustomVideo = "customVideo", r.CustomAudio = "customAudio", r))(S || {}), j = /* @__PURE__ */ ((r) => (r.DeviceCaptured = "deviceCaptured", r.DeviceStopCapture = "deviceStopCapture", r.Error = "error", r.Interrupted = "interrupted", r))(j || {}), w = /* @__PURE__ */ ((r) => (r.PushStart = "pushStart", r.PushStop = "pushStop", r.PushError = "pushError", r.RTCConnectStateChanged = "rtcConnectStateChanged", r.CaptureFirstVideoFrame = "capturefirstvideoframe", r.CaptureFirstAudioFrame = "capturefirstaudioframe", r.NotAllowedAutoPlay = "notallowedautoplay", r))(w || {}), Ri = /* @__PURE__ */ ((r) => (r["120p"] = "160x120x15x200", r["180p"] = "320x180x15x350", r["240p"] = "320x240x15x400", r["360p"] = "640x360x15x800", r["480p"] = "640x480x15x900", r["720p-1"] = "1280x720x15x1500", r["720p-2"] = "1280x720x25x1500", r["720p-3"] = "1280x720x30x1500", r["1080p-1"] = "1920x1080x15x2080", r["1080p-2"] = "1920x1080x25x3000", r["1080p-3"] = "1920x1080x30x3150", r))(Ri || {}), Ai = /* @__PURE__ */ ((r) => (r["120p"] = "120x160x15x200", r["180p"] = "180x320x15x350", r["240p"] = "240x320x15x400", r["360p"] = "360x640x15x800", r["480p"] = "480x640x15x900", r["720p-1"] = "720x1280x15x1500", r["720p-2"] = "720x1280x25x1500", r["720p-3"] = "720x1280x30x1500", r["1080p-1"] = "1080x1920x15x2080", r["1080p-2"] = "1080x1920x25x3000", r["1080p-3"] = "1080x1920x30x3150", r))(Ai || {}), wi = /* @__PURE__ */ ((r) => (r.STANDARD = "48000x40", r.HIGH = "48000x128", r))(wi || {}), ie = /* @__PURE__ */ ((r) => (r.VideoStreamChange = "videoStreamChange", r.AudioStreamChange = "audioStreamChange", r))(ie || {}), Oi = /* @__PURE__ */ ((r) => (r[r.init = -1] = "init", r[r.new = 0] = "new", r[r.connecting = 1] = "connecting", r[r.connected = 2] = "connected", r[r.disconnected = 3] = "disconnected", r[r.failed = 4] = "failed", r[r.closed = 5] = "closed", r))(Oi || {}), Ft = /* @__PURE__ */ ((r) => (r.SizeChange = "sizeChange", r))(Ft || {}), _t = /* @__PURE__ */ ((r) => (r.Portrait = "portrait", r.Landscape = "landscape", r))(_t || {});
133
- const Ii = "720p-1", Mi = "STANDARD";
130
+ var sn = rn();
131
+ const te = /* @__PURE__ */ Ge(sn);
132
+ var S = /* @__PURE__ */ ((r) => (r.Camera = "camera", r.Screen = "screen", r.VideoFile = "videoFile", r.Microphone = "microphone", r.AudioFile = "audioFile", r.Image = "image", r.MixAudio = "mixAudio", r.MixVideo = "mixVideo", r.CustomVideo = "customVideo", r.CustomAudio = "customAudio", r))(S || {}), j = /* @__PURE__ */ ((r) => (r.DeviceCaptured = "deviceCaptured", r.DeviceStopCapture = "deviceStopCapture", r.Error = "error", r.Interrupted = "interrupted", r))(j || {}), w = /* @__PURE__ */ ((r) => (r.PushStart = "pushStart", r.PushStop = "pushStop", r.PushError = "pushError", r.RTCConnectStateChanged = "rtcConnectStateChanged", r.CaptureFirstVideoFrame = "capturefirstvideoframe", r.CaptureFirstAudioFrame = "capturefirstaudioframe", r.NotAllowedAutoPlay = "notallowedautoplay", r))(w || {}), Ri = /* @__PURE__ */ ((r) => (r["120p"] = "160x120x15x200", r["180p"] = "320x180x15x350", r["240p"] = "320x240x15x400", r["360p"] = "640x360x15x800", r["480p"] = "640x480x15x900", r["720p-1"] = "1280x720x15x1500", r["720p-2"] = "1280x720x25x1500", r["720p-3"] = "1280x720x30x1500", r["1080p-1"] = "1920x1080x15x2080", r["1080p-2"] = "1920x1080x25x3000", r["1080p-3"] = "1920x1080x30x3150", r))(Ri || {}), Ai = /* @__PURE__ */ ((r) => (r["120p"] = "120x160x15x200", r["180p"] = "180x320x15x350", r["240p"] = "240x320x15x400", r["360p"] = "360x640x15x800", r["480p"] = "480x640x15x900", r["720p-1"] = "720x1280x15x1500", r["720p-2"] = "720x1280x25x1500", r["720p-3"] = "720x1280x30x1500", r["1080p-1"] = "1080x1920x15x2080", r["1080p-2"] = "1080x1920x25x3000", r["1080p-3"] = "1080x1920x30x3150", r))(Ai || {}), wi = /* @__PURE__ */ ((r) => (r.STANDARD = "48000x40", r.HIGH = "48000x128", r))(wi || {}), ie = /* @__PURE__ */ ((r) => (r.VideoStreamChange = "videoStreamChange", r.AudioStreamChange = "audioStreamChange", r))(ie || {}), Oi = /* @__PURE__ */ ((r) => (r[r.init = -1] = "init", r[r.new = 0] = "new", r[r.connecting = 1] = "connecting", r[r.connected = 2] = "connected", r[r.disconnected = 3] = "disconnected", r[r.failed = 4] = "failed", r[r.closed = 5] = "closed", r))(Oi || {}), Nt = /* @__PURE__ */ ((r) => (r.SizeChange = "sizeChange", r))(Nt || {}), gt = /* @__PURE__ */ ((r) => (r.Portrait = "portrait", r.Landscape = "landscape", r))(gt || {});
133
+ const Ii = "720p-1", Di = "STANDARD";
134
134
  var y = /* @__PURE__ */ ((r) => (r.TRACK_NOT_AVAILABLE = "track-not-available", r.UNEXPECTED_TYPE = "unexpected-type", r.PLAY_FAILED = "play-failed", r.CAPTURE_FAILED = "capture-failed", r.NOT_SUPPORTED = "not-supported", r.UNEXPECTED_ERROR = "unexpected-error", r))(y || {}), E = /* @__PURE__ */ ((r) => (r.AUDIO = "audio", r.VIDEO = "video", r))(E || {}), I = /* @__PURE__ */ ((r) => (r.ENDED = "ended", r.MUTE = "mute", r.UNMUTE = "unmute", r.PLAY_FAILED = "play-failed", r.SIZE_CHANGE = "size-change", r))(I || {});
135
135
  const O = [];
136
136
  for (let r = 0; r < 256; ++r)
137
137
  O.push((r + 256).toString(16).slice(1));
138
- function sn(r, e = 0) {
138
+ function nn(r, e = 0) {
139
139
  return (O[r[e + 0]] + O[r[e + 1]] + O[r[e + 2]] + O[r[e + 3]] + "-" + O[r[e + 4]] + O[r[e + 5]] + "-" + O[r[e + 6]] + O[r[e + 7]] + "-" + O[r[e + 8]] + O[r[e + 9]] + "-" + O[r[e + 10]] + O[r[e + 11]] + O[r[e + 12]] + O[r[e + 13]] + O[r[e + 14]] + O[r[e + 15]]).toLowerCase();
140
140
  }
141
- let nt;
142
- const nn = new Uint8Array(16);
143
- function on() {
144
- if (!nt) {
141
+ let ot;
142
+ const on = new Uint8Array(16);
143
+ function an() {
144
+ if (!ot) {
145
145
  if (typeof crypto > "u" || !crypto.getRandomValues)
146
146
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
147
- nt = crypto.getRandomValues.bind(crypto);
147
+ ot = crypto.getRandomValues.bind(crypto);
148
148
  }
149
- return nt(nn);
149
+ return ot(on);
150
150
  }
151
- const an = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), kr = { randomUUID: an };
151
+ const cn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), kr = { randomUUID: cn };
152
152
  function oe(r, e, t) {
153
153
  var s;
154
154
  if (kr.randomUUID && !r)
155
155
  return kr.randomUUID();
156
156
  r = r || {};
157
- const i = r.random ?? ((s = r.rng) == null ? void 0 : s.call(r)) ?? on();
157
+ const i = r.random ?? ((s = r.rng) == null ? void 0 : s.call(r)) ?? an();
158
158
  if (i.length < 16)
159
159
  throw new Error("Random bytes length must be >= 16");
160
- return i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, sn(i);
160
+ return i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, nn(i);
161
161
  }
162
- class Di {
162
+ class Mi {
163
163
  constructor() {
164
164
  m(this, "id", oe());
165
165
  m(this, "_nextNode");
@@ -190,7 +190,7 @@ class Di {
190
190
  (e = this._node) == null || e.disconnect(), delete this._node;
191
191
  }
192
192
  }
193
- class Pr extends Di {
193
+ class Pr extends Mi {
194
194
  constructor(t, i) {
195
195
  super();
196
196
  m(this, "previousNode");
@@ -207,7 +207,7 @@ class Pr extends Di {
207
207
  this._g = t, this._node && (this._node.gain.value = t);
208
208
  }
209
209
  }
210
- class cn extends Di {
210
+ class dn extends Mi {
211
211
  constructor(t) {
212
212
  super();
213
213
  m(this, "previousNode", null);
@@ -221,7 +221,7 @@ class cn extends Di {
221
221
  super.destroy();
222
222
  }
223
223
  }
224
- class dn extends cn {
224
+ class un extends dn {
225
225
  constructor() {
226
226
  super(...arguments);
227
227
  m(this, "_node");
@@ -230,7 +230,7 @@ class dn extends cn {
230
230
  if (this._node)
231
231
  return this._node;
232
232
  let i;
233
- if (this.source instanceof $i) {
233
+ if (this.source instanceof Bi) {
234
234
  const s = this.source.element();
235
235
  i = new MediaElementAudioSourceNode(t, {
236
236
  mediaElement: s
@@ -262,8 +262,8 @@ const xr = {
262
262
  warn: { color: "rgba(255, 119, 0, 0.3)", text: "WARN" },
263
263
  err: { color: "rgba(255, 0, 0, 0.3)", text: "ERR " },
264
264
  succ: { color: "rgba(0, 119, 0, 0.3)", text: "SUCC" }
265
- }, Rr = "__debug__", un = "[VE-CAPTURE]";
266
- function hn() {
265
+ }, Rr = "__debug__", hn = "[VE-CAPTURE]";
266
+ function pn() {
267
267
  if (typeof location > "u" || typeof localStorage > "u")
268
268
  return !1;
269
269
  let r = !1;
@@ -275,9 +275,9 @@ let L = class {
275
275
  this.moduleName = e;
276
276
  }
277
277
  print(e, t, ...i) {
278
- const s = pn();
279
- hn() && console.log(
280
- `${s}-${un}%c[${xr[e].text}]%c[${this.moduleName}][${t}]`,
278
+ const s = ln();
279
+ pn() && console.log(
280
+ `${s}-${hn}%c[${xr[e].text}]%c[${this.moduleName}][${t}]`,
281
281
  `background-color:${xr[e].color};`,
282
282
  "background-color:rgba(0, 0, 0, 0)",
283
283
  ...i
@@ -310,11 +310,11 @@ let L = class {
310
310
  };
311
311
  }
312
312
  };
313
- function pn() {
313
+ function ln() {
314
314
  const r = /* @__PURE__ */ new Date();
315
315
  return `${r.toTimeString().split(" ")[0]}:${r.getMilliseconds().toString().padStart(3, "0")}`;
316
316
  }
317
- function gt(r, e) {
317
+ function vt(r, e) {
318
318
  const t = document.createElement(r);
319
319
  return e.id && (t.id = e.id), e.classList && e.classList.forEach((i) => {
320
320
  t.classList.add(i);
@@ -331,7 +331,7 @@ function Li({ width: r, height: e }) {
331
331
  );
332
332
  return t.width = r, t.height = e, t.style.width = "100%", t.style.height = "100%", { context: i, canvas: t };
333
333
  }
334
- class Nt {
334
+ class Vt {
335
335
  constructor(e) {
336
336
  m(this, "target");
337
337
  m(this, "_eventDict", /* @__PURE__ */ new Map());
@@ -366,12 +366,12 @@ const x = () => typeof window > "u";
366
366
  function P() {
367
367
  return navigator.userAgent.toLowerCase();
368
368
  }
369
- function Vt(r = P()) {
369
+ function Ut(r = P()) {
370
370
  let e = "none";
371
371
  return x() || (r.match("firefox") !== null ? e = "firefox" : r.match("Chrome") !== null ? (e = "chrome", r.match("Electron") !== null && (e = "electron")) : (r.match("Safari") !== null || r.match("AppleWebKit") !== null) && (e = "safari")), e;
372
372
  }
373
- const ln = Vt() === "firefox", Ut = Vt() === "safari";
374
- Vt();
373
+ const Fi = Ut() === "firefox", He = Ut() === "safari";
374
+ Ut();
375
375
  !x() && /crios/i.test(P());
376
376
  !x() && /edg\//i.test(P());
377
377
  !x() && /edgA/i.test(P());
@@ -384,67 +384,67 @@ Vt();
384
384
  !x() && /micromessenger/i.test(P());
385
385
  !x() && P().includes("mobile");
386
386
  !x() && /sm-\w+/i.test(P());
387
- !x() && /(iphone|ipad|ipod)/i.exec(P());
387
+ const mn = !x() && !!/(iphone|ipad|ipod)/i.exec(P());
388
388
  !x() && /android/i.test(P());
389
389
  !x() && /windows/i.test(P());
390
390
  !x() && /openharmony/i.test(P());
391
- let Fi = "0";
391
+ let Ni = "0";
392
392
  var Ti;
393
- const mn = !x() && ((Ti = P().match(/version\/(\d+)/i)) == null ? void 0 : Ti[1]);
393
+ const fn = !x() && ((Ti = P().match(/version\/(\d+)/i)) == null ? void 0 : Ti[1]);
394
394
  var Ei;
395
- Ut && mn && (Fi = (Ei = navigator.userAgent.match(/version\/(\d+\.\d+)/i)) == null ? void 0 : Ei[1]);
395
+ He && fn && (Ni = (Ei = navigator.userAgent.match(/version\/(\d+\.\d+)/i)) == null ? void 0 : Ei[1]);
396
396
  var bi;
397
397
  !x() && ((bi = P().match(/firefox\/(\d+)/i)) == null || bi[1]);
398
- const vt = Fi;
398
+ const Ct = Ni;
399
399
  var ki, Pi;
400
400
  !x() && ((Pi = (ki = P().match(/ ([\d_]+) like mac os x/i)) == null ? void 0 : ki[1]) == null || Pi.split("_").map((r) => parseInt(r)));
401
401
  var xi;
402
402
  !x() && ((xi = P().match(/chrome\/(\d+)/i)) == null || xi[1]);
403
- function fn() {
403
+ function _n() {
404
404
  var r;
405
405
  return !!((r = navigator == null ? void 0 : navigator.permissions) != null && r.query);
406
406
  }
407
407
  function $t() {
408
408
  return !!(navigator != null && navigator.mediaDevices);
409
409
  }
410
- function _n() {
410
+ function gn() {
411
411
  var r;
412
412
  return $t() && !!((r = navigator == null ? void 0 : navigator.mediaDevices) != null && r.getUserMedia);
413
413
  }
414
- function gn() {
415
- return !!Promise.withResolvers;
416
- }
417
414
  function vn() {
418
- return !(Ut && vt === "16.1");
415
+ return !!Promise.withResolvers;
419
416
  }
420
417
  function Cn() {
421
- return !(Ut && vt && ["16.1", "16.2", "16.3"].includes(vt));
418
+ return !(He && Ct === "16.1");
422
419
  }
423
420
  function yn() {
424
- return !ln;
421
+ return !(He && Ct && ["16.1", "16.2", "16.3"].includes(Ct));
425
422
  }
426
423
  function Sn() {
424
+ return !Fi;
425
+ }
426
+ function Tn() {
427
427
  return typeof CanvasCaptureMediaStreamTrack < "u";
428
428
  }
429
- function Tn(r) {
429
+ function En(r) {
430
430
  return typeof r.requestFrame == "function";
431
431
  }
432
- function En() {
432
+ function bn() {
433
433
  return !!$t() && typeof navigator.mediaDevices.ondevicechange < "u" && typeof navigator.mediaDevices.addEventListener == "function";
434
434
  }
435
435
  const G = {
436
- permissionQuery: fn,
436
+ permissionQuery: _n,
437
437
  mediaDevices: $t,
438
- settingResolutionInGetDisplayMedia: vn,
439
- promiseWithResolvers: gn,
440
- getUserMedia: _n,
441
- isolateEnumerateDevices: yn,
442
- supportIdealParamsInGetDisplayMedia: Cn,
443
- canvasCaptureMediaStreamTrack: Sn,
444
- requestFrameOnMediaStream: Tn,
445
- ondevicechange: En
438
+ settingResolutionInGetDisplayMedia: Cn,
439
+ promiseWithResolvers: vn,
440
+ getUserMedia: gn,
441
+ isolateEnumerateDevices: Sn,
442
+ supportIdealParamsInGetDisplayMedia: yn,
443
+ canvasCaptureMediaStreamTrack: Tn,
444
+ requestFrameOnMediaStream: En,
445
+ ondevicechange: bn
446
446
  };
447
- function bn() {
447
+ function kn() {
448
448
  if (G.promiseWithResolvers())
449
449
  return Promise.withResolvers();
450
450
  let r, e;
@@ -455,12 +455,12 @@ function bn() {
455
455
  throw Error("resolver and rejector working unexpected");
456
456
  return { promise: t, resolve: r, reject: e };
457
457
  }
458
- function Ni(r = {}) {
458
+ function Vi(r = {}) {
459
459
  const { timeout: e, message: t } = {
460
460
  timeout: 0,
461
461
  message: new C(y.UNEXPECTED_ERROR, "unexpected timeout"),
462
462
  ...r
463
- }, { promise: i, resolve: s, reject: n } = bn();
463
+ }, { promise: i, resolve: s, reject: n } = kn();
464
464
  if (e <= 0)
465
465
  return { promise: i, resolve: s, reject: n };
466
466
  const a = setTimeout(() => {
@@ -474,7 +474,7 @@ function Ni(r = {}) {
474
474
  reject: n
475
475
  };
476
476
  }
477
- const kn = {
477
+ const Pn = {
478
478
  playsinline: "",
479
479
  "webkit-playsinline": "",
480
480
  "x5-playsinline": "",
@@ -483,7 +483,7 @@ const kn = {
483
483
  preload: "metadata",
484
484
  muted: "",
485
485
  crossOrigin: "anonymous"
486
- }, Pn = {
486
+ }, xn = {
487
487
  playsinline: "",
488
488
  "webkit-playsinline": "",
489
489
  preload: "metadata",
@@ -503,19 +503,19 @@ class be {
503
503
  let i;
504
504
  if (e instanceof MediaStreamTrack) {
505
505
  const o = new MediaStream([e]);
506
- i = xn(o), this._stream = o;
506
+ i = Rn(o), this._stream = o;
507
507
  } else if (e.url)
508
- i = Rn(e);
508
+ i = An(e);
509
509
  else
510
510
  throw new C(
511
511
  y.UNEXPECTED_TYPE,
512
512
  `got ${typeof e}, expected: MediaStreamTrack or constraints for creating element`
513
513
  );
514
- const { promise: s, resolve: n, reject: a } = Ni({
514
+ const { promise: s, resolve: n, reject: a } = Vi({
515
515
  timeout: 2e3,
516
516
  message: new C(y.PLAY_FAILED, "load media timeout")
517
517
  });
518
- this._readyLock = s, this._releaseReadyLock = n, this._throwReadyLock = a, this._element = new Nt(i), this._bindPlayerEvent(this._element), this._referenceTracks = [...t];
518
+ this._readyLock = s, this._releaseReadyLock = n, this._throwReadyLock = a, this._element = new Vt(i), this._bindPlayerEvent(this._element), this._referenceTracks = [...t];
519
519
  }
520
520
  addReferenceTrack(e) {
521
521
  this._referenceTracks.push(e);
@@ -609,33 +609,33 @@ class be {
609
609
  });
610
610
  }
611
611
  }
612
- function xn(r) {
612
+ function Rn(r) {
613
613
  let e = "audio";
614
614
  r.getVideoTracks().length > 0 && (e = "video");
615
- const t = Vi(
615
+ const t = Ui(
616
616
  e === "video" ? E.VIDEO : E.AUDIO
617
617
  );
618
618
  return t.srcObject = r, t;
619
619
  }
620
- function Rn(r) {
621
- const { url: e, kind: t, loop: i } = r, s = Vi(t);
620
+ function An(r) {
621
+ const { url: e, kind: t, loop: i } = r, s = Ui(t);
622
622
  return s.src = e, s.loop = i, s;
623
623
  }
624
- function Vi(r) {
624
+ function Ui(r) {
625
625
  if (r === E.VIDEO)
626
- return gt(E.VIDEO, {
626
+ return vt(E.VIDEO, {
627
627
  style: {
628
628
  width: "100%",
629
629
  height: "100%"
630
630
  },
631
- attributes: kn
631
+ attributes: Pn
632
632
  });
633
633
  if (r === E.AUDIO)
634
- return gt(E.AUDIO, {
634
+ return vt(E.AUDIO, {
635
635
  style: {
636
636
  display: "none"
637
637
  },
638
- attributes: Pn
638
+ attributes: xn
639
639
  });
640
640
  throw new C(
641
641
  y.UNEXPECTED_TYPE,
@@ -676,7 +676,7 @@ class Bt extends te {
676
676
  return super.once(e, s, i);
677
677
  }
678
678
  }
679
- function ot(r) {
679
+ function at(r) {
680
680
  if (typeof r == "number")
681
681
  return r;
682
682
  if (typeof (r == null ? void 0 : r.exact) == "number")
@@ -689,8 +689,8 @@ function ot(r) {
689
689
  return r.min;
690
690
  throw new C(y.UNEXPECTED_TYPE, "unexpected constraints type");
691
691
  }
692
- const Ct = 1e3;
693
- class Ui {
692
+ const yt = 1e3;
693
+ class $i {
694
694
  constructor(e) {
695
695
  m(this, "id", oe());
696
696
  m(this, "_context");
@@ -703,17 +703,17 @@ class Ui {
703
703
  m(this, "_loopTimer");
704
704
  m(this, "_referenceTracks", []);
705
705
  m(this, "_stream");
706
- const t = ot(e.width), i = ot(e.height), s = ot(e.frameRate);
706
+ const t = at(e.width), i = at(e.height), s = at(e.frameRate);
707
707
  this._config = { width: t, height: i, frameRate: s };
708
708
  const { context: n, canvas: a } = Li({ width: t, height: i });
709
709
  this._context = n, this._canvas = a;
710
- const o = An({ url: e.url, width: t, height: i });
711
- this._image = new Nt(o);
712
- const { promise: u, resolve: c, reject: d } = Ni({
710
+ const o = wn({ url: e.url, width: t, height: i });
711
+ this._image = new Vt(o);
712
+ const { promise: u, resolve: d, reject: c } = Vi({
713
713
  timeout: 2e3,
714
714
  message: new C(y.PLAY_FAILED, "load image timeout")
715
715
  });
716
- this._readyLock = u, this._releaseReadyLock = c, this._throwReadyLock = d, this._bindImageEvent(this._image);
716
+ this._readyLock = u, this._releaseReadyLock = d, this._throwReadyLock = c, this._bindImageEvent(this._image);
717
717
  }
718
718
  track() {
719
719
  this._paint();
@@ -750,7 +750,7 @@ class Ui {
750
750
  const { width: e, height: t, frameRate: i } = this._config;
751
751
  this._context.drawImage(this._image.target, 0, 0, e, t), this._loopTimer && clearTimeout(this._loopTimer), this._loopTimer = setTimeout(
752
752
  this._paint.bind(this),
753
- Ct / i
753
+ yt / i
754
754
  );
755
755
  }
756
756
  addReferenceTrack(e) {
@@ -762,12 +762,12 @@ class Ui {
762
762
  }
763
763
  // destroy() {}
764
764
  }
765
- function An({
765
+ function wn({
766
766
  url: r,
767
767
  height: e,
768
768
  width: t
769
769
  }) {
770
- const i = gt("img", {
770
+ const i = vt("img", {
771
771
  style: {
772
772
  width: `${t}px`,
773
773
  height: `${e}px`
@@ -784,7 +784,7 @@ class jt extends Bt {
784
784
  m(this, "id", oe());
785
785
  m(this, "_track");
786
786
  m(this, "_element");
787
- t instanceof MediaStreamTrack ? (this._track = new Nt(t), this._bindTrackEvent(this._track)) : t instanceof be ? (this._element = t, t.addReferenceTrack(this)) : t instanceof Ui && (this._element = t);
787
+ t instanceof MediaStreamTrack ? (this._track = new Vt(t), this._bindTrackEvent(this._track)) : t instanceof be ? (this._element = t, t.addReferenceTrack(this)) : t instanceof $i && (this._element = t);
788
788
  }
789
789
  _bindTrackEvent(t) {
790
790
  t.on("ended", this._handleTrackEnded.bind(this)), t.on("mute", () => {
@@ -841,7 +841,7 @@ class jt extends Bt {
841
841
  (t = this._track) == null || t.clearAll(), (i = this._track) == null || i.target.stop(), this._track && delete this._track, (s = this._element) == null || s.removeReference(this), delete this._element;
842
842
  }
843
843
  }
844
- class He extends jt {
844
+ class qe extends jt {
845
845
  constructor() {
846
846
  super(...arguments);
847
847
  m(this, "kind", E.AUDIO);
@@ -855,7 +855,7 @@ class He extends jt {
855
855
  );
856
856
  if (this._node)
857
857
  return this._node;
858
- const t = new dn(this);
858
+ const t = new un(this);
859
859
  return this._node = t, t;
860
860
  }
861
861
  /** overwrite in AudioTrack */
@@ -890,19 +890,19 @@ class He extends jt {
890
890
  this.logger.warn("destroy", this.id), (t = this._node) == null || t.destroy(), super.destroy();
891
891
  }
892
892
  }
893
- class wn extends He {
893
+ class On extends qe {
894
894
  constructor() {
895
895
  super(...arguments);
896
896
  m(this, "logger", new L("MicrophoneAudioTrack"));
897
897
  }
898
898
  }
899
- class On extends He {
899
+ class In extends qe {
900
900
  constructor() {
901
901
  super(...arguments);
902
902
  m(this, "logger", new L("ScreenAudioTrack"));
903
903
  }
904
904
  }
905
- class $i extends He {
905
+ class Bi extends qe {
906
906
  constructor() {
907
907
  super(...arguments);
908
908
  m(this, "logger", new L("MediaAudioTrack"));
@@ -921,35 +921,35 @@ class $i extends He {
921
921
  }
922
922
  }
923
923
  }
924
- class In extends He {
924
+ class Dn extends qe {
925
925
  constructor() {
926
926
  super(...arguments);
927
927
  m(this, "logger", new L("CustomAudioTrack"));
928
928
  }
929
929
  }
930
930
  let Mn = 1;
931
- const at = new L("PromiseQueue");
932
- class Dn {
931
+ const ct = new L("PromiseQueue");
932
+ class Ln {
933
933
  constructor(e) {
934
934
  m(this, "lockingPromise", Promise.resolve());
935
935
  m(this, "locks", 0);
936
936
  m(this, "name", "");
937
937
  m(this, "lockId");
938
938
  m(this, "closeReason");
939
- this.lockId = Mn++, e && (this.name = e), at.info(`lock-${this.name}-${this.lockId}`, "is created.");
939
+ this.lockId = Mn++, e && (this.name = e), ct.info(`lock-${this.name}-${this.lockId}`, "is created.");
940
940
  }
941
941
  get isLocked() {
942
942
  return this.locks > 0;
943
943
  }
944
944
  lock() {
945
- this.locks += 1, at.info(
945
+ this.locks += 1, ct.info(
946
946
  `lock-${this.name}-${this.lockId}`,
947
947
  `locked, current queue ${this.locks}.`
948
948
  );
949
949
  let e;
950
950
  const t = new Promise((s) => {
951
951
  e = () => {
952
- this.locks -= 1, at.info(
952
+ this.locks -= 1, ct.info(
953
953
  `lock-${this.name}-${this.lockId}`,
954
954
  `unlocked, current queue ${this.locks}.`
955
955
  ), s();
@@ -958,8 +958,8 @@ class Dn {
958
958
  return this.lockingPromise = this.lockingPromise.then(() => t), i;
959
959
  }
960
960
  }
961
- const Ln = 300, Fn = 3e3, B = new L("Devices");
962
- class Nn extends Bt {
961
+ const Fn = 300, Nn = 3e3, B = new L("Devices");
962
+ class Vn extends Bt {
963
963
  constructor() {
964
964
  super();
965
965
  /** 存储 SDK 已知的设备列表 */
@@ -973,7 +973,7 @@ class Nn extends Bt {
973
973
  [E.AUDIO]: !1,
974
974
  [E.VIDEO]: !1
975
975
  });
976
- m(this, "_changedQueue", new Dn("device changed queue"));
976
+ m(this, "_changedQueue", new Ln("device changed queue"));
977
977
  this._init();
978
978
  }
979
979
  async _init() {
@@ -988,13 +988,13 @@ class Nn extends Bt {
988
988
  "no supported, use timer instead"
989
989
  ), setInterval(() => {
990
990
  this._handleDeviceChanged();
991
- }, Fn);
991
+ }, Nn);
992
992
  return;
993
993
  }
994
994
  G.ondevicechange() && navigator.mediaDevices.addEventListener("devicechange", () => {
995
995
  B.info("devicechange"), setTimeout(() => {
996
996
  this._handleDeviceChanged();
997
- }, Ln);
997
+ }, Fn);
998
998
  });
999
999
  }
1000
1000
  async _initPermissionChanged() {
@@ -1176,23 +1176,23 @@ function Ir(r) {
1176
1176
  const e = [];
1177
1177
  return r.audio && e.push(E.AUDIO), r.video && e.push(E.VIDEO), e;
1178
1178
  }
1179
- const yt = new Nn();
1179
+ const St = new Vn();
1180
1180
  class zt {
1181
1181
  constructor() {
1182
1182
  m(this, "id", oe());
1183
1183
  }
1184
1184
  position(e, t) {
1185
- return new Vn(this, { x: e, y: t });
1185
+ return new Un(this, { x: e, y: t });
1186
1186
  }
1187
1187
  scale(e) {
1188
- return new Un(this, { s: e });
1188
+ return new $n(this, { s: e });
1189
1189
  }
1190
1190
  available() {
1191
1191
  var e;
1192
1192
  return ((e = this.previousNode) == null ? void 0 : e.available()) ?? !1;
1193
1193
  }
1194
1194
  }
1195
- class Vn extends zt {
1195
+ class Un extends zt {
1196
1196
  constructor(t, i) {
1197
1197
  super();
1198
1198
  m(this, "previousNode");
@@ -1204,7 +1204,7 @@ class Vn extends zt {
1204
1204
  t.translate(this._x, this._y);
1205
1205
  }
1206
1206
  }
1207
- class Un extends zt {
1207
+ class $n extends zt {
1208
1208
  constructor(t, i) {
1209
1209
  super();
1210
1210
  m(this, "previousNode");
@@ -1215,7 +1215,7 @@ class Un extends zt {
1215
1215
  t.scale(this._s, this._s);
1216
1216
  }
1217
1217
  }
1218
- class $n extends zt {
1218
+ class Bn extends zt {
1219
1219
  constructor(t) {
1220
1220
  super();
1221
1221
  m(this, "previousNode", null);
@@ -1226,7 +1226,7 @@ class $n extends zt {
1226
1226
  return this._source.available();
1227
1227
  }
1228
1228
  }
1229
- class qe extends $n {
1229
+ class We extends Bn {
1230
1230
  constructor(t, i) {
1231
1231
  super(t);
1232
1232
  m(this, "_targetWidth");
@@ -1235,7 +1235,7 @@ class qe extends $n {
1235
1235
  this._targetWidth = s ?? this._source.width(), this._targetHeight = n ?? this._source.height();
1236
1236
  }
1237
1237
  size(t, i) {
1238
- return new qe(this._source, { width: t, height: i });
1238
+ return new We(this._source, { width: t, height: i });
1239
1239
  }
1240
1240
  paint(t) {
1241
1241
  const i = this._targetWidth, s = this._targetHeight;
@@ -1248,7 +1248,7 @@ class qe extends $n {
1248
1248
  );
1249
1249
  }
1250
1250
  }
1251
- class Bn extends jt {
1251
+ class jn extends jt {
1252
1252
  constructor() {
1253
1253
  super(...arguments);
1254
1254
  m(this, "logger", new L("PictureTrack"));
@@ -1277,15 +1277,15 @@ class Bn extends jt {
1277
1277
  y.TRACK_NOT_AVAILABLE,
1278
1278
  "track is not avaiable when creating node"
1279
1279
  );
1280
- const t = new qe(this);
1280
+ const t = new We(this);
1281
1281
  return this.logger.info("node", t), t;
1282
1282
  }
1283
1283
  destroy() {
1284
1284
  this.logger.warn("destroy"), super.destroy();
1285
1285
  }
1286
1286
  }
1287
- const jn = 500;
1288
- class We extends jt {
1287
+ const zn = 500;
1288
+ class Xe extends jt {
1289
1289
  constructor() {
1290
1290
  super(...arguments);
1291
1291
  m(this, "kind", E.VIDEO);
@@ -1299,7 +1299,7 @@ class We extends jt {
1299
1299
  width: s,
1300
1300
  height: n
1301
1301
  });
1302
- }, jn);
1302
+ }, zn);
1303
1303
  });
1304
1304
  }
1305
1305
  element() {
@@ -1317,13 +1317,13 @@ class We extends jt {
1317
1317
  y.TRACK_NOT_AVAILABLE,
1318
1318
  "track is not avaiable when creating node"
1319
1319
  );
1320
- return new qe(this);
1320
+ return new We(this);
1321
1321
  }
1322
1322
  destroy() {
1323
1323
  clearTimeout(this.sizeChangeTimer), super.destroy();
1324
1324
  }
1325
1325
  }
1326
- class zn extends We {
1326
+ class Gn extends Xe {
1327
1327
  constructor(t) {
1328
1328
  super(t);
1329
1329
  m(this, "logger", new L("CameraVideoTrack"));
@@ -1338,7 +1338,7 @@ class zn extends We {
1338
1338
  return t ?? 0;
1339
1339
  }
1340
1340
  }
1341
- class Gn extends We {
1341
+ class Hn extends Xe {
1342
1342
  constructor(t) {
1343
1343
  super(t);
1344
1344
  m(this, "logger", new L("ScreenVideoTrack"));
@@ -1353,7 +1353,7 @@ class Gn extends We {
1353
1353
  return t ?? 0;
1354
1354
  }
1355
1355
  }
1356
- class Hn extends We {
1356
+ class qn extends Xe {
1357
1357
  constructor() {
1358
1358
  super(...arguments);
1359
1359
  m(this, "logger", new L("MediaVideoTrack"));
@@ -1367,7 +1367,7 @@ class Hn extends We {
1367
1367
  return t ?? 0;
1368
1368
  }
1369
1369
  }
1370
- class qn extends We {
1370
+ class Wn extends Xe {
1371
1371
  constructor() {
1372
1372
  super(...arguments);
1373
1373
  m(this, "logger", new L("CustomVideoTrack"));
@@ -1381,7 +1381,7 @@ class qn extends We {
1381
1381
  return t ?? 0;
1382
1382
  }
1383
1383
  }
1384
- function Bi(r, e) {
1384
+ function ji(r, e) {
1385
1385
  let t;
1386
1386
  if (e != null && e.frameRate && typeof e.frameRate == "number" && (t = e.frameRate), t)
1387
1387
  try {
@@ -1396,13 +1396,13 @@ function Bi(r, e) {
1396
1396
  }
1397
1397
  }
1398
1398
  const q = new L("Capture");
1399
- async function Wn(r) {
1400
- return yt.enumerateDevices(r);
1401
- }
1402
1399
  async function Xn(r) {
1403
- yt.removeAllListeners("onDeviceStateChanged"), yt.on("onDeviceStateChanged", r);
1400
+ return St.enumerateDevices(r);
1404
1401
  }
1405
1402
  async function Kn(r) {
1403
+ St.removeAllListeners("onDeviceStateChanged"), St.on("onDeviceStateChanged", r);
1404
+ }
1405
+ async function Jn(r) {
1406
1406
  let e;
1407
1407
  try {
1408
1408
  const i = { video: r ?? !0 };
@@ -1415,11 +1415,11 @@ async function Kn(r) {
1415
1415
  );
1416
1416
  }
1417
1417
  const t = e.getVideoTracks()[0];
1418
- if (r != null && r.frameRate && Bi(t, r), !t)
1418
+ if (r != null && r.frameRate && ji(t, r), !t)
1419
1419
  throw new C(y.UNEXPECTED_TYPE, "got falsy in track");
1420
- return new zn(t);
1420
+ return new Gn(t);
1421
1421
  }
1422
- async function Jn(r, e) {
1422
+ async function Yn(r, e) {
1423
1423
  const { video: t, audio: i } = r;
1424
1424
  let s = t === !0 ? {} : t;
1425
1425
  e != null && e.displaySurface && (s.displaySurface = e.displaySurface, delete e.displaySurface), G.settingResolutionInGetDisplayMedia() || (s = !0), !G.supportIdealParamsInGetDisplayMedia() && typeof s != "boolean" && (s.width && typeof s.width == "number" && (s.width = {
@@ -1434,33 +1434,33 @@ async function Jn(r, e) {
1434
1434
  audio: i,
1435
1435
  ...e
1436
1436
  });
1437
- } catch (c) {
1437
+ } catch (d) {
1438
1438
  throw new C(
1439
1439
  y.CAPTURE_FAILED,
1440
1440
  "got error when capture screen",
1441
- c
1441
+ d
1442
1442
  );
1443
1443
  }
1444
1444
  const a = n.getVideoTracks()[0], o = n.getAudioTracks()[0];
1445
1445
  if (!a)
1446
1446
  throw new C(y.UNEXPECTED_TYPE, "got falsy in videoTrack");
1447
- typeof s != "boolean" && typeof s.frameRate == "number" && Bi(a, s);
1447
+ typeof s != "boolean" && typeof s.frameRate == "number" && ji(a, s);
1448
1448
  const u = [];
1449
- return u.push(new Gn(a)), o && u.push(new On(o)), u;
1449
+ return u.push(new Hn(a)), o && u.push(new In(o)), u;
1450
1450
  }
1451
- async function Yn(r) {
1451
+ async function Zn(r) {
1452
1452
  const { url: e, audio: t, video: i, loop: s } = r, n = new be({
1453
1453
  url: e,
1454
1454
  kind: i ? E.VIDEO : E.AUDIO,
1455
1455
  loop: s
1456
1456
  }), a = [];
1457
- return t && a.push(new $i(n)), i && a.push(new Hn(n)), await n.isReady(), a;
1458
- }
1459
- async function Zn(r) {
1460
- const e = new Ui(r);
1461
- return await e.isReady(), new Bn(e);
1457
+ return t && a.push(new Bi(n)), i && a.push(new qn(n)), await n.isReady(), a;
1462
1458
  }
1463
1459
  async function Qn(r) {
1460
+ const e = new $i(r);
1461
+ return await e.isReady(), new jn(e);
1462
+ }
1463
+ async function eo(r) {
1464
1464
  let e;
1465
1465
  try {
1466
1466
  const i = { audio: r ?? !0 };
@@ -1475,31 +1475,31 @@ async function Qn(r) {
1475
1475
  const t = e.getAudioTracks()[0];
1476
1476
  if (!t)
1477
1477
  throw new C(y.UNEXPECTED_TYPE, "got falsy in track");
1478
- return new wn(t);
1478
+ return new On(t);
1479
1479
  }
1480
- function eo(r) {
1480
+ function to(r) {
1481
1481
  if (!r || r.kind !== "video")
1482
1482
  throw new C(
1483
1483
  y.UNEXPECTED_TYPE,
1484
1484
  "error custom video track type"
1485
1485
  );
1486
- return new qn(r);
1486
+ return new Wn(r);
1487
1487
  }
1488
- function to(r) {
1488
+ function ro(r) {
1489
1489
  if (!r || r.kind !== "audio")
1490
1490
  throw new C(
1491
1491
  y.UNEXPECTED_TYPE,
1492
1492
  "error custom audio track type"
1493
1493
  );
1494
- return new In(r);
1494
+ return new Dn(r);
1495
1495
  }
1496
- const ro = q.invoke(Wn, "enumerateInputDevices"), io = q.invoke(Kn, "createCameraTrack"), so = q.invoke(Zn, "createPictureTrack"), Mr = q.invoke(Yn, "createMediaTracks"), no = q.invoke(Qn, "createMicrophoneTrack"), oo = q.invoke(Jn, "createScreenTracks"), ao = q.invoke(Xn, "onDeviceChanged"), co = q.invoke(eo, "createCustomVideoTrack"), uo = q.invoke(to, "createCustomAudioTrack");
1497
- var St = /* @__PURE__ */ ((r) => (r.PAUSING = "pausing", r))(St || {});
1498
- const ho = {
1496
+ const io = q.invoke(Xn, "enumerateInputDevices"), so = q.invoke(Jn, "createCameraTrack"), no = q.invoke(Qn, "createPictureTrack"), Dr = q.invoke(Zn, "createMediaTracks"), oo = q.invoke(eo, "createMicrophoneTrack"), ao = q.invoke(Yn, "createScreenTracks"), co = q.invoke(Kn, "onDeviceChanged"), uo = q.invoke(to, "createCustomVideoTrack"), ho = q.invoke(ro, "createCustomAudioTrack");
1497
+ var Tt = /* @__PURE__ */ ((r) => (r.PAUSING = "pausing", r))(Tt || {});
1498
+ const po = {
1499
1499
  sampleRate: 48e3,
1500
1500
  keepAlive: !0
1501
- }, Dr = /* @__PURE__ */ new Map(), ye = new L("Mixer");
1502
- class po extends Bt {
1501
+ }, Mr = /* @__PURE__ */ new Map(), ye = new L("Mixer");
1502
+ class lo extends Bt {
1503
1503
  constructor(t) {
1504
1504
  super();
1505
1505
  m(this, "id", oe());
@@ -1510,12 +1510,12 @@ class po extends Bt {
1510
1510
  m(this, "_bufferNode");
1511
1511
  m(this, "_track");
1512
1512
  ye.info("ctor", t), this._config = {
1513
- ...ho,
1513
+ ...po,
1514
1514
  ...t
1515
- }, this._context = lo(this._config), this._bindContextEvent(this._context);
1515
+ }, this._context = mo(this._config), this._bindContextEvent(this._context);
1516
1516
  }
1517
1517
  mix(t) {
1518
- ye.info("mix", t), Tt(this._context);
1518
+ ye.info("mix", t), Et(this._context);
1519
1519
  for (const i of this._nodeList)
1520
1520
  t.includes(i) || i.destroy();
1521
1521
  this._nodeList = t, this._connect(t, this._destNode), this._nodeList.length === 0 && this._appendSlience(this._context, this._destNode);
@@ -1544,10 +1544,10 @@ class po extends Bt {
1544
1544
  }
1545
1545
  _handleContextStateChange() {
1546
1546
  const t = this._context;
1547
- (t.state === "suspended" || t.state === "interrupted") && (ye.info("_emit_", St.PAUSING), this.emit(St.PAUSING));
1547
+ (t.state === "suspended" || t.state === "interrupted") && (ye.info("_emit_", Tt.PAUSING), this.emit(Tt.PAUSING));
1548
1548
  }
1549
1549
  track() {
1550
- if (ye.info("track"), Tt(this._context), this._track)
1550
+ if (ye.info("track"), Et(this._context), this._track)
1551
1551
  return this._track;
1552
1552
  let t = this._destNode;
1553
1553
  t || (t = new MediaStreamAudioDestinationNode(this._context)), this._nodeList.length === 0 && this._appendSlience(this._context, t), this._connect(this._nodeList, t);
@@ -1555,23 +1555,23 @@ class po extends Bt {
1555
1555
  return this._destNode = t, this._track = i, i;
1556
1556
  }
1557
1557
  }
1558
- function lo(r) {
1558
+ function mo(r) {
1559
1559
  const { sampleRate: e, keepAlive: t } = r;
1560
- let i = Dr.get(e);
1561
- return (!i || i.state === "closed") && (i = new AudioContext({ sampleRate: e }), Dr.set(e, i)), t && (i.onstatechange = () => {
1562
- Tt(i);
1560
+ let i = Mr.get(e);
1561
+ return (!i || i.state === "closed") && (i = new AudioContext({ sampleRate: e }), Mr.set(e, i)), t && (i.onstatechange = () => {
1562
+ Et(i);
1563
1563
  }), i;
1564
1564
  }
1565
- function Tt(r) {
1565
+ function Et(r) {
1566
1566
  if (r.state === "suspended" || r.state === "interrupted")
1567
1567
  return r.resume();
1568
1568
  }
1569
- const mo = (r) => (e, t) => (r.set(e, t), t), Lr = Number.MAX_SAFE_INTEGER === void 0 ? 9007199254740991 : Number.MAX_SAFE_INTEGER, ji = 536870912, Fr = ji * 2, fo = (r, e) => (t) => {
1569
+ const fo = (r) => (e, t) => (r.set(e, t), t), Lr = Number.MAX_SAFE_INTEGER === void 0 ? 9007199254740991 : Number.MAX_SAFE_INTEGER, zi = 536870912, Fr = zi * 2, _o = (r, e) => (t) => {
1570
1570
  const i = e.get(t);
1571
1571
  let s = i === void 0 ? t.size : i < Fr ? i + 1 : 0;
1572
1572
  if (!t.has(s))
1573
1573
  return r(t, s);
1574
- if (t.size < ji) {
1574
+ if (t.size < zi) {
1575
1575
  for (; t.has(s); )
1576
1576
  s = Math.floor(Math.random() * Fr);
1577
1577
  return r(t, s);
@@ -1581,71 +1581,71 @@ const mo = (r) => (e, t) => (r.set(e, t), t), Lr = Number.MAX_SAFE_INTEGER === v
1581
1581
  for (; t.has(s); )
1582
1582
  s = Math.floor(Math.random() * Lr);
1583
1583
  return r(t, s);
1584
- }, zi = /* @__PURE__ */ new WeakMap(), _o = mo(zi), Y = fo(_o, zi), go = (r) => r.method !== void 0 && r.method === "call", vo = (r) => typeof r.id == "number" && typeof r.result == "boolean", Co = (r) => {
1584
+ }, Gi = /* @__PURE__ */ new WeakMap(), go = fo(Gi), Y = _o(go, Gi), vo = (r) => r.method !== void 0 && r.method === "call", Co = (r) => typeof r.id == "number" && typeof r.result == "boolean", yo = (r) => {
1585
1585
  const e = /* @__PURE__ */ new Map([[0, () => {
1586
1586
  }]]), t = /* @__PURE__ */ new Map([[0, () => {
1587
1587
  }]]), i = /* @__PURE__ */ new Map(), s = new Worker(r);
1588
- return s.addEventListener("message", ({ data: c }) => {
1589
- if (go(c)) {
1590
- const { params: { timerId: d, timerType: h } } = c;
1588
+ return s.addEventListener("message", ({ data: d }) => {
1589
+ if (vo(d)) {
1590
+ const { params: { timerId: c, timerType: h } } = d;
1591
1591
  if (h === "interval") {
1592
- const p = e.get(d);
1592
+ const p = e.get(c);
1593
1593
  if (typeof p === void 0)
1594
1594
  throw new Error("The timer is in an undefined state.");
1595
1595
  if (typeof p == "number") {
1596
1596
  const l = i.get(p);
1597
- if (l === void 0 || l.timerId !== d || l.timerType !== h)
1597
+ if (l === void 0 || l.timerId !== c || l.timerType !== h)
1598
1598
  throw new Error("The timer is in an undefined state.");
1599
1599
  } else typeof p == "function" && p();
1600
1600
  } else if (h === "timeout") {
1601
- const p = t.get(d);
1601
+ const p = t.get(c);
1602
1602
  if (typeof p === void 0)
1603
1603
  throw new Error("The timer is in an undefined state.");
1604
1604
  if (typeof p == "number") {
1605
1605
  const l = i.get(p);
1606
- if (l === void 0 || l.timerId !== d || l.timerType !== h)
1606
+ if (l === void 0 || l.timerId !== c || l.timerType !== h)
1607
1607
  throw new Error("The timer is in an undefined state.");
1608
- } else typeof p == "function" && (p(), t.delete(d));
1608
+ } else typeof p == "function" && (p(), t.delete(c));
1609
1609
  }
1610
- } else if (vo(c)) {
1611
- const { id: d } = c, h = i.get(d);
1610
+ } else if (Co(d)) {
1611
+ const { id: c } = d, h = i.get(c);
1612
1612
  if (h === void 0)
1613
1613
  throw new Error("The timer is in an undefined state.");
1614
1614
  const { timerId: p, timerType: l } = h;
1615
- i.delete(d), l === "interval" ? e.delete(p) : t.delete(p);
1615
+ i.delete(c), l === "interval" ? e.delete(p) : t.delete(p);
1616
1616
  } else {
1617
- const { error: { message: d } } = c;
1618
- throw new Error(d);
1617
+ const { error: { message: c } } = d;
1618
+ throw new Error(c);
1619
1619
  }
1620
1620
  }), {
1621
- clearInterval: (c) => {
1622
- if (typeof e.get(c) == "function") {
1623
- const d = Y(i);
1624
- i.set(d, { timerId: c, timerType: "interval" }), e.set(c, d), s.postMessage({
1625
- id: d,
1621
+ clearInterval: (d) => {
1622
+ if (typeof e.get(d) == "function") {
1623
+ const c = Y(i);
1624
+ i.set(c, { timerId: d, timerType: "interval" }), e.set(d, c), s.postMessage({
1625
+ id: c,
1626
1626
  method: "clear",
1627
- params: { timerId: c, timerType: "interval" }
1627
+ params: { timerId: d, timerType: "interval" }
1628
1628
  });
1629
1629
  }
1630
1630
  },
1631
- clearTimeout: (c) => {
1632
- if (typeof t.get(c) == "function") {
1633
- const d = Y(i);
1634
- i.set(d, { timerId: c, timerType: "timeout" }), t.set(c, d), s.postMessage({
1635
- id: d,
1631
+ clearTimeout: (d) => {
1632
+ if (typeof t.get(d) == "function") {
1633
+ const c = Y(i);
1634
+ i.set(c, { timerId: d, timerType: "timeout" }), t.set(d, c), s.postMessage({
1635
+ id: c,
1636
1636
  method: "clear",
1637
- params: { timerId: c, timerType: "timeout" }
1637
+ params: { timerId: d, timerType: "timeout" }
1638
1638
  });
1639
1639
  }
1640
1640
  },
1641
- setInterval: (c, d = 0, ...h) => {
1641
+ setInterval: (d, c = 0, ...h) => {
1642
1642
  const p = Y(e);
1643
1643
  return e.set(p, () => {
1644
- c(...h), typeof e.get(p) == "function" && s.postMessage({
1644
+ d(...h), typeof e.get(p) == "function" && s.postMessage({
1645
1645
  id: null,
1646
1646
  method: "set",
1647
1647
  params: {
1648
- delay: d,
1648
+ delay: c,
1649
1649
  now: performance.timeOrigin + performance.now(),
1650
1650
  timerId: p,
1651
1651
  timerType: "interval"
@@ -1655,20 +1655,20 @@ const mo = (r) => (e, t) => (r.set(e, t), t), Lr = Number.MAX_SAFE_INTEGER === v
1655
1655
  id: null,
1656
1656
  method: "set",
1657
1657
  params: {
1658
- delay: d,
1658
+ delay: c,
1659
1659
  now: performance.timeOrigin + performance.now(),
1660
1660
  timerId: p,
1661
1661
  timerType: "interval"
1662
1662
  }
1663
1663
  }), p;
1664
1664
  },
1665
- setTimeout: (c, d = 0, ...h) => {
1665
+ setTimeout: (d, c = 0, ...h) => {
1666
1666
  const p = Y(t);
1667
- return t.set(p, () => c(...h)), s.postMessage({
1667
+ return t.set(p, () => d(...h)), s.postMessage({
1668
1668
  id: null,
1669
1669
  method: "set",
1670
1670
  params: {
1671
- delay: d,
1671
+ delay: c,
1672
1672
  now: performance.timeOrigin + performance.now(),
1673
1673
  timerId: p,
1674
1674
  timerType: "timeout"
@@ -1676,7 +1676,7 @@ const mo = (r) => (e, t) => (r.set(e, t), t), Lr = Number.MAX_SAFE_INTEGER === v
1676
1676
  }), p;
1677
1677
  }
1678
1678
  };
1679
- }, yo = (r, e) => {
1679
+ }, So = (r, e) => {
1680
1680
  let t = null;
1681
1681
  return () => {
1682
1682
  if (t !== null)
@@ -1684,7 +1684,7 @@ const mo = (r) => (e, t) => (r.set(e, t), t), Lr = Number.MAX_SAFE_INTEGER === v
1684
1684
  const i = new Blob([e], { type: "application/javascript; charset=utf-8" }), s = URL.createObjectURL(i);
1685
1685
  return t = r(s), setTimeout(() => URL.revokeObjectURL(s)), t;
1686
1686
  };
1687
- }, So = `(()=>{"use strict";const e=new Map,t=new Map,r=t=>{const r=e.get(t);return void 0!==r&&(clearTimeout(r),e.delete(t),!0)},s=e=>{const r=t.get(e);return void 0!==r&&(clearTimeout(r),t.delete(e),!0)},o=(e,t)=>{const r=performance.now(),s=e+t-r-performance.timeOrigin;return{expected:r+s,remainingDelay:s}},i=(e,t,r,s)=>{const o=r-performance.now();o>0?e.set(t,setTimeout(i,o,e,t,r,s)):(e.delete(t),postMessage({id:null,method:"call",params:{timerId:t,timerType:s}}))};addEventListener("message",(({data:n})=>{try{if("clear"===n.method){const{id:e,params:{timerId:t,timerType:o}}=n;if("interval"===o)postMessage({id:e,result:r(t)});else{if("timeout"!==o)throw new Error('The given type "'.concat(o,'" is not supported'));postMessage({id:e,result:s(t)})}}else{if("set"!==n.method)throw new Error('The given method "'.concat(n.method,'" is not supported'));{const{params:{delay:r,now:s,timerId:a,timerType:m}}=n;if("interval"===m)((t,r,s)=>{const{expected:n,remainingDelay:a}=o(t,s);e.set(r,setTimeout(i,a,e,r,n,"interval"))})(r,a,s);else{if("timeout"!==m)throw new Error('The given type "'.concat(m,'" is not supported'));((e,r,s)=>{const{expected:n,remainingDelay:a}=o(e,s);t.set(r,setTimeout(i,a,t,r,n,"timeout"))})(r,a,s)}}}}catch(e){postMessage({error:{message:e.message},id:n.id,result:null})}}))})();`, Gi = yo(Co, So), To = (r) => Gi().clearTimeout(r), Eo = (...r) => Gi().setTimeout(...r), bo = (r) => r.method !== void 0 && r.method === "call", ko = (r) => typeof r.id == "number" && typeof r.result == "boolean", Po = (r) => {
1687
+ }, To = `(()=>{"use strict";const e=new Map,t=new Map,r=t=>{const r=e.get(t);return void 0!==r&&(clearTimeout(r),e.delete(t),!0)},s=e=>{const r=t.get(e);return void 0!==r&&(clearTimeout(r),t.delete(e),!0)},o=(e,t)=>{const r=performance.now(),s=e+t-r-performance.timeOrigin;return{expected:r+s,remainingDelay:s}},i=(e,t,r,s)=>{const o=r-performance.now();o>0?e.set(t,setTimeout(i,o,e,t,r,s)):(e.delete(t),postMessage({id:null,method:"call",params:{timerId:t,timerType:s}}))};addEventListener("message",(({data:n})=>{try{if("clear"===n.method){const{id:e,params:{timerId:t,timerType:o}}=n;if("interval"===o)postMessage({id:e,result:r(t)});else{if("timeout"!==o)throw new Error('The given type "'.concat(o,'" is not supported'));postMessage({id:e,result:s(t)})}}else{if("set"!==n.method)throw new Error('The given method "'.concat(n.method,'" is not supported'));{const{params:{delay:r,now:s,timerId:a,timerType:m}}=n;if("interval"===m)((t,r,s)=>{const{expected:n,remainingDelay:a}=o(t,s);e.set(r,setTimeout(i,a,e,r,n,"interval"))})(r,a,s);else{if("timeout"!==m)throw new Error('The given type "'.concat(m,'" is not supported'));((e,r,s)=>{const{expected:n,remainingDelay:a}=o(e,s);t.set(r,setTimeout(i,a,t,r,n,"timeout"))})(r,a,s)}}}}catch(e){postMessage({error:{message:e.message},id:n.id,result:null})}}))})();`, Hi = So(yo, To), Eo = (r) => Hi().clearTimeout(r), bo = (...r) => Hi().setTimeout(...r), ko = (r) => r.method !== void 0 && r.method === "call", Po = (r) => typeof r.id == "number" && typeof r.result == "boolean", xo = (r) => {
1688
1688
  const e = /* @__PURE__ */ new Map([
1689
1689
  [0, () => {
1690
1690
  }]
@@ -1694,71 +1694,71 @@ const mo = (r) => (e, t) => (r.set(e, t), t), Lr = Number.MAX_SAFE_INTEGER === v
1694
1694
  ]), i = /* @__PURE__ */ new Map(), s = new Worker(r, {
1695
1695
  credentials: "omit"
1696
1696
  });
1697
- return s.addEventListener("message", ({ data: c }) => {
1698
- if (bo(c)) {
1697
+ return s.addEventListener("message", ({ data: d }) => {
1698
+ if (ko(d)) {
1699
1699
  const {
1700
- params: { timerId: d, timerType: h }
1701
- } = c;
1700
+ params: { timerId: c, timerType: h }
1701
+ } = d;
1702
1702
  if (h === "interval") {
1703
- const p = e.get(d);
1703
+ const p = e.get(c);
1704
1704
  if (typeof p === void 0)
1705
1705
  throw new Error("The timer is in an undefined state.");
1706
1706
  if (typeof p == "number") {
1707
1707
  const l = i.get(p);
1708
- if (l === void 0 || l.timerId !== d || l.timerType !== h)
1708
+ if (l === void 0 || l.timerId !== c || l.timerType !== h)
1709
1709
  throw new Error("The timer is in an undefined state.");
1710
1710
  } else typeof p == "function" && p();
1711
1711
  } else if (h === "timeout") {
1712
- const p = t.get(d);
1712
+ const p = t.get(c);
1713
1713
  if (typeof p === void 0)
1714
1714
  throw new Error("The timer is in an undefined state.");
1715
1715
  if (typeof p == "number") {
1716
1716
  const l = i.get(p);
1717
- if (l === void 0 || l.timerId !== d || l.timerType !== h)
1717
+ if (l === void 0 || l.timerId !== c || l.timerType !== h)
1718
1718
  throw new Error("The timer is in an undefined state.");
1719
- } else typeof p == "function" && (p(), t.delete(d));
1719
+ } else typeof p == "function" && (p(), t.delete(c));
1720
1720
  }
1721
- } else if (ko(c)) {
1722
- const { id: d } = c, h = i.get(d);
1721
+ } else if (Po(d)) {
1722
+ const { id: c } = d, h = i.get(c);
1723
1723
  if (h === void 0)
1724
1724
  throw new Error("The timer is in an undefined state.");
1725
1725
  const { timerId: p, timerType: l } = h;
1726
- i.delete(d), l === "interval" ? e.delete(p) : t.delete(p);
1726
+ i.delete(c), l === "interval" ? e.delete(p) : t.delete(p);
1727
1727
  } else {
1728
1728
  const {
1729
- error: { message: d }
1730
- } = c;
1731
- throw new Error(d);
1729
+ error: { message: c }
1730
+ } = d;
1731
+ throw new Error(c);
1732
1732
  }
1733
1733
  }), {
1734
- clearInterval: (c) => {
1735
- if (typeof e.get(c) == "function") {
1736
- const d = Y(i);
1737
- i.set(d, { timerId: c, timerType: "interval" }), e.set(c, d), s.postMessage({
1738
- id: d,
1734
+ clearInterval: (d) => {
1735
+ if (typeof e.get(d) == "function") {
1736
+ const c = Y(i);
1737
+ i.set(c, { timerId: d, timerType: "interval" }), e.set(d, c), s.postMessage({
1738
+ id: c,
1739
1739
  method: "clear",
1740
- params: { timerId: c, timerType: "interval" }
1740
+ params: { timerId: d, timerType: "interval" }
1741
1741
  });
1742
1742
  }
1743
1743
  },
1744
- clearTimeout: (c) => {
1745
- if (typeof t.get(c) == "function") {
1746
- const d = Y(i);
1747
- i.set(d, { timerId: c, timerType: "timeout" }), t.set(c, d), s.postMessage({
1748
- id: d,
1744
+ clearTimeout: (d) => {
1745
+ if (typeof t.get(d) == "function") {
1746
+ const c = Y(i);
1747
+ i.set(c, { timerId: d, timerType: "timeout" }), t.set(d, c), s.postMessage({
1748
+ id: c,
1749
1749
  method: "clear",
1750
- params: { timerId: c, timerType: "timeout" }
1750
+ params: { timerId: d, timerType: "timeout" }
1751
1751
  });
1752
1752
  }
1753
1753
  },
1754
- setInterval: (c, d = 0, ...h) => {
1754
+ setInterval: (d, c = 0, ...h) => {
1755
1755
  const p = Y(e);
1756
1756
  return e.set(p, () => {
1757
- c(...h), typeof e.get(p) == "function" && s.postMessage({
1757
+ d(...h), typeof e.get(p) == "function" && s.postMessage({
1758
1758
  id: null,
1759
1759
  method: "set",
1760
1760
  params: {
1761
- delay: d,
1761
+ delay: c,
1762
1762
  now: performance.timeOrigin + performance.now(),
1763
1763
  timerId: p,
1764
1764
  timerType: "interval"
@@ -1768,20 +1768,20 @@ const mo = (r) => (e, t) => (r.set(e, t), t), Lr = Number.MAX_SAFE_INTEGER === v
1768
1768
  id: null,
1769
1769
  method: "set",
1770
1770
  params: {
1771
- delay: d,
1771
+ delay: c,
1772
1772
  now: performance.timeOrigin + performance.now(),
1773
1773
  timerId: p,
1774
1774
  timerType: "interval"
1775
1775
  }
1776
1776
  }), p;
1777
1777
  },
1778
- setTimeout: (c, d = 0, ...h) => {
1778
+ setTimeout: (d, c = 0, ...h) => {
1779
1779
  const p = Y(t);
1780
- return t.set(p, () => c(...h)), s.postMessage({
1780
+ return t.set(p, () => d(...h)), s.postMessage({
1781
1781
  id: null,
1782
1782
  method: "set",
1783
1783
  params: {
1784
- delay: d,
1784
+ delay: c,
1785
1785
  now: performance.timeOrigin + performance.now(),
1786
1786
  timerId: p,
1787
1787
  timerType: "timeout"
@@ -1789,13 +1789,13 @@ const mo = (r) => (e, t) => (r.set(e, t), t), Lr = Number.MAX_SAFE_INTEGER === v
1789
1789
  }), p;
1790
1790
  }
1791
1791
  };
1792
- }, xo = {
1792
+ }, Ro = {
1793
1793
  width: 640,
1794
1794
  height: 480,
1795
1795
  frameRate: 30,
1796
1796
  backgroundColor: "#000000"
1797
1797
  }, Ie = new L("View");
1798
- class Ro {
1798
+ class Ao {
1799
1799
  constructor(e) {
1800
1800
  m(this, "id", oe());
1801
1801
  m(this, "_context");
@@ -1819,18 +1819,18 @@ class Ro {
1819
1819
  }
1820
1820
  this._drawOnCanvas(), this._workerTimeoutId && this._customClearTimeout(this._workerTimeoutId), this._workerTimeoutId = this._customSetTimeout(() => {
1821
1821
  this._paintLoop(), this._raqId && (cancelAnimationFrame(this._raqId), this._raqId = void 0);
1822
- }, Ct / this._config.frameRate), this._raqId = requestAnimationFrame(this._paintLoop);
1822
+ }, yt / this._config.frameRate), this._raqId = requestAnimationFrame(this._paintLoop);
1823
1823
  });
1824
1824
  Ie.info("ctor", e), this._config = {
1825
- ...xo,
1825
+ ...Ro,
1826
1826
  ...e
1827
1827
  };
1828
1828
  const { context: t, canvas: i } = Li(this._config);
1829
- this._context = t, this._canvas = i, this._customSetTimeout = Eo, this._customClearTimeout = To;
1829
+ this._context = t, this._canvas = i, this._customSetTimeout = bo, this._customClearTimeout = Eo;
1830
1830
  }
1831
1831
  setWorkerTimerScriptUrl(e) {
1832
1832
  if (this._workerTimerScriptUrl = e, this._workerTimerScriptUrl) {
1833
- const t = Po(this._workerTimerScriptUrl);
1833
+ const t = xo(this._workerTimerScriptUrl);
1834
1834
  this._customSetTimeout = (...i) => t.setTimeout(...i), this._customClearTimeout = (i) => t.clearTimeout(i);
1835
1835
  }
1836
1836
  }
@@ -1838,7 +1838,7 @@ class Ro {
1838
1838
  if (e < this._nextTime)
1839
1839
  return !1;
1840
1840
  for (; e > this._nextTime; )
1841
- this._nextTime += Ct / this._config.frameRate;
1841
+ this._nextTime += yt / this._config.frameRate;
1842
1842
  return !0;
1843
1843
  }
1844
1844
  updateConfig(e) {
@@ -1888,10 +1888,10 @@ class Ro {
1888
1888
  this._stopped = !0;
1889
1889
  }
1890
1890
  }
1891
- function Ao() {
1891
+ function wo() {
1892
1892
  return Math.random().toString(36).slice(-8);
1893
1893
  }
1894
- const wo = `
1894
+ const Oo = `
1895
1895
  const SMOOTHING_FACTOR = 0.8;
1896
1896
  const MINIMUM_VALUE = 0.00001;
1897
1897
 
@@ -1946,10 +1946,10 @@ registerProcessor('vumeter', class extends AudioWorkletProcessor {
1946
1946
  return true;
1947
1947
  }
1948
1948
  });
1949
- `, Oo = URL.createObjectURL(
1950
- new Blob([wo], { type: "application/javascript" })
1949
+ `, Io = URL.createObjectURL(
1950
+ new Blob([Oo], { type: "application/javascript" })
1951
1951
  );
1952
- class Io {
1952
+ class Do {
1953
1953
  constructor() {
1954
1954
  this._audioCtx = null, this._volume = 0;
1955
1955
  }
@@ -1959,7 +1959,7 @@ class Io {
1959
1959
  async start(e, t) {
1960
1960
  if (this._audioCtx) return;
1961
1961
  const i = new AudioContext();
1962
- await i.audioWorklet.addModule(t || Oo);
1962
+ await i.audioWorklet.addModule(t || Io);
1963
1963
  const s = new MediaStream();
1964
1964
  s.addTrack(e);
1965
1965
  const n = i.createMediaStreamSource(s), a = new AudioWorkletNode(i, "vumeter");
@@ -1973,12 +1973,12 @@ class Io {
1973
1973
  (e = this._audioCtx) == null || e.close(), this._audioCtx = null;
1974
1974
  }
1975
1975
  }
1976
- class Xe {
1976
+ class Ke {
1977
1977
  constructor() {
1978
1978
  this._volumeDetectScriptUrl = void 0;
1979
1979
  }
1980
1980
  static get instance() {
1981
- return this._instance || (this._instance = new Xe()), this._instance;
1981
+ return this._instance || (this._instance = new Ke()), this._instance;
1982
1982
  }
1983
1983
  get volumeDetectScriptUrl() {
1984
1984
  return this._volumeDetectScriptUrl;
@@ -1987,9 +1987,9 @@ class Xe {
1987
1987
  this._volumeDetectScriptUrl = e;
1988
1988
  }
1989
1989
  }
1990
- class Hi extends te {
1990
+ class qi extends te {
1991
1991
  constructor(e) {
1992
- super(), this._width = 0, this._height = 0, this._mediaStream = null, this._nextStream = null, this._trackMap = {}, this.type = e.type, this.id = Ao(), this._source = e.stream;
1992
+ super(), this._width = 0, this._height = 0, this._mediaStream = null, this._nextStream = null, this._trackMap = {}, this.type = e.type, this.id = wo(), this._source = e.stream;
1993
1993
  }
1994
1994
  get source() {
1995
1995
  return this._source;
@@ -2020,9 +2020,9 @@ class Hi extends te {
2020
2020
  return this._trackMap.audio && e.addTrack(this._trackMap.audio), this._trackMap.video && e.addTrack(this._trackMap.video), this._mediaStream = e, e;
2021
2021
  }
2022
2022
  async startVolumeDetect() {
2023
- this.audioTrack && (this._volumeDetector || (this._volumeDetector = new Io()), await this._volumeDetector.start(
2023
+ this.audioTrack && (this._volumeDetector || (this._volumeDetector = new Do()), await this._volumeDetector.start(
2024
2024
  this.audioTrack,
2025
- Xe.instance.volumeDetectScriptUrl
2025
+ Ke.instance.volumeDetectScriptUrl
2026
2026
  ));
2027
2027
  }
2028
2028
  stopVolumeDetect() {
@@ -2034,7 +2034,7 @@ class Hi extends te {
2034
2034
  return ((e = this._volumeDetector) == null ? void 0 : e.volume) || 0;
2035
2035
  }
2036
2036
  }
2037
- class _e extends Hi {
2037
+ class _e extends qi {
2038
2038
  get isVideoStream() {
2039
2039
  return !0;
2040
2040
  }
@@ -2043,14 +2043,14 @@ class _e extends Hi {
2043
2043
  }
2044
2044
  bindTrackSizeChangeEvent(e) {
2045
2045
  e.on(I.SIZE_CHANGE, ({ width: t, height: i }) => {
2046
- this._width = t, this._height = i, this.emit(Ft.SizeChange, {
2046
+ this._width = t, this._height = i, this.emit(Nt.SizeChange, {
2047
2047
  width: t,
2048
2048
  height: i
2049
2049
  });
2050
2050
  });
2051
2051
  }
2052
2052
  }
2053
- class Ke extends Hi {
2053
+ class Je extends qi {
2054
2054
  get isVideoStream() {
2055
2055
  return !1;
2056
2056
  }
@@ -2081,67 +2081,67 @@ class Mo extends _e {
2081
2081
  this.source.destroy();
2082
2082
  }
2083
2083
  }
2084
- var qi = typeof global == "object" && global && global.Object === Object && global, Do = typeof self == "object" && self && self.Object === Object && self, W = qi || Do || Function("return this")(), Q = W.Symbol, Wi = Object.prototype, Lo = Wi.hasOwnProperty, Fo = Wi.toString, Se = Q ? Q.toStringTag : void 0;
2085
- function No(r) {
2086
- var e = Lo.call(r, Se), t = r[Se];
2084
+ var Wi = typeof global == "object" && global && global.Object === Object && global, Lo = typeof self == "object" && self && self.Object === Object && self, W = Wi || Lo || Function("return this")(), Q = W.Symbol, Xi = Object.prototype, Fo = Xi.hasOwnProperty, No = Xi.toString, Se = Q ? Q.toStringTag : void 0;
2085
+ function Vo(r) {
2086
+ var e = Fo.call(r, Se), t = r[Se];
2087
2087
  try {
2088
2088
  r[Se] = void 0;
2089
2089
  var i = !0;
2090
2090
  } catch {
2091
2091
  }
2092
- var s = Fo.call(r);
2092
+ var s = No.call(r);
2093
2093
  return i && (e ? r[Se] = t : delete r[Se]), s;
2094
2094
  }
2095
- var Vo = Object.prototype, Uo = Vo.toString;
2096
- function $o(r) {
2097
- return Uo.call(r);
2095
+ var Uo = Object.prototype, $o = Uo.toString;
2096
+ function Bo(r) {
2097
+ return $o.call(r);
2098
2098
  }
2099
- var Bo = "[object Null]", jo = "[object Undefined]", Nr = Q ? Q.toStringTag : void 0;
2099
+ var jo = "[object Null]", zo = "[object Undefined]", Nr = Q ? Q.toStringTag : void 0;
2100
2100
  function ge(r) {
2101
- return r == null ? r === void 0 ? jo : Bo : Nr && Nr in Object(r) ? No(r) : $o(r);
2101
+ return r == null ? r === void 0 ? zo : jo : Nr && Nr in Object(r) ? Vo(r) : Bo(r);
2102
2102
  }
2103
2103
  function me(r) {
2104
2104
  return r != null && typeof r == "object";
2105
2105
  }
2106
- var zo = "[object Symbol]";
2107
- function Je(r) {
2108
- return typeof r == "symbol" || me(r) && ge(r) == zo;
2106
+ var Go = "[object Symbol]";
2107
+ function Ye(r) {
2108
+ return typeof r == "symbol" || me(r) && ge(r) == Go;
2109
2109
  }
2110
- function Xi(r, e) {
2110
+ function Ki(r, e) {
2111
2111
  for (var t = -1, i = r == null ? 0 : r.length, s = Array(i); ++t < i; )
2112
2112
  s[t] = e(r[t], t, r);
2113
2113
  return s;
2114
2114
  }
2115
- var D = Array.isArray, Vr = Q ? Q.prototype : void 0, Ur = Vr ? Vr.toString : void 0;
2116
- function Ki(r) {
2115
+ var M = Array.isArray, Vr = Q ? Q.prototype : void 0, Ur = Vr ? Vr.toString : void 0;
2116
+ function Ji(r) {
2117
2117
  if (typeof r == "string")
2118
2118
  return r;
2119
- if (D(r))
2120
- return Xi(r, Ki) + "";
2121
- if (Je(r))
2119
+ if (M(r))
2120
+ return Ki(r, Ji) + "";
2121
+ if (Ye(r))
2122
2122
  return Ur ? Ur.call(r) : "";
2123
2123
  var e = r + "";
2124
2124
  return e == "0" && 1 / r == -1 / 0 ? "-0" : e;
2125
2125
  }
2126
- var Go = /\s/;
2127
- function Ho(r) {
2128
- for (var e = r.length; e-- && Go.test(r.charAt(e)); )
2126
+ var Ho = /\s/;
2127
+ function qo(r) {
2128
+ for (var e = r.length; e-- && Ho.test(r.charAt(e)); )
2129
2129
  ;
2130
2130
  return e;
2131
2131
  }
2132
- var qo = /^\s+/;
2133
- function Wo(r) {
2134
- return r && r.slice(0, Ho(r) + 1).replace(qo, "");
2132
+ var Wo = /^\s+/;
2133
+ function Xo(r) {
2134
+ return r && r.slice(0, qo(r) + 1).replace(Wo, "");
2135
2135
  }
2136
2136
  function ke(r) {
2137
2137
  var e = typeof r;
2138
2138
  return r != null && (e == "object" || e == "function");
2139
2139
  }
2140
- var $r = NaN, Xo = /^[-+]0x[0-9a-f]+$/i, Ko = /^0b[01]+$/i, Jo = /^0o[0-7]+$/i, Yo = parseInt;
2141
- function Zo(r) {
2140
+ var $r = NaN, Ko = /^[-+]0x[0-9a-f]+$/i, Jo = /^0b[01]+$/i, Yo = /^0o[0-7]+$/i, Zo = parseInt;
2141
+ function Qo(r) {
2142
2142
  if (typeof r == "number")
2143
2143
  return r;
2144
- if (Je(r))
2144
+ if (Ye(r))
2145
2145
  return $r;
2146
2146
  if (ke(r)) {
2147
2147
  var e = typeof r.valueOf == "function" ? r.valueOf() : r;
@@ -2149,46 +2149,46 @@ function Zo(r) {
2149
2149
  }
2150
2150
  if (typeof r != "string")
2151
2151
  return r === 0 ? r : +r;
2152
- r = Wo(r);
2153
- var t = Ko.test(r);
2154
- return t || Jo.test(r) ? Yo(r.slice(2), t ? 2 : 8) : Xo.test(r) ? $r : +r;
2152
+ r = Xo(r);
2153
+ var t = Jo.test(r);
2154
+ return t || Yo.test(r) ? Zo(r.slice(2), t ? 2 : 8) : Ko.test(r) ? $r : +r;
2155
2155
  }
2156
- var Qo = 1 / 0, ea = 17976931348623157e292;
2157
- function ta(r) {
2156
+ var ea = 1 / 0, ta = 17976931348623157e292;
2157
+ function ra(r) {
2158
2158
  if (!r)
2159
2159
  return r === 0 ? r : 0;
2160
- if (r = Zo(r), r === Qo || r === -1 / 0) {
2160
+ if (r = Qo(r), r === ea || r === -1 / 0) {
2161
2161
  var e = r < 0 ? -1 : 1;
2162
- return e * ea;
2162
+ return e * ta;
2163
2163
  }
2164
2164
  return r === r ? r : 0;
2165
2165
  }
2166
- function ra(r) {
2167
- var e = ta(r), t = e % 1;
2166
+ function ia(r) {
2167
+ var e = ra(r), t = e % 1;
2168
2168
  return e === e ? t ? e - t : e : 0;
2169
2169
  }
2170
- function ia(r) {
2170
+ function sa(r) {
2171
2171
  return r;
2172
2172
  }
2173
- var sa = "[object AsyncFunction]", na = "[object Function]", oa = "[object GeneratorFunction]", aa = "[object Proxy]";
2174
- function Ji(r) {
2173
+ var na = "[object AsyncFunction]", oa = "[object Function]", aa = "[object GeneratorFunction]", ca = "[object Proxy]";
2174
+ function Yi(r) {
2175
2175
  if (!ke(r))
2176
2176
  return !1;
2177
2177
  var e = ge(r);
2178
- return e == na || e == oa || e == sa || e == aa;
2178
+ return e == oa || e == aa || e == na || e == ca;
2179
2179
  }
2180
- var ct = W["__core-js_shared__"], Br = function() {
2181
- var r = /[^.]+$/.exec(ct && ct.keys && ct.keys.IE_PROTO || "");
2180
+ var dt = W["__core-js_shared__"], Br = function() {
2181
+ var r = /[^.]+$/.exec(dt && dt.keys && dt.keys.IE_PROTO || "");
2182
2182
  return r ? "Symbol(src)_1." + r : "";
2183
2183
  }();
2184
- function ca(r) {
2184
+ function da(r) {
2185
2185
  return !!Br && Br in r;
2186
2186
  }
2187
- var da = Function.prototype, ua = da.toString;
2187
+ var ua = Function.prototype, ha = ua.toString;
2188
2188
  function ae(r) {
2189
2189
  if (r != null) {
2190
2190
  try {
2191
- return ua.call(r);
2191
+ return ha.call(r);
2192
2192
  } catch {
2193
2193
  }
2194
2194
  try {
@@ -2198,144 +2198,144 @@ function ae(r) {
2198
2198
  }
2199
2199
  return "";
2200
2200
  }
2201
- var ha = /[\\^$.*+?()[\]{}|]/g, pa = /^\[object .+?Constructor\]$/, la = Function.prototype, ma = Object.prototype, fa = la.toString, _a = ma.hasOwnProperty, ga = RegExp(
2202
- "^" + fa.call(_a).replace(ha, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
2201
+ var pa = /[\\^$.*+?()[\]{}|]/g, la = /^\[object .+?Constructor\]$/, ma = Function.prototype, fa = Object.prototype, _a = ma.toString, ga = fa.hasOwnProperty, va = RegExp(
2202
+ "^" + _a.call(ga).replace(pa, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
2203
2203
  );
2204
- function va(r) {
2205
- if (!ke(r) || ca(r))
2204
+ function Ca(r) {
2205
+ if (!ke(r) || da(r))
2206
2206
  return !1;
2207
- var e = Ji(r) ? ga : pa;
2207
+ var e = Yi(r) ? va : la;
2208
2208
  return e.test(ae(r));
2209
2209
  }
2210
- function Ca(r, e) {
2210
+ function ya(r, e) {
2211
2211
  return r == null ? void 0 : r[e];
2212
2212
  }
2213
2213
  function ve(r, e) {
2214
- var t = Ca(r, e);
2215
- return va(t) ? t : void 0;
2214
+ var t = ya(r, e);
2215
+ return Ca(t) ? t : void 0;
2216
2216
  }
2217
- var Et = ve(W, "WeakMap");
2218
- function ya(r, e, t, i) {
2217
+ var bt = ve(W, "WeakMap");
2218
+ function Sa(r, e, t, i) {
2219
2219
  for (var s = r.length, n = t + -1; ++n < s; )
2220
2220
  if (e(r[n], n, r))
2221
2221
  return n;
2222
2222
  return -1;
2223
2223
  }
2224
- var Sa = 9007199254740991, Ta = /^(?:0|[1-9]\d*)$/;
2225
- function Yi(r, e) {
2224
+ var Ta = 9007199254740991, Ea = /^(?:0|[1-9]\d*)$/;
2225
+ function Zi(r, e) {
2226
2226
  var t = typeof r;
2227
- return e = e ?? Sa, !!e && (t == "number" || t != "symbol" && Ta.test(r)) && r > -1 && r % 1 == 0 && r < e;
2227
+ return e = e ?? Ta, !!e && (t == "number" || t != "symbol" && Ea.test(r)) && r > -1 && r % 1 == 0 && r < e;
2228
2228
  }
2229
- function Zi(r, e) {
2229
+ function Qi(r, e) {
2230
2230
  return r === e || r !== r && e !== e;
2231
2231
  }
2232
- var Ea = 9007199254740991;
2232
+ var ba = 9007199254740991;
2233
2233
  function Gt(r) {
2234
- return typeof r == "number" && r > -1 && r % 1 == 0 && r <= Ea;
2234
+ return typeof r == "number" && r > -1 && r % 1 == 0 && r <= ba;
2235
2235
  }
2236
2236
  function Ht(r) {
2237
- return r != null && Gt(r.length) && !Ji(r);
2237
+ return r != null && Gt(r.length) && !Yi(r);
2238
2238
  }
2239
- var ba = Object.prototype;
2240
- function ka(r) {
2241
- var e = r && r.constructor, t = typeof e == "function" && e.prototype || ba;
2239
+ var ka = Object.prototype;
2240
+ function Pa(r) {
2241
+ var e = r && r.constructor, t = typeof e == "function" && e.prototype || ka;
2242
2242
  return r === t;
2243
2243
  }
2244
- function Pa(r, e) {
2244
+ function xa(r, e) {
2245
2245
  for (var t = -1, i = Array(r); ++t < r; )
2246
2246
  i[t] = e(t);
2247
2247
  return i;
2248
2248
  }
2249
- var xa = "[object Arguments]";
2249
+ var Ra = "[object Arguments]";
2250
2250
  function jr(r) {
2251
- return me(r) && ge(r) == xa;
2251
+ return me(r) && ge(r) == Ra;
2252
2252
  }
2253
- var Qi = Object.prototype, Ra = Qi.hasOwnProperty, Aa = Qi.propertyIsEnumerable, es = jr(/* @__PURE__ */ function() {
2253
+ var es = Object.prototype, Aa = es.hasOwnProperty, wa = es.propertyIsEnumerable, ts = jr(/* @__PURE__ */ function() {
2254
2254
  return arguments;
2255
2255
  }()) ? jr : function(r) {
2256
- return me(r) && Ra.call(r, "callee") && !Aa.call(r, "callee");
2256
+ return me(r) && Aa.call(r, "callee") && !wa.call(r, "callee");
2257
2257
  };
2258
- function wa() {
2258
+ function Oa() {
2259
2259
  return !1;
2260
2260
  }
2261
- var ts = typeof exports == "object" && exports && !exports.nodeType && exports, zr = ts && typeof module == "object" && module && !module.nodeType && module, Oa = zr && zr.exports === ts, Gr = Oa ? W.Buffer : void 0, Ia = Gr ? Gr.isBuffer : void 0, bt = Ia || wa, Ma = "[object Arguments]", Da = "[object Array]", La = "[object Boolean]", Fa = "[object Date]", Na = "[object Error]", Va = "[object Function]", Ua = "[object Map]", $a = "[object Number]", Ba = "[object Object]", ja = "[object RegExp]", za = "[object Set]", Ga = "[object String]", Ha = "[object WeakMap]", qa = "[object ArrayBuffer]", Wa = "[object DataView]", Xa = "[object Float32Array]", Ka = "[object Float64Array]", Ja = "[object Int8Array]", Ya = "[object Int16Array]", Za = "[object Int32Array]", Qa = "[object Uint8Array]", ec = "[object Uint8ClampedArray]", tc = "[object Uint16Array]", rc = "[object Uint32Array]", k = {};
2262
- k[Xa] = k[Ka] = k[Ja] = k[Ya] = k[Za] = k[Qa] = k[ec] = k[tc] = k[rc] = !0;
2263
- k[Ma] = k[Da] = k[qa] = k[La] = k[Wa] = k[Fa] = k[Na] = k[Va] = k[Ua] = k[$a] = k[Ba] = k[ja] = k[za] = k[Ga] = k[Ha] = !1;
2264
- function ic(r) {
2261
+ var rs = typeof exports == "object" && exports && !exports.nodeType && exports, zr = rs && typeof module == "object" && module && !module.nodeType && module, Ia = zr && zr.exports === rs, Gr = Ia ? W.Buffer : void 0, Da = Gr ? Gr.isBuffer : void 0, kt = Da || Oa, Ma = "[object Arguments]", La = "[object Array]", Fa = "[object Boolean]", Na = "[object Date]", Va = "[object Error]", Ua = "[object Function]", $a = "[object Map]", Ba = "[object Number]", ja = "[object Object]", za = "[object RegExp]", Ga = "[object Set]", Ha = "[object String]", qa = "[object WeakMap]", Wa = "[object ArrayBuffer]", Xa = "[object DataView]", Ka = "[object Float32Array]", Ja = "[object Float64Array]", Ya = "[object Int8Array]", Za = "[object Int16Array]", Qa = "[object Int32Array]", ec = "[object Uint8Array]", tc = "[object Uint8ClampedArray]", rc = "[object Uint16Array]", ic = "[object Uint32Array]", k = {};
2262
+ k[Ka] = k[Ja] = k[Ya] = k[Za] = k[Qa] = k[ec] = k[tc] = k[rc] = k[ic] = !0;
2263
+ k[Ma] = k[La] = k[Wa] = k[Fa] = k[Xa] = k[Na] = k[Va] = k[Ua] = k[$a] = k[Ba] = k[ja] = k[za] = k[Ga] = k[Ha] = k[qa] = !1;
2264
+ function sc(r) {
2265
2265
  return me(r) && Gt(r.length) && !!k[ge(r)];
2266
2266
  }
2267
- function sc(r) {
2267
+ function nc(r) {
2268
2268
  return function(e) {
2269
2269
  return r(e);
2270
2270
  };
2271
2271
  }
2272
- var rs = typeof exports == "object" && exports && !exports.nodeType && exports, Ee = rs && typeof module == "object" && module && !module.nodeType && module, nc = Ee && Ee.exports === rs, dt = nc && qi.process, Hr = function() {
2272
+ var is = typeof exports == "object" && exports && !exports.nodeType && exports, Ee = is && typeof module == "object" && module && !module.nodeType && module, oc = Ee && Ee.exports === is, ut = oc && Wi.process, Hr = function() {
2273
2273
  try {
2274
2274
  var r = Ee && Ee.require && Ee.require("util").types;
2275
- return r || dt && dt.binding && dt.binding("util");
2275
+ return r || ut && ut.binding && ut.binding("util");
2276
2276
  } catch {
2277
2277
  }
2278
- }(), qr = Hr && Hr.isTypedArray, is = qr ? sc(qr) : ic, oc = Object.prototype, ac = oc.hasOwnProperty;
2279
- function cc(r, e) {
2280
- var t = D(r), i = !t && es(r), s = !t && !i && bt(r), n = !t && !i && !s && is(r), a = t || i || s || n, o = a ? Pa(r.length, String) : [], u = o.length;
2281
- for (var c in r)
2282
- ac.call(r, c) && !(a && // Safari 9 has enumerable `arguments.length` in strict mode.
2283
- (c == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
2284
- s && (c == "offset" || c == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
2285
- n && (c == "buffer" || c == "byteLength" || c == "byteOffset") || // Skip index properties.
2286
- Yi(c, u))) && o.push(c);
2278
+ }(), qr = Hr && Hr.isTypedArray, ss = qr ? nc(qr) : sc, ac = Object.prototype, cc = ac.hasOwnProperty;
2279
+ function dc(r, e) {
2280
+ var t = M(r), i = !t && ts(r), s = !t && !i && kt(r), n = !t && !i && !s && ss(r), a = t || i || s || n, o = a ? xa(r.length, String) : [], u = o.length;
2281
+ for (var d in r)
2282
+ cc.call(r, d) && !(a && // Safari 9 has enumerable `arguments.length` in strict mode.
2283
+ (d == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
2284
+ s && (d == "offset" || d == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
2285
+ n && (d == "buffer" || d == "byteLength" || d == "byteOffset") || // Skip index properties.
2286
+ Zi(d, u))) && o.push(d);
2287
2287
  return o;
2288
2288
  }
2289
- function dc(r, e) {
2289
+ function uc(r, e) {
2290
2290
  return function(t) {
2291
2291
  return r(e(t));
2292
2292
  };
2293
2293
  }
2294
- var uc = dc(Object.keys, Object), hc = Object.prototype, pc = hc.hasOwnProperty;
2295
- function lc(r) {
2296
- if (!ka(r))
2297
- return uc(r);
2294
+ var hc = uc(Object.keys, Object), pc = Object.prototype, lc = pc.hasOwnProperty;
2295
+ function mc(r) {
2296
+ if (!Pa(r))
2297
+ return hc(r);
2298
2298
  var e = [];
2299
2299
  for (var t in Object(r))
2300
- pc.call(r, t) && t != "constructor" && e.push(t);
2300
+ lc.call(r, t) && t != "constructor" && e.push(t);
2301
2301
  return e;
2302
2302
  }
2303
2303
  function Ae(r) {
2304
- return Ht(r) ? cc(r) : lc(r);
2304
+ return Ht(r) ? dc(r) : mc(r);
2305
2305
  }
2306
- var mc = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, fc = /^\w*$/;
2306
+ var fc = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, _c = /^\w*$/;
2307
2307
  function qt(r, e) {
2308
- if (D(r))
2308
+ if (M(r))
2309
2309
  return !1;
2310
2310
  var t = typeof r;
2311
- return t == "number" || t == "symbol" || t == "boolean" || r == null || Je(r) ? !0 : fc.test(r) || !mc.test(r) || e != null && r in Object(e);
2311
+ return t == "number" || t == "symbol" || t == "boolean" || r == null || Ye(r) ? !0 : _c.test(r) || !fc.test(r) || e != null && r in Object(e);
2312
2312
  }
2313
2313
  var Pe = ve(Object, "create");
2314
- function _c() {
2314
+ function gc() {
2315
2315
  this.__data__ = Pe ? Pe(null) : {}, this.size = 0;
2316
2316
  }
2317
- function gc(r) {
2317
+ function vc(r) {
2318
2318
  var e = this.has(r) && delete this.__data__[r];
2319
2319
  return this.size -= e ? 1 : 0, e;
2320
2320
  }
2321
- var vc = "__lodash_hash_undefined__", Cc = Object.prototype, yc = Cc.hasOwnProperty;
2322
- function Sc(r) {
2321
+ var Cc = "__lodash_hash_undefined__", yc = Object.prototype, Sc = yc.hasOwnProperty;
2322
+ function Tc(r) {
2323
2323
  var e = this.__data__;
2324
2324
  if (Pe) {
2325
2325
  var t = e[r];
2326
- return t === vc ? void 0 : t;
2326
+ return t === Cc ? void 0 : t;
2327
2327
  }
2328
- return yc.call(e, r) ? e[r] : void 0;
2328
+ return Sc.call(e, r) ? e[r] : void 0;
2329
2329
  }
2330
- var Tc = Object.prototype, Ec = Tc.hasOwnProperty;
2331
- function bc(r) {
2330
+ var Ec = Object.prototype, bc = Ec.hasOwnProperty;
2331
+ function kc(r) {
2332
2332
  var e = this.__data__;
2333
- return Pe ? e[r] !== void 0 : Ec.call(e, r);
2333
+ return Pe ? e[r] !== void 0 : bc.call(e, r);
2334
2334
  }
2335
- var kc = "__lodash_hash_undefined__";
2336
- function Pc(r, e) {
2335
+ var Pc = "__lodash_hash_undefined__";
2336
+ function xc(r, e) {
2337
2337
  var t = this.__data__;
2338
- return this.size += this.has(r) ? 0 : 1, t[r] = Pe && e === void 0 ? kc : e, this;
2338
+ return this.size += this.has(r) ? 0 : 1, t[r] = Pe && e === void 0 ? Pc : e, this;
2339
2339
  }
2340
2340
  function ne(r) {
2341
2341
  var e = -1, t = r == null ? 0 : r.length;
@@ -2344,37 +2344,37 @@ function ne(r) {
2344
2344
  this.set(i[0], i[1]);
2345
2345
  }
2346
2346
  }
2347
- ne.prototype.clear = _c;
2348
- ne.prototype.delete = gc;
2349
- ne.prototype.get = Sc;
2350
- ne.prototype.has = bc;
2351
- ne.prototype.set = Pc;
2352
- function xc() {
2347
+ ne.prototype.clear = gc;
2348
+ ne.prototype.delete = vc;
2349
+ ne.prototype.get = Tc;
2350
+ ne.prototype.has = kc;
2351
+ ne.prototype.set = xc;
2352
+ function Rc() {
2353
2353
  this.__data__ = [], this.size = 0;
2354
2354
  }
2355
- function Ye(r, e) {
2355
+ function Ze(r, e) {
2356
2356
  for (var t = r.length; t--; )
2357
- if (Zi(r[t][0], e))
2357
+ if (Qi(r[t][0], e))
2358
2358
  return t;
2359
2359
  return -1;
2360
2360
  }
2361
- var Rc = Array.prototype, Ac = Rc.splice;
2362
- function wc(r) {
2363
- var e = this.__data__, t = Ye(e, r);
2361
+ var Ac = Array.prototype, wc = Ac.splice;
2362
+ function Oc(r) {
2363
+ var e = this.__data__, t = Ze(e, r);
2364
2364
  if (t < 0)
2365
2365
  return !1;
2366
2366
  var i = e.length - 1;
2367
- return t == i ? e.pop() : Ac.call(e, t, 1), --this.size, !0;
2367
+ return t == i ? e.pop() : wc.call(e, t, 1), --this.size, !0;
2368
2368
  }
2369
- function Oc(r) {
2370
- var e = this.__data__, t = Ye(e, r);
2369
+ function Ic(r) {
2370
+ var e = this.__data__, t = Ze(e, r);
2371
2371
  return t < 0 ? void 0 : e[t][1];
2372
2372
  }
2373
- function Ic(r) {
2374
- return Ye(this.__data__, r) > -1;
2373
+ function Dc(r) {
2374
+ return Ze(this.__data__, r) > -1;
2375
2375
  }
2376
2376
  function Mc(r, e) {
2377
- var t = this.__data__, i = Ye(t, r);
2377
+ var t = this.__data__, i = Ze(t, r);
2378
2378
  return i < 0 ? (++this.size, t.push([r, e])) : t[i][1] = e, this;
2379
2379
  }
2380
2380
  function X(r) {
@@ -2384,39 +2384,39 @@ function X(r) {
2384
2384
  this.set(i[0], i[1]);
2385
2385
  }
2386
2386
  }
2387
- X.prototype.clear = xc;
2388
- X.prototype.delete = wc;
2389
- X.prototype.get = Oc;
2390
- X.prototype.has = Ic;
2387
+ X.prototype.clear = Rc;
2388
+ X.prototype.delete = Oc;
2389
+ X.prototype.get = Ic;
2390
+ X.prototype.has = Dc;
2391
2391
  X.prototype.set = Mc;
2392
2392
  var xe = ve(W, "Map");
2393
- function Dc() {
2393
+ function Lc() {
2394
2394
  this.size = 0, this.__data__ = {
2395
2395
  hash: new ne(),
2396
2396
  map: new (xe || X)(),
2397
2397
  string: new ne()
2398
2398
  };
2399
2399
  }
2400
- function Lc(r) {
2400
+ function Fc(r) {
2401
2401
  var e = typeof r;
2402
2402
  return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? r !== "__proto__" : r === null;
2403
2403
  }
2404
- function Ze(r, e) {
2404
+ function Qe(r, e) {
2405
2405
  var t = r.__data__;
2406
- return Lc(e) ? t[typeof e == "string" ? "string" : "hash"] : t.map;
2407
- }
2408
- function Fc(r) {
2409
- var e = Ze(this, r).delete(r);
2410
- return this.size -= e ? 1 : 0, e;
2406
+ return Fc(e) ? t[typeof e == "string" ? "string" : "hash"] : t.map;
2411
2407
  }
2412
2408
  function Nc(r) {
2413
- return Ze(this, r).get(r);
2409
+ var e = Qe(this, r).delete(r);
2410
+ return this.size -= e ? 1 : 0, e;
2414
2411
  }
2415
2412
  function Vc(r) {
2416
- return Ze(this, r).has(r);
2413
+ return Qe(this, r).get(r);
2414
+ }
2415
+ function Uc(r) {
2416
+ return Qe(this, r).has(r);
2417
2417
  }
2418
- function Uc(r, e) {
2419
- var t = Ze(this, r), i = t.size;
2418
+ function $c(r, e) {
2419
+ var t = Qe(this, r), i = t.size;
2420
2420
  return t.set(r, e), this.size += t.size == i ? 0 : 1, this;
2421
2421
  }
2422
2422
  function K(r) {
@@ -2426,15 +2426,15 @@ function K(r) {
2426
2426
  this.set(i[0], i[1]);
2427
2427
  }
2428
2428
  }
2429
- K.prototype.clear = Dc;
2430
- K.prototype.delete = Fc;
2431
- K.prototype.get = Nc;
2432
- K.prototype.has = Vc;
2433
- K.prototype.set = Uc;
2434
- var $c = "Expected a function";
2429
+ K.prototype.clear = Lc;
2430
+ K.prototype.delete = Nc;
2431
+ K.prototype.get = Vc;
2432
+ K.prototype.has = Uc;
2433
+ K.prototype.set = $c;
2434
+ var Bc = "Expected a function";
2435
2435
  function Wt(r, e) {
2436
2436
  if (typeof r != "function" || e != null && typeof e != "function")
2437
- throw new TypeError($c);
2437
+ throw new TypeError(Bc);
2438
2438
  var t = function() {
2439
2439
  var i = arguments, s = e ? e.apply(this, i) : i[0], n = t.cache;
2440
2440
  if (n.has(s))
@@ -2445,65 +2445,65 @@ function Wt(r, e) {
2445
2445
  return t.cache = new (Wt.Cache || K)(), t;
2446
2446
  }
2447
2447
  Wt.Cache = K;
2448
- var Bc = 500;
2449
- function jc(r) {
2448
+ var jc = 500;
2449
+ function zc(r) {
2450
2450
  var e = Wt(r, function(i) {
2451
- return t.size === Bc && t.clear(), i;
2451
+ return t.size === jc && t.clear(), i;
2452
2452
  }), t = e.cache;
2453
2453
  return e;
2454
2454
  }
2455
- var zc = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, Gc = /\\(\\)?/g, Hc = jc(function(r) {
2455
+ var Gc = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, Hc = /\\(\\)?/g, qc = zc(function(r) {
2456
2456
  var e = [];
2457
- return r.charCodeAt(0) === 46 && e.push(""), r.replace(zc, function(t, i, s, n) {
2458
- e.push(s ? n.replace(Gc, "$1") : i || t);
2457
+ return r.charCodeAt(0) === 46 && e.push(""), r.replace(Gc, function(t, i, s, n) {
2458
+ e.push(s ? n.replace(Hc, "$1") : i || t);
2459
2459
  }), e;
2460
2460
  });
2461
- function qc(r) {
2462
- return r == null ? "" : Ki(r);
2461
+ function Wc(r) {
2462
+ return r == null ? "" : Ji(r);
2463
2463
  }
2464
- function ss(r, e) {
2465
- return D(r) ? r : qt(r, e) ? [r] : Hc(qc(r));
2464
+ function ns(r, e) {
2465
+ return M(r) ? r : qt(r, e) ? [r] : qc(Wc(r));
2466
2466
  }
2467
- function Qe(r) {
2468
- if (typeof r == "string" || Je(r))
2467
+ function et(r) {
2468
+ if (typeof r == "string" || Ye(r))
2469
2469
  return r;
2470
2470
  var e = r + "";
2471
2471
  return e == "0" && 1 / r == -1 / 0 ? "-0" : e;
2472
2472
  }
2473
- function ns(r, e) {
2474
- e = ss(e, r);
2473
+ function os(r, e) {
2474
+ e = ns(e, r);
2475
2475
  for (var t = 0, i = e.length; r != null && t < i; )
2476
- r = r[Qe(e[t++])];
2476
+ r = r[et(e[t++])];
2477
2477
  return t && t == i ? r : void 0;
2478
2478
  }
2479
- function Wc(r, e, t) {
2480
- var i = r == null ? void 0 : ns(r, e);
2479
+ function Xc(r, e, t) {
2480
+ var i = r == null ? void 0 : os(r, e);
2481
2481
  return i === void 0 ? t : i;
2482
2482
  }
2483
- function Xc(r, e) {
2483
+ function Kc(r, e) {
2484
2484
  for (var t = -1, i = e.length, s = r.length; ++t < i; )
2485
2485
  r[s + t] = e[t];
2486
2486
  return r;
2487
2487
  }
2488
- function Kc() {
2488
+ function Jc() {
2489
2489
  this.__data__ = new X(), this.size = 0;
2490
2490
  }
2491
- function Jc(r) {
2491
+ function Yc(r) {
2492
2492
  var e = this.__data__, t = e.delete(r);
2493
2493
  return this.size = e.size, t;
2494
2494
  }
2495
- function Yc(r) {
2495
+ function Zc(r) {
2496
2496
  return this.__data__.get(r);
2497
2497
  }
2498
- function Zc(r) {
2498
+ function Qc(r) {
2499
2499
  return this.__data__.has(r);
2500
2500
  }
2501
- var Qc = 200;
2502
- function ed(r, e) {
2501
+ var ed = 200;
2502
+ function td(r, e) {
2503
2503
  var t = this.__data__;
2504
2504
  if (t instanceof X) {
2505
2505
  var i = t.__data__;
2506
- if (!xe || i.length < Qc - 1)
2506
+ if (!xe || i.length < ed - 1)
2507
2507
  return i.push([r, e]), this.size = ++t.size, this;
2508
2508
  t = this.__data__ = new K(i);
2509
2509
  }
@@ -2513,56 +2513,56 @@ function H(r) {
2513
2513
  var e = this.__data__ = new X(r);
2514
2514
  this.size = e.size;
2515
2515
  }
2516
- H.prototype.clear = Kc;
2517
- H.prototype.delete = Jc;
2518
- H.prototype.get = Yc;
2519
- H.prototype.has = Zc;
2520
- H.prototype.set = ed;
2521
- function os(r, e) {
2516
+ H.prototype.clear = Jc;
2517
+ H.prototype.delete = Yc;
2518
+ H.prototype.get = Zc;
2519
+ H.prototype.has = Qc;
2520
+ H.prototype.set = td;
2521
+ function as(r, e) {
2522
2522
  for (var t = -1, i = r == null ? 0 : r.length, s = 0, n = []; ++t < i; ) {
2523
2523
  var a = r[t];
2524
2524
  e(a, t, r) && (n[s++] = a);
2525
2525
  }
2526
2526
  return n;
2527
2527
  }
2528
- function td() {
2528
+ function rd() {
2529
2529
  return [];
2530
2530
  }
2531
- var rd = Object.prototype, id = rd.propertyIsEnumerable, Wr = Object.getOwnPropertySymbols, sd = Wr ? function(r) {
2532
- return r == null ? [] : (r = Object(r), os(Wr(r), function(e) {
2533
- return id.call(r, e);
2531
+ var id = Object.prototype, sd = id.propertyIsEnumerable, Wr = Object.getOwnPropertySymbols, nd = Wr ? function(r) {
2532
+ return r == null ? [] : (r = Object(r), as(Wr(r), function(e) {
2533
+ return sd.call(r, e);
2534
2534
  }));
2535
- } : td;
2536
- function nd(r, e, t) {
2535
+ } : rd;
2536
+ function od(r, e, t) {
2537
2537
  var i = e(r);
2538
- return D(r) ? i : Xc(i, t(r));
2538
+ return M(r) ? i : Kc(i, t(r));
2539
2539
  }
2540
2540
  function Xr(r) {
2541
- return nd(r, Ae, sd);
2541
+ return od(r, Ae, nd);
2542
2542
  }
2543
- var kt = ve(W, "DataView"), Pt = ve(W, "Promise"), xt = ve(W, "Set"), Kr = "[object Map]", od = "[object Object]", Jr = "[object Promise]", Yr = "[object Set]", Zr = "[object WeakMap]", Qr = "[object DataView]", ad = ae(kt), cd = ae(xe), dd = ae(Pt), ud = ae(xt), hd = ae(Et), J = ge;
2544
- (kt && J(new kt(new ArrayBuffer(1))) != Qr || xe && J(new xe()) != Kr || Pt && J(Pt.resolve()) != Jr || xt && J(new xt()) != Yr || Et && J(new Et()) != Zr) && (J = function(r) {
2545
- var e = ge(r), t = e == od ? r.constructor : void 0, i = t ? ae(t) : "";
2543
+ var Pt = ve(W, "DataView"), xt = ve(W, "Promise"), Rt = ve(W, "Set"), Kr = "[object Map]", ad = "[object Object]", Jr = "[object Promise]", Yr = "[object Set]", Zr = "[object WeakMap]", Qr = "[object DataView]", cd = ae(Pt), dd = ae(xe), ud = ae(xt), hd = ae(Rt), pd = ae(bt), J = ge;
2544
+ (Pt && J(new Pt(new ArrayBuffer(1))) != Qr || xe && J(new xe()) != Kr || xt && J(xt.resolve()) != Jr || Rt && J(new Rt()) != Yr || bt && J(new bt()) != Zr) && (J = function(r) {
2545
+ var e = ge(r), t = e == ad ? r.constructor : void 0, i = t ? ae(t) : "";
2546
2546
  if (i)
2547
2547
  switch (i) {
2548
- case ad:
2549
- return Qr;
2550
2548
  case cd:
2551
- return Kr;
2549
+ return Qr;
2552
2550
  case dd:
2553
- return Jr;
2551
+ return Kr;
2554
2552
  case ud:
2555
- return Yr;
2553
+ return Jr;
2556
2554
  case hd:
2555
+ return Yr;
2556
+ case pd:
2557
2557
  return Zr;
2558
2558
  }
2559
2559
  return e;
2560
2560
  });
2561
- var ei = W.Uint8Array, pd = "__lodash_hash_undefined__";
2562
- function ld(r) {
2563
- return this.__data__.set(r, pd), this;
2564
- }
2561
+ var ei = W.Uint8Array, ld = "__lodash_hash_undefined__";
2565
2562
  function md(r) {
2563
+ return this.__data__.set(r, ld), this;
2564
+ }
2565
+ function fd(r) {
2566
2566
  return this.__data__.has(r);
2567
2567
  }
2568
2568
  function je(r) {
@@ -2570,26 +2570,26 @@ function je(r) {
2570
2570
  for (this.__data__ = new K(); ++e < t; )
2571
2571
  this.add(r[e]);
2572
2572
  }
2573
- je.prototype.add = je.prototype.push = ld;
2574
- je.prototype.has = md;
2575
- function fd(r, e) {
2573
+ je.prototype.add = je.prototype.push = md;
2574
+ je.prototype.has = fd;
2575
+ function _d(r, e) {
2576
2576
  for (var t = -1, i = r == null ? 0 : r.length; ++t < i; )
2577
2577
  if (e(r[t], t, r))
2578
2578
  return !0;
2579
2579
  return !1;
2580
2580
  }
2581
- function _d(r, e) {
2581
+ function gd(r, e) {
2582
2582
  return r.has(e);
2583
2583
  }
2584
- var gd = 1, vd = 2;
2585
- function as(r, e, t, i, s, n) {
2586
- var a = t & gd, o = r.length, u = e.length;
2584
+ var vd = 1, Cd = 2;
2585
+ function cs(r, e, t, i, s, n) {
2586
+ var a = t & vd, o = r.length, u = e.length;
2587
2587
  if (o != u && !(a && u > o))
2588
2588
  return !1;
2589
- var c = n.get(r), d = n.get(e);
2590
- if (c && d)
2591
- return c == e && d == r;
2592
- var h = -1, p = !0, l = t & vd ? new je() : void 0;
2589
+ var d = n.get(r), c = n.get(e);
2590
+ if (d && c)
2591
+ return d == e && c == r;
2592
+ var h = -1, p = !0, l = t & Cd ? new je() : void 0;
2593
2593
  for (n.set(r, e), n.set(e, r); ++h < o; ) {
2594
2594
  var f = r[h], g = e[h];
2595
2595
  if (i)
@@ -2601,8 +2601,8 @@ function as(r, e, t, i, s, n) {
2601
2601
  break;
2602
2602
  }
2603
2603
  if (l) {
2604
- if (!fd(e, function(T, b) {
2605
- if (!_d(l, b) && (f === T || s(f, T, t, i, n)))
2604
+ if (!_d(e, function(T, b) {
2605
+ if (!gd(l, b) && (f === T || s(f, T, t, i, n)))
2606
2606
  return l.push(b);
2607
2607
  })) {
2608
2608
  p = !1;
@@ -2615,62 +2615,62 @@ function as(r, e, t, i, s, n) {
2615
2615
  }
2616
2616
  return n.delete(r), n.delete(e), p;
2617
2617
  }
2618
- function Cd(r) {
2618
+ function yd(r) {
2619
2619
  var e = -1, t = Array(r.size);
2620
2620
  return r.forEach(function(i, s) {
2621
2621
  t[++e] = [s, i];
2622
2622
  }), t;
2623
2623
  }
2624
- function yd(r) {
2624
+ function Sd(r) {
2625
2625
  var e = -1, t = Array(r.size);
2626
2626
  return r.forEach(function(i) {
2627
2627
  t[++e] = i;
2628
2628
  }), t;
2629
2629
  }
2630
- var Sd = 1, Td = 2, Ed = "[object Boolean]", bd = "[object Date]", kd = "[object Error]", Pd = "[object Map]", xd = "[object Number]", Rd = "[object RegExp]", Ad = "[object Set]", wd = "[object String]", Od = "[object Symbol]", Id = "[object ArrayBuffer]", Md = "[object DataView]", ti = Q ? Q.prototype : void 0, ut = ti ? ti.valueOf : void 0;
2631
- function Dd(r, e, t, i, s, n, a) {
2630
+ var Td = 1, Ed = 2, bd = "[object Boolean]", kd = "[object Date]", Pd = "[object Error]", xd = "[object Map]", Rd = "[object Number]", Ad = "[object RegExp]", wd = "[object Set]", Od = "[object String]", Id = "[object Symbol]", Dd = "[object ArrayBuffer]", Md = "[object DataView]", ti = Q ? Q.prototype : void 0, ht = ti ? ti.valueOf : void 0;
2631
+ function Ld(r, e, t, i, s, n, a) {
2632
2632
  switch (t) {
2633
2633
  case Md:
2634
2634
  if (r.byteLength != e.byteLength || r.byteOffset != e.byteOffset)
2635
2635
  return !1;
2636
2636
  r = r.buffer, e = e.buffer;
2637
- case Id:
2637
+ case Dd:
2638
2638
  return !(r.byteLength != e.byteLength || !n(new ei(r), new ei(e)));
2639
- case Ed:
2640
2639
  case bd:
2641
- case xd:
2642
- return Zi(+r, +e);
2643
2640
  case kd:
2644
- return r.name == e.name && r.message == e.message;
2645
2641
  case Rd:
2646
- case wd:
2647
- return r == e + "";
2642
+ return Qi(+r, +e);
2648
2643
  case Pd:
2649
- var o = Cd;
2644
+ return r.name == e.name && r.message == e.message;
2650
2645
  case Ad:
2651
- var u = i & Sd;
2652
- if (o || (o = yd), r.size != e.size && !u)
2653
- return !1;
2654
- var c = a.get(r);
2655
- if (c)
2656
- return c == e;
2657
- i |= Td, a.set(r, e);
2658
- var d = as(o(r), o(e), i, s, n, a);
2659
- return a.delete(r), d;
2660
2646
  case Od:
2661
- if (ut)
2662
- return ut.call(r) == ut.call(e);
2647
+ return r == e + "";
2648
+ case xd:
2649
+ var o = yd;
2650
+ case wd:
2651
+ var u = i & Td;
2652
+ if (o || (o = Sd), r.size != e.size && !u)
2653
+ return !1;
2654
+ var d = a.get(r);
2655
+ if (d)
2656
+ return d == e;
2657
+ i |= Ed, a.set(r, e);
2658
+ var c = cs(o(r), o(e), i, s, n, a);
2659
+ return a.delete(r), c;
2660
+ case Id:
2661
+ if (ht)
2662
+ return ht.call(r) == ht.call(e);
2663
2663
  }
2664
2664
  return !1;
2665
2665
  }
2666
- var Ld = 1, Fd = Object.prototype, Nd = Fd.hasOwnProperty;
2667
- function Vd(r, e, t, i, s, n) {
2668
- var a = t & Ld, o = Xr(r), u = o.length, c = Xr(e), d = c.length;
2669
- if (u != d && !a)
2666
+ var Fd = 1, Nd = Object.prototype, Vd = Nd.hasOwnProperty;
2667
+ function Ud(r, e, t, i, s, n) {
2668
+ var a = t & Fd, o = Xr(r), u = o.length, d = Xr(e), c = d.length;
2669
+ if (u != c && !a)
2670
2670
  return !1;
2671
2671
  for (var h = u; h--; ) {
2672
2672
  var p = o[h];
2673
- if (!(a ? p in e : Nd.call(e, p)))
2673
+ if (!(a ? p in e : Vd.call(e, p)))
2674
2674
  return !1;
2675
2675
  }
2676
2676
  var l = n.get(r), f = n.get(e);
@@ -2695,32 +2695,32 @@ function Vd(r, e, t, i, s, n) {
2695
2695
  }
2696
2696
  return n.delete(r), n.delete(e), g;
2697
2697
  }
2698
- var Ud = 1, ri = "[object Arguments]", ii = "[object Array]", Me = "[object Object]", $d = Object.prototype, si = $d.hasOwnProperty;
2699
- function Bd(r, e, t, i, s, n) {
2700
- var a = D(r), o = D(e), u = a ? ii : J(r), c = o ? ii : J(e);
2701
- u = u == ri ? Me : u, c = c == ri ? Me : c;
2702
- var d = u == Me, h = c == Me, p = u == c;
2703
- if (p && bt(r)) {
2704
- if (!bt(e))
2698
+ var $d = 1, ri = "[object Arguments]", ii = "[object Array]", De = "[object Object]", Bd = Object.prototype, si = Bd.hasOwnProperty;
2699
+ function jd(r, e, t, i, s, n) {
2700
+ var a = M(r), o = M(e), u = a ? ii : J(r), d = o ? ii : J(e);
2701
+ u = u == ri ? De : u, d = d == ri ? De : d;
2702
+ var c = u == De, h = d == De, p = u == d;
2703
+ if (p && kt(r)) {
2704
+ if (!kt(e))
2705
2705
  return !1;
2706
- a = !0, d = !1;
2706
+ a = !0, c = !1;
2707
2707
  }
2708
- if (p && !d)
2709
- return n || (n = new H()), a || is(r) ? as(r, e, t, i, s, n) : Dd(r, e, u, t, i, s, n);
2710
- if (!(t & Ud)) {
2711
- var l = d && si.call(r, "__wrapped__"), f = h && si.call(e, "__wrapped__");
2708
+ if (p && !c)
2709
+ return n || (n = new H()), a || ss(r) ? cs(r, e, t, i, s, n) : Ld(r, e, u, t, i, s, n);
2710
+ if (!(t & $d)) {
2711
+ var l = c && si.call(r, "__wrapped__"), f = h && si.call(e, "__wrapped__");
2712
2712
  if (l || f) {
2713
2713
  var g = l ? r.value() : r, _ = f ? e.value() : e;
2714
2714
  return n || (n = new H()), s(g, _, t, i, n);
2715
2715
  }
2716
2716
  }
2717
- return p ? (n || (n = new H()), Vd(r, e, t, i, s, n)) : !1;
2717
+ return p ? (n || (n = new H()), Ud(r, e, t, i, s, n)) : !1;
2718
2718
  }
2719
2719
  function Xt(r, e, t, i, s) {
2720
- return r === e ? !0 : r == null || e == null || !me(r) && !me(e) ? r !== r && e !== e : Bd(r, e, t, i, Xt, s);
2720
+ return r === e ? !0 : r == null || e == null || !me(r) && !me(e) ? r !== r && e !== e : jd(r, e, t, i, Xt, s);
2721
2721
  }
2722
- var jd = 1, zd = 2;
2723
- function Gd(r, e, t, i) {
2722
+ var zd = 1, Gd = 2;
2723
+ function Hd(r, e, t, i) {
2724
2724
  var s = t.length, n = s;
2725
2725
  if (r == null)
2726
2726
  return !n;
@@ -2731,79 +2731,79 @@ function Gd(r, e, t, i) {
2731
2731
  }
2732
2732
  for (; ++s < n; ) {
2733
2733
  a = t[s];
2734
- var o = a[0], u = r[o], c = a[1];
2734
+ var o = a[0], u = r[o], d = a[1];
2735
2735
  if (a[2]) {
2736
2736
  if (u === void 0 && !(o in r))
2737
2737
  return !1;
2738
2738
  } else {
2739
- var d = new H(), h;
2740
- if (!(h === void 0 ? Xt(c, u, jd | zd, i, d) : h))
2739
+ var c = new H(), h;
2740
+ if (!(h === void 0 ? Xt(d, u, zd | Gd, i, c) : h))
2741
2741
  return !1;
2742
2742
  }
2743
2743
  }
2744
2744
  return !0;
2745
2745
  }
2746
- function cs(r) {
2746
+ function ds(r) {
2747
2747
  return r === r && !ke(r);
2748
2748
  }
2749
- function Hd(r) {
2749
+ function qd(r) {
2750
2750
  for (var e = Ae(r), t = e.length; t--; ) {
2751
2751
  var i = e[t], s = r[i];
2752
- e[t] = [i, s, cs(s)];
2752
+ e[t] = [i, s, ds(s)];
2753
2753
  }
2754
2754
  return e;
2755
2755
  }
2756
- function ds(r, e) {
2756
+ function us(r, e) {
2757
2757
  return function(t) {
2758
2758
  return t == null ? !1 : t[r] === e && (e !== void 0 || r in Object(t));
2759
2759
  };
2760
2760
  }
2761
- function qd(r) {
2762
- var e = Hd(r);
2763
- return e.length == 1 && e[0][2] ? ds(e[0][0], e[0][1]) : function(t) {
2764
- return t === r || Gd(t, r, e);
2761
+ function Wd(r) {
2762
+ var e = qd(r);
2763
+ return e.length == 1 && e[0][2] ? us(e[0][0], e[0][1]) : function(t) {
2764
+ return t === r || Hd(t, r, e);
2765
2765
  };
2766
2766
  }
2767
- function Wd(r, e) {
2767
+ function Xd(r, e) {
2768
2768
  return r != null && e in Object(r);
2769
2769
  }
2770
- function Xd(r, e, t) {
2771
- e = ss(e, r);
2770
+ function Kd(r, e, t) {
2771
+ e = ns(e, r);
2772
2772
  for (var i = -1, s = e.length, n = !1; ++i < s; ) {
2773
- var a = Qe(e[i]);
2773
+ var a = et(e[i]);
2774
2774
  if (!(n = r != null && t(r, a)))
2775
2775
  break;
2776
2776
  r = r[a];
2777
2777
  }
2778
- return n || ++i != s ? n : (s = r == null ? 0 : r.length, !!s && Gt(s) && Yi(a, s) && (D(r) || es(r)));
2778
+ return n || ++i != s ? n : (s = r == null ? 0 : r.length, !!s && Gt(s) && Zi(a, s) && (M(r) || ts(r)));
2779
2779
  }
2780
- function Kd(r, e) {
2781
- return r != null && Xd(r, e, Wd);
2780
+ function Jd(r, e) {
2781
+ return r != null && Kd(r, e, Xd);
2782
2782
  }
2783
- var Jd = 1, Yd = 2;
2784
- function Zd(r, e) {
2785
- return qt(r) && cs(e) ? ds(Qe(r), e) : function(t) {
2786
- var i = Wc(t, r);
2787
- return i === void 0 && i === e ? Kd(t, r) : Xt(e, i, Jd | Yd);
2783
+ var Yd = 1, Zd = 2;
2784
+ function Qd(r, e) {
2785
+ return qt(r) && ds(e) ? us(et(r), e) : function(t) {
2786
+ var i = Xc(t, r);
2787
+ return i === void 0 && i === e ? Jd(t, r) : Xt(e, i, Yd | Zd);
2788
2788
  };
2789
2789
  }
2790
- function Qd(r) {
2790
+ function eu(r) {
2791
2791
  return function(e) {
2792
2792
  return e == null ? void 0 : e[r];
2793
2793
  };
2794
2794
  }
2795
- function eu(r) {
2795
+ function tu(r) {
2796
2796
  return function(e) {
2797
- return ns(e, r);
2797
+ return os(e, r);
2798
2798
  };
2799
2799
  }
2800
- function tu(r) {
2801
- return qt(r) ? Qd(Qe(r)) : eu(r);
2800
+ function ru(r) {
2801
+ return qt(r) ? eu(et(r)) : tu(r);
2802
2802
  }
2803
2803
  function Kt(r) {
2804
- return typeof r == "function" ? r : r == null ? ia : typeof r == "object" ? D(r) ? Zd(r[0], r[1]) : qd(r) : tu(r);
2804
+ return typeof r == "function" ? r : r == null ? sa : typeof r == "object" ? M(r) ? Qd(r[0], r[1]) : Wd(r) : ru(r);
2805
2805
  }
2806
- function ru(r) {
2806
+ function iu(r) {
2807
2807
  return function(e, t, i) {
2808
2808
  for (var s = -1, n = Object(e), a = i(e), o = a.length; o--; ) {
2809
2809
  var u = a[++s];
@@ -2813,11 +2813,11 @@ function ru(r) {
2813
2813
  return e;
2814
2814
  };
2815
2815
  }
2816
- var iu = ru();
2817
- function su(r, e) {
2818
- return r && iu(r, e, Ae);
2819
- }
2816
+ var su = iu();
2820
2817
  function nu(r, e) {
2818
+ return r && su(r, e, Ae);
2819
+ }
2820
+ function ou(r, e) {
2821
2821
  return function(t, i) {
2822
2822
  if (t == null)
2823
2823
  return t;
@@ -2828,18 +2828,18 @@ function nu(r, e) {
2828
2828
  return t;
2829
2829
  };
2830
2830
  }
2831
- var ou = nu(su);
2832
- function au(r, e) {
2831
+ var au = ou(nu);
2832
+ function cu(r, e) {
2833
2833
  var t = [];
2834
- return ou(r, function(i, s, n) {
2834
+ return au(r, function(i, s, n) {
2835
2835
  e(i, s, n) && t.push(i);
2836
2836
  }), t;
2837
2837
  }
2838
- function us(r, e) {
2839
- var t = D(r) ? os : au;
2838
+ function hs(r, e) {
2839
+ var t = M(r) ? as : cu;
2840
2840
  return t(r, Kt(e));
2841
2841
  }
2842
- function cu(r) {
2842
+ function du(r) {
2843
2843
  return function(e, t, i) {
2844
2844
  var s = Object(e);
2845
2845
  if (!Ht(e)) {
@@ -2852,27 +2852,27 @@ function cu(r) {
2852
2852
  return a > -1 ? s[n ? e[a] : a] : void 0;
2853
2853
  };
2854
2854
  }
2855
- var du = Math.max;
2856
- function uu(r, e, t) {
2855
+ var uu = Math.max;
2856
+ function hu(r, e, t) {
2857
2857
  var i = r == null ? 0 : r.length;
2858
2858
  if (!i)
2859
2859
  return -1;
2860
- var s = t == null ? 0 : ra(t);
2861
- return s < 0 && (s = du(i + s, 0)), ya(r, Kt(e), s);
2860
+ var s = t == null ? 0 : ia(t);
2861
+ return s < 0 && (s = uu(i + s, 0)), Sa(r, Kt(e), s);
2862
2862
  }
2863
- var Re = cu(uu);
2864
- function hu(r, e) {
2865
- return Xi(e, function(t) {
2863
+ var Re = du(hu);
2864
+ function pu(r, e) {
2865
+ return Ki(e, function(t) {
2866
2866
  return r[t];
2867
2867
  });
2868
2868
  }
2869
2869
  function ue(r) {
2870
- return r == null ? [] : hu(r, Ae(r));
2870
+ return r == null ? [] : pu(r, Ae(r));
2871
2871
  }
2872
- function pu(r) {
2872
+ function lu(r) {
2873
2873
  return r == null;
2874
2874
  }
2875
- class lu extends Ke {
2875
+ class mu extends Je {
2876
2876
  constructor(e) {
2877
2877
  super({
2878
2878
  type: S.Microphone,
@@ -2892,7 +2892,7 @@ class lu extends Ke {
2892
2892
  this.source.destroy();
2893
2893
  }
2894
2894
  }
2895
- class mu extends _e {
2895
+ class fu extends _e {
2896
2896
  constructor(e) {
2897
2897
  super({
2898
2898
  type: S.VideoFile,
@@ -2924,7 +2924,7 @@ class mu extends _e {
2924
2924
  (e = this._videoStream) == null || e.destroy(), (t = this._audioStream) == null || t.destroy(), delete this._trackMap.video, delete this._trackMap.audio;
2925
2925
  }
2926
2926
  }
2927
- class fu extends _e {
2927
+ class _u extends _e {
2928
2928
  constructor(e) {
2929
2929
  super({
2930
2930
  type: S.Screen,
@@ -2956,7 +2956,7 @@ class fu extends _e {
2956
2956
  (e = this._videoStream) == null || e.destroy(), (t = this._audioStream) == null || t.destroy(), delete this._trackMap.video, delete this._trackMap.audio;
2957
2957
  }
2958
2958
  }
2959
- class _u extends Ke {
2959
+ class gu extends Je {
2960
2960
  constructor(e) {
2961
2961
  super({
2962
2962
  type: S.AudioFile,
@@ -2981,7 +2981,7 @@ class _u extends Ke {
2981
2981
  (e = this._audioStream) == null || e.destroy();
2982
2982
  }
2983
2983
  }
2984
- class gu extends _e {
2984
+ class vu extends _e {
2985
2985
  constructor(e) {
2986
2986
  super({
2987
2987
  type: S.Image,
@@ -3004,7 +3004,7 @@ class gu extends _e {
3004
3004
  this.source.destroy();
3005
3005
  }
3006
3006
  }
3007
- class vu extends _e {
3007
+ class Cu extends _e {
3008
3008
  constructor(e) {
3009
3009
  super({
3010
3010
  type: S.CustomVideo,
@@ -3027,7 +3027,7 @@ class vu extends _e {
3027
3027
  this.source.destroy();
3028
3028
  }
3029
3029
  }
3030
- class Cu extends Ke {
3030
+ class yu extends Je {
3031
3031
  constructor(e) {
3032
3032
  super({
3033
3033
  type: S.CustomAudio,
@@ -3050,7 +3050,7 @@ class Cu extends Ke {
3050
3050
  (e = this._audioStream) == null || e.destroy();
3051
3051
  }
3052
3052
  }
3053
- const yu = ["user", "environment"];
3053
+ const Su = ["user", "environment"];
3054
3054
  var V = /* @__PURE__ */ ((r) => (r[r.OPEN_CAMERA_FAILED = 1001] = "OPEN_CAMERA_FAILED", r[r.OPEN_MICROPHONE_FAILED = 1002] = "OPEN_MICROPHONE_FAILED", r[r.OPEN_SCREEN_FAILED = 1003] = "OPEN_SCREEN_FAILED", r[r.VIDEO_FILE_CAPTURE_FAILED = 1004] = "VIDEO_FILE_CAPTURE_FAILED", r[r.AUDIO_FILE_CAPTURE_FAILED = 1005] = "AUDIO_FILE_CAPTURE_FAILED", r[r.IMAGE_FILE_CAPTURE_FAILED = 1006] = "IMAGE_FILE_CAPTURE_FAILED", r[r.VOLUME_DETECT_FAILED = 1008] = "VOLUME_DETECT_FAILED", r[r.PUBLISH_FAILED = 2001] = "PUBLISH_FAILED", r[r.UPDATE_PUBLISH_FAILED = 2002] = "UPDATE_PUBLISH_FAILED", r[r.PUSH_CONNECT_FAILED = 2003] = "PUSH_CONNECT_FAILED", r))(V || {});
3055
3055
  class Te extends Error {
3056
3056
  constructor(e, t, i) {
@@ -3058,12 +3058,12 @@ class Te extends Error {
3058
3058
  }
3059
3059
  }
3060
3060
  function fe(r, e, t) {
3061
- const i = _t.Landscape;
3061
+ const i = gt.Landscape;
3062
3062
  if (e === "video") {
3063
- const u = (i === _t.Landscape ? Ri : Ai)[r], [c, d, h, p] = u.split("x").map((l) => Number(l));
3063
+ const u = (i === gt.Landscape ? Ri : Ai)[r], [d, c, h, p] = u.split("x").map((l) => Number(l));
3064
3064
  return {
3065
- width: c,
3066
- height: d,
3065
+ width: d,
3066
+ height: c,
3067
3067
  frameRate: h,
3068
3068
  bitrate: p * 1e3
3069
3069
  };
@@ -3074,7 +3074,7 @@ function fe(r, e, t) {
3074
3074
  bitrate: a * 1e3
3075
3075
  };
3076
3076
  }
3077
- class Su extends te {
3077
+ class Tu extends te {
3078
3078
  constructor() {
3079
3079
  super(), this._videoConstraints = {
3080
3080
  width: 1080,
@@ -3084,7 +3084,7 @@ class Su extends te {
3084
3084
  const { width: e, height: t, frameRate: i } = fe(
3085
3085
  Ii,
3086
3086
  "video"
3087
- ), { sampleRate: s } = fe(Mi, "audio");
3087
+ ), { sampleRate: s } = fe(Di, "audio");
3088
3088
  this._videoConstraints = {
3089
3089
  width: e,
3090
3090
  height: t,
@@ -3133,7 +3133,7 @@ class Su extends te {
3133
3133
  };
3134
3134
  }
3135
3135
  async getDevicesList(e) {
3136
- return ro(
3136
+ return io(
3137
3137
  e ? [e] : ["audioinput", "videoinput"]
3138
3138
  );
3139
3139
  }
@@ -3185,13 +3185,13 @@ class Su extends te {
3185
3185
  }
3186
3186
  async startCameraCapture(e) {
3187
3187
  let t = {};
3188
- yu.includes(e) ? t = {
3188
+ Su.includes(e) ? t = {
3189
3189
  facingMode: e
3190
3190
  } : t = {
3191
3191
  deviceId: e
3192
3192
  };
3193
3193
  try {
3194
- const i = await io({
3194
+ const i = await so({
3195
3195
  ...t,
3196
3196
  ...this._videoConstraints
3197
3197
  }), s = new Mo(i);
@@ -3202,10 +3202,10 @@ class Su extends te {
3202
3202
  }
3203
3203
  async startMicrophoneCapture(e) {
3204
3204
  try {
3205
- const t = await no({
3205
+ const t = await oo({
3206
3206
  ...this._audioConstraints,
3207
3207
  deviceId: e
3208
- }), i = new lu(t);
3208
+ }), i = new mu(t);
3209
3209
  return this._microphoneStreams[i.id] = i, this._notifyCaptured(i), this._bindStreamEvent(i), i.id;
3210
3210
  } catch (t) {
3211
3211
  throw this._handleError(
@@ -3216,10 +3216,10 @@ class Su extends te {
3216
3216
  }
3217
3217
  async startScreenCapture(e) {
3218
3218
  try {
3219
- const t = await oo({
3219
+ const t = await ao({
3220
3220
  audio: e,
3221
3221
  video: this._videoConstraints
3222
- }), i = new fu(t);
3222
+ }), i = new _u(t);
3223
3223
  return this._screenStreams[i.id] = i, this._notifyCaptured(i), this._bindStreamEvent(i), i.id;
3224
3224
  } catch (t) {
3225
3225
  throw this._handleError(t, V.OPEN_SCREEN_FAILED), t;
@@ -3227,12 +3227,12 @@ class Su extends te {
3227
3227
  }
3228
3228
  async startVideoFileCapture(e) {
3229
3229
  try {
3230
- const t = await Mr({
3230
+ const t = await Dr({
3231
3231
  url: e,
3232
3232
  video: !0,
3233
3233
  audio: !0,
3234
3234
  loop: !0
3235
- }), i = new mu(t);
3235
+ }), i = new fu(t);
3236
3236
  return this._videoFileStreams[i.id] = i, this._notifyCaptured(i), this._bindStreamEvent(i), i.id;
3237
3237
  } catch (t) {
3238
3238
  throw this._handleError(
@@ -3243,12 +3243,12 @@ class Su extends te {
3243
3243
  }
3244
3244
  async startAudioFileCapture(e) {
3245
3245
  try {
3246
- const t = await Mr({
3246
+ const t = await Dr({
3247
3247
  url: e,
3248
3248
  video: !1,
3249
3249
  audio: !0,
3250
3250
  loop: !0
3251
- }), i = new _u(t);
3251
+ }), i = new gu(t);
3252
3252
  return this._audioFileStreams[i.id] = i, this._notifyCaptured(i), this._bindStreamEvent(i), i.id;
3253
3253
  } catch (t) {
3254
3254
  throw this._handleError(
@@ -3259,12 +3259,12 @@ class Su extends te {
3259
3259
  }
3260
3260
  async startImageCapture(e) {
3261
3261
  try {
3262
- const t = await so({
3262
+ const t = await no({
3263
3263
  url: e,
3264
3264
  width: 0,
3265
3265
  height: 0,
3266
3266
  frameRate: 30
3267
- }), i = new gu(t);
3267
+ }), i = new vu(t);
3268
3268
  return this._imageStreams[i.id] = i, this._notifyCaptured(i), this._bindStreamEvent(i), i.id;
3269
3269
  } catch (t) {
3270
3270
  throw this._handleError(
@@ -3274,16 +3274,16 @@ class Su extends te {
3274
3274
  }
3275
3275
  }
3276
3276
  startCustomVideoCapture(e) {
3277
- const t = co(e);
3277
+ const t = uo(e);
3278
3278
  if (t) {
3279
- const i = new vu(t);
3279
+ const i = new Cu(t);
3280
3280
  return this._customVideoStreams[i.id] = i, this._notifyCaptured(i), this._bindStreamEvent(i), i.id;
3281
3281
  }
3282
3282
  }
3283
3283
  startCustomAudioCapture(e) {
3284
- const t = uo(e);
3284
+ const t = ho(e);
3285
3285
  if (t) {
3286
- const i = new Cu(t);
3286
+ const i = new yu(t);
3287
3287
  return this._customAudioStreams[i.id] = i, this._notifyCaptured(i), this._bindStreamEvent(i), i.id;
3288
3288
  }
3289
3289
  }
@@ -3385,7 +3385,7 @@ class Jt {
3385
3385
  }
3386
3386
  }
3387
3387
  const ni = new ce("SingleComposer");
3388
- class Tu extends Jt {
3388
+ class Eu extends Jt {
3389
3389
  onStreamCapture(e) {
3390
3390
  e.isVideoStream ? this._handleVideoStreamCapture(e) : this._handleAudioStreamCapture(e);
3391
3391
  }
@@ -3456,7 +3456,7 @@ class Tu extends Jt {
3456
3456
  return this._composedStream;
3457
3457
  }
3458
3458
  }
3459
- class Eu extends te {
3459
+ class bu extends te {
3460
3460
  constructor(e, {
3461
3461
  width: t,
3462
3462
  height: i,
@@ -3504,7 +3504,7 @@ class Eu extends te {
3504
3504
  };
3505
3505
  }
3506
3506
  _bindVideoTrackSizeChange() {
3507
- this._stream.on(Ft.SizeChange, ({ width: e, height: t }) => {
3507
+ this._stream.on(Nt.SizeChange, ({ width: e, height: t }) => {
3508
3508
  this.setBaseProps("sourceWidth", e), this.setBaseProps("sourceHeight", t);
3509
3509
  });
3510
3510
  }
@@ -3625,16 +3625,16 @@ class oi extends _e {
3625
3625
  this.source.stop(), delete this._trackMap.video;
3626
3626
  }
3627
3627
  }
3628
- var bu = Object.defineProperty, ku = Object.getOwnPropertyDescriptor, we = (r, e, t, i) => {
3629
- for (var s = ku(e, t), n = r.length - 1, a; n >= 0; n--)
3628
+ var ku = Object.defineProperty, Pu = Object.getOwnPropertyDescriptor, we = (r, e, t, i) => {
3629
+ for (var s = Pu(e, t), n = r.length - 1, a; n >= 0; n--)
3630
3630
  (a = r[n]) && (s = a(e, t, s) || s);
3631
- return s && bu(e, t, s), s;
3631
+ return s && ku(e, t, s), s;
3632
3632
  };
3633
- const hs = new ce("composition-composer");
3633
+ const ps = new ce("composition-composer");
3634
3634
  function Oe(r, e, t) {
3635
3635
  const i = t.value;
3636
3636
  return t.value = function(...s) {
3637
- return this._active || hs.error("composer is not active"), i.apply(this, s);
3637
+ return this._active || ps.error("composer is not active"), i.apply(this, s);
3638
3638
  }, t;
3639
3639
  }
3640
3640
  class Ce extends Jt {
@@ -3644,7 +3644,7 @@ class Ce extends Jt {
3644
3644
  height: 720,
3645
3645
  frameRate: 30,
3646
3646
  backgroundColor: "#000000"
3647
- }, this._sprites = [], this._videoMixer = new Ro();
3647
+ }, this._sprites = [], this._videoMixer = new Ao();
3648
3648
  }
3649
3649
  onStreamCapture(e) {
3650
3650
  }
@@ -3660,7 +3660,7 @@ class Ce extends Jt {
3660
3660
  super.disable(), this._videoMixer.stop();
3661
3661
  }
3662
3662
  _updateSpriteToMixer() {
3663
- const e = us(
3663
+ const e = hs(
3664
3664
  this._sprites.map((t) => t.isHidden ? null : t.getViewNode())
3665
3665
  );
3666
3666
  this._videoMixer.draw(e);
@@ -3670,7 +3670,7 @@ class Ce extends Jt {
3670
3670
  }
3671
3671
  _addSprite(e) {
3672
3672
  this._sprites.push(e), this._sprites = this._sprites.sort((t, i) => t.zOrder - i.zOrder), e.on("propsChange", (t) => {
3673
- pu(t.zOrder) || (this._sprites = this._sprites.sort(
3673
+ lu(t.zOrder) || (this._sprites = this._sprites.sort(
3674
3674
  (i, s) => i.zOrder - s.zOrder
3675
3675
  )), this._updateSpriteToMixer();
3676
3676
  }), this._updateSpriteToMixer();
@@ -3687,14 +3687,14 @@ class Ce extends Jt {
3687
3687
  }
3688
3688
  addVideoStream(e, t) {
3689
3689
  if (!e.viewNode) {
3690
- hs.error("have no viewNode for composition");
3690
+ ps.error("have no viewNode for composition");
3691
3691
  return;
3692
3692
  }
3693
3693
  e.audioTrack && this._streamComposeController.addAudioStream({
3694
3694
  streamId: e.id,
3695
3695
  volume: 100
3696
3696
  });
3697
- const i = new Eu(e, t);
3697
+ const i = new bu(e, t);
3698
3698
  this._addSprite(i);
3699
3699
  }
3700
3700
  _updateSingleVideoStream(e) {
@@ -3754,7 +3754,7 @@ we([
3754
3754
  we([
3755
3755
  Oe
3756
3756
  ], Ce.prototype, "unmuteVideoStream");
3757
- class Pu extends te {
3757
+ class xu extends te {
3758
3758
  constructor(e, { volume: t }) {
3759
3759
  super(), this._volume = 100, this._isMute = !1, this._volume = t ?? 100, this._stream = e;
3760
3760
  }
@@ -3782,7 +3782,7 @@ class Pu extends te {
3782
3782
  return this._stream;
3783
3783
  }
3784
3784
  }
3785
- class xu extends Ke {
3785
+ class Ru extends Je {
3786
3786
  constructor(e) {
3787
3787
  super({
3788
3788
  type: S.MixAudio,
@@ -3806,9 +3806,9 @@ class xu extends Ke {
3806
3806
  (e = this._trackMap.audio) == null || e.stop(), delete this._trackMap.audio;
3807
3807
  }
3808
3808
  }
3809
- class Ru extends Jt {
3809
+ class Au extends Jt {
3810
3810
  constructor(e) {
3811
- super(e), this._spriteList = [], this._audioMixer = new po();
3811
+ super(e), this._spriteList = [], this._audioMixer = new lo();
3812
3812
  }
3813
3813
  onStreamCapture(e) {
3814
3814
  }
@@ -3816,7 +3816,7 @@ class Ru extends Jt {
3816
3816
  e && this.removeAudioStream(e.id);
3817
3817
  }
3818
3818
  _updateSpriteToMixer() {
3819
- const e = us(
3819
+ const e = hs(
3820
3820
  this._spriteList.map((t) => t.isMute ? null : t.getMixerNode())
3821
3821
  );
3822
3822
  this._audioMixer.mix(e);
@@ -3827,11 +3827,11 @@ class Ru extends Jt {
3827
3827
  }
3828
3828
  enable() {
3829
3829
  super.enable();
3830
- const e = this._audioMixer.track(), t = new xu(e);
3830
+ const e = this._audioMixer.track(), t = new Ru(e);
3831
3831
  this._composedStream.setAudioStream(t), this._audioMixer.mix([]);
3832
3832
  }
3833
3833
  addAudioStream(e, t) {
3834
- const i = new Pu(e, t);
3834
+ const i = new xu(e, t);
3835
3835
  this._spriteList.push(i), this._updateSpriteToMixer();
3836
3836
  }
3837
3837
  removeAudioStream(e) {
@@ -3874,7 +3874,7 @@ class Ru extends Jt {
3874
3874
  return this._spriteList.filter((t) => t.stream.type === e).map((t) => t.stream);
3875
3875
  }
3876
3876
  }
3877
- class Au extends te {
3877
+ class wu extends te {
3878
3878
  constructor({
3879
3879
  videoStream: e,
3880
3880
  audioStream: t
@@ -3904,10 +3904,10 @@ class Au extends te {
3904
3904
  return (e = this._audioStream) == null ? void 0 : e.audioTrack;
3905
3905
  }
3906
3906
  }
3907
- const wu = new ce("streamComposeController");
3908
- class Ou {
3907
+ const Ou = new ce("streamComposeController");
3908
+ class Iu {
3909
3909
  constructor(e) {
3910
- this._streamManagerController = e, this._composedStream = new Au(), this.singleComposer = new Tu({
3910
+ this._streamManagerController = e, this._composedStream = new wu(), this.singleComposer = new Eu({
3911
3911
  streamManagerController: this._streamManagerController,
3912
3912
  composedStream: this._composedStream,
3913
3913
  streamComposeController: this
@@ -3915,7 +3915,7 @@ class Ou {
3915
3915
  streamManagerController: this._streamManagerController,
3916
3916
  composedStream: this._composedStream,
3917
3917
  streamComposeController: this
3918
- }), this.mixerComposer = new Ru({
3918
+ }), this.mixerComposer = new Au({
3919
3919
  streamManagerController: this._streamManagerController,
3920
3920
  composedStream: this._composedStream,
3921
3921
  streamComposeController: this
@@ -3961,7 +3961,7 @@ class Ou {
3961
3961
  e.streamId
3962
3962
  );
3963
3963
  if (!t) {
3964
- wu.error("can not find video stream" + e.streamId);
3964
+ Ou.error("can not find video stream" + e.streamId);
3965
3965
  return;
3966
3966
  }
3967
3967
  this.compositionComposer.addVideoStream(t, e);
@@ -4005,7 +4005,7 @@ class Ou {
4005
4005
  this.compositionComposer.setMixerWorkerScript(e);
4006
4006
  }
4007
4007
  }
4008
- class ps {
4008
+ class ls {
4009
4009
  constructor(e) {
4010
4010
  this._hasBindComposedStreamEvent = !1, this._composedStream = e;
4011
4011
  }
@@ -4029,7 +4029,7 @@ class ps {
4029
4029
  }
4030
4030
  }
4031
4031
  const he = new ce("PreviewConsumer");
4032
- class Iu extends ps {
4032
+ class Du extends ls {
4033
4033
  constructor(e, {
4034
4034
  streamConsumeController: t
4035
4035
  }) {
@@ -4121,11 +4121,11 @@ class Iu extends ps {
4121
4121
  return this._isPreviewing;
4122
4122
  }
4123
4123
  }
4124
- var $ = {}, ht = {}, pt = { exports: {} }, ai;
4124
+ var $ = {}, pt = {}, lt = { exports: {} }, ai;
4125
4125
  function Yt() {
4126
- if (ai) return pt.exports;
4126
+ if (ai) return lt.exports;
4127
4127
  ai = 1;
4128
- var r = pt.exports = {
4128
+ var r = lt.exports = {
4129
4129
  v: [{
4130
4130
  name: "version",
4131
4131
  reg: /^(\d*)$/
@@ -4564,54 +4564,54 @@ function Yt() {
4564
4564
  t.forEach(function(i) {
4565
4565
  i.reg || (i.reg = /(.*)/), i.format || (i.format = "%s");
4566
4566
  });
4567
- }), pt.exports;
4567
+ }), lt.exports;
4568
4568
  }
4569
4569
  var ci;
4570
4570
  function Mu() {
4571
4571
  return ci || (ci = 1, function(r) {
4572
4572
  var e = function(o) {
4573
4573
  return String(Number(o)) === o ? Number(o) : o;
4574
- }, t = function(o, u, c, d) {
4575
- if (d && !c)
4576
- u[d] = e(o[1]);
4574
+ }, t = function(o, u, d, c) {
4575
+ if (c && !d)
4576
+ u[c] = e(o[1]);
4577
4577
  else
4578
- for (var h = 0; h < c.length; h += 1)
4579
- o[h + 1] != null && (u[c[h]] = e(o[h + 1]));
4580
- }, i = function(o, u, c) {
4581
- var d = o.name && o.names;
4582
- o.push && !u[o.push] ? u[o.push] = [] : d && !u[o.name] && (u[o.name] = {});
4578
+ for (var h = 0; h < d.length; h += 1)
4579
+ o[h + 1] != null && (u[d[h]] = e(o[h + 1]));
4580
+ }, i = function(o, u, d) {
4581
+ var c = o.name && o.names;
4582
+ o.push && !u[o.push] ? u[o.push] = [] : c && !u[o.name] && (u[o.name] = {});
4583
4583
  var h = o.push ? {} : (
4584
4584
  // blank object that will be pushed
4585
- d ? u[o.name] : u
4585
+ c ? u[o.name] : u
4586
4586
  );
4587
- t(c.match(o.reg), h, o.names, o.name), o.push && u[o.push].push(h);
4587
+ t(d.match(o.reg), h, o.names, o.name), o.push && u[o.push].push(h);
4588
4588
  }, s = Yt(), n = RegExp.prototype.test.bind(/^([a-z])=(.*)/);
4589
4589
  r.parse = function(o) {
4590
- var u = {}, c = [], d = u;
4590
+ var u = {}, d = [], c = u;
4591
4591
  return o.split(/(\r\n|\r|\n)/).filter(n).forEach(function(h) {
4592
4592
  var p = h[0], l = h.slice(2);
4593
- p === "m" && (c.push({ rtp: [], fmtp: [] }), d = c[c.length - 1]);
4593
+ p === "m" && (d.push({ rtp: [], fmtp: [] }), c = d[d.length - 1]);
4594
4594
  for (var f = 0; f < (s[p] || []).length; f += 1) {
4595
4595
  var g = s[p][f];
4596
4596
  if (g.reg.test(l))
4597
- return i(g, d, l);
4597
+ return i(g, c, l);
4598
4598
  }
4599
- }), u.media = c, u;
4599
+ }), u.media = d, u;
4600
4600
  };
4601
4601
  var a = function(o, u) {
4602
- var c = u.split(/=(.+)/, 2);
4603
- return c.length === 2 ? o[c[0]] = e(c[1]) : c.length === 1 && u.length > 1 && (o[c[0]] = void 0), o;
4602
+ var d = u.split(/=(.+)/, 2);
4603
+ return d.length === 2 ? o[d[0]] = e(d[1]) : d.length === 1 && u.length > 1 && (o[d[0]] = void 0), o;
4604
4604
  };
4605
4605
  r.parseParams = function(o) {
4606
4606
  return o.split(/;\s?/).reduce(a, {});
4607
4607
  }, r.parseFmtpConfig = r.parseParams, r.parsePayloads = function(o) {
4608
4608
  return o.toString().split(" ").map(Number);
4609
4609
  }, r.parseRemoteCandidates = function(o) {
4610
- for (var u = [], c = o.split(" ").map(e), d = 0; d < c.length; d += 3)
4610
+ for (var u = [], d = o.split(" ").map(e), c = 0; c < d.length; c += 3)
4611
4611
  u.push({
4612
- component: c[d],
4613
- ip: c[d + 1],
4614
- port: c[d + 2]
4612
+ component: d[c],
4613
+ ip: d[c + 1],
4614
+ port: d[c + 2]
4615
4615
  });
4616
4616
  return u;
4617
4617
  }, r.parseImageAttributes = function(o) {
@@ -4620,28 +4620,28 @@ function Mu() {
4620
4620
  });
4621
4621
  }, r.parseSimulcastStreamList = function(o) {
4622
4622
  return o.split(";").map(function(u) {
4623
- return u.split(",").map(function(c) {
4624
- var d, h = !1;
4625
- return c[0] !== "~" ? d = e(c) : (d = e(c.substring(1, c.length)), h = !0), {
4626
- scid: d,
4623
+ return u.split(",").map(function(d) {
4624
+ var c, h = !1;
4625
+ return d[0] !== "~" ? c = e(d) : (c = e(d.substring(1, d.length)), h = !0), {
4626
+ scid: c,
4627
4627
  paused: h
4628
4628
  };
4629
4629
  });
4630
4630
  });
4631
4631
  };
4632
- }(ht)), ht;
4632
+ }(pt)), pt;
4633
4633
  }
4634
- var lt, di;
4635
- function Du() {
4636
- if (di) return lt;
4634
+ var mt, di;
4635
+ function Lu() {
4636
+ if (di) return mt;
4637
4637
  di = 1;
4638
4638
  var r = Yt(), e = /%[sdv%]/g, t = function(a) {
4639
- var o = 1, u = arguments, c = u.length;
4640
- return a.replace(e, function(d) {
4641
- if (o >= c)
4642
- return d;
4639
+ var o = 1, u = arguments, d = u.length;
4640
+ return a.replace(e, function(c) {
4641
+ if (o >= d)
4642
+ return c;
4643
4643
  var h = u[o];
4644
- switch (o += 1, d) {
4644
+ switch (o += 1, c) {
4645
4645
  case "%%":
4646
4646
  return "%";
4647
4647
  case "%s":
@@ -4653,15 +4653,15 @@ function Du() {
4653
4653
  }
4654
4654
  });
4655
4655
  }, i = function(a, o, u) {
4656
- var c = o.format instanceof Function ? o.format(o.push ? u : u[o.name]) : o.format, d = [a + "=" + c];
4656
+ var d = o.format instanceof Function ? o.format(o.push ? u : u[o.name]) : o.format, c = [a + "=" + d];
4657
4657
  if (o.names)
4658
4658
  for (var h = 0; h < o.names.length; h += 1) {
4659
4659
  var p = o.names[h];
4660
- o.name ? d.push(u[o.name][p]) : d.push(u[o.names[h]]);
4660
+ o.name ? c.push(u[o.name][p]) : c.push(u[o.names[h]]);
4661
4661
  }
4662
4662
  else
4663
- d.push(u[o.name]);
4664
- return t.apply(null, d);
4663
+ c.push(u[o.name]);
4664
+ return t.apply(null, c);
4665
4665
  }, s = [
4666
4666
  "v",
4667
4667
  "o",
@@ -4677,45 +4677,45 @@ function Du() {
4677
4677
  "z",
4678
4678
  "a"
4679
4679
  ], n = ["i", "c", "b", "a"];
4680
- return lt = function(a, o) {
4680
+ return mt = function(a, o) {
4681
4681
  o = o || {}, a.version == null && (a.version = 0), a.name == null && (a.name = " "), a.media.forEach(function(h) {
4682
4682
  h.payloads == null && (h.payloads = "");
4683
4683
  });
4684
- var u = o.outerOrder || s, c = o.innerOrder || n, d = [];
4684
+ var u = o.outerOrder || s, d = o.innerOrder || n, c = [];
4685
4685
  return u.forEach(function(h) {
4686
4686
  r[h].forEach(function(p) {
4687
- p.name in a && a[p.name] != null ? d.push(i(h, p, a)) : p.push in a && a[p.push] != null && a[p.push].forEach(function(l) {
4688
- d.push(i(h, p, l));
4687
+ p.name in a && a[p.name] != null ? c.push(i(h, p, a)) : p.push in a && a[p.push] != null && a[p.push].forEach(function(l) {
4688
+ c.push(i(h, p, l));
4689
4689
  });
4690
4690
  });
4691
4691
  }), a.media.forEach(function(h) {
4692
- d.push(i("m", r.m[0], h)), c.forEach(function(p) {
4692
+ c.push(i("m", r.m[0], h)), d.forEach(function(p) {
4693
4693
  r[p].forEach(function(l) {
4694
- l.name in h && h[l.name] != null ? d.push(i(p, l, h)) : l.push in h && h[l.push] != null && h[l.push].forEach(function(f) {
4695
- d.push(i(p, l, f));
4694
+ l.name in h && h[l.name] != null ? c.push(i(p, l, h)) : l.push in h && h[l.push] != null && h[l.push].forEach(function(f) {
4695
+ c.push(i(p, l, f));
4696
4696
  });
4697
4697
  });
4698
4698
  });
4699
- }), d.join(`\r
4699
+ }), c.join(`\r
4700
4700
  `) + `\r
4701
4701
  `;
4702
- }, lt;
4702
+ }, mt;
4703
4703
  }
4704
4704
  var ui;
4705
- function Lu() {
4705
+ function Fu() {
4706
4706
  if (ui) return $;
4707
4707
  ui = 1;
4708
- var r = Mu(), e = Du(), t = Yt();
4708
+ var r = Mu(), e = Lu(), t = Yt();
4709
4709
  return $.grammar = t, $.write = e, $.parse = r.parse, $.parseParams = r.parseParams, $.parseFmtpConfig = r.parseFmtpConfig, $.parsePayloads = r.parsePayloads, $.parseRemoteCandidates = r.parseRemoteCandidates, $.parseImageAttributes = r.parseImageAttributes, $.parseSimulcastStreamList = r.parseSimulcastStreamList, $;
4710
4710
  }
4711
- var Fu = Lu();
4712
- const De = /* @__PURE__ */ Ge(Fu);
4713
- function ls(r) {
4711
+ var Nu = Fu();
4712
+ const Me = /* @__PURE__ */ Ge(Nu);
4713
+ function ms(r) {
4714
4714
  return new Promise((e) => {
4715
4715
  setTimeout(e, r);
4716
4716
  });
4717
4717
  }
4718
- async function Nu(r, e = {}, t = 0) {
4718
+ async function Vu(r, e = {}, t = 0) {
4719
4719
  const i = new AbortController();
4720
4720
  let s = !1;
4721
4721
  e = Object.assign({}, e, { signal: i.signal });
@@ -4742,15 +4742,15 @@ async function Nu(r, e = {}, t = 0) {
4742
4742
  throw s = !0, a;
4743
4743
  }
4744
4744
  }
4745
- async function ms(r, e = {}, t = {}) {
4745
+ async function fs(r, e = {}, t = {}) {
4746
4746
  const { timeout: i = 0, retryDelay: s = 0 } = t;
4747
4747
  let { retryCount: n = 0 } = t;
4748
4748
  try {
4749
- return await Nu(r, e, i);
4749
+ return await Vu(r, e, i);
4750
4750
  } catch (a) {
4751
4751
  if (n--, t.retryCount = n, n < 0)
4752
4752
  throw a;
4753
- return await ls(s), await ms(r, e, t);
4753
+ return await ms(s), await fs(r, e, t);
4754
4754
  }
4755
4755
  }
4756
4756
  function A(r, e) {
@@ -4759,7 +4759,7 @@ function A(r, e) {
4759
4759
  i.type === r && (t = i);
4760
4760
  }), t;
4761
4761
  }
4762
- async function Rt(r, e) {
4762
+ async function At(r, e) {
4763
4763
  const t = {}, i = await (r == null ? void 0 : r.getStats()), s = await (e == null ? void 0 : e.getStats());
4764
4764
  return i && (t.audio = {
4765
4765
  mediaSource: A("media-source", i),
@@ -4783,29 +4783,29 @@ async function Rt(r, e) {
4783
4783
  transport: A("transport", s)
4784
4784
  }), t;
4785
4785
  }
4786
- async function Vu(r, e, t) {
4787
- var d, h, p, l, f, g, _, T, b, v, U, R, Qt, er, tr, rr, ir, sr, nr, or, ar, cr, dr, ur, hr, pr, lr, mr, fr, _r, gr, vr, Cr, yr, Sr, Tr;
4788
- const i = await Rt(e, t);
4789
- await ls(r);
4790
- const s = await Rt(e, t), { audio: n, video: a } = i, { audio: o, video: u } = s, c = {};
4786
+ async function Uu(r, e, t) {
4787
+ var c, h, p, l, f, g, _, T, b, v, U, R, Qt, er, tr, rr, ir, sr, nr, or, ar, cr, dr, ur, hr, pr, lr, mr, fr, _r, gr, vr, Cr, yr, Sr, Tr;
4788
+ const i = await At(e, t);
4789
+ await ms(r);
4790
+ const s = await At(e, t), { audio: n, video: a } = i, { audio: o, video: u } = s, d = {};
4791
4791
  if (n != null && n.codec && (o != null && o.codec)) {
4792
- const et = ((d = o.outboundRtp) == null ? void 0 : d.timestamp) - ((h = n.outboundRtp) == null ? void 0 : h.timestamp), tt = ((p = o.outboundRtp) == null ? void 0 : p.bytesSent) - ((l = n.outboundRtp) == null ? void 0 : l.bytesSent), rt = ((f = o.remoteInboundRtp) == null ? void 0 : f.packetsLost) - ((g = n.remoteInboundRtp) == null ? void 0 : g.packetsLost), it = ((_ = o.outboundRtp) == null ? void 0 : _.packetsSent) - ((T = n.outboundRtp) == null ? void 0 : T.packetsSent);
4793
- c.audio = {
4792
+ const tt = ((c = o.outboundRtp) == null ? void 0 : c.timestamp) - ((h = n.outboundRtp) == null ? void 0 : h.timestamp), rt = ((p = o.outboundRtp) == null ? void 0 : p.bytesSent) - ((l = n.outboundRtp) == null ? void 0 : l.bytesSent), it = ((f = o.remoteInboundRtp) == null ? void 0 : f.packetsLost) - ((g = n.remoteInboundRtp) == null ? void 0 : g.packetsLost), st = ((_ = o.outboundRtp) == null ? void 0 : _.packetsSent) - ((T = n.outboundRtp) == null ? void 0 : T.packetsSent);
4793
+ d.audio = {
4794
4794
  codec: o.codec.mimeType,
4795
4795
  channels: o.codec.channels,
4796
- sendBitrate: tt / et * 8e3,
4796
+ sendBitrate: rt / tt * 8e3,
4797
4797
  // bps
4798
4798
  packetsSent: (b = o.outboundRtp) == null ? void 0 : b.packetsSent,
4799
4799
  nackCount: (v = o.outboundRtp) == null ? void 0 : v.nackCount,
4800
4800
  packetsLost: (U = o.remoteInboundRtp) == null ? void 0 : U.packetsLost,
4801
- packetsLostPercent: rt / it
4801
+ packetsLostPercent: it / st
4802
4802
  };
4803
4803
  }
4804
4804
  if (a != null && a.codec && (u != null && u.codec)) {
4805
- const et = ((R = u.outboundRtp) == null ? void 0 : R.timestamp) - ((Qt = a.outboundRtp) == null ? void 0 : Qt.timestamp), tt = ((er = u.outboundRtp) == null ? void 0 : er.bytesSent) - ((tr = a.outboundRtp) == null ? void 0 : tr.bytesSent), rt = ((rr = u.outboundRtp) == null ? void 0 : rr.framesEncoded) - ((ir = a.outboundRtp) == null ? void 0 : ir.framesEncoded), it = ((sr = u.outboundRtp) == null ? void 0 : sr.totalEncodeTime) - ((nr = a.outboundRtp) == null ? void 0 : nr.totalEncodeTime), Er = ((or = u.outboundRtp) == null ? void 0 : or.packetsSent) - ((ar = a.outboundRtp) == null ? void 0 : ar.packetsSent), Js = ((cr = u.outboundRtp) == null ? void 0 : cr.totalPacketSendDelay) - ((dr = a.outboundRtp) == null ? void 0 : dr.totalPacketSendDelay), Ys = ((ur = u.remoteInboundRtp) == null ? void 0 : ur.packetsLost) - ((hr = a.remoteInboundRtp) == null ? void 0 : hr.packetsLost);
4806
- c.video = {
4805
+ const tt = ((R = u.outboundRtp) == null ? void 0 : R.timestamp) - ((Qt = a.outboundRtp) == null ? void 0 : Qt.timestamp), rt = ((er = u.outboundRtp) == null ? void 0 : er.bytesSent) - ((tr = a.outboundRtp) == null ? void 0 : tr.bytesSent), it = ((rr = u.outboundRtp) == null ? void 0 : rr.framesEncoded) - ((ir = a.outboundRtp) == null ? void 0 : ir.framesEncoded), st = ((sr = u.outboundRtp) == null ? void 0 : sr.totalEncodeTime) - ((nr = a.outboundRtp) == null ? void 0 : nr.totalEncodeTime), Er = ((or = u.outboundRtp) == null ? void 0 : or.packetsSent) - ((ar = a.outboundRtp) == null ? void 0 : ar.packetsSent), Ys = ((cr = u.outboundRtp) == null ? void 0 : cr.totalPacketSendDelay) - ((dr = a.outboundRtp) == null ? void 0 : dr.totalPacketSendDelay), Zs = ((ur = u.remoteInboundRtp) == null ? void 0 : ur.packetsLost) - ((hr = a.remoteInboundRtp) == null ? void 0 : hr.packetsLost);
4806
+ d.video = {
4807
4807
  codec: u.codec.mimeType,
4808
- sendBitrate: tt / et * 8e3,
4808
+ sendBitrate: rt / tt * 8e3,
4809
4809
  // bps
4810
4810
  frameWidth: (pr = u.outboundRtp) == null ? void 0 : pr.frameWidth,
4811
4811
  frameHeight: (lr = u.outboundRtp) == null ? void 0 : lr.frameHeight,
@@ -4813,22 +4813,53 @@ async function Vu(r, e, t) {
4813
4813
  framesEncoded: (fr = u.outboundRtp) == null ? void 0 : fr.framesEncoded,
4814
4814
  keyFramesEncoded: (_r = u.outboundRtp) == null ? void 0 : _r.keyFramesEncoded,
4815
4815
  framesSent: (gr = u.outboundRtp) == null ? void 0 : gr.frameHeight,
4816
- frameEncodeAvgTime: it * 1e3 / rt,
4816
+ frameEncodeAvgTime: st * 1e3 / it,
4817
4817
  // ms
4818
4818
  packetsSent: (vr = u.outboundRtp) == null ? void 0 : vr.packetsSent,
4819
- packetSendDelay: Js * 1e3 / Er,
4819
+ packetSendDelay: Ys * 1e3 / Er,
4820
4820
  // ms
4821
4821
  nackCount: (Cr = u.outboundRtp) == null ? void 0 : Cr.nackCount,
4822
4822
  firCount: (yr = u.outboundRtp) == null ? void 0 : yr.firCount,
4823
4823
  pliCount: (Sr = u.outboundRtp) == null ? void 0 : Sr.pliCount,
4824
4824
  packetsLost: (Tr = u.remoteInboundRtp) == null ? void 0 : Tr.packetsLost,
4825
- packetsLostPercent: Ys / Er
4825
+ packetsLostPercent: Zs / Er
4826
4826
  };
4827
4827
  }
4828
- return c;
4828
+ return d;
4829
+ }
4830
+ const $u = (r) => {
4831
+ var t;
4832
+ if (!Fi)
4833
+ return;
4834
+ const e = (t = r.rtp.filter((i) => i.codec === "opus")[0]) == null ? void 0 : t.payload;
4835
+ e && r.fmtp.forEach((i) => {
4836
+ i.payload === e && (i.config = "minptime=10;useinbandfec=1");
4837
+ });
4838
+ }, Bu = (r) => {
4839
+ r.ext && (mn || He) && (r.ext = r.ext.filter(
4840
+ (e) => {
4841
+ var t;
4842
+ return !((t = e.uri) != null && t.includes("video-orientation"));
4843
+ }
4844
+ ));
4845
+ };
4846
+ function ju(r, e) {
4847
+ r == null || r.rtp.forEach(({ codec: t, payload: i }) => {
4848
+ if (["vp8", "h264"].includes(t.toLocaleLowerCase())) {
4849
+ const s = r.fmtp.find((n) => n.payload === i);
4850
+ s ? s.config = [
4851
+ ...s.config.split(";"),
4852
+ "x-google-min-bitrate=100",
4853
+ `x-google-start-bitrate=${e}`
4854
+ ].join(";") : r.fmtp.push({
4855
+ payload: i,
4856
+ config: `x-google-min-bitrate=100;x-google-start-bitrate=${e}`
4857
+ });
4858
+ }
4859
+ });
4829
4860
  }
4830
- const M = new ce("PCConnect");
4831
- class Uu {
4861
+ const D = new ce("PCConnect");
4862
+ class zu {
4832
4863
  constructor(e, t, i) {
4833
4864
  this._pc = null, this._ms = new MediaStream(), this._signalUrl = "", this._videoTransceiver = null, this._audioTransceiver = null, this._opts = void 0, this._sessionId = Date.now(), this._signalUrl = e, this._opts = t, this._onConnectStateChange = i;
4834
4865
  }
@@ -4843,32 +4874,25 @@ class Uu {
4843
4874
  return this._sessionId;
4844
4875
  }
4845
4876
  async publish(e, t) {
4846
- const i = new RTCPeerConnection(), s = /Gecko/.test(navigator.userAgent) && /Firefox/.test(navigator.userAgent);
4877
+ const i = new RTCPeerConnection();
4847
4878
  this._pc = i, this._bindRTCEvent();
4848
- const n = e.filter((h) => (h == null ? void 0 : h.kind) === "audio")[0], a = e.filter((h) => (h == null ? void 0 : h.kind) === "video")[0];
4849
- n && this._ms.addTrack(n), a && this._ms.addTrack(a), this._audioTransceiver = i.addTransceiver(n || "audio", {
4879
+ const s = e.filter((c) => (c == null ? void 0 : c.kind) === "audio")[0], n = e.filter((c) => (c == null ? void 0 : c.kind) === "video")[0];
4880
+ s && this._ms.addTrack(s), n && this._ms.addTrack(n), this._audioTransceiver = i.addTransceiver(s || "audio", {
4850
4881
  direction: "sendonly",
4851
4882
  sendEncodings: [{ maxBitrate: t[0] }],
4852
4883
  streams: [this._ms]
4853
- }), M.log("add track to pc,", n), this._videoTransceiver = i.addTransceiver(a || "video", {
4884
+ }), D.log("add track to pc,", s), this._videoTransceiver = i.addTransceiver(n || "video", {
4854
4885
  direction: "sendonly",
4855
4886
  sendEncodings: [{ maxBitrate: t[1] }],
4856
4887
  streams: [this._ms]
4857
- }), M.log("add track to pc,", a);
4858
- const o = await i.createOffer();
4859
- M.groupCollapsed("local offer"), M.log(o.sdp);
4860
- const u = De.parse(o.sdp);
4861
- u.media.filter((h) => h.type === "audio").forEach((h) => {
4862
- var l;
4863
- if (!s) return;
4864
- const p = (l = h.rtp.filter(
4865
- (f) => f.codec === "opus"
4866
- )[0]) == null ? void 0 : l.payload;
4867
- p && h.fmtp.forEach((f) => {
4868
- f.payload === p && (f.config = "minptime=10;useinbandfec=1");
4869
- });
4870
- }), o.sdp = De.write(u), M.log("local offer modified"), M.log(o.sdp), await i.setLocalDescription(o);
4871
- const c = await ms(
4888
+ }), D.log("add track to pc,", n);
4889
+ const a = await i.createOffer();
4890
+ D.groupCollapsed("local offer"), D.log(a.sdp);
4891
+ const o = Me.parse(a.sdp);
4892
+ o.media.forEach((c) => {
4893
+ c.type === "audio" ? $u(c) : c.type === "video" && (Bu(c), ju(c, t[1]));
4894
+ }), a.sdp = Me.write(o), D.log("local offer modified"), D.log(a.sdp), await i.setLocalDescription(a);
4895
+ const u = await fs(
4872
4896
  this._signalUrl,
4873
4897
  {
4874
4898
  method: "POST",
@@ -4876,7 +4900,7 @@ class Uu {
4876
4900
  body: JSON.stringify({
4877
4901
  sessionId: "" + this._sessionId,
4878
4902
  version: "1.0-html",
4879
- localSdp: o,
4903
+ localSdp: a,
4880
4904
  metadata: {
4881
4905
  platform: "Web"
4882
4906
  }
@@ -4884,24 +4908,24 @@ class Uu {
4884
4908
  },
4885
4909
  this._opts
4886
4910
  );
4887
- if ((c == null ? void 0 : c.code) !== 200)
4911
+ if ((u == null ? void 0 : u.code) !== 200)
4888
4912
  throw {
4889
- code: c.code,
4890
- message: c.message
4913
+ code: u.code,
4914
+ message: u.message
4891
4915
  };
4892
- M.log("remote answer:"), M.log(c.remoteSdp.sdp);
4893
- const d = De.parse(c.remoteSdp.sdp);
4894
- d.media.forEach((h) => {
4895
- var p;
4896
- (p = h.fingerprint) != null && p.hash && (h.fingerprint.hash = h.fingerprint.hash.toUpperCase());
4897
- }), c.remoteSdp.sdp = De.write(d), M.log("remote answer modified"), M.log(c.remoteSdp.sdp), M.groupEnd(), await i.setRemoteDescription(c.remoteSdp);
4916
+ D.log("remote answer:"), D.log(u.remoteSdp.sdp);
4917
+ const d = Me.parse(u.remoteSdp.sdp);
4918
+ d.media.forEach((c) => {
4919
+ var h;
4920
+ (h = c.fingerprint) != null && h.hash && (c.fingerprint.hash = c.fingerprint.hash.toUpperCase());
4921
+ }), u.remoteSdp.sdp = Me.write(d), D.log("remote answer modified"), D.log(u.remoteSdp.sdp), D.groupEnd(), await i.setRemoteDescription(u.remoteSdp);
4898
4922
  }
4899
4923
  async updatePublish(e, t) {
4900
4924
  var n, a;
4901
4925
  let i;
4902
4926
  t === "video" ? i = this._videoTransceiver : i = this._audioTransceiver;
4903
4927
  const s = (n = i == null ? void 0 : i.sender) == null ? void 0 : n.track;
4904
- (s == null ? void 0 : s.id) !== (e == null ? void 0 : e.id) && (await ((a = i == null ? void 0 : i.sender) == null ? void 0 : a.replaceTrack(e)), M.log(
4928
+ (s == null ? void 0 : s.id) !== (e == null ? void 0 : e.id) && (await ((a = i == null ? void 0 : i.sender) == null ? void 0 : a.replaceTrack(e)), D.log(
4905
4929
  `replace ${t} track done! ${s == null ? void 0 : s.label} -> ${e == null ? void 0 : e.label}`
4906
4930
  ));
4907
4931
  }
@@ -4910,25 +4934,25 @@ class Uu {
4910
4934
  const s = t === "video" ? (a = this._videoTransceiver) == null ? void 0 : a.sender : (o = this._audioTransceiver) == null ? void 0 : o.sender;
4911
4935
  if (!s) return;
4912
4936
  const n = s.getParameters();
4913
- n.encodings = (u = n.encodings) != null && u.length ? n.encodings : [{}], i ? n.encodings[0].minBitrate = e : n.encodings[0].maxBitrate = e, s.setParameters(n), M.log(`set bitrate for ${t}, ${e} bps, min:${i}`);
4937
+ n.encodings = (u = n.encodings) != null && u.length ? n.encodings : [{}], i ? n.encodings[0].minBitrate = e : n.encodings[0].maxBitrate = e, s.setParameters(n), D.log(`set bitrate for ${t}, ${e} bps, min:${i}`);
4914
4938
  }
4915
4939
  unpublish() {
4916
4940
  var e, t;
4917
4941
  (e = this._pc) == null || e.getSenders().forEach((i) => {
4918
4942
  var s;
4919
4943
  (s = this._pc) == null || s.removeTrack(i);
4920
- }), (t = this._pc) == null || t.close(), this._audioTransceiver = null, this._videoTransceiver = null, this._pc = null, M.log("close pc!");
4944
+ }), (t = this._pc) == null || t.close(), this._audioTransceiver = null, this._videoTransceiver = null, this._pc = null, D.log("close pc!");
4921
4945
  }
4922
4946
  getStats() {
4923
4947
  var e, t;
4924
- return Rt(
4948
+ return At(
4925
4949
  (e = this._audioTransceiver) == null ? void 0 : e.sender,
4926
4950
  (t = this._videoTransceiver) == null ? void 0 : t.sender
4927
4951
  );
4928
4952
  }
4929
4953
  getStatsSnapshoot(e) {
4930
4954
  var t, i;
4931
- return Vu(
4955
+ return Uu(
4932
4956
  e || 100,
4933
4957
  (t = this._audioTransceiver) == null ? void 0 : t.sender,
4934
4958
  (i = this._videoTransceiver) == null ? void 0 : i.sender
@@ -4937,66 +4961,66 @@ class Uu {
4937
4961
  _bindRTCEvent() {
4938
4962
  const e = this._pc;
4939
4963
  e == null || e.addEventListener("connectionstatechange", () => {
4940
- M.log("onconnectionstatechange:", e.connectionState), this._onConnectStateChange(e.connectionState);
4964
+ D.log("onconnectionstatechange:", e.connectionState), this._onConnectStateChange(e.connectionState);
4941
4965
  });
4942
4966
  }
4943
4967
  }
4944
- var se = /* @__PURE__ */ ((r) => (r.OnError = "onerror", r.OnConnectClosed = "onconnectclosed", r.OnFirstFramePushed = "onfirstframepushed", r))(se || {}), Z = /* @__PURE__ */ ((r) => (r.Video = "video", r.Audio = "audio", r))(Z || {}), N = /* @__PURE__ */ ((r) => (r.Init = "init", r.AvExist = "avexist", r.VideoFrame = "videoframe", r.MockVideoEncode = "mockvideoencode", r.AudioFrame = "audioframe", r.AdjustBitrate = "adjustbitrate", r.Publish = "publish", r.UnPublish = "unpublish", r.Download = "download", r.GetStats = "getstats", r.EncodeConfig = "encodeconfig", r))(N || {}), re = /* @__PURE__ */ ((r) => (r.Ready = "ready", r.Error = "error", r.FirstFramePushed = "firstframepushed", r.Flvfile = "flvfile", r.STATS = "stats", r.Close = "close", r))(re || {}), mt = { exports: {} }, hi;
4945
- function $u() {
4968
+ var se = /* @__PURE__ */ ((r) => (r.OnError = "onerror", r.OnConnectClosed = "onconnectclosed", r.OnFirstFramePushed = "onfirstframepushed", r))(se || {}), Z = /* @__PURE__ */ ((r) => (r.Video = "video", r.Audio = "audio", r))(Z || {}), N = /* @__PURE__ */ ((r) => (r.Init = "init", r.AvExist = "avexist", r.VideoFrame = "videoframe", r.MockVideoEncode = "mockvideoencode", r.AudioFrame = "audioframe", r.AdjustBitrate = "adjustbitrate", r.Publish = "publish", r.UnPublish = "unpublish", r.Download = "download", r.GetStats = "getstats", r.EncodeConfig = "encodeconfig", r))(N || {}), re = /* @__PURE__ */ ((r) => (r.Ready = "ready", r.Error = "error", r.FirstFramePushed = "firstframepushed", r.Flvfile = "flvfile", r.STATS = "stats", r.Close = "close", r))(re || {}), ft = { exports: {} }, hi;
4969
+ function Gu() {
4946
4970
  return hi || (hi = 1, function(r) {
4947
4971
  var e = Object.prototype.hasOwnProperty, t = "~";
4948
4972
  function i() {
4949
4973
  }
4950
4974
  Object.create && (i.prototype = /* @__PURE__ */ Object.create(null), new i().__proto__ || (t = !1));
4951
- function s(u, c, d) {
4952
- this.fn = u, this.context = c, this.once = d || !1;
4975
+ function s(u, d, c) {
4976
+ this.fn = u, this.context = d, this.once = c || !1;
4953
4977
  }
4954
- function n(u, c, d, h, p) {
4955
- if (typeof d != "function")
4978
+ function n(u, d, c, h, p) {
4979
+ if (typeof c != "function")
4956
4980
  throw new TypeError("The listener must be a function");
4957
- var l = new s(d, h || u, p), f = t ? t + c : c;
4981
+ var l = new s(c, h || u, p), f = t ? t + d : d;
4958
4982
  return u._events[f] ? u._events[f].fn ? u._events[f] = [u._events[f], l] : u._events[f].push(l) : (u._events[f] = l, u._eventsCount++), u;
4959
4983
  }
4960
- function a(u, c) {
4961
- --u._eventsCount === 0 ? u._events = new i() : delete u._events[c];
4984
+ function a(u, d) {
4985
+ --u._eventsCount === 0 ? u._events = new i() : delete u._events[d];
4962
4986
  }
4963
4987
  function o() {
4964
4988
  this._events = new i(), this._eventsCount = 0;
4965
4989
  }
4966
4990
  o.prototype.eventNames = function() {
4967
- var c = [], d, h;
4968
- if (this._eventsCount === 0) return c;
4969
- for (h in d = this._events)
4970
- e.call(d, h) && c.push(t ? h.slice(1) : h);
4971
- return Object.getOwnPropertySymbols ? c.concat(Object.getOwnPropertySymbols(d)) : c;
4972
- }, o.prototype.listeners = function(c) {
4973
- var d = t ? t + c : c, h = this._events[d];
4991
+ var d = [], c, h;
4992
+ if (this._eventsCount === 0) return d;
4993
+ for (h in c = this._events)
4994
+ e.call(c, h) && d.push(t ? h.slice(1) : h);
4995
+ return Object.getOwnPropertySymbols ? d.concat(Object.getOwnPropertySymbols(c)) : d;
4996
+ }, o.prototype.listeners = function(d) {
4997
+ var c = t ? t + d : d, h = this._events[c];
4974
4998
  if (!h) return [];
4975
4999
  if (h.fn) return [h.fn];
4976
5000
  for (var p = 0, l = h.length, f = new Array(l); p < l; p++)
4977
5001
  f[p] = h[p].fn;
4978
5002
  return f;
4979
- }, o.prototype.listenerCount = function(c) {
4980
- var d = t ? t + c : c, h = this._events[d];
5003
+ }, o.prototype.listenerCount = function(d) {
5004
+ var c = t ? t + d : d, h = this._events[c];
4981
5005
  return h ? h.fn ? 1 : h.length : 0;
4982
- }, o.prototype.emit = function(c, d, h, p, l, f) {
4983
- var g = t ? t + c : c;
5006
+ }, o.prototype.emit = function(d, c, h, p, l, f) {
5007
+ var g = t ? t + d : d;
4984
5008
  if (!this._events[g]) return !1;
4985
5009
  var _ = this._events[g], T = arguments.length, b, v;
4986
5010
  if (_.fn) {
4987
- switch (_.once && this.removeListener(c, _.fn, void 0, !0), T) {
5011
+ switch (_.once && this.removeListener(d, _.fn, void 0, !0), T) {
4988
5012
  case 1:
4989
5013
  return _.fn.call(_.context), !0;
4990
5014
  case 2:
4991
- return _.fn.call(_.context, d), !0;
5015
+ return _.fn.call(_.context, c), !0;
4992
5016
  case 3:
4993
- return _.fn.call(_.context, d, h), !0;
5017
+ return _.fn.call(_.context, c, h), !0;
4994
5018
  case 4:
4995
- return _.fn.call(_.context, d, h, p), !0;
5019
+ return _.fn.call(_.context, c, h, p), !0;
4996
5020
  case 5:
4997
- return _.fn.call(_.context, d, h, p, l), !0;
5021
+ return _.fn.call(_.context, c, h, p, l), !0;
4998
5022
  case 6:
4999
- return _.fn.call(_.context, d, h, p, l, f), !0;
5023
+ return _.fn.call(_.context, c, h, p, l, f), !0;
5000
5024
  }
5001
5025
  for (v = 1, b = new Array(T - 1); v < T; v++)
5002
5026
  b[v - 1] = arguments[v];
@@ -5004,18 +5028,18 @@ function $u() {
5004
5028
  } else {
5005
5029
  var U = _.length, R;
5006
5030
  for (v = 0; v < U; v++)
5007
- switch (_[v].once && this.removeListener(c, _[v].fn, void 0, !0), T) {
5031
+ switch (_[v].once && this.removeListener(d, _[v].fn, void 0, !0), T) {
5008
5032
  case 1:
5009
5033
  _[v].fn.call(_[v].context);
5010
5034
  break;
5011
5035
  case 2:
5012
- _[v].fn.call(_[v].context, d);
5036
+ _[v].fn.call(_[v].context, c);
5013
5037
  break;
5014
5038
  case 3:
5015
- _[v].fn.call(_[v].context, d, h);
5039
+ _[v].fn.call(_[v].context, c, h);
5016
5040
  break;
5017
5041
  case 4:
5018
- _[v].fn.call(_[v].context, d, h, p);
5042
+ _[v].fn.call(_[v].context, c, h, p);
5019
5043
  break;
5020
5044
  default:
5021
5045
  if (!b) for (R = 1, b = new Array(T - 1); R < T; R++)
@@ -5024,34 +5048,34 @@ function $u() {
5024
5048
  }
5025
5049
  }
5026
5050
  return !0;
5027
- }, o.prototype.on = function(c, d, h) {
5028
- return n(this, c, d, h, !1);
5029
- }, o.prototype.once = function(c, d, h) {
5030
- return n(this, c, d, h, !0);
5031
- }, o.prototype.removeListener = function(c, d, h, p) {
5032
- var l = t ? t + c : c;
5051
+ }, o.prototype.on = function(d, c, h) {
5052
+ return n(this, d, c, h, !1);
5053
+ }, o.prototype.once = function(d, c, h) {
5054
+ return n(this, d, c, h, !0);
5055
+ }, o.prototype.removeListener = function(d, c, h, p) {
5056
+ var l = t ? t + d : d;
5033
5057
  if (!this._events[l]) return this;
5034
- if (!d)
5058
+ if (!c)
5035
5059
  return a(this, l), this;
5036
5060
  var f = this._events[l];
5037
5061
  if (f.fn)
5038
- f.fn === d && (!p || f.once) && (!h || f.context === h) && a(this, l);
5062
+ f.fn === c && (!p || f.once) && (!h || f.context === h) && a(this, l);
5039
5063
  else {
5040
5064
  for (var g = 0, _ = [], T = f.length; g < T; g++)
5041
- (f[g].fn !== d || p && !f[g].once || h && f[g].context !== h) && _.push(f[g]);
5065
+ (f[g].fn !== c || p && !f[g].once || h && f[g].context !== h) && _.push(f[g]);
5042
5066
  _.length ? this._events[l] = _.length === 1 ? _[0] : _ : a(this, l);
5043
5067
  }
5044
5068
  return this;
5045
- }, o.prototype.removeAllListeners = function(c) {
5046
- var d;
5047
- return c ? (d = t ? t + c : c, this._events[d] && a(this, d)) : (this._events = new i(), this._eventsCount = 0), this;
5069
+ }, o.prototype.removeAllListeners = function(d) {
5070
+ var c;
5071
+ return d ? (c = t ? t + d : d, this._events[c] && a(this, c)) : (this._events = new i(), this._eventsCount = 0), this;
5048
5072
  }, o.prototype.off = o.prototype.removeListener, o.prototype.addListener = o.prototype.on, o.prefixed = t, o.EventEmitter = o, r.exports = o;
5049
- }(mt)), mt.exports;
5073
+ }(ft)), ft.exports;
5050
5074
  }
5051
- var Bu = $u();
5052
- const ju = /* @__PURE__ */ Ge(Bu);
5053
- var At = /* @__PURE__ */ ((r) => (r[r.RTMP_INIT_FAIL = 3e3] = "RTMP_INIT_FAIL", r[r.AUDIO_ENCODER_INIT_FAIL = 3001] = "AUDIO_ENCODER_INIT_FAIL", r[r.AUDIO_RRNOISE_INIT_FAIL = 3002] = "AUDIO_RRNOISE_INIT_FAIL", r[r.AUDIO_ENCODE_FAIL = 3003] = "AUDIO_ENCODE_FAIL", r[r.VIDEO_ENCODE_CONFIGURE_FAIL = 3004] = "VIDEO_ENCODE_CONFIGURE_FAIL", r[r.VIDEO_ENCODE_FAIL = 3005] = "VIDEO_ENCODE_FAIL", r[r.WTP_OPEN_FAIL = 3006] = "WTP_OPEN_FAIL", r[r.WTP_CONNECT_FAIL = 3007] = "WTP_CONNECT_FAIL", r[r.WORKER_ERROR = 3008] = "WORKER_ERROR", r))(At || {});
5054
- class zu extends Error {
5075
+ var Hu = Gu();
5076
+ const qu = /* @__PURE__ */ Ge(Hu);
5077
+ var wt = /* @__PURE__ */ ((r) => (r[r.RTMP_INIT_FAIL = 3e3] = "RTMP_INIT_FAIL", r[r.AUDIO_ENCODER_INIT_FAIL = 3001] = "AUDIO_ENCODER_INIT_FAIL", r[r.AUDIO_RRNOISE_INIT_FAIL = 3002] = "AUDIO_RRNOISE_INIT_FAIL", r[r.AUDIO_ENCODE_FAIL = 3003] = "AUDIO_ENCODE_FAIL", r[r.VIDEO_ENCODE_CONFIGURE_FAIL = 3004] = "VIDEO_ENCODE_CONFIGURE_FAIL", r[r.VIDEO_ENCODE_FAIL = 3005] = "VIDEO_ENCODE_FAIL", r[r.WTP_OPEN_FAIL = 3006] = "WTP_OPEN_FAIL", r[r.WTP_CONNECT_FAIL = 3007] = "WTP_CONNECT_FAIL", r[r.WORKER_ERROR = 3008] = "WORKER_ERROR", r))(wt || {});
5078
+ class Wu extends Error {
5055
5079
  constructor(e, t, i) {
5056
5080
  super(), this.code = e, this.message = t, i && (this.ext = i), this.toJson = () => ({
5057
5081
  code: this.code,
@@ -5061,7 +5085,7 @@ class zu extends Error {
5061
5085
  }
5062
5086
  }
5063
5087
  function pi(r, e, t) {
5064
- return new zu(r, e, t);
5088
+ return new Wu(r, e, t);
5065
5089
  }
5066
5090
  const pe = class pe {
5067
5091
  constructor(e) {
@@ -5094,7 +5118,7 @@ const pe = class pe {
5094
5118
  pe.enable = !1, pe.enableLong = !1;
5095
5119
  let ee = pe;
5096
5120
  const F = new ee("RTMP_Capture");
5097
- class Gu {
5121
+ class Xu {
5098
5122
  constructor(e) {
5099
5123
  this._videoFirstframeCaptured = !1, this._audioFirstframeCaptured = !1, this._videoProcessorReader = null, this._audioProcessorReader = null, this._bridge = e;
5100
5124
  }
@@ -5193,8 +5217,8 @@ class Gu {
5193
5217
  });
5194
5218
  }
5195
5219
  }
5196
- const fs = '(function(){"use strict";var l=(i=>(i.OnVideoCaptured="onvideocaptured",i.OnAudioCaptured="onaudiocaptured",i.OnVideoCaptureNoOutput="onvideocapturenooutput",i.OnVideoEncoded="onvideoencoded",i.OnAudioEncoded="onaudioencoded",i.OnEncodedFrame="onencodedframe",i.OnPacketed="onpacketed",i.OnUpstreamFeedback="onupstreamfeedback",i.OnBitrateChanged="onbitratechanged",i))(l||{}),O=(i=>(i.OnError="onerror",i.OnConnectClosed="onconnectclosed",i.OnFirstFramePushed="onfirstframepushed",i))(O||{}),S=(i=>(i.Video="video",i.Audio="audio",i))(S||{}),v=(i=>(i.Init="init",i.AvExist="avexist",i.VideoFrame="videoframe",i.MockVideoEncode="mockvideoencode",i.AudioFrame="audioframe",i.AdjustBitrate="adjustbitrate",i.Publish="publish",i.UnPublish="unpublish",i.Download="download",i.GetStats="getstats",i.EncodeConfig="encodeconfig",i))(v||{}),y=(i=>(i.Ready="ready",i.Error="error",i.FirstFramePushed="firstframepushed",i.Flvfile="flvfile",i.STATS="stats",i.Close="close",i))(y||{});function $(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var k={exports:{}},T;function q(){return T||(T=1,function(i){var t=Object.prototype.hasOwnProperty,e="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(e=!1));function n(u,a,r){this.fn=u,this.context=a,this.once=r||!1}function o(u,a,r,h,m){if(typeof r!="function")throw new TypeError("The listener must be a function");var g=new n(r,h||u,m),f=e?e+a:a;return u._events[f]?u._events[f].fn?u._events[f]=[u._events[f],g]:u._events[f].push(g):(u._events[f]=g,u._eventsCount++),u}function _(u,a){--u._eventsCount===0?u._events=new s:delete u._events[a]}function c(){this._events=new s,this._eventsCount=0}c.prototype.eventNames=function(){var a=[],r,h;if(this._eventsCount===0)return a;for(h in r=this._events)t.call(r,h)&&a.push(e?h.slice(1):h);return Object.getOwnPropertySymbols?a.concat(Object.getOwnPropertySymbols(r)):a},c.prototype.listeners=function(a){var r=e?e+a:a,h=this._events[r];if(!h)return[];if(h.fn)return[h.fn];for(var m=0,g=h.length,f=new Array(g);m<g;m++)f[m]=h[m].fn;return f},c.prototype.listenerCount=function(a){var r=e?e+a:a,h=this._events[r];return h?h.fn?1:h.length:0},c.prototype.emit=function(a,r,h,m,g,f){var w=e?e+a:a;if(!this._events[w])return!1;var d=this._events[w],F=arguments.length,V,p;if(d.fn){switch(d.once&&this.removeListener(a,d.fn,void 0,!0),F){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,r),!0;case 3:return d.fn.call(d.context,r,h),!0;case 4:return d.fn.call(d.context,r,h,m),!0;case 5:return d.fn.call(d.context,r,h,m,g),!0;case 6:return d.fn.call(d.context,r,h,m,g,f),!0}for(p=1,V=new Array(F-1);p<F;p++)V[p-1]=arguments[p];d.fn.apply(d.context,V)}else{var fe=d.length,R;for(p=0;p<fe;p++)switch(d[p].once&&this.removeListener(a,d[p].fn,void 0,!0),F){case 1:d[p].fn.call(d[p].context);break;case 2:d[p].fn.call(d[p].context,r);break;case 3:d[p].fn.call(d[p].context,r,h);break;case 4:d[p].fn.call(d[p].context,r,h,m);break;default:if(!V)for(R=1,V=new Array(F-1);R<F;R++)V[R-1]=arguments[R];d[p].fn.apply(d[p].context,V)}}return!0},c.prototype.on=function(a,r,h){return o(this,a,r,h,!1)},c.prototype.once=function(a,r,h){return o(this,a,r,h,!0)},c.prototype.removeListener=function(a,r,h,m){var g=e?e+a:a;if(!this._events[g])return this;if(!r)return _(this,g),this;var f=this._events[g];if(f.fn)f.fn===r&&(!m||f.once)&&(!h||f.context===h)&&_(this,g);else{for(var w=0,d=[],F=f.length;w<F;w++)(f[w].fn!==r||m&&!f[w].once||h&&f[w].context!==h)&&d.push(f[w]);d.length?this._events[g]=d.length===1?d[0]:d:_(this,g)}return this},c.prototype.removeAllListeners=function(a){var r;return a?(r=e?e+a:a,this._events[r]&&_(this,r)):(this._events=new s,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=e,c.EventEmitter=c,i.exports=c}(k)),k.exports}var z=q(),j=$(z);const N=class N{constructor(t){this.group=(...e)=>{this._enabled&&console.group(`[${this._prefix}]: `,...e)},this.groupCollapsed=(...e)=>{this._enabled&&console.groupCollapsed(`[${this._prefix}]: `,...e)},this.groupEnd=()=>{this._enabled&&console.groupEnd()},this.log=(...e)=>{this._enabled&&console.log(`[${this._prefix}]: `,...e)},this.warn=(...e)=>{this._enabled&&console.warn(`[${this._prefix}]: `,...e)},this.error=(...e)=>{this._enabled&&console.error(`[${this._prefix}]: `,...e)},this.table=(...e)=>{this._enabled&&console.table(...e)},this._prefix=t}get _enabled(){return N.enable}get _enableLong(){return N.enableLong}get long(){return this._enableLong}};N.enable=!1,N.enableLong=!1;let E=N;function D(i){i=i.filter(Boolean);const t=new Uint8Array(i.reduce((s,n)=>s+n.byteLength,0));let e=0;return i.forEach(s=>{t.set(s,e),e+=s.byteLength}),t}const A={codec:"avc1.4DE033",MaxCachedFrameSize:100,RealSpeedPercent:.8,UplinkBitrateCheckInterval:60*1e3,VideoBitrateDefault:1e6,AudioBitrateDefault:68e3,gopSize:90,sampleRate:48e3,channel:2,audioEncoderPath:"https://lf-unpkg.volccdn.com/obj/vcloudfe/sdk/Web_push/1.0.1/1735619140327/pcm2aac.js",audioEncoderWasmPath:"https://lf-unpkg.volccdn.com/obj/vcloudfe/sdk/Web_push/1.0.2/1735619208418/pcm2aac.wasm",rrnoiseAssetsPath:"https://sf1-cdn-tos.huoshanstatic.com/obj/media-fe/encoder/0.1.0",ignoreRelPublish:!1},U=new E("RTMP_AudioEncoder");class H{constructor(t){this._encodedFrameCount=0,this._ready=!1,this._lastFrame=null,this._aacOutput=(e,s)=>{const n=this._module.HEAPU8.subarray(e,e+s);if(!this._lastFrame)return;this._encodedFrameCount++;const{props:o}=this._lastFrame,_={buffer:new Uint8Array(n),props:{timestamp:parseInt(o.timestamp/1e3),originTs:parseInt(o.timestamp/1e3)}};this._core.emit(l.OnAudioEncoded,_)},this._core=t}async init(){const t=await fetch(A.audioEncoderPath).then(_=>_.text());new Function(`self.exports={};${t}`)();const e=self.exports.m;let s,n;const o=new Promise((_,c)=>{n=_,s=c});return e({instantiateWasm:function(_,c){fetch(A.audioEncoderWasmPath).then(u=>u.arrayBuffer()).then(u=>WebAssembly.instantiate(u,_)).then(function(u){return c(u.instance)}).then(()=>{n(),U.log("aac module inited")}).catch(u=>{s(u)})}}).then(_=>{const c=_.addFunction(this._aacOutput,"vii");_._init_callback(c),this._module=_}).catch(s),o}rnnoise(t){var s;const e=t.length;for(let n=0;n<e;n++)t[n]=t[n]*32768;(s=this._rnnoiseModule)==null||s.processFrame(t);for(let n=0;n<e;n++)t[n]=t[n]/32768}updateConfigure(){this._module._flush(),this._module._free_encoder(),this._ready=!1}encode(t){if(!this._ready){const o=this._start_encoder();if(o<0)throw new Error(`init aac encoder error, code:${o}`)}this._lastFrame=t;const e=t.buffer.buffer,s=this._module._malloc(e.byteLength);this._module.HEAPU8.subarray(s,s+e.byteLength).set(new Uint8Array(e));const n=this._module._encode_one_frame(s);if(n<0)throw new Error(`encode aac frame error, code:${n}`)}_start_encoder(){const t=this._core.getSetting(),e=this._module._init_encoder(t.sampleRate,t.channel,t.audioBitrate);if(e<0)return e;this._ready=!0,U.log(`init encoder: sampleRate=${t.sampleRate}, channel:${t.channel}, bitrate:${t.audioBitrate}`)}destroy(){var t;(t=this._module)==null||t._free_encoder()}}const P=1024;class M{constructor(){this._queue=[],this._sampleCount=0}compose(t){if(this._queue.push(t),this._sampleCount+=t.data.audioData.numberOfFrames,this._sampleCount>=P)return this._doCompose()}_doCompose(){const t=new Float32Array(P);let e=0,s=P;const n=this._queue[0];for(;;){const o=this._queue[0];if(!o)break;const _=Math.min(s,o.data.audioData.numberOfFrames-o.offset,480),c=o.data.buffer.slice(o.offset,o.offset+_);if(o.offset+=_,o.offset>=o.data.audioData.numberOfFrames&&this._queue.shift(),s-=_,this._sampleCount-=_,t.set(c,e),e+=_,s<=0)break}return{buffer:t,props:{timestamp:n.data.audioData.timestamp,sampleRate:n.data.audioData.sampleRate,numberOfChannels:n.data.audioData.numberOfChannels}}}}var C=(i=>(i[i.RTMP_INIT_FAIL=3e3]="RTMP_INIT_FAIL",i[i.AUDIO_ENCODER_INIT_FAIL=3001]="AUDIO_ENCODER_INIT_FAIL",i[i.AUDIO_RRNOISE_INIT_FAIL=3002]="AUDIO_RRNOISE_INIT_FAIL",i[i.AUDIO_ENCODE_FAIL=3003]="AUDIO_ENCODE_FAIL",i[i.VIDEO_ENCODE_CONFIGURE_FAIL=3004]="VIDEO_ENCODE_CONFIGURE_FAIL",i[i.VIDEO_ENCODE_FAIL=3005]="VIDEO_ENCODE_FAIL",i[i.WTP_OPEN_FAIL=3006]="WTP_OPEN_FAIL",i[i.WTP_CONNECT_FAIL=3007]="WTP_CONNECT_FAIL",i[i.WORKER_ERROR=3008]="WORKER_ERROR",i))(C||{});class W extends Error{constructor(t,e,s){super(),this.code=t,this.message=e,s&&(this.ext=s),this.toJson=()=>({code:this.code,message:this.message,ext:this.ext})}}function x(i,t,e){return new W(i,t,e)}class G{constructor(t){this._audioFrameQueue=new M,this.encode=e=>{const s=new Float32Array(e.numberOfFrames);e.copyTo(s,{planeIndex:0,frameOffset:0,frameCount:e.numberOfFrames});const n=this._audioFrameQueue.compose({offset:0,data:{audioData:e,buffer:s}});if(n)try{this._encoder.encode(n)}catch(o){this._core.emit(O.OnError,x(C.AUDIO_ENCODE_FAIL,o.message))}},this._core=t,this._encoder=new H(t)}async init(){try{await this._encoder.init()}catch(t){throw x(C.AUDIO_ENCODER_INIT_FAIL,t.message)}}setConfiguration(t){const e=Object.assign({},this._core.getSetting(),{audioBitrate:t});this._core.updateSetting(e),this._encoder.updateConfigure()}destroy(){this._encoder.destroy()}}const B=new E("RTMP_VEncoder");class J{constructor(t){this._encoder=null,this._queue=[],this._encodeTimer=0,this._loopEncodeTimer=0,this._frameIndex=0,this._gopSize=0,this._encodedFrameCount=0,this._lastFrame=null,this._startTimer=()=>{this._clearEncodeTimer(),this._encodeTimer=setInterval(()=>{const e=this._queue.shift();if(!(!e||!this._encoder||this._encoder.state==="closed"))try{this._encoder.encode(e,{keyFrame:this._frameIndex%this._gopSize===0}),this._frameIndex++,this._lastFrame&&this._lastFrame.close(),this._lastFrame=e}catch(s){B.log("encode frame error",s)}},5)},this._core=t}configurate(t){return this._gopSize=t.gopSize,this._encoder?this.flush().then(()=>this._configure(t)):this._configure(t)}_configure(t){return this._clearEncodeTimer(),B.log("start config encoder",t),VideoEncoder.isConfigSupported(t).then(e=>{if(!e.supported)throw new Error(`VideoEncoder not support config, ${JSON.stringify(t)}`);this._encoder=new VideoEncoder({output:(s,n)=>{const o=new Uint8Array(s.byteLength);s.copyTo(o),this._emitFrame(o,s,n)},error:s=>{this._clearEncodeTimer(),this._core.emit(O.OnError,x(C.VIDEO_ENCODE_FAIL,s.message))}}),this._encoder.configure(t),B.log("encoder configured")}).then(this._startTimer).catch(e=>{throw x(C.VIDEO_ENCODE_CONFIGURE_FAIL,e.message)})}_emitFrame(t,e,s){this._encodedFrameCount++,this._core.emit(l.OnVideoEncoded,{buffer:t,props:{byteLength:e.byteLength,duration:e.duration,timestamp:parseInt(e.timestamp/1e3),originTs:parseInt(e.timestamp/1e3),type:e.type},cfg:s.decoderConfig})}_clearEncodeTimer(){clearInterval(this._encodeTimer)}_clearLoopEncodeTimer(){this._loopEncodeTimer&&clearInterval(this._loopEncodeTimer)}flush(){return this._encoder?this._encoder.flush().then(()=>{var t;this._clearEncodeTimer(),(t=this._encoder)==null||t.close(),this._frameIndex=0,this._encoder=null,B.log("encoder flush & closed")}).catch(t=>{console.log("encoder flush & close error:",t)}):Promise.resolve()}encode(t){this._clearLoopEncodeTimer(),this._queue.push(t)}startLoop(t){if(!this._lastFrame)return;const e=Math.floor(1e3/t*1e3);B.log("start encode last frame looped, ",t,"increment:",e),this._loopEncodeTimer=setInterval(()=>{if(!this._lastFrame)return;const s=new VideoFrame(this._lastFrame,{duration:e,timestamp:(this._lastFrame.timestamp||0)+e});this._queue.push(s)},Math.floor(1e3/t))}destroy(){this._queue.forEach(t=>t.close()),this._lastFrame&&this._lastFrame.close(),this._clearEncodeTimer(),this._clearLoopEncodeTimer(),this.flush()}}const Q=new E("RTMP_VideoEncode");class K{constructor(t){this._core=t,this._encoder=new J(t)}async setConfiguration(t={}){const e=Object.assign({},this._core.getSetting(),t),s={width:e.width,height:e.height,displayWidth:e.width,displayHeight:e.height,bitrate:e.videoBitrate,framerate:Math.floor(e.frameRate),codec:e.codec,gopSize:e.gopSize,hardwareAcceleration:e.hardwareAcceleration};this._core.updateSetting(e),Q.log("set Configuration:",s,t);try{await this._encoder.configurate(s)}catch(n){this._core.emit(O.OnError,n)}}encode(t){this._encoder.encode(t)}startLoopEncodeLastFrame(){this._encoder.startLoop(this._core.getSetting().frameRate)}flushEncoder(){this._encoder.flush()}destroy(){this._encoder.destroy()}}const I=new E("RTMP_AVSync");class Z{constructor(t){this._videoFrameGot=!1,this._videoBaseDts=0,this._audioBaseDts=0,this._videoNextDts=0,this._videoLastDts=0,this._audioNextDts=0,this._lastVideoReceived=0,this._core=t}get avExist(){return this._core.getSetting().hasVideo&&this._core.getSetting().hasAudio}get videoRefDuration(){return parseInt(1e3/this._core.getSetting().frameRate)}get audioRefDuration(){return parseInt(1024/this._core.getSetting().sampleRate*1e3)}addVideoFrame(t){this._videoFrameGot||(this._videoFrameGot=!0);const e=t.props;if(Math.abs(this._videoNextDts-e.timestamp-this._videoBaseDts)>1e3){const n=Date.now()-this._lastVideoReceived;this._videoNextDts=this._videoNextDts===this._audioNextDts?this._videoNextDts+this.videoRefDuration:this._audioNextDts||this._videoNextDts+n,this._videoBaseDts=this._videoNextDts-e.timestamp,I.warn(`video stream timestamp breaked! dts:${this._videoNextDts} -> ${e.timestamp}, videoBaseDts=${this._videoBaseDts}, deltaToLastFrame=${n}`)}e.timestamp=e.timestamp+this._videoBaseDts;const s=e.timestamp-this._videoLastDts;return s>100&&I.warn("video frame large gap",s),this._videoLastDts=this._videoNextDts=e.timestamp,I.long&&I.log(`V frame, dts: ${e.timestamp}, originDts:${e.originTs}, videoBaseDts=${this._videoBaseDts}, type=${e.type}, duration=${s}`),this._lastVideoReceived=Date.now(),this._core.emit(l.OnEncodedFrame,S.Video,t),{size:t.buffer.length,duration:s,key:t.props.type==="key"}}addAudioFrame(t){if(this.avExist&&!this._videoFrameGot)return;const e=t.props;return this._audioBaseDts||(this._audioBaseDts=e.timestamp-this._videoNextDts),Math.abs(e.timestamp-this._audioBaseDts-this._audioNextDts)>1e3&&(this._audioBaseDts=this._audioNextDts+this.audioRefDuration-e.timestamp,I.warn(`audio stream timestamp breaked! dts:${this._audioNextDts} -> ${e.timestamp}, audioBaseDts=${this._audioBaseDts}`)),this._audioNextDts=e.timestamp=e.timestamp-this._audioBaseDts,I.long&&I.log(`A frame, dts: ${e.timestamp}, originDts:${e.originTs}`),this._core.emit(l.OnEncodedFrame,S.Audio,t),{size:t.buffer.length,duration:this.audioRefDuration}}}class X{constructor(){this._videoSize=0,this._videoDuration=0,this._videoBitrate=0,this._frameCount=0,this._fps=0,this._videoEncodedCount=0,this._keyCount=0,this._audioSize=0,this._audioDuration=0,this._audioBitrate=0,this._audioEncodedCount=0}get videoStats(){return{sendBitrate:this._videoBitrate,framesPerSecond:this._fps,framesEncoded:this._videoEncodedCount,keyFramesEncoded:this._keyCount}}get audioStats(){return{sendBitrate:this._audioBitrate,framesEncoded:this._audioEncodedCount}}addVideoSample({size:t,duration:e,key:s}){this._videoEncodedCount++,this._videoSize+=t,this._videoDuration+=e,this._frameCount++,s&&this._keyCount++,this._videoDuration>=1e3&&(this._videoBitrate=Math.floor(this._videoSize/this._videoDuration*8e3),this._fps=this._frameCount,this._frameCount=0,this._videoSize=0,this._videoDuration=0)}addAudioSample({size:t,duration:e}){this._audioEncodedCount++,this._audioSize+=t,this._audioDuration+=e,this._audioDuration>=1e3&&(this._audioBitrate=Math.floor(this._audioSize/this._audioDuration*1e3),this._audioSize=0,this._audioDuration=0)}}const Y=new E("RTMP_EncodeController");class ee{constructor(t){this._analyse=new X,this._gotFrame=!1,this._OnVideoCaptured=(e,s)=>{this._gotFrame=!0,this._videoSettingChanged(s)&&(Y.log("video track setting changed!",s),this._core.updateSetting({width:s.width,height:s.height,frameRate:s.frameRate,vDeviceId:s.deviceId}),this._videoEncode.setConfiguration()),this._videoEncode.encode(e)},this._OnVideoCaptureNoOutput=()=>{this._videoEncode.startLoopEncodeLastFrame()},this._OnAudioCaptured=e=>{this._gotFrame=!0,this._audioEncode.encode(e)},this._OnVideoEncoded=e=>{const s=this._avSync.addVideoFrame(e);this._analyse.addVideoSample(s)},this._OnAudioEncoded=e=>{if(!e.buffer.length)return;const s=this._avSync.addAudioFrame(e);s&&this._analyse.addAudioSample(s)},this._OnUpstreamFeedback=e=>{this._videoEncode.setConfiguration(e)},this._OnBitrateChanged=(e,s)=>{this._gotFrame&&(e===S.Video&&this._videoEncode.setConfiguration({videoBitrate:s}),e===S.Audio&&this._audioEncode.setConfiguration(s))},this._core=t,this._audioEncode=new G(t),this._videoEncode=new K(t),this._avSync=new Z(t),this._bindEvents()}getStats(){return{video:this._analyse.videoStats,audio:this._analyse.audioStats}}init(){return this._audioEncode.init()}_bindEvents(){this._core.on(l.OnVideoCaptured,this._OnVideoCaptured),this._core.on(l.OnAudioCaptured,this._OnAudioCaptured),this._core.on(l.OnVideoCaptureNoOutput,this._OnVideoCaptureNoOutput),this._core.on(l.OnVideoEncoded,this._OnVideoEncoded),this._core.on(l.OnAudioEncoded,this._OnAudioEncoded),this._core.on(l.OnUpstreamFeedback,this._OnUpstreamFeedback),this._core.on(l.OnBitrateChanged,this._OnBitrateChanged)}_videoSettingChanged(t){const e=this._core.getSetting();return t.width!==e.width||t.height!==e.height||Math.floor(t.frameRate)!==Math.floor(e.frameRate)||t.deviceId!==e.vDeviceId}destroy(){this._videoEncode.destroy(),this._audioEncode.destroy()}}var L=(i=>(i[i.AUDIO=8]="AUDIO",i[i.VIDEO=9]="VIDEO",i[i.SCRIPT_DATA=18]="SCRIPT_DATA",i))(L||{});const te=10,ie=1,se=7,oe={96e3:0,48e3:3,44100:4,22050:7,16e3:8,8e3:11};function ne(i){const t=(i[4]&3)+1;let e;const s=[],n=[];let o=6;const _=i[5]&31;let c;for(let r=0;r<_;r++){if(c=i[o]<<8|i[o+1],o+=2,!c)continue;const h=i.subarray(o,o+c);o+=c,s.push(h)}const u=i[o];o++;let a;for(let r=0;r<u;r++)a=i[o]<<8|i[o+1],o+=2,a&&(n.push(i.subarray(o,o+a)),o+=a);return{sps:e,spsArr:s,ppsArr:n,nalUnitSize:t}}class re{constructor(){this._cfg={hasVideo:!1,hasAudio:!1,sampleRate:48e3,channelCount:1},this._hasAudioSeqHeader=!1,this._hasVideoSeqHeader=!1}setConfig(t){this._cfg=Object.assign(this._cfg,t)}genHeader(){const t=[70,76,86,1,(this._cfg.hasAudio?1:0)<<2|(this._cfg.hasVideo?1:0),0,0,0,9,0,0,0,0];return new Uint8Array(t)}genSeqTag(t,e){let s;t===8?(s=this._genAudioTagPaylod(0,e),this._hasAudioSeqHeader=!0):(s=this._genVideoTagPayload(0,e),this._hasVideoSeqHeader=!0);const n=this._genTagHeader(t,s.length,e.props.timestamp),o=n.length+s.length;return D([n,s,new Uint8Array([o>>>24,o>>>16,o>>>8,o])])}genFrameTag(t,e){let s;t===8?s=this._genAudioTagPaylod(1,e):s=this._genVideoTagPayload(1,e);const n=this._genTagHeader(t,s.length,e.props.timestamp),o=n.length+s.length;return D([n,s,new Uint8Array([o>>>24,o>>>16,o>>>8,o])])}_genTagHeader(t,e,s){return new Uint8Array([t,e>>>16,e>>>8,e,s>>>16,s>>>8,s,s>>>24,0,0,0])}_genAudioTagPaylod(t,e){return D(t===0?[this._genAudioTagHeader(),this._genAudioSequenceHeader()]:[this._genAudioTagHeader(),this._genAudioData(e)])}_genAudioTagHeader(){return new Uint8Array([te<<4|12|ie<<1|this._cfg.channelCount-1])}_genAudioSequenceHeader(){const t=4096|oe[this._cfg.sampleRate]<<7|this._cfg.channelCount<<3;return new Uint8Array([0,t>>8,t])}_genAudioData(t){const e=new Uint8Array(1+t.buffer.length);return e.set([1],0),e.set(t.buffer,1),e}_genVideoTagPayload(t,e){return D(t===0?[this._genVideoTagHeader(e),this._genVideoSequenceHeader(e)]:[this._genVideoTagHeader(e),this._genVideoData(e)])}_genVideoTagHeader(t){return new Uint8Array([(t.props.type==="key"?1:2)<<4|se,this._hasVideoSeqHeader?1:0,0,0,0])}_genVideoSequenceHeader(t){return new Uint8Array(t.cfg.description)}_genVideoData(t){if(t.props.type==="delta")return t.buffer;const e=ne(new Uint8Array(t.cfg.description)),s=e.spsArr[0].length,n=e.ppsArr[0].length;return D([new Uint8Array([0,0,s>>8,s%256]),e.spsArr[0],new Uint8Array([0,0,n>>8,n%256]),e.ppsArr[0],t.buffer])}}const ae=new E("RTMP_Packet");class de{constructor(t){this._firstFrame=!0,this._flv=new re,this._OnEncodedFrame=(e,s)=>{if(this._firstFrame){const o=this._core.getSetting();this._flv.setConfig({hasVideo:o.hasVideo,hasAudio:o.hasAudio,sampleRate:o.sampleRate,channelCount:o.channel});const _=this._flv.genHeader();if(this._core.emit(l.OnPacketed,_),o.hasVideo){const c=this._flv.genSeqTag(L.VIDEO,s);this._core.emit(l.OnPacketed,c)}if(o.hasAudio){const c=this._flv.genSeqTag(L.AUDIO,s);this._core.emit(l.OnPacketed,c)}this._firstFrame=!1,ae.log("first frame encoded & packed")}const n=this._flv.genFrameTag(e==="video"?L.VIDEO:L.AUDIO,s);this._core.emit(l.OnPacketed,n,s.props.type==="key")},this._core=t,this._bindEvents()}_bindEvents(){this._core.on(l.OnEncodedFrame,this._OnEncodedFrame)}destroy(){}}class he{constructor(){this._lastDot=0,this._totalSize=0,this._speed=[]}addSample(t){this._lastDot||(this._lastDot=Date.now()),this._totalSize+=t;const e=Date.now()-this._lastDot;e>=500&&(this._addSpeedSample(this._totalSize/e*8e3),this._totalSize=0,this._lastDot=Date.now())}_addSpeedSample(t){this._speed.push(t),this._speed=this._speed.slice(-6)}reset(){this._speed=[]}getUpSpeed(){return this._speed.length?parseInt(this._speed.reduce((t,e)=>t+=e,0)/this._speed.length):0}}const b=new E("RTMP_Wtp");class ce{constructor(t){this._queue=[],this._url="",this._connectClosed=!1,this._upSpeed=new he,this._transport=null,this._writer=null,this._inWriting=!1,this._inAdjustEncode=!1,this._increaseTimer=0,this._firstFramePushed=!1,this._core=t,this._bindEvents()}get sendSpeed(){return this._upSpeed.getUpSpeed()}getStats(){var t;return(t=this._transport)==null?void 0:t.getStats()}_bindEvents(){this._core.on(l.OnPacketed,(t,e=!1)=>{this._checkDecreaseBitrate(),this._checkDeleteCache(e),this._queue.push(t),this._inWriting||this._write()})}_checkDecreaseBitrate(){if(this._inAdjustEncode)return;const t=this._upSpeed.getUpSpeed();if(!t||this._queue.length<A.MaxCachedFrameSize)return;b.log(`up speed: ${t} low, ajust encode setting`);const e=this._core.getSetting();this._core.emit(l.OnUpstreamFeedback,{videoBitrate:t*A.RealSpeedPercent,width:e.width,height:e.height,frameRate:e.frameRate}),this._inAdjustEncode=!0,this._checkIncreaseBitrate()}_checkIncreaseBitrate(){b.log("add timer to check uplink speed increased"),clearInterval(this._increaseTimer),this._increaseTimer=setTimeout(()=>{const t=this._core.getSetting();b.log(`set encode bitrate to specified ${t.videoBitrate}`),this._core.emit(l.OnUpstreamFeedback,{videoBitrate:t.videoBitrate,width:t.width,height:t.height,frameRate:t.frameRate}),this._inAdjustEncode=!0},A.UplinkBitrateCheckInterval)}_checkDeleteCache(t){this._inAdjustEncode&&t&&(b.log(`ajust encode setting finish, delete cached ${this._queue.length} frame`),this._queue=[],this._upSpeed.reset(),this._inAdjustEncode=!1)}async start(t){this._url=t;try{await this._connect()}catch(e){throw x(C.WTP_OPEN_FAIL,e.message)}}async _connect(){const t=new WebTransport(this._url);let e;t.closed.then(()=>{b.log("webtransport closed")}).catch(n=>{e=n.message,b.log("webtransport closed due to",n)}).finally(()=>{this._connectClosed=!0,this._core.emit(O.OnConnectClosed,e),this._core.emit(O.OnError,x(C.WTP_CONNECT_FAIL,e))}),await t.ready,this._transport=t;const s=await t.createBidirectionalStream();this._writer=s.writable.getWriter(),this._write(),b.log("transport opend")}async _write(){var e;if(!this._writer)return;this._inWriting=!0;const t=this._queue.shift();if(!t){this._inWriting=!1;return}await((e=this._writer)==null?void 0:e.write(t)),this._firstFramePushed||(this._firstFramePushed=!0,this._core.emit(O.OnFirstFramePushed),b.log("first frame pushed")),this._upSpeed.addSample(t.length);try{await this._write()}catch(s){b.log("writer error:",s)}}getFile(){return D(this._queue)}destroy(){var t,e;clearTimeout(this._increaseTimer),this._connectClosed||(t=this._writer)==null||t.close(),this._writer=null,(e=this._transport)==null||e.close(),this._transport=null}}const ue=new E("LiveRTMP");class _e extends j{constructor(){super(),this._ts=0,this._setting={codec:A.codec,hardwareAcceleration:"prefer-hardware",width:-1,height:-1,frameRate:-1,sampleRate:A.sampleRate,channel:A.channel,gopSize:A.gopSize,videoBitrate:A.VideoBitrateDefault,audioBitrate:A.AudioBitrateDefault,hasAudio:!1,hasVideo:!1,vDeviceId:"",aDeviceId:""},this._encode=new ee(this),this._packet=new de(this),this._transport=new ce(this)}ready(){return this._encode.init()}getSetting(){return this._setting}updateSetting(t){this._setting=Object.assign({},this._setting,t)}videoFrameCaptured(t,e){this.emit(l.OnVideoCaptured,t,e)}audioFrameCaptured(t,e){this.emit(l.OnAudioCaptured,t,e)}startMockVideoEncode(){this.emit(l.OnVideoCaptureNoOutput)}adjustBitrate(t,e){t===S.Video&&this.updateSetting({videoBitrate:e}),t===S.Audio&&this.updateSetting({audioBitrate:e}),this.emit(l.OnBitrateChanged,t,e)}avExist(t,e){this._setting.hasVideo=t,this._setting.hasAudio=e}publish(t){return this._transport.start(t)}setEncodeCapacity(t){this._setting=Object.assign({},this._setting,t)}getStats(){return{video:{...this._encode.getStats().video,sendSpeed:this._transport.sendSpeed,codec:this._setting.codec,frameWidth:this._setting.width,frameHeight:this._setting.height,gopSize:this._setting.gopSize},audio:{...this._encode.getStats().audio,codec:"aac",channels:this._setting.channel,sampleRate:this._setting.sampleRate}}}destroy(){ue.log("destroy"),this._encode.destroy(),this._packet.destroy(),this._transport.destroy()}down(){return this._transport.getFile()}}self.constructor.name!=="Window"&&le();function le(){let i={};self.addEventListener("message",async t=>{switch(t.data.type){case v.Init:{const{options:e}=t.data;e.logEnable&&(E.enable=!0),e.logEnableLong&&(E.enableLong=!0),i=new _e,i.on(O.OnError,s=>{self.postMessage({type:y.Error,data:s.toJson()})}),i.on(O.OnConnectClosed,()=>{self.postMessage({type:y.Close})}),i.on(O.OnFirstFramePushed,()=>{self.postMessage({type:y.FirstFramePushed})});try{await i.ready(),self.postMessage({type:y.Ready})}catch(s){self.postMessage({type:y.Error,data:s.toJson()})}}break;case v.AvExist:{const{hasAudio:e,hasVideo:s}=t.data;i.avExist(s,e)}break;case v.VideoFrame:{const{frame:e,setting:s}=t.data;i.videoFrameCaptured(e,s)}break;case v.MockVideoEncode:i.startMockVideoEncode();break;case v.AudioFrame:{const{frame:e,setting:s}=t.data;i.audioFrameCaptured(e,s)}break;case v.AdjustBitrate:{const{kind:e,bitrate:s}=t.data;i.adjustBitrate(e,s)}break;case v.Publish:{const{url:e}=t.data;try{await i.publish(e)}catch(s){self.postMessage({type:y.Error,data:s.toJson()})}}break;case v.GetStats:self.postMessage({type:y.STATS,data:i.getStats()});break;case v.EncodeConfig:{i.setEncodeCapacity(t.data.cfg);break}case v.Download:{const e=i.down();self.postMessage({type:y.Flvfile,buffer:e},[e.buffer])}break;case v.UnPublish:{i.destroy();break}}})}})();\n', li = typeof self < "u" && self.Blob && new Blob([fs], { type: "text/javascript;charset=utf-8" });
5197
- function Hu(r) {
5220
+ const _s = '(function(){"use strict";var l=(i=>(i.OnVideoCaptured="onvideocaptured",i.OnAudioCaptured="onaudiocaptured",i.OnVideoCaptureNoOutput="onvideocapturenooutput",i.OnVideoEncoded="onvideoencoded",i.OnAudioEncoded="onaudioencoded",i.OnEncodedFrame="onencodedframe",i.OnPacketed="onpacketed",i.OnUpstreamFeedback="onupstreamfeedback",i.OnBitrateChanged="onbitratechanged",i))(l||{}),O=(i=>(i.OnError="onerror",i.OnConnectClosed="onconnectclosed",i.OnFirstFramePushed="onfirstframepushed",i))(O||{}),I=(i=>(i.Video="video",i.Audio="audio",i))(I||{}),v=(i=>(i.Init="init",i.AvExist="avexist",i.VideoFrame="videoframe",i.MockVideoEncode="mockvideoencode",i.AudioFrame="audioframe",i.AdjustBitrate="adjustbitrate",i.Publish="publish",i.UnPublish="unpublish",i.Download="download",i.GetStats="getstats",i.EncodeConfig="encodeconfig",i))(v||{}),w=(i=>(i.Ready="ready",i.Error="error",i.FirstFramePushed="firstframepushed",i.Flvfile="flvfile",i.STATS="stats",i.Close="close",i))(w||{});function $(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var k={exports:{}},U;function q(){return U||(U=1,function(i){var t=Object.prototype.hasOwnProperty,e="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(e=!1));function r(u,a,n){this.fn=u,this.context=a,this.once=n||!1}function o(u,a,n,h,m){if(typeof n!="function")throw new TypeError("The listener must be a function");var g=new r(n,h||u,m),f=e?e+a:a;return u._events[f]?u._events[f].fn?u._events[f]=[u._events[f],g]:u._events[f].push(g):(u._events[f]=g,u._eventsCount++),u}function _(u,a){--u._eventsCount===0?u._events=new s:delete u._events[a]}function c(){this._events=new s,this._eventsCount=0}c.prototype.eventNames=function(){var a=[],n,h;if(this._eventsCount===0)return a;for(h in n=this._events)t.call(n,h)&&a.push(e?h.slice(1):h);return Object.getOwnPropertySymbols?a.concat(Object.getOwnPropertySymbols(n)):a},c.prototype.listeners=function(a){var n=e?e+a:a,h=this._events[n];if(!h)return[];if(h.fn)return[h.fn];for(var m=0,g=h.length,f=new Array(g);m<g;m++)f[m]=h[m].fn;return f},c.prototype.listenerCount=function(a){var n=e?e+a:a,h=this._events[n];return h?h.fn?1:h.length:0},c.prototype.emit=function(a,n,h,m,g,f){var F=e?e+a:a;if(!this._events[F])return!1;var d=this._events[F],C=arguments.length,N,p;if(d.fn){switch(d.once&&this.removeListener(a,d.fn,void 0,!0),C){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,n),!0;case 3:return d.fn.call(d.context,n,h),!0;case 4:return d.fn.call(d.context,n,h,m),!0;case 5:return d.fn.call(d.context,n,h,m,g),!0;case 6:return d.fn.call(d.context,n,h,m,g,f),!0}for(p=1,N=new Array(C-1);p<C;p++)N[p-1]=arguments[p];d.fn.apply(d.context,N)}else{var fe=d.length,R;for(p=0;p<fe;p++)switch(d[p].once&&this.removeListener(a,d[p].fn,void 0,!0),C){case 1:d[p].fn.call(d[p].context);break;case 2:d[p].fn.call(d[p].context,n);break;case 3:d[p].fn.call(d[p].context,n,h);break;case 4:d[p].fn.call(d[p].context,n,h,m);break;default:if(!N)for(R=1,N=new Array(C-1);R<C;R++)N[R-1]=arguments[R];d[p].fn.apply(d[p].context,N)}}return!0},c.prototype.on=function(a,n,h){return o(this,a,n,h,!1)},c.prototype.once=function(a,n,h){return o(this,a,n,h,!0)},c.prototype.removeListener=function(a,n,h,m){var g=e?e+a:a;if(!this._events[g])return this;if(!n)return _(this,g),this;var f=this._events[g];if(f.fn)f.fn===n&&(!m||f.once)&&(!h||f.context===h)&&_(this,g);else{for(var F=0,d=[],C=f.length;F<C;F++)(f[F].fn!==n||m&&!f[F].once||h&&f[F].context!==h)&&d.push(f[F]);d.length?this._events[g]=d.length===1?d[0]:d:_(this,g)}return this},c.prototype.removeAllListeners=function(a){var n;return a?(n=e?e+a:a,this._events[n]&&_(this,n)):(this._events=new s,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=e,c.EventEmitter=c,i.exports=c}(k)),k.exports}var z=q(),H=$(z);const x=class x{constructor(t){this.group=(...e)=>{this._enabled&&console.group(`[${this._prefix}]: `,...e)},this.groupCollapsed=(...e)=>{this._enabled&&console.groupCollapsed(`[${this._prefix}]: `,...e)},this.groupEnd=()=>{this._enabled&&console.groupEnd()},this.log=(...e)=>{this._enabled&&console.log(`[${this._prefix}]: `,...e)},this.warn=(...e)=>{this._enabled&&console.warn(`[${this._prefix}]: `,...e)},this.error=(...e)=>{this._enabled&&console.error(`[${this._prefix}]: `,...e)},this.table=(...e)=>{this._enabled&&console.table(...e)},this._prefix=t}get _enabled(){return x.enable}get _enableLong(){return x.enableLong}get long(){return this._enableLong}};x.enable=!1,x.enableLong=!1;let E=x;function S(i){i=i.filter(Boolean);const t=new Uint8Array(i.reduce((s,r)=>s+r.byteLength,0));let e=0;return i.forEach(s=>{t.set(s,e),e+=s.byteLength}),t}const A={codec:"avc1.4DE033",MaxCachedFrameSize:100,RealSpeedPercent:.8,UplinkBitrateCheckInterval:60*1e3,VideoBitrateDefault:1e6,AudioBitrateDefault:68e3,gopSize:90,sampleRate:48e3,channel:2,audioEncoderPath:"https://lf-unpkg.volccdn.com/obj/vcloudfe/sdk/Web_push/1.0.1/1735619140327/pcm2aac.js",audioEncoderWasmPath:"https://lf-unpkg.volccdn.com/obj/vcloudfe/sdk/Web_push/1.0.2/1735619208418/pcm2aac.wasm",ignoreRelPublish:!1},T=new E("RTMP_AudioEncoder");class j{constructor(t){this._encodedFrameCount=0,this._ready=!1,this._lastFrame=null,this._aacOutput=(e,s)=>{const r=this._module.HEAPU8.subarray(e,e+s);if(!this._lastFrame)return;this._encodedFrameCount++;const{props:o}=this._lastFrame,_={buffer:new Uint8Array(r),props:{timestamp:parseInt(o.timestamp/1e3),originTs:parseInt(o.timestamp/1e3)}};this._core.emit(l.OnAudioEncoded,_)},this._core=t}async init(){const t=await fetch(A.audioEncoderPath).then(_=>_.text());new Function(`self.exports={};${t}`)();const e=self.exports.m;let s,r;const o=new Promise((_,c)=>{r=_,s=c});return e({instantiateWasm:function(_,c){fetch(A.audioEncoderWasmPath).then(u=>u.arrayBuffer()).then(u=>WebAssembly.instantiate(u,_)).then(function(u){return c(u.instance)}).then(()=>{r(),T.log("aac module inited")}).catch(u=>{s(u)})}}).then(_=>{const c=_.addFunction(this._aacOutput,"vii");_._init_callback(c),this._module=_}).catch(s),o}rnnoise(t){var s;const e=t.length;for(let r=0;r<e;r++)t[r]=t[r]*32768;(s=this._rnnoiseModule)==null||s.processFrame(t);for(let r=0;r<e;r++)t[r]=t[r]/32768}updateConfigure(){this._module._flush(),this._module._free_encoder(),this._ready=!1}encode(t){if(!this._ready){const o=this._start_encoder();if(o<0)throw new Error(`init aac encoder error, code:${o}`)}this._lastFrame=t;const e=t.buffer.buffer,s=this._module._malloc(e.byteLength);this._module.HEAPU8.subarray(s,s+e.byteLength).set(new Uint8Array(e));const r=this._module._encode_one_frame(s);if(r<0)throw new Error(`encode aac frame error, code:${r}`)}_start_encoder(){const t=this._core.getSetting(),e=this._module._init_encoder(t.sampleRate,t.channel,t.audioBitrate);if(e<0)return e;this._ready=!0,T.log(`init encoder: sampleRate=${t.sampleRate}, channel:${t.channel}, bitrate:${t.audioBitrate}`)}destroy(){var t;(t=this._module)==null||t._free_encoder()}}const P=1024;class M{constructor(){this._queue=[],this._sampleCount=0}compose(t){if(this._queue.push(t),this._sampleCount+=t.data.audioData.numberOfFrames,this._sampleCount>=P)return this._doCompose()}_doCompose(){const t=new Float32Array(P);let e=0,s=P;const r=this._queue[0];for(;;){const o=this._queue[0];if(!o)break;const _=Math.min(s,o.data.audioData.numberOfFrames-o.offset,480),c=o.data.buffer.slice(o.offset,o.offset+_);if(o.offset+=_,o.offset>=o.data.audioData.numberOfFrames&&this._queue.shift(),s-=_,this._sampleCount-=_,t.set(c,e),e+=_,s<=0)break}return{buffer:t,props:{timestamp:r.data.audioData.timestamp,sampleRate:r.data.audioData.sampleRate,numberOfChannels:r.data.audioData.numberOfChannels}}}}var y=(i=>(i[i.RTMP_INIT_FAIL=3e3]="RTMP_INIT_FAIL",i[i.AUDIO_ENCODER_INIT_FAIL=3001]="AUDIO_ENCODER_INIT_FAIL",i[i.AUDIO_RRNOISE_INIT_FAIL=3002]="AUDIO_RRNOISE_INIT_FAIL",i[i.AUDIO_ENCODE_FAIL=3003]="AUDIO_ENCODE_FAIL",i[i.VIDEO_ENCODE_CONFIGURE_FAIL=3004]="VIDEO_ENCODE_CONFIGURE_FAIL",i[i.VIDEO_ENCODE_FAIL=3005]="VIDEO_ENCODE_FAIL",i[i.WTP_OPEN_FAIL=3006]="WTP_OPEN_FAIL",i[i.WTP_CONNECT_FAIL=3007]="WTP_CONNECT_FAIL",i[i.WORKER_ERROR=3008]="WORKER_ERROR",i))(y||{});class W extends Error{constructor(t,e,s){super(),this.code=t,this.message=e,s&&(this.ext=s),this.toJson=()=>({code:this.code,message:this.message,ext:this.ext})}}function b(i,t,e){return new W(i,t,e)}class G{constructor(t){this._audioFrameQueue=new M,this.encode=e=>{const s=new Float32Array(e.numberOfFrames);e.copyTo(s,{planeIndex:0,frameOffset:0,frameCount:e.numberOfFrames});const r=this._audioFrameQueue.compose({offset:0,data:{audioData:e,buffer:s}});if(r)try{this._encoder.encode(r)}catch(o){this._core.emit(O.OnError,b(y.AUDIO_ENCODE_FAIL,o.message))}},this._core=t,this._encoder=new j(t)}async init(){try{await this._encoder.init()}catch(t){throw b(y.AUDIO_ENCODER_INIT_FAIL,t.message)}}setConfiguration(t){const e=Object.assign({},this._core.getSetting(),{audioBitrate:t});this._core.updateSetting(e),this._encoder.updateConfigure()}destroy(){this._encoder.destroy()}}const L=new E("RTMP_VEncoder");class J{constructor(t){this._encoder=null,this._queue=[],this._encodeTimer=0,this._loopEncodeTimer=0,this._frameIndex=0,this._gopSize=0,this._encodedFrameCount=0,this._lastFrame=null,this._startTimer=()=>{this._clearEncodeTimer(),this._encodeTimer=setInterval(()=>{const e=this._queue.shift();if(!(!e||!this._encoder||this._encoder.state==="closed"))try{this._encoder.encode(e,{keyFrame:this._frameIndex%this._gopSize===0}),this._frameIndex++,this._lastFrame&&this._lastFrame.close(),this._lastFrame=e}catch(s){L.log("encode frame error",s)}},5)},this._core=t}configurate(t){return this._gopSize=t.gopSize,this._encoder?this.flush().then(()=>this._configure(t)):this._configure(t)}_configure(t){return this._clearEncodeTimer(),L.log("start config encoder",t),VideoEncoder.isConfigSupported(t).then(e=>{if(!e.supported)throw new Error(`VideoEncoder not support config, ${JSON.stringify(t)}`);this._encoder=new VideoEncoder({output:(s,r)=>{const o=new Uint8Array(s.byteLength);s.copyTo(o),this._emitFrame(o,s,r)},error:s=>{this._clearEncodeTimer(),this._core.emit(O.OnError,b(y.VIDEO_ENCODE_FAIL,s.message))}}),this._encoder.configure(t),L.log("encoder configured")}).then(this._startTimer).catch(e=>{throw b(y.VIDEO_ENCODE_CONFIGURE_FAIL,e.message)})}_emitFrame(t,e,s){this._encodedFrameCount++,this._core.emit(l.OnVideoEncoded,{buffer:t,props:{byteLength:e.byteLength,duration:e.duration,timestamp:parseInt(e.timestamp/1e3),originTs:parseInt(e.timestamp/1e3),type:e.type},cfg:s.decoderConfig})}_clearEncodeTimer(){clearInterval(this._encodeTimer)}_clearLoopEncodeTimer(){this._loopEncodeTimer&&clearInterval(this._loopEncodeTimer)}flush(){return this._encoder?this._encoder.flush().then(()=>{var t;this._clearEncodeTimer(),(t=this._encoder)==null||t.close(),this._frameIndex=0,this._encoder=null,L.log("encoder flush & closed")}).catch(t=>{console.log("encoder flush & close error:",t)}):Promise.resolve()}encode(t){this._clearLoopEncodeTimer(),this._queue.push(t)}startLoop(t){if(!this._lastFrame)return;const e=Math.floor(1e3/t*1e3);L.log("start encode last frame looped, ",t,"increment:",e),this._loopEncodeTimer=setInterval(()=>{if(!this._lastFrame)return;const s=new VideoFrame(this._lastFrame,{duration:e,timestamp:(this._lastFrame.timestamp||0)+e});this._queue.push(s)},Math.floor(1e3/t))}destroy(){this._queue.forEach(t=>t.close()),this._lastFrame&&this._lastFrame.close(),this._clearEncodeTimer(),this._clearLoopEncodeTimer(),this.flush()}}const Q=new E("RTMP_VideoEncode");class K{constructor(t){this._core=t,this._encoder=new J(t)}async setConfiguration(t={}){const e=Object.assign({},this._core.getSetting(),t),s={width:e.width,height:e.height,displayWidth:e.width,displayHeight:e.height,bitrate:e.videoBitrate,framerate:Math.floor(e.frameRate),codec:e.codec,gopSize:e.gopSize,hardwareAcceleration:e.hardwareAcceleration};this._core.updateSetting(e),Q.log("set Configuration:",s,t);try{await this._encoder.configurate(s)}catch(r){this._core.emit(O.OnError,r)}}encode(t){this._encoder.encode(t)}startLoopEncodeLastFrame(){this._encoder.startLoop(this._core.getSetting().frameRate)}flushEncoder(){this._encoder.flush()}destroy(){this._encoder.destroy()}}const V=new E("RTMP_AVSync");class Z{constructor(t){this._videoFrameGot=!1,this._videoBaseDts=0,this._audioBaseDts=0,this._videoNextDts=0,this._videoLastDts=0,this._audioNextDts=0,this._lastVideoReceived=0,this._core=t}get avExist(){return this._core.getSetting().hasVideo&&this._core.getSetting().hasAudio}get videoRefDuration(){return parseInt(1e3/this._core.getSetting().frameRate)}get audioRefDuration(){return parseInt(1024/this._core.getSetting().sampleRate*1e3)}addVideoFrame(t){this._videoFrameGot||(this._videoFrameGot=!0);const e=t.props;if(Math.abs(this._videoNextDts-e.timestamp-this._videoBaseDts)>1e3){const r=Date.now()-this._lastVideoReceived;this._videoNextDts=this._videoNextDts===this._audioNextDts?this._videoNextDts+this.videoRefDuration:this._audioNextDts||this._videoNextDts+r,this._videoBaseDts=this._videoNextDts-e.timestamp,V.warn(`video stream timestamp breaked! dts:${this._videoNextDts} -> ${e.timestamp}, videoBaseDts=${this._videoBaseDts}, deltaToLastFrame=${r}`)}e.timestamp=e.timestamp+this._videoBaseDts;const s=e.timestamp-this._videoLastDts;return s>100&&V.warn("video frame large gap",s),this._videoLastDts=this._videoNextDts=e.timestamp,V.long&&V.log(`V frame, dts: ${e.timestamp}, originDts:${e.originTs}, videoBaseDts=${this._videoBaseDts}, type=${e.type}, duration=${s}`),this._lastVideoReceived=Date.now(),this._core.emit(l.OnEncodedFrame,I.Video,t),{size:t.buffer.length,duration:s,key:t.props.type==="key"}}addAudioFrame(t){if(this.avExist&&!this._videoFrameGot)return;const e=t.props;return this._audioBaseDts||(this._audioBaseDts=e.timestamp-this._videoNextDts),Math.abs(e.timestamp-this._audioBaseDts-this._audioNextDts)>1e3&&(this._audioBaseDts=this._audioNextDts+this.audioRefDuration-e.timestamp,V.warn(`audio stream timestamp breaked! dts:${this._audioNextDts} -> ${e.timestamp}, audioBaseDts=${this._audioBaseDts}`)),this._audioNextDts=e.timestamp=e.timestamp-this._audioBaseDts,V.long&&V.log(`A frame, dts: ${e.timestamp}, originDts:${e.originTs}`),this._core.emit(l.OnEncodedFrame,I.Audio,t),{size:t.buffer.length,duration:this.audioRefDuration}}}class X{constructor(){this._videoSize=0,this._videoDuration=0,this._videoBitrate=0,this._frameCount=0,this._fps=0,this._videoEncodedCount=0,this._keyCount=0,this._audioSize=0,this._audioDuration=0,this._audioBitrate=0,this._audioEncodedCount=0}get videoStats(){return{sendBitrate:this._videoBitrate,framesPerSecond:this._fps,framesEncoded:this._videoEncodedCount,keyFramesEncoded:this._keyCount}}get audioStats(){return{sendBitrate:this._audioBitrate,framesEncoded:this._audioEncodedCount}}addVideoSample({size:t,duration:e,key:s}){this._videoEncodedCount++,this._videoSize+=t,this._videoDuration+=e,this._frameCount++,s&&this._keyCount++,this._videoDuration>=1e3&&(this._videoBitrate=Math.floor(this._videoSize/this._videoDuration*8e3),this._fps=this._frameCount,this._frameCount=0,this._videoSize=0,this._videoDuration=0)}addAudioSample({size:t,duration:e}){this._audioEncodedCount++,this._audioSize+=t,this._audioDuration+=e,this._audioDuration>=1e3&&(this._audioBitrate=Math.floor(this._audioSize/this._audioDuration*1e3),this._audioSize=0,this._audioDuration=0)}}const Y=new E("RTMP_EncodeController");class ee{constructor(t){this._analyse=new X,this._gotFrame=!1,this._OnVideoCaptured=(e,s)=>{this._gotFrame=!0,this._videoSettingChanged(s)&&(Y.log("video track setting changed!",s),this._core.updateSetting({width:s.width,height:s.height,frameRate:s.frameRate,vDeviceId:s.deviceId}),this._videoEncode.setConfiguration()),this._videoEncode.encode(e)},this._OnVideoCaptureNoOutput=()=>{this._videoEncode.startLoopEncodeLastFrame()},this._OnAudioCaptured=e=>{this._gotFrame=!0,this._audioEncode.encode(e)},this._OnVideoEncoded=e=>{const s=this._avSync.addVideoFrame(e);this._analyse.addVideoSample(s)},this._OnAudioEncoded=e=>{if(!e.buffer.length)return;const s=this._avSync.addAudioFrame(e);s&&this._analyse.addAudioSample(s)},this._OnUpstreamFeedback=e=>{this._videoEncode.setConfiguration(e)},this._OnBitrateChanged=(e,s)=>{this._gotFrame&&(e===I.Video&&this._videoEncode.setConfiguration({videoBitrate:s}),e===I.Audio&&this._audioEncode.setConfiguration(s))},this._core=t,this._audioEncode=new G(t),this._videoEncode=new K(t),this._avSync=new Z(t),this._bindEvents()}getStats(){return{video:this._analyse.videoStats,audio:this._analyse.audioStats}}init(){return this._audioEncode.init()}_bindEvents(){this._core.on(l.OnVideoCaptured,this._OnVideoCaptured),this._core.on(l.OnAudioCaptured,this._OnAudioCaptured),this._core.on(l.OnVideoCaptureNoOutput,this._OnVideoCaptureNoOutput),this._core.on(l.OnVideoEncoded,this._OnVideoEncoded),this._core.on(l.OnAudioEncoded,this._OnAudioEncoded),this._core.on(l.OnUpstreamFeedback,this._OnUpstreamFeedback),this._core.on(l.OnBitrateChanged,this._OnBitrateChanged)}_videoSettingChanged(t){const e=this._core.getSetting();return t.width!==e.width||t.height!==e.height||Math.floor(t.frameRate)!==Math.floor(e.frameRate)||t.deviceId!==e.vDeviceId}destroy(){this._videoEncode.destroy(),this._audioEncode.destroy()}}var B=(i=>(i[i.AUDIO=8]="AUDIO",i[i.VIDEO=9]="VIDEO",i[i.SCRIPT_DATA=18]="SCRIPT_DATA",i))(B||{});const te=10,ie=1,se=7,oe={96e3:0,48e3:3,44100:4,22050:7,16e3:8,8e3:11};function re(i){const t=(i[4]&3)+1;let e;const s=[],r=[];let o=6;const _=i[5]&31;let c;for(let n=0;n<_;n++){if(c=i[o]<<8|i[o+1],o+=2,!c)continue;const h=i.subarray(o,o+c);o+=c,s.push(h)}const u=i[o];o++;let a;for(let n=0;n<u;n++)a=i[o]<<8|i[o+1],o+=2,a&&(r.push(i.subarray(o,o+a)),o+=a);return{sps:e,spsArr:s,ppsArr:r,nalUnitSize:t}}class ne{constructor(){this._cfg={hasVideo:!1,hasAudio:!1,sampleRate:48e3,channelCount:1},this._hasAudioSeqHeader=!1,this._hasVideoSeqHeader=!1}setConfig(t){this._cfg=Object.assign(this._cfg,t)}genHeader(){const t=[70,76,86,1,(this._cfg.hasAudio?1:0)<<2|(this._cfg.hasVideo?1:0),0,0,0,9,0,0,0,0];return new Uint8Array(t)}genSeqTag(t,e){let s;t===8?(s=this._genAudioTagPaylod(0,e),this._hasAudioSeqHeader=!0):(s=this._genVideoTagPayload(0,e),this._hasVideoSeqHeader=!0);const r=this._genTagHeader(t,s.length,e.props.timestamp),o=r.length+s.length;return S([r,s,new Uint8Array([o>>>24,o>>>16,o>>>8,o])])}genFrameTag(t,e){let s;t===8?s=this._genAudioTagPaylod(1,e):s=this._genVideoTagPayload(1,e);const r=this._genTagHeader(t,s.length,e.props.timestamp),o=r.length+s.length;return S([r,s,new Uint8Array([o>>>24,o>>>16,o>>>8,o])])}_genTagHeader(t,e,s){return new Uint8Array([t,e>>>16,e>>>8,e,s>>>16,s>>>8,s,s>>>24,0,0,0])}_genAudioTagPaylod(t,e){return S(t===0?[this._genAudioTagHeader(),this._genAudioSequenceHeader()]:[this._genAudioTagHeader(),this._genAudioData(e)])}_genAudioTagHeader(){return new Uint8Array([te<<4|12|ie<<1|this._cfg.channelCount-1])}_genAudioSequenceHeader(){const t=4096|oe[this._cfg.sampleRate]<<7|this._cfg.channelCount<<3;return new Uint8Array([0,t>>8,t])}_genAudioData(t){const e=new Uint8Array(1+t.buffer.length);return e.set([1],0),e.set(t.buffer,1),e}_genVideoTagPayload(t,e){return S(t===0?[this._genVideoTagHeader(e),this._genVideoSequenceHeader(e)]:[this._genVideoTagHeader(e),this._genVideoData(e)])}_genVideoTagHeader(t){return new Uint8Array([(t.props.type==="key"?1:2)<<4|se,this._hasVideoSeqHeader?1:0,0,0,0])}_genVideoSequenceHeader(t){return new Uint8Array(t.cfg.description)}_genVideoData(t){if(t.props.type==="delta")return t.buffer;const e=re(new Uint8Array(t.cfg.description)),s=e.spsArr[0].length,r=e.ppsArr[0].length;return S([new Uint8Array([0,0,s>>8,s%256]),e.spsArr[0],new Uint8Array([0,0,r>>8,r%256]),e.ppsArr[0],t.buffer])}}const ae=new E("RTMP_Packet");class de{constructor(t){this._firstFrame=!0,this._flv=new ne,this._OnEncodedFrame=(e,s)=>{if(this._firstFrame){const o=this._core.getSetting();this._flv.setConfig({hasVideo:o.hasVideo,hasAudio:o.hasAudio,sampleRate:o.sampleRate,channelCount:o.channel});const _=this._flv.genHeader();if(this._core.emit(l.OnPacketed,_),o.hasVideo){const c=this._flv.genSeqTag(B.VIDEO,s);this._core.emit(l.OnPacketed,c)}if(o.hasAudio){const c=this._flv.genSeqTag(B.AUDIO,s);this._core.emit(l.OnPacketed,c)}this._firstFrame=!1,ae.log("first frame encoded & packed")}const r=this._flv.genFrameTag(e==="video"?B.VIDEO:B.AUDIO,s);this._core.emit(l.OnPacketed,r,s.props.type==="key")},this._core=t,this._bindEvents()}_bindEvents(){this._core.on(l.OnEncodedFrame,this._OnEncodedFrame)}destroy(){}}class he{constructor(){this._lastDot=0,this._totalSize=0,this._speed=[]}addSample(t){this._lastDot||(this._lastDot=Date.now()),this._totalSize+=t;const e=Date.now()-this._lastDot;e>=500&&(this._addSpeedSample(this._totalSize/e*8e3),this._totalSize=0,this._lastDot=Date.now())}_addSpeedSample(t){this._speed.push(t),this._speed=this._speed.slice(-6)}reset(){this._speed=[]}getUpSpeed(){return this._speed.length?parseInt(this._speed.reduce((t,e)=>t+=e,0)/this._speed.length):0}}const D=new E("RTMP_Wtp");class ce{constructor(t){this._queue=[],this._url="",this._connectClosed=!1,this._upSpeed=new he,this._transport=null,this._writer=null,this._inWriting=!1,this._inAdjustEncode=!1,this._increaseTimer=0,this._firstFramePushed=!1,this._core=t,this._bindEvents()}get sendSpeed(){return this._upSpeed.getUpSpeed()}getStats(){var t;return(t=this._transport)==null?void 0:t.getStats()}_bindEvents(){this._core.on(l.OnPacketed,(t,e=!1)=>{this._checkDecreaseBitrate(),this._checkDeleteCache(e),this._queue.push(t),this._inWriting||this._write()})}_checkDecreaseBitrate(){if(this._inAdjustEncode)return;const t=this._upSpeed.getUpSpeed();if(!t||this._queue.length<A.MaxCachedFrameSize)return;D.log(`up speed: ${t} low, ajust encode setting`);const e=this._core.getSetting();this._core.emit(l.OnUpstreamFeedback,{videoBitrate:t*A.RealSpeedPercent,width:e.width,height:e.height,frameRate:e.frameRate}),this._inAdjustEncode=!0,this._checkIncreaseBitrate()}_checkIncreaseBitrate(){D.log("add timer to check uplink speed increased"),clearInterval(this._increaseTimer),this._increaseTimer=setTimeout(()=>{const t=this._core.getSetting();D.log(`set encode bitrate to specified ${t.videoBitrate}`),this._core.emit(l.OnUpstreamFeedback,{videoBitrate:t.videoBitrate,width:t.width,height:t.height,frameRate:t.frameRate}),this._inAdjustEncode=!0},A.UplinkBitrateCheckInterval)}_checkDeleteCache(t){this._inAdjustEncode&&t&&(D.log(`ajust encode setting finish, delete cached ${this._queue.length} frame`),this._queue=[],this._upSpeed.reset(),this._inAdjustEncode=!1)}async start(t){this._url=t;try{await this._connect()}catch(e){throw b(y.WTP_OPEN_FAIL,e.message)}}async _connect(){const t=new WebTransport(this._url);let e;t.closed.then(()=>{D.log("webtransport closed")}).catch(r=>{e=r.message,D.log("webtransport closed due to",r)}).finally(()=>{this._connectClosed=!0,this._core.emit(O.OnConnectClosed,e),this._core.emit(O.OnError,b(y.WTP_CONNECT_FAIL,e))}),await t.ready,this._transport=t;const s=await t.createBidirectionalStream();this._writer=s.writable.getWriter(),this._write(),D.log("transport opend")}async _write(){var e;if(!this._writer)return;this._inWriting=!0;const t=this._queue.shift();if(!t){this._inWriting=!1;return}await((e=this._writer)==null?void 0:e.write(t)),this._firstFramePushed||(this._firstFramePushed=!0,this._core.emit(O.OnFirstFramePushed),D.log("first frame pushed")),this._upSpeed.addSample(t.length);try{await this._write()}catch(s){D.log("writer error:",s)}}getFile(){return S(this._queue)}destroy(){var t,e;clearTimeout(this._increaseTimer),this._connectClosed||(t=this._writer)==null||t.close(),this._writer=null,(e=this._transport)==null||e.close(),this._transport=null}}const ue=new E("LiveRTMP");class _e extends H{constructor(){super(),this._ts=0,this._setting={codec:A.codec,hardwareAcceleration:"prefer-hardware",width:-1,height:-1,frameRate:-1,sampleRate:A.sampleRate,channel:A.channel,gopSize:A.gopSize,videoBitrate:A.VideoBitrateDefault,audioBitrate:A.AudioBitrateDefault,hasAudio:!1,hasVideo:!1,vDeviceId:"",aDeviceId:""},this._encode=new ee(this),this._packet=new de(this),this._transport=new ce(this)}async checkVideoHardwareAcceleration(){const t=["prefer-hardware","prefer-software","no-preference"],e=this.getSetting(),s={codec:e.codec,width:1280,height:720,framerate:15,bitrate:e.videoBitrate};for(const r of t)try{if((await VideoEncoder.isConfigSupported({...s,hardwareAcceleration:r})).supported)return this.updateSetting({hardwareAcceleration:r}),Promise.resolve()}catch{throw b(y.VIDEO_ENCODE_CONFIGURE_FAIL,`VideoEncoder not support hardwareAcceleration, ${JSON.stringify({...s,hardwareAcceleration:r})}`)}throw b(y.VIDEO_ENCODE_CONFIGURE_FAIL,"VideoEncoder not support hardwareAcceleration")}async ready(){await Promise.all([this.checkVideoHardwareAcceleration(),this._encode.init()])}getSetting(){return this._setting}updateSetting(t){this._setting=Object.assign({},this._setting,t)}videoFrameCaptured(t,e){this.emit(l.OnVideoCaptured,t,e)}audioFrameCaptured(t,e){this.emit(l.OnAudioCaptured,t,e)}startMockVideoEncode(){this.emit(l.OnVideoCaptureNoOutput)}adjustBitrate(t,e){t===I.Video&&this.updateSetting({videoBitrate:e}),t===I.Audio&&this.updateSetting({audioBitrate:e}),this.emit(l.OnBitrateChanged,t,e)}avExist(t,e){this._setting.hasVideo=t,this._setting.hasAudio=e}publish(t){return this._transport.start(t)}setEncodeCapacity(t){this._setting=Object.assign({},this._setting,t)}getStats(){return{video:{...this._encode.getStats().video,sendSpeed:this._transport.sendSpeed,codec:this._setting.codec,frameWidth:this._setting.width,frameHeight:this._setting.height,gopSize:this._setting.gopSize},audio:{...this._encode.getStats().audio,codec:"aac",channels:this._setting.channel,sampleRate:this._setting.sampleRate}}}destroy(){ue.log("destroy"),this._encode.destroy(),this._packet.destroy(),this._transport.destroy()}down(){return this._transport.getFile()}}self.constructor.name!=="Window"&&le();function le(){let i={};self.addEventListener("message",async t=>{switch(t.data.type){case v.Init:{const{options:e}=t.data;e.logEnable&&(E.enable=!0),e.logEnableLong&&(E.enableLong=!0),i=new _e,i.on(O.OnError,s=>{self.postMessage({type:w.Error,data:s.toJson()})}),i.on(O.OnConnectClosed,()=>{self.postMessage({type:w.Close})}),i.on(O.OnFirstFramePushed,()=>{self.postMessage({type:w.FirstFramePushed})});try{await i.ready(),self.postMessage({type:w.Ready})}catch(s){self.postMessage({type:w.Error,data:s.toJson()})}}break;case v.AvExist:{const{hasAudio:e,hasVideo:s}=t.data;i.avExist(s,e)}break;case v.VideoFrame:{const{frame:e,setting:s}=t.data;i.videoFrameCaptured(e,s)}break;case v.MockVideoEncode:i.startMockVideoEncode();break;case v.AudioFrame:{const{frame:e,setting:s}=t.data;i.audioFrameCaptured(e,s)}break;case v.AdjustBitrate:{const{kind:e,bitrate:s}=t.data;i.adjustBitrate(e,s)}break;case v.Publish:{const{url:e}=t.data;try{await i.publish(e)}catch(s){self.postMessage({type:w.Error,data:s.toJson()})}}break;case v.GetStats:self.postMessage({type:w.STATS,data:i.getStats()});break;case v.EncodeConfig:{i.setEncodeCapacity(t.data.cfg);break}case v.Download:{const e=i.down();self.postMessage({type:w.Flvfile,buffer:e},[e.buffer])}break;case v.UnPublish:{i.destroy();break}}})}})();\n', li = typeof self < "u" && self.Blob && new Blob([_s], { type: "text/javascript;charset=utf-8" });
5221
+ function Ku(r) {
5198
5222
  let e;
5199
5223
  try {
5200
5224
  if (e = li && (self.URL || self.webkitURL).createObjectURL(li), !e) throw "";
@@ -5206,7 +5230,7 @@ function Hu(r) {
5206
5230
  }), t;
5207
5231
  } catch {
5208
5232
  return new Worker(
5209
- "data:text/javascript;charset=utf-8," + encodeURIComponent(fs),
5233
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(_s),
5210
5234
  {
5211
5235
  name: r == null ? void 0 : r.name
5212
5236
  }
@@ -5220,10 +5244,10 @@ try {
5220
5244
  } catch {
5221
5245
  }
5222
5246
  const Le = new ee("Bridge");
5223
- class _s extends ju {
5247
+ class gs extends qu {
5224
5248
  // static version = __VERSION__
5225
5249
  constructor() {
5226
- super(), this._worker = null, this._audioMsTrack = null, this._videoMsTrack = null, this._capture = new Gu(this);
5250
+ super(), this._worker = null, this._audioMsTrack = null, this._videoMsTrack = null, this._capture = new Xu(this);
5227
5251
  }
5228
5252
  static isSupported() {
5229
5253
  return typeof WebTransport < "u" && typeof MediaStreamTrackProcessor < "u" && typeof MediaStreamTrackGenerator < "u" && typeof VideoEncoder < "u";
@@ -5250,9 +5274,9 @@ class _s extends ju {
5250
5274
  }
5251
5275
  };
5252
5276
  try {
5253
- this._worker = new Hu();
5277
+ this._worker = new Ku();
5254
5278
  } catch (o) {
5255
- t(pi(At.RTMP_INIT_FAIL, o.message));
5279
+ t(pi(wt.RTMP_INIT_FAIL, o.message));
5256
5280
  }
5257
5281
  return (n = this._worker) == null || n.postMessage({
5258
5282
  type: N.Init,
@@ -5275,7 +5299,7 @@ class _s extends ju {
5275
5299
  Le.table(i.data.data), this.emit(se.OnError, i.data.data);
5276
5300
  break;
5277
5301
  case re.Flvfile:
5278
- qu(i.data.buffer);
5302
+ Ju(i.data.buffer);
5279
5303
  break;
5280
5304
  case re.FirstFramePushed:
5281
5305
  this.emit(se.OnFirstFramePushed);
@@ -5287,7 +5311,7 @@ class _s extends ju {
5287
5311
  }), (t = this._worker) == null || t.addEventListener("error", (i) => {
5288
5312
  this.emit(
5289
5313
  se.OnError,
5290
- pi(At.WORKER_ERROR, i.message)
5314
+ pi(wt.WORKER_ERROR, i.message)
5291
5315
  );
5292
5316
  });
5293
5317
  }
@@ -5393,14 +5417,14 @@ class _s extends ju {
5393
5417
  });
5394
5418
  }
5395
5419
  }
5396
- function qu(r) {
5420
+ function Ju(r) {
5397
5421
  const e = document.createElement("a");
5398
5422
  e.href = URL.createObjectURL(new Blob([r])), e.download = Date.now() + ".flv", e.click();
5399
5423
  }
5400
5424
  const mi = new ce("RTMPConnect");
5401
- class Wu {
5425
+ class Yu {
5402
5426
  constructor(e, t, i, s) {
5403
- this._opts = void 0, this._isPushing = !1, this._url = e, this._opts = t, this._onError = i, this._OnSuccess = s, this._rtmp = new _s(), this._bindEvents();
5427
+ this._opts = void 0, this._isPushing = !1, this._url = e, this._opts = t, this._onError = i, this._OnSuccess = s, this._rtmp = new gs(), this._bindEvents();
5404
5428
  }
5405
5429
  get isPushing() {
5406
5430
  return this._isPushing;
@@ -5437,8 +5461,8 @@ class Wu {
5437
5461
  mi.warn("unpublish"), this._rtmp.unpublish(), this._isPushing = !1;
5438
5462
  }
5439
5463
  }
5440
- const Xu = new ce("PushController");
5441
- class Ku extends ps {
5464
+ const Zu = new ce("PushController");
5465
+ class Qu extends ls {
5442
5466
  constructor(e, {
5443
5467
  config: t,
5444
5468
  streamConsumeController: i
@@ -5447,7 +5471,7 @@ class Ku extends ps {
5447
5471
  timeout: 5e3,
5448
5472
  retryCount: 1,
5449
5473
  retryDelay: 1e3
5450
- }, this._audioBitrate = fe(Mi, "audio").bitrate, this._videoBitrate = fe(Ii, "video").bitrate, this.handleAudioStreamChange = (s) => {
5474
+ }, this._audioBitrate = fe(Di, "audio").bitrate, this._videoBitrate = fe(Ii, "video").bitrate, this.handleAudioStreamChange = (s) => {
5451
5475
  this.updatePush({
5452
5476
  audioTrack: s.audioTrack
5453
5477
  });
@@ -5522,7 +5546,7 @@ class Ku extends ps {
5522
5546
  if (!i && !s)
5523
5547
  return;
5524
5548
  let n;
5525
- this._pushMode === "rtm" ? n = new Uu(e, this._pushConfig, this._OnRtcStateChange) : n = new Wu(
5549
+ this._pushMode === "rtm" ? n = new zu(e, this._pushConfig, this._OnRtcStateChange) : n = new Yu(
5526
5550
  e,
5527
5551
  this._pushConfig,
5528
5552
  this._OnRTMPError,
@@ -5535,7 +5559,7 @@ class Ku extends ps {
5535
5559
  t
5536
5560
  );
5537
5561
  } catch (a) {
5538
- Xu.groupEnd(), n.unpublish();
5562
+ Zu.groupEnd(), n.unpublish();
5539
5563
  const o = new Te(
5540
5564
  V.PUBLISH_FAILED,
5541
5565
  a.message,
@@ -5596,14 +5620,14 @@ class Ku extends ps {
5596
5620
  return this._pushMode;
5597
5621
  }
5598
5622
  }
5599
- class Ju extends te {
5623
+ class eh extends te {
5600
5624
  constructor(e) {
5601
- super(), this._previewConsumer = new Iu(
5625
+ super(), this._previewConsumer = new Du(
5602
5626
  e.getComposedStream(),
5603
5627
  {
5604
5628
  streamConsumeController: this
5605
5629
  }
5606
- ), this._pushConsumer = new Ku(
5630
+ ), this._pushConsumer = new Qu(
5607
5631
  e.getComposedStream(),
5608
5632
  {
5609
5633
  streamConsumeController: this
@@ -5650,13 +5674,13 @@ class Ju extends te {
5650
5674
  await this._pushConsumer.destroy(), this._previewConsumer.destroy();
5651
5675
  }
5652
5676
  }
5653
- const Yu = () => typeof window > "u", z = {}, ze = async (r) => {
5677
+ const th = () => typeof window > "u", z = {}, ze = async (r) => {
5654
5678
  const e = new RTCPeerConnection({ sdpSemantics: "unified-plan" });
5655
5679
  e.addTransceiver("video", { direction: r });
5656
5680
  const t = await e.createOffer();
5657
5681
  return e.close(), t.sdp.toLowerCase();
5658
5682
  };
5659
- function gs(r) {
5683
+ function vs(r) {
5660
5684
  const e = r.split(`
5661
5685
  `);
5662
5686
  let t = !1;
@@ -5689,30 +5713,30 @@ function gs(r) {
5689
5713
  }
5690
5714
  return !1;
5691
5715
  }
5692
- const Zu = async () => {
5716
+ const rh = async () => {
5693
5717
  let r = await ze("sendonly");
5694
- return navigator.userAgent.includes("VivoBrowser") && (r = await ze("sendonly")), z.h264encode = gs(r), z.vp8encode = r.indexOf("vp8") > -1, z;
5695
- }, Qu = async () => {
5718
+ return navigator.userAgent.includes("VivoBrowser") && (r = await ze("sendonly")), z.h264encode = vs(r), z.vp8encode = r.indexOf("vp8") > -1, z;
5719
+ }, ih = async () => {
5696
5720
  let r = await ze("recvonly");
5697
- return navigator.userAgent.includes("VivoBrowser") && (r = await ze("recvonly")), z.h264decode = gs(r), z.vp8decode = r.indexOf("vp8") > -1, z;
5698
- }, eh = async () => {
5721
+ return navigator.userAgent.includes("VivoBrowser") && (r = await ze("recvonly")), z.h264decode = vs(r), z.vp8decode = r.indexOf("vp8") > -1, z;
5722
+ }, sh = async () => {
5699
5723
  if (typeof z.h264encode > "u")
5700
5724
  try {
5701
- await Zu();
5725
+ await rh();
5702
5726
  } catch {
5703
5727
  return !1;
5704
5728
  }
5705
5729
  return z.h264encode || !1;
5706
- }, th = async () => {
5730
+ }, nh = async () => {
5707
5731
  if (typeof z.h264decode > "u")
5708
5732
  try {
5709
- await Qu();
5733
+ await ih();
5710
5734
  } catch {
5711
5735
  return !1;
5712
5736
  }
5713
5737
  return z.h264decode || !1;
5714
5738
  };
5715
- class rh {
5739
+ class oh {
5716
5740
  /** {zh}
5717
5741
  * @brief 构造函数
5718
5742
  * @hidden
@@ -5736,8 +5760,8 @@ class rh {
5736
5760
  };
5737
5761
  }
5738
5762
  }
5739
- const ih = new rh();
5740
- let vs = !0, Cs = !0;
5763
+ const ah = new oh();
5764
+ let Cs = !0, ys = !0;
5741
5765
  function Fe(r, e, t) {
5742
5766
  const i = r.match(e);
5743
5767
  return i && i.length >= t && parseInt(i[t], 10);
@@ -5749,9 +5773,9 @@ function de(r, e, t) {
5749
5773
  i.addEventListener = function(a, o) {
5750
5774
  if (a !== e)
5751
5775
  return s.apply(this, arguments);
5752
- const u = (c) => {
5753
- const d = t(c);
5754
- d && (o.handleEvent ? o.handleEvent(d) : o(d));
5776
+ const u = (d) => {
5777
+ const c = t(d);
5778
+ c && (o.handleEvent ? o.handleEvent(c) : o(c));
5755
5779
  };
5756
5780
  return this._eventMap = this._eventMap || {}, this._eventMap[e] || (this._eventMap[e] = /* @__PURE__ */ new Map()), this._eventMap[e].set(o, u), s.apply(this, [
5757
5781
  a,
@@ -5786,23 +5810,23 @@ function de(r, e, t) {
5786
5810
  configurable: !0
5787
5811
  });
5788
5812
  }
5789
- function sh(r) {
5790
- return typeof r != "boolean" ? new Error("Argument type: " + typeof r + ". Please use a boolean.") : (vs = r, r ? "adapter.js logging disabled" : "adapter.js logging enabled");
5813
+ function ch(r) {
5814
+ return typeof r != "boolean" ? new Error("Argument type: " + typeof r + ". Please use a boolean.") : (Cs = r, r ? "adapter.js logging disabled" : "adapter.js logging enabled");
5791
5815
  }
5792
- function nh(r) {
5793
- return typeof r != "boolean" ? new Error("Argument type: " + typeof r + ". Please use a boolean.") : (Cs = !r, "adapter.js deprecation warnings " + (r ? "disabled" : "enabled"));
5816
+ function dh(r) {
5817
+ return typeof r != "boolean" ? new Error("Argument type: " + typeof r + ". Please use a boolean.") : (ys = !r, "adapter.js deprecation warnings " + (r ? "disabled" : "enabled"));
5794
5818
  }
5795
- function ys() {
5819
+ function Ss() {
5796
5820
  if (typeof window == "object") {
5797
- if (vs)
5821
+ if (Cs)
5798
5822
  return;
5799
5823
  typeof console < "u" && typeof console.log == "function" && console.log.apply(console, arguments);
5800
5824
  }
5801
5825
  }
5802
5826
  function Zt(r, e) {
5803
- Cs && console.warn(r + " is deprecated, please use " + e + " instead.");
5827
+ ys && console.warn(r + " is deprecated, please use " + e + " instead.");
5804
5828
  }
5805
- function oh(r) {
5829
+ function uh(r) {
5806
5830
  const e = { browser: null, version: null };
5807
5831
  if (typeof r > "u" || !r.navigator || !r.navigator.userAgent)
5808
5832
  return e.browser = "Not a browser.", e;
@@ -5837,16 +5861,16 @@ function oh(r) {
5837
5861
  function fi(r) {
5838
5862
  return Object.prototype.toString.call(r) === "[object Object]";
5839
5863
  }
5840
- function Ss(r) {
5864
+ function Ts(r) {
5841
5865
  return fi(r) ? Object.keys(r).reduce(function(e, t) {
5842
- const i = fi(r[t]), s = i ? Ss(r[t]) : r[t], n = i && !Object.keys(s).length;
5866
+ const i = fi(r[t]), s = i ? Ts(r[t]) : r[t], n = i && !Object.keys(s).length;
5843
5867
  return s === void 0 || n ? e : Object.assign(e, { [t]: s });
5844
5868
  }, {}) : r;
5845
5869
  }
5846
- function wt(r, e, t) {
5870
+ function Ot(r, e, t) {
5847
5871
  !e || t.has(e.id) || (t.set(e.id, e), Object.keys(e).forEach((i) => {
5848
- i.endsWith("Id") ? wt(r, r.get(e[i]), t) : i.endsWith("Ids") && e[i].forEach((s) => {
5849
- wt(r, r.get(s), t);
5872
+ i.endsWith("Id") ? Ot(r, r.get(e[i]), t) : i.endsWith("Ids") && e[i].forEach((s) => {
5873
+ Ot(r, r.get(s), t);
5850
5874
  });
5851
5875
  }));
5852
5876
  }
@@ -5859,12 +5883,12 @@ function _i(r, e, t) {
5859
5883
  a.type === "track" && a.trackIdentifier === e.id && n.push(a);
5860
5884
  }), n.forEach((a) => {
5861
5885
  r.forEach((o) => {
5862
- o.type === i && o.trackId === a.id && wt(r, o, s);
5886
+ o.type === i && o.trackId === a.id && Ot(r, o, s);
5863
5887
  });
5864
5888
  }), s;
5865
5889
  }
5866
- const gi = ys;
5867
- function Ts(r, e) {
5890
+ const gi = Ss;
5891
+ function Es(r, e) {
5868
5892
  const t = r && r.navigator;
5869
5893
  if (!t.mediaDevices)
5870
5894
  return;
@@ -5872,44 +5896,44 @@ function Ts(r, e) {
5872
5896
  if (typeof o != "object" || o.mandatory || o.optional)
5873
5897
  return o;
5874
5898
  const u = {};
5875
- return Object.keys(o).forEach((c) => {
5876
- if (c === "require" || c === "advanced" || c === "mediaSource")
5899
+ return Object.keys(o).forEach((d) => {
5900
+ if (d === "require" || d === "advanced" || d === "mediaSource")
5877
5901
  return;
5878
- const d = typeof o[c] == "object" ? o[c] : { ideal: o[c] };
5879
- d.exact !== void 0 && typeof d.exact == "number" && (d.min = d.max = d.exact);
5902
+ const c = typeof o[d] == "object" ? o[d] : { ideal: o[d] };
5903
+ c.exact !== void 0 && typeof c.exact == "number" && (c.min = c.max = c.exact);
5880
5904
  const h = function(p, l) {
5881
5905
  return p ? p + l.charAt(0).toUpperCase() + l.slice(1) : l === "deviceId" ? "sourceId" : l;
5882
5906
  };
5883
- if (d.ideal !== void 0) {
5907
+ if (c.ideal !== void 0) {
5884
5908
  u.optional = u.optional || [];
5885
5909
  let p = {};
5886
- typeof d.ideal == "number" ? (p[h("min", c)] = d.ideal, u.optional.push(p), p = {}, p[h("max", c)] = d.ideal, u.optional.push(p)) : (p[h("", c)] = d.ideal, u.optional.push(p));
5910
+ typeof c.ideal == "number" ? (p[h("min", d)] = c.ideal, u.optional.push(p), p = {}, p[h("max", d)] = c.ideal, u.optional.push(p)) : (p[h("", d)] = c.ideal, u.optional.push(p));
5887
5911
  }
5888
- d.exact !== void 0 && typeof d.exact != "number" ? (u.mandatory = u.mandatory || {}, u.mandatory[h("", c)] = d.exact) : ["min", "max"].forEach((p) => {
5889
- d[p] !== void 0 && (u.mandatory = u.mandatory || {}, u.mandatory[h(p, c)] = d[p]);
5912
+ c.exact !== void 0 && typeof c.exact != "number" ? (u.mandatory = u.mandatory || {}, u.mandatory[h("", d)] = c.exact) : ["min", "max"].forEach((p) => {
5913
+ c[p] !== void 0 && (u.mandatory = u.mandatory || {}, u.mandatory[h(p, d)] = c[p]);
5890
5914
  });
5891
5915
  }), o.advanced && (u.optional = (u.optional || []).concat(o.advanced)), u;
5892
5916
  }, s = function(o, u) {
5893
5917
  if (e.version >= 61)
5894
5918
  return u(o);
5895
5919
  if (o = JSON.parse(JSON.stringify(o)), o && typeof o.audio == "object") {
5896
- const c = function(d, h, p) {
5897
- h in d && !(p in d) && (d[p] = d[h], delete d[h]);
5920
+ const d = function(c, h, p) {
5921
+ h in c && !(p in c) && (c[p] = c[h], delete c[h]);
5898
5922
  };
5899
- o = JSON.parse(JSON.stringify(o)), c(o.audio, "autoGainControl", "googAutoGainControl"), c(o.audio, "noiseSuppression", "googNoiseSuppression"), o.audio = i(o.audio);
5923
+ o = JSON.parse(JSON.stringify(o)), d(o.audio, "autoGainControl", "googAutoGainControl"), d(o.audio, "noiseSuppression", "googNoiseSuppression"), o.audio = i(o.audio);
5900
5924
  }
5901
5925
  if (o && typeof o.video == "object") {
5902
- let c = o.video.facingMode;
5903
- c = c && (typeof c == "object" ? c : { ideal: c });
5904
- const d = e.version < 66;
5905
- if (c && (c.exact === "user" || c.exact === "environment" || c.ideal === "user" || c.ideal === "environment") && !(t.mediaDevices.getSupportedConstraints && t.mediaDevices.getSupportedConstraints().facingMode && !d)) {
5926
+ let d = o.video.facingMode;
5927
+ d = d && (typeof d == "object" ? d : { ideal: d });
5928
+ const c = e.version < 66;
5929
+ if (d && (d.exact === "user" || d.exact === "environment" || d.ideal === "user" || d.ideal === "environment") && !(t.mediaDevices.getSupportedConstraints && t.mediaDevices.getSupportedConstraints().facingMode && !c)) {
5906
5930
  delete o.video.facingMode;
5907
5931
  let h;
5908
- if (c.exact === "environment" || c.ideal === "environment" ? h = ["back", "rear"] : (c.exact === "user" || c.ideal === "user") && (h = ["front"]), h)
5932
+ if (d.exact === "environment" || d.ideal === "environment" ? h = ["back", "rear"] : (d.exact === "user" || d.ideal === "user") && (h = ["front"]), h)
5909
5933
  return t.mediaDevices.enumerateDevices().then((p) => {
5910
5934
  p = p.filter((f) => f.kind === "videoinput");
5911
5935
  let l = p.find((f) => h.some((g) => f.label.toLowerCase().includes(g)));
5912
- return !l && p.length && h.includes("back") && (l = p[p.length - 1]), l && (o.video.deviceId = c.exact ? { exact: l.deviceId } : { ideal: l.deviceId }), o.video = i(o.video), gi("chrome: " + JSON.stringify(o)), u(o);
5936
+ return !l && p.length && h.includes("back") && (l = p[p.length - 1]), l && (o.video.deviceId = d.exact ? { exact: l.deviceId } : { ideal: l.deviceId }), o.video = i(o.video), gi("chrome: " + JSON.stringify(o)), u(o);
5913
5937
  });
5914
5938
  }
5915
5939
  o.video = i(o.video);
@@ -5936,30 +5960,30 @@ function Ts(r, e) {
5936
5960
  return this.name + (this.message && ": ") + this.message;
5937
5961
  }
5938
5962
  };
5939
- }, a = function(o, u, c) {
5940
- s(o, (d) => {
5941
- t.webkitGetUserMedia(d, u, (h) => {
5942
- c && c(n(h));
5963
+ }, a = function(o, u, d) {
5964
+ s(o, (c) => {
5965
+ t.webkitGetUserMedia(c, u, (h) => {
5966
+ d && d(n(h));
5943
5967
  });
5944
5968
  });
5945
5969
  };
5946
5970
  if (t.getUserMedia = a.bind(t), t.mediaDevices.getUserMedia) {
5947
5971
  const o = t.mediaDevices.getUserMedia.bind(t.mediaDevices);
5948
5972
  t.mediaDevices.getUserMedia = function(u) {
5949
- return s(u, (c) => o(c).then((d) => {
5950
- if (c.audio && !d.getAudioTracks().length || c.video && !d.getVideoTracks().length)
5951
- throw d.getTracks().forEach((h) => {
5973
+ return s(u, (d) => o(d).then((c) => {
5974
+ if (d.audio && !c.getAudioTracks().length || d.video && !c.getVideoTracks().length)
5975
+ throw c.getTracks().forEach((h) => {
5952
5976
  h.stop();
5953
5977
  }), new DOMException("", "NotFoundError");
5954
- return d;
5955
- }, (d) => Promise.reject(n(d))));
5978
+ return c;
5979
+ }, (c) => Promise.reject(n(c))));
5956
5980
  };
5957
5981
  }
5958
5982
  }
5959
- function Es(r) {
5983
+ function bs(r) {
5960
5984
  r.MediaStream = r.MediaStream || r.webkitMediaStream;
5961
5985
  }
5962
- function bs(r) {
5986
+ function ks(r) {
5963
5987
  if (typeof r == "object" && r.RTCPeerConnection && !("ontrack" in r.RTCPeerConnection.prototype)) {
5964
5988
  Object.defineProperty(r.RTCPeerConnection.prototype, "ontrack", {
5965
5989
  get() {
@@ -5994,7 +6018,7 @@ function bs(r) {
5994
6018
  { value: { receiver: e.receiver } }
5995
6019
  ), e));
5996
6020
  }
5997
- function ks(r) {
6021
+ function Ps(r) {
5998
6022
  if (typeof r == "object" && r.RTCPeerConnection && !("getSenders" in r.RTCPeerConnection.prototype) && "createDTMFSender" in r.RTCPeerConnection.prototype) {
5999
6023
  const e = function(s, n) {
6000
6024
  return {
@@ -6011,8 +6035,8 @@ function ks(r) {
6011
6035
  };
6012
6036
  const s = r.RTCPeerConnection.prototype.addTrack;
6013
6037
  r.RTCPeerConnection.prototype.addTrack = function(o, u) {
6014
- let c = s.apply(this, arguments);
6015
- return c || (c = e(this, o), this._senders.push(c)), c;
6038
+ let d = s.apply(this, arguments);
6039
+ return d || (d = e(this, o), this._senders.push(d)), d;
6016
6040
  };
6017
6041
  const n = r.RTCPeerConnection.prototype.removeTrack;
6018
6042
  r.RTCPeerConnection.prototype.removeTrack = function(o) {
@@ -6046,7 +6070,7 @@ function ks(r) {
6046
6070
  });
6047
6071
  }
6048
6072
  }
6049
- function Ps(r) {
6073
+ function xs(r) {
6050
6074
  if (!(typeof r == "object" && r.RTCPeerConnection && r.RTCRtpSender && r.RTCRtpReceiver))
6051
6075
  return;
6052
6076
  if (!("getStats" in r.RTCRtpSender.prototype)) {
@@ -6100,7 +6124,7 @@ function Ps(r) {
6100
6124
  return e.apply(this, arguments);
6101
6125
  };
6102
6126
  }
6103
- function xs(r) {
6127
+ function Rs(r) {
6104
6128
  r.RTCPeerConnection.prototype.getLocalStreams = function() {
6105
6129
  return this._shimmedLocalStreams = this._shimmedLocalStreams || {}, Object.keys(this._shimmedLocalStreams).map((a) => this._shimmedLocalStreams[a][0]);
6106
6130
  };
@@ -6114,8 +6138,8 @@ function xs(r) {
6114
6138
  };
6115
6139
  const t = r.RTCPeerConnection.prototype.addStream;
6116
6140
  r.RTCPeerConnection.prototype.addStream = function(a) {
6117
- this._shimmedLocalStreams = this._shimmedLocalStreams || {}, a.getTracks().forEach((c) => {
6118
- if (this.getSenders().find((h) => h.track === c))
6141
+ this._shimmedLocalStreams = this._shimmedLocalStreams || {}, a.getTracks().forEach((d) => {
6142
+ if (this.getSenders().find((h) => h.track === d))
6119
6143
  throw new DOMException(
6120
6144
  "Track already exists.",
6121
6145
  "InvalidAccessError"
@@ -6123,7 +6147,7 @@ function xs(r) {
6123
6147
  });
6124
6148
  const o = this.getSenders();
6125
6149
  t.apply(this, arguments);
6126
- const u = this.getSenders().filter((c) => o.indexOf(c) === -1);
6150
+ const u = this.getSenders().filter((d) => o.indexOf(d) === -1);
6127
6151
  this._shimmedLocalStreams[a.id] = [a].concat(u);
6128
6152
  };
6129
6153
  const i = r.RTCPeerConnection.prototype.removeStream;
@@ -6138,46 +6162,46 @@ function xs(r) {
6138
6162
  }), s.apply(this, arguments);
6139
6163
  };
6140
6164
  }
6141
- function Rs(r, e) {
6165
+ function As(r, e) {
6142
6166
  if (!r.RTCPeerConnection)
6143
6167
  return;
6144
6168
  if (r.RTCPeerConnection.prototype.addTrack && e.version >= 65)
6145
- return xs(r);
6169
+ return Rs(r);
6146
6170
  const t = r.RTCPeerConnection.prototype.getLocalStreams;
6147
6171
  r.RTCPeerConnection.prototype.getLocalStreams = function() {
6148
- const d = t.apply(this);
6149
- return this._reverseStreams = this._reverseStreams || {}, d.map((h) => this._reverseStreams[h.id]);
6172
+ const c = t.apply(this);
6173
+ return this._reverseStreams = this._reverseStreams || {}, c.map((h) => this._reverseStreams[h.id]);
6150
6174
  };
6151
6175
  const i = r.RTCPeerConnection.prototype.addStream;
6152
- r.RTCPeerConnection.prototype.addStream = function(d) {
6153
- if (this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {}, d.getTracks().forEach((h) => {
6176
+ r.RTCPeerConnection.prototype.addStream = function(c) {
6177
+ if (this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {}, c.getTracks().forEach((h) => {
6154
6178
  if (this.getSenders().find((l) => l.track === h))
6155
6179
  throw new DOMException(
6156
6180
  "Track already exists.",
6157
6181
  "InvalidAccessError"
6158
6182
  );
6159
- }), !this._reverseStreams[d.id]) {
6160
- const h = new r.MediaStream(d.getTracks());
6161
- this._streams[d.id] = h, this._reverseStreams[h.id] = d, d = h;
6183
+ }), !this._reverseStreams[c.id]) {
6184
+ const h = new r.MediaStream(c.getTracks());
6185
+ this._streams[c.id] = h, this._reverseStreams[h.id] = c, c = h;
6162
6186
  }
6163
- i.apply(this, [d]);
6187
+ i.apply(this, [c]);
6164
6188
  };
6165
6189
  const s = r.RTCPeerConnection.prototype.removeStream;
6166
- r.RTCPeerConnection.prototype.removeStream = function(d) {
6167
- this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {}, s.apply(this, [this._streams[d.id] || d]), delete this._reverseStreams[this._streams[d.id] ? this._streams[d.id].id : d.id], delete this._streams[d.id];
6168
- }, r.RTCPeerConnection.prototype.addTrack = function(d, h) {
6190
+ r.RTCPeerConnection.prototype.removeStream = function(c) {
6191
+ this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {}, s.apply(this, [this._streams[c.id] || c]), delete this._reverseStreams[this._streams[c.id] ? this._streams[c.id].id : c.id], delete this._streams[c.id];
6192
+ }, r.RTCPeerConnection.prototype.addTrack = function(c, h) {
6169
6193
  if (this.signalingState === "closed")
6170
6194
  throw new DOMException(
6171
6195
  "The RTCPeerConnection's signalingState is 'closed'.",
6172
6196
  "InvalidStateError"
6173
6197
  );
6174
6198
  const p = [].slice.call(arguments, 1);
6175
- if (p.length !== 1 || !p[0].getTracks().find((g) => g === d))
6199
+ if (p.length !== 1 || !p[0].getTracks().find((g) => g === c))
6176
6200
  throw new DOMException(
6177
6201
  "The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.",
6178
6202
  "NotSupportedError"
6179
6203
  );
6180
- if (this.getSenders().find((g) => g.track === d))
6204
+ if (this.getSenders().find((g) => g.track === c))
6181
6205
  throw new DOMException(
6182
6206
  "Track already exists.",
6183
6207
  "InvalidAccessError"
@@ -6185,45 +6209,45 @@ function Rs(r, e) {
6185
6209
  this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {};
6186
6210
  const f = this._streams[h.id];
6187
6211
  if (f)
6188
- f.addTrack(d), Promise.resolve().then(() => {
6212
+ f.addTrack(c), Promise.resolve().then(() => {
6189
6213
  this.dispatchEvent(new Event("negotiationneeded"));
6190
6214
  });
6191
6215
  else {
6192
- const g = new r.MediaStream([d]);
6216
+ const g = new r.MediaStream([c]);
6193
6217
  this._streams[h.id] = g, this._reverseStreams[g.id] = h, this.addStream(g);
6194
6218
  }
6195
- return this.getSenders().find((g) => g.track === d);
6219
+ return this.getSenders().find((g) => g.track === c);
6196
6220
  };
6197
- function n(c, d) {
6198
- let h = d.sdp;
6199
- return Object.keys(c._reverseStreams || []).forEach((p) => {
6200
- const l = c._reverseStreams[p], f = c._streams[l.id];
6221
+ function n(d, c) {
6222
+ let h = c.sdp;
6223
+ return Object.keys(d._reverseStreams || []).forEach((p) => {
6224
+ const l = d._reverseStreams[p], f = d._streams[l.id];
6201
6225
  h = h.replace(
6202
6226
  new RegExp(f.id, "g"),
6203
6227
  l.id
6204
6228
  );
6205
6229
  }), new RTCSessionDescription({
6206
- type: d.type,
6230
+ type: c.type,
6207
6231
  sdp: h
6208
6232
  });
6209
6233
  }
6210
- function a(c, d) {
6211
- let h = d.sdp;
6212
- return Object.keys(c._reverseStreams || []).forEach((p) => {
6213
- const l = c._reverseStreams[p], f = c._streams[l.id];
6234
+ function a(d, c) {
6235
+ let h = c.sdp;
6236
+ return Object.keys(d._reverseStreams || []).forEach((p) => {
6237
+ const l = d._reverseStreams[p], f = d._streams[l.id];
6214
6238
  h = h.replace(
6215
6239
  new RegExp(l.id, "g"),
6216
6240
  f.id
6217
6241
  );
6218
6242
  }), new RTCSessionDescription({
6219
- type: d.type,
6243
+ type: c.type,
6220
6244
  sdp: h
6221
6245
  });
6222
6246
  }
6223
- ["createOffer", "createAnswer"].forEach(function(c) {
6224
- const d = r.RTCPeerConnection.prototype[c], h = { [c]() {
6247
+ ["createOffer", "createAnswer"].forEach(function(d) {
6248
+ const c = r.RTCPeerConnection.prototype[d], h = { [d]() {
6225
6249
  const p = arguments;
6226
- return arguments.length && typeof arguments[0] == "function" ? d.apply(this, [
6250
+ return arguments.length && typeof arguments[0] == "function" ? c.apply(this, [
6227
6251
  (f) => {
6228
6252
  const g = n(this, f);
6229
6253
  p[0].apply(null, [g]);
@@ -6232,9 +6256,9 @@ function Rs(r, e) {
6232
6256
  p[1] && p[1].apply(null, f);
6233
6257
  },
6234
6258
  arguments[2]
6235
- ]) : d.apply(this, arguments).then((f) => n(this, f));
6259
+ ]) : c.apply(this, arguments).then((f) => n(this, f));
6236
6260
  } };
6237
- r.RTCPeerConnection.prototype[c] = h[c];
6261
+ r.RTCPeerConnection.prototype[d] = h[d];
6238
6262
  });
6239
6263
  const o = r.RTCPeerConnection.prototype.setLocalDescription;
6240
6264
  r.RTCPeerConnection.prototype.setLocalDescription = function() {
@@ -6249,19 +6273,19 @@ function Rs(r, e) {
6249
6273
  "localDescription",
6250
6274
  {
6251
6275
  get() {
6252
- const c = u.get.apply(this);
6253
- return c.type === "" ? c : n(this, c);
6276
+ const d = u.get.apply(this);
6277
+ return d.type === "" ? d : n(this, d);
6254
6278
  }
6255
6279
  }
6256
- ), r.RTCPeerConnection.prototype.removeTrack = function(d) {
6280
+ ), r.RTCPeerConnection.prototype.removeTrack = function(c) {
6257
6281
  if (this.signalingState === "closed")
6258
6282
  throw new DOMException(
6259
6283
  "The RTCPeerConnection's signalingState is 'closed'.",
6260
6284
  "InvalidStateError"
6261
6285
  );
6262
- if (!d._pc)
6286
+ if (!c._pc)
6263
6287
  throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.", "TypeError");
6264
- if (!(d._pc === this))
6288
+ if (!(c._pc === this))
6265
6289
  throw new DOMException(
6266
6290
  "Sender was not created by this connection.",
6267
6291
  "InvalidAccessError"
@@ -6269,11 +6293,11 @@ function Rs(r, e) {
6269
6293
  this._streams = this._streams || {};
6270
6294
  let p;
6271
6295
  Object.keys(this._streams).forEach((l) => {
6272
- this._streams[l].getTracks().find((g) => d.track === g) && (p = this._streams[l]);
6273
- }), p && (p.getTracks().length === 1 ? this.removeStream(this._reverseStreams[p.id]) : p.removeTrack(d.track), this.dispatchEvent(new Event("negotiationneeded")));
6296
+ this._streams[l].getTracks().find((g) => c.track === g) && (p = this._streams[l]);
6297
+ }), p && (p.getTracks().length === 1 ? this.removeStream(this._reverseStreams[p.id]) : p.removeTrack(c.track), this.dispatchEvent(new Event("negotiationneeded")));
6274
6298
  };
6275
6299
  }
6276
- function Ot(r, e) {
6300
+ function It(r, e) {
6277
6301
  !r.RTCPeerConnection && r.webkitRTCPeerConnection && (r.RTCPeerConnection = r.webkitRTCPeerConnection), r.RTCPeerConnection && e.version < 53 && ["setLocalDescription", "setRemoteDescription", "addIceCandidate"].forEach(function(t) {
6278
6302
  const i = r.RTCPeerConnection.prototype[t], s = { [t]() {
6279
6303
  return arguments[0] = new (t === "addIceCandidate" ? r.RTCIceCandidate : r.RTCSessionDescription)(arguments[0]), i.apply(this, arguments);
@@ -6281,7 +6305,7 @@ function Ot(r, e) {
6281
6305
  r.RTCPeerConnection.prototype[t] = s[t];
6282
6306
  });
6283
6307
  }
6284
- function As(r, e) {
6308
+ function ws(r, e) {
6285
6309
  de(r, "negotiationneeded", (t) => {
6286
6310
  const i = t.target;
6287
6311
  if (!((e.version < 72 || i.getConfiguration && i.getConfiguration().sdpSemantics === "plan-b") && i.signalingState !== "stable"))
@@ -6290,17 +6314,17 @@ function As(r, e) {
6290
6314
  }
6291
6315
  const vi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6292
6316
  __proto__: null,
6293
- fixNegotiationNeeded: As,
6294
- shimAddTrackRemoveTrack: Rs,
6295
- shimAddTrackRemoveTrackWithNative: xs,
6296
- shimGetSendersWithDtmf: ks,
6297
- shimGetUserMedia: Ts,
6298
- shimMediaStream: Es,
6299
- shimOnTrack: bs,
6300
- shimPeerConnection: Ot,
6301
- shimSenderReceiverGetStats: Ps
6317
+ fixNegotiationNeeded: ws,
6318
+ shimAddTrackRemoveTrack: As,
6319
+ shimAddTrackRemoveTrackWithNative: Rs,
6320
+ shimGetSendersWithDtmf: Ps,
6321
+ shimGetUserMedia: Es,
6322
+ shimMediaStream: bs,
6323
+ shimOnTrack: ks,
6324
+ shimPeerConnection: It,
6325
+ shimSenderReceiverGetStats: xs
6302
6326
  }, Symbol.toStringTag, { value: "Module" }));
6303
- function ws(r, e) {
6327
+ function Os(r, e) {
6304
6328
  const t = r && r.navigator, i = r && r.MediaStreamTrack;
6305
6329
  if (t.getUserMedia = function(s, n, a) {
6306
6330
  Zt(
@@ -6328,7 +6352,7 @@ function ws(r, e) {
6328
6352
  }
6329
6353
  }
6330
6354
  }
6331
- function ah(r, e) {
6355
+ function hh(r, e) {
6332
6356
  r.navigator.mediaDevices && "getDisplayMedia" in r.navigator.mediaDevices || r.navigator.mediaDevices && (r.navigator.mediaDevices.getDisplayMedia = function(i) {
6333
6357
  if (!(i && i.video)) {
6334
6358
  const s = new DOMException("getDisplayMedia without video constraints is undefined");
@@ -6337,14 +6361,14 @@ function ah(r, e) {
6337
6361
  return i.video === !0 ? i.video = { mediaSource: e } : i.video.mediaSource = e, r.navigator.mediaDevices.getUserMedia(i);
6338
6362
  });
6339
6363
  }
6340
- function Os(r) {
6364
+ function Is(r) {
6341
6365
  typeof r == "object" && r.RTCTrackEvent && "receiver" in r.RTCTrackEvent.prototype && !("transceiver" in r.RTCTrackEvent.prototype) && Object.defineProperty(r.RTCTrackEvent.prototype, "transceiver", {
6342
6366
  get() {
6343
6367
  return { receiver: this.receiver };
6344
6368
  }
6345
6369
  });
6346
6370
  }
6347
- function It(r, e) {
6371
+ function Dt(r, e) {
6348
6372
  if (typeof r != "object" || !(r.RTCPeerConnection || r.mozRTCPeerConnection))
6349
6373
  return;
6350
6374
  !r.RTCPeerConnection && r.mozRTCPeerConnection && (r.RTCPeerConnection = r.mozRTCPeerConnection), e.version < 53 && ["setLocalDescription", "setRemoteDescription", "addIceCandidate"].forEach(function(s) {
@@ -6365,15 +6389,15 @@ function It(r, e) {
6365
6389
  return i.apply(this, [n || null]).then((u) => {
6366
6390
  if (e.version < 53 && !a)
6367
6391
  try {
6368
- u.forEach((c) => {
6369
- c.type = t[c.type] || c.type;
6392
+ u.forEach((d) => {
6393
+ d.type = t[d.type] || d.type;
6370
6394
  });
6371
- } catch (c) {
6372
- if (c.name !== "TypeError")
6373
- throw c;
6374
- u.forEach((d, h) => {
6375
- u.set(h, Object.assign({}, d, {
6376
- type: t[d.type] || d.type
6395
+ } catch (d) {
6396
+ if (d.name !== "TypeError")
6397
+ throw d;
6398
+ u.forEach((c, h) => {
6399
+ u.set(h, Object.assign({}, c, {
6400
+ type: t[c.type] || c.type
6377
6401
  }));
6378
6402
  });
6379
6403
  }
@@ -6381,7 +6405,7 @@ function It(r, e) {
6381
6405
  }).then(a, o);
6382
6406
  };
6383
6407
  }
6384
- function Is(r) {
6408
+ function Ds(r) {
6385
6409
  if (!(typeof r == "object" && r.RTCPeerConnection && r.RTCRtpSender) || r.RTCRtpSender && "getStats" in r.RTCRtpSender.prototype)
6386
6410
  return;
6387
6411
  const e = r.RTCPeerConnection.prototype.getSenders;
@@ -6408,17 +6432,17 @@ function Ms(r) {
6408
6432
  return this._pc.getStats(this.track);
6409
6433
  };
6410
6434
  }
6411
- function Ds(r) {
6435
+ function Ls(r) {
6412
6436
  !r.RTCPeerConnection || "removeStream" in r.RTCPeerConnection.prototype || (r.RTCPeerConnection.prototype.removeStream = function(t) {
6413
6437
  Zt("removeStream", "removeTrack"), this.getSenders().forEach((i) => {
6414
6438
  i.track && t.getTracks().includes(i.track) && this.removeTrack(i);
6415
6439
  });
6416
6440
  });
6417
6441
  }
6418
- function Ls(r) {
6442
+ function Fs(r) {
6419
6443
  r.DataChannel && !r.RTCDataChannel && (r.RTCDataChannel = r.DataChannel);
6420
6444
  }
6421
- function Fs(r) {
6445
+ function Ns(r) {
6422
6446
  if (!(typeof r == "object" && r.RTCPeerConnection))
6423
6447
  return;
6424
6448
  const e = r.RTCPeerConnection.prototype.addTransceiver;
@@ -6450,7 +6474,7 @@ function Fs(r) {
6450
6474
  return n;
6451
6475
  });
6452
6476
  }
6453
- function Ns(r) {
6477
+ function Vs(r) {
6454
6478
  if (!(typeof r == "object" && r.RTCRtpSender))
6455
6479
  return;
6456
6480
  const e = r.RTCRtpSender.prototype.getParameters;
@@ -6459,7 +6483,7 @@ function Ns(r) {
6459
6483
  return "encodings" in i || (i.encodings = [].concat(this.sendEncodings || [{}])), i;
6460
6484
  });
6461
6485
  }
6462
- function Vs(r) {
6486
+ function Us(r) {
6463
6487
  if (!(typeof r == "object" && r.RTCPeerConnection))
6464
6488
  return;
6465
6489
  const e = r.RTCPeerConnection.prototype.createOffer;
@@ -6469,7 +6493,7 @@ function Vs(r) {
6469
6493
  }) : e.apply(this, arguments);
6470
6494
  };
6471
6495
  }
6472
- function Us(r) {
6496
+ function $s(r) {
6473
6497
  if (!(typeof r == "object" && r.RTCPeerConnection))
6474
6498
  return;
6475
6499
  const e = r.RTCPeerConnection.prototype.createAnswer;
@@ -6481,20 +6505,20 @@ function Us(r) {
6481
6505
  }
6482
6506
  const Ci = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6483
6507
  __proto__: null,
6484
- shimAddTransceiver: Fs,
6485
- shimCreateAnswer: Us,
6486
- shimCreateOffer: Vs,
6487
- shimGetDisplayMedia: ah,
6488
- shimGetParameters: Ns,
6489
- shimGetUserMedia: ws,
6490
- shimOnTrack: Os,
6491
- shimPeerConnection: It,
6492
- shimRTCDataChannel: Ls,
6508
+ shimAddTransceiver: Ns,
6509
+ shimCreateAnswer: $s,
6510
+ shimCreateOffer: Us,
6511
+ shimGetDisplayMedia: hh,
6512
+ shimGetParameters: Vs,
6513
+ shimGetUserMedia: Os,
6514
+ shimOnTrack: Is,
6515
+ shimPeerConnection: Dt,
6516
+ shimRTCDataChannel: Fs,
6493
6517
  shimReceiverGetStats: Ms,
6494
- shimRemoveStream: Ds,
6495
- shimSenderGetStats: Is
6518
+ shimRemoveStream: Ls,
6519
+ shimSenderGetStats: Ds
6496
6520
  }, Symbol.toStringTag, { value: "Module" }));
6497
- function $s(r) {
6521
+ function Bs(r) {
6498
6522
  if (!(typeof r != "object" || !r.RTCPeerConnection)) {
6499
6523
  if ("getLocalStreams" in r.RTCPeerConnection.prototype || (r.RTCPeerConnection.prototype.getLocalStreams = function() {
6500
6524
  return this._localStreams || (this._localStreams = []), this._localStreams;
@@ -6529,7 +6553,7 @@ function $s(r) {
6529
6553
  });
6530
6554
  }
6531
6555
  }
6532
- function Bs(r) {
6556
+ function js(r) {
6533
6557
  if (!(typeof r != "object" || !r.RTCPeerConnection) && ("getRemoteStreams" in r.RTCPeerConnection.prototype || (r.RTCPeerConnection.prototype.getRemoteStreams = function() {
6534
6558
  return this._remoteStreams ? this._remoteStreams : [];
6535
6559
  }), !("onaddstream" in r.RTCPeerConnection.prototype))) {
@@ -6564,47 +6588,47 @@ function Bs(r) {
6564
6588
  };
6565
6589
  }
6566
6590
  }
6567
- function js(r) {
6591
+ function zs(r) {
6568
6592
  if (typeof r != "object" || !r.RTCPeerConnection)
6569
6593
  return;
6570
6594
  const e = r.RTCPeerConnection.prototype, t = e.createOffer, i = e.createAnswer, s = e.setLocalDescription, n = e.setRemoteDescription, a = e.addIceCandidate;
6571
- e.createOffer = function(c, d) {
6595
+ e.createOffer = function(d, c) {
6572
6596
  const h = arguments.length >= 2 ? arguments[2] : arguments[0], p = t.apply(this, [h]);
6573
- return d ? (p.then(c, d), Promise.resolve()) : p;
6574
- }, e.createAnswer = function(c, d) {
6597
+ return c ? (p.then(d, c), Promise.resolve()) : p;
6598
+ }, e.createAnswer = function(d, c) {
6575
6599
  const h = arguments.length >= 2 ? arguments[2] : arguments[0], p = i.apply(this, [h]);
6576
- return d ? (p.then(c, d), Promise.resolve()) : p;
6600
+ return c ? (p.then(d, c), Promise.resolve()) : p;
6577
6601
  };
6578
- let o = function(u, c, d) {
6602
+ let o = function(u, d, c) {
6579
6603
  const h = s.apply(this, [u]);
6580
- return d ? (h.then(c, d), Promise.resolve()) : h;
6604
+ return c ? (h.then(d, c), Promise.resolve()) : h;
6581
6605
  };
6582
- e.setLocalDescription = o, o = function(u, c, d) {
6606
+ e.setLocalDescription = o, o = function(u, d, c) {
6583
6607
  const h = n.apply(this, [u]);
6584
- return d ? (h.then(c, d), Promise.resolve()) : h;
6585
- }, e.setRemoteDescription = o, o = function(u, c, d) {
6608
+ return c ? (h.then(d, c), Promise.resolve()) : h;
6609
+ }, e.setRemoteDescription = o, o = function(u, d, c) {
6586
6610
  const h = a.apply(this, [u]);
6587
- return d ? (h.then(c, d), Promise.resolve()) : h;
6611
+ return c ? (h.then(d, c), Promise.resolve()) : h;
6588
6612
  }, e.addIceCandidate = o;
6589
6613
  }
6590
- function zs(r) {
6614
+ function Gs(r) {
6591
6615
  const e = r && r.navigator;
6592
6616
  if (e.mediaDevices && e.mediaDevices.getUserMedia) {
6593
6617
  const t = e.mediaDevices, i = t.getUserMedia.bind(t);
6594
- e.mediaDevices.getUserMedia = (s) => i(Gs(s));
6618
+ e.mediaDevices.getUserMedia = (s) => i(Hs(s));
6595
6619
  }
6596
6620
  !e.getUserMedia && e.mediaDevices && e.mediaDevices.getUserMedia && (e.getUserMedia = (function(i, s, n) {
6597
6621
  e.mediaDevices.getUserMedia(i).then(s, n);
6598
6622
  }).bind(e));
6599
6623
  }
6600
- function Gs(r) {
6624
+ function Hs(r) {
6601
6625
  return r && r.video !== void 0 ? Object.assign(
6602
6626
  {},
6603
6627
  r,
6604
- { video: Ss(r.video) }
6628
+ { video: Ts(r.video) }
6605
6629
  ) : r;
6606
6630
  }
6607
- function Hs(r) {
6631
+ function qs(r) {
6608
6632
  if (!r.RTCPeerConnection)
6609
6633
  return;
6610
6634
  const e = r.RTCPeerConnection;
@@ -6624,14 +6648,14 @@ function Hs(r) {
6624
6648
  }
6625
6649
  });
6626
6650
  }
6627
- function qs(r) {
6651
+ function Ws(r) {
6628
6652
  typeof r == "object" && r.RTCTrackEvent && "receiver" in r.RTCTrackEvent.prototype && !("transceiver" in r.RTCTrackEvent.prototype) && Object.defineProperty(r.RTCTrackEvent.prototype, "transceiver", {
6629
6653
  get() {
6630
6654
  return { receiver: this.receiver };
6631
6655
  }
6632
6656
  });
6633
6657
  }
6634
- function Ws(r) {
6658
+ function Xs(r) {
6635
6659
  const e = r.RTCPeerConnection.prototype.createOffer;
6636
6660
  r.RTCPeerConnection.prototype.createOffer = function(i) {
6637
6661
  if (i) {
@@ -6644,23 +6668,23 @@ function Ws(r) {
6644
6668
  return e.apply(this, arguments);
6645
6669
  };
6646
6670
  }
6647
- function Xs(r) {
6671
+ function Ks(r) {
6648
6672
  typeof r != "object" || r.AudioContext || (r.AudioContext = r.webkitAudioContext);
6649
6673
  }
6650
6674
  const yi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6651
6675
  __proto__: null,
6652
- shimAudioContext: Xs,
6653
- shimCallbacksAPI: js,
6654
- shimConstraints: Gs,
6655
- shimCreateOfferLegacy: Ws,
6656
- shimGetUserMedia: zs,
6657
- shimLocalStreamsAPI: $s,
6658
- shimRTCIceServerUrls: Hs,
6659
- shimRemoteStreamsAPI: Bs,
6660
- shimTrackEventTransceiver: qs
6676
+ shimAudioContext: Ks,
6677
+ shimCallbacksAPI: zs,
6678
+ shimConstraints: Hs,
6679
+ shimCreateOfferLegacy: Xs,
6680
+ shimGetUserMedia: Gs,
6681
+ shimLocalStreamsAPI: Bs,
6682
+ shimRTCIceServerUrls: qs,
6683
+ shimRemoteStreamsAPI: js,
6684
+ shimTrackEventTransceiver: Ws
6661
6685
  }, Symbol.toStringTag, { value: "Module" }));
6662
- var ft = { exports: {} }, Si;
6663
- function ch() {
6686
+ var _t = { exports: {} }, Si;
6687
+ function ph() {
6664
6688
  return Si || (Si = 1, function(r) {
6665
6689
  const e = {};
6666
6690
  e.generateIdentifier = function() {
@@ -6870,22 +6894,22 @@ a=ice-pwd:` + t.password + `\r
6870
6894
  }, n = e.splitLines(t)[0].split(" ");
6871
6895
  i.profile = n[2];
6872
6896
  for (let o = 3; o < n.length; o++) {
6873
- const u = n[o], c = e.matchPrefix(
6897
+ const u = n[o], d = e.matchPrefix(
6874
6898
  t,
6875
6899
  "a=rtpmap:" + u + " "
6876
6900
  )[0];
6877
- if (c) {
6878
- const d = e.parseRtpMap(c), h = e.matchPrefix(
6901
+ if (d) {
6902
+ const c = e.parseRtpMap(d), h = e.matchPrefix(
6879
6903
  t,
6880
6904
  "a=fmtp:" + u + " "
6881
6905
  );
6882
- switch (d.parameters = h.length ? e.parseFmtp(h[0]) : {}, d.rtcpFeedback = e.matchPrefix(
6906
+ switch (c.parameters = h.length ? e.parseFmtp(h[0]) : {}, c.rtcpFeedback = e.matchPrefix(
6883
6907
  t,
6884
6908
  "a=rtcp-fb:" + u + " "
6885
- ).map(e.parseRtcpFb), i.codecs.push(d), d.name.toUpperCase()) {
6909
+ ).map(e.parseRtcpFb), i.codecs.push(c), c.name.toUpperCase()) {
6886
6910
  case "RED":
6887
6911
  case "ULPFEC":
6888
- i.fecMechanisms.push(d.name.toUpperCase());
6912
+ i.fecMechanisms.push(c.name.toUpperCase());
6889
6913
  break;
6890
6914
  }
6891
6915
  }
@@ -6896,7 +6920,7 @@ a=ice-pwd:` + t.password + `\r
6896
6920
  const a = e.matchPrefix(t, "a=rtcp-fb:* ").map(e.parseRtcpFb);
6897
6921
  return i.codecs.forEach((o) => {
6898
6922
  a.forEach((u) => {
6899
- o.rtcpFeedback.find((d) => d.type === u.type && d.parameter === u.parameter) || o.rtcpFeedback.push(u);
6923
+ o.rtcpFeedback.find((c) => c.type === u.type && c.parameter === u.parameter) || o.rtcpFeedback.push(u);
6900
6924
  });
6901
6925
  }), i;
6902
6926
  }, e.writeRtpDescription = function(t, i) {
@@ -6916,15 +6940,15 @@ a=ice-pwd:` + t.password + `\r
6916
6940
  }), s;
6917
6941
  }, e.parseRtpEncodingParameters = function(t) {
6918
6942
  const i = [], s = e.parseRtpParameters(t), n = s.fecMechanisms.indexOf("RED") !== -1, a = s.fecMechanisms.indexOf("ULPFEC") !== -1, o = e.matchPrefix(t, "a=ssrc:").map((p) => e.parseSsrcMedia(p)).filter((p) => p.attribute === "cname"), u = o.length > 0 && o[0].ssrc;
6919
- let c;
6920
- const d = e.matchPrefix(t, "a=ssrc-group:FID").map((p) => p.substring(17).split(" ").map((f) => parseInt(f, 10)));
6921
- d.length > 0 && d[0].length > 1 && d[0][0] === u && (c = d[0][1]), s.codecs.forEach((p) => {
6943
+ let d;
6944
+ const c = e.matchPrefix(t, "a=ssrc-group:FID").map((p) => p.substring(17).split(" ").map((f) => parseInt(f, 10)));
6945
+ c.length > 0 && c[0].length > 1 && c[0][0] === u && (d = c[0][1]), s.codecs.forEach((p) => {
6922
6946
  if (p.name.toUpperCase() === "RTX" && p.parameters.apt) {
6923
6947
  let l = {
6924
6948
  ssrc: u,
6925
6949
  codecPayloadType: parseInt(p.parameters.apt, 10)
6926
6950
  };
6927
- u && c && (l.rtx = { ssrc: c }), i.push(l), n && (l = JSON.parse(JSON.stringify(l)), l.fec = {
6951
+ u && d && (l.rtx = { ssrc: d }), i.push(l), n && (l = JSON.parse(JSON.stringify(l)), l.fec = {
6928
6952
  ssrc: u,
6929
6953
  mechanism: a ? "red+ulpfec" : "red"
6930
6954
  }, i.push(l));
@@ -7047,13 +7071,13 @@ t=0 0\r
7047
7071
  return !1;
7048
7072
  return !0;
7049
7073
  }, r.exports = e;
7050
- }(ft)), ft.exports;
7074
+ }(_t)), _t.exports;
7051
7075
  }
7052
- var Ks = ch();
7053
- const le = /* @__PURE__ */ Ge(Ks), dh = /* @__PURE__ */ en({
7076
+ var Js = ph();
7077
+ const le = /* @__PURE__ */ Ge(Js), lh = /* @__PURE__ */ tn({
7054
7078
  __proto__: null,
7055
7079
  default: le
7056
- }, [Ks]);
7080
+ }, [Js]);
7057
7081
  function Ne(r) {
7058
7082
  if (!r.RTCIceCandidate || r.RTCIceCandidate && "foundation" in r.RTCIceCandidate.prototype)
7059
7083
  return;
@@ -7107,27 +7131,27 @@ function Ve(r, e) {
7107
7131
  if (!o || !o.sdp)
7108
7132
  return !1;
7109
7133
  const u = le.splitSections(o.sdp);
7110
- return u.shift(), u.some((c) => {
7111
- const d = le.parseMLine(c);
7112
- return d && d.kind === "application" && d.protocol.indexOf("SCTP") !== -1;
7134
+ return u.shift(), u.some((d) => {
7135
+ const c = le.parseMLine(d);
7136
+ return c && c.kind === "application" && c.protocol.indexOf("SCTP") !== -1;
7113
7137
  });
7114
7138
  }, i = function(o) {
7115
7139
  const u = o.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);
7116
7140
  if (u === null || u.length < 2)
7117
7141
  return -1;
7118
- const c = parseInt(u[1], 10);
7119
- return c !== c ? -1 : c;
7142
+ const d = parseInt(u[1], 10);
7143
+ return d !== d ? -1 : d;
7120
7144
  }, s = function(o) {
7121
7145
  let u = 65536;
7122
7146
  return e.browser === "firefox" && (e.version < 57 ? o === -1 ? u = 16384 : u = 2147483637 : e.version < 60 ? u = e.version === 57 ? 65535 : 65536 : u = 2147483637), u;
7123
7147
  }, n = function(o, u) {
7124
- let c = 65536;
7125
- e.browser === "firefox" && e.version === 57 && (c = 65535);
7126
- const d = le.matchPrefix(
7148
+ let d = 65536;
7149
+ e.browser === "firefox" && e.version === 57 && (d = 65535);
7150
+ const c = le.matchPrefix(
7127
7151
  o.sdp,
7128
7152
  "a=max-message-size:"
7129
7153
  );
7130
- return d.length > 0 ? c = parseInt(d[0].substring(19), 10) : e.browser === "firefox" && u !== -1 && (c = 2147483637), c;
7154
+ return c.length > 0 ? d = parseInt(c[0].substring(19), 10) : e.browser === "firefox" && u !== -1 && (d = 2147483637), d;
7131
7155
  }, a = r.RTCPeerConnection.prototype.setRemoteDescription;
7132
7156
  r.RTCPeerConnection.prototype.setRemoteDescription = function() {
7133
7157
  if (this._sctp = null, e.browser === "chrome" && e.version >= 76) {
@@ -7141,9 +7165,9 @@ function Ve(r, e) {
7141
7165
  });
7142
7166
  }
7143
7167
  if (t(arguments[0])) {
7144
- const u = i(arguments[0]), c = s(u), d = n(arguments[0], u);
7168
+ const u = i(arguments[0]), d = s(u), c = n(arguments[0], u);
7145
7169
  let h;
7146
- c === 0 && d === 0 ? h = Number.POSITIVE_INFINITY : c === 0 || d === 0 ? h = Math.max(c, d) : h = Math.min(c, d);
7170
+ d === 0 && c === 0 ? h = Number.POSITIVE_INFINITY : d === 0 || c === 0 ? h = Math.max(d, c) : h = Math.min(d, c);
7147
7171
  const p = {};
7148
7172
  Object.defineProperty(p, "maxMessageSize", {
7149
7173
  get() {
@@ -7172,7 +7196,7 @@ function Ue(r) {
7172
7196
  return e(s, this), s;
7173
7197
  }, de(r, "datachannel", (i) => (e(i.channel, i.target), i));
7174
7198
  }
7175
- function Dt(r) {
7199
+ function Lt(r) {
7176
7200
  if (!r.RTCPeerConnection || "connectionState" in r.RTCPeerConnection.prototype)
7177
7201
  return;
7178
7202
  const e = r.RTCPeerConnection.prototype;
@@ -7218,7 +7242,7 @@ function Dt(r) {
7218
7242
  };
7219
7243
  });
7220
7244
  }
7221
- function Lt(r, e) {
7245
+ function Ft(r, e) {
7222
7246
  if (!r.RTCPeerConnection || e.browser === "chrome" && e.version >= 71 || e.browser === "safari" && e.version >= 605)
7223
7247
  return;
7224
7248
  const t = r.RTCPeerConnection.prototype.setRemoteDescription;
@@ -7266,48 +7290,48 @@ function Be(r, e) {
7266
7290
  return s.sdp || s.type !== "offer" && s.type !== "answer" ? t.apply(this, [s]) : (s.type === "offer" ? this.createOffer : this.createAnswer).apply(this).then((a) => t.apply(this, [a]));
7267
7291
  });
7268
7292
  }
7269
- const uh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7293
+ const mh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7270
7294
  __proto__: null,
7271
- removeExtmapAllowMixed: Lt,
7295
+ removeExtmapAllowMixed: Ft,
7272
7296
  shimAddIceCandidateNullOrEmpty: $e,
7273
- shimConnectionState: Dt,
7297
+ shimConnectionState: Lt,
7274
7298
  shimMaxMessageSize: Ve,
7275
7299
  shimParameterlessSetLocalDescription: Be,
7276
7300
  shimRTCIceCandidate: Ne,
7277
7301
  shimRTCIceCandidateRelayProtocol: Mt,
7278
7302
  shimSendThrowTypeError: Ue
7279
7303
  }, Symbol.toStringTag, { value: "Module" }));
7280
- function hh({ window: r } = {}, e = {
7304
+ function fh({ window: r } = {}, e = {
7281
7305
  shimChrome: !0,
7282
7306
  shimFirefox: !0,
7283
7307
  shimSafari: !0
7284
7308
  }) {
7285
- const t = ys, i = oh(r), s = {
7309
+ const t = Ss, i = uh(r), s = {
7286
7310
  browserDetails: i,
7287
- commonShim: uh,
7311
+ commonShim: mh,
7288
7312
  extractVersion: Fe,
7289
- disableLog: sh,
7290
- disableWarnings: nh,
7313
+ disableLog: ch,
7314
+ disableWarnings: dh,
7291
7315
  // Expose sdp as a convenience. For production apps include directly.
7292
- sdp: dh
7316
+ sdp: lh
7293
7317
  };
7294
7318
  switch (i.browser) {
7295
7319
  case "chrome":
7296
- if (!vi || !Ot || !e.shimChrome)
7320
+ if (!vi || !It || !e.shimChrome)
7297
7321
  return t("Chrome shim is not included in this adapter release."), s;
7298
7322
  if (i.version === null)
7299
7323
  return t("Chrome shim can not determine version, not shimming."), s;
7300
- t("adapter.js shimming chrome."), s.browserShim = vi, $e(r, i), Be(r), Ts(r, i), Es(r), Ot(r, i), bs(r), Rs(r, i), ks(r), Ps(r), As(r, i), Ne(r), Mt(r), Dt(r), Ve(r, i), Ue(r), Lt(r, i);
7324
+ t("adapter.js shimming chrome."), s.browserShim = vi, $e(r, i), Be(r), Es(r, i), bs(r), It(r, i), ks(r), As(r, i), Ps(r), xs(r), ws(r, i), Ne(r), Mt(r), Lt(r), Ve(r, i), Ue(r), Ft(r, i);
7301
7325
  break;
7302
7326
  case "firefox":
7303
- if (!Ci || !It || !e.shimFirefox)
7327
+ if (!Ci || !Dt || !e.shimFirefox)
7304
7328
  return t("Firefox shim is not included in this adapter release."), s;
7305
- t("adapter.js shimming firefox."), s.browserShim = Ci, $e(r, i), Be(r), ws(r, i), It(r, i), Os(r), Ds(r), Is(r), Ms(r), Ls(r), Fs(r), Ns(r), Vs(r), Us(r), Ne(r), Dt(r), Ve(r, i), Ue(r);
7329
+ t("adapter.js shimming firefox."), s.browserShim = Ci, $e(r, i), Be(r), Os(r, i), Dt(r, i), Is(r), Ls(r), Ds(r), Ms(r), Fs(r), Ns(r), Vs(r), Us(r), $s(r), Ne(r), Lt(r), Ve(r, i), Ue(r);
7306
7330
  break;
7307
7331
  case "safari":
7308
7332
  if (!yi || !e.shimSafari)
7309
7333
  return t("Safari shim is not included in this adapter release."), s;
7310
- t("adapter.js shimming safari."), s.browserShim = yi, $e(r, i), Be(r), Hs(r), Ws(r), js(r), $s(r), Bs(r), qs(r), zs(r), Xs(r), Ne(r), Mt(r), Ve(r, i), Ue(r), Lt(r, i);
7334
+ t("adapter.js shimming safari."), s.browserShim = yi, $e(r, i), Be(r), qs(r), Xs(r), zs(r), Bs(r), js(r), Ws(r), Gs(r), Ks(r), Ne(r), Mt(r), Ve(r, i), Ue(r), Ft(r, i);
7311
7335
  break;
7312
7336
  default:
7313
7337
  t("Unsupported browser!");
@@ -7315,8 +7339,8 @@ function hh({ window: r } = {}, e = {
7315
7339
  }
7316
7340
  return s;
7317
7341
  }
7318
- hh({ window: typeof window > "u" ? void 0 : window });
7319
- class fh extends te {
7342
+ fh({ window: typeof window > "u" ? void 0 : window });
7343
+ class Ch extends te {
7320
7344
  /** {zh}
7321
7345
  * @brief 查询是否支持 RTM 或 WebTransport 推流。
7322
7346
  * @param mode 推流模式。
@@ -7332,9 +7356,9 @@ class fh extends te {
7332
7356
  */
7333
7357
  static async isSupported(e) {
7334
7358
  if (e === "webTransport")
7335
- return Promise.resolve(_s.isSupported());
7359
+ return Promise.resolve(gs.isSupported());
7336
7360
  try {
7337
- return Yu() || !window.RTCPeerConnection || !window.RTCPeerConnection.prototype.addTransceiver || !window.RTCPeerConnection.prototype.createDataChannel ? !1 : await th() && await eh();
7361
+ return th() || !window.RTCPeerConnection || !window.RTCPeerConnection.prototype.addTransceiver || !window.RTCPeerConnection.prototype.createDataChannel ? !1 : await nh() && await sh();
7338
7362
  } catch {
7339
7363
  return !1;
7340
7364
  }
@@ -7350,11 +7374,11 @@ class fh extends te {
7350
7374
  * @return LivePusher instance.
7351
7375
  */
7352
7376
  constructor(e) {
7353
- super(), this._streamManagerController = new Su(), this._streamComposeController = new Ou(
7377
+ super(), this._streamManagerController = new Tu(), this._streamComposeController = new Iu(
7354
7378
  this._streamManagerController
7355
- ), this._streamConsumeController = new Ju(
7379
+ ), this._streamConsumeController = new eh(
7356
7380
  this._streamComposeController
7357
- ), this._streamConsumeController.setPushConfig(e), this._observer = ih, this._bindEvent();
7381
+ ), this._streamConsumeController.setPushConfig(e), this._observer = ah, this._bindEvent();
7358
7382
  }
7359
7383
  /** {zh}
7360
7384
  * @brief 获取设备列表,包括音频输入设备和视频输入设备。
@@ -7880,7 +7904,7 @@ class fh extends te {
7880
7904
  * @param config The video stream layout parameters can be a single object or an array of multiple objects.
7881
7905
  */
7882
7906
  addVideoStream(e) {
7883
- D(e) ? e.forEach((t) => {
7907
+ M(e) ? e.forEach((t) => {
7884
7908
  this._streamComposeController.addVideoStream(t);
7885
7909
  }) : this._streamComposeController.addVideoStream(e);
7886
7910
  }
@@ -7906,7 +7930,7 @@ class fh extends te {
7906
7930
  * @param config Update the video stream parameters. When an array is passed, multiple video streams are updated.
7907
7931
  */
7908
7932
  updateVideoStream(e) {
7909
- D(e) ? this._streamComposeController.updateVideoStream(e) : this._streamComposeController.updateVideoStream([e]);
7933
+ M(e) ? this._streamComposeController.updateVideoStream(e) : this._streamComposeController.updateVideoStream([e]);
7910
7934
  }
7911
7935
  /** {zh}
7912
7936
  * @brief 隐藏合流画布中的视频流。当需要暂时隐藏某个视频画面,但不想从合流画布中移除该视频流时使用。
@@ -7944,7 +7968,7 @@ class fh extends te {
7944
7968
  * @param config Audio stream parameters can be a single object or an array of multiple objects.
7945
7969
  */
7946
7970
  addAudioStream(e) {
7947
- D(e) ? e.map(
7971
+ M(e) ? e.map(
7948
7972
  (t) => this._streamComposeController.addAudioStream(t)
7949
7973
  ) : this._streamComposeController.addAudioStream(e);
7950
7974
  }
@@ -7978,7 +8002,7 @@ class fh extends te {
7978
8002
  * - Call `updateAudioStream()` to update the parameters of the audio stream.
7979
8003
  */
7980
8004
  updateAudioStream(e) {
7981
- D(e) ? this._streamComposeController.updateAudioStream(e) : this._streamComposeController.updateAudioStream([e]);
8005
+ M(e) ? this._streamComposeController.updateAudioStream(e) : this._streamComposeController.updateAudioStream([e]);
7982
8006
  }
7983
8007
  /** {zh}
7984
8008
  * @brief 静音指定的音频流或包含音频轨道的视频流。在某个音频流内容不需要被输出时使用。
@@ -8055,7 +8079,7 @@ class fh extends te {
8055
8079
  );
8056
8080
  break;
8057
8081
  case "setVolumeDetectScriptUrl":
8058
- Xe.instance.volumeDetectScriptUrl = t;
8082
+ Ke.instance.volumeDetectScriptUrl = t;
8059
8083
  break;
8060
8084
  case "setMixerWorkerScriptUrl":
8061
8085
  this._streamComposeController.setMixerWorkerScript(
@@ -8227,7 +8251,7 @@ class fh extends te {
8227
8251
  () => {
8228
8252
  this.observer.onCaptureFirstVideoFrame();
8229
8253
  }
8230
- ), ao((e) => {
8254
+ ), co((e) => {
8231
8255
  e.deviceInfo.kind === "videoinput" ? this.observer.onCameraChanged(e.deviceInfo) : e.deviceInfo.kind === "audioinput" && this.observer.onMicrophoneChanged(e.deviceInfo);
8232
8256
  });
8233
8257
  }
@@ -8297,5 +8321,5 @@ class fh extends te {
8297
8321
  }
8298
8322
  }
8299
8323
  export {
8300
- fh as default
8324
+ Ch as default
8301
8325
  };