@nainudhin/video-meeting-sdk 1.12.0 → 1.12.1

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/meet-sdk.mjs CHANGED
@@ -1,24 +1,24 @@
1
- var wn = (s) => {
2
- throw TypeError(s);
1
+ var En = (r) => {
2
+ throw TypeError(r);
3
3
  };
4
- var U = (s, e, t) => e.has(s) ? wn("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(s) : e.set(s, t);
5
- function Pn(s, e) {
4
+ var U = (r, e, t) => e.has(r) ? En("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t);
5
+ function Mn(r, e) {
6
6
  for (var t = 0; t < e.length; t++) {
7
7
  const n = e[t];
8
8
  if (typeof n != "string" && !Array.isArray(n)) {
9
9
  for (const i in n)
10
- if (i !== "default" && !(i in s)) {
11
- const r = Object.getOwnPropertyDescriptor(n, i);
12
- r && Object.defineProperty(s, i, r.get ? r : {
10
+ if (i !== "default" && !(i in r)) {
11
+ const s = Object.getOwnPropertyDescriptor(n, i);
12
+ s && Object.defineProperty(r, i, s.get ? s : {
13
13
  enumerable: !0,
14
14
  get: () => n[i]
15
15
  });
16
16
  }
17
17
  }
18
18
  }
19
- return Object.freeze(Object.defineProperty(s, Symbol.toStringTag, { value: "Module" }));
19
+ return Object.freeze(Object.defineProperty(r, Symbol.toStringTag, { value: "Module" }));
20
20
  }
21
- class En {
21
+ class In {
22
22
  constructor() {
23
23
  this.encoder = new TextEncoder(), this._pieces = [], this._parts = [];
24
24
  }
@@ -37,28 +37,28 @@ class En {
37
37
  toArrayBuffer() {
38
38
  const e = [];
39
39
  for (const t of this._parts) e.push(t);
40
- return Mn(e).buffer;
40
+ return An(e).buffer;
41
41
  }
42
42
  }
43
- function Mn(s) {
43
+ function An(r) {
44
44
  let e = 0;
45
- for (const i of s) e += i.byteLength;
45
+ for (const i of r) e += i.byteLength;
46
46
  const t = new Uint8Array(e);
47
47
  let n = 0;
48
- for (const i of s) {
49
- const r = new Uint8Array(i.buffer, i.byteOffset, i.byteLength);
50
- t.set(r, n), n += i.byteLength;
48
+ for (const i of r) {
49
+ const s = new Uint8Array(i.buffer, i.byteOffset, i.byteLength);
50
+ t.set(s, n), n += i.byteLength;
51
51
  }
52
52
  return t;
53
53
  }
54
- function bt(s) {
55
- return new In(s).unpack();
54
+ function bt(r) {
55
+ return new On(r).unpack();
56
56
  }
57
- function _t(s) {
58
- const e = new An(), t = e.pack(s);
57
+ function vt(r) {
58
+ const e = new Dn(), t = e.pack(r);
59
59
  return t instanceof Promise ? t.then(() => e.getBuffer()) : e.getBuffer();
60
60
  }
61
- class In {
61
+ class On {
62
62
  constructor(e) {
63
63
  this.index = 0, this.dataBuffer = e, this.dataView = new Uint8Array(this.dataBuffer), this.length = this.dataBuffer.byteLength;
64
64
  }
@@ -165,9 +165,9 @@ class In {
165
165
  }
166
166
  unpack_string(e) {
167
167
  const t = this.read(e);
168
- let n = 0, i = "", r, o;
168
+ let n = 0, i = "", s, o;
169
169
  for (; n < e; )
170
- r = t[n], r < 160 ? (o = r, n++) : (r ^ 192) < 32 ? (o = (r & 31) << 6 | t[n + 1] & 63, n += 2) : (r ^ 224) < 16 ? (o = (r & 15) << 12 | (t[n + 1] & 63) << 6 | t[n + 2] & 63, n += 3) : (o = (r & 7) << 18 | (t[n + 1] & 63) << 12 | (t[n + 2] & 63) << 6 | t[n + 3] & 63, n += 4), i += String.fromCodePoint(o);
170
+ s = t[n], s < 160 ? (o = s, n++) : (s ^ 192) < 32 ? (o = (s & 31) << 6 | t[n + 1] & 63, n += 2) : (s ^ 224) < 16 ? (o = (s & 15) << 12 | (t[n + 1] & 63) << 6 | t[n + 2] & 63, n += 3) : (o = (s & 7) << 18 | (t[n + 1] & 63) << 12 | (t[n + 2] & 63) << 6 | t[n + 3] & 63, n += 4), i += String.fromCodePoint(o);
171
171
  return this.index += e, i;
172
172
  }
173
173
  unpack_array(e) {
@@ -197,7 +197,7 @@ class In {
197
197
  throw new Error("BinaryPackFailure: read index out of range");
198
198
  }
199
199
  }
200
- class An {
200
+ class Dn {
201
201
  getBuffer() {
202
202
  return this._bufferBuilder.toArrayBuffer();
203
203
  }
@@ -263,8 +263,8 @@ class An {
263
263
  else throw new Error("Invalid length");
264
264
  const n = (i) => {
265
265
  if (i < t) {
266
- const r = this.pack(e[i]);
267
- return r instanceof Promise ? r.then(() => n(i + 1)) : n(i + 1);
266
+ const s = this.pack(e[i]);
267
+ return s instanceof Promise ? s.then(() => n(i + 1)) : n(i + 1);
268
268
  }
269
269
  };
270
270
  return n(0);
@@ -292,7 +292,7 @@ class An {
292
292
  pack_double(e) {
293
293
  let t = 0;
294
294
  e < 0 && (t = 1, e = -e);
295
- const n = Math.floor(Math.log(e) / Math.LN2), i = e / 2 ** n - 1, r = Math.floor(i * 2 ** 52), o = 2 ** 32, a = t << 31 | n + 1023 << 20 | r / o & 1048575, c = r % o;
295
+ const n = Math.floor(Math.log(e) / Math.LN2), i = e / 2 ** n - 1, s = Math.floor(i * 2 ** 52), o = 2 ** 32, a = t << 31 | n + 1023 << 20 | s / o & 1048575, c = s % o;
296
296
  this._bufferBuilder.append(203), this.pack_int32(a), this.pack_int32(c);
297
297
  }
298
298
  pack_object(e) {
@@ -303,15 +303,15 @@ class An {
303
303
  else if (n <= 4294967295)
304
304
  this._bufferBuilder.append(223), this.pack_uint32(n);
305
305
  else throw new Error("Invalid length");
306
- const i = (r) => {
307
- if (r < t.length) {
308
- const o = t[r];
306
+ const i = (s) => {
307
+ if (s < t.length) {
308
+ const o = t[s];
309
309
  if (e.hasOwnProperty(o)) {
310
310
  this.pack(o);
311
311
  const a = this.pack(e[o]);
312
- if (a instanceof Promise) return a.then(() => i(r + 1));
312
+ if (a instanceof Promise) return a.then(() => i(s + 1));
313
313
  }
314
- return i(r + 1);
314
+ return i(s + 1);
315
315
  }
316
316
  };
317
317
  return i(0);
@@ -344,16 +344,16 @@ class An {
344
344
  this._bufferBuilder.append((t & 4278190080) >>> 24), this._bufferBuilder.append((t & 16711680) >>> 16), this._bufferBuilder.append((t & 65280) >>> 8), this._bufferBuilder.append(t & 255), this._bufferBuilder.append((n & 4278190080) >>> 24), this._bufferBuilder.append((n & 16711680) >>> 16), this._bufferBuilder.append((n & 65280) >>> 8), this._bufferBuilder.append(n & 255);
345
345
  }
346
346
  constructor() {
347
- this._bufferBuilder = new En(), this._textEncoder = new TextEncoder();
347
+ this._bufferBuilder = new In(), this._textEncoder = new TextEncoder();
348
348
  }
349
349
  }
350
- let vt = !0, St = !0;
351
- function F(s, e, t) {
352
- const n = s.match(e);
350
+ let _t = !0, St = !0;
351
+ function q(r, e, t) {
352
+ const n = r.match(e);
353
353
  return n && n.length >= t && parseFloat(n[t], 10);
354
354
  }
355
- function A(s, e, t) {
356
- if (!s.RTCPeerConnection)
355
+ function A(r, e, t) {
356
+ if (!r.RTCPeerConnection)
357
357
  return;
358
358
  if (!Object.getOwnPropertyDescriptor(
359
359
  EventTarget.prototype,
@@ -362,15 +362,15 @@ function A(s, e, t) {
362
362
  Be("Unable to polyfill events");
363
363
  return;
364
364
  }
365
- const i = s.RTCPeerConnection.prototype, r = i.addEventListener;
365
+ const i = r.RTCPeerConnection.prototype, s = i.addEventListener;
366
366
  i.addEventListener = function(a, c) {
367
367
  if (a !== e)
368
- return r.apply(this, arguments);
368
+ return s.apply(this, arguments);
369
369
  const h = (l) => {
370
370
  const d = t(l);
371
371
  d && (c.handleEvent ? c.handleEvent(d) : c(d));
372
372
  };
373
- return this._eventMap = this._eventMap || {}, this._eventMap[e] || (this._eventMap[e] = /* @__PURE__ */ new Map()), this._eventMap[e].set(c, h), r.apply(this, [
373
+ return this._eventMap = this._eventMap || {}, this._eventMap[e] || (this._eventMap[e] = /* @__PURE__ */ new Map()), this._eventMap[e].set(c, h), s.apply(this, [
374
374
  a,
375
375
  h
376
376
  ]);
@@ -403,27 +403,27 @@ function A(s, e, t) {
403
403
  configurable: !0
404
404
  });
405
405
  }
406
- function On(s) {
407
- return typeof s != "boolean" ? new Error("Argument type: " + typeof s + ". Please use a boolean.") : (vt = s, s ? "adapter.js logging disabled" : "adapter.js logging enabled");
406
+ function Ln(r) {
407
+ return typeof r != "boolean" ? new Error("Argument type: " + typeof r + ". Please use a boolean.") : (_t = r, r ? "adapter.js logging disabled" : "adapter.js logging enabled");
408
408
  }
409
- function Dn(s) {
410
- return typeof s != "boolean" ? new Error("Argument type: " + typeof s + ". Please use a boolean.") : (St = !s, "adapter.js deprecation warnings " + (s ? "disabled" : "enabled"));
409
+ function $n(r) {
410
+ return typeof r != "boolean" ? new Error("Argument type: " + typeof r + ". Please use a boolean.") : (St = !r, "adapter.js deprecation warnings " + (r ? "disabled" : "enabled"));
411
411
  }
412
412
  function Be() {
413
413
  if (typeof window == "object") {
414
- if (vt)
414
+ if (_t)
415
415
  return;
416
416
  typeof console < "u" && typeof console.log == "function" && console.log.apply(console, arguments);
417
417
  }
418
418
  }
419
- function Ue(s, e) {
420
- St && console.warn(s + " is deprecated, please use " + e + " instead.");
419
+ function Ue(r, e) {
420
+ St && console.warn(r + " is deprecated, please use " + e + " instead.");
421
421
  }
422
- function Ln(s) {
422
+ function Bn(r) {
423
423
  const e = { browser: null, version: null };
424
- if (typeof s > "u" || !s.navigator || !s.navigator.userAgent)
424
+ if (typeof r > "u" || !r.navigator || !r.navigator.userAgent)
425
425
  return e.browser = "Not a browser.", e;
426
- const { navigator: t } = s;
426
+ const { navigator: t } = r;
427
427
  if (t.userAgentData && t.userAgentData.brands) {
428
428
  const n = t.userAgentData.brands.find((i) => i.brand === "Chromium");
429
429
  if (n) {
@@ -433,23 +433,23 @@ function Ln(s) {
433
433
  }
434
434
  }
435
435
  if (t.mozGetUserMedia)
436
- e.browser = "firefox", e.version = parseInt(F(
436
+ e.browser = "firefox", e.version = parseInt(q(
437
437
  t.userAgent,
438
438
  /Firefox\/(\d+)\./,
439
439
  1
440
440
  ));
441
- else if (t.webkitGetUserMedia || s.isSecureContext === !1 && s.webkitRTCPeerConnection)
442
- e.browser = "chrome", e.version = parseInt(F(
441
+ else if (t.webkitGetUserMedia || r.isSecureContext === !1 && r.webkitRTCPeerConnection)
442
+ e.browser = "chrome", e.version = parseInt(q(
443
443
  t.userAgent,
444
444
  /Chrom(e|ium)\/(\d+)\./,
445
445
  2
446
446
  )) || null;
447
- else if (s.RTCPeerConnection && t.userAgent.match(/AppleWebKit\/(\d+)\./))
448
- e.browser = "safari", e.version = parseInt(F(
447
+ else if (r.RTCPeerConnection && t.userAgent.match(/AppleWebKit\/(\d+)\./))
448
+ e.browser = "safari", e.version = parseInt(q(
449
449
  t.userAgent,
450
450
  /AppleWebKit\/(\d+)\./,
451
451
  1
452
- )), e.supportsUnifiedPlan = s.RTCRtpTransceiver && "currentDirection" in s.RTCRtpTransceiver.prototype, e._safariVersion = F(
452
+ )), e.supportsUnifiedPlan = r.RTCRtpTransceiver && "currentDirection" in r.RTCRtpTransceiver.prototype, e._safariVersion = q(
453
453
  t.userAgent,
454
454
  /Version\/(\d+(\.?\d+))/,
455
455
  1
@@ -458,40 +458,40 @@ function Ln(s) {
458
458
  return e.browser = "Not a supported browser.", e;
459
459
  return e;
460
460
  }
461
- function tt(s) {
462
- return Object.prototype.toString.call(s) === "[object Object]";
461
+ function tt(r) {
462
+ return Object.prototype.toString.call(r) === "[object Object]";
463
463
  }
464
- function Ct(s) {
465
- return tt(s) ? Object.keys(s).reduce(function(e, t) {
466
- const n = tt(s[t]), i = n ? Ct(s[t]) : s[t], r = n && !Object.keys(i).length;
467
- return i === void 0 || r ? e : Object.assign(e, { [t]: i });
468
- }, {}) : s;
464
+ function Ct(r) {
465
+ return tt(r) ? Object.keys(r).reduce(function(e, t) {
466
+ const n = tt(r[t]), i = n ? Ct(r[t]) : r[t], s = n && !Object.keys(i).length;
467
+ return i === void 0 || s ? e : Object.assign(e, { [t]: i });
468
+ }, {}) : r;
469
469
  }
470
- function _e(s, e, t) {
470
+ function ve(r, e, t) {
471
471
  !e || t.has(e.id) || (t.set(e.id, e), Object.keys(e).forEach((n) => {
472
- n.endsWith("Id") ? _e(s, s.get(e[n]), t) : n.endsWith("Ids") && e[n].forEach((i) => {
473
- _e(s, s.get(i), t);
472
+ n.endsWith("Id") ? ve(r, r.get(e[n]), t) : n.endsWith("Ids") && e[n].forEach((i) => {
473
+ ve(r, r.get(i), t);
474
474
  });
475
475
  }));
476
476
  }
477
- function nt(s, e, t) {
477
+ function nt(r, e, t) {
478
478
  const n = t ? "outbound-rtp" : "inbound-rtp", i = /* @__PURE__ */ new Map();
479
479
  if (e === null)
480
480
  return i;
481
- const r = [];
482
- return s.forEach((o) => {
483
- o.type === "track" && o.trackIdentifier === e.id && r.push(o);
484
- }), r.forEach((o) => {
485
- s.forEach((a) => {
486
- a.type === n && a.trackId === o.id && _e(s, a, i);
481
+ const s = [];
482
+ return r.forEach((o) => {
483
+ o.type === "track" && o.trackIdentifier === e.id && s.push(o);
484
+ }), s.forEach((o) => {
485
+ r.forEach((a) => {
486
+ a.type === n && a.trackId === o.id && ve(r, a, i);
487
487
  });
488
488
  }), i;
489
489
  }
490
- const st = Be;
491
- function xt(s, e) {
490
+ const rt = Be;
491
+ function xt(r, e) {
492
492
  if (e.version >= 64)
493
493
  return;
494
- const t = s && s.navigator;
494
+ const t = r && r.navigator;
495
495
  if (!t.mediaDevices)
496
496
  return;
497
497
  const n = function(a) {
@@ -534,14 +534,14 @@ function xt(s, e) {
534
534
  if (h.exact === "environment" || h.ideal === "environment" ? d = ["back", "rear"] : (h.exact === "user" || h.ideal === "user") && (d = ["front"]), d)
535
535
  return t.mediaDevices.enumerateDevices().then((u) => {
536
536
  u = u.filter((m) => m.kind === "videoinput");
537
- let f = u.find((m) => d.some((_) => m.label.toLowerCase().includes(_)));
538
- return !f && u.length && d.includes("back") && (f = u[u.length - 1]), f && (a.video.deviceId = h.exact ? { exact: f.deviceId } : { ideal: f.deviceId }), a.video = n(a.video), st("chrome: " + JSON.stringify(a)), c(a);
537
+ let f = u.find((m) => d.some((v) => m.label.toLowerCase().includes(v)));
538
+ return !f && u.length && d.includes("back") && (f = u[u.length - 1]), f && (a.video.deviceId = h.exact ? { exact: f.deviceId } : { ideal: f.deviceId }), a.video = n(a.video), rt("chrome: " + JSON.stringify(a)), c(a);
539
539
  });
540
540
  }
541
541
  a.video = n(a.video);
542
542
  }
543
- return st("chrome: " + JSON.stringify(a)), c(a);
544
- }, r = function(a) {
543
+ return rt("chrome: " + JSON.stringify(a)), c(a);
544
+ }, s = function(a) {
545
545
  return e.version >= 64 ? a : {
546
546
  name: {
547
547
  PermissionDeniedError: "NotAllowedError",
@@ -565,7 +565,7 @@ function xt(s, e) {
565
565
  }, o = function(a, c, h) {
566
566
  i(a, (l) => {
567
567
  t.webkitGetUserMedia(l, c, (d) => {
568
- h && h(r(d));
568
+ h && h(s(d));
569
569
  });
570
570
  });
571
571
  };
@@ -578,17 +578,17 @@ function xt(s, e) {
578
578
  d.stop();
579
579
  }), new DOMException("", "NotFoundError");
580
580
  return l;
581
- }, (l) => Promise.reject(r(l))));
581
+ }, (l) => Promise.reject(s(l))));
582
582
  };
583
583
  }
584
584
  }
585
- function kt(s) {
586
- s.MediaStream = s.MediaStream || s.webkitMediaStream;
585
+ function kt(r) {
586
+ r.MediaStream = r.MediaStream || r.webkitMediaStream;
587
587
  }
588
- function Rt(s, e) {
588
+ function Rt(r, e) {
589
589
  if (!(e.version > 102))
590
- if (typeof s == "object" && s.RTCPeerConnection && !("ontrack" in s.RTCPeerConnection.prototype)) {
591
- Object.defineProperty(s.RTCPeerConnection.prototype, "ontrack", {
590
+ if (typeof r == "object" && r.RTCPeerConnection && !("ontrack" in r.RTCPeerConnection.prototype)) {
591
+ Object.defineProperty(r.RTCPeerConnection.prototype, "ontrack", {
592
592
  get() {
593
593
  return this._ontrack;
594
594
  },
@@ -598,95 +598,95 @@ function Rt(s, e) {
598
598
  enumerable: !0,
599
599
  configurable: !0
600
600
  });
601
- const t = s.RTCPeerConnection.prototype.setRemoteDescription;
602
- s.RTCPeerConnection.prototype.setRemoteDescription = function() {
601
+ const t = r.RTCPeerConnection.prototype.setRemoteDescription;
602
+ r.RTCPeerConnection.prototype.setRemoteDescription = function() {
603
603
  return this._ontrackpoly || (this._ontrackpoly = (i) => {
604
- i.stream.addEventListener("addtrack", (r) => {
604
+ i.stream.addEventListener("addtrack", (s) => {
605
605
  let o;
606
- s.RTCPeerConnection.prototype.getReceivers ? o = this.getReceivers().find((c) => c.track && c.track.id === r.track.id) : o = { track: r.track };
606
+ r.RTCPeerConnection.prototype.getReceivers ? o = this.getReceivers().find((c) => c.track && c.track.id === s.track.id) : o = { track: s.track };
607
607
  const a = new Event("track");
608
- a.track = r.track, a.receiver = o, a.transceiver = { receiver: o }, a.streams = [i.stream], this.dispatchEvent(a);
609
- }), i.stream.getTracks().forEach((r) => {
608
+ a.track = s.track, a.receiver = o, a.transceiver = { receiver: o }, a.streams = [i.stream], this.dispatchEvent(a);
609
+ }), i.stream.getTracks().forEach((s) => {
610
610
  let o;
611
- s.RTCPeerConnection.prototype.getReceivers ? o = this.getReceivers().find((c) => c.track && c.track.id === r.id) : o = { track: r };
611
+ r.RTCPeerConnection.prototype.getReceivers ? o = this.getReceivers().find((c) => c.track && c.track.id === s.id) : o = { track: s };
612
612
  const a = new Event("track");
613
- a.track = r, a.receiver = o, a.transceiver = { receiver: o }, a.streams = [i.stream], this.dispatchEvent(a);
613
+ a.track = s, a.receiver = o, a.transceiver = { receiver: o }, a.streams = [i.stream], this.dispatchEvent(a);
614
614
  });
615
615
  }, this.addEventListener("addstream", this._ontrackpoly)), t.apply(this, arguments);
616
616
  };
617
617
  } else
618
- A(s, "track", (t) => (t.transceiver || Object.defineProperty(
618
+ A(r, "track", (t) => (t.transceiver || Object.defineProperty(
619
619
  t,
620
620
  "transceiver",
621
621
  { value: { receiver: t.receiver } }
622
622
  ), t));
623
623
  }
624
- function Tt(s) {
625
- if (typeof s == "object" && s.RTCPeerConnection && !("getSenders" in s.RTCPeerConnection.prototype) && "createDTMFSender" in s.RTCPeerConnection.prototype) {
626
- const e = function(i, r) {
624
+ function Tt(r) {
625
+ if (typeof r == "object" && r.RTCPeerConnection && !("getSenders" in r.RTCPeerConnection.prototype) && "createDTMFSender" in r.RTCPeerConnection.prototype) {
626
+ const e = function(i, s) {
627
627
  return {
628
- track: r,
628
+ track: s,
629
629
  get dtmf() {
630
- return this._dtmf === void 0 && (r.kind === "audio" ? this._dtmf = i.createDTMFSender(r) : this._dtmf = null), this._dtmf;
630
+ return this._dtmf === void 0 && (s.kind === "audio" ? this._dtmf = i.createDTMFSender(s) : this._dtmf = null), this._dtmf;
631
631
  },
632
632
  _pc: i
633
633
  };
634
634
  };
635
- if (!s.RTCPeerConnection.prototype.getSenders) {
636
- s.RTCPeerConnection.prototype.getSenders = function() {
635
+ if (!r.RTCPeerConnection.prototype.getSenders) {
636
+ r.RTCPeerConnection.prototype.getSenders = function() {
637
637
  return this._senders = this._senders || [], this._senders.slice();
638
638
  };
639
- const i = s.RTCPeerConnection.prototype.addTrack;
640
- s.RTCPeerConnection.prototype.addTrack = function(a, c) {
639
+ const i = r.RTCPeerConnection.prototype.addTrack;
640
+ r.RTCPeerConnection.prototype.addTrack = function(a, c) {
641
641
  let h = i.apply(this, arguments);
642
642
  return h || (h = e(this, a), this._senders.push(h)), h;
643
643
  };
644
- const r = s.RTCPeerConnection.prototype.removeTrack;
645
- s.RTCPeerConnection.prototype.removeTrack = function(a) {
646
- r.apply(this, arguments);
644
+ const s = r.RTCPeerConnection.prototype.removeTrack;
645
+ r.RTCPeerConnection.prototype.removeTrack = function(a) {
646
+ s.apply(this, arguments);
647
647
  const c = this._senders.indexOf(a);
648
648
  c !== -1 && this._senders.splice(c, 1);
649
649
  };
650
650
  }
651
- const t = s.RTCPeerConnection.prototype.addStream;
652
- s.RTCPeerConnection.prototype.addStream = function(r) {
653
- this._senders = this._senders || [], t.apply(this, [r]), r.getTracks().forEach((o) => {
651
+ const t = r.RTCPeerConnection.prototype.addStream;
652
+ r.RTCPeerConnection.prototype.addStream = function(s) {
653
+ this._senders = this._senders || [], t.apply(this, [s]), s.getTracks().forEach((o) => {
654
654
  this._senders.push(e(this, o));
655
655
  });
656
656
  };
657
- const n = s.RTCPeerConnection.prototype.removeStream;
658
- s.RTCPeerConnection.prototype.removeStream = function(r) {
659
- this._senders = this._senders || [], n.apply(this, [r]), r.getTracks().forEach((o) => {
657
+ const n = r.RTCPeerConnection.prototype.removeStream;
658
+ r.RTCPeerConnection.prototype.removeStream = function(s) {
659
+ this._senders = this._senders || [], n.apply(this, [s]), s.getTracks().forEach((o) => {
660
660
  const a = this._senders.find((c) => c.track === o);
661
661
  a && this._senders.splice(this._senders.indexOf(a), 1);
662
662
  });
663
663
  };
664
- } else if (typeof s == "object" && s.RTCPeerConnection && "getSenders" in s.RTCPeerConnection.prototype && "createDTMFSender" in s.RTCPeerConnection.prototype && s.RTCRtpSender && !("dtmf" in s.RTCRtpSender.prototype)) {
665
- const e = s.RTCPeerConnection.prototype.getSenders;
666
- s.RTCPeerConnection.prototype.getSenders = function() {
664
+ } else if (typeof r == "object" && r.RTCPeerConnection && "getSenders" in r.RTCPeerConnection.prototype && "createDTMFSender" in r.RTCPeerConnection.prototype && r.RTCRtpSender && !("dtmf" in r.RTCRtpSender.prototype)) {
665
+ const e = r.RTCPeerConnection.prototype.getSenders;
666
+ r.RTCPeerConnection.prototype.getSenders = function() {
667
667
  const n = e.apply(this, []);
668
668
  return n.forEach((i) => i._pc = this), n;
669
- }, Object.defineProperty(s.RTCRtpSender.prototype, "dtmf", {
669
+ }, Object.defineProperty(r.RTCRtpSender.prototype, "dtmf", {
670
670
  get() {
671
671
  return this._dtmf === void 0 && (this.track.kind === "audio" ? this._dtmf = this._pc.createDTMFSender(this.track) : this._dtmf = null), this._dtmf;
672
672
  }
673
673
  });
674
674
  }
675
675
  }
676
- function wt(s, e) {
677
- if (e.version >= 67 || !(typeof s == "object" && s.RTCPeerConnection && s.RTCRtpSender && s.RTCRtpReceiver))
676
+ function wt(r, e) {
677
+ if (e.version >= 67 || !(typeof r == "object" && r.RTCPeerConnection && r.RTCRtpSender && r.RTCRtpReceiver))
678
678
  return;
679
- if (!("getStats" in s.RTCRtpSender.prototype)) {
680
- const n = s.RTCPeerConnection.prototype.getSenders;
681
- n && (s.RTCPeerConnection.prototype.getSenders = function() {
679
+ if (!("getStats" in r.RTCRtpSender.prototype)) {
680
+ const n = r.RTCPeerConnection.prototype.getSenders;
681
+ n && (r.RTCPeerConnection.prototype.getSenders = function() {
682
682
  const o = n.apply(this, []);
683
683
  return o.forEach((a) => a._pc = this), o;
684
684
  });
685
- const i = s.RTCPeerConnection.prototype.addTrack;
686
- i && (s.RTCPeerConnection.prototype.addTrack = function() {
685
+ const i = r.RTCPeerConnection.prototype.addTrack;
686
+ i && (r.RTCPeerConnection.prototype.addTrack = function() {
687
687
  const o = i.apply(this, arguments);
688
688
  return o._pc = this, o;
689
- }), s.RTCRtpSender.prototype.getStats = function() {
689
+ }), r.RTCRtpSender.prototype.getStats = function() {
690
690
  const o = this;
691
691
  return this._pc.getStats().then((a) => (
692
692
  /* Note: this will include stats of all senders that
@@ -697,29 +697,29 @@ function wt(s, e) {
697
697
  ));
698
698
  };
699
699
  }
700
- if (!("getStats" in s.RTCRtpReceiver.prototype)) {
701
- const n = s.RTCPeerConnection.prototype.getReceivers;
702
- n && (s.RTCPeerConnection.prototype.getReceivers = function() {
703
- const r = n.apply(this, []);
704
- return r.forEach((o) => o._pc = this), r;
705
- }), A(s, "track", (i) => (i.receiver._pc = i.srcElement, i)), s.RTCRtpReceiver.prototype.getStats = function() {
706
- const r = this;
707
- return this._pc.getStats().then((o) => nt(o, r.track, !1));
700
+ if (!("getStats" in r.RTCRtpReceiver.prototype)) {
701
+ const n = r.RTCPeerConnection.prototype.getReceivers;
702
+ n && (r.RTCPeerConnection.prototype.getReceivers = function() {
703
+ const s = n.apply(this, []);
704
+ return s.forEach((o) => o._pc = this), s;
705
+ }), A(r, "track", (i) => (i.receiver._pc = i.srcElement, i)), r.RTCRtpReceiver.prototype.getStats = function() {
706
+ const s = this;
707
+ return this._pc.getStats().then((o) => nt(o, s.track, !1));
708
708
  };
709
709
  }
710
- if (!("getStats" in s.RTCRtpSender.prototype && "getStats" in s.RTCRtpReceiver.prototype))
710
+ if (!("getStats" in r.RTCRtpSender.prototype && "getStats" in r.RTCRtpReceiver.prototype))
711
711
  return;
712
- const t = s.RTCPeerConnection.prototype.getStats;
713
- s.RTCPeerConnection.prototype.getStats = function() {
714
- if (arguments.length > 0 && arguments[0] instanceof s.MediaStreamTrack) {
712
+ const t = r.RTCPeerConnection.prototype.getStats;
713
+ r.RTCPeerConnection.prototype.getStats = function() {
714
+ if (arguments.length > 0 && arguments[0] instanceof r.MediaStreamTrack) {
715
715
  const i = arguments[0];
716
- let r, o, a;
716
+ let s, o, a;
717
717
  return this.getSenders().forEach((c) => {
718
- c.track === i && (r ? a = !0 : r = c);
719
- }), this.getReceivers().forEach((c) => (c.track === i && (o ? a = !0 : o = c), c.track === i)), a || r && o ? Promise.reject(new DOMException(
718
+ c.track === i && (s ? a = !0 : s = c);
719
+ }), this.getReceivers().forEach((c) => (c.track === i && (o ? a = !0 : o = c), c.track === i)), a || s && o ? Promise.reject(new DOMException(
720
720
  "There are more than one sender or receiver for the track.",
721
721
  "InvalidAccessError"
722
- )) : r ? r.getStats() : o ? o.getStats() : Promise.reject(new DOMException(
722
+ )) : s ? s.getStats() : o ? o.getStats() : Promise.reject(new DOMException(
723
723
  "There is no sender or receiver for the track.",
724
724
  "InvalidAccessError"
725
725
  ));
@@ -727,20 +727,20 @@ function wt(s, e) {
727
727
  return t.apply(this, arguments);
728
728
  };
729
729
  }
730
- function Pt(s) {
731
- s.RTCPeerConnection.prototype.getLocalStreams = function() {
730
+ function Pt(r) {
731
+ r.RTCPeerConnection.prototype.getLocalStreams = function() {
732
732
  return this._shimmedLocalStreams = this._shimmedLocalStreams || {}, Object.keys(this._shimmedLocalStreams).map((o) => this._shimmedLocalStreams[o][0]);
733
733
  };
734
- const e = s.RTCPeerConnection.prototype.addTrack;
735
- s.RTCPeerConnection.prototype.addTrack = function(o, a) {
734
+ const e = r.RTCPeerConnection.prototype.addTrack;
735
+ r.RTCPeerConnection.prototype.addTrack = function(o, a) {
736
736
  if (!a)
737
737
  return e.apply(this, arguments);
738
738
  this._shimmedLocalStreams = this._shimmedLocalStreams || {};
739
739
  const c = e.apply(this, arguments);
740
740
  return this._shimmedLocalStreams[a.id] ? this._shimmedLocalStreams[a.id].indexOf(c) === -1 && this._shimmedLocalStreams[a.id].push(c) : this._shimmedLocalStreams[a.id] = [a, c], c;
741
741
  };
742
- const t = s.RTCPeerConnection.prototype.addStream;
743
- s.RTCPeerConnection.prototype.addStream = function(o) {
742
+ const t = r.RTCPeerConnection.prototype.addStream;
743
+ r.RTCPeerConnection.prototype.addStream = function(o) {
744
744
  this._shimmedLocalStreams = this._shimmedLocalStreams || {}, o.getTracks().forEach((h) => {
745
745
  if (this.getSenders().find((d) => d.track === h))
746
746
  throw new DOMException(
@@ -753,30 +753,30 @@ function Pt(s) {
753
753
  const c = this.getSenders().filter((h) => a.indexOf(h) === -1);
754
754
  this._shimmedLocalStreams[o.id] = [o].concat(c);
755
755
  };
756
- const n = s.RTCPeerConnection.prototype.removeStream;
757
- s.RTCPeerConnection.prototype.removeStream = function(o) {
756
+ const n = r.RTCPeerConnection.prototype.removeStream;
757
+ r.RTCPeerConnection.prototype.removeStream = function(o) {
758
758
  return this._shimmedLocalStreams = this._shimmedLocalStreams || {}, delete this._shimmedLocalStreams[o.id], n.apply(this, arguments);
759
759
  };
760
- const i = s.RTCPeerConnection.prototype.removeTrack;
761
- s.RTCPeerConnection.prototype.removeTrack = function(o) {
760
+ const i = r.RTCPeerConnection.prototype.removeTrack;
761
+ r.RTCPeerConnection.prototype.removeTrack = function(o) {
762
762
  return this._shimmedLocalStreams = this._shimmedLocalStreams || {}, o && Object.keys(this._shimmedLocalStreams).forEach((a) => {
763
763
  const c = this._shimmedLocalStreams[a].indexOf(o);
764
764
  c !== -1 && this._shimmedLocalStreams[a].splice(c, 1), this._shimmedLocalStreams[a].length === 1 && delete this._shimmedLocalStreams[a];
765
765
  }), i.apply(this, arguments);
766
766
  };
767
767
  }
768
- function Et(s, e) {
769
- if (!s.RTCPeerConnection)
768
+ function Et(r, e) {
769
+ if (!r.RTCPeerConnection)
770
770
  return;
771
- if (s.RTCPeerConnection.prototype.addTrack && e.version >= 65)
772
- return Pt(s);
773
- const t = s.RTCPeerConnection.prototype.getLocalStreams;
774
- s.RTCPeerConnection.prototype.getLocalStreams = function() {
771
+ if (r.RTCPeerConnection.prototype.addTrack && e.version >= 65)
772
+ return Pt(r);
773
+ const t = r.RTCPeerConnection.prototype.getLocalStreams;
774
+ r.RTCPeerConnection.prototype.getLocalStreams = function() {
775
775
  const l = t.apply(this);
776
776
  return this._reverseStreams = this._reverseStreams || {}, l.map((d) => this._reverseStreams[d.id]);
777
777
  };
778
- const n = s.RTCPeerConnection.prototype.addStream;
779
- s.RTCPeerConnection.prototype.addStream = function(l) {
778
+ const n = r.RTCPeerConnection.prototype.addStream;
779
+ r.RTCPeerConnection.prototype.addStream = function(l) {
780
780
  if (this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {}, l.getTracks().forEach((d) => {
781
781
  if (this.getSenders().find((f) => f.track === d))
782
782
  throw new DOMException(
@@ -784,27 +784,27 @@ function Et(s, e) {
784
784
  "InvalidAccessError"
785
785
  );
786
786
  }), !this._reverseStreams[l.id]) {
787
- const d = new s.MediaStream(l.getTracks());
787
+ const d = new r.MediaStream(l.getTracks());
788
788
  this._streams[l.id] = d, this._reverseStreams[d.id] = l, l = d;
789
789
  }
790
790
  n.apply(this, [l]);
791
791
  };
792
- const i = s.RTCPeerConnection.prototype.removeStream;
793
- s.RTCPeerConnection.prototype.removeStream = function(l) {
792
+ const i = r.RTCPeerConnection.prototype.removeStream;
793
+ r.RTCPeerConnection.prototype.removeStream = function(l) {
794
794
  this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {}, i.apply(this, [this._streams[l.id] || l]), delete this._reverseStreams[this._streams[l.id] ? this._streams[l.id].id : l.id], delete this._streams[l.id];
795
- }, s.RTCPeerConnection.prototype.addTrack = function(l, d) {
795
+ }, r.RTCPeerConnection.prototype.addTrack = function(l, d) {
796
796
  if (this.signalingState === "closed")
797
797
  throw new DOMException(
798
798
  "The RTCPeerConnection's signalingState is 'closed'.",
799
799
  "InvalidStateError"
800
800
  );
801
801
  const u = [].slice.call(arguments, 1);
802
- if (u.length !== 1 || !u[0].getTracks().find((_) => _ === l))
802
+ if (u.length !== 1 || !u[0].getTracks().find((v) => v === l))
803
803
  throw new DOMException(
804
804
  "The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.",
805
805
  "NotSupportedError"
806
806
  );
807
- if (this.getSenders().find((_) => _.track === l))
807
+ if (this.getSenders().find((v) => v.track === l))
808
808
  throw new DOMException(
809
809
  "Track already exists.",
810
810
  "InvalidAccessError"
@@ -816,12 +816,12 @@ function Et(s, e) {
816
816
  this.dispatchEvent(new Event("negotiationneeded"));
817
817
  });
818
818
  else {
819
- const _ = new s.MediaStream([l]);
820
- this._streams[d.id] = _, this._reverseStreams[_.id] = d, this.addStream(_);
819
+ const v = new r.MediaStream([l]);
820
+ this._streams[d.id] = v, this._reverseStreams[v.id] = d, this.addStream(v);
821
821
  }
822
- return this.getSenders().find((_) => _.track === l);
822
+ return this.getSenders().find((v) => v.track === l);
823
823
  };
824
- function r(h, l) {
824
+ function s(h, l) {
825
825
  let d = l.sdp;
826
826
  return Object.keys(h._reverseStreams || []).forEach((u) => {
827
827
  const f = h._reverseStreams[u], m = h._streams[f.id];
@@ -848,39 +848,39 @@ function Et(s, e) {
848
848
  });
849
849
  }
850
850
  ["createOffer", "createAnswer"].forEach(function(h) {
851
- const l = s.RTCPeerConnection.prototype[h], d = { [h]() {
851
+ const l = r.RTCPeerConnection.prototype[h], d = { [h]() {
852
852
  const u = arguments;
853
853
  return arguments.length && typeof arguments[0] == "function" ? l.apply(this, [
854
854
  (m) => {
855
- const _ = r(this, m);
856
- u[0].apply(null, [_]);
855
+ const v = s(this, m);
856
+ u[0].apply(null, [v]);
857
857
  },
858
858
  (m) => {
859
859
  u[1] && u[1].apply(null, m);
860
860
  },
861
861
  arguments[2]
862
- ]) : l.apply(this, arguments).then((m) => r(this, m));
862
+ ]) : l.apply(this, arguments).then((m) => s(this, m));
863
863
  } };
864
- s.RTCPeerConnection.prototype[h] = d[h];
864
+ r.RTCPeerConnection.prototype[h] = d[h];
865
865
  });
866
- const a = s.RTCPeerConnection.prototype.setLocalDescription;
867
- s.RTCPeerConnection.prototype.setLocalDescription = function() {
866
+ const a = r.RTCPeerConnection.prototype.setLocalDescription;
867
+ r.RTCPeerConnection.prototype.setLocalDescription = function() {
868
868
  return !arguments.length || !arguments[0].type ? a.apply(this, arguments) : (arguments[0] = o(this, arguments[0]), a.apply(this, arguments));
869
869
  };
870
870
  const c = Object.getOwnPropertyDescriptor(
871
- s.RTCPeerConnection.prototype,
871
+ r.RTCPeerConnection.prototype,
872
872
  "localDescription"
873
873
  );
874
874
  Object.defineProperty(
875
- s.RTCPeerConnection.prototype,
875
+ r.RTCPeerConnection.prototype,
876
876
  "localDescription",
877
877
  {
878
878
  get() {
879
879
  const h = c.get.apply(this);
880
- return h.type === "" ? h : r(this, h);
880
+ return h.type === "" ? h : s(this, h);
881
881
  }
882
882
  }
883
- ), s.RTCPeerConnection.prototype.removeTrack = function(l) {
883
+ ), r.RTCPeerConnection.prototype.removeTrack = function(l) {
884
884
  if (this.signalingState === "closed")
885
885
  throw new DOMException(
886
886
  "The RTCPeerConnection's signalingState is 'closed'.",
@@ -896,20 +896,20 @@ function Et(s, e) {
896
896
  this._streams = this._streams || {};
897
897
  let u;
898
898
  Object.keys(this._streams).forEach((f) => {
899
- this._streams[f].getTracks().find((_) => l.track === _) && (u = this._streams[f]);
899
+ this._streams[f].getTracks().find((v) => l.track === v) && (u = this._streams[f]);
900
900
  }), u && (u.getTracks().length === 1 ? this.removeStream(this._reverseStreams[u.id]) : u.removeTrack(l.track), this.dispatchEvent(new Event("negotiationneeded")));
901
901
  };
902
902
  }
903
- function ve(s, e) {
904
- !s.RTCPeerConnection && s.webkitRTCPeerConnection && (s.RTCPeerConnection = s.webkitRTCPeerConnection), s.RTCPeerConnection && e.version < 53 && ["setLocalDescription", "setRemoteDescription", "addIceCandidate"].forEach(function(t) {
905
- const n = s.RTCPeerConnection.prototype[t], i = { [t]() {
906
- return arguments[0] = new (t === "addIceCandidate" ? s.RTCIceCandidate : s.RTCSessionDescription)(arguments[0]), n.apply(this, arguments);
903
+ function _e(r, e) {
904
+ !r.RTCPeerConnection && r.webkitRTCPeerConnection && (r.RTCPeerConnection = r.webkitRTCPeerConnection), r.RTCPeerConnection && e.version < 53 && ["setLocalDescription", "setRemoteDescription", "addIceCandidate"].forEach(function(t) {
905
+ const n = r.RTCPeerConnection.prototype[t], i = { [t]() {
906
+ return arguments[0] = new (t === "addIceCandidate" ? r.RTCIceCandidate : r.RTCSessionDescription)(arguments[0]), n.apply(this, arguments);
907
907
  } };
908
- s.RTCPeerConnection.prototype[t] = i[t];
908
+ r.RTCPeerConnection.prototype[t] = i[t];
909
909
  });
910
910
  }
911
- function Mt(s, e) {
912
- e.version > 102 || A(s, "negotiationneeded", (t) => {
911
+ function Mt(r, e) {
912
+ e.version > 102 || A(r, "negotiationneeded", (t) => {
913
913
  const n = t.target;
914
914
  if (!((e.version < 72 || n.getConfiguration && n.getConfiguration().sdpSemantics === "plan-b") && n.signalingState !== "stable"))
915
915
  return t;
@@ -924,25 +924,25 @@ const it = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
924
924
  shimGetUserMedia: xt,
925
925
  shimMediaStream: kt,
926
926
  shimOnTrack: Rt,
927
- shimPeerConnection: ve,
927
+ shimPeerConnection: _e,
928
928
  shimSenderReceiverGetStats: wt
929
929
  }, Symbol.toStringTag, { value: "Module" }));
930
- function It(s, e) {
931
- const t = s && s.navigator;
930
+ function It(r, e) {
931
+ const t = r && r.navigator;
932
932
  if (!t.mediaDevices)
933
933
  return;
934
- const n = s && s.MediaStreamTrack;
935
- if (t.getUserMedia = function(i, r, o) {
934
+ const n = r && r.MediaStreamTrack;
935
+ if (t.getUserMedia = function(i, s, o) {
936
936
  Ue(
937
937
  "navigator.getUserMedia",
938
938
  "navigator.mediaDevices.getUserMedia"
939
- ), t.mediaDevices.getUserMedia(i).then(r, o);
939
+ ), t.mediaDevices.getUserMedia(i).then(s, o);
940
940
  }, !(e.version > 55 && "autoGainControl" in t.mediaDevices.getSupportedConstraints())) {
941
941
  const i = function(o, a, c) {
942
942
  a in o && !(c in o) && (o[c] = o[a], delete o[a]);
943
- }, r = t.mediaDevices.getUserMedia.bind(t.mediaDevices);
943
+ }, s = t.mediaDevices.getUserMedia.bind(t.mediaDevices);
944
944
  if (t.mediaDevices.getUserMedia = function(o) {
945
- return typeof o == "object" && typeof o.audio == "object" && (o = JSON.parse(JSON.stringify(o)), i(o.audio, "autoGainControl", "mozAutoGainControl"), i(o.audio, "noiseSuppression", "mozNoiseSuppression")), r(o);
945
+ return typeof o == "object" && typeof o.audio == "object" && (o = JSON.parse(JSON.stringify(o)), i(o.audio, "autoGainControl", "mozAutoGainControl"), i(o.audio, "noiseSuppression", "mozNoiseSuppression")), s(o);
946
946
  }, n && n.prototype.getSettings) {
947
947
  const o = n.prototype.getSettings;
948
948
  n.prototype.getSettings = function() {
@@ -958,32 +958,32 @@ function It(s, e) {
958
958
  }
959
959
  }
960
960
  }
961
- function $n(s, e) {
962
- s.navigator.mediaDevices && (s.navigator.mediaDevices && "getDisplayMedia" in s.navigator.mediaDevices || (s.navigator.mediaDevices.getDisplayMedia = function(n) {
961
+ function Un(r, e) {
962
+ r.navigator.mediaDevices && (r.navigator.mediaDevices && "getDisplayMedia" in r.navigator.mediaDevices || (r.navigator.mediaDevices.getDisplayMedia = function(n) {
963
963
  if (!(n && n.video)) {
964
964
  const i = new DOMException("getDisplayMedia without video constraints is undefined");
965
965
  return i.name = "NotFoundError", i.code = 8, Promise.reject(i);
966
966
  }
967
- return n.video === !0 ? n.video = { mediaSource: e } : n.video.mediaSource = e, s.navigator.mediaDevices.getUserMedia(n);
967
+ return n.video === !0 ? n.video = { mediaSource: e } : n.video.mediaSource = e, r.navigator.mediaDevices.getUserMedia(n);
968
968
  }));
969
969
  }
970
- function At(s) {
971
- typeof s == "object" && s.RTCTrackEvent && "receiver" in s.RTCTrackEvent.prototype && !("transceiver" in s.RTCTrackEvent.prototype) && Object.defineProperty(s.RTCTrackEvent.prototype, "transceiver", {
970
+ function At(r) {
971
+ typeof r == "object" && r.RTCTrackEvent && "receiver" in r.RTCTrackEvent.prototype && !("transceiver" in r.RTCTrackEvent.prototype) && Object.defineProperty(r.RTCTrackEvent.prototype, "transceiver", {
972
972
  get() {
973
973
  return { receiver: this.receiver };
974
974
  }
975
975
  });
976
976
  }
977
- function Se(s, e) {
978
- typeof s != "object" || !(s.RTCPeerConnection || s.mozRTCPeerConnection) || (!s.RTCPeerConnection && s.mozRTCPeerConnection && (s.RTCPeerConnection = s.mozRTCPeerConnection), e.version < 53 && ["setLocalDescription", "setRemoteDescription", "addIceCandidate"].forEach(function(t) {
979
- const n = s.RTCPeerConnection.prototype[t], i = { [t]() {
980
- return arguments[0] = new (t === "addIceCandidate" ? s.RTCIceCandidate : s.RTCSessionDescription)(arguments[0]), n.apply(this, arguments);
977
+ function Se(r, e) {
978
+ typeof r != "object" || !(r.RTCPeerConnection || r.mozRTCPeerConnection) || (!r.RTCPeerConnection && r.mozRTCPeerConnection && (r.RTCPeerConnection = r.mozRTCPeerConnection), e.version < 53 && ["setLocalDescription", "setRemoteDescription", "addIceCandidate"].forEach(function(t) {
979
+ const n = r.RTCPeerConnection.prototype[t], i = { [t]() {
980
+ return arguments[0] = new (t === "addIceCandidate" ? r.RTCIceCandidate : r.RTCSessionDescription)(arguments[0]), n.apply(this, arguments);
981
981
  } };
982
- s.RTCPeerConnection.prototype[t] = i[t];
982
+ r.RTCPeerConnection.prototype[t] = i[t];
983
983
  }));
984
984
  }
985
- function Ot(s, e) {
986
- if (typeof s != "object" || !(s.RTCPeerConnection || s.mozRTCPeerConnection) || e.version >= 151)
985
+ function Ot(r, e) {
986
+ if (typeof r != "object" || !(r.RTCPeerConnection || r.mozRTCPeerConnection) || e.version >= 151)
987
987
  return;
988
988
  const t = {
989
989
  inboundrtp: "inbound-rtp",
@@ -991,10 +991,10 @@ function Ot(s, e) {
991
991
  candidatepair: "candidate-pair",
992
992
  localcandidate: "local-candidate",
993
993
  remotecandidate: "remote-candidate"
994
- }, n = s.RTCPeerConnection.prototype.getStats;
995
- s.RTCPeerConnection.prototype.getStats = function() {
996
- const [r, o, a] = arguments;
997
- return this.signalingState === "closed" ? Promise.resolve(/* @__PURE__ */ new Map()) : n.apply(this, [r || null]).then((c) => {
994
+ }, n = r.RTCPeerConnection.prototype.getStats;
995
+ r.RTCPeerConnection.prototype.getStats = function() {
996
+ const [s, o, a] = arguments;
997
+ return this.signalingState === "closed" ? Promise.resolve(/* @__PURE__ */ new Map()) : n.apply(this, [s || null]).then((c) => {
998
998
  if (e.version < 53 && !o)
999
999
  try {
1000
1000
  c.forEach((h) => {
@@ -1013,53 +1013,53 @@ function Ot(s, e) {
1013
1013
  }).then(o, a);
1014
1014
  };
1015
1015
  }
1016
- function Dt(s) {
1017
- if (!(typeof s == "object" && s.RTCPeerConnection && s.RTCRtpSender) || s.RTCRtpSender && "getStats" in s.RTCRtpSender.prototype)
1016
+ function Dt(r) {
1017
+ if (!(typeof r == "object" && r.RTCPeerConnection && r.RTCRtpSender) || r.RTCRtpSender && "getStats" in r.RTCRtpSender.prototype)
1018
1018
  return;
1019
- const e = s.RTCPeerConnection.prototype.getSenders;
1020
- e && (s.RTCPeerConnection.prototype.getSenders = function() {
1019
+ const e = r.RTCPeerConnection.prototype.getSenders;
1020
+ e && (r.RTCPeerConnection.prototype.getSenders = function() {
1021
1021
  const i = e.apply(this, []);
1022
- return i.forEach((r) => r._pc = this), i;
1022
+ return i.forEach((s) => s._pc = this), i;
1023
1023
  });
1024
- const t = s.RTCPeerConnection.prototype.addTrack;
1025
- t && (s.RTCPeerConnection.prototype.addTrack = function() {
1024
+ const t = r.RTCPeerConnection.prototype.addTrack;
1025
+ t && (r.RTCPeerConnection.prototype.addTrack = function() {
1026
1026
  const i = t.apply(this, arguments);
1027
1027
  return i._pc = this, i;
1028
- }), s.RTCRtpSender.prototype.getStats = function() {
1028
+ }), r.RTCRtpSender.prototype.getStats = function() {
1029
1029
  return this.track ? this._pc.getStats(this.track) : Promise.resolve(/* @__PURE__ */ new Map());
1030
1030
  };
1031
1031
  }
1032
- function Lt(s) {
1033
- if (!(typeof s == "object" && s.RTCPeerConnection && s.RTCRtpSender) || s.RTCRtpSender && "getStats" in s.RTCRtpReceiver.prototype)
1032
+ function Lt(r) {
1033
+ if (!(typeof r == "object" && r.RTCPeerConnection && r.RTCRtpSender) || r.RTCRtpSender && "getStats" in r.RTCRtpReceiver.prototype)
1034
1034
  return;
1035
- const e = s.RTCPeerConnection.prototype.getReceivers;
1036
- e && (s.RTCPeerConnection.prototype.getReceivers = function() {
1035
+ const e = r.RTCPeerConnection.prototype.getReceivers;
1036
+ e && (r.RTCPeerConnection.prototype.getReceivers = function() {
1037
1037
  const n = e.apply(this, []);
1038
1038
  return n.forEach((i) => i._pc = this), n;
1039
- }), A(s, "track", (t) => (t.receiver._pc = t.srcElement, t)), s.RTCRtpReceiver.prototype.getStats = function() {
1039
+ }), A(r, "track", (t) => (t.receiver._pc = t.srcElement, t)), r.RTCRtpReceiver.prototype.getStats = function() {
1040
1040
  return this._pc.getStats(this.track);
1041
1041
  };
1042
1042
  }
1043
- function $t(s) {
1044
- !s.RTCPeerConnection || "removeStream" in s.RTCPeerConnection.prototype || (s.RTCPeerConnection.prototype.removeStream = function(t) {
1043
+ function $t(r) {
1044
+ !r.RTCPeerConnection || "removeStream" in r.RTCPeerConnection.prototype || (r.RTCPeerConnection.prototype.removeStream = function(t) {
1045
1045
  Ue("removeStream", "removeTrack"), this.getSenders().forEach((n) => {
1046
1046
  n.track && t.getTracks().includes(n.track) && this.removeTrack(n);
1047
1047
  });
1048
1048
  });
1049
1049
  }
1050
- function Bt(s) {
1051
- s.DataChannel && !s.RTCDataChannel && (s.RTCDataChannel = s.DataChannel);
1050
+ function Bt(r) {
1051
+ r.DataChannel && !r.RTCDataChannel && (r.RTCDataChannel = r.DataChannel);
1052
1052
  }
1053
- function Ut(s, e) {
1054
- if (!(typeof s == "object" && s.RTCPeerConnection) || e.version >= 110)
1053
+ function Ut(r, e) {
1054
+ if (!(typeof r == "object" && r.RTCPeerConnection) || e.version >= 110)
1055
1055
  return;
1056
- const t = s.RTCPeerConnection.prototype.addTransceiver;
1057
- t && (s.RTCPeerConnection.prototype.addTransceiver = function() {
1056
+ const t = r.RTCPeerConnection.prototype.addTransceiver;
1057
+ t && (r.RTCPeerConnection.prototype.addTransceiver = function() {
1058
1058
  this.setParametersPromises = [];
1059
1059
  let i = arguments[1] && arguments[1].sendEncodings;
1060
1060
  i === void 0 && (i = []), i = [...i];
1061
- const r = i.length > 0;
1062
- r && i.forEach((a) => {
1061
+ const s = i.length > 0;
1062
+ s && i.forEach((a) => {
1063
1063
  if ("rid" in a && !/^[a-z0-9]{0,16}$/i.test(a.rid))
1064
1064
  throw new TypeError("Invalid RID value provided.");
1065
1065
  if ("scaleResolutionDownBy" in a && !(parseFloat(a.scaleResolutionDownBy) >= 1))
@@ -1068,7 +1068,7 @@ function Ut(s, e) {
1068
1068
  throw new RangeError("max_framerate must be >= 0.0");
1069
1069
  });
1070
1070
  const o = t.apply(this, arguments);
1071
- if (r) {
1071
+ if (s) {
1072
1072
  const { sender: a } = o, c = a.getParameters();
1073
1073
  (!("encodings" in c) || // Avoid being fooled by patched getParameters() below.
1074
1074
  c.encodings.length === 1 && Object.keys(c.encodings[0]).length === 0) && (c.encodings = i, a.sendEncodings = i, this.setParametersPromises.push(
@@ -1082,41 +1082,41 @@ function Ut(s, e) {
1082
1082
  return o;
1083
1083
  });
1084
1084
  }
1085
- function zt(s, e) {
1086
- if (!(typeof s == "object" && s.RTCRtpSender) || e.version >= 110)
1085
+ function zt(r, e) {
1086
+ if (!(typeof r == "object" && r.RTCRtpSender) || e.version >= 110)
1087
1087
  return;
1088
- const t = s.RTCRtpSender.prototype.getParameters;
1089
- t && (s.RTCRtpSender.prototype.getParameters = function() {
1088
+ const t = r.RTCRtpSender.prototype.getParameters;
1089
+ t && (r.RTCRtpSender.prototype.getParameters = function() {
1090
1090
  const i = t.apply(this, arguments);
1091
1091
  return "encodings" in i || (i.encodings = [].concat(this.sendEncodings || [{}])), i;
1092
1092
  });
1093
1093
  }
1094
- function Nt(s, e) {
1095
- if (!(typeof s == "object" && s.RTCPeerConnection) || e.version >= 110)
1094
+ function Nt(r, e) {
1095
+ if (!(typeof r == "object" && r.RTCPeerConnection) || e.version >= 110)
1096
1096
  return;
1097
- const t = s.RTCPeerConnection.prototype.createOffer;
1098
- s.RTCPeerConnection.prototype.createOffer = function() {
1097
+ const t = r.RTCPeerConnection.prototype.createOffer;
1098
+ r.RTCPeerConnection.prototype.createOffer = function() {
1099
1099
  return this.setParametersPromises && this.setParametersPromises.length ? Promise.all(this.setParametersPromises).then(() => t.apply(this, arguments)).finally(() => {
1100
1100
  this.setParametersPromises = [];
1101
1101
  }) : t.apply(this, arguments);
1102
1102
  };
1103
1103
  }
1104
- function qt(s, e) {
1105
- if (!(typeof s == "object" && s.RTCPeerConnection) || e.version >= 110)
1104
+ function Ft(r, e) {
1105
+ if (!(typeof r == "object" && r.RTCPeerConnection) || e.version >= 110)
1106
1106
  return;
1107
- const t = s.RTCPeerConnection.prototype.createAnswer;
1108
- s.RTCPeerConnection.prototype.createAnswer = function() {
1107
+ const t = r.RTCPeerConnection.prototype.createAnswer;
1108
+ r.RTCPeerConnection.prototype.createAnswer = function() {
1109
1109
  return this.setParametersPromises && this.setParametersPromises.length ? Promise.all(this.setParametersPromises).then(() => t.apply(this, arguments)).finally(() => {
1110
1110
  this.setParametersPromises = [];
1111
1111
  }) : t.apply(this, arguments);
1112
1112
  };
1113
1113
  }
1114
- const rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1114
+ const st = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1115
1115
  __proto__: null,
1116
1116
  shimAddTransceiver: Ut,
1117
- shimCreateAnswer: qt,
1117
+ shimCreateAnswer: Ft,
1118
1118
  shimCreateOffer: Nt,
1119
- shimGetDisplayMedia: $n,
1119
+ shimGetDisplayMedia: Un,
1120
1120
  shimGetParameters: zt,
1121
1121
  shimGetStats: Ot,
1122
1122
  shimGetUserMedia: It,
@@ -1127,13 +1127,13 @@ const rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1127
1127
  shimRemoveStream: $t,
1128
1128
  shimSenderGetStats: Dt
1129
1129
  }, Symbol.toStringTag, { value: "Module" }));
1130
- function Ft(s) {
1131
- if (!(typeof s != "object" || !s.RTCPeerConnection)) {
1132
- if ("getLocalStreams" in s.RTCPeerConnection.prototype || (s.RTCPeerConnection.prototype.getLocalStreams = function() {
1130
+ function qt(r) {
1131
+ if (!(typeof r != "object" || !r.RTCPeerConnection)) {
1132
+ if ("getLocalStreams" in r.RTCPeerConnection.prototype || (r.RTCPeerConnection.prototype.getLocalStreams = function() {
1133
1133
  return this._localStreams || (this._localStreams = []), this._localStreams;
1134
- }), !("addStream" in s.RTCPeerConnection.prototype)) {
1135
- const e = s.RTCPeerConnection.prototype.addTrack;
1136
- s.RTCPeerConnection.prototype.addStream = function(n) {
1134
+ }), !("addStream" in r.RTCPeerConnection.prototype)) {
1135
+ const e = r.RTCPeerConnection.prototype.addTrack;
1136
+ r.RTCPeerConnection.prototype.addStream = function(n) {
1137
1137
  this._localStreams || (this._localStreams = []), this._localStreams.includes(n) || this._localStreams.push(n), n.getAudioTracks().forEach((i) => e.call(
1138
1138
  this,
1139
1139
  i,
@@ -1143,30 +1143,30 @@ function Ft(s) {
1143
1143
  i,
1144
1144
  n
1145
1145
  ));
1146
- }, s.RTCPeerConnection.prototype.addTrack = function(n, ...i) {
1147
- return i && i.forEach((r) => {
1148
- this._localStreams ? this._localStreams.includes(r) || this._localStreams.push(r) : this._localStreams = [r];
1146
+ }, r.RTCPeerConnection.prototype.addTrack = function(n, ...i) {
1147
+ return i && i.forEach((s) => {
1148
+ this._localStreams ? this._localStreams.includes(s) || this._localStreams.push(s) : this._localStreams = [s];
1149
1149
  }), e.apply(this, arguments);
1150
1150
  };
1151
1151
  }
1152
- "removeStream" in s.RTCPeerConnection.prototype || (s.RTCPeerConnection.prototype.removeStream = function(t) {
1152
+ "removeStream" in r.RTCPeerConnection.prototype || (r.RTCPeerConnection.prototype.removeStream = function(t) {
1153
1153
  this._localStreams || (this._localStreams = []);
1154
1154
  const n = this._localStreams.indexOf(t);
1155
1155
  if (n === -1)
1156
1156
  return;
1157
1157
  this._localStreams.splice(n, 1);
1158
1158
  const i = t.getTracks();
1159
- this.getSenders().forEach((r) => {
1160
- i.includes(r.track) && this.removeTrack(r);
1159
+ this.getSenders().forEach((s) => {
1160
+ i.includes(s.track) && this.removeTrack(s);
1161
1161
  });
1162
1162
  });
1163
1163
  }
1164
1164
  }
1165
- function jt(s) {
1166
- if (!(typeof s != "object" || !s.RTCPeerConnection) && ("getRemoteStreams" in s.RTCPeerConnection.prototype || (s.RTCPeerConnection.prototype.getRemoteStreams = function() {
1165
+ function jt(r) {
1166
+ if (!(typeof r != "object" || !r.RTCPeerConnection) && ("getRemoteStreams" in r.RTCPeerConnection.prototype || (r.RTCPeerConnection.prototype.getRemoteStreams = function() {
1167
1167
  return this._remoteStreams ? this._remoteStreams : [];
1168
- }), !("onaddstream" in s.RTCPeerConnection.prototype))) {
1169
- Object.defineProperty(s.RTCPeerConnection.prototype, "onaddstream", {
1168
+ }), !("onaddstream" in r.RTCPeerConnection.prototype))) {
1169
+ Object.defineProperty(r.RTCPeerConnection.prototype, "onaddstream", {
1170
1170
  get() {
1171
1171
  return this._onaddstream;
1172
1172
  },
@@ -1176,31 +1176,31 @@ function jt(s) {
1176
1176
  if (this._remoteStreams || (this._remoteStreams = []), this._remoteStreams.includes(i))
1177
1177
  return;
1178
1178
  this._remoteStreams.push(i);
1179
- const r = new Event("addstream");
1180
- r.stream = i, this.dispatchEvent(r);
1179
+ const s = new Event("addstream");
1180
+ s.stream = i, this.dispatchEvent(s);
1181
1181
  });
1182
1182
  });
1183
1183
  }
1184
1184
  });
1185
- const e = s.RTCPeerConnection.prototype.setRemoteDescription;
1186
- s.RTCPeerConnection.prototype.setRemoteDescription = function() {
1185
+ const e = r.RTCPeerConnection.prototype.setRemoteDescription;
1186
+ r.RTCPeerConnection.prototype.setRemoteDescription = function() {
1187
1187
  const n = this;
1188
1188
  return this._onaddstreampoly || this.addEventListener("track", this._onaddstreampoly = function(i) {
1189
- i.streams.forEach((r) => {
1190
- if (n._remoteStreams || (n._remoteStreams = []), n._remoteStreams.indexOf(r) >= 0)
1189
+ i.streams.forEach((s) => {
1190
+ if (n._remoteStreams || (n._remoteStreams = []), n._remoteStreams.indexOf(s) >= 0)
1191
1191
  return;
1192
- n._remoteStreams.push(r);
1192
+ n._remoteStreams.push(s);
1193
1193
  const o = new Event("addstream");
1194
- o.stream = r, n.dispatchEvent(o);
1194
+ o.stream = s, n.dispatchEvent(o);
1195
1195
  });
1196
1196
  }), e.apply(n, arguments);
1197
1197
  };
1198
1198
  }
1199
1199
  }
1200
- function Ht(s) {
1201
- if (typeof s != "object" || !s.RTCPeerConnection)
1200
+ function Ht(r) {
1201
+ if (typeof r != "object" || !r.RTCPeerConnection)
1202
1202
  return;
1203
- const e = s.RTCPeerConnection.prototype, t = e.createOffer, n = e.createAnswer, i = e.setLocalDescription, r = e.setRemoteDescription, o = e.addIceCandidate;
1203
+ const e = r.RTCPeerConnection.prototype, t = e.createOffer, n = e.createAnswer, i = e.setLocalDescription, s = e.setRemoteDescription, o = e.addIceCandidate;
1204
1204
  e.createOffer = function(h, l) {
1205
1205
  const d = arguments.length >= 2 ? arguments[2] : arguments[0], u = t.apply(this, [d]);
1206
1206
  return l ? (u.then(h, l), Promise.resolve()) : u;
@@ -1213,72 +1213,72 @@ function Ht(s) {
1213
1213
  return l ? (d.then(h, l), Promise.resolve()) : d;
1214
1214
  };
1215
1215
  e.setLocalDescription = a, a = function(c, h, l) {
1216
- const d = r.apply(this, [c]);
1216
+ const d = s.apply(this, [c]);
1217
1217
  return l ? (d.then(h, l), Promise.resolve()) : d;
1218
1218
  }, e.setRemoteDescription = a, a = function(c, h, l) {
1219
1219
  const d = o.apply(this, [c]);
1220
1220
  return l ? (d.then(h, l), Promise.resolve()) : d;
1221
1221
  }, e.addIceCandidate = a;
1222
1222
  }
1223
- function Vt(s) {
1224
- const e = s && s.navigator;
1223
+ function Vt(r) {
1224
+ const e = r && r.navigator;
1225
1225
  if (e.mediaDevices && e.mediaDevices.getUserMedia) {
1226
1226
  const t = e.mediaDevices, n = t.getUserMedia.bind(t);
1227
1227
  e.mediaDevices.getUserMedia = (i) => n(Kt(i));
1228
1228
  }
1229
- !e.getUserMedia && e.mediaDevices && e.mediaDevices.getUserMedia && (e.getUserMedia = (function(n, i, r) {
1230
- e.mediaDevices.getUserMedia(n).then(i, r);
1229
+ !e.getUserMedia && e.mediaDevices && e.mediaDevices.getUserMedia && (e.getUserMedia = (function(n, i, s) {
1230
+ e.mediaDevices.getUserMedia(n).then(i, s);
1231
1231
  }).bind(e));
1232
1232
  }
1233
- function Kt(s) {
1234
- return s && s.video !== void 0 ? Object.assign(
1233
+ function Kt(r) {
1234
+ return r && r.video !== void 0 ? Object.assign(
1235
1235
  {},
1236
- s,
1237
- { video: Ct(s.video) }
1238
- ) : s;
1236
+ r,
1237
+ { video: Ct(r.video) }
1238
+ ) : r;
1239
1239
  }
1240
- function Jt(s) {
1241
- if (!s.RTCPeerConnection)
1240
+ function Jt(r) {
1241
+ if (!r.RTCPeerConnection)
1242
1242
  return;
1243
- const e = s.RTCPeerConnection;
1244
- s.RTCPeerConnection = function(n, i) {
1243
+ const e = r.RTCPeerConnection;
1244
+ r.RTCPeerConnection = function(n, i) {
1245
1245
  if (n && n.iceServers) {
1246
- const r = [];
1246
+ const s = [];
1247
1247
  for (let o = 0; o < n.iceServers.length; o++) {
1248
1248
  let a = n.iceServers[o];
1249
- a.urls === void 0 && a.url ? (Ue("RTCIceServer.url", "RTCIceServer.urls"), a = JSON.parse(JSON.stringify(a)), a.urls = a.url, delete a.url, r.push(a)) : r.push(n.iceServers[o]);
1249
+ a.urls === void 0 && a.url ? (Ue("RTCIceServer.url", "RTCIceServer.urls"), a = JSON.parse(JSON.stringify(a)), a.urls = a.url, delete a.url, s.push(a)) : s.push(n.iceServers[o]);
1250
1250
  }
1251
- n.iceServers = r;
1251
+ n.iceServers = s;
1252
1252
  }
1253
1253
  return new e(n, i);
1254
- }, s.RTCPeerConnection.prototype = e.prototype, "generateCertificate" in e && Object.defineProperty(s.RTCPeerConnection, "generateCertificate", {
1254
+ }, r.RTCPeerConnection.prototype = e.prototype, "generateCertificate" in e && Object.defineProperty(r.RTCPeerConnection, "generateCertificate", {
1255
1255
  get() {
1256
1256
  return e.generateCertificate;
1257
1257
  }
1258
1258
  });
1259
1259
  }
1260
- function Wt(s) {
1261
- typeof s == "object" && s.RTCTrackEvent && "receiver" in s.RTCTrackEvent.prototype && !("transceiver" in s.RTCTrackEvent.prototype) && Object.defineProperty(s.RTCTrackEvent.prototype, "transceiver", {
1260
+ function Wt(r) {
1261
+ typeof r == "object" && r.RTCTrackEvent && "receiver" in r.RTCTrackEvent.prototype && !("transceiver" in r.RTCTrackEvent.prototype) && Object.defineProperty(r.RTCTrackEvent.prototype, "transceiver", {
1262
1262
  get() {
1263
1263
  return { receiver: this.receiver };
1264
1264
  }
1265
1265
  });
1266
1266
  }
1267
- function Yt(s) {
1268
- const e = s.RTCPeerConnection.prototype.createOffer;
1269
- s.RTCPeerConnection.prototype.createOffer = function(n) {
1267
+ function Yt(r) {
1268
+ const e = r.RTCPeerConnection.prototype.createOffer;
1269
+ r.RTCPeerConnection.prototype.createOffer = function(n) {
1270
1270
  if (n) {
1271
1271
  typeof n.offerToReceiveAudio < "u" && (n.offerToReceiveAudio = !!n.offerToReceiveAudio);
1272
1272
  const i = this.getTransceivers().find((o) => o.receiver.track.kind === "audio");
1273
1273
  n.offerToReceiveAudio === !1 && i ? i.direction === "sendrecv" ? i.setDirection ? i.setDirection("sendonly") : i.direction = "sendonly" : i.direction === "recvonly" && (i.setDirection ? i.setDirection("inactive") : i.direction = "inactive") : n.offerToReceiveAudio === !0 && !i && this.addTransceiver("audio", { direction: "recvonly" }), typeof n.offerToReceiveVideo < "u" && (n.offerToReceiveVideo = !!n.offerToReceiveVideo);
1274
- const r = this.getTransceivers().find((o) => o.receiver.track.kind === "video");
1275
- n.offerToReceiveVideo === !1 && r ? r.direction === "sendrecv" ? r.setDirection ? r.setDirection("sendonly") : r.direction = "sendonly" : r.direction === "recvonly" && (r.setDirection ? r.setDirection("inactive") : r.direction = "inactive") : n.offerToReceiveVideo === !0 && !r && this.addTransceiver("video", { direction: "recvonly" });
1274
+ const s = this.getTransceivers().find((o) => o.receiver.track.kind === "video");
1275
+ n.offerToReceiveVideo === !1 && s ? s.direction === "sendrecv" ? s.setDirection ? s.setDirection("sendonly") : s.direction = "sendonly" : s.direction === "recvonly" && (s.setDirection ? s.setDirection("inactive") : s.direction = "inactive") : n.offerToReceiveVideo === !0 && !s && this.addTransceiver("video", { direction: "recvonly" });
1276
1276
  }
1277
1277
  return e.apply(this, arguments);
1278
1278
  };
1279
1279
  }
1280
- function Gt(s) {
1281
- typeof s != "object" || s.AudioContext || (s.AudioContext = s.webkitAudioContext);
1280
+ function Gt(r) {
1281
+ typeof r != "object" || r.AudioContext || (r.AudioContext = r.webkitAudioContext);
1282
1282
  }
1283
1283
  const ot = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1284
1284
  __proto__: null,
@@ -1287,16 +1287,16 @@ const ot = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1287
1287
  shimConstraints: Kt,
1288
1288
  shimCreateOfferLegacy: Yt,
1289
1289
  shimGetUserMedia: Vt,
1290
- shimLocalStreamsAPI: Ft,
1290
+ shimLocalStreamsAPI: qt,
1291
1291
  shimRTCIceServerUrls: Jt,
1292
1292
  shimRemoteStreamsAPI: jt,
1293
1293
  shimTrackEventTransceiver: Wt
1294
1294
  }, Symbol.toStringTag, { value: "Module" }));
1295
- function Bn(s) {
1296
- return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
1295
+ function zn(r) {
1296
+ return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
1297
1297
  }
1298
1298
  var Qt = { exports: {} };
1299
- (function(s) {
1299
+ (function(r) {
1300
1300
  const e = {};
1301
1301
  e.generateIdentifier = function() {
1302
1302
  return Math.random().toString(36).substring(2, 12);
@@ -1305,7 +1305,7 @@ var Qt = { exports: {} };
1305
1305
  `).map((n) => n.trim());
1306
1306
  }, e.splitSections = function(t) {
1307
1307
  return t.split(`
1308
- m=`).map((i, r) => (r > 0 ? "m=" + i : i).trim() + `\r
1308
+ m=`).map((i, s) => (s > 0 ? "m=" + i : i).trim() + `\r
1309
1309
  `);
1310
1310
  }, e.getDescription = function(t) {
1311
1311
  const n = e.splitSections(t);
@@ -1330,22 +1330,22 @@ m=`).map((i, r) => (r > 0 ? "m=" + i : i).trim() + `\r
1330
1330
  // skip parts[6] == 'typ'
1331
1331
  type: n[7]
1332
1332
  };
1333
- for (let r = 8; r < n.length; r += 2)
1334
- switch (n[r]) {
1333
+ for (let s = 8; s < n.length; s += 2)
1334
+ switch (n[s]) {
1335
1335
  case "raddr":
1336
- i.relatedAddress = n[r + 1];
1336
+ i.relatedAddress = n[s + 1];
1337
1337
  break;
1338
1338
  case "rport":
1339
- i.relatedPort = parseInt(n[r + 1], 10);
1339
+ i.relatedPort = parseInt(n[s + 1], 10);
1340
1340
  break;
1341
1341
  case "tcptype":
1342
- i.tcpType = n[r + 1];
1342
+ i.tcpType = n[s + 1];
1343
1343
  break;
1344
1344
  case "ufrag":
1345
- i.ufrag = n[r + 1], i.usernameFragment = n[r + 1];
1345
+ i.ufrag = n[s + 1], i.usernameFragment = n[s + 1];
1346
1346
  break;
1347
1347
  default:
1348
- i[n[r]] === void 0 && (i[n[r]] = n[r + 1]);
1348
+ i[n[s]] === void 0 && (i[n[s]] = n[s + 1]);
1349
1349
  break;
1350
1350
  }
1351
1351
  return i;
@@ -1354,8 +1354,8 @@ m=`).map((i, r) => (r > 0 ? "m=" + i : i).trim() + `\r
1354
1354
  n.push(t.foundation);
1355
1355
  const i = t.component;
1356
1356
  i === "rtp" ? n.push(1) : i === "rtcp" ? n.push(2) : n.push(i), n.push(t.protocol.toUpperCase()), n.push(t.priority), n.push(t.address || t.ip), n.push(t.port);
1357
- const r = t.type;
1358
- return n.push("typ"), n.push(r), r !== "host" && t.relatedAddress && t.relatedPort !== void 0 && (n.push("raddr"), n.push(t.relatedAddress), n.push("rport"), n.push(t.relatedPort)), t.tcpType && t.protocol.toLowerCase() === "tcp" && (n.push("tcptype"), n.push(t.tcpType)), (t.usernameFragment || t.ufrag) && (n.push("ufrag"), n.push(t.usernameFragment || t.ufrag)), "candidate:" + n.join(" ");
1357
+ const s = t.type;
1358
+ return n.push("typ"), n.push(s), s !== "host" && t.relatedAddress && t.relatedPort !== void 0 && (n.push("raddr"), n.push(t.relatedAddress), n.push("rport"), n.push(t.relatedPort)), t.tcpType && t.protocol.toLowerCase() === "tcp" && (n.push("tcptype"), n.push(t.tcpType)), (t.usernameFragment || t.ufrag) && (n.push("ufrag"), n.push(t.usernameFragment || t.ufrag)), "candidate:" + n.join(" ");
1359
1359
  }, e.parseIceOptions = function(t) {
1360
1360
  return t.substring(14).split(" ");
1361
1361
  }, e.parseRtpMap = function(t) {
@@ -1385,17 +1385,17 @@ m=`).map((i, r) => (r > 0 ? "m=" + i : i).trim() + `\r
1385
1385
  }, e.parseFmtp = function(t) {
1386
1386
  const n = {};
1387
1387
  let i;
1388
- const r = t.substring(t.indexOf(" ") + 1).split(";");
1389
- for (let o = 0; o < r.length; o++)
1390
- i = r[o].trim().split("="), n[i[0].trim()] = i[1];
1388
+ const s = t.substring(t.indexOf(" ") + 1).split(";");
1389
+ for (let o = 0; o < s.length; o++)
1390
+ i = s[o].trim().split("="), n[i[0].trim()] = i[1];
1391
1391
  return n;
1392
1392
  }, e.writeFmtp = function(t) {
1393
1393
  let n = "", i = t.payloadType;
1394
1394
  if (t.preferredPayloadType !== void 0 && (i = t.preferredPayloadType), t.parameters && Object.keys(t.parameters).length) {
1395
- const r = [];
1395
+ const s = [];
1396
1396
  Object.keys(t.parameters).forEach((o) => {
1397
- t.parameters[o] !== void 0 ? r.push(o + "=" + t.parameters[o]) : r.push(o);
1398
- }), n += "a=fmtp:" + i + " " + r.join(";") + `\r
1397
+ t.parameters[o] !== void 0 ? s.push(o + "=" + t.parameters[o]) : s.push(o);
1398
+ }), n += "a=fmtp:" + i + " " + s.join(";") + `\r
1399
1399
  `;
1400
1400
  }
1401
1401
  return n;
@@ -1407,15 +1407,15 @@ m=`).map((i, r) => (r > 0 ? "m=" + i : i).trim() + `\r
1407
1407
  };
1408
1408
  }, e.writeRtcpFb = function(t) {
1409
1409
  let n = "", i = t.payloadType;
1410
- return t.preferredPayloadType !== void 0 && (i = t.preferredPayloadType), t.rtcpFeedback && t.rtcpFeedback.length && t.rtcpFeedback.forEach((r) => {
1411
- n += "a=rtcp-fb:" + i + " " + r.type + (r.parameter && r.parameter.length ? " " + r.parameter : "") + `\r
1410
+ return t.preferredPayloadType !== void 0 && (i = t.preferredPayloadType), t.rtcpFeedback && t.rtcpFeedback.length && t.rtcpFeedback.forEach((s) => {
1411
+ n += "a=rtcp-fb:" + i + " " + s.type + (s.parameter && s.parameter.length ? " " + s.parameter : "") + `\r
1412
1412
  `;
1413
1413
  }), n;
1414
1414
  }, e.parseSsrcMedia = function(t) {
1415
1415
  const n = t.indexOf(" "), i = {
1416
1416
  ssrc: parseInt(t.substring(7, n), 10)
1417
- }, r = t.indexOf(":", n);
1418
- return r > -1 ? (i.attribute = t.substring(n + 1, r), i.value = t.substring(r + 1)) : i.attribute = t.substring(n + 1), i;
1417
+ }, s = t.indexOf(":", n);
1418
+ return s > -1 ? (i.attribute = t.substring(n + 1, s), i.value = t.substring(s + 1)) : i.attribute = t.substring(n + 1), i;
1419
1419
  }, e.parseSsrcGroup = function(t) {
1420
1420
  const n = t.substring(13).split(" ");
1421
1421
  return {
@@ -1445,8 +1445,8 @@ m=`).map((i, r) => (r > 0 ? "m=" + i : i).trim() + `\r
1445
1445
  }, e.writeDtlsParameters = function(t, n) {
1446
1446
  let i = "a=setup:" + n + `\r
1447
1447
  `;
1448
- return t.fingerprints.forEach((r) => {
1449
- i += "a=fingerprint:" + r.algorithm + " " + r.value + `\r
1448
+ return t.fingerprints.forEach((s) => {
1449
+ i += "a=fingerprint:" + s.algorithm + " " + s.value + `\r
1450
1450
  `;
1451
1451
  }), i;
1452
1452
  }, e.parseCryptoLine = function(t) {
@@ -1482,13 +1482,13 @@ m=`).map((i, r) => (r > 0 ? "m=" + i : i).trim() + `\r
1482
1482
  const i = e.matchPrefix(
1483
1483
  t + n,
1484
1484
  "a=ice-ufrag:"
1485
- )[0], r = e.matchPrefix(
1485
+ )[0], s = e.matchPrefix(
1486
1486
  t + n,
1487
1487
  "a=ice-pwd:"
1488
1488
  )[0];
1489
- return i && r ? {
1489
+ return i && s ? {
1490
1490
  usernameFragment: i.substring(12),
1491
- password: r.substring(10)
1491
+ password: s.substring(10)
1492
1492
  } : null;
1493
1493
  }, e.writeIceParameters = function(t) {
1494
1494
  let n = "a=ice-ufrag:" + t.usernameFragment + `\r
@@ -1502,10 +1502,10 @@ a=ice-pwd:` + t.password + `\r
1502
1502
  headerExtensions: [],
1503
1503
  fecMechanisms: [],
1504
1504
  rtcp: []
1505
- }, r = e.splitLines(t)[0].split(" ");
1506
- n.profile = r[2];
1507
- for (let a = 3; a < r.length; a++) {
1508
- const c = r[a], h = e.matchPrefix(
1505
+ }, s = e.splitLines(t)[0].split(" ");
1506
+ n.profile = s[2];
1507
+ for (let a = 3; a < s.length; a++) {
1508
+ const c = s[a], h = e.matchPrefix(
1509
1509
  t,
1510
1510
  "a=rtpmap:" + c + " "
1511
1511
  )[0];
@@ -1542,15 +1542,15 @@ a=ice-pwd:` + t.password + `\r
1542
1542
  `, n.codecs.forEach((o) => {
1543
1543
  i += e.writeRtpMap(o), i += e.writeFmtp(o), i += e.writeRtcpFb(o);
1544
1544
  });
1545
- let r = 0;
1545
+ let s = 0;
1546
1546
  return n.codecs.forEach((o) => {
1547
- o.maxptime > r && (r = o.maxptime);
1548
- }), r > 0 && (i += "a=maxptime:" + r + `\r
1547
+ o.maxptime > s && (s = o.maxptime);
1548
+ }), s > 0 && (i += "a=maxptime:" + s + `\r
1549
1549
  `), n.headerExtensions && n.headerExtensions.forEach((o) => {
1550
1550
  i += e.writeExtmap(o);
1551
1551
  }), i;
1552
1552
  }, e.parseRtpEncodingParameters = function(t) {
1553
- const n = [], i = e.parseRtpParameters(t), r = i.fecMechanisms.indexOf("RED") !== -1, o = i.fecMechanisms.indexOf("ULPFEC") !== -1, a = e.matchPrefix(t, "a=ssrc:").map((u) => e.parseSsrcMedia(u)).filter((u) => u.attribute === "cname"), c = a.length > 0 && a[0].ssrc;
1553
+ const n = [], i = e.parseRtpParameters(t), s = i.fecMechanisms.indexOf("RED") !== -1, o = i.fecMechanisms.indexOf("ULPFEC") !== -1, a = e.matchPrefix(t, "a=ssrc:").map((u) => e.parseSsrcMedia(u)).filter((u) => u.attribute === "cname"), c = a.length > 0 && a[0].ssrc;
1554
1554
  let h;
1555
1555
  const l = e.matchPrefix(t, "a=ssrc-group:FID").map((u) => u.substring(17).split(" ").map((m) => parseInt(m, 10)));
1556
1556
  l.length > 0 && l[0].length > 1 && l[0][0] === c && (h = l[0][1]), i.codecs.forEach((u) => {
@@ -1559,7 +1559,7 @@ a=ice-pwd:` + t.password + `\r
1559
1559
  ssrc: c,
1560
1560
  codecPayloadType: parseInt(u.parameters.apt, 10)
1561
1561
  };
1562
- c && h && (f.rtx = { ssrc: h }), n.push(f), r && (f = JSON.parse(JSON.stringify(f)), f.fec = {
1562
+ c && h && (f.rtx = { ssrc: h }), n.push(f), s && (f = JSON.parse(JSON.stringify(f)), f.fec = {
1563
1563
  ssrc: c,
1564
1564
  mechanism: o ? "red+ulpfec" : "red"
1565
1565
  }, n.push(f));
@@ -1574,8 +1574,8 @@ a=ice-pwd:` + t.password + `\r
1574
1574
  }, e.parseRtcpParameters = function(t) {
1575
1575
  const n = {}, i = e.matchPrefix(t, "a=ssrc:").map((a) => e.parseSsrcMedia(a)).filter((a) => a.attribute === "cname")[0];
1576
1576
  i && (n.cname = i.value, n.ssrc = i.ssrc);
1577
- const r = e.matchPrefix(t, "a=rtcp-rsize");
1578
- n.reducedSize = r.length > 0, n.compound = r.length === 0;
1577
+ const s = e.matchPrefix(t, "a=rtcp-rsize");
1578
+ n.reducedSize = s.length > 0, n.compound = s.length === 0;
1579
1579
  const o = e.matchPrefix(t, "a=rtcp-mux");
1580
1580
  return n.mux = o.length > 0, n;
1581
1581
  }, e.writeRtcpParameters = function(t) {
@@ -1589,19 +1589,19 @@ a=ice-pwd:` + t.password + `\r
1589
1589
  const i = e.matchPrefix(t, "a=msid:");
1590
1590
  if (i.length === 1)
1591
1591
  return n = i[0].substring(7).split(" "), { stream: n[0], track: n[1] };
1592
- const r = e.matchPrefix(t, "a=ssrc:").map((o) => e.parseSsrcMedia(o)).filter((o) => o.attribute === "msid");
1593
- if (r.length > 0)
1594
- return n = r[0].value.split(" "), { stream: n[0], track: n[1] };
1592
+ const s = e.matchPrefix(t, "a=ssrc:").map((o) => e.parseSsrcMedia(o)).filter((o) => o.attribute === "msid");
1593
+ if (s.length > 0)
1594
+ return n = s[0].value.split(" "), { stream: n[0], track: n[1] };
1595
1595
  }, e.parseSctpDescription = function(t) {
1596
1596
  const n = e.parseMLine(t), i = e.matchPrefix(t, "a=max-message-size:");
1597
- let r;
1598
- i.length > 0 && (r = parseInt(i[0].substring(19), 10)), isNaN(r) && (r = 65536);
1597
+ let s;
1598
+ i.length > 0 && (s = parseInt(i[0].substring(19), 10)), isNaN(s) && (s = 65536);
1599
1599
  const o = e.matchPrefix(t, "a=sctp-port:");
1600
1600
  if (o.length > 0)
1601
1601
  return {
1602
1602
  port: parseInt(o[0].substring(12), 10),
1603
1603
  protocol: n.fmt,
1604
- maxMessageSize: r
1604
+ maxMessageSize: s
1605
1605
  };
1606
1606
  const a = e.matchPrefix(t, "a=sctpmap:");
1607
1607
  if (a.length > 0) {
@@ -1609,7 +1609,7 @@ a=ice-pwd:` + t.password + `\r
1609
1609
  return {
1610
1610
  port: parseInt(c[0], 10),
1611
1611
  protocol: c[1],
1612
- maxMessageSize: r
1612
+ maxMessageSize: s
1613
1613
  };
1614
1614
  }
1615
1615
  }, e.writeSctpDescription = function(t, n) {
@@ -1633,22 +1633,22 @@ a=ice-pwd:` + t.password + `\r
1633
1633
  }, e.generateSessionId = function() {
1634
1634
  return Math.random().toString().substr(2, 22);
1635
1635
  }, e.writeSessionBoilerplate = function(t, n, i) {
1636
- let r;
1636
+ let s;
1637
1637
  const o = n !== void 0 ? n : 2;
1638
- return t ? r = t : r = e.generateSessionId(), `v=0\r
1639
- o=` + (i || "thisisadapterortc") + " " + r + " " + o + ` IN IP4 127.0.0.1\r
1638
+ return t ? s = t : s = e.generateSessionId(), `v=0\r
1639
+ o=` + (i || "thisisadapterortc") + " " + s + " " + o + ` IN IP4 127.0.0.1\r
1640
1640
  s=-\r
1641
1641
  t=0 0\r
1642
1642
  `;
1643
1643
  }, e.getDirection = function(t, n) {
1644
1644
  const i = e.splitLines(t);
1645
- for (let r = 0; r < i.length; r++)
1646
- switch (i[r]) {
1645
+ for (let s = 0; s < i.length; s++)
1646
+ switch (i[s]) {
1647
1647
  case "a=sendrecv":
1648
1648
  case "a=sendonly":
1649
1649
  case "a=recvonly":
1650
1650
  case "a=inactive":
1651
- return i[r].substring(2);
1651
+ return i[s].substring(2);
1652
1652
  }
1653
1653
  return n ? e.getDirection(n) : "sendrecv";
1654
1654
  }, e.getKind = function(t) {
@@ -1681,25 +1681,25 @@ t=0 0\r
1681
1681
  if (n[i].length < 2 || n[i].charAt(1) !== "=")
1682
1682
  return !1;
1683
1683
  return !0;
1684
- }, s.exports = e;
1684
+ }, r.exports = e;
1685
1685
  })(Qt);
1686
1686
  var Xt = Qt.exports;
1687
- const $ = /* @__PURE__ */ Bn(Xt), Un = /* @__PURE__ */ Pn({
1687
+ const $ = /* @__PURE__ */ zn(Xt), Nn = /* @__PURE__ */ Mn({
1688
1688
  __proto__: null,
1689
1689
  default: $
1690
1690
  }, [Xt]);
1691
- function Q(s) {
1692
- if (!s.RTCIceCandidate || s.RTCIceCandidate && "foundation" in s.RTCIceCandidate.prototype)
1691
+ function Q(r) {
1692
+ if (!r.RTCIceCandidate || r.RTCIceCandidate && "foundation" in r.RTCIceCandidate.prototype)
1693
1693
  return;
1694
- const e = s.RTCIceCandidate;
1695
- s.RTCIceCandidate = function(n) {
1694
+ const e = r.RTCIceCandidate;
1695
+ r.RTCIceCandidate = function(n) {
1696
1696
  if (typeof n == "object" && n.candidate && n.candidate.indexOf("a=") === 0 && (n = JSON.parse(JSON.stringify(n)), n.candidate = n.candidate.substring(2)), n.candidate && n.candidate.length) {
1697
- const i = new e(n), r = $.parseCandidate(n.candidate);
1698
- for (const o in r)
1697
+ const i = new e(n), s = $.parseCandidate(n.candidate);
1698
+ for (const o in s)
1699
1699
  o in i || Object.defineProperty(
1700
1700
  i,
1701
1701
  o,
1702
- { value: r[o] }
1702
+ { value: s[o] }
1703
1703
  );
1704
1704
  return i.toJSON = function() {
1705
1705
  return {
@@ -1711,13 +1711,13 @@ function Q(s) {
1711
1711
  }, i;
1712
1712
  }
1713
1713
  return new e(n);
1714
- }, s.RTCIceCandidate.prototype = e.prototype, A(s, "icecandidate", (t) => (t.candidate && Object.defineProperty(t, "candidate", {
1715
- value: new s.RTCIceCandidate(t.candidate),
1714
+ }, r.RTCIceCandidate.prototype = e.prototype, A(r, "icecandidate", (t) => (t.candidate && Object.defineProperty(t, "candidate", {
1715
+ value: new r.RTCIceCandidate(t.candidate),
1716
1716
  writable: "false"
1717
1717
  }), t));
1718
1718
  }
1719
- function Ce(s) {
1720
- !s.RTCIceCandidate || s.RTCIceCandidate && "relayProtocol" in s.RTCIceCandidate.prototype || A(s, "icecandidate", (e) => {
1719
+ function Ce(r) {
1720
+ !r.RTCIceCandidate || r.RTCIceCandidate && "relayProtocol" in r.RTCIceCandidate.prototype || A(r, "icecandidate", (e) => {
1721
1721
  if (e.candidate) {
1722
1722
  const t = $.parseCandidate(e.candidate.candidate);
1723
1723
  t.type === "relay" && (e.candidate.relayProtocol = {
@@ -1729,10 +1729,10 @@ function Ce(s) {
1729
1729
  return e;
1730
1730
  });
1731
1731
  }
1732
- function X(s, e) {
1733
- if (!s.RTCPeerConnection || e.browser === "chrome" && e.version > 102 || e.browser === "firefox" && e.version >= 113)
1732
+ function X(r, e) {
1733
+ if (!r.RTCPeerConnection || e.browser === "chrome" && e.version > 102 || e.browser === "firefox" && e.version >= 113)
1734
1734
  return;
1735
- "sctp" in s.RTCPeerConnection.prototype || Object.defineProperty(s.RTCPeerConnection.prototype, "sctp", {
1735
+ "sctp" in r.RTCPeerConnection.prototype || Object.defineProperty(r.RTCPeerConnection.prototype, "sctp", {
1736
1736
  get() {
1737
1737
  return typeof this._sctp > "u" ? null : this._sctp;
1738
1738
  }
@@ -1754,7 +1754,7 @@ function X(s, e) {
1754
1754
  }, i = function(a) {
1755
1755
  let c = 65536;
1756
1756
  return e.browser === "firefox" && (e.version < 57 ? a === -1 ? c = 16384 : c = 2147483637 : e.version < 60 ? c = e.version === 57 ? 65535 : 65536 : c = 2147483637), c;
1757
- }, r = function(a, c) {
1757
+ }, s = function(a, c) {
1758
1758
  let h = 65536;
1759
1759
  e.browser === "firefox" && e.version === 57 && (h = 65535);
1760
1760
  const l = $.matchPrefix(
@@ -1762,8 +1762,8 @@ function X(s, e) {
1762
1762
  "a=max-message-size:"
1763
1763
  );
1764
1764
  return l.length > 0 ? h = parseInt(l[0].substring(19), 10) : e.browser === "firefox" && c !== -1 && (h = 2147483637), h;
1765
- }, o = s.RTCPeerConnection.prototype.setRemoteDescription;
1766
- s.RTCPeerConnection.prototype.setRemoteDescription = function() {
1765
+ }, o = r.RTCPeerConnection.prototype.setRemoteDescription;
1766
+ r.RTCPeerConnection.prototype.setRemoteDescription = function() {
1767
1767
  if (this._sctp = null, e.browser === "chrome" && e.version >= 76) {
1768
1768
  const { sdpSemantics: c } = this.getConfiguration();
1769
1769
  c === "plan-b" && Object.defineProperty(this, "sctp", {
@@ -1775,7 +1775,7 @@ function X(s, e) {
1775
1775
  });
1776
1776
  }
1777
1777
  if (t(arguments[0])) {
1778
- const c = n(arguments[0]), h = i(c), l = r(arguments[0], c);
1778
+ const c = n(arguments[0]), h = i(c), l = s(arguments[0], c);
1779
1779
  let d;
1780
1780
  h === 0 && l === 0 ? d = Number.POSITIVE_INFINITY : h === 0 || l === 0 ? d = Math.max(h, l) : d = Math.min(h, l);
1781
1781
  const u = {};
@@ -1788,28 +1788,28 @@ function X(s, e) {
1788
1788
  return o.apply(this, arguments);
1789
1789
  };
1790
1790
  }
1791
- function Z(s, e) {
1792
- if (!(s.RTCPeerConnection && "createDataChannel" in s.RTCPeerConnection.prototype) || e.browser === "chrome" && e.version >= 149 || e.browser === "firefox" && e.version > 60)
1791
+ function Z(r, e) {
1792
+ if (!(r.RTCPeerConnection && "createDataChannel" in r.RTCPeerConnection.prototype) || e.browser === "chrome" && e.version >= 149 || e.browser === "firefox" && e.version > 60)
1793
1793
  return;
1794
- function t(i, r) {
1794
+ function t(i, s) {
1795
1795
  const o = i.send;
1796
1796
  i.send = function() {
1797
1797
  const c = arguments[0], h = c.length || c.size || c.byteLength;
1798
- if (i.readyState === "open" && r.sctp && h > r.sctp.maxMessageSize)
1799
- throw new TypeError("Message too large (can send a maximum of " + r.sctp.maxMessageSize + " bytes)");
1798
+ if (i.readyState === "open" && s.sctp && h > s.sctp.maxMessageSize)
1799
+ throw new TypeError("Message too large (can send a maximum of " + s.sctp.maxMessageSize + " bytes)");
1800
1800
  return o.apply(i, arguments);
1801
1801
  };
1802
1802
  }
1803
- const n = s.RTCPeerConnection.prototype.createDataChannel;
1804
- s.RTCPeerConnection.prototype.createDataChannel = function() {
1805
- const r = n.apply(this, arguments);
1806
- return t(r, this), r;
1807
- }, A(s, "datachannel", (i) => (t(i.channel, i.target), i));
1803
+ const n = r.RTCPeerConnection.prototype.createDataChannel;
1804
+ r.RTCPeerConnection.prototype.createDataChannel = function() {
1805
+ const s = n.apply(this, arguments);
1806
+ return t(s, this), s;
1807
+ }, A(r, "datachannel", (i) => (t(i.channel, i.target), i));
1808
1808
  }
1809
- function xe(s) {
1810
- if (!s.RTCPeerConnection || "connectionState" in s.RTCPeerConnection.prototype)
1809
+ function xe(r) {
1810
+ if (!r.RTCPeerConnection || "connectionState" in r.RTCPeerConnection.prototype)
1811
1811
  return;
1812
- const e = s.RTCPeerConnection.prototype;
1812
+ const e = r.RTCPeerConnection.prototype;
1813
1813
  Object.defineProperty(e, "connectionState", {
1814
1814
  get() {
1815
1815
  return {
@@ -1838,11 +1838,11 @@ function xe(s) {
1838
1838
  const n = e[t];
1839
1839
  e[t] = function() {
1840
1840
  return this._connectionstatechangepoly || (this._connectionstatechangepoly = (i) => {
1841
- const r = i.target;
1842
- if (r._lastConnectionState !== r.connectionState) {
1843
- r._lastConnectionState = r.connectionState;
1841
+ const s = i.target;
1842
+ if (s._lastConnectionState !== s.connectionState) {
1843
+ s._lastConnectionState = s.connectionState;
1844
1844
  const o = new Event("connectionstatechange", i);
1845
- r.dispatchEvent(o);
1845
+ s.dispatchEvent(o);
1846
1846
  }
1847
1847
  return i;
1848
1848
  }, this.addEventListener(
@@ -1852,37 +1852,37 @@ function xe(s) {
1852
1852
  };
1853
1853
  });
1854
1854
  }
1855
- function ke(s, e) {
1856
- if (!s.RTCPeerConnection || e.browser === "chrome" && e.version >= 71 || e.browser === "safari" && e._safariVersion >= 13.1)
1855
+ function ke(r, e) {
1856
+ if (!r.RTCPeerConnection || e.browser === "chrome" && e.version >= 71 || e.browser === "safari" && e._safariVersion >= 13.1)
1857
1857
  return;
1858
- const t = s.RTCPeerConnection.prototype.setRemoteDescription;
1859
- s.RTCPeerConnection.prototype.setRemoteDescription = function(i) {
1858
+ const t = r.RTCPeerConnection.prototype.setRemoteDescription;
1859
+ r.RTCPeerConnection.prototype.setRemoteDescription = function(i) {
1860
1860
  if (i && i.sdp && i.sdp.indexOf(`
1861
1861
  a=extmap-allow-mixed`) !== -1) {
1862
- const r = i.sdp.split(`
1862
+ const s = i.sdp.split(`
1863
1863
  `).filter((o) => o.trim() !== "a=extmap-allow-mixed").join(`
1864
1864
  `);
1865
- s.RTCSessionDescription && i instanceof s.RTCSessionDescription ? arguments[0] = new s.RTCSessionDescription({
1865
+ r.RTCSessionDescription && i instanceof r.RTCSessionDescription ? arguments[0] = new r.RTCSessionDescription({
1866
1866
  type: i.type,
1867
- sdp: r
1868
- }) : i.sdp = r;
1867
+ sdp: s
1868
+ }) : i.sdp = s;
1869
1869
  }
1870
1870
  return t.apply(this, arguments);
1871
1871
  };
1872
1872
  }
1873
- function ee(s, e) {
1874
- if (!(s.RTCPeerConnection && s.RTCPeerConnection.prototype))
1873
+ function ee(r, e) {
1874
+ if (!(r.RTCPeerConnection && r.RTCPeerConnection.prototype))
1875
1875
  return;
1876
- const t = s.RTCPeerConnection.prototype.addIceCandidate;
1877
- !t || t.length === 0 || (s.RTCPeerConnection.prototype.addIceCandidate = function() {
1876
+ const t = r.RTCPeerConnection.prototype.addIceCandidate;
1877
+ !t || t.length === 0 || (r.RTCPeerConnection.prototype.addIceCandidate = function() {
1878
1878
  return arguments[0] ? (e.browser === "chrome" && e.version < 78 || e.browser === "firefox" && e.version < 68 || e.browser === "safari") && arguments[0] && arguments[0].candidate === "" ? Promise.resolve() : t.apply(this, arguments) : (arguments[1] && arguments[1].apply(null), Promise.resolve());
1879
1879
  });
1880
1880
  }
1881
- function te(s, e) {
1882
- if (!(s.RTCPeerConnection && s.RTCPeerConnection.prototype))
1881
+ function te(r, e) {
1882
+ if (!(r.RTCPeerConnection && r.RTCPeerConnection.prototype))
1883
1883
  return;
1884
- const t = s.RTCPeerConnection.prototype.setLocalDescription;
1885
- !t || t.length === 0 || (s.RTCPeerConnection.prototype.setLocalDescription = function() {
1884
+ const t = r.RTCPeerConnection.prototype.setLocalDescription;
1885
+ !t || t.length === 0 || (r.RTCPeerConnection.prototype.setLocalDescription = function() {
1886
1886
  let i = arguments[0] || {};
1887
1887
  if (typeof i != "object" || i.type && i.sdp)
1888
1888
  return t.apply(this, arguments);
@@ -1900,7 +1900,7 @@ function te(s, e) {
1900
1900
  return i.sdp || i.type !== "offer" && i.type !== "answer" ? t.apply(this, [i]) : (i.type === "offer" ? this.createOffer : this.createAnswer).apply(this).then((o) => t.apply(this, [o]));
1901
1901
  });
1902
1902
  }
1903
- const zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1903
+ const Fn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1904
1904
  __proto__: null,
1905
1905
  removeExtmapAllowMixed: ke,
1906
1906
  shimAddIceCandidateNullOrEmpty: ee,
@@ -1911,37 +1911,37 @@ const zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1911
1911
  shimRTCIceCandidateRelayProtocol: Ce,
1912
1912
  shimSendThrowTypeError: Z
1913
1913
  }, Symbol.toStringTag, { value: "Module" }));
1914
- function Nn({ window: s } = {}, e = {
1914
+ function qn({ window: r } = {}, e = {
1915
1915
  shimChrome: !0,
1916
1916
  shimFirefox: !0,
1917
1917
  shimSafari: !0
1918
1918
  }) {
1919
- const t = Be, n = Ln(s), i = {
1919
+ const t = Be, n = Bn(r), i = {
1920
1920
  browserDetails: n,
1921
- commonShim: zn,
1922
- extractVersion: F,
1923
- disableLog: On,
1924
- disableWarnings: Dn,
1921
+ commonShim: Fn,
1922
+ extractVersion: q,
1923
+ disableLog: Ln,
1924
+ disableWarnings: $n,
1925
1925
  // Expose sdp as a convenience. For production apps include directly.
1926
- sdp: Un
1926
+ sdp: Nn
1927
1927
  };
1928
1928
  switch (n.browser) {
1929
1929
  case "chrome":
1930
- if (!it || !ve || !e.shimChrome)
1930
+ if (!it || !_e || !e.shimChrome)
1931
1931
  return t("Chrome shim is not included in this adapter release."), i;
1932
1932
  if (n.version === null)
1933
1933
  return t("Chrome shim can not determine version, not shimming."), i;
1934
- t("adapter.js shimming chrome."), i.browserShim = it, ee(s, n), te(s), xt(s, n), kt(s), ve(s, n), Rt(s, n), Et(s, n), Tt(s), wt(s, n), Mt(s, n), Q(s), Ce(s), xe(s), X(s, n), Z(s, n), ke(s, n);
1934
+ t("adapter.js shimming chrome."), i.browserShim = it, ee(r, n), te(r), xt(r, n), kt(r), _e(r, n), Rt(r, n), Et(r, n), Tt(r), wt(r, n), Mt(r, n), Q(r), Ce(r), xe(r), X(r, n), Z(r, n), ke(r, n);
1935
1935
  break;
1936
1936
  case "firefox":
1937
- if (!rt || !Se || !e.shimFirefox)
1937
+ if (!st || !Se || !e.shimFirefox)
1938
1938
  return t("Firefox shim is not included in this adapter release."), i;
1939
- t("adapter.js shimming firefox."), i.browserShim = rt, ee(s, n), te(s), It(s, n), Se(s, n), Ot(s, n), At(s), $t(s), Dt(s), Lt(s), Bt(s), Ut(s, n), zt(s, n), Nt(s, n), qt(s, n), Q(s), xe(s), X(s, n), Z(s, n);
1939
+ t("adapter.js shimming firefox."), i.browserShim = st, ee(r, n), te(r), It(r, n), Se(r, n), Ot(r, n), At(r), $t(r), Dt(r), Lt(r), Bt(r), Ut(r, n), zt(r, n), Nt(r, n), Ft(r, n), Q(r), xe(r), X(r, n), Z(r, n);
1940
1940
  break;
1941
1941
  case "safari":
1942
1942
  if (!ot || !e.shimSafari)
1943
1943
  return t("Safari shim is not included in this adapter release."), i;
1944
- t("adapter.js shimming safari."), i.browserShim = ot, ee(s, n), te(s), Jt(s), Yt(s), Ht(s), Ft(s), jt(s), Wt(s), Vt(s), Gt(s), Q(s), Ce(s), X(s, n), Z(s, n), ke(s, n);
1944
+ t("adapter.js shimming safari."), i.browserShim = ot, ee(r, n), te(r), Jt(r), Yt(r), Ht(r), qt(r), jt(r), Wt(r), Vt(r), Gt(r), Q(r), Ce(r), X(r, n), Z(r, n), ke(r, n);
1945
1945
  break;
1946
1946
  default:
1947
1947
  t("Unsupported browser!");
@@ -1949,34 +1949,34 @@ function Nn({ window: s } = {}, e = {
1949
1949
  }
1950
1950
  return i;
1951
1951
  }
1952
- const at = Nn({ window: typeof window > "u" ? void 0 : window });
1953
- function O(s, e, t, n) {
1954
- Object.defineProperty(s, e, { get: t, set: n, enumerable: !0, configurable: !0 });
1952
+ const at = qn({ window: typeof window > "u" ? void 0 : window });
1953
+ function O(r, e, t, n) {
1954
+ Object.defineProperty(r, e, { get: t, set: n, enumerable: !0, configurable: !0 });
1955
1955
  }
1956
1956
  class Zt {
1957
1957
  constructor() {
1958
1958
  this.chunkedMTU = 16300, this._dataCount = 1, this.chunk = (e) => {
1959
1959
  const t = [], n = e.byteLength, i = Math.ceil(n / this.chunkedMTU);
1960
- let r = 0, o = 0;
1960
+ let s = 0, o = 0;
1961
1961
  for (; o < n; ) {
1962
1962
  const a = Math.min(n, o + this.chunkedMTU), c = e.slice(o, a), h = {
1963
1963
  __peerData: this._dataCount,
1964
- n: r,
1964
+ n: s,
1965
1965
  data: c,
1966
1966
  total: i
1967
1967
  };
1968
- t.push(h), o = a, r++;
1968
+ t.push(h), o = a, s++;
1969
1969
  }
1970
1970
  return this._dataCount++, t;
1971
1971
  };
1972
1972
  }
1973
1973
  }
1974
- function qn(s) {
1974
+ function jn(r) {
1975
1975
  let e = 0;
1976
- for (const i of s) e += i.byteLength;
1976
+ for (const i of r) e += i.byteLength;
1977
1977
  const t = new Uint8Array(e);
1978
1978
  let n = 0;
1979
- for (const i of s)
1979
+ for (const i of r)
1980
1980
  t.set(i, n), n += i.byteLength;
1981
1981
  return t;
1982
1982
  }
@@ -1988,8 +1988,8 @@ const fe = (
1988
1988
  return typeof RTCPeerConnection < "u";
1989
1989
  }
1990
1990
  isBrowserSupported() {
1991
- const s = this.getBrowser(), e = this.getVersion();
1992
- return this.supportedBrowsers.includes(s) ? s === "chrome" ? e >= this.minChromeVersion : s === "firefox" ? e >= this.minFirefoxVersion : s === "safari" ? !this.isIOS && e >= this.minSafariVersion : !1 : !1;
1991
+ const r = this.getBrowser(), e = this.getVersion();
1992
+ return this.supportedBrowsers.includes(r) ? r === "chrome" ? e >= this.minChromeVersion : r === "firefox" ? e >= this.minFirefoxVersion : r === "safari" ? !this.isIOS && e >= this.minSafariVersion : !1 : !1;
1993
1993
  }
1994
1994
  getBrowser() {
1995
1995
  return fe.browserDetails.browser;
@@ -1998,9 +1998,9 @@ const fe = (
1998
1998
  return fe.browserDetails.version || 0;
1999
1999
  }
2000
2000
  isUnifiedPlanSupported() {
2001
- const s = this.getBrowser(), e = fe.browserDetails.version || 0;
2002
- if (s === "chrome" && e < this.minChromeVersion) return !1;
2003
- if (s === "firefox" && e >= this.minFirefoxVersion) return !0;
2001
+ const r = this.getBrowser(), e = fe.browserDetails.version || 0;
2002
+ if (r === "chrome" && e < this.minChromeVersion) return !1;
2003
+ if (r === "firefox" && e >= this.minFirefoxVersion) return !0;
2004
2004
  if (!window.RTCRtpTransceiver || !("currentDirection" in RTCRtpTransceiver.prototype)) return !1;
2005
2005
  let t, n = !1;
2006
2006
  try {
@@ -2031,7 +2031,7 @@ const fe = (
2031
2031
  "safari"
2032
2032
  ], this.minFirefoxVersion = 59, this.minChromeVersion = 72, this.minSafariVersion = 605;
2033
2033
  }
2034
- }(), Fn = (s) => !s || /^[A-Za-z0-9]+(?:[ _-][A-Za-z0-9]+)*$/.test(s), en = () => Math.random().toString(36).slice(2), ct = {
2034
+ }(), Hn = (r) => !r || /^[A-Za-z0-9]+(?:[ _-][A-Za-z0-9]+)*$/.test(r), en = () => Math.random().toString(36).slice(2), ct = {
2035
2035
  iceServers: [
2036
2036
  {
2037
2037
  urls: "stun:stun.l.google.com:19302"
@@ -2047,7 +2047,7 @@ const fe = (
2047
2047
  ],
2048
2048
  sdpSemantics: "unified-plan"
2049
2049
  };
2050
- class jn extends Zt {
2050
+ class Vn extends Zt {
2051
2051
  noop() {
2052
2052
  }
2053
2053
  blobToArrayBuffer(e, t) {
@@ -2070,7 +2070,7 @@ class jn extends Zt {
2070
2070
  Chrome: 1,
2071
2071
  chrome: 1
2072
2072
  }, // Returns browser-agnostic default config
2073
- this.defaultConfig = ct, this.browser = z.getBrowser(), this.browserVersion = z.getVersion(), this.pack = _t, this.unpack = bt, /**
2073
+ this.defaultConfig = ct, this.browser = z.getBrowser(), this.browserVersion = z.getVersion(), this.pack = vt, this.unpack = bt, /**
2074
2074
  * A hash of WebRTC features mapped to booleans that correspond to whether the feature is supported by the current browser.
2075
2075
  *
2076
2076
  * :::caution
@@ -2109,11 +2109,11 @@ class jn extends Zt {
2109
2109
  }
2110
2110
  return t;
2111
2111
  }(), // Ensure alphanumeric ids
2112
- this.validateId = Fn, this.randomToken = en;
2112
+ this.validateId = Hn, this.randomToken = en;
2113
2113
  }
2114
2114
  }
2115
- const x = new jn(), Hn = "PeerJS: ";
2116
- class Vn {
2115
+ const x = new Vn(), Kn = "PeerJS: ";
2116
+ class Jn {
2117
2117
  get logLevel() {
2118
2118
  return this._logLevel;
2119
2119
  }
@@ -2134,7 +2134,7 @@ class Vn {
2134
2134
  }
2135
2135
  _print(e, ...t) {
2136
2136
  const n = [
2137
- Hn,
2137
+ Kn,
2138
2138
  ...t
2139
2139
  ];
2140
2140
  for (const i in n) n[i] instanceof Error && (n[i] = "(" + n[i].name + ") " + n[i].message);
@@ -2144,23 +2144,23 @@ class Vn {
2144
2144
  this._logLevel = 0;
2145
2145
  }
2146
2146
  }
2147
- var p = new Vn(), ze = {}, Kn = Object.prototype.hasOwnProperty, C = "~";
2147
+ var p = new Jn(), ze = {}, Wn = Object.prototype.hasOwnProperty, C = "~";
2148
2148
  function K() {
2149
2149
  }
2150
2150
  Object.create && (K.prototype = /* @__PURE__ */ Object.create(null), new K().__proto__ || (C = !1));
2151
- function Jn(s, e, t) {
2152
- this.fn = s, this.context = e, this.once = t || !1;
2151
+ function Yn(r, e, t) {
2152
+ this.fn = r, this.context = e, this.once = t || !1;
2153
2153
  }
2154
- function tn(s, e, t, n, i) {
2154
+ function tn(r, e, t, n, i) {
2155
2155
  if (typeof t != "function") throw new TypeError("The listener must be a function");
2156
- var r = new Jn(t, n || s, i), o = C ? C + e : e;
2157
- return s._events[o] ? s._events[o].fn ? s._events[o] = [
2158
- s._events[o],
2159
- r
2160
- ] : s._events[o].push(r) : (s._events[o] = r, s._eventsCount++), s;
2156
+ var s = new Yn(t, n || r, i), o = C ? C + e : e;
2157
+ return r._events[o] ? r._events[o].fn ? r._events[o] = [
2158
+ r._events[o],
2159
+ s
2160
+ ] : r._events[o].push(s) : (r._events[o] = s, r._eventsCount++), r;
2161
2161
  }
2162
- function ne(s, e) {
2163
- --s._eventsCount === 0 ? s._events = new K() : delete s._events[e];
2162
+ function ne(r, e) {
2163
+ --r._eventsCount === 0 ? r._events = new K() : delete r._events[e];
2164
2164
  }
2165
2165
  function S() {
2166
2166
  this._events = new K(), this._eventsCount = 0;
@@ -2168,7 +2168,7 @@ function S() {
2168
2168
  S.prototype.eventNames = function() {
2169
2169
  var e = [], t, n;
2170
2170
  if (this._eventsCount === 0) return e;
2171
- for (n in t = this._events) Kn.call(t, n) && e.push(C ? n.slice(1) : n);
2171
+ for (n in t = this._events) Wn.call(t, n) && e.push(C ? n.slice(1) : n);
2172
2172
  return Object.getOwnPropertySymbols ? e.concat(Object.getOwnPropertySymbols(t)) : e;
2173
2173
  };
2174
2174
  S.prototype.listeners = function(e) {
@@ -2177,14 +2177,14 @@ S.prototype.listeners = function(e) {
2177
2177
  if (n.fn) return [
2178
2178
  n.fn
2179
2179
  ];
2180
- for (var i = 0, r = n.length, o = new Array(r); i < r; i++) o[i] = n[i].fn;
2180
+ for (var i = 0, s = n.length, o = new Array(s); i < s; i++) o[i] = n[i].fn;
2181
2181
  return o;
2182
2182
  };
2183
2183
  S.prototype.listenerCount = function(e) {
2184
2184
  var t = C ? C + e : e, n = this._events[t];
2185
2185
  return n ? n.fn ? 1 : n.length : 0;
2186
2186
  };
2187
- S.prototype.emit = function(e, t, n, i, r, o) {
2187
+ S.prototype.emit = function(e, t, n, i, s, o) {
2188
2188
  var a = C ? C + e : e;
2189
2189
  if (!this._events[a]) return !1;
2190
2190
  var c = this._events[a], h = arguments.length, l, d;
@@ -2199,9 +2199,9 @@ S.prototype.emit = function(e, t, n, i, r, o) {
2199
2199
  case 4:
2200
2200
  return c.fn.call(c.context, t, n, i), !0;
2201
2201
  case 5:
2202
- return c.fn.call(c.context, t, n, i, r), !0;
2202
+ return c.fn.call(c.context, t, n, i, s), !0;
2203
2203
  case 6:
2204
- return c.fn.call(c.context, t, n, i, r, o), !0;
2204
+ return c.fn.call(c.context, t, n, i, s, o), !0;
2205
2205
  }
2206
2206
  for (d = 1, l = new Array(h - 1); d < h; d++) l[d - 1] = arguments[d];
2207
2207
  c.fn.apply(c.context, l);
@@ -2235,16 +2235,16 @@ S.prototype.once = function(e, t, n) {
2235
2235
  return tn(this, e, t, n, !0);
2236
2236
  };
2237
2237
  S.prototype.removeListener = function(e, t, n, i) {
2238
- var r = C ? C + e : e;
2239
- if (!this._events[r]) return this;
2238
+ var s = C ? C + e : e;
2239
+ if (!this._events[s]) return this;
2240
2240
  if (!t)
2241
- return ne(this, r), this;
2242
- var o = this._events[r];
2241
+ return ne(this, s), this;
2242
+ var o = this._events[s];
2243
2243
  if (o.fn)
2244
- o.fn === t && (!i || o.once) && (!n || o.context === n) && ne(this, r);
2244
+ o.fn === t && (!i || o.once) && (!n || o.context === n) && ne(this, s);
2245
2245
  else {
2246
2246
  for (var a = 0, c = [], h = o.length; a < h; a++) (o[a].fn !== t || i && !o[a].once || n && o[a].context !== n) && c.push(o[a]);
2247
- c.length ? this._events[r] = c.length === 1 ? c[0] : c : ne(this, r);
2247
+ c.length ? this._events[s] = c.length === 1 ? c[0] : c : ne(this, s);
2248
2248
  }
2249
2249
  return this;
2250
2250
  };
@@ -2264,41 +2264,41 @@ O(D, "BaseConnectionErrorType", () => Re);
2264
2264
  O(D, "DataConnectionErrorType", () => Ne);
2265
2265
  O(D, "SerializationType", () => le);
2266
2266
  O(D, "SocketEventType", () => P);
2267
- O(D, "ServerMessageType", () => v);
2268
- var E = /* @__PURE__ */ function(s) {
2269
- return s.Data = "data", s.Media = "media", s;
2270
- }({}), y = /* @__PURE__ */ function(s) {
2271
- return s.BrowserIncompatible = "browser-incompatible", s.Disconnected = "disconnected", s.InvalidID = "invalid-id", s.InvalidKey = "invalid-key", s.Network = "network", s.PeerUnavailable = "peer-unavailable", s.SslUnavailable = "ssl-unavailable", s.ServerError = "server-error", s.SocketError = "socket-error", s.SocketClosed = "socket-closed", s.UnavailableID = "unavailable-id", s.WebRTC = "webrtc", s;
2272
- }({}), Re = /* @__PURE__ */ function(s) {
2273
- return s.NegotiationFailed = "negotiation-failed", s.ConnectionClosed = "connection-closed", s;
2274
- }({}), Ne = /* @__PURE__ */ function(s) {
2275
- return s.NotOpenYet = "not-open-yet", s.MessageToBig = "message-too-big", s;
2276
- }({}), le = /* @__PURE__ */ function(s) {
2277
- return s.Binary = "binary", s.BinaryUTF8 = "binary-utf8", s.JSON = "json", s.None = "raw", s;
2278
- }({}), P = /* @__PURE__ */ function(s) {
2279
- return s.Message = "message", s.Disconnected = "disconnected", s.Error = "error", s.Close = "close", s;
2280
- }({}), v = /* @__PURE__ */ function(s) {
2281
- return s.Heartbeat = "HEARTBEAT", s.Candidate = "CANDIDATE", s.Offer = "OFFER", s.Answer = "ANSWER", s.Open = "OPEN", s.Error = "ERROR", s.IdTaken = "ID-TAKEN", s.InvalidKey = "INVALID-KEY", s.Leave = "LEAVE", s.Expire = "EXPIRE", s;
2267
+ O(D, "ServerMessageType", () => _);
2268
+ var E = /* @__PURE__ */ function(r) {
2269
+ return r.Data = "data", r.Media = "media", r;
2270
+ }({}), y = /* @__PURE__ */ function(r) {
2271
+ return r.BrowserIncompatible = "browser-incompatible", r.Disconnected = "disconnected", r.InvalidID = "invalid-id", r.InvalidKey = "invalid-key", r.Network = "network", r.PeerUnavailable = "peer-unavailable", r.SslUnavailable = "ssl-unavailable", r.ServerError = "server-error", r.SocketError = "socket-error", r.SocketClosed = "socket-closed", r.UnavailableID = "unavailable-id", r.WebRTC = "webrtc", r;
2272
+ }({}), Re = /* @__PURE__ */ function(r) {
2273
+ return r.NegotiationFailed = "negotiation-failed", r.ConnectionClosed = "connection-closed", r;
2274
+ }({}), Ne = /* @__PURE__ */ function(r) {
2275
+ return r.NotOpenYet = "not-open-yet", r.MessageToBig = "message-too-big", r;
2276
+ }({}), le = /* @__PURE__ */ function(r) {
2277
+ return r.Binary = "binary", r.BinaryUTF8 = "binary-utf8", r.JSON = "json", r.None = "raw", r;
2278
+ }({}), P = /* @__PURE__ */ function(r) {
2279
+ return r.Message = "message", r.Disconnected = "disconnected", r.Error = "error", r.Close = "close", r;
2280
+ }({}), _ = /* @__PURE__ */ function(r) {
2281
+ return r.Heartbeat = "HEARTBEAT", r.Candidate = "CANDIDATE", r.Offer = "OFFER", r.Answer = "ANSWER", r.Open = "OPEN", r.Error = "ERROR", r.IdTaken = "ID-TAKEN", r.InvalidKey = "INVALID-KEY", r.Leave = "LEAVE", r.Expire = "EXPIRE", r;
2282
2282
  }({});
2283
2283
  const nn = "1.5.5";
2284
- class Wn extends ze.EventEmitter {
2285
- constructor(e, t, n, i, r, o = 5e3) {
2284
+ class Gn extends ze.EventEmitter {
2285
+ constructor(e, t, n, i, s, o = 5e3) {
2286
2286
  super(), this.pingInterval = o, this._disconnected = !0, this._messagesQueue = [];
2287
2287
  const a = e ? "wss://" : "ws://";
2288
- this._baseUrl = a + t + ":" + n + i + "peerjs?key=" + r;
2288
+ this._baseUrl = a + t + ":" + n + i + "peerjs?key=" + s;
2289
2289
  }
2290
2290
  start(e, t) {
2291
2291
  this._id = e;
2292
2292
  const n = `${this._baseUrl}&id=${e}&token=${t}`;
2293
2293
  this._socket || !this._disconnected || (this._socket = new WebSocket(n + "&version=" + nn), this._disconnected = !1, this._socket.onmessage = (i) => {
2294
- let r;
2294
+ let s;
2295
2295
  try {
2296
- r = JSON.parse(i.data), p.log("Server message received:", r);
2296
+ s = JSON.parse(i.data), p.log("Server message received:", s);
2297
2297
  } catch {
2298
2298
  p.log("Invalid server message", i.data);
2299
2299
  return;
2300
2300
  }
2301
- this.emit(P.Message, r);
2301
+ this.emit(P.Message, s);
2302
2302
  }, this._socket.onclose = (i) => {
2303
2303
  this._disconnected || (p.log("Socket closed.", i), this._cleanup(), this._disconnected = !0, this.emit(P.Disconnected));
2304
2304
  }, this._socket.onopen = () => {
@@ -2316,7 +2316,7 @@ class Wn extends ze.EventEmitter {
2316
2316
  return;
2317
2317
  }
2318
2318
  const e = JSON.stringify({
2319
- type: v.Heartbeat
2319
+ type: _.Heartbeat
2320
2320
  });
2321
2321
  this._socket.send(e), this._scheduleHeartbeat();
2322
2322
  }
@@ -2354,7 +2354,7 @@ class Wn extends ze.EventEmitter {
2354
2354
  this._socket && (this._socket.onopen = this._socket.onmessage = this._socket.onclose = null, this._socket.close(), this._socket = void 0), clearTimeout(this._wsPingTimer);
2355
2355
  }
2356
2356
  }
2357
- class sn {
2357
+ class rn {
2358
2358
  constructor(e) {
2359
2359
  this.connection = e;
2360
2360
  }
@@ -2364,8 +2364,8 @@ class sn {
2364
2364
  if (this.connection.peerConnection = t, this.connection.type === E.Media && e._stream && this._addTracksToConnection(e._stream, t), e.originator) {
2365
2365
  const n = this.connection, i = {
2366
2366
  ordered: !!e.reliable
2367
- }, r = t.createDataChannel(n.label, i);
2368
- n._initializeDataChannel(r), this._makeOffer();
2367
+ }, s = t.createDataChannel(n.label, i);
2368
+ n._initializeDataChannel(s), this._makeOffer();
2369
2369
  } else this.handleSDP("OFFER", e.sdp);
2370
2370
  }
2371
2371
  /** Start a PC. */
@@ -2376,10 +2376,10 @@ class sn {
2376
2376
  }
2377
2377
  /** Set up various WebRTC listeners. */
2378
2378
  _setupListeners(e) {
2379
- const t = this.connection.peer, n = this.connection.connectionId, i = this.connection.type, r = this.connection.provider;
2379
+ const t = this.connection.peer, n = this.connection.connectionId, i = this.connection.type, s = this.connection.provider;
2380
2380
  p.log("Listening for ICE candidates."), e.onicecandidate = (o) => {
2381
- !o.candidate || !o.candidate.candidate || (p.log(`Received ICE candidates for ${t}:`, o.candidate), r.socket.send({
2382
- type: v.Candidate,
2381
+ !o.candidate || !o.candidate.candidate || (p.log(`Received ICE candidates for ${t}:`, o.candidate), s.socket.send({
2382
+ type: _.Candidate,
2383
2383
  payload: {
2384
2384
  candidate: o.candidate,
2385
2385
  type: i,
@@ -2407,10 +2407,10 @@ class sn {
2407
2407
  }, p.log("Listening for data channel"), e.ondatachannel = (o) => {
2408
2408
  p.log("Received data channel");
2409
2409
  const a = o.channel;
2410
- r.getConnection(t, n)._initializeDataChannel(a);
2410
+ s.getConnection(t, n)._initializeDataChannel(a);
2411
2411
  }, p.log("Listening for remote stream"), e.ontrack = (o) => {
2412
2412
  p.log("Received remote stream");
2413
- const a = o.streams[0], c = r.getConnection(t, n);
2413
+ const a = o.streams[0], c = s.getConnection(t, n);
2414
2414
  if (c.type === E.Media) {
2415
2415
  const h = c;
2416
2416
  this._addStreamToMediaConnection(a, h);
@@ -2442,16 +2442,16 @@ class sn {
2442
2442
  metadata: this.connection.metadata
2443
2443
  };
2444
2444
  if (this.connection.type === E.Data) {
2445
- const r = this.connection;
2445
+ const s = this.connection;
2446
2446
  i = {
2447
2447
  ...i,
2448
- label: r.label,
2449
- reliable: r.reliable,
2450
- serialization: r.serialization
2448
+ label: s.label,
2449
+ reliable: s.reliable,
2450
+ serialization: s.serialization
2451
2451
  };
2452
2452
  }
2453
2453
  t.socket.send({
2454
- type: v.Offer,
2454
+ type: _.Offer,
2455
2455
  payload: i,
2456
2456
  dst: this.connection.peer
2457
2457
  });
@@ -2469,7 +2469,7 @@ class sn {
2469
2469
  p.log("Created answer."), this.connection.options.sdpTransform && typeof this.connection.options.sdpTransform == "function" && (n.sdp = this.connection.options.sdpTransform(n.sdp) || n.sdp);
2470
2470
  try {
2471
2471
  await e.setLocalDescription(n), p.log("Set localDescription:", n, `for:${this.connection.peer}`), t.socket.send({
2472
- type: v.Answer,
2472
+ type: _.Answer,
2473
2473
  payload: {
2474
2474
  sdp: n,
2475
2475
  type: this.connection.type,
@@ -2489,9 +2489,9 @@ class sn {
2489
2489
  t = new RTCSessionDescription(t);
2490
2490
  const n = this.connection.peerConnection, i = this.connection.provider;
2491
2491
  p.log("Setting remote description", t);
2492
- const r = this;
2492
+ const s = this;
2493
2493
  try {
2494
- await n.setRemoteDescription(t), p.log(`Set remoteDescription:${e} for:${this.connection.peer}`), e === "OFFER" && await r._makeAnswer();
2494
+ await n.setRemoteDescription(t), p.log(`Set remoteDescription:${e} for:${this.connection.peer}`), e === "OFFER" && await s._makeAnswer();
2495
2495
  } catch (o) {
2496
2496
  i.emitError(y.WebRTC, o), p.log("Failed to setRemoteDescription, ", o);
2497
2497
  }
@@ -2515,17 +2515,17 @@ class sn {
2515
2515
  p.log(`add stream ${e.id} to media connection ${t.connectionId}`), t.addStream(e);
2516
2516
  }
2517
2517
  }
2518
- class rn extends ze.EventEmitter {
2518
+ class sn extends ze.EventEmitter {
2519
2519
  /**
2520
2520
  * Emits a typed error message.
2521
2521
  *
2522
2522
  * @internal
2523
2523
  */
2524
2524
  emitError(e, t) {
2525
- p.error("Error:", t), this.emit("error", new Yn(`${e}`, t));
2525
+ p.error("Error:", t), this.emit("error", new Qn(`${e}`, t));
2526
2526
  }
2527
2527
  }
2528
- class Yn extends Error {
2528
+ class Qn extends Error {
2529
2529
  /**
2530
2530
  * @internal
2531
2531
  */
@@ -2533,7 +2533,7 @@ class Yn extends Error {
2533
2533
  typeof t == "string" ? super(t) : (super(), Object.assign(this, t)), this.type = e;
2534
2534
  }
2535
2535
  }
2536
- class on extends rn {
2536
+ class on extends sn {
2537
2537
  /**
2538
2538
  * Whether the media connection is active (e.g. your call has been answered).
2539
2539
  * You can check this if you want to set a maximum wait time for a one-sided call.
@@ -2560,7 +2560,7 @@ const H = class H extends on {
2560
2560
  return this._remoteStream;
2561
2561
  }
2562
2562
  constructor(e, t, n) {
2563
- super(e, t, n), this._localStream = this.options._stream, this.connectionId = this.options.connectionId || H.ID_PREFIX + x.randomToken(), this._negotiator = new sn(this), this._localStream && this._negotiator.startConnection({
2563
+ super(e, t, n), this._localStream = this.options._stream, this.connectionId = this.options.connectionId || H.ID_PREFIX + x.randomToken(), this._negotiator = new rn(this), this._localStream && this._negotiator.startConnection({
2564
2564
  _stream: this._localStream,
2565
2565
  originator: !0
2566
2566
  });
@@ -2582,10 +2582,10 @@ const H = class H extends on {
2582
2582
  handleMessage(e) {
2583
2583
  const t = e.type, n = e.payload;
2584
2584
  switch (e.type) {
2585
- case v.Answer:
2585
+ case _.Answer:
2586
2586
  this._negotiator.handleSDP(t, n.sdp), this._open = !0;
2587
2587
  break;
2588
- case v.Candidate:
2588
+ case _.Candidate:
2589
2589
  this._negotiator.handleCandidate(n.candidate);
2590
2590
  break;
2591
2591
  default:
@@ -2628,12 +2628,12 @@ const H = class H extends on {
2628
2628
  };
2629
2629
  Oe = new WeakMap(), U(H, Oe, H.ID_PREFIX = "mc_");
2630
2630
  let ae = H;
2631
- class Gn {
2631
+ class Xn {
2632
2632
  constructor(e) {
2633
2633
  this._options = e;
2634
2634
  }
2635
2635
  _buildRequest(e) {
2636
- const t = this._options.secure ? "https" : "http", { host: n, port: i, path: r, key: o } = this._options, a = new URL(`${t}://${n}:${i}${r}${o}/${e}`);
2636
+ const t = this._options.secure ? "https" : "http", { host: n, port: i, path: s, key: o } = this._options, a = new URL(`${t}://${n}:${i}${s}${o}/${e}`);
2637
2637
  return a.searchParams.set("ts", `${Date.now()}${Math.random()}`), a.searchParams.set("version", nn), fetch(a.href, {
2638
2638
  referrerPolicy: this._options.referrerPolicy
2639
2639
  });
@@ -2673,7 +2673,7 @@ const I = class I extends on {
2673
2673
  return E.Data;
2674
2674
  }
2675
2675
  constructor(e, t, n) {
2676
- super(e, t, n), this.connectionId = this.options.connectionId || I.ID_PREFIX + en(), this.label = this.options.label || this.connectionId, this.reliable = !!this.options.reliable, this._negotiator = new sn(this), this._negotiator.startConnection(this.options._payload || {
2676
+ super(e, t, n), this.connectionId = this.options.connectionId || I.ID_PREFIX + en(), this.label = this.options.label || this.connectionId, this.reliable = !!this.options.reliable, this._negotiator = new rn(this), this._negotiator.startConnection(this.options._payload || {
2677
2677
  originator: !0,
2678
2678
  reliable: this.reliable
2679
2679
  });
@@ -2714,10 +2714,10 @@ const I = class I extends on {
2714
2714
  async handleMessage(e) {
2715
2715
  const t = e.payload;
2716
2716
  switch (e.type) {
2717
- case v.Answer:
2717
+ case _.Answer:
2718
2718
  await this._negotiator.handleSDP(e.type, t.sdp);
2719
2719
  break;
2720
- case v.Candidate:
2720
+ case _.Candidate:
2721
2721
  await this._negotiator.handleCandidate(t.candidate);
2722
2722
  break;
2723
2723
  default:
@@ -2728,7 +2728,7 @@ const I = class I extends on {
2728
2728
  };
2729
2729
  De = new WeakMap(), Le = new WeakMap(), U(I, De, I.ID_PREFIX = "dc_"), U(I, Le, I.MAX_BUFFERED_AMOUNT = 8388608);
2730
2730
  let ce = I;
2731
- class qe extends ce {
2731
+ class Fe extends ce {
2732
2732
  get bufferSize() {
2733
2733
  return this._bufferSize;
2734
2734
  }
@@ -2773,7 +2773,7 @@ class qe extends ce {
2773
2773
  super(...e), this._buffer = [], this._bufferSize = 0, this._buffering = !1;
2774
2774
  }
2775
2775
  }
2776
- class ge extends qe {
2776
+ class ge extends Fe {
2777
2777
  close(e) {
2778
2778
  super.close(e), this._chunkedData = {};
2779
2779
  }
@@ -2801,14 +2801,14 @@ class ge extends qe {
2801
2801
  };
2802
2802
  if (n.data[e.n] = new Uint8Array(e.data), n.count++, this._chunkedData[t] = n, n.total === n.count) {
2803
2803
  delete this._chunkedData[t];
2804
- const i = qn(n.data);
2804
+ const i = jn(n.data);
2805
2805
  this._handleDataMessage({
2806
2806
  data: i
2807
2807
  });
2808
2808
  }
2809
2809
  }
2810
2810
  _send(e, t) {
2811
- const n = _t(e);
2811
+ const n = vt(e);
2812
2812
  if (n instanceof Promise) return this._send_blob(n);
2813
2813
  if (!t && n.byteLength > this.chunker.chunkedMTU) {
2814
2814
  this._sendChunks(n);
@@ -2830,7 +2830,7 @@ class ge extends qe {
2830
2830
  for (const n of t) this.send(n, !0);
2831
2831
  }
2832
2832
  }
2833
- class Qn extends qe {
2833
+ class Zn extends Fe {
2834
2834
  _handleDataMessage({ data: e }) {
2835
2835
  super.emit("data", e);
2836
2836
  }
@@ -2841,7 +2841,7 @@ class Qn extends qe {
2841
2841
  super(...e), this.serialization = le.None;
2842
2842
  }
2843
2843
  }
2844
- class Xn extends qe {
2844
+ class er extends Fe {
2845
2845
  // Handles a DataChannel message.
2846
2846
  _handleDataMessage({ data: e }) {
2847
2847
  const t = this.parse(this.decoder.decode(e)), n = t.__peerData;
@@ -2864,7 +2864,7 @@ class Xn extends qe {
2864
2864
  }
2865
2865
  }
2866
2866
  var $e;
2867
- const V = class V extends rn {
2867
+ const V = class V extends sn {
2868
2868
  /**
2869
2869
  * The brokering ID of this peer
2870
2870
  *
@@ -2910,8 +2910,8 @@ const V = class V extends rn {
2910
2910
  }
2911
2911
  constructor(e, t) {
2912
2912
  super(), this._serializers = {
2913
- raw: Qn,
2914
- json: Xn,
2913
+ raw: Zn,
2914
+ json: er,
2915
2915
  binary: ge,
2916
2916
  "binary-utf8": ge,
2917
2917
  default: ge
@@ -2932,7 +2932,7 @@ const V = class V extends rn {
2932
2932
  }, this._options = t, this._serializers = {
2933
2933
  ...this._serializers,
2934
2934
  ...this.options.serializers
2935
- }, this._options.host === "/" && (this._options.host = window.location.hostname), this._options.path && (this._options.path[0] !== "/" && (this._options.path = "/" + this._options.path), this._options.path[this._options.path.length - 1] !== "/" && (this._options.path += "/")), this._options.secure === void 0 && this._options.host !== x.CLOUD_HOST ? this._options.secure = x.isSecure() : this._options.host == x.CLOUD_HOST && (this._options.secure = !0), this._options.logFunction && p.setLogFunction(this._options.logFunction), p.logLevel = this._options.debug || 0, this._api = new Gn(t), this._socket = this._createServerConnection(), !x.supports.audioVideo && !x.supports.data) {
2935
+ }, this._options.host === "/" && (this._options.host = window.location.hostname), this._options.path && (this._options.path[0] !== "/" && (this._options.path = "/" + this._options.path), this._options.path[this._options.path.length - 1] !== "/" && (this._options.path += "/")), this._options.secure === void 0 && this._options.host !== x.CLOUD_HOST ? this._options.secure = x.isSecure() : this._options.host == x.CLOUD_HOST && (this._options.secure = !0), this._options.logFunction && p.setLogFunction(this._options.logFunction), p.logLevel = this._options.debug || 0, this._api = new Xn(t), this._socket = this._createServerConnection(), !x.supports.audioVideo && !x.supports.data) {
2936
2936
  this._delayedAbort(y.BrowserIncompatible, "The current browser does not support WebRTC");
2937
2937
  return;
2938
2938
  }
@@ -2943,7 +2943,7 @@ const V = class V extends rn {
2943
2943
  n ? this._initialize(n) : this._api.retrieveId().then((i) => this._initialize(i)).catch((i) => this._abort(y.ServerError, i));
2944
2944
  }
2945
2945
  _createServerConnection() {
2946
- const e = new Wn(this._options.secure, this._options.host, this._options.port, this._options.path, this._options.key, this._options.pingInterval);
2946
+ const e = new Gn(this._options.secure, this._options.host, this._options.port, this._options.path, this._options.key, this._options.pingInterval);
2947
2947
  return e.on(P.Message, (t) => {
2948
2948
  this._handleMessage(t);
2949
2949
  }), e.on(P.Error, (t) => {
@@ -2962,37 +2962,37 @@ const V = class V extends rn {
2962
2962
  _handleMessage(e) {
2963
2963
  const t = e.type, n = e.payload, i = e.src;
2964
2964
  switch (t) {
2965
- case v.Open:
2965
+ case _.Open:
2966
2966
  this._lastServerId = this.id, this._open = !0, this.emit("open", this.id);
2967
2967
  break;
2968
- case v.Error:
2968
+ case _.Error:
2969
2969
  this._abort(y.ServerError, n.msg);
2970
2970
  break;
2971
- case v.IdTaken:
2971
+ case _.IdTaken:
2972
2972
  this._abort(y.UnavailableID, `ID "${this.id}" is taken`);
2973
2973
  break;
2974
- case v.InvalidKey:
2974
+ case _.InvalidKey:
2975
2975
  this._abort(y.InvalidKey, `API KEY "${this._options.key}" is invalid`);
2976
2976
  break;
2977
- case v.Leave:
2977
+ case _.Leave:
2978
2978
  p.log(`Received leave message from ${i}`), this._cleanupPeer(i), this._connections.delete(i);
2979
2979
  break;
2980
- case v.Expire:
2980
+ case _.Expire:
2981
2981
  this.emitError(y.PeerUnavailable, `Could not connect to peer ${i}`);
2982
2982
  break;
2983
- case v.Offer: {
2984
- const r = n.connectionId;
2985
- let o = this.getConnection(i, r);
2986
- if (o && (o.close(), p.warn(`Offer received for existing Connection ID:${r}`)), n.type === E.Media) {
2983
+ case _.Offer: {
2984
+ const s = n.connectionId;
2985
+ let o = this.getConnection(i, s);
2986
+ if (o && (o.close(), p.warn(`Offer received for existing Connection ID:${s}`)), n.type === E.Media) {
2987
2987
  const c = new ae(i, this, {
2988
- connectionId: r,
2988
+ connectionId: s,
2989
2989
  _payload: n,
2990
2990
  metadata: n.metadata
2991
2991
  });
2992
2992
  o = c, this._addConnection(i, o), this.emit("call", c);
2993
2993
  } else if (n.type === E.Data) {
2994
2994
  const c = new this._serializers[n.serialization](i, this, {
2995
- connectionId: r,
2995
+ connectionId: s,
2996
2996
  _payload: n,
2997
2997
  metadata: n.metadata,
2998
2998
  label: n.label,
@@ -3004,7 +3004,7 @@ const V = class V extends rn {
3004
3004
  p.warn(`Received malformed connection type:${n.type}`);
3005
3005
  return;
3006
3006
  }
3007
- const a = this._getMessages(r);
3007
+ const a = this._getMessages(s);
3008
3008
  for (const c of a) o.handleMessage(c);
3009
3009
  break;
3010
3010
  }
@@ -3013,8 +3013,8 @@ const V = class V extends rn {
3013
3013
  p.warn(`You received a malformed message from ${i} of type ${t}`);
3014
3014
  return;
3015
3015
  }
3016
- const r = n.connectionId, o = this.getConnection(i, r);
3017
- o && o.peerConnection ? o.handleMessage(e) : r ? this._storeMessage(r, e) : p.warn("You received an unrecognized message:", e);
3016
+ const s = n.connectionId, o = this.getConnection(i, s);
3017
+ o && o.peerConnection ? o.handleMessage(e) : s ? this._storeMessage(s, e) : p.warn("You received an unrecognized message:", e);
3018
3018
  break;
3019
3019
  }
3020
3020
  }
@@ -3169,8 +3169,8 @@ const V = class V extends rn {
3169
3169
  };
3170
3170
  $e = new WeakMap(), U(V, $e, V.DEFAULT_KEY = "peerjs");
3171
3171
  let Te = V;
3172
- var Zn = Te;
3173
- class es {
3172
+ var tr = Te;
3173
+ class nr {
3174
3174
  constructor(e) {
3175
3175
  this.config = e, this.peer = null, this.localStream = null, this.connections = {}, this.callbacks = {
3176
3176
  onStream: null,
@@ -3188,8 +3188,8 @@ class es {
3188
3188
  }
3189
3189
  async initialize(e, t = 0) {
3190
3190
  return new Promise((n, i) => {
3191
- const r = t === 0 ? e : `${e}-r${Math.random().toString(36).slice(2, 6)}`;
3192
- this.peer = new Zn(r, {
3191
+ const s = t === 0 ? e : `${e}-r${Math.random().toString(36).slice(2, 6)}`;
3192
+ this.peer = new tr(s, {
3193
3193
  host: this.config.peerServer.host,
3194
3194
  port: this.config.peerServer.port,
3195
3195
  path: this.config.peerServer.path || "/peerjs",
@@ -3201,7 +3201,7 @@ class es {
3201
3201
  o = !0, console.log("Peer initialized:", a), this.actualPeerId = a, n(a);
3202
3202
  }), this.peer.on("error", async (a) => {
3203
3203
  if (!o && a && a.type === "unavailable-id" && t < 1) {
3204
- console.warn(`Peer id "${r}" taken — retrying with a suffix`);
3204
+ console.warn(`Peer id "${s}" taken — retrying with a suffix`);
3205
3205
  try {
3206
3206
  this.peer.destroy();
3207
3207
  } catch {
@@ -3302,9 +3302,9 @@ class es {
3302
3302
  for (const { call: t } of Object.values(this.connections)) {
3303
3303
  const n = t && t.peerConnection;
3304
3304
  if (!n) continue;
3305
- const i = n.getSenders().find((r) => r.track && r.track.kind === "video");
3305
+ const i = n.getSenders().find((s) => s.track && s.track.kind === "video");
3306
3306
  i && i.replaceTrack(e).catch(
3307
- (r) => console.warn("replaceTrack failed:", r && r.message)
3307
+ (s) => console.warn("replaceTrack failed:", s && s.message)
3308
3308
  );
3309
3309
  }
3310
3310
  }
@@ -3370,126 +3370,126 @@ w.pong = "3";
3370
3370
  w.message = "4";
3371
3371
  w.upgrade = "5";
3372
3372
  w.noop = "6";
3373
- const se = /* @__PURE__ */ Object.create(null);
3374
- Object.keys(w).forEach((s) => {
3375
- se[w[s]] = s;
3373
+ const re = /* @__PURE__ */ Object.create(null);
3374
+ Object.keys(w).forEach((r) => {
3375
+ re[w[r]] = r;
3376
3376
  });
3377
- const we = { type: "error", data: "parser error" }, an = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", cn = typeof ArrayBuffer == "function", hn = (s) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(s) : s && s.buffer instanceof ArrayBuffer, Fe = ({ type: s, data: e }, t, n) => an && e instanceof Blob ? t ? n(e) : ht(e, n) : cn && (e instanceof ArrayBuffer || hn(e)) ? t ? n(e) : ht(new Blob([e]), n) : n(w[s] + (e || "")), ht = (s, e) => {
3377
+ const we = { type: "error", data: "parser error" }, an = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", cn = typeof ArrayBuffer == "function", hn = (r) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(r) : r && r.buffer instanceof ArrayBuffer, qe = ({ type: r, data: e }, t, n) => an && e instanceof Blob ? t ? n(e) : ht(e, n) : cn && (e instanceof ArrayBuffer || hn(e)) ? t ? n(e) : ht(new Blob([e]), n) : n(w[r] + (e || "")), ht = (r, e) => {
3378
3378
  const t = new FileReader();
3379
3379
  return t.onload = function() {
3380
3380
  const n = t.result.split(",")[1];
3381
3381
  e("b" + (n || ""));
3382
- }, t.readAsDataURL(s);
3382
+ }, t.readAsDataURL(r);
3383
3383
  };
3384
- function lt(s) {
3385
- return s instanceof Uint8Array ? s : s instanceof ArrayBuffer ? new Uint8Array(s) : new Uint8Array(s.buffer, s.byteOffset, s.byteLength);
3384
+ function lt(r) {
3385
+ return r instanceof Uint8Array ? r : r instanceof ArrayBuffer ? new Uint8Array(r) : new Uint8Array(r.buffer, r.byteOffset, r.byteLength);
3386
3386
  }
3387
3387
  let me;
3388
- function ts(s, e) {
3389
- if (an && s.data instanceof Blob)
3390
- return s.data.arrayBuffer().then(lt).then(e);
3391
- if (cn && (s.data instanceof ArrayBuffer || hn(s.data)))
3392
- return e(lt(s.data));
3393
- Fe(s, !1, (t) => {
3388
+ function rr(r, e) {
3389
+ if (an && r.data instanceof Blob)
3390
+ return r.data.arrayBuffer().then(lt).then(e);
3391
+ if (cn && (r.data instanceof ArrayBuffer || hn(r.data)))
3392
+ return e(lt(r.data));
3393
+ qe(r, !1, (t) => {
3394
3394
  me || (me = new TextEncoder()), e(me.encode(t));
3395
3395
  });
3396
3396
  }
3397
3397
  const dt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", j = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
3398
- for (let s = 0; s < dt.length; s++)
3399
- j[dt.charCodeAt(s)] = s;
3400
- const ns = (s) => {
3401
- let e = s.length * 0.75, t = s.length, n, i = 0, r, o, a, c;
3402
- s[s.length - 1] === "=" && (e--, s[s.length - 2] === "=" && e--);
3398
+ for (let r = 0; r < dt.length; r++)
3399
+ j[dt.charCodeAt(r)] = r;
3400
+ const ir = (r) => {
3401
+ let e = r.length * 0.75, t = r.length, n, i = 0, s, o, a, c;
3402
+ r[r.length - 1] === "=" && (e--, r[r.length - 2] === "=" && e--);
3403
3403
  const h = new ArrayBuffer(e), l = new Uint8Array(h);
3404
3404
  for (n = 0; n < t; n += 4)
3405
- r = j[s.charCodeAt(n)], o = j[s.charCodeAt(n + 1)], a = j[s.charCodeAt(n + 2)], c = j[s.charCodeAt(n + 3)], l[i++] = r << 2 | o >> 4, l[i++] = (o & 15) << 4 | a >> 2, l[i++] = (a & 3) << 6 | c & 63;
3405
+ s = j[r.charCodeAt(n)], o = j[r.charCodeAt(n + 1)], a = j[r.charCodeAt(n + 2)], c = j[r.charCodeAt(n + 3)], l[i++] = s << 2 | o >> 4, l[i++] = (o & 15) << 4 | a >> 2, l[i++] = (a & 3) << 6 | c & 63;
3406
3406
  return h;
3407
- }, ss = typeof ArrayBuffer == "function", je = (s, e) => {
3408
- if (typeof s != "string")
3407
+ }, sr = typeof ArrayBuffer == "function", je = (r, e) => {
3408
+ if (typeof r != "string")
3409
3409
  return {
3410
3410
  type: "message",
3411
- data: ln(s, e)
3411
+ data: ln(r, e)
3412
3412
  };
3413
- const t = s.charAt(0);
3413
+ const t = r.charAt(0);
3414
3414
  return t === "b" ? {
3415
3415
  type: "message",
3416
- data: is(s.substring(1), e)
3417
- } : se[t] ? s.length > 1 ? {
3418
- type: se[t],
3419
- data: s.substring(1)
3416
+ data: or(r.substring(1), e)
3417
+ } : re[t] ? r.length > 1 ? {
3418
+ type: re[t],
3419
+ data: r.substring(1)
3420
3420
  } : {
3421
- type: se[t]
3421
+ type: re[t]
3422
3422
  } : we;
3423
- }, is = (s, e) => {
3424
- if (ss) {
3425
- const t = ns(s);
3423
+ }, or = (r, e) => {
3424
+ if (sr) {
3425
+ const t = ir(r);
3426
3426
  return ln(t, e);
3427
3427
  } else
3428
- return { base64: !0, data: s };
3429
- }, ln = (s, e) => {
3428
+ return { base64: !0, data: r };
3429
+ }, ln = (r, e) => {
3430
3430
  switch (e) {
3431
3431
  case "blob":
3432
- return s instanceof Blob ? s : new Blob([s]);
3432
+ return r instanceof Blob ? r : new Blob([r]);
3433
3433
  case "arraybuffer":
3434
3434
  default:
3435
- return s instanceof ArrayBuffer ? s : s.buffer;
3435
+ return r instanceof ArrayBuffer ? r : r.buffer;
3436
3436
  }
3437
- }, dn = "", rs = (s, e) => {
3438
- const t = s.length, n = new Array(t);
3437
+ }, dn = "", ar = (r, e) => {
3438
+ const t = r.length, n = new Array(t);
3439
3439
  let i = 0;
3440
- s.forEach((r, o) => {
3441
- Fe(r, !1, (a) => {
3440
+ r.forEach((s, o) => {
3441
+ qe(s, !1, (a) => {
3442
3442
  n[o] = a, ++i === t && e(n.join(dn));
3443
3443
  });
3444
3444
  });
3445
- }, os = (s, e) => {
3446
- const t = s.split(dn), n = [];
3445
+ }, cr = (r, e) => {
3446
+ const t = r.split(dn), n = [];
3447
3447
  for (let i = 0; i < t.length; i++) {
3448
- const r = je(t[i], e);
3449
- if (n.push(r), r.type === "error")
3448
+ const s = je(t[i], e);
3449
+ if (n.push(s), s.type === "error")
3450
3450
  break;
3451
3451
  }
3452
3452
  return n;
3453
3453
  };
3454
- function as() {
3454
+ function hr() {
3455
3455
  return new TransformStream({
3456
- transform(s, e) {
3457
- ts(s, (t) => {
3456
+ transform(r, e) {
3457
+ rr(r, (t) => {
3458
3458
  const n = t.length;
3459
3459
  let i;
3460
3460
  if (n < 126)
3461
3461
  i = new Uint8Array(1), new DataView(i.buffer).setUint8(0, n);
3462
3462
  else if (n < 65536) {
3463
3463
  i = new Uint8Array(3);
3464
- const r = new DataView(i.buffer);
3465
- r.setUint8(0, 126), r.setUint16(1, n);
3464
+ const s = new DataView(i.buffer);
3465
+ s.setUint8(0, 126), s.setUint16(1, n);
3466
3466
  } else {
3467
3467
  i = new Uint8Array(9);
3468
- const r = new DataView(i.buffer);
3469
- r.setUint8(0, 127), r.setBigUint64(1, BigInt(n));
3468
+ const s = new DataView(i.buffer);
3469
+ s.setUint8(0, 127), s.setBigUint64(1, BigInt(n));
3470
3470
  }
3471
- s.data && typeof s.data != "string" && (i[0] |= 128), e.enqueue(i), e.enqueue(t);
3471
+ r.data && typeof r.data != "string" && (i[0] |= 128), e.enqueue(i), e.enqueue(t);
3472
3472
  });
3473
3473
  }
3474
3474
  });
3475
3475
  }
3476
3476
  let ye;
3477
- function J(s) {
3478
- return s.reduce((e, t) => e + t.length, 0);
3477
+ function J(r) {
3478
+ return r.reduce((e, t) => e + t.length, 0);
3479
3479
  }
3480
- function W(s, e) {
3481
- if (s[0].length === e)
3482
- return s.shift();
3480
+ function W(r, e) {
3481
+ if (r[0].length === e)
3482
+ return r.shift();
3483
3483
  const t = new Uint8Array(e);
3484
3484
  let n = 0;
3485
3485
  for (let i = 0; i < e; i++)
3486
- t[i] = s[0][n++], n === s[0].length && (s.shift(), n = 0);
3487
- return s.length && n < s[0].length && (s[0] = s[0].slice(n)), t;
3486
+ t[i] = r[0][n++], n === r[0].length && (r.shift(), n = 0);
3487
+ return r.length && n < r[0].length && (r[0] = r[0].slice(n)), t;
3488
3488
  }
3489
- function cs(s, e) {
3489
+ function lr(r, e) {
3490
3490
  ye || (ye = new TextDecoder());
3491
3491
  const t = [];
3492
- let n = 0, i = -1, r = !1;
3492
+ let n = 0, i = -1, s = !1;
3493
3493
  return new TransformStream({
3494
3494
  transform(o, a) {
3495
3495
  for (t.push(o); ; ) {
@@ -3497,7 +3497,7 @@ function cs(s, e) {
3497
3497
  if (J(t) < 1)
3498
3498
  break;
3499
3499
  const c = W(t, 1);
3500
- r = (c[0] & 128) === 128, i = c[0] & 127, i < 126 ? n = 3 : i === 126 ? n = 1 : n = 2;
3500
+ s = (c[0] & 128) === 128, i = c[0] & 127, i < 126 ? n = 3 : i === 126 ? n = 1 : n = 2;
3501
3501
  } else if (n === 1) {
3502
3502
  if (J(t) < 2)
3503
3503
  break;
@@ -3516,9 +3516,9 @@ function cs(s, e) {
3516
3516
  if (J(t) < i)
3517
3517
  break;
3518
3518
  const c = W(t, i);
3519
- a.enqueue(je(r ? c : ye.decode(c), e)), n = 0;
3519
+ a.enqueue(je(s ? c : ye.decode(c), e)), n = 0;
3520
3520
  }
3521
- if (i === 0 || i > s) {
3521
+ if (i === 0 || i > r) {
3522
3522
  a.enqueue(we);
3523
3523
  break;
3524
3524
  }
@@ -3527,40 +3527,40 @@ function cs(s, e) {
3527
3527
  });
3528
3528
  }
3529
3529
  const un = 4;
3530
- function b(s) {
3531
- if (s) return hs(s);
3530
+ function b(r) {
3531
+ if (r) return dr(r);
3532
3532
  }
3533
- function hs(s) {
3533
+ function dr(r) {
3534
3534
  for (var e in b.prototype)
3535
- s[e] = b.prototype[e];
3536
- return s;
3535
+ r[e] = b.prototype[e];
3536
+ return r;
3537
3537
  }
3538
- b.prototype.on = b.prototype.addEventListener = function(s, e) {
3539
- return this._callbacks = this._callbacks || {}, (this._callbacks["$" + s] = this._callbacks["$" + s] || []).push(e), this;
3538
+ b.prototype.on = b.prototype.addEventListener = function(r, e) {
3539
+ return this._callbacks = this._callbacks || {}, (this._callbacks["$" + r] = this._callbacks["$" + r] || []).push(e), this;
3540
3540
  };
3541
- b.prototype.once = function(s, e) {
3541
+ b.prototype.once = function(r, e) {
3542
3542
  function t() {
3543
- this.off(s, t), e.apply(this, arguments);
3543
+ this.off(r, t), e.apply(this, arguments);
3544
3544
  }
3545
- return t.fn = e, this.on(s, t), this;
3545
+ return t.fn = e, this.on(r, t), this;
3546
3546
  };
3547
- b.prototype.off = b.prototype.removeListener = b.prototype.removeAllListeners = b.prototype.removeEventListener = function(s, e) {
3547
+ b.prototype.off = b.prototype.removeListener = b.prototype.removeAllListeners = b.prototype.removeEventListener = function(r, e) {
3548
3548
  if (this._callbacks = this._callbacks || {}, arguments.length == 0)
3549
3549
  return this._callbacks = {}, this;
3550
- var t = this._callbacks["$" + s];
3550
+ var t = this._callbacks["$" + r];
3551
3551
  if (!t) return this;
3552
3552
  if (arguments.length == 1)
3553
- return delete this._callbacks["$" + s], this;
3553
+ return delete this._callbacks["$" + r], this;
3554
3554
  for (var n, i = 0; i < t.length; i++)
3555
3555
  if (n = t[i], n === e || n.fn === e) {
3556
3556
  t.splice(i, 1);
3557
3557
  break;
3558
3558
  }
3559
- return t.length === 0 && delete this._callbacks["$" + s], this;
3559
+ return t.length === 0 && delete this._callbacks["$" + r], this;
3560
3560
  };
3561
- b.prototype.emit = function(s) {
3561
+ b.prototype.emit = function(r) {
3562
3562
  this._callbacks = this._callbacks || {};
3563
- for (var e = new Array(arguments.length - 1), t = this._callbacks["$" + s], n = 1; n < arguments.length; n++)
3563
+ for (var e = new Array(arguments.length - 1), t = this._callbacks["$" + r], n = 1; n < arguments.length; n++)
3564
3564
  e[n - 1] = arguments[n];
3565
3565
  if (t) {
3566
3566
  t = t.slice(0);
@@ -3570,48 +3570,48 @@ b.prototype.emit = function(s) {
3570
3570
  return this;
3571
3571
  };
3572
3572
  b.prototype.emitReserved = b.prototype.emit;
3573
- b.prototype.listeners = function(s) {
3574
- return this._callbacks = this._callbacks || {}, this._callbacks["$" + s] || [];
3573
+ b.prototype.listeners = function(r) {
3574
+ return this._callbacks = this._callbacks || {}, this._callbacks["$" + r] || [];
3575
3575
  };
3576
- b.prototype.hasListeners = function(s) {
3577
- return !!this.listeners(s).length;
3576
+ b.prototype.hasListeners = function(r) {
3577
+ return !!this.listeners(r).length;
3578
3578
  };
3579
- const de = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), k = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), ls = "arraybuffer";
3580
- function pn(s, ...e) {
3581
- return e.reduce((t, n) => (s.hasOwnProperty(n) && (t[n] = s[n]), t), {});
3579
+ const de = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), k = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), ur = "arraybuffer";
3580
+ function pn(r, ...e) {
3581
+ return e.reduce((t, n) => (r.hasOwnProperty(n) && (t[n] = r[n]), t), {});
3582
3582
  }
3583
- const ds = k.setTimeout, us = k.clearTimeout;
3584
- function ue(s, e) {
3585
- e.useNativeTimers ? (s.setTimeoutFn = ds.bind(k), s.clearTimeoutFn = us.bind(k)) : (s.setTimeoutFn = k.setTimeout.bind(k), s.clearTimeoutFn = k.clearTimeout.bind(k));
3583
+ const pr = k.setTimeout, fr = k.clearTimeout;
3584
+ function ue(r, e) {
3585
+ e.useNativeTimers ? (r.setTimeoutFn = pr.bind(k), r.clearTimeoutFn = fr.bind(k)) : (r.setTimeoutFn = k.setTimeout.bind(k), r.clearTimeoutFn = k.clearTimeout.bind(k));
3586
3586
  }
3587
- const ps = 1.33;
3588
- function fs(s) {
3589
- return typeof s == "string" ? gs(s) : Math.ceil((s.byteLength || s.size) * ps);
3587
+ const gr = 1.33;
3588
+ function mr(r) {
3589
+ return typeof r == "string" ? yr(r) : Math.ceil((r.byteLength || r.size) * gr);
3590
3590
  }
3591
- function gs(s) {
3591
+ function yr(r) {
3592
3592
  let e = 0, t = 0;
3593
- for (let n = 0, i = s.length; n < i; n++)
3594
- e = s.charCodeAt(n), e < 128 ? t += 1 : e < 2048 ? t += 2 : e < 55296 || e >= 57344 ? t += 3 : (n++, t += 4);
3593
+ for (let n = 0, i = r.length; n < i; n++)
3594
+ e = r.charCodeAt(n), e < 128 ? t += 1 : e < 2048 ? t += 2 : e < 55296 || e >= 57344 ? t += 3 : (n++, t += 4);
3595
3595
  return t;
3596
3596
  }
3597
3597
  function fn() {
3598
3598
  return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
3599
3599
  }
3600
- function ms(s) {
3600
+ function br(r) {
3601
3601
  let e = "";
3602
- for (let t in s)
3603
- s.hasOwnProperty(t) && (e.length && (e += "&"), e += encodeURIComponent(t) + "=" + encodeURIComponent(s[t]));
3602
+ for (let t in r)
3603
+ r.hasOwnProperty(t) && (e.length && (e += "&"), e += encodeURIComponent(t) + "=" + encodeURIComponent(r[t]));
3604
3604
  return e;
3605
3605
  }
3606
- function ys(s) {
3607
- let e = {}, t = s.split("&");
3606
+ function vr(r) {
3607
+ let e = {}, t = r.split("&");
3608
3608
  for (let n = 0, i = t.length; n < i; n++) {
3609
- let r = t[n].split("=");
3610
- e[decodeURIComponent(r[0])] = decodeURIComponent(r[1]);
3609
+ let s = t[n].split("=");
3610
+ e[decodeURIComponent(s[0])] = decodeURIComponent(s[1]);
3611
3611
  }
3612
3612
  return e;
3613
3613
  }
3614
- class bs extends Error {
3614
+ class _r extends Error {
3615
3615
  constructor(e, t, n) {
3616
3616
  super(e), this.description = t, this.context = n, this.type = "TransportError";
3617
3617
  }
@@ -3636,7 +3636,7 @@ class He extends b {
3636
3636
  * @protected
3637
3637
  */
3638
3638
  onError(e, t, n) {
3639
- return super.emitReserved("error", new bs(e, t, n)), this;
3639
+ return super.emitReserved("error", new _r(e, t, n)), this;
3640
3640
  }
3641
3641
  /**
3642
3642
  * Opens the transport.
@@ -3710,11 +3710,11 @@ class He extends b {
3710
3710
  return this.opts.port && (this.opts.secure && Number(this.opts.port) !== 443 || !this.opts.secure && Number(this.opts.port) !== 80) ? ":" + this.opts.port : "";
3711
3711
  }
3712
3712
  _query(e) {
3713
- const t = ms(e);
3713
+ const t = br(e);
3714
3714
  return t.length ? "?" + t : "";
3715
3715
  }
3716
3716
  }
3717
- class _s extends He {
3717
+ class Sr extends He {
3718
3718
  constructor() {
3719
3719
  super(...arguments), this._polling = !1;
3720
3720
  }
@@ -3770,7 +3770,7 @@ class _s extends He {
3770
3770
  return this.onClose({ description: "transport closed by the server" }), !1;
3771
3771
  this.onPacket(n);
3772
3772
  };
3773
- os(e, this.socket.binaryType).forEach(t), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
3773
+ cr(e, this.socket.binaryType).forEach(t), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
3774
3774
  }
3775
3775
  /**
3776
3776
  * For polling, send a close packet.
@@ -3790,7 +3790,7 @@ class _s extends He {
3790
3790
  * @protected
3791
3791
  */
3792
3792
  write(e) {
3793
- this.writable = !1, rs(e, (t) => {
3793
+ this.writable = !1, ar(e, (t) => {
3794
3794
  this.doWrite(t, () => {
3795
3795
  this.writable = !0, this.emitReserved("drain");
3796
3796
  });
@@ -3811,10 +3811,10 @@ try {
3811
3811
  gn = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
3812
3812
  } catch {
3813
3813
  }
3814
- const vs = gn;
3815
- function Ss() {
3814
+ const Cr = gn;
3815
+ function xr() {
3816
3816
  }
3817
- class Cs extends _s {
3817
+ class kr extends Sr {
3818
3818
  /**
3819
3819
  * XHR Polling constructor.
3820
3820
  *
@@ -3840,8 +3840,8 @@ class Cs extends _s {
3840
3840
  method: "POST",
3841
3841
  data: e
3842
3842
  });
3843
- n.on("success", t), n.on("error", (i, r) => {
3844
- this.onError("xhr post error", i, r);
3843
+ n.on("success", t), n.on("error", (i, s) => {
3844
+ this.onError("xhr post error", i, s);
3845
3845
  });
3846
3846
  }
3847
3847
  /**
@@ -3927,7 +3927,7 @@ class T extends b {
3927
3927
  */
3928
3928
  _cleanup(e) {
3929
3929
  if (!(typeof this._xhr > "u" || this._xhr === null)) {
3930
- if (this._xhr.onreadystatechange = Ss, e)
3930
+ if (this._xhr.onreadystatechange = xr, e)
3931
3931
  try {
3932
3932
  this._xhr.abort();
3933
3933
  } catch {
@@ -3959,34 +3959,34 @@ if (typeof document < "u") {
3959
3959
  if (typeof attachEvent == "function")
3960
3960
  attachEvent("onunload", ut);
3961
3961
  else if (typeof addEventListener == "function") {
3962
- const s = "onpagehide" in k ? "pagehide" : "unload";
3963
- addEventListener(s, ut, !1);
3962
+ const r = "onpagehide" in k ? "pagehide" : "unload";
3963
+ addEventListener(r, ut, !1);
3964
3964
  }
3965
3965
  }
3966
3966
  function ut() {
3967
- for (let s in T.requests)
3968
- T.requests.hasOwnProperty(s) && T.requests[s].abort();
3967
+ for (let r in T.requests)
3968
+ T.requests.hasOwnProperty(r) && T.requests[r].abort();
3969
3969
  }
3970
- const xs = function() {
3971
- const s = mn({
3970
+ const Rr = function() {
3971
+ const r = mn({
3972
3972
  xdomain: !1
3973
3973
  });
3974
- return s && s.responseType !== null;
3974
+ return r && r.responseType !== null;
3975
3975
  }();
3976
- class ks extends Cs {
3976
+ class Tr extends kr {
3977
3977
  constructor(e) {
3978
3978
  super(e);
3979
3979
  const t = e && e.forceBase64;
3980
- this.supportsBinary = xs && !t;
3980
+ this.supportsBinary = Rr && !t;
3981
3981
  }
3982
3982
  request(e = {}) {
3983
3983
  return Object.assign(e, { xd: this.xd }, this.opts), new T(mn, this.uri(), e);
3984
3984
  }
3985
3985
  }
3986
- function mn(s) {
3987
- const e = s.xdomain;
3986
+ function mn(r) {
3987
+ const e = r.xdomain;
3988
3988
  try {
3989
- if (typeof XMLHttpRequest < "u" && (!e || vs))
3989
+ if (typeof XMLHttpRequest < "u" && (!e || Cr))
3990
3990
  return new XMLHttpRequest();
3991
3991
  } catch {
3992
3992
  }
@@ -3997,7 +3997,7 @@ function mn(s) {
3997
3997
  }
3998
3998
  }
3999
3999
  const yn = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
4000
- class Rs extends He {
4000
+ class wr extends He {
4001
4001
  get name() {
4002
4002
  return "websocket";
4003
4003
  }
@@ -4028,9 +4028,9 @@ class Rs extends He {
4028
4028
  this.writable = !1;
4029
4029
  for (let t = 0; t < e.length; t++) {
4030
4030
  const n = e[t], i = t === e.length - 1;
4031
- Fe(n, this.supportsBinary, (r) => {
4031
+ qe(n, this.supportsBinary, (s) => {
4032
4032
  try {
4033
- this.doWrite(n, r);
4033
+ this.doWrite(n, s);
4034
4034
  } catch {
4035
4035
  }
4036
4036
  i && de(() => {
@@ -4054,7 +4054,7 @@ class Rs extends He {
4054
4054
  }
4055
4055
  }
4056
4056
  const be = k.WebSocket || k.MozWebSocket;
4057
- class Ts extends Rs {
4057
+ class Pr extends wr {
4058
4058
  createSocket(e, t, n) {
4059
4059
  return yn ? new be(e, t, n) : t ? new be(e, t) : new be(e);
4060
4060
  }
@@ -4062,7 +4062,7 @@ class Ts extends Rs {
4062
4062
  this.ws.send(t);
4063
4063
  }
4064
4064
  }
4065
- class ws extends He {
4065
+ class Er extends He {
4066
4066
  get name() {
4067
4067
  return "webtransport";
4068
4068
  }
@@ -4078,15 +4078,15 @@ class ws extends He {
4078
4078
  this.onError("webtransport error", e);
4079
4079
  }), this._transport.ready.then(() => {
4080
4080
  this._transport.createBidirectionalStream().then((e) => {
4081
- const t = cs(Number.MAX_SAFE_INTEGER, this.socket.binaryType), n = e.readable.pipeThrough(t).getReader(), i = as();
4081
+ const t = lr(Number.MAX_SAFE_INTEGER, this.socket.binaryType), n = e.readable.pipeThrough(t).getReader(), i = hr();
4082
4082
  i.readable.pipeTo(e.writable), this._writer = i.writable.getWriter();
4083
- const r = () => {
4083
+ const s = () => {
4084
4084
  n.read().then(({ done: a, value: c }) => {
4085
- a || (this.onPacket(c), r());
4085
+ a || (this.onPacket(c), s());
4086
4086
  }).catch((a) => {
4087
4087
  });
4088
4088
  };
4089
- r();
4089
+ s();
4090
4090
  const o = { type: "open" };
4091
4091
  this.query.sid && (o.data = `{"sid":"${this.query.sid}"}`), this._writer.write(o).then(() => this.onOpen());
4092
4092
  });
@@ -4108,11 +4108,11 @@ class ws extends He {
4108
4108
  (e = this._transport) === null || e === void 0 || e.close();
4109
4109
  }
4110
4110
  }
4111
- const Ps = {
4112
- websocket: Ts,
4113
- webtransport: ws,
4114
- polling: ks
4115
- }, Es = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, Ms = [
4111
+ const Mr = {
4112
+ websocket: Pr,
4113
+ webtransport: Er,
4114
+ polling: Tr
4115
+ }, Ir = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, Ar = [
4116
4116
  "source",
4117
4117
  "protocol",
4118
4118
  "authority",
@@ -4128,29 +4128,29 @@ const Ps = {
4128
4128
  "query",
4129
4129
  "anchor"
4130
4130
  ];
4131
- function Pe(s) {
4132
- if (s.length > 8e3)
4131
+ function Pe(r) {
4132
+ if (r.length > 8e3)
4133
4133
  throw "URI too long";
4134
- const e = s, t = s.indexOf("["), n = s.indexOf("]");
4135
- t != -1 && n != -1 && (s = s.substring(0, t) + s.substring(t, n).replace(/:/g, ";") + s.substring(n, s.length));
4136
- let i = Es.exec(s || ""), r = {}, o = 14;
4134
+ const e = r, t = r.indexOf("["), n = r.indexOf("]");
4135
+ t != -1 && n != -1 && (r = r.substring(0, t) + r.substring(t, n).replace(/:/g, ";") + r.substring(n, r.length));
4136
+ let i = Ir.exec(r || ""), s = {}, o = 14;
4137
4137
  for (; o--; )
4138
- r[Ms[o]] = i[o] || "";
4139
- return t != -1 && n != -1 && (r.source = e, r.host = r.host.substring(1, r.host.length - 1).replace(/;/g, ":"), r.authority = r.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), r.ipv6uri = !0), r.pathNames = Is(r, r.path), r.queryKey = As(r, r.query), r;
4138
+ s[Ar[o]] = i[o] || "";
4139
+ return t != -1 && n != -1 && (s.source = e, s.host = s.host.substring(1, s.host.length - 1).replace(/;/g, ":"), s.authority = s.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), s.ipv6uri = !0), s.pathNames = Or(s, s.path), s.queryKey = Dr(s, s.query), s;
4140
4140
  }
4141
- function Is(s, e) {
4141
+ function Or(r, e) {
4142
4142
  const t = /\/{2,9}/g, n = e.replace(t, "/").split("/");
4143
4143
  return (e.slice(0, 1) == "/" || e.length === 0) && n.splice(0, 1), e.slice(-1) == "/" && n.splice(n.length - 1, 1), n;
4144
4144
  }
4145
- function As(s, e) {
4145
+ function Dr(r, e) {
4146
4146
  const t = {};
4147
- return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(n, i, r) {
4148
- i && (t[i] = r);
4147
+ return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(n, i, s) {
4148
+ i && (t[i] = s);
4149
4149
  }), t;
4150
4150
  }
4151
4151
  const Ee = typeof addEventListener == "function" && typeof removeEventListener == "function", ie = [];
4152
4152
  Ee && addEventListener("offline", () => {
4153
- ie.forEach((s) => s());
4153
+ ie.forEach((r) => r());
4154
4154
  }, !1);
4155
4155
  class M extends b {
4156
4156
  /**
@@ -4160,7 +4160,7 @@ class M extends b {
4160
4160
  * @param {Object} opts - options
4161
4161
  */
4162
4162
  constructor(e, t) {
4163
- if (super(), this.binaryType = ls, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, e && typeof e == "object" && (t = e, e = null), e) {
4163
+ if (super(), this.binaryType = ur, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, e && typeof e == "object" && (t = e, e = null), e) {
4164
4164
  const n = Pe(e);
4165
4165
  t.hostname = n.host, t.secure = n.protocol === "https" || n.protocol === "wss", t.port = n.port, n.query && (t.query = n.query);
4166
4166
  } else t.host && (t.hostname = Pe(t.host).host);
@@ -4181,7 +4181,7 @@ class M extends b {
4181
4181
  },
4182
4182
  transportOptions: {},
4183
4183
  closeOnBeforeunload: !1
4184
- }, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = ys(this.opts.query)), Ee && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
4184
+ }, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = vr(this.opts.query)), Ee && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
4185
4185
  this.transport && (this.transport.removeAllListeners(), this.transport.close());
4186
4186
  }, addEventListener("beforeunload", this._beforeunloadEventListener, !1)), this.hostname !== "localhost" && (this._offlineEventListener = () => {
4187
4187
  this._onClose("transport close", {
@@ -4316,7 +4316,7 @@ class M extends b {
4316
4316
  let t = 1;
4317
4317
  for (let n = 0; n < this.writeBuffer.length; n++) {
4318
4318
  const i = this.writeBuffer[n].data;
4319
- if (i && (t += fs(i)), n > 0 && t > this._maxPayload)
4319
+ if (i && (t += mr(i)), n > 0 && t > this._maxPayload)
4320
4320
  return this.writeBuffer.slice(0, n);
4321
4321
  t += 2;
4322
4322
  }
@@ -4375,12 +4375,12 @@ class M extends b {
4375
4375
  if (typeof t == "function" && (i = t, t = void 0), typeof n == "function" && (i = n, n = null), this.readyState === "closing" || this.readyState === "closed")
4376
4376
  return;
4377
4377
  n = n || {}, n.compress = n.compress !== !1;
4378
- const r = {
4378
+ const s = {
4379
4379
  type: e,
4380
4380
  data: t,
4381
4381
  options: n
4382
4382
  };
4383
- this.emitReserved("packetCreate", r), this.writeBuffer.push(r), i && this.once("flush", i), this.flush();
4383
+ this.emitReserved("packetCreate", s), this.writeBuffer.push(s), i && this.once("flush", i), this.flush();
4384
4384
  }
4385
4385
  /**
4386
4386
  * Closes the connection.
@@ -4423,7 +4423,7 @@ class M extends b {
4423
4423
  }
4424
4424
  }
4425
4425
  M.protocol = un;
4426
- class Os extends M {
4426
+ class Lr extends M {
4427
4427
  constructor() {
4428
4428
  super(...arguments), this._upgrades = [];
4429
4429
  }
@@ -4456,12 +4456,12 @@ class Os extends M {
4456
4456
  }
4457
4457
  }));
4458
4458
  };
4459
- function r() {
4459
+ function s() {
4460
4460
  n || (n = !0, l(), t.close(), t = null);
4461
4461
  }
4462
4462
  const o = (d) => {
4463
4463
  const u = new Error("probe error: " + d);
4464
- u.transport = t.name, r(), this.emitReserved("upgradeError", u);
4464
+ u.transport = t.name, s(), this.emitReserved("upgradeError", u);
4465
4465
  };
4466
4466
  function a() {
4467
4467
  o("transport closed");
@@ -4470,7 +4470,7 @@ class Os extends M {
4470
4470
  o("socket closed");
4471
4471
  }
4472
4472
  function h(d) {
4473
- t && d.name !== t.name && r();
4473
+ t && d.name !== t.name && s();
4474
4474
  }
4475
4475
  const l = () => {
4476
4476
  t.removeListener("open", i), t.removeListener("error", o), t.removeListener("close", a), this.off("close", c), this.off("upgrading", h);
@@ -4495,82 +4495,82 @@ class Os extends M {
4495
4495
  return t;
4496
4496
  }
4497
4497
  }
4498
- let Ds = class extends Os {
4498
+ let $r = class extends Lr {
4499
4499
  constructor(e, t = {}) {
4500
4500
  const n = typeof e == "object", i = n ? { ...e } : { ...t };
4501
- (!i.transports || i.transports && typeof i.transports[0] == "string") && (i.transports = (i.transports || ["polling", "websocket", "webtransport"]).map((r) => Ps[r]).filter((r) => !!r)), super(n ? i : e, i);
4501
+ (!i.transports || i.transports && typeof i.transports[0] == "string") && (i.transports = (i.transports || ["polling", "websocket", "webtransport"]).map((s) => Mr[s]).filter((s) => !!s)), super(n ? i : e, i);
4502
4502
  }
4503
4503
  };
4504
- function Ls(s, e = "", t) {
4505
- let n = s;
4506
- t = t || typeof location < "u" && location, s == null && (s = t.protocol + "//" + t.host), typeof s == "string" && (s.charAt(0) === "/" && (s.charAt(1) === "/" ? s = t.protocol + s : s = t.host + s), /^(https?|wss?):\/\//.test(s) || (typeof t < "u" ? s = t.protocol + "//" + s : s = "https://" + s), n = Pe(s)), n.port || (/^(http|ws)$/.test(n.protocol) ? n.port = "80" : /^(http|ws)s$/.test(n.protocol) && (n.port = "443")), n.path = n.path || "/";
4507
- const r = n.host.indexOf(":") !== -1 ? "[" + n.host + "]" : n.host;
4508
- return n.id = n.protocol + "://" + r + ":" + n.port + e, n.href = n.protocol + "://" + r + (t && t.port === n.port ? "" : ":" + n.port), n;
4509
- }
4510
- const $s = typeof ArrayBuffer == "function", Bs = (s) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(s) : s.buffer instanceof ArrayBuffer, bn = Object.prototype.toString, Us = typeof Blob == "function" || typeof Blob < "u" && bn.call(Blob) === "[object BlobConstructor]", zs = typeof File == "function" || typeof File < "u" && bn.call(File) === "[object FileConstructor]";
4511
- function Ve(s) {
4512
- return $s && (s instanceof ArrayBuffer || Bs(s)) || Us && s instanceof Blob || zs && s instanceof File;
4513
- }
4514
- function re(s, e) {
4515
- if (!s || typeof s != "object")
4504
+ function Br(r, e = "", t) {
4505
+ let n = r;
4506
+ t = t || typeof location < "u" && location, r == null && (r = t.protocol + "//" + t.host), typeof r == "string" && (r.charAt(0) === "/" && (r.charAt(1) === "/" ? r = t.protocol + r : r = t.host + r), /^(https?|wss?):\/\//.test(r) || (typeof t < "u" ? r = t.protocol + "//" + r : r = "https://" + r), n = Pe(r)), n.port || (/^(http|ws)$/.test(n.protocol) ? n.port = "80" : /^(http|ws)s$/.test(n.protocol) && (n.port = "443")), n.path = n.path || "/";
4507
+ const s = n.host.indexOf(":") !== -1 ? "[" + n.host + "]" : n.host;
4508
+ return n.id = n.protocol + "://" + s + ":" + n.port + e, n.href = n.protocol + "://" + s + (t && t.port === n.port ? "" : ":" + n.port), n;
4509
+ }
4510
+ const Ur = typeof ArrayBuffer == "function", zr = (r) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(r) : r.buffer instanceof ArrayBuffer, bn = Object.prototype.toString, Nr = typeof Blob == "function" || typeof Blob < "u" && bn.call(Blob) === "[object BlobConstructor]", Fr = typeof File == "function" || typeof File < "u" && bn.call(File) === "[object FileConstructor]";
4511
+ function Ve(r) {
4512
+ return Ur && (r instanceof ArrayBuffer || zr(r)) || Nr && r instanceof Blob || Fr && r instanceof File;
4513
+ }
4514
+ function se(r, e) {
4515
+ if (!r || typeof r != "object")
4516
4516
  return !1;
4517
- if (Array.isArray(s)) {
4518
- for (let t = 0, n = s.length; t < n; t++)
4519
- if (re(s[t]))
4517
+ if (Array.isArray(r)) {
4518
+ for (let t = 0, n = r.length; t < n; t++)
4519
+ if (se(r[t]))
4520
4520
  return !0;
4521
4521
  return !1;
4522
4522
  }
4523
- if (Ve(s))
4523
+ if (Ve(r))
4524
4524
  return !0;
4525
- if (s.toJSON && typeof s.toJSON == "function" && arguments.length === 1)
4526
- return re(s.toJSON(), !0);
4527
- for (const t in s)
4528
- if (Object.prototype.hasOwnProperty.call(s, t) && re(s[t]))
4525
+ if (r.toJSON && typeof r.toJSON == "function" && arguments.length === 1)
4526
+ return se(r.toJSON(), !0);
4527
+ for (const t in r)
4528
+ if (Object.prototype.hasOwnProperty.call(r, t) && se(r[t]))
4529
4529
  return !0;
4530
4530
  return !1;
4531
4531
  }
4532
- function Ns(s) {
4533
- const e = [], t = s.data, n = s;
4532
+ function qr(r) {
4533
+ const e = [], t = r.data, n = r;
4534
4534
  return n.data = Me(t, e), n.attachments = e.length, { packet: n, buffers: e };
4535
4535
  }
4536
- function Me(s, e) {
4537
- if (!s)
4538
- return s;
4539
- if (Ve(s)) {
4536
+ function Me(r, e) {
4537
+ if (!r)
4538
+ return r;
4539
+ if (Ve(r)) {
4540
4540
  const t = { _placeholder: !0, num: e.length };
4541
- return e.push(s), t;
4542
- } else if (Array.isArray(s)) {
4543
- const t = new Array(s.length);
4544
- for (let n = 0; n < s.length; n++)
4545
- t[n] = Me(s[n], e);
4541
+ return e.push(r), t;
4542
+ } else if (Array.isArray(r)) {
4543
+ const t = new Array(r.length);
4544
+ for (let n = 0; n < r.length; n++)
4545
+ t[n] = Me(r[n], e);
4546
4546
  return t;
4547
- } else if (typeof s == "object" && !(s instanceof Date)) {
4547
+ } else if (typeof r == "object" && !(r instanceof Date)) {
4548
4548
  const t = {};
4549
- for (const n in s)
4550
- Object.prototype.hasOwnProperty.call(s, n) && (t[n] = Me(s[n], e));
4549
+ for (const n in r)
4550
+ Object.prototype.hasOwnProperty.call(r, n) && (t[n] = Me(r[n], e));
4551
4551
  return t;
4552
4552
  }
4553
- return s;
4553
+ return r;
4554
4554
  }
4555
- function qs(s, e) {
4556
- return s.data = Ie(s.data, e), delete s.attachments, s;
4555
+ function jr(r, e) {
4556
+ return r.data = Ie(r.data, e), delete r.attachments, r;
4557
4557
  }
4558
- function Ie(s, e) {
4559
- if (!s)
4560
- return s;
4561
- if (s && s._placeholder === !0) {
4562
- if (typeof s.num == "number" && s.num >= 0 && s.num < e.length)
4563
- return e[s.num];
4558
+ function Ie(r, e) {
4559
+ if (!r)
4560
+ return r;
4561
+ if (r && r._placeholder === !0) {
4562
+ if (typeof r.num == "number" && r.num >= 0 && r.num < e.length)
4563
+ return e[r.num];
4564
4564
  throw new Error("illegal attachments");
4565
- } else if (Array.isArray(s))
4566
- for (let t = 0; t < s.length; t++)
4567
- s[t] = Ie(s[t], e);
4568
- else if (typeof s == "object")
4569
- for (const t in s)
4570
- Object.prototype.hasOwnProperty.call(s, t) && (s[t] = Ie(s[t], e));
4571
- return s;
4572
- }
4573
- const Fs = [
4565
+ } else if (Array.isArray(r))
4566
+ for (let t = 0; t < r.length; t++)
4567
+ r[t] = Ie(r[t], e);
4568
+ else if (typeof r == "object")
4569
+ for (const t in r)
4570
+ Object.prototype.hasOwnProperty.call(r, t) && (r[t] = Ie(r[t], e));
4571
+ return r;
4572
+ }
4573
+ const Hr = [
4574
4574
  "connect",
4575
4575
  // used on the client side
4576
4576
  "connect_error",
@@ -4585,10 +4585,10 @@ const Fs = [
4585
4585
  // used by the Node.js EventEmitter
4586
4586
  ];
4587
4587
  var g;
4588
- (function(s) {
4589
- s[s.CONNECT = 0] = "CONNECT", s[s.DISCONNECT = 1] = "DISCONNECT", s[s.EVENT = 2] = "EVENT", s[s.ACK = 3] = "ACK", s[s.CONNECT_ERROR = 4] = "CONNECT_ERROR", s[s.BINARY_EVENT = 5] = "BINARY_EVENT", s[s.BINARY_ACK = 6] = "BINARY_ACK";
4588
+ (function(r) {
4589
+ r[r.CONNECT = 0] = "CONNECT", r[r.DISCONNECT = 1] = "DISCONNECT", r[r.EVENT = 2] = "EVENT", r[r.ACK = 3] = "ACK", r[r.CONNECT_ERROR = 4] = "CONNECT_ERROR", r[r.BINARY_EVENT = 5] = "BINARY_EVENT", r[r.BINARY_ACK = 6] = "BINARY_ACK";
4590
4590
  })(g || (g = {}));
4591
- class js {
4591
+ class Vr {
4592
4592
  /**
4593
4593
  * Encoder constructor
4594
4594
  *
@@ -4604,7 +4604,7 @@ class js {
4604
4604
  * @param {Object} obj - packet object
4605
4605
  */
4606
4606
  encode(e) {
4607
- return (e.type === g.EVENT || e.type === g.ACK) && re(e) ? this.encodeAsBinary({
4607
+ return (e.type === g.EVENT || e.type === g.ACK) && se(e) ? this.encodeAsBinary({
4608
4608
  type: e.type === g.EVENT ? g.BINARY_EVENT : g.BINARY_ACK,
4609
4609
  nsp: e.nsp,
4610
4610
  data: e.data,
@@ -4624,7 +4624,7 @@ class js {
4624
4624
  * a list of buffers.
4625
4625
  */
4626
4626
  encodeAsBinary(e) {
4627
- const t = Ns(e), n = this.encodeAsString(t.packet), i = t.buffers;
4627
+ const t = qr(e), n = this.encodeAsString(t.packet), i = t.buffers;
4628
4628
  return i.unshift(n), i;
4629
4629
  }
4630
4630
  }
@@ -4650,7 +4650,7 @@ class Ke extends b {
4650
4650
  throw new Error("got plaintext data when reconstructing a packet");
4651
4651
  t = this.decodeString(e);
4652
4652
  const n = t.type === g.BINARY_EVENT;
4653
- n || t.type === g.BINARY_ACK ? (t.type = n ? g.EVENT : g.ACK, this.reconstructor = new Hs(t), t.attachments === 0 && super.emitReserved("decoded", t)) : super.emitReserved("decoded", t);
4653
+ n || t.type === g.BINARY_ACK ? (t.type = n ? g.EVENT : g.ACK, this.reconstructor = new Kr(t), t.attachments === 0 && super.emitReserved("decoded", t)) : super.emitReserved("decoded", t);
4654
4654
  } else if (Ve(e) || e.base64)
4655
4655
  if (this.reconstructor)
4656
4656
  t = this.reconstructor.takeBinaryData(e), t && (this.reconstructor = null, super.emitReserved("decoded", t));
@@ -4673,29 +4673,29 @@ class Ke extends b {
4673
4673
  if (g[n.type] === void 0)
4674
4674
  throw new Error("unknown packet type " + n.type);
4675
4675
  if (n.type === g.BINARY_EVENT || n.type === g.BINARY_ACK) {
4676
- const r = t + 1;
4676
+ const s = t + 1;
4677
4677
  for (; e.charAt(++t) !== "-" && t != e.length; )
4678
4678
  ;
4679
- const o = e.substring(r, t);
4679
+ const o = e.substring(s, t);
4680
4680
  if (o != Number(o) || e.charAt(t) !== "-")
4681
4681
  throw new Error("Illegal attachments");
4682
4682
  const a = Number(o);
4683
- if (!Vs(a) || a < 0)
4683
+ if (!Jr(a) || a < 0)
4684
4684
  throw new Error("Illegal attachments");
4685
4685
  if (a > this.opts.maxAttachments)
4686
4686
  throw new Error("too many attachments");
4687
4687
  n.attachments = a;
4688
4688
  }
4689
4689
  if (e.charAt(t + 1) === "/") {
4690
- const r = t + 1;
4690
+ const s = t + 1;
4691
4691
  for (; ++t && !(e.charAt(t) === "," || t === e.length); )
4692
4692
  ;
4693
- n.nsp = e.substring(r, t);
4693
+ n.nsp = e.substring(s, t);
4694
4694
  } else
4695
4695
  n.nsp = "/";
4696
4696
  const i = e.charAt(t + 1);
4697
4697
  if (i !== "" && Number(i) == i) {
4698
- const r = t + 1;
4698
+ const s = t + 1;
4699
4699
  for (; ++t; ) {
4700
4700
  const o = e.charAt(t);
4701
4701
  if (o == null || Number(o) != o) {
@@ -4705,12 +4705,12 @@ class Ke extends b {
4705
4705
  if (t === e.length)
4706
4706
  break;
4707
4707
  }
4708
- n.id = Number(e.substring(r, t + 1));
4708
+ n.id = Number(e.substring(s, t + 1));
4709
4709
  }
4710
4710
  if (e.charAt(++t)) {
4711
- const r = this.tryParse(e.substr(t));
4712
- if (Ke.isPayloadValid(n.type, r))
4713
- n.data = r;
4711
+ const s = this.tryParse(e.substr(t));
4712
+ if (Ke.isPayloadValid(n.type, s))
4713
+ n.data = s;
4714
4714
  else
4715
4715
  throw new Error("invalid payload");
4716
4716
  }
@@ -4733,7 +4733,7 @@ class Ke extends b {
4733
4733
  return typeof t == "string" || pt(t);
4734
4734
  case g.EVENT:
4735
4735
  case g.BINARY_EVENT:
4736
- return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && Fs.indexOf(t[0]) === -1);
4736
+ return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && Hr.indexOf(t[0]) === -1);
4737
4737
  case g.ACK:
4738
4738
  case g.BINARY_ACK:
4739
4739
  return Array.isArray(t);
@@ -4746,7 +4746,7 @@ class Ke extends b {
4746
4746
  this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
4747
4747
  }
4748
4748
  }
4749
- class Hs {
4749
+ class Kr {
4750
4750
  constructor(e) {
4751
4751
  this.packet = e, this.buffers = [], this.reconPack = e;
4752
4752
  }
@@ -4760,7 +4760,7 @@ class Hs {
4760
4760
  */
4761
4761
  takeBinaryData(e) {
4762
4762
  if (this.buffers.push(e), this.buffers.length === this.reconPack.attachments) {
4763
- const t = qs(this.reconPack, this.buffers);
4763
+ const t = jr(this.reconPack, this.buffers);
4764
4764
  return this.finishedReconstruction(), t;
4765
4765
  }
4766
4766
  return null;
@@ -4772,26 +4772,26 @@ class Hs {
4772
4772
  this.reconPack = null, this.buffers = [];
4773
4773
  }
4774
4774
  }
4775
- const Vs = Number.isInteger || function(s) {
4776
- return typeof s == "number" && isFinite(s) && Math.floor(s) === s;
4775
+ const Jr = Number.isInteger || function(r) {
4776
+ return typeof r == "number" && isFinite(r) && Math.floor(r) === r;
4777
4777
  };
4778
- function pt(s) {
4779
- return Object.prototype.toString.call(s) === "[object Object]";
4778
+ function pt(r) {
4779
+ return Object.prototype.toString.call(r) === "[object Object]";
4780
4780
  }
4781
- const Ks = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4781
+ const Wr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4782
4782
  __proto__: null,
4783
4783
  Decoder: Ke,
4784
- Encoder: js,
4784
+ Encoder: Vr,
4785
4785
  get PacketType() {
4786
4786
  return g;
4787
4787
  }
4788
4788
  }, Symbol.toStringTag, { value: "Module" }));
4789
- function R(s, e, t) {
4790
- return s.on(e, t), function() {
4791
- s.off(e, t);
4789
+ function R(r, e, t) {
4790
+ return r.on(e, t), function() {
4791
+ r.off(e, t);
4792
4792
  };
4793
4793
  }
4794
- const Js = Object.freeze({
4794
+ const Yr = Object.freeze({
4795
4795
  connect: 1,
4796
4796
  connect_error: 1,
4797
4797
  disconnect: 1,
@@ -4800,7 +4800,7 @@ const Js = Object.freeze({
4800
4800
  newListener: 1,
4801
4801
  removeListener: 1
4802
4802
  });
4803
- class _n extends b {
4803
+ class vn extends b {
4804
4804
  /**
4805
4805
  * `Socket` constructor.
4806
4806
  */
@@ -4915,8 +4915,8 @@ class _n extends b {
4915
4915
  * @return self
4916
4916
  */
4917
4917
  emit(e, ...t) {
4918
- var n, i, r;
4919
- if (Js.hasOwnProperty(e))
4918
+ var n, i, s;
4919
+ if (Yr.hasOwnProperty(e))
4920
4920
  throw new Error('"' + e.toString() + '" is a reserved event name');
4921
4921
  if (t.unshift(e), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile)
4922
4922
  return this._addToQueue(t), this;
@@ -4928,7 +4928,7 @@ class _n extends b {
4928
4928
  const l = this.ids++, d = t.pop();
4929
4929
  this._registerAckCallback(l, d), o.id = l;
4930
4930
  }
4931
- const a = (i = (n = this.io.engine) === null || n === void 0 ? void 0 : n.transport) === null || i === void 0 ? void 0 : i.writable, c = this.connected && !(!((r = this.io.engine) === null || r === void 0) && r._hasPingExpired());
4931
+ const a = (i = (n = this.io.engine) === null || n === void 0 ? void 0 : n.transport) === null || i === void 0 ? void 0 : i.writable, c = this.connected && !(!((s = this.io.engine) === null || s === void 0) && s._hasPingExpired());
4932
4932
  return this.flags.volatile && !a || (c ? (this.notifyOutgoingListeners(o), this.packet(o)) : this.sendBuffer.push(o)), this.flags = {}, this;
4933
4933
  }
4934
4934
  /**
@@ -4941,13 +4941,13 @@ class _n extends b {
4941
4941
  this.acks[e] = t;
4942
4942
  return;
4943
4943
  }
4944
- const r = this.io.setTimeoutFn(() => {
4944
+ const s = this.io.setTimeoutFn(() => {
4945
4945
  delete this.acks[e];
4946
4946
  for (let a = 0; a < this.sendBuffer.length; a++)
4947
4947
  this.sendBuffer[a].id === e && this.sendBuffer.splice(a, 1);
4948
4948
  t.call(this, new Error("operation has timed out"));
4949
4949
  }, i), o = (...a) => {
4950
- this.io.clearTimeoutFn(r), t.apply(this, a);
4950
+ this.io.clearTimeoutFn(s), t.apply(this, a);
4951
4951
  };
4952
4952
  o.withError = !0, this.acks[e] = o;
4953
4953
  }
@@ -4969,8 +4969,8 @@ class _n extends b {
4969
4969
  */
4970
4970
  emitWithAck(e, ...t) {
4971
4971
  return new Promise((n, i) => {
4972
- const r = (o, a) => o ? i(o) : n(a);
4973
- r.withError = !0, t.push(r), this.emit(e, ...t);
4972
+ const s = (o, a) => o ? i(o) : n(a);
4973
+ s.withError = !0, t.push(s), this.emit(e, ...t);
4974
4974
  });
4975
4975
  }
4976
4976
  /**
@@ -4988,7 +4988,7 @@ class _n extends b {
4988
4988
  args: e,
4989
4989
  flags: Object.assign({ fromQueue: !0 }, this.flags)
4990
4990
  };
4991
- e.push((i, ...r) => (this._queue[0], i !== null ? n.tryCount > this._opts.retries && (this._queue.shift(), t && t(i)) : (this._queue.shift(), t && t(null, ...r)), n.pending = !1, this._drainQueue())), this._queue.push(n), this._drainQueue();
4991
+ e.push((i, ...s) => (this._queue[0], i !== null ? n.tryCount > this._opts.retries && (this._queue.shift(), t && t(i)) : (this._queue.shift(), t && t(null, ...s)), n.pending = !1, this._drainQueue())), this._queue.push(n), this._drainQueue();
4992
4992
  }
4993
4993
  /**
4994
4994
  * Send the first packet of the queue, and wait for an acknowledgement from the server.
@@ -5392,28 +5392,28 @@ class _n extends b {
5392
5392
  }
5393
5393
  }
5394
5394
  }
5395
- function B(s) {
5396
- s = s || {}, this.ms = s.min || 100, this.max = s.max || 1e4, this.factor = s.factor || 2, this.jitter = s.jitter > 0 && s.jitter <= 1 ? s.jitter : 0, this.attempts = 0;
5395
+ function B(r) {
5396
+ r = r || {}, this.ms = r.min || 100, this.max = r.max || 1e4, this.factor = r.factor || 2, this.jitter = r.jitter > 0 && r.jitter <= 1 ? r.jitter : 0, this.attempts = 0;
5397
5397
  }
5398
5398
  B.prototype.duration = function() {
5399
- var s = this.ms * Math.pow(this.factor, this.attempts++);
5399
+ var r = this.ms * Math.pow(this.factor, this.attempts++);
5400
5400
  if (this.jitter) {
5401
- var e = Math.random(), t = Math.floor(e * this.jitter * s);
5402
- s = Math.floor(e * 10) & 1 ? s + t : s - t;
5401
+ var e = Math.random(), t = Math.floor(e * this.jitter * r);
5402
+ r = Math.floor(e * 10) & 1 ? r + t : r - t;
5403
5403
  }
5404
- return Math.min(s, this.max) | 0;
5404
+ return Math.min(r, this.max) | 0;
5405
5405
  };
5406
5406
  B.prototype.reset = function() {
5407
5407
  this.attempts = 0;
5408
5408
  };
5409
- B.prototype.setMin = function(s) {
5410
- this.ms = s;
5409
+ B.prototype.setMin = function(r) {
5410
+ this.ms = r;
5411
5411
  };
5412
- B.prototype.setMax = function(s) {
5413
- this.max = s;
5412
+ B.prototype.setMax = function(r) {
5413
+ this.max = r;
5414
5414
  };
5415
- B.prototype.setJitter = function(s) {
5416
- this.jitter = s;
5415
+ B.prototype.setJitter = function(r) {
5416
+ this.jitter = r;
5417
5417
  };
5418
5418
  class Ae extends b {
5419
5419
  constructor(e, t) {
@@ -5423,7 +5423,7 @@ class Ae extends b {
5423
5423
  max: this.reconnectionDelayMax(),
5424
5424
  jitter: this.randomizationFactor()
5425
5425
  }), this.timeout(t.timeout == null ? 2e4 : t.timeout), this._readyState = "closed", this.uri = e;
5426
- const i = t.parser || Ks;
5426
+ const i = t.parser || Wr;
5427
5427
  this.encoder = new i.Encoder(), this.decoder = new i.Decoder(), this._autoConnect = t.autoConnect !== !1, this._autoConnect && this.open();
5428
5428
  }
5429
5429
  reconnection(e) {
@@ -5466,17 +5466,17 @@ class Ae extends b {
5466
5466
  open(e) {
5467
5467
  if (~this._readyState.indexOf("open"))
5468
5468
  return this;
5469
- this.engine = new Ds(this.uri, this.opts);
5469
+ this.engine = new $r(this.uri, this.opts);
5470
5470
  const t = this.engine, n = this;
5471
5471
  this._readyState = "opening", this.skipReconnect = !1;
5472
5472
  const i = R(t, "open", function() {
5473
5473
  n.onopen(), e && e();
5474
- }), r = (a) => {
5474
+ }), s = (a) => {
5475
5475
  this.cleanup(), this._readyState = "closed", this.emitReserved("error", a), e ? e(a) : this.maybeReconnectOnOpen();
5476
- }, o = R(t, "error", r);
5476
+ }, o = R(t, "error", s);
5477
5477
  if (this._timeout !== !1) {
5478
5478
  const a = this._timeout, c = this.setTimeoutFn(() => {
5479
- i(), r(new Error("timeout")), t.close();
5479
+ i(), s(new Error("timeout")), t.close();
5480
5480
  }, a);
5481
5481
  this.opts.autoUnref && c.unref(), this.subs.push(() => {
5482
5482
  this.clearTimeoutFn(c);
@@ -5556,7 +5556,7 @@ class Ae extends b {
5556
5556
  */
5557
5557
  socket(e, t) {
5558
5558
  let n = this.nsps[e];
5559
- return n ? this._autoConnect && !n.active && n.connect() : (n = new _n(this, e, t), this.nsps[e] = n), n;
5559
+ return n ? this._autoConnect && !n.active && n.connect() : (n = new vn(this, e, t), this.nsps[e] = n), n;
5560
5560
  }
5561
5561
  /**
5562
5562
  * Called upon a socket close.
@@ -5654,19 +5654,19 @@ class Ae extends b {
5654
5654
  }
5655
5655
  }
5656
5656
  const N = {};
5657
- function oe(s, e) {
5658
- typeof s == "object" && (e = s, s = void 0), e = e || {};
5659
- const t = Ls(s, e.path || "/socket.io"), n = t.source, i = t.id, r = t.path, o = N[i] && r in N[i].nsps, a = e.forceNew || e["force new connection"] || e.multiplex === !1 || o;
5657
+ function oe(r, e) {
5658
+ typeof r == "object" && (e = r, r = void 0), e = e || {};
5659
+ const t = Br(r, e.path || "/socket.io"), n = t.source, i = t.id, s = t.path, o = N[i] && s in N[i].nsps, a = e.forceNew || e["force new connection"] || e.multiplex === !1 || o;
5660
5660
  let c;
5661
5661
  return a ? c = new Ae(n, e) : (N[i] || (N[i] = new Ae(n, e)), c = N[i]), t.query && !e.query && (e.query = t.queryKey), c.socket(t.path, e);
5662
5662
  }
5663
5663
  Object.assign(oe, {
5664
5664
  Manager: Ae,
5665
- Socket: _n,
5665
+ Socket: vn,
5666
5666
  io: oe,
5667
5667
  connect: oe
5668
5668
  });
5669
- class Ws {
5669
+ class Gr {
5670
5670
  constructor(e) {
5671
5671
  this.config = e, this.socket = null, this.callbacks = {
5672
5672
  onMessage: null,
@@ -5681,9 +5681,9 @@ class Ws {
5681
5681
  connect(e) {
5682
5682
  let t = this.config.socketUrl, n = "/socket.io/";
5683
5683
  try {
5684
- const r = new URL(this.config.socketUrl);
5685
- t = `${r.protocol}//${r.host}`;
5686
- const o = r.pathname.replace(/\/+$/, "");
5684
+ const s = new URL(this.config.socketUrl);
5685
+ t = `${s.protocol}//${s.host}`;
5686
+ const o = s.pathname.replace(/\/+$/, "");
5687
5687
  o && (n = `${o}/socket.io/`);
5688
5688
  } catch {
5689
5689
  }
@@ -5697,18 +5697,18 @@ class Ws {
5697
5697
  console.log("Socket connected");
5698
5698
  }), this.socket.on("disconnect", () => {
5699
5699
  console.log("Socket disconnected");
5700
- }), this.socket.on("new-message", (r) => {
5701
- this.callbacks.onMessage && this.callbacks.onMessage(r);
5702
- }), this.socket.on("existing-peers", (r) => {
5703
- this.callbacks.onExistingPeers && this.callbacks.onExistingPeers(r);
5704
- }), this.socket.on("you-joined", (r) => {
5705
- this.callbacks.onYouJoined && this.callbacks.onYouJoined(r);
5706
- }), this.socket.on("user-joined", (r) => {
5707
- this.callbacks.onUserJoined && this.callbacks.onUserJoined(r);
5708
- }), this.socket.on("user-left", (r) => {
5709
- this.callbacks.onUserLeft && this.callbacks.onUserLeft(r);
5710
- }), this.socket.on("peer-media-state-change", (r) => {
5711
- this.callbacks.onPeerMediaStateChange && this.callbacks.onPeerMediaStateChange(r);
5700
+ }), this.socket.on("new-message", (s) => {
5701
+ this.callbacks.onMessage && this.callbacks.onMessage(s);
5702
+ }), this.socket.on("existing-peers", (s) => {
5703
+ this.callbacks.onExistingPeers && this.callbacks.onExistingPeers(s);
5704
+ }), this.socket.on("you-joined", (s) => {
5705
+ this.callbacks.onYouJoined && this.callbacks.onYouJoined(s);
5706
+ }), this.socket.on("user-joined", (s) => {
5707
+ this.callbacks.onUserJoined && this.callbacks.onUserJoined(s);
5708
+ }), this.socket.on("user-left", (s) => {
5709
+ this.callbacks.onUserLeft && this.callbacks.onUserLeft(s);
5710
+ }), this.socket.on("peer-media-state-change", (s) => {
5711
+ this.callbacks.onPeerMediaStateChange && this.callbacks.onPeerMediaStateChange(s);
5712
5712
  });
5713
5713
  const i = [
5714
5714
  "code-changed",
@@ -5727,9 +5727,9 @@ class Ws {
5727
5727
  "recording-state",
5728
5728
  "recording-stop"
5729
5729
  ];
5730
- for (const r of i)
5731
- this.socket.on(r, (o) => {
5732
- const a = this.rawListeners && this.rawListeners.get(r);
5730
+ for (const s of i)
5731
+ this.socket.on(s, (o) => {
5732
+ const a = this.rawListeners && this.rawListeners.get(s);
5733
5733
  a && a.forEach((c) => {
5734
5734
  try {
5735
5735
  c(o);
@@ -5738,8 +5738,8 @@ class Ws {
5738
5738
  }
5739
5739
  });
5740
5740
  });
5741
- this.socket.on("error", (r) => {
5742
- console.error("Socket error:", r), this.callbacks.onError && this.callbacks.onError(r);
5741
+ this.socket.on("error", (s) => {
5742
+ console.error("Socket error:", s), this.callbacks.onError && this.callbacks.onError(s);
5743
5743
  });
5744
5744
  }
5745
5745
  joinRoom(e, t, n, i) {
@@ -5762,10 +5762,10 @@ class Ws {
5762
5762
  return (n = this.rawListeners.get(e)) == null ? void 0 : n.delete(t);
5763
5763
  };
5764
5764
  }
5765
- sendMessage(e, t, n, i, r) {
5765
+ sendMessage(e, t, n, i, s) {
5766
5766
  if (this.socket) {
5767
5767
  const o = { roomId: e, userId: t, userName: n, message: i || "" };
5768
- Array.isArray(r) && r.length && (o.attachmentIds = r), this.socket.emit("send-message", o);
5768
+ Array.isArray(s) && s.length && (o.attachmentIds = s), this.socket.emit("send-message", o);
5769
5769
  }
5770
5770
  }
5771
5771
  leaveRoom() {
@@ -5778,7 +5778,7 @@ class Ws {
5778
5778
  this.socket && (this.socket.close(), this.socket = null);
5779
5779
  }
5780
5780
  }
5781
- class Ys {
5781
+ class Qr {
5782
5782
  constructor() {
5783
5783
  this.localStream = null, this.remoteStreams = {};
5784
5784
  }
@@ -5858,9 +5858,9 @@ class Je {
5858
5858
  throw new Error("MediaRecorder API not supported in this browser");
5859
5859
  if (this.state === "recording") return;
5860
5860
  if (!e) throw new Error("stream is required to start recording");
5861
- const n = t.timesliceMs || 15e3, i = Number.isFinite(t.videoBitsPerSecond) ? t.videoBitsPerSecond : 1e6, r = Number.isFinite(t.audioBitsPerSecond) ? t.audioBitsPerSecond : 64e3;
5861
+ const n = t.timesliceMs || 15e3, i = Number.isFinite(t.videoBitsPerSecond) ? t.videoBitsPerSecond : 1e6, s = Number.isFinite(t.audioBitsPerSecond) ? t.audioBitsPerSecond : 64e3;
5862
5862
  t.onChunk && (this.callbacks.onChunk = t.onChunk), this.stream = e, this.seq = typeof t.startSeq == "number" ? t.startSeq : 0, this.pendingUploads = [];
5863
- const o = this.pickMimeType(), a = { videoBitsPerSecond: i, audioBitsPerSecond: r };
5863
+ const o = this.pickMimeType(), a = { videoBitsPerSecond: i, audioBitsPerSecond: s };
5864
5864
  o && (a.mimeType = o), this.recorder = new window.MediaRecorder(e, a), this.mimeType = this.recorder.mimeType || o || "video/webm", this.recorder.ondataavailable = (c) => {
5865
5865
  if (!c.data || c.data.size === 0) return;
5866
5866
  const h = this.seq++, l = c.data, d = this.callbacks.onChunk;
@@ -5877,10 +5877,10 @@ class Je {
5877
5877
  // Resolves only after every pending chunk upload has settled.
5878
5878
  async stop() {
5879
5879
  if (this.state !== "recording" || !this.recorder) return null;
5880
- await new Promise((r) => {
5881
- this.recorder.onstop = r, this.recorder.stop();
5880
+ await new Promise((s) => {
5881
+ this.recorder.onstop = s, this.recorder.stop();
5882
5882
  });
5883
- const t = (await Promise.allSettled(this.pendingUploads)).filter((r) => r.status === "rejected").length, n = /* @__PURE__ */ new Date(), i = {
5883
+ const t = (await Promise.allSettled(this.pendingUploads)).filter((s) => s.status === "rejected").length, n = /* @__PURE__ */ new Date(), i = {
5884
5884
  startedAt: this.startedAt,
5885
5885
  endedAt: n,
5886
5886
  mimeType: this.mimeType,
@@ -5945,23 +5945,23 @@ class he {
5945
5945
  this.ctx.fillStyle = "#0d0d0d", this.ctx.fillRect(0, 0, this.width, this.height);
5946
5946
  const e = Array.from(this.videos.values());
5947
5947
  if (e.length === 0) return;
5948
- const { cols: t, rows: n } = Zs(e.length), i = this.width / t, r = this.height / n;
5948
+ const { cols: t, rows: n } = ti(e.length), i = this.width / t, s = this.height / n;
5949
5949
  e.forEach((o, a) => {
5950
- const c = a % t, h = Math.floor(a / t), l = c * i, d = h * r;
5951
- this.ctx.fillStyle = "#1a1a1a", this.ctx.fillRect(l, d, i, r);
5952
- const u = o.videoEl.videoWidth || 0, f = o.videoEl.videoHeight || 0, m = o.videoTrack, _ = m && m.enabled && m.readyState === "live";
5953
- if (u > 0 && f > 0 && _ !== !1) {
5954
- const Xe = Math.min(i / u, r / f), Ze = u * Xe, et = f * Xe, Rn = l + (i - Ze) / 2, Tn = d + (r - et) / 2;
5950
+ const c = a % t, h = Math.floor(a / t), l = c * i, d = h * s;
5951
+ this.ctx.fillStyle = "#1a1a1a", this.ctx.fillRect(l, d, i, s);
5952
+ const u = o.videoEl.videoWidth || 0, f = o.videoEl.videoHeight || 0, m = o.videoTrack, v = m && m.enabled && m.readyState === "live";
5953
+ if (u > 0 && f > 0 && v !== !1) {
5954
+ const Xe = Math.min(i / u, s / f), Ze = u * Xe, et = f * Xe, wn = l + (i - Ze) / 2, Pn = d + (s - et) / 2;
5955
5955
  try {
5956
- this.ctx.drawImage(o.videoEl, Rn, Tn, Ze, et);
5956
+ this.ctx.drawImage(o.videoEl, wn, Pn, Ze, et);
5957
5957
  } catch {
5958
5958
  }
5959
5959
  } else
5960
- Xs(this.ctx, o.label || "Peer", l, d, i, r);
5960
+ ei(this.ctx, o.label || "Peer", l, d, i, s);
5961
5961
  const We = o.label || "Peer";
5962
5962
  this.ctx.font = "bold 16px system-ui, sans-serif";
5963
- const Cn = this.ctx.measureText(We), Ye = 10, xn = 6, kn = Cn.width + Ye * 2, pe = 24, Ge = l + 12, Qe = d + r - pe - 12;
5964
- this.ctx.fillStyle = "rgba(0,0,0,0.65)", this.ctx.fillRect(Ge, Qe, kn, pe), this.ctx.fillStyle = "#fff", this.ctx.fillText(We, Ge + Ye, Qe + pe - xn - 2);
5963
+ const kn = this.ctx.measureText(We), Ye = 10, Rn = 6, Tn = kn.width + Ye * 2, pe = 24, Ge = l + 12, Qe = d + s - pe - 12;
5964
+ this.ctx.fillStyle = "rgba(0,0,0,0.65)", this.ctx.fillRect(Ge, Qe, Tn, pe), this.ctx.fillStyle = "#fff", this.ctx.fillText(We, Ge + Ye, Qe + pe - Rn - 2);
5965
5965
  });
5966
5966
  }
5967
5967
  addStream(e, t, n = {}) {
@@ -5970,10 +5970,10 @@ class he {
5970
5970
  const i = document.createElement("video");
5971
5971
  i.srcObject = t, i.autoplay = !0, i.muted = !0, i.playsInline = !0, i.style.cssText = "position:absolute;left:-9999px;top:-9999px;", document.body.appendChild(i), i.play().catch(() => {
5972
5972
  });
5973
- const r = t.getVideoTracks()[0] || null;
5973
+ const s = t.getVideoTracks()[0] || null;
5974
5974
  this.videos.set(e, {
5975
5975
  videoEl: i,
5976
- videoTrack: r,
5976
+ videoTrack: s,
5977
5977
  label: n.label || (n.isLocal ? "You" : e)
5978
5978
  });
5979
5979
  const o = t.getAudioTracks();
@@ -6018,49 +6018,87 @@ class he {
6018
6018
  }
6019
6019
  }
6020
6020
  }
6021
- function Gs(s) {
6022
- const e = String(s).trim().split(/\s+/).filter(Boolean);
6021
+ function Xr(r) {
6022
+ const e = String(r).trim().split(/\s+/).filter(Boolean);
6023
6023
  return e.length === 0 ? "?" : e.length === 1 ? e[0].slice(0, 2).toUpperCase() : (e[0][0] + e[e.length - 1][0]).toUpperCase();
6024
6024
  }
6025
- function Qs(s) {
6025
+ function Zr(r) {
6026
6026
  let e = 0;
6027
- const t = String(s);
6027
+ const t = String(r);
6028
6028
  for (let i = 0; i < t.length; i++) e = e * 31 + t.charCodeAt(i) >>> 0;
6029
6029
  return `hsl(${e % 360}, 45%, 40%)`;
6030
6030
  }
6031
- function Xs(s, e, t, n, i, r) {
6032
- const o = t + i / 2, a = n + r / 2, c = Math.min(i, r) * 0.22;
6033
- s.fillStyle = Qs(e), s.beginPath(), s.arc(o, a, c, 0, Math.PI * 2), s.fill(), s.fillStyle = "#fff", s.font = `600 ${Math.floor(c)}px system-ui, sans-serif`, s.textAlign = "center", s.textBaseline = "middle", s.fillText(Gs(e), o, a + 1), s.textAlign = "start", s.textBaseline = "alphabetic";
6031
+ function ei(r, e, t, n, i, s) {
6032
+ const o = t + i / 2, a = n + s / 2, c = Math.min(i, s) * 0.22;
6033
+ r.fillStyle = Zr(e), r.beginPath(), r.arc(o, a, c, 0, Math.PI * 2), r.fill(), r.fillStyle = "#fff", r.font = `600 ${Math.floor(c)}px system-ui, sans-serif`, r.textAlign = "center", r.textBaseline = "middle", r.fillText(Xr(e), o, a + 1), r.textAlign = "start", r.textBaseline = "alphabetic";
6034
6034
  }
6035
- function Zs(s) {
6036
- if (s <= 1) return { cols: 1, rows: 1 };
6037
- if (s === 2) return { cols: 2, rows: 1 };
6038
- if (s <= 4) return { cols: 2, rows: 2 };
6039
- if (s <= 6) return { cols: 3, rows: 2 };
6040
- if (s <= 9) return { cols: 3, rows: 3 };
6035
+ function ti(r) {
6036
+ if (r <= 1) return { cols: 1, rows: 1 };
6037
+ if (r === 2) return { cols: 2, rows: 1 };
6038
+ if (r <= 4) return { cols: 2, rows: 2 };
6039
+ if (r <= 6) return { cols: 3, rows: 2 };
6040
+ if (r <= 9) return { cols: 3, rows: 3 };
6041
6041
  const e = 4;
6042
- return { cols: e, rows: Math.ceil(s / e) };
6042
+ return { cols: e, rows: Math.ceil(r / e) };
6043
6043
  }
6044
- function vn(s) {
6045
- return String(s || "").replace(/-r[a-z0-9]{4}$/i, "");
6044
+ function _n(r) {
6045
+ return String(r || "").replace(/-r[a-z0-9]{4}$/i, "");
6046
6046
  }
6047
- function ei(s) {
6048
- return vn(s).endsWith("-screen");
6047
+ function ni(r) {
6048
+ return _n(r).endsWith("-screen");
6049
6049
  }
6050
- function Sn(s, e) {
6051
- return !s || !e ? !1 : vn(s).endsWith(`-${e}`);
6050
+ function Sn(r, e) {
6051
+ return !r || !e ? !1 : _n(r).endsWith(`-${e}`);
6052
6052
  }
6053
- function Y(s, e) {
6054
- if (!s || !e) return null;
6055
- for (const [t] of s.entries())
6053
+ function Y(r, e) {
6054
+ if (!r || !e) return null;
6055
+ for (const [t] of r.entries())
6056
6056
  if (Sn(t, e)) return t;
6057
6057
  return null;
6058
6058
  }
6059
- function ti(s, e) {
6060
- return s.includes("pdf") || /\.pdf$/i.test(e) ? "📕" : s.includes("word") || /\.docx?$/i.test(e) ? "📘" : s.includes("sheet") || s.includes("excel") || /\.(xlsx?|csv)$/i.test(e) ? "📗" : s.startsWith("text/") ? "📄" : "📎";
6059
+ function ri({ isLocal: r, isCamera: e }) {
6060
+ return r && e ? "cover" : "contain";
6061
+ }
6062
+ const ii = 'viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"', si = {
6063
+ videoOn: '<path d="M23 7l-7 5 7 5V7z"/><rect x="1" y="5" width="15" height="14" rx="2"/>',
6064
+ videoOff: '<line x1="2" y1="2" x2="22" y2="22"/><path d="M10.66 5H14a2 2 0 0 1 2 2v3.34l1 1L23 7v10"/><path d="M16 16v1a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2"/>',
6065
+ micOn: '<rect x="9" y="2" width="6" height="11" rx="3"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" y1="19" x2="12" y2="22"/><line x1="8" y1="22" x2="16" y2="22"/>',
6066
+ micOff: '<line x1="2" y1="2" x2="22" y2="22"/><path d="M18.89 13.23A7.12 7.12 0 0 0 19 12v-2"/><path d="M5 10v2a7 7 0 0 0 12 4"/><path d="M15 9.34V5a3 3 0 0 0-5.68-1.33"/><path d="M9 9v3a3 3 0 0 0 5.12 2.12"/><line x1="12" y1="19" x2="12" y2="22"/><line x1="8" y1="22" x2="16" y2="22"/>',
6067
+ shareIdle: '<path d="M13 3H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-3"/><path d="M8 21h8"/><path d="M12 17v4"/><path d="m17 8 5-5"/><path d="M17 3h5v5"/>',
6068
+ shareActive: '<path d="M13 3H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-3"/><path d="M8 21h8"/><path d="M12 17v4"/><path d="m22 3-5 5"/><path d="m17 3 5 5"/>',
6069
+ recIdle: '<circle cx="12" cy="12" r="9"/><circle cx="12" cy="12" r="4" fill="currentColor" stroke="none"/>',
6070
+ recActive: '<rect x="6" y="6" width="12" height="12" rx="2" fill="currentColor" stroke="none"/>',
6071
+ pause: '<rect x="6" y="4" width="4" height="16" fill="currentColor" stroke="none"/><rect x="14" y="4" width="4" height="16" fill="currentColor" stroke="none"/>',
6072
+ resume: '<path d="M6 3v18l15-9L6 3z" fill="currentColor" stroke="none"/>',
6073
+ leave: '<path d="M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91"/><line x1="22" y1="2" x2="2" y2="22"/>'
6074
+ };
6075
+ function Cn(r) {
6076
+ const e = si[r];
6077
+ return e ? `<svg ${ii}>${e}</svg>` : "";
6078
+ }
6079
+ const xn = {
6080
+ "toggle-video": { on: "videoOn", off: "videoOff", offTest: /off/i },
6081
+ "toggle-audio": { on: "micOn", off: "micOff", offTest: /off/i },
6082
+ "toggle-screenshare": { on: "shareIdle", off: "shareActive", offTest: /stop/i },
6083
+ "toggle-record": { on: "recIdle", off: "recActive", offTest: /stop/i },
6084
+ "toggle-pause": { on: "pause", off: "resume", offTest: /resume/i },
6085
+ "leave-meeting": { on: "leave", off: "leave", offTest: /never/ }
6086
+ };
6087
+ function oi(r, e) {
6088
+ const t = xn[r];
6089
+ if (!t) return "";
6090
+ const n = t.offTest.test(e || "");
6091
+ return Cn(n ? t.off : t.on);
6092
+ }
6093
+ function ai(r, e) {
6094
+ const t = xn[r];
6095
+ return !t || r === "leave-meeting" ? !1 : t.offTest.test(e || "");
6096
+ }
6097
+ function ci(r, e) {
6098
+ return r.includes("pdf") || /\.pdf$/i.test(e) ? "📕" : r.includes("word") || /\.docx?$/i.test(e) ? "📘" : r.includes("sheet") || r.includes("excel") || /\.(xlsx?|csv)$/i.test(e) ? "📗" : r.startsWith("text/") ? "📄" : "📎";
6061
6099
  }
6062
6100
  const ft = "repeat(auto-fit, minmax(280px, 1fr))", gt = "minmax(180px, 1fr)";
6063
- class ni {
6101
+ class hi {
6064
6102
  constructor(e = {}) {
6065
6103
  this.container = null, this.videoElements = {}, this.chatMessages = [], this.recording = e.recording || "off", this.screenShare = e.screenShare !== !1, this.enabledPanels = new Set(
6066
6104
  Array.isArray(e.panels) && e.panels.length ? e.panels : ["chat"]
@@ -6072,9 +6110,9 @@ class ni {
6072
6110
  this._ownershipToken = Symbol("meet-sdk-ownership"), this.container.__meetSdkOwner = this._ownershipToken, this.render();
6073
6111
  }
6074
6112
  render() {
6075
- const e = (a, c, h, l, d = "") => `<button id="${a}" class="ms-btn ${c}" title="${l}" style="${d}">
6076
- <span class="ms-icon" aria-hidden="true">${h}</span><span class="ms-text">${l}</span>
6077
- </button>`, t = this.recording === "manual" ? e("toggle-record", "ms-btn-rec", "●", "Record") : "", n = this.recording !== "off" ? e("toggle-pause", "ms-btn-primary", "⏸", "Pause", "display:none;") : "", i = this.screenShare ? e("toggle-screenshare", "ms-btn-primary", "⛶", "Share") : "", r = this.recording !== "off" ? '<span id="recording-indicator" class="ms-rec-indicator" style="display:none;"><span id="rec-dot" class="ms-rec-dot"></span>REC <span id="rec-elapsed">00:00</span></span>' : "", o = this.recording !== "off" ? '<span id="queue-indicator" class="ms-queue-indicator" style="display:none;">⏳ <span id="queue-count">0</span> uploading</span>' : "";
6113
+ const e = (a, c, h, l, d = "") => `<button id="${a}" class="ms-btn ${c}" title="${l}" aria-label="${l}" style="${d}">
6114
+ <span class="ms-icon" aria-hidden="true">${Cn(h)}</span><span class="ms-text">${l}</span>
6115
+ </button>`, t = this.recording === "manual" ? e("toggle-record", "ms-btn-rec", "recIdle", "Record") : "", n = this.recording !== "off" ? e("toggle-pause", "ms-btn-pause", "pause", "Pause", "display:none;") : "", i = this.screenShare ? e("toggle-screenshare", "ms-btn-share", "shareIdle", "Share") : "", s = this.recording !== "off" ? '<span id="recording-indicator" class="ms-rec-indicator" style="display:none;"><span id="rec-dot" class="ms-rec-dot"></span>REC <span id="rec-elapsed">00:00</span></span>' : "", o = this.recording !== "off" ? '<span id="queue-indicator" class="ms-queue-indicator" style="display:none;">⏳ <span id="queue-count">0</span> uploading</span>' : "";
6078
6116
  this._panelWiredOnRender = !0, this.container.innerHTML = `
6079
6117
  <style>
6080
6118
  /* All styles scoped under .ms-root so consumer CSS doesn't collide. */
@@ -6281,25 +6319,55 @@ class ni {
6281
6319
 
6282
6320
  /* ─── Buttons ────────────────────────────────────────────────── */
6283
6321
  .ms-btn {
6284
- border: 0; border-radius: 8px;
6322
+ border: 0; border-radius: 14px;
6285
6323
  color: #fff; cursor: pointer;
6286
- font-size: 14px; font-weight: 500;
6287
- padding: 10px 16px;
6288
- min-height: 44px;
6289
- display: inline-flex; align-items: center; justify-content: center; gap: 8px;
6290
- transition: transform 0.05s ease, background 0.15s ease;
6324
+ padding: 0;
6325
+ min-height: 48px; min-width: 48px; width: 48px;
6326
+ display: inline-flex; align-items: center; justify-content: center;
6327
+ transition: transform 0.05s ease, background 0.18s ease, box-shadow 0.18s ease;
6291
6328
  user-select: none;
6292
- white-space: nowrap;
6329
+ box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 8px 18px rgba(0,0,0,0.35);
6293
6330
  }
6331
+ .ms-btn:hover { filter: brightness(1.08); }
6294
6332
  .ms-btn:active { transform: scale(0.96); }
6295
- .ms-btn .ms-icon { font-size: 16px; line-height: 1; }
6296
- .ms-btn-primary { background: #3a5a7a; }
6297
- .ms-btn-primary:hover { background: #4a6a8a; }
6298
- .ms-btn-primary.active { background: #c53030; }
6299
- .ms-btn-rec { background: #7a3a3a; }
6300
- .ms-btn-rec.active { background: #c53030; }
6301
- .ms-btn-danger { background: #b23a3a; }
6302
- .ms-btn-danger:hover { background: #c53030; }
6333
+ .ms-btn:focus-visible {
6334
+ outline: 2px solid #93c5fd;
6335
+ outline-offset: 2px;
6336
+ }
6337
+ .ms-btn .ms-icon {
6338
+ display: flex; align-items: center; justify-content: center;
6339
+ line-height: 0; color: #fff;
6340
+ }
6341
+ .ms-btn .ms-icon svg { display: block; }
6342
+ .ms-btn .ms-text {
6343
+ position: absolute;
6344
+ width: 1px; height: 1px;
6345
+ padding: 0; margin: -1px;
6346
+ overflow: hidden; clip: rect(0, 0, 0, 0);
6347
+ white-space: nowrap; border: 0;
6348
+ }
6349
+ .ms-btn-primary { background: #1D4ED8; }
6350
+ .ms-btn-primary.active { background: #E11D48; }
6351
+ .ms-btn-mic { background: #0F766E; }
6352
+ .ms-btn-mic.active { background: #E11D48; }
6353
+ .ms-btn-share { background: #6D28D9; }
6354
+ .ms-btn-share.active { background: #D97706; }
6355
+ .ms-btn-rec { background: #9F1239; }
6356
+ .ms-btn-rec.active {
6357
+ background: #DC2626;
6358
+ animation: msRecPulse 1.6s ease-in-out infinite;
6359
+ }
6360
+ .ms-btn-pause { background: #334155; }
6361
+ .ms-btn-pause.active { background: #0F766E; }
6362
+ .ms-btn-danger { background: #BE123C; }
6363
+ .ms-btn-danger:hover { background: #E11D48; }
6364
+ @keyframes msRecPulse {
6365
+ 0%, 100% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 0 0 0 rgba(220,38,38,0.45); }
6366
+ 50% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 0 0 8px rgba(220,38,38,0); }
6367
+ }
6368
+ @media (prefers-reduced-motion: reduce) {
6369
+ .ms-btn-rec.active { animation: none; }
6370
+ }
6303
6371
 
6304
6372
  #controls-container {
6305
6373
  flex-shrink: 0;
@@ -6307,10 +6375,10 @@ class ni {
6307
6375
  z-index: 5;
6308
6376
  padding: 14px 16px;
6309
6377
  padding-bottom: max(14px, env(safe-area-inset-bottom));
6310
- background: #1a1a1a;
6311
- border-top: 1px solid #333;
6378
+ background: #0F1419;
6379
+ border-top: 1px solid #1F2937;
6312
6380
  display: flex; justify-content: center;
6313
- gap: 8px;
6381
+ gap: 10px;
6314
6382
  flex-wrap: wrap;
6315
6383
  }
6316
6384
 
@@ -6364,40 +6432,25 @@ class ni {
6364
6432
  }
6365
6433
  .ms-panel-close { display: inline-flex; }
6366
6434
 
6367
- /* Compact controls */
6435
+ /* Compact icon-only controls */
6368
6436
  #controls-container {
6369
- padding: 8px 8px;
6370
- padding-bottom: max(8px, env(safe-area-inset-bottom));
6371
- gap: 6px;
6437
+ padding: 10px 8px;
6438
+ padding-bottom: max(10px, env(safe-area-inset-bottom));
6439
+ gap: 8px;
6372
6440
  }
6373
6441
  .ms-btn {
6374
- padding: 8px 10px;
6375
- font-size: 13px;
6376
6442
  flex: 1 1 0;
6377
- min-width: 0;
6378
- gap: 4px;
6443
+ min-width: 48px;
6444
+ width: auto;
6445
+ max-width: 64px;
6379
6446
  }
6380
- .ms-btn .ms-icon { font-size: 18px; }
6381
- .ms-btn .ms-text {
6382
- max-width: 100%;
6383
- overflow: hidden;
6384
- text-overflow: ellipsis;
6385
- }
6386
- }
6387
-
6388
- /* Very narrow phones — icons only */
6389
- @media (max-width: 420px) {
6390
- .ms-btn { padding: 8px 6px; }
6391
- .ms-btn .ms-text { display: none; }
6392
- .ms-btn .ms-icon { font-size: 20px; }
6393
- #controls-container .ms-btn { min-width: 48px; }
6394
6447
  }
6395
6448
 
6396
6449
  /* Landscape short-height phones — trim vertical padding */
6397
6450
  @media (max-height: 500px) and (max-width: 900px) {
6398
6451
  .ms-topbar { min-height: 40px; padding: 6px 12px; }
6399
6452
  #controls-container { padding: 6px 8px; }
6400
- .ms-btn { min-height: 40px; padding: 6px 10px; }
6453
+ .ms-btn { min-height: 44px; }
6401
6454
  #video-container { grid-auto-rows: minmax(100px, 1fr); }
6402
6455
  }
6403
6456
  </style>
@@ -6406,7 +6459,7 @@ class ni {
6406
6459
  <div class="ms-topbar">
6407
6460
  <h3>Video Meeting</h3>
6408
6461
  <span class="ms-spacer"></span>
6409
- ${r}
6462
+ ${s}
6410
6463
  ${o}
6411
6464
  <span id="upload-indicator" style="display:none;">Uploading…</span>
6412
6465
  <span id="ms-status" class="ms-status" style="display:none; color:#f87171; font-size:12px; max-width:240px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;"></span>
@@ -6452,12 +6505,12 @@ class ni {
6452
6505
  </div>
6453
6506
 
6454
6507
  <div id="controls-container">
6455
- ${e("toggle-video", "ms-btn-primary", "📹", "Video On")}
6456
- ${e("toggle-audio", "ms-btn-primary", "🎤", "Mic On")}
6508
+ ${e("toggle-video", "ms-btn-primary", "videoOn", "Video On")}
6509
+ ${e("toggle-audio", "ms-btn-mic", "micOn", "Mic On")}
6457
6510
  ${i}
6458
6511
  ${t}
6459
6512
  ${n}
6460
- ${e("leave-meeting", "ms-btn-danger", "📞", "Leave")}
6513
+ ${e("leave-meeting", "ms-btn-danger", "leave", "Leave")}
6461
6514
  </div>
6462
6515
  </div>
6463
6516
  `, this.wireDrawer();
@@ -6467,16 +6520,16 @@ class ni {
6467
6520
  wireDrawer() {
6468
6521
  const e = this.container.querySelector("#panel-toggle-btn"), t = this.container.querySelector("#panel-close-btn"), n = this.container.querySelector("#panel-scrim"), i = this.container.querySelector("#side-panel");
6469
6522
  if (!e || !i) return;
6470
- const r = () => {
6523
+ const s = () => {
6471
6524
  if (!(typeof window < "u" && window.innerWidth <= 720)) {
6472
6525
  i.style.transform = "";
6473
6526
  return;
6474
6527
  }
6475
6528
  i.style.transform = this._drawerOpen ? "translateX(0)" : "translateX(100%)";
6476
6529
  }, o = (a) => {
6477
- this._drawerOpen = a, i.classList.toggle("open", a), n && n.classList.toggle("visible", a), r(), a && this.clearUnreadBadge();
6530
+ this._drawerOpen = a, i.classList.toggle("open", a), n && n.classList.toggle("visible", a), s(), a && this.clearUnreadBadge();
6478
6531
  };
6479
- r(), this._resizeHandler && window.removeEventListener("resize", this._resizeHandler), this._resizeHandler = () => r(), window.addEventListener("resize", this._resizeHandler), e.addEventListener("click", () => o(!this._drawerOpen)), t && t.addEventListener("click", () => o(!1)), n && n.addEventListener("click", () => o(!1)), this._escHandler && window.removeEventListener("keydown", this._escHandler), this._escHandler = (a) => {
6532
+ s(), this._resizeHandler && window.removeEventListener("resize", this._resizeHandler), this._resizeHandler = () => s(), window.addEventListener("resize", this._resizeHandler), e.addEventListener("click", () => o(!this._drawerOpen)), t && t.addEventListener("click", () => o(!1)), n && n.addEventListener("click", () => o(!1)), this._escHandler && window.removeEventListener("keydown", this._escHandler), this._escHandler = (a) => {
6480
6533
  a.key === "Escape" && this._drawerOpen && o(!1);
6481
6534
  }, window.addEventListener("keydown", this._escHandler);
6482
6535
  }
@@ -6493,7 +6546,7 @@ class ni {
6493
6546
  e && (e.textContent = "0", e.classList.remove("visible"));
6494
6547
  }
6495
6548
  addVideoStream(e, t, n = !1, i = null) {
6496
- const r = this.container.querySelector("#video-container");
6549
+ const s = this.container.querySelector("#video-container");
6497
6550
  this._panelWired || (this.wirePanelTabs(), this._panelWired = !0), this.videoElements[e] && (this.videoElements[e].remove(), delete this.videoElements[e]);
6498
6551
  const o = document.createElement("div");
6499
6552
  o.id = `video-${e}`, o.dataset.peerId = e, o.style.cssText = "position: relative; background-color: #2a2a2a; border-radius: 8px; overflow: hidden; min-height: 0;";
@@ -6504,12 +6557,12 @@ class ni {
6504
6557
  });
6505
6558
  } catch {
6506
6559
  }
6507
- const c = !ei(e) && t && t.getVideoTracks && t.getVideoTracks().some((u) => !(u.getSettings ? u.getSettings() : {}).displaySurface), h = n && c;
6508
- a.style.cssText = "width: 100%; height: 100%; object-fit: cover;" + (h ? " transform: scaleX(-1);" : ""), a.dataset.mirror = h ? "1" : "0";
6509
- const l = document.createElement("div");
6510
- l.textContent = n ? "You" : i || "Peer", l.style.cssText = "position: absolute; bottom: 10px; left: 10px; background-color: rgba(0,0,0,0.7); padding: 4px 10px; border-radius: 4px; font-size: 13px; max-width: calc(100% - 20px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;", o.appendChild(a), o.appendChild(l);
6511
- const d = r.querySelector("#others-strip");
6512
- d && e !== this._presentingPeer ? d.appendChild(o) : r.appendChild(o), this.videoElements[e] = o, this._presentingPeer && this.setPresentingPeer(this._presentingPeer);
6560
+ const c = !ni(e) && t && t.getVideoTracks && t.getVideoTracks().some((f) => !(f.getSettings ? f.getSettings() : {}).displaySurface), h = n && c, l = ri({ isLocal: n, isCamera: c });
6561
+ a.style.cssText = "width: 100%; height: 100%; object-fit: " + l + ";" + (h ? " transform: scaleX(-1);" : ""), a.dataset.mirror = h ? "1" : "0";
6562
+ const d = document.createElement("div");
6563
+ d.textContent = n ? "You" : i || "Peer", d.style.cssText = "position: absolute; bottom: 10px; left: 10px; background-color: rgba(0,0,0,0.7); padding: 4px 10px; border-radius: 4px; font-size: 13px; max-width: calc(100% - 20px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;", o.appendChild(a), o.appendChild(d);
6564
+ const u = s.querySelector("#others-strip");
6565
+ u && e !== this._presentingPeer ? u.appendChild(o) : s.appendChild(o), this.videoElements[e] = o, this._presentingPeer && this.setPresentingPeer(this._presentingPeer);
6513
6566
  }
6514
6567
  renderPanelTabs() {
6515
6568
  return [
@@ -6552,7 +6605,7 @@ class ni {
6552
6605
  updateChat() {
6553
6606
  const e = this.container.querySelector("#chat-messages");
6554
6607
  e && (e.innerHTML = this.chatMessages.map((t) => {
6555
- const n = t.message ? `<div style="font-size: 14px; line-height: 1.4; word-wrap: break-word;">${this.escapeHtml(t.message)}</div>` : "", i = Array.isArray(t.attachments) && t.attachments.length ? `<div style="display:flex; flex-direction:column; gap:6px; margin-top:${t.message ? 6 : 0}px;">${t.attachments.map((r) => this.renderAttachment(r)).join("")}</div>` : "";
6608
+ const n = t.message ? `<div style="font-size: 14px; line-height: 1.4; word-wrap: break-word;">${this.escapeHtml(t.message)}</div>` : "", i = Array.isArray(t.attachments) && t.attachments.length ? `<div style="display:flex; flex-direction:column; gap:6px; margin-top:${t.message ? 6 : 0}px;">${t.attachments.map((s) => this.renderAttachment(s)).join("")}</div>` : "";
6556
6609
  return `
6557
6610
  <div style="padding: 8px 12px; background-color: #2a2a2a; border-radius: 8px;">
6558
6611
  <div style="display: flex; justify-content: space-between; margin-bottom: 5px; font-size: 12px; gap: 8px;">
@@ -6565,14 +6618,14 @@ class ni {
6565
6618
  }).join(""), e.scrollTop = e.scrollHeight);
6566
6619
  }
6567
6620
  renderAttachment(e) {
6568
- const t = (e.contentType || "").startsWith("image/"), n = Math.max(1, Math.round((e.fileSize || 0) / 1024)), i = this.escapeHtml(e.fileName || "file"), r = e.url || "";
6621
+ const t = (e.contentType || "").startsWith("image/"), n = Math.max(1, Math.round((e.fileSize || 0) / 1024)), i = this.escapeHtml(e.fileName || "file"), s = e.url || "";
6569
6622
  if (t)
6570
- return `<a href="${r}" target="_blank" rel="noreferrer" style="display:block; max-width:100%;">
6571
- <img src="${r}" alt="${i}" style="max-width:100%; border-radius:6px; display:block;" />
6623
+ return `<a href="${s}" target="_blank" rel="noreferrer" style="display:block; max-width:100%;">
6624
+ <img src="${s}" alt="${i}" style="max-width:100%; border-radius:6px; display:block;" />
6572
6625
  <div style="font-size:11px; color:#888; margin-top:2px;">${i} · ${n} KB</div>
6573
6626
  </a>`;
6574
- const o = ti(e.contentType || "", e.fileName || "");
6575
- return `<a href="${r}" target="_blank" rel="noreferrer" style="display:flex; align-items:center; gap:8px; padding:8px 10px; background:#333; border-radius:6px; text-decoration:none; color:#ddd; font-size:13px;">
6627
+ const o = ci(e.contentType || "", e.fileName || "");
6628
+ return `<a href="${s}" target="_blank" rel="noreferrer" style="display:flex; align-items:center; gap:8px; padding:8px 10px; background:#333; border-radius:6px; text-decoration:none; color:#ddd; font-size:13px;">
6576
6629
  <span style="font-size:22px;">${o}</span>
6577
6630
  <div style="min-width:0; flex:1; overflow:hidden;">
6578
6631
  <div style="white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">${i}</div>
@@ -6596,22 +6649,22 @@ class ni {
6596
6649
  }
6597
6650
  onChatSend(e) {
6598
6651
  this._chatSendCallback = e, this._pendingAttachments = [];
6599
- const t = this.container.querySelector("#chat-input"), n = this.container.querySelector("#chat-send-btn"), i = this.container.querySelector("#chat-attach-btn"), r = this.container.querySelector("#chat-file-input"), o = () => {
6652
+ const t = this.container.querySelector("#chat-input"), n = this.container.querySelector("#chat-send-btn"), i = this.container.querySelector("#chat-attach-btn"), s = this.container.querySelector("#chat-file-input"), o = () => {
6600
6653
  const a = t ? t.value.trim() : "", c = (this._pendingAttachments || []).filter((h) => h.attachmentId);
6601
6654
  !a && c.length === 0 || (e(a, c.map((h) => h.attachmentId)), t && (t.value = ""), this._pendingAttachments = [], this.renderPendingAttachments(), this.updateSendButtonState());
6602
6655
  };
6603
6656
  t && (t.addEventListener("keypress", (a) => {
6604
6657
  a.key === "Enter" && o();
6605
- }), t.addEventListener("input", () => this.updateSendButtonState())), n && n.addEventListener("click", o), i && r && (i.addEventListener("click", () => r.click()), r.addEventListener("change", () => {
6606
- const a = r.files && r.files[0];
6607
- r.value = "", a && this._onAttachFile && this._onAttachFile(a);
6658
+ }), t.addEventListener("input", () => this.updateSendButtonState())), n && n.addEventListener("click", o), i && s && (i.addEventListener("click", () => s.click()), s.addEventListener("change", () => {
6659
+ const a = s.files && s.files[0];
6660
+ s.value = "", a && this._onAttachFile && this._onAttachFile(a);
6608
6661
  })), this.updateSendButtonState();
6609
6662
  }
6610
6663
  updateSendButtonState() {
6611
6664
  const e = this.container && this.container.querySelector("#chat-send-btn");
6612
6665
  if (!e) return;
6613
- const t = this.container.querySelector("#chat-input"), n = t ? t.value.trim() : "", i = (this._pendingAttachments || []).filter((o) => o.attachmentId), r = !!n || i.length > 0;
6614
- e.disabled = !r, e.style.opacity = r ? "1" : "0.5", e.style.cursor = r ? "pointer" : "not-allowed";
6666
+ const t = this.container.querySelector("#chat-input"), n = t ? t.value.trim() : "", i = (this._pendingAttachments || []).filter((o) => o.attachmentId), s = !!n || i.length > 0;
6667
+ e.disabled = !s, e.style.opacity = s ? "1" : "0.5", e.style.cursor = s ? "pointer" : "not-allowed";
6615
6668
  }
6616
6669
  onAttachFile(e) {
6617
6670
  this._onAttachFile = async (t) => {
@@ -6632,16 +6685,16 @@ class ni {
6632
6685
  if (!e) return;
6633
6686
  const t = this._pendingAttachments || [];
6634
6687
  e.style.display = t.length ? "flex" : "none", e.innerHTML = t.map((n, i) => {
6635
- const r = this.escapeHtml(n.fileName);
6688
+ const s = this.escapeHtml(n.fileName);
6636
6689
  return `
6637
6690
  <span style="display:inline-flex; align-items:center; gap:6px; padding:4px 8px; background:#333; border-radius:12px; font-size:12px; color:#ddd;">
6638
- ${n.error ? `<span style="color:#f87171;">✗ ${this.escapeHtml(n.error)}</span>` : n.pending ? "⏳" : "✓"} ${r}
6691
+ ${n.error ? `<span style="color:#f87171;">✗ ${this.escapeHtml(n.error)}</span>` : n.pending ? "⏳" : "✓"} ${s}
6639
6692
  <button data-idx="${i}" class="chat-attach-remove" style="background:transparent; border:0; color:#f87171; cursor:pointer; font-size:14px; padding:0;">×</button>
6640
6693
  </span>`;
6641
6694
  }).join(""), e.querySelectorAll(".chat-attach-remove").forEach((n) => {
6642
6695
  n.addEventListener("click", (i) => {
6643
- const r = parseInt(i.currentTarget.getAttribute("data-idx"), 10);
6644
- this._pendingAttachments.splice(r, 1), this.renderPendingAttachments(), this.updateSendButtonState();
6696
+ const s = parseInt(i.currentTarget.getAttribute("data-idx"), 10);
6697
+ this._pendingAttachments.splice(s, 1), this.renderPendingAttachments(), this.updateSendButtonState();
6645
6698
  });
6646
6699
  }), this.updateSendButtonState();
6647
6700
  }
@@ -6650,11 +6703,17 @@ class ni {
6650
6703
  _setButtonLabel(e, t) {
6651
6704
  if (!e) return;
6652
6705
  const n = e.querySelector(".ms-text");
6653
- n ? n.textContent = t : e.textContent = t;
6706
+ n ? n.textContent = t : e.querySelector(".ms-icon") || (e.textContent = t);
6707
+ }
6708
+ _applyControlChrome(e, t, n, i = n) {
6709
+ if (!e) return;
6710
+ this._setButtonLabel(e, n), e.title = i, e.setAttribute("aria-label", i);
6711
+ const s = e.querySelector(".ms-icon");
6712
+ s && (s.innerHTML = oi(t, n)), e.classList.toggle("active", ai(t, n));
6654
6713
  }
6655
6714
  updateButtonState(e, t) {
6656
- const n = this.container.querySelector(`#${e}`);
6657
- this._setButtonLabel(n, t), n && (n.title = t);
6715
+ const n = this.container && this.container.querySelector(`#${e}`);
6716
+ this._applyControlChrome(n, e, t);
6658
6717
  }
6659
6718
  updateRecordingIndicator(e) {
6660
6719
  if (!this.container) return;
@@ -6662,10 +6721,8 @@ class ni {
6662
6721
  t && (t.style.display = e === "recording" ? "inline-flex" : "none");
6663
6722
  const n = this.container.querySelector("#toggle-record");
6664
6723
  if (n) {
6665
- const i = e === "recording";
6666
- this._setButtonLabel(n, i ? "Stop" : "Record");
6667
- const r = n.querySelector(".ms-icon");
6668
- r && (r.textContent = i ? "■" : "●"), n.classList.toggle("active", i), n.disabled || (n.title = i ? "Stop recording" : "Start recording");
6724
+ const i = e === "recording", s = i ? "Stop" : "Record", o = i ? "Stop recording" : "Start recording";
6725
+ this._applyControlChrome(n, "toggle-record", s, n.disabled ? n.title : o);
6669
6726
  }
6670
6727
  e === "recording" ? this.startRecElapsed() : this.stopRecElapsed();
6671
6728
  }
@@ -6674,8 +6731,8 @@ class ni {
6674
6731
  const e = Date.now(), t = () => {
6675
6732
  const n = this.container && this.container.querySelector("#rec-elapsed");
6676
6733
  if (!n) return;
6677
- const i = Math.floor((Date.now() - e) / 1e3), r = String(Math.floor(i / 60)).padStart(2, "0"), o = String(i % 60).padStart(2, "0");
6678
- n.textContent = `${r}:${o}`;
6734
+ const i = Math.floor((Date.now() - e) / 1e3), s = String(Math.floor(i / 60)).padStart(2, "0"), o = String(i % 60).padStart(2, "0");
6735
+ n.textContent = `${s}:${o}`;
6679
6736
  };
6680
6737
  t(), this._elapsedHandle = setInterval(t, 1e3);
6681
6738
  }
@@ -6691,7 +6748,12 @@ class ni {
6691
6748
  }
6692
6749
  setScreenSharingState(e) {
6693
6750
  const t = this.container && this.container.querySelector("#toggle-screenshare");
6694
- t && (this._setButtonLabel(t, e ? "Stop" : "Share"), t.classList.toggle("active", e), t.title = e ? "Stop sharing" : "Share screen");
6751
+ t && this._applyControlChrome(
6752
+ t,
6753
+ "toggle-screenshare",
6754
+ e ? "Stop sharing" : "Share",
6755
+ e ? "Stop sharing" : "Share screen"
6756
+ );
6695
6757
  }
6696
6758
  setQueueCount(e) {
6697
6759
  if (!this.container) return;
@@ -6710,17 +6772,17 @@ class ni {
6710
6772
  for (; n.firstChild; ) t.appendChild(n.firstChild);
6711
6773
  n.remove();
6712
6774
  }
6713
- Object.entries(this.videoElements).forEach(([i, r]) => {
6714
- e && i === e ? (r.parentNode === n && t.insertBefore(r, n), r.style.gridColumn = "", r.style.flex = "1 1 auto", r.style.minHeight = "0", r.style.width = "100%", r.style.aspectRatio = "", r.style.maxHeight = "") : e ? (r.parentNode !== n && n.appendChild(r), r.style.flex = "0 0 auto", r.style.width = "160px", r.style.height = "120px", r.style.minHeight = "", r.style.aspectRatio = "", r.style.maxHeight = "", r.style.gridColumn = "") : (r.parentNode === n && t.appendChild(r), r.style.flex = "", r.style.width = "", r.style.height = "", r.style.minHeight = "", r.style.gridColumn = "", r.style.maxHeight = "", r.style.aspectRatio = "");
6775
+ Object.entries(this.videoElements).forEach(([i, s]) => {
6776
+ e && i === e ? (s.parentNode === n && t.insertBefore(s, n), s.style.gridColumn = "", s.style.flex = "1 1 auto", s.style.minHeight = "0", s.style.width = "100%", s.style.aspectRatio = "", s.style.maxHeight = "") : e ? (s.parentNode !== n && n.appendChild(s), s.style.flex = "0 0 auto", s.style.width = "160px", s.style.height = "120px", s.style.minHeight = "", s.style.aspectRatio = "", s.style.maxHeight = "", s.style.gridColumn = "") : (s.parentNode === n && t.appendChild(s), s.style.flex = "", s.style.width = "", s.style.height = "", s.style.minHeight = "", s.style.gridColumn = "", s.style.maxHeight = "", s.style.aspectRatio = "");
6715
6777
  });
6716
6778
  }
6717
6779
  setParticipants(e, t = {}) {
6718
6780
  if (!this.container) return;
6719
6781
  const n = this.container.querySelector("#participants-list"), i = this.container.querySelector("#participants-count");
6720
6782
  if (i && (i.textContent = `(${e.length})`), !n) return;
6721
- const r = !!t.showControls;
6783
+ const s = !!t.showControls;
6722
6784
  n.innerHTML = e.map((o, a) => {
6723
- const c = o.isYou ? " (You)" : o.isHost ? " · host" : "", h = this.escapeHtml(o.label) + c, l = `<span style="display:inline-block; width:8px; height:8px; border-radius:50%; background:${o.isSharing ? "#a3e635" : "#6366f1"}; flex-shrink:0;"></span>`, d = r && !o.isHost && !o.isYou && o.userId ? `<span style="margin-left:auto; display:inline-flex; gap:4px; flex-shrink:0;">
6785
+ const c = o.isYou ? " (You)" : o.isHost ? " · host" : "", h = this.escapeHtml(o.label) + c, l = `<span style="display:inline-block; width:8px; height:8px; border-radius:50%; background:${o.isSharing ? "#a3e635" : "#6366f1"}; flex-shrink:0;"></span>`, d = s && !o.isHost && !o.isYou && o.userId ? `<span style="margin-left:auto; display:inline-flex; gap:4px; flex-shrink:0;">
6724
6786
  <button data-idx="${a}" data-perm="code" title="Toggle code edit" style="padding:2px 6px; font-size:10px; border-radius:4px; border:1px solid ${o.canEditCode ? "#22c55e" : "#3a3a3a"}; background:${o.canEditCode ? "#052e16" : "#1a1a1a"}; color:${o.canEditCode ? "#4ade80" : "#888"}; cursor:pointer;">Code</button>
6725
6787
  <button data-idx="${a}" data-perm="board" title="Toggle whiteboard draw" style="padding:2px 6px; font-size:10px; border-radius:4px; border:1px solid ${o.canDrawBoard ? "#22c55e" : "#3a3a3a"}; background:${o.canDrawBoard ? "#052e16" : "#1a1a1a"}; color:${o.canDrawBoard ? "#4ade80" : "#888"}; cursor:pointer;">Board</button>
6726
6788
  </span>` : "";
@@ -6729,7 +6791,7 @@ class ni {
6729
6791
  <span style="overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0;">${h}${o.isSharing ? " · presenting" : ""}</span>
6730
6792
  ${d}
6731
6793
  </div>`;
6732
- }).join(""), r && this._onParticipantPermToggle && n.querySelectorAll("button[data-perm]").forEach((o) => {
6794
+ }).join(""), s && this._onParticipantPermToggle && n.querySelectorAll("button[data-perm]").forEach((o) => {
6733
6795
  o.addEventListener("click", () => {
6734
6796
  const a = e[parseInt(o.getAttribute("data-idx"), 10)], c = o.getAttribute("data-perm");
6735
6797
  this._onParticipantPermToggle(a, c);
@@ -6741,7 +6803,7 @@ class ni {
6741
6803
  }
6742
6804
  setRecordAllowed(e, t) {
6743
6805
  const n = this.container && this.container.querySelector("#toggle-record");
6744
- n && (n.disabled = !e, n.title = e ? t || "Record" : t || "Only the meeting host can record");
6806
+ n && (n.disabled = !e, n.title = e ? t || "Record" : t || "Only the meeting host can record", n.setAttribute && n.setAttribute("aria-label", n.title));
6745
6807
  }
6746
6808
  setStatus(e) {
6747
6809
  if (!this.container) return;
@@ -6756,16 +6818,18 @@ class ni {
6756
6818
  }
6757
6819
  setPauseButtonState(e) {
6758
6820
  const t = this.container && this.container.querySelector("#toggle-pause");
6759
- if (!t) return;
6760
- this._setButtonLabel(t, e ? "Resume" : "Pause");
6761
- const n = t.querySelector(".ms-icon");
6762
- n && (n.textContent = e ? "▶" : "⏸"), t.title = e ? "Resume recording" : "Pause recording";
6821
+ t && this._applyControlChrome(
6822
+ t,
6823
+ "toggle-pause",
6824
+ e ? "Resume" : "Pause",
6825
+ e ? "Resume recording" : "Pause recording"
6826
+ );
6763
6827
  }
6764
6828
  destroy() {
6765
6829
  this.container && this.container.__meetSdkOwner === this._ownershipToken && (this.container.innerHTML = "", this.container.__meetSdkOwner = null), this._escHandler && (window.removeEventListener("keydown", this._escHandler), this._escHandler = null), this._resizeHandler && (window.removeEventListener("resize", this._resizeHandler), this._resizeHandler = null), this.videoElements = {}, this.chatMessages = [];
6766
6830
  }
6767
6831
  }
6768
- class si {
6832
+ class li {
6769
6833
  constructor(e) {
6770
6834
  this.container = e.container, this.emit = e.emit, this.canRun = e.canRun || (() => !0), this.canEdit = e.canEdit || (() => !0), this.userId = e.userId, this.state = {
6771
6835
  code: "",
@@ -6850,17 +6914,17 @@ class si {
6850
6914
  const t = e.stdout || "", n = e.stderr || "", i = [];
6851
6915
  t && i.push(`<span style="color:#e5e7eb;">${mt(t)}</span>`), n && i.push(`<span style="color:#f87171;">${mt(n)}</span>`), !t && !n && i.push('<span style="color:#888;">(no output)</span>'), this.output.innerHTML = i.join(`
6852
6916
  `);
6853
- const r = typeof e.time == "number" || typeof e.time == "string" && e.time ? ` · ${e.time}s` : "", o = e.memory ? ` · ${Math.round(e.memory / 1024)} MB` : "";
6854
- this.setStatus(`Exit ${e.exitCode ?? 0}${r}${o}`), this.refreshPermissionUI();
6917
+ const s = typeof e.time == "number" || typeof e.time == "string" && e.time ? ` · ${e.time}s` : "", o = e.memory ? ` · ${Math.round(e.memory / 1024)} MB` : "";
6918
+ this.setStatus(`Exit ${e.exitCode ?? 0}${s}${o}`), this.refreshPermissionUI();
6855
6919
  }
6856
6920
  handleStateSync(e) {
6857
6921
  e && (typeof e.code == "string" && e.code !== this.state.code && (this.state.code = e.code, this.editor.value = e.code), e.language && (this.state.language = e.language, this.langSel.value = e.language), e.lastExecutionOutput && this.handleExecutionResult(e.lastExecutionOutput), this.refreshPermissionUI());
6858
6922
  }
6859
6923
  }
6860
- function mt(s) {
6861
- return String(s).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
6924
+ function mt(r) {
6925
+ return String(r).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
6862
6926
  }
6863
- class ii {
6927
+ class di {
6864
6928
  constructor(e) {
6865
6929
  this.container = e.container, this.emit = e.emit, this.canDraw = e.canDraw || (() => !0), this.userId = e.userId, this.tool = "pen", this.color = "#ffffff", this.size = 3, this.imageData = null, this.remoteStrokes = [], this.currentStroke = null, this.render();
6866
6930
  }
@@ -6927,9 +6991,9 @@ class ii {
6927
6991
  y: (e.clientY - t.top) / t.height
6928
6992
  };
6929
6993
  }
6930
- _drawSegment(e, t, n, i, r) {
6994
+ _drawSegment(e, t, n, i, s) {
6931
6995
  const o = this.canvas.getBoundingClientRect().width, a = this.canvas.getBoundingClientRect().height;
6932
- this.ctx.lineWidth = r, this.ctx.lineCap = "round", this.ctx.lineJoin = "round", this.ctx.globalCompositeOperation = n === "eraser" ? "destination-out" : "source-over", this.ctx.strokeStyle = n === "eraser" ? "rgba(0,0,0,1)" : i, this.ctx.beginPath(), this.ctx.moveTo(e.x * o, e.y * a), this.ctx.lineTo(t.x * o, t.y * a), this.ctx.stroke();
6996
+ this.ctx.lineWidth = s, this.ctx.lineCap = "round", this.ctx.lineJoin = "round", this.ctx.globalCompositeOperation = n === "eraser" ? "destination-out" : "source-over", this.ctx.strokeStyle = n === "eraser" ? "rgba(0,0,0,1)" : i, this.ctx.beginPath(), this.ctx.moveTo(e.x * o, e.y * a), this.ctx.lineTo(t.x * o, t.y * a), this.ctx.stroke();
6933
6997
  }
6934
6998
  _onDown(e) {
6935
6999
  if (!this.canDraw()) return;
@@ -6992,16 +7056,16 @@ class ii {
6992
7056
  window.removeEventListener("resize", this._resize), this._resizeObserver && this._resizeObserver.disconnect();
6993
7057
  }
6994
7058
  }
6995
- function ri(s, e, t) {
6996
- return !s || s.recordingMode !== "composite" ? null : t || !e ? new Error(
7059
+ function ui(r, e, t) {
7060
+ return !r || r.recordingMode !== "composite" ? null : t || !e ? new Error(
6997
7061
  "Room recording needs a computer browser. Join from the web to start Rec."
6998
7062
  ) : null;
6999
7063
  }
7000
- function yt(s, e) {
7001
- return !!(s && s.active && !e);
7064
+ function yt(r, e) {
7065
+ return !!(r && r.active && !e);
7002
7066
  }
7003
- const oi = /* @__PURE__ */ new Set(["auto", "manual", "off"]), ai = /* @__PURE__ */ new Set(["local", "composite"]), q = "https://preproduction.tentoro.in/videocall";
7004
- function ci() {
7067
+ const pi = /* @__PURE__ */ new Set(["auto", "manual", "off"]), fi = /* @__PURE__ */ new Set(["local", "composite"]), F = "https://preproduction.tentoro.in/videocall";
7068
+ function gi() {
7005
7069
  if (typeof crypto < "u" && typeof crypto.randomUUID == "function")
7006
7070
  try {
7007
7071
  return crypto.randomUUID();
@@ -7009,13 +7073,13 @@ function ci() {
7009
7073
  }
7010
7074
  return "u-" + Date.now().toString(36) + "-" + Math.random().toString(36).slice(2, 12);
7011
7075
  }
7012
- function hi({ workspace: s, ai: e }) {
7013
- const t = { workspace: s };
7076
+ function mi({ workspace: r, ai: e }) {
7077
+ const t = { workspace: r };
7014
7078
  return e && (e.whisperKey && (t["x-whisper-key"] = e.whisperKey), e.whisperUrl && (t["x-whisper-url"] = e.whisperUrl), e.llmKey && (t["x-llm-key"] = e.llmKey), e.llmUrl && (t["x-llm-url"] = e.llmUrl), e.llmModel && (t["x-llm-model"] = e.llmModel)), t;
7015
7079
  }
7016
- async function G(s, e, { workspace: t, ai: n, body: i } = {}) {
7017
- const r = hi({ workspace: t, ai: n }), o = { method: s, headers: r };
7018
- i !== void 0 && (r["Content-Type"] = "application/json", o.body = JSON.stringify(i));
7080
+ async function G(r, e, { workspace: t, ai: n, body: i } = {}) {
7081
+ const s = mi({ workspace: t, ai: n }), o = { method: r, headers: s };
7082
+ i !== void 0 && (s["Content-Type"] = "application/json", o.body = JSON.stringify(i));
7019
7083
  const a = await fetch(e, o), c = await a.json().catch(() => ({}));
7020
7084
  if (!a.ok) {
7021
7085
  const h = new Error(c.error || `HTTP ${a.status}`);
@@ -7023,8 +7087,8 @@ async function G(s, e, { workspace: t, ai: n, body: i } = {}) {
7023
7087
  }
7024
7088
  return c;
7025
7089
  }
7026
- function li(s) {
7027
- const e = new URL(s), t = e.protocol === "https:", n = e.pathname.replace(/\/+$/, "");
7090
+ function yi(r) {
7091
+ const e = new URL(r), t = e.protocol === "https:", n = e.pathname.replace(/\/+$/, "");
7028
7092
  return {
7029
7093
  host: e.hostname,
7030
7094
  port: e.port ? parseInt(e.port, 10) : t ? 443 : 80,
@@ -7039,17 +7103,17 @@ class L {
7039
7103
  init(e) {
7040
7104
  if (!e || !e.workspace || !e.roomId || !e.user)
7041
7105
  throw new Error("workspace, roomId, and user are required");
7042
- const t = e.host || q, n = oi.has(e.recording) ? e.recording : "off", i = n !== "off" && !!e.transcribe, r = i && !!e.summarize, o = e.recordOnlyIfHost !== !1, a = ai.has(e.recordingMode) ? e.recordingMode : "local", c = Number.isFinite(e.compositeWidth) ? e.compositeWidth : 1280, h = Number.isFinite(e.compositeHeight) ? e.compositeHeight : 720, l = Number.isFinite(e.compositeFps) ? e.compositeFps : 30, d = Number.isFinite(e.recordingVideoBps) ? e.recordingVideoBps : 1e6, u = Number.isFinite(e.recordingAudioBps) ? e.recordingAudioBps : 64e3, f = ["chat", "code", "whiteboard"], m = Array.isArray(e.panels) && e.panels.length ? e.panels.filter((_) => f.includes(_)) : ["chat"];
7106
+ const t = e.host || F, n = pi.has(e.recording) ? e.recording : "off", i = n !== "off" && !!e.transcribe, s = i && !!e.summarize, o = e.recordOnlyIfHost !== !1, a = fi.has(e.recordingMode) ? e.recordingMode : "local", c = Number.isFinite(e.compositeWidth) ? e.compositeWidth : 1280, h = Number.isFinite(e.compositeHeight) ? e.compositeHeight : 720, l = Number.isFinite(e.compositeFps) ? e.compositeFps : 30, d = Number.isFinite(e.recordingVideoBps) ? e.recordingVideoBps : 1e6, u = Number.isFinite(e.recordingAudioBps) ? e.recordingAudioBps : 64e3, f = ["chat", "code", "whiteboard"], m = Array.isArray(e.panels) && e.panels.length ? e.panels.filter((v) => f.includes(v)) : ["chat"];
7043
7107
  m.includes("chat") || m.unshift("chat"), this.config = {
7044
7108
  ...e,
7045
7109
  host: t,
7046
7110
  apiUrl: e.apiUrl || `${t}/api`,
7047
7111
  socketUrl: e.socketUrl || t,
7048
- peerServer: e.peerServer || li(t),
7112
+ peerServer: e.peerServer || yi(t),
7049
7113
  ai: { ...e.ai || {} },
7050
7114
  recording: n,
7051
7115
  transcribe: i,
7052
- summarize: r,
7116
+ summarize: s,
7053
7117
  recordOnlyIfHost: o,
7054
7118
  recordingMode: a,
7055
7119
  compositeWidth: c,
@@ -7058,7 +7122,7 @@ class L {
7058
7122
  recordingVideoBps: d,
7059
7123
  recordingAudioBps: u,
7060
7124
  panels: m
7061
- }, this.roomRecording = { active: !1, recordedBy: null, sessionId: null }, this.compositeUnavailable = !1, this._pendingPresentingUserId = null, this.myRole = null, this.roleResolvers = [], this.currentRoom = this.config.roomId, this.currentUser = this.config.user, this.peerManager = new es(this.config), this.socketManager = new Ws(this.config), this.mediaManager = new Ys(), this.uiManager = new ni({
7125
+ }, this.roomRecording = { active: !1, recordedBy: null, sessionId: null }, this.compositeUnavailable = !1, this._pendingPresentingUserId = null, this.myRole = null, this.roleResolvers = [], this.currentRoom = this.config.roomId, this.currentUser = this.config.user, this.peerManager = new nr(this.config), this.socketManager = new Gr(this.config), this.mediaManager = new Qr(), this.uiManager = new hi({
7062
7126
  recording: n,
7063
7127
  screenShare: e.screenShare !== !1,
7064
7128
  panels: m
@@ -7193,15 +7257,15 @@ class L {
7193
7257
  }), this.peerLabels) {
7194
7258
  const t = `${this.config.workspace}-${this.currentRoom}-`;
7195
7259
  for (const [n, i] of this.peerLabels.entries()) {
7196
- const r = n.startsWith(t) ? n.slice(t.length) : n;
7260
+ const s = n.startsWith(t) ? n.slice(t.length) : n;
7197
7261
  e.push({
7198
7262
  label: i,
7199
- userId: r,
7263
+ userId: s,
7200
7264
  isYou: !1,
7201
7265
  isHost: this.hostPeerId === n,
7202
7266
  isSharing: this.presentingPeerId === n,
7203
- canEditCode: this.codePermsByUser ? !!this.codePermsByUser.get(r) : !1,
7204
- canDrawBoard: this.boardPermsByUser ? !!this.boardPermsByUser.get(r) : !1
7267
+ canEditCode: this.codePermsByUser ? !!this.codePermsByUser.get(s) : !1,
7268
+ canDrawBoard: this.boardPermsByUser ? !!this.boardPermsByUser.get(s) : !1
7205
7269
  });
7206
7270
  }
7207
7271
  }
@@ -7264,7 +7328,7 @@ class L {
7264
7328
  }
7265
7329
  }), this.config.panels.includes("code")) {
7266
7330
  const e = this.uiManager.getPanelSlot("code");
7267
- e && (this.codeSandbox = new si({
7331
+ e && (this.codeSandbox = new li({
7268
7332
  container: e,
7269
7333
  userId: this.currentUser.id,
7270
7334
  canEdit: () => this._canEditCode(),
@@ -7295,7 +7359,7 @@ class L {
7295
7359
  }
7296
7360
  if (this.config.panels.includes("whiteboard")) {
7297
7361
  const e = this.uiManager.getPanelSlot("whiteboard");
7298
- e && (this.whiteboard = new ii({
7362
+ e && (this.whiteboard = new di({
7299
7363
  container: e,
7300
7364
  userId: this.currentUser.id,
7301
7365
  canDraw: () => this._canDrawWhiteboard(),
@@ -7392,7 +7456,7 @@ class L {
7392
7456
  this.requestStopRecording();
7393
7457
  return;
7394
7458
  }
7395
- const e = ri(
7459
+ const e = ui(
7396
7460
  this.config,
7397
7461
  this.compositor,
7398
7462
  this.compositeUnavailable
@@ -7403,10 +7467,10 @@ class L {
7403
7467
  if (t = this.compositor.getStream(), !t) throw new Error("composite stream not ready");
7404
7468
  } else if (t = this.peerManager.localStream, !t) throw new Error("local stream not ready");
7405
7469
  const n = this.readStoredSession();
7406
- let i = null, r = 0;
7470
+ let i = null, s = 0;
7407
7471
  if (n) {
7408
7472
  const o = await this.probeSessionStatus(n.sessionId).catch(() => null);
7409
- o && o.active ? (i = { sessionId: n.sessionId }, r = (o.lastSeq || -1) + 1, console.log(`MeetSDK: resuming recording session ${n.sessionId} at seq=${r}`)) : this.clearStoredSession();
7473
+ o && o.active ? (i = { sessionId: n.sessionId }, s = (o.lastSeq || -1) + 1, console.log(`MeetSDK: resuming recording session ${n.sessionId} at seq=${s}`)) : this.clearStoredSession();
7410
7474
  }
7411
7475
  if (!i) {
7412
7476
  if (i = await this.startRecordingSession(), !i || i.alreadyActive) return;
@@ -7418,7 +7482,7 @@ class L {
7418
7482
  }
7419
7483
  this.recordingSession = i, this.chunkQueue = [], this.chunkDrainerRunning = !1, this.recorder.start(t, {
7420
7484
  timesliceMs: 15e3,
7421
- startSeq: r,
7485
+ startSeq: s,
7422
7486
  videoBitsPerSecond: this.config.recordingVideoBps,
7423
7487
  audioBitsPerSecond: this.config.recordingAudioBps,
7424
7488
  onChunk: (o, a) => (this.enqueueChunk(i.sessionId, o, a), Promise.resolve())
@@ -7532,12 +7596,12 @@ class L {
7532
7596
  async uploadRecordingChunk(e, t, n) {
7533
7597
  const i = new FormData();
7534
7598
  i.append("chunk", t, `chunk-${n}.webm`);
7535
- const r = await fetch(
7599
+ const s = await fetch(
7536
7600
  `${this.config.apiUrl}/rooms/${encodeURIComponent(this.currentRoom)}/recordings/session/${encodeURIComponent(e)}/chunk?seq=${n}`,
7537
7601
  { method: "POST", headers: this.buildHeaders(), body: i }
7538
7602
  );
7539
- if (!r.ok)
7540
- throw new Error(`chunk seq=${n}: HTTP ${r.status}`);
7603
+ if (!s.ok)
7604
+ throw new Error(`chunk seq=${n}: HTTP ${s.status}`);
7541
7605
  }
7542
7606
  async finalizeRecordingSession(e, t) {
7543
7607
  const n = Math.max(0, Math.round((t.endedAt - t.startedAt) / 1e3)), i = await fetch(
@@ -7553,8 +7617,8 @@ class L {
7553
7617
  }
7554
7618
  );
7555
7619
  if (!i.ok) throw new Error(`session/finalize failed: HTTP ${i.status}`);
7556
- const r = await i.json();
7557
- return this.clearStoredSession(), r;
7620
+ const s = await i.json();
7621
+ return this.clearStoredSession(), s;
7558
7622
  }
7559
7623
  async listRecordings() {
7560
7624
  if (!this.isInitialized) throw new Error("SDK not initialized");
@@ -7674,7 +7738,7 @@ class L {
7674
7738
  workspace: t,
7675
7739
  host: n,
7676
7740
  ai: i,
7677
- title: r,
7741
+ title: s,
7678
7742
  hostUserId: o,
7679
7743
  hostName: a,
7680
7744
  hostId: c,
@@ -7682,8 +7746,8 @@ class L {
7682
7746
  users: l
7683
7747
  } = e;
7684
7748
  if (!t) throw new Error("workspace is required");
7685
- const d = n || q, u = {};
7686
- return r !== void 0 && (u.title = r), o !== void 0 && (u.hostUserId = o), a !== void 0 && (u.hostName = a), c !== void 0 && (u.hostId = c), h !== void 0 && (u.scheduledFor = h), l !== void 0 && (u.users = l), G("POST", `${d}/api/meetings/schedule`, { workspace: t, ai: i, body: u });
7749
+ const d = n || F, u = {};
7750
+ return s !== void 0 && (u.title = s), o !== void 0 && (u.hostUserId = o), a !== void 0 && (u.hostName = a), c !== void 0 && (u.hostId = c), h !== void 0 && (u.scheduledFor = h), l !== void 0 && (u.users = l), G("POST", `${d}/api/meetings/schedule`, { workspace: t, ai: i, body: u });
7687
7751
  }
7688
7752
  /**
7689
7753
  * Update a scheduled meeting. Any of the fields (title, hostUserId, hostName,
@@ -7695,7 +7759,7 @@ class L {
7695
7759
  workspace: t,
7696
7760
  roomId: n,
7697
7761
  host: i,
7698
- ai: r,
7762
+ ai: s,
7699
7763
  title: o,
7700
7764
  hostUserId: a,
7701
7765
  hostName: c,
@@ -7704,29 +7768,29 @@ class L {
7704
7768
  } = e;
7705
7769
  if (!t) throw new Error("workspace is required");
7706
7770
  if (!n) throw new Error("roomId is required");
7707
- const d = i || q, u = {};
7771
+ const d = i || F, u = {};
7708
7772
  return o !== void 0 && (u.title = o), a !== void 0 && (u.hostUserId = a), c !== void 0 && (u.hostName = c), h !== void 0 && (u.users = h), l !== void 0 && (u.scheduledFor = l), G("PATCH", `${d}/api/meetings/${encodeURIComponent(n)}`, {
7709
7773
  workspace: t,
7710
- ai: r,
7774
+ ai: s,
7711
7775
  body: u
7712
7776
  });
7713
7777
  }
7714
7778
  /** Cancel a scheduled meeting. Returns { success, roomId, status:'cancelled' }. */
7715
7779
  static async cancelMeeting(e = {}) {
7716
- const { workspace: t, roomId: n, host: i, ai: r } = e;
7780
+ const { workspace: t, roomId: n, host: i, ai: s } = e;
7717
7781
  if (!t) throw new Error("workspace is required");
7718
7782
  if (!n) throw new Error("roomId is required");
7719
- return G("DELETE", `${i || q}/api/meetings/${encodeURIComponent(n)}`, {
7783
+ return G("DELETE", `${i || F}/api/meetings/${encodeURIComponent(n)}`, {
7720
7784
  workspace: t,
7721
- ai: r
7785
+ ai: s
7722
7786
  });
7723
7787
  }
7724
7788
  /** List meetings for a workspace. Options: { status, upcoming: true }. */
7725
7789
  static async listMeetings(e = {}) {
7726
- const { workspace: t, host: n, ai: i, status: r, upcoming: o } = e;
7790
+ const { workspace: t, host: n, ai: i, status: s, upcoming: o } = e;
7727
7791
  if (!t) throw new Error("workspace is required");
7728
- const a = n || q, c = new URLSearchParams();
7729
- r && c.set("status", r), o && c.set("upcoming", "true");
7792
+ const a = n || F, c = new URLSearchParams();
7793
+ s && c.set("status", s), o && c.set("upcoming", "true");
7730
7794
  const h = c.toString();
7731
7795
  return G("GET", `${a}/api/meetings${h ? "?" + h : ""}`, { workspace: t, ai: i });
7732
7796
  }
@@ -7737,10 +7801,10 @@ class L {
7737
7801
  * you already have a stable id for the user (e.g. from your auth system).
7738
7802
  */
7739
7803
  static async quickJoin(e = {}) {
7740
- const { workspace: t, roomId: n, userName: i, container: r } = e;
7741
- if (!t || !n || !i || !r)
7804
+ const { workspace: t, roomId: n, userName: i, container: s } = e;
7805
+ if (!t || !n || !i || !s)
7742
7806
  throw new Error("workspace, roomId, userName, and container are required");
7743
- const o = e.userId || ci(), {
7807
+ const o = e.userId || gi(), {
7744
7808
  userId: a,
7745
7809
  userName: c,
7746
7810
  container: h,
@@ -7751,7 +7815,7 @@ class L {
7751
7815
  workspace: t,
7752
7816
  roomId: n,
7753
7817
  user: { id: o, name: i }
7754
- }), await d.mount(r), d;
7818
+ }), await d.mount(s), d;
7755
7819
  }
7756
7820
  async leave() {
7757
7821
  if (!(this._leaving || this._left)) {
@@ -7803,10 +7867,10 @@ class L {
7803
7867
  }
7804
7868
  }
7805
7869
  if (typeof window < "u") {
7806
- const s = new L();
7870
+ const r = new L();
7807
7871
  ["createMeeting", "updateMeeting", "cancelMeeting", "listMeetings", "quickJoin"].forEach((e) => {
7808
- s[e] = L[e].bind(L);
7809
- }), window.MeetSDK = s, window.MeetSDKClass = L;
7872
+ r[e] = L[e].bind(L);
7873
+ }), window.MeetSDK = r, window.MeetSDKClass = L;
7810
7874
  }
7811
7875
  export {
7812
7876
  L as default