@nainudhin/video-meeting-sdk 1.8.3 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/meet-sdk.mjs CHANGED
@@ -352,14 +352,14 @@ function z(r, e, t) {
352
352
  const n = r.match(e);
353
353
  return n && n.length >= t && parseFloat(n[t], 10);
354
354
  }
355
- function O(r, e, t) {
355
+ function I(r, e, t) {
356
356
  if (!r.RTCPeerConnection)
357
357
  return;
358
358
  if (!Object.getOwnPropertyDescriptor(
359
359
  EventTarget.prototype,
360
360
  "addEventListener"
361
361
  ).writable) {
362
- Oe("Unable to polyfill events");
362
+ Ie("Unable to polyfill events");
363
363
  return;
364
364
  }
365
365
  const s = r.RTCPeerConnection.prototype, i = s.addEventListener;
@@ -409,14 +409,14 @@ function xn(r) {
409
409
  function Tn(r) {
410
410
  return typeof r != "boolean" ? new Error("Argument type: " + typeof r + ". Please use a boolean.") : (pt = !r, "adapter.js deprecation warnings " + (r ? "disabled" : "enabled"));
411
411
  }
412
- function Oe() {
412
+ function Ie() {
413
413
  if (typeof window == "object") {
414
414
  if (ft)
415
415
  return;
416
416
  typeof console < "u" && typeof console.log == "function" && console.log.apply(console, arguments);
417
417
  }
418
418
  }
419
- function Ie(r, e) {
419
+ function Oe(r, e) {
420
420
  pt && console.warn(r + " is deprecated, please use " + e + " instead.");
421
421
  }
422
422
  function Rn(r) {
@@ -487,7 +487,7 @@ function Xe(r, e, t) {
487
487
  });
488
488
  }), s;
489
489
  }
490
- const Ze = Oe;
490
+ const Ze = Ie;
491
491
  function mt(r, e) {
492
492
  if (e.version >= 64)
493
493
  return;
@@ -615,7 +615,7 @@ function bt(r, e) {
615
615
  }, this.addEventListener("addstream", this._ontrackpoly)), t.apply(this, arguments);
616
616
  };
617
617
  } else
618
- O(r, "track", (t) => (t.transceiver || Object.defineProperty(
618
+ I(r, "track", (t) => (t.transceiver || Object.defineProperty(
619
619
  t,
620
620
  "transceiver",
621
621
  { value: { receiver: t.receiver } }
@@ -702,7 +702,7 @@ function vt(r, e) {
702
702
  n && (r.RTCPeerConnection.prototype.getReceivers = function() {
703
703
  const i = n.apply(this, []);
704
704
  return i.forEach((o) => o._pc = this), i;
705
- }), O(r, "track", (s) => (s.receiver._pc = s.srcElement, s)), r.RTCRtpReceiver.prototype.getStats = function() {
705
+ }), I(r, "track", (s) => (s.receiver._pc = s.srcElement, s)), r.RTCRtpReceiver.prototype.getStats = function() {
706
706
  const i = this;
707
707
  return this._pc.getStats().then((o) => Xe(o, i.track, !1));
708
708
  };
@@ -909,7 +909,7 @@ function ge(r, e) {
909
909
  });
910
910
  }
911
911
  function kt(r, e) {
912
- e.version > 102 || O(r, "negotiationneeded", (t) => {
912
+ e.version > 102 || I(r, "negotiationneeded", (t) => {
913
913
  const n = t.target;
914
914
  if (!((e.version < 72 || n.getConfiguration && n.getConfiguration().sdpSemantics === "plan-b") && n.signalingState !== "stable"))
915
915
  return t;
@@ -933,7 +933,7 @@ function xt(r, e) {
933
933
  return;
934
934
  const n = r && r.MediaStreamTrack;
935
935
  if (t.getUserMedia = function(s, i, o) {
936
- Ie(
936
+ Oe(
937
937
  "navigator.getUserMedia",
938
938
  "navigator.mediaDevices.getUserMedia"
939
939
  ), t.mediaDevices.getUserMedia(s).then(i, o);
@@ -1036,13 +1036,13 @@ function Et(r) {
1036
1036
  e && (r.RTCPeerConnection.prototype.getReceivers = function() {
1037
1037
  const n = e.apply(this, []);
1038
1038
  return n.forEach((s) => s._pc = this), n;
1039
- }), O(r, "track", (t) => (t.receiver._pc = t.srcElement, t)), r.RTCRtpReceiver.prototype.getStats = function() {
1039
+ }), I(r, "track", (t) => (t.receiver._pc = t.srcElement, t)), r.RTCRtpReceiver.prototype.getStats = function() {
1040
1040
  return this._pc.getStats(this.track);
1041
1041
  };
1042
1042
  }
1043
1043
  function wt(r) {
1044
1044
  !r.RTCPeerConnection || "removeStream" in r.RTCPeerConnection.prototype || (r.RTCPeerConnection.prototype.removeStream = function(t) {
1045
- Ie("removeStream", "removeTrack"), this.getSenders().forEach((n) => {
1045
+ Oe("removeStream", "removeTrack"), this.getSenders().forEach((n) => {
1046
1046
  n.track && t.getTracks().includes(n.track) && this.removeTrack(n);
1047
1047
  });
1048
1048
  });
@@ -1082,7 +1082,7 @@ function At(r, e) {
1082
1082
  return o;
1083
1083
  });
1084
1084
  }
1085
- function Ot(r, e) {
1085
+ function It(r, e) {
1086
1086
  if (!(typeof r == "object" && r.RTCRtpSender) || e.version >= 110)
1087
1087
  return;
1088
1088
  const t = r.RTCRtpSender.prototype.getParameters;
@@ -1091,7 +1091,7 @@ function Ot(r, e) {
1091
1091
  return "encodings" in s || (s.encodings = [].concat(this.sendEncodings || [{}])), s;
1092
1092
  });
1093
1093
  }
1094
- function It(r, e) {
1094
+ function Ot(r, e) {
1095
1095
  if (!(typeof r == "object" && r.RTCPeerConnection) || e.version >= 110)
1096
1096
  return;
1097
1097
  const t = r.RTCPeerConnection.prototype.createOffer;
@@ -1115,9 +1115,9 @@ const tt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1115
1115
  __proto__: null,
1116
1116
  shimAddTransceiver: At,
1117
1117
  shimCreateAnswer: Dt,
1118
- shimCreateOffer: It,
1118
+ shimCreateOffer: Ot,
1119
1119
  shimGetDisplayMedia: Pn,
1120
- shimGetParameters: Ot,
1120
+ shimGetParameters: It,
1121
1121
  shimGetStats: Rt,
1122
1122
  shimGetUserMedia: xt,
1123
1123
  shimOnTrack: Tt,
@@ -1246,7 +1246,7 @@ function zt(r) {
1246
1246
  const i = [];
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 ? (Ie("RTCIceServer.url", "RTCIceServer.urls"), a = JSON.parse(JSON.stringify(a)), a.urls = a.url, delete a.url, i.push(a)) : i.push(n.iceServers[o]);
1249
+ a.urls === void 0 && a.url ? (Oe("RTCIceServer.url", "RTCIceServer.urls"), a = JSON.parse(JSON.stringify(a)), a.urls = a.url, delete a.url, i.push(a)) : i.push(n.iceServers[o]);
1250
1250
  }
1251
1251
  n.iceServers = i;
1252
1252
  }
@@ -1295,7 +1295,7 @@ const nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1295
1295
  function En(r) {
1296
1296
  return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
1297
1297
  }
1298
- var Vt = { exports: {} };
1298
+ var Ht = { exports: {} };
1299
1299
  (function(r) {
1300
1300
  const e = {};
1301
1301
  e.generateIdentifier = function() {
@@ -1682,12 +1682,12 @@ t=0 0\r
1682
1682
  return !1;
1683
1683
  return !0;
1684
1684
  }, r.exports = e;
1685
- })(Vt);
1686
- var Ht = Vt.exports;
1687
- const L = /* @__PURE__ */ En(Ht), wn = /* @__PURE__ */ _n({
1685
+ })(Ht);
1686
+ var Vt = Ht.exports;
1687
+ const L = /* @__PURE__ */ En(Vt), wn = /* @__PURE__ */ _n({
1688
1688
  __proto__: null,
1689
1689
  default: L
1690
- }, [Ht]);
1690
+ }, [Vt]);
1691
1691
  function J(r) {
1692
1692
  if (!r.RTCIceCandidate || r.RTCIceCandidate && "foundation" in r.RTCIceCandidate.prototype)
1693
1693
  return;
@@ -1711,13 +1711,13 @@ function J(r) {
1711
1711
  }, s;
1712
1712
  }
1713
1713
  return new e(n);
1714
- }, r.RTCIceCandidate.prototype = e.prototype, O(r, "icecandidate", (t) => (t.candidate && Object.defineProperty(t, "candidate", {
1714
+ }, r.RTCIceCandidate.prototype = e.prototype, I(r, "icecandidate", (t) => (t.candidate && Object.defineProperty(t, "candidate", {
1715
1715
  value: new r.RTCIceCandidate(t.candidate),
1716
1716
  writable: "false"
1717
1717
  }), t));
1718
1718
  }
1719
1719
  function ye(r) {
1720
- !r.RTCIceCandidate || r.RTCIceCandidate && "relayProtocol" in r.RTCIceCandidate.prototype || O(r, "icecandidate", (e) => {
1720
+ !r.RTCIceCandidate || r.RTCIceCandidate && "relayProtocol" in r.RTCIceCandidate.prototype || I(r, "icecandidate", (e) => {
1721
1721
  if (e.candidate) {
1722
1722
  const t = L.parseCandidate(e.candidate.candidate);
1723
1723
  t.type === "relay" && (e.candidate.relayProtocol = {
@@ -1804,7 +1804,7 @@ function Y(r, e) {
1804
1804
  r.RTCPeerConnection.prototype.createDataChannel = function() {
1805
1805
  const i = n.apply(this, arguments);
1806
1806
  return t(i, this), i;
1807
- }, O(r, "datachannel", (s) => (t(s.channel, s.target), s));
1807
+ }, I(r, "datachannel", (s) => (t(s.channel, s.target), s));
1808
1808
  }
1809
1809
  function be(r) {
1810
1810
  if (!r.RTCPeerConnection || "connectionState" in r.RTCPeerConnection.prototype)
@@ -1916,7 +1916,7 @@ function An({ window: r } = {}, e = {
1916
1916
  shimFirefox: !0,
1917
1917
  shimSafari: !0
1918
1918
  }) {
1919
- const t = Oe, n = Rn(r), s = {
1919
+ const t = Ie, n = Rn(r), s = {
1920
1920
  browserDetails: n,
1921
1921
  commonShim: Mn,
1922
1922
  extractVersion: z,
@@ -1936,7 +1936,7 @@ function An({ window: r } = {}, e = {
1936
1936
  case "firefox":
1937
1937
  if (!tt || !me || !e.shimFirefox)
1938
1938
  return t("Firefox shim is not included in this adapter release."), s;
1939
- t("adapter.js shimming firefox."), s.browserShim = tt, G(r, n), Q(r), xt(r, n), me(r, n), Rt(r, n), Tt(r), wt(r), Pt(r), Et(r), Mt(r), At(r, n), Ot(r, n), It(r, n), Dt(r, n), J(r), be(r), W(r, n), Y(r, n);
1939
+ t("adapter.js shimming firefox."), s.browserShim = tt, G(r, n), Q(r), xt(r, n), me(r, n), Rt(r, n), Tt(r), wt(r), Pt(r), Et(r), Mt(r), At(r, n), It(r, n), Ot(r, n), Dt(r, n), J(r), be(r), W(r, n), Y(r, n);
1940
1940
  break;
1941
1941
  case "safari":
1942
1942
  if (!nt || !e.shimSafari)
@@ -1950,7 +1950,7 @@ function An({ window: r } = {}, e = {
1950
1950
  return s;
1951
1951
  }
1952
1952
  const rt = An({ window: typeof window > "u" ? void 0 : window });
1953
- function I(r, e, t, n) {
1953
+ function O(r, e, t, n) {
1954
1954
  Object.defineProperty(r, e, { get: t, set: n, enumerable: !0, configurable: !0 });
1955
1955
  }
1956
1956
  class Kt {
@@ -1971,7 +1971,7 @@ class Kt {
1971
1971
  };
1972
1972
  }
1973
1973
  }
1974
- function On(r) {
1974
+ function In(r) {
1975
1975
  let e = 0;
1976
1976
  for (const s of r) e += s.byteLength;
1977
1977
  const t = new Uint8Array(e);
@@ -2031,7 +2031,7 @@ const he = (
2031
2031
  "safari"
2032
2032
  ], this.minFirefoxVersion = 59, this.minChromeVersion = 72, this.minSafariVersion = 605;
2033
2033
  }
2034
- }(), In = (r) => !r || /^[A-Za-z0-9]+(?:[ _-][A-Za-z0-9]+)*$/.test(r), Jt = () => Math.random().toString(36).slice(2), st = {
2034
+ }(), On = (r) => !r || /^[A-Za-z0-9]+(?:[ _-][A-Za-z0-9]+)*$/.test(r), Jt = () => Math.random().toString(36).slice(2), st = {
2035
2035
  iceServers: [
2036
2036
  {
2037
2037
  urls: "stun:stun.l.google.com:19302"
@@ -2109,7 +2109,7 @@ class Dn extends Kt {
2109
2109
  }
2110
2110
  return t;
2111
2111
  }(), // Ensure alphanumeric ids
2112
- this.validateId = In, this.randomToken = Jt;
2112
+ this.validateId = On, this.randomToken = Jt;
2113
2113
  }
2114
2114
  }
2115
2115
  const k = new Dn(), Ln = "PeerJS: ";
@@ -2145,9 +2145,9 @@ class $n {
2145
2145
  }
2146
2146
  }
2147
2147
  var f = new $n(), De = {}, Bn = Object.prototype.hasOwnProperty, C = "~";
2148
- function V() {
2148
+ function H() {
2149
2149
  }
2150
- Object.create && (V.prototype = /* @__PURE__ */ Object.create(null), new V().__proto__ || (C = !1));
2150
+ Object.create && (H.prototype = /* @__PURE__ */ Object.create(null), new H().__proto__ || (C = !1));
2151
2151
  function Un(r, e, t) {
2152
2152
  this.fn = r, this.context = e, this.once = t || !1;
2153
2153
  }
@@ -2160,10 +2160,10 @@ function Wt(r, e, t, n, s) {
2160
2160
  ] : r._events[o].push(i) : (r._events[o] = i, r._eventsCount++), r;
2161
2161
  }
2162
2162
  function X(r, e) {
2163
- --r._eventsCount === 0 ? r._events = new V() : delete r._events[e];
2163
+ --r._eventsCount === 0 ? r._events = new H() : delete r._events[e];
2164
2164
  }
2165
2165
  function S() {
2166
- this._events = new V(), this._eventsCount = 0;
2166
+ this._events = new H(), this._eventsCount = 0;
2167
2167
  }
2168
2168
  S.prototype.eventNames = function() {
2169
2169
  var e = [], t, n;
@@ -2250,7 +2250,7 @@ S.prototype.removeListener = function(e, t, n, s) {
2250
2250
  };
2251
2251
  S.prototype.removeAllListeners = function(e) {
2252
2252
  var t;
2253
- return e ? (t = C ? C + e : e, this._events[t] && X(this, t)) : (this._events = new V(), this._eventsCount = 0), this;
2253
+ return e ? (t = C ? C + e : e, this._events[t] && X(this, t)) : (this._events = new H(), this._eventsCount = 0), this;
2254
2254
  };
2255
2255
  S.prototype.off = S.prototype.removeListener;
2256
2256
  S.prototype.addListener = S.prototype.on;
@@ -2258,13 +2258,13 @@ S.prefixed = C;
2258
2258
  S.EventEmitter = S;
2259
2259
  De = S;
2260
2260
  var D = {};
2261
- I(D, "ConnectionType", () => w);
2262
- I(D, "PeerErrorType", () => y);
2263
- I(D, "BaseConnectionErrorType", () => ve);
2264
- I(D, "DataConnectionErrorType", () => Le);
2265
- I(D, "SerializationType", () => ie);
2266
- I(D, "SocketEventType", () => E);
2267
- I(D, "ServerMessageType", () => v);
2261
+ O(D, "ConnectionType", () => w);
2262
+ O(D, "PeerErrorType", () => y);
2263
+ O(D, "BaseConnectionErrorType", () => ve);
2264
+ O(D, "DataConnectionErrorType", () => Le);
2265
+ O(D, "SerializationType", () => ie);
2266
+ O(D, "SocketEventType", () => E);
2267
+ O(D, "ServerMessageType", () => v);
2268
2268
  var w = /* @__PURE__ */ function(r) {
2269
2269
  return r.Data = "data", r.Media = "media", r;
2270
2270
  }({}), y = /* @__PURE__ */ function(r) {
@@ -2801,7 +2801,7 @@ class le extends $e {
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 s = On(n.data);
2804
+ const s = In(n.data);
2805
2805
  this._handleDataMessage({
2806
2806
  data: s
2807
2807
  });
@@ -3169,8 +3169,8 @@ const q = class q extends Qt {
3169
3169
  };
3170
3170
  Ae = new WeakMap(), B(q, Ae, q.DEFAULT_KEY = "peerjs");
3171
3171
  let Se = q;
3172
- var Vn = Se;
3173
- class Hn {
3172
+ var Hn = Se;
3173
+ class Vn {
3174
3174
  constructor(e) {
3175
3175
  this.config = e, this.peer = null, this.localStream = null, this.connections = {}, this.callbacks = {
3176
3176
  onStream: null,
@@ -3188,7 +3188,7 @@ class Hn {
3188
3188
  async initialize(e, t = 0) {
3189
3189
  return new Promise((n, s) => {
3190
3190
  const i = t === 0 ? e : `${e}-r${Math.random().toString(36).slice(2, 6)}`;
3191
- this.peer = new Vn(i, {
3191
+ this.peer = new Hn(i, {
3192
3192
  host: this.config.peerServer.host,
3193
3193
  port: this.config.peerServer.port,
3194
3194
  path: this.config.peerServer.path || "/peerjs",
@@ -3465,7 +3465,7 @@ function Xn() {
3465
3465
  });
3466
3466
  }
3467
3467
  let ue;
3468
- function H(r) {
3468
+ function V(r) {
3469
3469
  return r.reduce((e, t) => e + t.length, 0);
3470
3470
  }
3471
3471
  function K(r, e) {
@@ -3485,17 +3485,17 @@ function Zn(r, e) {
3485
3485
  transform(o, a) {
3486
3486
  for (t.push(o); ; ) {
3487
3487
  if (n === 0) {
3488
- if (H(t) < 1)
3488
+ if (V(t) < 1)
3489
3489
  break;
3490
3490
  const c = K(t, 1);
3491
3491
  i = (c[0] & 128) === 128, s = c[0] & 127, s < 126 ? n = 3 : s === 126 ? n = 1 : n = 2;
3492
3492
  } else if (n === 1) {
3493
- if (H(t) < 2)
3493
+ if (V(t) < 2)
3494
3494
  break;
3495
3495
  const c = K(t, 2);
3496
3496
  s = new DataView(c.buffer, c.byteOffset, c.length).getUint16(0), n = 3;
3497
3497
  } else if (n === 2) {
3498
- if (H(t) < 8)
3498
+ if (V(t) < 8)
3499
3499
  break;
3500
3500
  const c = K(t, 8), h = new DataView(c.buffer, c.byteOffset, c.length), l = h.getUint32(0);
3501
3501
  if (l > Math.pow(2, 21) - 1) {
@@ -3504,7 +3504,7 @@ function Zn(r, e) {
3504
3504
  }
3505
3505
  s = l * Math.pow(2, 32) + h.getUint32(4), n = 3;
3506
3506
  } else {
3507
- if (H(t) < s)
3507
+ if (V(t) < s)
3508
3508
  break;
3509
3509
  const c = K(t, s);
3510
3510
  a.enqueue(Ue(i ? c : ue.decode(c), e)), n = 0;
@@ -4543,7 +4543,7 @@ function Te(r, e) {
4543
4543
  }
4544
4544
  return r;
4545
4545
  }
4546
- function Or(r, e) {
4546
+ function Ir(r, e) {
4547
4547
  return r.data = Re(r.data, e), delete r.attachments, r;
4548
4548
  }
4549
4549
  function Re(r, e) {
@@ -4561,7 +4561,7 @@ function Re(r, e) {
4561
4561
  Object.prototype.hasOwnProperty.call(r, t) && (r[t] = Re(r[t], e));
4562
4562
  return r;
4563
4563
  }
4564
- const Ir = [
4564
+ const Or = [
4565
4565
  "connect",
4566
4566
  // used on the client side
4567
4567
  "connect_error",
@@ -4724,7 +4724,7 @@ class Fe extends b {
4724
4724
  return typeof t == "string" || ht(t);
4725
4725
  case g.EVENT:
4726
4726
  case g.BINARY_EVENT:
4727
- return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && Ir.indexOf(t[0]) === -1);
4727
+ return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && Or.indexOf(t[0]) === -1);
4728
4728
  case g.ACK:
4729
4729
  case g.BINARY_ACK:
4730
4730
  return Array.isArray(t);
@@ -4751,7 +4751,7 @@ class Lr {
4751
4751
  */
4752
4752
  takeBinaryData(e) {
4753
4753
  if (this.buffers.push(e), this.buffers.length === this.reconPack.attachments) {
4754
- const t = Or(this.reconPack, this.buffers);
4754
+ const t = Ir(this.reconPack, this.buffers);
4755
4755
  return this.finishedReconstruction(), t;
4756
4756
  }
4757
4757
  return null;
@@ -5934,7 +5934,7 @@ class qe {
5934
5934
  this.ctx.fillStyle = "#0d0d0d", this.ctx.fillRect(0, 0, this.width, this.height);
5935
5935
  const e = Array.from(this.videos.values());
5936
5936
  if (e.length === 0) return;
5937
- const { cols: t, rows: n } = Vr(e.length), s = this.width / t, i = this.height / n;
5937
+ const { cols: t, rows: n } = Hr(e.length), s = this.width / t, i = this.height / n;
5938
5938
  e.forEach((o, a) => {
5939
5939
  const c = a % t, h = Math.floor(a / t), l = c * s, d = h * i;
5940
5940
  this.ctx.fillStyle = "#1a1a1a", this.ctx.fillRect(l, d, s, i);
@@ -5947,10 +5947,10 @@ class qe {
5947
5947
  }
5948
5948
  } else
5949
5949
  qr(this.ctx, o.label || "Peer", l, d, s, i);
5950
- const Ve = o.label || "Peer";
5950
+ const He = o.label || "Peer";
5951
5951
  this.ctx.font = "bold 16px system-ui, sans-serif";
5952
- const fn = this.ctx.measureText(Ve), He = 10, pn = 6, gn = fn.width + He * 2, ce = 24, Ke = l + 12, Je = d + i - ce - 12;
5953
- this.ctx.fillStyle = "rgba(0,0,0,0.65)", this.ctx.fillRect(Ke, Je, gn, ce), this.ctx.fillStyle = "#fff", this.ctx.fillText(Ve, Ke + He, Je + ce - pn - 2);
5952
+ const fn = this.ctx.measureText(He), Ve = 10, pn = 6, gn = fn.width + Ve * 2, ce = 24, Ke = l + 12, Je = d + i - ce - 12;
5953
+ this.ctx.fillStyle = "rgba(0,0,0,0.65)", this.ctx.fillRect(Ke, Je, gn, ce), this.ctx.fillStyle = "#fff", this.ctx.fillText(He, Ke + Ve, Je + ce - pn - 2);
5954
5954
  });
5955
5955
  }
5956
5956
  addStream(e, t, n = {}) {
@@ -6021,7 +6021,7 @@ function qr(r, e, t, n, s, i) {
6021
6021
  const o = t + s / 2, a = n + i / 2, c = Math.min(s, i) * 0.22;
6022
6022
  r.fillStyle = jr(e), r.beginPath(), r.arc(o, a, c, 0, Math.PI * 2), r.fill(), r.fillStyle = "#fff", r.font = `600 ${Math.floor(c)}px system-ui, sans-serif`, r.textAlign = "center", r.textBaseline = "middle", r.fillText(Fr(e), o, a + 1), r.textAlign = "start", r.textBaseline = "alphabetic";
6023
6023
  }
6024
- function Vr(r) {
6024
+ function Hr(r) {
6025
6025
  if (r <= 1) return { cols: 1, rows: 1 };
6026
6026
  if (r === 2) return { cols: 2, rows: 1 };
6027
6027
  if (r <= 4) return { cols: 2, rows: 2 };
@@ -6030,7 +6030,7 @@ function Vr(r) {
6030
6030
  const e = 4;
6031
6031
  return { cols: e, rows: Math.ceil(r / e) };
6032
6032
  }
6033
- function Hr(r, e) {
6033
+ function Vr(r, e) {
6034
6034
  return r.includes("pdf") || /\.pdf$/i.test(e) ? "📕" : r.includes("word") || /\.docx?$/i.test(e) ? "📘" : r.includes("sheet") || r.includes("excel") || /\.(xlsx?|csv)$/i.test(e) ? "📗" : r.startsWith("text/") ? "📄" : "📎";
6035
6035
  }
6036
6036
  class Kr {
@@ -6118,9 +6118,13 @@ class Kr {
6118
6118
  const o = document.createElement("div");
6119
6119
  o.id = `video-${e}`, o.dataset.peerId = e, o.style.cssText = "position: relative; background-color: #2a2a2a; border-radius: 8px; overflow: hidden; aspect-ratio: 16/9;";
6120
6120
  const a = document.createElement("video");
6121
- a.srcObject = t, a.autoplay = !0, a.playsInline = !0, a.muted = n, a.style.cssText = "width: 100%; height: 100%; object-fit: cover;";
6122
- const c = document.createElement("div");
6123
- c.textContent = n ? "You" : s || "Peer", c.style.cssText = "position: absolute; bottom: 10px; left: 10px; background-color: rgba(0,0,0,0.7); padding: 5px 10px; border-radius: 4px; font-size: 14px;", o.appendChild(a), o.appendChild(c), i.appendChild(o), this.videoElements[e] = o;
6121
+ a.srcObject = t, a.autoplay = !0, a.playsInline = !0, a.muted = n;
6122
+ const c = t && t.getVideoTracks && t.getVideoTracks().some((u) => !(u.getSettings ? u.getSettings() : {}).displaySurface), h = n && c;
6123
+ a.style.cssText = "width: 100%; height: 100%; object-fit: cover;" + (h ? " transform: scaleX(-1);" : ""), a.dataset.mirror = h ? "1" : "0";
6124
+ const l = document.createElement("div");
6125
+ l.textContent = n ? "You" : s || "Peer", l.style.cssText = "position: absolute; bottom: 10px; left: 10px; background-color: rgba(0,0,0,0.7); padding: 5px 10px; border-radius: 4px; font-size: 14px;", o.appendChild(a), o.appendChild(l);
6126
+ const d = i.querySelector("#others-strip");
6127
+ d && e !== this._presentingPeer ? d.appendChild(o) : i.appendChild(o), this.videoElements[e] = o, this._presentingPeer && this.setPresentingPeer(this._presentingPeer);
6124
6128
  }
6125
6129
  renderPanelTabs() {
6126
6130
  return [
@@ -6185,7 +6189,7 @@ class Kr {
6185
6189
  <img src="${i}" alt="${s}" style="max-width:100%; border-radius:6px; display:block;" />
6186
6190
  <div style="font-size:11px; color:#888; margin-top:2px;">${s} · ${n} KB</div>
6187
6191
  </a>`;
6188
- const o = Hr(e.contentType || "", e.fileName || "");
6192
+ const o = Vr(e.contentType || "", e.fileName || "");
6189
6193
  return `<a href="${i}" 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;">
6190
6194
  <span style="font-size:22px;">${o}</span>
6191
6195
  <div style="min-width:0; flex:1; overflow:hidden;">
@@ -6302,20 +6306,43 @@ class Kr {
6302
6306
  setPresentingPeer(e) {
6303
6307
  if (!this.container) return;
6304
6308
  const t = this.container.querySelector("#video-container");
6305
- t && (e ? (t.setAttribute("data-hero", e), t.style.gridTemplateColumns = "1fr", t.style.gridAutoRows = "auto") : (t.removeAttribute("data-hero"), t.style.gridTemplateColumns = "repeat(auto-fit, minmax(300px, 1fr))", t.style.gridAutoRows = "minmax(200px, 1fr)"), Object.entries(this.videoElements).forEach(([n, s]) => {
6306
- e && n === e ? (s.style.gridColumn = "1 / -1", s.style.aspectRatio = "16 / 9", s.style.maxHeight = "65vh") : e ? (s.style.gridColumn = "", s.style.maxHeight = "160px", s.style.aspectRatio = "16 / 9") : (s.style.gridColumn = "", s.style.maxHeight = "", s.style.aspectRatio = "16 / 9");
6307
- }));
6309
+ if (!t) return;
6310
+ this._presentingPeer = e || null, e ? (t.setAttribute("data-hero", e), t.style.display = "flex", t.style.flexDirection = "column", t.style.gap = "10px", t.style.gridTemplateColumns = "", t.style.gridAutoRows = "", t.style.overflow = "hidden") : (t.removeAttribute("data-hero"), t.style.display = "grid", t.style.flexDirection = "", t.style.gridTemplateColumns = "repeat(auto-fit, minmax(300px, 1fr))", t.style.gridAutoRows = "minmax(200px, 1fr)", t.style.overflow = "");
6311
+ let n = t.querySelector("#others-strip");
6312
+ if (e)
6313
+ 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;", t.appendChild(n));
6314
+ else if (n) {
6315
+ for (; n.firstChild; ) t.appendChild(n.firstChild);
6316
+ n.remove();
6317
+ }
6318
+ Object.entries(this.videoElements).forEach(([s, i]) => {
6319
+ e && s === e ? (i.parentNode === n && t.insertBefore(i, n), i.style.gridColumn = "", i.style.flex = "1 1 auto", i.style.minHeight = "0", i.style.width = "100%", i.style.aspectRatio = "", i.style.maxHeight = "") : e ? (i.parentNode !== n && n.appendChild(i), i.style.flex = "0 0 auto", i.style.width = "213px", i.style.height = "120px", i.style.minHeight = "", i.style.aspectRatio = "", i.style.maxHeight = "", i.style.gridColumn = "") : (i.parentNode === n && t.appendChild(i), i.style.flex = "", i.style.width = "", i.style.height = "", i.style.minHeight = "", i.style.gridColumn = "", i.style.maxHeight = "", i.style.aspectRatio = "16 / 9");
6320
+ });
6308
6321
  }
6309
- setParticipants(e) {
6322
+ setParticipants(e, t = {}) {
6310
6323
  if (!this.container) return;
6311
- const t = this.container.querySelector("#participants-list"), n = this.container.querySelector("#participants-count");
6312
- n && (n.textContent = `(${e.length})`), t && (t.innerHTML = e.map((s) => {
6313
- const i = s.isYou ? " (You)" : s.isHost ? " · host" : "", o = this.escapeHtml(s.label) + i;
6324
+ const n = this.container.querySelector("#participants-list"), s = this.container.querySelector("#participants-count");
6325
+ if (s && (s.textContent = `(${e.length})`), !n) return;
6326
+ const i = !!t.showControls;
6327
+ n.innerHTML = e.map((o, a) => {
6328
+ const c = o.isYou ? " (You)" : o.isHost ? " · host" : "", h = this.escapeHtml(o.label) + c, l = `<span style="display:inline-block; width:8px; height:8px; border-radius:50%; background:${o.isSharing ? "#a3e635" : "#6366f1"};"></span>`, d = i && !o.isHost && !o.isYou && o.userId ? `<span style="margin-left:auto; display:inline-flex; gap:4px;">
6329
+ <button data-idx="${a}" data-perm="code" title="Toggle code edit" style="padding:2px 6px; font-size:10px; border-radius:4px; border:1px solid ${o.canEditCode ? "#22c55e" : "#3a3a3a"}; background:${o.canEditCode ? "#052e16" : "#1a1a1a"}; color:${o.canEditCode ? "#4ade80" : "#888"}; cursor:pointer;">Code</button>
6330
+ <button data-idx="${a}" data-perm="board" title="Toggle whiteboard draw" style="padding:2px 6px; font-size:10px; border-radius:4px; border:1px solid ${o.canDrawBoard ? "#22c55e" : "#3a3a3a"}; background:${o.canDrawBoard ? "#052e16" : "#1a1a1a"}; color:${o.canDrawBoard ? "#4ade80" : "#888"}; cursor:pointer;">Board</button>
6331
+ </span>` : "";
6314
6332
  return `<div style="font-size:12px; color:#ccc; padding:2px 0; display:flex; align-items:center; gap:6px;">
6315
- <span style="display:inline-block; width:8px; height:8px; border-radius:50%; background:${s.isSharing ? "#a3e635" : "#6366f1"};"></span>
6316
- ${o}${s.isSharing ? " · presenting" : ""}
6333
+ ${l}
6334
+ ${h}${o.isSharing ? " · presenting" : ""}
6335
+ ${d}
6317
6336
  </div>`;
6318
- }).join(""));
6337
+ }).join(""), i && this._onParticipantPermToggle && n.querySelectorAll("button[data-perm]").forEach((o) => {
6338
+ o.addEventListener("click", () => {
6339
+ const a = e[parseInt(o.getAttribute("data-idx"), 10)], c = o.getAttribute("data-perm");
6340
+ this._onParticipantPermToggle(a, c);
6341
+ });
6342
+ });
6343
+ }
6344
+ onParticipantPermToggle(e) {
6345
+ this._onParticipantPermToggle = e;
6319
6346
  }
6320
6347
  setPauseButtonVisible(e) {
6321
6348
  const t = this.container && this.container.querySelector("#toggle-pause");
@@ -6592,7 +6619,7 @@ class Zr {
6592
6619
  recordingVideoBps: d,
6593
6620
  recordingAudioBps: u,
6594
6621
  panels: m
6595
- }, this.myRole = null, this.roleResolvers = [], this.currentRoom = this.config.roomId, this.currentUser = this.config.user, this.peerManager = new Hn(this.config), this.socketManager = new Nr(this.config), this.mediaManager = new zr(), this.uiManager = new Kr({
6622
+ }, this.myRole = null, this.roleResolvers = [], this.currentRoom = this.config.roomId, this.currentUser = this.config.user, this.peerManager = new Vn(this.config), this.socketManager = new Nr(this.config), this.mediaManager = new zr(), this.uiManager = new Kr({
6596
6623
  recording: n,
6597
6624
  screenShare: e.screenShare !== !1,
6598
6625
  panels: m
@@ -6663,18 +6690,28 @@ class Zr {
6663
6690
  const e = [];
6664
6691
  if (this.currentUser && e.push({
6665
6692
  label: this.currentUser.name || "You",
6693
+ userId: this.currentUser.id,
6666
6694
  isYou: !0,
6667
6695
  isHost: this.myRole === "organizer",
6668
6696
  isSharing: this.peerManager && this.peerManager.isScreenSharing && this.peerManager.isScreenSharing()
6669
- }), this.peerLabels)
6670
- for (const [t, n] of this.peerLabels.entries())
6697
+ }), this.peerLabels) {
6698
+ const t = `${this.config.workspace}-${this.currentRoom}-`;
6699
+ for (const [n, s] of this.peerLabels.entries()) {
6700
+ const i = n.startsWith(t) ? n.slice(t.length) : n;
6671
6701
  e.push({
6672
- label: n,
6702
+ label: s,
6703
+ userId: i,
6673
6704
  isYou: !1,
6674
- isHost: this.hostPeerId === t,
6675
- isSharing: this.presentingPeerId === t
6705
+ isHost: this.hostPeerId === n,
6706
+ isSharing: this.presentingPeerId === n,
6707
+ canEditCode: this.codePermsByUser ? !!this.codePermsByUser.get(i) : !1,
6708
+ canDrawBoard: this.boardPermsByUser ? !!this.boardPermsByUser.get(i) : !1
6676
6709
  });
6677
- this.uiManager.setParticipants(e);
6710
+ }
6711
+ }
6712
+ this.uiManager.setParticipants(e, {
6713
+ showControls: this.myRole === "organizer"
6714
+ });
6678
6715
  }
6679
6716
  waitForRole(e = 3e3) {
6680
6717
  return this.myRole ? Promise.resolve(this.myRole) : new Promise((t) => {
@@ -6716,7 +6753,17 @@ class Zr {
6716
6753
  }).catch((s) => console.warn("Chat history fetch failed:", s && s.message)), console.log("MeetSDK mounted");
6717
6754
  }
6718
6755
  setupCollabPanels() {
6719
- if (this.uiManager && !this.uiManager._panelWired && (this.uiManager.wirePanelTabs(), this.uiManager._panelWired = !0), this.config.panels.includes("code")) {
6756
+ if (this.uiManager && !this.uiManager._panelWired && (this.uiManager.wirePanelTabs(), this.uiManager._panelWired = !0), this.codePermsByUser = this.codePermsByUser || /* @__PURE__ */ new Map(), this.boardPermsByUser = this.boardPermsByUser || /* @__PURE__ */ new Map(), this.uiManager && this.uiManager.onParticipantPermToggle && this.uiManager.onParticipantPermToggle((e, t) => {
6757
+ if (!(this.myRole !== "organizer" || !e || !e.userId)) {
6758
+ if (t === "code") {
6759
+ const n = !this.codePermsByUser.get(e.userId);
6760
+ this.grantCodeEdit(e.userId, e.label, n);
6761
+ } else if (t === "board") {
6762
+ const n = !this.boardPermsByUser.get(e.userId);
6763
+ this.grantWhiteboardDraw(e.userId, e.label, n);
6764
+ }
6765
+ }
6766
+ }), this.config.panels.includes("code")) {
6720
6767
  const e = this.uiManager.getPanelSlot("code");
6721
6768
  e && (this.codeSandbox = new Jr({
6722
6769
  container: e,
@@ -6735,14 +6782,16 @@ class Zr {
6735
6782
  if (t && Array.isArray(t.editPermissions)) {
6736
6783
  const n = t.editPermissions.find((s) => s.userId === this.currentUser.id);
6737
6784
  this._codeEditPermission = !!(n && n.canEdit);
6785
+ for (const s of t.editPermissions) this.codePermsByUser.set(s.userId, !!s.canEdit);
6738
6786
  }
6739
- this.codeSandbox.handleStateSync(t);
6787
+ this.codeSandbox.handleStateSync(t), this.refreshParticipantsPanel();
6740
6788
  }), this.socketManager.onRaw("code-permission-changed", (t) => {
6741
- if (t && t.targetUserId === this.currentUser.id && (this._codeEditPermission = !!t.canEdit), Array.isArray(t && t.editPermissions)) {
6789
+ if (t && t.targetUserId === this.currentUser.id && (this._codeEditPermission = !!t.canEdit), t && t.targetUserId && this.codePermsByUser.set(t.targetUserId, !!t.canEdit), Array.isArray(t && t.editPermissions)) {
6742
6790
  const n = t.editPermissions.find((s) => s.userId === this.currentUser.id);
6743
6791
  n && (this._codeEditPermission = !!n.canEdit);
6792
+ for (const s of t.editPermissions) this.codePermsByUser.set(s.userId, !!s.canEdit);
6744
6793
  }
6745
- this.codeSandbox.refreshPermissionUI();
6794
+ this.codeSandbox.refreshPermissionUI(), this.refreshParticipantsPanel();
6746
6795
  }), this.socketManager.emit("code-state-request", { roomId: this.currentRoom }));
6747
6796
  }
6748
6797
  if (this.config.panels.includes("whiteboard")) {
@@ -6763,14 +6812,16 @@ class Zr {
6763
6812
  if (t && Array.isArray(t.drawPermissions)) {
6764
6813
  const n = t.drawPermissions.find((s) => s.userId === this.currentUser.id);
6765
6814
  this._whiteboardDrawPermission = !!(n && n.canDraw);
6815
+ for (const s of t.drawPermissions) this.boardPermsByUser.set(s.userId, !!s.canDraw);
6766
6816
  }
6767
- this.whiteboard.handleStateSync(t);
6817
+ this.whiteboard.handleStateSync(t), this.refreshParticipantsPanel();
6768
6818
  }), this.socketManager.onRaw("whiteboard-permission-changed", (t) => {
6769
- if (t && t.targetUserId === this.currentUser.id && (this._whiteboardDrawPermission = !!t.canDraw), Array.isArray(t && t.drawPermissions)) {
6819
+ if (t && t.targetUserId === this.currentUser.id && (this._whiteboardDrawPermission = !!t.canDraw), t && t.targetUserId && this.boardPermsByUser.set(t.targetUserId, !!t.canDraw), Array.isArray(t && t.drawPermissions)) {
6770
6820
  const n = t.drawPermissions.find((s) => s.userId === this.currentUser.id);
6771
6821
  n && (this._whiteboardDrawPermission = !!n.canDraw);
6822
+ for (const s of t.drawPermissions) this.boardPermsByUser.set(s.userId, !!s.canDraw);
6772
6823
  }
6773
- this.whiteboard.refreshPermissionUI();
6824
+ this.whiteboard.refreshPermissionUI(), this.refreshParticipantsPanel();
6774
6825
  }), this.socketManager.emit("whiteboard-state-request", { roomId: this.currentRoom }));
6775
6826
  }
6776
6827
  }