@vkontakte/calls-sdk 2.8.11-dev.6637565d.0 → 2.8.11-dev.6c644bb1.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/calls-sdk.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @vkontakte/calls-sdk v2.8.11-dev.6637565d.0
3
- * Thu, 09 Jul 2026 09:32:23 GMT
2
+ * @vkontakte/calls-sdk v2.8.11-dev.6c644bb1.0
3
+ * Fri, 10 Jul 2026 11:42:14 GMT
4
4
  * https://calls-sdk.cdn-vk.ru/doc/latest/index.html
5
5
  */
6
6
 
@@ -112,31 +112,31 @@ var g = class {
112
112
  }
113
113
  }, y = /* @__PURE__ */ function(e) {
114
114
  return e.RECOVER = "recover", e.ACCEPT_CALL = "accept-call", e.ADD_PARTICIPANT = "add-participant", e.REMOVE_PARTICIPANT = "remove-participant", e.HANGUP = "hangup", e.TRANSMIT_DATA = "transmit-data", e.ACCEPT_PRODUCER = "accept-producer", e.ALLOCATE_CONSUMER = "allocate-consumer", e.CHANGE_MEDIA_SETTINGS = "change-media-settings", e.CHANGE_PARTICIPANT_STATE = "change-participant-state", e.CHANGE_STREAM_PRIORITIES = "change-streams-priorities", e.UPDATE_DISPLAY_LAYOUT = "update-display-layout", e.REPORT_PERF_STAT = "report-perf-stat", e.REPORT_SHARING_STAT = "report-sharing-stat", e.REPORT_NETWORK_STAT = "report-network-stat", e.RECORD_START = "record-start", e.RECORD_STOP = "record-stop", e.RECORD_PUBLISH = "record-publish", e.RECORD_SET_CONF = "record-set-conf", e.RECORD_GET_STATUS = "record-get-status", e.SWITCH_MICRO = "switch-micro", e.SWITCH_TOPOLOGY = "switch-topology", e.REQUEST_REALLOC = "request-realloc", e.CHAT_MESSAGE = "chat-message", e.CHAT_HISTORY = "chat-history", e.CUSTOM_DATA = "custom-data", e.GRANT_ROLES = "grant-roles", e.MUTE_PARTICIPANT = "mute-participant", e.ENABLE_FEATURE_FOR_ROLES = "enable-feature-for-roles", e.PIN_PARTICIPANT = "pin-participant", e.UPDATE_MEDIA_MODIFIERS = "update-media-modifiers", e.CHANGE_OPTIONS = "change-options", e.GET_WAITING_HALL = "get-waiting-hall", e.GET_PARTICIPANT_LIST_CHUNK = "get-participant-list-chunk", e.GET_PARTICIPANTS = "get-participants", e.PROMOTE_PARTICIPANT = "promote-participant", e.REQUEST_TEST_MODE = "request-test-mode", e.ADD_MOVIE = "add-movie", e.UPDATE_MOVIE = "update-movie", e.REMOVE_MOVIE = "remove-movie", e.START_URL_SHARING = "start-url-sharing", e.STOP_URL_SHARING = "stop-url-sharing", e.GET_ROOMS = "get-rooms", e.UPDATE_ROOMS = "update-rooms", e.ACTIVATE_ROOMS = "activate-rooms", e.REMOVE_ROOMS = "remove-rooms", e.SWITCH_ROOM = "switch-room", e.FEEDBACK = "feedback", e.ASR_START = "asr-start", e.ASR_STOP = "asr-stop", e.REQUEST_ASR = "request-asr", e.REQUEST_PROMOTION = "request-promotion", e.ACCEPT_PROMOTION = "accept-promotion", e.GET_HAND_QUEUE = "get-hand-queue", e.ENABLE_VIDEO_SUSPEND = "enable-video-suspend", e.ENABLE_VIDEO_SUSPEND_SUGGEST = "enable-video-suspend-suggest", e.HOLD = "hold", e.PUT_HANDS_DOWN = "put-hands-down", e.CHANGE_SIMULCAST = "change-simulcast", e;
115
- }(y || {}), ne = 25 * 1024 * 1024, re = 10, ie = "_okcls_logs_session_", ae = 3e4, oe = "ok-calls-sdk-debug-logs", se = 1, b = "sessions", ce = "chunks", le = 120 * 1e3, ue = new Set(["WARN", "ERROR"]);
116
- function de() {
115
+ }(y || {}), ne = 25 * 1024 * 1024, re = 10, ie = "_okcls_logs_session_", ae = 3e4, oe = "ok-calls-sdk-debug-logs", se = 1, b = "sessions", x = "chunks", ce = 120 * 1e3, le = new Set(["WARN", "ERROR"]);
116
+ function ue() {
117
117
  return `${Date.now()}_${Math.random().toString(36).slice(2)}`;
118
118
  }
119
- function fe() {
120
- let e = de();
121
- return pe(e), e;
119
+ function de() {
120
+ let e = ue();
121
+ return fe(e), e;
122
122
  }
123
- function pe(e) {
123
+ function fe(e) {
124
124
  Ue.has(e) || Ue.set(e, []), We.has(e) || We.set(e, 0), Ge.has(e) || Ge.set(e, null);
125
125
  }
126
- function me(e) {
126
+ function pe(e) {
127
127
  return Ge.get(e) ?? null;
128
128
  }
129
- function he(e) {
129
+ function me(e) {
130
130
  let t = We.get(e) ?? 0;
131
131
  return We.set(e, t + 1), t;
132
132
  }
133
- function ge(e, t) {
133
+ function he(e, t) {
134
134
  return `${e}:${String(t).padStart(12, "0")}`;
135
135
  }
136
- function _e(e) {
136
+ function ge(e) {
137
137
  return new Blob([e]).size;
138
138
  }
139
- function ve() {
139
+ function _e() {
140
140
  try {
141
141
  let e = window.localStorage;
142
142
  for (let t of Object.keys(e)) t.indexOf(ie) === 0 && e.removeItem(t);
@@ -144,7 +144,7 @@ function ve() {
144
144
  console.error("Storage is blocked", e);
145
145
  }
146
146
  }
147
- var x = new class {
147
+ var S = new class {
148
148
  constructor() {
149
149
  h(this, "_db", null), h(this, "_dbPromise", null), h(this, "_supported", this.isSupported());
150
150
  }
@@ -197,7 +197,7 @@ var x = new class {
197
197
  async getChunksBySession(e) {
198
198
  let t = await this.open();
199
199
  if (!t) return [];
200
- let n = t.transaction(ce, "readonly"), r = await this.requestToPromise(n.objectStore(ce).index("sessionId").getAll(e));
200
+ let n = t.transaction(x, "readonly"), r = await this.requestToPromise(n.objectStore(x).index("sessionId").getAll(e));
201
201
  return await this.txDone(n), r.sort((e, t) => e.sequence - t.sequence);
202
202
  }
203
203
  async putSession(e) {
@@ -209,8 +209,8 @@ var x = new class {
209
209
  async putSessionAndChunk(e, t) {
210
210
  let n = await this.open();
211
211
  if (!n) return !1;
212
- let r = n.transaction([b, ce], "readwrite");
213
- return r.objectStore(b).put(e), r.objectStore(ce).put(t), await this.txDone(r), !0;
212
+ let r = n.transaction([b, x], "readwrite");
213
+ return r.objectStore(b).put(e), r.objectStore(x).put(t), await this.txDone(r), !0;
214
214
  }
215
215
  async updateSessionConversationId(e, t) {
216
216
  let [n] = await this.getSessionBySessionId(e);
@@ -223,14 +223,14 @@ var x = new class {
223
223
  async deleteSession(e) {
224
224
  let t = await this.open();
225
225
  if (!t) return 0;
226
- let n = await this.getChunksBySession(e), r = t.transaction([b, ce], "readwrite"), i = r.objectStore(ce), a = 0;
226
+ let n = await this.getChunksBySession(e), r = t.transaction([b, x], "readwrite"), i = r.objectStore(x), a = 0;
227
227
  for (let e of n) a += e.bytes, i.delete(e.id);
228
228
  return r.objectStore(b).delete(e), await this.txDone(r), a;
229
229
  }
230
230
  async deleteChunks(e) {
231
231
  let t = await this.open();
232
232
  if (!t || !e.length) return;
233
- let n = t.transaction(ce, "readwrite"), r = n.objectStore(ce);
233
+ let n = t.transaction(x, "readwrite"), r = n.objectStore(x);
234
234
  for (let t of e) r.delete(t.id);
235
235
  await this.txDone(n);
236
236
  }
@@ -264,7 +264,7 @@ var x = new class {
264
264
  let t = e.createObjectStore(b, { keyPath: "sessionId" });
265
265
  t.createIndex("conversationId", "conversationId", { unique: !1 }), t.createIndex("updatedAt", "updatedAt", { unique: !1 });
266
266
  }
267
- e.objectStoreNames.contains(ce) || e.createObjectStore(ce, { keyPath: "id" }).createIndex("sessionId", "sessionId", { unique: !1 });
267
+ e.objectStoreNames.contains(x) || e.createObjectStore(x, { keyPath: "id" }).createIndex("sessionId", "sessionId", { unique: !1 });
268
268
  }
269
269
  isSupported() {
270
270
  return typeof window < "u" && !!window.indexedDB;
@@ -335,15 +335,15 @@ var x = new class {
335
335
  return i;
336
336
  }
337
337
  }();
338
- async function ye(e) {
339
- return e.sessionId ? x.getSessionBySessionId(e.sessionId) : e.conversationId ? x.getSessionsByConversationId(e.conversationId) : [];
338
+ async function ve(e) {
339
+ return e.sessionId ? S.getSessionBySessionId(e.sessionId) : e.conversationId ? S.getSessionsByConversationId(e.conversationId) : [];
340
340
  }
341
- async function be(e, t, n, r) {
341
+ async function ye(e, t, n, r) {
342
342
  if (!r.length) return;
343
- let i = me(e) || t, a = r, o = JSON.stringify(a), s = _e(o);
344
- for (; s > ne && a.length > 1;) a = a.slice(Math.floor(a.length / 2)), o = JSON.stringify(a), s = _e(o);
343
+ let i = pe(e) || t, a = r, o = JSON.stringify(a), s = ge(o);
344
+ for (; s > ne && a.length > 1;) a = a.slice(Math.floor(a.length / 2)), o = JSON.stringify(a), s = ge(o);
345
345
  if (s > ne) return;
346
- let c = a[0].t, l = a[a.length - 1].t, [u] = await x.getSessionBySessionId(e), d = u || {
346
+ let c = a[0].t, l = a[a.length - 1].t, [u] = await S.getSessionBySessionId(e), d = u || {
347
347
  sessionId: e,
348
348
  conversationId: i,
349
349
  startTime: c,
@@ -360,7 +360,7 @@ async function be(e, t, n, r) {
360
360
  bytes: d.bytes + s,
361
361
  entriesCount: d.entriesCount + a.length
362
362
  }, p = {
363
- id: ge(e, n),
363
+ id: he(e, n),
364
364
  sessionId: e,
365
365
  sequence: n,
366
366
  startTime: c,
@@ -368,9 +368,9 @@ async function be(e, t, n, r) {
368
368
  bytes: s,
369
369
  items: a
370
370
  };
371
- await x.putSessionAndChunk(f, p) && await x.enforceRetentionPolicy();
371
+ await S.putSessionAndChunk(f, p) && await S.enforceRetentionPolicy();
372
372
  }
373
- function xe(e) {
373
+ function be(e) {
374
374
  let t = /* @__PURE__ */ new WeakSet();
375
375
  try {
376
376
  return JSON.parse(JSON.stringify(e, (e, n) => {
@@ -385,23 +385,23 @@ function xe(e) {
385
385
  return e.map((e) => String(e));
386
386
  }
387
387
  }
388
- function Se(e) {
388
+ function xe(e) {
389
389
  let t = Ue.get(e);
390
390
  if (!t?.length) return Je;
391
- let n = t.splice(0), r = me(e), i = he(e);
392
- return Je = Je.then(() => be(e, r, i, n)).catch((e) => {
391
+ let n = t.splice(0), r = pe(e), i = me(e);
392
+ return Je = Je.then(() => ye(e, r, i, n)).catch((e) => {
393
393
  console.warn("Failed to write debug log to storage", e);
394
394
  }), Je;
395
395
  }
396
- function S(e) {
397
- if (e) return Se(e);
398
- for (let e of Ue.keys()) Se(e);
396
+ function Se(e) {
397
+ if (e) return xe(e);
398
+ for (let e of Ue.keys()) xe(e);
399
399
  return Je;
400
400
  }
401
401
  async function Ce(e) {
402
402
  let t = [];
403
403
  for (let n of e.sort((e, t) => e.startTime - t.startTime)) {
404
- let e = await x.getChunksBySession(n.sessionId);
404
+ let e = await S.getChunksBySession(n.sessionId);
405
405
  for (let n of e) t.push(...n.items);
406
406
  }
407
407
  return t;
@@ -413,10 +413,10 @@ async function we(e) {
413
413
  return [...await Te(r, i, new Set(e.map((e) => e.sessionId))), ...n].sort(Ee);
414
414
  }
415
415
  async function Te(e, t, n) {
416
- let r = (await x.getAllSessions()).filter((r) => !n.has(r.sessionId) && r.conversationId === null && r.endTime >= e - le && r.startTime <= t), i = [];
416
+ let r = (await S.getAllSessions()).filter((r) => !n.has(r.sessionId) && r.conversationId === null && r.endTime >= e - ce && r.startTime <= t), i = [];
417
417
  for (let n of r) {
418
- let r = await x.getChunksBySession(n.sessionId);
419
- for (let n of r) n.endTime < e - le || n.startTime > t || i.push(...n.items.filter((n) => n.t >= e - le && n.t <= e ? !0 : n.t >= e && n.t <= t && ue.has(n.l)));
418
+ let r = await S.getChunksBySession(n.sessionId);
419
+ for (let n of r) n.endTime < e - ce || n.startTime > t || i.push(...n.items.filter((n) => n.t >= e - ce && n.t <= e ? !0 : n.t >= e && n.t <= t && le.has(n.l)));
420
420
  }
421
421
  return i;
422
422
  }
@@ -428,40 +428,40 @@ function De(e, t) {
428
428
  n.href = i, n.download = t, n.click(), URL.revokeObjectURL(i);
429
429
  }
430
430
  function Oe() {
431
- S();
431
+ Se();
432
432
  }
433
433
  function ke() {
434
- document.visibilityState === "hidden" && S();
434
+ document.visibilityState === "hidden" && Se();
435
435
  }
436
436
  function Ae(e, t, n = Ke) {
437
- He || je(), pe(n);
437
+ He || je(), fe(n);
438
438
  let r = /* @__PURE__ */ new Date(), i = {
439
439
  t: r.getTime(),
440
440
  l: e,
441
- d: xe(t),
441
+ d: be(t),
442
442
  h: r.toLocaleString("ru-RU", {
443
443
  dateStyle: "short",
444
444
  timeStyle: "long"
445
445
  })
446
446
  };
447
447
  return Ue.get(n)?.push(i), qe || (qe = window.setTimeout(() => {
448
- qe = null, S();
448
+ qe = null, Se();
449
449
  }, ae)), i;
450
450
  }
451
451
  function je() {
452
- He || (He = !0, ve(), x.open(), window.addEventListener("pagehide", Oe), document.addEventListener("visibilitychange", ke));
452
+ He || (He = !0, _e(), S.open(), window.addEventListener("pagehide", Oe), document.addEventListener("visibilitychange", ke));
453
453
  }
454
454
  function Me() {
455
- return He || je(), S(), fe();
455
+ return He || je(), Se(), de();
456
456
  }
457
457
  function Ne(e, t = Ke) {
458
- t && (pe(t), Ge.set(t, e), e && x.updateSessionConversationId(t, e));
458
+ t && (fe(t), Ge.set(t, e), e && S.updateSessionConversationId(t, e));
459
459
  }
460
460
  async function Pe() {
461
- return await S(), (await x.getAllSessions()).sort((e, t) => t.updatedAt - e.updatedAt);
461
+ return await Se(), (await S.getAllSessions()).sort((e, t) => t.updatedAt - e.updatedAt);
462
462
  }
463
463
  async function Fe(e) {
464
- return await S(), we(await ye(e));
464
+ return await Se(), we(await ve(e));
465
465
  }
466
466
  async function Ie(e) {
467
467
  return JSON.stringify(await Fe(e));
@@ -471,15 +471,15 @@ async function Le(e) {
471
471
  return De(t, n), n;
472
472
  }
473
473
  async function Re(e) {
474
- await S();
475
- let t = e ? await ye(e) : await x.getAllSessions();
476
- for (let e of t) await x.deleteSession(e.sessionId);
474
+ await Se();
475
+ let t = e ? await ve(e) : await S.getAllSessions();
476
+ for (let e of t) await S.deleteSession(e.sessionId);
477
477
  }
478
478
  async function ze() {
479
- await S();
480
- let e = await x.getStorageSummary(), t = await x.estimateStorage();
479
+ await Se();
480
+ let e = await S.getStorageSummary(), t = await S.estimateStorage();
481
481
  return {
482
- supported: x.supported,
482
+ supported: S.supported,
483
483
  callsCount: e.callsCount,
484
484
  sessionsCount: e.sessions.length,
485
485
  usedBytes: e.usedBytes,
@@ -490,15 +490,15 @@ async function ze() {
490
490
  };
491
491
  }
492
492
  async function Be() {
493
- await S();
494
- let e = await Ce(await x.getAllSessions());
493
+ await Se();
494
+ let e = await Ce(await S.getAllSessions());
495
495
  return JSON.stringify(e.sort(Ee));
496
496
  }
497
497
  async function Ve() {
498
498
  let e = await Be(), t = `logs_${Date.now()}.json`;
499
499
  return De(e, t), t;
500
500
  }
501
- var He = !1, Ue = /* @__PURE__ */ new Map(), We = /* @__PURE__ */ new Map(), Ge = /* @__PURE__ */ new Map(), Ke = fe(), qe = null, Je = Promise.resolve();
501
+ var He = !1, Ue = /* @__PURE__ */ new Map(), We = /* @__PURE__ */ new Map(), Ge = /* @__PURE__ */ new Map(), Ke = de(), qe = null, Je = Promise.resolve();
502
502
  window.__VKCallsSDKLogs__ = (e = !1) => (He || je(), e ? Be() : Ve());
503
503
  //#endregion
504
504
  //#region src/static/AuthData.ts
@@ -1076,7 +1076,7 @@ var D;
1076
1076
  }
1077
1077
  e.getBlackMediaTrack = ie;
1078
1078
  function ae() {
1079
- if (he() === "Edge" && Number(ge()) < 70) return !1;
1079
+ if (me() === "Edge" && Number(he()) < 70) return !1;
1080
1080
  try {
1081
1081
  let e = window;
1082
1082
  return "mediaDevices" in e.navigator && "getUserMedia" in e.navigator.mediaDevices && e.RTCPeerConnection && e.RTCIceCandidate && e.RTCSessionDescription && e.HTMLCanvasElement && e.HTMLCanvasElement.prototype.captureStream && e.RTCRtpSender && e.RTCRtpSender.prototype.replaceTrack && e.RTCRtpSender.prototype.getParameters && "sendBeacon" in navigator && !0 || !1;
@@ -1098,7 +1098,7 @@ var D;
1098
1098
  return D.browserName() === "Yandex" && D.os() === "Windows" || N.simulcast;
1099
1099
  }
1100
1100
  e.isBrokenVP9Encoder = b;
1101
- function ce() {
1101
+ function x() {
1102
1102
  let e = D.browserName() === "Safari" && Number(D.browserVersion()) === 17 && [
1103
1103
  4,
1104
1104
  5,
@@ -1106,20 +1106,20 @@ var D;
1106
1106
  ].includes(Number(D.browserSubVersion())), t = D.os() === "Windows" && D.osVersion() === 10;
1107
1107
  return e || t;
1108
1108
  }
1109
- e.isBrokenVP9Decoder = ce;
1110
- function le() {
1109
+ e.isBrokenVP9Decoder = x;
1110
+ function ce() {
1111
1111
  return D.browserName() === "Firefox" && Number(D.browserVersion()) < 60;
1112
1112
  }
1113
- e.isOldDataChannelDescription = le;
1114
- function ue() {
1113
+ e.isOldDataChannelDescription = ce;
1114
+ function le() {
1115
1115
  return !(D.baseChromeVersion() && D.isMobile());
1116
1116
  }
1117
- e.canPreferH264 = ue;
1118
- function de() {
1117
+ e.canPreferH264 = le;
1118
+ function ue() {
1119
1119
  return !(D.browserName() === "Firefox" || D.browserName() === "Safari");
1120
1120
  }
1121
- e.isSimulcastSupportedByBrowser = de;
1122
- function fe() {
1121
+ e.isSimulcastSupportedByBrowser = ue;
1122
+ function de() {
1123
1123
  return Ct || (Ct = (() => {
1124
1124
  let e = {
1125
1125
  Windows: /Win/,
@@ -1141,53 +1141,53 @@ var D;
1141
1141
  return "Unknown";
1142
1142
  })()), Ct;
1143
1143
  }
1144
- e.os = fe;
1145
- function pe() {
1144
+ e.os = de;
1145
+ function fe() {
1146
1146
  return wt;
1147
1147
  }
1148
- e.osVersion = pe;
1149
- function me() {
1148
+ e.osVersion = fe;
1149
+ function pe() {
1150
1150
  return St === null && (St = /Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(Dt)), St;
1151
1151
  }
1152
- e.isMobile = me;
1153
- function he() {
1152
+ e.isMobile = pe;
1153
+ function me() {
1154
1154
  return Ut()[0];
1155
1155
  }
1156
- e.browserName = he;
1157
- function ge() {
1156
+ e.browserName = me;
1157
+ function he() {
1158
1158
  return Ut()[1];
1159
1159
  }
1160
- e.browserVersion = ge;
1161
- function _e() {
1160
+ e.browserVersion = he;
1161
+ function ge() {
1162
1162
  return Ut()[3];
1163
1163
  }
1164
- e.baseChromeVersion = _e;
1165
- function ve() {
1164
+ e.baseChromeVersion = ge;
1165
+ function _e() {
1166
1166
  return Et || (Et = new (window.AudioContext || window.webkitAudioContext)()), Et.resume().catch(() => {
1167
1167
  z.warn("Failed to resume AudioContext");
1168
1168
  }), Et;
1169
1169
  }
1170
- e.getAudioContext = ve;
1171
- function x() {
1170
+ e.getAudioContext = _e;
1171
+ function S() {
1172
1172
  return Ut()[4];
1173
1173
  }
1174
- e.browserSubVersion = x;
1175
- function ye() {
1174
+ e.browserSubVersion = S;
1175
+ function ve() {
1176
1176
  return D.baseChromeVersion() >= 105 && !D.isMobile();
1177
1177
  }
1178
- e.isAudioShareSupported = ye;
1179
- function be(e, t) {
1178
+ e.isAudioShareSupported = ve;
1179
+ function ye(e, t) {
1180
1180
  At[e] || (At[e] = []), At[e].push(t);
1181
1181
  }
1182
- e.addEventListener = be;
1183
- function xe(e, t) {
1182
+ e.addEventListener = ye;
1183
+ function be(e, t) {
1184
1184
  if (At[e]) if (!t) delete At[e];
1185
1185
  else {
1186
1186
  let n = At[e].indexOf(t);
1187
1187
  n > -1 && At[e].splice(n, 1);
1188
1188
  }
1189
1189
  }
1190
- e.removeEventListener = xe;
1190
+ e.removeEventListener = be;
1191
1191
  })(D || (D = {}));
1192
1192
  var O = D;
1193
1193
  //#endregion
@@ -1842,15 +1842,15 @@ var sn = 533, cn = "a=fmtp:", ln = "sps-pps-idr-in-keyframe=1", un;
1842
1842
  };
1843
1843
  }
1844
1844
  e.decomposeParticipantId = b;
1845
- function ce() {
1845
+ function x() {
1846
1846
  let e = window.crypto?.randomUUID?.();
1847
1847
  if (e) return e;
1848
1848
  let t = "0123456789abcdefghijklmnopqrstuvwxyz".split(""), n = Array(36), r = 0, i, a;
1849
1849
  for (a = 0; a < 36; a++) a === 8 || a === 13 || a === 18 || a === 23 ? n[a] = "-" : a === 14 ? n[a] = "4" : (r <= 2 && (r = 33554432 + Math.random() * 16777216 | 0), i = r & 15, r >>= 4, n[a] = t[a === 19 ? i & 3 | 8 : i]);
1850
1850
  return n.join("");
1851
1851
  }
1852
- e.uuid = ce;
1853
- function le(e, t) {
1852
+ e.uuid = x;
1853
+ function ce(e, t) {
1854
1854
  let n;
1855
1855
  function r(...r) {
1856
1856
  let i = this;
@@ -1860,8 +1860,8 @@ var sn = 533, cn = "a=fmtp:", ln = "sps-pps-idr-in-keyframe=1", un;
1860
1860
  }
1861
1861
  return r;
1862
1862
  }
1863
- e.debounce = le;
1864
- function ue(e) {
1863
+ e.debounce = ce;
1864
+ function le(e) {
1865
1865
  if (!window.BigInt) return null;
1866
1866
  let t = "", n = e.split("\n");
1867
1867
  for (let e of n) if (e.startsWith("a=fingerprint")) {
@@ -1879,8 +1879,8 @@ var sn = 533, cn = "a=fmtp:", ln = "sps-pps-idr-in-keyframe=1", un;
1879
1879
  }
1880
1880
  return BigInt.asIntN(64, i);
1881
1881
  }
1882
- e.sdpFingerprint = ue;
1883
- async function de(e, { signal: t } = {}) {
1882
+ e.sdpFingerprint = le;
1883
+ async function ue(e, { signal: t } = {}) {
1884
1884
  return new Promise((n, r) => {
1885
1885
  if (t?.aborted) return r(t.reason);
1886
1886
  let i = setTimeout(() => {
@@ -1891,13 +1891,13 @@ var sn = 533, cn = "a=fmtp:", ln = "sps-pps-idr-in-keyframe=1", un;
1891
1891
  t?.addEventListener("abort", a, { once: !0 });
1892
1892
  });
1893
1893
  }
1894
- e.delay = de;
1895
- function fe(e, t, n, r = z) {
1894
+ e.delay = ue;
1895
+ function de(e, t, n, r = z) {
1896
1896
  let i = [];
1897
- return e.getSenders().forEach((e) => pe(t, e, e.track, n, i, r)), i;
1897
+ return e.getSenders().forEach((e) => fe(t, e, e.track, n, i, r)), i;
1898
1898
  }
1899
- e.applySettings = fe;
1900
- function pe(e, t, n, r, i, a = z) {
1899
+ e.applySettings = de;
1900
+ function fe(e, t, n, r, i, a = z) {
1901
1901
  if (!RTCRtpSender.prototype.getParameters || !RTCRtpSender.prototype.setParameters || !e || !n || n.kind !== A.video) return;
1902
1902
  let o = n.getSettings();
1903
1903
  if (!o) return;
@@ -1936,25 +1936,25 @@ var sn = 533, cn = "a=fmtp:", ln = "sps-pps-idr-in-keyframe=1", un;
1936
1936
  a.log(`applyVideoTrackSettings: actual encodings= ${JSON.stringify(e.encodings)}`);
1937
1937
  }
1938
1938
  }
1939
- e.applyVideoTrackSettings = pe;
1940
- function me(e, t) {
1939
+ e.applyVideoTrackSettings = fe;
1940
+ function pe(e, t) {
1941
1941
  Array.isArray(t) || (t = [t]);
1942
1942
  for (let n of t) if (e.includes(n)) return !0;
1943
1943
  return !1;
1944
1944
  }
1945
- e.includesOneOf = me;
1946
- function he(e) {
1945
+ e.includesOneOf = pe;
1946
+ function me(e) {
1947
1947
  return Object.entries(e.participantState?.state || {}).reduce((t, [n, r]) => (e.participantState && (t[n] = {
1948
1948
  ts: e.participantState.stateUpdateTs[n],
1949
1949
  state: r
1950
1950
  }), t), {});
1951
1951
  }
1952
- e.mapParticipantState = he;
1953
- function ge(e) {
1952
+ e.mapParticipantState = me;
1953
+ function he(e) {
1954
1954
  let t = e.map((e) => ({
1955
1955
  uid: e.externalId,
1956
1956
  mediaSettings: e.mediaSettings,
1957
- status: e.status,
1957
+ status: e.connectionStatus.lastEffective,
1958
1958
  muteStates: e.muteStates,
1959
1959
  unmuteOptions: e.unmuteOptions,
1960
1960
  participantState: e.participantState,
@@ -1964,37 +1964,37 @@ var sn = 533, cn = "a=fmtp:", ln = "sps-pps-idr-in-keyframe=1", un;
1964
1964
  }));
1965
1965
  return N.filterObservers ? t.filter((e) => !e.uid.observer) : t;
1966
1966
  }
1967
- e.mapSharedParticipants = ge;
1968
- function _e(e, t) {
1967
+ e.mapSharedParticipants = he;
1968
+ function ge(e, t) {
1969
1969
  let n = Object.keys(e), r = Object.keys(t);
1970
1970
  if (n.length !== r.length) return !1;
1971
1971
  for (let i of n) if (!Object.hasOwn(r, i) || e[i].state !== t[i].state || e[i].ts !== t[i].ts) return !1;
1972
1972
  return !0;
1973
1973
  }
1974
- e.isEqualParticipantState = _e;
1975
- function ve(e, t, n = !1) {
1974
+ e.isEqualParticipantState = ge;
1975
+ function _e(e, t, n = !1) {
1976
1976
  let r = Object.keys(e), i = Object.keys(t);
1977
1977
  if (r.length !== i.length) return !1;
1978
1978
  for (let i of r) {
1979
1979
  if (!Object.hasOwn(t, i)) return !1;
1980
1980
  let r = e[i], a = t[i];
1981
- if (n && S(r) && S(a)) return ve(r, a, n);
1981
+ if (n && Se(r) && Se(a)) return _e(r, a, n);
1982
1982
  if (r !== a) return !1;
1983
1983
  }
1984
1984
  return !0;
1985
1985
  }
1986
- e.isObjectsEquals = ve;
1987
- function x(e, t) {
1986
+ e.isObjectsEquals = _e;
1987
+ function S(e, t) {
1988
1988
  if (e.length !== t.length) return !1;
1989
1989
  for (let n of e) if (t.indexOf(n) < 0) return !1;
1990
1990
  return !0;
1991
1991
  }
1992
- e.isArraysEquals = x;
1993
- function ye(e) {
1992
+ e.isArraysEquals = S;
1993
+ function ve(e) {
1994
1994
  return !Object.keys(e).length;
1995
1995
  }
1996
- e.isEmptyObject = ye;
1997
- function be(e, t) {
1996
+ e.isEmptyObject = ve;
1997
+ function ye(e, t) {
1998
1998
  if (!e && !t) return 0;
1999
1999
  if (!e || !t) return e ? -1 : 1;
2000
2000
  return r(t.rank, e.rank) || r(e.ts, t.ts) || n(e, t);
@@ -2009,17 +2009,17 @@ var sn = 533, cn = "a=fmtp:", ln = "sps-pps-idr-in-keyframe=1", un;
2009
2009
  return e < t ? -1 : e === t ? 0 : 1;
2010
2010
  }
2011
2011
  }
2012
- e.participantMarkerCompare = be;
2013
- function xe(e, t) {
2012
+ e.participantMarkerCompare = ye;
2013
+ function be(e, t) {
2014
2014
  return an(Object.entries(e).filter(([, e]) => Array.isArray(t) ? !t.includes(e) : e !== t));
2015
2015
  }
2016
- e.objectFilterOutValues = xe;
2017
- function Se(e, t, n) {
2016
+ e.objectFilterOutValues = be;
2017
+ function xe(e, t, n) {
2018
2018
  let r = n;
2019
2019
  for (let n in e) Object.hasOwn(e, n) && (r = t(r, e[n], n));
2020
2020
  return r;
2021
2021
  }
2022
- e.objectReduce = Se, e.setImmediate = (() => {
2022
+ e.objectReduce = xe, e.setImmediate = (() => {
2023
2023
  let e = 1, t = {}, n = null;
2024
2024
  return typeof MessageChannel < "u" && (n = new MessageChannel(), n.port1.onmessage = (e) => {
2025
2025
  let n = e.data;
@@ -2035,10 +2035,10 @@ var sn = 533, cn = "a=fmtp:", ln = "sps-pps-idr-in-keyframe=1", un;
2035
2035
  return () => clearTimeout(i);
2036
2036
  };
2037
2037
  })();
2038
- function S(e) {
2038
+ function Se(e) {
2039
2039
  return typeof e == "object" && !!e && !Array.isArray(e);
2040
2040
  }
2041
- e.isObject = S;
2041
+ e.isObject = Se;
2042
2042
  function Ce(e, n, r, i) {
2043
2043
  function a(e, t) {
2044
2044
  let n = 0, r = e.length, i = !1;
@@ -2171,7 +2171,7 @@ var hn = mn.getInstance(), N = class e {
2171
2171
  return 1.1;
2172
2172
  }
2173
2173
  static get sdkVersion() {
2174
- return "2.8.11-dev.6637565d.0";
2174
+ return "2.8.11-dev.6c644bb1.0";
2175
2175
  }
2176
2176
  static get debug() {
2177
2177
  return e._params.debug;
@@ -2540,6 +2540,9 @@ var hn = mn.getInstance(), N = class e {
2540
2540
  static get transparentAudio() {
2541
2541
  return e._params.transparentAudio;
2542
2542
  }
2543
+ static get enableSessionStateUpdates() {
2544
+ return e._params.enableSessionStateUpdates;
2545
+ }
2543
2546
  static toJSON() {
2544
2547
  return {
2545
2548
  apiKey: e._params.apiKey,
@@ -2575,7 +2578,8 @@ var hn = mn.getInstance(), N = class e {
2575
2578
  simulcast: e._params.simulcast,
2576
2579
  webtransport: e._params.webtransport,
2577
2580
  webtransportFF: e._params.webtransportFF,
2578
- transparentAudio: e._params.transparentAudio
2581
+ transparentAudio: e._params.transparentAudio,
2582
+ enableSessionStateUpdates: e._params.enableSessionStateUpdates
2579
2583
  };
2580
2584
  }
2581
2585
  };
@@ -2685,7 +2689,8 @@ h(N, "_params", {
2685
2689
  simulcast: !1,
2686
2690
  webtransport: !1,
2687
2691
  webtransportFF: !1,
2688
- transparentAudio: !1
2692
+ transparentAudio: !1,
2693
+ enableSessionStateUpdates: !1
2689
2694
  });
2690
2695
  //#endregion
2691
2696
  //#region src/static/External.ts
@@ -2824,75 +2829,75 @@ var _n;
2824
2829
  F("onRemoteParticipantsState", e, t);
2825
2830
  }
2826
2831
  e.onRemoteParticipantsState = b;
2827
- function ce(e, t, n = null) {
2832
+ function x(e, t, n = null) {
2828
2833
  z.debug("Remote status:", t, e), I("onRemoteStatus", e, t, n);
2829
2834
  }
2830
- e.onRemoteStatus = ce;
2831
- function le() {
2835
+ e.onRemoteStatus = x;
2836
+ function ce() {
2832
2837
  F("onPermissionsRequested");
2833
2838
  }
2834
- e.onPermissionsRequested = le;
2835
- function ue(e, t) {
2839
+ e.onPermissionsRequested = ce;
2840
+ function le(e, t) {
2836
2841
  F("onPermissionsError", e, t);
2837
2842
  }
2838
- e.onPermissionsError = ue;
2839
- function de(e, t) {
2843
+ e.onPermissionsError = le;
2844
+ function ue(e, t) {
2840
2845
  I("onRemoteRemoved", e, t);
2841
2846
  }
2842
- e.onRemoteRemoved = de;
2843
- function fe(e, t, n) {
2847
+ e.onRemoteRemoved = ue;
2848
+ function de(e, t, n) {
2844
2849
  F("onCallState", e, t, L(n));
2845
2850
  }
2846
- e.onCallState = fe;
2847
- function pe(e, t) {
2851
+ e.onCallState = de;
2852
+ function fe(e, t) {
2848
2853
  F("onDeviceSwitched", e, t);
2849
2854
  }
2850
- e.onDeviceSwitched = pe;
2851
- function me(e, t, n, r = !1, i = !1, a = null, o = null, s, c, l = null) {
2855
+ e.onDeviceSwitched = fe;
2856
+ function pe(e, t, n, r = !1, i = !1, a = null, o = null, s, c, l = null) {
2852
2857
  let u = c ? gn(c) : void 0;
2853
2858
  F("onMuteStates", L(e), gn(t), gn(n), r, i, a, o, s, u, l);
2854
2859
  }
2855
- e.onMuteStates = me;
2856
- function he(e, t, n = !1) {
2860
+ e.onMuteStates = pe;
2861
+ function me(e, t, n = !1) {
2857
2862
  I("onRolesChanged", e, gn(t), n);
2858
2863
  }
2859
- e.onRolesChanged = he;
2860
- function ge(e, t = !1) {
2864
+ e.onRolesChanged = me;
2865
+ function he(e, t = !1) {
2861
2866
  F("onLocalRolesChanged", gn(e), t);
2862
2867
  }
2863
- e.onLocalRolesChanged = ge;
2864
- function _e(e, t, n, r) {
2868
+ e.onLocalRolesChanged = he;
2869
+ function ge(e, t, n, r) {
2865
2870
  I("onPinnedParticipant", e, t, n, r);
2866
2871
  }
2867
- e.onPinnedParticipant = _e;
2868
- function ve(e, t) {
2872
+ e.onPinnedParticipant = ge;
2873
+ function _e(e, t) {
2869
2874
  F("onLocalPin", e, t);
2870
2875
  }
2871
- e.onLocalPin = ve;
2872
- function x(e) {
2876
+ e.onLocalPin = _e;
2877
+ function S(e) {
2873
2878
  F("onOptionsChanged", gn(e));
2874
2879
  }
2875
- e.onOptionsChanged = x;
2876
- function ye() {
2880
+ e.onOptionsChanged = S;
2881
+ function ve() {
2877
2882
  F("onCallAccepted");
2878
2883
  }
2879
- e.onCallAccepted = ye;
2880
- function be(e, t) {
2884
+ e.onCallAccepted = ve;
2885
+ function ye(e, t) {
2881
2886
  I("onAcceptedCall", e, t);
2882
2887
  }
2883
- e.onAcceptedCall = be;
2884
- function xe() {
2888
+ e.onAcceptedCall = ye;
2889
+ function be() {
2885
2890
  F("onRateNeeded");
2886
2891
  }
2887
- e.onRateNeeded = xe;
2888
- function Se(e) {
2892
+ e.onRateNeeded = be;
2893
+ function xe(e) {
2889
2894
  I("onSpeakerChanged", e);
2890
2895
  }
2891
- e.onSpeakerChanged = Se;
2892
- function S(e) {
2896
+ e.onSpeakerChanged = xe;
2897
+ function Se(e) {
2893
2898
  F("onVolumesDetected", gn(e));
2894
2899
  }
2895
- e.onVolumesDetected = S;
2900
+ e.onVolumesDetected = Se;
2896
2901
  function Ce(e, t) {
2897
2902
  F("onLocalVolume", e, t);
2898
2903
  }
@@ -3609,67 +3614,36 @@ var U = {
3609
3614
  clearMark: sr,
3610
3615
  measureMark: cr,
3611
3616
  getMarkNameScreenshareFirstFrame: lr
3612
- }, dr = /* @__PURE__ */ function(e) {
3613
- return e.START = "start", e.ACCEPT = "accept", e.JOIN = "join", e.RETRY = "retry", e;
3614
- }(dr || {}), W = /* @__PURE__ */ function(e) {
3615
- return e.NOTIFICATION = "NOTIFICATION", e.FAILED = "FAILED", e.RECONNECT = "RECONNECT", e;
3616
- }(W || {}), G = /* @__PURE__ */ function(e) {
3617
- return e.TRANSMITTED_DATA = "transmitted-data", e.ACCEPTED_CALL = "accepted-call", e.HUNGUP = "hungup", e.PARTICIPANT_ADDED = "participant-added", e.PARTICIPANT_JOINED = "participant-joined", e.CLOSED_CONVERSATION = "closed-conversation", e.MEDIA_SETTINGS_CHANGED = "media-settings-changed", e.PARTICIPANT_STATE_CHANGED = "participant-state-changed", e.PARTICIPANTS_STATE_CHANGED = "participants-state-changed", e.RATE_CALL_DATA = "rate-call-data", e.FEATURE_SET_CHANGED = "feature-set-changed", e.TOPOLOGY_CHANGED = "topology-changed", e.PRODUCER_UPDATED = "producer-updated", e.CONSUMER_ANSWERED = "consumer-answered", e.MULTIPARTY_CHAT_CREATED = "multiparty-chat-created", e.FORCE_MEDIA_SETTINGS_CHANGE = "force-media-settings-change", e.SETTINGS_UPDATE = "settings-update", e.VIDEO_QUALITY_UPDATE = "video-quality-update", e.REGISTERED_PEER = "registered-peer", e.SWITCH_MICRO = "switch-micro", e.RECORD_STARTED = "record-started", e.RECORD_STOPPED = "record-stopped", e.REALLOC_CON = "realloc-con", e.AUDIO_ACTIVITY = "audio-activity", e.SPEAKER_CHANGED = "speaker-changed", e.STALLED_ACTIVITY = "stalled-activity", e.CHAT_MESSAGE = "chat-message", e.CUSTOM_DATA = "custom-data", e.ROLES_CHANGED = "roles-changed", e.MUTE_PARTICIPANT = "mute-participant", e.PIN_PARTICIPANT = "pin-participant", e.OPTIONS_CHANGED = "options-changed", e.NETWORK_STATUS = "network-status", e.PARTICIPANT_SOURCES_UPDATE = "participant-sources-update", e.PROMOTE_PARTICIPANT = "promote-participant", e.CHAT_ROOM_UPDATED = "chat-room-updated", e.PROMOTION_APPROVED = "promotion-approved", e.JOIN_LINK_CHANGED = "join-link-changed", e.FEEDBACK = "feedback", e.MOVIE_UPDATE_NOTIFICATION = "movie-update-notification", e.MOVIE_SHARE_STARTED = "movie-share-started", e.MOVIE_SHARE_STOPPED = "movie-share-stopped", e.URL_SHARING_INFO_UPDATED = "url-sharing-info-updated", e.ROOM_UPDATED = "room-updated", e.ROOMS_UPDATED = "rooms-updated", e.ROOM_PARTICIPANTS_UPDATED = "room-participants-updated", e.FEATURES_PER_ROLE_CHANGED = "features-per-role-changed", e.PARTICIPANT_ANIMOJI_CHANGED = "participant-animoji-changed", e.ASR_STARTED = "asr-started", e.ASR_STOPPED = "asr-stopped", e.DECORATIVE_PARTICIPANT_ID_CHANGED = "decorative-participant-id-changed", e.VIDEO_SUSPEND_SUGGEST = "video-suspend-suggest", e;
3618
- }(G || {}), fr = /* @__PURE__ */ function(e) {
3619
- return e.WEBSOCKET = "ws", e.WEBTRANSPORT = "wt", e;
3620
- }({}), pr = /* @__PURE__ */ function(e) {
3621
- return e.CONNECTED = "connected", e.RECONNECTED = "reconnected", e.FAILED_PINGS = "failed_pings", e.FAILED_EXCEPTIONS = "failed_exception", e.TIMEOUT = "timeout", e.RESTART = "restart", e;
3622
- }({}), mr = {
3623
- connected: {
3624
- wt: V.WEBTRANSPORT_CONNECTED,
3625
- ws: V.WEBSOCKET_CONNECTED
3626
- },
3627
- reconnected: {
3628
- wt: V.WEBTRANSPORT_RECONNECTED,
3629
- ws: V.WEBSOCKET_RECONNECTED
3630
- },
3631
- failed_pings: {
3632
- wt: V.WEBTRANSPORT_FAILED_PINGS,
3633
- ws: V.WEBSOCKET_FAILED_PINGS
3634
- },
3635
- failed_exception: {
3636
- wt: V.WEBTRANSPORT_FAILED_EXCEPTION,
3637
- ws: V.WEBSOCKET_FAILED_EXCEPTION
3638
- },
3639
- timeout: {
3640
- wt: V.WEBTRANSPORT_TIMEOUT,
3641
- ws: V.WEBSOCKET_TIMEOUT
3642
- },
3643
- restart: {
3644
- wt: V.WEBTRANSPORT_RESTART,
3645
- ws: V.WEBSOCKET_RESTART
3646
- }
3647
- }, K = /* @__PURE__ */ function(e) {
3617
+ }, W = /* @__PURE__ */ function(e) {
3648
3618
  return e.IDLE = "IDLE", e.OPENED = "OPENED", e.CONNECTING = "CONNECTING", e.RECONNECTING = "RECONNECTING", e.CONNECTED = "CONNECTED", e.CLOSED = "CLOSED", e.FAILED = "FAILED", e;
3649
- }(K || {}), q = /* @__PURE__ */ function(e) {
3619
+ }(W || {}), dr = /* @__PURE__ */ function(e) {
3620
+ return e.NOTIFICATION = "NOTIFICATION", e.FAILED = "FAILED", e.RECONNECT = "RECONNECT", e;
3621
+ }(dr || {}), G = /* @__PURE__ */ function(e) {
3622
+ return e.TRANSMITTED_DATA = "transmitted-data", e.ACCEPTED_CALL = "accepted-call", e.HUNGUP = "hungup", e.PARTICIPANT_ADDED = "participant-added", e.PARTICIPANT_JOINED = "participant-joined", e.CLOSED_CONVERSATION = "closed-conversation", e.MEDIA_SETTINGS_CHANGED = "media-settings-changed", e.PARTICIPANT_STATE_CHANGED = "participant-state-changed", e.PARTICIPANTS_STATE_CHANGED = "participants-state-changed", e.RATE_CALL_DATA = "rate-call-data", e.FEATURE_SET_CHANGED = "feature-set-changed", e.TOPOLOGY_CHANGED = "topology-changed", e.PRODUCER_UPDATED = "producer-updated", e.CONSUMER_ANSWERED = "consumer-answered", e.MULTIPARTY_CHAT_CREATED = "multiparty-chat-created", e.FORCE_MEDIA_SETTINGS_CHANGE = "force-media-settings-change", e.SETTINGS_UPDATE = "settings-update", e.VIDEO_QUALITY_UPDATE = "video-quality-update", e.REGISTERED_PEER = "registered-peer", e.SWITCH_MICRO = "switch-micro", e.RECORD_STARTED = "record-started", e.RECORD_STOPPED = "record-stopped", e.REALLOC_CON = "realloc-con", e.AUDIO_ACTIVITY = "audio-activity", e.SPEAKER_CHANGED = "speaker-changed", e.SESSION_STATE = "session-state", e.STALLED_ACTIVITY = "stalled-activity", e.CHAT_MESSAGE = "chat-message", e.CUSTOM_DATA = "custom-data", e.ROLES_CHANGED = "roles-changed", e.MUTE_PARTICIPANT = "mute-participant", e.PIN_PARTICIPANT = "pin-participant", e.OPTIONS_CHANGED = "options-changed", e.NETWORK_STATUS = "network-status", e.PARTICIPANT_SOURCES_UPDATE = "participant-sources-update", e.PROMOTE_PARTICIPANT = "promote-participant", e.CHAT_ROOM_UPDATED = "chat-room-updated", e.PROMOTION_APPROVED = "promotion-approved", e.JOIN_LINK_CHANGED = "join-link-changed", e.FEEDBACK = "feedback", e.MOVIE_UPDATE_NOTIFICATION = "movie-update-notification", e.MOVIE_SHARE_STARTED = "movie-share-started", e.MOVIE_SHARE_STOPPED = "movie-share-stopped", e.URL_SHARING_INFO_UPDATED = "url-sharing-info-updated", e.ROOM_UPDATED = "room-updated", e.ROOMS_UPDATED = "rooms-updated", e.ROOM_PARTICIPANTS_UPDATED = "room-participants-updated", e.FEATURES_PER_ROLE_CHANGED = "features-per-role-changed", e.PARTICIPANT_ANIMOJI_CHANGED = "participant-animoji-changed", e.ASR_STARTED = "asr-started", e.ASR_STOPPED = "asr-stopped", e.DECORATIVE_PARTICIPANT_ID_CHANGED = "decorative-participant-id-changed", e.VIDEO_SUSPEND_SUGGEST = "video-suspend-suggest", e;
3623
+ }(G || {}), K = /* @__PURE__ */ function(e) {
3650
3624
  return e.DIRECT = "DIRECT", e.SERVER = "SERVER", e;
3651
- }(q || {}), hr = /* @__PURE__ */ function(e) {
3625
+ }(K || {}), fr = /* @__PURE__ */ function(e) {
3652
3626
  return e.producerNotification = "producerNotification", e.producerCommand = "producerCommand", e.consumerScreenShare = "consumerScreenShare", e.producerScreenShare = "producerScreenShare", e.asr = "asr", e.animoji = "animoji", e;
3653
- }(hr || {}), { isObject: gr, isObjectsEquals: _r } = M;
3654
- function vr(e, t) {
3655
- return e === null || t === null ? e === null && t === null : e.maxDimension !== t.maxDimension || e.maxBitrateK !== t.maxBitrateK || e.maxFramerate !== t.maxFramerate || e.degradationPreference !== t.degradationPreference || e.scalabilityMode !== t.scalabilityMode || gr(e.bitrates) && gr(t.bitrates) && !_r(e.bitrates, t.bitrates, !0) ? !1 : e.bitrates === t.bitrates;
3627
+ }(fr || {}), { isObject: pr, isObjectsEquals: mr } = M;
3628
+ function hr(e, t) {
3629
+ return e === null || t === null ? e === null && t === null : e.maxDimension !== t.maxDimension || e.maxBitrateK !== t.maxBitrateK || e.maxFramerate !== t.maxFramerate || e.degradationPreference !== t.degradationPreference || e.scalabilityMode !== t.scalabilityMode || pr(e.bitrates) && pr(t.bitrates) && !mr(e.bitrates, t.bitrates, !0) ? !1 : e.bitrates === t.bitrates;
3656
3630
  }
3657
- var yr = /* @__PURE__ */ function(e) {
3631
+ var gr = /* @__PURE__ */ function(e) {
3658
3632
  return e.L1T1 = "L1T1", e.L1T2 = "L1T2", e.L1T3 = "L1T3", e;
3659
3633
  }({});
3660
3634
  //#endregion
3661
3635
  //#region src/types/ServerSettings.ts
3662
- function br(e, t) {
3663
- return !(!vr(e.camera, t.camera) || !vr(e.screenSharing, t.screenSharing) || !vr(e.fastScreenSharing, t.fastScreenSharing));
3636
+ function _r(e, t) {
3637
+ return !(!hr(e.camera, t.camera) || !hr(e.screenSharing, t.screenSharing) || !hr(e.fastScreenSharing, t.fastScreenSharing));
3664
3638
  }
3665
- function xr(e, t) {
3639
+ function vr(e, t) {
3666
3640
  return {
3667
3641
  camera: Object.assign({}, e.camera, t.camera),
3668
3642
  screenSharing: Object.assign({}, e.screenSharing, t.screenSharing),
3669
3643
  fastScreenSharing: Object.assign({}, e.fastScreenSharing, t.fastScreenSharing)
3670
3644
  };
3671
3645
  }
3672
- function Sr() {
3646
+ function yr() {
3673
3647
  return {
3674
3648
  camera: null,
3675
3649
  screenSharing: null,
@@ -3678,14 +3652,14 @@ function Sr() {
3678
3652
  }
3679
3653
  //#endregion
3680
3654
  //#region src/classes/transport/BaseTransport.ts
3681
- var Cr = class extends g {
3655
+ var br = class extends g {
3682
3656
  constructor(e, t) {
3683
- super(), h(this, "_signaling", void 0), h(this, "_mediaSource", void 0), h(this, "_state", K.IDLE), h(this, "_pc", null), this._signaling = e, this._mediaSource = t;
3657
+ super(), h(this, "_signaling", void 0), h(this, "_mediaSource", void 0), h(this, "_state", W.IDLE), h(this, "_pc", null), this._signaling = e, this._mediaSource = t;
3684
3658
  }
3685
3659
  getState() {
3686
- return this._state || K.IDLE;
3660
+ return this._state || W.IDLE;
3687
3661
  }
3688
- }, wr = class {
3662
+ }, xr = class {
3689
3663
  constructor(e, t = null) {
3690
3664
  h(this, "weightUp", void 0), h(this, "weightDown", void 0), h(this, "value", NaN), this.weightUp = e, this.weightDown = t ?? e;
3691
3665
  }
@@ -3703,7 +3677,7 @@ var Cr = class extends g {
3703
3677
  getValue() {
3704
3678
  return this.value;
3705
3679
  }
3706
- }, Tr = .25, Er = .35, Dr = 85, Or = .1, kr = 1.5, Ar = .1, jr = 1, Mr = .6, Nr = .3, Pr = class extends g {
3680
+ }, Sr = .25, Cr = .35, wr = 85, Tr = .1, Er = 1.5, Dr = .1, Or = 1, kr = .6, Ar = .3, jr = class extends g {
3707
3681
  constructor(e, t = z) {
3708
3682
  super(), h(this, "_signaling", void 0), h(this, "_localNetworkStat", void 0), h(this, "_remoteNetworkStat", void 0), h(this, "_lastNetworkStat", void 0), h(this, "_networkLimits", {
3709
3683
  badNet: {
@@ -3715,8 +3689,8 @@ var Cr = class extends g {
3715
3689
  rtt: 600
3716
3690
  }
3717
3691
  }), h(this, "_lastStatSentTimestamp", 0), h(this, "_currentState", "good"), h(this, "_debug", void 0), this._debug = t, this._signaling = e, this._localNetworkStat = {
3718
- rtt: new wr(Tr, Tr),
3719
- loss: new wr(Er, Er),
3692
+ rtt: new xr(Sr, Sr),
3693
+ loss: new xr(Cr, Cr),
3720
3694
  bitrate: 0
3721
3695
  }, this._remoteNetworkStat = {
3722
3696
  rtt: 0,
@@ -3731,20 +3705,20 @@ var Cr = class extends g {
3731
3705
  _calcRttRating(e) {
3732
3706
  let t = typeof e == "number" ? e : e.getValue(), n = 1;
3733
3707
  if (isNaN(t)) return n;
3734
- let r = Math.round((t - this._networkLimits.goodNet.rtt) / Dr);
3735
- for (let e = 0; e < r; e++) n *= 1 - Or;
3708
+ let r = Math.round((t - this._networkLimits.goodNet.rtt) / wr);
3709
+ for (let e = 0; e < r; e++) n *= 1 - Tr;
3736
3710
  return n;
3737
3711
  }
3738
3712
  _calcLossRating(e) {
3739
3713
  let t = typeof e == "number" ? e : e.getValue(), n = 1;
3740
3714
  if (isNaN(t)) return n;
3741
- let r = Math.round((t - this._networkLimits.goodNet.loss) / kr);
3742
- for (let e = 0; e < r; e++) n *= 1 - Ar;
3715
+ let r = Math.round((t - this._networkLimits.goodNet.loss) / Er);
3716
+ for (let e = 0; e < r; e++) n *= 1 - Dr;
3743
3717
  return n;
3744
3718
  }
3745
3719
  _calcBitrateRating(e, t) {
3746
3720
  if (!e || !t) return 1;
3747
- let n = 1 - (1 - Math.min(e, t) / Math.max(e, t)) * jr;
3721
+ let n = 1 - (1 - Math.min(e, t) / Math.max(e, t)) * Or;
3748
3722
  return Math.min(n, 1);
3749
3723
  }
3750
3724
  _calcUDPRating({ rtt: e, loss: t }) {
@@ -3754,7 +3728,7 @@ var Cr = class extends g {
3754
3728
  return n ? this._calcBitrateRating(e.bitrate, t.bitrate) : this._calcUDPRating(e) * this._calcUDPRating(t);
3755
3729
  }
3756
3730
  _getNetworkState(e) {
3757
- return isNaN(e) || e >= Mr ? "good" : e >= Nr ? "medium" : "bad";
3731
+ return isNaN(e) || e >= kr ? "good" : e >= Ar ? "medium" : "bad";
3758
3732
  }
3759
3733
  updateSettings(e) {
3760
3734
  Object.assign(this._networkLimits.badNet, e?.badNet || {}), Object.assign(this._networkLimits.goodNet, e?.goodNet || {});
@@ -3778,7 +3752,7 @@ var Cr = class extends g {
3778
3752
  let { rtt: t, loss: n, bitrate: r } = e || {};
3779
3753
  this._remoteNetworkStat.rtt = t || 0, this._remoteNetworkStat.loss = n || 0, this._remoteNetworkStat.bitrate = r || 0;
3780
3754
  }
3781
- }, Fr = 30 * 1e3, Ir = class e extends Cr {
3755
+ }, Mr = 30 * 1e3, Nr = class e extends br {
3782
3756
  constructor(e, t, n, r, i, a = z, o = null, s = null, c = null) {
3783
3757
  super(n, r), h(this, "_participantId", void 0), h(this, "_isMaster", void 0), h(this, "_remoteSDP", {}), h(this, "_remoteCandidates", {}), h(this, "_lastRemoteSDP", null), h(this, "_animojiDataChannel", null), h(this, "_animojiReceiver", null), h(this, "_animojiSender", null), h(this, "_remoteAnimojiVersion", 1), h(this, "_isOpen", !1), h(this, "_remotePeerId", null), h(this, "_statInterval", null), h(this, "_settingsInterval", null), h(this, "_failedOnCreate", null), h(this, "_remoteStream", null), h(this, "_iceRestartTimeout", null), h(this, "_reconnectionTimeout", null), h(this, "_reconnectionPrevented", !1), h(this, "_lastStat", void 0), h(this, "_fingerprint", null), h(this, "_neverConnected", !0), h(this, "_serverSettings", void 0), h(this, "_prevConsumerSettings", {}), h(this, "_networkLimitsForVideo", {
3784
3758
  bad: {
@@ -3793,7 +3767,7 @@ var Cr = class extends g {
3793
3767
  worst: 320,
3794
3768
  bad: 640,
3795
3769
  good: 1280
3796
- }), h(this, "_lastVideoMaxDimension", this._videoMaxDimensionsForNet.good), h(this, "_lastBadConnection", 0), h(this, "_perfStatReporter", void 0), h(this, "_directStatReporter", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_codecStatsAggregator", void 0), this._participantId = e, this._isMaster = t, this._serverSettings = i, this._debug = a, this._logger = o, this._statAggregator = s, this._codecStatsAggregator = c, this._perfStatReporter = new ra(this, n, this._statAggregator, !0, this._debug), this._directStatReporter = new Pr(n, this._debug), this.subscribe(this._signaling, W.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, qt.TRACK_REPLACED, this._onReplacedTrack.bind(this)), this.subscribe(this._mediaSource, qt.SOURCE_CHANGED, this._applySettings.bind(this)), this.subscribe(this._directStatReporter, J.NETWORK_STATUS, this._onNetworkStatus.bind(this));
3770
+ }), h(this, "_lastVideoMaxDimension", this._videoMaxDimensionsForNet.good), h(this, "_lastBadConnection", 0), h(this, "_perfStatReporter", void 0), h(this, "_directStatReporter", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_codecStatsAggregator", void 0), this._participantId = e, this._isMaster = t, this._serverSettings = i, this._debug = a, this._logger = o, this._statAggregator = s, this._codecStatsAggregator = c, this._perfStatReporter = new $i(this, n, this._statAggregator, !0, this._debug), this._directStatReporter = new jr(n, this._debug), this.subscribe(this._signaling, dr.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, qt.TRACK_REPLACED, this._onReplacedTrack.bind(this)), this.subscribe(this._mediaSource, qt.SOURCE_CHANGED, this._applySettings.bind(this)), this.subscribe(this._directStatReporter, J.NETWORK_STATUS, this._onNetworkStatus.bind(this));
3797
3771
  try {
3798
3772
  this._pc = new RTCPeerConnection({
3799
3773
  iceServers: N.iceServers,
@@ -3803,7 +3777,7 @@ var Cr = class extends g {
3803
3777
  this._debug.error("Failed to create RTCPeerConnection:", e), this.close(e);
3804
3778
  return;
3805
3779
  }
3806
- if (this._pc.onicecandidate = this._handleIceCandidate.bind(this), this._pc.ontrack = this._onAddTrack.bind(this), this._pc.oniceconnectionstatechange = this._onIceConnectionStateChange.bind(this), this._pc.onconnectionstatechange = this._onConnectionStateChange.bind(this), this._pc.onsignalingstatechange = this._onSignalingStateChange.bind(this), this._prevConsumerSettings = {}, N.vmoji && this._createDataChannel(this._pc, hr.animoji, (e) => {
3780
+ if (this._pc.onicecandidate = this._handleIceCandidate.bind(this), this._pc.ontrack = this._onAddTrack.bind(this), this._pc.oniceconnectionstatechange = this._onIceConnectionStateChange.bind(this), this._pc.onconnectionstatechange = this._onConnectionStateChange.bind(this), this._pc.onsignalingstatechange = this._onSignalingStateChange.bind(this), this._prevConsumerSettings = {}, N.vmoji && this._createDataChannel(this._pc, fr.animoji, (e) => {
3807
3781
  this._animojiDataChannel = e, this._animojiDataChannel.binaryType = "arraybuffer", this._animojiReceiver?.setDataChannel(this._animojiDataChannel), this._animojiSender?.setDataChannel(this._animojiDataChannel);
3808
3782
  }), this._isMaster) {
3809
3783
  try {
@@ -3813,7 +3787,7 @@ var Cr = class extends g {
3813
3787
  return;
3814
3788
  }
3815
3789
  this._createOffer(!1).catch((e) => {
3816
- this._state === K.IDLE ? this._failedOnCreate = e : this.close(e);
3790
+ this._state === W.IDLE ? this._failedOnCreate = e : this.close(e);
3817
3791
  });
3818
3792
  }
3819
3793
  this._startSettingsInterval();
@@ -3826,9 +3800,9 @@ var Cr = class extends g {
3826
3800
  }
3827
3801
  _isDeadConnection() {
3828
3802
  return [
3829
- K.IDLE,
3830
- K.CLOSED,
3831
- K.FAILED
3803
+ W.IDLE,
3804
+ W.CLOSED,
3805
+ W.FAILED
3832
3806
  ].includes(this.getState());
3833
3807
  }
3834
3808
  async open(e = null) {
@@ -3846,7 +3820,7 @@ var Cr = class extends g {
3846
3820
  this._logger?.log(E.ERROR, "addTrack-direct"), this._debug.error("DirectTransport: Unable to add media source tracks", e, { participantId: this._participantId }), this.close(e);
3847
3821
  return;
3848
3822
  }
3849
- this._setState(K.OPENED);
3823
+ this._setState(W.OPENED);
3850
3824
  let t = e;
3851
3825
  if (!e) {
3852
3826
  let e = Object.keys(this._remoteSDP);
@@ -3861,7 +3835,7 @@ var Cr = class extends g {
3861
3835
  this._remoteSDP = {}, this._remoteCandidates = {};
3862
3836
  }
3863
3837
  updateSettings(e) {
3864
- br(e, this._serverSettings) || (this._serverSettings = e, this._applySettings());
3838
+ _r(e, this._serverSettings) || (this._serverSettings = e, this._applySettings());
3865
3839
  }
3866
3840
  preventRestart() {
3867
3841
  this._reconnectionPrevented = !0;
@@ -3878,7 +3852,7 @@ var Cr = class extends g {
3878
3852
  close(e) {
3879
3853
  this._isOpen && (this._isOpen = !1, this._stopReconnection(), this._remoteStream && (this._remoteStream.getTracks().forEach((e) => {
3880
3854
  e.stop(), this._triggerEvent(J.REMOTE_TRACK_REMOVED, this._remoteStream, e);
3881
- }), this._remoteStream = null), this._stopStatInterval(), this._stopSettingsInterval(), this._pc && (this._animojiDataChannel && (this._animojiDataChannel.onopen = null, this._animojiDataChannel.onmessage = null, this._animojiDataChannel.onerror = null, this._animojiDataChannel.close()), this._pc.onicecandidate = null, this._pc.ontrack = null, this._pc.oniceconnectionstatechange = null, this._pc.onconnectionstatechange = null, this._pc.onsignalingstatechange = null, this._pc.close(), this._pc = null), this._onNetworkStatus(1), this.unsubscribe(), e ? (this._debug.error("DirectTransport: Closed", e, { participantId: this._participantId }), this._setState(K.FAILED)) : (this._debug.debug("DirectTransport: Closed", { participantId: this._participantId }), this._setState(K.CLOSED)), this._triggerEvent(J.PEER_CONNECTION_CLOSED));
3855
+ }), this._remoteStream = null), this._stopStatInterval(), this._stopSettingsInterval(), this._pc && (this._animojiDataChannel && (this._animojiDataChannel.onopen = null, this._animojiDataChannel.onmessage = null, this._animojiDataChannel.onerror = null, this._animojiDataChannel.close()), this._pc.onicecandidate = null, this._pc.ontrack = null, this._pc.oniceconnectionstatechange = null, this._pc.onconnectionstatechange = null, this._pc.onsignalingstatechange = null, this._pc.close(), this._pc = null), this._onNetworkStatus(1), this.unsubscribe(), e ? (this._debug.error("DirectTransport: Closed", e, { participantId: this._participantId }), this._setState(W.FAILED)) : (this._debug.debug("DirectTransport: Closed", { participantId: this._participantId }), this._setState(W.CLOSED)), this._triggerEvent(J.PEER_CONNECTION_CLOSED));
3882
3856
  }
3883
3857
  _setState(e) {
3884
3858
  this._state !== e && (this._debug.debug(`DirectTransport: State changed to ${e}`, { participantId: this._participantId }), this._state = e, this._triggerEvent(J.STATE_CHANGED, e));
@@ -3982,7 +3956,7 @@ var Cr = class extends g {
3982
3956
  switch (this._debug.debug(`DirectTransport: Ice Connection state changed to ${this._pc?.iceConnectionState}`, { participantId: this._participantId }), this._pc?.iceConnectionState) {
3983
3957
  case "checking":
3984
3958
  let e = this.getState();
3985
- e === K.IDLE || e === K.OPENED ? this._setState(K.CONNECTING) : this._setState(K.RECONNECTING);
3959
+ e === W.IDLE || e === W.OPENED ? this._setState(W.CONNECTING) : this._setState(W.RECONNECTING);
3986
3960
  break;
3987
3961
  case "connected":
3988
3962
  case "completed":
@@ -3991,7 +3965,7 @@ var Cr = class extends g {
3991
3965
  }
3992
3966
  }
3993
3967
  _markConnected() {
3994
- this._neverConnected = !1, this._setState(K.CONNECTED), this._stopReconnection(), this._pc && M.getPeerConnectionHostInfo(this._pc).then((e) => {
3968
+ this._neverConnected = !1, this._setState(W.CONNECTED), this._stopReconnection(), this._pc && M.getPeerConnectionHostInfo(this._pc).then((e) => {
3995
3969
  e?.local && (this._logger?.log(E.ICE_CONNECTION_TYPE, e.local.type), this._debug.debug("Selected ICE candidates", e));
3996
3970
  }), this._startStatInterval();
3997
3971
  }
@@ -4002,7 +3976,7 @@ var Cr = class extends g {
4002
3976
  break;
4003
3977
  case "failed":
4004
3978
  case "disconnected":
4005
- this._reconnectionPrevented ? this.close(/* @__PURE__ */ Error(`Ice connection ${this._pc.connectionState}`)) : (this._setState(K.RECONNECTING), this._startReconnection());
3979
+ this._reconnectionPrevented ? this.close(/* @__PURE__ */ Error(`Ice connection ${this._pc.connectionState}`)) : (this._setState(W.RECONNECTING), this._startReconnection());
4006
3980
  break;
4007
3981
  case "closed":
4008
3982
  this.close(/* @__PURE__ */ Error("Ice connection closed"));
@@ -4015,7 +3989,7 @@ var Cr = class extends g {
4015
3989
  }, N.transportConnectionWaitTime));
4016
3990
  }
4017
3991
  _requestTopologySwitch() {
4018
- this._isMaster && this._signaling.ready && (this._debug.log("Switch topology DIRECT to SERVER", { participantId: this._participantId }), this._signaling.switchTopology(q.SERVER));
3992
+ this._isMaster && this._signaling.ready && (this._debug.log("Switch topology DIRECT to SERVER", { participantId: this._participantId }), this._signaling.switchTopology(K.SERVER));
4019
3993
  }
4020
3994
  _stopReconnection() {
4021
3995
  this._reconnectionTimeout && (clearTimeout(this._reconnectionTimeout), this._reconnectionTimeout = null), this._iceRestartTimeout && (clearTimeout(this._iceRestartTimeout), this._iceRestartTimeout = null);
@@ -4098,17 +4072,17 @@ var Cr = class extends g {
4098
4072
  this._lastStat = t, this._codecStatsAggregator?.reportUsage(t);
4099
4073
  let n = {
4100
4074
  inbound: {
4101
- topology: q.DIRECT,
4075
+ topology: K.DIRECT,
4102
4076
  transport: t.transport,
4103
4077
  rtps: t.rtps.filter((e) => e.type === "inbound-rtp" ? (e.userId = this._participantId, !0) : !1)
4104
4078
  },
4105
4079
  outbound: {
4106
- topology: q.DIRECT,
4080
+ topology: K.DIRECT,
4107
4081
  transport: t.transport,
4108
4082
  rtps: t.rtps.filter((e) => e.type === "outbound-rtp")
4109
4083
  },
4110
4084
  remoteInbound: {
4111
- topology: q.DIRECT,
4085
+ topology: K.DIRECT,
4112
4086
  transport: t.transport,
4113
4087
  rtps: t.remoteRtps ?? []
4114
4088
  }
@@ -4142,8 +4116,8 @@ var Cr = class extends g {
4142
4116
  }
4143
4117
  async _checkPPTNetwork(e) {
4144
4118
  if (!N.switchVideoAtBadNetwork || !e.inbound.transport.averageNetStat) return;
4145
- let { averageNetStat: t } = e.inbound.transport, n = t.currentRoundTripTime <= this._networkLimitsForVideo.good.rtt && t.lostPercent <= this._networkLimitsForVideo.good.loss, r = t.currentRoundTripTime >= this._networkLimitsForVideo.bad.rtt || t.lostPercent >= this._networkLimitsForVideo.bad.loss, i = t.currentRoundTripTime < this._networkLimitsForVideo.bad.rtt, a = this._videoMaxDimensionsForNet.good, o = yr.L1T1;
4146
- if (r ? (this._lastBadConnection = Date.now(), i ? (a = this._videoMaxDimensionsForNet.bad, o = yr.L1T2) : (a = this._videoMaxDimensionsForNet.worst, o = yr.L1T3)) : n && (a = this._videoMaxDimensionsForNet.good, o = yr.L1T1), !(a < this._lastVideoMaxDimension || Date.now() - this._lastBadConnection > Fr) || this._lastVideoMaxDimension === a) return;
4119
+ let { averageNetStat: t } = e.inbound.transport, n = t.currentRoundTripTime <= this._networkLimitsForVideo.good.rtt && t.lostPercent <= this._networkLimitsForVideo.good.loss, r = t.currentRoundTripTime >= this._networkLimitsForVideo.bad.rtt || t.lostPercent >= this._networkLimitsForVideo.bad.loss, i = t.currentRoundTripTime < this._networkLimitsForVideo.bad.rtt, a = this._videoMaxDimensionsForNet.good, o = gr.L1T1;
4120
+ if (r ? (this._lastBadConnection = Date.now(), i ? (a = this._videoMaxDimensionsForNet.bad, o = gr.L1T2) : (a = this._videoMaxDimensionsForNet.worst, o = gr.L1T3)) : n && (a = this._videoMaxDimensionsForNet.good, o = gr.L1T1), !(a < this._lastVideoMaxDimension || Date.now() - this._lastBadConnection > Mr) || this._lastVideoMaxDimension === a) return;
4147
4121
  let s = this._serverSettings.camera;
4148
4122
  if (!s || !await this._isSVCSupported(e, o)) return;
4149
4123
  this._debug.debug("Switch outbound video frame size and scalabilityMode", {
@@ -4208,9 +4182,9 @@ var Cr = class extends g {
4208
4182
  }, n(r)) : this._debug.error(`[${t}] data channel open failed, state [${e}]`);
4209
4183
  };
4210
4184
  }
4211
- }, Lr = /* @__PURE__ */ function(e) {
4185
+ }, Pr = /* @__PURE__ */ function(e) {
4212
4186
  return e.AUDIO_MIX = "audio-mix", e.PARTICIPANT_AGNOSTIC_TRACK_PREFIX = "pat", e.TRANSPARENT_AUDIO_TRACK_PREFIX = "ta", e;
4213
- }({}), Rr = 16, zr = class e {
4187
+ }({}), Fr = 16, Ir = class e {
4214
4188
  constructor(e, t, n, r = z) {
4215
4189
  h(this, "_datachannel", void 0), h(this, "_participantIdRegistry", void 0), h(this, "_asrCallback", void 0), h(this, "_textDecoder", void 0), h(this, "_debug", void 0), this._debug = r, this._debug.debug("AsrReceiver started"), this._datachannel = e, this._participantIdRegistry = t, this._asrCallback = n, this._textDecoder = new TextDecoder(), this._datachannel.onmessage = (e) => this._onDataChannelMessage(e.data);
4216
4190
  }
@@ -4224,7 +4198,7 @@ var Cr = class extends g {
4224
4198
  ssrc: a,
4225
4199
  timestamp: o,
4226
4200
  duration: s,
4227
- data: e.slice(Rr)
4201
+ data: e.slice(Fr)
4228
4202
  };
4229
4203
  }
4230
4204
  _onDataChannelMessage(t) {
@@ -4244,7 +4218,7 @@ var Cr = class extends g {
4244
4218
  destroy() {
4245
4219
  this._datachannel.onmessage = null;
4246
4220
  }
4247
- }, Br, Vr = class {
4221
+ }, Lr, Rr = class {
4248
4222
  constructor() {
4249
4223
  h(this, "_value", 1);
4250
4224
  }
@@ -4255,10 +4229,10 @@ var Cr = class extends g {
4255
4229
  this._value = e;
4256
4230
  }
4257
4231
  };
4258
- Br = Vr, h(Vr, "_instance", null), h(Vr, "getInstance", () => (Br._instance || (Br._instance = new Br()), Br._instance));
4232
+ Lr = Rr, h(Rr, "_instance", null), h(Rr, "getInstance", () => (Lr._instance || (Lr._instance = new Lr()), Lr._instance));
4259
4233
  //#endregion
4260
4234
  //#region src/classes/ParticipantIdRegistry.ts
4261
- var Hr = class {
4235
+ var zr = class {
4262
4236
  constructor(e = z) {
4263
4237
  h(this, "streamDescriptionByCompactId", /* @__PURE__ */ new Map()), h(this, "compactIdByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_debug", void 0), this._debug = e;
4264
4238
  }
@@ -4374,7 +4348,7 @@ var Hr = class {
4374
4348
  this._debug.error("unexpected null sequenceNumber", e, r);
4375
4349
  continue;
4376
4350
  }
4377
- let l = Lr.PARTICIPANT_AGNOSTIC_TRACK_PREFIX + "-" + e, u = i ? i >>> 0 : null;
4351
+ let l = Pr.PARTICIPANT_AGNOSTIC_TRACK_PREFIX + "-" + e, u = i ? i >>> 0 : null;
4378
4352
  n.push({
4379
4353
  participantStreamDescription: c,
4380
4354
  streamId: l,
@@ -4390,9 +4364,9 @@ var Hr = class {
4390
4364
  participantUpdateInfos: n
4391
4365
  };
4392
4366
  }
4393
- }, Ur = /* @__PURE__ */ function(e) {
4367
+ }, q = /* @__PURE__ */ function(e) {
4394
4368
  return e.INIT = "init", e.READY = "ready", e.FRAME = "frame", e.SET_BITRATE = "set_bitrate", e.ERROR = "error", e.DEBUG = "debug", e.LOG_ERROR = "log_error", e;
4395
- }({}), Wr = class {
4369
+ }({}), Br = class {
4396
4370
  constructor(e = z, t = null) {
4397
4371
  h(this, "_worker", null), h(this, "_debug", void 0), h(this, "_logger", void 0), this._debug = e, this._logger = t;
4398
4372
  }
@@ -4408,7 +4382,7 @@ var Hr = class {
4408
4382
  return;
4409
4383
  }
4410
4384
  t({
4411
- type: Ur.FRAME,
4385
+ type: q.FRAME,
4412
4386
  error: e
4413
4387
  });
4414
4388
  };
@@ -4418,23 +4392,23 @@ var Hr = class {
4418
4392
  e.preventDefault?.(), m(this._formatWorkerMessageError(e));
4419
4393
  }, f.onmessage = (e) => {
4420
4394
  switch (e.data.type) {
4421
- case Ur.READY:
4395
+ case q.READY:
4422
4396
  s = !0, c || (c = !0, a());
4423
4397
  break;
4424
- case Ur.ERROR:
4398
+ case q.ERROR:
4425
4399
  s ? m(e.data.error) : p(e.data.error);
4426
4400
  break;
4427
- case Ur.FRAME:
4401
+ case q.FRAME:
4428
4402
  t(e.data);
4429
4403
  break;
4430
- case Ur.DEBUG:
4404
+ case q.DEBUG:
4431
4405
  this._debug.debug(e.data.message);
4432
4406
  break;
4433
- case Ur.LOG_ERROR:
4407
+ case q.LOG_ERROR:
4434
4408
  this._logger?.log(E.ERROR, e.data.message);
4435
4409
  break;
4436
4410
  }
4437
- }, this._sendToWorker(Ur.INIT, r, i);
4411
+ }, this._sendToWorker(q.INIT, r, i);
4438
4412
  });
4439
4413
  }
4440
4414
  _removeWorker() {
@@ -4457,7 +4431,7 @@ var Hr = class {
4457
4431
  static isBrowserSupported() {
4458
4432
  throw Error("Not implemented");
4459
4433
  }
4460
- }, Gr = class extends Wr {
4434
+ }, Vr = class extends Br {
4461
4435
  constructor(e = z, t = null) {
4462
4436
  super(e, t);
4463
4437
  }
@@ -4467,7 +4441,7 @@ var Hr = class {
4467
4441
  }, [c, c.getUrl]);
4468
4442
  }
4469
4443
  decodeFrame(e, t, n, r) {
4470
- this._sendToWorker(Ur.FRAME, {
4444
+ this._sendToWorker(q.FRAME, {
4471
4445
  timestamp: e,
4472
4446
  data: t.buffer,
4473
4447
  isVP9: n,
@@ -4481,7 +4455,7 @@ var Hr = class {
4481
4455
  static isBrowserSupported() {
4482
4456
  return "WebAssembly" in window && "Worker" in window;
4483
4457
  }
4484
- }, Kr = class extends Wr {
4458
+ }, Hr = class extends Br {
4485
4459
  constructor(e = z, t = null) {
4486
4460
  super(e, t);
4487
4461
  }
@@ -4491,7 +4465,7 @@ var Hr = class {
4491
4465
  }, [O.baseChromeVersion() >= 92 || O.browserName() === "Safari"]);
4492
4466
  }
4493
4467
  decodeFrame(e, t, n, r = !1) {
4494
- this._sendToWorker(Ur.FRAME, {
4468
+ this._sendToWorker(q.FRAME, {
4495
4469
  timestamp: e,
4496
4470
  data: t.buffer,
4497
4471
  isVP9: n,
@@ -4504,7 +4478,7 @@ var Hr = class {
4504
4478
  static isBrowserSupported() {
4505
4479
  return "VideoDecoder" in window && "Worker" in window && "VideoFrame" in window && !O.isBrokenVP9Decoder() && O.browserName() !== "Firefox";
4506
4480
  }
4507
- }, qr = class {
4481
+ }, Ur = class {
4508
4482
  constructor(e = null, t = 0) {
4509
4483
  h(this, "_counter", 0), h(this, "_interval", 0), h(this, "_lastCalculationTime", Date.now()), h(this, "_onCalculated", null), this._onCalculated = e, t && (this._interval = window.setInterval(() => this.calculate(), t));
4510
4484
  }
@@ -4518,7 +4492,7 @@ var Hr = class {
4518
4492
  destroy() {
4519
4493
  window.clearInterval(this._interval), this._interval = 0;
4520
4494
  }
4521
- }, Jr = class {
4495
+ }, Wr = class {
4522
4496
  constructor(e, t) {
4523
4497
  h(this, "_participantId", void 0), h(this, "_statAggregator", void 0), h(this, "_firstFrameReceived", !1), this._participantId = e, this._statAggregator = t;
4524
4498
  }
@@ -4533,14 +4507,14 @@ var Hr = class {
4533
4507
  height: t
4534
4508
  });
4535
4509
  }
4536
- }, Yr = 65536, Xr = "MARK_SCREENSHARE_FREEZE_DURATION", Zr = class e {
4510
+ }, Gr = 65536, Kr = "MARK_SCREENSHARE_FREEZE_DURATION", qr = class e {
4537
4511
  constructor(e, t, n, r, i, a = z) {
4538
- h(this, "_participantId", void 0), h(this, "_onStream", void 0), h(this, "_onStat", void 0), h(this, "_onKeyFrameRequested", void 0), h(this, "_statScreenShareFirstFrame", void 0), h(this, "_debug", void 0), h(this, "_chunks", []), this._participantId = e, this._onStream = t, this._onStat = n, this._onKeyFrameRequested = i, this._statScreenShareFirstFrame = new Jr(e, r), this._debug = a;
4512
+ h(this, "_participantId", void 0), h(this, "_onStream", void 0), h(this, "_onStat", void 0), h(this, "_onKeyFrameRequested", void 0), h(this, "_statScreenShareFirstFrame", void 0), h(this, "_debug", void 0), h(this, "_chunks", []), this._participantId = e, this._onStream = t, this._onStat = n, this._onKeyFrameRequested = i, this._statScreenShareFirstFrame = new Wr(e, r), this._debug = a;
4539
4513
  }
4540
4514
  appendChunk(t) {
4541
4515
  let n = this._chunks.length;
4542
4516
  if (t.start) this._measureFreezeDuration(!1), this._measureFreezeDuration(!0), n && (this._debug.warn("[FrameBuilder] Cleanup buffer", Array.prototype.slice.call(this._chunks)), this._chunks = []);
4543
- else if (!n || (this._chunks[n - 1].sequence + 1) % Yr !== t.sequence) {
4517
+ else if (!n || (this._chunks[n - 1].sequence + 1) % Gr !== t.sequence) {
4544
4518
  this._debug.warn("[FrameBuilder] Got incorrect chunk");
4545
4519
  return;
4546
4520
  }
@@ -4557,7 +4531,7 @@ var Hr = class {
4557
4531
  }
4558
4532
  }
4559
4533
  destroy() {
4560
- U.clearMark(Xr), U.clearMark(U.getMarkNameScreenshareFirstFrame(this._participantId)), this._chunks = [];
4534
+ U.clearMark(Kr), U.clearMark(U.getMarkNameScreenshareFirstFrame(this._participantId)), this._chunks = [];
4561
4535
  }
4562
4536
  _processFrameData() {
4563
4537
  let e = this._chunks;
@@ -4580,13 +4554,13 @@ var Hr = class {
4580
4554
  }
4581
4555
  _measureFreezeDuration(e) {
4582
4556
  if (e) {
4583
- U.setMark(Xr);
4557
+ U.setMark(Kr);
4584
4558
  return;
4585
4559
  }
4586
- let t = U.measureMark(Xr);
4560
+ let t = U.measureMark(Kr);
4587
4561
  t !== null && t > 1e3 && this._onStat({ freeze_duration: t });
4588
4562
  }
4589
- }, Qr = class {
4563
+ }, Jr = class {
4590
4564
  constructor(e) {
4591
4565
  h(this, "_onStream", void 0), this._onStream = e;
4592
4566
  }
@@ -4599,7 +4573,7 @@ var Hr = class {
4599
4573
  static isBrowserSupported() {
4600
4574
  throw Error("Method `isBrowserSupported` is not implemented");
4601
4575
  }
4602
- }, $r = class extends Qr {
4576
+ }, Yr = class extends Jr {
4603
4577
  constructor(e, t = z) {
4604
4578
  super(e), h(this, "_useImageBitmap", void 0), h(this, "_canvas", null), h(this, "_canvasContext", null), h(this, "_stream", null), h(this, "_track", null), h(this, "_debug", void 0), this._debug = t, this._debug.debug("CanvasRenderer started"), this._useImageBitmap = "ImageBitmap" in window;
4605
4579
  }
@@ -4659,7 +4633,7 @@ var Hr = class {
4659
4633
  static isBrowserSupported() {
4660
4634
  return ("CanvasCaptureMediaStream" in window || "CanvasCaptureMediaStreamTrack" in window) && !(O.browserName() === "Safari" && Number(O.browserVersion()) === 15) && !(O.browserName() === "Firefox" && Number(O.browserVersion()) < 60);
4661
4635
  }
4662
- }, ei = class extends Qr {
4636
+ }, Xr = class extends Jr {
4663
4637
  constructor(e, t = z) {
4664
4638
  super(e), h(this, "_generator", void 0), h(this, "_writer", void 0), h(this, "_stream", void 0), h(this, "_debug", void 0), this._debug = t, this._debug.debug("TrackGeneratorRenderer started"), this._generator = new MediaStreamTrackGenerator({ kind: A.video }), this._writer = this._generator.writable.getWriter(), this._stream = new MediaStream([this._generator]), this._onStream(this._stream);
4665
4639
  }
@@ -4670,9 +4644,9 @@ var Hr = class {
4670
4644
  this._writer.releaseLock(), this._generator.writable.close().then(() => this._generator.stop()), this._debug.debug("TrackGeneratorRenderer destroyed");
4671
4645
  }
4672
4646
  static isBrowserSupported() {
4673
- return "VideoFrame" in window && "MediaStreamTrackGenerator" in window && Kr.isBrowserSupported();
4647
+ return "VideoFrame" in window && "MediaStreamTrackGenerator" in window && Hr.isBrowserSupported();
4674
4648
  }
4675
- }, ti = class extends Zr {
4649
+ }, Zr = class extends qr {
4676
4650
  constructor(e, t, n, r, i, a = z, o = null) {
4677
4651
  super(e, t, n, r, i, a), h(this, "_renderer", void 0), h(this, "_decoder", void 0), h(this, "_decoderReady", !1), h(this, "_decoderBusy", !1), h(this, "_decoderQueue", []), h(this, "_fpsMeter", void 0), h(this, "_logger", void 0), this._logger = o, this._debug.debug(`StreamBuilder started for participant [${e}]`), this._initFpsMeter(), this._initRenderer(), this._initDecoder();
4678
4652
  }
@@ -4680,20 +4654,20 @@ var Hr = class {
4680
4654
  e.keyframe && (this._decoderQueue = []), this._decoderQueue.push(e), this._decodeQueue();
4681
4655
  }
4682
4656
  _initFpsMeter() {
4683
- this._fpsMeter = new qr((e) => this._debug.log(`[StreamBuilder][${this._participantId}] fps: ${e}`), 2e4);
4657
+ this._fpsMeter = new Ur((e) => this._debug.log(`[StreamBuilder][${this._participantId}] fps: ${e}`), 2e4);
4684
4658
  }
4685
4659
  _initRenderer(e = !1) {
4686
- e || !ei.isBrowserSupported() ? this._renderer = new $r(this._onStream, this._debug) : this._renderer = new ei(this._onStream, this._debug);
4660
+ e || !Xr.isBrowserSupported() ? this._renderer = new Yr(this._onStream, this._debug) : this._renderer = new Xr(this._onStream, this._debug);
4687
4661
  }
4688
4662
  _initDecoder(e = !1) {
4689
- e || !Kr.isBrowserSupported() ? this._decoder = new Gr(this._debug, this._logger) : this._decoder = new Kr(this._debug, this._logger), this._decoder.init(async (e) => {
4663
+ e || !Hr.isBrowserSupported() ? this._decoder = new Vr(this._debug, this._logger) : this._decoder = new Hr(this._debug, this._logger), this._decoder.init(async (e) => {
4690
4664
  this._decoderBusy = !1, "VideoFrame" in window && e instanceof VideoFrame ? await this._renderer.drawFrame(e) : await this._renderer.drawImage(e), this._fpsMeter.increment(), this._decodeQueue();
4691
4665
  }, (e) => {
4692
- this._decoderBusy = !1, this._decodeQueue(), this._decoder instanceof Kr && typeof e == "string" && e.includes("EncodingError") && this._switchToLibVPXDecoder();
4666
+ this._decoderBusy = !1, this._decodeQueue(), this._decoder instanceof Hr && typeof e == "string" && e.includes("EncodingError") && this._switchToLibVPXDecoder();
4693
4667
  }, this._onKeyFrameRequested).then(() => {
4694
4668
  this._decoderReady = !0, this._decodeQueue();
4695
4669
  }).catch((e) => {
4696
- this._debug.warn("StreamBuilder decoder init failed", e), this._decoder instanceof Kr && this._switchToLibVPXDecoder();
4670
+ this._debug.warn("StreamBuilder decoder init failed", e), this._decoder instanceof Hr && this._switchToLibVPXDecoder();
4697
4671
  });
4698
4672
  }
4699
4673
  _switchToLibVPXDecoder() {
@@ -4708,20 +4682,20 @@ var Hr = class {
4708
4682
  super.destroy(), this._fpsMeter.destroy(), this._decoder.destroy(), this._renderer.destroy(), this._debug.debug(`StreamBuilder destroyed for participant ${this._participantId}`);
4709
4683
  }
4710
4684
  static isBrowserSupported() {
4711
- return $r.isBrowserSupported() || ei.isBrowserSupported();
4685
+ return Yr.isBrowserSupported() || Xr.isBrowserSupported();
4712
4686
  }
4713
- }, ni = 1, ri = 1, ii = 2, ai = 0, oi = 1, si = 2, ci = 4, li = 8;
4714
- function ui(e, t, n, r, i, a, o) {
4687
+ }, Qr = 1, $r = 1, ei = 2, ti = 0, ni = 1, ri = 2, ii = 4, ai = 8;
4688
+ function oi(e, t, n, r, i, a, o) {
4715
4689
  let s = 0;
4716
- t && (s |= oi), n && (s |= si), r && (s |= ci), o || (s |= li);
4690
+ t && (s |= ni), n && (s |= ri), r && (s |= ii), o || (s |= ai);
4717
4691
  let c = /* @__PURE__ */ new ArrayBuffer(11), l = new DataView(c);
4718
- if (l.setUint8(0, ni), l.setUint16(1, i), l.setUint32(3, e), l.setUint8(7, +!!a), l.setUint16(8, ai), l.setUint8(10, s), !o) return c;
4692
+ if (l.setUint8(0, Qr), l.setUint16(1, i), l.setUint32(3, e), l.setUint8(7, +!!a), l.setUint16(8, ti), l.setUint8(10, s), !o) return c;
4719
4693
  let u = new Uint8Array(c.byteLength + o.byteLength);
4720
4694
  return u.set(new Uint8Array(c), 0), u.set(new Uint8Array(o), c.byteLength), u.buffer;
4721
4695
  }
4722
- function di(e) {
4723
- let t = new DataView(e), n = t.getUint8(0), r = t.getUint16(1), i = t.getUint32(3), a = t.getUint8(7) === 1, o = t.getUint16(8), s = t.getUint8(10), c = !!(s & oi), l = !!(s & si), u = !!(s & ci), d = !!(s & li);
4724
- if (n !== ni) throw Error(`Unexpected protocol version. Got ${n}, expected ${ni}`);
4696
+ function si(e) {
4697
+ let t = new DataView(e), n = t.getUint8(0), r = t.getUint16(1), i = t.getUint32(3), a = t.getUint8(7) === 1, o = t.getUint16(8), s = t.getUint8(10), c = !!(s & ni), l = !!(s & ri), u = !!(s & ii), d = !!(s & ai);
4698
+ if (n !== Qr) throw Error(`Unexpected protocol version. Got ${n}, expected ${Qr}`);
4725
4699
  return {
4726
4700
  timestamp: i,
4727
4701
  start: c,
@@ -4734,26 +4708,26 @@ function di(e) {
4734
4708
  data: e.slice(11)
4735
4709
  };
4736
4710
  }
4737
- function fi(e) {
4711
+ function ci(e) {
4738
4712
  if (!e || !e.byteLength || e.byteLength !== 4) return !1;
4739
4713
  let t = new DataView(e);
4740
- return !(t.getUint8(0) !== ni || t.getUint8(1) !== ri || t.getUint16(2) !== ai);
4714
+ return !(t.getUint8(0) !== Qr || t.getUint8(1) !== $r || t.getUint16(2) !== ti);
4741
4715
  }
4742
- function pi(e) {
4716
+ function li(e) {
4743
4717
  if (!e || !e.byteLength || e.byteLength !== 10) return null;
4744
4718
  let t = new DataView(e);
4745
- return t.getUint8(0) !== ni || t.getUint8(1) !== ii || t.getUint16(2) !== ai ? null : {
4719
+ return t.getUint8(0) !== Qr || t.getUint8(1) !== ei || t.getUint16(2) !== ti ? null : {
4746
4720
  seq: t.getUint16(4),
4747
4721
  ts2: t.getUint32(6)
4748
4722
  };
4749
4723
  }
4750
- function mi(e) {
4724
+ function ui(e) {
4751
4725
  let t = /* @__PURE__ */ new ArrayBuffer(4), n = new DataView(t);
4752
- return n.setUint8(0, ni), n.setUint8(1, ri), n.setUint16(2, e), t;
4726
+ return n.setUint8(0, Qr), n.setUint8(1, $r), n.setUint16(2, e), t;
4753
4727
  }
4754
4728
  //#endregion
4755
4729
  //#region src/classes/screenshare/WebmBuilder.ts
4756
- var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
4730
+ var di = 2 ** 15 - 1, fi = 1, pi = 5, mi = 5, hi = class e {
4757
4731
  constructor(e, t = z) {
4758
4732
  h(this, "_mediaSource", void 0), h(this, "_codec", void 0), h(this, "_sourceBuffer", null), h(this, "_queue", []), h(this, "_clearBufferTill", 0), h(this, "_debug", void 0), this._mediaSource = new MediaSource(), this._codec = e, this._debug = t;
4759
4733
  let n = () => {
@@ -4796,8 +4770,8 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
4796
4770
  this._mediaSource?.readyState === "open" && this._sourceBuffer?.abort();
4797
4771
  let e = this._sourceBuffer?.buffered, t = e?.length;
4798
4772
  if (!t) return;
4799
- let n = e.start(0), r = Math.max(0, e.end(t - 1) - _i);
4800
- r - n > vi && (this._clearBufferTill = r);
4773
+ let n = e.start(0), r = Math.max(0, e.end(t - 1) - pi);
4774
+ r - n > mi && (this._clearBufferTill = r);
4801
4775
  }
4802
4776
  destroy() {
4803
4777
  this._queue = [], this._mediaSource.readyState === "open" && (this._sourceBuffer?.abort(), this._mediaSource.endOfStream()), this._sourceBuffer = null, this._clearBufferTill = 0;
@@ -4811,7 +4785,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
4811
4785
  get buffered() {
4812
4786
  return this._sourceBuffer?.buffered;
4813
4787
  }
4814
- }, bi = class e extends Zr {
4788
+ }, gi = class e extends qr {
4815
4789
  constructor(e, t, n, r, i = z) {
4816
4790
  super(e, t, n, r, void 0, i), h(this, "_mediaBuffer", null), h(this, "_video", null), h(this, "_stream", null), h(this, "_earliestTimestamp", 0), h(this, "_clusterStartTime", 0), h(this, "_lastFrameTimestamp", 0), this._debug.debug(`[WebmBuilder] started for participant [${e}]`);
4817
4791
  }
@@ -4835,8 +4809,8 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
4835
4809
  u.element(u.ID.MuxingApp, u.string("vk-webm-builder")),
4836
4810
  u.element(u.ID.WritingApp, u.string("vk-webm-builder"))
4837
4811
  ]), i = [u.element(u.ID.PixelWidth, u.number(e)), u.element(u.ID.PixelHeight, u.number(t))], a = u.element(u.ID.Tracks, u.element(u.ID.TrackEntry, [
4838
- u.element(u.ID.TrackNumber, u.number(gi)),
4839
- u.element(u.ID.TrackUID, u.number(gi)),
4812
+ u.element(u.ID.TrackNumber, u.number(fi)),
4813
+ u.element(u.ID.TrackUID, u.number(fi)),
4840
4814
  u.element(u.ID.TrackType, u.number(1)),
4841
4815
  u.element(u.ID.FlagLacing, u.number(0)),
4842
4816
  u.element(u.ID.DefaultDuration, u.number(1e9)),
@@ -4849,7 +4823,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
4849
4823
  return u.unknownSizeElement(u.ID.Cluster, [u.element(u.ID.Timecode, u.number(Math.round(e)))]);
4850
4824
  }
4851
4825
  _createVideo(e) {
4852
- this._mediaBuffer = new yi(e, this._debug), this._video = document.createElement("video"), this._video.autoplay = !0, this._video.controls = !1, this._video.muted = !0, this._video.style.pointerEvents = "none", this._video.style.visibility = "hidden", this._video.style.position = "absolute", this._video.style.width = "160px", this._video.style.height = "90px", this._video.style.bottom = "0", this._video.style.right = "0", this._video.style.zIndex = "5000", this._video.src = URL.createObjectURL(this._mediaBuffer.mediaSource), document.body.appendChild(this._video);
4826
+ this._mediaBuffer = new hi(e, this._debug), this._video = document.createElement("video"), this._video.autoplay = !0, this._video.controls = !1, this._video.muted = !0, this._video.style.pointerEvents = "none", this._video.style.visibility = "hidden", this._video.style.position = "absolute", this._video.style.width = "160px", this._video.style.height = "90px", this._video.style.bottom = "0", this._video.style.right = "0", this._video.style.zIndex = "5000", this._video.src = URL.createObjectURL(this._mediaBuffer.mediaSource), document.body.appendChild(this._video);
4853
4827
  let t = () => {
4854
4828
  if (this._video?.src) {
4855
4829
  this._debug.warn(`[WebmBuilder] Video paused for participant [${this._participantId}], try to play again`);
@@ -4876,13 +4850,13 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
4876
4850
  this._mediaBuffer?.append(a);
4877
4851
  }
4878
4852
  let i = Math.round(r - this._clusterStartTime);
4879
- if (i > hi && (this._clusterStartTime = r, i = 0), i === 0) {
4853
+ if (i > di && (this._clusterStartTime = r, i = 0), i === 0) {
4880
4854
  this._debug.debug(`[WebmBuilder] Cluster header for participant [${this._participantId}]`);
4881
4855
  let t = e._genClusterHeader(this._clusterStartTime);
4882
4856
  this._mediaBuffer?.append(t);
4883
4857
  }
4884
4858
  let a = u.element(u.ID.SimpleBlock, [
4885
- u.vintEncodedNumber(gi),
4859
+ u.vintEncodedNumber(fi),
4886
4860
  u.bytes(e._intToU16BE(i)),
4887
4861
  u.number(!!t.keyframe << 7),
4888
4862
  u.bytes(t.frameData)
@@ -4895,12 +4869,12 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
4895
4869
  static isBrowserSupported() {
4896
4870
  return "captureStream" in window.HTMLVideoElement?.prototype && window.MediaSource?.isTypeSupported("video/webm; codecs=\"vp8\"") && window.MediaSource?.isTypeSupported("video/webm; codecs=\"vp9\"");
4897
4871
  }
4898
- }, xi = class {
4872
+ }, _i = class {
4899
4873
  constructor(e, t, n, r, i, a = null, o = z, s = null) {
4900
4874
  h(this, "_datachannel", void 0), h(this, "_participantIdRegistry", null), h(this, "_streamBuilders", {}), h(this, "_onStream", () => {}), h(this, "_onEos", () => {}), h(this, "_onStat", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), this._debug = o, this._logger = s, this._statAggregator = a, this._debug.debug("ScreenCaptureReceiver started"), this._datachannel = e, this._participantIdRegistry = t, this._onStream = n, this._onEos = r, this._onStat = i, this._datachannel.onmessage = (e) => this._onDataChannelMessage(e.data);
4901
4875
  }
4902
4876
  _onDataChannelMessage(e) {
4903
- let t = di(e), n = this._participantIdRegistry?.getStreamDescription(t.ssrc)?.participantId;
4877
+ let t = si(e), n = this._participantIdRegistry?.getStreamDescription(t.ssrc)?.participantId;
4904
4878
  if (!n) {
4905
4879
  this._debug.warn(`Participant id for ssrc ${t.ssrc} not found in registry`);
4906
4880
  return;
@@ -4912,7 +4886,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
4912
4886
  let r = this._streamBuilders[n];
4913
4887
  if (!r) {
4914
4888
  let e = (e) => this._onStream(n, e);
4915
- r = N.screenShareWebmBuilder && bi.isBrowserSupported() ? new bi(n, e, this._onStat, this._statAggregator, this._debug) : new ti(n, e, this._onStat, this._statAggregator, () => {
4889
+ r = N.screenShareWebmBuilder && gi.isBrowserSupported() ? new gi(n, e, this._onStat, this._statAggregator, this._debug) : new Zr(n, e, this._onStat, this._statAggregator, () => {
4916
4890
  this._requestKeyFrame(t.ssrc);
4917
4891
  }, this._debug, this._logger), this._streamBuilders[n] = r;
4918
4892
  }
@@ -4920,7 +4894,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
4920
4894
  }
4921
4895
  _requestKeyFrame(e) {
4922
4896
  if (!(!this._datachannel || this._datachannel.readyState !== "open")) try {
4923
- let t = mi(e);
4897
+ let t = ui(e);
4924
4898
  this._datachannel.send(t), this._debug.debug(`ScreenCaptureReceiver request for keyframe for ssrc ${e}`);
4925
4899
  } catch (e) {
4926
4900
  this._debug.warn("Failed to send keyframe request", e);
@@ -4933,7 +4907,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
4933
4907
  destroy() {
4934
4908
  this._datachannel.onbufferedamountlow = null, this._datachannel.onmessage = null, this._onStream = () => {}, Object.values(this._streamBuilders).forEach((e) => e.destroy()), this._streamBuilders = {}, this._participantIdRegistry = null, this._debug.debug("ScreenCaptureReceiver destroyed");
4935
4909
  }
4936
- }, Si = class {
4910
+ }, vi = class {
4937
4911
  constructor(e, t, n) {
4938
4912
  h(this, "_prev", void 0), h(this, "_next", void 0), h(this, "_data", void 0), this._next = n, n && (n.prev = this), this._prev = t, t && (t.next = this), this._data = e;
4939
4913
  }
@@ -4952,7 +4926,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
4952
4926
  get data() {
4953
4927
  return this._data;
4954
4928
  }
4955
- }, Ci = class {
4929
+ }, yi = class {
4956
4930
  constructor() {
4957
4931
  h(this, "_head", null), h(this, "_tail", null), h(this, "_length", 0);
4958
4932
  }
@@ -4960,7 +4934,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
4960
4934
  return this._length;
4961
4935
  }
4962
4936
  push(...e) {
4963
- for (let t of e) this._tail = new Si(t, this._tail, null), this._head || (this._head = this._tail), this._length++;
4937
+ for (let t of e) this._tail = new vi(t, this._tail, null), this._head || (this._head = this._tail), this._length++;
4964
4938
  }
4965
4939
  merge(e) {
4966
4940
  this._tail && (this._tail.next = e._head), this._head || (this._head = e._head), this._tail = e._tail, this._length += e._length, e.clear();
@@ -4990,7 +4964,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
4990
4964
  for (; t !== null;) e.push(t.data), t = t.next;
4991
4965
  return e.length ? JSON.stringify(e, (e, t) => t instanceof Error ? String(t) : t) : "";
4992
4966
  }
4993
- }, wi = 1e3, Ti = class extends Wr {
4967
+ }, bi = 1e3, xi = class extends Br {
4994
4968
  constructor(e, t, n, r, i = z, a = null) {
4995
4969
  super(i, a), h(this, "_sourceTrack", void 0), h(this, "_onFrame", void 0), h(this, "_useCongestionControl", void 0), h(this, "_maxBitrate", void 0), h(this, "_useImageCapture", void 0), h(this, "_video", null), h(this, "_imageCapture", null), h(this, "_canvas", null), h(this, "_canvasCtx", null), h(this, "_frameReadTimeout", 0), h(this, "_lastFrame", null), this._sourceTrack = e, this._onFrame = t, this._useCongestionControl = n, this._maxBitrate = r, this._useImageCapture = "ImageCapture" in window && ImageCapture.prototype.grabFrame !== void 0 && "ImageBitmap" in window, (e.readyState !== "live" || !e.enabled || e.muted) && (this._useImageCapture = !1);
4996
4970
  }
@@ -5059,7 +5033,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5059
5033
  }
5060
5034
  _encode(e, t) {
5061
5035
  let n = e.data.buffer;
5062
- this._sendToWorker(Ur.FRAME, {
5036
+ this._sendToWorker(q.FRAME, {
5063
5037
  width: e.width,
5064
5038
  height: e.height,
5065
5039
  imageData: n,
@@ -5076,7 +5050,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5076
5050
  let t = this._drawFrameData(this._lastFrame);
5077
5051
  this._encode(t, e);
5078
5052
  } else this._onFrame(null);
5079
- }, wi), this._getFrameBitmap().then((t) => {
5053
+ }, bi), this._getFrameBitmap().then((t) => {
5080
5054
  window.clearTimeout(this._frameReadTimeout), this._lastFrame?.close(), this._lastFrame = t;
5081
5055
  let n = this._drawFrameData(t);
5082
5056
  this._encode(n, e);
@@ -5086,7 +5060,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5086
5060
  this._useImageCapture ? this._requestFrameBitmap(e) : this._requestFrameVideo(e);
5087
5061
  }
5088
5062
  setBitrate(e, t, n) {
5089
- this._sendToWorker(Ur.SET_BITRATE, {
5063
+ this._sendToWorker(q.SET_BITRATE, {
5090
5064
  bitrate: e,
5091
5065
  useCbr: t
5092
5066
  });
@@ -5097,7 +5071,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5097
5071
  destroy() {
5098
5072
  this._removeWorker(), this._removeStream(), this._removeDom(), this._debug.debug("LibVPxEncoder destroyed");
5099
5073
  }
5100
- }, Ei = class extends Wr {
5074
+ }, Si = class extends Br {
5101
5075
  constructor(e, t, n, r, i, a, o = z, s = null) {
5102
5076
  super(o, s), h(this, "_sourceTrack", void 0), h(this, "_trackProcessor", void 0), h(this, "_onFrame", void 0), h(this, "_useCongestionControl", void 0), h(this, "_maxBitrate", void 0), h(this, "_useCbr", void 0), h(this, "_frameRate", void 0), this._sourceTrack = e, this._onFrame = t, this._useCongestionControl = n, this._maxBitrate = r, this._useCbr = i, this._frameRate = a, this._trackProcessor = new MediaStreamTrackProcessor({ track: e });
5103
5077
  }
@@ -5125,10 +5099,10 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5125
5099
  }, [n]);
5126
5100
  }
5127
5101
  requestFrame(e = !1) {
5128
- this._sendToWorker(Ur.FRAME, { keyFrame: e });
5102
+ this._sendToWorker(q.FRAME, { keyFrame: e });
5129
5103
  }
5130
5104
  setBitrate(e, t, n) {
5131
- this._sendToWorker(Ur.SET_BITRATE, {
5105
+ this._sendToWorker(q.SET_BITRATE, {
5132
5106
  bitrate: e,
5133
5107
  useCbr: t,
5134
5108
  fps: n
@@ -5143,11 +5117,11 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5143
5117
  static isBrowserSupported() {
5144
5118
  return "VideoEncoder" in window && "Worker" in window && "EncodedVideoChunk" in window && "MediaStreamTrackProcessor" in window;
5145
5119
  }
5146
- }, Di = 2100, Oi = 600, ki = 1.2, Ai = .8, ji = 2e3, Mi = 8e3, Ni = 8e3, Pi = 16e3, Fi = 4, Ii = 2e3, Li = /* @__PURE__ */ function(e) {
5120
+ }, Ci = 2100, wi = 600, Ti = 1.2, Ei = .8, Di = 2e3, Oi = 8e3, ki = 8e3, Ai = 16e3, ji = 4, Mi = 2e3, Ni = /* @__PURE__ */ function(e) {
5147
5121
  return e[e.NONE = 0] = "NONE", e[e.UP = 1] = "UP", e[e.DOWN = 2] = "DOWN", e;
5148
- }(Li || {}), Ri = class {
5122
+ }(Ni || {}), Pi = class {
5149
5123
  constructor(e, t, n, r, i, a, o, s = z) {
5150
- h(this, "_onCongestion", void 0), h(this, "_ccEnabled", void 0), h(this, "_fastSharing", void 0), h(this, "_trendDelayThreshold", void 0), h(this, "_highDelayThreshold", void 0), h(this, "_targetFps", void 0), h(this, "_minBitrate", void 0), h(this, "_maxBitrate", void 0), h(this, "_targetBitrate", void 0), h(this, "_lastDown", void 0), h(this, "_lastUp", void 0), h(this, "_lastProbing", void 0), h(this, "_lastCheckDelay", void 0), h(this, "_upPenalty", 0), h(this, "_probing", void 0), h(this, "_delayAvgShort", -1), h(this, "_delayAvgLong", -1), h(this, "_minDelay", Number.MAX_VALUE), h(this, "_maxDelay", 0), h(this, "_largeDelayDuration", 0), h(this, "_lastFpsCalcMs", void 0), h(this, "_frames", 0), h(this, "_fps", 0), h(this, "_debug", void 0), this._onCongestion = e, this._ccEnabled = r, this._debug = s, this._minBitrate = t, this._maxBitrate = n, this._fastSharing = i, this._targetFps = o, a > 0 ? this._highDelayThreshold = a : this._highDelayThreshold = Di, i && (this._highDelayThreshold = Oi), this._trendDelayThreshold = Math.round(this._highDelayThreshold / 3), this._targetBitrate = this._maxBitrate, this._probing = !1;
5124
+ h(this, "_onCongestion", void 0), h(this, "_ccEnabled", void 0), h(this, "_fastSharing", void 0), h(this, "_trendDelayThreshold", void 0), h(this, "_highDelayThreshold", void 0), h(this, "_targetFps", void 0), h(this, "_minBitrate", void 0), h(this, "_maxBitrate", void 0), h(this, "_targetBitrate", void 0), h(this, "_lastDown", void 0), h(this, "_lastUp", void 0), h(this, "_lastProbing", void 0), h(this, "_lastCheckDelay", void 0), h(this, "_upPenalty", 0), h(this, "_probing", void 0), h(this, "_delayAvgShort", -1), h(this, "_delayAvgLong", -1), h(this, "_minDelay", Number.MAX_VALUE), h(this, "_maxDelay", 0), h(this, "_largeDelayDuration", 0), h(this, "_lastFpsCalcMs", void 0), h(this, "_frames", 0), h(this, "_fps", 0), h(this, "_debug", void 0), this._onCongestion = e, this._ccEnabled = r, this._debug = s, this._minBitrate = t, this._maxBitrate = n, this._fastSharing = i, this._targetFps = o, a > 0 ? this._highDelayThreshold = a : this._highDelayThreshold = Ci, i && (this._highDelayThreshold = wi), this._trendDelayThreshold = Math.round(this._highDelayThreshold / 3), this._targetBitrate = this._maxBitrate, this._probing = !1;
5151
5125
  let c = Date.now();
5152
5126
  this._lastDown = 0, this._lastUp = c, this._lastProbing = c, this._lastCheckDelay = 0, this._lastFpsCalcMs = 0;
5153
5127
  }
@@ -5157,27 +5131,27 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5157
5131
  let i = 0, a = this._delayAvgShort - this._delayAvgLong, o = Math.round(Math.abs(a) * 100 / this._delayAvgLong), s = a > 40 && o > 30 && this._delayAvgShort > this._trendDelayThreshold, c = this._delayAvgShort > this._highDelayThreshold;
5158
5132
  s || c ? i = 2 : Math.abs(a) < 40 && o < 10 && !c && (i = 1);
5159
5133
  let l = Math.round(this._targetBitrate / 1e3), u = n;
5160
- e % 20 == 0 && this._debug.debug(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${Li[i]} tr=${l} br=${n}`);
5134
+ e % 20 == 0 && this._debug.debug(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${Ni[i]} tr=${l} br=${n}`);
5161
5135
  let d = r - this._lastDown;
5162
- if (i === 2 && d > ji) {
5163
- this._probing && (this._upPenalty = Math.min(++this._upPenalty, Fi), this._probing = !1);
5164
- let n = Ai * u * 1e3;
5165
- if (n >= this._targetBitrate && (n = this._targetBitrate * Ai), n = Math.max(n, this._minBitrate), n < this._targetBitrate) {
5166
- let r = Math.round(n / 1e3), s = Math.round(this._upPenalty * Ni / 1e3);
5167
- this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${Li[i]}`), this._debug.log(`#${e}: cc: DOWN delay=${t} bitrate=${u} target=${l} -> newBitrate=${r} penalty=${s}s`), this._setBitrate(n, !0), this._targetBitrate = n;
5136
+ if (i === 2 && d > Di) {
5137
+ this._probing && (this._upPenalty = Math.min(++this._upPenalty, ji), this._probing = !1);
5138
+ let n = Ei * u * 1e3;
5139
+ if (n >= this._targetBitrate && (n = this._targetBitrate * Ei), n = Math.max(n, this._minBitrate), n < this._targetBitrate) {
5140
+ let r = Math.round(n / 1e3), s = Math.round(this._upPenalty * ki / 1e3);
5141
+ this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${Ni[i]}`), this._debug.log(`#${e}: cc: DOWN delay=${t} bitrate=${u} target=${l} -> newBitrate=${r} penalty=${s}s`), this._setBitrate(n, !0), this._targetBitrate = n;
5168
5142
  }
5169
5143
  this._lastDown = r;
5170
5144
  }
5171
- let f = r - this._lastUp, p = Mi + this._upPenalty * Ni;
5145
+ let f = r - this._lastUp, p = Oi + this._upPenalty * ki;
5172
5146
  if (i === 1 && f > p && d > p) {
5173
- let n = Math.min(this._targetBitrate * ki, this._maxBitrate);
5147
+ let n = Math.min(this._targetBitrate * Ti, this._maxBitrate);
5174
5148
  if (n > this._targetBitrate) {
5175
- let s = Math.round(n / 1e3), c = Math.round(this._targetBitrate / 1e3), l = Math.round(this._upPenalty * Ni / 1e3);
5176
- this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${Li[i]}`), this._debug.log(`#${e}: cc: UP bitrate=${u} target=${c} -> newBitrate=${s} penalty=${l}s`), this._setBitrate(n, !1), this._targetBitrate = n, this._probing = !0, this._lastProbing = r, this._lastUp = r;
5149
+ let s = Math.round(n / 1e3), c = Math.round(this._targetBitrate / 1e3), l = Math.round(this._upPenalty * ki / 1e3);
5150
+ this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${Ni[i]}`), this._debug.log(`#${e}: cc: UP bitrate=${u} target=${c} -> newBitrate=${s} penalty=${l}s`), this._setBitrate(n, !1), this._targetBitrate = n, this._probing = !0, this._lastProbing = r, this._lastUp = r;
5177
5151
  }
5178
5152
  }
5179
5153
  let m = r - this._lastProbing;
5180
- this._probing && m > Pi && (this._probing = !1);
5154
+ this._probing && m > Ai && (this._probing = !1);
5181
5155
  let ee = r - this._lastDown;
5182
5156
  this._upPenalty > 0 && ee > 3 * p && (this._debug.log(`#${e}: cc: UP reset penalty: oldPenalty=${this._upPenalty}`), this._upPenalty = 0);
5183
5157
  }
@@ -5188,7 +5162,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5188
5162
  }
5189
5163
  _calcDelay(e, t) {
5190
5164
  if (!(e <= 0)) {
5191
- if (this._delayAvgShort === -1 && (this._delayAvgShort = e, this._delayAvgLong = e), this._delayAvgShort = Math.round((this._delayAvgShort * 3 + e) / 4), this._delayAvgLong = Math.round((this._delayAvgLong * 23 + e) / 24), e > 0 && e < this._minDelay ? this._minDelay = e : e > this._maxDelay && (this._maxDelay = e), this._lastCheckDelay === 0 && (this._lastCheckDelay = t), e > Ii) {
5165
+ if (this._delayAvgShort === -1 && (this._delayAvgShort = e, this._delayAvgLong = e), this._delayAvgShort = Math.round((this._delayAvgShort * 3 + e) / 4), this._delayAvgLong = Math.round((this._delayAvgLong * 23 + e) / 24), e > 0 && e < this._minDelay ? this._minDelay = e : e > this._maxDelay && (this._maxDelay = e), this._lastCheckDelay === 0 && (this._lastCheckDelay = t), e > Mi) {
5192
5166
  let e = t - this._lastCheckDelay;
5193
5167
  this._largeDelayDuration += e;
5194
5168
  }
@@ -5217,7 +5191,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5217
5191
  this._fps === 0 ? this._fps = Math.round(r) : this._fps = Math.round((this._fps * 3 + r) / 4), this._frames = 0, this._fps !== n && this._debug.log(`cc: fps=${this._fps}`);
5218
5192
  }
5219
5193
  }
5220
- }, zi = class {
5194
+ }, Fi = class {
5221
5195
  constructor(e) {
5222
5196
  h(this, "_maxSize", void 0), h(this, "_size", 0), h(this, "_buffer", void 0), h(this, "_head", 0), h(this, "_tail", 0), this._maxSize = e, this._buffer = Array(e);
5223
5197
  }
@@ -5291,11 +5265,11 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5291
5265
  clear() {
5292
5266
  this._buffer.fill(void 0), this._size = 0, this._head = 0, this._tail = 0;
5293
5267
  }
5294
- }, Bi = 65536, Vi = 50, Hi = 400, Ui = 1e6, Wi = 3e5, Gi = 3e4, Ki = 2e3, qi = 5, Ji = 0, Yi = class {
5268
+ }, Ii = 65536, Li = 50, Ri = 400, zi = 1e6, Bi = 3e5, Vi = 3e4, Hi = 2e3, Ui = 5, Wi = 0, Gi = class {
5295
5269
  constructor(e, t, n, r, i = z, a = null) {
5296
- h(this, "_encoder", void 0), h(this, "_datachannel", void 0), h(this, "_signaling", void 0), h(this, "_fastSharing", void 0), h(this, "_destroyed", !1), h(this, "_needKeyframe", !0), h(this, "DATA_SIZE", void 0), h(this, "_congestionControl", void 0), h(this, "_frameNum", 0), h(this, "_width", void 0), h(this, "_height", void 0), h(this, "_feedback", new zi(1024)), h(this, "_lastSentFrameSeq", 0), h(this, "_lastDeliveredFrameSeq", 0), h(this, "_lastFrameDelay", 0), h(this, "_lastFramerateReduced", Date.now()), h(this, "_lastSharingStat", Date.now()), h(this, "_congestionControlEnabled", void 0), h(this, "_queue", new Ci()), h(this, "_fpsMeter", void 0), h(this, "_maxFrameDelay", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), this._debug = i, this._logger = a, this._debug.debug("ScreenCaptureSender started"), this.DATA_SIZE = N.consumerScreenDataChannelPacketSize - 11, this._datachannel = t, this._signaling = n, this._fastSharing = r, this._congestionControlEnabled = N.screenShareCongestionControl || this._fastSharing, this._width = e.getSettings().width, this._height = e.getSettings().height, this._maxFrameDelay = this._fastSharing ? N.screenShareCongestionControlThreshold : N.screenShareCongestionControlThreshold * 2;
5270
+ h(this, "_encoder", void 0), h(this, "_datachannel", void 0), h(this, "_signaling", void 0), h(this, "_fastSharing", void 0), h(this, "_destroyed", !1), h(this, "_needKeyframe", !0), h(this, "DATA_SIZE", void 0), h(this, "_congestionControl", void 0), h(this, "_frameNum", 0), h(this, "_width", void 0), h(this, "_height", void 0), h(this, "_feedback", new Fi(1024)), h(this, "_lastSentFrameSeq", 0), h(this, "_lastDeliveredFrameSeq", 0), h(this, "_lastFrameDelay", 0), h(this, "_lastFramerateReduced", Date.now()), h(this, "_lastSharingStat", Date.now()), h(this, "_congestionControlEnabled", void 0), h(this, "_queue", new yi()), h(this, "_fpsMeter", void 0), h(this, "_maxFrameDelay", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), this._debug = i, this._logger = a, this._debug.debug("ScreenCaptureSender started"), this.DATA_SIZE = N.consumerScreenDataChannelPacketSize - 11, this._datachannel = t, this._signaling = n, this._fastSharing = r, this._congestionControlEnabled = N.screenShareCongestionControl || this._fastSharing, this._width = e.getSettings().width, this._height = e.getSettings().height, this._maxFrameDelay = this._fastSharing ? N.screenShareCongestionControlThreshold : N.screenShareCongestionControlThreshold * 2;
5297
5271
  let o = N.getScreenFrameRate(this._fastSharing), { minBitrate: s, maxBitrate: c } = this._calcMinMaxBitrate(this._width, this._height), l = this._onCongestionCallback.bind(this);
5298
- this._debug.log(`ScreenCaptureSender: CongestionControl: enabled=${this._congestionControlEnabled} minBitrate=${Math.round(s / 1e3)}k maxBitrate=${Math.round(c / 1e3)}k delayThreshold=${N.screenShareCongestionControlThreshold}`), this._congestionControl = new Ri(l, s, c, this._congestionControlEnabled, this._fastSharing, N.screenShareCongestionControlThreshold, o, this._debug);
5272
+ this._debug.log(`ScreenCaptureSender: CongestionControl: enabled=${this._congestionControlEnabled} minBitrate=${Math.round(s / 1e3)}k maxBitrate=${Math.round(c / 1e3)}k delayThreshold=${N.screenShareCongestionControlThreshold}`), this._congestionControl = new Pi(l, s, c, this._congestionControlEnabled, this._fastSharing, N.screenShareCongestionControlThreshold, o, this._debug);
5299
5273
  let u = (e, t) => {
5300
5274
  if (this._destroyed) return;
5301
5275
  if (!e) {
@@ -5306,23 +5280,23 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5306
5280
  let n = this._sliceFrame(e);
5307
5281
  this._queue.merge(n), this._handleQueue(), this._sendSharingStat();
5308
5282
  };
5309
- if (Ei.isBrowserSupported()) {
5283
+ if (Si.isBrowserSupported()) {
5310
5284
  let t = this._fastSharing;
5311
- this._encoder = new Ei(e, u, this._congestionControlEnabled, c, t, o, this._debug, this._logger);
5312
- } else this._encoder = new Ti(e, u, this._congestionControlEnabled, c, this._debug, this._logger);
5285
+ this._encoder = new Si(e, u, this._congestionControlEnabled, c, t, o, this._debug, this._logger);
5286
+ } else this._encoder = new xi(e, u, this._congestionControlEnabled, c, this._debug, this._logger);
5313
5287
  this._datachannel.onmessage = (e) => {
5314
- fi(e.data) && (this._debug.debug(`[${this._datachannel.label}] Requested keyframe`), this._needKeyframe = !0);
5315
- let t = pi(e.data);
5288
+ ci(e.data) && (this._debug.debug(`[${this._datachannel.label}] Requested keyframe`), this._needKeyframe = !0);
5289
+ let t = li(e.data);
5316
5290
  t !== null && this._checkCcFeedback(t);
5317
- }, this._encoder.init().then(() => this._handleQueue()).catch((e) => this._debug.warn("ScreenCaptureSender init failed", e)), this._fpsMeter = new qr((e) => this._debug.log(`[ScreenCaptureSender] fps: ${e}`), 5e3);
5291
+ }, this._encoder.init().then(() => this._handleQueue()).catch((e) => this._debug.warn("ScreenCaptureSender init failed", e)), this._fpsMeter = new Ur((e) => this._debug.log(`[ScreenCaptureSender] fps: ${e}`), 5e3);
5318
5292
  }
5319
5293
  _handleQueue() {
5320
5294
  if (this._destroyed) return;
5321
5295
  let e = this._queue.shift();
5322
5296
  if (!e) {
5323
- if ((this._lastSentFrameSeq - this._lastDeliveredFrameSeq + Bi) % Bi > qi && this._lastFrameDelay > this._maxFrameDelay) {
5297
+ if ((this._lastSentFrameSeq - this._lastDeliveredFrameSeq + Ii) % Ii > Ui && this._lastFrameDelay > this._maxFrameDelay) {
5324
5298
  let e = Date.now();
5325
- e - this._lastFramerateReduced > Ki && (this._lastFramerateReduced = e, this._debug.debug(`[ScreenCaptureSender] reduce framerate: delay=${this._lastFrameDelay} maxDelay=${this._maxFrameDelay}`));
5299
+ e - this._lastFramerateReduced > Hi && (this._lastFramerateReduced = e, this._debug.debug(`[ScreenCaptureSender] reduce framerate: delay=${this._lastFrameDelay} maxDelay=${this._maxFrameDelay}`));
5326
5300
  } else this._requestFrame();
5327
5301
  return;
5328
5302
  }
@@ -5348,7 +5322,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5348
5322
  this._destroyed || (this._encoder.requestFrame(this._needKeyframe), this._needKeyframe = !1);
5349
5323
  }
5350
5324
  _sliceFrame(e) {
5351
- let t = e.type === "key", n = e.data.byteLength, r = new Ci();
5325
+ let t = e.type === "key", n = e.data.byteLength, r = new yi();
5352
5326
  for (let i = 0; i < n; i += this.DATA_SIZE) {
5353
5327
  let a = e.data.slice(i, i + this.DATA_SIZE), o = i === 0, s = n <= i + a.byteLength, c = this._wrapHeader(e.timestamp, o, s, t, a);
5354
5328
  r.push({
@@ -5364,11 +5338,11 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5364
5338
  return r;
5365
5339
  }
5366
5340
  _wrapHeader(e, t, n, r, i) {
5367
- let a = ui(e, t, n, r, Ji, this._encoder.isVP9(), i), o = {
5368
- sequence: Ji,
5341
+ let a = oi(e, t, n, r, Wi, this._encoder.isVP9(), i), o = {
5342
+ sequence: Wi,
5369
5343
  data: a
5370
5344
  };
5371
- return Ji = (Ji + 1) % Bi, o;
5345
+ return Wi = (Wi + 1) % Ii, o;
5372
5346
  }
5373
5347
  _stopPacket() {
5374
5348
  return this._wrapHeader(Date.now(), !1, !1, !1, null).data;
@@ -5385,7 +5359,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5385
5359
  this._queue.clear(), this._fpsMeter.destroy(), this._datachannel.onmessage = null, this._feedback.clear(), this._datachannel.readyState === "open" && this._datachannel.send(this._stopPacket()), this._destroyed = !0, this._encoder.destroy(), this._debug.debug("ScreenCaptureSender destroyed");
5386
5360
  }
5387
5361
  static isBrowserSupported() {
5388
- return Ei.isBrowserSupported() || Ti.isBrowserSupported();
5362
+ return Si.isBrowserSupported() || xi.isBrowserSupported();
5389
5363
  }
5390
5364
  _onCongestionCallback(e, t, n) {
5391
5365
  this._encoder.setBitrate(e, t, n);
@@ -5398,8 +5372,8 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5398
5372
  (e === void 0 || e < 640) && (e = 640), (t === void 0 || t < 360) && (t = 360);
5399
5373
  let n = e * t / 256;
5400
5374
  return {
5401
- minBitrate: Math.max(Wi, Math.min(Ui, Math.round(n * Vi))),
5402
- maxBitrate: Math.round(n * Hi)
5375
+ minBitrate: Math.max(Bi, Math.min(zi, Math.round(n * Li))),
5376
+ maxBitrate: Math.round(n * Ri)
5403
5377
  };
5404
5378
  }
5405
5379
  _checkCcFeedback(e) {
@@ -5413,19 +5387,19 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5413
5387
  }
5414
5388
  _sendSharingStat() {
5415
5389
  let e = Date.now();
5416
- if (e - this._lastSharingStat > Gi) {
5390
+ if (e - this._lastSharingStat > Vi) {
5417
5391
  let t = this._congestionControl.getStat();
5418
5392
  t !== null && (this._debug.debug(`cc: send stats: ${JSON.stringify(t)}`), this._signaling.reportSharingStat(t)), this._lastSharingStat = e;
5419
5393
  }
5420
5394
  }
5421
- }, Xi = 90, Zi = 4294967295, Qi = class e extends Cr {
5395
+ }, Ki = 90, qi = 4294967295, Ji = class e extends br {
5422
5396
  constructor(e, t, n, r = z, i = null, a = null, o = null) {
5423
- super(e, t), h(this, "_producerNotification", null), h(this, "_producerCommand", null), h(this, "_producerScreen", null), h(this, "_consumerScreen", null), h(this, "_asr", null), h(this, "_animojiDataChannel", null), h(this, "_animojiReceiver", null), h(this, "_animojiSender", null), h(this, "_isOpen", !1), h(this, "_observer", !1), h(this, "_reconnectionPrevented", !1), h(this, "_statInterval", null), h(this, "_settingsInterval", null), h(this, "_monitorRtpShareInterval", null), h(this, "_statBytes", {}), h(this, "_ssrcMap", {}), h(this, "_ssrcMapUpdated", !1), h(this, "_perfStatReporter", void 0), h(this, "_producerOfferIsProcessing", !1), h(this, "_producerNextOffer", null), h(this, "_producerNextSessionId", null), h(this, "_lastStat", null), h(this, "_serverSettings", void 0), h(this, "_prevConsumerSettings", {}), h(this, "_prevConsumerFastSharingSettings", {}), h(this, "_asrTrack", null), h(this, "_captureSender", null), h(this, "_captureReceiver", null), h(this, "_participantIdRegistry", null), h(this, "_disabledSenders", /* @__PURE__ */ new Set()), h(this, "_rtpReceiversByStreamId", {}), h(this, "_producerSessionId", ""), h(this, "_newAudioShareTrack", null), h(this, "_simulcastInfo", null), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_codecStatsAggregator", void 0), this._debug = r, this._logger = i, this._statAggregator = a, this._codecStatsAggregator = o, this.subscribe(this._signaling, W.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, qt.TRACK_REPLACED, this._onReplacedTrack.bind(this)), this.subscribe(this._mediaSource, qt.SOURCE_CHANGED, this._onSourcesChanged.bind(this)), this.subscribe(this._mediaSource, qt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._createPerfStatsReporter(), this._serverSettings = n, this._debug.debug("ServerTransport: Created");
5397
+ super(e, t), h(this, "_producerNotification", null), h(this, "_producerCommand", null), h(this, "_producerScreen", null), h(this, "_consumerScreen", null), h(this, "_asr", null), h(this, "_animojiDataChannel", null), h(this, "_animojiReceiver", null), h(this, "_animojiSender", null), h(this, "_isOpen", !1), h(this, "_observer", !1), h(this, "_reconnectionPrevented", !1), h(this, "_statInterval", null), h(this, "_settingsInterval", null), h(this, "_monitorRtpShareInterval", null), h(this, "_statBytes", {}), h(this, "_ssrcMap", {}), h(this, "_ssrcMapUpdated", !1), h(this, "_perfStatReporter", void 0), h(this, "_producerOfferIsProcessing", !1), h(this, "_producerNextOffer", null), h(this, "_producerNextSessionId", null), h(this, "_lastStat", null), h(this, "_serverSettings", void 0), h(this, "_prevConsumerSettings", {}), h(this, "_prevConsumerFastSharingSettings", {}), h(this, "_asrTrack", null), h(this, "_captureSender", null), h(this, "_captureReceiver", null), h(this, "_participantIdRegistry", null), h(this, "_disabledSenders", /* @__PURE__ */ new Set()), h(this, "_rtpReceiversByStreamId", {}), h(this, "_producerSessionId", ""), h(this, "_newAudioShareTrack", null), h(this, "_simulcastInfo", null), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_codecStatsAggregator", void 0), this._debug = r, this._logger = i, this._statAggregator = a, this._codecStatsAggregator = o, this.subscribe(this._signaling, dr.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, qt.TRACK_REPLACED, this._onReplacedTrack.bind(this)), this.subscribe(this._mediaSource, qt.SOURCE_CHANGED, this._onSourcesChanged.bind(this)), this.subscribe(this._mediaSource, qt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._createPerfStatsReporter(), this._serverSettings = n, this._debug.debug("ServerTransport: Created");
5424
5398
  }
5425
5399
  updateStatisticsInterval() {
5426
5400
  this._stopStatInterval();
5427
5401
  let e = this.getState();
5428
- e !== K.IDLE && e !== K.CLOSED && e !== K.FAILED && this._startStatInterval();
5402
+ e !== W.IDLE && e !== W.CLOSED && e !== W.FAILED && this._startStatInterval();
5429
5403
  }
5430
5404
  open(e = !1) {
5431
5405
  if (this._isOpen) {
@@ -5435,7 +5409,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5435
5409
  this._isOpen = !0, this._observer = e, this._openConnection();
5436
5410
  }
5437
5411
  close(e) {
5438
- this._isOpen && (this._isOpen = !1, this._closeConnection(), this.unsubscribe(), e ? (this._debug.error("ServerTransport: Closed", e), this._setState(K.FAILED)) : (this._debug.debug("ServerTransport: Closed"), this._setState(K.CLOSED)));
5412
+ this._isOpen && (this._isOpen = !1, this._closeConnection(), this.unsubscribe(), e ? (this._debug.error("ServerTransport: Closed", e), this._setState(W.FAILED)) : (this._debug.debug("ServerTransport: Closed"), this._setState(W.CLOSED)));
5439
5413
  }
5440
5414
  removeParticipant(e) {
5441
5415
  this._captureReceiver?.close(e);
@@ -5447,7 +5421,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5447
5421
  this._reconnectionPrevented = !1;
5448
5422
  }
5449
5423
  updateSettings(e) {
5450
- br(e, this._serverSettings) || (this._serverSettings = e, this._applyConsumerSettings());
5424
+ _r(e, this._serverSettings) || (this._serverSettings = e, this._applyConsumerSettings());
5451
5425
  }
5452
5426
  setAnimojiTransport(e, t) {
5453
5427
  if (N.vmoji && (this._animojiReceiver = e, this._animojiSender = t, this._participantIdRegistry && e.setParticipantIdRegistry(this._participantIdRegistry), this._animojiDataChannel)) {
@@ -5459,7 +5433,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5459
5433
  N.simulcast && await this._changeSimulcastInfo(!0, !1);
5460
5434
  }
5461
5435
  _createPerfStatsReporter() {
5462
- this._perfStatReporter?.destroy(), this._perfStatReporter = new ra(this, this._signaling, this._statAggregator, !1, this._debug);
5436
+ this._perfStatReporter?.destroy(), this._perfStatReporter = new $i(this, this._signaling, this._statAggregator, !1, this._debug);
5463
5437
  }
5464
5438
  _closeConnection() {
5465
5439
  this._stopStatInterval(), this._stopSettingsInterval(), this._stopMonitorRtpShareInterval(), this._removeAsrTrack(), this._removeCaptureSender(), this._removeCaptureReceiver(), this._simulcastInfo = null, this._pc && (this._rtpReceiversByStreamId = {}, this._disabledSenders.forEach((e) => e.track?.stop()), this._disabledSenders.clear(), this._pc.ontrack = null, this._pc.onconnectionstatechange = null, this._pc.onsignalingstatechange = null, this._participantIdRegistry = null, e._closeDataChannel(this._producerNotification), e._closeDataChannel(this._producerCommand), e._closeDataChannel(this._producerScreen), e._closeDataChannel(this._consumerScreen), e._closeDataChannel(this._asr), e._closeDataChannel(this._animojiDataChannel), this._pc.close(), this._pc = null, this._producerOfferIsProcessing = !1, this._producerNextOffer = null), this._triggerEvent(J.PEER_CONNECTION_CLOSED);
@@ -5488,17 +5462,17 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5488
5462
  }
5489
5463
  this._pc.ontrack = this._onAddTrack.bind(this, this._pc), this._pc.onconnectionstatechange = M.debounce((e) => {
5490
5464
  this._pc && this._onConnectionStateChange(this._pc, e);
5491
- }, 500), this._pc.onsignalingstatechange = this._onSignalingStateChange.bind(this, this._pc), this._participantIdRegistry = new Hr(this._debug), this._signaling.setParticipantIdRegistry(this._participantIdRegistry), this._createDataChannel(this._pc, hr.producerNotification, (e) => {
5465
+ }, 500), this._pc.onsignalingstatechange = this._onSignalingStateChange.bind(this, this._pc), this._participantIdRegistry = new zr(this._debug), this._signaling.setParticipantIdRegistry(this._participantIdRegistry), this._createDataChannel(this._pc, fr.producerNotification, (e) => {
5492
5466
  this._producerNotification = e, this._producerNotification.binaryType = "arraybuffer", this._signaling.setProducerNotificationDataChannel(e);
5493
- }), this._signaling.useCommandDataChannel(!0), this._createDataChannel(this._pc, hr.producerCommand, (e) => {
5467
+ }), this._signaling.useCommandDataChannel(!0), this._createDataChannel(this._pc, fr.producerCommand, (e) => {
5494
5468
  this._producerCommand = e, this._signaling.setProducerCommandDataChannel(e);
5495
- }), this._createDataChannel(this._pc, hr.producerScreenShare, (e) => {
5469
+ }), this._createDataChannel(this._pc, fr.producerScreenShare, (e) => {
5496
5470
  this._producerScreen = e, this._producerScreen.binaryType = "arraybuffer", this._createCaptureReceiver();
5497
- }), N.asrDataChannel && this._createDataChannel(this._pc, hr.asr, (e) => {
5498
- this._asr = e, this._asr.binaryType = "arraybuffer", this._removeAsrTrack(), this._asrTrack = new zr(e, this._participantIdRegistry, (e) => {
5471
+ }), N.asrDataChannel && this._createDataChannel(this._pc, fr.asr, (e) => {
5472
+ this._asr = e, this._asr.binaryType = "arraybuffer", this._removeAsrTrack(), this._asrTrack = new Ir(e, this._participantIdRegistry, (e) => {
5499
5473
  this._onAsrTranscription(e);
5500
5474
  }, this._debug);
5501
- }), N.vmoji && this._createDataChannel(this._pc, hr.animoji, (e) => {
5475
+ }), N.vmoji && this._createDataChannel(this._pc, fr.animoji, (e) => {
5502
5476
  this._animojiDataChannel = e, this._animojiDataChannel.binaryType = "arraybuffer", this._animojiReceiver?.setDataChannel(e), this._animojiReceiver?.setParticipantIdRegistry(this._participantIdRegistry), this._animojiSender?.setDataChannel(e), this._animojiSender?.setProtocolVersion(N.vmojiOptions.protocolVersion || 1);
5503
5477
  }), this._newAudioShareTrack = this._mediaSource.getAudioShareTrack();
5504
5478
  try {
@@ -5507,17 +5481,17 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5507
5481
  this._debug.error("ServerTransport: Unable to add media source tracks", e), this._logger?.log(E.ERROR, "addTrack-single"), this.close(e);
5508
5482
  return;
5509
5483
  }
5510
- this._createDataChannel(this._pc, hr.consumerScreenShare, (e) => {
5484
+ this._createDataChannel(this._pc, fr.consumerScreenShare, (e) => {
5511
5485
  this._consumerScreen = e, this._consumerScreen.binaryType = "arraybuffer";
5512
5486
  let t = this._mediaSource.getScreenTrack();
5513
5487
  t && (!N.consumerFastScreenShare || !this._mediaSource.getMediaSettings().isFastScreenSharingEnabled) && this._createCaptureSender(t);
5514
- }), e || this._allocateConsumer(), this._setState(K.OPENED), this._startStatInterval(), this._startSettingsInterval(), this._startMonitorRtpShareInterval();
5488
+ }), e || this._allocateConsumer(), this._setState(W.OPENED), this._startStatInterval(), this._startSettingsInterval(), this._startMonitorRtpShareInterval();
5515
5489
  }
5516
5490
  _removeAsrTrack() {
5517
5491
  this._asrTrack?.destroy(), this._asrTrack = null;
5518
5492
  }
5519
5493
  _reconnect() {
5520
- this.getState() !== K.OPENED && (this._setState(K.RECONNECTING), this._closeConnection(), this._openConnection(!0));
5494
+ this.getState() !== W.OPENED && (this._setState(W.RECONNECTING), this._closeConnection(), this._openConnection(!0));
5521
5495
  }
5522
5496
  _signalActiveParticipants(e) {
5523
5497
  this._triggerEvent(J.SIGNALLED_ACTIVE_PARTICIPANTS, e);
@@ -5533,19 +5507,19 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5533
5507
  }
5534
5508
  _updateSSRCMap(e) {
5535
5509
  e && e.sdp.split("\n").forEach((e) => {
5536
- let t = `a=ssrc:([0-9]+) label:(audio|video)-((?:[ug]?[\\d]+)|(?:mix)|(?:${Lr.PARTICIPANT_AGNOSTIC_TRACK_PREFIX}-[0-9]+)|(?:${Lr.TRANSPARENT_AUDIO_TRACK_PREFIX}-[0-9]+))`, n = new RegExp(t).exec(e);
5510
+ let t = `a=ssrc:([0-9]+) label:(audio|video)-((?:[ug]?[\\d]+)|(?:mix)|(?:${Pr.PARTICIPANT_AGNOSTIC_TRACK_PREFIX}-[0-9]+)|(?:${Pr.TRANSPARENT_AUDIO_TRACK_PREFIX}-[0-9]+))`, n = new RegExp(t).exec(e);
5537
5511
  n && (this._ssrcMap[n[1]] = n[3], this._ssrcMapUpdated = !0);
5538
5512
  });
5539
5513
  }
5540
5514
  _createCaptureSender(e) {
5541
5515
  let t = this._mediaSource.getMediaSettings();
5542
- !e || !this._consumerScreen || !t.isScreenSharingEnabled || (this._captureSender && this._removeCaptureSender(), this._captureSender = new Yi(e, this._consumerScreen, this._signaling, t.isFastScreenSharingEnabled, this._debug, this._logger));
5516
+ !e || !this._consumerScreen || !t.isScreenSharingEnabled || (this._captureSender && this._removeCaptureSender(), this._captureSender = new Gi(e, this._consumerScreen, this._signaling, t.isFastScreenSharingEnabled, this._debug, this._logger));
5543
5517
  }
5544
5518
  _removeCaptureSender() {
5545
5519
  this._captureSender?.destroy(), this._captureSender = null;
5546
5520
  }
5547
5521
  _createCaptureReceiver() {
5548
- this._producerScreen && (this._captureReceiver && this._removeCaptureReceiver(), this._captureReceiver = new xi(this._producerScreen, this._participantIdRegistry, (e, t) => {
5522
+ this._producerScreen && (this._captureReceiver && this._removeCaptureReceiver(), this._captureReceiver = new _i(this._producerScreen, this._participantIdRegistry, (e, t) => {
5549
5523
  this._triggerEvent(J.REMOTE_STREAM_SECOND, e, t);
5550
5524
  }, (e) => {
5551
5525
  this._triggerEvent(J.REMOTE_STREAM_SECOND, e, null);
@@ -5636,17 +5610,17 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5636
5610
  _reportStats(e) {
5637
5611
  this._triggerEvent(J.REMOTE_DATA_STATS, {
5638
5612
  inbound: {
5639
- topology: q.SERVER,
5613
+ topology: K.SERVER,
5640
5614
  transport: e.transport,
5641
5615
  rtps: e.rtps.filter((e) => e.type === "inbound-rtp")
5642
5616
  },
5643
5617
  outbound: {
5644
- topology: q.SERVER,
5618
+ topology: K.SERVER,
5645
5619
  transport: e.transport,
5646
5620
  rtps: e.rtps.filter((e) => e.type === "outbound-rtp")
5647
5621
  },
5648
5622
  remoteInbound: {
5649
- topology: q.SERVER,
5623
+ topology: K.SERVER,
5650
5624
  transport: e.transport,
5651
5625
  rtps: e.remoteRtps ?? []
5652
5626
  }
@@ -5655,7 +5629,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5655
5629
  _detectStaleTracks(e) {
5656
5630
  let t = e.rtps.find((e) => e.type === "inbound-rtp" && e.kind === "audio" && this._ssrcMap[e.ssrc] === "mix");
5657
5631
  if (!t) return;
5658
- let n = Lr.AUDIO_MIX, r = this._statBytes[n], i = !1;
5632
+ let n = Pr.AUDIO_MIX, r = this._statBytes[n], i = !1;
5659
5633
  if (r) {
5660
5634
  let e = t.bytesReceived - r.bytesReceived;
5661
5635
  e >= 0 && e <= 5 && (i = !0), r.stalled !== i && this._triggerEvent(J.AUDIO_MIX_STALL, i);
@@ -5668,7 +5642,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5668
5642
  _allocateConsumer() {
5669
5643
  if (!this._signaling.ready) return;
5670
5644
  let e = {
5671
- estimatedPerformanceIndex: ra.getEstimatedPerformanceIndex(),
5645
+ estimatedPerformanceIndex: $i.getEstimatedPerformanceIndex(),
5672
5646
  audioMix: !0,
5673
5647
  consumerUpdate: !0,
5674
5648
  producerNotificationDataChannelVersion: 8,
@@ -5852,13 +5826,13 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5852
5826
  break;
5853
5827
  case "connecting":
5854
5828
  let t = this.getState();
5855
- t === K.IDLE || t === K.OPENED ? this._setState(K.CONNECTING) : e.iceConnectionState === "checking" && this._setState(K.RECONNECTING);
5829
+ t === W.IDLE || t === W.OPENED ? this._setState(W.CONNECTING) : e.iceConnectionState === "checking" && this._setState(W.RECONNECTING);
5856
5830
  break;
5857
5831
  case "disconnected":
5858
- this._reconnectionPrevented ? this.close(/* @__PURE__ */ Error("Ice connection disconnected")) : this._setState(K.RECONNECTING);
5832
+ this._reconnectionPrevented ? this.close(/* @__PURE__ */ Error("Ice connection disconnected")) : this._setState(W.RECONNECTING);
5859
5833
  break;
5860
5834
  case "connected":
5861
- this._setState(K.CONNECTED), M.getPeerConnectionHostInfo(e).then((e) => {
5835
+ this._setState(W.CONNECTED), M.getPeerConnectionHostInfo(e).then((e) => {
5862
5836
  e?.local && (this._logger?.log(E.ICE_CONNECTION_TYPE, e.local.type), this._debug.debug("Selected ICE candidates", e));
5863
5837
  });
5864
5838
  break;
@@ -5894,7 +5868,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5894
5868
  if (!r || !r.length) return this._debug.log(`Cannot get stream waiting time, ${e} receiver has no synchronization sources`), 0;
5895
5869
  let i = r[0].rtpTimestamp;
5896
5870
  if (!Number.isInteger(i)) return this._logger?.log(E.PAT_WAITING_TIME_ERROR, "timestampNotInteger"), this._debug.error(`Cannot get stream waiting time, ${e} receiver's RTP timestamp is not an integer: ${i}`), 0;
5897
- let a = t - i & Zi, o = Math.ceil(a / Xi);
5871
+ let a = t - i & qi, o = Math.ceil(a / Ki);
5898
5872
  return Math.min(100, Math.max(0, o));
5899
5873
  }
5900
5874
  async _changeSimulcastInfo(e, t) {
@@ -5923,7 +5897,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5923
5897
  }
5924
5898
  }
5925
5899
  async _monitorRtpShare() {
5926
- let e = Vr.getInstance().value;
5900
+ let e = Rr.getInstance().value;
5927
5901
  if (!this._mediaSource.getMediaSettings().isFastScreenSharingEnabled || !N.consumerFastScreenShare || e < .6) return;
5928
5902
  let t = this._pc?.getSenders().find((e) => e.track?.kind === A.video && e.track?.contentHint === "motion");
5929
5903
  t && (await t.getStats()).forEach((e) => {
@@ -5954,9 +5928,9 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5954
5928
  }
5955
5929
  }, J = /* @__PURE__ */ function(e) {
5956
5930
  return e.REMOTE_TRACK_ADDED = "REMOTE_TRACK_ADDED", e.REMOTE_TRACK_REMOVED = "REMOTE_TRACK_REMOVED", e.REMOTE_STREAM_SECOND = "REMOTE_STREAM_SECOND", e.AUDIO_MIX_STALL = "AUDIO_MIX_STALL", e.REMOTE_DATA_STATS = "REMOTE_DATA_STATS", e.STATE_CHANGED = "STATE_CHANGED", e.LOCAL_STATE_CHANGED = "LOCAL_STATE_CHANGED", e.SIGNALLED_ACTIVE_PARTICIPANTS = "SIGNALLED_ACTIVE_PARTICIPANTS", e.SIGNALLED_SPEAKER_CHANGED = "SIGNALLED_SPEAKER_CHANGED", e.SIGNALLED_STALLED_PARTICIPANTS = "SIGNALLED_STALLED_PARTICIPANTS", e.TOPOLOGY_CHANGED = "TOPOLOGY_CHANGED", e.NETWORK_STATUS = "NETWORK_STATUS", e.PEER_CONNECTION_CLOSED = "PEER_CONNECTION_CLOSED", e.ASR_TRANSCRIPTION = "ASR_TRANSCRIPTION", e.ANIMOJI_STREAM = "ANIMOJI_STREAM", e.ANIMOJI_ERROR = "ANIMOJI_ERROR", e.SCREEN_SHARING_STAT = "SCREEN_SHARING_STAT", e;
5957
- }({}), $i = class extends g {
5931
+ }({}), Yi = class extends g {
5958
5932
  constructor(e, t, n, r, i = z, a = null, o = null, s = null) {
5959
- super(), h(this, "_signaling", void 0), h(this, "_mediaSource", void 0), h(this, "_topology", void 0), h(this, "_allocated", []), h(this, "_opened", []), h(this, "_directTransport", null), h(this, "_serverTransport", null), h(this, "_serverSettings", void 0), h(this, "_dtListeners", []), h(this, "_stListeners", []), h(this, "_states", {}), h(this, "_localState", K.IDLE), h(this, "_animojiReceiver", null), h(this, "_animojiSender", null), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_codecStatsAggregator", void 0), this._signaling = t, this._mediaSource = n, this._topology = e, this._serverSettings = r, this._debug = i, this._logger = a, this._statAggregator = o, this._codecStatsAggregator = s, this.subscribe(this._signaling, W.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, qt.ANIMOJI_STATUS, this._onAnimojiStatus.bind(this)), this.subscribe(this._mediaSource, qt.SOURCE_CHANGED, this._onSourceChanged.bind(this)), this._createAnimojiTransport(), e === q.SERVER && (this._serverTransport = this._createServerTransport());
5933
+ super(), h(this, "_signaling", void 0), h(this, "_mediaSource", void 0), h(this, "_topology", void 0), h(this, "_allocated", []), h(this, "_opened", []), h(this, "_directTransport", null), h(this, "_serverTransport", null), h(this, "_serverSettings", void 0), h(this, "_dtListeners", []), h(this, "_stListeners", []), h(this, "_states", {}), h(this, "_localState", W.IDLE), h(this, "_animojiReceiver", null), h(this, "_animojiSender", null), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_codecStatsAggregator", void 0), this._signaling = t, this._mediaSource = n, this._topology = e, this._serverSettings = r, this._debug = i, this._logger = a, this._statAggregator = o, this._codecStatsAggregator = s, this.subscribe(this._signaling, dr.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, qt.ANIMOJI_STATUS, this._onAnimojiStatus.bind(this)), this.subscribe(this._mediaSource, qt.SOURCE_CHANGED, this._onSourceChanged.bind(this)), this._createAnimojiTransport(), e === K.SERVER && (this._serverTransport = this._createServerTransport());
5960
5934
  }
5961
5935
  updateSettings(e) {
5962
5936
  this._debug.log("Update transport settings", e), this._serverSettings = e, this._directTransport && this._directTransport.updateSettings(e), this._serverTransport && this._serverTransport.updateSettings(e);
@@ -5969,7 +5943,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5969
5943
  this._debug.warn(`The participant [${e}] has already had allocated transport`);
5970
5944
  return;
5971
5945
  }
5972
- this._allocated.push(e), this._topology === q.DIRECT && !this._directTransport && (this._directTransport = this._createDirectTransport(e, t)), this._topology === q.SERVER && !this._serverTransport && (this._serverTransport = this._createServerTransport());
5946
+ this._allocated.push(e), this._topology === K.DIRECT && !this._directTransport && (this._directTransport = this._createDirectTransport(e, t)), this._topology === K.SERVER && !this._serverTransport && (this._serverTransport = this._createServerTransport());
5973
5947
  }
5974
5948
  open(e, t = null, n = !1, r = !1) {
5975
5949
  this._debug.log("Trying open participant", { participantIds: e });
@@ -5985,11 +5959,11 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
5985
5959
  }
5986
5960
  this._opened.push(t), i = !0;
5987
5961
  }
5988
- i && (this._topology === q.DIRECT && this._directTransport && this._directTransport.open(t), this._topology === q.SERVER && this._serverTransport && (this._serverTransport.open(n), this._setStates(e, this._serverTransport.getState()), this._setLocalState(this._serverTransport.getState())), this._debug.debug("The transport has been opened", e));
5962
+ i && (this._topology === K.DIRECT && this._directTransport && this._directTransport.open(t), this._topology === K.SERVER && this._serverTransport && (this._serverTransport.open(n), this._setStates(e, this._serverTransport.getState()), this._setLocalState(this._serverTransport.getState())), this._debug.debug("The transport has been opened", e));
5989
5963
  }
5990
5964
  close(e) {
5991
5965
  let t = this._allocated.indexOf(e), n = this._opened.indexOf(e);
5992
- t < 0 && this._debug.warn(`The participant [${e}] transport has already deallocated`), this._topology === q.DIRECT && this._directTransport && n >= 0 && this._releaseDirectTransport(), this._topology === q.SERVER && (this._serverTransport?.removeParticipant(e), this._setStates([e], K.CLOSED)), n >= 0 && this._opened.splice(n, 1), t >= 0 && this._allocated.splice(t, 1), delete this._states[e];
5966
+ t < 0 && this._debug.warn(`The participant [${e}] transport has already deallocated`), this._topology === K.DIRECT && this._directTransport && n >= 0 && this._releaseDirectTransport(), this._topology === K.SERVER && (this._serverTransport?.removeParticipant(e), this._setStates([e], W.CLOSED)), n >= 0 && this._opened.splice(n, 1), t >= 0 && this._allocated.splice(t, 1), delete this._states[e];
5993
5967
  }
5994
5968
  destroy() {
5995
5969
  this.unsubscribe();
@@ -6010,7 +5984,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
6010
5984
  return this._opened.slice();
6011
5985
  }
6012
5986
  getState() {
6013
- return this._topology === q.SERVER ? this._serverTransport?.getState() : this._directTransport?.getState();
5987
+ return this._topology === K.SERVER ? this._serverTransport?.getState() : this._directTransport?.getState();
6014
5988
  }
6015
5989
  getStates() {
6016
5990
  return this._states;
@@ -6022,7 +5996,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
6022
5996
  this._animojiSender?.setFill(e);
6023
5997
  }
6024
5998
  async onCameraResolutionChanged() {
6025
- this._topology === q.SERVER && this._serverTransport && await this._serverTransport.onCameraResolutionChanged();
5999
+ this._topology === K.SERVER && this._serverTransport && await this._serverTransport.onCameraResolutionChanged();
6026
6000
  }
6027
6001
  _setStates(e, t) {
6028
6002
  let n = e.filter((e) => this._states[e] === t ? !1 : (this._states[e] = t, !0));
@@ -6036,7 +6010,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
6036
6010
  }
6037
6011
  _onTopologyChanged(e) {
6038
6012
  if (e.topology !== this._topology) {
6039
- if (this._debug.log(`Topology changed ${this._topology} -> ${e.topology}`), this._logger?.log(E.TOPOLOGY_CHANGE_REQUESTED, e.topology), this._topology = e.topology, this._topology === q.SERVER && (this._serverTransport ? this._serverTransport.allowRestart() : (this._serverTransport = this._createServerTransport(), this._opened.length > 0 && (this._directTransport?.preventRestart(), this._serverTransport.open()))), this._topology === q.DIRECT) {
6013
+ if (this._debug.log(`Topology changed ${this._topology} -> ${e.topology}`), this._logger?.log(E.TOPOLOGY_CHANGE_REQUESTED, e.topology), this._topology = e.topology, this._topology === K.SERVER && (this._serverTransport ? this._serverTransport.allowRestart() : (this._serverTransport = this._createServerTransport(), this._opened.length > 0 && (this._directTransport?.preventRestart(), this._serverTransport.open()))), this._topology === K.DIRECT) {
6040
6014
  let t = e.offerTo || [], n = e.offerToTypes || [], r = e.offerToDeviceIdxs || [], i = t.length && n.length ? M.composeParticipantId(t[0], n[0], r[0]) : null;
6041
6015
  if (this._serverTransport && this._serverTransport.preventRestart(), !this._allocated || this._allocated.length === 0) {
6042
6016
  this._debug.error("Topology changed to DIRECT, but the list of allocated participants is empty");
@@ -6055,12 +6029,12 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
6055
6029
  }
6056
6030
  }
6057
6031
  _createDirectTransport(e, t = !1) {
6058
- let n = new Ir(e, t, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._logger, this._statAggregator, this._codecStatsAggregator);
6059
- return this._dtListeners.length > 0 && this._debug.warn(`The list of direct listeners for the participant [${e}] is not empty`), this._dtListeners = [], this._dtListeners.push(n.addEventListener("REMOTE_TRACK_ADDED", this._onRemoteTrackAdded.bind(this, e)), n.addEventListener("REMOTE_TRACK_REMOVED", this._onRemoteTrackRemoved.bind(this, e)), n.addEventListener("REMOTE_DATA_STATS", this._onRemoteDataStats.bind(this)), n.addEventListener("STATE_CHANGED", this._onDirectTransportChanged.bind(this)), n.addEventListener("NETWORK_STATUS", this._onTransportNetworkStatus.bind(this)), n.addEventListener("PEER_CONNECTION_CLOSED", this._onPeerConnectionClosed.bind(this, q.DIRECT))), this._animojiReceiver && this._animojiSender && n.setAnimojiTransport(this._animojiReceiver, this._animojiSender), n;
6032
+ let n = new Nr(e, t, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._logger, this._statAggregator, this._codecStatsAggregator);
6033
+ return this._dtListeners.length > 0 && this._debug.warn(`The list of direct listeners for the participant [${e}] is not empty`), this._dtListeners = [], this._dtListeners.push(n.addEventListener("REMOTE_TRACK_ADDED", this._onRemoteTrackAdded.bind(this, e)), n.addEventListener("REMOTE_TRACK_REMOVED", this._onRemoteTrackRemoved.bind(this, e)), n.addEventListener("REMOTE_DATA_STATS", this._onRemoteDataStats.bind(this)), n.addEventListener("STATE_CHANGED", this._onDirectTransportChanged.bind(this)), n.addEventListener("NETWORK_STATUS", this._onTransportNetworkStatus.bind(this)), n.addEventListener("PEER_CONNECTION_CLOSED", this._onPeerConnectionClosed.bind(this, K.DIRECT))), this._animojiReceiver && this._animojiSender && n.setAnimojiTransport(this._animojiReceiver, this._animojiSender), n;
6060
6034
  }
6061
6035
  _createServerTransport() {
6062
- let e = new Qi(this._signaling, this._mediaSource, this._serverSettings, this._debug, this._logger, this._statAggregator, this._codecStatsAggregator);
6063
- return this._stListeners.length > 0 && this._debug.warn("The list of server transport listeners is not empty"), this._stListeners = [], this._stListeners.push(e.addEventListener("REMOTE_TRACK_ADDED", this._onRemoteTrackAdded.bind(this)), e.addEventListener("REMOTE_TRACK_REMOVED", this._onRemoteTrackRemoved.bind(this)), e.addEventListener("AUDIO_MIX_STALL", this._onServerAudioMixStall.bind(this)), e.addEventListener("REMOTE_DATA_STATS", this._onRemoteDataStats.bind(this)), e.addEventListener("STATE_CHANGED", this._onServerTransportChanged.bind(this)), e.addEventListener("SIGNALLED_ACTIVE_PARTICIPANTS", this._onTransportActiveParticipants.bind(this)), e.addEventListener("SIGNALLED_SPEAKER_CHANGED", this._onTransportSpeakerChanged.bind(this)), e.addEventListener("SIGNALLED_STALLED_PARTICIPANTS", this._onTransportStalledParticipants.bind(this)), e.addEventListener("NETWORK_STATUS", this._onTransportNetworkStatus.bind(this)), e.addEventListener("REMOTE_STREAM_SECOND", this._onRemoteStreamSecond.bind(this)), e.addEventListener("PEER_CONNECTION_CLOSED", this._onPeerConnectionClosed.bind(this, q.SERVER)), e.addEventListener("ASR_TRANSCRIPTION", this._onAsrTranscription.bind(this))), this._animojiReceiver && this._animojiSender && e.setAnimojiTransport(this._animojiReceiver, this._animojiSender), e;
6036
+ let e = new Ji(this._signaling, this._mediaSource, this._serverSettings, this._debug, this._logger, this._statAggregator, this._codecStatsAggregator);
6037
+ return this._stListeners.length > 0 && this._debug.warn("The list of server transport listeners is not empty"), this._stListeners = [], this._stListeners.push(e.addEventListener("REMOTE_TRACK_ADDED", this._onRemoteTrackAdded.bind(this)), e.addEventListener("REMOTE_TRACK_REMOVED", this._onRemoteTrackRemoved.bind(this)), e.addEventListener("AUDIO_MIX_STALL", this._onServerAudioMixStall.bind(this)), e.addEventListener("REMOTE_DATA_STATS", this._onRemoteDataStats.bind(this)), e.addEventListener("STATE_CHANGED", this._onServerTransportChanged.bind(this)), e.addEventListener("SIGNALLED_ACTIVE_PARTICIPANTS", this._onTransportActiveParticipants.bind(this)), e.addEventListener("SIGNALLED_SPEAKER_CHANGED", this._onTransportSpeakerChanged.bind(this)), e.addEventListener("SIGNALLED_STALLED_PARTICIPANTS", this._onTransportStalledParticipants.bind(this)), e.addEventListener("NETWORK_STATUS", this._onTransportNetworkStatus.bind(this)), e.addEventListener("REMOTE_STREAM_SECOND", this._onRemoteStreamSecond.bind(this)), e.addEventListener("PEER_CONNECTION_CLOSED", this._onPeerConnectionClosed.bind(this, K.SERVER)), e.addEventListener("ASR_TRANSCRIPTION", this._onAsrTranscription.bind(this))), this._animojiReceiver && this._animojiSender && e.setAnimojiTransport(this._animojiReceiver, this._animojiSender), e;
6064
6038
  }
6065
6039
  _releaseDirectTransport() {
6066
6040
  this._directTransport?.close(), this._directTransport = null;
@@ -6074,26 +6048,26 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
6074
6048
  }
6075
6049
  _onDirectTransportChanged(e) {
6076
6050
  let t = this._directTransport?.participantId;
6077
- if (e === K.CONNECTED && this._topology === q.DIRECT && this._releaseServerTransport(), (e === K.CLOSED || e === K.FAILED) && (this._releaseDirectTransport(), this._topology === q.DIRECT)) {
6051
+ if (e === W.CONNECTED && this._topology === K.DIRECT && this._releaseServerTransport(), (e === W.CLOSED || e === W.FAILED) && (this._releaseDirectTransport(), this._topology === K.DIRECT)) {
6078
6052
  let e = this._opened.indexOf(t);
6079
6053
  e >= 0 && this._opened.splice(e, 1);
6080
6054
  let n = this._allocated.indexOf(t);
6081
6055
  n >= 0 && this._allocated.splice(n, 1);
6082
6056
  }
6083
- this._topology === q.DIRECT && t && (this._setStates([t], e), this._setLocalState(e));
6057
+ this._topology === K.DIRECT && t && (this._setStates([t], e), this._setLocalState(e));
6084
6058
  }
6085
6059
  _onServerTransportChanged(e) {
6086
6060
  let t = this._opened.slice();
6087
- e === K.CONNECTED && this._topology === q.SERVER && this._releaseDirectTransport(), (e === K.CLOSED || e === K.FAILED) && (this._releaseServerTransport(), this._topology === q.SERVER && (this._allocated = [], this._opened = [])), this._topology === q.SERVER && (this._setStates(t, e), this._setLocalState(e));
6061
+ e === W.CONNECTED && this._topology === K.SERVER && this._releaseDirectTransport(), (e === W.CLOSED || e === W.FAILED) && (this._releaseServerTransport(), this._topology === K.SERVER && (this._allocated = [], this._opened = [])), this._topology === K.SERVER && (this._setStates(t, e), this._setLocalState(e));
6088
6062
  }
6089
6063
  _onTransportActiveParticipants(e) {
6090
- this._topology === q.SERVER && this._triggerEvent("SIGNALLED_ACTIVE_PARTICIPANTS", e);
6064
+ this._topology === K.SERVER && this._triggerEvent("SIGNALLED_ACTIVE_PARTICIPANTS", e);
6091
6065
  }
6092
6066
  _onTransportStalledParticipants(e) {
6093
- this._topology === q.SERVER && this._triggerEvent("SIGNALLED_STALLED_PARTICIPANTS", e);
6067
+ this._topology === K.SERVER && this._triggerEvent("SIGNALLED_STALLED_PARTICIPANTS", e);
6094
6068
  }
6095
6069
  _onTransportSpeakerChanged(e) {
6096
- this._topology === q.SERVER && this._triggerEvent("SIGNALLED_SPEAKER_CHANGED", e);
6070
+ this._topology === K.SERVER && this._triggerEvent("SIGNALLED_SPEAKER_CHANGED", e);
6097
6071
  }
6098
6072
  _onTransportNetworkStatus(e) {
6099
6073
  this._triggerEvent("NETWORK_STATUS", e);
@@ -6105,7 +6079,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
6105
6079
  this._triggerEvent("PEER_CONNECTION_CLOSED", e);
6106
6080
  }
6107
6081
  _onServerAudioMixStall(e) {
6108
- this._topology === q.SERVER && this._triggerEvent("AUDIO_MIX_STALL", e);
6082
+ this._topology === K.SERVER && this._triggerEvent("AUDIO_MIX_STALL", e);
6109
6083
  }
6110
6084
  _onRemoteDataStats(e) {
6111
6085
  this._triggerEvent("REMOTE_DATA_STATS", e);
@@ -6144,14 +6118,14 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
6144
6118
  this._animojiSender?.destroy(), this._animojiSender = null, this._animojiReceiver?.destroy(), this._animojiReceiver = null;
6145
6119
  }
6146
6120
  getStreamWaitingTimeMs(e, t) {
6147
- return this._topology === q.SERVER ? this._serverTransport ? this._serverTransport.getStreamWaitingTimeMs(e, t) : (this._logger?.log(E.PAT_WAITING_TIME_ERROR, "noTransport"), this._debug.error("Cannot get stream waiting time, server transport is not initialized"), 0) : (this._logger?.log(E.PAT_WAITING_TIME_ERROR, "wrongTopology"), this._debug.error(`Cannot get stream waiting time, incorrect topology: ${this._topology}`), 0);
6121
+ return this._topology === K.SERVER ? this._serverTransport ? this._serverTransport.getStreamWaitingTimeMs(e, t) : (this._logger?.log(E.PAT_WAITING_TIME_ERROR, "noTransport"), this._debug.error("Cannot get stream waiting time, server transport is not initialized"), 0) : (this._logger?.log(E.PAT_WAITING_TIME_ERROR, "wrongTopology"), this._debug.error(`Cannot get stream waiting time, incorrect topology: ${this._topology}`), 0);
6148
6122
  }
6149
- }, ea = "videochat-epi", ta = 5e3, na = 500, ra = class extends g {
6123
+ }, Xi = "videochat-epi", Zi = 5e3, Qi = 500, $i = class extends g {
6150
6124
  constructor(e, t, n = null, r = !1, i = z) {
6151
6125
  super(), h(this, "_previousPerfStatReportTimestamp", 0), h(this, "_previousNetworkStatReportTimestamp", Date.now()), h(this, "_previousCallStatReportTimestamp", Date.now()), h(this, "_previousCallStatReport", null), h(this, "_screenShareStats", []), h(this, "_signaling", void 0), h(this, "_directTopology", void 0), h(this, "_debug", void 0), h(this, "_statAggregator", void 0), h(this, "_handleScreenSharingStat", (e) => {
6152
6126
  this._screenShareStats.push(e);
6153
6127
  }), h(this, "_handleTransportStateChanged", (e) => {
6154
- (this._directTopology && e === K.CONNECTED || !this._directTopology && e === K.OPENED) && (this._previousNetworkStatReportTimestamp = Date.now(), this._previousCallStatReportTimestamp = Date.now());
6128
+ (this._directTopology && e === W.CONNECTED || !this._directTopology && e === W.OPENED) && (this._previousNetworkStatReportTimestamp = Date.now(), this._previousCallStatReportTimestamp = Date.now());
6155
6129
  }), this._signaling = t, this._directTopology = r, this._debug = i, this._statAggregator = n, this.subscribe(e, J.REMOTE_DATA_STATS, this._handleStats.bind(this)), this.subscribe(e, J.SCREEN_SHARING_STAT, this._handleScreenSharingStat.bind(this)), this.subscribe(e, J.STATE_CHANGED, this._handleTransportStateChanged.bind(this));
6156
6130
  }
6157
6131
  destroy() {
@@ -6159,7 +6133,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
6159
6133
  }
6160
6134
  static getEstimatedPerformanceIndex() {
6161
6135
  try {
6162
- let e = parseInt(localStorage.getItem(ea) || "", 10);
6136
+ let e = parseInt(localStorage.getItem(Xi) || "", 10);
6163
6137
  return isNaN(e) ? 0 : e;
6164
6138
  } catch {
6165
6139
  return 0;
@@ -6168,9 +6142,9 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
6168
6142
  async _handleStats(e) {
6169
6143
  if (!e.inbound || !e.inbound.rtps) return;
6170
6144
  let t = Date.now();
6171
- !this._directTopology && N.perfStatReportEnabled && this._previousPerfStatReportTimestamp + ta <= t && (await this.reportPerfStats(e), this._previousPerfStatReportTimestamp = t);
6145
+ !this._directTopology && N.perfStatReportEnabled && this._previousPerfStatReportTimestamp + Zi <= t && (await this.reportPerfStats(e), this._previousPerfStatReportTimestamp = t);
6172
6146
  let n = e.outbound.transport.local?.protocol === "tcp";
6173
- !this._directTopology && n && this._previousNetworkStatReportTimestamp + na <= t && (await this.reportNetworkStats(e), this._previousNetworkStatReportTimestamp = t), N.callStatReportEnabled && this._previousCallStatReportTimestamp + N.statisticsInterval <= t && (this._reportCallStats(e), this._previousCallStatReportTimestamp = t);
6147
+ !this._directTopology && n && this._previousNetworkStatReportTimestamp + Qi <= t && (await this.reportNetworkStats(e), this._previousNetworkStatReportTimestamp = t), N.callStatReportEnabled && this._previousCallStatReportTimestamp + N.statisticsInterval <= t && (this._reportCallStats(e), this._previousCallStatReportTimestamp = t);
6174
6148
  }
6175
6149
  async reportPerfStats(e) {
6176
6150
  let t = e.inbound.rtps.reduce((e, t) => (t.kind === "video" && (e.framesDecoded += t.framesDecoded || 0, e.framesReceived += t.framesReceived || 0), e), {
@@ -6179,7 +6153,7 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
6179
6153
  });
6180
6154
  if (t.framesDecoded) try {
6181
6155
  let e = await this._signaling.reportPerfStat(t);
6182
- localStorage.setItem(ea, e.estimatedPerformanceIndex);
6156
+ localStorage.setItem(Xi, e.estimatedPerformanceIndex);
6183
6157
  } catch {}
6184
6158
  }
6185
6159
  async reportNetworkStats(e) {
@@ -6223,11 +6197,11 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
6223
6197
  rtt: Math.round(e.inbound.transport.currentRoundTripTime * 1e3),
6224
6198
  ss_freeze_count: 0,
6225
6199
  ss_total_freezes_duration: 0,
6226
- local_address: aa(e.inbound.transport.local),
6200
+ local_address: ta(e.inbound.transport.local),
6227
6201
  local_connection_type: e.inbound.transport.local?.type,
6228
6202
  network_type: e.inbound.transport.local?.networkType,
6229
6203
  transport: e.inbound.transport.local?.protocol,
6230
- remote_address: aa(e.inbound.transport.remote),
6204
+ remote_address: ta(e.inbound.transport.remote),
6231
6205
  remote_connection_type: e.inbound.transport.remote?.type
6232
6206
  };
6233
6207
  this._previousCallStatReport || (this._previousCallStatReport = Object.assign({}, t));
@@ -6248,35 +6222,35 @@ var hi = 2 ** 15 - 1, gi = 1, _i = 5, vi = 5, yi = class e {
6248
6222
  frames_dropped: Math.max(0, t.frames_dropped - this._previousCallStatReport.frames_dropped),
6249
6223
  rtt: Math.max(0, t.rtt)
6250
6224
  };
6251
- if (N.simulcast && (i.is_simulcast = !0), navigator.hardwareConcurrency && (i.cpu_hardware_concurrency = navigator.hardwareConcurrency), n && !oa(t.jitter_video) && (i.jitter_video = Math.round(t.jitter_video)), r && !oa(t.jitter_audio) && (i.jitter_audio = Math.round(t.jitter_audio)), n && !oa(t.interframe_delay_variance) && (i.interframe_delay_variance = t.interframe_delay_variance), t.freeze_count && t.total_freezes_duration && (i.freeze_count = t.freeze_count, i.total_freezes_duration = Math.round(t.total_freezes_duration * 1e3)), t.ss_freeze_count && t.ss_total_freezes_duration && (i.ss_freeze_count = t.ss_freeze_count, i.ss_total_freezes_duration = t.ss_total_freezes_duration), r && !oa(t.total_audio_samples_received)) {
6225
+ if (N.simulcast && (i.is_simulcast = !0), navigator.hardwareConcurrency && (i.cpu_hardware_concurrency = navigator.hardwareConcurrency), n && !na(t.jitter_video) && (i.jitter_video = Math.round(t.jitter_video)), r && !na(t.jitter_audio) && (i.jitter_audio = Math.round(t.jitter_audio)), n && !na(t.interframe_delay_variance) && (i.interframe_delay_variance = t.interframe_delay_variance), t.freeze_count && t.total_freezes_duration && (i.freeze_count = t.freeze_count, i.total_freezes_duration = Math.round(t.total_freezes_duration * 1e3)), t.ss_freeze_count && t.ss_total_freezes_duration && (i.ss_freeze_count = t.ss_freeze_count, i.ss_total_freezes_duration = t.ss_total_freezes_duration), r && !na(t.total_audio_samples_received)) {
6252
6226
  let e = Math.max(0, t.total_audio_samples_received - this._previousCallStatReport.total_audio_samples_received), n = Math.max(0, t.inserted_audio_samples_for_deceleration - this._previousCallStatReport.inserted_audio_samples_for_deceleration), r = Math.max(0, t.removed_audio_samples_for_acceleration - this._previousCallStatReport.removed_audio_samples_for_acceleration), a = Math.max(0, t.concealed_audio_samples - this._previousCallStatReport.concealed_audio_samples), o = Math.max(0, t.silent_concealed_audio_samples - this._previousCallStatReport.silent_concealed_audio_samples), s = Math.max(0, t.audio_concealment_events - this._previousCallStatReport.audio_concealment_events);
6253
- i.inserted_audio_samples_for_deceleration = sa(n / e * 1e3), i.removed_audio_samples_for_acceleration = sa(r / e * 1e3), i.concealed_audio_samples = sa(a / e * 1e3), i.concealed_silent_audio_samples = sa(o / e * 1e3), i.concealment_audio_avg_size = sa(a / s), i.total_audio_energy = t.total_audio_energy;
6227
+ i.inserted_audio_samples_for_deceleration = ra(n / e * 1e3), i.removed_audio_samples_for_acceleration = ra(r / e * 1e3), i.concealed_audio_samples = ra(a / e * 1e3), i.concealed_silent_audio_samples = ra(o / e * 1e3), i.concealment_audio_avg_size = ra(a / s), i.total_audio_energy = t.total_audio_energy;
6254
6228
  }
6255
- ia(t, "local_address", "local_connection_type", "network_type", "transport") && (i.local_address = t.local_address, i.local_connection_type = t.local_connection_type, i.network_type = t.network_type, i.transport = t.transport), ia(t, "remote_address", "remote_connection_type") && (i.remote_address = t.remote_address, i.remote_connection_type = t.remote_connection_type);
6229
+ ea(t, "local_address", "local_connection_type", "network_type", "transport") && (i.local_address = t.local_address, i.local_connection_type = t.local_connection_type, i.network_type = t.network_type, i.transport = t.transport), ea(t, "remote_address", "remote_connection_type") && (i.remote_address = t.remote_address, i.remote_connection_type = t.remote_connection_type);
6256
6230
  let a = Math.max(0, t.packets_sent_video - this._previousCallStatReport.packets_sent_video), o = Math.max(0, t.packets_sent_audio - this._previousCallStatReport.packets_sent_audio);
6257
- a > 0 && (i.video_loss = sa(Math.max(0, t.packets_lost_video - this._previousCallStatReport.packets_lost_video) / a * 100)), o > 0 && (i.audio_loss = sa(Math.max(0, t.packets_lost_audio - this._previousCallStatReport.packets_lost_audio) / o * 100)), this._statAggregator?.logCallStat(i), N.enableLogPerfStatReport && this._debug.log("Sent call stats", i), this._previousCallStatReport = t;
6231
+ a > 0 && (i.video_loss = ra(Math.max(0, t.packets_lost_video - this._previousCallStatReport.packets_lost_video) / a * 100)), o > 0 && (i.audio_loss = ra(Math.max(0, t.packets_lost_audio - this._previousCallStatReport.packets_lost_audio) / o * 100)), this._statAggregator?.logCallStat(i), N.enableLogPerfStatReport && this._debug.log("Sent call stats", i), this._previousCallStatReport = t;
6258
6232
  }
6259
6233
  };
6260
- function ia(e, ...t) {
6234
+ function ea(e, ...t) {
6261
6235
  for (let n of t) if (!Object.hasOwn(e, n) || e[n] === void 0) return !1;
6262
6236
  return !0;
6263
6237
  }
6264
- function aa(e, t = !1) {
6238
+ function ta(e, t = !1) {
6265
6239
  if (e?.address) return e.address + (t ? `:${e.port}` : "");
6266
6240
  }
6267
- function oa(e) {
6241
+ function na(e) {
6268
6242
  return e === void 0;
6269
6243
  }
6270
- function sa(e) {
6244
+ function ra(e) {
6271
6245
  return Number.isNaN(e) ? 0 : e;
6272
6246
  }
6273
6247
  //#endregion
6274
6248
  //#region src/static/Capabilities.ts
6275
- var ca;
6249
+ var ia;
6276
6250
  (function(e) {
6277
6251
  function t() {
6278
6252
  return {
6279
- estimatedPerformanceIndex: ra.getEstimatedPerformanceIndex(),
6253
+ estimatedPerformanceIndex: $i.getEstimatedPerformanceIndex(),
6280
6254
  audioMix: !0,
6281
6255
  consumerUpdate: !0,
6282
6256
  producerNotificationDataChannelVersion: 8,
@@ -6301,8 +6275,39 @@ var ca;
6301
6275
  };
6302
6276
  }
6303
6277
  e.get = t;
6304
- })(ca || (ca = {}));
6305
- var la = ca, ua = {
6278
+ })(ia || (ia = {}));
6279
+ var aa = ia, oa = /* @__PURE__ */ function(e) {
6280
+ return e.START = "start", e.ACCEPT = "accept", e.JOIN = "join", e.RETRY = "retry", e;
6281
+ }(oa || {}), sa = /* @__PURE__ */ function(e) {
6282
+ return e.WEBSOCKET = "ws", e.WEBTRANSPORT = "wt", e;
6283
+ }({}), ca = /* @__PURE__ */ function(e) {
6284
+ return e.CONNECTED = "connected", e.RECONNECTED = "reconnected", e.FAILED_PINGS = "failed_pings", e.FAILED_EXCEPTIONS = "failed_exception", e.TIMEOUT = "timeout", e.RESTART = "restart", e;
6285
+ }({}), la = {
6286
+ connected: {
6287
+ wt: V.WEBTRANSPORT_CONNECTED,
6288
+ ws: V.WEBSOCKET_CONNECTED
6289
+ },
6290
+ reconnected: {
6291
+ wt: V.WEBTRANSPORT_RECONNECTED,
6292
+ ws: V.WEBSOCKET_RECONNECTED
6293
+ },
6294
+ failed_pings: {
6295
+ wt: V.WEBTRANSPORT_FAILED_PINGS,
6296
+ ws: V.WEBSOCKET_FAILED_PINGS
6297
+ },
6298
+ failed_exception: {
6299
+ wt: V.WEBTRANSPORT_FAILED_EXCEPTION,
6300
+ ws: V.WEBSOCKET_FAILED_EXCEPTION
6301
+ },
6302
+ timeout: {
6303
+ wt: V.WEBTRANSPORT_TIMEOUT,
6304
+ ws: V.WEBSOCKET_TIMEOUT
6305
+ },
6306
+ restart: {
6307
+ wt: V.WEBTRANSPORT_RESTART,
6308
+ ws: V.WEBSOCKET_RESTART
6309
+ }
6310
+ }, ua = {
6306
6311
  producerScreenTrack: () => !0,
6307
6312
  videoTracksCount: () => N.videoTracksCount > 0,
6308
6313
  waitingHall: () => !0,
@@ -6317,7 +6322,7 @@ var la = ca, ua = {
6317
6322
  useChatRooms: () => N.useChatRooms,
6318
6323
  audienceModeHandUpTimestamps: () => !1,
6319
6324
  animojiBackendRender: () => !N.vmojiOptions.renderingOptions.useFullClientRendering,
6320
- sessionStateUpdates: () => !1,
6325
+ sessionStateUpdates: () => N.enableSessionStateUpdates,
6321
6326
  addParticipant: () => N.addParticipant,
6322
6327
  p2pRelay: () => !1,
6323
6328
  waitForAdmin: () => N.waitForAdminInGroupCalls,
@@ -6554,7 +6559,7 @@ var la = ca, ua = {
6554
6559
  return e.EMPTY_ENDPOINT = "EMPTY_ENDPOINT", e.NETWORK_ERROR = "NETWORK_ERROR", e.ABORTED = "ABORTED", e;
6555
6560
  }({}), Sa = class {
6556
6561
  constructor(e) {
6557
- h(this, "handlers", void 0), h(this, "socket", null), h(this, "endpoint", ""), h(this, "wtEndpoint", null), h(this, "peerId", null), h(this, "lastStamp", 0), h(this, "connectionType", void 0), h(this, "reconnectCount", 0), h(this, "reconnectTimer", 0), h(this, "doctorTimer", 0), h(this, "forceWebSocket", !1), h(this, "abortSignal", void 0), h(this, "manualClose", !1), h(this, "currentType", fr.WEBSOCKET), this.handlers = e;
6562
+ h(this, "handlers", void 0), h(this, "socket", null), h(this, "endpoint", ""), h(this, "wtEndpoint", null), h(this, "peerId", null), h(this, "lastStamp", 0), h(this, "connectionType", void 0), h(this, "reconnectCount", 0), h(this, "reconnectTimer", 0), h(this, "doctorTimer", 0), h(this, "forceWebSocket", !1), h(this, "abortSignal", void 0), h(this, "manualClose", !1), h(this, "currentType", sa.WEBSOCKET), this.handlers = e;
6558
6563
  }
6559
6564
  get readyState() {
6560
6565
  return this.socket?.readyState ?? null;
@@ -6581,7 +6586,7 @@ var la = ca, ua = {
6581
6586
  this.reconnectCount = 0;
6582
6587
  }
6583
6588
  connect(e) {
6584
- this.socket && this.socket.readyState < WebSocket.CLOSING || (e !== dr.RETRY && (this.forceWebSocket = !1, this.reconnectCount = 0), this.manualClose = !1, this.connectionType = e, this._connect());
6589
+ this.socket && this.socket.readyState < WebSocket.CLOSING || (e !== oa.RETRY && (this.forceWebSocket = !1, this.reconnectCount = 0), this.manualClose = !1, this.connectionType = e, this._connect());
6585
6590
  }
6586
6591
  close(e) {
6587
6592
  this.manualClose = !0, this._disconnect(e), window.clearTimeout(this.reconnectTimer), this.reconnectTimer = 0, this.lastStamp = 0;
@@ -6602,7 +6607,7 @@ var la = ca, ua = {
6602
6607
  return;
6603
6608
  }
6604
6609
  let e = this._buildUrl(this.wtEndpoint, !0);
6605
- this.currentType = fr.WEBTRANSPORT, this.socket = new ba(e, { congestionControl: "low-latency" }), this._setSocketHandlers();
6610
+ this.currentType = sa.WEBTRANSPORT, this.socket = new ba(e, { congestionControl: "low-latency" }), this._setSocketHandlers();
6606
6611
  }
6607
6612
  _connectWebSocket() {
6608
6613
  if (!this.endpoint) {
@@ -6614,14 +6619,14 @@ var la = ca, ua = {
6614
6619
  return;
6615
6620
  }
6616
6621
  let e = this._buildUrl(this.endpoint, !1);
6617
- this.currentType = fr.WEBSOCKET, this.socket = new WebSocket(e), this._setSocketHandlers();
6622
+ this.currentType = sa.WEBSOCKET, this.socket = new WebSocket(e), this._setSocketHandlers();
6618
6623
  }
6619
6624
  _setSocketHandlers() {
6620
6625
  this.socket && (this.socket.onopen = this._onOpen.bind(this), this.socket.onmessage = this._onMessage.bind(this), this.socket.onerror = this._onError.bind(this), this.socket.onclose = this._onClose.bind(this), this._startDoctor());
6621
6626
  }
6622
6627
  _buildUrl(e, t) {
6623
6628
  let n = new URL(e), r = n.searchParams;
6624
- return r.set("platform", N.platform), r.set("appVersion", String(N.appVersion)), r.set("version", String(N.protocolVersion)), r.set("device", N.device), r.set("capabilities", da.getFlags()), r.set("clientType", N.clientType), this.connectionType && r.set("tgt", this.connectionType), this.connectionType === dr.RETRY && this.lastStamp && r.set("recoverTs", String(this.lastStamp)), N.useParticipantListChunk && (r.set("partIdx", String(N.participantListChunkInitIndex)), N.participantListChunkInitCount !== null && r.set("partCount", String(N.participantListChunkInitCount))), t && (r.set("compression", "deflate-raw"), r.set("ua", navigator.userAgent)), this.peerId !== null && r.set("peerId", String(this.peerId)), n.toString();
6629
+ return r.set("platform", N.platform), r.set("appVersion", String(N.appVersion)), r.set("version", String(N.protocolVersion)), r.set("device", N.device), r.set("capabilities", da.getFlags()), r.set("clientType", N.clientType), this.connectionType && r.set("tgt", this.connectionType), this.connectionType === oa.RETRY && this.lastStamp && r.set("recoverTs", String(this.lastStamp)), N.useParticipantListChunk && (r.set("partIdx", String(N.participantListChunkInitIndex)), N.participantListChunkInitCount !== null && r.set("partCount", String(N.participantListChunkInitCount))), t && (r.set("compression", "deflate-raw"), r.set("ua", navigator.userAgent)), this.peerId !== null && r.set("peerId", String(this.peerId)), n.toString();
6625
6630
  }
6626
6631
  _canUseWebTransport() {
6627
6632
  return !this.forceWebSocket && ba.isBrowserSupported() && this.wtEndpoint !== null && N.webtransport;
@@ -6662,7 +6667,7 @@ var la = ca, ua = {
6662
6667
  count: this.reconnectCount,
6663
6668
  delay: e
6664
6669
  }), this.reconnectTimer = window.setTimeout(() => {
6665
- this.connectionType = dr.RETRY, this._connect();
6670
+ this.connectionType = oa.RETRY, this._connect();
6666
6671
  }, e);
6667
6672
  }
6668
6673
  _getReconnectDelay() {
@@ -6786,7 +6791,7 @@ var la = ca, ua = {
6786
6791
  return t && (n.participantId = t), this._sendRaw(y.CHANGE_PARTICIPANT_STATE, n);
6787
6792
  }
6788
6793
  async hold(e) {
6789
- let t = la.get();
6794
+ let t = aa.get();
6790
6795
  return this._send(y.HOLD, {
6791
6796
  hold: e,
6792
6797
  capabilities: e ? void 0 : t
@@ -7046,11 +7051,11 @@ var la = ca, ua = {
7046
7051
  return this.producerCommandDataChannelEnabled ? e === y.UPDATE_DISPLAY_LAYOUT || e === y.REPORT_PERF_STAT || e === y.REPORT_SHARING_STAT || e === y.REQUEST_ASR || e === y.ENABLE_VIDEO_SUSPEND || e === y.ENABLE_VIDEO_SUSPEND_SUGGEST || e === y.REPORT_NETWORK_STAT || e === y.CHANGE_SIMULCAST : !1;
7047
7052
  }
7048
7053
  _onOpen() {
7049
- this._debug.debug("[signaling] socket opened"), this._logger?.log(E.SOCKET_ACTION, "opened"), this._waitConnectionMessage(), this._logTransportStat(this.connectionType === dr.RETRY ? pr.RECONNECTED : pr.CONNECTED);
7054
+ this._debug.debug("[signaling] socket opened"), this._logger?.log(E.SOCKET_ACTION, "opened"), this._waitConnectionMessage(), this._logTransportStat(this.connectionType === oa.RETRY ? ca.RECONNECTED : ca.CONNECTED);
7050
7055
  }
7051
7056
  _onMessage(e) {
7052
7057
  if (e.data === "ping") {
7053
- this._statPings?.mark(this._getSocketType()), this._markTransportStat(pr.FAILED_PINGS), R.onSignalingMessage(e.data), this.transport.readyState === WebSocket.OPEN && this.transport.send("pong");
7058
+ this._statPings?.mark(this._getSocketType()), this._markTransportStat(ca.FAILED_PINGS), R.onSignalingMessage(e.data), this.transport.readyState === WebSocket.OPEN && this.transport.send("pong");
7054
7059
  return;
7055
7060
  }
7056
7061
  try {
@@ -7063,13 +7068,13 @@ var la = ca, ua = {
7063
7068
  _handleMessage(e) {
7064
7069
  switch (e.type) {
7065
7070
  case "notification":
7066
- e.notification === "connection" ? (this._debug.debug("[signaling] signaling connected", e), this.connected = !0, this.transport.resetReconnectCount(), this.transport.setEndpoint(e.endpoint), e.peerId && this.peerId !== e.peerId.id && (this.peerId = e.peerId.id, this.transport.setPeerId(e.peerId.id)), this._stopWaitConnectionMessage(), this.conversationResolve ? this.conversationResolve(e) : (this._logTransportStat(pr.RESTART), this._triggerEvent(W.RECONNECT, e), e.conversation.topology && this._triggerEvent(W.NOTIFICATION, {
7071
+ e.notification === "connection" ? (this._debug.debug("[signaling] signaling connected", e), this.connected = !0, this.transport.resetReconnectCount(), this.transport.setEndpoint(e.endpoint), e.peerId && this.peerId !== e.peerId.id && (this.peerId = e.peerId.id, this.transport.setPeerId(e.peerId.id)), this._stopWaitConnectionMessage(), this.conversationResolve ? this.conversationResolve(e) : (this._logTransportStat(ca.RESTART), this._triggerEvent(dr.RECONNECT, e), e.conversation.topology && this._triggerEvent(dr.NOTIFICATION, {
7067
7072
  type: "notification",
7068
7073
  notification: G.TOPOLOGY_CHANGED,
7069
7074
  topology: e.conversation.topology
7070
7075
  })), this.lastStamp && this._handleCachedMessages(), e.recoverMessages?.forEach((e) => {
7071
7076
  e.notification === G.ACCEPTED_CALL && e.peerId.id === this.peerId && e.peerId.type === "WEB_TRANSPORT" || this._handleMessage(e);
7072
- }), this._handleCommandsQueue(this.websocketCommandsQueue)) : !this.connected || !this.listenersReady ? this.incomingCache.push(e) : this._triggerEvent(W.NOTIFICATION, e);
7077
+ }), this._handleCommandsQueue(this.websocketCommandsQueue)) : !this.connected || !this.listenersReady ? this.incomingCache.push(e) : this._triggerEvent(dr.NOTIFICATION, e);
7073
7078
  break;
7074
7079
  case "response":
7075
7080
  this._handleCommandResponse(!0, e);
@@ -7090,7 +7095,7 @@ var la = ca, ua = {
7090
7095
  message: `Conversation ended: ${e.error}`,
7091
7096
  remote: !0
7092
7097
  });
7093
- this.conversationReject ? this.conversationReject(n) : this._triggerEvent(W.NOTIFICATION, {
7098
+ this.conversationReject ? this.conversationReject(n) : this._triggerEvent(dr.NOTIFICATION, {
7094
7099
  notification: G.CLOSED_CONVERSATION,
7095
7100
  reason: _.SERVICE_UNAVAILABLE
7096
7101
  });
@@ -7099,7 +7104,7 @@ var la = ca, ua = {
7099
7104
  this.conversationReject ? this.conversationReject(new v(e.reason || w.SIGNALING_FAILED, {
7100
7105
  message: `Conversation ended: ${e.error}`,
7101
7106
  remote: !0
7102
- })) : this._triggerEvent(W.NOTIFICATION, {
7107
+ })) : this._triggerEvent(dr.NOTIFICATION, {
7103
7108
  notification: G.CLOSED_CONVERSATION,
7104
7109
  reason: e.reason
7105
7110
  });
@@ -7129,10 +7134,10 @@ var la = ca, ua = {
7129
7134
  }
7130
7135
  }
7131
7136
  _throwError(e) {
7132
- this._triggerEvent(W.FAILED, e);
7137
+ this._triggerEvent(dr.FAILED, e);
7133
7138
  }
7134
7139
  _onError(e) {
7135
- this._logger?.log(E.SOCKET_ACTION, "error"), this._debug.error("[signaling] signaling error", e), this._logTransportStat(pr.FAILED_EXCEPTIONS, { string_value: this._serializeErrorEvent(e) });
7140
+ this._logger?.log(E.SOCKET_ACTION, "error"), this._debug.error("[signaling] signaling error", e), this._logTransportStat(ca.FAILED_EXCEPTIONS, { string_value: this._serializeErrorEvent(e) });
7136
7141
  }
7137
7142
  _serializeErrorEvent(e) {
7138
7143
  let t = e, n = t.error instanceof Error ? t.error : null;
@@ -7254,20 +7259,20 @@ var la = ca, ua = {
7254
7259
  }
7255
7260
  }
7256
7261
  _onTransportReconnectScheduled(e) {
7257
- this.connectionType = dr.RETRY, this._debug.log(`[signaling] reconnect websocket after ${e.delay}ms (${e.count})`), this._logger?.log(E.SOCKET_ACTION, "reconnect");
7262
+ this.connectionType = oa.RETRY, this._debug.log(`[signaling] reconnect websocket after ${e.delay}ms (${e.count})`), this._logger?.log(E.SOCKET_ACTION, "reconnect");
7258
7263
  }
7259
7264
  _onTransportConnectionDead() {
7260
- this._debug.warn("[signaling] socket is dead, trying to reconnect"), this._logTransportStat(pr.FAILED_PINGS);
7265
+ this._debug.warn("[signaling] socket is dead, trying to reconnect"), this._logTransportStat(ca.FAILED_PINGS);
7261
7266
  }
7262
7267
  _getSocketType() {
7263
7268
  return this.transport.type;
7264
7269
  }
7265
7270
  _markTransportStat(e) {
7266
- let t = this._getSocketType(), n = mr[e][t];
7271
+ let t = this._getSocketType(), n = la[e][t];
7267
7272
  U.setMark(n);
7268
7273
  }
7269
7274
  _logTransportStat(e, t) {
7270
- let n = this._getSocketType(), r = mr[e][n];
7275
+ let n = this._getSocketType(), r = la[e][n];
7271
7276
  this._statAggregator?.logEventualStat({
7272
7277
  name: r,
7273
7278
  ...t
@@ -7322,8 +7327,52 @@ function Ra(e, t) {
7322
7327
  return !0;
7323
7328
  }
7324
7329
  //#endregion
7325
- //#region src/types/ExternalId.ts
7326
- var za = /* @__PURE__ */ function(e) {
7330
+ //#region src/static/ParticipantConnectionStatusUtils.ts
7331
+ var za;
7332
+ (function(e) {
7333
+ function t(e) {
7334
+ let t = e?.transport ?? e?.lastEffective ?? P.WAITING, n = {
7335
+ transport: t,
7336
+ sessionState: e?.sessionState,
7337
+ sessionStateApplicable: e?.sessionStateApplicable ?? !1,
7338
+ sessionStateConnectedBySpeaker: e?.sessionStateConnectedBySpeaker ?? !1,
7339
+ lastEffective: e?.lastEffective ?? t
7340
+ };
7341
+ return n.lastEffective = r(n), n;
7342
+ }
7343
+ e.create = t;
7344
+ function n(e) {
7345
+ return e === W.CONNECTED ? P.CONNECTED : e === W.CONNECTING || e === W.OPENED ? P.CONNECTING : e === W.RECONNECTING ? P.RECONNECT : null;
7346
+ }
7347
+ e.fromTransportState = n;
7348
+ function r(e) {
7349
+ return e.transport === P.HANGUP || e.transport === P.ERROR ? e.transport : e.sessionStateApplicable && e.sessionState?.connected === !1 ? e.transport === P.RECONNECT ? P.RECONNECT : e.sessionStateConnectedBySpeaker && e.transport === P.CONNECTED ? P.CONNECTED : P.CONNECTING : e.transport;
7350
+ }
7351
+ e.computeEffective = r;
7352
+ function i(e, t, n = !1) {
7353
+ return e.sessionState = t, e.sessionStateConnectedBySpeaker = t?.connected === !1 && n, s(e);
7354
+ }
7355
+ e.setSessionState = i;
7356
+ function a(e, t) {
7357
+ return e.transport = t, t !== P.CONNECTED && (e.sessionStateConnectedBySpeaker = !1), s(e);
7358
+ }
7359
+ e.setTransport = a;
7360
+ function o(e, t) {
7361
+ return e.sessionStateApplicable = t, t || (e.sessionStateConnectedBySpeaker = !1), s(e);
7362
+ }
7363
+ e.setSessionStateApplicable = o;
7364
+ function s(e) {
7365
+ let t = r(e);
7366
+ return e.lastEffective === t ? {
7367
+ status: t,
7368
+ shouldNotify: !1
7369
+ } : (e.lastEffective = t, {
7370
+ status: t,
7371
+ shouldNotify: !0
7372
+ });
7373
+ }
7374
+ })(za || (za = {}));
7375
+ var Ba = za, Va = /* @__PURE__ */ function(e) {
7327
7376
  return e.USER = "USER", e.ANONYM = "ANONYM", e.GROUP = "GROUP", e;
7328
7377
  }({}), Z;
7329
7378
  (function(e) {
@@ -7384,7 +7433,7 @@ var za = /* @__PURE__ */ function(e) {
7384
7433
  })(Z || (Z = {}));
7385
7434
  //#endregion
7386
7435
  //#region src/types/WaitingHall.ts
7387
- function Ba(e) {
7436
+ function Ha(e) {
7388
7437
  try {
7389
7438
  return btoa(JSON.stringify(e));
7390
7439
  } catch (t) {
@@ -7392,7 +7441,7 @@ function Ba(e) {
7392
7441
  }
7393
7442
  return null;
7394
7443
  }
7395
- function Va(e) {
7444
+ function Ua(e) {
7396
7445
  try {
7397
7446
  return JSON.parse(atob(e));
7398
7447
  } catch (t) {
@@ -7402,12 +7451,12 @@ function Va(e) {
7402
7451
  }
7403
7452
  //#endregion
7404
7453
  //#region src/utils/Conversation.ts
7405
- var Ha = (e, t) => M.objectReduce(e, (e, n, r) => (n === t && e.push(r), e), []);
7406
- function Ua(e) {
7454
+ var Wa = (e, t) => M.objectReduce(e, (e, n, r) => (n === t && e.push(r), e), []);
7455
+ function Ga(e) {
7407
7456
  if (e.conversation?.muteStates) return e.conversation.muteStates;
7408
7457
  if (e.muteState && e.muteOptions) return e.muteOptions.reduce((t, n) => (t[n] = e.muteState, t), {});
7409
7458
  }
7410
- function Wa(e, t) {
7459
+ function Ka(e, t) {
7411
7460
  switch (e) {
7412
7461
  case T.AUDIO: return !!t.isAudioEnabled;
7413
7462
  case T.AUDIO_SHARING: return !!t.isAudioSharingEnabled;
@@ -7416,12 +7465,12 @@ function Wa(e, t) {
7416
7465
  default: return !1;
7417
7466
  }
7418
7467
  }
7419
- function Ga(e, t) {
7468
+ function qa(e, t) {
7420
7469
  return M.objectReduce(e, (e, n, r) => {
7421
7470
  switch (n) {
7422
7471
  case Na.MUTE:
7423
7472
  case Na.MUTE_PERMANENT:
7424
- Wa(r, t) || (e[r] = n);
7473
+ Ka(r, t) || (e[r] = n);
7425
7474
  break;
7426
7475
  default:
7427
7476
  e[r] = n;
@@ -7430,19 +7479,19 @@ function Ga(e, t) {
7430
7479
  return e;
7431
7480
  }, {});
7432
7481
  }
7433
- function Ka(e) {
7482
+ function Ja(e) {
7434
7483
  let { muteStates: t = {}, mediaSettings: n } = e;
7435
- return Ga(t, n);
7484
+ return qa(t, n);
7436
7485
  }
7437
- function qa(e, t) {
7486
+ function Ya(e, t) {
7438
7487
  let n = e.conversation.participants.find((t) => M.comparePeerId(t.peerId, e.peerId));
7439
7488
  if (!n) return t;
7440
7489
  let { mediaSettings: r } = n;
7441
- return Ga(t, r);
7490
+ return qa(t, r);
7442
7491
  }
7443
7492
  //#endregion
7444
7493
  //#region src/utils/Lz4.ts
7445
- function Ja(e, t) {
7494
+ function Xa(e, t) {
7446
7495
  let n = new Uint8Array(t), r = 0, i = 0;
7447
7496
  for (; r < e.length && i < t;) {
7448
7497
  let a = e[r++], o = a >> 4, s = a & 15;
@@ -7469,7 +7518,7 @@ function Ja(e, t) {
7469
7518
  }
7470
7519
  //#endregion
7471
7520
  //#region src/classes/AudioFix.ts
7472
- var Ya = class {
7521
+ var Za = class {
7473
7522
  constructor(e, t = z, n = null) {
7474
7523
  h(this, "_fixNoPacketsApplied", !1), h(this, "_fixNoPacketsChecked", !1), h(this, "_fixTooManyPacketsApplied", !1), h(this, "_fixTooManyPacketsSucceeded", !1), h(this, "_fixTooManyPacketsFailed", !1), h(this, "_fixTooManyPacketsTime", void 0), h(this, "_mediaSource", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_lastPacketsSent", void 0), h(this, "_lastPacketsSentTime", void 0), h(this, "_toggleAudioPromise", null), h(this, "_fixNoPacketsAppliedVideo", !1), this._mediaSource = e, this._debug = t, this._logger = n;
7475
7524
  }
@@ -7507,7 +7556,7 @@ var Ya = class {
7507
7556
  this._debug.warn("[AudioFix] Failed to fix RV (no packets): video restart", e);
7508
7557
  }));
7509
7558
  }
7510
- }, Xa = class {
7559
+ }, Qa = class {
7511
7560
  constructor(e, t = !1, n = z, r = null) {
7512
7561
  h(this, "_audioElement", null), h(this, "_audioTracks", /* @__PURE__ */ new Map()), h(this, "_allowMultipleTracks", void 0), h(this, "_volume", 1), h(this, "_features", { setSinkId: !!Audio.prototype.setSinkId }), h(this, "_statFirstMediaReceived", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), this._statFirstMediaReceived = e, this._allowMultipleTracks = t, this._debug = n, this._logger = r;
7513
7562
  }
@@ -7595,18 +7644,18 @@ var Ya = class {
7595
7644
  };
7596
7645
  //#endregion
7597
7646
  //#region src/classes/ConversationResponseValidator.ts
7598
- function Za(e, t) {
7599
- e || $a(t, "response is empty"), e.id || $a(t, "id is empty"), e.endpoint || $a(t, "endpoint is empty"), !Qa(e.stun_server) && !Qa(e.turn_server) && $a(t, "ice servers are empty");
7647
+ function $a(e, t) {
7648
+ e || to(t, "response is empty"), e.id || to(t, "id is empty"), e.endpoint || to(t, "endpoint is empty"), !eo(e.stun_server) && !eo(e.turn_server) && to(t, "ice servers are empty");
7600
7649
  }
7601
- function Qa(e) {
7650
+ function eo(e) {
7602
7651
  return Array.isArray(e?.urls) && e.urls.length > 0;
7603
7652
  }
7604
- function $a(e, t) {
7653
+ function to(e, t) {
7605
7654
  throw new v(_.UNKNOWN_ERROR, { message: `Invalid ${e} response: ${t}` });
7606
7655
  }
7607
7656
  //#endregion
7608
7657
  //#region src/classes/DebugInfo.ts
7609
- var eo = 90, to = 3, no = class extends g {
7658
+ var no = 90, ro = 3, io = class extends g {
7610
7659
  constructor(e = z) {
7611
7660
  super(), h(this, "_lastMemoryStat", {
7612
7661
  percent: 0,
@@ -7622,9 +7671,9 @@ var eo = 90, to = 3, no = class extends g {
7622
7671
  let e = window?.performance?.memory;
7623
7672
  if (!e || !e.usedJSHeapSize || !e.jsHeapSizeLimit) return;
7624
7673
  let t = Number((100 * e.usedJSHeapSize / e.jsHeapSizeLimit).toFixed(2)), n = Number((e.usedJSHeapSize / 1024 / 1024).toFixed(1));
7625
- t > eo ? this._debug.warn(`High memory usage: ${t}% (${n} MiB)`) : (!this._lastMemoryStat.percent || Math.abs(t - this._lastMemoryStat.percent) >= to) && (this._debug.debug(`Memory usage: ${t}% (${n} MiB)`), this._lastMemoryStat.percent = t, this._lastMemoryStat.bytes = e.usedJSHeapSize);
7674
+ t > no ? this._debug.warn(`High memory usage: ${t}% (${n} MiB)`) : (!this._lastMemoryStat.percent || Math.abs(t - this._lastMemoryStat.percent) >= ro) && (this._debug.debug(`Memory usage: ${t}% (${n} MiB)`), this._lastMemoryStat.percent = t, this._lastMemoryStat.bytes = e.usedJSHeapSize);
7626
7675
  }
7627
- }, ro = class {
7676
+ }, ao = class {
7628
7677
  constructor({ api: e, debug: t, getParticipants: n, isMe: r, updateDisplayLayout: i }) {
7629
7678
  h(this, "_api", void 0), h(this, "_debug", void 0), h(this, "_getParticipants", void 0), h(this, "_isMe", void 0), h(this, "_updateDisplayLayout", void 0), h(this, "_requestedLayouts", {}), h(this, "_uncertainLayouts", {}), h(this, "_pendingRequests", null), h(this, "_pendingPromises", []), h(this, "_lastRequests", null), h(this, "_timer", null), h(this, "_inFlight", !1), h(this, "_lastFlushAt", null), h(this, "_generation", 0), h(this, "_forceNextFlush", !1), this._api = e, this._debug = t, this._getParticipants = n, this._isMe = r, this._updateDisplayLayout = i;
7630
7679
  }
@@ -7734,7 +7783,7 @@ var eo = 90, to = 3, no = class extends g {
7734
7783
  let n = e, r = t;
7735
7784
  return n.width !== r.width || n.height !== r.height || n.fit !== r.fit || n.priority !== r.priority;
7736
7785
  }
7737
- }, io = 44100, ao = class {
7786
+ }, oo = 44100, so = class {
7738
7787
  constructor(e, t) {
7739
7788
  h(this, "_analyser", null), h(this, "_gainNode", null), h(this, "_fftBins", null), h(this, "_mediaStreamSource", null), h(this, "_lastSmoothedLevel", 0), h(this, "_trackId", void 0), h(this, "_track", void 0), h(this, "_stream", void 0), this._trackId = e, this._track = t, this._stream = new MediaStream([t]);
7740
7789
  try {
@@ -7751,7 +7800,7 @@ var eo = 90, to = 3, no = class extends g {
7751
7800
  _getBins() {
7752
7801
  if (!this._fftBins || !this._analyser) return new Uint8Array();
7753
7802
  this._analyser.getByteFrequencyData(this._fftBins);
7754
- let e = io / this._fftBins.length, t = Math.ceil(N.voiceParams.minFreq / e), n = Math.floor(N.voiceParams.maxFreq / e);
7803
+ let e = oo / this._fftBins.length, t = Math.ceil(N.voiceParams.minFreq / e), n = Math.floor(N.voiceParams.maxFreq / e);
7755
7804
  return this._fftBins.subarray(t, n);
7756
7805
  }
7757
7806
  getLevel() {
@@ -7764,7 +7813,7 @@ var eo = 90, to = 3, no = class extends g {
7764
7813
  destroy() {
7765
7814
  this._mediaStreamSource && (this._mediaStreamSource.disconnect(), this._mediaStreamSource = null), this._gainNode && (this._gainNode.disconnect(), this._gainNode = null), this._analyser && (this._analyser.disconnect(), this._analyser = null, this._fftBins = null, this._lastSmoothedLevel = 0), this._stream.removeTrack(this._track);
7766
7815
  }
7767
- }, oo = class extends g {
7816
+ }, co = class extends g {
7768
7817
  constructor(e) {
7769
7818
  super(), h(this, "_detector", null), h(this, "_interval", null);
7770
7819
  let t = () => {
@@ -7780,7 +7829,7 @@ var eo = 90, to = 3, no = class extends g {
7780
7829
  }), this.subscribe(e, qt.SOURCE_READY, n), n();
7781
7830
  }
7782
7831
  init(e) {
7783
- this._stopDetector(), this._detector = new ao("local", e.clone());
7832
+ this._stopDetector(), this._detector = new so("local", e.clone());
7784
7833
  }
7785
7834
  _stopDetector() {
7786
7835
  this._detector && (this._detector.track.stop(), this._detector.destroy(), this._detector = null);
@@ -7788,7 +7837,7 @@ var eo = 90, to = 3, no = class extends g {
7788
7837
  destroy() {
7789
7838
  this.unsubscribe(), this._interval && (window.clearTimeout(this._interval), this._interval = null), this._stopDetector();
7790
7839
  }
7791
- }, so = class {
7840
+ }, lo = class {
7792
7841
  constructor(e, t = z) {
7793
7842
  h(this, "processor", void 0), h(this, "queue", []), h(this, "isProcessing", !1), h(this, "_debug", void 0), this.processor = e, this._debug = t;
7794
7843
  }
@@ -7808,9 +7857,9 @@ var eo = 90, to = 3, no = class extends g {
7808
7857
  this.isProcessing = !1;
7809
7858
  }
7810
7859
  }
7811
- }, co = /* @__PURE__ */ function(e) {
7860
+ }, uo = /* @__PURE__ */ function(e) {
7812
7861
  return e.VOLUMES_DETECTED = "VOLUMES_DETECTED", e;
7813
- }({}), lo = class extends g {
7862
+ }({}), fo = class extends g {
7814
7863
  constructor(e) {
7815
7864
  super(), h(this, "_detectors", /* @__PURE__ */ new Map()), h(this, "_interval", null), h(this, "_activeParticipants", void 0), h(this, "_removedParticipants", void 0), h(this, "_topology", void 0), this._topology = e.getTopology(), this.subscribe(e, J.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(e, J.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(e, J.SIGNALLED_ACTIVE_PARTICIPANTS, this._onSignalledActiveParticipants.bind(this)), this.subscribe(e, J.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this));
7816
7865
  }
@@ -7818,7 +7867,7 @@ var eo = 90, to = 3, no = class extends g {
7818
7867
  this._interval && (window.clearTimeout(this._interval), this._interval = null), this.unsubscribe(), this._destroyDetectors();
7819
7868
  }
7820
7869
  _onRemoteTrackAdded(e, t, n) {
7821
- if (n.kind === A.audio && (this._detectors.get(e)?.destroy(), this._detectors.set(e, new ao(e, n)), !this._interval)) {
7870
+ if (n.kind === A.audio && (this._detectors.get(e)?.destroy(), this._detectors.set(e, new so(e, n)), !this._interval)) {
7822
7871
  let e = () => {
7823
7872
  this._collectVolumes(), this._interval = window.setTimeout(e, N.voiceParams.interval);
7824
7873
  };
@@ -7833,7 +7882,7 @@ var eo = 90, to = 3, no = class extends g {
7833
7882
  _collectVolumes() {
7834
7883
  if (!this._detectors.size) return;
7835
7884
  let e = {};
7836
- if (this._topology === q.SERVER) {
7885
+ if (this._topology === K.SERVER) {
7837
7886
  if (this._activeParticipants) for (let t of this._activeParticipants) {
7838
7887
  let n = this._getAudioTrackLevelByParticipantId(t);
7839
7888
  n && (e[t] = n);
@@ -7850,14 +7899,14 @@ var eo = 90, to = 3, no = class extends g {
7850
7899
  }
7851
7900
  _getAudioTrackLevelByParticipantId(e) {
7852
7901
  if (this._isTransparentAudioMode()) return this._getTransparentAudioLevelByParticipantId(e);
7853
- let t = this._detectors.get(Lr.AUDIO_MIX);
7902
+ let t = this._detectors.get(Pr.AUDIO_MIX);
7854
7903
  return t ? t.getLevel() : null;
7855
7904
  }
7856
7905
  _getTransparentAudioLevelByParticipantId(e) {
7857
7906
  if (!this._activeParticipants?.includes(e)) return null;
7858
7907
  let t = null;
7859
7908
  return this._detectors.forEach((e, n) => {
7860
- if (!n.startsWith(`${Lr.TRANSPARENT_AUDIO_TRACK_PREFIX}-`)) return;
7909
+ if (!n.startsWith(`${Pr.TRANSPARENT_AUDIO_TRACK_PREFIX}-`)) return;
7861
7910
  let r = e.getLevel();
7862
7911
  (!t || r.real > t.real) && (t = r);
7863
7912
  }), t;
@@ -7866,21 +7915,21 @@ var eo = 90, to = 3, no = class extends g {
7866
7915
  this._removedParticipants = this._activeParticipants?.filter((t) => !e.includes(t)) ?? null, this._activeParticipants = e;
7867
7916
  }
7868
7917
  _onTopologyChanged(e) {
7869
- this._topology = e, this._destroyDetectors(), e === q.DIRECT && (this._activeParticipants = null, this._removedParticipants = null);
7918
+ this._topology = e, this._destroyDetectors(), e === K.DIRECT && (this._activeParticipants = null, this._removedParticipants = null);
7870
7919
  }
7871
7920
  _isTransparentAudioMode() {
7872
- return this._topology === q.SERVER && N.transparentAudio;
7921
+ return this._topology === K.SERVER && N.transparentAudio;
7873
7922
  }
7874
7923
  _destroyDetectors() {
7875
7924
  this._detectors.forEach((e) => {
7876
7925
  e.destroy();
7877
7926
  }), this._detectors.clear();
7878
7927
  }
7879
- }, uo = /* @__PURE__ */ function(e) {
7928
+ }, po = /* @__PURE__ */ function(e) {
7880
7929
  return e.SPEAKER_CHANGED = "SPEAKER_CHANGED", e;
7881
- }({}), fo = class extends g {
7930
+ }({}), mo = class extends g {
7882
7931
  constructor(e, t, n) {
7883
- super(), h(this, "_speakerId", null), h(this, "_serverSideSpeakerDetection", !1), this._serverSideSpeakerDetection = n === q.SERVER, this.subscribe(e, co.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this.subscribe(t, J.SIGNALLED_SPEAKER_CHANGED, this._onServerSpeakerChanged.bind(this)), this.subscribe(t, J.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this));
7932
+ super(), h(this, "_speakerId", null), h(this, "_serverSideSpeakerDetection", !1), this._serverSideSpeakerDetection = n === K.SERVER, this.subscribe(e, uo.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this.subscribe(t, J.SIGNALLED_SPEAKER_CHANGED, this._onServerSpeakerChanged.bind(this)), this.subscribe(t, J.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this));
7884
7933
  }
7885
7934
  destroy() {
7886
7935
  this.unsubscribe();
@@ -7900,11 +7949,11 @@ var eo = 90, to = 3, no = class extends g {
7900
7949
  this._serverSideSpeakerDetection && this._triggerEvent("SPEAKER_CHANGED", e);
7901
7950
  }
7902
7951
  _onTopologyChanged(e) {
7903
- this._serverSideSpeakerDetection = e === q.SERVER;
7952
+ this._serverSideSpeakerDetection = e === K.SERVER;
7904
7953
  }
7905
- }, po = class extends g {
7954
+ }, ho = class extends g {
7906
7955
  constructor(e, t, n, r = z, i = null) {
7907
- super(), h(this, "_transport", void 0), h(this, "_volumes", {}), h(this, "_participants", {}), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_connectionTimeout", 0), h(this, "_volumeTimeout", 0), this._transport = e, this._participants = n, this._debug = r, this._logger = i, this.subscribe(e, J.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(t, co.VOLUMES_DETECTED, this._onVolumesDetected.bind(this));
7956
+ super(), h(this, "_transport", void 0), h(this, "_volumes", {}), h(this, "_participants", {}), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_connectionTimeout", 0), h(this, "_volumeTimeout", 0), this._transport = e, this._participants = n, this._debug = r, this._logger = i, this.subscribe(e, J.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(t, uo.VOLUMES_DETECTED, this._onVolumesDetected.bind(this));
7908
7957
  }
7909
7958
  destroy() {
7910
7959
  this.unsubscribe(), this._connectionTimeout && window.clearTimeout(this._connectionTimeout), this._volumeTimeout && window.clearTimeout(this._volumeTimeout);
@@ -7913,7 +7962,7 @@ var eo = 90, to = 3, no = class extends g {
7913
7962
  t.isAudioEnabled || (this._volumes[e] = 1), t.isAudioEnabled && (this._volumes[e] = 0);
7914
7963
  }
7915
7964
  _onTransportStateChanged(e, t) {
7916
- t === K.OPENED && (this._connectionTimeout || (this._connectionTimeout = window.setTimeout(this._onConnectionTimeout.bind(this), N.specListenerParams.connectionTimeout)), this._volumeTimeout || (this._volumeTimeout = window.setTimeout(this._onVolumeTimeout.bind(this), N.specListenerParams.volumeTimeout))), t === K.FAILED && this._connectionTimeout && (this._debug.warn("Transport failed, send callSpecError"), this._logger?.log(E.CALL_SPEC_ERROR, `${this._transport.getTopology()}_CONNECTION_TIMEOUT`));
7965
+ t === W.OPENED && (this._connectionTimeout || (this._connectionTimeout = window.setTimeout(this._onConnectionTimeout.bind(this), N.specListenerParams.connectionTimeout)), this._volumeTimeout || (this._volumeTimeout = window.setTimeout(this._onVolumeTimeout.bind(this), N.specListenerParams.volumeTimeout))), t === W.FAILED && this._connectionTimeout && (this._debug.warn("Transport failed, send callSpecError"), this._logger?.log(E.CALL_SPEC_ERROR, `${this._transport.getTopology()}_CONNECTION_TIMEOUT`));
7917
7966
  }
7918
7967
  _onVolumesDetected(e) {
7919
7968
  Object.keys(e).forEach((t) => {
@@ -7921,7 +7970,7 @@ var eo = 90, to = 3, no = class extends g {
7921
7970
  });
7922
7971
  }
7923
7972
  _onConnectionTimeout() {
7924
- Object.values(this._transport.getStates()).filter((e) => e !== K.CONNECTED).length > 0 && (this._debug.warn("There is not connected transport, send callSpecError"), this._logger?.log(E.CALL_SPEC_ERROR, `${this._transport.getTopology()}_CONNECTION_TIMEOUT`)), this._connectionTimeout = 0;
7973
+ Object.values(this._transport.getStates()).filter((e) => e !== W.CONNECTED).length > 0 && (this._debug.warn("There is not connected transport, send callSpecError"), this._logger?.log(E.CALL_SPEC_ERROR, `${this._transport.getTopology()}_CONNECTION_TIMEOUT`)), this._connectionTimeout = 0;
7925
7974
  }
7926
7975
  _onVolumeTimeout() {
7927
7976
  let e = [];
@@ -7931,7 +7980,7 @@ var eo = 90, to = 3, no = class extends g {
7931
7980
  r && r.platform && (n = r.platform), e.indexOf(n) < 0 && (e.push(n), this._logger?.log(E.CALL_SPEC_ERROR, `${this._transport.getTopology()}_VOLUME_TIMEOUT_${n}`));
7932
7981
  }), e.length && this._debug.warn("There is silent participant, send callSpecError"), this._volumeTimeout = 0;
7933
7982
  }
7934
- }, mo = class extends f {
7983
+ }, go = class extends f {
7935
7984
  constructor(e, t, n) {
7936
7985
  super(), h(this, "_externalLogger", void 0), h(this, "_api", void 0), h(this, "_conversationIdProvider", void 0), h(this, "_batchInterval", 3e3), h(this, "_batchedClientStats", []), h(this, "_batchedClientEvents", []), h(this, "_batchTimeout", null), h(this, "_serverTimeDelta", 0), this._api = e, this._externalLogger = t, this._conversationIdProvider = n, this._calculateServerTimeDelta();
7937
7986
  }
@@ -7990,7 +8039,7 @@ var eo = 90, to = 3, no = class extends g {
7990
8039
  _now() {
7991
8040
  return Date.now() - this._serverTimeDelta;
7992
8041
  }
7993
- }, ho = class {
8042
+ }, _o = class {
7994
8043
  constructor(e, t) {
7995
8044
  h(this, "_logger", void 0), h(this, "_codecUsages", /* @__PURE__ */ new Map()), h(this, "getCurrentTransportTopology", void 0), this._logger = e, this.getCurrentTransportTopology = t;
7996
8045
  }
@@ -8044,7 +8093,7 @@ var eo = 90, to = 3, no = class extends g {
8044
8093
  name: V.CODEC_USAGE,
8045
8094
  codec_implementation: e.codecName,
8046
8095
  value: e.totalEncodeTime,
8047
- call_topology: e.topology === q.DIRECT ? "D" : "S"
8096
+ call_topology: e.topology === K.DIRECT ? "D" : "S"
8048
8097
  };
8049
8098
  e.audioCodecParams && (t.string_value = e.audioCodecParams), this._logger.logClientStats(t);
8050
8099
  }
@@ -8053,7 +8102,7 @@ var eo = 90, to = 3, no = class extends g {
8053
8102
  this.report(e);
8054
8103
  }), this._codecUsages.clear();
8055
8104
  }
8056
- }, go = class {
8105
+ }, vo = class {
8057
8106
  constructor(e) {
8058
8107
  h(this, "_logger", void 0), h(this, "_eventualLogs", /* @__PURE__ */ new Set()), this._logger = e;
8059
8108
  }
@@ -8078,7 +8127,7 @@ var eo = 90, to = 3, no = class extends g {
8078
8127
  destroy() {
8079
8128
  this._eventualLogs.clear();
8080
8129
  }
8081
- }, _o = class {
8130
+ }, yo = class {
8082
8131
  constructor(e) {
8083
8132
  if (h(this, "q", void 0), h(this, "inits", []), h(this, "n", [
8084
8133
  1,
@@ -8137,7 +8186,7 @@ var eo = 90, to = 3, no = class extends g {
8137
8186
  5
8138
8187
  ];
8139
8188
  }
8140
- }, vo = class {
8189
+ }, bo = class {
8141
8190
  constructor() {
8142
8191
  h(this, "n", 0), h(this, "mean", 0);
8143
8192
  }
@@ -8149,9 +8198,9 @@ var eo = 90, to = 3, no = class extends g {
8149
8198
  get avg() {
8150
8199
  return this.n ? this.mean : NaN;
8151
8200
  }
8152
- }, yo = class {
8201
+ }, xo = class {
8153
8202
  constructor() {
8154
- h(this, "count", 0), h(this, "minVal", Infinity), h(this, "maxVal", -Infinity), h(this, "mean", new vo()), h(this, "p50", new _o(.5)), h(this, "p95", new _o(.95));
8203
+ h(this, "count", 0), h(this, "minVal", Infinity), h(this, "maxVal", -Infinity), h(this, "mean", new bo()), h(this, "p50", new yo(.5)), h(this, "p95", new yo(.95));
8155
8204
  }
8156
8205
  add(e) {
8157
8206
  e < this.minVal && (this.minVal = e), e > this.maxVal && (this.maxVal = e), this.mean.add(e), this.p50.add(e), this.p95.add(e), this.count++;
@@ -8169,11 +8218,11 @@ var eo = 90, to = 3, no = class extends g {
8169
8218
  get hasData() {
8170
8219
  return this.count > 0;
8171
8220
  }
8172
- }, bo = class {
8221
+ }, So = class {
8173
8222
  constructor(e) {
8174
8223
  h(this, "_logger", void 0), h(this, "trackerByTransport", {
8175
- ws: new yo(),
8176
- wt: new yo()
8224
+ ws: new xo(),
8225
+ wt: new xo()
8177
8226
  }), h(this, "lastSeen", {}), this._logger = e;
8178
8227
  }
8179
8228
  mark(e) {
@@ -8185,11 +8234,11 @@ var eo = 90, to = 3, no = class extends g {
8185
8234
  this.lastSeen[e] = t;
8186
8235
  }
8187
8236
  logMetrics(e) {
8188
- [fr.WEBSOCKET, fr.WEBTRANSPORT].forEach((t) => {
8237
+ [sa.WEBSOCKET, sa.WEBTRANSPORT].forEach((t) => {
8189
8238
  if (!this.trackerByTransport[t].hasData) return;
8190
8239
  let n = this.trackerByTransport[t].snapshot();
8191
8240
  this._logger.logClientStats({
8192
- call_topology: e === q.DIRECT ? "D" : "S",
8241
+ call_topology: e === K.DIRECT ? "D" : "S",
8193
8242
  name: V.SIGNALING_PING_SUMMARY,
8194
8243
  min_value: n.min,
8195
8244
  max_value: n.max,
@@ -8203,24 +8252,24 @@ var eo = 90, to = 3, no = class extends g {
8203
8252
  }
8204
8253
  destroy() {
8205
8254
  this.trackerByTransport = {
8206
- ws: new yo(),
8207
- wt: new yo()
8255
+ ws: new xo(),
8256
+ wt: new xo()
8208
8257
  }, this.lastSeen = {};
8209
8258
  }
8210
- }, xo = class {
8259
+ }, Co = class {
8211
8260
  constructor(e) {
8212
8261
  h(this, "_logger", void 0), h(this, "trackerByCommand", /* @__PURE__ */ new Map()), this._logger = e;
8213
8262
  }
8214
8263
  mark(e, t, n) {
8215
8264
  let r = `${e}|${n}`, i;
8216
- this.trackerByCommand.has(r) ? i = this.trackerByCommand.get(r) : (i = new yo(), this.trackerByCommand.set(r, i)), i.add(t);
8265
+ this.trackerByCommand.has(r) ? i = this.trackerByCommand.get(r) : (i = new xo(), this.trackerByCommand.set(r, i)), i.add(t);
8217
8266
  }
8218
8267
  logMetrics(e) {
8219
8268
  for (let [t, n] of this.trackerByCommand.entries()) {
8220
8269
  if (!n.hasData) continue;
8221
8270
  let [r, i] = t.split("|"), a = n.snapshot();
8222
8271
  this._logger.logClientStats({
8223
- call_topology: e === q.DIRECT ? "D" : "S",
8272
+ call_topology: e === K.DIRECT ? "D" : "S",
8224
8273
  name: V.SIGNALING_COMMAND_SUMMARY,
8225
8274
  api_method: r,
8226
8275
  min_value: a.min,
@@ -8236,9 +8285,9 @@ var eo = 90, to = 3, no = class extends g {
8236
8285
  destroy() {
8237
8286
  this.trackerByCommand.clear();
8238
8287
  }
8239
- }, So = class e {
8288
+ }, wo = class e {
8240
8289
  constructor(e, t, n, r) {
8241
- h(this, "logger", void 0), h(this, "statAggregator", void 0), h(this, "codecStatsAggregator", void 0), h(this, "pings", void 0), h(this, "signalingCommands", void 0), this.logger = new mo(e, t, n), this.statAggregator = new go(this.logger), this.codecStatsAggregator = new ho(this.logger, r), this.pings = new bo(this.logger), this.signalingCommands = new xo(this.logger);
8290
+ h(this, "logger", void 0), h(this, "statAggregator", void 0), h(this, "codecStatsAggregator", void 0), h(this, "pings", void 0), h(this, "signalingCommands", void 0), this.logger = new go(e, t, n), this.statAggregator = new vo(this.logger), this.codecStatsAggregator = new _o(this.logger, r), this.pings = new So(this.logger), this.signalingCommands = new Co(this.logger);
8242
8291
  }
8243
8292
  logHangup(t, n) {
8244
8293
  if (![
@@ -8257,7 +8306,7 @@ var eo = 90, to = 3, no = class extends g {
8257
8306
  this.logger.logClientStats({
8258
8307
  name: V.CALL_FINISH,
8259
8308
  reason: e.correctHangupReason(t.hangup),
8260
- call_topology: n === q.DIRECT ? "D" : "S",
8309
+ call_topology: n === K.DIRECT ? "D" : "S",
8261
8310
  ...r && { string_value: r }
8262
8311
  });
8263
8312
  }
@@ -8282,21 +8331,21 @@ var eo = 90, to = 3, no = class extends g {
8282
8331
  default: return "hangup";
8283
8332
  }
8284
8333
  }
8285
- }, Co = class {
8334
+ }, To = class {
8286
8335
  constructor(e) {
8287
8336
  h(this, "_statAggregator", void 0), h(this, "_isCallMarked", !1), h(this, "_isFinished", !1), h(this, "_callType", null), this._statAggregator = e;
8288
8337
  }
8289
8338
  markAcceptCall(e) {
8290
- this.mark(e === q.DIRECT ? "direct_incoming" : "server_incoming");
8339
+ this.mark(e === K.DIRECT ? "direct_incoming" : "server_incoming");
8291
8340
  }
8292
8341
  markAcceptedCall(e) {
8293
- e === q.DIRECT && this.mark("direct_outgoing");
8342
+ e === K.DIRECT && this.mark("direct_outgoing");
8294
8343
  }
8295
8344
  markOnJoin(e) {
8296
- this.mark(e === q.DIRECT ? "direct_join" : "server_join_server", e === q.DIRECT);
8345
+ this.mark(e === K.DIRECT ? "direct_join" : "server_join_server", e === K.DIRECT);
8297
8346
  }
8298
8347
  markTopologyChanged(e) {
8299
- this._isFinished || e !== q.SERVER || (this._callType = "server_change_topology");
8348
+ this._isFinished || e !== K.SERVER || (this._callType = "server_change_topology");
8300
8349
  }
8301
8350
  mark(e, t = !1) {
8302
8351
  (!this._isCallMarked || t) && (this._isCallMarked = !0, this._callType = e, U.setMark(V.FIRST_MEDIA_RECEIVED));
@@ -8307,9 +8356,9 @@ var eo = 90, to = 3, no = class extends g {
8307
8356
  call_type: this._callType
8308
8357
  }));
8309
8358
  }
8310
- }, wo = 1e3, To = 1e4, Eo = 15, Q = class e extends g {
8359
+ }, Eo = 1e3, Do = 1e4, Oo = 15, Q = class e extends g {
8311
8360
  constructor(e, t) {
8312
- super(), h(this, "_api", void 0), h(this, "_signaling", void 0), h(this, "_signalingActor", void 0), h(this, "_displayLayoutRequester", void 0), h(this, "_mediaSource", null), h(this, "_conversation", null), h(this, "_myLastRequestedLayouts", {}), h(this, "_state", "IDLE"), h(this, "_participantState", X.CALLED), h(this, "_participants", {}), h(this, "_pendingParticipants", /* @__PURE__ */ new Map()), h(this, "_transport", null), h(this, "_debugInfo", null), h(this, "_debug", z.createSessionLogger()), h(this, "_volumesDetector", null), h(this, "_speakerDetector", null), h(this, "_localVolumeDetector", null), h(this, "_specListener", null), h(this, "_activeSpeakerId", null), h(this, "_lastSignalledActiveSpeakerId", null), h(this, "_isRealTimeAsrRequested", !1), h(this, "_serverSettings", Sr()), h(this, "_serverTimeOffset", 0), h(this, "_onUnload", void 0), h(this, "_audioOutput", void 0), h(this, "_stats", void 0), h(this, "_lastStalled", {}), h(this, "_audioMixStalled", !1), h(this, "_audioFix", null), h(this, "_streamByStreamId", /* @__PURE__ */ new Map()), h(this, "_streamIdByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_streamWaitTimerByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_sequenceNumberByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_cooldownTimestampByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_cooldownQueueCleanupTimer", null), h(this, "_statFirstMediaReceived", void 0), h(this, "_changeMediaSettings", M.debounce(async (e) => {
8361
+ super(), h(this, "_api", void 0), h(this, "_signaling", void 0), h(this, "_signalingActor", void 0), h(this, "_displayLayoutRequester", void 0), h(this, "_mediaSource", null), h(this, "_conversation", null), h(this, "_myLastRequestedLayouts", {}), h(this, "_state", "IDLE"), h(this, "_participantState", X.CALLED), h(this, "_participants", {}), h(this, "_pendingParticipants", /* @__PURE__ */ new Map()), h(this, "_transport", null), h(this, "_debugInfo", null), h(this, "_debug", z.createSessionLogger()), h(this, "_volumesDetector", null), h(this, "_speakerDetector", null), h(this, "_localVolumeDetector", null), h(this, "_specListener", null), h(this, "_activeSpeakerId", null), h(this, "_lastSignalledActiveSpeakerId", null), h(this, "_isRealTimeAsrRequested", !1), h(this, "_serverSettings", yr()), h(this, "_serverTimeOffset", 0), h(this, "_onUnload", void 0), h(this, "_audioOutput", void 0), h(this, "_stats", void 0), h(this, "_lastStalled", {}), h(this, "_audioMixStalled", !1), h(this, "_audioFix", null), h(this, "_streamByStreamId", /* @__PURE__ */ new Map()), h(this, "_streamIdByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_streamWaitTimerByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_sequenceNumberByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_cooldownTimestampByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_cooldownQueueCleanupTimer", null), h(this, "_statFirstMediaReceived", void 0), h(this, "_changeMediaSettings", M.debounce(async (e) => {
8313
8362
  if (this._signaling.ready) try {
8314
8363
  await this._signaling.changeMediaSettings(e);
8315
8364
  } catch (e) {
@@ -8319,7 +8368,7 @@ var eo = 90, to = 3, no = class extends g {
8319
8368
  captureAudio: !1
8320
8369
  });
8321
8370
  }
8322
- }, 100)), this._stats = new So(e, t, () => this._conversation?.id || null, () => this._transport?.getTopology()), this._api = e, this._signaling = new Ea(this._debug, this._stats.logger, this._stats.statAggregator, this._stats.pings, this._stats.signalingCommands), this._signalingActor = new so(this._onSignalingNotification.bind(this), this._debug), this._displayLayoutRequester = new ro({
8371
+ }, 100)), this._stats = new wo(e, t, () => this._conversation?.id || null, () => this._transport?.getTopology()), this._api = e, this._signaling = new Ea(this._debug, this._stats.logger, this._stats.statAggregator, this._stats.pings, this._stats.signalingCommands), this._signalingActor = new lo(this._onSignalingNotification.bind(this), this._debug), this._displayLayoutRequester = new ao({
8323
8372
  api: this._api,
8324
8373
  debug: this._debug,
8325
8374
  getParticipants: () => this._getParticipants(),
@@ -8330,7 +8379,7 @@ var eo = 90, to = 3, no = class extends g {
8330
8379
  event_type: V.CALL_DECLINED_OR_HANGED_LOCALLY,
8331
8380
  reason: "none"
8332
8381
  }, !0)), this._stats.destroy();
8333
- }, window.addEventListener("pagehide", this._onUnload), this._statFirstMediaReceived = new Co(this._stats.statAggregator), this._audioOutput = new Xa(this._statFirstMediaReceived, N.transparentAudio, this._debug, this._stats.logger), N.videoTracksCount > 0 && (this._cooldownQueueCleanupTimer = window.setInterval(this._cleanupCooldownQueue.bind(this), wo));
8382
+ }, window.addEventListener("pagehide", this._onUnload), this._statFirstMediaReceived = new To(this._stats.statAggregator), this._audioOutput = new Qa(this._statFirstMediaReceived, N.transparentAudio, this._debug, this._stats.logger), N.videoTracksCount > 0 && (this._cooldownQueueCleanupTimer = window.setInterval(this._cleanupCooldownQueue.bind(this), Eo));
8334
8383
  }
8335
8384
  static current() {
8336
8385
  return e._current;
@@ -8484,7 +8533,7 @@ var eo = 90, to = 3, no = class extends g {
8484
8533
  let i = atob(n), a = new Uint8Array(i.length);
8485
8534
  for (let e = 0; e < i.length; e++) a[e] = i.charCodeAt(e);
8486
8535
  try {
8487
- let e = Ja(a, r).reduce((e, t) => (e += String.fromCharCode(t), e), ""), { srcp: t, stne: n, tkn: i, trne: o, trnp: s, trnu: c, wse: l, wte: u } = JSON.parse(e);
8536
+ let e = Xa(a, r).reduce((e, t) => (e += String.fromCharCode(t), e), ""), { srcp: t, stne: n, tkn: i, trne: o, trnp: s, trnu: c, wse: l, wte: u } = JSON.parse(e);
8488
8537
  return {
8489
8538
  token: i,
8490
8539
  endpoint: l,
@@ -8594,7 +8643,7 @@ var eo = 90, to = 3, no = class extends g {
8594
8643
  if (!this._transport) return;
8595
8644
  let n = [];
8596
8645
  for (let r of e) (r.state === X.CALLED || r.state === X.ACCEPTED) && (this._transport.isAllocated(r.id) || this._transport.allocate(r.id, t)), r.state === X.ACCEPTED && n.push(r.id);
8597
- n.length ? this._transport.open(n, null, !!this._conversation?.observer) : this._transport.getTopology() === q.SERVER && this._forceOpenTransportForAloneInCall();
8646
+ n.length ? this._transport.open(n, null, !!this._conversation?.observer) : this._transport.getTopology() === K.SERVER && this._forceOpenTransportForAloneInCall();
8598
8647
  }
8599
8648
  async _close(t, n) {
8600
8649
  n && this._debug.error(n, t), this._debug.debug("Close conversation", t), this._stats.logHangup(t, this._transport?.getTopology()), this._stats.flushCallMetrics(this._transport?.getTopology()), this._signaling.readyToSend(!1), t.error ? this._signaling.ready && this._signaling.hangup(_.FAILED) : this._stats.logger.log(E.ERROR, t.hangup), e._activationMutex = !1;
@@ -8720,7 +8769,7 @@ var eo = 90, to = 3, no = class extends g {
8720
8769
  }
8721
8770
  } else ee = await this._api.startConversation(p, t, n, m, a, o, s, { onlyAdminCanShareMovie: c }, l), this._debug.debug("Api.startConversation", ee);
8722
8771
  this._setConversationParams(ee);
8723
- let h = await this._connectSignaling(dr.START, ee);
8772
+ let h = await this._connectSignaling(oa.START, ee);
8724
8773
  return await this._setConversation(ee, h, r), this._logCallStartEvent(u, Y.OUTGOING), h;
8725
8774
  }
8726
8775
  async _joinConversation(t, n) {
@@ -8770,8 +8819,8 @@ var eo = 90, to = 3, no = class extends g {
8770
8819
  } else if (r) d = await this._api.joinConversation(r, u, a), f = "joinConversation";
8771
8820
  else if (o) d = await this._api.joinConversationByLink(o, u, s, c), f = "joinConversationByLink";
8772
8821
  else throw new v(_.UNKNOWN_ERROR);
8773
- this._debug.debug("Api.joinConversation", d), Za(d, f), this._setConversationParams(d);
8774
- let p = await this._connectSignaling(dr.JOIN, d);
8822
+ this._debug.debug("Api.joinConversation", d), $a(d, f), this._setConversationParams(d);
8823
+ let p = await this._connectSignaling(oa.JOIN, d);
8775
8824
  return await this._setConversation(d, p, Y.JOINING), this._logCallStartEvent(n, Y.JOINING), p;
8776
8825
  }
8777
8826
  async _prepareConversation(t, n = j.USER, r, i, a) {
@@ -8829,17 +8878,17 @@ var eo = 90, to = 3, no = class extends g {
8829
8878
  conversationParams: e
8830
8879
  }), u.wt_endpoint = l);
8831
8880
  }
8832
- let d = await this._connectSignaling(dr.ACCEPT, u);
8881
+ let d = await this._connectSignaling(oa.ACCEPT, u);
8833
8882
  return e._current && (e._current._participantState === X.ACCEPTED || e._current._participantState === X.CALLED) ? (this._debug.log("Push rejected (busy)"), this._stats.logger.log(E.PUSH, "busy"), this._signaling.ready && this._signaling.hangup(_.BUSY), Promise.reject(new v(_.BUSY))) : (e._current && (e._current.destroy(), e._current = null), await this._setConversation(u, d, Y.INCOMING, n), d);
8834
8883
  }
8835
- async _createParticipant(e, t) {
8836
- let n = Object.assign({
8884
+ async _createParticipant(e, t, n = !0) {
8885
+ let r = Object.assign({
8837
8886
  id: null,
8838
8887
  externalId: null,
8839
8888
  mediaSettings: k(),
8840
8889
  participantState: {},
8841
8890
  state: X.CALLED,
8842
- status: null,
8891
+ connectionStatus: null,
8843
8892
  remoteStream: null,
8844
8893
  mediaSource: null,
8845
8894
  platform: null,
@@ -8853,7 +8902,7 @@ var eo = 90, to = 3, no = class extends g {
8853
8902
  isInRoom: !1,
8854
8903
  markers: null
8855
8904
  }, e);
8856
- return n.externalId || (n.externalId = await this._getParticipantId(t ?? n.id)), this._api.cacheExternalId(t ?? n.id, n.externalId), t && this._api.mapDecorativeId(t, n.id), n.observedIds?.length && (n.externalId.observer = !0), e.markers && (n.markers = this._denormalizeMarkers(n.id, e.markers)), n;
8905
+ return r.externalId || (r.externalId = await this._getParticipantId(t ?? r.id)), n && this._api.cacheExternalId(t ?? r.id, r.externalId), t && this._api.mapDecorativeId(t, r.id), r.observedIds?.length && (r.externalId.observer = !0), e.markers && (r.markers = this._denormalizeMarkers(r.id, e.markers)), r.connectionStatus = Ba.create(r.connectionStatus), r;
8857
8906
  }
8858
8907
  async _getParticipantId(e) {
8859
8908
  try {
@@ -8862,8 +8911,9 @@ var eo = 90, to = 3, no = class extends g {
8862
8911
  throw this._close(new v(_.NETWORK_ERROR), e), e;
8863
8912
  }
8864
8913
  }
8865
- _cacheParticipantExternalIds(e) {
8866
- e.forEach((e) => {
8914
+ async _setConversation(e, t, n, r = j.USER) {
8915
+ let { participants: i } = t.conversation;
8916
+ t.conversationParams?.serverTime && (this._serverTimeOffset = t.conversationParams.serverTime - Date.now()), i.forEach((e) => {
8867
8917
  let t = M.composeId(e), n = Z.fromSignalingParticipant(e, !1);
8868
8918
  if (n) {
8869
8919
  this._api.cacheExternalId(t, n);
@@ -8871,10 +8921,6 @@ var eo = 90, to = 3, no = class extends g {
8871
8921
  r && i && (this._api.cacheExternalId(r, i), this._api.mapDecorativeId(e.decorativeUserId, e.id));
8872
8922
  }
8873
8923
  });
8874
- }
8875
- async _setConversation(e, t, n, r = j.USER) {
8876
- let { participants: i } = t.conversation;
8877
- t.conversationParams?.serverTime && (this._serverTimeOffset = t.conversationParams.serverTime - Date.now()), this._cacheParticipantExternalIds(i);
8878
8924
  let a = this._api.getUserId(), o = this._extractLocalParticipantFromConnection(t), s = e.device_idx || 0;
8879
8925
  if (!a) {
8880
8926
  if (!o) throw new v(_.UNKNOWN_ERROR);
@@ -8890,7 +8936,7 @@ var eo = 90, to = 3, no = class extends g {
8890
8936
  featuresPerRole: t.conversation.featuresPerRole,
8891
8937
  id: t.conversation.id || e.id,
8892
8938
  participantsLimit: t.conversation.participantsLimit || 30,
8893
- topology: t.conversation.topology || q.DIRECT,
8939
+ topology: t.conversation.topology || K.DIRECT,
8894
8940
  direction: n,
8895
8941
  concurrent: t.isConcurrent || e.is_concurrent || !1,
8896
8942
  needRate: !1,
@@ -8917,14 +8963,14 @@ var eo = 90, to = 3, no = class extends g {
8917
8963
  }
8918
8964
  _updateConversation(e) {
8919
8965
  if (!this._conversation) throw new v(_.UNKNOWN_ERROR);
8920
- this._conversation.acceptTime = e.conversation.acceptTime, this._conversation.features = e.conversation.features || [], this._conversation.featuresPerRole = e.conversation.featuresPerRole, this._conversation.participantsLimit = e.conversation.participantsLimit || 30, this._conversation.topology = e.conversation.topology || q.DIRECT, this._conversation.concurrent = e.isConcurrent || !1, this._conversation.chatId = e.conversation.multichatId, this._conversation.mediaModifiers = e.mediaModifiers, this._conversation.waitingHall = !1, this._conversation.waitForAdmin = !1, this._conversation.restricted = !1, this._cacheParticipantExternalIds(e.conversation.participants ?? []);
8966
+ this._conversation.acceptTime = e.conversation.acceptTime, this._conversation.features = e.conversation.features || [], this._conversation.featuresPerRole = e.conversation.featuresPerRole, this._conversation.participantsLimit = e.conversation.participantsLimit || 30, this._conversation.topology = e.conversation.topology || K.DIRECT, this._conversation.concurrent = e.isConcurrent || !1, this._conversation.chatId = e.conversation.multichatId, this._conversation.mediaModifiers = e.mediaModifiers, this._conversation.waitingHall = !1, this._conversation.waitForAdmin = !1, this._conversation.restricted = !1;
8921
8967
  }
8922
8968
  _createMediaSource() {
8923
8969
  let e = new Yt(this._debug, this._stats.logger);
8924
- return this.subscribe(e, qt.SOURCE_CHANGED, this._onLocalMediaStreamChanged.bind(this)), this.subscribe(e, qt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._audioFix = new Ya(e, this._debug, this._stats.logger), e;
8970
+ return this.subscribe(e, qt.SOURCE_CHANGED, this._onLocalMediaStreamChanged.bind(this)), this.subscribe(e, qt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._audioFix = new Za(e, this._debug, this._stats.logger), e;
8925
8971
  }
8926
8972
  async _connectSignaling(e, t) {
8927
- this._signaling.setEndpoint(t.endpoint), this._signaling.setWebTransportEndpoint(t.wt_endpoint ? t.wt_endpoint : null), this.subscribe(this._signaling, W.NOTIFICATION, (e) => this._signalingActor.add(e)), this.subscribe(this._signaling, W.FAILED, this._onSignalingFailed.bind(this)), this.subscribe(this._signaling, W.RECONNECT, this._onSignalingReconnect.bind(this));
8973
+ this._signaling.setEndpoint(t.endpoint), this._signaling.setWebTransportEndpoint(t.wt_endpoint ? t.wt_endpoint : null), this.subscribe(this._signaling, dr.NOTIFICATION, (e) => this._signalingActor.add(e)), this.subscribe(this._signaling, dr.FAILED, this._onSignalingFailed.bind(this)), this.subscribe(this._signaling, dr.RECONNECT, this._onSignalingReconnect.bind(this));
8928
8974
  let n = await this._signaling.connect(e, t);
8929
8975
  return this._stats.statAggregator.logEventualStat({ name: V.SIGNALING_CONNECTED }), n;
8930
8976
  }
@@ -8982,7 +9028,7 @@ var eo = 90, to = 3, no = class extends g {
8982
9028
  participantState: M.mapParticipantState(n),
8983
9029
  state: n.state,
8984
9030
  roles: n.roles || [],
8985
- status: P.WAITING,
9031
+ connectionStatus: this._buildConnectionStatus(e, n.sessionState),
8986
9032
  muteStates: n.muteStates || {},
8987
9033
  unmuteOptions: n.unmuteOptions || [],
8988
9034
  observedIds: n.observedIds || [],
@@ -8997,7 +9043,7 @@ var eo = 90, to = 3, no = class extends g {
8997
9043
  _registerParticipantLocalMuteState({ muteStates: e, unmuteOptions: t }) {
8998
9044
  if (!e) return;
8999
9045
  let n = async () => {
9000
- let n = Ha(e, Na.MUTE), r = Ha(e, Na.MUTE_PERMANENT);
9046
+ let n = Wa(e, Na.MUTE), r = Wa(e, Na.MUTE_PERMANENT);
9001
9047
  for (let i of [n, r]) i.length && await this._onMuteParticipant({
9002
9048
  muteStates: e,
9003
9049
  unmuteOptions: t,
@@ -9007,9 +9053,30 @@ var eo = 90, to = 3, no = class extends g {
9007
9053
  };
9008
9054
  M.setImmediate(() => n().catch((e) => this._debug.error(e)));
9009
9055
  }
9010
- _getStatusByTransportState(e) {
9011
- let t = null;
9012
- return e === K.CONNECTED ? t = P.CONNECTED : e === K.CONNECTING || e === K.OPENED ? t = P.CONNECTING : e === K.RECONNECTING && (t = P.RECONNECT), t;
9056
+ _remoteParticipantSessionState(e, t) {
9057
+ if (!(!N.enableSessionStateUpdates || this._isMe(e))) return t;
9058
+ }
9059
+ _buildConnectionStatus(e, t, n) {
9060
+ return Ba.create({
9061
+ transport: Ba.fromTransportState(n) ?? P.WAITING,
9062
+ sessionState: this._remoteParticipantSessionState(e, t),
9063
+ sessionStateApplicable: this._isParticipantSessionStateApplicable(e)
9064
+ });
9065
+ }
9066
+ _isParticipantSessionStateApplicable(e) {
9067
+ return N.enableSessionStateUpdates && !this._isMe(e) && this._conversation?.topology === K.SERVER;
9068
+ }
9069
+ _setTransportStatus(e, t) {
9070
+ return Ba.setTransport(e.connectionStatus, t);
9071
+ }
9072
+ _setSessionState(e, t) {
9073
+ let n = Ba.setSessionStateApplicable(e.connectionStatus, this._isParticipantSessionStateApplicable(e.id));
9074
+ this._emitParticipantTransition(e, n);
9075
+ let r = e.connectionStatus.sessionStateApplicable && e.id === this._activeSpeakerId && e.connectionStatus.transport === P.CONNECTED, i = Ba.setSessionState(e.connectionStatus, t, r);
9076
+ return this._emitParticipantTransition(e, i), i;
9077
+ }
9078
+ _emitParticipantTransition(e, t, n = null) {
9079
+ t.shouldNotify && R.onRemoteStatus([e.externalId], t.status, n);
9013
9080
  }
9014
9081
  _registerParticipantInCache(e) {
9015
9082
  return this._participants[e.id] = e, e;
@@ -9017,8 +9084,14 @@ var eo = 90, to = 3, no = class extends g {
9017
9084
  async _getExistedParticipantByIdOrCreate(e) {
9018
9085
  let t = (await this._getParticipants())[e];
9019
9086
  if (t) return t;
9020
- let n = this._api.getDecorativeIdByInitialId(M.decomposeId(e).id), r = n ? M.composeUserId(n) : void 0;
9021
- return this._createParticipant({ id: e }, r);
9087
+ let n = this._api.getDecorativeIdByInitialId(M.decomposeId(e).id), r = n ? M.composeUserId(n) : void 0, i = await this._getParticipantId(e), { deviceIdx: a } = M.decomposeParticipantId(e);
9088
+ return this._createParticipant({
9089
+ id: e,
9090
+ externalId: {
9091
+ ...i,
9092
+ deviceIdx: a
9093
+ }
9094
+ }, r, !1);
9022
9095
  }
9023
9096
  async _getExternalIdByParticipantId(e) {
9024
9097
  if (this._isMe(e)) return this._conversation?.externalId;
@@ -9030,9 +9103,6 @@ var eo = 90, to = 3, no = class extends g {
9030
9103
  return this._api.cacheExternalId(e, t), t;
9031
9104
  }
9032
9105
  }
9033
- _getExternalIdsByOkIdsFromCache(e) {
9034
- return e.map((e) => this._api.getCachedExternalIdByOkId(e) ?? Z.fromId(String(e)));
9035
- }
9036
9106
  async _registerParticipantAndSetMarkersIfChunkEnabled(e, t) {
9037
9107
  if (N.useParticipantListChunk) {
9038
9108
  let n = this._registerParticipantInCache(await this._getExistedParticipantByIdOrCreate(e));
@@ -9057,11 +9127,11 @@ var eo = 90, to = 3, no = class extends g {
9057
9127
  this._onRoomSwitched(t, !0);
9058
9128
  }
9059
9129
  _processMuteStates(e, t = !1) {
9060
- let n = Ua(e);
9130
+ let n = Ga(e);
9061
9131
  this._setMuteStatesForRoomId(n, null);
9062
9132
  for (let t of e.rooms?.rooms ?? []) this._setMuteStatesForRoomId(t.muteStates, t.id);
9063
9133
  let r = this._getMuteStatesForCurrentRoom();
9064
- t && (r = qa(e, r));
9134
+ t && (r = Ya(e, r));
9065
9135
  let i = Object.keys(r), a = this._conversation?.roomId;
9066
9136
  i.length && this._onMuteParticipant({
9067
9137
  muteStates: r,
@@ -9081,15 +9151,15 @@ var eo = 90, to = 3, no = class extends g {
9081
9151
  }
9082
9152
  async _allocateTransport() {
9083
9153
  if (!this._conversation || !this._mediaSource) return;
9084
- this._transport = new $i(this._conversation.topology, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._stats.logger, this._stats.statAggregator, this._stats.codecStatsAggregator), this._debugInfo = new no(this._debug), this.subscribe(this._transport, J.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(this._transport, J.LOCAL_STATE_CHANGED, this._onTransportLocalStateChanged.bind(this)), this.subscribe(this._transport, J.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(this._transport, J.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(this._transport, J.AUDIO_MIX_STALL, this._onAudioMixStall.bind(this)), this.subscribe(this._transport, J.REMOTE_DATA_STATS, this._onRemoteDataStats.bind(this)), this.subscribe(this._transport, J.SIGNALLED_STALLED_PARTICIPANTS, this._onRemoteSignalledStall.bind(this)), this.subscribe(this._transport, J.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this)), this.subscribe(this._transport, J.NETWORK_STATUS, this._onNetworkStatus.bind(this)), this.subscribe(this._transport, J.REMOTE_STREAM_SECOND, this._onRemoteStreamSecond.bind(this)), this.subscribe(this._transport, J.PEER_CONNECTION_CLOSED, this._onPeerConnectionClosed.bind(this)), this.subscribe(this._transport, J.ASR_TRANSCRIPTION, this._onAsrTranscription.bind(this)), this.subscribe(this._transport, J.ANIMOJI_STREAM, this._onAnimojiStream.bind(this)), this.subscribe(this._transport, J.ANIMOJI_ERROR, this._onAnimojiError.bind(this));
9154
+ this._transport = new Yi(this._conversation.topology, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._stats.logger, this._stats.statAggregator, this._stats.codecStatsAggregator), this._debugInfo = new io(this._debug), this.subscribe(this._transport, J.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(this._transport, J.LOCAL_STATE_CHANGED, this._onTransportLocalStateChanged.bind(this)), this.subscribe(this._transport, J.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(this._transport, J.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(this._transport, J.AUDIO_MIX_STALL, this._onAudioMixStall.bind(this)), this.subscribe(this._transport, J.REMOTE_DATA_STATS, this._onRemoteDataStats.bind(this)), this.subscribe(this._transport, J.SIGNALLED_STALLED_PARTICIPANTS, this._onRemoteSignalledStall.bind(this)), this.subscribe(this._transport, J.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this)), this.subscribe(this._transport, J.NETWORK_STATUS, this._onNetworkStatus.bind(this)), this.subscribe(this._transport, J.REMOTE_STREAM_SECOND, this._onRemoteStreamSecond.bind(this)), this.subscribe(this._transport, J.PEER_CONNECTION_CLOSED, this._onPeerConnectionClosed.bind(this)), this.subscribe(this._transport, J.ASR_TRANSCRIPTION, this._onAsrTranscription.bind(this)), this.subscribe(this._transport, J.ANIMOJI_STREAM, this._onAnimojiStream.bind(this)), this.subscribe(this._transport, J.ANIMOJI_ERROR, this._onAnimojiError.bind(this));
9085
9155
  let e = this._conversation.direction === Y.OUTGOING && !this._conversation.concurrent, t = await this._getParticipants();
9086
9156
  for (let n of Object.values(t)) (n.state === X.ACCEPTED || n.state === X.CALLED) && this._transport.allocate(n.id, e);
9087
9157
  }
9088
9158
  _createSpeakerDetector() {
9089
- this._transport && this._conversation && (this._volumesDetector = new lo(this._transport), this.subscribe(this._volumesDetector, co.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this._speakerDetector = new fo(this._volumesDetector, this._transport, this._conversation.topology), this.subscribe(this._speakerDetector, uo.SPEAKER_CHANGED, this._onSpeakerChanged.bind(this)), this._localVolumeDetector = new oo(this._mediaSource));
9159
+ this._transport && this._conversation && (this._volumesDetector = new fo(this._transport), this.subscribe(this._volumesDetector, uo.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this._speakerDetector = new mo(this._volumesDetector, this._transport, this._conversation.topology), this.subscribe(this._speakerDetector, po.SPEAKER_CHANGED, this._onSpeakerChanged.bind(this)), this._localVolumeDetector = new co(this._mediaSource));
9090
9160
  }
9091
9161
  async _createSpecListener() {
9092
- this._transport && this._volumesDetector && (this._specListener = new po(this._transport, this._volumesDetector, await this._getParticipants(), this._debug, this._stats.logger));
9162
+ this._transport && this._volumesDetector && (this._specListener = new ho(this._transport, this._volumesDetector, await this._getParticipants(), this._debug, this._stats.logger));
9093
9163
  }
9094
9164
  _logDevices() {
9095
9165
  let e = O.getCameras().length, t = O.getMicrophones().length;
@@ -9143,6 +9213,8 @@ var eo = 90, to = 3, no = class extends g {
9143
9213
  async _onAddParticipant(e, t, n) {
9144
9214
  this._debug.debug(`Add new participant [${e}]`);
9145
9215
  let r = await this._getParticipant(e);
9216
+ r && this._updateParticipantExternalId(r, t);
9217
+ let i = !r;
9146
9218
  if (r && (r.state === X.ACCEPTED || r.state === X.CALLED)) {
9147
9219
  this._debug.warn(`Participant [${r.id}:${r.state}] is already in conversation`);
9148
9220
  return;
@@ -9155,17 +9227,18 @@ var eo = 90, to = 3, no = class extends g {
9155
9227
  mediaSettings: k(t.mediaSettings),
9156
9228
  state: t.state,
9157
9229
  roles: t.roles || [],
9230
+ connectionStatus: this._buildConnectionStatus(e, t.sessionState, this._transport?.getState()),
9158
9231
  muteStates: t.muteStates || {},
9159
9232
  unmuteOptions: t.unmuteOptions || [],
9160
9233
  observedIds: t.observedIds || []
9161
9234
  }, n), r = await this._getParticipant(e);
9162
9235
  }
9163
- this._setParticipantsStatus([r], P.WAITING), n ? (r.state = X.HUNGUP, await this._removeParticipant(r, n)) : this._transport && (r.state = X.CALLED, this._transport.allocate(r.id, !0), this._stats.logger.log(E.ADD_PARTICIPANT), this._invokeRolesChangedCallbackIfNeeded(r));
9236
+ this._setParticipantsStatus([r], P.WAITING), i && this._emitParticipantEffectiveStatusIfSessionOverridesTransport(r), n ? (r.state = X.HUNGUP, await this._removeParticipant(r, n)) : this._transport && (r.state = X.CALLED, this._transport.allocate(r.id, !0), this._stats.logger.log(E.ADD_PARTICIPANT), this._invokeRolesChangedCallbackIfNeeded(r));
9164
9237
  }
9165
9238
  async _onRemoveParticipant(e) {
9166
9239
  this._debug.debug(`Remove participant [${e}]`);
9167
9240
  let t = [], n = await this._getParticipants();
9168
- for (let r = 0; r <= Eo; r++) {
9241
+ for (let r = 0; r <= Oo; r++) {
9169
9242
  let i = n[M.compose(e, r)];
9170
9243
  i && t.push(i);
9171
9244
  }
@@ -9287,7 +9360,7 @@ var eo = 90, to = 3, no = class extends g {
9287
9360
  }
9288
9361
  await this._stopStreaming(e.value), t[e.value] = { stopStream: !0 };
9289
9362
  }
9290
- if (this._transport?.getTopology() !== q.SERVER) {
9363
+ if (this._transport?.getTopology() !== K.SERVER) {
9291
9364
  n.forEach((e) => e());
9292
9365
  return;
9293
9366
  }
@@ -9364,7 +9437,7 @@ var eo = 90, to = 3, no = class extends g {
9364
9437
  });
9365
9438
  }
9366
9439
  }
9367
- if (r && r.length && (this._debug.warn("Could not allocate one or more participants", r), t)) throw new Do("Could not allocate one or more participants", r);
9440
+ if (r && r.length && (this._debug.warn("Could not allocate one or more participants", r), t)) throw new ko("Could not allocate one or more participants", r);
9368
9441
  }
9369
9442
  async _cleanupCooldownQueue() {
9370
9443
  let e = {}, t = this._cooldownTimestampByStreamDescription.entries();
@@ -9372,7 +9445,7 @@ var eo = 90, to = 3, no = class extends g {
9372
9445
  let n = t.next();
9373
9446
  if (n.done) break;
9374
9447
  let r = n.value;
9375
- if (r[1] + To > Date.now()) break;
9448
+ if (r[1] + Do > Date.now()) break;
9376
9449
  let i = r[0];
9377
9450
  await this._stopStreaming(i), e[i] = { stopStream: !0 };
9378
9451
  } while (!0);
@@ -9409,8 +9482,11 @@ var eo = 90, to = 3, no = class extends g {
9409
9482
  R.onChatRoomUpdated(e, t, l, [], []);
9410
9483
  return;
9411
9484
  }
9412
- c.length && l.push(...this._getExternalIdsByOkIdsFromCache(c));
9413
- let u = this._getExternalIdsByOkIdsFromCache(o), d = this._getExternalIdsByOkIdsFromCache(s);
9485
+ if (c.length) {
9486
+ let e = await this._api.getExternalIdsByOkIds(c);
9487
+ l.push(...e);
9488
+ }
9489
+ let u = await this._api.getExternalIdsByOkIds(o), d = await this._api.getExternalIdsByOkIds(s);
9414
9490
  R.onChatRoomUpdated(e, t, l, u, d);
9415
9491
  }
9416
9492
  async _onSharedMovieUpdate(e) {
@@ -9617,10 +9693,10 @@ var eo = 90, to = 3, no = class extends g {
9617
9693
  this._signaling.ready && this._conversation && (this._conversation.mediaModifiers = e, await this._signaling.updateMediaModifiers(e));
9618
9694
  }
9619
9695
  async enableVideoSuspend(e) {
9620
- this._signaling.ready && this._conversation && this._transport?.getTopology() === q.SERVER && await this._signaling.enableVideoSuspend(e);
9696
+ this._signaling.ready && this._conversation && this._transport?.getTopology() === K.SERVER && await this._signaling.enableVideoSuspend(e);
9621
9697
  }
9622
9698
  async enableVideoSuspendSuggest(e) {
9623
- this._signaling.ready && this._conversation && this._transport?.getTopology() === q.SERVER && await this._signaling.enableVideoSuspendSuggest(e);
9699
+ this._signaling.ready && this._conversation && this._transport?.getTopology() === K.SERVER && await this._signaling.enableVideoSuspendSuggest(e);
9624
9700
  }
9625
9701
  async changeOptions(e) {
9626
9702
  if (this._signaling.ready && this._conversation) {
@@ -9632,14 +9708,14 @@ var eo = 90, to = 3, no = class extends g {
9632
9708
  async getWaitingHall(e, t, n) {
9633
9709
  if (!this._signaling) return Promise.reject();
9634
9710
  let r = null;
9635
- if (e && (r = Va(e), r)) {
9711
+ if (e && (r = Ua(e), r)) {
9636
9712
  let e = this._api.getDecorativeIdByInitialId(r.id);
9637
9713
  r.id = e ? M.composeUserId(e) : r.id;
9638
9714
  }
9639
9715
  let i = await this._signaling.getWaitingHall(r, t, n);
9640
9716
  if (i.error) return Promise.reject(i.message);
9641
9717
  let a = i.participants || [], { externalIds: o } = await this._resolveWaitingHallExternalIds(a), s = null;
9642
- return a.length && i.hasMore && (s = Ba(a[a.length - 1].id)), {
9718
+ return a.length && i.hasMore && (s = Ha(a[a.length - 1].id)), {
9643
9719
  participants: o,
9644
9720
  pageMarker: s,
9645
9721
  totalCount: i.totalCount || 0
@@ -9654,7 +9730,7 @@ var eo = 90, to = 3, no = class extends g {
9654
9730
  let t = Z.fromSignaling(e.externalId);
9655
9731
  n.push(e.id.addedTs), r.push(t), this._api.cacheExternalId(e.id.id, t);
9656
9732
  } else i.push(M.decomposeId(e.id.id).id);
9657
- }), i.length && !r.length && (r = this._getExternalIdsByOkIdsFromCache(i), n = r.map((e) => {
9733
+ }), i.length && !r.length && (r = await this._api.getExternalIdsByOkIds(i), n = r.map((e) => {
9658
9734
  let n = this._api.getCachedOkIdByExternalId(e);
9659
9735
  return (n ? t.get(n) : void 0) || Date.now();
9660
9736
  }));
@@ -9830,7 +9906,7 @@ var eo = 90, to = 3, no = class extends g {
9830
9906
  participantState: M.mapParticipantState(e),
9831
9907
  state: e.state,
9832
9908
  roles: e.roles || [],
9833
- status: this._getStatusByTransportState(i) ?? P.WAITING,
9909
+ connectionStatus: this._buildConnectionStatus(t, e.sessionState, i),
9834
9910
  muteStates: e.muteStates || {},
9835
9911
  unmuteOptions: e.unmuteOptions || [],
9836
9912
  observedIds: e.observedIds || [],
@@ -9846,8 +9922,8 @@ var eo = 90, to = 3, no = class extends g {
9846
9922
  await this._registerParticipants(i);
9847
9923
  let a = this._transport?.getState();
9848
9924
  return n.participants.forEach((e) => {
9849
- let t = r[M.composeId(e)];
9850
- t.status = this._getStatusByTransportState(a) ?? P.WAITING, t.movieShareInfos = e.movieShareInfos, Object.assign(t.mediaSettings, k(e.mediaSettings)), Object.assign(t.muteStates, e.muteStates), t.unmuteOptions = e.unmuteOptions ?? t.unmuteOptions, this._openTransport([t], !0);
9925
+ let t = M.composeId(e), n = r[t];
9926
+ this._updateParticipantExternalId(n, e), this._setSessionState(n, this._remoteParticipantSessionState(t, e.sessionState)), this._setTransportStatus(n, Ba.fromTransportState(a) ?? P.WAITING), n.movieShareInfos = e.movieShareInfos, Object.assign(n.mediaSettings, k(e.mediaSettings)), Object.assign(n.muteStates, e.muteStates), n.unmuteOptions = e.unmuteOptions ?? n.unmuteOptions, this._openTransport([n], !0);
9851
9927
  }), this._participantListChunkToExternalChunk(n);
9852
9928
  }
9853
9929
  async _getInitialParticiapntListChunk() {
@@ -9861,7 +9937,7 @@ var eo = 90, to = 3, no = class extends g {
9861
9937
  _onLocalMediaStreamChanged(e) {
9862
9938
  if (!this._conversation || !this._mediaSource) return;
9863
9939
  let t = this._mediaSource.getMediaSettings();
9864
- this._debug.debug("Local media stream changed", t), e.kind === A.audio && this._mediaSource && (this._audioFix = new Ya(this._mediaSource, this._debug, this._stats.logger)), R.onLocalStreamUpdate(t, e.kind), !this._conversation?.waitingHall && !this._conversation?.observer && !this._isAudienceModeListener() && this._changeMediaSettings(t);
9940
+ this._debug.debug("Local media stream changed", t), e.kind === A.audio && this._mediaSource && (this._audioFix = new Za(this._mediaSource, this._debug, this._stats.logger)), R.onLocalStreamUpdate(t, e.kind), !this._conversation?.waitingHall && !this._conversation?.observer && !this._isAudienceModeListener() && this._changeMediaSettings(t);
9865
9941
  }
9866
9942
  _onScreenSharingStatus(e) {
9867
9943
  let t = this._mediaSource?.getMediaSettings();
@@ -9930,6 +10006,7 @@ var eo = 90, to = 3, no = class extends g {
9930
10006
  case G.CLOSED_CONVERSATION: return this._onClosedConversation(e);
9931
10007
  case G.MEDIA_SETTINGS_CHANGED: return this._onMediaSettingsChanged(e);
9932
10008
  case G.PARTICIPANT_STATE_CHANGED: return this._onParticipantStateChanged(e);
10009
+ case G.SESSION_STATE: return this._onSessionState(e);
9933
10010
  case G.PARTICIPANTS_STATE_CHANGED: return this._onParticipantsStateChanged(e);
9934
10011
  case G.RATE_CALL_DATA: return this._onNeedRate();
9935
10012
  case G.FEATURE_SET_CHANGED: return this._onFeatureSetChanged(e);
@@ -9987,7 +10064,7 @@ var eo = 90, to = 3, no = class extends g {
9987
10064
  if (this._isMe(e)) {
9988
10065
  Ra(this._conversation.roles, i) || this._onRolesChanged(e, i), t = () => {
9989
10066
  this._registerParticipantLocalMuteState({
9990
- muteStates: Ka(n),
10067
+ muteStates: Ja(n),
9991
10068
  unmuteOptions: n.unmuteOptions
9992
10069
  });
9993
10070
  };
@@ -10001,6 +10078,7 @@ var eo = 90, to = 3, no = class extends g {
10001
10078
  mediaSettings: n.mediaSettings
10002
10079
  });
10003
10080
  else {
10081
+ this._updateParticipantSessionState(a, e, n.sessionState);
10004
10082
  let t = k(n.mediaSettings);
10005
10083
  Wt(t, a.mediaSettings) || await this._changeRemoteMediaSettings(e, t);
10006
10084
  let r = M.mapParticipantState(n), o = a.participantState;
@@ -10010,12 +10088,14 @@ var eo = 90, to = 3, no = class extends g {
10010
10088
  let i = await this._getParticipants();
10011
10089
  for (let e of n) r.indexOf(e) < 0 && i[e] && this._removeParticipant(i[e], _.HUNGUP);
10012
10090
  }
10013
- let n = e.rooms?.roomId ?? null;
10091
+ let n = [...e.participants?.participants ?? [], ...e.rooms?.rooms.flatMap((e) => e.participants?.participants ?? []) ?? []];
10092
+ await this._reconcileParticipantSessionStates(n);
10093
+ let r = e.rooms?.roomId ?? null;
10014
10094
  if (!this._conversation) {
10015
10095
  this._debug.warn("Conversation is empty, but should be filled");
10016
10096
  return;
10017
10097
  }
10018
- this._conversation.roomId === n ? this._processMuteStates(e, !0) : await this._onRoomSwitched(n), t?.(), this._processRecordInfos(e), this._onOptionsChanged(e.conversation.options);
10098
+ this._conversation.roomId === r ? this._processMuteStates(e, !0) : await this._onRoomSwitched(r), t?.(), this._processRecordInfos(e), this._onOptionsChanged(e.conversation.options);
10019
10099
  }
10020
10100
  _onSignalingFailed(e) {
10021
10101
  this._debug.error("Signaling failed", e), this._close(e);
@@ -10059,9 +10139,45 @@ var eo = 90, to = 3, no = class extends g {
10059
10139
  }
10060
10140
  this._transport && this._transport.close(t), n.state = e.reason === _.REJECTED ? X.REJECTED : X.HUNGUP, this._state !== "CLOSE" && this._removeParticipant(n, e.reason ?? _.HUNGUP);
10061
10141
  }
10142
+ async _onSessionState(e) {
10143
+ if (!N.enableSessionStateUpdates) return;
10144
+ let t = M.composeMessageId(e);
10145
+ if (this._isMe(t)) return;
10146
+ await this._registerParticipantAndSetMarkersIfChunkEnabled(t, e.markers);
10147
+ let n = await this._getParticipant(t);
10148
+ if (!n) {
10149
+ this._warnParticipantNotInConversation(t);
10150
+ return;
10151
+ }
10152
+ if (e.connected) {
10153
+ let e = Ba.fromTransportState(this._transport?.getState());
10154
+ e && this._setTransportStatus(n, e);
10155
+ }
10156
+ this._setSessionState(n, { connected: e.connected });
10157
+ }
10158
+ async _reconcileParticipantSessionStates(e) {
10159
+ if (!N.enableSessionStateUpdates || !e.length) return;
10160
+ let t = await this._getParticipants();
10161
+ for (let n of e) {
10162
+ let e = M.composeId(n), r = t[e];
10163
+ r && !this._isMe(e) && (this._updateParticipantExternalId(r, n), this._updateParticipantSessionState(r, e, n.sessionState));
10164
+ }
10165
+ }
10166
+ _updateParticipantExternalId(e, t) {
10167
+ let n = Z.fromSignalingParticipant(t) ?? Z.fromSignalingParticipant(t, !1);
10168
+ n && (e.externalId = n, this._api.cacheExternalId(e.id, n));
10169
+ }
10170
+ _updateParticipantSessionState(e, t, n) {
10171
+ return this._setSessionState(e, this._remoteParticipantSessionState(t, n));
10172
+ }
10173
+ _emitParticipantEffectiveStatusIfSessionOverridesTransport(e) {
10174
+ e.connectionStatus.sessionState?.connected !== !1 || e.connectionStatus.lastEffective === e.connectionStatus.transport || R.onRemoteStatus([e.externalId], e.connectionStatus.lastEffective);
10175
+ }
10062
10176
  async _onAddedParticipant(e) {
10063
10177
  this._debug.debug(`Participant added [${e.participantId}]`);
10064
10178
  let t = M.composeMessageId(e), n = await this._getParticipant(t);
10179
+ n && this._updateParticipantExternalId(n, e.participant);
10180
+ let r = !n;
10065
10181
  if (n && n.state !== X.HUNGUP && n.state !== X.REJECTED) {
10066
10182
  this._debug.debug(`Participant [${t}] is already in conversation and is active`);
10067
10183
  return;
@@ -10075,16 +10191,19 @@ var eo = 90, to = 3, no = class extends g {
10075
10191
  state: r.state,
10076
10192
  participantState: M.mapParticipantState(r),
10077
10193
  roles: r.roles || [],
10194
+ connectionStatus: this._buildConnectionStatus(t, r.sessionState, this._transport?.getState()),
10078
10195
  muteStates: r.muteStates || {},
10079
10196
  unmuteOptions: r.unmuteOptions || [],
10080
10197
  observedIds: r.observedIds || []
10081
10198
  }, i), n = await this._getParticipant(t);
10082
10199
  }
10083
- n.state = X.CALLED, n.mediaSettings = k(e.participant?.mediaSettings), n.participantState = M.mapParticipantState(e.participant), n.roles = e.participant?.roles || [], this._setParticipantsStatus([n], P.WAITING), this._state !== "IDLE" && this._transport && this._transport.allocate(n.id, !0), R.onParticipantAdded(n.externalId, n.markers), await this._changeRemoteMediaSettings(t, n.mediaSettings), await this._changeRemoteParticipantState(t, n.participantState), this._invokeRolesChangedCallbackIfNeeded(n);
10200
+ n.state = X.CALLED, n.mediaSettings = k(e.participant?.mediaSettings), n.participantState = M.mapParticipantState(e.participant), n.roles = e.participant?.roles || [], this._updateParticipantSessionState(n, t, e.participant.sessionState), this._setParticipantsStatus([n], P.WAITING), r && this._emitParticipantEffectiveStatusIfSessionOverridesTransport(n), this._state !== "IDLE" && this._transport && this._transport.allocate(n.id, !0), R.onParticipantAdded(n.externalId, n.markers), await this._changeRemoteMediaSettings(t, n.mediaSettings), await this._changeRemoteParticipantState(t, n.participantState), this._invokeRolesChangedCallbackIfNeeded(n);
10084
10201
  }
10085
10202
  async _onJoinedParticipant(e) {
10086
10203
  this._debug.debug(`Participant joined [${e.participantId}]`), this._statFirstMediaReceived.markOnJoin(this._transport?.getTopology());
10087
10204
  let t = M.composeMessageId(e), n = await this._getParticipant(t);
10205
+ n && this._updateParticipantExternalId(n, e.participant);
10206
+ let r = !n;
10088
10207
  if (n && n.state === X.ACCEPTED) {
10089
10208
  this._debug.warn(`Participant [${t}] is already in conversation and is active`);
10090
10209
  return;
@@ -10102,14 +10221,15 @@ var eo = 90, to = 3, no = class extends g {
10102
10221
  movieShareInfos: r.movieShareInfos,
10103
10222
  unmuteOptions: r.unmuteOptions || [],
10104
10223
  observedIds: r.observedIds || [],
10224
+ connectionStatus: this._buildConnectionStatus(t, r.sessionState, this._transport?.getState()),
10105
10225
  markers: this._denormalizeMarkers(t, r.markers)
10106
10226
  }, i), n = await this._getParticipant(t);
10107
10227
  }
10108
- this._conversation && this._conversation.direction === Y.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), n.state = X.ACCEPTED, n.mediaSettings = k(e.mediaSettings), n.participantState = M.mapParticipantState(e.participant), n.roles = e.participant.roles || [], this._transport?.isAllocated(n.id) ? this._setParticipantsStatus([n], P.CONNECTED) : this._setParticipantsStatus([n], P.WAITING), this._state !== "IDLE" && this._transport && (this._transport.isAllocated(n.id) || this._transport.allocate(n.id, !0), this._transport.open([n.id], null, !!this._conversation?.observer)), R.onParticipantJoined(n.externalId, n.markers), await this._changeRemoteMediaSettings(t, n.mediaSettings), await this._changeRemoteParticipantState(t, n.participantState), this._invokeRolesChangedCallbackIfNeeded(n);
10109
- let r = Object.keys(n.muteStates);
10110
- r.length && this._onMuteParticipant({
10228
+ this._conversation && this._conversation.direction === Y.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), n.state = X.ACCEPTED, n.mediaSettings = k(e.mediaSettings), n.participantState = M.mapParticipantState(e.participant), n.roles = e.participant.roles || [], this._updateParticipantSessionState(n, t, e.participant.sessionState), this._transport?.isAllocated(n.id) ? this._setParticipantsStatus([n], P.CONNECTED) : this._setParticipantsStatus([n], P.WAITING), r && this._emitParticipantEffectiveStatusIfSessionOverridesTransport(n), this._state !== "IDLE" && this._transport && (this._transport.isAllocated(n.id) || this._transport.allocate(n.id, !0), this._transport.open([n.id], null, !!this._conversation?.observer)), R.onParticipantJoined(n.externalId, n.markers), await this._changeRemoteMediaSettings(t, n.mediaSettings), await this._changeRemoteParticipantState(t, n.participantState), this._invokeRolesChangedCallbackIfNeeded(n);
10229
+ let i = Object.keys(n.muteStates);
10230
+ i.length && this._onMuteParticipant({
10111
10231
  muteStates: n.muteStates,
10112
- mediaOptions: r,
10232
+ mediaOptions: i,
10113
10233
  stateUpdated: !0,
10114
10234
  participantId: t
10115
10235
  }), await this._processSharedMovieInfos(n.movieShareInfos);
@@ -10162,7 +10282,7 @@ var eo = 90, to = 3, no = class extends g {
10162
10282
  screenSharing: e.screenSharing,
10163
10283
  fastScreenSharing: e.fastScreenSharing
10164
10284
  };
10165
- this._serverSettings = xr(this._serverSettings, t), this._transport && this._transport.updateSettings(this._serverSettings);
10285
+ this._serverSettings = vr(this._serverSettings, t), this._transport && this._transport.updateSettings(this._serverSettings);
10166
10286
  }
10167
10287
  _onVideoQualityUpdate(e) {
10168
10288
  this._debug.debug("Got video quality update notification", e);
@@ -10178,7 +10298,7 @@ var eo = 90, to = 3, no = class extends g {
10178
10298
  camera: Object.assign({}, this._serverSettings.camera, t),
10179
10299
  screenSharing: null,
10180
10300
  fastScreenSharing: null
10181
- }, this._serverSettings = xr(this._serverSettings, n), this._transport && this._transport.updateSettings(this._serverSettings);
10301
+ }, this._serverSettings = vr(this._serverSettings, n), this._transport && this._transport.updateSettings(this._serverSettings);
10182
10302
  }
10183
10303
  async _onPeerRegistered(e) {
10184
10304
  let t = M.composeMessageId(e), n = await this._getParticipant(t);
@@ -10294,7 +10414,7 @@ var eo = 90, to = 3, no = class extends g {
10294
10414
  async _onRolesChanged(e, t) {
10295
10415
  if (this._conversation && this._isMe(e) && !Ra(this._conversation.roles, t)) {
10296
10416
  this._debug.debug(`Local roles changed: ${t}`), this._conversation.roles = t, R.onLocalRolesChanged(t), this._processMuteState({
10297
- mediaOptions: Ha(this._getMuteStatesForCurrentRoom(), Na.MUTE_PERMANENT),
10417
+ mediaOptions: Wa(this._getMuteStatesForCurrentRoom(), Na.MUTE_PERMANENT),
10298
10418
  stateUpdated: !0
10299
10419
  }), M.includesOneOf(t, [La.ADMIN, La.CREATOR]) ? this._refreshRooms(!0) : t.length || this._onRoomSwitched(null);
10300
10420
  return;
@@ -10396,7 +10516,7 @@ var eo = 90, to = 3, no = class extends g {
10396
10516
  if (this._isMe(r) || r === "") e = this._conversation.networkRating;
10397
10517
  else if (n[r]) e = n[r].networkRating;
10398
10518
  else continue;
10399
- if (e !== i) if (this._isMe(r) || r === "") this._conversation.networkRating = i, Vr.getInstance().value = i, R.onLocalNetworkStatusChanged(i);
10519
+ if (e !== i) if (this._isMe(r) || r === "") this._conversation.networkRating = i, Rr.getInstance().value = i, R.onLocalNetworkStatusChanged(i);
10400
10520
  else {
10401
10521
  let e = n[r];
10402
10522
  e.networkRating = i, t.push({
@@ -10433,7 +10553,7 @@ var eo = 90, to = 3, no = class extends g {
10433
10553
  }
10434
10554
  }
10435
10555
  _onPeerConnectionClosed(e) {
10436
- e === q.SERVER && this._cleanupParticipantAgnosticStreams(), this._audioOutput.destroy();
10556
+ e === K.SERVER && this._cleanupParticipantAgnosticStreams(), this._audioOutput.destroy();
10437
10557
  }
10438
10558
  _changeFeatureSet() {
10439
10559
  if (this._conversation) {
@@ -10459,34 +10579,50 @@ var eo = 90, to = 3, no = class extends g {
10459
10579
  R.onVolumesDetected(t);
10460
10580
  }
10461
10581
  async _onSpeakerChanged(e) {
10462
- this._activeSpeakerId = e;
10463
- let t = await this._getParticipant(e);
10464
- t && this._lastSignalledActiveSpeakerId !== e && (R.onSpeakerChanged(t.externalId), this._lastSignalledActiveSpeakerId = e);
10582
+ let t = this._activeSpeakerId;
10583
+ if (this._activeSpeakerId = e, t && t !== e) {
10584
+ let e = await this._getParticipant(t);
10585
+ if (e?.connectionStatus.sessionStateConnectedBySpeaker) {
10586
+ e.connectionStatus.sessionStateConnectedBySpeaker = !1;
10587
+ let t = this._setTransportStatus(e, e.connectionStatus.transport);
10588
+ this._emitParticipantTransition(e, t);
10589
+ }
10590
+ }
10591
+ let n = await this._getParticipant(e);
10592
+ if (n) {
10593
+ if (n.connectionStatus.sessionStateApplicable && n.connectionStatus.sessionState?.connected === !1) {
10594
+ let e = Ba.fromTransportState(this._transport?.getState());
10595
+ e && this._setTransportStatus(n, e), n.connectionStatus.sessionStateConnectedBySpeaker = !0;
10596
+ let t = this._setTransportStatus(n, n.connectionStatus.transport);
10597
+ this._emitParticipantTransition(n, t);
10598
+ }
10599
+ this._lastSignalledActiveSpeakerId !== e && (R.onSpeakerChanged(n.externalId), this._lastSignalledActiveSpeakerId = e);
10600
+ }
10465
10601
  }
10466
10602
  async _onTransportStateChanged(e, t) {
10467
10603
  this._debug.debug(`Transport state has changed: ${t}`, e);
10468
- let n = this._getStatusByTransportState(t);
10604
+ let n = Ba.fromTransportState(t);
10469
10605
  if (!n) return;
10470
10606
  let r = await this._getParticipants(), i = [], a = e.reduce((e, n) => {
10471
10607
  if (n in r) {
10472
10608
  let a = r[n];
10473
- e.push(a), t === K.CONNECTED && (a.remoteStream || (a.mediaSettings && this._changeRemoteMediaSettings(n, a.mediaSettings), this._changeRemoteParticipantState(n, a.participantState)), i.push(...Object.values(a.lastRequestedLayouts)));
10609
+ e.push(a), t === W.CONNECTED && (a.remoteStream || (a.mediaSettings && this._changeRemoteMediaSettings(n, a.mediaSettings), this._changeRemoteParticipantState(n, a.participantState)), i.push(...Object.values(a.lastRequestedLayouts)));
10474
10610
  } else this._warnParticipantNotInConversation(n);
10475
10611
  return e;
10476
10612
  }, []);
10477
10613
  a.length && (this._updateDisplayLayoutFromCache(i), this._setParticipantsStatus(a, n));
10478
10614
  }
10479
10615
  async _onTransportLocalStateChanged(e) {
10480
- if (this._debug.debug(`Local transport state has changed: ${e}`), e === K.CONNECTED && (O.releaseFirefoxMicrophonePermissionWarmup(), R.onLocalStatus(P.CONNECTED), this._transport?.getTopology() === q.SERVER)) {
10616
+ if (this._debug.debug(`Local transport state has changed: ${e}`), e === W.CONNECTED && (O.releaseFirefoxMicrophonePermissionWarmup(), R.onLocalStatus(P.CONNECTED), this._transport?.getTopology() === K.SERVER)) {
10481
10617
  let e = Object.values(this._myLastRequestedLayouts);
10482
10618
  await this.updateDisplayLayout(e), this._displayLayoutRequester.resend();
10483
10619
  }
10484
- e === K.CONNECTING && R.onLocalStatus(P.CONNECTING), e === K.RECONNECTING && R.onLocalStatus(P.RECONNECT), e === K.FAILED && this._transport && this._transport.allocated().length === 0 && (this._signaling.ready && await this._signaling.hangup(_.FAILED), this._close(new v(_.FAILED), "Transport failed"));
10620
+ e === W.CONNECTING && R.onLocalStatus(P.CONNECTING), e === W.RECONNECTING && R.onLocalStatus(P.RECONNECT), e === W.FAILED && this._transport && this._transport.allocated().length === 0 && (this._signaling.ready && await this._signaling.hangup(_.FAILED), this._close(new v(_.FAILED), "Transport failed"));
10485
10621
  }
10486
10622
  async _onRemoteTrackAdded(e, t, n) {
10487
- if (e.endsWith(Lr.AUDIO_MIX)) this._debug.debug("Remote audio mix track added"), this._audioOutput.add(e, n), R.onRemoteMixedAudioStream(t);
10488
- else if (e.startsWith(Lr.TRANSPARENT_AUDIO_TRACK_PREFIX)) this._debug.debug(`Remote transparent audio track added: ${e}`), this._audioOutput.add(e, n);
10489
- else if (e.startsWith(Lr.PARTICIPANT_AGNOSTIC_TRACK_PREFIX)) this._debug.debug(`Participant-agnostic track added: ${e}`), this._streamByStreamId.set(e, t);
10623
+ if (e.endsWith(Pr.AUDIO_MIX)) this._debug.debug("Remote audio mix track added"), this._audioOutput.add(e, n), R.onRemoteMixedAudioStream(t);
10624
+ else if (e.startsWith(Pr.TRANSPARENT_AUDIO_TRACK_PREFIX)) this._debug.debug(`Remote transparent audio track added: ${e}`), this._audioOutput.add(e, n);
10625
+ else if (e.startsWith(Pr.PARTICIPANT_AGNOSTIC_TRACK_PREFIX)) this._debug.debug(`Participant-agnostic track added: ${e}`), this._streamByStreamId.set(e, t);
10490
10626
  else {
10491
10627
  this._debug.debug(`Remote track added on the participant [${e}]`, { kind: n.kind });
10492
10628
  let r = await this._getParticipant(e);
@@ -10513,7 +10649,7 @@ var eo = 90, to = 3, no = class extends g {
10513
10649
  }
10514
10650
  }
10515
10651
  async _removeAudioTrack(e, t, n) {
10516
- if (e !== Lr.AUDIO_MIX) {
10652
+ if (e !== Pr.AUDIO_MIX) {
10517
10653
  let n = await this._getParticipant(e);
10518
10654
  if (!n || n.remoteStream && n.remoteStream !== t) return;
10519
10655
  }
@@ -10521,7 +10657,15 @@ var eo = 90, to = 3, no = class extends g {
10521
10657
  }
10522
10658
  _removeVideoTrack(e, t, n) {}
10523
10659
  _onTopologyChanged(e) {
10524
- this._statFirstMediaReceived.markTopologyChanged(e), e === q.DIRECT && (this._onRemoteSignalledStall([]), this._onAudioMixStall(!1)), this._conversation && (this._conversation.topology = e, this._changeFeatureSet(), this._forceOpenTransportForAloneInCall()), this._audioOutput.destroy();
10660
+ if (this._statFirstMediaReceived.markTopologyChanged(e), e === K.DIRECT && (this._onRemoteSignalledStall([]), this._onAudioMixStall(!1)), this._conversation) {
10661
+ this._conversation.topology = e;
10662
+ for (let e of Object.values(this._participants)) {
10663
+ let t = Ba.setSessionStateApplicable(e.connectionStatus, this._isParticipantSessionStateApplicable(e.id));
10664
+ this._emitParticipantTransition(e, t);
10665
+ }
10666
+ this._changeFeatureSet(), this._forceOpenTransportForAloneInCall();
10667
+ }
10668
+ this._audioOutput.destroy();
10525
10669
  }
10526
10670
  _onAudioMixStall(e) {
10527
10671
  this._audioMixStalled !== e && (this._audioMixStalled = e, this._debug.debug("Audio mix stalled:", e), R.onLocalStatus(e ? P.RECONNECT : P.CONNECTED));
@@ -10560,7 +10704,7 @@ var eo = 90, to = 3, no = class extends g {
10560
10704
  }), R.onJoinStatus(t, e));
10561
10705
  }
10562
10706
  async _updateDisplayLayoutFromCache(e) {
10563
- if (this._transport?.getTopology() === q.SERVER && e.length) try {
10707
+ if (this._transport?.getTopology() === K.SERVER && e.length) try {
10564
10708
  await this.updateDisplayLayout(e);
10565
10709
  } catch (e) {
10566
10710
  this._debug.warn(`_updateDisplayLayoutFromCache failed: ${e}`);
@@ -10568,8 +10712,12 @@ var eo = 90, to = 3, no = class extends g {
10568
10712
  }
10569
10713
  _setParticipantsStatus(e, t, n = null) {
10570
10714
  if (!e.length) return;
10571
- let r = e.reduce((e, n) => (n.status !== t && (n.status = t, e.push(n.externalId)), e), []);
10572
- r.length && R.onRemoteStatus(r, t, n);
10715
+ let r = e.reduce((e, n) => {
10716
+ var r;
10717
+ let i = this._setTransportStatus(n, t);
10718
+ return i.shouldNotify && (e[r = i.status] ?? (e[r] = [])).push(n.externalId), e;
10719
+ }, {});
10720
+ for (let [e, t] of Object.entries(r)) t.length && R.onRemoteStatus(t, e, n);
10573
10721
  }
10574
10722
  _onJoinLinkChanged(e) {
10575
10723
  this._conversation && e.joinLink && (this._conversation.joinLink = e.joinLink), R.onJoinLinkChanged(e.joinLink);
@@ -10610,7 +10758,7 @@ var eo = 90, to = 3, no = class extends g {
10610
10758
  };
10611
10759
  }
10612
10760
  async _onRoomParticipantsUpdated(e) {
10613
- let t = this._transport?.getState(), n = e.roomId ?? null, r = e.addedParticipantIds?.map((e) => M.decomposeId(e).id) || [], i = this._getExternalIdsByOkIdsFromCache(r), a = e.addedParticipants;
10761
+ let t = this._transport?.getState(), n = e.roomId ?? null, r = e.addedParticipantIds?.map((e) => M.decomposeId(e).id) || [], i = await this._api.getExternalIdsByOkIds(r), a = e.addedParticipants;
10614
10762
  if (i.length && a?.length !== i.length && !this._isCalledState()) {
10615
10763
  let e = this._convertExternalIdsToServerExternalIds(i);
10616
10764
  a = (await this._signaling.getParticipants(e)).participants;
@@ -10624,7 +10772,7 @@ var eo = 90, to = 3, no = class extends g {
10624
10772
  participantState: M.mapParticipantState(e),
10625
10773
  state: e.state,
10626
10774
  roles: e.roles || [],
10627
- status: this._getStatusByTransportState(t) ?? P.WAITING,
10775
+ connectionStatus: this._buildConnectionStatus(r, e.sessionState, t),
10628
10776
  muteStates: e.muteStates || {},
10629
10777
  unmuteOptions: e.unmuteOptions || [],
10630
10778
  observedIds: e.observedIds || [],
@@ -10633,7 +10781,7 @@ var eo = 90, to = 3, no = class extends g {
10633
10781
  }, e.decorativeUserId);
10634
10782
  }) || []), s = !1;
10635
10783
  for (let e of o) e.id === this._conversation?.compositeUserId && (s = !0), this._registerParticipantInCache(e);
10636
- this._transport?.getState() === K.IDLE && !this._isCalledState() && this._openTransport(o, !0);
10784
+ this._transport?.getState() === W.IDLE && !this._isCalledState() && this._openTransport(o, !0);
10637
10785
  let c = [], l = [];
10638
10786
  if (e?.removedParticipantMarkers) {
10639
10787
  for (let t of e.removedParticipantMarkers) if (t.GRID?.id) {
@@ -10723,7 +10871,7 @@ var eo = 90, to = 3, no = class extends g {
10723
10871
  }
10724
10872
  }
10725
10873
  _onVideoSuspendSuggest(e) {
10726
- !this._conversation || this._conversation.topology !== q.SERVER || (this._debug.debug("Video suspend suggested", e), R.onVideoSuspendSuggest(e.bandwidth));
10874
+ !this._conversation || this._conversation.topology !== K.SERVER || (this._debug.debug("Video suspend suggested", e), R.onVideoSuspendSuggest(e.bandwidth));
10727
10875
  }
10728
10876
  _isMe(e) {
10729
10877
  return e === this._conversation?.compositeUserId;
@@ -10738,7 +10886,7 @@ var eo = 90, to = 3, no = class extends g {
10738
10886
  this._conversation?.muteStates.set(t, e);
10739
10887
  }
10740
10888
  _forceOpenTransportForAloneInCall() {
10741
- this._transport?.getTopology() === q.SERVER && this._transport?.getState() === K.IDLE && !this._isCalledState() && this._transport.open(this._transport.allocated(), null, !!this._conversation?.observer, !0);
10889
+ this._transport?.getTopology() === K.SERVER && this._transport?.getState() === W.IDLE && !this._isCalledState() && this._transport.open(this._transport.allocated(), null, !!this._conversation?.observer, !0);
10742
10890
  }
10743
10891
  _registerParticipant(e, t) {
10744
10892
  let n = this._createParticipant(e, t);
@@ -10767,19 +10915,19 @@ var eo = 90, to = 3, no = class extends g {
10767
10915
  }
10768
10916
  };
10769
10917
  h(Q, "_current", void 0), h(Q, "_activationMutex", void 0), h(Q, "_delayedHangup", !1), h(Q, "_abortController", null);
10770
- var Do = class e extends Error {
10918
+ var ko = class e extends Error {
10771
10919
  constructor(t, n) {
10772
10920
  super(t), h(this, "participantErrors", void 0), Object.setPrototypeOf(this, e.prototype), this.participantErrors = n;
10773
10921
  }
10774
- }, Oo = null, ko = null;
10775
- function Ao() {
10776
- Oo = null, ko = null;
10922
+ }, Ao = null, jo = null;
10923
+ function Mo() {
10924
+ Ao = null, jo = null;
10777
10925
  }
10778
- function jo(e) {
10926
+ function No(e) {
10779
10927
  return e?.endsWith("/") ? e.slice(0, -1) : e;
10780
10928
  }
10781
- async function Mo(e = null, t) {
10782
- let n = jo(e ?? N.apiBaseUrl);
10929
+ async function Po(e = null, t) {
10930
+ let n = No(e ?? N.apiBaseUrl);
10783
10931
  if (n) return n;
10784
10932
  if ((t ?? N.apiEnv) !== "AUTO") return N.apiEndpoint(t);
10785
10933
  try {
@@ -10794,20 +10942,20 @@ async function Mo(e = null, t) {
10794
10942
  return z.warn("Failed to resolve API endpoint using DNS, default is used", e), N.apiEndpoint(t);
10795
10943
  }
10796
10944
  }
10797
- async function No() {
10798
- return Oo || ko || (ko = Mo(), Oo = await ko, ko = null, Oo);
10945
+ async function Fo() {
10946
+ return Ao || jo || (jo = Po(), Ao = await jo, jo = null, Ao);
10799
10947
  }
10800
- async function Po(e, t = {}, n = !1) {
10948
+ async function Io(e, t = {}, n = !1) {
10801
10949
  if (!window.Blob || !window.navigator.sendBeacon) return;
10802
- await No();
10803
- let r = Ro(e, t, n), i = new window.Blob([r], { type: "application/x-www-form-urlencoded" });
10804
- window.navigator.sendBeacon(`${Oo}/fb.do`, i);
10950
+ await Fo();
10951
+ let r = Bo(e, t, n), i = new window.Blob([r], { type: "application/x-www-form-urlencoded" });
10952
+ window.navigator.sendBeacon(`${Ao}/fb.do`, i);
10805
10953
  }
10806
- async function Fo(e, t = {}, n = !1, r) {
10807
- return await No(), Io(Ro(e, t, n), r);
10954
+ async function Lo(e, t = {}, n = !1, r) {
10955
+ return await Fo(), Ro(Bo(e, t, n), r);
10808
10956
  }
10809
- async function Io(e, t) {
10810
- let n = `${t ?? Oo}/fb.do`, r = new AbortController(), i = setTimeout(() => r.abort(new v(_.NETWORK_ERROR)), N.apiTimeout), a = await fetch(n, {
10957
+ async function Ro(e, t) {
10958
+ let n = `${t ?? Ao}/fb.do`, r = new AbortController(), i = setTimeout(() => r.abort(new v(_.NETWORK_ERROR)), N.apiTimeout), a = await fetch(n, {
10811
10959
  method: "POST",
10812
10960
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
10813
10961
  body: e,
@@ -10823,7 +10971,7 @@ async function Io(e, t) {
10823
10971
  if (!a.ok || Object.hasOwn(s, "error_msg")) throw s;
10824
10972
  return s;
10825
10973
  }
10826
- async function Lo(e, t) {
10974
+ async function zo(e, t) {
10827
10975
  try {
10828
10976
  let n = await fetch(e, {
10829
10977
  method: "POST",
@@ -10836,7 +10984,7 @@ async function Lo(e, t) {
10836
10984
  throw z.warn("Failed to send form data", e), e;
10837
10985
  }
10838
10986
  }
10839
- function Ro(e, t = {}, n = !1) {
10987
+ function Bo(e, t = {}, n = !1) {
10840
10988
  t.method = e, t.format = "JSON", t.application_key || (t.application_key = N.apiKey), n || (C.sessionKey ? t.session_key = C.sessionKey : C.accessToken && (t.access_token = C.accessToken));
10841
10989
  for (let [e, n] of Object.entries(t)) typeof n == "object" && (t[e] = JSON.stringify(n));
10842
10990
  let r = "";
@@ -10845,7 +10993,7 @@ function Ro(e, t = {}, n = !1) {
10845
10993
  }
10846
10994
  //#endregion
10847
10995
  //#region src/abstract/BaseApi.ts
10848
- var zo = class {
10996
+ var Vo = class {
10849
10997
  constructor() {
10850
10998
  h(this, "_abortSignal", void 0);
10851
10999
  }
@@ -10870,9 +11018,6 @@ var zo = class {
10870
11018
  getCachedRawOkIdByExternalId(e) {
10871
11019
  return null;
10872
11020
  }
10873
- getCachedExternalIdByOkId(e) {
10874
- return null;
10875
- }
10876
11021
  cacheExternalId(e, t) {}
10877
11022
  mapDecorativeId(e, t) {}
10878
11023
  unmapDecorativeId(e) {}
@@ -10886,7 +11031,7 @@ var zo = class {
10886
11031
  return Date.now();
10887
11032
  }
10888
11033
  cleanup() {}
10889
- }, Bo = class {
11034
+ }, Ho = class {
10890
11035
  constructor() {
10891
11036
  h(this, "_okIdToExternalId", /* @__PURE__ */ new Map()), h(this, "_externalIdToOkId", /* @__PURE__ */ new Map()), h(this, "_decorativeIdToInitialId", /* @__PURE__ */ new Map()), h(this, "_initialIdToDecorativeId", /* @__PURE__ */ new Map());
10892
11037
  }
@@ -10931,19 +11076,19 @@ var zo = class {
10931
11076
  clear() {
10932
11077
  this._okIdToExternalId.clear(), this._externalIdToOkId.clear(), this._decorativeIdToInitialId.clear(), this._initialIdToDecorativeId.clear();
10933
11078
  }
10934
- }, Vo = "anonymLogin:", Ho = 700, Uo = 3e3, Wo = class extends zo {
11079
+ }, Uo = "anonymLogin:", Wo = 700, Go = 3e3, Ko = class extends Vo {
10935
11080
  constructor(...e) {
10936
- super(...e), h(this, "_userId", null), h(this, "_uuid", void 0), h(this, "_idCache", new Bo());
11081
+ super(...e), h(this, "_userId", null), h(this, "_uuid", void 0), h(this, "_idCache", new Ho());
10937
11082
  }
10938
11083
  async _callUnsafe(e, t = {}, n = !1) {
10939
11084
  let r = async (i) => {
10940
11085
  try {
10941
- return await Fo(e, t, n);
11086
+ return await Lo(e, t, n);
10942
11087
  } catch (t) {
10943
11088
  if (!Object.hasOwn(t, "error_msg")) {
10944
11089
  i++;
10945
11090
  let n = Object.getOwnPropertyNames(t).map((e) => `${e}: ${JSON.stringify(t[e])}`);
10946
- if (z.debug(`${e} network error, attempt ${i}: ${n.join("\n ")}`), this._abortSignal?.aborted && (z.debug(`${e} aborted`), this._abortSignal.throwIfAborted()), i < N.apiMaxAttempt) return await M.delay(Math.min(i * Ho, Uo), { signal: this._abortSignal }), r(i);
11091
+ if (z.debug(`${e} network error, attempt ${i}: ${n.join("\n ")}`), this._abortSignal?.aborted && (z.debug(`${e} aborted`), this._abortSignal.throwIfAborted()), i < N.apiMaxAttempt) return await M.delay(Math.min(i * Wo, Go), { signal: this._abortSignal }), r(i);
10947
11092
  }
10948
11093
  throw z.warn(e, "error", t), t;
10949
11094
  }
@@ -10966,7 +11111,7 @@ var zo = class {
10966
11111
  code: r.error_code
10967
11112
  };
10968
11113
  if (r instanceof v) throw r;
10969
- if (r.custom_error && (a.custom_error = r.custom_error), Go(r)) switch (r.error_code) {
11114
+ if (r.custom_error && (a.custom_error = r.custom_error), qo(r)) switch (r.error_code) {
10970
11115
  case 1101:
10971
11116
  i = _.SERVICE_DISABLED;
10972
11117
  break;
@@ -11001,7 +11146,7 @@ var zo = class {
11001
11146
  }
11002
11147
  async userId(e) {
11003
11148
  let t = M.extractOkId(e);
11004
- return C.isEmpty() ? Z.fromId(String(t)) : this._idCache.getExternalId(t) || Z.fromId(String(t));
11149
+ return C.isEmpty() ? Z.fromId(String(t)) : (this._idCache.hasByOkId(t) || await this._getExternalIdsByOkIds([t]), this._idCache.getExternalId(t) || Z.fromId(String(t)));
11005
11150
  }
11006
11151
  async authorize() {
11007
11152
  if (this._ensureUuid(), !N.apiKey) throw new v(w.API, { message: "Required argument apiAppKey not passed" });
@@ -11026,17 +11171,17 @@ var zo = class {
11026
11171
  });
11027
11172
  }
11028
11173
  _getAnonymLoginCacheKey() {
11029
- return N.authToken ? `${Vo}${N.authToken}` : null;
11174
+ return N.authToken ? `${Uo}${N.authToken}` : null;
11030
11175
  }
11031
11176
  _getCachedAnonymLogin() {
11032
11177
  let e = this._getAnonymLoginCacheKey();
11033
11178
  if (!e) return null;
11034
11179
  let t = ot.get(e);
11035
- return Ko(t) ? t : (t && ot.remove(e), null);
11180
+ return Jo(t) ? t : (t && ot.remove(e), null);
11036
11181
  }
11037
11182
  _setCachedAnonymLogin(e) {
11038
11183
  let t = this._getAnonymLoginCacheKey();
11039
- !t || !Ko(e) || ot.set(t, {
11184
+ !t || !Jo(e) || ot.set(t, {
11040
11185
  session_key: e.session_key,
11041
11186
  session_secret_key: e.session_secret_key,
11042
11187
  uid: e.uid
@@ -11057,7 +11202,7 @@ var zo = class {
11057
11202
  version: 1,
11058
11203
  items: e
11059
11204
  };
11060
- N.clientStatsPlatform && (t.platform = N.clientStatsPlatform), Po("vchat.clientStats", { data: JSON.stringify(t) });
11205
+ N.clientStatsPlatform && (t.platform = N.clientStatsPlatform), Io("vchat.clientStats", { data: JSON.stringify(t) });
11061
11206
  }
11062
11207
  logClientEvents(e) {
11063
11208
  let t = {
@@ -11067,7 +11212,7 @@ var zo = class {
11067
11212
  version: 1,
11068
11213
  items: e
11069
11214
  };
11070
- N.clientStatsPlatform && (t.platform = N.clientStatsPlatform), Po("vchat.clientEvents", { data: JSON.stringify(t) });
11215
+ N.clientStatsPlatform && (t.platform = N.clientStatsPlatform), Io("vchat.clientEvents", { data: JSON.stringify(t) });
11071
11216
  }
11072
11217
  async uploadDebugLogs(e, t, n, r) {
11073
11218
  let i = {
@@ -11078,7 +11223,7 @@ var zo = class {
11078
11223
  }, a = await this._callUnsafe("vchat.getLogUploadUrl", i), o = new FormData(), s = new Blob([r], { type: "application/json" });
11079
11224
  o.append("file", s, "log.json");
11080
11225
  let c = new URL(a.upload_url);
11081
- return c.searchParams.append("size", s.size.toString()), Lo(c.toString(), o);
11226
+ return c.searchParams.append("size", s.size.toString()), zo(c.toString(), o);
11082
11227
  }
11083
11228
  async joinConversation(e, t = !1, n) {
11084
11229
  let r = {
@@ -11170,15 +11315,22 @@ var zo = class {
11170
11315
  };
11171
11316
  return n?.length && (i.observedIds = n.join(",")), N.anonymToken && (i.anonymToken = N.anonymToken), r && (i.payload = r), this._call("vchat.joinConversationByLink", i);
11172
11317
  }
11318
+ async getExternalIdsByOkIds(e) {
11319
+ let t = [], n = [];
11320
+ for (let r of e) {
11321
+ let e = this._idCache.getExternalId(r);
11322
+ e ? t.push(e) : n.push(r);
11323
+ }
11324
+ if (!n.length) return t;
11325
+ let r = await this._getExternalIdsByOkIds(n);
11326
+ return Array.from(r.values());
11327
+ }
11173
11328
  getCachedOkIdByExternalId(e) {
11174
11329
  return this._idCache.getParticipantIdByExternalId(e);
11175
11330
  }
11176
11331
  getCachedRawOkIdByExternalId(e) {
11177
11332
  return this._idCache.getOkId(e);
11178
11333
  }
11179
- getCachedExternalIdByOkId(e) {
11180
- return this._idCache.getExternalId(e);
11181
- }
11182
11334
  cacheExternalId(e, t) {
11183
11335
  this._idCache.cache(e, t);
11184
11336
  }
@@ -11209,7 +11361,7 @@ var zo = class {
11209
11361
  conversationId: e,
11210
11362
  reason: t
11211
11363
  };
11212
- N.anonymToken && (n.anonymToken = N.anonymToken), Po("vchat.hangupConversation", n);
11364
+ N.anonymToken && (n.anonymToken = N.anonymToken), Io("vchat.hangupConversation", n);
11213
11365
  }
11214
11366
  async removeHistoryRecords(e) {
11215
11367
  await this._call("vchat.removeHistoryRecords", { recordIds: e.join(",") });
@@ -11217,23 +11369,46 @@ var zo = class {
11217
11369
  cleanup() {
11218
11370
  this._idCache.clear();
11219
11371
  }
11372
+ async _getExternalIdsByOkIds(e) {
11373
+ let t = /* @__PURE__ */ new Map();
11374
+ e = e.map((e) => this.getDecorativeIdByInitialId(e) ?? e);
11375
+ try {
11376
+ let n = await this._call("vchat.getExternalIdsByOkIds", { uids: e.join(",") }), r = (e, n) => {
11377
+ for (let [r, i] of Object.entries(e)) {
11378
+ let e = Number(r), a = Z.fromId(i, n);
11379
+ t.set(e, a), this.cacheExternalId(e, a);
11380
+ }
11381
+ };
11382
+ n.external_ids && r(n.external_ids, Va.USER), n.anonym_ids && r(n.anonym_ids, Va.ANONYM);
11383
+ for (let n of e) {
11384
+ let e = Number(n);
11385
+ if (!t.has(e)) {
11386
+ let n = Z.fromId(String(e));
11387
+ t.set(e, n), this.cacheExternalId(e, n);
11388
+ }
11389
+ }
11390
+ return t;
11391
+ } catch {
11392
+ return t;
11393
+ }
11394
+ }
11220
11395
  async getServerTime() {
11221
11396
  return (await this._call("system.getInfo")).serverTime;
11222
11397
  }
11223
11398
  };
11224
- function Go(e) {
11399
+ function qo(e) {
11225
11400
  return typeof e == "object" && !!e && "error_code" in e && "error_msg" in e;
11226
11401
  }
11227
- function Ko(e) {
11402
+ function Jo(e) {
11228
11403
  return typeof e == "object" && !!e && "session_key" in e && "session_secret_key" in e && typeof e.session_key == "string" && e.session_key.length > 0 && typeof e.session_secret_key == "string" && e.session_secret_key.length > 0;
11229
11404
  }
11230
11405
  //#endregion
11231
11406
  //#region src/enums/RecordRole.ts
11232
- var qo = /* @__PURE__ */ function(e) {
11407
+ var Yo = /* @__PURE__ */ function(e) {
11233
11408
  return e.KING = "KING", e.PAWN = "PAWN", e;
11234
- }(qo || {}), Jo = /* @__PURE__ */ function(e) {
11409
+ }(Yo || {}), Xo = /* @__PURE__ */ function(e) {
11235
11410
  return e.OFF = "0", e.ON = "1", e;
11236
- }({}), Yo = class {
11411
+ }({}), Zo = class {
11237
11412
  constructor(e) {
11238
11413
  h(this, "_queue", void 0), h(this, "_readCursor", void 0), h(this, "_writeCursor", void 0), h(this, "_moveReadCursor", void 0), h(this, "_left", void 0), this._queue = Array(e).fill(null), this._readCursor = this._writeCursor = this._left = 0, this._moveReadCursor = !1;
11239
11414
  }
@@ -11256,12 +11431,12 @@ var qo = /* @__PURE__ */ function(e) {
11256
11431
  let e = this._queue[this._readCursor];
11257
11432
  return e && (this._moveReadCursor = !1, this._queue[this._readCursor] = null, this._readCursor = this.nextCursor(this._readCursor), --this._left), e;
11258
11433
  }
11259
- }, Xo = class {
11434
+ }, Qo = class {
11260
11435
  constructor(e, t, n, r = null) {
11261
11436
  h(this, "_uuid", void 0), h(this, "_apiKey", void 0), h(this, "_callToken", void 0), h(this, "_apiEnv", void 0), h(this, "_baseApiUrl", void 0), h(this, "_sessionKey", void 0), this._uuid = M.uuid(), this._apiKey = t, this._callToken = n, this._apiEnv = e, this._baseApiUrl = r;
11262
11437
  }
11263
11438
  async authorize() {
11264
- let e = await Fo("auth.anonymLogin", {
11439
+ let e = await Lo("auth.anonymLogin", {
11265
11440
  session_data: {
11266
11441
  device_id: this._uuid,
11267
11442
  client_version: N.appVersion,
@@ -11270,18 +11445,18 @@ var qo = /* @__PURE__ */ function(e) {
11270
11445
  version: 3
11271
11446
  },
11272
11447
  application_key: this._apiKey
11273
- }, !0, await Mo(this._baseApiUrl, this._apiEnv));
11448
+ }, !0, await Po(this._baseApiUrl, this._apiEnv));
11274
11449
  return M.isObject(e) && !("error_msg" in e) ? (this._sessionKey = e.session_key, !0) : !1;
11275
11450
  }
11276
11451
  async hangupConversation(e) {
11277
- await Fo("vchat.hangupConversation", {
11452
+ await Lo("vchat.hangupConversation", {
11278
11453
  conversationId: e,
11279
11454
  reason: _.HUNGUP,
11280
11455
  application_key: this._apiKey,
11281
11456
  session_key: this._sessionKey
11282
- }, !0, await Mo(this._baseApiUrl, this._apiEnv));
11457
+ }, !0, await Po(this._baseApiUrl, this._apiEnv));
11283
11458
  }
11284
- }, $, Zo = null, Qo = {
11459
+ }, $, $o = null, es = {
11285
11460
  getCameras: O.getCameras,
11286
11461
  getMicrophones: O.getMicrophones,
11287
11462
  getOutput: O.getOutput,
@@ -11307,33 +11482,33 @@ var qo = /* @__PURE__ */ function(e) {
11307
11482
  baseChromeVersion: O.baseChromeVersion,
11308
11483
  getAudioContext: O.getAudioContext,
11309
11484
  isAudioShareSupported: O.isAudioShareSupported
11310
- }, $o = { participantMarkerCompare: M.participantMarkerCompare };
11311
- function es(e) {
11312
- Zo = e;
11485
+ }, ts = { participantMarkerCompare: M.participantMarkerCompare };
11486
+ function ns(e) {
11487
+ $o = e;
11313
11488
  }
11314
- function ts(e) {
11489
+ function rs(e) {
11315
11490
  N.videoEffects = e;
11316
11491
  }
11317
- function ns(e) {
11492
+ function is(e) {
11318
11493
  N.audioEffects = e;
11319
11494
  }
11320
- function rs(e, t = null, n = {}, r = 1) {
11495
+ function as(e, t = null, n = {}, r = 1) {
11321
11496
  N.vmoji = e, N.vmojiOptions = {
11322
11497
  protocolVersion: r,
11323
11498
  renderingOptions: n
11324
11499
  }, t && e.setSDK(t);
11325
11500
  }
11326
- async function is(t) {
11327
- if (N.set(t), $ || ($ = new Wo()), e.disableLog(!N.debug), z.toggle(N.debug), z.log(`Calls SDK ${N.sdkVersion}`, t), await O.init(), !O.isBrowserSupported()) throw new v(w.UNSUPPORTED);
11501
+ async function os(t) {
11502
+ if (N.set(t), $ || ($ = new Ko()), e.disableLog(!N.debug), z.toggle(N.debug), z.log(`Calls SDK ${N.sdkVersion}`, t), await O.init(), !O.isBrowserSupported()) throw new v(w.UNSUPPORTED);
11328
11503
  z.log("UserAgent:", navigator.userAgent), z.log("Screen resolution:", `${window.screen.width}x${window.screen.height}`), z.log("Permissions:", `Camera: ${O.hasCameraPermission()}, Mic: ${O.hasMicrophonePermission()}`), z.log("Simulcast:", `${t.simulcast} => ${N.simulcast}`);
11329
11504
  }
11330
- async function as(e, t = [T.AUDIO], n = "", r = !1, i = !1, a, o, s) {
11505
+ async function ss(e, t = [T.AUDIO], n = "", r = !1, i = !1, a, o, s) {
11331
11506
  let c = [];
11332
- return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]), os([], Da.USER, t, n, r, i, a, c, o, s);
11507
+ return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]), cs([], Da.USER, t, n, r, i, a, c, o, s);
11333
11508
  }
11334
- async function os(e, t = Da.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
11509
+ async function cs(e, t = Da.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
11335
11510
  if (Q.current()) throw z.error("There is already active call"), new v(_.FAILED);
11336
- return new Q($, Zo).onStart({
11511
+ return new Q($, $o).onStart({
11337
11512
  opponentIds: e,
11338
11513
  opponentType: t,
11339
11514
  mediaOptions: n,
@@ -11346,37 +11521,37 @@ async function os(e, t = Da.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
11346
11521
  conversationId: l
11347
11522
  });
11348
11523
  }
11349
- async function ss(e, t) {
11350
- return cs(e, j.USER, void 0, t);
11524
+ async function ls(e, t) {
11525
+ return us(e, j.USER, void 0, t);
11351
11526
  }
11352
- async function cs(e, t = j.USER, n, r, i, a) {
11527
+ async function us(e, t = j.USER, n, r, i, a) {
11353
11528
  if (e === Q.id()) throw Error("Push has already been processed");
11354
- return a && $.setUserId(a), new Q($, Zo).onPush(e, t, n, r, i);
11529
+ return a && $.setUserId(a), new Q($, $o).onPush(e, t, n, r, i);
11355
11530
  }
11356
- async function ls(e, t) {
11357
- return e && (N.authToken = e), t !== void 0 && N.apiBaseUrl !== t && (N.apiBaseUrl = t, Ao()), $.authorize();
11531
+ async function ds(e, t) {
11532
+ return e && (N.authToken = e), t !== void 0 && N.apiBaseUrl !== t && (N.apiBaseUrl = t, Mo()), $.authorize();
11358
11533
  }
11359
- async function us(e = [T.AUDIO]) {
11360
- return Pc().accept(e);
11534
+ async function fs(e = [T.AUDIO]) {
11535
+ return Ic().accept(e);
11361
11536
  }
11362
- async function ds() {
11537
+ async function ps() {
11363
11538
  let e = Q.current();
11364
11539
  if (e) return e.decline();
11365
11540
  }
11366
- async function fs(e, t = [T.AUDIO]) {
11367
- return ps(e, t);
11541
+ async function ms(e, t = [T.AUDIO]) {
11542
+ return hs(e, t);
11368
11543
  }
11369
- async function ps(e, t, n) {
11544
+ async function hs(e, t, n) {
11370
11545
  if (Q.current()) throw z.error("There is already active call"), new v(_.FAILED);
11371
- return new Q($, Zo).onJoin({
11546
+ return new Q($, $o).onJoin({
11372
11547
  conversationId: e,
11373
11548
  mediaOptions: t,
11374
11549
  chatId: n
11375
11550
  });
11376
11551
  }
11377
- async function ms(e, t = [T.AUDIO], n, r, i, a) {
11552
+ async function gs(e, t = [T.AUDIO], n, r, i, a) {
11378
11553
  if (Q.current()) throw z.error("There is already active call"), new v(_.FAILED);
11379
- return n && (N.anonymToken = n), new Q($, Zo).onJoin({
11554
+ return n && (N.anonymToken = n), new Q($, $o).onJoin({
11380
11555
  joinLink: e,
11381
11556
  mediaOptions: t,
11382
11557
  observedIds: r,
@@ -11384,31 +11559,31 @@ async function ms(e, t = [T.AUDIO], n, r, i, a) {
11384
11559
  onFastJoin: a
11385
11560
  });
11386
11561
  }
11387
- async function hs() {
11562
+ async function _s() {
11388
11563
  let e = Q.current();
11389
11564
  if (e) return e.hangup();
11390
11565
  Q.hangupAfterInit();
11391
11566
  }
11392
- async function gs(e, t) {
11567
+ async function vs(e, t) {
11393
11568
  let n = Array.isArray(e) ? e : [e], r = Q.current();
11394
11569
  r && await r.addParticipant(n, t);
11395
11570
  }
11396
- async function _s(e, t) {
11571
+ async function ys(e, t) {
11397
11572
  let n = Q.current();
11398
11573
  if (n) {
11399
11574
  let r = e.map((e) => M.composeUserId(e));
11400
11575
  await n.addParticipantLegacy(r, t);
11401
11576
  }
11402
11577
  }
11403
- async function vs(e, t = !1) {
11578
+ async function bs(e, t = !1) {
11404
11579
  let n = $.getCachedRawOkIdByExternalId(e);
11405
11580
  if (!n) {
11406
11581
  z.warn("removeParticipant: externalId not found in cache", e);
11407
11582
  return;
11408
11583
  }
11409
- return ys(n, t);
11584
+ return xs(n, t);
11410
11585
  }
11411
- async function ys(e, t = !1) {
11586
+ async function xs(e, t = !1) {
11412
11587
  let n = Q.current();
11413
11588
  if (n) try {
11414
11589
  await n.removeParticipant(M.composeUserId(e), t);
@@ -11416,13 +11591,13 @@ async function ys(e, t = !1) {
11416
11591
  z.warn(`Failed to remove participant ${e}. Perhaps he is no longer on the call. ${t}`);
11417
11592
  }
11418
11593
  }
11419
- async function bs(e, t) {
11594
+ async function Ss(e, t) {
11420
11595
  let n = Q.current();
11421
11596
  if (e === "videoinput" && jt.contains(t)) return N.videoFacingMode = t, n ? (O.isMobile() && n.stopVideoTrack(), n.changeDevice(e)) : void 0;
11422
11597
  if (!await O._saveDeviceId(e, t)) throw Error(`Device not found: ${t}`);
11423
11598
  if (n) return n.changeDevice(e);
11424
11599
  }
11425
- async function xs(e) {
11600
+ async function Cs(e) {
11426
11601
  let t = typeof e == "object" ? {
11427
11602
  ...e,
11428
11603
  fastScreenSharing: e.captureScreen && e.fastScreenSharing,
@@ -11434,31 +11609,31 @@ async function xs(e) {
11434
11609
  }, n = Q.current();
11435
11610
  return n ? n.toggleScreenCapturing(t) : Promise.reject();
11436
11611
  }
11437
- function Ss(e) {
11612
+ function ws(e) {
11438
11613
  let t = Q.current();
11439
11614
  t && t.toggleAnimojiCapturing(e);
11440
11615
  }
11441
- async function Cs(e, t = !1) {
11616
+ async function Ts(e, t = !1) {
11442
11617
  let n = Q.current();
11443
11618
  n && await n.setVideoStream(e, t);
11444
11619
  }
11445
- async function ws(e) {
11620
+ async function Es(e) {
11446
11621
  let t = Q.current();
11447
11622
  t && await t.toggleLocalVideo(e);
11448
11623
  }
11449
- async function Ts(e) {
11624
+ async function Ds(e) {
11450
11625
  let t = Q.current();
11451
11626
  t && await t.toggleLocalAudio(e);
11452
11627
  }
11453
- async function Es(e) {
11628
+ async function Os(e) {
11454
11629
  let t = Q.current();
11455
11630
  if (t) return t.setLocalResolution(e);
11456
11631
  }
11457
- async function Ds(e) {
11632
+ async function ks(e) {
11458
11633
  let t = Q.current();
11459
11634
  t && await t.changePriorities(e);
11460
11635
  }
11461
- async function Os(e, t) {
11636
+ async function As(e, t) {
11462
11637
  let n = Q.current();
11463
11638
  if (n) {
11464
11639
  let r;
@@ -11473,37 +11648,37 @@ async function Os(e, t) {
11473
11648
  await n.changeParticipantState(e, r);
11474
11649
  }
11475
11650
  }
11476
- async function ks(e) {
11651
+ async function js(e) {
11477
11652
  let t = Q.current();
11478
11653
  t && await t.hold(e);
11479
11654
  }
11480
- async function As() {
11655
+ async function Ms() {
11481
11656
  let e = Q.current();
11482
11657
  e && await e.putHandsDown();
11483
11658
  }
11484
- async function js(e) {
11659
+ async function Ns(e) {
11485
11660
  let t = Q.current();
11486
11661
  t && await t.updateDisplayLayout(e);
11487
11662
  }
11488
- async function Ms(e) {
11663
+ async function Ps(e) {
11489
11664
  let t = Q.current();
11490
11665
  t && await t.requestDisplayLayout(e);
11491
11666
  }
11492
- async function Ns(e, t, n = !1) {
11667
+ async function Fs(e, t, n = !1) {
11493
11668
  let r = $.getCachedRawOkIdByExternalId(e);
11494
11669
  if (!r) {
11495
11670
  z.warn("grantRoles: externalId not found in cache", e);
11496
11671
  return;
11497
11672
  }
11498
- return Ps(r, Z.getDeviceIdx(e), t, n);
11673
+ return Is(r, Z.getDeviceIdx(e), t, n);
11499
11674
  }
11500
- async function Ps(e, t, n, r = !1) {
11675
+ async function Is(e, t, n, r = !1) {
11501
11676
  let i = Q.current();
11502
11677
  i && await i.grantRoles(M.composeParticipantId(e, j.USER, t), n, r);
11503
11678
  }
11504
- async function Fs({ externalId: e = null, muteStates: t, requestedMedia: n = [], roomId: r = null }) {
11679
+ async function Ls({ externalId: e = null, muteStates: t, requestedMedia: n = [], roomId: r = null }) {
11505
11680
  let i = null;
11506
- return e && (i = $.getCachedRawOkIdByExternalId(e), i || z.warn("muteParticipant: externalId not found in cache", e)), Is({
11681
+ return e && (i = $.getCachedRawOkIdByExternalId(e), i || z.warn("muteParticipant: externalId not found in cache", e)), Rs({
11507
11682
  uid: i,
11508
11683
  muteStates: t,
11509
11684
  requestedMedia: n,
@@ -11511,75 +11686,75 @@ async function Fs({ externalId: e = null, muteStates: t, requestedMedia: n = [],
11511
11686
  roomId: r
11512
11687
  });
11513
11688
  }
11514
- async function Is({ uid: e = null, muteStates: t, requestedMedia: n = [], deviceIdx: r = 0, roomId: i = null }) {
11689
+ async function Rs({ uid: e = null, muteStates: t, requestedMedia: n = [], deviceIdx: r = 0, roomId: i = null }) {
11515
11690
  let a = Q.current();
11516
11691
  if (a) {
11517
11692
  let o = e ? M.composeParticipantId(e, j.USER, r) : null;
11518
11693
  await a.muteParticipant(o, t, n, i);
11519
11694
  }
11520
11695
  }
11521
- async function Ls(e, t = !1, n = null) {
11696
+ async function zs(e, t = !1, n = null) {
11522
11697
  let r = $.getCachedRawOkIdByExternalId(e);
11523
11698
  if (!r) {
11524
11699
  z.warn("pinParticipant: externalId not found in cache", e);
11525
11700
  return;
11526
11701
  }
11527
- return Rs(r, t, Z.getDeviceIdx(e), n);
11702
+ return Bs(r, t, Z.getDeviceIdx(e), n);
11528
11703
  }
11529
- async function Rs(e, t = !1, n = 0, r = null) {
11704
+ async function Bs(e, t = !1, n = 0, r = null) {
11530
11705
  let i = Q.current();
11531
11706
  i && await i.pinParticipant(M.composeParticipantId(e, j.USER, n), t, r);
11532
11707
  }
11533
- async function zs(e) {
11708
+ async function Vs(e) {
11534
11709
  let t = Q.current();
11535
11710
  t && await t.updateMediaModifiers(e);
11536
11711
  }
11537
- async function Bs(e) {
11712
+ async function Hs(e) {
11538
11713
  let t = Q.current();
11539
11714
  t && await t.enableVideoSuspend(e);
11540
11715
  }
11541
- async function Vs(e) {
11716
+ async function Us(e) {
11542
11717
  let t = Q.current();
11543
11718
  t && await t.enableVideoSuspendSuggest(e);
11544
11719
  }
11545
- async function Hs(e) {
11720
+ async function Ws(e) {
11546
11721
  let t = Q.current();
11547
11722
  t && await t.changeOptions(e);
11548
11723
  }
11549
- async function Us(e, t = null) {
11724
+ async function Gs(e, t = null) {
11550
11725
  let n = null;
11551
- return t && (n = $.getCachedRawOkIdByExternalId(t), n || z.warn("chatMessage: externalId not found in cache", t)), Ws(e, n);
11726
+ return t && (n = $.getCachedRawOkIdByExternalId(t), n || z.warn("chatMessage: externalId not found in cache", t)), Ks(e, n);
11552
11727
  }
11553
- async function Ws(e, t = null) {
11728
+ async function Ks(e, t = null) {
11554
11729
  let n = Q.current();
11555
11730
  if (n) {
11556
11731
  let r = t ? M.composeUserId(t) : null;
11557
11732
  await n.chatMessage(e, r);
11558
11733
  }
11559
11734
  }
11560
- async function Gs(e = 10) {
11735
+ async function qs(e = 10) {
11561
11736
  let t = Q.current();
11562
11737
  if (t) return t.chatHistory(e);
11563
11738
  }
11564
- async function Ks(e, t = null) {
11739
+ async function Js(e, t = null) {
11565
11740
  let n = null;
11566
- return t && (n = $.getCachedRawOkIdByExternalId(t), n || z.warn("customData: externalId not found in cache", t)), qs(e, n, Z.getDeviceIdx(t));
11741
+ return t && (n = $.getCachedRawOkIdByExternalId(t), n || z.warn("customData: externalId not found in cache", t)), Ys(e, n, Z.getDeviceIdx(t));
11567
11742
  }
11568
- async function qs(e, t = null, n = 0) {
11743
+ async function Ys(e, t = null, n = 0) {
11569
11744
  let r = Q.current();
11570
11745
  if (r) {
11571
11746
  let i = t ? M.composeParticipantId(t, j.USER, n) : null;
11572
11747
  await r.customData(e, i);
11573
11748
  }
11574
11749
  }
11575
- async function Js(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, waitForAdmin: r = !1, closedConversation: i = !1 } = {}, a) {
11750
+ async function Xs(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, waitForAdmin: r = !1, closedConversation: i = !1 } = {}, a) {
11576
11751
  return (await $.createConversation(a ?? M.uuid(), e, t, {
11577
11752
  onlyAdminCanShareMovie: n,
11578
11753
  waitForAdmin: r,
11579
11754
  closedConversation: i
11580
11755
  })).join_link;
11581
11756
  }
11582
- async function Ys(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, audioOnly: r = !1 } = {}, i) {
11757
+ async function Zs(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, audioOnly: r = !1 } = {}, i) {
11583
11758
  let a = i.map((e) => Z.fromId(e));
11584
11759
  return (await $.createConversation(M.uuid(), e, t, {
11585
11760
  onlyAdminCanShareMovie: n,
@@ -11587,53 +11762,53 @@ async function Ys(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, audioOnly: r
11587
11762
  audioOnly: r
11588
11763
  }, a)).join_link;
11589
11764
  }
11590
- async function Xs() {
11765
+ async function Qs() {
11591
11766
  let e = Q.current();
11592
11767
  return e ? e.createJoinLink() : Promise.reject();
11593
11768
  }
11594
- async function Zs() {
11769
+ async function $s() {
11595
11770
  let e = Q.current();
11596
11771
  return e ? e.removeJoinLink() : Promise.reject();
11597
11772
  }
11598
- async function Qs(e, t) {
11773
+ async function ec(e, t) {
11599
11774
  return $.getAnonymTokenByLink(e, t);
11600
11775
  }
11601
- function $s(e) {
11776
+ function tc(e) {
11602
11777
  let t = Q.current();
11603
11778
  t && t.setVolume(e);
11604
11779
  }
11605
- function ec(e) {
11780
+ function nc(e) {
11606
11781
  N.forceRelayPolicy = e;
11607
11782
  }
11608
- async function tc(e = !1, t = null, n = null, r = "DIRECT_LINK", i = null, a = null) {
11783
+ async function rc(e = !1, t = null, n = null, r = "DIRECT_LINK", i = null, a = null) {
11609
11784
  let o = Q.current();
11610
11785
  return o ? o.startStream(e, t, n, r, i, a) : Promise.reject();
11611
11786
  }
11612
- async function nc(e = null, t) {
11787
+ async function ic(e = null, t) {
11613
11788
  let n = Q.current();
11614
11789
  return n ? n.stopStream(e, t) : Promise.reject();
11615
11790
  }
11616
- async function rc(e = null) {
11791
+ async function ac(e = null) {
11617
11792
  let t = Q.current();
11618
11793
  return t ? t.publishStream(e) : Promise.reject();
11619
11794
  }
11620
- async function ic() {
11795
+ async function oc() {
11621
11796
  let e = Q.current();
11622
11797
  return e ? e.getStreamInfo() : Promise.reject();
11623
11798
  }
11624
- async function ac(e) {
11799
+ async function sc(e) {
11625
11800
  let t = Q.current();
11626
11801
  return t ? t.addMovie(e) : Promise.reject();
11627
11802
  }
11628
- async function oc(e) {
11803
+ async function cc(e) {
11629
11804
  let t = Q.current();
11630
11805
  return t ? t.updateMovie(e) : Promise.reject();
11631
11806
  }
11632
- async function sc(e) {
11807
+ async function lc(e) {
11633
11808
  let t = Q.current();
11634
11809
  return t ? t.removeMovie(e) : Promise.reject();
11635
11810
  }
11636
- async function cc(e, t) {
11811
+ async function uc(e, t) {
11637
11812
  let n = Q.current();
11638
11813
  if (n) {
11639
11814
  let r = [];
@@ -11658,11 +11833,11 @@ async function cc(e, t) {
11658
11833
  }
11659
11834
  return Promise.reject();
11660
11835
  }
11661
- async function lc(e, t) {
11836
+ async function dc(e, t) {
11662
11837
  let n = Q.current();
11663
11838
  return n ? n.activateRooms(e, t) : Promise.reject();
11664
11839
  }
11665
- async function uc(e = null, t = null) {
11840
+ async function fc(e = null, t = null) {
11666
11841
  let n = Q.current();
11667
11842
  if (!n) return Promise.reject();
11668
11843
  let r;
@@ -11677,22 +11852,22 @@ async function uc(e = null, t = null) {
11677
11852
  }
11678
11853
  return n.switchRoom(e, r);
11679
11854
  }
11680
- async function dc(e) {
11855
+ async function pc(e) {
11681
11856
  let t = Q.current();
11682
11857
  return t ? t.removeRooms(e) : Promise.reject();
11683
11858
  }
11684
- function fc(e) {
11859
+ function mc(e) {
11685
11860
  N.statisticsInterval = e;
11686
11861
  let t = Q.current();
11687
11862
  if (t) return t.updateStatisticsInterval();
11688
11863
  }
11689
- function pc(t) {
11864
+ function hc(t) {
11690
11865
  e.disableLog(!t), z.toggle(t);
11691
11866
  }
11692
- function mc(e, ...t) {
11867
+ function gc(e, ...t) {
11693
11868
  N.debugLog && z.send(e, "[external]", ...t);
11694
11869
  }
11695
- var hc = {
11870
+ var _c = {
11696
11871
  list: Pe,
11697
11872
  get: Fe,
11698
11873
  getJson: Ie,
@@ -11700,7 +11875,7 @@ var hc = {
11700
11875
  clear: Re,
11701
11876
  stats: ze
11702
11877
  };
11703
- function gc() {
11878
+ function vc() {
11704
11879
  let e = [
11705
11880
  [`Calls SDK ${N.sdkVersion}`, N.toJSON()],
11706
11881
  ["UserAgent:", navigator.userAgent],
@@ -11717,31 +11892,31 @@ function gc() {
11717
11892
  d: e
11718
11893
  }));
11719
11894
  }
11720
- async function _c() {
11895
+ async function yc() {
11721
11896
  let e = Q.id(), t = Q.debugSessionId();
11722
11897
  if (!t || !e) throw z.error("[uploadDebugLogs]", "No conversation id found"), Error("No conversation id found");
11723
11898
  let n = await Fe({ sessionId: t });
11724
11899
  if (n.length === 0) throw z.error("[uploadDebugLogs]", "No logs found"), Error("No logs found");
11725
11900
  let r = n[0].t, i = n[n.length - 1].t;
11726
11901
  try {
11727
- return $?.uploadDebugLogs(e, r, i, JSON.stringify([...gc(), ...n]));
11902
+ return $?.uploadDebugLogs(e, r, i, JSON.stringify([...vc(), ...n]));
11728
11903
  } catch (e) {
11729
11904
  throw z.error("[uploadDebugLogs]", "Error while uploading logs", e), Error("Error while uploading logs", { cause: e });
11730
11905
  }
11731
11906
  }
11732
- async function vc(e) {
11907
+ async function bc(e) {
11733
11908
  let t = Q.current();
11734
11909
  if (t) return t.videoEffect(e);
11735
11910
  }
11736
- async function yc(e, t) {
11911
+ async function xc(e, t) {
11737
11912
  let n = Q.current();
11738
11913
  if (n) return n.audioEffect(e.length > 0 ? e : null, t);
11739
11914
  }
11740
- async function bc(e) {
11915
+ async function Sc(e) {
11741
11916
  let t = Q.current();
11742
11917
  t && await t.setAudioStream(e);
11743
11918
  }
11744
- async function xc(e, t = null, n = null) {
11919
+ async function Cc(e, t = null, n = null) {
11745
11920
  let r = Q.current();
11746
11921
  if (!r) return;
11747
11922
  let i = n ?? t?.id, a = null;
@@ -11752,18 +11927,18 @@ async function xc(e, t = null, n = null) {
11752
11927
  }
11753
11928
  r.setAnimojiSvg(e, a, i);
11754
11929
  }
11755
- function Sc(e) {
11930
+ function wc(e) {
11756
11931
  let t = Q.current();
11757
11932
  t && t.setAnimojiFill(e);
11758
11933
  }
11759
- async function Cc(e = null, t, n = !1) {
11760
- return Pc().getWaitingHall(e, t, n);
11934
+ async function Tc(e = null, t, n = !1) {
11935
+ return Ic().getWaitingHall(e, t, n);
11761
11936
  }
11762
- async function wc() {
11763
- return Pc().getAudienceModeHands();
11937
+ async function Ec() {
11938
+ return Ic().getAudienceModeHands();
11764
11939
  }
11765
- async function Tc(e, t = !1) {
11766
- let n = Pc(), r;
11940
+ async function Dc(e, t = !1) {
11941
+ let n = Ic(), r;
11767
11942
  if (e) {
11768
11943
  let t = $.getCachedRawOkIdByExternalId(e);
11769
11944
  if (!t) {
@@ -11774,65 +11949,65 @@ async function Tc(e, t = !1) {
11774
11949
  }
11775
11950
  return n.promoteParticipant(r, t);
11776
11951
  }
11777
- async function Ec(e = !1) {
11778
- return Pc().requestPromotion(e);
11952
+ async function Oc(e = !1) {
11953
+ return Ic().requestPromotion(e);
11779
11954
  }
11780
- async function Dc(e = !1) {
11781
- return Pc().acceptPromotion(e);
11955
+ async function kc(e = !1) {
11956
+ return Ic().acceptPromotion(e);
11782
11957
  }
11783
- async function Oc(e) {
11784
- return Pc().getParticipantListChunk(e);
11958
+ async function Ac(e) {
11959
+ return Ic().getParticipantListChunk(e);
11785
11960
  }
11786
- async function kc(e) {
11787
- return Pc().getParticipants(e);
11961
+ async function jc(e) {
11962
+ return Ic().getParticipants(e);
11788
11963
  }
11789
- async function Ac(e) {
11790
- return Pc().feedback(e);
11964
+ async function Mc(e) {
11965
+ return Ic().feedback(e);
11791
11966
  }
11792
- function jc(e, t, n) {
11793
- return Pc().userFeedbackStats(e, t, n);
11967
+ function Nc(e, t, n) {
11968
+ return Ic().userFeedbackStats(e, t, n);
11794
11969
  }
11795
- function Mc(e, t = {}, n = !1) {
11970
+ function Pc(e, t = {}, n = !1) {
11796
11971
  let r = Q.current();
11797
11972
  r && r.sendClientEvent(e, t, n);
11798
11973
  }
11799
- async function Nc(e, t) {
11800
- return Pc().enableFeatureForRoles(e, t);
11974
+ async function Fc(e, t) {
11975
+ return Ic().enableFeatureForRoles(e, t);
11801
11976
  }
11802
- function Pc() {
11977
+ function Ic() {
11803
11978
  let e = Q.current();
11804
11979
  if (!e) throw Error("Conversation not found");
11805
11980
  return e;
11806
11981
  }
11807
- async function Fc(e) {
11982
+ async function Lc(e) {
11808
11983
  await $.removeHistoryRecords(e);
11809
11984
  }
11810
- async function Ic(e) {
11985
+ async function Rc(e) {
11811
11986
  let t = Q.current();
11812
11987
  t && await t.startAsr(e);
11813
11988
  }
11814
- async function Lc(e) {
11989
+ async function zc(e) {
11815
11990
  let t = Q.current();
11816
11991
  t && await t.stopAsr(e);
11817
11992
  }
11818
- async function Rc(e) {
11993
+ async function Bc(e) {
11819
11994
  let t = Q.current();
11820
11995
  t && await t.requestAsr(e);
11821
11996
  }
11822
- async function zc(e) {
11997
+ async function Vc(e) {
11823
11998
  let t = Q.current();
11824
11999
  return t ? t.startUrlSharing(e) : Promise.reject();
11825
12000
  }
11826
- async function Bc() {
12001
+ async function Hc() {
11827
12002
  let e = Q.current();
11828
12003
  return e ? e.stopUrlSharing() : Promise.reject();
11829
12004
  }
11830
- function Vc() {
12005
+ function Uc() {
11831
12006
  return Q.getSyncedTime();
11832
12007
  }
11833
- function Hc() {
12008
+ function Wc() {
11834
12009
  return N.sdkVersion;
11835
12010
  }
11836
12011
  typeof window < "u" && (window.__CALLS_SDK = hn);
11837
12012
  //#endregion
11838
- export { Wo as Api, Xo as ApiExternal, Yo as ArrayDequeue, C as AuthData, f as BaseLogger, Y as CallDirection, Da as CallType, Oa as ChatRoomEventType, ka as ConversationFeature, Aa as ConversationOption, vn as DebugMessageType, za as ExternalIdType, jt as FacingMode, w as FatalError, v as HangupReason, _ as HangupType, T as MediaOption, A as MediaTrackKind, B as MediaType, Na as MuteState, X as ParticipantState, Jo as ParticipantStateDataValue, P as ParticipantStatus, qo as RecordRole, Pa as RoomsEventType, Ea as Signaling, y as SignalingCommandType, dr as SignalingConnectionType, G as SignalingNotification, q as TransportTopology, La as UserRole, j as UserType, ao as VolumeDetector, us as acceptCall, Dc as acceptPromotion, lc as activateRooms, ac as addMovie, gs as addParticipant, _s as addParticipantInternal, ls as authorize, Qo as browser, os as callInternal, as as callTo, xs as captureScreen, Ss as captureVmoji, yc as changeAudioEffect, Hs as changeConversationOptions, bs as changeDevice, Os as changeParticipantState, Ds as changePriorities, vc as changeVideoEffect, Gs as chatHistory, Us as chatMessage, Ws as chatMessageInternal, Xs as createJoinLink, Ks as customData, qs as customDataInternal, pc as debug, hc as debugLogs, mc as debugMessage, ds as declineCall, Nc as enableFeatureForRoles, Bs as enableVideoSuspend, Vs as enableVideoSuspendSuggest, Ac as feedback, ec as forceRelayPolicy, Qs as getAnonymTokenByLink, wc as getAudienceModeHands, Oc as getParticipantListChunk, kc as getParticipants, ic as getStreamInfo, Vc as getSyncedTime, Cc as getWaitingHall, Ns as grantRoles, Ps as grantRolesInternal, hs as hangup, ks as hold, is as init, fs as joinCall, ms as joinCallByLink, ps as joinCallInternal, Mc as logClientEvent, Fs as muteParticipant, Is as muteParticipantInternal, Ls as pinParticipant, Rs as pinParticipantInternal, ss as processPush, cs as processPushInternal, Tc as promoteParticipant, rc as publishStream, As as putHandsDown, Fc as removeHistoryRecords, Zs as removeJoinLink, sc as removeMovie, vs as removeParticipant, ys as removeParticipantInternal, dc as removeRooms, Rc as requestAsr, Ms as requestDisplayLayout, Ec as requestPromotion, ns as setAudioEffects, bc as setAudioStream, Es as setLocalResolution, es as setLogger, zs as setMediaModifiers, fc as setStatisticsInterval, ts as setVideoEffects, Cs as setVideoStream, rs as setVmoji, Sc as setVmojiFill, xc as setVmojiSvg, $s as setVolume, Ic as startAsr, Ys as startAudienceConversation, Js as startConversation, tc as startStream, zc as startUrlSharing, Lc as stopAsr, nc as stopStream, Bc as stopUrlSharing, uc as switchRoom, Ts as toggleLocalAudio, ws as toggleLocalVideo, js as updateDisplayLayout, oc as updateMovie, cc as updateRooms, _c as uploadDebugLogs, jc as userFeedbackStats, $o as utils, Hc as version };
12013
+ export { Ko as Api, Qo as ApiExternal, Zo as ArrayDequeue, C as AuthData, f as BaseLogger, Y as CallDirection, Da as CallType, Oa as ChatRoomEventType, ka as ConversationFeature, Aa as ConversationOption, vn as DebugMessageType, Va as ExternalIdType, jt as FacingMode, w as FatalError, v as HangupReason, _ as HangupType, T as MediaOption, A as MediaTrackKind, B as MediaType, Na as MuteState, X as ParticipantState, Xo as ParticipantStateDataValue, P as ParticipantStatus, Yo as RecordRole, Pa as RoomsEventType, Ea as Signaling, y as SignalingCommandType, oa as SignalingConnectionType, G as SignalingNotification, K as TransportTopology, La as UserRole, j as UserType, so as VolumeDetector, fs as acceptCall, kc as acceptPromotion, dc as activateRooms, sc as addMovie, vs as addParticipant, ys as addParticipantInternal, ds as authorize, es as browser, cs as callInternal, ss as callTo, Cs as captureScreen, ws as captureVmoji, xc as changeAudioEffect, Ws as changeConversationOptions, Ss as changeDevice, As as changeParticipantState, ks as changePriorities, bc as changeVideoEffect, qs as chatHistory, Gs as chatMessage, Ks as chatMessageInternal, Qs as createJoinLink, Js as customData, Ys as customDataInternal, hc as debug, _c as debugLogs, gc as debugMessage, ps as declineCall, Fc as enableFeatureForRoles, Hs as enableVideoSuspend, Us as enableVideoSuspendSuggest, Mc as feedback, nc as forceRelayPolicy, ec as getAnonymTokenByLink, Ec as getAudienceModeHands, Ac as getParticipantListChunk, jc as getParticipants, oc as getStreamInfo, Uc as getSyncedTime, Tc as getWaitingHall, Fs as grantRoles, Is as grantRolesInternal, _s as hangup, js as hold, os as init, ms as joinCall, gs as joinCallByLink, hs as joinCallInternal, Pc as logClientEvent, Ls as muteParticipant, Rs as muteParticipantInternal, zs as pinParticipant, Bs as pinParticipantInternal, ls as processPush, us as processPushInternal, Dc as promoteParticipant, ac as publishStream, Ms as putHandsDown, Lc as removeHistoryRecords, $s as removeJoinLink, lc as removeMovie, bs as removeParticipant, xs as removeParticipantInternal, pc as removeRooms, Bc as requestAsr, Ps as requestDisplayLayout, Oc as requestPromotion, is as setAudioEffects, Sc as setAudioStream, Os as setLocalResolution, ns as setLogger, Vs as setMediaModifiers, mc as setStatisticsInterval, rs as setVideoEffects, Ts as setVideoStream, as as setVmoji, wc as setVmojiFill, Cc as setVmojiSvg, tc as setVolume, Rc as startAsr, Zs as startAudienceConversation, Xs as startConversation, rc as startStream, Vc as startUrlSharing, zc as stopAsr, ic as stopStream, Hc as stopUrlSharing, fc as switchRoom, Ds as toggleLocalAudio, Es as toggleLocalVideo, Ns as updateDisplayLayout, cc as updateMovie, uc as updateRooms, yc as uploadDebugLogs, Nc as userFeedbackStats, ts as utils, Wc as version };