@nainudhin/video-meeting-sdk 1.11.0 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/meet-sdk.mjs CHANGED
@@ -1,8 +1,8 @@
1
- var kn = (s) => {
1
+ var wn = (s) => {
2
2
  throw TypeError(s);
3
3
  };
4
- var U = (s, e, t) => e.has(s) ? kn("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(s) : e.set(s, t);
5
- function xn(s, e) {
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) {
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)) {
@@ -18,7 +18,7 @@ function xn(s, e) {
18
18
  }
19
19
  return Object.freeze(Object.defineProperty(s, Symbol.toStringTag, { value: "Module" }));
20
20
  }
21
- class Tn {
21
+ class En {
22
22
  constructor() {
23
23
  this.encoder = new TextEncoder(), this._pieces = [], this._parts = [];
24
24
  }
@@ -37,10 +37,10 @@ class Tn {
37
37
  toArrayBuffer() {
38
38
  const e = [];
39
39
  for (const t of this._parts) e.push(t);
40
- return Rn(e).buffer;
40
+ return Mn(e).buffer;
41
41
  }
42
42
  }
43
- function Rn(s) {
43
+ function Mn(s) {
44
44
  let e = 0;
45
45
  for (const i of s) e += i.byteLength;
46
46
  const t = new Uint8Array(e);
@@ -51,14 +51,14 @@ function Rn(s) {
51
51
  }
52
52
  return t;
53
53
  }
54
- function gt(s) {
55
- return new wn(s).unpack();
54
+ function bt(s) {
55
+ return new In(s).unpack();
56
56
  }
57
- function yt(s) {
58
- const e = new Pn(), t = e.pack(s);
57
+ function _t(s) {
58
+ const e = new An(), t = e.pack(s);
59
59
  return t instanceof Promise ? t.then(() => e.getBuffer()) : e.getBuffer();
60
60
  }
61
- class wn {
61
+ class In {
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
  }
@@ -197,7 +197,7 @@ class wn {
197
197
  throw new Error("BinaryPackFailure: read index out of range");
198
198
  }
199
199
  }
200
- class Pn {
200
+ class An {
201
201
  getBuffer() {
202
202
  return this._bufferBuilder.toArrayBuffer();
203
203
  }
@@ -344,22 +344,22 @@ class Pn {
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 Tn(), this._textEncoder = new TextEncoder();
347
+ this._bufferBuilder = new En(), this._textEncoder = new TextEncoder();
348
348
  }
349
349
  }
350
- let bt = !0, _t = !0;
350
+ let vt = !0, St = !0;
351
351
  function F(s, e, t) {
352
352
  const n = s.match(e);
353
353
  return n && n.length >= t && parseFloat(n[t], 10);
354
354
  }
355
- function I(s, e, t) {
355
+ function A(s, e, t) {
356
356
  if (!s.RTCPeerConnection)
357
357
  return;
358
358
  if (!Object.getOwnPropertyDescriptor(
359
359
  EventTarget.prototype,
360
360
  "addEventListener"
361
361
  ).writable) {
362
- Le("Unable to polyfill events");
362
+ Be("Unable to polyfill events");
363
363
  return;
364
364
  }
365
365
  const i = s.RTCPeerConnection.prototype, r = i.addEventListener;
@@ -403,23 +403,23 @@ function I(s, e, t) {
403
403
  configurable: !0
404
404
  });
405
405
  }
406
- function En(s) {
407
- return typeof s != "boolean" ? new Error("Argument type: " + typeof s + ". Please use a boolean.") : (bt = s, s ? "adapter.js logging disabled" : "adapter.js logging enabled");
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");
408
408
  }
409
- function Mn(s) {
410
- return typeof s != "boolean" ? new Error("Argument type: " + typeof s + ". Please use a boolean.") : (_t = !s, "adapter.js deprecation warnings " + (s ? "disabled" : "enabled"));
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"));
411
411
  }
412
- function Le() {
412
+ function Be() {
413
413
  if (typeof window == "object") {
414
- if (bt)
414
+ if (vt)
415
415
  return;
416
416
  typeof console < "u" && typeof console.log == "function" && console.log.apply(console, arguments);
417
417
  }
418
418
  }
419
- function $e(s, e) {
420
- _t && console.warn(s + " is deprecated, please use " + e + " instead.");
419
+ function Ue(s, e) {
420
+ St && console.warn(s + " is deprecated, please use " + e + " instead.");
421
421
  }
422
- function An(s) {
422
+ function Ln(s) {
423
423
  const e = { browser: null, version: null };
424
424
  if (typeof s > "u" || !s.navigator || !s.navigator.userAgent)
425
425
  return e.browser = "Not a browser.", e;
@@ -458,23 +458,23 @@ function An(s) {
458
458
  return e.browser = "Not a supported browser.", e;
459
459
  return e;
460
460
  }
461
- function et(s) {
461
+ function tt(s) {
462
462
  return Object.prototype.toString.call(s) === "[object Object]";
463
463
  }
464
- function vt(s) {
465
- return et(s) ? Object.keys(s).reduce(function(e, t) {
466
- const n = et(s[t]), i = n ? vt(s[t]) : s[t], r = n && !Object.keys(i).length;
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
467
  return i === void 0 || r ? e : Object.assign(e, { [t]: i });
468
468
  }, {}) : s;
469
469
  }
470
- function ye(s, e, t) {
470
+ function _e(s, e, t) {
471
471
  !e || t.has(e.id) || (t.set(e.id, e), Object.keys(e).forEach((n) => {
472
- n.endsWith("Id") ? ye(s, s.get(e[n]), t) : n.endsWith("Ids") && e[n].forEach((i) => {
473
- ye(s, s.get(i), t);
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);
474
474
  });
475
475
  }));
476
476
  }
477
- function tt(s, e, t) {
477
+ function nt(s, e, t) {
478
478
  const n = t ? "outbound-rtp" : "inbound-rtp", i = /* @__PURE__ */ new Map();
479
479
  if (e === null)
480
480
  return i;
@@ -483,12 +483,12 @@ function tt(s, e, t) {
483
483
  o.type === "track" && o.trackIdentifier === e.id && r.push(o);
484
484
  }), r.forEach((o) => {
485
485
  s.forEach((a) => {
486
- a.type === n && a.trackId === o.id && ye(s, a, i);
486
+ a.type === n && a.trackId === o.id && _e(s, a, i);
487
487
  });
488
488
  }), i;
489
489
  }
490
- const nt = Le;
491
- function St(s, e) {
490
+ const st = Be;
491
+ function xt(s, e) {
492
492
  if (e.version >= 64)
493
493
  return;
494
494
  const t = s && s.navigator;
@@ -533,14 +533,14 @@ function St(s, e) {
533
533
  let d;
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
- u = u.filter((g) => g.kind === "videoinput");
537
- let f = u.find((g) => d.some((_) => g.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), nt("chrome: " + JSON.stringify(a)), c(a);
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);
539
539
  });
540
540
  }
541
541
  a.video = n(a.video);
542
542
  }
543
- return nt("chrome: " + JSON.stringify(a)), c(a);
543
+ return st("chrome: " + JSON.stringify(a)), c(a);
544
544
  }, r = function(a) {
545
545
  return e.version >= 64 ? a : {
546
546
  name: {
@@ -582,10 +582,10 @@ function St(s, e) {
582
582
  };
583
583
  }
584
584
  }
585
- function Ct(s) {
585
+ function kt(s) {
586
586
  s.MediaStream = s.MediaStream || s.webkitMediaStream;
587
587
  }
588
- function kt(s, e) {
588
+ function Rt(s, e) {
589
589
  if (!(e.version > 102))
590
590
  if (typeof s == "object" && s.RTCPeerConnection && !("ontrack" in s.RTCPeerConnection.prototype)) {
591
591
  Object.defineProperty(s.RTCPeerConnection.prototype, "ontrack", {
@@ -615,13 +615,13 @@ function kt(s, e) {
615
615
  }, this.addEventListener("addstream", this._ontrackpoly)), t.apply(this, arguments);
616
616
  };
617
617
  } else
618
- I(s, "track", (t) => (t.transceiver || Object.defineProperty(
618
+ A(s, "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 xt(s) {
624
+ function Tt(s) {
625
625
  if (typeof s == "object" && s.RTCPeerConnection && !("getSenders" in s.RTCPeerConnection.prototype) && "createDTMFSender" in s.RTCPeerConnection.prototype) {
626
626
  const e = function(i, r) {
627
627
  return {
@@ -673,7 +673,7 @@ function xt(s) {
673
673
  });
674
674
  }
675
675
  }
676
- function Tt(s, e) {
676
+ function wt(s, e) {
677
677
  if (e.version >= 67 || !(typeof s == "object" && s.RTCPeerConnection && s.RTCRtpSender && s.RTCRtpReceiver))
678
678
  return;
679
679
  if (!("getStats" in s.RTCRtpSender.prototype)) {
@@ -693,7 +693,7 @@ function Tt(s, e) {
693
693
  * send a track with the same id as sender.track as
694
694
  * it is not possible to identify the RTCRtpSender.
695
695
  */
696
- tt(a, o.track, !0)
696
+ nt(a, o.track, !0)
697
697
  ));
698
698
  };
699
699
  }
@@ -702,9 +702,9 @@ function Tt(s, e) {
702
702
  n && (s.RTCPeerConnection.prototype.getReceivers = function() {
703
703
  const r = n.apply(this, []);
704
704
  return r.forEach((o) => o._pc = this), r;
705
- }), I(s, "track", (i) => (i.receiver._pc = i.srcElement, i)), s.RTCRtpReceiver.prototype.getStats = function() {
705
+ }), A(s, "track", (i) => (i.receiver._pc = i.srcElement, i)), s.RTCRtpReceiver.prototype.getStats = function() {
706
706
  const r = this;
707
- return this._pc.getStats().then((o) => tt(o, r.track, !1));
707
+ return this._pc.getStats().then((o) => nt(o, r.track, !1));
708
708
  };
709
709
  }
710
710
  if (!("getStats" in s.RTCRtpSender.prototype && "getStats" in s.RTCRtpReceiver.prototype))
@@ -727,7 +727,7 @@ function Tt(s, e) {
727
727
  return t.apply(this, arguments);
728
728
  };
729
729
  }
730
- function Rt(s) {
730
+ function Pt(s) {
731
731
  s.RTCPeerConnection.prototype.getLocalStreams = function() {
732
732
  return this._shimmedLocalStreams = this._shimmedLocalStreams || {}, Object.keys(this._shimmedLocalStreams).map((o) => this._shimmedLocalStreams[o][0]);
733
733
  };
@@ -765,11 +765,11 @@ function Rt(s) {
765
765
  }), i.apply(this, arguments);
766
766
  };
767
767
  }
768
- function wt(s, e) {
768
+ function Et(s, e) {
769
769
  if (!s.RTCPeerConnection)
770
770
  return;
771
771
  if (s.RTCPeerConnection.prototype.addTrack && e.version >= 65)
772
- return Rt(s);
772
+ return Pt(s);
773
773
  const t = s.RTCPeerConnection.prototype.getLocalStreams;
774
774
  s.RTCPeerConnection.prototype.getLocalStreams = function() {
775
775
  const l = t.apply(this);
@@ -810,9 +810,9 @@ function wt(s, e) {
810
810
  "InvalidAccessError"
811
811
  );
812
812
  this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {};
813
- const g = this._streams[d.id];
814
- if (g)
815
- g.addTrack(l), Promise.resolve().then(() => {
813
+ const m = this._streams[d.id];
814
+ if (m)
815
+ m.addTrack(l), Promise.resolve().then(() => {
816
816
  this.dispatchEvent(new Event("negotiationneeded"));
817
817
  });
818
818
  else {
@@ -824,9 +824,9 @@ function wt(s, e) {
824
824
  function r(h, l) {
825
825
  let d = l.sdp;
826
826
  return Object.keys(h._reverseStreams || []).forEach((u) => {
827
- const f = h._reverseStreams[u], g = h._streams[f.id];
827
+ const f = h._reverseStreams[u], m = h._streams[f.id];
828
828
  d = d.replace(
829
- new RegExp(g.id, "g"),
829
+ new RegExp(m.id, "g"),
830
830
  f.id
831
831
  );
832
832
  }), new RTCSessionDescription({
@@ -837,10 +837,10 @@ function wt(s, e) {
837
837
  function o(h, l) {
838
838
  let d = l.sdp;
839
839
  return Object.keys(h._reverseStreams || []).forEach((u) => {
840
- const f = h._reverseStreams[u], g = h._streams[f.id];
840
+ const f = h._reverseStreams[u], m = h._streams[f.id];
841
841
  d = d.replace(
842
842
  new RegExp(f.id, "g"),
843
- g.id
843
+ m.id
844
844
  );
845
845
  }), new RTCSessionDescription({
846
846
  type: l.type,
@@ -851,15 +851,15 @@ function wt(s, e) {
851
851
  const l = s.RTCPeerConnection.prototype[h], d = { [h]() {
852
852
  const u = arguments;
853
853
  return arguments.length && typeof arguments[0] == "function" ? l.apply(this, [
854
- (g) => {
855
- const _ = r(this, g);
854
+ (m) => {
855
+ const _ = r(this, m);
856
856
  u[0].apply(null, [_]);
857
857
  },
858
- (g) => {
859
- u[1] && u[1].apply(null, g);
858
+ (m) => {
859
+ u[1] && u[1].apply(null, m);
860
860
  },
861
861
  arguments[2]
862
- ]) : l.apply(this, arguments).then((g) => r(this, g));
862
+ ]) : l.apply(this, arguments).then((m) => r(this, m));
863
863
  } };
864
864
  s.RTCPeerConnection.prototype[h] = d[h];
865
865
  });
@@ -900,7 +900,7 @@ function wt(s, e) {
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 be(s, e) {
903
+ function ve(s, e) {
904
904
  !s.RTCPeerConnection && s.webkitRTCPeerConnection && (s.RTCPeerConnection = s.webkitRTCPeerConnection), s.RTCPeerConnection && e.version < 53 && ["setLocalDescription", "setRemoteDescription", "addIceCandidate"].forEach(function(t) {
905
905
  const n = s.RTCPeerConnection.prototype[t], i = { [t]() {
906
906
  return arguments[0] = new (t === "addIceCandidate" ? s.RTCIceCandidate : s.RTCSessionDescription)(arguments[0]), n.apply(this, arguments);
@@ -908,32 +908,32 @@ function be(s, e) {
908
908
  s.RTCPeerConnection.prototype[t] = i[t];
909
909
  });
910
910
  }
911
- function Pt(s, e) {
912
- e.version > 102 || I(s, "negotiationneeded", (t) => {
911
+ function Mt(s, e) {
912
+ e.version > 102 || A(s, "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;
916
916
  });
917
917
  }
918
- const st = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
918
+ const it = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
919
919
  __proto__: null,
920
- fixNegotiationNeeded: Pt,
921
- shimAddTrackRemoveTrack: wt,
922
- shimAddTrackRemoveTrackWithNative: Rt,
923
- shimGetSendersWithDtmf: xt,
924
- shimGetUserMedia: St,
925
- shimMediaStream: Ct,
926
- shimOnTrack: kt,
927
- shimPeerConnection: be,
928
- shimSenderReceiverGetStats: Tt
920
+ fixNegotiationNeeded: Mt,
921
+ shimAddTrackRemoveTrack: Et,
922
+ shimAddTrackRemoveTrackWithNative: Pt,
923
+ shimGetSendersWithDtmf: Tt,
924
+ shimGetUserMedia: xt,
925
+ shimMediaStream: kt,
926
+ shimOnTrack: Rt,
927
+ shimPeerConnection: ve,
928
+ shimSenderReceiverGetStats: wt
929
929
  }, Symbol.toStringTag, { value: "Module" }));
930
- function Et(s, e) {
930
+ function It(s, e) {
931
931
  const t = s && s.navigator;
932
932
  if (!t.mediaDevices)
933
933
  return;
934
934
  const n = s && s.MediaStreamTrack;
935
935
  if (t.getUserMedia = function(i, r, o) {
936
- $e(
936
+ Ue(
937
937
  "navigator.getUserMedia",
938
938
  "navigator.mediaDevices.getUserMedia"
939
939
  ), t.mediaDevices.getUserMedia(i).then(r, o);
@@ -958,7 +958,7 @@ function Et(s, e) {
958
958
  }
959
959
  }
960
960
  }
961
- function In(s, e) {
961
+ function $n(s, e) {
962
962
  s.navigator.mediaDevices && (s.navigator.mediaDevices && "getDisplayMedia" in s.navigator.mediaDevices || (s.navigator.mediaDevices.getDisplayMedia = function(n) {
963
963
  if (!(n && n.video)) {
964
964
  const i = new DOMException("getDisplayMedia without video constraints is undefined");
@@ -967,14 +967,14 @@ function In(s, e) {
967
967
  return n.video === !0 ? n.video = { mediaSource: e } : n.video.mediaSource = e, s.navigator.mediaDevices.getUserMedia(n);
968
968
  }));
969
969
  }
970
- function Mt(s) {
970
+ function At(s) {
971
971
  typeof s == "object" && s.RTCTrackEvent && "receiver" in s.RTCTrackEvent.prototype && !("transceiver" in s.RTCTrackEvent.prototype) && Object.defineProperty(s.RTCTrackEvent.prototype, "transceiver", {
972
972
  get() {
973
973
  return { receiver: this.receiver };
974
974
  }
975
975
  });
976
976
  }
977
- function _e(s, e) {
977
+ function Se(s, e) {
978
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
979
  const n = s.RTCPeerConnection.prototype[t], i = { [t]() {
980
980
  return arguments[0] = new (t === "addIceCandidate" ? s.RTCIceCandidate : s.RTCSessionDescription)(arguments[0]), n.apply(this, arguments);
@@ -982,7 +982,7 @@ function _e(s, e) {
982
982
  s.RTCPeerConnection.prototype[t] = i[t];
983
983
  }));
984
984
  }
985
- function At(s, e) {
985
+ function Ot(s, e) {
986
986
  if (typeof s != "object" || !(s.RTCPeerConnection || s.mozRTCPeerConnection) || e.version >= 151)
987
987
  return;
988
988
  const t = {
@@ -1013,7 +1013,7 @@ function At(s, e) {
1013
1013
  }).then(o, a);
1014
1014
  };
1015
1015
  }
1016
- function It(s) {
1016
+ function Dt(s) {
1017
1017
  if (!(typeof s == "object" && s.RTCPeerConnection && s.RTCRtpSender) || s.RTCRtpSender && "getStats" in s.RTCRtpSender.prototype)
1018
1018
  return;
1019
1019
  const e = s.RTCPeerConnection.prototype.getSenders;
@@ -1029,28 +1029,28 @@ function It(s) {
1029
1029
  return this.track ? this._pc.getStats(this.track) : Promise.resolve(/* @__PURE__ */ new Map());
1030
1030
  };
1031
1031
  }
1032
- function Ot(s) {
1032
+ function Lt(s) {
1033
1033
  if (!(typeof s == "object" && s.RTCPeerConnection && s.RTCRtpSender) || s.RTCRtpSender && "getStats" in s.RTCRtpReceiver.prototype)
1034
1034
  return;
1035
1035
  const e = s.RTCPeerConnection.prototype.getReceivers;
1036
1036
  e && (s.RTCPeerConnection.prototype.getReceivers = function() {
1037
1037
  const n = e.apply(this, []);
1038
1038
  return n.forEach((i) => i._pc = this), n;
1039
- }), I(s, "track", (t) => (t.receiver._pc = t.srcElement, t)), s.RTCRtpReceiver.prototype.getStats = function() {
1039
+ }), A(s, "track", (t) => (t.receiver._pc = t.srcElement, t)), s.RTCRtpReceiver.prototype.getStats = function() {
1040
1040
  return this._pc.getStats(this.track);
1041
1041
  };
1042
1042
  }
1043
- function Dt(s) {
1043
+ function $t(s) {
1044
1044
  !s.RTCPeerConnection || "removeStream" in s.RTCPeerConnection.prototype || (s.RTCPeerConnection.prototype.removeStream = function(t) {
1045
- $e("removeStream", "removeTrack"), this.getSenders().forEach((n) => {
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 Lt(s) {
1050
+ function Bt(s) {
1051
1051
  s.DataChannel && !s.RTCDataChannel && (s.RTCDataChannel = s.DataChannel);
1052
1052
  }
1053
- function $t(s, e) {
1053
+ function Ut(s, e) {
1054
1054
  if (!(typeof s == "object" && s.RTCPeerConnection) || e.version >= 110)
1055
1055
  return;
1056
1056
  const t = s.RTCPeerConnection.prototype.addTransceiver;
@@ -1082,7 +1082,7 @@ function $t(s, e) {
1082
1082
  return o;
1083
1083
  });
1084
1084
  }
1085
- function Bt(s, e) {
1085
+ function zt(s, e) {
1086
1086
  if (!(typeof s == "object" && s.RTCRtpSender) || e.version >= 110)
1087
1087
  return;
1088
1088
  const t = s.RTCRtpSender.prototype.getParameters;
@@ -1091,7 +1091,7 @@ function Bt(s, e) {
1091
1091
  return "encodings" in i || (i.encodings = [].concat(this.sendEncodings || [{}])), i;
1092
1092
  });
1093
1093
  }
1094
- function Ut(s, e) {
1094
+ function Nt(s, e) {
1095
1095
  if (!(typeof s == "object" && s.RTCPeerConnection) || e.version >= 110)
1096
1096
  return;
1097
1097
  const t = s.RTCPeerConnection.prototype.createOffer;
@@ -1101,7 +1101,7 @@ function Ut(s, e) {
1101
1101
  }) : t.apply(this, arguments);
1102
1102
  };
1103
1103
  }
1104
- function zt(s, e) {
1104
+ function qt(s, e) {
1105
1105
  if (!(typeof s == "object" && s.RTCPeerConnection) || e.version >= 110)
1106
1106
  return;
1107
1107
  const t = s.RTCPeerConnection.prototype.createAnswer;
@@ -1111,23 +1111,23 @@ function zt(s, e) {
1111
1111
  }) : t.apply(this, arguments);
1112
1112
  };
1113
1113
  }
1114
- const it = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1114
+ const rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1115
1115
  __proto__: null,
1116
- shimAddTransceiver: $t,
1117
- shimCreateAnswer: zt,
1118
- shimCreateOffer: Ut,
1119
- shimGetDisplayMedia: In,
1120
- shimGetParameters: Bt,
1121
- shimGetStats: At,
1122
- shimGetUserMedia: Et,
1123
- shimOnTrack: Mt,
1124
- shimPeerConnection: _e,
1125
- shimRTCDataChannel: Lt,
1126
- shimReceiverGetStats: Ot,
1127
- shimRemoveStream: Dt,
1128
- shimSenderGetStats: It
1116
+ shimAddTransceiver: Ut,
1117
+ shimCreateAnswer: qt,
1118
+ shimCreateOffer: Nt,
1119
+ shimGetDisplayMedia: $n,
1120
+ shimGetParameters: zt,
1121
+ shimGetStats: Ot,
1122
+ shimGetUserMedia: It,
1123
+ shimOnTrack: At,
1124
+ shimPeerConnection: Se,
1125
+ shimRTCDataChannel: Bt,
1126
+ shimReceiverGetStats: Lt,
1127
+ shimRemoveStream: $t,
1128
+ shimSenderGetStats: Dt
1129
1129
  }, Symbol.toStringTag, { value: "Module" }));
1130
- function Nt(s) {
1130
+ function Ft(s) {
1131
1131
  if (!(typeof s != "object" || !s.RTCPeerConnection)) {
1132
1132
  if ("getLocalStreams" in s.RTCPeerConnection.prototype || (s.RTCPeerConnection.prototype.getLocalStreams = function() {
1133
1133
  return this._localStreams || (this._localStreams = []), this._localStreams;
@@ -1162,7 +1162,7 @@ function Nt(s) {
1162
1162
  });
1163
1163
  }
1164
1164
  }
1165
- function qt(s) {
1165
+ function jt(s) {
1166
1166
  if (!(typeof s != "object" || !s.RTCPeerConnection) && ("getRemoteStreams" in s.RTCPeerConnection.prototype || (s.RTCPeerConnection.prototype.getRemoteStreams = function() {
1167
1167
  return this._remoteStreams ? this._remoteStreams : [];
1168
1168
  }), !("onaddstream" in s.RTCPeerConnection.prototype))) {
@@ -1197,7 +1197,7 @@ function qt(s) {
1197
1197
  };
1198
1198
  }
1199
1199
  }
1200
- function Ft(s) {
1200
+ function Ht(s) {
1201
1201
  if (typeof s != "object" || !s.RTCPeerConnection)
1202
1202
  return;
1203
1203
  const e = s.RTCPeerConnection.prototype, t = e.createOffer, n = e.createAnswer, i = e.setLocalDescription, r = e.setRemoteDescription, o = e.addIceCandidate;
@@ -1220,24 +1220,24 @@ function Ft(s) {
1220
1220
  return l ? (d.then(h, l), Promise.resolve()) : d;
1221
1221
  }, e.addIceCandidate = a;
1222
1222
  }
1223
- function jt(s) {
1223
+ function Vt(s) {
1224
1224
  const e = s && s.navigator;
1225
1225
  if (e.mediaDevices && e.mediaDevices.getUserMedia) {
1226
1226
  const t = e.mediaDevices, n = t.getUserMedia.bind(t);
1227
- e.mediaDevices.getUserMedia = (i) => n(Ht(i));
1227
+ e.mediaDevices.getUserMedia = (i) => n(Kt(i));
1228
1228
  }
1229
1229
  !e.getUserMedia && e.mediaDevices && e.mediaDevices.getUserMedia && (e.getUserMedia = (function(n, i, r) {
1230
1230
  e.mediaDevices.getUserMedia(n).then(i, r);
1231
1231
  }).bind(e));
1232
1232
  }
1233
- function Ht(s) {
1233
+ function Kt(s) {
1234
1234
  return s && s.video !== void 0 ? Object.assign(
1235
1235
  {},
1236
1236
  s,
1237
- { video: vt(s.video) }
1237
+ { video: Ct(s.video) }
1238
1238
  ) : s;
1239
1239
  }
1240
- function Vt(s) {
1240
+ function Jt(s) {
1241
1241
  if (!s.RTCPeerConnection)
1242
1242
  return;
1243
1243
  const e = s.RTCPeerConnection;
@@ -1246,7 +1246,7 @@ function Vt(s) {
1246
1246
  const r = [];
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 ? ($e("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, r.push(a)) : r.push(n.iceServers[o]);
1250
1250
  }
1251
1251
  n.iceServers = r;
1252
1252
  }
@@ -1257,14 +1257,14 @@ function Vt(s) {
1257
1257
  }
1258
1258
  });
1259
1259
  }
1260
- function Kt(s) {
1260
+ function Wt(s) {
1261
1261
  typeof s == "object" && s.RTCTrackEvent && "receiver" in s.RTCTrackEvent.prototype && !("transceiver" in s.RTCTrackEvent.prototype) && Object.defineProperty(s.RTCTrackEvent.prototype, "transceiver", {
1262
1262
  get() {
1263
1263
  return { receiver: this.receiver };
1264
1264
  }
1265
1265
  });
1266
1266
  }
1267
- function Jt(s) {
1267
+ function Yt(s) {
1268
1268
  const e = s.RTCPeerConnection.prototype.createOffer;
1269
1269
  s.RTCPeerConnection.prototype.createOffer = function(n) {
1270
1270
  if (n) {
@@ -1277,25 +1277,25 @@ function Jt(s) {
1277
1277
  return e.apply(this, arguments);
1278
1278
  };
1279
1279
  }
1280
- function Wt(s) {
1280
+ function Gt(s) {
1281
1281
  typeof s != "object" || s.AudioContext || (s.AudioContext = s.webkitAudioContext);
1282
1282
  }
1283
- const rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1283
+ const ot = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1284
1284
  __proto__: null,
1285
- shimAudioContext: Wt,
1286
- shimCallbacksAPI: Ft,
1287
- shimConstraints: Ht,
1288
- shimCreateOfferLegacy: Jt,
1289
- shimGetUserMedia: jt,
1290
- shimLocalStreamsAPI: Nt,
1291
- shimRTCIceServerUrls: Vt,
1292
- shimRemoteStreamsAPI: qt,
1293
- shimTrackEventTransceiver: Kt
1285
+ shimAudioContext: Gt,
1286
+ shimCallbacksAPI: Ht,
1287
+ shimConstraints: Kt,
1288
+ shimCreateOfferLegacy: Yt,
1289
+ shimGetUserMedia: Vt,
1290
+ shimLocalStreamsAPI: Ft,
1291
+ shimRTCIceServerUrls: Jt,
1292
+ shimRemoteStreamsAPI: jt,
1293
+ shimTrackEventTransceiver: Wt
1294
1294
  }, Symbol.toStringTag, { value: "Module" }));
1295
- function On(s) {
1295
+ function Bn(s) {
1296
1296
  return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
1297
1297
  }
1298
- var Yt = { exports: {} };
1298
+ var Qt = { exports: {} };
1299
1299
  (function(s) {
1300
1300
  const e = {};
1301
1301
  e.generateIdentifier = function() {
@@ -1552,7 +1552,7 @@ a=ice-pwd:` + t.password + `\r
1552
1552
  }, e.parseRtpEncodingParameters = function(t) {
1553
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;
1554
1554
  let h;
1555
- const l = e.matchPrefix(t, "a=ssrc-group:FID").map((u) => u.substring(17).split(" ").map((g) => parseInt(g, 10)));
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) => {
1557
1557
  if (u.name.toUpperCase() === "RTX" && u.parameters.apt) {
1558
1558
  let f = {
@@ -1682,13 +1682,13 @@ t=0 0\r
1682
1682
  return !1;
1683
1683
  return !0;
1684
1684
  }, s.exports = e;
1685
- })(Yt);
1686
- var Gt = Yt.exports;
1687
- const $ = /* @__PURE__ */ On(Gt), Dn = /* @__PURE__ */ xn({
1685
+ })(Qt);
1686
+ var Xt = Qt.exports;
1687
+ const $ = /* @__PURE__ */ Bn(Xt), Un = /* @__PURE__ */ Pn({
1688
1688
  __proto__: null,
1689
1689
  default: $
1690
- }, [Gt]);
1691
- function G(s) {
1690
+ }, [Xt]);
1691
+ function Q(s) {
1692
1692
  if (!s.RTCIceCandidate || s.RTCIceCandidate && "foundation" in s.RTCIceCandidate.prototype)
1693
1693
  return;
1694
1694
  const e = s.RTCIceCandidate;
@@ -1711,13 +1711,13 @@ function G(s) {
1711
1711
  }, i;
1712
1712
  }
1713
1713
  return new e(n);
1714
- }, s.RTCIceCandidate.prototype = e.prototype, I(s, "icecandidate", (t) => (t.candidate && Object.defineProperty(t, "candidate", {
1714
+ }, s.RTCIceCandidate.prototype = e.prototype, A(s, "icecandidate", (t) => (t.candidate && Object.defineProperty(t, "candidate", {
1715
1715
  value: new s.RTCIceCandidate(t.candidate),
1716
1716
  writable: "false"
1717
1717
  }), t));
1718
1718
  }
1719
- function ve(s) {
1720
- !s.RTCIceCandidate || s.RTCIceCandidate && "relayProtocol" in s.RTCIceCandidate.prototype || I(s, "icecandidate", (e) => {
1719
+ function Ce(s) {
1720
+ !s.RTCIceCandidate || s.RTCIceCandidate && "relayProtocol" in s.RTCIceCandidate.prototype || A(s, "icecandidate", (e) => {
1721
1721
  if (e.candidate) {
1722
1722
  const t = $.parseCandidate(e.candidate.candidate);
1723
1723
  t.type === "relay" && (e.candidate.relayProtocol = {
@@ -1729,7 +1729,7 @@ function ve(s) {
1729
1729
  return e;
1730
1730
  });
1731
1731
  }
1732
- function Q(s, e) {
1732
+ function X(s, e) {
1733
1733
  if (!s.RTCPeerConnection || e.browser === "chrome" && e.version > 102 || e.browser === "firefox" && e.version >= 113)
1734
1734
  return;
1735
1735
  "sctp" in s.RTCPeerConnection.prototype || Object.defineProperty(s.RTCPeerConnection.prototype, "sctp", {
@@ -1788,7 +1788,7 @@ function Q(s, e) {
1788
1788
  return o.apply(this, arguments);
1789
1789
  };
1790
1790
  }
1791
- function X(s, e) {
1791
+ function Z(s, e) {
1792
1792
  if (!(s.RTCPeerConnection && "createDataChannel" in s.RTCPeerConnection.prototype) || e.browser === "chrome" && e.version >= 149 || e.browser === "firefox" && e.version > 60)
1793
1793
  return;
1794
1794
  function t(i, r) {
@@ -1804,9 +1804,9 @@ function X(s, e) {
1804
1804
  s.RTCPeerConnection.prototype.createDataChannel = function() {
1805
1805
  const r = n.apply(this, arguments);
1806
1806
  return t(r, this), r;
1807
- }, I(s, "datachannel", (i) => (t(i.channel, i.target), i));
1807
+ }, A(s, "datachannel", (i) => (t(i.channel, i.target), i));
1808
1808
  }
1809
- function Se(s) {
1809
+ function xe(s) {
1810
1810
  if (!s.RTCPeerConnection || "connectionState" in s.RTCPeerConnection.prototype)
1811
1811
  return;
1812
1812
  const e = s.RTCPeerConnection.prototype;
@@ -1852,7 +1852,7 @@ function Se(s) {
1852
1852
  };
1853
1853
  });
1854
1854
  }
1855
- function Ce(s, e) {
1855
+ function ke(s, e) {
1856
1856
  if (!s.RTCPeerConnection || e.browser === "chrome" && e.version >= 71 || e.browser === "safari" && e._safariVersion >= 13.1)
1857
1857
  return;
1858
1858
  const t = s.RTCPeerConnection.prototype.setRemoteDescription;
@@ -1870,7 +1870,7 @@ a=extmap-allow-mixed`) !== -1) {
1870
1870
  return t.apply(this, arguments);
1871
1871
  };
1872
1872
  }
1873
- function Z(s, e) {
1873
+ function ee(s, e) {
1874
1874
  if (!(s.RTCPeerConnection && s.RTCPeerConnection.prototype))
1875
1875
  return;
1876
1876
  const t = s.RTCPeerConnection.prototype.addIceCandidate;
@@ -1878,7 +1878,7 @@ function Z(s, e) {
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 ee(s, e) {
1881
+ function te(s, e) {
1882
1882
  if (!(s.RTCPeerConnection && s.RTCPeerConnection.prototype))
1883
1883
  return;
1884
1884
  const t = s.RTCPeerConnection.prototype.setLocalDescription;
@@ -1900,48 +1900,48 @@ function ee(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 Ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1903
+ const zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1904
1904
  __proto__: null,
1905
- removeExtmapAllowMixed: Ce,
1906
- shimAddIceCandidateNullOrEmpty: Z,
1907
- shimConnectionState: Se,
1908
- shimMaxMessageSize: Q,
1909
- shimParameterlessSetLocalDescription: ee,
1910
- shimRTCIceCandidate: G,
1911
- shimRTCIceCandidateRelayProtocol: ve,
1912
- shimSendThrowTypeError: X
1905
+ removeExtmapAllowMixed: ke,
1906
+ shimAddIceCandidateNullOrEmpty: ee,
1907
+ shimConnectionState: xe,
1908
+ shimMaxMessageSize: X,
1909
+ shimParameterlessSetLocalDescription: te,
1910
+ shimRTCIceCandidate: Q,
1911
+ shimRTCIceCandidateRelayProtocol: Ce,
1912
+ shimSendThrowTypeError: Z
1913
1913
  }, Symbol.toStringTag, { value: "Module" }));
1914
- function $n({ window: s } = {}, e = {
1914
+ function Nn({ window: s } = {}, e = {
1915
1915
  shimChrome: !0,
1916
1916
  shimFirefox: !0,
1917
1917
  shimSafari: !0
1918
1918
  }) {
1919
- const t = Le, n = An(s), i = {
1919
+ const t = Be, n = Ln(s), i = {
1920
1920
  browserDetails: n,
1921
- commonShim: Ln,
1921
+ commonShim: zn,
1922
1922
  extractVersion: F,
1923
- disableLog: En,
1924
- disableWarnings: Mn,
1923
+ disableLog: On,
1924
+ disableWarnings: Dn,
1925
1925
  // Expose sdp as a convenience. For production apps include directly.
1926
- sdp: Dn
1926
+ sdp: Un
1927
1927
  };
1928
1928
  switch (n.browser) {
1929
1929
  case "chrome":
1930
- if (!st || !be || !e.shimChrome)
1930
+ if (!it || !ve || !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 = st, Z(s, n), ee(s), St(s, n), Ct(s), be(s, n), kt(s, n), wt(s, n), xt(s), Tt(s, n), Pt(s, n), G(s), ve(s), Se(s), Q(s, n), X(s, n), Ce(s, n);
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);
1935
1935
  break;
1936
1936
  case "firefox":
1937
- if (!it || !_e || !e.shimFirefox)
1937
+ if (!rt || !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 = it, Z(s, n), ee(s), Et(s, n), _e(s, n), At(s, n), Mt(s), Dt(s), It(s), Ot(s), Lt(s), $t(s, n), Bt(s, n), Ut(s, n), zt(s, n), G(s), Se(s), Q(s, n), X(s, n);
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);
1940
1940
  break;
1941
1941
  case "safari":
1942
- if (!rt || !e.shimSafari)
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 = rt, Z(s, n), ee(s), Vt(s), Jt(s), Ft(s), Nt(s), qt(s), Kt(s), jt(s), Wt(s), G(s), ve(s), Q(s, n), X(s, n), Ce(s, n);
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);
1945
1945
  break;
1946
1946
  default:
1947
1947
  t("Unsupported browser!");
@@ -1949,11 +1949,11 @@ function $n({ window: s } = {}, e = {
1949
1949
  }
1950
1950
  return i;
1951
1951
  }
1952
- const ot = $n({ window: typeof window > "u" ? void 0 : window });
1952
+ const at = Nn({ window: typeof window > "u" ? void 0 : window });
1953
1953
  function O(s, e, t, n) {
1954
1954
  Object.defineProperty(s, e, { get: t, set: n, enumerable: !0, configurable: !0 });
1955
1955
  }
1956
- class Qt {
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);
@@ -1971,7 +1971,7 @@ class Qt {
1971
1971
  };
1972
1972
  }
1973
1973
  }
1974
- function Bn(s) {
1974
+ function qn(s) {
1975
1975
  let e = 0;
1976
1976
  for (const i of s) e += i.byteLength;
1977
1977
  const t = new Uint8Array(e);
@@ -1980,9 +1980,9 @@ function Bn(s) {
1980
1980
  t.set(i, n), n += i.byteLength;
1981
1981
  return t;
1982
1982
  }
1983
- const ue = (
1983
+ const fe = (
1984
1984
  //@ts-ignore
1985
- ot.default || ot
1985
+ at.default || at
1986
1986
  ), z = new class {
1987
1987
  isWebRTCSupported() {
1988
1988
  return typeof RTCPeerConnection < "u";
@@ -1992,13 +1992,13 @@ const ue = (
1992
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;
1993
1993
  }
1994
1994
  getBrowser() {
1995
- return ue.browserDetails.browser;
1995
+ return fe.browserDetails.browser;
1996
1996
  }
1997
1997
  getVersion() {
1998
- return ue.browserDetails.version || 0;
1998
+ return fe.browserDetails.version || 0;
1999
1999
  }
2000
2000
  isUnifiedPlanSupported() {
2001
- const s = this.getBrowser(), e = ue.browserDetails.version || 0;
2001
+ const s = this.getBrowser(), e = fe.browserDetails.version || 0;
2002
2002
  if (s === "chrome" && e < this.minChromeVersion) return !1;
2003
2003
  if (s === "firefox" && e >= this.minFirefoxVersion) return !0;
2004
2004
  if (!window.RTCRtpTransceiver || !("currentDirection" in RTCRtpTransceiver.prototype)) return !1;
@@ -2031,7 +2031,7 @@ const ue = (
2031
2031
  "safari"
2032
2032
  ], this.minFirefoxVersion = 59, this.minChromeVersion = 72, this.minSafariVersion = 605;
2033
2033
  }
2034
- }(), Un = (s) => !s || /^[A-Za-z0-9]+(?:[ _-][A-Za-z0-9]+)*$/.test(s), Xt = () => Math.random().toString(36).slice(2), at = {
2034
+ }(), Fn = (s) => !s || /^[A-Za-z0-9]+(?:[ _-][A-Za-z0-9]+)*$/.test(s), 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 ue = (
2047
2047
  ],
2048
2048
  sdpSemantics: "unified-plan"
2049
2049
  };
2050
- class zn extends Qt {
2050
+ class jn extends Zt {
2051
2051
  noop() {
2052
2052
  }
2053
2053
  blobToArrayBuffer(e, t) {
@@ -2070,7 +2070,7 @@ class zn extends Qt {
2070
2070
  Chrome: 1,
2071
2071
  chrome: 1
2072
2072
  }, // Returns browser-agnostic default config
2073
- this.defaultConfig = at, this.browser = z.getBrowser(), this.browserVersion = z.getVersion(), this.pack = yt, this.unpack = gt, /**
2073
+ this.defaultConfig = ct, this.browser = z.getBrowser(), this.browserVersion = z.getVersion(), this.pack = _t, 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
@@ -2089,7 +2089,7 @@ class zn extends Qt {
2089
2089
  if (!t.webRTC) return t;
2090
2090
  let n;
2091
2091
  try {
2092
- n = new RTCPeerConnection(at), t.audioVideo = !0;
2092
+ n = new RTCPeerConnection(ct), t.audioVideo = !0;
2093
2093
  let i;
2094
2094
  try {
2095
2095
  i = n.createDataChannel("_PEERJSTEST", {
@@ -2109,11 +2109,11 @@ class zn extends Qt {
2109
2109
  }
2110
2110
  return t;
2111
2111
  }(), // Ensure alphanumeric ids
2112
- this.validateId = Un, this.randomToken = Xt;
2112
+ this.validateId = Fn, this.randomToken = en;
2113
2113
  }
2114
2114
  }
2115
- const k = new zn(), Nn = "PeerJS: ";
2116
- class qn {
2115
+ const x = new jn(), Hn = "PeerJS: ";
2116
+ class Vn {
2117
2117
  get logLevel() {
2118
2118
  return this._logLevel;
2119
2119
  }
@@ -2134,7 +2134,7 @@ class qn {
2134
2134
  }
2135
2135
  _print(e, ...t) {
2136
2136
  const n = [
2137
- Nn,
2137
+ Hn,
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,22 +2144,22 @@ class qn {
2144
2144
  this._logLevel = 0;
2145
2145
  }
2146
2146
  }
2147
- var p = new qn(), Be = {}, Fn = Object.prototype.hasOwnProperty, C = "~";
2147
+ var p = new Vn(), ze = {}, Kn = 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) {
2151
+ function Jn(s, e, t) {
2152
2152
  this.fn = s, this.context = e, this.once = t || !1;
2153
2153
  }
2154
- function Zt(s, e, t, n, i) {
2154
+ function tn(s, 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;
2156
+ var r = new Jn(t, n || s, i), o = C ? C + e : e;
2157
2157
  return s._events[o] ? s._events[o].fn ? s._events[o] = [
2158
2158
  s._events[o],
2159
2159
  r
2160
2160
  ] : s._events[o].push(r) : (s._events[o] = r, s._eventsCount++), s;
2161
2161
  }
2162
- function te(s, e) {
2162
+ function ne(s, e) {
2163
2163
  --s._eventsCount === 0 ? s._events = new K() : delete s._events[e];
2164
2164
  }
2165
2165
  function S() {
@@ -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) Fn.call(t, n) && e.push(C ? n.slice(1) : n);
2171
+ for (n in t = this._events) Kn.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) {
@@ -2229,59 +2229,59 @@ S.prototype.emit = function(e, t, n, i, r, o) {
2229
2229
  return !0;
2230
2230
  };
2231
2231
  S.prototype.on = function(e, t, n) {
2232
- return Zt(this, e, t, n, !1);
2232
+ return tn(this, e, t, n, !1);
2233
2233
  };
2234
2234
  S.prototype.once = function(e, t, n) {
2235
- return Zt(this, e, t, n, !0);
2235
+ return tn(this, e, t, n, !0);
2236
2236
  };
2237
2237
  S.prototype.removeListener = function(e, t, n, i) {
2238
2238
  var r = C ? C + e : e;
2239
2239
  if (!this._events[r]) return this;
2240
2240
  if (!t)
2241
- return te(this, r), this;
2241
+ return ne(this, r), this;
2242
2242
  var o = this._events[r];
2243
2243
  if (o.fn)
2244
- o.fn === t && (!i || o.once) && (!n || o.context === n) && te(this, r);
2244
+ o.fn === t && (!i || o.once) && (!n || o.context === n) && ne(this, r);
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 : te(this, r);
2247
+ c.length ? this._events[r] = c.length === 1 ? c[0] : c : ne(this, r);
2248
2248
  }
2249
2249
  return this;
2250
2250
  };
2251
2251
  S.prototype.removeAllListeners = function(e) {
2252
2252
  var t;
2253
- return e ? (t = C ? C + e : e, this._events[t] && te(this, t)) : (this._events = new K(), this._eventsCount = 0), this;
2253
+ return e ? (t = C ? C + e : e, this._events[t] && ne(this, t)) : (this._events = new K(), this._eventsCount = 0), this;
2254
2254
  };
2255
2255
  S.prototype.off = S.prototype.removeListener;
2256
2256
  S.prototype.addListener = S.prototype.on;
2257
2257
  S.prefixed = C;
2258
2258
  S.EventEmitter = S;
2259
- Be = S;
2259
+ ze = S;
2260
2260
  var D = {};
2261
2261
  O(D, "ConnectionType", () => E);
2262
2262
  O(D, "PeerErrorType", () => y);
2263
- O(D, "BaseConnectionErrorType", () => ke);
2264
- O(D, "DataConnectionErrorType", () => Ue);
2265
- O(D, "SerializationType", () => ce);
2263
+ O(D, "BaseConnectionErrorType", () => Re);
2264
+ O(D, "DataConnectionErrorType", () => Ne);
2265
+ O(D, "SerializationType", () => le);
2266
2266
  O(D, "SocketEventType", () => P);
2267
2267
  O(D, "ServerMessageType", () => v);
2268
2268
  var E = /* @__PURE__ */ function(s) {
2269
2269
  return s.Data = "data", s.Media = "media", s;
2270
2270
  }({}), y = /* @__PURE__ */ function(s) {
2271
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
- }({}), ke = /* @__PURE__ */ function(s) {
2272
+ }({}), Re = /* @__PURE__ */ function(s) {
2273
2273
  return s.NegotiationFailed = "negotiation-failed", s.ConnectionClosed = "connection-closed", s;
2274
- }({}), Ue = /* @__PURE__ */ function(s) {
2274
+ }({}), Ne = /* @__PURE__ */ function(s) {
2275
2275
  return s.NotOpenYet = "not-open-yet", s.MessageToBig = "message-too-big", s;
2276
- }({}), ce = /* @__PURE__ */ function(s) {
2276
+ }({}), le = /* @__PURE__ */ function(s) {
2277
2277
  return s.Binary = "binary", s.BinaryUTF8 = "binary-utf8", s.JSON = "json", s.None = "raw", s;
2278
2278
  }({}), P = /* @__PURE__ */ function(s) {
2279
2279
  return s.Message = "message", s.Disconnected = "disconnected", s.Error = "error", s.Close = "close", s;
2280
2280
  }({}), v = /* @__PURE__ */ function(s) {
2281
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;
2282
2282
  }({});
2283
- const en = "1.5.5";
2284
- class Hn extends Be.EventEmitter {
2283
+ const nn = "1.5.5";
2284
+ class Wn extends ze.EventEmitter {
2285
2285
  constructor(e, t, n, i, r, o = 5e3) {
2286
2286
  super(), this.pingInterval = o, this._disconnected = !0, this._messagesQueue = [];
2287
2287
  const a = e ? "wss://" : "ws://";
@@ -2290,7 +2290,7 @@ class Hn extends Be.EventEmitter {
2290
2290
  start(e, t) {
2291
2291
  this._id = e;
2292
2292
  const n = `${this._baseUrl}&id=${e}&token=${t}`;
2293
- this._socket || !this._disconnected || (this._socket = new WebSocket(n + "&version=" + en), this._disconnected = !1, this._socket.onmessage = (i) => {
2293
+ this._socket || !this._disconnected || (this._socket = new WebSocket(n + "&version=" + nn), this._disconnected = !1, this._socket.onmessage = (i) => {
2294
2294
  let r;
2295
2295
  try {
2296
2296
  r = JSON.parse(i.data), p.log("Server message received:", r);
@@ -2354,7 +2354,7 @@ class Hn extends Be.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 tn {
2357
+ class sn {
2358
2358
  constructor(e) {
2359
2359
  this.connection = e;
2360
2360
  }
@@ -2390,10 +2390,10 @@ class tn {
2390
2390
  }, e.oniceconnectionstatechange = () => {
2391
2391
  switch (e.iceConnectionState) {
2392
2392
  case "failed":
2393
- p.log("iceConnectionState is failed, closing connections to " + t), this.connection.emitError(ke.NegotiationFailed, "Negotiation of connection to " + t + " failed."), this.connection.close();
2393
+ p.log("iceConnectionState is failed, closing connections to " + t), this.connection.emitError(Re.NegotiationFailed, "Negotiation of connection to " + t + " failed."), this.connection.close();
2394
2394
  break;
2395
2395
  case "closed":
2396
- p.log("iceConnectionState is closed, closing connections to " + t), this.connection.emitError(ke.ConnectionClosed, "Connection to " + t + " closed."), this.connection.close();
2396
+ p.log("iceConnectionState is closed, closing connections to " + t), this.connection.emitError(Re.ConnectionClosed, "Connection to " + t + " closed."), this.connection.close();
2397
2397
  break;
2398
2398
  case "disconnected":
2399
2399
  p.log("iceConnectionState changed to disconnected on the connection with " + t);
@@ -2515,17 +2515,17 @@ class tn {
2515
2515
  p.log(`add stream ${e.id} to media connection ${t.connectionId}`), t.addStream(e);
2516
2516
  }
2517
2517
  }
2518
- class nn extends Be.EventEmitter {
2518
+ class rn 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 Vn(`${e}`, t));
2525
+ p.error("Error:", t), this.emit("error", new Yn(`${e}`, t));
2526
2526
  }
2527
2527
  }
2528
- class Vn extends Error {
2528
+ class Yn extends Error {
2529
2529
  /**
2530
2530
  * @internal
2531
2531
  */
@@ -2533,7 +2533,7 @@ class Vn extends Error {
2533
2533
  typeof t == "string" ? super(t) : (super(), Object.assign(this, t)), this.type = e;
2534
2534
  }
2535
2535
  }
2536
- class sn extends nn {
2536
+ class on extends rn {
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.
@@ -2545,8 +2545,8 @@ class sn extends nn {
2545
2545
  super(), this.peer = e, this.provider = t, this.options = n, this._open = !1, this.metadata = n.metadata;
2546
2546
  }
2547
2547
  }
2548
- var Ae;
2549
- const H = class H extends sn {
2548
+ var Oe;
2549
+ const H = class H extends on {
2550
2550
  /**
2551
2551
  * For media connections, this is always 'media'.
2552
2552
  */
@@ -2560,7 +2560,7 @@ const H = class H extends sn {
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 + k.randomToken(), this._negotiator = new tn(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 sn(this), this._localStream && this._negotiator.startConnection({
2564
2564
  _stream: this._localStream,
2565
2565
  originator: !0
2566
2566
  });
@@ -2626,15 +2626,15 @@ const H = class H extends sn {
2626
2626
  this._negotiator && (this._negotiator.cleanup(), this._negotiator = null), this._localStream = null, this._remoteStream = null, this.provider && (this.provider._removeConnection(this), this.provider = null), this.options && this.options._stream && (this.options._stream = null), this.open && (this._open = !1, super.emit("close"));
2627
2627
  }
2628
2628
  };
2629
- Ae = new WeakMap(), U(H, Ae, H.ID_PREFIX = "mc_");
2630
- let oe = H;
2631
- class Kn {
2629
+ Oe = new WeakMap(), U(H, Oe, H.ID_PREFIX = "mc_");
2630
+ let ae = H;
2631
+ class Gn {
2632
2632
  constructor(e) {
2633
2633
  this._options = e;
2634
2634
  }
2635
2635
  _buildRequest(e) {
2636
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}`);
2637
- return a.searchParams.set("ts", `${Date.now()}${Math.random()}`), a.searchParams.set("version", en), fetch(a.href, {
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
  });
2640
2640
  }
@@ -2647,7 +2647,7 @@ class Kn {
2647
2647
  } catch (e) {
2648
2648
  p.error("Error retrieving ID", e);
2649
2649
  let t = "";
2650
- throw this._options.path === "/" && this._options.host !== k.CLOUD_HOST && (t = " If you passed in a `path` to your self-hosted PeerServer, you'll also need to pass in that same path when creating a new Peer."), new Error("Could not get an ID from the server." + t);
2650
+ throw this._options.path === "/" && this._options.host !== x.CLOUD_HOST && (t = " If you passed in a `path` to your self-hosted PeerServer, you'll also need to pass in that same path when creating a new Peer."), new Error("Could not get an ID from the server." + t);
2651
2651
  }
2652
2652
  }
2653
2653
  /** @deprecated */
@@ -2657,7 +2657,7 @@ class Kn {
2657
2657
  if (e.status !== 200) {
2658
2658
  if (e.status === 401) {
2659
2659
  let t = "";
2660
- throw this._options.host === k.CLOUD_HOST ? t = "It looks like you're using the cloud server. You can email team@peerjs.com to enable peer listing for your API key." : t = "You need to enable `allow_discovery` on your self-hosted PeerServer to use this feature.", new Error("It doesn't look like you have permission to list peers IDs. " + t);
2660
+ throw this._options.host === x.CLOUD_HOST ? t = "It looks like you're using the cloud server. You can email team@peerjs.com to enable peer listing for your API key." : t = "You need to enable `allow_discovery` on your self-hosted PeerServer to use this feature.", new Error("It doesn't look like you have permission to list peers IDs. " + t);
2661
2661
  }
2662
2662
  throw new Error(`Error. Status:${e.status}`);
2663
2663
  }
@@ -2667,13 +2667,13 @@ class Kn {
2667
2667
  }
2668
2668
  }
2669
2669
  }
2670
- var Ie, Oe;
2671
- const A = class A extends sn {
2670
+ var De, Le;
2671
+ const I = class I extends on {
2672
2672
  get type() {
2673
2673
  return E.Data;
2674
2674
  }
2675
2675
  constructor(e, t, n) {
2676
- super(e, t, n), this.connectionId = this.options.connectionId || A.ID_PREFIX + Xt(), this.label = this.options.label || this.connectionId, this.reliable = !!this.options.reliable, this._negotiator = new tn(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 sn(this), this._negotiator.startConnection(this.options._payload || {
2677
2677
  originator: !0,
2678
2678
  reliable: this.reliable
2679
2679
  });
@@ -2706,7 +2706,7 @@ const A = class A extends sn {
2706
2706
  /** Allows user to send data. */
2707
2707
  send(e, t = !1) {
2708
2708
  if (!this.open) {
2709
- this.emitError(Ue.NotOpenYet, "Connection is not open. You should listen for the `open` event before sending messages.");
2709
+ this.emitError(Ne.NotOpenYet, "Connection is not open. You should listen for the `open` event before sending messages.");
2710
2710
  return;
2711
2711
  }
2712
2712
  return this._send(e, t);
@@ -2726,9 +2726,9 @@ const A = class A extends sn {
2726
2726
  }
2727
2727
  }
2728
2728
  };
2729
- Ie = new WeakMap(), Oe = new WeakMap(), U(A, Ie, A.ID_PREFIX = "dc_"), U(A, Oe, A.MAX_BUFFERED_AMOUNT = 8388608);
2730
- let ae = A;
2731
- class ze extends ae {
2729
+ De = new WeakMap(), Le = new WeakMap(), U(I, De, I.ID_PREFIX = "dc_"), U(I, Le, I.MAX_BUFFERED_AMOUNT = 8388608);
2730
+ let ce = I;
2731
+ class qe extends ce {
2732
2732
  get bufferSize() {
2733
2733
  return this._bufferSize;
2734
2734
  }
@@ -2741,7 +2741,7 @@ class ze extends ae {
2741
2741
  // Returns true if the send succeeds.
2742
2742
  _trySend(e) {
2743
2743
  if (!this.open) return !1;
2744
- if (this.dataChannel.bufferedAmount > ae.MAX_BUFFERED_AMOUNT)
2744
+ if (this.dataChannel.bufferedAmount > ce.MAX_BUFFERED_AMOUNT)
2745
2745
  return this._buffering = !0, setTimeout(() => {
2746
2746
  this._buffering = !1, this._tryBuffer();
2747
2747
  }, 50), !1;
@@ -2773,16 +2773,16 @@ class ze extends ae {
2773
2773
  super(...e), this._buffer = [], this._bufferSize = 0, this._buffering = !1;
2774
2774
  }
2775
2775
  }
2776
- class pe extends ze {
2776
+ class ge extends qe {
2777
2777
  close(e) {
2778
2778
  super.close(e), this._chunkedData = {};
2779
2779
  }
2780
2780
  constructor(e, t, n) {
2781
- super(e, t, n), this.chunker = new Qt(), this.serialization = ce.Binary, this._chunkedData = {};
2781
+ super(e, t, n), this.chunker = new Zt(), this.serialization = le.Binary, this._chunkedData = {};
2782
2782
  }
2783
2783
  // Handles a DataChannel message.
2784
2784
  _handleDataMessage({ data: e }) {
2785
- const t = gt(e), n = t.__peerData;
2785
+ const t = bt(e), n = t.__peerData;
2786
2786
  if (n) {
2787
2787
  if (n.type === "close") {
2788
2788
  this.close();
@@ -2801,14 +2801,14 @@ class pe extends ze {
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 = Bn(n.data);
2804
+ const i = qn(n.data);
2805
2805
  this._handleDataMessage({
2806
2806
  data: i
2807
2807
  });
2808
2808
  }
2809
2809
  }
2810
2810
  _send(e, t) {
2811
- const n = yt(e);
2811
+ const n = _t(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 pe extends ze {
2830
2830
  for (const n of t) this.send(n, !0);
2831
2831
  }
2832
2832
  }
2833
- class Jn extends ze {
2833
+ class Qn extends qe {
2834
2834
  _handleDataMessage({ data: e }) {
2835
2835
  super.emit("data", e);
2836
2836
  }
@@ -2838,10 +2838,10 @@ class Jn extends ze {
2838
2838
  this._bufferedSend(e);
2839
2839
  }
2840
2840
  constructor(...e) {
2841
- super(...e), this.serialization = ce.None;
2841
+ super(...e), this.serialization = le.None;
2842
2842
  }
2843
2843
  }
2844
- class Wn extends ze {
2844
+ class Xn extends qe {
2845
2845
  // Handles a DataChannel message.
2846
2846
  _handleDataMessage({ data: e }) {
2847
2847
  const t = this.parse(this.decoder.decode(e)), n = t.__peerData;
@@ -2853,18 +2853,18 @@ class Wn extends ze {
2853
2853
  }
2854
2854
  _send(e, t) {
2855
2855
  const n = this.encoder.encode(this.stringify(e));
2856
- if (n.byteLength >= k.chunkedMTU) {
2857
- this.emitError(Ue.MessageToBig, "Message too big for JSON channel");
2856
+ if (n.byteLength >= x.chunkedMTU) {
2857
+ this.emitError(Ne.MessageToBig, "Message too big for JSON channel");
2858
2858
  return;
2859
2859
  }
2860
2860
  this._bufferedSend(n);
2861
2861
  }
2862
2862
  constructor(...e) {
2863
- super(...e), this.serialization = ce.JSON, this.encoder = new TextEncoder(), this.decoder = new TextDecoder(), this.stringify = JSON.stringify, this.parse = JSON.parse;
2863
+ super(...e), this.serialization = le.JSON, this.encoder = new TextEncoder(), this.decoder = new TextDecoder(), this.stringify = JSON.stringify, this.parse = JSON.parse;
2864
2864
  }
2865
2865
  }
2866
- var De;
2867
- const V = class V extends nn {
2866
+ var $e;
2867
+ const V = class V extends rn {
2868
2868
  /**
2869
2869
  * The brokering ID of this peer
2870
2870
  *
@@ -2910,40 +2910,40 @@ const V = class V extends nn {
2910
2910
  }
2911
2911
  constructor(e, t) {
2912
2912
  super(), this._serializers = {
2913
- raw: Jn,
2914
- json: Wn,
2915
- binary: pe,
2916
- "binary-utf8": pe,
2917
- default: pe
2913
+ raw: Qn,
2914
+ json: Xn,
2915
+ binary: ge,
2916
+ "binary-utf8": ge,
2917
+ default: ge
2918
2918
  }, this._id = null, this._lastServerId = null, // States.
2919
2919
  this._destroyed = !1, this._disconnected = !1, this._open = !1, this._connections = /* @__PURE__ */ new Map(), this._lostMessages = /* @__PURE__ */ new Map();
2920
2920
  let n;
2921
2921
  if (e && e.constructor == Object ? t = e : e && (n = e.toString()), t = {
2922
2922
  debug: 0,
2923
- host: k.CLOUD_HOST,
2924
- port: k.CLOUD_PORT,
2923
+ host: x.CLOUD_HOST,
2924
+ port: x.CLOUD_PORT,
2925
2925
  path: "/",
2926
2926
  key: V.DEFAULT_KEY,
2927
- token: k.randomToken(),
2928
- config: k.defaultConfig,
2927
+ token: x.randomToken(),
2928
+ config: x.defaultConfig,
2929
2929
  referrerPolicy: "strict-origin-when-cross-origin",
2930
2930
  serializers: {},
2931
2931
  ...t
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 !== k.CLOUD_HOST ? this._options.secure = k.isSecure() : this._options.host == k.CLOUD_HOST && (this._options.secure = !0), this._options.logFunction && p.setLogFunction(this._options.logFunction), p.logLevel = this._options.debug || 0, this._api = new Kn(t), this._socket = this._createServerConnection(), !k.supports.audioVideo && !k.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 Gn(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
  }
2939
- if (n && !k.validateId(n)) {
2939
+ if (n && !x.validateId(n)) {
2940
2940
  this._delayedAbort(y.InvalidID, `ID "${n}" is invalid`);
2941
2941
  return;
2942
2942
  }
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 Hn(this._options.secure, this._options.host, this._options.port, this._options.path, this._options.key, this._options.pingInterval);
2946
+ const e = new Wn(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) => {
@@ -2984,7 +2984,7 @@ const V = class V extends nn {
2984
2984
  const r = n.connectionId;
2985
2985
  let o = this.getConnection(i, r);
2986
2986
  if (o && (o.close(), p.warn(`Offer received for existing Connection ID:${r}`)), n.type === E.Media) {
2987
- const c = new oe(i, this, {
2987
+ const c = new ae(i, this, {
2988
2988
  connectionId: r,
2989
2989
  _payload: n,
2990
2990
  metadata: n.metadata
@@ -3063,7 +3063,7 @@ const V = class V extends nn {
3063
3063
  p.error("To call a peer, you must provide a stream from your browser's `getUserMedia`.");
3064
3064
  return;
3065
3065
  }
3066
- const i = new oe(e, this, {
3066
+ const i = new ae(e, this, {
3067
3067
  ...n,
3068
3068
  _stream: t
3069
3069
  });
@@ -3167,10 +3167,10 @@ const V = class V extends nn {
3167
3167
  this._api.listAllPeers().then((t) => e(t)).catch((t) => this._abort(y.ServerError, t));
3168
3168
  }
3169
3169
  };
3170
- De = new WeakMap(), U(V, De, V.DEFAULT_KEY = "peerjs");
3171
- let xe = V;
3172
- var Yn = xe;
3173
- class Gn {
3170
+ $e = new WeakMap(), U(V, $e, V.DEFAULT_KEY = "peerjs");
3171
+ let Te = V;
3172
+ var Zn = Te;
3173
+ class es {
3174
3174
  constructor(e) {
3175
3175
  this.config = e, this.peer = null, this.localStream = null, this.connections = {}, this.callbacks = {
3176
3176
  onStream: null,
@@ -3189,7 +3189,7 @@ class Gn {
3189
3189
  async initialize(e, t = 0) {
3190
3190
  return new Promise((n, i) => {
3191
3191
  const r = t === 0 ? e : `${e}-r${Math.random().toString(36).slice(2, 6)}`;
3192
- this.peer = new Yn(r, {
3192
+ this.peer = new Zn(r, {
3193
3193
  host: this.config.peerServer.host,
3194
3194
  port: this.config.peerServer.port,
3195
3195
  path: this.config.peerServer.path || "/peerjs",
@@ -3370,63 +3370,63 @@ w.pong = "3";
3370
3370
  w.message = "4";
3371
3371
  w.upgrade = "5";
3372
3372
  w.noop = "6";
3373
- const ne = /* @__PURE__ */ Object.create(null);
3373
+ const se = /* @__PURE__ */ Object.create(null);
3374
3374
  Object.keys(w).forEach((s) => {
3375
- ne[w[s]] = s;
3375
+ se[w[s]] = s;
3376
3376
  });
3377
- const Te = { type: "error", data: "parser error" }, rn = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", on = typeof ArrayBuffer == "function", an = (s) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(s) : s && s.buffer instanceof ArrayBuffer, Ne = ({ type: s, data: e }, t, n) => rn && e instanceof Blob ? t ? n(e) : ct(e, n) : on && (e instanceof ArrayBuffer || an(e)) ? t ? n(e) : ct(new Blob([e]), n) : n(w[s] + (e || "")), ct = (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 = (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) => {
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
3382
  }, t.readAsDataURL(s);
3383
3383
  };
3384
- function ht(s) {
3384
+ function lt(s) {
3385
3385
  return s instanceof Uint8Array ? s : s instanceof ArrayBuffer ? new Uint8Array(s) : new Uint8Array(s.buffer, s.byteOffset, s.byteLength);
3386
3386
  }
3387
- let fe;
3388
- function Qn(s, e) {
3389
- if (rn && s.data instanceof Blob)
3390
- return s.data.arrayBuffer().then(ht).then(e);
3391
- if (on && (s.data instanceof ArrayBuffer || an(s.data)))
3392
- return e(ht(s.data));
3393
- Ne(s, !1, (t) => {
3394
- fe || (fe = new TextEncoder()), e(fe.encode(t));
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) => {
3394
+ me || (me = new TextEncoder()), e(me.encode(t));
3395
3395
  });
3396
3396
  }
3397
- const lt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", j = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
3398
- for (let s = 0; s < lt.length; s++)
3399
- j[lt.charCodeAt(s)] = s;
3400
- const Xn = (s) => {
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
3401
  let e = s.length * 0.75, t = s.length, n, i = 0, r, o, a, c;
3402
3402
  s[s.length - 1] === "=" && (e--, s[s.length - 2] === "=" && e--);
3403
3403
  const h = new ArrayBuffer(e), l = new Uint8Array(h);
3404
3404
  for (n = 0; n < t; n += 4)
3405
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;
3406
3406
  return h;
3407
- }, Zn = typeof ArrayBuffer == "function", qe = (s, e) => {
3407
+ }, ss = typeof ArrayBuffer == "function", je = (s, e) => {
3408
3408
  if (typeof s != "string")
3409
3409
  return {
3410
3410
  type: "message",
3411
- data: cn(s, e)
3411
+ data: ln(s, e)
3412
3412
  };
3413
3413
  const t = s.charAt(0);
3414
3414
  return t === "b" ? {
3415
3415
  type: "message",
3416
- data: es(s.substring(1), e)
3417
- } : ne[t] ? s.length > 1 ? {
3418
- type: ne[t],
3416
+ data: is(s.substring(1), e)
3417
+ } : se[t] ? s.length > 1 ? {
3418
+ type: se[t],
3419
3419
  data: s.substring(1)
3420
3420
  } : {
3421
- type: ne[t]
3422
- } : Te;
3423
- }, es = (s, e) => {
3424
- if (Zn) {
3425
- const t = Xn(s);
3426
- return cn(t, e);
3421
+ type: se[t]
3422
+ } : we;
3423
+ }, is = (s, e) => {
3424
+ if (ss) {
3425
+ const t = ns(s);
3426
+ return ln(t, e);
3427
3427
  } else
3428
3428
  return { base64: !0, data: s };
3429
- }, cn = (s, e) => {
3429
+ }, ln = (s, e) => {
3430
3430
  switch (e) {
3431
3431
  case "blob":
3432
3432
  return s instanceof Blob ? s : new Blob([s]);
@@ -3434,27 +3434,27 @@ const Xn = (s) => {
3434
3434
  default:
3435
3435
  return s instanceof ArrayBuffer ? s : s.buffer;
3436
3436
  }
3437
- }, hn = "", ts = (s, e) => {
3437
+ }, dn = "", rs = (s, e) => {
3438
3438
  const t = s.length, n = new Array(t);
3439
3439
  let i = 0;
3440
3440
  s.forEach((r, o) => {
3441
- Ne(r, !1, (a) => {
3442
- n[o] = a, ++i === t && e(n.join(hn));
3441
+ Fe(r, !1, (a) => {
3442
+ n[o] = a, ++i === t && e(n.join(dn));
3443
3443
  });
3444
3444
  });
3445
- }, ns = (s, e) => {
3446
- const t = s.split(hn), n = [];
3445
+ }, os = (s, e) => {
3446
+ const t = s.split(dn), n = [];
3447
3447
  for (let i = 0; i < t.length; i++) {
3448
- const r = qe(t[i], e);
3448
+ const r = je(t[i], e);
3449
3449
  if (n.push(r), r.type === "error")
3450
3450
  break;
3451
3451
  }
3452
3452
  return n;
3453
3453
  };
3454
- function ss() {
3454
+ function as() {
3455
3455
  return new TransformStream({
3456
3456
  transform(s, e) {
3457
- Qn(s, (t) => {
3457
+ ts(s, (t) => {
3458
3458
  const n = t.length;
3459
3459
  let i;
3460
3460
  if (n < 126)
@@ -3473,7 +3473,7 @@ function ss() {
3473
3473
  }
3474
3474
  });
3475
3475
  }
3476
- let me;
3476
+ let ye;
3477
3477
  function J(s) {
3478
3478
  return s.reduce((e, t) => e + t.length, 0);
3479
3479
  }
@@ -3486,8 +3486,8 @@ function W(s, e) {
3486
3486
  t[i] = s[0][n++], n === s[0].length && (s.shift(), n = 0);
3487
3487
  return s.length && n < s[0].length && (s[0] = s[0].slice(n)), t;
3488
3488
  }
3489
- function is(s, e) {
3490
- me || (me = new TextDecoder());
3489
+ function cs(s, e) {
3490
+ ye || (ye = new TextDecoder());
3491
3491
  const t = [];
3492
3492
  let n = 0, i = -1, r = !1;
3493
3493
  return new TransformStream({
@@ -3508,7 +3508,7 @@ function is(s, e) {
3508
3508
  break;
3509
3509
  const c = W(t, 8), h = new DataView(c.buffer, c.byteOffset, c.length), l = h.getUint32(0);
3510
3510
  if (l > Math.pow(2, 21) - 1) {
3511
- a.enqueue(Te);
3511
+ a.enqueue(we);
3512
3512
  break;
3513
3513
  }
3514
3514
  i = l * Math.pow(2, 32) + h.getUint32(4), n = 3;
@@ -3516,21 +3516,21 @@ function is(s, e) {
3516
3516
  if (J(t) < i)
3517
3517
  break;
3518
3518
  const c = W(t, i);
3519
- a.enqueue(qe(r ? c : me.decode(c), e)), n = 0;
3519
+ a.enqueue(je(r ? c : ye.decode(c), e)), n = 0;
3520
3520
  }
3521
3521
  if (i === 0 || i > s) {
3522
- a.enqueue(Te);
3522
+ a.enqueue(we);
3523
3523
  break;
3524
3524
  }
3525
3525
  }
3526
3526
  }
3527
3527
  });
3528
3528
  }
3529
- const ln = 4;
3529
+ const un = 4;
3530
3530
  function b(s) {
3531
- if (s) return rs(s);
3531
+ if (s) return hs(s);
3532
3532
  }
3533
- function rs(s) {
3533
+ function hs(s) {
3534
3534
  for (var e in b.prototype)
3535
3535
  s[e] = b.prototype[e];
3536
3536
  return s;
@@ -3576,34 +3576,34 @@ b.prototype.listeners = function(s) {
3576
3576
  b.prototype.hasListeners = function(s) {
3577
3577
  return !!this.listeners(s).length;
3578
3578
  };
3579
- const he = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), x = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), os = "arraybuffer";
3580
- function dn(s, ...e) {
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
3581
  return e.reduce((t, n) => (s.hasOwnProperty(n) && (t[n] = s[n]), t), {});
3582
3582
  }
3583
- const as = x.setTimeout, cs = x.clearTimeout;
3584
- function le(s, e) {
3585
- e.useNativeTimers ? (s.setTimeoutFn = as.bind(x), s.clearTimeoutFn = cs.bind(x)) : (s.setTimeoutFn = x.setTimeout.bind(x), s.clearTimeoutFn = x.clearTimeout.bind(x));
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));
3586
3586
  }
3587
- const hs = 1.33;
3588
- function ls(s) {
3589
- return typeof s == "string" ? ds(s) : Math.ceil((s.byteLength || s.size) * hs);
3587
+ const ps = 1.33;
3588
+ function fs(s) {
3589
+ return typeof s == "string" ? gs(s) : Math.ceil((s.byteLength || s.size) * ps);
3590
3590
  }
3591
- function ds(s) {
3591
+ function gs(s) {
3592
3592
  let e = 0, t = 0;
3593
3593
  for (let n = 0, i = s.length; n < i; n++)
3594
3594
  e = s.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
- function un() {
3597
+ function fn() {
3598
3598
  return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
3599
3599
  }
3600
- function us(s) {
3600
+ function ms(s) {
3601
3601
  let e = "";
3602
3602
  for (let t in s)
3603
3603
  s.hasOwnProperty(t) && (e.length && (e += "&"), e += encodeURIComponent(t) + "=" + encodeURIComponent(s[t]));
3604
3604
  return e;
3605
3605
  }
3606
- function ps(s) {
3606
+ function ys(s) {
3607
3607
  let e = {}, t = s.split("&");
3608
3608
  for (let n = 0, i = t.length; n < i; n++) {
3609
3609
  let r = t[n].split("=");
@@ -3611,12 +3611,12 @@ function ps(s) {
3611
3611
  }
3612
3612
  return e;
3613
3613
  }
3614
- class fs extends Error {
3614
+ class bs extends Error {
3615
3615
  constructor(e, t, n) {
3616
3616
  super(e), this.description = t, this.context = n, this.type = "TransportError";
3617
3617
  }
3618
3618
  }
3619
- class Fe extends b {
3619
+ class He extends b {
3620
3620
  /**
3621
3621
  * Transport abstract constructor.
3622
3622
  *
@@ -3624,7 +3624,7 @@ class Fe extends b {
3624
3624
  * @protected
3625
3625
  */
3626
3626
  constructor(e) {
3627
- super(), this.writable = !1, le(this, e), this.opts = e, this.query = e.query, this.socket = e.socket, this.supportsBinary = !e.forceBase64;
3627
+ super(), this.writable = !1, ue(this, e), this.opts = e, this.query = e.query, this.socket = e.socket, this.supportsBinary = !e.forceBase64;
3628
3628
  }
3629
3629
  /**
3630
3630
  * Emits an error.
@@ -3636,7 +3636,7 @@ class Fe extends b {
3636
3636
  * @protected
3637
3637
  */
3638
3638
  onError(e, t, n) {
3639
- return super.emitReserved("error", new fs(e, t, n)), this;
3639
+ return super.emitReserved("error", new bs(e, t, n)), this;
3640
3640
  }
3641
3641
  /**
3642
3642
  * Opens the transport.
@@ -3673,7 +3673,7 @@ class Fe extends b {
3673
3673
  * @protected
3674
3674
  */
3675
3675
  onData(e) {
3676
- const t = qe(e, this.socket.binaryType);
3676
+ const t = je(e, this.socket.binaryType);
3677
3677
  this.onPacket(t);
3678
3678
  }
3679
3679
  /**
@@ -3710,11 +3710,11 @@ class Fe 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 = us(e);
3713
+ const t = ms(e);
3714
3714
  return t.length ? "?" + t : "";
3715
3715
  }
3716
3716
  }
3717
- class ms extends Fe {
3717
+ class _s extends He {
3718
3718
  constructor() {
3719
3719
  super(...arguments), this._polling = !1;
3720
3720
  }
@@ -3770,7 +3770,7 @@ class ms extends Fe {
3770
3770
  return this.onClose({ description: "transport closed by the server" }), !1;
3771
3771
  this.onPacket(n);
3772
3772
  };
3773
- ns(e, this.socket.binaryType).forEach(t), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
3773
+ os(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 ms extends Fe {
3790
3790
  * @protected
3791
3791
  */
3792
3792
  write(e) {
3793
- this.writable = !1, ts(e, (t) => {
3793
+ this.writable = !1, rs(e, (t) => {
3794
3794
  this.doWrite(t, () => {
3795
3795
  this.writable = !0, this.emitReserved("drain");
3796
3796
  });
@@ -3803,18 +3803,18 @@ class ms extends Fe {
3803
3803
  */
3804
3804
  uri() {
3805
3805
  const e = this.opts.secure ? "https" : "http", t = this.query || {};
3806
- return this.opts.timestampRequests !== !1 && (t[this.opts.timestampParam] = un()), !this.supportsBinary && !t.sid && (t.b64 = 1), this.createUri(e, t);
3806
+ return this.opts.timestampRequests !== !1 && (t[this.opts.timestampParam] = fn()), !this.supportsBinary && !t.sid && (t.b64 = 1), this.createUri(e, t);
3807
3807
  }
3808
3808
  }
3809
- let pn = !1;
3809
+ let gn = !1;
3810
3810
  try {
3811
- pn = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
3811
+ gn = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
3812
3812
  } catch {
3813
3813
  }
3814
- const gs = pn;
3815
- function ys() {
3814
+ const vs = gn;
3815
+ function Ss() {
3816
3816
  }
3817
- class bs extends ms {
3817
+ class Cs extends _s {
3818
3818
  /**
3819
3819
  * XHR Polling constructor.
3820
3820
  *
@@ -3856,7 +3856,7 @@ class bs extends ms {
3856
3856
  }), this.pollXhr = e;
3857
3857
  }
3858
3858
  }
3859
- class R extends b {
3859
+ class T extends b {
3860
3860
  /**
3861
3861
  * Request constructor
3862
3862
  *
@@ -3864,7 +3864,7 @@ class R extends b {
3864
3864
  * @package
3865
3865
  */
3866
3866
  constructor(e, t, n) {
3867
- super(), this.createRequest = e, le(this, n), this._opts = n, this._method = n.method || "GET", this._uri = t, this._data = n.data !== void 0 ? n.data : null, this._create();
3867
+ super(), this.createRequest = e, ue(this, n), this._opts = n, this._method = n.method || "GET", this._uri = t, this._data = n.data !== void 0 ? n.data : null, this._create();
3868
3868
  }
3869
3869
  /**
3870
3870
  * Creates the XHR object and sends the request.
@@ -3873,7 +3873,7 @@ class R extends b {
3873
3873
  */
3874
3874
  _create() {
3875
3875
  var e;
3876
- const t = dn(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
3876
+ const t = pn(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
3877
3877
  t.xdomain = !!this._opts.xd;
3878
3878
  const n = this._xhr = this.createRequest(t);
3879
3879
  try {
@@ -3910,7 +3910,7 @@ class R extends b {
3910
3910
  }, 0);
3911
3911
  return;
3912
3912
  }
3913
- typeof document < "u" && (this._index = R.requestsCount++, R.requests[this._index] = this);
3913
+ typeof document < "u" && (this._index = T.requestsCount++, T.requests[this._index] = this);
3914
3914
  }
3915
3915
  /**
3916
3916
  * Called upon error.
@@ -3927,12 +3927,12 @@ class R extends b {
3927
3927
  */
3928
3928
  _cleanup(e) {
3929
3929
  if (!(typeof this._xhr > "u" || this._xhr === null)) {
3930
- if (this._xhr.onreadystatechange = ys, e)
3930
+ if (this._xhr.onreadystatechange = Ss, e)
3931
3931
  try {
3932
3932
  this._xhr.abort();
3933
3933
  } catch {
3934
3934
  }
3935
- typeof document < "u" && delete R.requests[this._index], this._xhr = null;
3935
+ typeof document < "u" && delete T.requests[this._index], this._xhr = null;
3936
3936
  }
3937
3937
  }
3938
3938
  /**
@@ -3953,56 +3953,56 @@ class R extends b {
3953
3953
  this._cleanup();
3954
3954
  }
3955
3955
  }
3956
- R.requestsCount = 0;
3957
- R.requests = {};
3956
+ T.requestsCount = 0;
3957
+ T.requests = {};
3958
3958
  if (typeof document < "u") {
3959
3959
  if (typeof attachEvent == "function")
3960
- attachEvent("onunload", dt);
3960
+ attachEvent("onunload", ut);
3961
3961
  else if (typeof addEventListener == "function") {
3962
- const s = "onpagehide" in x ? "pagehide" : "unload";
3963
- addEventListener(s, dt, !1);
3962
+ const s = "onpagehide" in k ? "pagehide" : "unload";
3963
+ addEventListener(s, ut, !1);
3964
3964
  }
3965
3965
  }
3966
- function dt() {
3967
- for (let s in R.requests)
3968
- R.requests.hasOwnProperty(s) && R.requests[s].abort();
3966
+ function ut() {
3967
+ for (let s in T.requests)
3968
+ T.requests.hasOwnProperty(s) && T.requests[s].abort();
3969
3969
  }
3970
- const _s = function() {
3971
- const s = fn({
3970
+ const xs = function() {
3971
+ const s = mn({
3972
3972
  xdomain: !1
3973
3973
  });
3974
3974
  return s && s.responseType !== null;
3975
3975
  }();
3976
- class vs extends bs {
3976
+ class ks extends Cs {
3977
3977
  constructor(e) {
3978
3978
  super(e);
3979
3979
  const t = e && e.forceBase64;
3980
- this.supportsBinary = _s && !t;
3980
+ this.supportsBinary = xs && !t;
3981
3981
  }
3982
3982
  request(e = {}) {
3983
- return Object.assign(e, { xd: this.xd }, this.opts), new R(fn, this.uri(), e);
3983
+ return Object.assign(e, { xd: this.xd }, this.opts), new T(mn, this.uri(), e);
3984
3984
  }
3985
3985
  }
3986
- function fn(s) {
3986
+ function mn(s) {
3987
3987
  const e = s.xdomain;
3988
3988
  try {
3989
- if (typeof XMLHttpRequest < "u" && (!e || gs))
3989
+ if (typeof XMLHttpRequest < "u" && (!e || vs))
3990
3990
  return new XMLHttpRequest();
3991
3991
  } catch {
3992
3992
  }
3993
3993
  if (!e)
3994
3994
  try {
3995
- return new x[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP");
3995
+ return new k[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP");
3996
3996
  } catch {
3997
3997
  }
3998
3998
  }
3999
- const mn = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
4000
- class Ss extends Fe {
3999
+ const yn = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
4000
+ class Rs extends He {
4001
4001
  get name() {
4002
4002
  return "websocket";
4003
4003
  }
4004
4004
  doOpen() {
4005
- const e = this.uri(), t = this.opts.protocols, n = mn ? {} : dn(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");
4005
+ const e = this.uri(), t = this.opts.protocols, n = yn ? {} : pn(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");
4006
4006
  this.opts.extraHeaders && (n.headers = this.opts.extraHeaders);
4007
4007
  try {
4008
4008
  this.ws = this.createSocket(e, t, n);
@@ -4028,12 +4028,12 @@ class Ss extends Fe {
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
- Ne(n, this.supportsBinary, (r) => {
4031
+ Fe(n, this.supportsBinary, (r) => {
4032
4032
  try {
4033
4033
  this.doWrite(n, r);
4034
4034
  } catch {
4035
4035
  }
4036
- i && he(() => {
4036
+ i && de(() => {
4037
4037
  this.writable = !0, this.emitReserved("drain");
4038
4038
  }, this.setTimeoutFn);
4039
4039
  });
@@ -4050,19 +4050,19 @@ class Ss extends Fe {
4050
4050
  */
4051
4051
  uri() {
4052
4052
  const e = this.opts.secure ? "wss" : "ws", t = this.query || {};
4053
- return this.opts.timestampRequests && (t[this.opts.timestampParam] = un()), this.supportsBinary || (t.b64 = 1), this.createUri(e, t);
4053
+ return this.opts.timestampRequests && (t[this.opts.timestampParam] = fn()), this.supportsBinary || (t.b64 = 1), this.createUri(e, t);
4054
4054
  }
4055
4055
  }
4056
- const ge = x.WebSocket || x.MozWebSocket;
4057
- class Cs extends Ss {
4056
+ const be = k.WebSocket || k.MozWebSocket;
4057
+ class Ts extends Rs {
4058
4058
  createSocket(e, t, n) {
4059
- return mn ? new ge(e, t, n) : t ? new ge(e, t) : new ge(e);
4059
+ return yn ? new be(e, t, n) : t ? new be(e, t) : new be(e);
4060
4060
  }
4061
4061
  doWrite(e, t) {
4062
4062
  this.ws.send(t);
4063
4063
  }
4064
4064
  }
4065
- class ks extends Fe {
4065
+ class ws extends He {
4066
4066
  get name() {
4067
4067
  return "webtransport";
4068
4068
  }
@@ -4078,7 +4078,7 @@ class ks extends Fe {
4078
4078
  this.onError("webtransport error", e);
4079
4079
  }), this._transport.ready.then(() => {
4080
4080
  this._transport.createBidirectionalStream().then((e) => {
4081
- const t = is(Number.MAX_SAFE_INTEGER, this.socket.binaryType), n = e.readable.pipeThrough(t).getReader(), i = ss();
4081
+ const t = cs(Number.MAX_SAFE_INTEGER, this.socket.binaryType), n = e.readable.pipeThrough(t).getReader(), i = as();
4082
4082
  i.readable.pipeTo(e.writable), this._writer = i.writable.getWriter();
4083
4083
  const r = () => {
4084
4084
  n.read().then(({ done: a, value: c }) => {
@@ -4097,7 +4097,7 @@ class ks extends Fe {
4097
4097
  for (let t = 0; t < e.length; t++) {
4098
4098
  const n = e[t], i = t === e.length - 1;
4099
4099
  this._writer.write(n).then(() => {
4100
- i && he(() => {
4100
+ i && de(() => {
4101
4101
  this.writable = !0, this.emitReserved("drain");
4102
4102
  }, this.setTimeoutFn);
4103
4103
  });
@@ -4108,11 +4108,11 @@ class ks extends Fe {
4108
4108
  (e = this._transport) === null || e === void 0 || e.close();
4109
4109
  }
4110
4110
  }
4111
- const xs = {
4112
- websocket: Cs,
4113
- webtransport: ks,
4114
- polling: vs
4115
- }, Ts = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, Rs = [
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 = [
4116
4116
  "source",
4117
4117
  "protocol",
4118
4118
  "authority",
@@ -4128,29 +4128,29 @@ const xs = {
4128
4128
  "query",
4129
4129
  "anchor"
4130
4130
  ];
4131
- function Re(s) {
4131
+ function Pe(s) {
4132
4132
  if (s.length > 8e3)
4133
4133
  throw "URI too long";
4134
4134
  const e = s, t = s.indexOf("["), n = s.indexOf("]");
4135
4135
  t != -1 && n != -1 && (s = s.substring(0, t) + s.substring(t, n).replace(/:/g, ";") + s.substring(n, s.length));
4136
- let i = Ts.exec(s || ""), r = {}, o = 14;
4136
+ let i = Es.exec(s || ""), r = {}, o = 14;
4137
4137
  for (; o--; )
4138
- r[Rs[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 = ws(r, r.path), r.queryKey = Ps(r, r.query), r;
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;
4140
4140
  }
4141
- function ws(s, e) {
4141
+ function Is(s, 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 Ps(s, e) {
4145
+ function As(s, e) {
4146
4146
  const t = {};
4147
4147
  return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(n, i, r) {
4148
4148
  i && (t[i] = r);
4149
4149
  }), t;
4150
4150
  }
4151
- const we = typeof addEventListener == "function" && typeof removeEventListener == "function", se = [];
4152
- we && addEventListener("offline", () => {
4153
- se.forEach((s) => s());
4151
+ const Ee = typeof addEventListener == "function" && typeof removeEventListener == "function", ie = [];
4152
+ Ee && addEventListener("offline", () => {
4153
+ ie.forEach((s) => s());
4154
4154
  }, !1);
4155
4155
  class M extends b {
4156
4156
  /**
@@ -4160,11 +4160,11 @@ class M extends b {
4160
4160
  * @param {Object} opts - options
4161
4161
  */
4162
4162
  constructor(e, t) {
4163
- if (super(), this.binaryType = os, 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
- const n = Re(e);
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) {
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
- } else t.host && (t.hostname = Re(t.host).host);
4167
- le(this, t), this.secure = t.secure != null ? t.secure : typeof location < "u" && location.protocol === "https:", t.hostname && !t.port && (t.port = this.secure ? "443" : "80"), this.hostname = t.hostname || (typeof location < "u" ? location.hostname : "localhost"), this.port = t.port || (typeof location < "u" && location.port ? location.port : this.secure ? "443" : "80"), this.transports = [], this._transportsByName = {}, t.transports.forEach((n) => {
4166
+ } else t.host && (t.hostname = Pe(t.host).host);
4167
+ ue(this, t), this.secure = t.secure != null ? t.secure : typeof location < "u" && location.protocol === "https:", t.hostname && !t.port && (t.port = this.secure ? "443" : "80"), this.hostname = t.hostname || (typeof location < "u" ? location.hostname : "localhost"), this.port = t.port || (typeof location < "u" && location.port ? location.port : this.secure ? "443" : "80"), this.transports = [], this._transportsByName = {}, t.transports.forEach((n) => {
4168
4168
  const i = n.prototype.name;
4169
4169
  this.transports.push(i), this._transportsByName[i] = n;
4170
4170
  }), this.opts = Object.assign({
@@ -4181,13 +4181,13 @@ 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 = ps(this.opts.query)), we && (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 = ys(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", {
4188
4188
  description: "network connection lost"
4189
4189
  });
4190
- }, se.push(this._offlineEventListener))), this.opts.withCredentials && (this._cookieJar = void 0), this._open();
4190
+ }, ie.push(this._offlineEventListener))), this.opts.withCredentials && (this._cookieJar = void 0), this._open();
4191
4191
  }
4192
4192
  /**
4193
4193
  * Creates transport of the given type.
@@ -4198,7 +4198,7 @@ class M extends b {
4198
4198
  */
4199
4199
  createTransport(e) {
4200
4200
  const t = Object.assign({}, this.opts.query);
4201
- t.EIO = ln, t.transport = e, this.id && (t.sid = this.id);
4201
+ t.EIO = un, t.transport = e, this.id && (t.sid = this.id);
4202
4202
  const n = Object.assign({}, this.opts, {
4203
4203
  query: t,
4204
4204
  socket: this,
@@ -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 += ls(i)), n > 0 && t > this._maxPayload)
4319
+ if (i && (t += fs(i)), n > 0 && t > this._maxPayload)
4320
4320
  return this.writeBuffer.slice(0, n);
4321
4321
  t += 2;
4322
4322
  }
@@ -4336,7 +4336,7 @@ class M extends b {
4336
4336
  if (!this._pingTimeoutTime)
4337
4337
  return !0;
4338
4338
  const e = Date.now() > this._pingTimeoutTime;
4339
- return e && (this._pingTimeoutTime = 0, he(() => {
4339
+ return e && (this._pingTimeoutTime = 0, de(() => {
4340
4340
  this._onClose("ping timeout");
4341
4341
  }, this.setTimeoutFn)), e;
4342
4342
  }
@@ -4414,16 +4414,16 @@ class M extends b {
4414
4414
  */
4415
4415
  _onClose(e, t) {
4416
4416
  if (this.readyState === "opening" || this.readyState === "open" || this.readyState === "closing") {
4417
- if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), we && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
4418
- const n = se.indexOf(this._offlineEventListener);
4419
- n !== -1 && se.splice(n, 1);
4417
+ if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), Ee && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
4418
+ const n = ie.indexOf(this._offlineEventListener);
4419
+ n !== -1 && ie.splice(n, 1);
4420
4420
  }
4421
4421
  this.readyState = "closed", this.id = null, this.emitReserved("close", e, t), this.writeBuffer = [], this._prevBufferLen = 0;
4422
4422
  }
4423
4423
  }
4424
4424
  }
4425
- M.protocol = ln;
4426
- class Es extends M {
4425
+ M.protocol = un;
4426
+ class Os extends M {
4427
4427
  constructor() {
4428
4428
  super(...arguments), this._upgrades = [];
4429
4429
  }
@@ -4495,67 +4495,67 @@ class Es extends M {
4495
4495
  return t;
4496
4496
  }
4497
4497
  }
4498
- let Ms = class extends Es {
4498
+ let Ds = class extends Os {
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) => xs[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((r) => Ps[r]).filter((r) => !!r)), super(n ? i : e, i);
4502
4502
  }
4503
4503
  };
4504
- function As(s, e = "", t) {
4504
+ function Ls(s, e = "", t) {
4505
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 = Re(s)), n.port || (/^(http|ws)$/.test(n.protocol) ? n.port = "80" : /^(http|ws)s$/.test(n.protocol) && (n.port = "443")), n.path = n.path || "/";
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
4507
  const r = n.host.indexOf(":") !== -1 ? "[" + n.host + "]" : n.host;
4508
4508
  return n.id = n.protocol + "://" + r + ":" + n.port + e, n.href = n.protocol + "://" + r + (t && t.port === n.port ? "" : ":" + n.port), n;
4509
4509
  }
4510
- const Is = typeof ArrayBuffer == "function", Os = (s) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(s) : s.buffer instanceof ArrayBuffer, gn = Object.prototype.toString, Ds = typeof Blob == "function" || typeof Blob < "u" && gn.call(Blob) === "[object BlobConstructor]", Ls = typeof File == "function" || typeof File < "u" && gn.call(File) === "[object FileConstructor]";
4511
- function je(s) {
4512
- return Is && (s instanceof ArrayBuffer || Os(s)) || Ds && s instanceof Blob || Ls && s instanceof File;
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
4513
  }
4514
- function ie(s, e) {
4514
+ function re(s, e) {
4515
4515
  if (!s || typeof s != "object")
4516
4516
  return !1;
4517
4517
  if (Array.isArray(s)) {
4518
4518
  for (let t = 0, n = s.length; t < n; t++)
4519
- if (ie(s[t]))
4519
+ if (re(s[t]))
4520
4520
  return !0;
4521
4521
  return !1;
4522
4522
  }
4523
- if (je(s))
4523
+ if (Ve(s))
4524
4524
  return !0;
4525
4525
  if (s.toJSON && typeof s.toJSON == "function" && arguments.length === 1)
4526
- return ie(s.toJSON(), !0);
4526
+ return re(s.toJSON(), !0);
4527
4527
  for (const t in s)
4528
- if (Object.prototype.hasOwnProperty.call(s, t) && ie(s[t]))
4528
+ if (Object.prototype.hasOwnProperty.call(s, t) && re(s[t]))
4529
4529
  return !0;
4530
4530
  return !1;
4531
4531
  }
4532
- function $s(s) {
4532
+ function Ns(s) {
4533
4533
  const e = [], t = s.data, n = s;
4534
- return n.data = Pe(t, e), n.attachments = e.length, { packet: n, buffers: e };
4534
+ return n.data = Me(t, e), n.attachments = e.length, { packet: n, buffers: e };
4535
4535
  }
4536
- function Pe(s, e) {
4536
+ function Me(s, e) {
4537
4537
  if (!s)
4538
4538
  return s;
4539
- if (je(s)) {
4539
+ if (Ve(s)) {
4540
4540
  const t = { _placeholder: !0, num: e.length };
4541
4541
  return e.push(s), t;
4542
4542
  } else if (Array.isArray(s)) {
4543
4543
  const t = new Array(s.length);
4544
4544
  for (let n = 0; n < s.length; n++)
4545
- t[n] = Pe(s[n], e);
4545
+ t[n] = Me(s[n], e);
4546
4546
  return t;
4547
4547
  } else if (typeof s == "object" && !(s instanceof Date)) {
4548
4548
  const t = {};
4549
4549
  for (const n in s)
4550
- Object.prototype.hasOwnProperty.call(s, n) && (t[n] = Pe(s[n], e));
4550
+ Object.prototype.hasOwnProperty.call(s, n) && (t[n] = Me(s[n], e));
4551
4551
  return t;
4552
4552
  }
4553
4553
  return s;
4554
4554
  }
4555
- function Bs(s, e) {
4556
- return s.data = Ee(s.data, e), delete s.attachments, s;
4555
+ function qs(s, e) {
4556
+ return s.data = Ie(s.data, e), delete s.attachments, s;
4557
4557
  }
4558
- function Ee(s, e) {
4558
+ function Ie(s, e) {
4559
4559
  if (!s)
4560
4560
  return s;
4561
4561
  if (s && s._placeholder === !0) {
@@ -4564,13 +4564,13 @@ function Ee(s, e) {
4564
4564
  throw new Error("illegal attachments");
4565
4565
  } else if (Array.isArray(s))
4566
4566
  for (let t = 0; t < s.length; t++)
4567
- s[t] = Ee(s[t], e);
4567
+ s[t] = Ie(s[t], e);
4568
4568
  else if (typeof s == "object")
4569
4569
  for (const t in s)
4570
- Object.prototype.hasOwnProperty.call(s, t) && (s[t] = Ee(s[t], e));
4570
+ Object.prototype.hasOwnProperty.call(s, t) && (s[t] = Ie(s[t], e));
4571
4571
  return s;
4572
4572
  }
4573
- const Us = [
4573
+ const Fs = [
4574
4574
  "connect",
4575
4575
  // used on the client side
4576
4576
  "connect_error",
@@ -4584,11 +4584,11 @@ const Us = [
4584
4584
  "removeListener"
4585
4585
  // used by the Node.js EventEmitter
4586
4586
  ];
4587
- var m;
4587
+ var g;
4588
4588
  (function(s) {
4589
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";
4590
- })(m || (m = {}));
4591
- class zs {
4590
+ })(g || (g = {}));
4591
+ class js {
4592
4592
  /**
4593
4593
  * Encoder constructor
4594
4594
  *
@@ -4604,8 +4604,8 @@ class zs {
4604
4604
  * @param {Object} obj - packet object
4605
4605
  */
4606
4606
  encode(e) {
4607
- return (e.type === m.EVENT || e.type === m.ACK) && ie(e) ? this.encodeAsBinary({
4608
- type: e.type === m.EVENT ? m.BINARY_EVENT : m.BINARY_ACK,
4607
+ return (e.type === g.EVENT || e.type === g.ACK) && re(e) ? this.encodeAsBinary({
4608
+ type: e.type === g.EVENT ? g.BINARY_EVENT : g.BINARY_ACK,
4609
4609
  nsp: e.nsp,
4610
4610
  data: e.data,
4611
4611
  id: e.id
@@ -4616,7 +4616,7 @@ class zs {
4616
4616
  */
4617
4617
  encodeAsString(e) {
4618
4618
  let t = "" + e.type;
4619
- return (e.type === m.BINARY_EVENT || e.type === m.BINARY_ACK) && (t += e.attachments + "-"), e.nsp && e.nsp !== "/" && (t += e.nsp + ","), e.id != null && (t += e.id), e.data != null && (t += JSON.stringify(e.data, this.replacer)), t;
4619
+ return (e.type === g.BINARY_EVENT || e.type === g.BINARY_ACK) && (t += e.attachments + "-"), e.nsp && e.nsp !== "/" && (t += e.nsp + ","), e.id != null && (t += e.id), e.data != null && (t += JSON.stringify(e.data, this.replacer)), t;
4620
4620
  }
4621
4621
  /**
4622
4622
  * Encode packet as 'buffer sequence' by removing blobs, and
@@ -4624,11 +4624,11 @@ class zs {
4624
4624
  * a list of buffers.
4625
4625
  */
4626
4626
  encodeAsBinary(e) {
4627
- const t = $s(e), n = this.encodeAsString(t.packet), i = t.buffers;
4627
+ const t = Ns(e), n = this.encodeAsString(t.packet), i = t.buffers;
4628
4628
  return i.unshift(n), i;
4629
4629
  }
4630
4630
  }
4631
- class He extends b {
4631
+ class Ke extends b {
4632
4632
  /**
4633
4633
  * Decoder constructor
4634
4634
  */
@@ -4649,9 +4649,9 @@ class He extends b {
4649
4649
  if (this.reconstructor)
4650
4650
  throw new Error("got plaintext data when reconstructing a packet");
4651
4651
  t = this.decodeString(e);
4652
- const n = t.type === m.BINARY_EVENT;
4653
- n || t.type === m.BINARY_ACK ? (t.type = n ? m.EVENT : m.ACK, this.reconstructor = new Ns(t), t.attachments === 0 && super.emitReserved("decoded", t)) : super.emitReserved("decoded", t);
4654
- } else if (je(e) || e.base64)
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);
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));
4657
4657
  else
@@ -4670,9 +4670,9 @@ class He extends b {
4670
4670
  const n = {
4671
4671
  type: Number(e.charAt(0))
4672
4672
  };
4673
- if (m[n.type] === void 0)
4673
+ if (g[n.type] === void 0)
4674
4674
  throw new Error("unknown packet type " + n.type);
4675
- if (n.type === m.BINARY_EVENT || n.type === m.BINARY_ACK) {
4675
+ if (n.type === g.BINARY_EVENT || n.type === g.BINARY_ACK) {
4676
4676
  const r = t + 1;
4677
4677
  for (; e.charAt(++t) !== "-" && t != e.length; )
4678
4678
  ;
@@ -4680,7 +4680,7 @@ class He extends b {
4680
4680
  if (o != Number(o) || e.charAt(t) !== "-")
4681
4681
  throw new Error("Illegal attachments");
4682
4682
  const a = Number(o);
4683
- if (!qs(a) || a < 0)
4683
+ if (!Vs(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");
@@ -4709,7 +4709,7 @@ class He extends b {
4709
4709
  }
4710
4710
  if (e.charAt(++t)) {
4711
4711
  const r = this.tryParse(e.substr(t));
4712
- if (He.isPayloadValid(n.type, r))
4712
+ if (Ke.isPayloadValid(n.type, r))
4713
4713
  n.data = r;
4714
4714
  else
4715
4715
  throw new Error("invalid payload");
@@ -4725,17 +4725,17 @@ class He extends b {
4725
4725
  }
4726
4726
  static isPayloadValid(e, t) {
4727
4727
  switch (e) {
4728
- case m.CONNECT:
4729
- return ut(t);
4730
- case m.DISCONNECT:
4728
+ case g.CONNECT:
4729
+ return pt(t);
4730
+ case g.DISCONNECT:
4731
4731
  return t === void 0;
4732
- case m.CONNECT_ERROR:
4733
- return typeof t == "string" || ut(t);
4734
- case m.EVENT:
4735
- case m.BINARY_EVENT:
4736
- return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && Us.indexOf(t[0]) === -1);
4737
- case m.ACK:
4738
- case m.BINARY_ACK:
4732
+ case g.CONNECT_ERROR:
4733
+ return typeof t == "string" || pt(t);
4734
+ case g.EVENT:
4735
+ case g.BINARY_EVENT:
4736
+ return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && Fs.indexOf(t[0]) === -1);
4737
+ case g.ACK:
4738
+ case g.BINARY_ACK:
4739
4739
  return Array.isArray(t);
4740
4740
  }
4741
4741
  }
@@ -4746,7 +4746,7 @@ class He extends b {
4746
4746
  this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
4747
4747
  }
4748
4748
  }
4749
- class Ns {
4749
+ class Hs {
4750
4750
  constructor(e) {
4751
4751
  this.packet = e, this.buffers = [], this.reconPack = e;
4752
4752
  }
@@ -4760,7 +4760,7 @@ class Ns {
4760
4760
  */
4761
4761
  takeBinaryData(e) {
4762
4762
  if (this.buffers.push(e), this.buffers.length === this.reconPack.attachments) {
4763
- const t = Bs(this.reconPack, this.buffers);
4763
+ const t = qs(this.reconPack, this.buffers);
4764
4764
  return this.finishedReconstruction(), t;
4765
4765
  }
4766
4766
  return null;
@@ -4772,26 +4772,26 @@ class Ns {
4772
4772
  this.reconPack = null, this.buffers = [];
4773
4773
  }
4774
4774
  }
4775
- const qs = Number.isInteger || function(s) {
4775
+ const Vs = Number.isInteger || function(s) {
4776
4776
  return typeof s == "number" && isFinite(s) && Math.floor(s) === s;
4777
4777
  };
4778
- function ut(s) {
4778
+ function pt(s) {
4779
4779
  return Object.prototype.toString.call(s) === "[object Object]";
4780
4780
  }
4781
- const Fs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4781
+ const Ks = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4782
4782
  __proto__: null,
4783
- Decoder: He,
4784
- Encoder: zs,
4783
+ Decoder: Ke,
4784
+ Encoder: js,
4785
4785
  get PacketType() {
4786
- return m;
4786
+ return g;
4787
4787
  }
4788
4788
  }, Symbol.toStringTag, { value: "Module" }));
4789
- function T(s, e, t) {
4789
+ function R(s, e, t) {
4790
4790
  return s.on(e, t), function() {
4791
4791
  s.off(e, t);
4792
4792
  };
4793
4793
  }
4794
- const js = Object.freeze({
4794
+ const Js = 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 yn extends b {
4803
+ class _n extends b {
4804
4804
  /**
4805
4805
  * `Socket` constructor.
4806
4806
  */
@@ -4834,10 +4834,10 @@ class yn extends b {
4834
4834
  return;
4835
4835
  const e = this.io;
4836
4836
  this.subs = [
4837
- T(e, "open", this.onopen.bind(this)),
4838
- T(e, "packet", this.onpacket.bind(this)),
4839
- T(e, "error", this.onerror.bind(this)),
4840
- T(e, "close", this.onclose.bind(this))
4837
+ R(e, "open", this.onopen.bind(this)),
4838
+ R(e, "packet", this.onpacket.bind(this)),
4839
+ R(e, "error", this.onerror.bind(this)),
4840
+ R(e, "close", this.onclose.bind(this))
4841
4841
  ];
4842
4842
  }
4843
4843
  /**
@@ -4916,12 +4916,12 @@ class yn extends b {
4916
4916
  */
4917
4917
  emit(e, ...t) {
4918
4918
  var n, i, r;
4919
- if (js.hasOwnProperty(e))
4919
+ if (Js.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;
4923
4923
  const o = {
4924
- type: m.EVENT,
4924
+ type: g.EVENT,
4925
4925
  data: t
4926
4926
  };
4927
4927
  if (o.options = {}, o.options.compress = this.flags.compress !== !1, typeof t[t.length - 1] == "function") {
@@ -5029,7 +5029,7 @@ class yn extends b {
5029
5029
  */
5030
5030
  _sendConnectPacket(e) {
5031
5031
  this.packet({
5032
- type: m.CONNECT,
5032
+ type: g.CONNECT,
5033
5033
  data: this._pid ? Object.assign({ pid: this._pid, offset: this._lastOffset }, e) : e
5034
5034
  });
5035
5035
  }
@@ -5075,21 +5075,21 @@ class yn extends b {
5075
5075
  onpacket(e) {
5076
5076
  if (e.nsp === this.nsp)
5077
5077
  switch (e.type) {
5078
- case m.CONNECT:
5078
+ case g.CONNECT:
5079
5079
  e.data && e.data.sid ? this.onconnect(e.data.sid, e.data.pid) : this.emitReserved("connect_error", new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));
5080
5080
  break;
5081
- case m.EVENT:
5082
- case m.BINARY_EVENT:
5081
+ case g.EVENT:
5082
+ case g.BINARY_EVENT:
5083
5083
  this.onevent(e);
5084
5084
  break;
5085
- case m.ACK:
5086
- case m.BINARY_ACK:
5085
+ case g.ACK:
5086
+ case g.BINARY_ACK:
5087
5087
  this.onack(e);
5088
5088
  break;
5089
- case m.DISCONNECT:
5089
+ case g.DISCONNECT:
5090
5090
  this.ondisconnect();
5091
5091
  break;
5092
- case m.CONNECT_ERROR:
5092
+ case g.CONNECT_ERROR:
5093
5093
  this.destroy();
5094
5094
  const n = new Error(e.data.message);
5095
5095
  n.data = e.data.data, this.emitReserved("connect_error", n);
@@ -5124,7 +5124,7 @@ class yn extends b {
5124
5124
  let n = !1;
5125
5125
  return function(...i) {
5126
5126
  n || (n = !0, t.packet({
5127
- type: m.ACK,
5127
+ type: g.ACK,
5128
5128
  id: e,
5129
5129
  data: i
5130
5130
  }));
@@ -5193,7 +5193,7 @@ class yn extends b {
5193
5193
  * @return self
5194
5194
  */
5195
5195
  disconnect() {
5196
- return this.connected && this.packet({ type: m.DISCONNECT }), this.destroy(), this.connected && this.onclose("io client disconnect"), this;
5196
+ return this.connected && this.packet({ type: g.DISCONNECT }), this.destroy(), this.connected && this.onclose("io client disconnect"), this;
5197
5197
  }
5198
5198
  /**
5199
5199
  * Alias for {@link disconnect()}.
@@ -5415,15 +5415,15 @@ B.prototype.setMax = function(s) {
5415
5415
  B.prototype.setJitter = function(s) {
5416
5416
  this.jitter = s;
5417
5417
  };
5418
- class Me extends b {
5418
+ class Ae extends b {
5419
5419
  constructor(e, t) {
5420
5420
  var n;
5421
- super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t = t || {}, t.path = t.path || "/socket.io", this.opts = t, le(this, t), this.reconnection(t.reconnection !== !1), this.reconnectionAttempts(t.reconnectionAttempts || 1 / 0), this.reconnectionDelay(t.reconnectionDelay || 1e3), this.reconnectionDelayMax(t.reconnectionDelayMax || 5e3), this.randomizationFactor((n = t.randomizationFactor) !== null && n !== void 0 ? n : 0.5), this.backoff = new B({
5421
+ super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t = t || {}, t.path = t.path || "/socket.io", this.opts = t, ue(this, t), this.reconnection(t.reconnection !== !1), this.reconnectionAttempts(t.reconnectionAttempts || 1 / 0), this.reconnectionDelay(t.reconnectionDelay || 1e3), this.reconnectionDelayMax(t.reconnectionDelayMax || 5e3), this.randomizationFactor((n = t.randomizationFactor) !== null && n !== void 0 ? n : 0.5), this.backoff = new B({
5422
5422
  min: this.reconnectionDelay(),
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 || Fs;
5426
+ const i = t.parser || Ks;
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,14 +5466,14 @@ class Me extends b {
5466
5466
  open(e) {
5467
5467
  if (~this._readyState.indexOf("open"))
5468
5468
  return this;
5469
- this.engine = new Ms(this.uri, this.opts);
5469
+ this.engine = new Ds(this.uri, this.opts);
5470
5470
  const t = this.engine, n = this;
5471
5471
  this._readyState = "opening", this.skipReconnect = !1;
5472
- const i = T(t, "open", function() {
5472
+ const i = R(t, "open", function() {
5473
5473
  n.onopen(), e && e();
5474
5474
  }), r = (a) => {
5475
5475
  this.cleanup(), this._readyState = "closed", this.emitReserved("error", a), e ? e(a) : this.maybeReconnectOnOpen();
5476
- }, o = T(t, "error", r);
5476
+ }, o = R(t, "error", r);
5477
5477
  if (this._timeout !== !1) {
5478
5478
  const a = this._timeout, c = this.setTimeoutFn(() => {
5479
5479
  i(), r(new Error("timeout")), t.close();
@@ -5502,12 +5502,12 @@ class Me extends b {
5502
5502
  this.cleanup(), this._readyState = "open", this.emitReserved("open");
5503
5503
  const e = this.engine;
5504
5504
  this.subs.push(
5505
- T(e, "ping", this.onping.bind(this)),
5506
- T(e, "data", this.ondata.bind(this)),
5507
- T(e, "error", this.onerror.bind(this)),
5508
- T(e, "close", this.onclose.bind(this)),
5505
+ R(e, "ping", this.onping.bind(this)),
5506
+ R(e, "data", this.ondata.bind(this)),
5507
+ R(e, "error", this.onerror.bind(this)),
5508
+ R(e, "close", this.onclose.bind(this)),
5509
5509
  // @ts-ignore
5510
- T(this.decoder, "decoded", this.ondecoded.bind(this))
5510
+ R(this.decoder, "decoded", this.ondecoded.bind(this))
5511
5511
  );
5512
5512
  }
5513
5513
  /**
@@ -5536,7 +5536,7 @@ class Me extends b {
5536
5536
  * @private
5537
5537
  */
5538
5538
  ondecoded(e) {
5539
- he(() => {
5539
+ de(() => {
5540
5540
  this.emitReserved("packet", e);
5541
5541
  }, this.setTimeoutFn);
5542
5542
  }
@@ -5556,7 +5556,7 @@ class Me 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 yn(this, e, t), this.nsps[e] = n), n;
5559
+ return n ? this._autoConnect && !n.active && n.connect() : (n = new _n(this, e, t), this.nsps[e] = n), n;
5560
5560
  }
5561
5561
  /**
5562
5562
  * Called upon a socket close.
@@ -5654,19 +5654,19 @@ class Me extends b {
5654
5654
  }
5655
5655
  }
5656
5656
  const N = {};
5657
- function re(s, e) {
5657
+ function oe(s, e) {
5658
5658
  typeof s == "object" && (e = s, s = void 0), e = e || {};
5659
- const t = As(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;
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;
5660
5660
  let c;
5661
- return a ? c = new Me(n, e) : (N[i] || (N[i] = new Me(n, e)), c = N[i]), t.query && !e.query && (e.query = t.queryKey), c.socket(t.path, e);
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
- Object.assign(re, {
5664
- Manager: Me,
5665
- Socket: yn,
5666
- io: re,
5667
- connect: re
5663
+ Object.assign(oe, {
5664
+ Manager: Ae,
5665
+ Socket: _n,
5666
+ io: oe,
5667
+ connect: oe
5668
5668
  });
5669
- class Hs {
5669
+ class Ws {
5670
5670
  constructor(e) {
5671
5671
  this.config = e, this.socket = null, this.callbacks = {
5672
5672
  onMessage: null,
@@ -5687,7 +5687,7 @@ class Hs {
5687
5687
  o && (n = `${o}/socket.io/`);
5688
5688
  } catch {
5689
5689
  }
5690
- this.socket = re(t, {
5690
+ this.socket = oe(t, {
5691
5691
  path: n,
5692
5692
  auth: {
5693
5693
  workspace: e
@@ -5723,7 +5723,9 @@ class Hs {
5723
5723
  "whiteboard-image-uploaded",
5724
5724
  "whiteboard-state-sync",
5725
5725
  "whiteboard-permission-changed",
5726
- "whiteboard-toggled"
5726
+ "whiteboard-toggled",
5727
+ "recording-state",
5728
+ "recording-stop"
5727
5729
  ];
5728
5730
  for (const r of i)
5729
5731
  this.socket.on(r, (o) => {
@@ -5776,7 +5778,7 @@ class Hs {
5776
5778
  this.socket && (this.socket.close(), this.socket = null);
5777
5779
  }
5778
5780
  }
5779
- class Vs {
5781
+ class Ys {
5780
5782
  constructor() {
5781
5783
  this.localStream = null, this.remoteStreams = {};
5782
5784
  }
@@ -5821,7 +5823,7 @@ class Vs {
5821
5823
  this.stopLocalStream(), this.remoteStreams = {};
5822
5824
  }
5823
5825
  }
5824
- class Ve {
5826
+ class Je {
5825
5827
  constructor() {
5826
5828
  this.recorder = null, this.stream = null, this.state = "idle", this.startedAt = null, this.seq = 0, this.pendingUploads = [], this.callbacks = { onStateChange: null, onChunk: null };
5827
5829
  }
@@ -5852,7 +5854,7 @@ class Ve {
5852
5854
  // audioBitsPerSecond default 64_000 — Opus is efficient at this rate
5853
5855
  // onChunk async (blob, seq)
5854
5856
  start(e, t = {}) {
5855
- if (!Ve.isSupported())
5857
+ if (!Je.isSupported())
5856
5858
  throw new Error("MediaRecorder API not supported in this browser");
5857
5859
  if (this.state === "recording") return;
5858
5860
  if (!e) throw new Error("stream is required to start recording");
@@ -5910,7 +5912,7 @@ class Ve {
5910
5912
  }
5911
5913
  }
5912
5914
  }
5913
- class Ke {
5915
+ class he {
5914
5916
  constructor(e = {}) {
5915
5917
  this.width = e.width || 1280, this.height = e.height || 720, this.fps = e.fps || 30, this.canvas = null, this.ctx = null, this.videos = /* @__PURE__ */ new Map(), this.audioContext = null, this.audioDestination = null, this.audioSources = /* @__PURE__ */ new Map(), this.combinedStream = null, this.animationHandle = null, this.running = !1;
5916
5918
  }
@@ -5919,7 +5921,7 @@ class Ke {
5919
5921
  }
5920
5922
  async start() {
5921
5923
  if (this.running) return this.combinedStream;
5922
- if (!Ke.isSupported())
5924
+ if (!he.isSupported())
5923
5925
  throw new Error("Composite recording requires canvas.captureStream + AudioContext");
5924
5926
  this.canvas = document.createElement("canvas"), this.canvas.width = this.width, this.canvas.height = this.height, this.canvas.style.cssText = "position:absolute;left:-9999px;top:-9999px;", document.body.appendChild(this.canvas), this.ctx = this.canvas.getContext("2d");
5925
5927
  const e = window.AudioContext || window.webkitAudioContext;
@@ -5943,23 +5945,23 @@ class Ke {
5943
5945
  this.ctx.fillStyle = "#0d0d0d", this.ctx.fillRect(0, 0, this.width, this.height);
5944
5946
  const e = Array.from(this.videos.values());
5945
5947
  if (e.length === 0) return;
5946
- const { cols: t, rows: n } = Ys(e.length), i = this.width / t, r = this.height / n;
5948
+ const { cols: t, rows: n } = Zs(e.length), i = this.width / t, r = this.height / n;
5947
5949
  e.forEach((o, a) => {
5948
5950
  const c = a % t, h = Math.floor(a / t), l = c * i, d = h * r;
5949
5951
  this.ctx.fillStyle = "#1a1a1a", this.ctx.fillRect(l, d, i, r);
5950
- const u = o.videoEl.videoWidth || 0, f = o.videoEl.videoHeight || 0, g = o.videoTrack, _ = g && g.enabled && g.readyState === "live";
5952
+ const u = o.videoEl.videoWidth || 0, f = o.videoEl.videoHeight || 0, m = o.videoTrack, _ = m && m.enabled && m.readyState === "live";
5951
5953
  if (u > 0 && f > 0 && _ !== !1) {
5952
- const Qe = Math.min(i / u, r / f), Xe = u * Qe, Ze = f * Qe, Sn = l + (i - Xe) / 2, Cn = d + (r - Ze) / 2;
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;
5953
5955
  try {
5954
- this.ctx.drawImage(o.videoEl, Sn, Cn, Xe, Ze);
5956
+ this.ctx.drawImage(o.videoEl, Rn, Tn, Ze, et);
5955
5957
  } catch {
5956
5958
  }
5957
5959
  } else
5958
- Ws(this.ctx, o.label || "Peer", l, d, i, r);
5959
- const Je = o.label || "Peer";
5960
+ Xs(this.ctx, o.label || "Peer", l, d, i, r);
5961
+ const We = o.label || "Peer";
5960
5962
  this.ctx.font = "bold 16px system-ui, sans-serif";
5961
- const bn = this.ctx.measureText(Je), We = 10, _n = 6, vn = bn.width + We * 2, de = 24, Ye = l + 12, Ge = d + r - de - 12;
5962
- this.ctx.fillStyle = "rgba(0,0,0,0.65)", this.ctx.fillRect(Ye, Ge, vn, de), this.ctx.fillStyle = "#fff", this.ctx.fillText(Je, Ye + We, Ge + de - _n - 2);
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
5965
  });
5964
5966
  }
5965
5967
  addStream(e, t, n = {}) {
@@ -6016,21 +6018,21 @@ class Ke {
6016
6018
  }
6017
6019
  }
6018
6020
  }
6019
- function Ks(s) {
6021
+ function Gs(s) {
6020
6022
  const e = String(s).trim().split(/\s+/).filter(Boolean);
6021
6023
  return e.length === 0 ? "?" : e.length === 1 ? e[0].slice(0, 2).toUpperCase() : (e[0][0] + e[e.length - 1][0]).toUpperCase();
6022
6024
  }
6023
- function Js(s) {
6025
+ function Qs(s) {
6024
6026
  let e = 0;
6025
6027
  const t = String(s);
6026
6028
  for (let i = 0; i < t.length; i++) e = e * 31 + t.charCodeAt(i) >>> 0;
6027
6029
  return `hsl(${e % 360}, 45%, 40%)`;
6028
6030
  }
6029
- function Ws(s, e, t, n, i, r) {
6031
+ function Xs(s, e, t, n, i, r) {
6030
6032
  const o = t + i / 2, a = n + r / 2, c = Math.min(i, r) * 0.22;
6031
- s.fillStyle = Js(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(Ks(e), o, a + 1), s.textAlign = "start", s.textBaseline = "alphabetic";
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";
6032
6034
  }
6033
- function Ys(s) {
6035
+ function Zs(s) {
6034
6036
  if (s <= 1) return { cols: 1, rows: 1 };
6035
6037
  if (s === 2) return { cols: 2, rows: 1 };
6036
6038
  if (s <= 4) return { cols: 2, rows: 2 };
@@ -6039,11 +6041,26 @@ function Ys(s) {
6039
6041
  const e = 4;
6040
6042
  return { cols: e, rows: Math.ceil(s / e) };
6041
6043
  }
6042
- function Gs(s, e) {
6044
+ function vn(s) {
6045
+ return String(s || "").replace(/-r[a-z0-9]{4}$/i, "");
6046
+ }
6047
+ function ei(s) {
6048
+ return vn(s).endsWith("-screen");
6049
+ }
6050
+ function Sn(s, e) {
6051
+ return !s || !e ? !1 : vn(s).endsWith(`-${e}`);
6052
+ }
6053
+ function Y(s, e) {
6054
+ if (!s || !e) return null;
6055
+ for (const [t] of s.entries())
6056
+ if (Sn(t, e)) return t;
6057
+ return null;
6058
+ }
6059
+ function ti(s, e) {
6043
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/") ? "📄" : "📎";
6044
6061
  }
6045
- const pt = "repeat(auto-fit, minmax(280px, 1fr))", ft = "minmax(180px, 1fr)";
6046
- class Qs {
6062
+ const ft = "repeat(auto-fit, minmax(280px, 1fr))", gt = "minmax(180px, 1fr)";
6063
+ class ni {
6047
6064
  constructor(e = {}) {
6048
6065
  this.container = null, this.videoElements = {}, this.chatMessages = [], this.recording = e.recording || "off", this.screenShare = e.screenShare !== !1, this.enabledPanels = new Set(
6049
6066
  Array.isArray(e.panels) && e.panels.length ? e.panels : ["chat"]
@@ -6137,8 +6154,8 @@ class Qs {
6137
6154
  flex: 1;
6138
6155
  display: grid;
6139
6156
  gap: 8px;
6140
- grid-template-columns: ${pt};
6141
- grid-auto-rows: ${ft};
6157
+ grid-template-columns: ${ft};
6158
+ grid-auto-rows: ${gt};
6142
6159
  min-width: 0; min-height: 0;
6143
6160
  }
6144
6161
 
@@ -6286,6 +6303,8 @@ class Qs {
6286
6303
 
6287
6304
  #controls-container {
6288
6305
  flex-shrink: 0;
6306
+ position: relative;
6307
+ z-index: 5;
6289
6308
  padding: 14px 16px;
6290
6309
  padding-bottom: max(14px, env(safe-area-inset-bottom));
6291
6310
  background: #1a1a1a;
@@ -6390,6 +6409,7 @@ class Qs {
6390
6409
  ${r}
6391
6410
  ${o}
6392
6411
  <span id="upload-indicator" style="display:none;">Uploading…</span>
6412
+ <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>
6393
6413
  <button id="panel-toggle-btn" class="ms-panel-toggle" aria-label="Open side panel">
6394
6414
  ☰<span class="ms-badge" id="chat-badge">0</span>
6395
6415
  </button>
@@ -6479,7 +6499,12 @@ class Qs {
6479
6499
  o.id = `video-${e}`, o.dataset.peerId = e, o.style.cssText = "position: relative; background-color: #2a2a2a; border-radius: 8px; overflow: hidden; min-height: 0;";
6480
6500
  const a = document.createElement("video");
6481
6501
  a.srcObject = t, a.autoplay = !0, a.playsInline = !0, a.muted = n;
6482
- const c = t && t.getVideoTracks && t.getVideoTracks().some((u) => !(u.getSettings ? u.getSettings() : {}).displaySurface), h = n && c;
6502
+ try {
6503
+ a.play().catch(() => {
6504
+ });
6505
+ } catch {
6506
+ }
6507
+ const c = !ei(e) && t && t.getVideoTracks && t.getVideoTracks().some((u) => !(u.getSettings ? u.getSettings() : {}).displaySurface), h = n && c;
6483
6508
  a.style.cssText = "width: 100%; height: 100%; object-fit: cover;" + (h ? " transform: scaleX(-1);" : ""), a.dataset.mirror = h ? "1" : "0";
6484
6509
  const l = document.createElement("div");
6485
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);
@@ -6546,7 +6571,7 @@ class Qs {
6546
6571
  <img src="${r}" alt="${i}" style="max-width:100%; border-radius:6px; display:block;" />
6547
6572
  <div style="font-size:11px; color:#888; margin-top:2px;">${i} · ${n} KB</div>
6548
6573
  </a>`;
6549
- const o = Gs(e.contentType || "", e.fileName || "");
6574
+ const o = ti(e.contentType || "", e.fileName || "");
6550
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;">
6551
6576
  <span style="font-size:22px;">${o}</span>
6552
6577
  <div style="min-width:0; flex:1; overflow:hidden;">
@@ -6640,7 +6665,7 @@ class Qs {
6640
6665
  const i = e === "recording";
6641
6666
  this._setButtonLabel(n, i ? "Stop" : "Record");
6642
6667
  const r = n.querySelector(".ms-icon");
6643
- r && (r.textContent = i ? "■" : "●"), n.classList.toggle("active", i), n.title = i ? "Stop recording" : "Start recording";
6668
+ r && (r.textContent = i ? "■" : "●"), n.classList.toggle("active", i), n.disabled || (n.title = i ? "Stop recording" : "Start recording");
6644
6669
  }
6645
6670
  e === "recording" ? this.startRecElapsed() : this.stopRecElapsed();
6646
6671
  }
@@ -6677,7 +6702,7 @@ class Qs {
6677
6702
  if (!this.container) return;
6678
6703
  const t = this.container.querySelector("#video-container");
6679
6704
  if (!t) return;
6680
- this._presentingPeer = e || null, e ? (t.setAttribute("data-hero", e), t.style.display = "flex", t.style.flexDirection = "column", t.style.gap = "8px", t.style.gridTemplateColumns = "", t.style.gridAutoRows = "", t.style.overflow = "hidden") : (t.removeAttribute("data-hero"), t.style.display = "grid", t.style.flexDirection = "", t.style.gridTemplateColumns = pt, t.style.gridAutoRows = ft, t.style.overflow = "");
6705
+ this._presentingPeer = e || null, e ? (t.setAttribute("data-hero", e), t.style.display = "flex", t.style.flexDirection = "column", t.style.gap = "8px", t.style.gridTemplateColumns = "", t.style.gridAutoRows = "", t.style.overflow = "hidden") : (t.removeAttribute("data-hero"), t.style.display = "grid", t.style.flexDirection = "", t.style.gridTemplateColumns = ft, t.style.gridAutoRows = gt, t.style.overflow = "");
6681
6706
  let n = t.querySelector("#others-strip");
6682
6707
  if (e)
6683
6708
  n || (n = document.createElement("div"), n.id = "others-strip", n.style.cssText = "flex: 0 0 auto; display:flex; gap:8px; height:120px; overflow-x:auto; overflow-y:hidden; -webkit-overflow-scrolling: touch;", t.appendChild(n));
@@ -6714,6 +6739,17 @@ class Qs {
6714
6739
  onParticipantPermToggle(e) {
6715
6740
  this._onParticipantPermToggle = e;
6716
6741
  }
6742
+ setRecordAllowed(e, t) {
6743
+ 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");
6745
+ }
6746
+ setStatus(e) {
6747
+ if (!this.container) return;
6748
+ const t = this.container.querySelector("#ms-status");
6749
+ if (!t) return;
6750
+ const n = e == null ? "" : String(e);
6751
+ t.textContent = n, t.title = n, t.style.display = n ? "inline" : "none";
6752
+ }
6717
6753
  setPauseButtonVisible(e) {
6718
6754
  const t = this.container && this.container.querySelector("#toggle-pause");
6719
6755
  t && (t.style.display = e ? "inline-flex" : "none");
@@ -6729,7 +6765,7 @@ class Qs {
6729
6765
  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 = [];
6730
6766
  }
6731
6767
  }
6732
- class Xs {
6768
+ class si {
6733
6769
  constructor(e) {
6734
6770
  this.container = e.container, this.emit = e.emit, this.canRun = e.canRun || (() => !0), this.canEdit = e.canEdit || (() => !0), this.userId = e.userId, this.state = {
6735
6771
  code: "",
@@ -6824,7 +6860,7 @@ class Xs {
6824
6860
  function mt(s) {
6825
6861
  return String(s).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
6826
6862
  }
6827
- class Zs {
6863
+ class ii {
6828
6864
  constructor(e) {
6829
6865
  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();
6830
6866
  }
@@ -6956,8 +6992,16 @@ class Zs {
6956
6992
  window.removeEventListener("resize", this._resize), this._resizeObserver && this._resizeObserver.disconnect();
6957
6993
  }
6958
6994
  }
6959
- const ei = /* @__PURE__ */ new Set(["auto", "manual", "off"]), ti = /* @__PURE__ */ new Set(["local", "composite"]), q = "https://preproduction.tentoro.in/videocall";
6960
- function ni() {
6995
+ function ri(s, e, t) {
6996
+ return !s || s.recordingMode !== "composite" ? null : t || !e ? new Error(
6997
+ "Room recording needs a computer browser. Join from the web to start Rec."
6998
+ ) : null;
6999
+ }
7000
+ function yt(s, e) {
7001
+ return !!(s && s.active && !e);
7002
+ }
7003
+ const oi = /* @__PURE__ */ new Set(["auto", "manual", "off"]), ai = /* @__PURE__ */ new Set(["local", "composite"]), q = "https://preproduction.tentoro.in/videocall";
7004
+ function ci() {
6961
7005
  if (typeof crypto < "u" && typeof crypto.randomUUID == "function")
6962
7006
  try {
6963
7007
  return crypto.randomUUID();
@@ -6965,12 +7009,12 @@ function ni() {
6965
7009
  }
6966
7010
  return "u-" + Date.now().toString(36) + "-" + Math.random().toString(36).slice(2, 12);
6967
7011
  }
6968
- function si({ workspace: s, ai: e }) {
7012
+ function hi({ workspace: s, ai: e }) {
6969
7013
  const t = { workspace: s };
6970
7014
  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;
6971
7015
  }
6972
- async function Y(s, e, { workspace: t, ai: n, body: i } = {}) {
6973
- const r = si({ workspace: t, ai: n }), o = { method: s, headers: r };
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 };
6974
7018
  i !== void 0 && (r["Content-Type"] = "application/json", o.body = JSON.stringify(i));
6975
7019
  const a = await fetch(e, o), c = await a.json().catch(() => ({}));
6976
7020
  if (!a.ok) {
@@ -6979,7 +7023,7 @@ async function Y(s, e, { workspace: t, ai: n, body: i } = {}) {
6979
7023
  }
6980
7024
  return c;
6981
7025
  }
6982
- function ii(s) {
7026
+ function li(s) {
6983
7027
  const e = new URL(s), t = e.protocol === "https:", n = e.pathname.replace(/\/+$/, "");
6984
7028
  return {
6985
7029
  host: e.hostname,
@@ -6995,13 +7039,13 @@ class L {
6995
7039
  init(e) {
6996
7040
  if (!e || !e.workspace || !e.roomId || !e.user)
6997
7041
  throw new Error("workspace, roomId, and user are required");
6998
- const t = e.host || q, n = ei.has(e.recording) ? e.recording : "off", i = n !== "off" && !!e.transcribe, r = i && !!e.summarize, o = e.recordOnlyIfHost !== !1, a = ti.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"], g = Array.isArray(e.panels) && e.panels.length ? e.panels.filter((_) => f.includes(_)) : ["chat"];
6999
- g.includes("chat") || g.unshift("chat"), this.config = {
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"];
7043
+ m.includes("chat") || m.unshift("chat"), this.config = {
7000
7044
  ...e,
7001
7045
  host: t,
7002
7046
  apiUrl: e.apiUrl || `${t}/api`,
7003
7047
  socketUrl: e.socketUrl || t,
7004
- peerServer: e.peerServer || ii(t),
7048
+ peerServer: e.peerServer || li(t),
7005
7049
  ai: { ...e.ai || {} },
7006
7050
  recording: n,
7007
7051
  transcribe: i,
@@ -7013,12 +7057,12 @@ class L {
7013
7057
  compositeFps: l,
7014
7058
  recordingVideoBps: d,
7015
7059
  recordingAudioBps: u,
7016
- panels: g
7017
- }, this.myRole = null, this.roleResolvers = [], this.currentRoom = this.config.roomId, this.currentUser = this.config.user, this.peerManager = new Gn(this.config), this.socketManager = new Hs(this.config), this.mediaManager = new Vs(), this.uiManager = new Qs({
7060
+ 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({
7018
7062
  recording: n,
7019
7063
  screenShare: e.screenShare !== !1,
7020
- panels: g
7021
- }), this.recorder = n === "off" ? null : new Ve(), this.compositor = null, this.setupEventHandlers(), this.isInitialized = !0, console.log("MeetSDK initialized");
7064
+ panels: m
7065
+ }), this.recorder = n === "off" ? null : new Je(), this.compositor = null, this.setupEventHandlers(), this.isInitialized = !0, console.log("MeetSDK initialized");
7022
7066
  }
7023
7067
  setupEventHandlers() {
7024
7068
  this.peerManager.on("stream", (e, t, n) => {
@@ -7033,36 +7077,36 @@ class L {
7033
7077
  }), this.peerLabels = /* @__PURE__ */ new Map(), this.socketManager.on("existingPeers", (e) => {
7034
7078
  e.forEach((t) => {
7035
7079
  this.peerLabels.set(t.peerId, t.userName || t.userId), this.peerManager.callPeer(t.peerId);
7036
- }), this.refreshParticipantsPanel();
7080
+ }), this.refreshParticipantsPanel(), this.flushPendingPresenting();
7037
7081
  }), this.socketManager.on("userJoined", (e) => {
7038
- this.peerLabels.set(e.peerId, e.userName || e.userId), this.uiManager.updateVideoStreamLabel(e.peerId, e.userName || e.userId), this.peerManager.callPeer(e.peerId), this.refreshParticipantsPanel();
7082
+ this.peerLabels.set(e.peerId, e.userName || e.userId), this.uiManager.updateVideoStreamLabel(e.peerId, e.userName || e.userId), this.peerManager.callPeer(e.peerId), this.refreshParticipantsPanel(), this.flushPendingPresenting();
7039
7083
  }), this.socketManager.on("userLeft", (e) => {
7040
7084
  const t = e.peerId || e.userId;
7041
- this.mediaManager.removeRemoteStream(t), this.uiManager.removeVideoStream(t), this.compositor && t && this.compositor.removeStream(t), e.peerId && this.peerLabels.delete(e.peerId), this.refreshParticipantsPanel();
7085
+ this.mediaManager.removeRemoteStream(t), this.uiManager.removeVideoStream(t), this.compositor && t && this.compositor.removeStream(t), e.peerId && this.peerLabels.delete(e.peerId), this.presentingPeerId && (this.presentingPeerId === t || e.userId && Sn(this.presentingPeerId, e.userId)) && this.setPresentingPeer(null), this.refreshParticipantsPanel();
7042
7086
  }), this.socketManager.on("peerMediaStateChange", (e) => {
7043
7087
  if (!e || !e.userId || e.type !== "screen") return;
7044
7088
  let t = null;
7045
- for (const [n] of this.peerLabels.entries())
7046
- if (n.endsWith(`-${e.userId}`)) {
7047
- t = n;
7048
- break;
7049
- }
7050
- t && (e.enabled ? this.setPresentingPeer(t) : this.presentingPeerId === t && this.setPresentingPeer(null));
7089
+ if (e.peerId && this.peerLabels && this.peerLabels.has(e.peerId) && (t = e.peerId), t || (t = Y(this.peerLabels, e.userId)), !t) {
7090
+ e.enabled && (this._pendingPresentingUserId = e.userId);
7091
+ return;
7092
+ }
7093
+ e.enabled ? this.setPresentingPeer(t) : this.presentingPeerId === t && this.setPresentingPeer(null);
7051
7094
  }), this.socketManager.on("youJoined", (e) => {
7052
7095
  if (this.myRole = e && e.role ? e.role : "candidate", console.log(
7053
7096
  `MeetSDK: joined as ${this.myRole}` + (e && e.hostId ? ` (host is ${e.hostName || e.hostId})` : "")
7054
7097
  ), e && e.hostId) {
7055
- for (const [n] of this.peerLabels.entries())
7056
- if (n.endsWith(`-${e.hostId}`)) {
7057
- this.hostPeerId = n;
7058
- break;
7059
- }
7098
+ const n = Y(this.peerLabels, e.hostId);
7099
+ n && (this.hostPeerId = n);
7060
7100
  }
7061
7101
  const t = this.roleResolvers;
7062
7102
  this.roleResolvers = [];
7063
7103
  for (const n of t) n(this.myRole);
7064
- this.refreshParticipantsPanel(), this.codeSandbox && this.codeSandbox.refreshPermissionUI(), this.whiteboard && this.whiteboard.refreshPermissionUI();
7065
- });
7104
+ this.refreshParticipantsPanel(), this.maybeAttachRecordingForHost(), this.applyPresentingSnapshot(e), this.applyRecordingState(e && e.recording), this.codeSandbox && this.codeSandbox.refreshPermissionUI(), this.whiteboard && this.whiteboard.refreshPermissionUI();
7105
+ }), this.socketManager && typeof this.socketManager.onRaw == "function" && (this.socketManager.onRaw("recording-state", (e) => {
7106
+ this.applyRecordingState(e);
7107
+ }), this.socketManager.onRaw("recording-stop", (e) => {
7108
+ this.handleRemoteRecordingStop(e);
7109
+ }));
7066
7110
  }
7067
7111
  async hydrateIceServers() {
7068
7112
  try {
@@ -7080,7 +7124,62 @@ class L {
7080
7124
  return t ? this.currentUser && this.currentUser.name ? this.currentUser.name : "You" : this.peerLabels && this.peerLabels.has(e) ? this.peerLabels.get(e) : e;
7081
7125
  }
7082
7126
  setPresentingPeer(e) {
7083
- this.presentingPeerId = e || null, this.uiManager && this.uiManager.setPresentingPeer && this.uiManager.setPresentingPeer(this.presentingPeerId), this.refreshParticipantsPanel();
7127
+ this.presentingPeerId = e || null, e && (this._pendingPresentingUserId = null), this.uiManager && this.uiManager.setPresentingPeer && this.uiManager.setPresentingPeer(this.presentingPeerId), this.refreshParticipantsPanel();
7128
+ }
7129
+ applyPresentingSnapshot(e) {
7130
+ const t = e && e.presenting;
7131
+ if (!t || !t.userId) return;
7132
+ let n = t.peerId && this.peerLabels && this.peerLabels.has(t.peerId) ? t.peerId : Y(this.peerLabels, t.userId);
7133
+ n ? this.setPresentingPeer(n) : this._pendingPresentingUserId = t.userId;
7134
+ }
7135
+ flushPendingPresenting() {
7136
+ if (!this._pendingPresentingUserId) return;
7137
+ const e = Y(this.peerLabels, this._pendingPresentingUserId);
7138
+ e && this.setPresentingPeer(e);
7139
+ }
7140
+ applyRecordingState(e) {
7141
+ if (!e) return;
7142
+ this.roomRecording = {
7143
+ active: !!e.active,
7144
+ recordedBy: e.recordedBy || null,
7145
+ sessionId: e.sessionId || null
7146
+ };
7147
+ const t = !!(this.recorder && this.recorder.isRecording && this.recorder.isRecording());
7148
+ this.uiManager && this.uiManager.updateRecordingIndicator && this.uiManager.updateRecordingIndicator(
7149
+ this.roomRecording.active || t ? "recording" : "idle"
7150
+ );
7151
+ try {
7152
+ typeof window < "u" && window.__tentoroPostCtl && window.__tentoroPostCtl();
7153
+ } catch {
7154
+ }
7155
+ }
7156
+ async handleRemoteRecordingStop(e) {
7157
+ if (!this.recorder || !this.recorder.isRecording()) return;
7158
+ const t = this.recordingSession && this.recordingSession.sessionId;
7159
+ if (!(e && e.sessionId && t && e.sessionId !== t))
7160
+ try {
7161
+ await this.stopRecording();
7162
+ } catch (n) {
7163
+ console.warn("MeetSDK: remote recording stop failed:", n && n.message);
7164
+ }
7165
+ }
7166
+ requestStopRecording() {
7167
+ const e = this.roomRecording && this.roomRecording.sessionId || this.recordingSession && this.recordingSession.sessionId;
7168
+ this.socketManager.emit("recording-stop", {
7169
+ roomId: this.currentRoom,
7170
+ sessionId: e
7171
+ });
7172
+ }
7173
+ async toggleRoomRecording() {
7174
+ if (this.recorder && this.recorder.isRecording()) {
7175
+ await this.stopRecording();
7176
+ return;
7177
+ }
7178
+ if (yt(this.roomRecording, !1)) {
7179
+ this.requestStopRecording();
7180
+ return;
7181
+ }
7182
+ await this.startRecording();
7084
7183
  }
7085
7184
  refreshParticipantsPanel() {
7086
7185
  if (!this.uiManager) return;
@@ -7126,18 +7225,21 @@ class L {
7126
7225
  await this.peerManager.initialize(t);
7127
7226
  const n = await this.peerManager.getLocalStream();
7128
7227
  if (this.uiManager.addVideoStream("local", n, !0), this.config.recordingMode === "composite" && this.recorder)
7129
- try {
7130
- this.compositor = new Ke({
7131
- width: this.config.compositeWidth,
7132
- height: this.config.compositeHeight,
7133
- fps: this.config.compositeFps
7134
- }), await this.compositor.start(), this.compositor.addStream("local", n, {
7135
- isLocal: !0,
7136
- label: this.labelForPeer("local", !0)
7137
- });
7138
- } catch (i) {
7139
- console.warn("Composite recording unavailable, falling back to local:", i.message), this.compositor = null;
7140
- }
7228
+ if (!he.isSupported())
7229
+ this.compositeUnavailable = !0, this.compositor = null;
7230
+ else
7231
+ try {
7232
+ this.compositor = new he({
7233
+ width: this.config.compositeWidth,
7234
+ height: this.config.compositeHeight,
7235
+ fps: this.config.compositeFps
7236
+ }), await this.compositor.start(), this.compositor.addStream("local", n, {
7237
+ isLocal: !0,
7238
+ label: this.labelForPeer("local", !0)
7239
+ });
7240
+ } catch (i) {
7241
+ console.warn("Composite recording unavailable:", i.message), this.compositor = null, this.compositeUnavailable = !0;
7242
+ }
7141
7243
  this.socketManager.connect(this.config.workspace), setTimeout(() => {
7142
7244
  this.socketManager.joinRoom(
7143
7245
  this.currentRoom,
@@ -7162,7 +7264,7 @@ class L {
7162
7264
  }
7163
7265
  }), this.config.panels.includes("code")) {
7164
7266
  const e = this.uiManager.getPanelSlot("code");
7165
- e && (this.codeSandbox = new Xs({
7267
+ e && (this.codeSandbox = new si({
7166
7268
  container: e,
7167
7269
  userId: this.currentUser.id,
7168
7270
  canEdit: () => this._canEditCode(),
@@ -7193,7 +7295,7 @@ class L {
7193
7295
  }
7194
7296
  if (this.config.panels.includes("whiteboard")) {
7195
7297
  const e = this.uiManager.getPanelSlot("whiteboard");
7196
- e && (this.whiteboard = new Zs({
7298
+ e && (this.whiteboard = new ii({
7197
7299
  container: e,
7198
7300
  userId: this.currentUser.id,
7199
7301
  canDraw: () => this._canDrawWhiteboard(),
@@ -7261,32 +7363,65 @@ class L {
7261
7363
  }), this.uiManager.onControlClick("toggle-pause", () => {
7262
7364
  this.recorder.isPaused() ? this.recorder.resume() : this.recorder.pause();
7263
7365
  }), this.config.recordOnlyIfHost && await this.waitForRole() !== "organizer") {
7264
- console.log("MeetSDK: not the host — skipping recording");
7366
+ this.uiManager.setRecordAllowed && this.uiManager.setRecordAllowed(!1, "Only the meeting host can record"), this._pendingRecordAttach = this.config.recording === "manual", console.log("MeetSDK: not the host — recording controls disabled until host role arrives");
7265
7367
  return;
7266
7368
  }
7267
- this.config.recording === "auto" && this.startRecording().catch((t) => console.error("Auto-record failed:", t)), this.config.recording === "manual" && this.uiManager.onControlClick("toggle-record", async () => {
7268
- this.recorder.isRecording() ? await this.stopRecording() : await this.startRecording();
7269
- });
7369
+ this.enableAndAttachRecording();
7270
7370
  }
7271
7371
  }
7372
+ maybeAttachRecordingForHost() {
7373
+ this.myRole === "organizer" && this._pendingRecordAttach && (this._pendingRecordAttach = !1, this.uiManager && this.uiManager.setRecordAllowed && this.uiManager.setRecordAllowed(!0), this.attachRecordToggle());
7374
+ }
7375
+ enableAndAttachRecording() {
7376
+ this.uiManager && this.uiManager.setRecordAllowed && this.uiManager.setRecordAllowed(!0), this.config.recording === "auto" && this.startRecording().catch((e) => console.error("Auto-record failed:", e)), this.config.recording === "manual" && this.attachRecordToggle();
7377
+ }
7378
+ attachRecordToggle() {
7379
+ this._recordToggleAttached || (this._recordToggleAttached = !0, this._pendingRecordAttach = !1, this.uiManager.onControlClick("toggle-record", async () => {
7380
+ try {
7381
+ await this.toggleRoomRecording();
7382
+ } catch (e) {
7383
+ console.error("MeetSDK: record toggle failed:", e);
7384
+ const t = e && e.message || String(e);
7385
+ this.uiManager && typeof this.uiManager.setStatus == "function" && this.uiManager.setStatus(t);
7386
+ }
7387
+ }));
7388
+ }
7272
7389
  async startRecording() {
7273
7390
  if (!this.recorder) throw new Error("recording is disabled in SDK config");
7274
- let e;
7391
+ if (yt(this.roomRecording, !!(this.recorder.isRecording && this.recorder.isRecording()))) {
7392
+ this.requestStopRecording();
7393
+ return;
7394
+ }
7395
+ const e = ri(
7396
+ this.config,
7397
+ this.compositor,
7398
+ this.compositeUnavailable
7399
+ );
7400
+ if (e) throw e;
7401
+ let t;
7275
7402
  if (this.config.recordingMode === "composite" && this.compositor) {
7276
- if (e = this.compositor.getStream(), !e) throw new Error("composite stream not ready");
7277
- } else if (e = this.peerManager.localStream, !e) throw new Error("local stream not ready");
7278
- const t = this.readStoredSession();
7279
- let n = null, i = 0;
7280
- if (t) {
7281
- const r = await this.probeSessionStatus(t.sessionId).catch(() => null);
7282
- r && r.active ? (n = { sessionId: t.sessionId }, i = (r.lastSeq || -1) + 1, console.log(`MeetSDK: resuming recording session ${t.sessionId} at seq=${i}`)) : this.clearStoredSession();
7403
+ if (t = this.compositor.getStream(), !t) throw new Error("composite stream not ready");
7404
+ } else if (t = this.peerManager.localStream, !t) throw new Error("local stream not ready");
7405
+ const n = this.readStoredSession();
7406
+ let i = null, r = 0;
7407
+ if (n) {
7408
+ 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();
7410
+ }
7411
+ if (!i) {
7412
+ if (i = await this.startRecordingSession(), !i || i.alreadyActive) return;
7413
+ this.persistStoredSession(i), this.applyRecordingState({
7414
+ active: !0,
7415
+ recordedBy: this.currentUser && this.currentUser.id,
7416
+ sessionId: i.sessionId
7417
+ });
7283
7418
  }
7284
- n || (n = await this.startRecordingSession(), this.persistStoredSession(n)), this.recordingSession = n, this.chunkQueue = [], this.chunkDrainerRunning = !1, this.recorder.start(e, {
7419
+ this.recordingSession = i, this.chunkQueue = [], this.chunkDrainerRunning = !1, this.recorder.start(t, {
7285
7420
  timesliceMs: 15e3,
7286
- startSeq: i,
7421
+ startSeq: r,
7287
7422
  videoBitsPerSecond: this.config.recordingVideoBps,
7288
7423
  audioBitsPerSecond: this.config.recordingAudioBps,
7289
- onChunk: (r, o) => (this.enqueueChunk(n.sessionId, r, o), Promise.resolve())
7424
+ onChunk: (o, a) => (this.enqueueChunk(i.sessionId, o, a), Promise.resolve())
7290
7425
  });
7291
7426
  }
7292
7427
  storedSessionKey() {
@@ -7363,7 +7498,8 @@ class L {
7363
7498
  const t = this.recordingSession.sessionId;
7364
7499
  this.recordingSession = null, await this.waitForChunkQueueEmpty();
7365
7500
  try {
7366
- return await this.finalizeRecordingSession(t, e);
7501
+ const n = await this.finalizeRecordingSession(t, e);
7502
+ return this.applyRecordingState({ active: !1, recordedBy: null, sessionId: null }), n;
7367
7503
  } catch (n) {
7368
7504
  throw console.error("Recording finalize failed:", n), n;
7369
7505
  }
@@ -7382,6 +7518,14 @@ class L {
7382
7518
  body: JSON.stringify(e)
7383
7519
  }
7384
7520
  );
7521
+ if (t.status === 409) {
7522
+ const n = await t.json().catch(() => ({}));
7523
+ return this.applyRecordingState({
7524
+ active: !0,
7525
+ recordedBy: n.recordedBy,
7526
+ sessionId: n.sessionId
7527
+ }), this.requestStopRecording(), { alreadyActive: !0, sessionId: n.sessionId };
7528
+ }
7385
7529
  if (!t.ok) throw new Error(`session/start failed: HTTP ${t.status}`);
7386
7530
  return t.json();
7387
7531
  }
@@ -7539,7 +7683,7 @@ class L {
7539
7683
  } = e;
7540
7684
  if (!t) throw new Error("workspace is required");
7541
7685
  const d = n || q, u = {};
7542
- 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), Y("POST", `${d}/api/meetings/schedule`, { workspace: t, ai: i, body: 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 });
7543
7687
  }
7544
7688
  /**
7545
7689
  * Update a scheduled meeting. Any of the fields (title, hostUserId, hostName,
@@ -7561,7 +7705,7 @@ class L {
7561
7705
  if (!t) throw new Error("workspace is required");
7562
7706
  if (!n) throw new Error("roomId is required");
7563
7707
  const d = i || q, u = {};
7564
- 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), Y("PATCH", `${d}/api/meetings/${encodeURIComponent(n)}`, {
7708
+ 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)}`, {
7565
7709
  workspace: t,
7566
7710
  ai: r,
7567
7711
  body: u
@@ -7572,7 +7716,7 @@ class L {
7572
7716
  const { workspace: t, roomId: n, host: i, ai: r } = e;
7573
7717
  if (!t) throw new Error("workspace is required");
7574
7718
  if (!n) throw new Error("roomId is required");
7575
- return Y("DELETE", `${i || q}/api/meetings/${encodeURIComponent(n)}`, {
7719
+ return G("DELETE", `${i || q}/api/meetings/${encodeURIComponent(n)}`, {
7576
7720
  workspace: t,
7577
7721
  ai: r
7578
7722
  });
@@ -7584,7 +7728,7 @@ class L {
7584
7728
  const a = n || q, c = new URLSearchParams();
7585
7729
  r && c.set("status", r), o && c.set("upcoming", "true");
7586
7730
  const h = c.toString();
7587
- return Y("GET", `${a}/api/meetings${h ? "?" + h : ""}`, { workspace: t, ai: i });
7731
+ return G("GET", `${a}/api/meetings${h ? "?" + h : ""}`, { workspace: t, ai: i });
7588
7732
  }
7589
7733
  /**
7590
7734
  * One-shot join: create an SDK instance, init(), mount(target), and return
@@ -7596,7 +7740,7 @@ class L {
7596
7740
  const { workspace: t, roomId: n, userName: i, container: r } = e;
7597
7741
  if (!t || !n || !i || !r)
7598
7742
  throw new Error("workspace, roomId, userName, and container are required");
7599
- const o = e.userId || ni(), {
7743
+ const o = e.userId || ci(), {
7600
7744
  userId: a,
7601
7745
  userName: c,
7602
7746
  container: h,