@vkontakte/calls-sdk 2.8.12-dev.35600965.0 → 2.8.12-dev.48fc9c32.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.12-dev.35600965.0
3
- * Thu, 13 Aug 2026 11:58:10 GMT
2
+ * @vkontakte/calls-sdk v2.8.12-dev.48fc9c32.0
3
+ * Thu, 13 Aug 2026 10:10:18 GMT
4
4
  * https://calls-sdk.cdn-vk.ru/doc/latest/index.html
5
5
  */
6
6
 
@@ -55,31 +55,31 @@ function h(e, t, n) {
55
55
  }
56
56
  //#endregion
57
57
  //#region src/utils/DebugStorage.ts
58
- var te = 25 * 1024 * 1024, ne = 10, re = "_okcls_logs_session_", ie = 3e4, ae = "ok-calls-sdk-debug-logs", oe = 1, g = "sessions", _ = "chunks", se = 120 * 1e3, ce = new Set(["WARN", "ERROR"]);
59
- function le() {
60
- return `${Date.now()}_${Math.random().toString(36).slice(2)}`;
61
- }
58
+ var te = 25 * 1024 * 1024, ne = 10, re = "_okcls_logs_session_", ie = 3e4, ae = "ok-calls-sdk-debug-logs", oe = 1, g = "sessions", se = "chunks", ce = 120 * 1e3, le = new Set(["WARN", "ERROR"]);
62
59
  function ue() {
63
- let e = le();
64
- return de(e), e;
60
+ return `${Date.now()}_${Math.random().toString(36).slice(2)}`;
65
61
  }
66
- function de(e) {
67
- He.has(e) || He.set(e, []), Ue.has(e) || Ue.set(e, 0), We.has(e) || We.set(e, null);
62
+ function de() {
63
+ let e = ue();
64
+ return fe(e), e;
68
65
  }
69
66
  function fe(e) {
70
- return We.get(e) ?? null;
67
+ Ue.has(e) || Ue.set(e, []), We.has(e) || We.set(e, 0), Ge.has(e) || Ge.set(e, null);
71
68
  }
72
69
  function pe(e) {
73
- let t = Ue.get(e) ?? 0;
74
- return Ue.set(e, t + 1), t;
70
+ return Ge.get(e) ?? null;
71
+ }
72
+ function me(e) {
73
+ let t = We.get(e) ?? 0;
74
+ return We.set(e, t + 1), t;
75
75
  }
76
- function me(e, t) {
76
+ function he(e, t) {
77
77
  return `${e}:${String(t).padStart(12, "0")}`;
78
78
  }
79
- function he(e) {
79
+ function ge(e) {
80
80
  return new Blob([e]).size;
81
81
  }
82
- function ge() {
82
+ function _e() {
83
83
  try {
84
84
  let e = window.localStorage;
85
85
  for (let t of Object.keys(e)) t.indexOf(re) === 0 && e.removeItem(t);
@@ -87,7 +87,7 @@ function ge() {
87
87
  console.error("Storage is blocked", e);
88
88
  }
89
89
  }
90
- var v = new class {
90
+ var _ = new class {
91
91
  constructor() {
92
92
  h(this, "_db", null), h(this, "_dbPromise", null), h(this, "_supported", this.isSupported());
93
93
  }
@@ -140,7 +140,7 @@ var v = new class {
140
140
  async getChunksBySession(e) {
141
141
  let t = await this.open();
142
142
  if (!t) return [];
143
- let n = t.transaction(_, "readonly"), r = await this.requestToPromise(n.objectStore(_).index("sessionId").getAll(e));
143
+ let n = t.transaction(se, "readonly"), r = await this.requestToPromise(n.objectStore(se).index("sessionId").getAll(e));
144
144
  return await this.txDone(n), r.sort((e, t) => e.sequence - t.sequence);
145
145
  }
146
146
  async putSession(e) {
@@ -152,8 +152,8 @@ var v = new class {
152
152
  async putSessionAndChunk(e, t) {
153
153
  let n = await this.open();
154
154
  if (!n) return !1;
155
- let r = n.transaction([g, _], "readwrite");
156
- return r.objectStore(g).put(e), r.objectStore(_).put(t), await this.txDone(r), !0;
155
+ let r = n.transaction([g, se], "readwrite");
156
+ return r.objectStore(g).put(e), r.objectStore(se).put(t), await this.txDone(r), !0;
157
157
  }
158
158
  async updateSessionConversationId(e, t) {
159
159
  let [n] = await this.getSessionBySessionId(e);
@@ -166,14 +166,14 @@ var v = new class {
166
166
  async deleteSession(e) {
167
167
  let t = await this.open();
168
168
  if (!t) return 0;
169
- let n = await this.getChunksBySession(e), r = t.transaction([g, _], "readwrite"), i = r.objectStore(_), a = 0;
169
+ let n = await this.getChunksBySession(e), r = t.transaction([g, se], "readwrite"), i = r.objectStore(se), a = 0;
170
170
  for (let e of n) a += e.bytes, i.delete(e.id);
171
171
  return r.objectStore(g).delete(e), await this.txDone(r), a;
172
172
  }
173
173
  async deleteChunks(e) {
174
174
  let t = await this.open();
175
175
  if (!t || !e.length) return;
176
- let n = t.transaction(_, "readwrite"), r = n.objectStore(_);
176
+ let n = t.transaction(se, "readwrite"), r = n.objectStore(se);
177
177
  for (let t of e) r.delete(t.id);
178
178
  await this.txDone(n);
179
179
  }
@@ -207,7 +207,7 @@ var v = new class {
207
207
  let t = e.createObjectStore(g, { keyPath: "sessionId" });
208
208
  t.createIndex("conversationId", "conversationId", { unique: !1 }), t.createIndex("updatedAt", "updatedAt", { unique: !1 });
209
209
  }
210
- e.objectStoreNames.contains(_) || e.createObjectStore(_, { keyPath: "id" }).createIndex("sessionId", "sessionId", { unique: !1 });
210
+ e.objectStoreNames.contains(se) || e.createObjectStore(se, { keyPath: "id" }).createIndex("sessionId", "sessionId", { unique: !1 });
211
211
  }
212
212
  isSupported() {
213
213
  return typeof window < "u" && !!window.indexedDB;
@@ -278,15 +278,15 @@ var v = new class {
278
278
  return i;
279
279
  }
280
280
  }();
281
- async function _e(e) {
282
- return e.sessionId ? v.getSessionBySessionId(e.sessionId) : e.conversationId ? v.getSessionsByConversationId(e.conversationId) : [];
281
+ async function ve(e) {
282
+ return e.sessionId ? _.getSessionBySessionId(e.sessionId) : e.conversationId ? _.getSessionsByConversationId(e.conversationId) : [];
283
283
  }
284
- async function ve(e, t, n, r) {
284
+ async function ye(e, t, n, r) {
285
285
  if (!r.length) return;
286
- let i = fe(e) || t, a = r, o = JSON.stringify(a), s = he(o);
287
- for (; s > te && a.length > 1;) a = a.slice(Math.floor(a.length / 2)), o = JSON.stringify(a), s = he(o);
286
+ let i = pe(e) || t, a = r, o = JSON.stringify(a), s = ge(o);
287
+ for (; s > te && a.length > 1;) a = a.slice(Math.floor(a.length / 2)), o = JSON.stringify(a), s = ge(o);
288
288
  if (s > te) return;
289
- let c = a[0].t, l = a[a.length - 1].t, [u] = await v.getSessionBySessionId(e), d = u || {
289
+ let c = a[0].t, l = a[a.length - 1].t, [u] = await _.getSessionBySessionId(e), d = u || {
290
290
  sessionId: e,
291
291
  conversationId: i,
292
292
  startTime: c,
@@ -303,7 +303,7 @@ async function ve(e, t, n, r) {
303
303
  bytes: d.bytes + s,
304
304
  entriesCount: d.entriesCount + a.length
305
305
  }, p = {
306
- id: me(e, n),
306
+ id: he(e, n),
307
307
  sessionId: e,
308
308
  sequence: n,
309
309
  startTime: c,
@@ -311,9 +311,9 @@ async function ve(e, t, n, r) {
311
311
  bytes: s,
312
312
  items: a
313
313
  };
314
- await v.putSessionAndChunk(f, p) && await v.enforceRetentionPolicy();
314
+ await _.putSessionAndChunk(f, p) && await _.enforceRetentionPolicy();
315
315
  }
316
- function ye(e) {
316
+ function be(e) {
317
317
  let t = /* @__PURE__ */ new WeakSet();
318
318
  try {
319
319
  return JSON.parse(JSON.stringify(e, (e, n) => {
@@ -328,101 +328,101 @@ function ye(e) {
328
328
  return e.map((e) => String(e));
329
329
  }
330
330
  }
331
- function be(e) {
332
- let t = He.get(e);
333
- if (!t?.length) return qe;
334
- let n = t.splice(0), r = fe(e), i = pe(e);
335
- return qe = qe.then(() => ve(e, r, i, n)).catch((e) => {
331
+ function xe(e) {
332
+ let t = Ue.get(e);
333
+ if (!t?.length) return Je;
334
+ let n = t.splice(0), r = pe(e), i = me(e);
335
+ return Je = Je.then(() => ye(e, r, i, n)).catch((e) => {
336
336
  console.warn("Failed to write debug log to storage", e);
337
- }), qe;
337
+ }), Je;
338
338
  }
339
- function xe(e) {
340
- if (e) return be(e);
341
- for (let e of He.keys()) be(e);
342
- return qe;
339
+ function Se(e) {
340
+ if (e) return xe(e);
341
+ for (let e of Ue.keys()) xe(e);
342
+ return Je;
343
343
  }
344
- async function Se(e) {
344
+ async function Ce(e) {
345
345
  let t = [];
346
346
  for (let n of e.sort((e, t) => e.startTime - t.startTime)) {
347
- let e = await v.getChunksBySession(n.sessionId);
347
+ let e = await _.getChunksBySession(n.sessionId);
348
348
  for (let n of e) t.push(...n.items);
349
349
  }
350
350
  return t;
351
351
  }
352
- async function Ce(e) {
353
- let t = await Se(e);
352
+ async function we(e) {
353
+ let t = await Ce(e);
354
354
  if (!t.length) return t;
355
- let n = t.sort(Te), r = n[0].t, i = n[n.length - 1].t;
356
- return [...await we(r, i, new Set(e.map((e) => e.sessionId))), ...n].sort(Te);
355
+ let n = t.sort(Ee), r = n[0].t, i = n[n.length - 1].t;
356
+ return [...await Te(r, i, new Set(e.map((e) => e.sessionId))), ...n].sort(Ee);
357
357
  }
358
- async function we(e, t, n) {
359
- let r = (await v.getAllSessions()).filter((r) => !n.has(r.sessionId) && r.conversationId === null && r.endTime >= e - se && r.startTime <= t), i = [];
358
+ async function Te(e, t, n) {
359
+ let r = (await _.getAllSessions()).filter((r) => !n.has(r.sessionId) && r.conversationId === null && r.endTime >= e - ce && r.startTime <= t), i = [];
360
360
  for (let n of r) {
361
- let r = await v.getChunksBySession(n.sessionId);
362
- for (let n of r) n.endTime < e - se || n.startTime > t || i.push(...n.items.filter((n) => n.t >= e - se && n.t <= e ? !0 : n.t >= e && n.t <= t && ce.has(n.l)));
361
+ let r = await _.getChunksBySession(n.sessionId);
362
+ 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)));
363
363
  }
364
364
  return i;
365
365
  }
366
- function Te(e, t) {
366
+ function Ee(e, t) {
367
367
  return e.t - t.t;
368
368
  }
369
- function Ee(e, t) {
369
+ function De(e, t) {
370
370
  let n = document.createElement("a"), r = new Blob([e], { type: "text/json" }), i = URL.createObjectURL(r);
371
371
  n.href = i, n.download = t, n.click(), URL.revokeObjectURL(i);
372
372
  }
373
- function De() {
374
- xe();
375
- }
376
373
  function Oe() {
377
- document.visibilityState === "hidden" && xe();
374
+ Se();
378
375
  }
379
- function ke(e, t, n = Ge) {
380
- Ve || Ae(), de(n);
376
+ function ke() {
377
+ document.visibilityState === "hidden" && Se();
378
+ }
379
+ function Ae(e, t, n = Ke) {
380
+ He || je(), fe(n);
381
381
  let r = /* @__PURE__ */ new Date(), i = {
382
382
  t: r.getTime(),
383
383
  l: e,
384
- d: ye(t),
384
+ d: be(t),
385
385
  h: r.toLocaleString("ru-RU", {
386
386
  dateStyle: "short",
387
387
  timeStyle: "long"
388
388
  })
389
389
  };
390
- return He.get(n)?.push(i), Ke || (Ke = window.setTimeout(() => {
391
- Ke = null, xe();
390
+ return Ue.get(n)?.push(i), qe || (qe = window.setTimeout(() => {
391
+ qe = null, Se();
392
392
  }, ie)), i;
393
393
  }
394
- function Ae() {
395
- Ve || (Ve = !0, ge(), v.open(), window.addEventListener("pagehide", De), document.addEventListener("visibilitychange", Oe));
396
- }
397
394
  function je() {
398
- return Ve || Ae(), xe(), ue();
395
+ He || (He = !0, _e(), _.open(), window.addEventListener("pagehide", Oe), document.addEventListener("visibilitychange", ke));
399
396
  }
400
- function Me(e, t = Ge) {
401
- t && (de(t), We.set(t, e), e && v.updateSessionConversationId(t, e));
397
+ function Me() {
398
+ return He || je(), Se(), de();
402
399
  }
403
- async function Ne() {
404
- return await xe(), (await v.getAllSessions()).sort((e, t) => t.updatedAt - e.updatedAt);
400
+ function Ne(e, t = Ke) {
401
+ t && (fe(t), Ge.set(t, e), e && _.updateSessionConversationId(t, e));
405
402
  }
406
- async function Pe(e) {
407
- return await xe(), Ce(await _e(e));
403
+ async function Pe() {
404
+ return await Se(), (await _.getAllSessions()).sort((e, t) => t.updatedAt - e.updatedAt);
408
405
  }
409
406
  async function Fe(e) {
410
- return JSON.stringify(await Pe(e));
407
+ return await Se(), we(await ve(e));
411
408
  }
412
409
  async function Ie(e) {
413
- let t = await Fe(e), n = `logs_${e.sessionId || e.conversationId}_${Date.now()}.json`;
414
- return Ee(t, n), n;
410
+ return JSON.stringify(await Fe(e));
415
411
  }
416
412
  async function Le(e) {
417
- await xe();
418
- let t = e ? await _e(e) : await v.getAllSessions();
419
- for (let e of t) await v.deleteSession(e.sessionId);
413
+ let t = await Ie(e), n = `logs_${e.sessionId || e.conversationId}_${Date.now()}.json`;
414
+ return De(t, n), n;
415
+ }
416
+ async function Re(e) {
417
+ await Se();
418
+ let t = e ? await ve(e) : await _.getAllSessions();
419
+ for (let e of t) await _.deleteSession(e.sessionId);
420
420
  }
421
- async function Re() {
422
- await xe();
423
- let e = await v.getStorageSummary(), t = await v.estimateStorage();
421
+ async function ze() {
422
+ await Se();
423
+ let e = await _.getStorageSummary(), t = await _.estimateStorage();
424
424
  return {
425
- supported: v.supported,
425
+ supported: _.supported,
426
426
  callsCount: e.callsCount,
427
427
  sessionsCount: e.sessions.length,
428
428
  usedBytes: e.usedBytes,
@@ -432,20 +432,20 @@ async function Re() {
432
432
  usageBytes: t?.usage
433
433
  };
434
434
  }
435
- async function ze() {
436
- await xe();
437
- let e = await Se(await v.getAllSessions());
438
- return JSON.stringify(e.sort(Te));
439
- }
440
435
  async function Be() {
441
- let e = await ze(), t = `logs_${Date.now()}.json`;
442
- return Ee(e, t), t;
436
+ await Se();
437
+ let e = await Ce(await _.getAllSessions());
438
+ return JSON.stringify(e.sort(Ee));
443
439
  }
444
- var Ve = !1, He = /* @__PURE__ */ new Map(), Ue = /* @__PURE__ */ new Map(), We = /* @__PURE__ */ new Map(), Ge = ue(), Ke = null, qe = Promise.resolve();
445
- window.__VKCallsSDKLogs__ = (e = !1) => (Ve || Ae(), e ? ze() : Be());
440
+ async function Ve() {
441
+ let e = await Be(), t = `logs_${Date.now()}.json`;
442
+ return De(e, t), t;
443
+ }
444
+ var He = !1, Ue = /* @__PURE__ */ new Map(), We = /* @__PURE__ */ new Map(), Ge = /* @__PURE__ */ new Map(), Ke = de(), qe = null, Je = Promise.resolve();
445
+ window.__VKCallsSDKLogs__ = (e = !1) => (He || je(), e ? Be() : Ve());
446
446
  //#endregion
447
447
  //#region src/static/AuthData.ts
448
- var y = class e {
448
+ var v = class e {
449
449
  static get sessionKey() {
450
450
  return e._sessionKey;
451
451
  }
@@ -479,10 +479,10 @@ var y = class e {
479
479
  })), e._reauthorizePromise;
480
480
  }
481
481
  };
482
- h(y, "_sessionKey", void 0), h(y, "_sessionSecretKey", void 0), h(y, "_accessToken", void 0), h(y, "_userId", null), h(y, "_reauthorizePromise", null);
482
+ h(v, "_sessionKey", void 0), h(v, "_sessionSecretKey", void 0), h(v, "_accessToken", void 0), h(v, "_userId", null), h(v, "_reauthorizePromise", null);
483
483
  //#endregion
484
484
  //#region src/classes/EventEmitter.ts
485
- var b = class {
485
+ var y = class {
486
486
  constructor() {
487
487
  h(this, "_handlers", {}), h(this, "_listeners", []);
488
488
  }
@@ -508,14 +508,14 @@ var b = class {
508
508
  e.dispose();
509
509
  });
510
510
  }
511
- }, x = /* @__PURE__ */ function(e) {
511
+ }, b = /* @__PURE__ */ function(e) {
512
512
  return e.MIC_CAMERA_PERMISSION = "mic_camera", e.CAMERA_PERMISSION = "camera", e.MIC_PERMISSION = "mic", e.CAMERA_ACCESS = "cameralock", e.MIC_ACCESS = "miclock", e.MIC_NOT_FOUND = "nomic", e.SCREEN_PERMISSION = "screenpermission", e.SCREEN_ACCESS = "screenlock", e.CONNECTION = "connection", e.NETWORK = "network", e.UNKNOWN = "unknown", e.UNSUPPORTED = "unsupported", e.SIGNALING_FAILED = "signalingfailed", e.API = "api", e.AUTH = "auth", e.OVERCONSTRAINED = "overconstrained", e;
513
- }(x || {}), S = /* @__PURE__ */ function(e) {
513
+ }(b || {}), x = /* @__PURE__ */ function(e) {
514
514
  return e.AUDIO = "AUDIO", e.VIDEO = "VIDEO", e.SCREEN_SHARING = "SCREEN_SHARING", e.MOVIE_SHARING = "MOVIE_SHARING", e.AUDIO_SHARING = "AUDIO_SHARING", e.ANIMOJI = "ANIMOJI", e;
515
- }(S || {}), C = /* @__PURE__ */ function(e) {
515
+ }(x || {}), S = /* @__PURE__ */ function(e) {
516
516
  return e.ACCEPT_CONCURRENT = "callAcceptConcurrent", e.ACCEPT_INCOMING = "callAcceptIncoming", e.ACCEPTED_OUTGOING = "callAcceptedOutgoing", e.ADD_PARTICIPANT = "callAddParticipant", e.CALL_SPEC_ERROR = "callSpecError", e.DECLINE_INCOMING = "callDeclineIncoming", e.DEVICE_CHANGED = "callDeviceChanged", e.DEVICES = "callDevices", e.ERROR = "callError", e.HANGUP = "callHangup", e.ICE_CONNECTION_STATE = "callIceConnectionState", e.ICE_CONNECTION_TYPE = "callIceConnectionType", e.ICE_RESTART = "callIceRestart", e.JOIN_CONVERSATION = "callJoinConversation", e.MEDIA_STATUS = "callMediaStatus", e.OUTGOING_CALL = "callStart", e.OUTGOING_MULTIPARTY_CALL = "callStartMultiparty", e.PAT_ALLOCATED = "patAllocate", e.PAT_DEALLOCATED = "patDeallocate", e.PAT_ERROR = "patError", e.PAT_OUTDATED_RESPONSE = "patOutdatedResponse", e.PAT_WAITING_TIME_ERROR = "patWaitingTimeError", e.POOR_CONNECTION = "callPoorConnection", e.PUSH = "callPush", e.RECONNECT = "callReconnect", e.RELAY_POLICY = "callForceRelay", e.REMOVE_PARTICIPANT = "callRemoveParticipant", e.SOCKET_ACTION = "callSocketAction", e.TOPOLOGY_CHANGE_REQUESTED = "callTopologyChangeRequested", e;
517
- }(C || {}), Je = (e) => e.stop(), Ye = (e) => e.getTracks().forEach(Je), Xe = (e) => e.getVideoTracks().forEach(Je);
518
- async function Ze(e, t) {
517
+ }(S || {}), Ye = (e) => e.stop(), Xe = (e) => e.getTracks().forEach(Ye), Ze = (e) => e.getVideoTracks().forEach(Ye);
518
+ async function Qe(e, t) {
519
519
  try {
520
520
  let n = typeof t.width == "number" ? t.width : void 0, r = typeof t.height == "number" ? t.height : void 0;
521
521
  await e.applyConstraints({
@@ -535,7 +535,7 @@ async function Ze(e, t) {
535
535
  }
536
536
  //#endregion
537
537
  //#region src/utils/NavigatorPermissions.ts
538
- var Qe = class {
538
+ var $e = class {
539
539
  constructor() {
540
540
  h(this, "_cameraPermissionStatus", void 0), h(this, "_microphonePermissionStatus", void 0), h(this, "_listener", void 0);
541
541
  }
@@ -576,7 +576,7 @@ var Qe = class {
576
576
  }
577
577
  return t;
578
578
  }
579
- }, $e = "_okcls_", et = (() => {
579
+ }, et = "_okcls_", tt = (() => {
580
580
  try {
581
581
  let e = Date.now().toString(), t = window.localStorage, n = !1;
582
582
  return t.setItem(e, e), n = t.getItem(e) === e, t.removeItem(e), n ? t : null;
@@ -584,8 +584,8 @@ var Qe = class {
584
584
  return null;
585
585
  }
586
586
  })();
587
- function tt(e) {
588
- let t = et ? et.getItem($e + e) : null;
587
+ function nt(e) {
588
+ let t = tt ? tt.getItem(et + e) : null;
589
589
  if (t === null) return null;
590
590
  try {
591
591
  return JSON.parse(t);
@@ -593,30 +593,30 @@ function tt(e) {
593
593
  return null;
594
594
  }
595
595
  }
596
- function nt(e, t) {
596
+ function rt(e, t) {
597
597
  try {
598
- et && et.setItem($e + e, JSON.stringify(t));
598
+ tt && tt.setItem(et + e, JSON.stringify(t));
599
599
  } catch {}
600
600
  }
601
- function rt(e) {
602
- et && et.removeItem($e + e);
601
+ function it(e) {
602
+ tt && tt.removeItem(et + e);
603
603
  }
604
- var it;
604
+ var at;
605
605
  (function(e) {
606
606
  function t(e) {
607
- return tt(e) || null;
607
+ return nt(e) || null;
608
608
  }
609
609
  e.get = t;
610
610
  function n(e, t) {
611
- nt(e, t);
611
+ rt(e, t);
612
612
  }
613
613
  e.set = n;
614
614
  function r(e) {
615
- rt(e);
615
+ it(e);
616
616
  }
617
617
  e.remove = r;
618
- })(it || (it = {}));
619
- var at = it, ot = null, st = null, ct = null, lt = [], ut = [], dt = [], ft = null, pt = null, mt = null, ht = !1, gt = !1, _t, vt, yt, bt = null, xt = null, St = "", Ct = null, wt = [], Tt = null, Et = navigator.appVersion, Dt = navigator.appName, Ot = navigator.userAgent, kt = {};
618
+ })(at || (at = {}));
619
+ var ot = at, st = null, ct = null, lt = null, ut = [], dt = [], ft = [], pt = null, mt = null, ht = null, gt = !1, _t = !1, vt, yt, bt, xt = null, St = null, Ct = "", wt = null, Tt = [], Et = null, Dt = navigator.appVersion, Ot = navigator.appName, C = navigator.userAgent, kt = {};
620
620
  function At(e, t) {
621
621
  return Number(t.deviceId === "default") - Number(e.deviceId === "default");
622
622
  }
@@ -640,8 +640,8 @@ var Mt = class {
640
640
  autoGainControl: !0
641
641
  };
642
642
  let t = w.getMicrophones(), n, r;
643
- if (pt && (r = pt.groupId, n = pt.deviceId), typeof e == "string") r = t.find((t) => t.deviceId === e)?.groupId, n = e;
644
- else if (!pt && w.os() === "MacOS" && t.find((e) => e.label.includes("iPhone"))) {
643
+ if (mt && (r = mt.groupId, n = mt.deviceId), typeof e == "string") r = t.find((t) => t.deviceId === e)?.groupId, n = e;
644
+ else if (!mt && w.os() === "MacOS" && t.find((e) => e.label.includes("iPhone"))) {
645
645
  let e = t.find((e) => !e.label.includes("Virtual") && !e.label.includes("iPhone"));
646
646
  e && (r = e.groupId, n = e.deviceId);
647
647
  }
@@ -664,8 +664,8 @@ var Mt = class {
664
664
  frameRate: { ideal: i }
665
665
  };
666
666
  let e = w.getCameras(), a, s;
667
- if (ft && (s = ft.groupId, a = ft.deviceId), typeof t == "string") s = e.find((e) => e.deviceId === t)?.groupId, a = t;
668
- else if (!ft && w.os() === "MacOS" && e.find((e) => e.label.includes("iPhone"))) {
667
+ if (pt && (s = pt.groupId, a = pt.deviceId), typeof t == "string") s = e.find((e) => e.deviceId === t)?.groupId, a = t;
668
+ else if (!pt && w.os() === "MacOS" && e.find((e) => e.label.includes("iPhone"))) {
669
669
  let t = e.find((e) => !e.label.includes("Virtual") && !e.label.includes("iPhone"));
670
670
  t && (s = t.groupId, a = t.deviceId);
671
671
  }
@@ -694,9 +694,9 @@ var Mt = class {
694
694
  }
695
695
  }, Nt = class extends Mt {
696
696
  constructor(e, t, n, r) {
697
- if (super(!1, !0), h(this, "captureController", void 0), this.captureController = "CaptureController" in window ? new CaptureController() : null, typeof this.video == "object" ? (delete this.video.deviceId, delete this.video.groupId, delete this.video.aspectRatio, delete this.video.frameRate, delete this.video.facingMode) : this.video = {}, this.video.cursor = "motion", this.video.width = e, this.video.height = t, this.video.frameRate = n, this.video.displaySurface = M.displaySurface, w.browserName() === "Safari") {
697
+ if (super(!1, !0), h(this, "captureController", void 0), this.captureController = "CaptureController" in window ? new CaptureController() : null, typeof this.video == "object" ? (delete this.video.deviceId, delete this.video.groupId, delete this.video.aspectRatio, delete this.video.frameRate, delete this.video.facingMode, delete this.video.width, delete this.video.height) : this.video = {}, this.video.cursor = "motion", e && (this.video.width = e), t && (this.video.height = t), this.video.frameRate = n, this.video.displaySurface = M.displaySurface, w.browserName() === "Safari") {
698
698
  let n = Number(w.browserVersion());
699
- n === 16 ? (this.video.width = { max: e }, this.video.height = { max: t }) : n === 17 && (delete this.video.width, delete this.video.height);
699
+ n === 16 ? (e && (this.video.width = { max: e }), t && (this.video.height = { max: t })) : n === 17 && (delete this.video.width, delete this.video.height);
700
700
  }
701
701
  r && (this.audio = {
702
702
  noiseSuppression: !1,
@@ -716,7 +716,7 @@ var Mt = class {
716
716
  h(this, "_lockId", Math.round(Math.random() * 99998) + 1);
717
717
  }
718
718
  busy(t = null) {
719
- if (e._lockId) throw t?.log(C.ERROR, "change_device"), R.warn("Device change failed: MediaSource is busy"), Error("MediaSource is busy");
719
+ if (e._lockId) throw t?.log(S.ERROR, "change_device"), R.warn("Device change failed: MediaSource is busy"), Error("MediaSource is busy");
720
720
  e._lockId = this._lockId;
721
721
  }
722
722
  free() {
@@ -725,7 +725,7 @@ var Mt = class {
725
725
  };
726
726
  h(Pt, "_lockId", 0);
727
727
  async function Ft() {
728
- gt = !1, ht = !1, ot = null;
728
+ _t = !1, gt = !1, st = null;
729
729
  let e = {
730
730
  camera: w.getSavedCamera(),
731
731
  microphone: w.getSavedMicrophone(),
@@ -737,18 +737,18 @@ function It(e, ...t) {
737
737
  if (kt[e]) for (let n of kt[e]) n(...t);
738
738
  }
739
739
  async function Lt() {
740
- return ot || (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices ? [] : (!st && navigator.mediaDevices.addEventListener && (st = j.debounce(Ft, M.enumerateDevicesDelay), navigator.mediaDevices.addEventListener("devicechange", st)), !ct && Qe.isSupported() && (ct = new Qe(), await ct.init((e, t) => {
740
+ return st || (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices ? [] : (!ct && navigator.mediaDevices.addEventListener && (ct = j.debounce(Ft, M.enumerateDevicesDelay), navigator.mediaDevices.addEventListener("devicechange", ct)), !lt && $e.isSupported() && (lt = new $e(), await lt.init((e, t) => {
741
741
  switch (t) {
742
742
  case "denied":
743
743
  case "prompt":
744
- st?.();
744
+ ct?.();
745
745
  break;
746
746
  }
747
- })), ot = navigator.mediaDevices.enumerateDevices().then((e) => {
748
- lt = e.filter((e) => e.kind === "videoinput" ? (e.label && (ht = !0), !0) : !1), lt.sort(At), ut = e.filter((e) => e.kind === "audioinput" ? (e.label ? gt = !0 : w.isMobile() && w.browserName() === "Firefox" && (gt = ht), !0) : !1), ut.sort(At), dt = e.filter((e) => e.kind === "audiooutput"), dt.sort(At);
749
- let t = ft?.deviceId ?? at.get("videoinput"), n = pt?.deviceId ?? at.get("audioinput"), r = mt?.deviceId ?? at.get("audiooutput");
750
- return ft = lt.find((e) => e.deviceId === t) || null, pt = ut.find((e) => e.deviceId === n) || null, mt = dt.find((e) => e.deviceId === r) || dt[0] || null, ot = Promise.resolve(e), e;
751
- }).catch(() => (ot = null, []))));
747
+ })), st = navigator.mediaDevices.enumerateDevices().then((e) => {
748
+ ut = e.filter((e) => e.kind === "videoinput" ? (e.label && (gt = !0), !0) : !1), ut.sort(At), dt = e.filter((e) => e.kind === "audioinput" ? (e.label ? _t = !0 : w.isMobile() && w.browserName() === "Firefox" && (_t = gt), !0) : !1), dt.sort(At), ft = e.filter((e) => e.kind === "audiooutput"), ft.sort(At);
749
+ let t = pt?.deviceId ?? ot.get("videoinput"), n = mt?.deviceId ?? ot.get("audioinput"), r = ht?.deviceId ?? ot.get("audiooutput");
750
+ return pt = ut.find((e) => e.deviceId === t) || null, mt = dt.find((e) => e.deviceId === n) || null, ht = ft.find((e) => e.deviceId === r) || ft[0] || null, st = Promise.resolve(e), e;
751
+ }).catch(() => (st = null, []))));
752
752
  }
753
753
  async function Rt() {
754
754
  if ("userAgentData" in navigator) try {
@@ -758,19 +758,19 @@ async function Rt() {
758
758
  return;
759
759
  }
760
760
  let t = parseInt(e.split(".")[0]);
761
- Ct = isNaN(t) ? null : t;
761
+ wt = isNaN(t) ? null : t;
762
762
  } catch (e) {
763
763
  R.warn("Failed to get OS version", e);
764
764
  }
765
765
  }
766
766
  function zt(e) {
767
- if (ft && pt) return;
767
+ if (pt && mt) return;
768
768
  let t = (e, t) => {
769
769
  let n = t.getSettings()?.deviceId;
770
770
  return e.find((e) => e.deviceId === n || e.label === t.label) || null;
771
771
  };
772
772
  e?.getTracks().forEach((e) => {
773
- !pt && e.kind === k.audio ? pt = t(w.getMicrophones(), e) : !ft && e.kind === k.video && (ft = t(w.getCameras(), e));
773
+ !mt && e.kind === k.audio ? mt = t(w.getMicrophones(), e) : !pt && e.kind === k.video && (pt = t(w.getCameras(), e));
774
774
  });
775
775
  }
776
776
  async function Bt(e, t, n = R, r = null) {
@@ -790,31 +790,31 @@ async function Bt(e, t, n = R, r = null) {
790
790
  case "SecurityError":
791
791
  case "DOMException":
792
792
  case "NotFoundError":
793
- t = e.isVideoRequested() ? x.CAMERA_PERMISSION : x.MIC_PERMISSION;
793
+ t = e.isVideoRequested() ? b.CAMERA_PERMISSION : b.MIC_PERMISSION;
794
794
  break;
795
795
  case "OverconstrainedError":
796
- t = x.OVERCONSTRAINED;
796
+ t = b.OVERCONSTRAINED;
797
797
  break;
798
798
  case "TypeError":
799
- t = x.UNKNOWN;
799
+ t = b.UNKNOWN;
800
800
  break;
801
801
  case "AbortError":
802
802
  case "NotReadableError":
803
- t = e.isVideoRequested() ? x.CAMERA_ACCESS : x.MIC_ACCESS;
803
+ t = e.isVideoRequested() ? b.CAMERA_ACCESS : b.MIC_ACCESS;
804
804
  break;
805
805
  case "Error": if (i.message === "MediaSource is busy") {
806
- t = e.isVideoRequested() ? x.CAMERA_ACCESS : x.MIC_ACCESS;
806
+ t = e.isVideoRequested() ? b.CAMERA_ACCESS : b.MIC_ACCESS;
807
807
  break;
808
808
  }
809
809
  }
810
810
  if (e.canSimplify()) return Bt(e.simplify(), t, n, r);
811
- let o = t || x.UNKNOWN;
811
+ let o = t || b.UNKNOWN;
812
812
  throw L.onPermissionsError(o, i), o;
813
813
  }
814
814
  }
815
815
  async function Vt(e = R) {
816
- if (!(bt || w.browserName() !== "Firefox" || !navigator.mediaDevices?.getUserMedia)) try {
817
- w.hasMicrophonePermission() || L.onPermissionsRequested(), bt = await navigator.mediaDevices.getUserMedia({
816
+ if (!(xt || w.browserName() !== "Firefox" || !navigator.mediaDevices?.getUserMedia)) try {
817
+ w.hasMicrophonePermission() || L.onPermissionsRequested(), xt = await navigator.mediaDevices.getUserMedia({
818
818
  audio: !0,
819
819
  video: !1
820
820
  });
@@ -841,9 +841,9 @@ async function Ht(e, t = R, n = null) {
841
841
  switch (e.name) {
842
842
  case "PermissionDeniedError":
843
843
  case "NotAllowedError":
844
- case "SecurityError": throw x.SCREEN_PERMISSION;
844
+ case "SecurityError": throw b.SCREEN_PERMISSION;
845
845
  case "AbortError":
846
- case "NotReadableError": throw x.SCREEN_ACCESS;
846
+ case "NotReadableError": throw b.SCREEN_ACCESS;
847
847
  default: throw e;
848
848
  }
849
849
  } finally {
@@ -851,9 +851,9 @@ async function Ht(e, t = R, n = null) {
851
851
  }
852
852
  }
853
853
  function Ut() {
854
- return wt.length || (wt = (() => {
855
- let e, t = !1, n = 0, r = "0", i = Ot.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
856
- if (/trident/i.test(i[1])) return e = /\brv[ :]+(\d+)/g.exec(Ot), [
854
+ return Tt.length || (Tt = (() => {
855
+ let e, t = !1, n = 0, r = "0", i = C.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
856
+ if (/trident/i.test(i[1])) return e = /\brv[ :]+(\d+)/g.exec(C), [
857
857
  "IE",
858
858
  e && e[1] || "Unknown",
859
859
  t,
@@ -861,35 +861,35 @@ function Ut() {
861
861
  r
862
862
  ];
863
863
  if (i[1] === "Safari") {
864
- if (e = Ot.match(/\bEdge\/(\d+)/), e) return [
864
+ if (e = C.match(/\bEdge\/(\d+)/), e) return [
865
865
  "Edge",
866
866
  e[1] || "Unknown",
867
867
  t,
868
868
  n,
869
869
  r
870
870
  ];
871
- if (e = Ot.match(/\bCriOS\/(\d+)/), e) return [
871
+ if (e = C.match(/\bCriOS\/(\d+)/), e) return [
872
872
  "Chrome",
873
873
  e[1],
874
874
  !0,
875
875
  Number(e[1]),
876
876
  r
877
877
  ];
878
- if (e = Ot.match(/\bFxiOS\/(\d+)/), e) return [
878
+ if (e = C.match(/\bFxiOS\/(\d+)/), e) return [
879
879
  "Firefox",
880
880
  e[1],
881
881
  !1,
882
882
  n,
883
883
  r
884
884
  ];
885
- if (e = Ot.match(/\bYaBrowser\/(\d+)/), e) return [
885
+ if (e = C.match(/\bYaBrowser\/(\d+)/), e) return [
886
886
  "Yandex",
887
887
  e[1],
888
888
  !1,
889
889
  n,
890
890
  r
891
891
  ];
892
- if (e = Ot.match(/\bOPT\/(\d+)/), e) return [
892
+ if (e = C.match(/\bOPT\/(\d+)/), e) return [
893
893
  "Opera",
894
894
  e[1],
895
895
  !1,
@@ -898,28 +898,28 @@ function Ut() {
898
898
  ];
899
899
  }
900
900
  if (i[1] === "Chrome") {
901
- if (t = !0, n = Number(i[2]), e = Ot.match(/\bOPR\/(\d+)/), e) return [
901
+ if (t = !0, n = Number(i[2]), e = C.match(/\bOPR\/(\d+)/), e) return [
902
902
  "Opera",
903
903
  e[1] || "Unknown",
904
904
  t,
905
905
  n,
906
906
  r
907
907
  ];
908
- if (e = Ot.match(/\bYaBrowser\/(\d+)/), e) return [
908
+ if (e = C.match(/\bYaBrowser\/(\d+)/), e) return [
909
909
  "Yandex",
910
910
  e[1] || "Unknown",
911
911
  t,
912
912
  n,
913
913
  r
914
914
  ];
915
- if (e = Ot.match(/\bSferum\/((\d+)(?:\.\d+)*)/), e) return [
915
+ if (e = C.match(/\bSferum\/((\d+)(?:\.\d+)*)/), e) return [
916
916
  "Sferum",
917
917
  e[1] || "Unknown",
918
918
  t,
919
919
  n,
920
920
  r
921
921
  ];
922
- if (e = Ot.match(/\bEdge?\/(\d+)/), e) return [
922
+ if (e = C.match(/\bEdge?\/(\d+)/), e) return [
923
923
  "Edge",
924
924
  e[1] || "Unknown",
925
925
  t,
@@ -934,14 +934,14 @@ function Ut() {
934
934
  r
935
935
  ];
936
936
  }
937
- return e = Ot.match(/version\/(\d+)(?:(?:\.)(\d+))?/i), e && e[2] !== void 0 && (r = e[2]), [
938
- i[2] ? i[1] : Dt,
939
- e && e[1] || i[2] || Et,
937
+ return e = C.match(/version\/(\d+)(?:(?:\.)(\d+))?/i), e && e[2] !== void 0 && (r = e[2]), [
938
+ i[2] ? i[1] : Ot,
939
+ e && e[1] || i[2] || Dt,
940
940
  t,
941
941
  n,
942
942
  r
943
943
  ];
944
- })()), wt;
944
+ })()), Tt;
945
945
  }
946
946
  var w;
947
947
  (function(e) {
@@ -950,35 +950,35 @@ var w;
950
950
  }
951
951
  e.init = t;
952
952
  function n() {
953
- return lt;
953
+ return ut;
954
954
  }
955
955
  e.getCameras = n;
956
956
  function r() {
957
- return ut;
957
+ return dt;
958
958
  }
959
959
  e.getMicrophones = r;
960
960
  function i() {
961
- return dt;
961
+ return ft;
962
962
  }
963
963
  e.getOutput = i;
964
964
  function a() {
965
- return lt.length > 0;
965
+ return ut.length > 0;
966
966
  }
967
967
  e.hasCamera = a;
968
968
  function o() {
969
- return ut.length > 0;
969
+ return dt.length > 0;
970
970
  }
971
971
  e.hasMicrophone = o;
972
972
  function s() {
973
- return ft;
973
+ return pt;
974
974
  }
975
975
  e.getSavedCamera = s;
976
976
  function c() {
977
- return pt;
977
+ return mt;
978
978
  }
979
979
  e.getSavedMicrophone = c;
980
980
  function l() {
981
- return mt;
981
+ return ht;
982
982
  }
983
983
  e.getSavedOutput = l;
984
984
  function u() {
@@ -986,15 +986,15 @@ var w;
986
986
  }
987
987
  e.getVideoFacingMode = u;
988
988
  function d() {
989
- return ht;
989
+ return gt;
990
990
  }
991
991
  e.hasCameraPermission = d;
992
992
  function f() {
993
- return gt;
993
+ return _t;
994
994
  }
995
995
  e.hasMicrophonePermission = f;
996
996
  function p() {
997
- return ct?.getPermissionState("microphone") ?? null;
997
+ return lt?.getPermissionState("microphone") ?? null;
998
998
  }
999
999
  e.getMicrophonePermissionState = p;
1000
1000
  function m(e = !1) {
@@ -1002,7 +1002,7 @@ var w;
1002
1002
  }
1003
1003
  e.hasPermissions = m;
1004
1004
  function ee() {
1005
- bt && (Ye(bt), bt = null);
1005
+ xt && (Xe(xt), xt = null);
1006
1006
  }
1007
1007
  e.releaseFirefoxMicrophonePermissionWarmup = ee;
1008
1008
  async function h(e = !1, t = !0, n = !0, r = R, i = null) {
@@ -1018,7 +1018,7 @@ var w;
1018
1018
  }
1019
1019
  e.getUserMedia = h;
1020
1020
  async function te(e, t, n = R, r = null) {
1021
- return Ht(new Nt(e && !M.consumerFastScreenShare ? M.fastScreenShareWidth : window.screen.width, e && !M.consumerFastScreenShare ? M.fastScreenShareHeight : window.screen.height, M.getScreenFrameRate(e), t), n, r);
1021
+ return Ht(new Nt(e && !M.consumerFastScreenShare ? M.fastScreenShareWidth : 0, e && !M.consumerFastScreenShare ? M.fastScreenShareHeight : 0, M.getScreenFrameRate(e), t), n, r);
1022
1022
  }
1023
1023
  e.getScreenMedia = te;
1024
1024
  async function ne(e = !1, t, n = R, r = null) {
@@ -1037,80 +1037,79 @@ var w;
1037
1037
  async function ae(e, t) {
1038
1038
  let [n] = e.getVideoTracks();
1039
1039
  if (!n) throw Error("Video track not found in stream");
1040
- return Ze(n, t);
1040
+ return Qe(n, t);
1041
1041
  }
1042
1042
  e.setResolution = ae;
1043
1043
  async function oe(e, t) {
1044
1044
  let n = (await Lt()).find((n) => n.kind === e && n.deviceId === t);
1045
- return n ? (e === "videoinput" ? ft = n : e === "audioinput" ? pt = n : e === "audiooutput" && (mt = n), at.set(e, t), n) : null;
1045
+ return n ? (e === "videoinput" ? pt = n : e === "audioinput" ? mt = n : e === "audiooutput" && (ht = n), ot.set(e, t), n) : null;
1046
1046
  }
1047
1047
  e._saveDeviceId = oe;
1048
1048
  function g() {
1049
- if (!yt || yt.readyState === "ended") {
1049
+ if (!bt || bt.readyState === "ended") {
1050
1050
  let e = w.getAudioContext(), t = e.createMediaStreamDestination(), n = e.createGain();
1051
1051
  n.gain.value = 1e-5, n.connect(t), n.connect(e.destination);
1052
1052
  let r = e.createOscillator();
1053
- r.type = "sine", r.frequency.value = 0, r.connect(n), r.start(), yt = t.stream.getAudioTracks()[0];
1053
+ r.type = "sine", r.frequency.value = 0, r.connect(n), r.start(), bt = t.stream.getAudioTracks()[0];
1054
1054
  }
1055
- return Object.assign(yt.clone(), { enabled: !1 });
1055
+ return Object.assign(bt.clone(), { enabled: !1 });
1056
1056
  }
1057
1057
  e.getSilentMediaTrack = g;
1058
- function _(e = M.videoMinWidth, t = M.videoMinHeight) {
1059
- vt || (vt = document.createElement("canvas")), vt.width = e, vt.height = t;
1060
- let n = vt.getContext("2d");
1061
- return n.rect(0, 0, e, t), n.fillStyle = "black", n.fill(), (!_t || _t.readyState === "ended") && (_t = vt.captureStream(M.videoFrameRate).getVideoTracks()[0]), Object.assign(_t.clone(), { enabled: !1 });
1062
- }
1063
- e.getBlackMediaTrack = _;
1064
- function se() {
1065
- return ce() === null;
1058
+ function se(e = M.videoMinWidth, t = M.videoMinHeight) {
1059
+ yt || (yt = document.createElement("canvas")), yt.width = e, yt.height = t;
1060
+ let n = yt.getContext("2d");
1061
+ return n.rect(0, 0, e, t), n.fillStyle = "black", n.fill(), (!vt || vt.readyState === "ended") && (vt = yt.captureStream(M.videoFrameRate).getVideoTracks()[0]), Object.assign(vt.clone(), { enabled: !1 });
1066
1062
  }
1067
- e.isBrowserSupported = se;
1063
+ e.getBlackMediaTrack = se;
1068
1064
  function ce() {
1065
+ return le() === null;
1066
+ }
1067
+ e.isBrowserSupported = ce;
1068
+ function le() {
1069
1069
  try {
1070
1070
  let e = window;
1071
- return ve() === "Edge" && Number(ye()) < 70 ? "old-edge" : e.navigator.mediaDevices ? "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 e.navigator ? null : "send-beacon-unavailable" : "rtp-sender-get-parameters-unavailable" : "rtp-sender-replace-track-unavailable" : "rtp-sender-unavailable" : "canvas-capture-stream-unavailable" : "html-canvas-unavailable" : "rtc-session-description-unavailable" : "rtc-ice-candidate-unavailable" : "rtc-peer-connection-unavailable" : "get-user-media-unavailable" : "media-devices-unavailable";
1071
+ return ye() === "Edge" && Number(be()) < 70 ? "old-edge" : e.navigator.mediaDevices ? "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 e.navigator ? null : "send-beacon-unavailable" : "rtp-sender-get-parameters-unavailable" : "rtp-sender-replace-track-unavailable" : "rtp-sender-unavailable" : "canvas-capture-stream-unavailable" : "html-canvas-unavailable" : "rtc-session-description-unavailable" : "rtc-ice-candidate-unavailable" : "rtc-peer-connection-unavailable" : "get-user-media-unavailable" : "media-devices-unavailable";
1072
1072
  } catch {
1073
1073
  return "support-check-failed";
1074
1074
  }
1075
1075
  }
1076
- e.getBrowserSupportFailure = ce;
1077
- function le() {
1076
+ e.getBrowserSupportFailure = le;
1077
+ function ue() {
1078
1078
  return !!navigator.mediaDevices.getDisplayMedia;
1079
1079
  }
1080
- e.isScreenCapturingSupported = le;
1081
- function ue() {
1080
+ e.isScreenCapturingSupported = ue;
1081
+ function de() {
1082
1082
  let e = w.browserName() === "Safari" && w.browserVersion() === "15" && w.browserSubVersion() === "1", t = w.browserName() === "Opera", n = w.browserName() === "Yandex";
1083
1083
  return e || t || n;
1084
1084
  }
1085
- e.isBrokenH264Decoder = ue;
1086
- function de() {
1085
+ e.isBrokenH264Decoder = de;
1086
+ function fe() {
1087
1087
  return w.browserName() === "Yandex" && w.os() === "Windows" || M.simulcast;
1088
1088
  }
1089
- e.isBrokenVP9Encoder = de;
1090
- function fe() {
1089
+ e.isBrokenVP9Encoder = fe;
1090
+ function pe() {
1091
1091
  let e = w.browserName() === "Safari" && Number(w.browserVersion()) === 17 && [
1092
1092
  4,
1093
1093
  5,
1094
1094
  6
1095
- ].includes(Number(w.browserSubVersion())), t = w.osVersion(), n = w.os() === "Windows" && t != null && t > 0 && t < 13;
1096
- return e || n;
1095
+ ].includes(Number(w.browserSubVersion())), t = w.os() === "Windows" && w.osVersion() === 10;
1096
+ return e || t;
1097
1097
  }
1098
- e.isBrokenVP9Decoder = fe;
1099
- function pe() {
1100
- return w.browserName() === "Firefox" && Number(w.browserVersion()) < 60;
1101
- }
1102
- e.isOldDataChannelDescription = pe;
1098
+ e.isBrokenVP9Decoder = pe;
1103
1099
  function me() {
1104
- return !(w.baseChromeVersion() && w.isMobile());
1100
+ return w.browserName() === "Firefox" && Number(w.browserVersion()) < 60;
1105
1101
  }
1106
- e.canPreferH264 = me;
1102
+ e.isOldDataChannelDescription = me;
1107
1103
  function he() {
1108
- let e = w.browserName(), t = Number(w.browserVersion());
1109
- return e === "Safari" ? t >= 18 : e === "Firefox" ? t >= 134 : !0;
1104
+ return !(w.baseChromeVersion() && w.isMobile());
1110
1105
  }
1111
- e.isSimulcastSupportedByBrowser = he;
1106
+ e.canPreferH264 = he;
1112
1107
  function ge() {
1113
- return St || (St = (() => {
1108
+ return !(w.browserName() === "Firefox" || w.browserName() === "Safari");
1109
+ }
1110
+ e.isSimulcastSupportedByBrowser = ge;
1111
+ function _e() {
1112
+ return Ct || (Ct = (() => {
1114
1113
  let e = {
1115
1114
  Windows: /Win/,
1116
1115
  Android: /Android/,
@@ -1127,57 +1126,57 @@ var w;
1127
1126
  OS2: /OS\/2/,
1128
1127
  Bot: /(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver)/
1129
1128
  };
1130
- for (let t in e) if (Object.hasOwn(e, t) && e[t].test(Ot)) return t;
1129
+ for (let t in e) if (Object.hasOwn(e, t) && e[t].test(C)) return t;
1131
1130
  return "Unknown";
1132
- })()), St;
1133
- }
1134
- e.os = ge;
1135
- function v() {
1136
- return Ct;
1131
+ })()), Ct;
1137
1132
  }
1138
- e.osVersion = v;
1139
- function _e() {
1140
- return xt === null && (xt = /Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(Et)), xt;
1133
+ e.os = _e;
1134
+ function _() {
1135
+ return wt;
1141
1136
  }
1142
- e.isMobile = _e;
1137
+ e.osVersion = _;
1143
1138
  function ve() {
1144
- return Ut()[0];
1139
+ return St === null && (St = /Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(Dt)), St;
1145
1140
  }
1146
- e.browserName = ve;
1141
+ e.isMobile = ve;
1147
1142
  function ye() {
1148
- return Ut()[1];
1143
+ return Ut()[0];
1149
1144
  }
1150
- e.browserVersion = ye;
1145
+ e.browserName = ye;
1151
1146
  function be() {
1152
- return Ut()[3];
1147
+ return Ut()[1];
1153
1148
  }
1154
- e.baseChromeVersion = be;
1149
+ e.browserVersion = be;
1155
1150
  function xe() {
1156
- return Tt || (Tt = new (window.AudioContext || window.webkitAudioContext)()), Tt.resume().catch(() => {
1157
- R.warn("Failed to resume AudioContext");
1158
- }), Tt;
1151
+ return Ut()[3];
1159
1152
  }
1160
- e.getAudioContext = xe;
1153
+ e.baseChromeVersion = xe;
1161
1154
  function Se() {
1162
- return Ut()[4];
1155
+ return Et || (Et = new (window.AudioContext || window.webkitAudioContext)()), Et.resume().catch(() => {
1156
+ R.warn("Failed to resume AudioContext");
1157
+ }), Et;
1163
1158
  }
1164
- e.browserSubVersion = Se;
1159
+ e.getAudioContext = Se;
1165
1160
  function Ce() {
1161
+ return Ut()[4];
1162
+ }
1163
+ e.browserSubVersion = Ce;
1164
+ function we() {
1166
1165
  return w.baseChromeVersion() >= 105 && !w.isMobile();
1167
1166
  }
1168
- e.isAudioShareSupported = Ce;
1169
- function we(e, t) {
1167
+ e.isAudioShareSupported = we;
1168
+ function Te(e, t) {
1170
1169
  kt[e] || (kt[e] = []), kt[e].push(t);
1171
1170
  }
1172
- e.addEventListener = we;
1173
- function Te(e, t) {
1171
+ e.addEventListener = Te;
1172
+ function Ee(e, t) {
1174
1173
  if (kt[e]) if (!t) delete kt[e];
1175
1174
  else {
1176
1175
  let n = kt[e].indexOf(t);
1177
1176
  n > -1 && kt[e].splice(n, 1);
1178
1177
  }
1179
1178
  }
1180
- e.removeEventListener = Te;
1179
+ e.removeEventListener = Ee;
1181
1180
  })(w || (w = {}));
1182
1181
  var T = w;
1183
1182
  //#endregion
@@ -1207,7 +1206,7 @@ var D = /* @__PURE__ */ function(e) {
1207
1206
  }
1208
1207
  }, Gt = /* @__PURE__ */ function(e) {
1209
1208
  return e.FpsLimit = "fps-limit", e;
1210
- }({}), Kt = class extends b {
1209
+ }({}), Kt = class extends y {
1211
1210
  constructor(e = R) {
1212
1211
  super(), h(this, "FPS_LIMITS", [
1213
1212
  13,
@@ -1253,7 +1252,7 @@ var D = /* @__PURE__ */ function(e) {
1253
1252
  return e.audio = "audio", e.video = "video", e.screen = "screen", e.audioshare = "audioshare", e;
1254
1253
  }({}), Jt = /* @__PURE__ */ function(e) {
1255
1254
  return e[e.CAMERA = 1] = "CAMERA", e[e.SCREEN = 2] = "SCREEN", e;
1256
- }({}), Yt = class extends b {
1255
+ }({}), Yt = class extends y {
1257
1256
  constructor(e = R, t = null) {
1258
1257
  super(), h(this, "_stream", null), h(this, "_screenTrack", null), h(this, "_audioShareTrack", null), h(this, "_screenShareTrack", null), h(this, "_sendVideoTrack", null), h(this, "_cameraVideoTrack", null), h(this, "_micAudioTrack", null), h(this, "_audioEffectsTrack", null), h(this, "_mediaSettings", E()), h(this, "_lastMediaSettings", null), h(this, "_videoStatusOnScreenCapturingEnabled", !1), h(this, "_effect", null), h(this, "_audioEffectParams", null), h(this, "_onDeviceChange", void 0), h(this, "_animojiEnabled", !1), h(this, "_videoEffectsFpsLimiter", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "videoTrackMuteHandler", () => {
1259
1258
  this._mediaSettings.isVideoEnabled && this.toggleVideo(!0);
@@ -1265,10 +1264,10 @@ var D = /* @__PURE__ */ function(e) {
1265
1264
  set cameraVideoTrack(e) {
1266
1265
  this._cameraVideoTrack && this._cameraVideoTrack.removeEventListener("mute", this.videoTrackMuteHandler), this._cameraVideoTrack = e, this._cameraVideoTrack && this._cameraVideoTrack.addEventListener("mute", this.videoTrackMuteHandler), M.consumerFastScreenShare && (this._screenShareTrack = this.getBlackScreenShareTrack());
1267
1266
  }
1268
- async request(e = [S.AUDIO], t = !0) {
1267
+ async request(e = [x.AUDIO], t = !0) {
1269
1268
  if (this._stream) return;
1270
- let n = e.includes(S.VIDEO), r = e.includes(S.AUDIO), i = e.includes(S.ANIMOJI), a = T.getBrowserSupportFailure();
1271
- if (a) throw new O(x.UNSUPPORTED, { callError: {
1269
+ let n = e.includes(x.VIDEO), r = e.includes(x.AUDIO), i = e.includes(x.ANIMOJI), a = T.getBrowserSupportFailure();
1270
+ if (a) throw new O(b.UNSUPPORTED, { callError: {
1272
1271
  scope: "internal",
1273
1272
  code: "environment",
1274
1273
  description: a
@@ -1313,11 +1312,11 @@ var D = /* @__PURE__ */ function(e) {
1313
1312
  case "audioinput":
1314
1313
  if (this._mediaSettings.isAudioEnabled) return this._changeAudioInput();
1315
1314
  break;
1316
- default: return Promise.reject(x.UNKNOWN);
1315
+ default: return Promise.reject(b.UNKNOWN);
1317
1316
  }
1318
1317
  }
1319
1318
  stopVideoTrack() {
1320
- this._mediaSettings.isVideoEnabled && (this._stopEffect(), this._stream && Xe(this._stream), this.cameraVideoTrack?.stop());
1319
+ this._mediaSettings.isVideoEnabled && (this._stopEffect(), this._stream && Ze(this._stream), this.cameraVideoTrack?.stop());
1321
1320
  }
1322
1321
  async setVideoStream(e, t) {
1323
1322
  return t ? this._changeScreen(!1, !1, e) : this._changeVideoInput(e);
@@ -1337,13 +1336,13 @@ var D = /* @__PURE__ */ function(e) {
1337
1336
  async _changeVideoInput(e) {
1338
1337
  try {
1339
1338
  let t = e ? "stream" : "video", n = e || await T._getUserVideo(!!this._effect, this._frameRate, this._debug, this._logger);
1340
- if (this.cameraVideoTrack?.stop(), this.cameraVideoTrack = n.getVideoTracks()[0], !this._stream) Ye(n);
1339
+ if (this.cameraVideoTrack?.stop(), this.cameraVideoTrack = n.getVideoTracks()[0], !this._stream) Xe(n);
1341
1340
  else {
1342
1341
  let e = await this._setEffect(this._effect, this.cameraVideoTrack);
1343
- this._logger?.log(C.DEVICE_CHANGED, t), this._debug.log("Video stream changed"), await this._replaceLocalTrack(e), this._mediaSettings.isVideoEnabled = !0, this._triggerEvent("SOURCE_CHANGED", { kind: "video" });
1342
+ this._logger?.log(S.DEVICE_CHANGED, t), this._debug.log("Video stream changed"), await this._replaceLocalTrack(e), this._mediaSettings.isVideoEnabled = !0, this._triggerEvent("SOURCE_CHANGED", { kind: "video" });
1344
1343
  }
1345
1344
  } catch (e) {
1346
- throw this._logger?.log(C.ERROR, "change_video"), this._debug.warn("Camera change failed", e), e;
1345
+ throw this._logger?.log(S.ERROR, "change_video"), this._debug.warn("Camera change failed", e), e;
1347
1346
  }
1348
1347
  }
1349
1348
  async setAudioStream(e) {
@@ -1352,30 +1351,30 @@ var D = /* @__PURE__ */ function(e) {
1352
1351
  async _changeAudioInput(e = null) {
1353
1352
  try {
1354
1353
  let t = e || await T.getUserAudio(void 0, this._debug, this._logger);
1355
- if (this._micAudioTrack?.stop(), this._micAudioTrack = t.getAudioTracks()[0], !this._stream) Ye(t);
1354
+ if (this._micAudioTrack?.stop(), this._micAudioTrack = t.getAudioTracks()[0], !this._stream) Xe(t);
1356
1355
  else {
1357
1356
  let e = await this._applyAudioEffect();
1358
- this._logger?.log(C.DEVICE_CHANGED, "audio"), this._debug.log("Audio stream changed", e), await this._replaceLocalTrack(e), this._mediaSettings.isAudioEnabled = !0, this._triggerEvent("SOURCE_CHANGED", { kind: "audio" });
1357
+ this._logger?.log(S.DEVICE_CHANGED, "audio"), this._debug.log("Audio stream changed", e), await this._replaceLocalTrack(e), this._mediaSettings.isAudioEnabled = !0, this._triggerEvent("SOURCE_CHANGED", { kind: "audio" });
1359
1358
  }
1360
1359
  } catch (e) {
1361
- throw this._logger?.log(C.ERROR, "change_audio"), this._debug.error("Microphone change failed", e), e;
1360
+ throw this._logger?.log(S.ERROR, "change_audio"), this._debug.error("Microphone change failed", e), e;
1362
1361
  }
1363
1362
  }
1364
1363
  async _changeScreen(e, t, n) {
1365
1364
  try {
1366
- if (n = n || await T.getScreenMedia(e, t, this._debug, this._logger), !this._stream) Ye(n);
1365
+ if (n = n || await T.getScreenMedia(e, t, this._debug, this._logger), !this._stream) Xe(n);
1367
1366
  else {
1368
1367
  let r = n.getVideoTracks()[0];
1369
1368
  if (r.addEventListener("ended", () => {
1370
1369
  this._mediaSettings.isScreenSharingEnabled && this.disableScreenCapturing();
1371
- }, !1), this._logger?.log(C.DEVICE_CHANGED, "screen"), this._debug.log("Screen capturing started"), this._screenTrack = r, this._mediaSettings.isScreenSharingEnabled = !0, this._mediaSettings.isFastScreenSharingEnabled = e, M.consumerFastScreenShare && this._mediaSettings.isFastScreenSharingEnabled && (r.contentHint = "motion", this._screenShareTrack = r), n.getAudioTracks().length > 0) {
1370
+ }, !1), this._logger?.log(S.DEVICE_CHANGED, "screen"), this._debug.log("Screen capturing started"), this._screenTrack = r, this._mediaSettings.isScreenSharingEnabled = !0, this._mediaSettings.isFastScreenSharingEnabled = e, M.consumerFastScreenShare && this._mediaSettings.isFastScreenSharingEnabled && (r.contentHint = "motion", this._screenShareTrack = r), n.getAudioTracks().length > 0) {
1372
1371
  let e = n.getAudioTracks()[0];
1373
1372
  e.contentHint = "music", this._audioShareTrack = e, await this._replaceLocalTrack(e), this._mediaSettings.isAudioSharingEnabled = !0;
1374
1373
  }
1375
1374
  t && !this._mediaSettings.isAudioSharingEnabled && this._debug.debug("Audio share requested but not captured"), this._triggerEvent("SCREEN_STATUS", { track: r }), this._triggerEvent("SOURCE_CHANGED", { kind: "screen" });
1376
1375
  }
1377
1376
  } catch (e) {
1378
- throw this._logger?.log(C.ERROR, "screen"), this._debug.warn("Screen capturing failed", e), e;
1377
+ throw this._logger?.log(S.ERROR, "screen"), this._debug.warn("Screen capturing failed", e), e;
1379
1378
  }
1380
1379
  }
1381
1380
  async _disableScreenCapture() {
@@ -1423,7 +1422,7 @@ var D = /* @__PURE__ */ function(e) {
1423
1422
  }
1424
1423
  }
1425
1424
  destroy() {
1426
- this._destroyDeviceChangeListener(), T.releaseFirefoxMicrophonePermissionWarmup(), M.videoEffects && (this._effect = null, M.videoEffects.destroy()), M.audioEffects && M.audioEffects.destroy(), this._stream && (Ye(this._stream), this._stream = null), this.cameraVideoTrack?.stop(), this._micAudioTrack?.stop(), this._audioEffectsTrack?.stop(), this._disableScreenCapture(), T.getAudioContext()?.suspend().catch((e) => this._debug.error(e)), this._videoEffectsFpsLimiter?.destroy();
1425
+ this._destroyDeviceChangeListener(), T.releaseFirefoxMicrophonePermissionWarmup(), M.videoEffects && (this._effect = null, M.videoEffects.destroy()), M.audioEffects && M.audioEffects.destroy(), this._stream && (Xe(this._stream), this._stream = null), this.cameraVideoTrack?.stop(), this._micAudioTrack?.stop(), this._audioEffectsTrack?.stop(), this._disableScreenCapture(), T.getAudioContext()?.suspend().catch((e) => this._debug.error(e)), this._videoEffectsFpsLimiter?.destroy();
1427
1426
  }
1428
1427
  async stopLocalMedia() {
1429
1428
  this._mediaSettings.isScreenSharingEnabled && await this.disableScreenCapturing(), this._stream && (this._lastMediaSettings = { ...this._mediaSettings }, this._stream.getAudioTracks().length > 0 && await this.toggleAudio(!1), this._stream.getVideoTracks().length > 0 && await this.toggleVideo(!1), this.cameraVideoTrack = null, this._micAudioTrack = null);
@@ -1431,7 +1430,7 @@ var D = /* @__PURE__ */ function(e) {
1431
1430
  async resumeLocalMedia(e) {
1432
1431
  if (!this._lastMediaSettings) return;
1433
1432
  let t = [];
1434
- if ((e ? e.isAudioEnabled : this._lastMediaSettings.isAudioEnabled) && (t.push(S.AUDIO), await this.toggleAudio(!0)), await this.request(t), this._lastMediaSettings = null, this._stream) for (let e of this._stream.getTracks()) this._triggerEvent("TRACK_REPLACED", e);
1433
+ if ((e ? e.isAudioEnabled : this._lastMediaSettings.isAudioEnabled) && (t.push(x.AUDIO), await this.toggleAudio(!0)), await this.request(t), this._lastMediaSettings = null, this._stream) for (let e of this._stream.getTracks()) this._triggerEvent("TRACK_REPLACED", e);
1435
1434
  }
1436
1435
  async toggleScreenCapturing(e) {
1437
1436
  if (e.captureScreen) {
@@ -1499,7 +1498,7 @@ var D = /* @__PURE__ */ function(e) {
1499
1498
  }
1500
1499
  async videoEffect(e) {
1501
1500
  if (!M.videoEffects) throw Error("Video Effects library is not set");
1502
- if (this._logger?.log(C.DEVICE_CHANGED, `effect_${e?.effect || "none"}`), !this._mediaSettings.isVideoEnabled) {
1501
+ if (this._logger?.log(S.DEVICE_CHANGED, `effect_${e?.effect || "none"}`), !this._mediaSettings.isVideoEnabled) {
1503
1502
  this._effect = e;
1504
1503
  return;
1505
1504
  }
@@ -1548,7 +1547,7 @@ var D = /* @__PURE__ */ function(e) {
1548
1547
  return this._effect ? Math.min(e, M.videoFrameRate) : void 0;
1549
1548
  }
1550
1549
  async _applyVideoConstraints(e, t) {
1551
- await Ze(e, {
1550
+ await Qe(e, {
1552
1551
  width: this._effect ? M.videoEffectMaxWidth : M.videoMaxWidth,
1553
1552
  height: this._effect ? M.videoEffectMaxHeight : M.videoMaxHeight,
1554
1553
  ...this._frameRate && { frameRate: { ideal: this._frameRate } },
@@ -1824,19 +1823,19 @@ var sn = 533, cn = "a=fmtp:", ln = "sps-pps-idr-in-keyframe=1", un;
1824
1823
  return ae(e.id, e.idType || A.USER, e.deviceIdx);
1825
1824
  }
1826
1825
  e.composeId = g;
1827
- function _(e) {
1828
- if (e.decorativeUserId) return ae(e.decorativeUserId, e.idType || A.USER, e.deviceIdx);
1829
- }
1830
- e.composeDecorativeId = _;
1831
1826
  function se(e) {
1832
- return e.participant ? g(e.participant) : ae(e.participantId, e.participantType || A.USER, e.deviceIdx);
1827
+ if (e.decorativeUserId) return ae(e.decorativeUserId, e.idType || A.USER, e.deviceIdx);
1833
1828
  }
1834
- e.composeMessageId = se;
1829
+ e.composeDecorativeId = se;
1835
1830
  function ce(e) {
1836
- return typeof e == "string" ? le(ue(e).compositeUserId).id : e;
1831
+ return e.participant ? g(e.participant) : ae(e.participantId, e.participantType || A.USER, e.deviceIdx);
1837
1832
  }
1838
- e.extractOkId = ce;
1833
+ e.composeMessageId = ce;
1839
1834
  function le(e) {
1835
+ return typeof e == "string" ? ue(de(e).compositeUserId).id : e;
1836
+ }
1837
+ e.extractOkId = le;
1838
+ function ue(e) {
1840
1839
  let t = String(e), n = t.match(re);
1841
1840
  return n ? {
1842
1841
  id: Number(n[2]),
@@ -1846,24 +1845,24 @@ var sn = 533, cn = "a=fmtp:", ln = "sps-pps-idr-in-keyframe=1", un;
1846
1845
  type: A.USER
1847
1846
  });
1848
1847
  }
1849
- e.decomposeId = le;
1850
- function ue(e) {
1848
+ e.decomposeId = ue;
1849
+ function de(e) {
1851
1850
  let t = e.split(":d");
1852
1851
  return {
1853
1852
  compositeUserId: t[0],
1854
1853
  deviceIdx: t.length > 1 ? parseInt(t[1], 10) : 0
1855
1854
  };
1856
1855
  }
1857
- e.decomposeParticipantId = ue;
1858
- function de() {
1856
+ e.decomposeParticipantId = de;
1857
+ function fe() {
1859
1858
  let e = window.crypto?.randomUUID?.();
1860
1859
  if (e) return e;
1861
1860
  let t = "0123456789abcdefghijklmnopqrstuvwxyz".split(""), n = Array(36), r = 0, i, a;
1862
1861
  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]);
1863
1862
  return n.join("");
1864
1863
  }
1865
- e.uuid = de;
1866
- function fe(e, t) {
1864
+ e.uuid = fe;
1865
+ function pe(e, t) {
1867
1866
  let n;
1868
1867
  function r(...r) {
1869
1868
  let i = this;
@@ -1873,8 +1872,8 @@ var sn = 533, cn = "a=fmtp:", ln = "sps-pps-idr-in-keyframe=1", un;
1873
1872
  }
1874
1873
  return r;
1875
1874
  }
1876
- e.debounce = fe;
1877
- function pe(e) {
1875
+ e.debounce = pe;
1876
+ function me(e) {
1878
1877
  if (!window.BigInt) return null;
1879
1878
  let t = "", n = e.split("\n");
1880
1879
  for (let e of n) if (e.startsWith("a=fingerprint")) {
@@ -1892,8 +1891,8 @@ var sn = 533, cn = "a=fmtp:", ln = "sps-pps-idr-in-keyframe=1", un;
1892
1891
  }
1893
1892
  return BigInt.asIntN(64, i);
1894
1893
  }
1895
- e.sdpFingerprint = pe;
1896
- async function me(e, { signal: t } = {}) {
1894
+ e.sdpFingerprint = me;
1895
+ async function he(e, { signal: t } = {}) {
1897
1896
  return new Promise((n, r) => {
1898
1897
  if (t?.aborted) return r(t.reason);
1899
1898
  let i = setTimeout(() => {
@@ -1904,13 +1903,13 @@ var sn = 533, cn = "a=fmtp:", ln = "sps-pps-idr-in-keyframe=1", un;
1904
1903
  t?.addEventListener("abort", a, { once: !0 });
1905
1904
  });
1906
1905
  }
1907
- e.delay = me;
1908
- function he(e, t, n, r = R) {
1906
+ e.delay = he;
1907
+ function ge(e, t, n, r = R) {
1909
1908
  let i = [];
1910
- return e.getSenders().forEach((e) => ge(t, e, e.track, n, i, r)), i;
1909
+ return e.getSenders().forEach((e) => _e(t, e, e.track, n, i, r)), i;
1911
1910
  }
1912
- e.applySettings = he;
1913
- function ge(e, t, n, r, i, a = R) {
1911
+ e.applySettings = ge;
1912
+ function _e(e, t, n, r, i, a = R) {
1914
1913
  if (!RTCRtpSender.prototype.getParameters || !RTCRtpSender.prototype.setParameters || !e || !n || n.kind !== k.video) return;
1915
1914
  let o = n.getSettings();
1916
1915
  if (!o) return;
@@ -1949,21 +1948,21 @@ var sn = 533, cn = "a=fmtp:", ln = "sps-pps-idr-in-keyframe=1", un;
1949
1948
  a.log(`applyVideoTrackSettings: actual encodings= ${JSON.stringify(e.encodings)}`);
1950
1949
  }
1951
1950
  }
1952
- e.applyVideoTrackSettings = ge;
1953
- function v(e, t) {
1951
+ e.applyVideoTrackSettings = _e;
1952
+ function _(e, t) {
1954
1953
  Array.isArray(t) || (t = [t]);
1955
1954
  for (let n of t) if (e.includes(n)) return !0;
1956
1955
  return !1;
1957
1956
  }
1958
- e.includesOneOf = v;
1959
- function _e(e) {
1957
+ e.includesOneOf = _;
1958
+ function ve(e) {
1960
1959
  return Object.entries(e.participantState?.state || {}).reduce((t, [n, r]) => (e.participantState && (t[n] = {
1961
1960
  ts: e.participantState.stateUpdateTs[n],
1962
1961
  state: r
1963
1962
  }), t), {});
1964
1963
  }
1965
- e.mapParticipantState = _e;
1966
- function ve(e) {
1964
+ e.mapParticipantState = ve;
1965
+ function ye(e) {
1967
1966
  let t = e.map((e) => ({
1968
1967
  uid: e.externalId,
1969
1968
  mediaSettings: e.mediaSettings,
@@ -1977,37 +1976,37 @@ var sn = 533, cn = "a=fmtp:", ln = "sps-pps-idr-in-keyframe=1", un;
1977
1976
  }));
1978
1977
  return M.filterObservers ? t.filter((e) => !e.uid.observer) : t;
1979
1978
  }
1980
- e.mapSharedParticipants = ve;
1981
- function ye(e, t) {
1979
+ e.mapSharedParticipants = ye;
1980
+ function be(e, t) {
1982
1981
  let n = Object.keys(e), r = Object.keys(t);
1983
1982
  if (n.length !== r.length) return !1;
1984
1983
  for (let i of n) if (!Object.hasOwn(r, i) || e[i].state !== t[i].state || e[i].ts !== t[i].ts) return !1;
1985
1984
  return !0;
1986
1985
  }
1987
- e.isEqualParticipantState = ye;
1988
- function be(e, t, n = !1) {
1986
+ e.isEqualParticipantState = be;
1987
+ function xe(e, t, n = !1) {
1989
1988
  let r = Object.keys(e), i = Object.keys(t);
1990
1989
  if (r.length !== i.length) return !1;
1991
1990
  for (let i of r) {
1992
1991
  if (!Object.hasOwn(t, i)) return !1;
1993
1992
  let r = e[i], a = t[i];
1994
- if (n && Ee(r) && Ee(a)) return be(r, a, n);
1993
+ if (n && De(r) && De(a)) return xe(r, a, n);
1995
1994
  if (r !== a) return !1;
1996
1995
  }
1997
1996
  return !0;
1998
1997
  }
1999
- e.isObjectsEquals = be;
2000
- function xe(e, t) {
1998
+ e.isObjectsEquals = xe;
1999
+ function Se(e, t) {
2001
2000
  if (e.length !== t.length) return !1;
2002
2001
  for (let n of e) if (t.indexOf(n) < 0) return !1;
2003
2002
  return !0;
2004
2003
  }
2005
- e.isArraysEquals = xe;
2006
- function Se(e) {
2004
+ e.isArraysEquals = Se;
2005
+ function Ce(e) {
2007
2006
  return !Object.keys(e).length;
2008
2007
  }
2009
- e.isEmptyObject = Se;
2010
- function Ce(e, t) {
2008
+ e.isEmptyObject = Ce;
2009
+ function we(e, t) {
2011
2010
  if (!e && !t) return 0;
2012
2011
  if (!e || !t) return e ? -1 : 1;
2013
2012
  return r(t.rank, e.rank) || r(e.ts, t.ts) || n(e, t);
@@ -2015,24 +2014,24 @@ var sn = 533, cn = "a=fmtp:", ln = "sps-pps-idr-in-keyframe=1", un;
2015
2014
  let n = {
2016
2015
  [A.USER]: 0,
2017
2016
  [A.GROUP]: 1
2018
- }, { compositeUserId: i, deviceIdx: a } = ue(e.id), { compositeUserId: o, deviceIdx: s } = ue(t.id), { id: c, type: l } = le(i), { id: u, type: d } = le(o);
2017
+ }, { compositeUserId: i, deviceIdx: a } = de(e.id), { compositeUserId: o, deviceIdx: s } = de(t.id), { id: c, type: l } = ue(i), { id: u, type: d } = ue(o);
2019
2018
  return r(n[l], n[d]) || r(c, u) || r(a, s);
2020
2019
  }
2021
2020
  function r(e, t) {
2022
2021
  return e < t ? -1 : e === t ? 0 : 1;
2023
2022
  }
2024
2023
  }
2025
- e.participantMarkerCompare = Ce;
2026
- function we(e, t) {
2024
+ e.participantMarkerCompare = we;
2025
+ function Te(e, t) {
2027
2026
  return an(Object.entries(e).filter(([, e]) => Array.isArray(t) ? !t.includes(e) : e !== t));
2028
2027
  }
2029
- e.objectFilterOutValues = we;
2030
- function Te(e, t, n) {
2028
+ e.objectFilterOutValues = Te;
2029
+ function Ee(e, t, n) {
2031
2030
  let r = n;
2032
2031
  for (let n in e) Object.hasOwn(e, n) && (r = t(r, e[n], n));
2033
2032
  return r;
2034
2033
  }
2035
- e.objectReduce = Te, e.setImmediate = (() => {
2034
+ e.objectReduce = Ee, e.setImmediate = (() => {
2036
2035
  let e = 1, t = {}, n = null;
2037
2036
  return typeof MessageChannel < "u" && (n = new MessageChannel(), n.port1.onmessage = (e) => {
2038
2037
  let n = e.data;
@@ -2048,11 +2047,11 @@ var sn = 533, cn = "a=fmtp:", ln = "sps-pps-idr-in-keyframe=1", un;
2048
2047
  return () => clearTimeout(i);
2049
2048
  };
2050
2049
  })();
2051
- function Ee(e) {
2050
+ function De(e) {
2052
2051
  return typeof e == "object" && !!e && !Array.isArray(e);
2053
2052
  }
2054
- e.isObject = Ee;
2055
- function De(e, n, r, i) {
2053
+ e.isObject = De;
2054
+ function Oe(e, n, r, i) {
2056
2055
  function a(e, t) {
2057
2056
  let n = 0, r = e.length, i = !1;
2058
2057
  for (let a = 0; a < e.length; a++) if (!i && e[a].startsWith("m=video") && (n = a), e[a].startsWith("a=mid:" + t) && (i = !0), i && e[a].startsWith("m=")) {
@@ -2078,7 +2077,7 @@ var sn = 533, cn = "a=fmtp:", ln = "sps-pps-idr-in-keyframe=1", un;
2078
2077
  }
2079
2078
  return e;
2080
2079
  }
2081
- e.patchSimulcastAnswerSdp = De;
2080
+ e.patchSimulcastAnswerSdp = Oe;
2082
2081
  })(un || (un = {}));
2083
2082
  var j = un, dn = "__CALLS_SDK_DEVTOOLS_", fn = class {
2084
2083
  set(e, t) {
@@ -2167,7 +2166,7 @@ var j = un, dn = "__CALLS_SDK_DEVTOOLS_", fn = class {
2167
2166
  h(mn, "instance", null);
2168
2167
  var hn = mn.getInstance(), M = class e {
2169
2168
  static set(t) {
2170
- Object.hasOwn(t, "voiceParams") && (Object.assign(e._params.voiceParams, t.voiceParams), delete t.voiceParams), Object.hasOwn(t, "specListenerParams") && (Object.assign(e._params.specListenerParams, t.specListenerParams), delete t.specListenerParams), Object.hasOwn(t, "apiAuth") && (y.accessToken = t.apiAuth.accessToken, y.sessionKey = t.apiAuth.sessionKey, y.sessionSecretKey = t.apiAuth.sessionSecretKey);
2169
+ Object.hasOwn(t, "voiceParams") && (Object.assign(e._params.voiceParams, t.voiceParams), delete t.voiceParams), Object.hasOwn(t, "specListenerParams") && (Object.assign(e._params.specListenerParams, t.specListenerParams), delete t.specListenerParams), Object.hasOwn(t, "apiAuth") && (v.accessToken = t.apiAuth.accessToken, v.sessionKey = t.apiAuth.sessionKey, v.sessionSecretKey = t.apiAuth.sessionSecretKey);
2171
2170
  let n = hn.params.applyOverrides(t);
2172
2171
  Object.assign(e._params, j.objectFilterOutValues(n, void 0));
2173
2172
  }
@@ -2184,7 +2183,7 @@ var hn = mn.getInstance(), M = class e {
2184
2183
  return 1.1;
2185
2184
  }
2186
2185
  static get sdkVersion() {
2187
- return "2.8.12-dev.35600965.0";
2186
+ return "2.8.12-dev.48fc9c32.0";
2188
2187
  }
2189
2188
  static get debug() {
2190
2189
  return e._params.debug;
@@ -2559,12 +2558,6 @@ var hn = mn.getInstance(), M = class e {
2559
2558
  static get enableSessionStateUpdates() {
2560
2559
  return e._params.enableSessionStateUpdates;
2561
2560
  }
2562
- static get safariAudioElement() {
2563
- return e._params.safariAudioElement;
2564
- }
2565
- static get forwardEmptyIceCandidate() {
2566
- return e._params.forwardEmptyIceCandidate;
2567
- }
2568
2561
  static toJSON() {
2569
2562
  return {
2570
2563
  apiKey: e._params.apiKey,
@@ -2601,9 +2594,7 @@ var hn = mn.getInstance(), M = class e {
2601
2594
  webtransport: e._params.webtransport,
2602
2595
  waitForRecordResponse: e._params.waitForRecordResponse,
2603
2596
  transparentAudio: e._params.transparentAudio,
2604
- enableSessionStateUpdates: e._params.enableSessionStateUpdates,
2605
- safariAudioElement: e._params.safariAudioElement,
2606
- forwardEmptyIceCandidate: e._params.forwardEmptyIceCandidate
2597
+ enableSessionStateUpdates: e._params.enableSessionStateUpdates
2607
2598
  };
2608
2599
  }
2609
2600
  };
@@ -2714,9 +2705,7 @@ h(M, "_params", {
2714
2705
  webtransport: !1,
2715
2706
  waitForRecordResponse: !1,
2716
2707
  transparentAudio: !1,
2717
- enableSessionStateUpdates: !1,
2718
- safariAudioElement: !1,
2719
- forwardEmptyIceCandidate: !1
2708
+ enableSessionStateUpdates: !1
2720
2709
  });
2721
2710
  //#endregion
2722
2711
  //#region src/static/External.ts
@@ -2835,251 +2824,251 @@ var _n;
2835
2824
  F("onRemoteSharedUrl", e, t, n, r);
2836
2825
  }
2837
2826
  e.onRemoteSharedUrl = g;
2838
- function _(e, t, n) {
2827
+ function se(e, t, n) {
2839
2828
  F("onParticipantAdded", e, t, n);
2840
2829
  }
2841
- e.onParticipantAdded = _;
2842
- function se(e, t, n) {
2830
+ e.onParticipantAdded = se;
2831
+ function ce(e, t, n) {
2843
2832
  F("onParticipantJoined", e, t, n);
2844
2833
  }
2845
- e.onParticipantJoined = se;
2846
- function ce(e, t = !1, n) {
2834
+ e.onParticipantJoined = ce;
2835
+ function le(e, t = !1, n) {
2847
2836
  P("onLocalParticipantState", I(e), t, n);
2848
2837
  }
2849
- e.onLocalParticipantState = ce;
2850
- function le(e, t, n, r) {
2838
+ e.onLocalParticipantState = le;
2839
+ function ue(e, t, n, r) {
2851
2840
  F("onRemoteParticipantState", e, I(t), n, r);
2852
2841
  }
2853
- e.onRemoteParticipantState = le;
2854
- function ue(e, t, n) {
2842
+ e.onRemoteParticipantState = ue;
2843
+ function de(e, t, n) {
2855
2844
  P("onRemoteParticipantsState", e, t, n);
2856
2845
  }
2857
- e.onRemoteParticipantsState = ue;
2858
- function de(e, t, n = null, r) {
2846
+ e.onRemoteParticipantsState = de;
2847
+ function fe(e, t, n = null, r) {
2859
2848
  R.debug("Remote status:", t, e), F("onRemoteStatus", e, t, n, r);
2860
2849
  }
2861
- e.onRemoteStatus = de;
2862
- function fe() {
2850
+ e.onRemoteStatus = fe;
2851
+ function pe() {
2863
2852
  P("onPermissionsRequested");
2864
2853
  }
2865
- e.onPermissionsRequested = fe;
2866
- function pe(e, t) {
2854
+ e.onPermissionsRequested = pe;
2855
+ function me(e, t) {
2867
2856
  P("onPermissionsError", e, t);
2868
2857
  }
2869
- e.onPermissionsError = pe;
2870
- function me(e, t, n) {
2858
+ e.onPermissionsError = me;
2859
+ function he(e, t, n) {
2871
2860
  F("onRemoteRemoved", e, t, n);
2872
2861
  }
2873
- e.onRemoteRemoved = me;
2874
- function he(e, t, n, r) {
2862
+ e.onRemoteRemoved = he;
2863
+ function ge(e, t, n, r) {
2875
2864
  P("onCallState", e, t, I(n), r);
2876
2865
  }
2877
- e.onCallState = he;
2878
- function ge(e, t, n) {
2866
+ e.onCallState = ge;
2867
+ function _e(e, t, n) {
2879
2868
  P("onDeviceSwitched", e, t, n);
2880
2869
  }
2881
- e.onDeviceSwitched = ge;
2882
- function v(e, t, n, r = !1, i = !1, a = null, o = null, s, c, l = null, u) {
2870
+ e.onDeviceSwitched = _e;
2871
+ function _(e, t, n, r = !1, i = !1, a = null, o = null, s, c, l = null, u) {
2883
2872
  let d = c ? gn(c) : void 0;
2884
2873
  P("onMuteStates", I(e), gn(t), gn(n), r, i, a, o, s, d, l, u);
2885
2874
  }
2886
- e.onMuteStates = v;
2887
- function _e(e, t, n = !1, r) {
2875
+ e.onMuteStates = _;
2876
+ function ve(e, t, n = !1, r) {
2888
2877
  F("onRolesChanged", e, gn(t), n, r);
2889
2878
  }
2890
- e.onRolesChanged = _e;
2891
- function ve(e, t = !1, n) {
2879
+ e.onRolesChanged = ve;
2880
+ function ye(e, t = !1, n) {
2892
2881
  P("onLocalRolesChanged", gn(e), t, n);
2893
2882
  }
2894
- e.onLocalRolesChanged = ve;
2895
- function ye(e, t, n, r, i) {
2883
+ e.onLocalRolesChanged = ye;
2884
+ function be(e, t, n, r, i) {
2896
2885
  F("onPinnedParticipant", e, t, n, r, i);
2897
2886
  }
2898
- e.onPinnedParticipant = ye;
2899
- function be(e, t, n) {
2887
+ e.onPinnedParticipant = be;
2888
+ function xe(e, t, n) {
2900
2889
  P("onLocalPin", e, t, n);
2901
2890
  }
2902
- e.onLocalPin = be;
2903
- function xe(e, t) {
2891
+ e.onLocalPin = xe;
2892
+ function Se(e, t) {
2904
2893
  P("onOptionsChanged", gn(e), t);
2905
2894
  }
2906
- e.onOptionsChanged = xe;
2907
- function Se(e) {
2895
+ e.onOptionsChanged = Se;
2896
+ function Ce(e) {
2908
2897
  P("onCallAccepted", e);
2909
2898
  }
2910
- e.onCallAccepted = Se;
2911
- function Ce(e) {
2899
+ e.onCallAccepted = Ce;
2900
+ function we(e) {
2912
2901
  P("onCallActive", e);
2913
2902
  }
2914
- e.onCallActive = Ce;
2915
- function we(e, t, n) {
2903
+ e.onCallActive = we;
2904
+ function Te(e, t, n) {
2916
2905
  F("onAcceptedCall", e, t, n);
2917
2906
  }
2918
- e.onAcceptedCall = we;
2919
- function Te(e) {
2907
+ e.onAcceptedCall = Te;
2908
+ function Ee(e) {
2920
2909
  P("onRateNeeded", e);
2921
2910
  }
2922
- e.onRateNeeded = Te;
2923
- function Ee(e, t) {
2911
+ e.onRateNeeded = Ee;
2912
+ function De(e, t) {
2924
2913
  F("onSpeakerChanged", e, t);
2925
2914
  }
2926
- e.onSpeakerChanged = Ee;
2927
- function De(e, t) {
2915
+ e.onSpeakerChanged = De;
2916
+ function Oe(e, t) {
2928
2917
  P("onVolumesDetected", gn(e), t);
2929
2918
  }
2930
- e.onVolumesDetected = De;
2931
- function Oe(e, t) {
2919
+ e.onVolumesDetected = Oe;
2920
+ function ke(e, t) {
2932
2921
  P("onLocalVolume", e, t);
2933
2922
  }
2934
- e.onLocalVolume = Oe;
2935
- function ke(e, t, n) {
2923
+ e.onLocalVolume = ke;
2924
+ function Ae(e, t, n) {
2936
2925
  P("onJoinStatus", e, t, n);
2937
2926
  }
2938
- e.onJoinStatus = ke;
2939
- function Ae(e, t) {
2927
+ e.onJoinStatus = Ae;
2928
+ function je(e, t) {
2940
2929
  P("onHangup", e, t);
2941
2930
  }
2942
- e.onHangup = Ae;
2943
- function je(e) {
2931
+ e.onHangup = je;
2932
+ function Me(e) {
2944
2933
  P("onMultipartyChatCreated", I(e));
2945
2934
  }
2946
- e.onMultipartyChatCreated = je;
2947
- function Me() {
2935
+ e.onMultipartyChatCreated = Me;
2936
+ function Ne() {
2948
2937
  P("onDeviceChange");
2949
2938
  }
2950
- e.onDeviceChange = Me;
2951
- function Ne(e) {
2939
+ e.onDeviceChange = Ne;
2940
+ function Pe(e) {
2952
2941
  P("onFingerprintChange", e);
2953
2942
  }
2954
- e.onFingerprintChange = Ne;
2955
- function Pe() {
2943
+ e.onFingerprintChange = Pe;
2944
+ function Fe() {
2956
2945
  P("onTokenExpired");
2957
2946
  }
2958
- e.onTokenExpired = Pe;
2959
- function Fe(e, t, n = !1, r) {
2947
+ e.onTokenExpired = Fe;
2948
+ function Ie(e, t, n = !1, r) {
2960
2949
  P("onChatMessage", e, t, n, r);
2961
2950
  }
2962
- e.onChatMessage = Fe;
2963
- function Ie(e, t, n = !1, r) {
2951
+ e.onChatMessage = Ie;
2952
+ function Le(e, t, n = !1, r) {
2964
2953
  P("onCustomData", e, t, n, r);
2965
2954
  }
2966
- e.onCustomData = Ie;
2967
- function Le(e, t, n, r, i, a, o = null, s) {
2955
+ e.onCustomData = Le;
2956
+ function Re(e, t, n, r, i, a, o = null, s) {
2968
2957
  P("onRecordStarted", e, t, n, r, i, a, o, s);
2969
2958
  }
2970
- e.onRecordStarted = Le;
2971
- function Re(e = null, t, n) {
2959
+ e.onRecordStarted = Re;
2960
+ function ze(e = null, t, n) {
2972
2961
  P("onRecordStopped", e, t, n);
2973
2962
  }
2974
- e.onRecordStopped = Re;
2975
- function ze(e, t) {
2963
+ e.onRecordStopped = ze;
2964
+ function Be(e, t) {
2976
2965
  P("onLocalNetworkStatusChanged", e, t);
2977
2966
  }
2978
- e.onLocalNetworkStatusChanged = ze;
2979
- function Be(e, t) {
2967
+ e.onLocalNetworkStatusChanged = Be;
2968
+ function Ve(e, t) {
2980
2969
  P("onNetworkStatusChanged", e, t);
2981
2970
  }
2982
- e.onNetworkStatusChanged = Be;
2983
- function Ve(e, ...t) {
2971
+ e.onNetworkStatusChanged = Ve;
2972
+ function He(e, ...t) {
2984
2973
  P("onDebugMessage", e, ...t);
2985
2974
  }
2986
- e.onDebugMessage = Ve;
2987
- function He(e, t, ...n) {
2975
+ e.onDebugMessage = He;
2976
+ function Ue(e, t, ...n) {
2988
2977
  P("onDebugMessageWithContext", e, t, ...n);
2989
2978
  }
2990
- e.onDebugMessageWithContext = He;
2991
- function Ue(e, t) {
2979
+ e.onDebugMessageWithContext = Ue;
2980
+ function We(e, t) {
2992
2981
  P("onStatistics", Object.assign({}, e, { memory: t }));
2993
2982
  }
2994
- e.onStatistics = Ue;
2995
- function We() {
2983
+ e.onStatistics = We;
2984
+ function Ge() {
2996
2985
  P("onAutoplayError");
2997
2986
  }
2998
- e.onAutoplayError = We;
2999
- function Ge(e, t, n, r, i, a) {
2987
+ e.onAutoplayError = Ge;
2988
+ function Ke(e, t, n, r, i, a) {
3000
2989
  P("onChatRoomUpdated", e, t, n, r, i, a);
3001
2990
  }
3002
- e.onChatRoomUpdated = Ge;
3003
- function Ke(e, t) {
2991
+ e.onChatRoomUpdated = Ke;
2992
+ function qe(e, t) {
3004
2993
  P("onPromoted", e, t);
3005
2994
  }
3006
- e.onPromoted = Ke;
3007
- function qe(e, t) {
2995
+ e.onPromoted = qe;
2996
+ function Je(e, t) {
3008
2997
  P("onRemoteMixedAudioStream", e, t);
3009
2998
  }
3010
- e.onRemoteMixedAudioStream = qe;
3011
- function y(e, t) {
2999
+ e.onRemoteMixedAudioStream = Je;
3000
+ function v(e, t) {
3012
3001
  P("onJoinLinkChanged", e, t);
3013
3002
  }
3014
- e.onJoinLinkChanged = y;
3015
- function b(e, t) {
3003
+ e.onJoinLinkChanged = v;
3004
+ function y(e, t) {
3016
3005
  P("onRoomsUpdated", e, t);
3017
3006
  }
3018
- e.onRoomsUpdated = b;
3019
- function x(e, t, n, r, i) {
3007
+ e.onRoomsUpdated = y;
3008
+ function b(e, t, n, r, i) {
3020
3009
  P("onRoomUpdated", e, t, n, r, i);
3021
3010
  }
3022
- e.onRoomUpdated = x;
3023
- function S(e, t) {
3011
+ e.onRoomUpdated = b;
3012
+ function x(e, t) {
3024
3013
  P("onRoomParticipantsUpdated", e, t);
3025
3014
  }
3026
- e.onRoomParticipantsUpdated = S;
3027
- function C(e, t) {
3015
+ e.onRoomParticipantsUpdated = x;
3016
+ function S(e, t) {
3028
3017
  P("onRoomSwitched", e, t);
3029
3018
  }
3030
- e.onRoomSwitched = C;
3031
- function Je(e, t) {
3019
+ e.onRoomSwitched = S;
3020
+ function Ye(e, t) {
3032
3021
  P("onRoomStart", e, t);
3033
3022
  }
3034
- e.onRoomStart = Je;
3035
- function Ye(e, t = null, n) {
3023
+ e.onRoomStart = Ye;
3024
+ function Xe(e, t = null, n) {
3036
3025
  P("onFeedback", e, t, n);
3037
3026
  }
3038
- e.onFeedback = Ye;
3039
- function Xe(e, t) {
3027
+ e.onFeedback = Xe;
3028
+ function Ze(e, t) {
3040
3029
  P("onFeaturesPerRoleChanged", e, t);
3041
3030
  }
3042
- e.onFeaturesPerRoleChanged = Xe;
3043
- function Ze(e, t) {
3031
+ e.onFeaturesPerRoleChanged = Ze;
3032
+ function Qe(e, t) {
3044
3033
  P("onParticipantVmojiUpdate", e, t);
3045
3034
  }
3046
- e.onParticipantVmojiUpdate = Ze;
3047
- function Qe(e, t, n) {
3035
+ e.onParticipantVmojiUpdate = Qe;
3036
+ function $e(e, t, n) {
3048
3037
  P("onAsrSet", e, t, n);
3049
3038
  }
3050
- e.onAsrSet = Qe;
3051
- function $e(e, t, n, r) {
3039
+ e.onAsrSet = $e;
3040
+ function et(e, t, n, r) {
3052
3041
  P("onAsrStarted", e, t, n, r);
3053
3042
  }
3054
- e.onAsrStarted = $e;
3055
- function et(e, t) {
3043
+ e.onAsrStarted = et;
3044
+ function tt(e, t) {
3056
3045
  P("onAsrStopped", e, t);
3057
3046
  }
3058
- e.onAsrStopped = et;
3059
- function tt(e, t, n, r, i) {
3047
+ e.onAsrStopped = tt;
3048
+ function nt(e, t, n, r, i) {
3060
3049
  P("onAsrTranscription", e, t, n, r, i);
3061
3050
  }
3062
- e.onAsrTranscription = tt;
3063
- function nt(e, t, n) {
3051
+ e.onAsrTranscription = nt;
3052
+ function rt(e, t, n) {
3064
3053
  P("onParticipantIdChanged", e, t, n);
3065
3054
  }
3066
- e.onParticipantIdChanged = nt;
3067
- function rt(e, t) {
3055
+ e.onParticipantIdChanged = rt;
3056
+ function it(e, t) {
3068
3057
  P("onVideoSuspendSuggest", e, t);
3069
3058
  }
3070
- e.onVideoSuspendSuggest = rt;
3071
- function it(e) {
3059
+ e.onVideoSuspendSuggest = it;
3060
+ function at(e) {
3072
3061
  P("onSignalingMessage", typeof e == "string" ? e : I(e));
3073
3062
  }
3074
- e.onSignalingMessage = it;
3075
- function at(e, t) {
3063
+ e.onSignalingMessage = at;
3064
+ function ot(e, t) {
3076
3065
  P("onPromotionApproved", e, t);
3077
3066
  }
3078
- e.onPromotionApproved = at;
3079
- function ot(e, t) {
3067
+ e.onPromotionApproved = ot;
3068
+ function st(e, t) {
3080
3069
  P("onPeerRegistered", e, t);
3081
3070
  }
3082
- e.onPeerRegistered = ot;
3071
+ e.onPeerRegistered = st;
3083
3072
  })(_n || (_n = {}));
3084
3073
  var L = _n, vn = /* @__PURE__ */ function(e) {
3085
3074
  return e.DEBUG = "DEBUG", e.LOG = "LOG", e.WARN = "WARN", e.ERROR = "ERROR", e;
@@ -3101,7 +3090,7 @@ var L = _n, vn = /* @__PURE__ */ function(e) {
3101
3090
  }
3102
3091
  function u(e, t, n) {
3103
3092
  let u = l(n);
3104
- if (M.debugLog && ke(e, t, u.sessionId || void 0), c) switch (e) {
3093
+ if (M.debugLog && Ae(e, t, u.sessionId || void 0), c) switch (e) {
3105
3094
  case "DEBUG":
3106
3095
  i(...t);
3107
3096
  break;
@@ -3138,7 +3127,7 @@ var L = _n, vn = /* @__PURE__ */ function(e) {
3138
3127
  }
3139
3128
  e.enabled = ee;
3140
3129
  function h(e) {
3141
- c = e, M.debugLog && Ae();
3130
+ c = e, M.debugLog && je();
3142
3131
  }
3143
3132
  e.toggle = h;
3144
3133
  function te(e, ...t) {
@@ -3170,7 +3159,7 @@ var L = _n, vn = /* @__PURE__ */ function(e) {
3170
3159
  function re(e = null) {
3171
3160
  let t = null, n = e;
3172
3161
  function r() {
3173
- !M.debugLog || t || (t = je(), n && Me(n, t));
3162
+ !M.debugLog || t || (t = Me(), n && Ne(n, t));
3174
3163
  }
3175
3164
  let i = () => (r(), {
3176
3165
  sessionId: t,
@@ -3184,7 +3173,7 @@ var L = _n, vn = /* @__PURE__ */ function(e) {
3184
3173
  return n;
3185
3174
  },
3186
3175
  setConversationId(e) {
3187
- n = e, t && Me(n, t);
3176
+ n = e, t && Ne(n, t);
3188
3177
  },
3189
3178
  send: (e, ...t) => u(e, t, i),
3190
3179
  debug: (...e) => u("DEBUG", e, i),
@@ -3296,7 +3285,7 @@ var R = yn, z = new class {
3296
3285
  this._pendingRemovals.clear();
3297
3286
  }
3298
3287
  }
3299
- }(), bn = class extends b {
3288
+ }(), bn = class extends y {
3300
3289
  constructor(...e) {
3301
3290
  super(...e), h(this, "_abortSignal", void 0);
3302
3291
  }
@@ -3709,7 +3698,7 @@ function ir(e, t, n = !1) {
3709
3698
  }).filter((e) => !!e);
3710
3699
  }
3711
3700
  function ar(e, t, n = !1) {
3712
- if (!t || !t.rtps || !e.rtps) return e;
3701
+ if (!t || !t.rtps.length || !e.rtps.length) return e;
3713
3702
  let r, i;
3714
3703
  n && (r = Qn("ssrc", e?.remoteRtps || []), i = Qn("ssrc", t?.remoteRtps || []));
3715
3704
  let a = Qn("ssrc", e.rtps), o = Qn("ssrc", t.rtps), s = (e.timestamp - t.timestamp) / 1e3;
@@ -3878,7 +3867,7 @@ var Er = class {
3878
3867
  this._timer = null, this._poll();
3879
3868
  }, this._pollIntervalMs));
3880
3869
  }
3881
- }, Dr = class extends b {
3870
+ }, Dr = class extends y {
3882
3871
  constructor(e, t, n = null) {
3883
3872
  super(), h(this, "_signaling", void 0), h(this, "_mediaSource", void 0), h(this, "_state", q.IDLE), h(this, "_pc", null), h(this, "_onFirstMediaSent", void 0), h(this, "_firstMediaSentProbe", null), h(this, "_firstMediaSentProbeStopped", !1), this._signaling = e, this._mediaSource = t, this._onFirstMediaSent = n;
3884
3873
  }
@@ -3912,7 +3901,7 @@ var Er = class {
3912
3901
  getValue() {
3913
3902
  return this.value;
3914
3903
  }
3915
- }, kr = .25, Ar = .35, jr = 85, Mr = .1, Nr = 1.5, Pr = .1, Fr = 1, Ir = .6, Lr = .3, Rr = class extends b {
3904
+ }, kr = .25, Ar = .35, jr = 85, Mr = .1, Nr = 1.5, Pr = .1, Fr = 1, Ir = .6, Lr = .3, Rr = class extends y {
3916
3905
  constructor(e, t = R) {
3917
3906
  super(), h(this, "_signaling", void 0), h(this, "_localNetworkStat", void 0), h(this, "_remoteNetworkStat", void 0), h(this, "_lastNetworkStat", void 0), h(this, "_networkLimits", {
3918
3907
  badNet: {
@@ -4006,14 +3995,14 @@ var Er = class {
4006
3995
  try {
4007
3996
  this._pc = this._createPeerConnection();
4008
3997
  } catch (e) {
4009
- this._debug.error("Failed to create RTCPeerConnection:", e), this.close(e);
3998
+ this._debug.error("Failed to create RTCPeerConnection:", e), this._failedOnCreate = e;
4010
3999
  return;
4011
4000
  }
4012
4001
  if (this._isMaster) {
4013
4002
  try {
4014
4003
  this._mediaSource.addTrackToPeerConnection(this._pc, !1, !0), this._applySettings();
4015
4004
  } catch (e) {
4016
- this._logger?.log(C.ERROR, "addTrack-direct"), this._debug.error("Unable to add media source tracks", e, { participantId: this._participantId }), this._failedOnCreate = e;
4005
+ this._logger?.log(S.ERROR, "addTrack-direct"), this._debug.error("Unable to add media source tracks", e, { participantId: this._participantId }), this._failedOnCreate = e;
4017
4006
  return;
4018
4007
  }
4019
4008
  this._createOffer(!1).catch((e) => {
@@ -4041,13 +4030,13 @@ var Er = class {
4041
4030
  return;
4042
4031
  }
4043
4032
  if (this._failedOnCreate) {
4044
- this.close(this._failedOnCreate);
4033
+ this._finishClose(this._failedOnCreate);
4045
4034
  return;
4046
4035
  }
4047
4036
  if (this._debug.debug("DirectTransport: Open transport", { participantId: this._participantId }), this._isOpen = !0, this._remotePeerId = e, !this._isMaster) try {
4048
4037
  this._mediaSource.addTrackToPeerConnection(this._pc, !1, !0), this._applySettings();
4049
4038
  } catch (e) {
4050
- this._logger?.log(C.ERROR, "addTrack-direct"), this._debug.error("DirectTransport: Unable to add media source tracks", e, { participantId: this._participantId }), this.close(e);
4039
+ this._logger?.log(S.ERROR, "addTrack-direct"), this._debug.error("DirectTransport: Unable to add media source tracks", e, { participantId: this._participantId }), this.close(e);
4051
4040
  return;
4052
4041
  }
4053
4042
  this._startFirstMediaSentProbe(), this._setState(q.OPENED);
@@ -4126,7 +4115,10 @@ var Er = class {
4126
4115
  }
4127
4116
  }
4128
4117
  close(e) {
4129
- this._isOpen && (this._isOpen = !1, this._stopReconnection(), this._stopStatInterval(), this._stopSettingsInterval(), this._disposePeerConnection(), this._onNetworkStatus(1), this.unsubscribe(), e ? (this._debug.error("DirectTransport: Closed", e, { participantId: this._participantId }), this._setState(q.FAILED)) : (this._debug.debug("DirectTransport: Closed", { participantId: this._participantId }), this._setState(q.CLOSED)), this._triggerEvent(X.PEER_CONNECTION_CLOSED));
4118
+ this._isOpen && this._finishClose(e);
4119
+ }
4120
+ _finishClose(e) {
4121
+ this._isOpen = !1, this._stopReconnection(), this._stopStatInterval(), this._stopSettingsInterval(), this._disposePeerConnection(), this._onNetworkStatus(1), this.unsubscribe(), e ? (this._debug.error("DirectTransport: Closed", e, { participantId: this._participantId }), this._setState(q.FAILED)) : (this._debug.debug("DirectTransport: Closed", { participantId: this._participantId }), this._setState(q.CLOSED)), this._triggerEvent(X.PEER_CONNECTION_CLOSED);
4130
4122
  }
4131
4123
  _setState(e) {
4132
4124
  this._state !== e && (this._debug.debug(`DirectTransport: State changed to ${e}`, { participantId: this._participantId }), this._state = e, this._triggerEvent(X.STATE_CHANGED, e));
@@ -4157,7 +4149,7 @@ var Er = class {
4157
4149
  try {
4158
4150
  await this._pc.addIceCandidate(new RTCIceCandidate(t));
4159
4151
  } catch (e) {
4160
- throw this._logger?.log(C.ERROR, "addIceCandidate-direct"), this._debug.error("Unable to add remote ice candidate", e, {
4152
+ throw this._logger?.log(S.ERROR, "addIceCandidate-direct"), this._debug.error("Unable to add remote ice candidate", e, {
4161
4153
  participantId: this._participantId,
4162
4154
  candidate: t
4163
4155
  }), e;
@@ -4188,7 +4180,7 @@ var Er = class {
4188
4180
  try {
4189
4181
  await this._pc.setRemoteDescription(n), await this._setRemoteCandidates(t), this._processAnimojiProtocolVersion(this._remoteAnimojiVersion);
4190
4182
  } catch (e) {
4191
- throw this._logger?.log(C.ERROR, "setRemoteDescription-direct"), this._debug.error("Unable to set remote description", e, {
4183
+ throw this._logger?.log(S.ERROR, "setRemoteDescription-direct"), this._debug.error("Unable to set remote description", e, {
4192
4184
  participantId: this._participantId,
4193
4185
  sdp: n
4194
4186
  }), e;
@@ -4208,10 +4200,10 @@ var Er = class {
4208
4200
  }), this._triggerEvent(X.REMOTE_TRACK_ADDED, this._remoteStream, e.track);
4209
4201
  }
4210
4202
  async _handleIceCandidate(e) {
4211
- this._signaling.ready && (e.candidate ? (this._debug.debug("Local ice candidate", {
4203
+ e.candidate && this._signaling.ready && (this._debug.debug("Local ice candidate", {
4212
4204
  participantId: this._participantId,
4213
4205
  candidate: e.candidate
4214
- }), await this._signaling.sendCandidate(this._participantId, e.candidate)) : M.forwardEmptyIceCandidate && (this._debug.debug("ICE gathering complete, forwarding empty candidate", { participantId: this._participantId }), await this._signaling.sendCandidate(this._participantId, { candidate: "" })));
4206
+ }), await this._signaling.sendCandidate(this._participantId, e.candidate));
4215
4207
  }
4216
4208
  _onSignalingStateChange() {
4217
4209
  this._debug.debug(`DirectTransport: Signaling state changed to ${this._pc?.signalingState}`, { participantId: this._participantId });
@@ -4240,11 +4232,11 @@ var Er = class {
4240
4232
  }
4241
4233
  _markConnected() {
4242
4234
  this._neverConnected = !1, this._setState(q.CONNECTED), this._stopReconnection(), this._pc && j.getPeerConnectionHostInfo(this._pc).then((e) => {
4243
- e?.local && (this._logger?.log(C.ICE_CONNECTION_TYPE, e.local.type), this._debug.debug("Selected ICE candidates", e));
4235
+ e?.local && (this._logger?.log(S.ICE_CONNECTION_TYPE, e.local.type), this._debug.debug("Selected ICE candidates", e));
4244
4236
  }), this._startStatInterval();
4245
4237
  }
4246
4238
  _onConnectionStateChange() {
4247
- switch (this._debug.debug(`DirectTransport: Connection state changed to ${this._pc?.connectionState}`, { participantId: this._participantId }), this._logger?.log(C.ICE_CONNECTION_STATE, this._pc?.connectionState), this._pc?.connectionState) {
4239
+ switch (this._debug.debug(`DirectTransport: Connection state changed to ${this._pc?.connectionState}`, { participantId: this._participantId }), this._logger?.log(S.ICE_CONNECTION_STATE, this._pc?.connectionState), this._pc?.connectionState) {
4248
4240
  case "connected":
4249
4241
  this._markConnected();
4250
4242
  break;
@@ -4269,8 +4261,8 @@ var Er = class {
4269
4261
  this._reconnectionTimeout && (clearTimeout(this._reconnectionTimeout), this._reconnectionTimeout = null), this._iceRestartTimeout && (clearTimeout(this._iceRestartTimeout), this._iceRestartTimeout = null);
4270
4262
  }
4271
4263
  _startIceRestart() {
4272
- this._isMaster ? (this._logger?.log(C.ICE_RESTART), this._debug.log("Ice restart", { participantId: this._participantId }), this._createOffer(!0).catch(this.close.bind(this))) : this._debug.debug("Waiting for ice restart...", { participantId: this._participantId }), this._iceRestartTimeout = window.setTimeout(() => {
4273
- this._iceRestartTimeout = null, this._debug.error("Ice restart failed", { participantId: this._participantId }), this._logger?.log(C.ERROR, "iceRestart-direct"), this._requestTopologySwitch();
4264
+ this._isMaster ? (this._logger?.log(S.ICE_RESTART), this._debug.log("Ice restart", { participantId: this._participantId }), this._createOffer(!0).catch(this.close.bind(this))) : this._debug.debug("Waiting for ice restart...", { participantId: this._participantId }), this._iceRestartTimeout = window.setTimeout(() => {
4265
+ this._iceRestartTimeout = null, this._debug.error("Ice restart failed", { participantId: this._participantId }), this._logger?.log(S.ERROR, "iceRestart-direct"), this._requestTopologySwitch();
4274
4266
  }, M.iceRestartWaitTime);
4275
4267
  }
4276
4268
  async _createOffer(t) {
@@ -4290,7 +4282,7 @@ var Er = class {
4290
4282
  offer: r
4291
4283
  }), r = e._patchLocalDescription(r);
4292
4284
  } catch (e) {
4293
- throw this._debug.error("Unable to create offer", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "createOffer-direct"), e;
4285
+ throw this._debug.error("Unable to create offer", e, { participantId: this._participantId }), this._logger?.log(S.ERROR, "createOffer-direct"), e;
4294
4286
  }
4295
4287
  try {
4296
4288
  return this._debug.debug("Set local description", {
@@ -4298,7 +4290,7 @@ var Er = class {
4298
4290
  offer: r
4299
4291
  }), this._calcFingerprint(r.sdp), await this._pc?.setLocalDescription(r), r;
4300
4292
  } catch (e) {
4301
- throw this._debug.error("Unable to set local description", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "setLocalDescription-direct"), e;
4293
+ throw this._debug.error("Unable to set local description", e, { participantId: this._participantId }), this._logger?.log(S.ERROR, "setLocalDescription-direct"), e;
4302
4294
  }
4303
4295
  }
4304
4296
  async _createAnswer() {
@@ -4310,7 +4302,7 @@ var Er = class {
4310
4302
  answer: t
4311
4303
  }), t = e._patchLocalDescription(t);
4312
4304
  } catch (e) {
4313
- throw this._debug.error("Unable to create answer", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "createAnswer-direct"), e;
4305
+ throw this._debug.error("Unable to create answer", e, { participantId: this._participantId }), this._logger?.log(S.ERROR, "createAnswer-direct"), e;
4314
4306
  }
4315
4307
  try {
4316
4308
  return this._debug.debug("Set local description", {
@@ -4318,7 +4310,7 @@ var Er = class {
4318
4310
  answer: t
4319
4311
  }), this._calcFingerprint(t.sdp), await this._pc?.setLocalDescription(t), t;
4320
4312
  } catch (e) {
4321
- throw this._debug.error("Unable to set local description", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "setLocalDescription-direct"), e;
4313
+ throw this._debug.error("Unable to set local description", e, { participantId: this._participantId }), this._logger?.log(S.ERROR, "setLocalDescription-direct"), e;
4322
4314
  }
4323
4315
  }
4324
4316
  static _patchLocalDescription(e) {
@@ -4331,7 +4323,7 @@ var Er = class {
4331
4323
  _onReplacedTrack(e) {
4332
4324
  this._pc && (this._pc.getSenders().forEach((t) => {
4333
4325
  t.track && t.track.kind === e.kind && t.track.contentHint === e.contentHint && t.replaceTrack(e).catch((e) => {
4334
- this._debug.error("DirectTransport: Unable to replace track", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "replaceTrack-direct");
4326
+ this._debug.error("DirectTransport: Unable to replace track", e, { participantId: this._participantId }), this._logger?.log(S.ERROR, "replaceTrack-direct");
4335
4327
  });
4336
4328
  }), this._applySettings());
4337
4329
  }
@@ -4679,7 +4671,7 @@ var Kr = class {
4679
4671
  this._debug.debug(e.data.message);
4680
4672
  break;
4681
4673
  case Y.LOG_ERROR:
4682
- this._logger?.log(C.ERROR, e.data.message);
4674
+ this._logger?.log(S.ERROR, e.data.message);
4683
4675
  break;
4684
4676
  }
4685
4677
  }, this._sendToWorker(Y.INIT, r, i);
@@ -5752,7 +5744,7 @@ var vi = 2 ** 15 - 1, yi = 1, bi = 5, xi = 5, Si = class e {
5752
5744
  try {
5753
5745
  this._mediaSource.addTrackToPeerConnection(this._pc, this._observer, !1), this._prevConsumerSettings = {}, this._prevConsumerFastSharingSettings = {}, this._applyConsumerSettings();
5754
5746
  } catch (e) {
5755
- this._debug.error("ServerTransport: Unable to add media source tracks", e), this._logger?.log(C.ERROR, "addTrack-single"), this.close(e);
5747
+ this._debug.error("ServerTransport: Unable to add media source tracks", e), this._logger?.log(S.ERROR, "addTrack-single"), this.close(e);
5756
5748
  return;
5757
5749
  }
5758
5750
  this._startFirstMediaSentProbe(), this._createDataChannel(this._pc, gr.consumerScreenShare, (e) => {
@@ -5924,7 +5916,7 @@ var vi = 2 ** 15 - 1, yi = 1, bi = 5, xi = 5, Si = class e {
5924
5916
  try {
5925
5917
  await this._pc.setRemoteDescription(e);
5926
5918
  } catch (e) {
5927
- throw this._debug.error("[single] unable to set remote offer", e), this._logger?.log(C.ERROR, "setRemoteDescription-single"), e;
5919
+ throw this._debug.error("[single] unable to set remote offer", e), this._logger?.log(S.ERROR, "setRemoteDescription-single"), e;
5928
5920
  }
5929
5921
  let r = this._findFirstSimTransceiver();
5930
5922
  if (M.simulcast) if (r) {
@@ -5937,13 +5929,13 @@ var vi = 2 ** 15 - 1, yi = 1, bi = 5, xi = 5, Si = class e {
5937
5929
  if (await this._handleTracks(), this._debug.debug("[single] create local answer"), !this._pc) throw Error("Interrupt allocation");
5938
5930
  i = await this._pc.createAnswer();
5939
5931
  } catch (e) {
5940
- throw this._debug.error("[single] unable to create answer", e), this._logger?.log(C.ERROR, "createAnswer-single"), e;
5932
+ throw this._debug.error("[single] unable to create answer", e), this._logger?.log(S.ERROR, "createAnswer-single"), e;
5941
5933
  }
5942
5934
  try {
5943
5935
  if (!this._pc) throw Error("Interrupt allocation");
5944
5936
  i.sdp = j.patchLocalSDP(i.sdp, !1, T.isBrokenH264Decoder(), !1), this._debug.debug("[single] set local answer", { answer: i }), await this._pc.setLocalDescription(i);
5945
5937
  } catch (e) {
5946
- throw this._debug.error("[single] unable to set local answer", e), this._logger?.log(C.ERROR, "setLocalDescription-single"), e;
5938
+ throw this._debug.error("[single] unable to set local answer", e), this._logger?.log(S.ERROR, "setLocalDescription-single"), e;
5947
5939
  }
5948
5940
  if (n && r) {
5949
5941
  i.sdp = j.patchSimulcastAnswerSdp(i.sdp, r, Xt.WIDTH, Xt.HEIGHT);
@@ -5952,7 +5944,7 @@ var vi = 2 ** 15 - 1, yi = 1, bi = 5, xi = 5, Si = class e {
5952
5944
  try {
5953
5945
  this._debug.debug("[single] transmit local answer", { answer: i }), this._updateSSRCMap(e), await this._signaling.acceptProducer(i, Object.keys(this._ssrcMap), t), this._debug.debug("[single] remote offer has been processed");
5954
5946
  } catch (e) {
5955
- this._debug.warn("[single] unable to send local answer", e), this._logger?.log(C.ERROR, "acceptProducer");
5947
+ this._debug.warn("[single] unable to send local answer", e), this._logger?.log(S.ERROR, "acceptProducer");
5956
5948
  }
5957
5949
  n && await this._changeSimulcastInfo(!0, !0);
5958
5950
  }
@@ -6026,7 +6018,7 @@ var vi = 2 ** 15 - 1, yi = 1, bi = 5, xi = 5, Si = class e {
6026
6018
  try {
6027
6019
  e.direction = "sendonly", await e.sender.replaceTrack(this._newAudioShareTrack), this._newAudioShareTrack = null;
6028
6020
  } catch (e) {
6029
- this._debug.error("ServerTransport: Unable to replace track", e), this._logger?.log(C.ERROR, "replaceTrack-single");
6021
+ this._debug.error("ServerTransport: Unable to replace track", e), this._logger?.log(S.ERROR, "replaceTrack-single");
6030
6022
  }
6031
6023
  }
6032
6024
  async _handleScreenShareTrack() {
@@ -6071,7 +6063,7 @@ var vi = 2 ** 15 - 1, yi = 1, bi = 5, xi = 5, Si = class e {
6071
6063
  this._debug.debug("[single] signaling state changed", { state: e.signalingState }, t);
6072
6064
  }
6073
6065
  _onConnectionStateChange(e, t) {
6074
- switch (this._debug.debug("[single] connection state changed", { state: e.connectionState }, t), this._logger?.log(C.ICE_CONNECTION_STATE, e.connectionState), e.connectionState) {
6066
+ switch (this._debug.debug("[single] connection state changed", { state: e.connectionState }, t), this._logger?.log(S.ICE_CONNECTION_STATE, e.connectionState), e.connectionState) {
6075
6067
  case "failed":
6076
6068
  this._reconnectionPrevented ? this.close(/* @__PURE__ */ Error("Ice connection failed")) : this._reconnect();
6077
6069
  break;
@@ -6084,7 +6076,7 @@ var vi = 2 ** 15 - 1, yi = 1, bi = 5, xi = 5, Si = class e {
6084
6076
  break;
6085
6077
  case "connected":
6086
6078
  this._setState(q.CONNECTED), j.getPeerConnectionHostInfo(e).then((e) => {
6087
- e?.local && (this._logger?.log(C.ICE_CONNECTION_TYPE, e.local.type), this._debug.debug("Selected ICE candidates", e));
6079
+ e?.local && (this._logger?.log(S.ICE_CONNECTION_TYPE, e.local.type), this._debug.debug("Selected ICE candidates", e));
6088
6080
  });
6089
6081
  break;
6090
6082
  }
@@ -6094,7 +6086,7 @@ var vi = 2 ** 15 - 1, yi = 1, bi = 5, xi = 5, Si = class e {
6094
6086
  this._debug.debug(`_onReplacedTrack: newTrack=${e}, sendTrack=${t}`), t && (e = t);
6095
6087
  let n = (e, t) => {
6096
6088
  e.replaceTrack(t).catch((e) => {
6097
- this._debug.error("ServerTransport: Unable to replace track", e), this._logger?.log(C.ERROR, "replaceTrack-single");
6089
+ this._debug.error("ServerTransport: Unable to replace track", e), this._logger?.log(S.ERROR, "replaceTrack-single");
6098
6090
  });
6099
6091
  };
6100
6092
  if (this._debug.log(`_onReplacedTrack: newTrack=${e.getSettings().width}x${e.getSettings().height}`), M.simulcast && e.kind === k.video) {
@@ -6111,14 +6103,14 @@ var vi = 2 ** 15 - 1, yi = 1, bi = 5, xi = 5, Si = class e {
6111
6103
  e === k.screen && M.consumerFastScreenShare && this._mediaSource.mediaSettings.isFastScreenSharingEnabled && await this._replaceScreenShareTrack(), this._applyConsumerSettings();
6112
6104
  }
6113
6105
  getStreamWaitingTimeMs(e, t) {
6114
- if (!this._pc) return this._logger?.log(C.PAT_WAITING_TIME_ERROR, "noConnection"), this._debug.error("Cannot get stream waiting time, peer connection is not initialized"), 0;
6115
- if (!RTCRtpReceiver.prototype.getSynchronizationSources) return this._logger?.log(C.PAT_WAITING_TIME_ERROR, "oldBrowser"), this._debug.error("Cannot get stream waiting time, RTCRtpReceiver.getSynchronizationSources is not supported"), 0;
6106
+ if (!this._pc) return this._logger?.log(S.PAT_WAITING_TIME_ERROR, "noConnection"), this._debug.error("Cannot get stream waiting time, peer connection is not initialized"), 0;
6107
+ if (!RTCRtpReceiver.prototype.getSynchronizationSources) return this._logger?.log(S.PAT_WAITING_TIME_ERROR, "oldBrowser"), this._debug.error("Cannot get stream waiting time, RTCRtpReceiver.getSynchronizationSources is not supported"), 0;
6116
6108
  let n = this._rtpReceiversByStreamId[e];
6117
- if (!n) return this._logger?.log(C.PAT_WAITING_TIME_ERROR, "noReceiver"), this._debug.error(`Cannot get stream waiting time, cannot find RTP receiver by stream ID: ${e}`), 0;
6109
+ if (!n) return this._logger?.log(S.PAT_WAITING_TIME_ERROR, "noReceiver"), this._debug.error(`Cannot get stream waiting time, cannot find RTP receiver by stream ID: ${e}`), 0;
6118
6110
  let r = n.getSynchronizationSources();
6119
6111
  if (!r || !r.length) return this._debug.log(`Cannot get stream waiting time, ${e} receiver has no synchronization sources`), 0;
6120
6112
  let i = r[0].rtpTimestamp;
6121
- if (!Number.isInteger(i)) return this._logger?.log(C.PAT_WAITING_TIME_ERROR, "timestampNotInteger"), this._debug.error(`Cannot get stream waiting time, ${e} receiver's RTP timestamp is not an integer: ${i}`), 0;
6113
+ if (!Number.isInteger(i)) return this._logger?.log(S.PAT_WAITING_TIME_ERROR, "timestampNotInteger"), this._debug.error(`Cannot get stream waiting time, ${e} receiver's RTP timestamp is not an integer: ${i}`), 0;
6122
6114
  let a = t - i & ea, o = Math.ceil(a / $i);
6123
6115
  return Math.min(100, Math.max(0, o));
6124
6116
  }
@@ -6130,7 +6122,7 @@ var vi = 2 ** 15 - 1, yi = 1, bi = 5, xi = 5, Si = class e {
6130
6122
  let a = i.getVideoTracks()[0], o = a.getSettings().width, s = a.getSettings().height, c = nn(o, s, this._serverSettings.camera?.bitrates?.generic), l = t || !en(this._simulcastInfo, c);
6131
6123
  if (!c.streams.length || !l) return;
6132
6124
  let u = r.sender.getParameters();
6133
- if (u.encodings || (u.encodings = [{}]), !(u.encodings.length <= 1)) {
6125
+ if (u.encodings.length || (u.encodings = [{}]), !(u.encodings.length <= 1)) {
6134
6126
  if (this._debug.log(`_changeSimulcastInfo: ${o}x${s} command: ${JSON.stringify(c)} `), e) {
6135
6127
  let e = 0;
6136
6128
  for (let t of u.encodings) t.scaleResolutionDownBy = rn(t.rid), t.scalabilityMode = Zt, e >= c.streams.length ? (t.maxBitrate = 0, t.active = !1) : (t.active = !0, t.maxBitrate = c.streams[e].bitrate), e++;
@@ -6138,7 +6130,7 @@ var vi = 2 ** 15 - 1, yi = 1, bi = 5, xi = 5, Si = class e {
6138
6130
  this._debug.error("Failed to set sender parameters", u, e);
6139
6131
  }), this._debug.log(`_changeSimulcastInfo: actual encodings: ${JSON.stringify(u.encodings)} `);
6140
6132
  }
6141
- if (this._simulcastInfo = c, c.streams) {
6133
+ if (this._simulcastInfo = c, c.streams.length) {
6142
6134
  let e = {
6143
6135
  mediaSource: Jt.CAMERA,
6144
6136
  simulcastInfo: c
@@ -6179,7 +6171,7 @@ var vi = 2 ** 15 - 1, yi = 1, bi = 5, xi = 5, Si = class e {
6179
6171
  }
6180
6172
  }, X = /* @__PURE__ */ function(e) {
6181
6173
  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;
6182
- }({}), na = class extends b {
6174
+ }({}), na = class extends y {
6183
6175
  constructor(e, t, n, r, i = R, a = null, o = null, s = null, c = null) {
6184
6176
  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", q.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), h(this, "_onFirstMediaSent", void 0), h(this, "_firstMediaSentProbeStopped", !1), 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._onFirstMediaSent = c, this.subscribe(this._signaling, G.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 === J.SERVER && (this._serverTransport = this._createServerTransport());
6185
6177
  }
@@ -6279,7 +6271,7 @@ var vi = 2 ** 15 - 1, yi = 1, bi = 5, xi = 5, Si = class e {
6279
6271
  }
6280
6272
  _onTopologyChanged(e) {
6281
6273
  if (e.topology !== this._topology) {
6282
- if (this._debug.log(`Topology changed ${this._topology} -> ${e.topology}`), this._logger?.log(C.TOPOLOGY_CHANGE_REQUESTED, e.topology), this._topology = e.topology, this._topology === J.SERVER && (this._serverTransport ? this._serverTransport.allowRestart() : (this._serverTransport = this._createServerTransport(), this._opened.length > 0 && (this._directTransport?.preventRestart(), this._serverTransport.open()))), this._topology === J.DIRECT) {
6274
+ if (this._debug.log(`Topology changed ${this._topology} -> ${e.topology}`), this._logger?.log(S.TOPOLOGY_CHANGE_REQUESTED, e.topology), this._topology = e.topology, this._topology === J.SERVER && (this._serverTransport ? this._serverTransport.allowRestart() : (this._serverTransport = this._createServerTransport(), this._opened.length > 0 && (this._directTransport?.preventRestart(), this._serverTransport.open()))), this._topology === J.DIRECT) {
6283
6275
  let t = e.offerTo || [], n = e.offerToTypes || [], r = e.offerToDeviceIdxs || [], i = t.length && n.length ? j.composeParticipantId(t[0], n[0], r[0]) : null;
6284
6276
  if (this._serverTransport && this._serverTransport.preventRestart(), !this._allocated || this._allocated.length === 0) {
6285
6277
  this._debug.error("Topology changed to DIRECT, but the list of allocated participants is empty");
@@ -6387,9 +6379,9 @@ var vi = 2 ** 15 - 1, yi = 1, bi = 5, xi = 5, Si = class e {
6387
6379
  this._animojiSender?.destroy(), this._animojiSender = null, this._animojiReceiver?.destroy(), this._animojiReceiver = null;
6388
6380
  }
6389
6381
  getStreamWaitingTimeMs(e, t) {
6390
- return this._topology === J.SERVER ? this._serverTransport ? this._serverTransport.getStreamWaitingTimeMs(e, t) : (this._logger?.log(C.PAT_WAITING_TIME_ERROR, "noTransport"), this._debug.error("Cannot get stream waiting time, server transport is not initialized"), 0) : (this._logger?.log(C.PAT_WAITING_TIME_ERROR, "wrongTopology"), this._debug.error(`Cannot get stream waiting time, incorrect topology: ${this._topology}`), 0);
6382
+ return this._topology === J.SERVER ? this._serverTransport ? this._serverTransport.getStreamWaitingTimeMs(e, t) : (this._logger?.log(S.PAT_WAITING_TIME_ERROR, "noTransport"), this._debug.error("Cannot get stream waiting time, server transport is not initialized"), 0) : (this._logger?.log(S.PAT_WAITING_TIME_ERROR, "wrongTopology"), this._debug.error(`Cannot get stream waiting time, incorrect topology: ${this._topology}`), 0);
6391
6383
  }
6392
- }, ra = "videochat-epi", ia = 5e3, aa = 500, oa = class extends b {
6384
+ }, ra = "videochat-epi", ia = 5e3, aa = 500, oa = class extends y {
6393
6385
  constructor(e, t, n = null, r = !1, i = R) {
6394
6386
  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) => {
6395
6387
  this._screenShareStats.push(e);
@@ -6677,12 +6669,7 @@ var fa = da, pa = {
6677
6669
  }
6678
6670
  }, Ca = class {
6679
6671
  static isBrowserSupported() {
6680
- if (!("WebTransport" in window && typeof WebTransport == "function")) return !1;
6681
- if (T.browserName() === "Safari") {
6682
- let e = Number(T.browserVersion()), t = Number(T.browserSubVersion());
6683
- if (e < 26 || e === 26 && t < 4) return !1;
6684
- }
6685
- return !0;
6672
+ return !(!("WebTransport" in window && typeof WebTransport == "function") || T.browserName() === "Safari");
6686
6673
  }
6687
6674
  constructor(e, t = {}, n = R) {
6688
6675
  h(this, "onopen", null), h(this, "onmessage", null), h(this, "onerror", null), h(this, "onclose", null), h(this, "readyState", WebSocket.CONNECTING), h(this, "webTransport", null), h(this, "writer", null), h(this, "url", void 0), h(this, "options", void 0), h(this, "compression", void 0), h(this, "encoder", void 0), h(this, "decoder", void 0), h(this, "_debug", void 0), this._debug = n, this.url = e, this.options = t, this.compression = this.getCompressionTypeFromUrl(e), this.encoder = new xa(this.compression), this.decoder = new Sa(this.compression), this.connect();
@@ -6879,7 +6866,10 @@ var fa = da, pa = {
6879
6866
  this.currentType = pr.WEBSOCKET, this.socket = new WebSocket(e), this._setSocketHandlers();
6880
6867
  }
6881
6868
  _setSocketHandlers() {
6882
- 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());
6869
+ this.socket && (this.handlers.onConnecting({
6870
+ connectionType: this.connectionType,
6871
+ source: this.currentType
6872
+ }), 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());
6883
6873
  }
6884
6874
  _buildUrl(e, t) {
6885
6875
  let n = new URL(e), r = n.searchParams;
@@ -6974,6 +6964,7 @@ var ja = new Set([
6974
6964
  }
6975
6965
  constructor(e = R, t = null, n = null, r = null, i = null) {
6976
6966
  super(), h(this, "transport", void 0), h(this, "sequence", 1), h(this, "lastStamp", 0), h(this, "websocketCommandsQueue", []), h(this, "datachannelCommandsQueue", []), h(this, "incomingCache", []), h(this, "responseHandlers", {}), h(this, "connectionType", void 0), h(this, "conversationResolve", null), h(this, "conversationReject", null), h(this, "connected", !1), h(this, "listenersReady", !1), h(this, "peerId", null), h(this, "conversationId", null), h(this, "connectionMessageWaitTimer", 0), h(this, "participantIdRegistry", null), h(this, "producerNotificationDataChannel", null), h(this, "producerCommandDataChannel", null), h(this, "producerCommandDataChannelEnabled", !1), h(this, "producerCommandSerializationService", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_statPings", void 0), h(this, "_statSignalingCommands", void 0), this._debug = e, this._logger = t, this._statAggregator = n, this._statPings = r, this._statSignalingCommands = i, this.producerCommandSerializationService = new qn(e), this.transport = new Ta(e, {
6967
+ onConnecting: this._onTransportConnecting.bind(this),
6977
6968
  onOpen: this._onOpen.bind(this),
6978
6969
  onMessage: this._onMessage.bind(this),
6979
6970
  onError: this._onError.bind(this),
@@ -7022,7 +7013,7 @@ var ja = new Set([
7022
7013
  async connect(e) {
7023
7014
  return new Promise((t, n) => {
7024
7015
  if (this.transport.readyState !== null && this.transport.readyState < WebSocket.CLOSING) {
7025
- this._logger?.log(C.SOCKET_ACTION, "already_opened"), n(Error("Socket already opened"));
7016
+ this._logger?.log(S.SOCKET_ACTION, "already_opened"), n(Error("Socket already opened"));
7026
7017
  return;
7027
7018
  }
7028
7019
  this.conversationResolve = (e) => {
@@ -7104,7 +7095,7 @@ var ja = new Set([
7104
7095
  description: e.sdp,
7105
7096
  sessionId: n
7106
7097
  };
7107
- return t && (r.ssrcs = t), this._send(B.ACCEPT_PRODUCER, r);
7098
+ return t.length && (r.ssrcs = t), this._send(B.ACCEPT_PRODUCER, r);
7108
7099
  }
7109
7100
  async changePriorities(e) {
7110
7101
  return this._send(B.CHANGE_STREAM_PRIORITIES, { typedPriorities: e }).catch(() => {});
@@ -7300,10 +7291,10 @@ var ja = new Set([
7300
7291
  if (this._isDataChannelCommand(e)) this.datachannelCommandsQueue.push(t), this.producerCommandDataChannel?.readyState === Ea && this._handleCommandsQueue(this.datachannelCommandsQueue);
7301
7292
  else {
7302
7293
  if (this.transport.readyState === null) {
7303
- this._logger?.log(C.SOCKET_ACTION, "not_opened"), this._debug.warn("[signaling] socket is not opened"), t.reject(/* @__PURE__ */ Error(`Socket not opened [${e}]`), !0);
7294
+ this._logger?.log(S.SOCKET_ACTION, "not_opened"), this._debug.warn("[signaling] socket is not opened"), t.reject(/* @__PURE__ */ Error(`Socket not opened [${e}]`), !0);
7304
7295
  return;
7305
7296
  }
7306
- this.transport.readyState > WebSocket.OPEN && (this._logger?.log(C.SOCKET_ACTION, "invalid_state"), this._debug.warn(`[signaling] socket is not opened, state ${this.transport.readyState}`)), this.websocketCommandsQueue.push(t), this.transport.readyState === WebSocket.OPEN && this._handleCommandsQueue(this.websocketCommandsQueue);
7297
+ this.transport.readyState > WebSocket.OPEN && (this._logger?.log(S.SOCKET_ACTION, "invalid_state"), this._debug.warn(`[signaling] socket is not opened, state ${this.transport.readyState}`)), this.websocketCommandsQueue.push(t), this.transport.readyState === WebSocket.OPEN && this._handleCommandsQueue(this.websocketCommandsQueue);
7307
7298
  }
7308
7299
  };
7309
7300
  return new Promise((a, o) => {
@@ -7328,7 +7319,7 @@ var ja = new Set([
7328
7319
  return this.producerCommandDataChannelEnabled ? e === B.UPDATE_DISPLAY_LAYOUT || e === B.REPORT_PERF_STAT || e === B.REPORT_SHARING_STAT || e === B.REQUEST_ASR || e === B.ENABLE_VIDEO_SUSPEND || e === B.ENABLE_VIDEO_SUSPEND_SUGGEST || e === B.REPORT_NETWORK_STAT || e === B.CHANGE_SIMULCAST : !1;
7329
7320
  }
7330
7321
  _onOpen() {
7331
- this._debug.debug("[signaling] socket opened"), this._logger?.log(C.SOCKET_ACTION, "opened"), this._waitConnectionMessage(), this._logTransportStat(this.connectionType === fr.RETRY ? mr.RECONNECTED : mr.CONNECTED);
7322
+ this._debug.debug("[signaling] socket opened"), this._logger?.log(S.SOCKET_ACTION, "opened"), this._waitConnectionMessage(), this._logTransportStat(this.connectionType === fr.RETRY ? mr.RECONNECTED : mr.CONNECTED);
7332
7323
  }
7333
7324
  _onMessage(e) {
7334
7325
  if (e.data === "ping") {
@@ -7339,7 +7330,7 @@ var ja = new Set([
7339
7330
  let t = JSON.parse(e.data);
7340
7331
  L.onSignalingMessage(t), this._handleMessage(t);
7341
7332
  } catch (t) {
7342
- this._logger?.log(C.SOCKET_ACTION, "parse_error"), this._debug.error("[signaling] unable to parse message", t, e.data);
7333
+ this._logger?.log(S.SOCKET_ACTION, "parse_error"), this._debug.error("[signaling] unable to parse message", t, e.data);
7343
7334
  }
7344
7335
  }
7345
7336
  _handleMessage(e) {
@@ -7359,12 +7350,12 @@ var ja = new Set([
7359
7350
  case "error":
7360
7351
  this._handleErrorMessage(e);
7361
7352
  break;
7362
- default: this._logger?.log(C.SOCKET_ACTION, "unknown_message"), this._debug.warn("[signaling] unhandled message", e);
7353
+ default: this._logger?.log(S.SOCKET_ACTION, "unknown_message"), this._debug.warn("[signaling] unhandled message", e);
7363
7354
  }
7364
7355
  e.stamp && (this.lastStamp = e.stamp, this.transport.setLastStamp(e.stamp));
7365
7356
  }
7366
7357
  _handleErrorMessage(e) {
7367
- this._logger?.log(C.SOCKET_ACTION, `error-${e.error}`);
7358
+ this._logger?.log(S.SOCKET_ACTION, `error-${e.error}`);
7368
7359
  let t = this._getSocketType(), n = e.error ? this._createSignalingCallError(e.error, e.errorCode, t) : void 0, r = Aa(e, "Unknown signaling error");
7369
7360
  switch (this._debug.debug(`[signaling] error message [${e.sequence}]`, e), e.sequence && this.responseHandlers[e.sequence] && this._handleCommandResponse(!1, e), e.error) {
7370
7361
  case Oa.SERVICE_UNAVAILABLE:
@@ -7380,7 +7371,7 @@ var ja = new Set([
7380
7371
  });
7381
7372
  break;
7382
7373
  case Oa.CONVERSATION_ENDED:
7383
- this.conversationReject ? this.conversationReject(new O(e.reason || x.SIGNALING_FAILED, {
7374
+ this.conversationReject ? this.conversationReject(new O(e.reason || b.SIGNALING_FAILED, {
7384
7375
  callError: n,
7385
7376
  message: r,
7386
7377
  remote: !0
@@ -7391,7 +7382,7 @@ var ja = new Set([
7391
7382
  });
7392
7383
  break;
7393
7384
  case Oa.PARTICIPANT_NOT_FOUND:
7394
- this._throwError(new O(x.SIGNALING_FAILED, {
7385
+ this._throwError(new O(b.SIGNALING_FAILED, {
7395
7386
  callError: n,
7396
7387
  message: r,
7397
7388
  remote: !0
@@ -7407,14 +7398,14 @@ var ja = new Set([
7407
7398
  case Oa.INVALID_TOKEN:
7408
7399
  default:
7409
7400
  if (e.sequence || t === pr.WEBTRANSPORT) break;
7410
- this.connected ? this._throwError(new O(e.reason || x.SIGNALING_FAILED, {
7401
+ this.connected ? this._throwError(new O(e.reason || b.SIGNALING_FAILED, {
7411
7402
  callError: n ?? {
7412
7403
  scope: "unknown",
7413
7404
  description: "signaling-unrecognized-error"
7414
7405
  },
7415
7406
  message: r,
7416
7407
  remote: !0
7417
- })) : e.sequence || (this.conversationReject?.(new O(e.reason || x.SIGNALING_FAILED, {
7408
+ })) : e.sequence || (this.conversationReject?.(new O(e.reason || b.SIGNALING_FAILED, {
7418
7409
  callError: n ?? {
7419
7410
  scope: "unknown",
7420
7411
  description: "signaling-unrecognized-error"
@@ -7435,7 +7426,7 @@ var ja = new Set([
7435
7426
  this._triggerEvent(G.FAILED, e);
7436
7427
  }
7437
7428
  _onError(e) {
7438
- this._logger?.log(C.SOCKET_ACTION, "error"), this._debug.error("[signaling] signaling error", e), this._logTransportStat(mr.FAILED_EXCEPTIONS, { string_value: this._serializeErrorEvent(e) });
7429
+ this._logger?.log(S.SOCKET_ACTION, "error"), this._debug.error("[signaling] signaling error", e), this._logTransportStat(mr.FAILED_EXCEPTIONS, { string_value: this._serializeErrorEvent(e) });
7439
7430
  }
7440
7431
  _serializeErrorEvent(e) {
7441
7432
  let t = e, n = t.error instanceof Error ? t.error : null;
@@ -7450,7 +7441,7 @@ var ja = new Set([
7450
7441
  });
7451
7442
  }
7452
7443
  _onClose(e) {
7453
- this._logger?.log(C.SOCKET_ACTION, "closed"), this._debug.debug("[signaling] connection closed", {
7444
+ this._logger?.log(S.SOCKET_ACTION, "closed"), this._debug.debug("[signaling] connection closed", {
7454
7445
  code: e.code,
7455
7446
  reason: e.reason
7456
7447
  }), this.connected = !1;
@@ -7484,7 +7475,7 @@ var ja = new Set([
7484
7475
  let r = this.responseHandlers[n.sequence];
7485
7476
  window.clearTimeout(r.responseTimer);
7486
7477
  let i = W.measureMark(r.statMarkName);
7487
- i !== null && this._statSignalingCommands?.mark(r.name, i, this._getSocketType()), this._debug.debug(`[signaling] command response [${n.sequence}]`, n), t ? (delete this.responseHandlers[n.sequence], r.resolve(n)) : n.type === "error" ? (delete this.responseHandlers[n.sequence], this._logger?.log(C.SOCKET_ACTION, "response-error"), r.reject(Error(Aa(n, `Response error [${r.name}]`)), !0)) : this.transport.readyState === WebSocket.OPEN ? (delete this.responseHandlers[n.sequence], this._logger?.log(C.SOCKET_ACTION, "response-timeout"), r.reject(Error(Aa(n, `Response timeout [${r.name}]`)))) : r.responseTimer = window.setTimeout(() => this._handleCommandResponse(t, n), e.WAIT_RESPONSE_DELAY);
7478
+ i !== null && this._statSignalingCommands?.mark(r.name, i, this._getSocketType()), this._debug.debug(`[signaling] command response [${n.sequence}]`, n), t ? (delete this.responseHandlers[n.sequence], r.resolve(n)) : n.type === "error" ? (delete this.responseHandlers[n.sequence], this._logger?.log(S.SOCKET_ACTION, "response-error"), r.reject(Error(Aa(n, `Response error [${r.name}]`)), !0)) : this.transport.readyState === WebSocket.OPEN ? (delete this.responseHandlers[n.sequence], this._logger?.log(S.SOCKET_ACTION, "response-timeout"), r.reject(Error(Aa(n, `Response timeout [${r.name}]`)))) : r.responseTimer = window.setTimeout(() => this._handleCommandResponse(t, n), e.WAIT_RESPONSE_DELAY);
7488
7479
  }
7489
7480
  _handleCommandsQueue(e) {
7490
7481
  for (; e.length > 0;) {
@@ -7551,7 +7542,7 @@ var ja = new Set([
7551
7542
  _waitConnectionMessage() {
7552
7543
  let t = this._getSocketType();
7553
7544
  this.connectionMessageWaitTimer = window.setTimeout(() => {
7554
- this.conversationReject && this.conversationReject(new O(x.SIGNALING_FAILED, {
7545
+ this.conversationReject && this.conversationReject(new O(b.SIGNALING_FAILED, {
7555
7546
  callError: {
7556
7547
  scope: "network",
7557
7548
  source: t,
@@ -7566,10 +7557,14 @@ var ja = new Set([
7566
7557
  _stopWaitConnectionMessage() {
7567
7558
  window.clearTimeout(this.connectionMessageWaitTimer), this.connectionMessageWaitTimer = 0;
7568
7559
  }
7560
+ _onTransportConnecting(e) {
7561
+ let t = e.connectionType === fr.RETRY ? mr.RECONNECTED : mr.CONNECTED;
7562
+ this._markTransportStat(t, e.source);
7563
+ }
7569
7564
  _onTransportFailed(e) {
7570
7565
  switch (e.failure) {
7571
7566
  case wa.EMPTY_ENDPOINT:
7572
- this.conversationReject?.(new O(x.SIGNALING_FAILED, {
7567
+ this.conversationReject?.(new O(b.SIGNALING_FAILED, {
7573
7568
  callError: {
7574
7569
  scope: "internal",
7575
7570
  code: "configuration",
@@ -7593,7 +7588,7 @@ var ja = new Set([
7593
7588
  }
7594
7589
  }
7595
7590
  _onTransportReconnectScheduled(e) {
7596
- this.connectionType = fr.RETRY, this._debug.log(`[signaling] reconnect signaling after ${e.delay}ms (${e.count})`), this._logger?.log(C.SOCKET_ACTION, "reconnect");
7591
+ this.connectionType = fr.RETRY, this._debug.log(`[signaling] reconnect signaling after ${e.delay}ms (${e.count})`), this._logger?.log(S.SOCKET_ACTION, "reconnect");
7597
7592
  }
7598
7593
  _onTransportConnectionDead() {
7599
7594
  this._debug.warn("[signaling] socket is dead, trying to reconnect"), this._logTransportStat(mr.FAILED_PINGS);
@@ -7618,8 +7613,8 @@ var ja = new Set([
7618
7613
  _getSocketType() {
7619
7614
  return this.transport.type;
7620
7615
  }
7621
- _markTransportStat(e) {
7622
- let t = this._getSocketType(), n = hr[e][t];
7616
+ _markTransportStat(e, t = this._getSocketType()) {
7617
+ let n = hr[e][t];
7623
7618
  W.setMark(n);
7624
7619
  }
7625
7620
  _logTransportStat(e, t) {
@@ -7815,10 +7810,10 @@ function Qa(e) {
7815
7810
  }
7816
7811
  function $a(e, t) {
7817
7812
  switch (e) {
7818
- case S.AUDIO: return !!t.isAudioEnabled;
7819
- case S.AUDIO_SHARING: return !!t.isAudioSharingEnabled;
7820
- case S.VIDEO: return !!t.isVideoEnabled;
7821
- case S.SCREEN_SHARING: return !!t.isFastScreenSharingEnabled || !!t.isScreenSharingEnabled;
7813
+ case x.AUDIO: return !!t.isAudioEnabled;
7814
+ case x.AUDIO_SHARING: return !!t.isAudioSharingEnabled;
7815
+ case x.VIDEO: return !!t.isVideoEnabled;
7816
+ case x.SCREEN_SHARING: return !!t.isFastScreenSharingEnabled || !!t.isScreenSharingEnabled;
7822
7817
  default: return !1;
7823
7818
  }
7824
7819
  }
@@ -7847,8 +7842,29 @@ function no(e, t) {
7847
7842
  return eo(t, r);
7848
7843
  }
7849
7844
  //#endregion
7845
+ //#region src/utils/IceServers.ts
7846
+ function ro(e) {
7847
+ if (!e) return null;
7848
+ let t = Array.from(new Set((e.urls ?? []).map((e) => e.trim()).filter((e) => e.length > 0)));
7849
+ return t.length ? {
7850
+ ...e,
7851
+ urls: t
7852
+ } : null;
7853
+ }
7854
+ function io(e, t) {
7855
+ let n = [], r = ro(e), i = ro(t);
7856
+ if (r && n.push(r), i) {
7857
+ let e = [...i.urls];
7858
+ e.push(`${e[e.length - 1]}?transport=tcp`), n.push({
7859
+ ...i,
7860
+ urls: e
7861
+ });
7862
+ }
7863
+ return n;
7864
+ }
7865
+ //#endregion
7850
7866
  //#region src/utils/Lz4.ts
7851
- function ro(e, t) {
7867
+ function ao(e, t) {
7852
7868
  let n = new Uint8Array(t), r = 0, i = 0;
7853
7869
  for (; r < e.length && i < t;) {
7854
7870
  let a = e[r++], o = a >> 4, s = a & 15;
@@ -7875,17 +7891,17 @@ function ro(e, t) {
7875
7891
  }
7876
7892
  //#endregion
7877
7893
  //#region src/classes/AudioFix.ts
7878
- var io = class {
7894
+ var oo = class {
7879
7895
  constructor(e, t = R, n = null) {
7880
7896
  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;
7881
7897
  }
7882
7898
  _fixAudioDeviceNoPackets(e) {
7883
7899
  if (!(this._fixNoPacketsApplied && this._fixNoPacketsChecked)) {
7884
7900
  if (this._fixNoPacketsApplied && !this._fixNoPacketsChecked) {
7885
- this._fixNoPacketsChecked = !0, this._logger?.log(C.ERROR, `audio_device_recover_${e.bandwidth ? "success" : "fail"}`);
7901
+ this._fixNoPacketsChecked = !0, this._logger?.log(S.ERROR, `audio_device_recover_${e.bandwidth ? "success" : "fail"}`);
7886
7902
  return;
7887
7903
  }
7888
- !this._fixNoPacketsApplied && !e.bandwidth && (this._fixNoPacketsApplied = !0, this._logger?.log(C.ERROR, "audio_device_recover"), this._debug.log("[AudioFix] Trying to fix RV (no packets)"), this._toggleAudioPromise = this._mediaSource.toggleAudio(T.getMicrophonePermissionState() !== "denied"), this._toggleAudioPromise.catch(() => void 0));
7904
+ !this._fixNoPacketsApplied && !e.bandwidth && (this._fixNoPacketsApplied = !0, this._logger?.log(S.ERROR, "audio_device_recover"), this._debug.log("[AudioFix] Trying to fix RV (no packets)"), this._toggleAudioPromise = this._mediaSource.toggleAudio(T.getMicrophonePermissionState() !== "denied"), this._toggleAudioPromise.catch(() => void 0));
7889
7905
  }
7890
7906
  }
7891
7907
  _fixAudioDeviceTooManyPackets(e) {
@@ -7894,7 +7910,7 @@ var io = class {
7894
7910
  if (!this._lastPacketsSentTime) e.packetsSent > 0 && (this._lastPacketsSentTime = t, this._lastPacketsSent = e.packetsSent);
7895
7911
  else if (t - this._lastPacketsSentTime > 500) {
7896
7912
  let n = (e.packetsSent - this._lastPacketsSent) * 1e3 / (t - this._lastPacketsSentTime);
7897
- this._lastPacketsSentTime = t, this._lastPacketsSent = e.packetsSent, this._fixTooManyPacketsApplied ? n > 75 ? (this._debug.log("[AudioFix] Failed to fix RV"), this._logger?.log(C.ERROR, "audio_device_recover_rv_fail"), this._fixTooManyPacketsFailed = !0) : t - this._fixTooManyPacketsTime > 6e4 && (this._debug.log("[AudioFix] Fixed RV"), this._logger?.log(C.ERROR, "audio_device_recover_rv_success"), this._fixTooManyPacketsSucceeded = !0) : n > 75 && (this._fixTooManyPacketsApplied = !0, this._logger?.log(C.ERROR, "audio_device_recover"), this._debug.log("[AudioFix] Trying to fix RV (too many packets)"), this._mediaSource.toggleAudio(!0).catch((e) => {
7913
+ this._lastPacketsSentTime = t, this._lastPacketsSent = e.packetsSent, this._fixTooManyPacketsApplied ? n > 75 ? (this._debug.log("[AudioFix] Failed to fix RV"), this._logger?.log(S.ERROR, "audio_device_recover_rv_fail"), this._fixTooManyPacketsFailed = !0) : t - this._fixTooManyPacketsTime > 6e4 && (this._debug.log("[AudioFix] Fixed RV"), this._logger?.log(S.ERROR, "audio_device_recover_rv_success"), this._fixTooManyPacketsSucceeded = !0) : n > 75 && (this._fixTooManyPacketsApplied = !0, this._logger?.log(S.ERROR, "audio_device_recover"), this._debug.log("[AudioFix] Trying to fix RV (too many packets)"), this._mediaSource.toggleAudio(!0).catch((e) => {
7898
7914
  this._debug.warn("[AudioFix] Failed to fix RV (too many packets)", e);
7899
7915
  }), this._fixTooManyPacketsTime = t);
7900
7916
  }
@@ -7913,7 +7929,7 @@ var io = class {
7913
7929
  this._debug.warn("[AudioFix] Failed to fix RV (no packets): video restart", e);
7914
7930
  }));
7915
7931
  }
7916
- }, ao = class {
7932
+ }, so = class {
7917
7933
  constructor(e, t = !1, n = R, r = null) {
7918
7934
  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;
7919
7935
  }
@@ -7954,7 +7970,7 @@ var io = class {
7954
7970
  let e = T.getSavedOutput();
7955
7971
  e && await this._audioElement.setSinkId?.(e.deviceId);
7956
7972
  } catch (e) {
7957
- throw this._logger?.log(C.ERROR, "change_output"), this._debug.error("[audio] Output change failed", e), e;
7973
+ throw this._logger?.log(S.ERROR, "change_output"), this._debug.error("[audio] Output change failed", e), e;
7958
7974
  }
7959
7975
  }
7960
7976
  _getTracks() {
@@ -7964,7 +7980,7 @@ var io = class {
7964
7980
  if (M.muteMode) return;
7965
7981
  let e = this._getTracks();
7966
7982
  if (!e.length) return;
7967
- let t = T.browserName() !== "Safari" || T.isMobile() || M.safariAudioElement, n = document.createElement(t ? "audio" : "video");
7983
+ let t = T.browserName() !== "Safari" || T.isMobile(), n = document.createElement(t ? "audio" : "video");
7968
7984
  n.muted = !1, n.volume = this._volume, n.preload = "auto";
7969
7985
  let r = () => {
7970
7986
  this._debug.warn("[audio] Error on play audio"), L.onAutoplayError();
@@ -8001,13 +8017,13 @@ var io = class {
8001
8017
  };
8002
8018
  //#endregion
8003
8019
  //#region src/classes/ConversationResponseValidator.ts
8004
- function oo(e, t) {
8005
- e || co(t, "response-empty"), e.id || co(t, "id-empty"), e.endpoint || co(t, "endpoint-empty"), !so(e.stun_server) && !so(e.turn_server) && co(t, "ice-servers-empty");
8020
+ function co(e, t) {
8021
+ e || uo(t, "response-empty"), e.id || uo(t, "id-empty"), e.endpoint || uo(t, "endpoint-empty"), !lo(e.stun_server) && !lo(e.turn_server) && uo(t, "ice-servers-empty");
8006
8022
  }
8007
- function so(e) {
8023
+ function lo(e) {
8008
8024
  return Array.isArray(e?.urls) && e.urls.length > 0;
8009
8025
  }
8010
- function co(e, t) {
8026
+ function uo(e, t) {
8011
8027
  let n = e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`), r = e === "fastStart" || e === "fastJoin";
8012
8028
  throw new O(r ? e === "fastStart" ? D.FAST_START_ERROR : D.FAST_JOIN_ERROR : D.UNKNOWN_ERROR, {
8013
8029
  message: `Invalid ${e} response: ${t}`,
@@ -8026,7 +8042,7 @@ function co(e, t) {
8026
8042
  }
8027
8043
  //#endregion
8028
8044
  //#region src/classes/DebugInfo.ts
8029
- var lo = 90, uo = 3, fo = class extends b {
8045
+ var fo = 90, po = 3, mo = class extends y {
8030
8046
  constructor(e = R) {
8031
8047
  super(), h(this, "_lastMemoryStat", {
8032
8048
  percent: 0,
@@ -8042,9 +8058,9 @@ var lo = 90, uo = 3, fo = class extends b {
8042
8058
  let e = window?.performance?.memory;
8043
8059
  if (!e || !e.usedJSHeapSize || !e.jsHeapSizeLimit) return;
8044
8060
  let t = Number((100 * e.usedJSHeapSize / e.jsHeapSizeLimit).toFixed(2)), n = Number((e.usedJSHeapSize / 1024 / 1024).toFixed(1));
8045
- t > lo ? this._debug.warn(`High memory usage: ${t}% (${n} MiB)`) : (!this._lastMemoryStat.percent || Math.abs(t - this._lastMemoryStat.percent) >= uo) && (this._debug.debug(`Memory usage: ${t}% (${n} MiB)`), this._lastMemoryStat.percent = t, this._lastMemoryStat.bytes = e.usedJSHeapSize);
8061
+ t > fo ? this._debug.warn(`High memory usage: ${t}% (${n} MiB)`) : (!this._lastMemoryStat.percent || Math.abs(t - this._lastMemoryStat.percent) >= po) && (this._debug.debug(`Memory usage: ${t}% (${n} MiB)`), this._lastMemoryStat.percent = t, this._lastMemoryStat.bytes = e.usedJSHeapSize);
8046
8062
  }
8047
- }, po = class {
8063
+ }, ho = class {
8048
8064
  constructor({ api: e, debug: t, getParticipants: n, isMe: r, updateDisplayLayout: i }) {
8049
8065
  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;
8050
8066
  }
@@ -8154,7 +8170,7 @@ var lo = 90, uo = 3, fo = class extends b {
8154
8170
  let n = e, r = t;
8155
8171
  return n.width !== r.width || n.height !== r.height || n.fit !== r.fit || n.priority !== r.priority;
8156
8172
  }
8157
- }, mo = 44100, ho = class {
8173
+ }, go = 44100, _o = class {
8158
8174
  constructor(e, t) {
8159
8175
  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]);
8160
8176
  try {
@@ -8171,7 +8187,7 @@ var lo = 90, uo = 3, fo = class extends b {
8171
8187
  _getBins() {
8172
8188
  if (!this._fftBins || !this._analyser) return new Uint8Array();
8173
8189
  this._analyser.getByteFrequencyData(this._fftBins);
8174
- let e = mo / this._fftBins.length, t = Math.ceil(M.voiceParams.minFreq / e), n = Math.floor(M.voiceParams.maxFreq / e);
8190
+ let e = go / this._fftBins.length, t = Math.ceil(M.voiceParams.minFreq / e), n = Math.floor(M.voiceParams.maxFreq / e);
8175
8191
  return this._fftBins.subarray(t, n);
8176
8192
  }
8177
8193
  getLevel() {
@@ -8184,7 +8200,7 @@ var lo = 90, uo = 3, fo = class extends b {
8184
8200
  destroy() {
8185
8201
  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);
8186
8202
  }
8187
- }, go = class extends b {
8203
+ }, vo = class extends y {
8188
8204
  constructor(e) {
8189
8205
  super(), h(this, "_detector", null), h(this, "_interval", null);
8190
8206
  let t = () => {
@@ -8200,7 +8216,7 @@ var lo = 90, uo = 3, fo = class extends b {
8200
8216
  }), this.subscribe(e, qt.SOURCE_READY, n), n();
8201
8217
  }
8202
8218
  init(e) {
8203
- this._stopDetector(), this._detector = new ho("local", e.clone());
8219
+ this._stopDetector(), this._detector = new _o("local", e.clone());
8204
8220
  }
8205
8221
  _stopDetector() {
8206
8222
  this._detector && (this._detector.track.stop(), this._detector.destroy(), this._detector = null);
@@ -8208,7 +8224,7 @@ var lo = 90, uo = 3, fo = class extends b {
8208
8224
  destroy() {
8209
8225
  this.unsubscribe(), this._interval && (window.clearTimeout(this._interval), this._interval = null), this._stopDetector();
8210
8226
  }
8211
- }, _o = class {
8227
+ }, yo = class {
8212
8228
  constructor(e, t = R) {
8213
8229
  h(this, "processor", void 0), h(this, "queue", []), h(this, "isProcessing", !1), h(this, "_debug", void 0), this.processor = e, this._debug = t;
8214
8230
  }
@@ -8228,9 +8244,9 @@ var lo = 90, uo = 3, fo = class extends b {
8228
8244
  this.isProcessing = !1;
8229
8245
  }
8230
8246
  }
8231
- }, vo = /* @__PURE__ */ function(e) {
8247
+ }, bo = /* @__PURE__ */ function(e) {
8232
8248
  return e.VOLUMES_DETECTED = "VOLUMES_DETECTED", e;
8233
- }({}), yo = class extends b {
8249
+ }({}), xo = class extends y {
8234
8250
  constructor(e) {
8235
8251
  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, X.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(e, X.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(e, X.SIGNALLED_ACTIVE_PARTICIPANTS, this._onSignalledActiveParticipants.bind(this)), this.subscribe(e, X.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this));
8236
8252
  }
@@ -8238,7 +8254,7 @@ var lo = 90, uo = 3, fo = class extends b {
8238
8254
  this._interval && (window.clearTimeout(this._interval), this._interval = null), this.unsubscribe(), this._destroyDetectors();
8239
8255
  }
8240
8256
  _onRemoteTrackAdded(e, t, n) {
8241
- if (n.kind === k.audio && (this._detectors.get(e)?.destroy(), this._detectors.set(e, new ho(e, n)), !this._interval)) {
8257
+ if (n.kind === k.audio && (this._detectors.get(e)?.destroy(), this._detectors.set(e, new _o(e, n)), !this._interval)) {
8242
8258
  let e = () => {
8243
8259
  this._collectVolumes(), this._interval = window.setTimeout(e, M.voiceParams.interval);
8244
8260
  };
@@ -8296,11 +8312,11 @@ var lo = 90, uo = 3, fo = class extends b {
8296
8312
  e.destroy();
8297
8313
  }), this._detectors.clear();
8298
8314
  }
8299
- }, bo = /* @__PURE__ */ function(e) {
8315
+ }, So = /* @__PURE__ */ function(e) {
8300
8316
  return e.SPEAKER_CHANGED = "SPEAKER_CHANGED", e;
8301
- }({}), xo = class extends b {
8317
+ }({}), Co = class extends y {
8302
8318
  constructor(e, t, n) {
8303
- super(), h(this, "_speakerId", null), h(this, "_serverSideSpeakerDetection", !1), this._serverSideSpeakerDetection = n === J.SERVER, this.subscribe(e, vo.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this.subscribe(t, X.SIGNALLED_SPEAKER_CHANGED, this._onServerSpeakerChanged.bind(this)), this.subscribe(t, X.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this));
8319
+ super(), h(this, "_speakerId", null), h(this, "_serverSideSpeakerDetection", !1), this._serverSideSpeakerDetection = n === J.SERVER, this.subscribe(e, bo.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this.subscribe(t, X.SIGNALLED_SPEAKER_CHANGED, this._onServerSpeakerChanged.bind(this)), this.subscribe(t, X.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this));
8304
8320
  }
8305
8321
  destroy() {
8306
8322
  this.unsubscribe();
@@ -8322,9 +8338,9 @@ var lo = 90, uo = 3, fo = class extends b {
8322
8338
  _onTopologyChanged(e) {
8323
8339
  this._serverSideSpeakerDetection = e === J.SERVER;
8324
8340
  }
8325
- }, So = 15e3, Co = 15e3, wo = class extends b {
8341
+ }, wo = 15e3, To = 15e3, Eo = class extends y {
8326
8342
  constructor(e, t, n, r = R, i = null) {
8327
- 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, "_connectionTimeoutSuppressed", !1), h(this, "_volumeTimeout", 0), this._transport = e, this._participants = n, this._debug = r, this._logger = i, this.subscribe(e, X.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(t, vo.VOLUMES_DETECTED, this._onVolumesDetected.bind(this));
8343
+ 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, "_connectionTimeoutSuppressed", !1), h(this, "_volumeTimeout", 0), this._transport = e, this._participants = n, this._debug = r, this._logger = i, this.subscribe(e, X.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(t, bo.VOLUMES_DETECTED, this._onVolumesDetected.bind(this));
8328
8344
  }
8329
8345
  destroy() {
8330
8346
  this.unsubscribe(), this._connectionTimeout && window.clearTimeout(this._connectionTimeout), this._volumeTimeout && window.clearTimeout(this._volumeTimeout);
@@ -8336,13 +8352,13 @@ var lo = 90, uo = 3, fo = class extends b {
8336
8352
  this._connectionTimeout || !this._connectionTimeoutSuppressed || this._reportConnectionTimeout();
8337
8353
  }
8338
8354
  _getConnectionTimeout() {
8339
- return this._transport.getTopology() === J.DIRECT ? So : M.specListenerParams.connectionTimeout;
8355
+ return this._transport.getTopology() === J.DIRECT ? wo : M.specListenerParams.connectionTimeout;
8340
8356
  }
8341
8357
  _getVolumeTimeout() {
8342
- return this._transport.getTopology() === J.DIRECT ? Co : M.specListenerParams.volumeTimeout;
8358
+ return this._transport.getTopology() === J.DIRECT ? To : M.specListenerParams.volumeTimeout;
8343
8359
  }
8344
8360
  _onTransportStateChanged(e, t) {
8345
- t === q.OPENED && (this._connectionTimeout || (this._connectionTimeoutSuppressed = !1, this._connectionTimeout = window.setTimeout(this._onConnectionTimeout.bind(this), this._getConnectionTimeout()))), t === q.CONNECTED && (this._volumeTimeout || (this._volumeTimeout = window.setTimeout(this._onVolumeTimeout.bind(this), this._getVolumeTimeout())), this._volumeTimeout && (window.clearTimeout(this._volumeTimeout), this._volumeTimeout = window.setTimeout(this._onVolumeTimeout.bind(this), this._getVolumeTimeout()))), t === q.FAILED && this._connectionTimeout && (this._debug.warn("Transport failed, send callSpecError"), this._logger?.log(C.CALL_SPEC_ERROR, `${this._transport.getTopology()}_CONNECTION_TIMEOUT`));
8361
+ t === q.OPENED && (this._connectionTimeout || (this._connectionTimeoutSuppressed = !1, this._connectionTimeout = window.setTimeout(this._onConnectionTimeout.bind(this), this._getConnectionTimeout()))), t === q.CONNECTED && (this._volumeTimeout || (this._volumeTimeout = window.setTimeout(this._onVolumeTimeout.bind(this), this._getVolumeTimeout())), this._volumeTimeout && (window.clearTimeout(this._volumeTimeout), this._volumeTimeout = window.setTimeout(this._onVolumeTimeout.bind(this), this._getVolumeTimeout()))), t === q.FAILED && this._connectionTimeout && (this._debug.warn("Transport failed, send callSpecError"), this._logger?.log(S.CALL_SPEC_ERROR, `${this._transport.getTopology()}_CONNECTION_TIMEOUT`));
8346
8362
  }
8347
8363
  _onVolumesDetected(e) {
8348
8364
  Object.keys(e).forEach((t) => {
@@ -8362,17 +8378,17 @@ var lo = 90, uo = 3, fo = class extends b {
8362
8378
  }
8363
8379
  t = !0;
8364
8380
  }
8365
- }), this._connectionTimeoutSuppressed = e && !t, t && (this._debug.warn("There is not connected transport, send callSpecError"), this._logger?.log(C.CALL_SPEC_ERROR, `${this._transport.getTopology()}_CONNECTION_TIMEOUT`));
8381
+ }), this._connectionTimeoutSuppressed = e && !t, t && (this._debug.warn("There is not connected transport, send callSpecError"), this._logger?.log(S.CALL_SPEC_ERROR, `${this._transport.getTopology()}_CONNECTION_TIMEOUT`));
8366
8382
  }
8367
8383
  _onVolumeTimeout() {
8368
8384
  let e = [];
8369
8385
  Object.keys(this._volumes).forEach((t) => {
8370
8386
  if (this._volumes[t] > 0 || this._participants[t]?.isOnHold) return;
8371
8387
  let n = "UNKNOWN", r = this._participants[t];
8372
- r && r.platform && (n = r.platform), e.indexOf(n) < 0 && (e.push(n), this._logger?.log(C.CALL_SPEC_ERROR, `${this._transport.getTopology()}_VOLUME_TIMEOUT_${n}`));
8388
+ r && r.platform && (n = r.platform), e.indexOf(n) < 0 && (e.push(n), this._logger?.log(S.CALL_SPEC_ERROR, `${this._transport.getTopology()}_VOLUME_TIMEOUT_${n}`));
8373
8389
  }), e.length && this._debug.warn("There is silent participant, send callSpecError"), this._volumeTimeout = 0;
8374
8390
  }
8375
- }, To = class extends f {
8391
+ }, Do = class extends f {
8376
8392
  constructor(e, t, n, r = () => void 0) {
8377
8393
  super(), h(this, "_externalLogger", void 0), h(this, "_api", void 0), h(this, "_conversationIdProvider", void 0), h(this, "_topologyProvider", void 0), h(this, "_batchInterval", 3e3), h(this, "_batchedClientStats", []), h(this, "_batchTimeout", null), h(this, "_serverTimeDelta", 0), h(this, "_waitingForServerTime", !0), h(this, "_deferredClientStats", []), this._api = e, this._externalLogger = t, this._conversationIdProvider = n, this._topologyProvider = r, this._calculateServerTimeDelta();
8378
8394
  }
@@ -8452,7 +8468,7 @@ var lo = 90, uo = 3, fo = class extends b {
8452
8468
  _now() {
8453
8469
  return Date.now() - this._serverTimeDelta;
8454
8470
  }
8455
- }, Eo = "invalid-error-metadata", Do = 64, Oo = new Set(Object.values(D)), ko = new Set(Object.values(x)), Ao = {
8471
+ }, Oo = "invalid-error-metadata", ko = 64, Ao = new Set(Object.values(D)), jo = new Set(Object.values(b)), Mo = {
8456
8472
  [D.CANCELED]: {
8457
8473
  type: "semantic",
8458
8474
  reason: "canceled"
@@ -8573,8 +8589,8 @@ var lo = 90, uo = 3, fo = class extends b {
8573
8589
  type: "semantic",
8574
8590
  reason: "obsolete_client"
8575
8591
  }
8576
- }, jo = {
8577
- [x.MIC_CAMERA_PERMISSION]: {
8592
+ }, No = {
8593
+ [b.MIC_CAMERA_PERMISSION]: {
8578
8594
  type: "direct-error",
8579
8595
  error: {
8580
8596
  scope: "internal",
@@ -8582,7 +8598,7 @@ var lo = 90, uo = 3, fo = class extends b {
8582
8598
  description: "mic-camera-permission"
8583
8599
  }
8584
8600
  },
8585
- [x.CAMERA_PERMISSION]: {
8601
+ [b.CAMERA_PERMISSION]: {
8586
8602
  type: "direct-error",
8587
8603
  error: {
8588
8604
  scope: "internal",
@@ -8590,7 +8606,7 @@ var lo = 90, uo = 3, fo = class extends b {
8590
8606
  description: "camera-permission"
8591
8607
  }
8592
8608
  },
8593
- [x.MIC_PERMISSION]: {
8609
+ [b.MIC_PERMISSION]: {
8594
8610
  type: "direct-error",
8595
8611
  error: {
8596
8612
  scope: "internal",
@@ -8598,7 +8614,7 @@ var lo = 90, uo = 3, fo = class extends b {
8598
8614
  description: "microphone-permission"
8599
8615
  }
8600
8616
  },
8601
- [x.CAMERA_ACCESS]: {
8617
+ [b.CAMERA_ACCESS]: {
8602
8618
  type: "direct-error",
8603
8619
  error: {
8604
8620
  scope: "internal",
@@ -8606,7 +8622,7 @@ var lo = 90, uo = 3, fo = class extends b {
8606
8622
  description: "camera-access"
8607
8623
  }
8608
8624
  },
8609
- [x.MIC_ACCESS]: {
8625
+ [b.MIC_ACCESS]: {
8610
8626
  type: "direct-error",
8611
8627
  error: {
8612
8628
  scope: "internal",
@@ -8614,7 +8630,7 @@ var lo = 90, uo = 3, fo = class extends b {
8614
8630
  description: "microphone-access"
8615
8631
  }
8616
8632
  },
8617
- [x.MIC_NOT_FOUND]: {
8633
+ [b.MIC_NOT_FOUND]: {
8618
8634
  type: "direct-error",
8619
8635
  error: {
8620
8636
  scope: "internal",
@@ -8622,7 +8638,7 @@ var lo = 90, uo = 3, fo = class extends b {
8622
8638
  description: "microphone-not-found"
8623
8639
  }
8624
8640
  },
8625
- [x.SCREEN_PERMISSION]: {
8641
+ [b.SCREEN_PERMISSION]: {
8626
8642
  type: "direct-error",
8627
8643
  error: {
8628
8644
  scope: "internal",
@@ -8630,7 +8646,7 @@ var lo = 90, uo = 3, fo = class extends b {
8630
8646
  description: "screen-permission"
8631
8647
  }
8632
8648
  },
8633
- [x.SCREEN_ACCESS]: {
8649
+ [b.SCREEN_ACCESS]: {
8634
8650
  type: "direct-error",
8635
8651
  error: {
8636
8652
  scope: "internal",
@@ -8638,7 +8654,7 @@ var lo = 90, uo = 3, fo = class extends b {
8638
8654
  description: "screen-access"
8639
8655
  }
8640
8656
  },
8641
- [x.CONNECTION]: {
8657
+ [b.CONNECTION]: {
8642
8658
  type: "direct-error",
8643
8659
  error: {
8644
8660
  scope: "network",
@@ -8647,13 +8663,13 @@ var lo = 90, uo = 3, fo = class extends b {
8647
8663
  description: "connection-failed"
8648
8664
  }
8649
8665
  },
8650
- [x.NETWORK]: { type: "requires-call-error" },
8651
- [x.UNKNOWN]: { type: "failed" },
8652
- [x.UNSUPPORTED]: { type: "requires-call-error" },
8653
- [x.SIGNALING_FAILED]: { type: "requires-call-error" },
8654
- [x.API]: { type: "requires-call-error" },
8655
- [x.AUTH]: { type: "requires-call-error" },
8656
- [x.OVERCONSTRAINED]: {
8666
+ [b.NETWORK]: { type: "requires-call-error" },
8667
+ [b.UNKNOWN]: { type: "failed" },
8668
+ [b.UNSUPPORTED]: { type: "requires-call-error" },
8669
+ [b.SIGNALING_FAILED]: { type: "requires-call-error" },
8670
+ [b.API]: { type: "requires-call-error" },
8671
+ [b.AUTH]: { type: "requires-call-error" },
8672
+ [b.OVERCONSTRAINED]: {
8657
8673
  type: "direct-error",
8658
8674
  error: {
8659
8675
  scope: "internal",
@@ -8662,14 +8678,14 @@ var lo = 90, uo = 3, fo = class extends b {
8662
8678
  }
8663
8679
  }
8664
8680
  };
8665
- function Mo(e) {
8666
- if (typeof e != "string" && typeof e != "number" || typeof e == "number" && !Number.isFinite(e)) return Eo;
8681
+ function Po(e) {
8682
+ if (typeof e != "string" && typeof e != "number" || typeof e == "number" && !Number.isFinite(e)) return Oo;
8667
8683
  let t = String(e).trim();
8668
- if (!t) return Eo;
8684
+ if (!t) return Oo;
8669
8685
  let n = t.toLowerCase().replace(/[\s_:]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
8670
- return !n || !/^[a-z0-9.-]+$/.test(n) ? Eo : n.length > Do ? `${n.slice(0, Do - 3)}...` : n;
8686
+ return !n || !/^[a-z0-9.-]+$/.test(n) ? Oo : n.length > ko ? `${n.slice(0, ko - 3)}...` : n;
8671
8687
  }
8672
- function No(e) {
8688
+ function Fo(e) {
8673
8689
  if (!e || typeof e != "object") return !1;
8674
8690
  let t = e;
8675
8691
  switch (t.scope) {
@@ -8681,49 +8697,49 @@ function No(e) {
8681
8697
  default: return !1;
8682
8698
  }
8683
8699
  }
8684
- function Po(e) {
8685
- let t = Mo(e.description);
8700
+ function Io(e) {
8701
+ let t = Po(e.description);
8686
8702
  if (e.scope === "unknown") return `unknown:${t}`;
8687
- let n = Mo(e.code);
8703
+ let n = Po(e.code);
8688
8704
  return e.scope === "internal" ? `internal:${n}:${t}` : `${e.scope}:${e.source}:${n}:${t}`;
8689
8705
  }
8690
- function Fo(e, t) {
8706
+ function Lo(e, t) {
8691
8707
  return t === null ? e.type === "direct-error" ? {
8692
8708
  reason: "error",
8693
- string_value: Po(e.error)
8694
- } : { reason: "failed" } : No(t) ? {
8709
+ string_value: Io(e.error)
8710
+ } : { reason: "failed" } : Fo(t) ? {
8695
8711
  reason: "error",
8696
- string_value: Po(t)
8712
+ string_value: Io(t)
8697
8713
  } : { reason: "failed" };
8698
8714
  }
8699
- function Io(e) {
8715
+ function Ro(e) {
8700
8716
  if (e.hangup) {
8701
- let t = Ao[e.hangup];
8717
+ let t = Mo[e.hangup];
8702
8718
  return t ? t.type === "semantic" ? e.hangup === D.OBSOLETE_CLIENT && e.custom_error?.vchat_detailed_api_error.code ? {
8703
8719
  reason: t.reason,
8704
8720
  string_value: e.custom_error.vchat_detailed_api_error.code
8705
- } : { reason: t.reason } : Fo(t, e.callError) : { reason: "failed" };
8721
+ } : { reason: t.reason } : Lo(t, e.callError) : { reason: "failed" };
8706
8722
  }
8707
8723
  if (e.error) {
8708
- let t = jo[e.error];
8709
- return t ? Fo(t, e.callError) : { reason: "failed" };
8724
+ let t = No[e.error];
8725
+ return t ? Lo(t, e.callError) : { reason: "failed" };
8710
8726
  }
8711
8727
  return { reason: "failed" };
8712
8728
  }
8713
- function Lo(e) {
8714
- return e instanceof O ? Io(e) : typeof e == "string" && (Oo.has(e) || ko.has(e)) ? Io(new O(e)) : { reason: "failed" };
8729
+ function zo(e) {
8730
+ return e instanceof O ? Ro(e) : typeof e == "string" && (Ao.has(e) || jo.has(e)) ? Ro(new O(e)) : { reason: "failed" };
8715
8731
  }
8716
8732
  //#endregion
8717
8733
  //#region src/classes/stat/CallLifecycleStats.ts
8718
- var Ro = {
8734
+ var Bo = {
8719
8735
  wallNow: () => Date.now(),
8720
8736
  monotonicNow: () => performance.now()
8721
8737
  };
8722
- function zo(e) {
8738
+ function Vo(e) {
8723
8739
  return e === "anonym_join" ? "join" : e;
8724
8740
  }
8725
- var Bo = class {
8726
- constructor(e, t = Ro) {
8741
+ var Ho = class {
8742
+ constructor(e, t = Bo) {
8727
8743
  h(this, "_logger", void 0), h(this, "_clock", void 0), h(this, "_conversationId", null), h(this, "_callStartLabel", null), h(this, "_lifecycleStartedAtMonotonic", 0), h(this, "_warmupStartedAtMonotonic", null), h(this, "_pendingEvents", []), h(this, "_warmupCompleted", !1), h(this, "_callStarted", !1), h(this, "_accepted", !1), h(this, "_firstMediaSent", !1), h(this, "_finished", !1), h(this, "_destroyed", !1), this._logger = e, this._clock = t;
8728
8744
  }
8729
8745
  get firstMediaSentReported() {
@@ -8735,7 +8751,7 @@ var Bo = class {
8735
8751
  markInitializationStarted({ source: e, conversationId: t }) {
8736
8752
  if (this._destroyed || this._callStartLabel !== null) return;
8737
8753
  let n = this._clock.wallNow();
8738
- this._callStartLabel = zo(e), this._lifecycleStartedAtMonotonic = this._clock.monotonicNow(), t && (this._conversationId = t), this._record({
8754
+ this._callStartLabel = Vo(e), this._lifecycleStartedAtMonotonic = this._clock.monotonicNow(), t && (this._conversationId = t), this._record({
8739
8755
  name: H.CALL_INIT,
8740
8756
  source: e
8741
8757
  }, n);
@@ -8775,7 +8791,7 @@ var Bo = class {
8775
8791
  !this._canRecord() || this._firstMediaSent || (this._firstMediaSent = !0, this._record({ name: H.FIRST_MEDIA_SENT }));
8776
8792
  }
8777
8793
  markFinished(e) {
8778
- this._finish(Lo(e));
8794
+ this._finish(zo(e));
8779
8795
  }
8780
8796
  markTerminated() {
8781
8797
  this._finish({ reason: "terminated" });
@@ -8826,7 +8842,7 @@ var Bo = class {
8826
8842
  ...n && { immediately: !0 }
8827
8843
  });
8828
8844
  }
8829
- }, Vo = class {
8845
+ }, Uo = class {
8830
8846
  constructor(e, t) {
8831
8847
  h(this, "_logger", void 0), h(this, "_codecUsages", /* @__PURE__ */ new Map()), h(this, "getCurrentTransportTopology", void 0), this._logger = e, this.getCurrentTransportTopology = t;
8832
8848
  }
@@ -8889,7 +8905,7 @@ var Bo = class {
8889
8905
  this.report(e);
8890
8906
  }), this._codecUsages.clear();
8891
8907
  }
8892
- }, Ho = class {
8908
+ }, Wo = class {
8893
8909
  constructor(e) {
8894
8910
  h(this, "_logger", void 0), h(this, "_eventualLogs", /* @__PURE__ */ new Set()), this._logger = e;
8895
8911
  }
@@ -8914,7 +8930,7 @@ var Bo = class {
8914
8930
  destroy() {
8915
8931
  this._eventualLogs.clear();
8916
8932
  }
8917
- }, Uo = class {
8933
+ }, Go = class {
8918
8934
  constructor(e) {
8919
8935
  if (h(this, "q", void 0), h(this, "inits", []), h(this, "n", [
8920
8936
  1,
@@ -8973,7 +8989,7 @@ var Bo = class {
8973
8989
  5
8974
8990
  ];
8975
8991
  }
8976
- }, Wo = class {
8992
+ }, Ko = class {
8977
8993
  constructor() {
8978
8994
  h(this, "n", 0), h(this, "mean", 0);
8979
8995
  }
@@ -8985,9 +9001,9 @@ var Bo = class {
8985
9001
  get avg() {
8986
9002
  return this.n ? this.mean : NaN;
8987
9003
  }
8988
- }, Go = class {
9004
+ }, qo = class {
8989
9005
  constructor() {
8990
- h(this, "count", 0), h(this, "minVal", Infinity), h(this, "maxVal", -Infinity), h(this, "mean", new Wo()), h(this, "p50", new Uo(.5)), h(this, "p95", new Uo(.95));
9006
+ h(this, "count", 0), h(this, "minVal", Infinity), h(this, "maxVal", -Infinity), h(this, "mean", new Ko()), h(this, "p50", new Go(.5)), h(this, "p95", new Go(.95));
8991
9007
  }
8992
9008
  add(e) {
8993
9009
  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++;
@@ -9005,11 +9021,11 @@ var Bo = class {
9005
9021
  get hasData() {
9006
9022
  return this.count > 0;
9007
9023
  }
9008
- }, Ko = class {
9024
+ }, Jo = class {
9009
9025
  constructor(e) {
9010
9026
  h(this, "_logger", void 0), h(this, "trackerByTransport", {
9011
- ws: new Go(),
9012
- wt: new Go()
9027
+ ws: new qo(),
9028
+ wt: new qo()
9013
9029
  }), h(this, "lastSeen", {}), this._logger = e;
9014
9030
  }
9015
9031
  mark(e) {
@@ -9038,17 +9054,17 @@ var Bo = class {
9038
9054
  }
9039
9055
  destroy() {
9040
9056
  this.trackerByTransport = {
9041
- ws: new Go(),
9042
- wt: new Go()
9057
+ ws: new qo(),
9058
+ wt: new qo()
9043
9059
  }, this.lastSeen = {};
9044
9060
  }
9045
- }, qo = class {
9061
+ }, Yo = class {
9046
9062
  constructor(e) {
9047
9063
  h(this, "_logger", void 0), h(this, "trackerByCommand", /* @__PURE__ */ new Map()), this._logger = e;
9048
9064
  }
9049
9065
  mark(e, t, n) {
9050
9066
  let r = `${e}|${n}`, i;
9051
- this.trackerByCommand.has(r) ? i = this.trackerByCommand.get(r) : (i = new Go(), this.trackerByCommand.set(r, i)), i.add(t);
9067
+ this.trackerByCommand.has(r) ? i = this.trackerByCommand.get(r) : (i = new qo(), this.trackerByCommand.set(r, i)), i.add(t);
9052
9068
  }
9053
9069
  logMetrics() {
9054
9070
  for (let [e, t] of this.trackerByCommand.entries()) {
@@ -9070,9 +9086,9 @@ var Bo = class {
9070
9086
  destroy() {
9071
9087
  this.trackerByCommand.clear();
9072
9088
  }
9073
- }, Jo = class {
9089
+ }, Xo = class {
9074
9090
  constructor(e, t, n, r) {
9075
- h(this, "logger", void 0), h(this, "lifecycle", 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 To(e, t, n, r), this.lifecycle = new Bo(this.logger), this.statAggregator = new Ho(this.logger), this.codecStatsAggregator = new Vo(this.logger, r), this.pings = new Ko(this.logger), this.signalingCommands = new qo(this.logger);
9091
+ h(this, "logger", void 0), h(this, "lifecycle", 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 Do(e, t, n, r), this.lifecycle = new Ho(this.logger), this.statAggregator = new Wo(this.logger), this.codecStatsAggregator = new Uo(this.logger, r), this.pings = new Jo(this.logger), this.signalingCommands = new Yo(this.logger);
9076
9092
  }
9077
9093
  logHangup(e) {
9078
9094
  this.lifecycle.markFinished(e);
@@ -9083,7 +9099,7 @@ var Bo = class {
9083
9099
  destroy() {
9084
9100
  this.lifecycle.markTerminated(), this.lifecycle.destroy(), this.statAggregator.destroy(), this.codecStatsAggregator.destroy(), this.pings.destroy(), this.signalingCommands.destroy(), this.logger.destroy();
9085
9101
  }
9086
- }, Yo = class {
9102
+ }, Zo = class {
9087
9103
  constructor(e) {
9088
9104
  h(this, "_statAggregator", void 0), h(this, "_isCallMarked", !1), h(this, "_isFinished", !1), h(this, "_callType", null), this._statAggregator = e;
9089
9105
  }
@@ -9108,8 +9124,8 @@ var Bo = class {
9108
9124
  call_type: this._callType
9109
9125
  }));
9110
9126
  }
9111
- }, Xo = 1e3, Zo = 1e4;
9112
- function Qo(e, t, n, r) {
9127
+ }, Qo = 1e3, $o = 1e4;
9128
+ function es(e, t, n, r) {
9113
9129
  return new O(e, {
9114
9130
  callError: {
9115
9131
  scope: "external",
@@ -9120,7 +9136,7 @@ function Qo(e, t, n, r) {
9120
9136
  message: r
9121
9137
  });
9122
9138
  }
9123
- var $o = 15, $ = class e extends b {
9139
+ var ts = 15, $ = class e extends y {
9124
9140
  constructor(e, t) {
9125
9141
  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, "_previousState", null), h(this, "_waitingHallHoldPending", !1), h(this, "_participantState", Z.CALLED), h(this, "_participants", {}), h(this, "_pendingParticipants", /* @__PURE__ */ new Map()), h(this, "_directTransportIsMaster", void 0), h(this, "_transport", null), h(this, "_debugInfo", null), h(this, "_debug", R.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", Cr()), h(this, "_serverTimeOffset", 0), h(this, "_delayedHangup", !1), h(this, "_abortController", null), h(this, "_registeredPeerReceived", !1), h(this, "_calleeUnavailableTimer", null), h(this, "_reservedId", null), 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", j.debounce(async (e) => {
9126
9142
  if (this._signaling.ready) try {
@@ -9132,7 +9148,7 @@ var $o = 15, $ = class e extends b {
9132
9148
  captureAudio: !1
9133
9149
  });
9134
9150
  }
9135
- }, 100)), this._stats = new Jo(e, t, () => this._conversation?.id || null, () => this._transport?.getTopology() ?? this._conversation?.topology), this._api = e, this._signaling = new Ma(this._debug, this._stats.logger, this._stats.statAggregator, this._stats.pings, this._stats.signalingCommands), this._signalingActor = new _o(this._onSignalingNotification.bind(this), this._debug), this._displayLayoutRequester = new po({
9151
+ }, 100)), this._stats = new Xo(e, t, () => this._conversation?.id || null, () => this._transport?.getTopology() ?? this._conversation?.topology), this._api = e, this._signaling = new Ma(this._debug, this._stats.logger, this._stats.statAggregator, this._stats.pings, this._stats.signalingCommands), this._signalingActor = new yo(this._onSignalingNotification.bind(this), this._debug), this._displayLayoutRequester = new ho({
9136
9152
  api: this._api,
9137
9153
  debug: this._debug,
9138
9154
  getParticipants: () => this._getParticipants(),
@@ -9140,13 +9156,13 @@ var $o = 15, $ = class e extends b {
9140
9156
  updateDisplayLayout: (e) => this.updateDisplayLayout(e)
9141
9157
  }), this._onUnload = () => {
9142
9158
  this._stopFirstMediaSentProbe(), this._conversation && this._api && this._api.hangupConversation(this._conversation.id, this._state === "IDLE" ? D.CANCELED : D.HUNGUP), this._stats.destroy();
9143
- }, window.addEventListener("pagehide", this._onUnload), this._statFirstMediaReceived = new Yo(this._stats.statAggregator), this._audioOutput = new ao(this._statFirstMediaReceived, M.transparentAudio, this._debug, this._stats.logger), M.videoTracksCount > 0 && (this._cooldownQueueCleanupTimer = window.setInterval(this._cleanupCooldownQueue.bind(this), Xo));
9159
+ }, window.addEventListener("pagehide", this._onUnload), this._statFirstMediaReceived = new Zo(this._stats.statAggregator), this._audioOutput = new so(this._statFirstMediaReceived, M.transparentAudio, this._debug, this._stats.logger), M.videoTracksCount > 0 && (this._cooldownQueueCleanupTimer = window.setInterval(this._cleanupCooldownQueue.bind(this), Qo));
9144
9160
  }
9145
9161
  static current() {
9146
9162
  return z.getActive() ?? (M.hold ? null : z.getFirst());
9147
9163
  }
9148
9164
  static hangupAfterInit() {
9149
- let e = es;
9165
+ let e = ns;
9150
9166
  e && e._delayedHangup === !1 && !e._conversation && (e._delayedHangup = !0, e._abortController?.abort(new O(D.CANCELED)));
9151
9167
  }
9152
9168
  static id() {
@@ -9189,11 +9205,11 @@ var $o = 15, $ = class e extends b {
9189
9205
  this._stats.lifecycle.markInitializationStarted({
9190
9206
  source: "outgoing",
9191
9207
  conversationId: u
9192
- }), this._debug.setConversationId(u), es = this, this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal);
9208
+ }), this._debug.setConversationId(u), ns = this, this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal);
9193
9209
  try {
9194
9210
  this._mediaSource = this._createMediaSource(), await this._mediaSource.request(n);
9195
9211
  let l = this._mediaSource.mediaSettings;
9196
- t === Pa.CHAT || e && e.length > 1 ? this._logWithMediaSettings(C.OUTGOING_MULTIPARTY_CALL, l) : this._logWithMediaSettings(C.OUTGOING_CALL, l), this._stats.lifecycle.markWarmupStarted();
9212
+ t === Pa.CHAT || e && e.length > 1 ? this._logWithMediaSettings(S.OUTGOING_MULTIPARTY_CALL, l) : this._logWithMediaSettings(S.OUTGOING_CALL, l), this._stats.lifecycle.markWarmupStarted();
9197
9213
  let d = await this._startConversation({
9198
9214
  opponentIds: e,
9199
9215
  opponentType: t,
@@ -9217,18 +9233,18 @@ var $o = 15, $ = class e extends b {
9217
9233
  opponentIds: e,
9218
9234
  opponentType: t,
9219
9235
  mediaOptions: n
9220
- }), this._processConnectionSharedMovieInfo(d), this._processConversationUrlSharingInfo(d), L.onLocalStream(this._mediaSource.getStream(), this._mediaSource.mediaSettings, this.id), L.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), this._getMainRoomParticipants(), void 0, this.id), this._onConversationParticipantListChunk(d), this._processPinnedParticipants(d), L.onLocalStatus(N.WAITING, this.id), this._toggleJoinAvailability(), this._changeFeatureSet(), this._changeNeedRate(), z.add(this), await z.setActive(this.id), es = null, this._conversation.concurrent && await this._acceptConcurrent(), f && !this._registeredPeerReceived && this._state !== "CLOSE" && (this._calleeUnavailableTimer = window.setTimeout(() => {
9236
+ }), this._processConnectionSharedMovieInfo(d), this._processConversationUrlSharingInfo(d), L.onLocalStream(this._mediaSource.getStream(), this._mediaSource.mediaSettings, this.id), L.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), this._getMainRoomParticipants(), void 0, this.id), this._onConversationParticipantListChunk(d), this._processPinnedParticipants(d), L.onLocalStatus(N.WAITING, this.id), this._toggleJoinAvailability(), this._changeFeatureSet(), this._changeNeedRate(), z.add(this), await z.setActive(this.id), ns = null, this._conversation.concurrent && await this._acceptConcurrent(), f && !this._registeredPeerReceived && this._state !== "CLOSE" && (this._calleeUnavailableTimer = window.setTimeout(() => {
9221
9237
  this._calleeUnavailableTimer = null, this._signaling.ready && this._signaling.hangup(D.CANCELED), this._close(new O(D.CALLEE_UNAVAILABLE));
9222
9238
  }, f)), this._conversation;
9223
9239
  } catch (e) {
9224
- throw es = null, this._cleanupRegistry(), this._close(e, "Unable to start conversation"), e;
9240
+ throw ns = null, this._cleanupRegistry(), this._close(e, "Unable to start conversation"), e;
9225
9241
  }
9226
9242
  }
9227
9243
  async onJoin(e) {
9228
9244
  this._stats.lifecycle.markInitializationStarted({
9229
9245
  source: e.anonymous ? "anonym_join" : "join",
9230
9246
  conversationId: e.conversationId
9231
- }), es = this, this._state = "PROCESSING", this._debug.setConversationId(e.conversationId ?? null), this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal);
9247
+ }), ns = this, this._state = "PROCESSING", this._debug.setConversationId(e.conversationId ?? null), this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal);
9232
9248
  try {
9233
9249
  let t = !!e.observedIds?.length;
9234
9250
  if (t && M.videoTracksCount > 0) throw this._debug.error("Observer mode: please set videoTracksCount=0"), new O(D.UNSUPPORTED, { callError: {
@@ -9238,16 +9254,16 @@ var $o = 15, $ = class e extends b {
9238
9254
  } });
9239
9255
  this._mediaSource = this._createMediaSource(), await this._mediaSource.request(e.mediaOptions, !t);
9240
9256
  let n = this._mediaSource.mediaSettings;
9241
- this._logWithMediaSettings(C.JOIN_CONVERSATION, n), this._stats.lifecycle.markWarmupStarted();
9257
+ this._logWithMediaSettings(S.JOIN_CONVERSATION, n), this._stats.lifecycle.markWarmupStarted();
9242
9258
  let r = await this._joinConversation(e);
9243
9259
  if (!this._conversation) throw new O(D.UNKNOWN_ERROR, { callError: {
9244
9260
  scope: "internal",
9245
9261
  code: "conversation",
9246
9262
  description: "not-initialized-after-join"
9247
9263
  } });
9248
- return this._conversation.observer = t, L.onLocalStream(this._mediaSource.getStream(), n, this.id), this._conversation.waitForAdmin || this._conversation.waitingHall ? (this._debug.log(this._conversation.waitForAdmin ? "Wait for admin" : "In waiting hall"), z.add(this), es = null, this._signaling.readyToSend(), L.onLocalStatus(this._conversation.waitForAdmin ? N.WAIT_FOR_ADMIN : N.WAITING_HALL, this.id), this._conversation) : this._onJoinPart2(r);
9264
+ return this._conversation.observer = t, L.onLocalStream(this._mediaSource.getStream(), n, this.id), this._conversation.waitForAdmin || this._conversation.waitingHall ? (this._debug.log(this._conversation.waitForAdmin ? "Wait for admin" : "In waiting hall"), z.add(this), ns = null, this._signaling.readyToSend(), L.onLocalStatus(this._conversation.waitForAdmin ? N.WAIT_FOR_ADMIN : N.WAITING_HALL, this.id), this._conversation) : this._onJoinPart2(r);
9249
9265
  } catch (e) {
9250
- throw es = null, this._cleanupRegistry(), this._close(e, "Unable to join conversation"), e;
9266
+ throw ns = null, this._cleanupRegistry(), this._close(e, "Unable to join conversation"), e;
9251
9267
  }
9252
9268
  }
9253
9269
  async _onJoinPart2(e, t = !0, n = !1) {
@@ -9262,7 +9278,7 @@ var $o = 15, $ = class e extends b {
9262
9278
  if (this._delayedHangup) throw new O(D.CANCELED);
9263
9279
  this._processConnectionSharedMovieInfo(e), this._processConversationUrlSharingInfo(e), this._processConnectionAsrInfo(e);
9264
9280
  let r = this._extractExternalRoomsData(e.rooms?.rooms, e.rooms?.roomId);
9265
- L.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), this._getMainRoomParticipants(), r, this.id), this._onConversationParticipantListChunk(e), this._processPinnedParticipants(e), L.onLocalStatus(N.WAITING, this.id), this._toggleJoinAvailability(), this._changeNeedRate(), t && (this._state = "ACTIVE"), this._changeFeatureSet(), t && (z.add(this), n ? await this._holdLocally() : await z.setActive(this.id), es = null);
9281
+ L.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), this._getMainRoomParticipants(), r, this.id), this._onConversationParticipantListChunk(e), this._processPinnedParticipants(e), L.onLocalStatus(N.WAITING, this.id), this._toggleJoinAvailability(), this._changeNeedRate(), t && (this._state = "ACTIVE"), this._changeFeatureSet(), t && (z.add(this), n ? await this._holdLocally() : await z.setActive(this.id), ns = null);
9266
9282
  let i = this._extractLocalParticipantFromConnection(e);
9267
9283
  if (i) {
9268
9284
  let e = j.mapParticipantState(i);
@@ -9270,7 +9286,7 @@ var $o = 15, $ = class e extends b {
9270
9286
  }
9271
9287
  return t && this._openTransport(Object.values(this._getParticipants()), !1), this._conversation;
9272
9288
  } catch (e) {
9273
- throw es = null, this._cleanupRegistry(), this._close(e, "Unable to join conversation"), e;
9289
+ throw ns = null, this._cleanupRegistry(), this._close(e, "Unable to join conversation"), e;
9274
9290
  }
9275
9291
  }
9276
9292
  _extractExternalRooms(e) {
@@ -9286,7 +9302,7 @@ var $o = 15, $ = class e extends b {
9286
9302
  z.reserve(e), this._reservedId = e, this._stats.lifecycle.markInitializationStarted({
9287
9303
  source: "incoming",
9288
9304
  conversationId: e
9289
- }), this._debug.setConversationId(e), es = this, this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal), a && this._api.setUserId(a);
9305
+ }), this._debug.setConversationId(e), ns = this, this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal), a && this._api.setUserId(a);
9290
9306
  try {
9291
9307
  this._stats.lifecycle.markWarmupStarted();
9292
9308
  let a = await this._prepareConversation(e, t, n, r, i);
@@ -9295,10 +9311,10 @@ var $o = 15, $ = class e extends b {
9295
9311
  code: "conversation",
9296
9312
  description: "incoming-not-initialized"
9297
9313
  } });
9298
- if (!a.conversation.participants.find((e) => e.state === Z.CALLED && e.id === this._conversation?.userId)) throw this._debug.log("Push rejected (there is an active call)"), this._stats.logger.log(C.PUSH, "rejected"), new O(D.REJECTED);
9299
- if (await this._processConnection(a), this._extractConnectionUrlSharingInfo(a), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener(), this._processPinnedParticipants(a), this._signaling.readyToSend(), this._stats.lifecycle.markCallStarted(), this._stats.logger.log(C.PUSH, "accepted"), z.add(this), es = null, this._delayedHangup) throw new O(D.CANCELED);
9314
+ if (!a.conversation.participants.find((e) => e.state === Z.CALLED && e.id === this._conversation?.userId)) throw this._debug.log("Push rejected (there is an active call)"), this._stats.logger.log(S.PUSH, "rejected"), new O(D.REJECTED);
9315
+ if (await this._processConnection(a), this._extractConnectionUrlSharingInfo(a), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener(), this._processPinnedParticipants(a), this._signaling.readyToSend(), this._stats.lifecycle.markCallStarted(), this._stats.logger.log(S.PUSH, "accepted"), z.add(this), ns = null, this._delayedHangup) throw new O(D.CANCELED);
9300
9316
  } catch (e) {
9301
- throw es = null, this._cleanupRegistry(), this._close(e, "Unable to handle inbound call push"), e;
9317
+ throw ns = null, this._cleanupRegistry(), this._close(e, "Unable to handle inbound call push"), e;
9302
9318
  }
9303
9319
  }
9304
9320
  _isInWaitingHall(e) {
@@ -9327,7 +9343,7 @@ var $o = 15, $ = class e extends b {
9327
9343
  } });
9328
9344
  this._state = "PROCESSING";
9329
9345
  let e = this._mediaSource.mediaSettings;
9330
- this._logWithMediaSettings(C.ACCEPT_CONCURRENT, e), this._debug.debug("Concurrent call", { conversationId: this._conversation.id });
9346
+ this._logWithMediaSettings(S.ACCEPT_CONCURRENT, e), this._debug.debug("Concurrent call", { conversationId: this._conversation.id });
9331
9347
  try {
9332
9348
  this._statFirstMediaReceived.markAcceptCall(this._transport.getTopology()), await this._signaling.acceptCall(this._mediaSource.mediaSettings), this._stats.lifecycle.markIncomingAccepted(!0), L.onCallAccepted(this.id), this._state = "ACTIVE", this._participantState = Z.ACCEPTED, this._changeFeatureSet(), this._openTransport(Object.values(this._getParticipants()), !0);
9333
9349
  } catch (e) {
@@ -9344,7 +9360,7 @@ var $o = 15, $ = class e extends b {
9344
9360
  let i = atob(n), a = new Uint8Array(i.length);
9345
9361
  for (let e = 0; e < i.length; e++) a[e] = i.charCodeAt(e);
9346
9362
  try {
9347
- let e = ro(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);
9363
+ let e = ao(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);
9348
9364
  return {
9349
9365
  token: i,
9350
9366
  endpoint: l,
@@ -9362,7 +9378,7 @@ var $o = 15, $ = class e extends b {
9362
9378
  }
9363
9379
  }
9364
9380
  async accept(e) {
9365
- if (this._state !== "IDLE") throw this._stats.logger.log(C.ERROR, "acceptIncoming"), this._debug.error("Unable to accept a call - invalid state"), Error("Unable to accept a call - invalid state");
9381
+ if (this._state !== "IDLE") throw this._stats.logger.log(S.ERROR, "acceptIncoming"), this._debug.error("Unable to accept a call - invalid state"), Error("Unable to accept a call - invalid state");
9366
9382
  if (!this._mediaSource || !this._conversation || !this._transport) throw new O(D.UNKNOWN_ERROR, { callError: {
9367
9383
  scope: "internal",
9368
9384
  code: "accept",
@@ -9372,7 +9388,7 @@ var $o = 15, $ = class e extends b {
9372
9388
  try {
9373
9389
  await this._mediaSource.request(e);
9374
9390
  let t = this._mediaSource.mediaSettings;
9375
- this._logWithMediaSettings(C.ACCEPT_INCOMING, t), this._changeMediaSettings(t), this._statFirstMediaReceived.markAcceptCall(this._transport.getTopology()), await this._signaling.acceptCall(t), this._stats.lifecycle.markIncomingAccepted(!1), this._participantState = Z.ACCEPTED;
9391
+ this._logWithMediaSettings(S.ACCEPT_INCOMING, t), this._changeMediaSettings(t), this._statFirstMediaReceived.markAcceptCall(this._transport.getTopology()), await this._signaling.acceptCall(t), this._stats.lifecycle.markIncomingAccepted(!1), this._participantState = Z.ACCEPTED;
9376
9392
  let n = this._getMuteStatesForCurrentRoom(), r = Object.keys(n);
9377
9393
  r.length && this._onMuteParticipant({
9378
9394
  muteStates: n,
@@ -9381,7 +9397,7 @@ var $o = 15, $ = class e extends b {
9381
9397
  stateUpdated: !0
9382
9398
  }), this._registerParticipantLocalMuteState({ muteStates: this._conversation.muteStatesPersonal });
9383
9399
  let i = await this._signaling.getRooms(this._isCallAdmin());
9384
- if (i.rooms?.rooms) {
9400
+ if (i.rooms?.rooms?.length) {
9385
9401
  let e = this._getParticipants();
9386
9402
  i.rooms.rooms.forEach((t) => {
9387
9403
  t.participantIds?.forEach((t) => {
@@ -9406,8 +9422,8 @@ var $o = 15, $ = class e extends b {
9406
9422
  }
9407
9423
  }
9408
9424
  async decline() {
9409
- if (this._state !== "IDLE") throw this._stats.logger.log(C.ERROR, "declineIncoming"), this._debug.error("Unable to decline a call - invalid state"), Error("Unable to decline a call - invalid state");
9410
- this._state = "PROCESSING", this._debug.debug("Decline incoming call"), this._logWithMediaSettings(C.DECLINE_INCOMING, this.mediaSettings), this._participantState = Z.HUNGUP;
9425
+ if (this._state !== "IDLE") throw this._stats.logger.log(S.ERROR, "declineIncoming"), this._debug.error("Unable to decline a call - invalid state"), Error("Unable to decline a call - invalid state");
9426
+ this._state = "PROCESSING", this._debug.debug("Decline incoming call"), this._logWithMediaSettings(S.DECLINE_INCOMING, this.mediaSettings), this._participantState = Z.HUNGUP;
9411
9427
  let e = new O(D.REJECTED);
9412
9428
  this._finishLifecycle(e);
9413
9429
  try {
@@ -9419,7 +9435,7 @@ var $o = 15, $ = class e extends b {
9419
9435
  async hangup() {
9420
9436
  this._clearCalleeUnavailableWatchdog(), this._debug.debug("Hangup");
9421
9437
  let e = this._state === "ACTIVE" || this._state === "HELD" ? D.HUNGUP : D.CANCELED, t = new O(e);
9422
- this._stats.logger.log(C.HANGUP, e), this._finishLifecycle(t);
9438
+ this._stats.logger.log(S.HANGUP, e), this._finishLifecycle(t);
9423
9439
  try {
9424
9440
  this._signaling.ready && await this._signaling.hangup(e);
9425
9441
  } finally {
@@ -9439,7 +9455,7 @@ var $o = 15, $ = class e extends b {
9439
9455
  let n = await this._signaling.addParticipant(e.map(Q.toSignaling), t), r = null;
9440
9456
  n.type === "error" && (r = n.error === "call-unfeasible" ? n.status : D.UNKNOWN_ERROR);
9441
9457
  let i = n.participants;
9442
- if (!i && n.rejectedParticipants) throw Error(n.rejectedParticipants[0].reason);
9458
+ if (!i && n.rejectedParticipants?.length) throw Error(n.rejectedParticipants[0].reason);
9443
9459
  for (let e of i) await this._onAddParticipant(j.composeId(e), e, r);
9444
9460
  }
9445
9461
  async addParticipantLegacy(e, t) {
@@ -9478,7 +9494,7 @@ var $o = 15, $ = class e extends b {
9478
9494
  z.remove(this._reservedId), z.remove(this.id), this._reservedId = null;
9479
9495
  }
9480
9496
  async _close(e, t) {
9481
- this._clearCalleeUnavailableWatchdog(), t && this._debug.error(t, e), this._debug.debug("Close conversation", e), this._finishLifecycle(e), this._stats.flushCallMetrics(), this._signaling.readyToSend(!1), e.error ? this._signaling.ready && this._signaling.hangup(D.FAILED) : this._stats.logger.log(C.ERROR, e.hangup);
9497
+ this._clearCalleeUnavailableWatchdog(), t && this._debug.error(t, e), this._debug.debug("Close conversation", e), this._finishLifecycle(e), this._stats.flushCallMetrics(), this._signaling.readyToSend(!1), e.error ? this._signaling.ready && this._signaling.hangup(D.FAILED) : this._stats.logger.log(S.ERROR, e.hangup);
9482
9498
  let n = this._conversation && this._conversation.id;
9483
9499
  if ([
9484
9500
  D.CANCELED,
@@ -9520,28 +9536,11 @@ var $o = 15, $ = class e extends b {
9520
9536
  async _getConversationParams(e) {
9521
9537
  let t = await this._api.getConversationParams(e);
9522
9538
  this._debug.debug("Api.getConversationParams", t);
9523
- let n = [], { turn_server: r, stun_server: i } = t;
9524
- if (i && n.push(i), r && r.urls) {
9525
- let e = r.urls.filter((e, t, n) => n.indexOf(e) === t);
9526
- e.push(`${e[e.length - 1]}?transport=tcp`), n.push({
9527
- urls: e,
9528
- username: r.username,
9529
- credential: r.credential
9530
- });
9531
- }
9532
- return M.iceServers = n, M.wssBase = t.endpoint, t.wt_endpoint && (M.wtsBase = t.wt_endpoint), M.wssToken = t.token, t.client_type && (M.clientType = t.client_type), t.external_user_type && (M.externalUserType = t.external_user_type), t;
9539
+ let { turn_server: n, stun_server: r } = t;
9540
+ return M.iceServers = io(r, n), M.wssBase = t.endpoint, t.wt_endpoint && (M.wtsBase = t.wt_endpoint), M.wssToken = t.token, t.client_type && (M.clientType = t.client_type), t.external_user_type && (M.externalUserType = t.external_user_type), t;
9533
9541
  }
9534
9542
  _setConversationParams({ turn_server: e, stun_server: t, endpoint: n, wt_endpoint: r, token: i, client_type: a }) {
9535
- let o = [];
9536
- if (t && o.push(t), e && e.urls) {
9537
- let t = e.urls.filter((e, t, n) => n.indexOf(e) === t);
9538
- t.push(`${t[t.length - 1]}?transport=tcp`), o.push({
9539
- urls: t,
9540
- username: e.username,
9541
- credential: e.credential
9542
- });
9543
- }
9544
- M.iceServers = o, M.wssBase = n, M.wssToken = i, r && (M.wtsBase = r), a && (M.clientType = a);
9543
+ M.iceServers = io(t, e), M.wssBase = n, M.wssToken = i, r && (M.wtsBase = r), a && (M.clientType = a);
9545
9544
  }
9546
9545
  _buildSignalingEndpoint({ baseEndpoint: e, userId: t, type: n, deviceIdx: r, conversationId: i, token: a, conversationParams: o }) {
9547
9546
  let s = new URL(e), c = s.searchParams;
@@ -9559,7 +9558,7 @@ var $o = 15, $ = class e extends b {
9559
9558
  opponentType: t,
9560
9559
  direction: n
9561
9560
  });
9562
- let f = r.includes(S.VIDEO), p, m;
9561
+ let f = r.includes(x.VIDEO), p, m;
9563
9562
  if (l) {
9564
9563
  let e = {
9565
9564
  deviceId: this._api.deviceId(),
@@ -9581,10 +9580,10 @@ var $o = 15, $ = class e extends b {
9581
9580
  isVideo: f,
9582
9581
  joiningAllowed: a,
9583
9582
  requireAuthToJoin: o
9584
- }, this._abortController?.signal), !s) throw Qo(D.FAST_START_ERROR, "invalid-response", "fast-start-response-empty");
9583
+ }, this._abortController?.signal), !s) throw es(D.FAST_START_ERROR, "invalid-response", "fast-start-response-empty");
9585
9584
  if (!s.internalCallerParams) {
9586
9585
  let e = s.rejectedParticipants[0]?.status;
9587
- throw Qo(D.FAST_START_ERROR, e ? "fast-start" : "invalid-response", e ?? "fast-start-internal-caller-params-empty", JSON.stringify(s));
9586
+ throw es(D.FAST_START_ERROR, e ? "fast-start" : "invalid-response", e ?? "fast-start-internal-caller-params-empty", JSON.stringify(s));
9588
9587
  }
9589
9588
  } catch (e) {
9590
9589
  throw this._delayedHangup && this._abortController?.signal.aborted ? new O(D.CANCELED) : e instanceof O ? e : e instanceof Error ? new O(D.FAST_START_ERROR, { message: e.message }) : new O(D.FAST_START_ERROR, { message: String(e) });
@@ -9606,10 +9605,10 @@ var $o = 15, $ = class e extends b {
9606
9605
  token: new URL(e.endpoint).searchParams.get("token") ?? ""
9607
9606
  }, this._debug.debug("FastStart", p), m = "fastStart";
9608
9607
  } catch {
9609
- throw Qo(D.FAST_START_ERROR, "invalid-response", "fast-start-internal-caller-params-invalid");
9608
+ throw es(D.FAST_START_ERROR, "invalid-response", "fast-start-internal-caller-params-invalid");
9610
9609
  }
9611
9610
  } else p = await this._api.startConversation(d, e, t, f, i, a, o, { onlyAdminCanShareMovie: s }, c), this._debug.debug("Api.startConversation", p), m = "startConversation";
9612
- oo(p, m), this._setConversationParams(p), this._stats.lifecycle.bindConversationId(p.id), this._stats.lifecycle.markWarmupCompleted();
9611
+ co(p, m), this._setConversationParams(p), this._stats.lifecycle.bindConversationId(p.id), this._stats.lifecycle.markWarmupCompleted();
9613
9612
  let ee = await this._connectSignaling(fr.START, p);
9614
9613
  return this._setConversation(p, ee, n), this._stats.lifecycle.markCallStarted(), ee;
9615
9614
  }
@@ -9621,7 +9620,7 @@ var $o = 15, $ = class e extends b {
9621
9620
  joinLink: i,
9622
9621
  observedIds: a
9623
9622
  }), t && z.has(t)) throw new O(D.HAS_ACTIVE_CALL);
9624
- let c = n.includes(S.VIDEO), l, u;
9623
+ let c = n.includes(x.VIDEO), l, u;
9625
9624
  if (s) {
9626
9625
  if (!i) throw new O(D.FAST_JOIN_ERROR, { callError: {
9627
9626
  scope: "internal",
@@ -9642,9 +9641,9 @@ var $o = 15, $ = class e extends b {
9642
9641
  joinLink: i,
9643
9642
  isVideo: c,
9644
9643
  internalParams: t
9645
- }, this._abortController?.signal), !n) throw Qo(D.FAST_JOIN_ERROR, "invalid-response", "fast-join-response-empty");
9646
- if (!n.internalCallerParams) throw Qo(D.FAST_JOIN_ERROR, "invalid-response", "fast-join-internal-caller-params-empty", JSON.stringify(n));
9647
- if (!n.conversationId) throw Qo(D.FAST_JOIN_ERROR, "invalid-response", "fast-join-conversation-id-empty", JSON.stringify(n));
9644
+ }, this._abortController?.signal), !n) throw es(D.FAST_JOIN_ERROR, "invalid-response", "fast-join-response-empty");
9645
+ if (!n.internalCallerParams) throw es(D.FAST_JOIN_ERROR, "invalid-response", "fast-join-internal-caller-params-empty", JSON.stringify(n));
9646
+ if (!n.conversationId) throw es(D.FAST_JOIN_ERROR, "invalid-response", "fast-join-conversation-id-empty", JSON.stringify(n));
9648
9647
  } catch (e) {
9649
9648
  throw this._delayedHangup && this._abortController?.signal.aborted ? new O(D.CANCELED) : e instanceof O ? e : e instanceof Error ? new O(D.FAST_JOIN_ERROR, { message: e.message }) : new O(D.FAST_JOIN_ERROR, { message: String(e) });
9650
9649
  }
@@ -9662,7 +9661,7 @@ var $o = 15, $ = class e extends b {
9662
9661
  token: new URL(e.endpoint).searchParams.get("token") ?? ""
9663
9662
  }, this._debug.debug("FastJoin", l), u = "fastJoin";
9664
9663
  } catch (e) {
9665
- throw e instanceof O ? e : Qo(D.FAST_JOIN_ERROR, "invalid-response", "fast-join-internal-caller-params-invalid");
9664
+ throw e instanceof O ? e : es(D.FAST_JOIN_ERROR, "invalid-response", "fast-join-internal-caller-params-invalid");
9666
9665
  }
9667
9666
  } else if (t) l = await this._api.joinConversation(t, c, r), u = "joinConversation";
9668
9667
  else if (i) l = await this._api.joinConversationByLink(i, c, a, o), u = "joinConversationByLink";
@@ -9671,7 +9670,7 @@ var $o = 15, $ = class e extends b {
9671
9670
  code: "join",
9672
9671
  description: "target-missing"
9673
9672
  } });
9674
- if (this._debug.debug("Api.joinConversation", l), l.id && this._stats.lifecycle.bindConversationId(l.id), oo(l, u), l.id) {
9673
+ if (this._debug.debug("Api.joinConversation", l), l.id && this._stats.lifecycle.bindConversationId(l.id), co(l, u), l.id) {
9675
9674
  if (z.has(l.id)) throw new O(D.HAS_ACTIVE_CALL);
9676
9675
  z.reserve(l.id), this._reservedId = l.id;
9677
9676
  }
@@ -9740,7 +9739,7 @@ var $o = 15, $ = class e extends b {
9740
9739
  }
9741
9740
  this._stats.lifecycle.markWarmupCompleted();
9742
9741
  let u = await this._connectSignaling(fr.ACCEPT, l);
9743
- return z.callsLength >= M.maxParallelCalls || !M.hold && z.callsLength > 0 ? (this._debug.log("Push rejected (busy)"), this._stats.logger.log(C.PUSH, "busy"), this._signaling.ready && this._signaling.hangup(D.BUSY), Promise.reject(new O(D.BUSY))) : (this._setConversation(l, u, Na.INCOMING, t), u);
9742
+ return z.callsLength >= M.maxParallelCalls || !M.hold && z.callsLength > 0 ? (this._debug.log("Push rejected (busy)"), this._stats.logger.log(S.PUSH, "busy"), this._signaling.ready && this._signaling.hangup(D.BUSY), Promise.reject(new O(D.BUSY))) : (this._setConversation(l, u, Na.INCOMING, t), u);
9744
9743
  }
9745
9744
  _createParticipant(e, t, n = !0) {
9746
9745
  let r = Object.assign({
@@ -9832,7 +9831,7 @@ var $o = 15, $ = class e extends b {
9832
9831
  audienceMode: this._isAudienceMode(t),
9833
9832
  restricted: this._isRestricted(t),
9834
9833
  urlSharingInfoByRoom: /* @__PURE__ */ new Map()
9835
- }, this._debug.setConversationId(t.conversation.id || e.id), this._signaling.setConversationId(this._conversation.id), e.p2p_forbidden && (M.forceRelayPolicy = e.p2p_forbidden), this._stats.logger.log(C.RELAY_POLICY, M.forceRelayPolicy ? "1" : "0"), this._changeFeatureSet(), this._changeFeaturesPerRole(), this._logDevices();
9834
+ }, this._debug.setConversationId(t.conversation.id || e.id), this._signaling.setConversationId(this._conversation.id), e.p2p_forbidden && (M.forceRelayPolicy = e.p2p_forbidden), this._stats.logger.log(S.RELAY_POLICY, M.forceRelayPolicy ? "1" : "0"), this._changeFeatureSet(), this._changeFeaturesPerRole(), this._logDevices();
9836
9835
  }
9837
9836
  _updateConversation(e) {
9838
9837
  if (!this._conversation) throw new O(D.UNKNOWN_ERROR, { callError: {
@@ -9844,7 +9843,7 @@ var $o = 15, $ = class e extends b {
9844
9843
  }
9845
9844
  _createMediaSource() {
9846
9845
  let e = new Yt(this._debug, this._stats.logger);
9847
- return this.subscribe(e, qt.SOURCE_CHANGED, this._onLocalMediaStreamChanged.bind(this)), this.subscribe(e, qt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._audioFix = new io(e, this._debug, this._stats.logger), e;
9846
+ return this.subscribe(e, qt.SOURCE_CHANGED, this._onLocalMediaStreamChanged.bind(this)), this.subscribe(e, qt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._audioFix = new oo(e, this._debug, this._stats.logger), e;
9848
9847
  }
9849
9848
  async _connectSignaling(e, t) {
9850
9849
  this._signaling.setEndpoint(t.endpoint), this._signaling.setWebTransportEndpoint(t.wt_endpoint ? t.wt_endpoint : null), this.subscribe(this._signaling, G.NOTIFICATION, (e) => this._signalingActor.add(e)), this.subscribe(this._signaling, G.FAILED, this._onSignalingFailed.bind(this)), this.subscribe(this._signaling, G.RECONNECT, this._onSignalingReconnect.bind(this));
@@ -10038,19 +10037,19 @@ var $o = 15, $ = class e extends b {
10038
10037
  }
10039
10038
  _allocateTransport() {
10040
10039
  if (!this._conversation || !this._mediaSource) return;
10041
- this._transport = new na(this._conversation.topology, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._stats.logger, this._stats.statAggregator, this._stats.codecStatsAggregator, this._getFirstMediaSentCallback()), this._debugInfo = new fo(this._debug), this.subscribe(this._transport, X.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(this._transport, X.LOCAL_STATE_CHANGED, this._onTransportLocalStateChanged.bind(this)), this.subscribe(this._transport, X.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(this._transport, X.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(this._transport, X.AUDIO_MIX_STALL, this._onAudioMixStall.bind(this)), this.subscribe(this._transport, X.REMOTE_DATA_STATS, this._onRemoteDataStats.bind(this)), this.subscribe(this._transport, X.SIGNALLED_STALLED_PARTICIPANTS, this._onRemoteSignalledStall.bind(this)), this.subscribe(this._transport, X.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this)), this.subscribe(this._transport, X.NETWORK_STATUS, this._onNetworkStatus.bind(this)), this.subscribe(this._transport, X.REMOTE_STREAM_SECOND, this._onRemoteStreamSecond.bind(this)), this.subscribe(this._transport, X.PEER_CONNECTION_CLOSED, this._onPeerConnectionClosed.bind(this)), this.subscribe(this._transport, X.ASR_TRANSCRIPTION, this._onAsrTranscription.bind(this)), this.subscribe(this._transport, X.ANIMOJI_STREAM, this._onAnimojiStream.bind(this)), this.subscribe(this._transport, X.ANIMOJI_ERROR, this._onAnimojiError.bind(this));
10040
+ this._transport = new na(this._conversation.topology, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._stats.logger, this._stats.statAggregator, this._stats.codecStatsAggregator, this._getFirstMediaSentCallback()), this._debugInfo = new mo(this._debug), this.subscribe(this._transport, X.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(this._transport, X.LOCAL_STATE_CHANGED, this._onTransportLocalStateChanged.bind(this)), this.subscribe(this._transport, X.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(this._transport, X.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(this._transport, X.AUDIO_MIX_STALL, this._onAudioMixStall.bind(this)), this.subscribe(this._transport, X.REMOTE_DATA_STATS, this._onRemoteDataStats.bind(this)), this.subscribe(this._transport, X.SIGNALLED_STALLED_PARTICIPANTS, this._onRemoteSignalledStall.bind(this)), this.subscribe(this._transport, X.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this)), this.subscribe(this._transport, X.NETWORK_STATUS, this._onNetworkStatus.bind(this)), this.subscribe(this._transport, X.REMOTE_STREAM_SECOND, this._onRemoteStreamSecond.bind(this)), this.subscribe(this._transport, X.PEER_CONNECTION_CLOSED, this._onPeerConnectionClosed.bind(this)), this.subscribe(this._transport, X.ASR_TRANSCRIPTION, this._onAsrTranscription.bind(this)), this.subscribe(this._transport, X.ANIMOJI_STREAM, this._onAnimojiStream.bind(this)), this.subscribe(this._transport, X.ANIMOJI_ERROR, this._onAnimojiError.bind(this));
10042
10041
  let e = this._conversation.direction === Na.OUTGOING && !this._conversation.concurrent, t = this._getParticipants();
10043
10042
  for (let n of Object.values(t)) (n.state === Z.ACCEPTED || n.state === Z.CALLED) && this._allocateParticipantTransport(n.id, e);
10044
10043
  }
10045
10044
  _createSpeakerDetector() {
10046
- this._transport && this._conversation && (this._volumesDetector = new yo(this._transport), this.subscribe(this._volumesDetector, vo.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this._speakerDetector = new xo(this._volumesDetector, this._transport, this._conversation.topology), this.subscribe(this._speakerDetector, bo.SPEAKER_CHANGED, this._onSpeakerChanged.bind(this)), this._localVolumeDetector = new go(this._mediaSource));
10045
+ this._transport && this._conversation && (this._volumesDetector = new xo(this._transport), this.subscribe(this._volumesDetector, bo.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this._speakerDetector = new Co(this._volumesDetector, this._transport, this._conversation.topology), this.subscribe(this._speakerDetector, So.SPEAKER_CHANGED, this._onSpeakerChanged.bind(this)), this._localVolumeDetector = new vo(this._mediaSource));
10047
10046
  }
10048
10047
  _createSpecListener() {
10049
- this._transport && this._volumesDetector && (this._specListener = new wo(this._transport, this._volumesDetector, this._getParticipants(), this._debug, this._stats.logger));
10048
+ this._transport && this._volumesDetector && (this._specListener = new Eo(this._transport, this._volumesDetector, this._getParticipants(), this._debug, this._stats.logger));
10050
10049
  }
10051
10050
  _logDevices() {
10052
10051
  let e = T.getCameras().length, t = T.getMicrophones().length;
10053
- this._debug.debug("Cameras: " + e + (T.hasCameraPermission() ? "✔" : "✖") + ", Microphones: " + t + (T.hasMicrophonePermission() ? "✔" : "✖")), this._stats.logger.log(C.DEVICES, `${e}_${t}`);
10052
+ this._debug.debug("Cameras: " + e + (T.hasCameraPermission() ? "✔" : "✖") + ", Microphones: " + t + (T.hasMicrophonePermission() ? "✔" : "✖")), this._stats.logger.log(S.DEVICES, `${e}_${t}`);
10054
10053
  }
10055
10054
  _logWithMediaSettings(e, t) {
10056
10055
  this._stats.logger.log(e, [t?.isAudioEnabled && "audio", t?.isVideoEnabled && "video"].filter(Boolean).join("_"));
@@ -10134,12 +10133,12 @@ var $o = 15, $ = class e extends b {
10134
10133
  observedIds: t.observedIds || []
10135
10134
  }, n), r = this._getParticipant(e);
10136
10135
  }
10137
- this._setParticipantsStatus([r], N.WAITING), i && this._emitParticipantEffectiveStatusIfSessionOverridesTransport(r), n ? (r.state = Z.HUNGUP, await this._removeParticipant(r, n)) : this._transport && (r.state = Z.CALLED, this._allocateParticipantTransport(r.id, !0), this._stats.logger.log(C.ADD_PARTICIPANT), this._invokeRolesChangedCallbackIfNeeded(r));
10136
+ this._setParticipantsStatus([r], N.WAITING), i && this._emitParticipantEffectiveStatusIfSessionOverridesTransport(r), n ? (r.state = Z.HUNGUP, await this._removeParticipant(r, n)) : this._transport && (r.state = Z.CALLED, this._allocateParticipantTransport(r.id, !0), this._stats.logger.log(S.ADD_PARTICIPANT), this._invokeRolesChangedCallbackIfNeeded(r));
10138
10137
  }
10139
10138
  _onRemoveParticipant(e) {
10140
10139
  this._debug.debug(`Remove participant [${e}]`);
10141
10140
  let t = [], n = this._getParticipants();
10142
- for (let r = 0; r <= $o; r++) {
10141
+ for (let r = 0; r <= ts; r++) {
10143
10142
  let i = n[j.compose(e, r)];
10144
10143
  i && t.push(i);
10145
10144
  }
@@ -10148,19 +10147,19 @@ var $o = 15, $ = class e extends b {
10148
10147
  return;
10149
10148
  }
10150
10149
  if (this._transport) for (let e of t) this._transport.close(e.id);
10151
- this._stats.logger.log(C.REMOVE_PARTICIPANT);
10150
+ this._stats.logger.log(S.REMOVE_PARTICIPANT);
10152
10151
  }
10153
10152
  async changeDevice(e) {
10154
- return e === "audiooutput" ? this._audioOutput.changeOutput() : this._mediaSource ? this._mediaSource.changeDevice(e) : Promise.reject(x.UNKNOWN);
10153
+ return e === "audiooutput" ? this._audioOutput.changeOutput() : this._mediaSource ? this._mediaSource.changeDevice(e) : Promise.reject(b.UNKNOWN);
10155
10154
  }
10156
10155
  stopVideoTrack() {
10157
10156
  return this._mediaSource?.stopVideoTrack();
10158
10157
  }
10159
10158
  async toggleScreenCapturing(e) {
10160
- return this._mediaSource ? this._mediaSource.toggleScreenCapturing(e) : Promise.reject(x.UNKNOWN);
10159
+ return this._mediaSource ? this._mediaSource.toggleScreenCapturing(e) : Promise.reject(b.UNKNOWN);
10161
10160
  }
10162
10161
  async disableScreenCapturing() {
10163
- return this._mediaSource ? this._mediaSource.disableScreenCapturing() : Promise.reject(x.UNKNOWN);
10162
+ return this._mediaSource ? this._mediaSource.disableScreenCapturing() : Promise.reject(b.UNKNOWN);
10164
10163
  }
10165
10164
  toggleAnimojiCapturing(e) {
10166
10165
  this._mediaSource && this._mediaSource.toggleAnimojiCapturing(e);
@@ -10192,10 +10191,10 @@ var $o = 15, $ = class e extends b {
10192
10191
  if (this._mediaSource) return this._mediaSource.setAudioStream(e);
10193
10192
  }
10194
10193
  async toggleLocalVideo(e) {
10195
- if (this._mediaSource) return this._stats.logger.log(C.MEDIA_STATUS, e ? "video_1" : "video_0"), this._mediaSource.toggleVideo(e);
10194
+ if (this._mediaSource) return this._stats.logger.log(S.MEDIA_STATUS, e ? "video_1" : "video_0"), this._mediaSource.toggleVideo(e);
10196
10195
  }
10197
10196
  async toggleLocalAudio(e) {
10198
- if (this._mediaSource) return this._stats.logger.log(C.MEDIA_STATUS, e ? "audio_1" : "audio_0"), this._mediaSource.toggleAudio(e);
10197
+ if (this._mediaSource) return this._stats.logger.log(S.MEDIA_STATUS, e ? "audio_1" : "audio_0"), this._mediaSource.toggleAudio(e);
10199
10198
  }
10200
10199
  async changePriorities(e) {
10201
10200
  if (e.length < 2 || !this._signaling.ready) return;
@@ -10332,7 +10331,7 @@ var $o = 15, $ = class e extends b {
10332
10331
  L.onRemoteScreenStream(r.externalId, null, this.id);
10333
10332
  break;
10334
10333
  }
10335
- this._stats.logger.log(C.PAT_DEALLOCATED);
10334
+ this._stats.logger.log(S.PAT_DEALLOCATED);
10336
10335
  } else this._debug.log(`Cannot find participant to stop streaming: ${n.participantId}`);
10337
10336
  }
10338
10337
  this._streamIdByStreamDescription.delete(e);
@@ -10358,7 +10357,7 @@ var $o = 15, $ = class e extends b {
10358
10357
  });
10359
10358
  }
10360
10359
  }
10361
- if (r && r.length && (this._debug.warn("Could not allocate one or more participants", r), t)) throw new ts("Could not allocate one or more participants", r);
10360
+ if (r && r.length && (this._debug.warn("Could not allocate one or more participants", r), t)) throw new rs("Could not allocate one or more participants", r);
10362
10361
  }
10363
10362
  async _cleanupCooldownQueue() {
10364
10363
  let e = {}, t = this._cooldownTimestampByStreamDescription.entries();
@@ -10366,7 +10365,7 @@ var $o = 15, $ = class e extends b {
10366
10365
  let n = t.next();
10367
10366
  if (n.done) break;
10368
10367
  let r = n.value;
10369
- if (r[1] + Zo > Date.now()) break;
10368
+ if (r[1] + $o > Date.now()) break;
10370
10369
  let i = r[0];
10371
10370
  await this._stopStreaming(i), e[i] = { stopStream: !0 };
10372
10371
  } while (!0);
@@ -10497,7 +10496,7 @@ var $o = 15, $ = class e extends b {
10497
10496
  }
10498
10497
  let a = En(t), o = this._sequenceNumberByStreamDescription.get(a);
10499
10498
  if (o && o > e.sequenceNumber) {
10500
- this._debug.warn(`Participant ${r} received outdated PAT response: sequence number ${e.sequenceNumber}; last sent sequence number for given participant is ${o}`), this._stats.logger.log(C.PAT_OUTDATED_RESPONSE);
10499
+ this._debug.warn(`Participant ${r} received outdated PAT response: sequence number ${e.sequenceNumber}; last sent sequence number for given participant is ${o}`), this._stats.logger.log(S.PAT_OUTDATED_RESPONSE);
10501
10500
  return;
10502
10501
  }
10503
10502
  i && e.suspend !== void 0 && n && (this._debug.debug(`participant-sources-update: mediaType=${n}, suspend=${e.suspend}`), L.onRemoteStreamSuspended(i.externalId, n, e.suspend, this.id));
@@ -10506,15 +10505,15 @@ var $o = 15, $ = class e extends b {
10506
10505
  this._streamWaitTimerByStreamDescription.delete(a);
10507
10506
  let t = this._conversation?.externalId, n = this._isMe(r);
10508
10507
  if (!i && !n) {
10509
- this._stats.logger.log(C.PAT_ERROR, "participantMissing"), this._debug.error(`Could not find participant by ID: ${r}`);
10508
+ this._stats.logger.log(S.PAT_ERROR, "participantMissing"), this._debug.error(`Could not find participant by ID: ${r}`);
10510
10509
  return;
10511
10510
  }
10512
10511
  let o = n ? t : i.externalId, c = this._streamByStreamId.get(s);
10513
10512
  if (!c) {
10514
- this._stats.logger.log(C.PAT_ERROR, "streamNotFound"), this._debug.error(`Could not find stream by ID: ${s}`);
10513
+ this._stats.logger.log(S.PAT_ERROR, "streamNotFound"), this._debug.error(`Could not find stream by ID: ${s}`);
10515
10514
  return;
10516
10515
  }
10517
- this._stats.logger.log(C.PAT_ALLOCATED), this._streamIdByStreamDescription.set(a, s);
10516
+ this._stats.logger.log(S.PAT_ALLOCATED), this._streamIdByStreamDescription.set(a, s);
10518
10517
  let l = e.participantStreamDescription?.mediaType;
10519
10518
  if (l === V.STREAM || l === V.MOVIE) {
10520
10519
  if (e.participantStreamDescription?.streamName) {
@@ -10837,7 +10836,7 @@ var $o = 15, $ = class e extends b {
10837
10836
  _onLocalMediaStreamChanged(e) {
10838
10837
  if (!this._conversation || !this._mediaSource) return;
10839
10838
  let t = this._mediaSource.mediaSettings;
10840
- this._debug.debug("Local media stream changed", t), e.kind === k.audio && this._mediaSource && (this._audioFix = new io(this._mediaSource, this._debug, this._stats.logger)), L.onLocalStreamUpdate(t, e.kind, this.id), !this._conversation?.waitingHall && !this._conversation?.observer && !this._isAudienceModeListener() && this._changeMediaSettings(t);
10839
+ this._debug.debug("Local media stream changed", t), e.kind === k.audio && this._mediaSource && (this._audioFix = new oo(this._mediaSource, this._debug, this._stats.logger)), L.onLocalStreamUpdate(t, e.kind, this.id), !this._conversation?.waitingHall && !this._conversation?.observer && !this._isAudienceModeListener() && this._changeMediaSettings(t);
10841
10840
  }
10842
10841
  _onScreenSharingStatus(e) {
10843
10842
  let t = this.mediaSettings;
@@ -11020,7 +11019,7 @@ var $o = 15, $ = class e extends b {
11020
11019
  mediaSettings: E(e.mediaSettings)
11021
11020
  }, i));
11022
11021
  }
11023
- r.state = Z.ACCEPTED, r.mediaSettings = E(e.mediaSettings), this._logWithMediaSettings(C.ACCEPTED_OUTGOING, r.mediaSettings), this._conversation && this._conversation.direction === Na.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), this._state === "ACTIVE" && this._transport && this._transport.open([r.id], n), this._changeRemoteMediaSettings(t, r.mediaSettings), await this._changeRemoteParticipantState(t);
11022
+ r.state = Z.ACCEPTED, r.mediaSettings = E(e.mediaSettings), this._logWithMediaSettings(S.ACCEPTED_OUTGOING, r.mediaSettings), this._conversation && this._conversation.direction === Na.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), this._state === "ACTIVE" && this._transport && this._transport.open([r.id], n), this._changeRemoteMediaSettings(t, r.mediaSettings), await this._changeRemoteParticipantState(t);
11024
11023
  let i = Object.keys(r.muteStates);
11025
11024
  i.length && this._onMuteParticipant({
11026
11025
  muteStates: r.muteStates,
@@ -11224,7 +11223,7 @@ var $o = 15, $ = class e extends b {
11224
11223
  n && (n.clientType = e.clientType, n.platform = e.platform), L.onPeerRegistered(this.id, [n.externalId]);
11225
11224
  }
11226
11225
  async _onMicSwitched(e) {
11227
- L.onDeviceSwitched(S.AUDIO, !e.mute, this.id), await this.toggleLocalAudio(!e.mute);
11226
+ L.onDeviceSwitched(x.AUDIO, !e.mute, this.id), await this.toggleLocalAudio(!e.mute);
11228
11227
  }
11229
11228
  _onChatMessage(e) {
11230
11229
  let t = j.composeMessageId(e), n = this._getExternalIdByParticipantId(t);
@@ -11389,17 +11388,17 @@ var $o = 15, $ = class e extends b {
11389
11388
  for (let [e, i] of d) {
11390
11389
  let a = this._isCallAdmin() && n;
11391
11390
  if (!(i !== Ba.MUTE && i !== Ba.MUTE_PERMANENT || a) && (this._isCallAdmin() && i === Ba.MUTE_PERMANENT && !n && (l[e] = Ba.MUTE), !(!t.includes(e) || r))) switch (e) {
11392
- case S.VIDEO:
11393
- u.isVideoEnabled && (L.onDeviceSwitched(S.VIDEO, !1, this.id), await this.toggleLocalVideo(!1));
11391
+ case x.VIDEO:
11392
+ u.isVideoEnabled && (L.onDeviceSwitched(x.VIDEO, !1, this.id), await this.toggleLocalVideo(!1));
11394
11393
  break;
11395
- case S.AUDIO:
11396
- u.isAudioEnabled && (L.onDeviceSwitched(S.AUDIO, !1, this.id), await this.toggleLocalAudio(!1));
11394
+ case x.AUDIO:
11395
+ u.isAudioEnabled && (L.onDeviceSwitched(x.AUDIO, !1, this.id), await this.toggleLocalAudio(!1));
11397
11396
  break;
11398
- case S.SCREEN_SHARING:
11399
- u.isScreenSharingEnabled && (L.onDeviceSwitched(S.SCREEN_SHARING, !1, this.id), await this.disableScreenCapturing());
11397
+ case x.SCREEN_SHARING:
11398
+ u.isScreenSharingEnabled && (L.onDeviceSwitched(x.SCREEN_SHARING, !1, this.id), await this.disableScreenCapturing());
11400
11399
  break;
11401
- case S.AUDIO_SHARING:
11402
- u.isAudioSharingEnabled && (L.onDeviceSwitched(S.AUDIO_SHARING, !1, this.id), await this.toggleScreenCapturing({
11400
+ case x.AUDIO_SHARING:
11401
+ u.isAudioSharingEnabled && (L.onDeviceSwitched(x.AUDIO_SHARING, !1, this.id), await this.toggleScreenCapturing({
11403
11402
  captureScreen: u.isScreenSharingEnabled,
11404
11403
  fastScreenSharing: u.isFastScreenSharingEnabled,
11405
11404
  captureAudio: !1
@@ -11859,19 +11858,19 @@ var $o = 15, $ = class e extends b {
11859
11858
  _getParticipant(e) {
11860
11859
  return this._getParticipants()[e];
11861
11860
  }
11862
- }, es = null, ts = class e extends Error {
11861
+ }, ns = null, rs = class e extends Error {
11863
11862
  constructor(t, n) {
11864
11863
  super(t), h(this, "participantErrors", void 0), Object.setPrototypeOf(this, e.prototype), this.participantErrors = n;
11865
11864
  }
11866
- }, ns = null, rs = null;
11867
- function is() {
11868
- ns = null, rs = null;
11865
+ }, is = null, as = null;
11866
+ function os() {
11867
+ is = null, as = null;
11869
11868
  }
11870
- function as(e) {
11869
+ function ss(e) {
11871
11870
  return e?.endsWith("/") ? e.slice(0, -1) : e;
11872
11871
  }
11873
- async function os(e = null, t) {
11874
- let n = as(e ?? M.apiBaseUrl);
11872
+ async function cs(e = null, t) {
11873
+ let n = ss(e ?? M.apiBaseUrl);
11875
11874
  if (n) return n;
11876
11875
  if ((t ?? M.apiEnv) !== "AUTO") return M.apiEndpoint(t);
11877
11876
  try {
@@ -11886,20 +11885,20 @@ async function os(e = null, t) {
11886
11885
  return R.warn("Failed to resolve API endpoint using DNS, default is used", e), M.apiEndpoint(t);
11887
11886
  }
11888
11887
  }
11889
- async function ss() {
11890
- return ns || rs || (rs = os(), ns = await rs, rs = null, ns);
11888
+ async function ls() {
11889
+ return is || as || (as = cs(), is = await as, as = null, is);
11891
11890
  }
11892
- async function cs(e, t = {}, n = !1) {
11891
+ async function us(e, t = {}, n = !1) {
11893
11892
  if (!window.Blob || !window.navigator.sendBeacon) return;
11894
- await ss();
11895
- let r = ps(e, t, n), i = new window.Blob([r], { type: "application/x-www-form-urlencoded" });
11896
- window.navigator.sendBeacon(`${ns}/fb.do`, i);
11893
+ await ls();
11894
+ let r = hs(e, t, n), i = new window.Blob([r], { type: "application/x-www-form-urlencoded" });
11895
+ window.navigator.sendBeacon(`${is}/fb.do`, i);
11897
11896
  }
11898
- async function ls(e, t = {}, n = !1, r) {
11899
- return await ss(), us(ps(e, t, n), r);
11897
+ async function ds(e, t = {}, n = !1, r) {
11898
+ return await ls(), fs(hs(e, t, n), r);
11900
11899
  }
11901
- async function us(e, t) {
11902
- let n = `${t ?? ns}/fb.do`, r = new AbortController(), i = new O(x.NETWORK, { callError: {
11900
+ async function fs(e, t) {
11901
+ let n = `${t ?? is}/fb.do`, r = new AbortController(), i = new O(b.NETWORK, { callError: {
11903
11902
  scope: "network",
11904
11903
  source: "api",
11905
11904
  code: "timeout",
@@ -11917,16 +11916,16 @@ async function us(e, t) {
11917
11916
  } catch {
11918
11917
  a = { result: i };
11919
11918
  }
11920
- if (!t.ok && !ds(a)) throw new O(x.API, { callError: {
11919
+ if (!t.ok && !ps(a)) throw new O(b.API, { callError: {
11921
11920
  scope: "server",
11922
11921
  source: "api",
11923
11922
  code: `http-${t.status}`,
11924
11923
  description: "http-error"
11925
11924
  } });
11926
- if (ds(a)) throw a;
11925
+ if (ps(a)) throw a;
11927
11926
  return a;
11928
11927
  } catch (e) {
11929
- throw e instanceof O ? e : r.signal.aborted ? i : ds(e) ? e : new O(x.NETWORK, { callError: {
11928
+ throw e instanceof O ? e : r.signal.aborted ? i : ps(e) ? e : new O(b.NETWORK, { callError: {
11930
11929
  scope: "network",
11931
11930
  source: "api",
11932
11931
  code: "fetch-failed",
@@ -11936,12 +11935,12 @@ async function us(e, t) {
11936
11935
  clearTimeout(a);
11937
11936
  }
11938
11937
  }
11939
- function ds(e) {
11938
+ function ps(e) {
11940
11939
  if (typeof e != "object" || !e) return !1;
11941
11940
  let t = e;
11942
11941
  return typeof t.error_code == "number" && typeof t.error_msg == "string";
11943
11942
  }
11944
- async function fs(e, t) {
11943
+ async function ms(e, t) {
11945
11944
  try {
11946
11945
  let n = await fetch(e, {
11947
11946
  method: "POST",
@@ -11954,8 +11953,8 @@ async function fs(e, t) {
11954
11953
  throw R.warn("Failed to send form data", e), e;
11955
11954
  }
11956
11955
  }
11957
- function ps(e, t = {}, n = !1) {
11958
- t.method = e, t.format = "JSON", t.application_key || (t.application_key = M.apiKey), n || (y.sessionKey ? t.session_key = y.sessionKey : y.accessToken && (t.access_token = y.accessToken));
11956
+ function hs(e, t = {}, n = !1) {
11957
+ t.method = e, t.format = "JSON", t.application_key || (t.application_key = M.apiKey), n || (v.sessionKey ? t.session_key = v.sessionKey : v.accessToken && (t.access_token = v.accessToken));
11959
11958
  for (let [e, n] of Object.entries(t)) typeof n == "object" && (t[e] = JSON.stringify(n));
11960
11959
  let r = "";
11961
11960
  for (let [e, n] of Object.entries(t)) r && (r += "&"), r += `${e}=${encodeURIComponent(n)}`;
@@ -11963,7 +11962,7 @@ function ps(e, t = {}, n = !1) {
11963
11962
  }
11964
11963
  //#endregion
11965
11964
  //#region src/abstract/BaseApi.ts
11966
- var ms = class {
11965
+ var gs = class {
11967
11966
  constructor() {
11968
11967
  h(this, "_abortSignal", void 0);
11969
11968
  }
@@ -12006,7 +12005,7 @@ var ms = class {
12006
12005
  async getInbounds() {
12007
12006
  return [];
12008
12007
  }
12009
- }, hs = class e {
12008
+ }, _s = class e {
12010
12009
  constructor() {
12011
12010
  h(this, "_okIdToExternalId", /* @__PURE__ */ new Map()), h(this, "_externalIdToOkId", /* @__PURE__ */ new Map()), h(this, "_decorativeIdToInitialId", /* @__PURE__ */ new Map()), h(this, "_initialIdToDecorativeId", /* @__PURE__ */ new Map());
12012
12011
  }
@@ -12057,27 +12056,27 @@ var ms = class {
12057
12056
  clear() {
12058
12057
  this._okIdToExternalId.clear(), this._externalIdToOkId.clear(), this._decorativeIdToInitialId.clear(), this._initialIdToDecorativeId.clear();
12059
12058
  }
12060
- }, gs = "anonymLogin:", _s = 700, vs = 3e3;
12061
- function ys(e) {
12059
+ }, vs = "anonymLogin:", ys = 700, bs = 3e3;
12060
+ function xs(e) {
12062
12061
  let t = e.error_code;
12063
12062
  switch (t) {
12064
- case 2: return bs(D.SERVICE_UNAVAILABLE, t, "service-unavailable");
12065
- case 4: return e.error_msg.includes("participants.limit.exceeded") ? bs(D.PARTICIPANT_LIMIT_REACHED, t, "participants-limit-exceeded") : bs(x.API, t, "request-error");
12066
- case 300: return bs(D.NOT_FOUND, t, "not-found");
12067
- case 1101: return bs(D.SERVICE_DISABLED, t, "vchat-service-disabled");
12068
- case 1102: return bs(D.CALLEE_IS_OFFLINE, t, "target-user-unavailable");
12069
- case 1103: return bs(D.NOT_FRIENDS, t, "friendship-required");
12070
- case 1104: return xs(t, "youla-api-error");
12071
- case 1106: return xs(t, "vk-api-error");
12072
- case 1113: return bs(D.CALLER_IS_REJECTED, t, "caller-is-rejected");
12063
+ case 2: return Ss(D.SERVICE_UNAVAILABLE, t, "service-unavailable");
12064
+ case 4: return e.error_msg.includes("participants.limit.exceeded") ? Ss(D.PARTICIPANT_LIMIT_REACHED, t, "participants-limit-exceeded") : Ss(b.API, t, "request-error");
12065
+ case 300: return Ss(D.NOT_FOUND, t, "not-found");
12066
+ case 1101: return Ss(D.SERVICE_DISABLED, t, "vchat-service-disabled");
12067
+ case 1102: return Ss(D.CALLEE_IS_OFFLINE, t, "target-user-unavailable");
12068
+ case 1103: return Ss(D.NOT_FRIENDS, t, "friendship-required");
12069
+ case 1104: return Cs(t, "youla-api-error");
12070
+ case 1106: return Cs(t, "vk-api-error");
12071
+ case 1113: return Ss(D.CALLER_IS_REJECTED, t, "caller-is-rejected");
12073
12072
  case 1114: {
12074
12073
  let n = e.custom_error?.vchat_detailed_api_error?.code, r = n?.startsWith("obsolete_client");
12075
- return bs(r ? D.OBSOLETE_CLIENT : D.VCHAT_DETAILED_ERROR, t, n ?? "detailed-error", r ? n : void 0);
12074
+ return Ss(r ? D.OBSOLETE_CLIENT : D.VCHAT_DETAILED_ERROR, t, n ?? "detailed-error", r ? n : void 0);
12076
12075
  }
12077
- default: return bs(x.API, t, "api-error");
12076
+ default: return Ss(b.API, t, "api-error");
12078
12077
  }
12079
12078
  }
12080
- function bs(e, t, n, r) {
12079
+ function Ss(e, t, n, r) {
12081
12080
  return {
12082
12081
  type: e,
12083
12082
  callError: {
@@ -12089,7 +12088,7 @@ function bs(e, t, n, r) {
12089
12088
  message: r
12090
12089
  };
12091
12090
  }
12092
- function xs(e, t) {
12091
+ function Cs(e, t) {
12093
12092
  return {
12094
12093
  type: D.EXTERNAL_API_ERROR,
12095
12094
  callError: {
@@ -12100,19 +12099,19 @@ function xs(e, t) {
12100
12099
  }
12101
12100
  };
12102
12101
  }
12103
- var Ss = class extends ms {
12102
+ var ws = class extends gs {
12104
12103
  constructor(...e) {
12105
- super(...e), h(this, "_uuid", void 0), h(this, "_idCache", new hs());
12104
+ super(...e), h(this, "_uuid", void 0), h(this, "_idCache", new _s());
12106
12105
  }
12107
12106
  async _callUnsafe(e, t = {}, n = !1) {
12108
12107
  let r = async (i) => {
12109
12108
  try {
12110
- return await ls(e, t, n);
12109
+ return await ds(e, t, n);
12111
12110
  } catch (t) {
12112
12111
  if (!t || typeof t != "object" || !Object.hasOwn(t, "error_msg")) {
12113
12112
  i++;
12114
12113
  let n = t && (typeof t == "object" || typeof t == "function") ? Object.getOwnPropertyNames(t).map((e) => `${e}: ${JSON.stringify(t[e])}`) : [String(t)];
12115
- if (R.debug(`${e} network error, attempt ${i}: ${n.join("\n ")}`), this._abortSignal?.aborted && (R.debug(`${e} aborted`), this._abortSignal.throwIfAborted()), i < M.apiMaxAttempt) return await j.delay(Math.min(i * _s, vs), { signal: this._abortSignal }), r(i);
12114
+ if (R.debug(`${e} network error, attempt ${i}: ${n.join("\n ")}`), this._abortSignal?.aborted && (R.debug(`${e} aborted`), this._abortSignal.throwIfAborted()), i < M.apiMaxAttempt) return await j.delay(Math.min(i * ys, bs), { signal: this._abortSignal }), r(i);
12116
12115
  }
12117
12116
  throw R.warn(e, "error", t), t;
12118
12117
  }
@@ -12129,25 +12128,25 @@ var Ss = class extends ms {
12129
12128
  case 103:
12130
12129
  case 104:
12131
12130
  if (!r) break;
12132
- return this._removeCachedAnonymLogin(), await y.reauthorize(() => this.authorize()), this._call(e, t, n, !1);
12131
+ return this._removeCachedAnonymLogin(), await v.reauthorize(() => this.authorize()), this._call(e, t, n, !1);
12133
12132
  }
12134
12133
  let a = {
12135
12134
  message: i?.error_msg,
12136
12135
  code: i?.error_code
12137
12136
  };
12138
- if (i.custom_error && (a.custom_error = i.custom_error), Cs(i)) {
12139
- let e = ys(i);
12137
+ if (i.custom_error && (a.custom_error = i.custom_error), Ts(i)) {
12138
+ let e = xs(i);
12140
12139
  throw a.callError = e.callError, a.message = e.message ?? a.message, new O(e.type, a);
12141
12140
  }
12142
- throw new O(x.API, a);
12141
+ throw new O(b.API, a);
12143
12142
  }
12144
12143
  }
12145
12144
  userId(e) {
12146
12145
  let { compositeUserId: t } = j.decomposeParticipantId(e), { id: n } = j.decomposeId(t);
12147
- return y.isEmpty() ? Q.fromId(String(n)) : this._idCache.getExternalId(n) || Q.fromId(String(n));
12146
+ return v.isEmpty() ? Q.fromId(String(n)) : this._idCache.getExternalId(n) || Q.fromId(String(n));
12148
12147
  }
12149
12148
  async authorize() {
12150
- if (this._ensureUuid(), !M.apiKey) throw new O(x.API, {
12149
+ if (this._ensureUuid(), !M.apiKey) throw new O(b.API, {
12151
12150
  message: "Required argument apiAppKey not passed",
12152
12151
  callError: {
12153
12152
  scope: "internal",
@@ -12169,7 +12168,7 @@ var Ss = class extends ms {
12169
12168
  return M.authToken && (t.session_data.auth_token = M.authToken, t.session_data.version = 3), this._callUnsafe("auth.anonymLogin", t, !0).then((e) => {
12170
12169
  this._applyAnonymLogin(e), this._setCachedAnonymLogin(e);
12171
12170
  }).catch((e) => {
12172
- throw e instanceof O ? e : (e?.error_code === 401 && (this._removeCachedAnonymLogin(), L.onTokenExpired()), new O(x.AUTH, {
12171
+ throw e instanceof O ? e : (e?.error_code === 401 && (this._removeCachedAnonymLogin(), L.onTokenExpired()), new O(b.AUTH, {
12173
12172
  message: e?.error_msg,
12174
12173
  code: e?.error_code,
12175
12174
  callError: {
@@ -12182,17 +12181,17 @@ var Ss = class extends ms {
12182
12181
  });
12183
12182
  }
12184
12183
  _getAnonymLoginCacheKey() {
12185
- return M.authToken ? `${gs}${M.authToken}` : null;
12184
+ return M.authToken ? `${vs}${M.authToken}` : null;
12186
12185
  }
12187
12186
  _getCachedAnonymLogin() {
12188
12187
  let e = this._getAnonymLoginCacheKey();
12189
12188
  if (!e) return null;
12190
- let t = at.get(e);
12191
- return ws(t) ? t : (t && at.remove(e), null);
12189
+ let t = ot.get(e);
12190
+ return Es(t) ? t : (t && ot.remove(e), null);
12192
12191
  }
12193
12192
  _setCachedAnonymLogin(e) {
12194
12193
  let t = this._getAnonymLoginCacheKey();
12195
- !t || !ws(e) || at.set(t, {
12194
+ !t || !Es(e) || ot.set(t, {
12196
12195
  session_key: e.session_key,
12197
12196
  session_secret_key: e.session_secret_key,
12198
12197
  uid: e.uid
@@ -12200,10 +12199,10 @@ var Ss = class extends ms {
12200
12199
  }
12201
12200
  _removeCachedAnonymLogin() {
12202
12201
  let e = this._getAnonymLoginCacheKey();
12203
- e && at.remove(e);
12202
+ e && ot.remove(e);
12204
12203
  }
12205
12204
  _applyAnonymLogin(e) {
12206
- e.uid && (y.userId = Number(e.uid)), y.sessionKey = e.session_key, y.sessionSecretKey = e.session_secret_key;
12205
+ e.uid && (v.userId = Number(e.uid)), v.sessionKey = e.session_key, v.sessionSecretKey = e.session_secret_key;
12207
12206
  }
12208
12207
  logClientStats(e) {
12209
12208
  let t = {
@@ -12213,7 +12212,7 @@ var Ss = class extends ms {
12213
12212
  version: 1,
12214
12213
  items: e
12215
12214
  };
12216
- M.clientStatsPlatform && (t.platform = M.clientStatsPlatform), cs("vchat.clientStats", { data: JSON.stringify(t) });
12215
+ M.clientStatsPlatform && (t.platform = M.clientStatsPlatform), us("vchat.clientStats", { data: JSON.stringify(t) });
12217
12216
  }
12218
12217
  async uploadDebugLogs(e, t, n, r) {
12219
12218
  let i = {
@@ -12224,7 +12223,7 @@ var Ss = class extends ms {
12224
12223
  }, a = await this._callUnsafe("vchat.getLogUploadUrl", i), o = new FormData(), s = new Blob([r], { type: "application/json" });
12225
12224
  o.append("file", s, "log.json");
12226
12225
  let c = new URL(a.upload_url);
12227
- return c.searchParams.append("size", s.size.toString()), fs(c.toString(), o);
12226
+ return c.searchParams.append("size", s.size.toString()), ms(c.toString(), o);
12228
12227
  }
12229
12228
  async joinConversation(e, t = !1, n) {
12230
12229
  let r = {
@@ -12277,8 +12276,8 @@ var Ss = class extends ms {
12277
12276
  }
12278
12277
  _ensureUuid() {
12279
12278
  if (!this._uuid) {
12280
- let e = at.get("uuid");
12281
- e || (e = j.uuid(), at.set("uuid", e)), this._uuid = String(e);
12279
+ let e = ot.get("uuid");
12280
+ e || (e = j.uuid(), ot.set("uuid", e)), this._uuid = String(e);
12282
12281
  }
12283
12282
  }
12284
12283
  deviceId() {
@@ -12305,7 +12304,7 @@ var Ss = class extends ms {
12305
12304
  let n = { joinLink: e };
12306
12305
  t && (n.anonymName = t);
12307
12306
  let r = await this._call("vchat.getAnonymTokenByLink", n);
12308
- return y.userId = Number(r.uid), r.token;
12307
+ return v.userId = Number(r.uid), r.token;
12309
12308
  }
12310
12309
  async joinConversationByLink(e, t = !1, n, r) {
12311
12310
  let i = {
@@ -12345,17 +12344,17 @@ var Ss = class extends ms {
12345
12344
  return M.anonymToken && (t.anonymToken = M.anonymToken), e && (t.conversationId = e), this._call("vchat.getConversationParams", t);
12346
12345
  }
12347
12346
  getUserId() {
12348
- return y.userId;
12347
+ return v.userId;
12349
12348
  }
12350
12349
  setUserId(e) {
12351
- y.userId = e;
12350
+ v.userId = e;
12352
12351
  }
12353
12352
  hangupConversation(e, t = D.HUNGUP) {
12354
12353
  let n = {
12355
12354
  conversationId: e,
12356
12355
  reason: t
12357
12356
  };
12358
- M.anonymToken && (n.anonymToken = M.anonymToken), cs("vchat.hangupConversation", n);
12357
+ M.anonymToken && (n.anonymToken = M.anonymToken), us("vchat.hangupConversation", n);
12359
12358
  }
12360
12359
  async removeHistoryRecords(e) {
12361
12360
  await this._call("vchat.removeHistoryRecords", { recordIds: e.join(",") });
@@ -12371,19 +12370,19 @@ var Ss = class extends ms {
12371
12370
  return Array.isArray(e?.inbounds) ? e.inbounds : [];
12372
12371
  }
12373
12372
  };
12374
- function Cs(e) {
12373
+ function Ts(e) {
12375
12374
  return typeof e == "object" && !!e && "error_code" in e && "error_msg" in e;
12376
12375
  }
12377
- function ws(e) {
12376
+ function Es(e) {
12378
12377
  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;
12379
12378
  }
12380
12379
  //#endregion
12381
12380
  //#region src/enums/RecordRole.ts
12382
- var Ts = /* @__PURE__ */ function(e) {
12381
+ var Ds = /* @__PURE__ */ function(e) {
12383
12382
  return e.KING = "KING", e.PAWN = "PAWN", e;
12384
- }(Ts || {}), Es = /* @__PURE__ */ function(e) {
12383
+ }(Ds || {}), Os = /* @__PURE__ */ function(e) {
12385
12384
  return e.OFF = "0", e.ON = "1", e;
12386
- }({}), Ds = class {
12385
+ }({}), ks = class {
12387
12386
  constructor(e) {
12388
12387
  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;
12389
12388
  }
@@ -12406,12 +12405,12 @@ var Ts = /* @__PURE__ */ function(e) {
12406
12405
  let e = this._queue[this._readCursor];
12407
12406
  return e && (this._moveReadCursor = !1, this._queue[this._readCursor] = null, this._readCursor = this.nextCursor(this._readCursor), --this._left), e;
12408
12407
  }
12409
- }, Os = class {
12408
+ }, As = class {
12410
12409
  constructor(e, t, n, r = null) {
12411
12410
  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 = j.uuid(), this._apiKey = t, this._callToken = n, this._apiEnv = e, this._baseApiUrl = r;
12412
12411
  }
12413
12412
  async authorize() {
12414
- let e = await ls("auth.anonymLogin", {
12413
+ let e = await ds("auth.anonymLogin", {
12415
12414
  session_data: {
12416
12415
  device_id: this._uuid,
12417
12416
  client_version: M.appVersion,
@@ -12420,18 +12419,18 @@ var Ts = /* @__PURE__ */ function(e) {
12420
12419
  version: 3
12421
12420
  },
12422
12421
  application_key: this._apiKey
12423
- }, !0, await os(this._baseApiUrl, this._apiEnv));
12422
+ }, !0, await cs(this._baseApiUrl, this._apiEnv));
12424
12423
  return j.isObject(e) && !("error_msg" in e) ? (this._sessionKey = e.session_key, !0) : !1;
12425
12424
  }
12426
12425
  async hangupConversation(e) {
12427
- await ls("vchat.hangupConversation", {
12426
+ await ds("vchat.hangupConversation", {
12428
12427
  conversationId: e,
12429
12428
  reason: D.HUNGUP,
12430
12429
  application_key: this._apiKey,
12431
12430
  session_key: this._sessionKey
12432
- }, !0, await os(this._baseApiUrl, this._apiEnv));
12431
+ }, !0, await cs(this._baseApiUrl, this._apiEnv));
12433
12432
  }
12434
- }, ks, As = null, js = {
12433
+ }, js, Ms = null, Ns = {
12435
12434
  getCameras: T.getCameras,
12436
12435
  getMicrophones: T.getMicrophones,
12437
12436
  getOutput: T.getOutput,
@@ -12457,39 +12456,39 @@ var Ts = /* @__PURE__ */ function(e) {
12457
12456
  baseChromeVersion: T.baseChromeVersion,
12458
12457
  getAudioContext: T.getAudioContext,
12459
12458
  isAudioShareSupported: T.isAudioShareSupported
12460
- }, Ms = { participantMarkerCompare: j.participantMarkerCompare };
12461
- function Ns(e) {
12462
- As = e;
12459
+ }, Ps = { participantMarkerCompare: j.participantMarkerCompare };
12460
+ function Fs(e) {
12461
+ Ms = e;
12463
12462
  }
12464
- function Ps(e) {
12463
+ function Is(e) {
12465
12464
  M.videoEffects = e;
12466
12465
  }
12467
- function Fs(e) {
12466
+ function Ls(e) {
12468
12467
  M.audioEffects = e;
12469
12468
  }
12470
- function Is(e, t = null, n = {}, r = 1) {
12469
+ function Rs(e, t = null, n = {}, r = 1) {
12471
12470
  M.vmoji = e, M.vmojiOptions = {
12472
12471
  protocolVersion: r,
12473
12472
  renderingOptions: n
12474
12473
  }, t && e.setSDK(t);
12475
12474
  }
12476
- async function Ls(t) {
12477
- M.set(t), ks || (ks = new Ss()), e.disableLog(!M.debug), R.toggle(M.debug), R.log(`Calls SDK ${M.sdkVersion}`, t), await T.init();
12475
+ async function zs(t) {
12476
+ M.set(t), js || (js = new ws()), e.disableLog(!M.debug), R.toggle(M.debug), R.log(`Calls SDK ${M.sdkVersion}`, t), await T.init();
12478
12477
  let n = T.getBrowserSupportFailure();
12479
- if (n) throw new O(x.UNSUPPORTED, { callError: {
12478
+ if (n) throw new O(b.UNSUPPORTED, { callError: {
12480
12479
  scope: "internal",
12481
12480
  code: "environment",
12482
12481
  description: n
12483
12482
  } });
12484
12483
  R.log("UserAgent:", navigator.userAgent), R.log("Screen resolution:", `${window.screen.width}x${window.screen.height}`), R.log("Permissions:", `Camera: ${T.hasCameraPermission()}, Mic: ${T.hasMicrophonePermission()}`), R.log("Simulcast:", `${t.simulcast} => ${M.simulcast}`);
12485
12484
  }
12486
- async function Rs(e, t = [S.AUDIO], n = "", r = !1, i = !1, a, o, s) {
12485
+ async function Bs(e, t = [x.AUDIO], n = "", r = !1, i = !1, a, o, s) {
12487
12486
  let c = [];
12488
- return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]), zs([], Pa.USER, t, n, r, i, a, c, o, s);
12487
+ return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]), Vs([], Pa.USER, t, n, r, i, a, c, o, s);
12489
12488
  }
12490
- async function zs(e, t = Pa.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
12489
+ async function Vs(e, t = Pa.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
12491
12490
  if (!M.hold && z.callsLength > 0) throw R.error("There is already active call"), new O(D.HAS_ACTIVE_CALL);
12492
- return new $(new Ss(), As).onStart({
12491
+ return new $(new ws(), Ms).onStart({
12493
12492
  opponentIds: e,
12494
12493
  opponentType: t,
12495
12494
  mediaOptions: n,
@@ -12502,40 +12501,40 @@ async function zs(e, t = Pa.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
12502
12501
  conversationId: l
12503
12502
  });
12504
12503
  }
12505
- async function Bs(e, t) {
12506
- return Vs(e, A.USER, void 0, t);
12504
+ async function Hs(e, t) {
12505
+ return Us(e, A.USER, void 0, t);
12507
12506
  }
12508
- async function Vs(e, t = A.USER, n, r, i, a) {
12507
+ async function Us(e, t = A.USER, n, r, i, a) {
12509
12508
  if (e === $.id()) throw Error("Push has already been processed");
12510
- return new $(new Ss(), As).onPush(e, t, n, r, i, a);
12509
+ return new $(new ws(), Ms).onPush(e, t, n, r, i, a);
12511
12510
  }
12512
- async function Hs() {
12513
- return ks.getInbounds();
12511
+ async function Ws() {
12512
+ return js.getInbounds();
12514
12513
  }
12515
- async function Us(e, t) {
12516
- return e && (M.authToken = e), t !== void 0 && M.apiBaseUrl !== t && (M.apiBaseUrl = t, is()), ks.authorize();
12514
+ async function Gs(e, t) {
12515
+ return e && (M.authToken = e), t !== void 0 && M.apiBaseUrl !== t && (M.apiBaseUrl = t, os()), js.authorize();
12517
12516
  }
12518
- async function Ws(e = [S.AUDIO], t) {
12519
- return pl(t).accept(e);
12517
+ async function Ks(e = [x.AUDIO], t) {
12518
+ return hl(t).accept(e);
12520
12519
  }
12521
- async function Gs(e) {
12522
- let t = fl(e);
12520
+ async function qs(e) {
12521
+ let t = ml(e);
12523
12522
  if (t) return t.decline();
12524
12523
  }
12525
- async function Ks(e, t = [S.AUDIO]) {
12526
- return qs(e, t);
12524
+ async function Js(e, t = [x.AUDIO]) {
12525
+ return Ys(e, t);
12527
12526
  }
12528
- async function qs(e, t, n) {
12527
+ async function Ys(e, t, n) {
12529
12528
  if (!M.hold && z.callsLength > 0) throw R.error("There is already active call"), new O(D.HAS_ACTIVE_CALL);
12530
- return new $(new Ss(), As).onJoin({
12529
+ return new $(new ws(), Ms).onJoin({
12531
12530
  conversationId: e,
12532
12531
  mediaOptions: t,
12533
12532
  chatId: n
12534
12533
  });
12535
12534
  }
12536
- async function Js(e, t = [S.AUDIO], n, r, i, a) {
12535
+ async function Xs(e, t = [x.AUDIO], n, r, i, a) {
12537
12536
  if (!M.hold && z.callsLength > 0) throw R.error("There is already active call"), new O(D.HAS_ACTIVE_CALL);
12538
- return n && (M.anonymToken = n), new $(new Ss(), As).onJoin({
12537
+ return n && (M.anonymToken = n), new $(new ws(), Ms).onJoin({
12539
12538
  joinLink: e,
12540
12539
  mediaOptions: t,
12541
12540
  observedIds: r,
@@ -12544,31 +12543,31 @@ async function Js(e, t = [S.AUDIO], n, r, i, a) {
12544
12543
  anonymous: !!M.anonymToken
12545
12544
  });
12546
12545
  }
12547
- async function Ys(e) {
12548
- let t = fl(e);
12546
+ async function Zs(e) {
12547
+ let t = ml(e);
12549
12548
  if (t) return t.hangup();
12550
12549
  $.hangupAfterInit();
12551
12550
  }
12552
- async function Xs(e, t) {
12551
+ async function Qs(e, t) {
12553
12552
  let n = Array.isArray(e) ? e : [e], r = $.current();
12554
12553
  r && await r.addParticipant(n, t);
12555
12554
  }
12556
- async function Zs(e, t) {
12555
+ async function $s(e, t) {
12557
12556
  let n = $.current();
12558
12557
  if (n) {
12559
12558
  let r = e.map((e) => j.composeUserId(e));
12560
12559
  await n.addParticipantLegacy(r, t);
12561
12560
  }
12562
12561
  }
12563
- async function Qs(e, t = !1) {
12562
+ async function ec(e, t = !1) {
12564
12563
  let n = $.current()?.getCachedRawOkIdByExternalId(e) ?? null;
12565
12564
  if (!n) {
12566
12565
  R.warn("removeParticipant: externalId not found in cache", e);
12567
12566
  return;
12568
12567
  }
12569
- return $s(n, t);
12568
+ return tc(n, t);
12570
12569
  }
12571
- async function $s(e, t = !1) {
12570
+ async function tc(e, t = !1) {
12572
12571
  let n = $.current();
12573
12572
  if (n) try {
12574
12573
  await n.removeParticipant(j.composeUserId(e), t);
@@ -12576,13 +12575,13 @@ async function $s(e, t = !1) {
12576
12575
  R.warn(`Failed to remove participant ${e}. Perhaps he is no longer on the call. ${t}`);
12577
12576
  }
12578
12577
  }
12579
- async function ec(e, t) {
12578
+ async function nc(e, t) {
12580
12579
  let n = $.current();
12581
12580
  if (e === "videoinput" && jt.contains(t)) return M.videoFacingMode = t, n ? (T.isMobile() && n.stopVideoTrack(), n.changeDevice(e)) : void 0;
12582
12581
  if (!await T._saveDeviceId(e, t)) throw Error(`Device not found: ${t}`);
12583
12582
  if (n) return n.changeDevice(e);
12584
12583
  }
12585
- async function tc(e, t) {
12584
+ async function rc(e, t) {
12586
12585
  let n = typeof e == "object" ? {
12587
12586
  ...e,
12588
12587
  fastScreenSharing: e.captureScreen && e.fastScreenSharing,
@@ -12591,34 +12590,34 @@ async function tc(e, t) {
12591
12590
  captureScreen: e,
12592
12591
  fastScreenSharing: !1,
12593
12592
  captureAudio: !1
12594
- }, r = fl(t);
12593
+ }, r = ml(t);
12595
12594
  return r ? r.toggleScreenCapturing(n) : Promise.reject();
12596
12595
  }
12597
- function nc(e) {
12596
+ function ic(e) {
12598
12597
  let t = $.current();
12599
12598
  t && t.toggleAnimojiCapturing(e);
12600
12599
  }
12601
- async function rc(e, t = !1) {
12600
+ async function ac(e, t = !1) {
12602
12601
  let n = $.current();
12603
12602
  n && await n.setVideoStream(e, t);
12604
12603
  }
12605
- async function ic(e, t) {
12606
- let n = fl(t);
12604
+ async function oc(e, t) {
12605
+ let n = ml(t);
12607
12606
  n && await n.toggleLocalVideo(e);
12608
12607
  }
12609
- async function ac(e, t) {
12610
- let n = fl(t);
12608
+ async function sc(e, t) {
12609
+ let n = ml(t);
12611
12610
  n && await n.toggleLocalAudio(e);
12612
12611
  }
12613
- async function oc(e) {
12612
+ async function cc(e) {
12614
12613
  let t = $.current();
12615
12614
  if (t) return t.setLocalResolution(e);
12616
12615
  }
12617
- async function sc(e) {
12616
+ async function lc(e) {
12618
12617
  let t = $.current();
12619
12618
  t && await t.changePriorities(e);
12620
12619
  }
12621
- async function cc(e, t) {
12620
+ async function uc(e, t) {
12622
12621
  let n = $.current();
12623
12622
  if (n) {
12624
12623
  let r;
@@ -12633,33 +12632,33 @@ async function cc(e, t) {
12633
12632
  await n.changeParticipantState(e, r);
12634
12633
  }
12635
12634
  }
12636
- async function lc() {
12635
+ async function dc() {
12637
12636
  let e = $.current();
12638
12637
  e && await e.putHandsDown();
12639
12638
  }
12640
- async function uc(e) {
12639
+ async function fc(e) {
12641
12640
  let t = $.current();
12642
12641
  t && await t.updateDisplayLayout(e);
12643
12642
  }
12644
- async function dc(e) {
12643
+ async function pc(e) {
12645
12644
  let t = $.current();
12646
12645
  t && await t.requestDisplayLayout(e);
12647
12646
  }
12648
- async function fc(e, t, n = !1) {
12647
+ async function mc(e, t, n = !1) {
12649
12648
  let r = $.current()?.getCachedRawOkIdByExternalId(e) ?? null;
12650
12649
  if (!r) {
12651
12650
  R.warn("grantRoles: externalId not found in cache", e);
12652
12651
  return;
12653
12652
  }
12654
- return pc(r, Q.getDeviceIdx(e), t, n);
12653
+ return hc(r, Q.getDeviceIdx(e), t, n);
12655
12654
  }
12656
- async function pc(e, t, n, r = !1) {
12655
+ async function hc(e, t, n, r = !1) {
12657
12656
  let i = $.current();
12658
12657
  i && await i.grantRoles(j.composeParticipantId(e, A.USER, t), n, r);
12659
12658
  }
12660
- async function mc({ externalId: e = null, muteStates: t, requestedMedia: n = [], roomId: r = null }) {
12659
+ async function gc({ externalId: e = null, muteStates: t, requestedMedia: n = [], roomId: r = null }) {
12661
12660
  let i = null;
12662
- return e && (i = $.current()?.getCachedRawOkIdByExternalId(e) ?? null, i || R.warn("muteParticipant: externalId not found in cache", e)), hc({
12661
+ return e && (i = $.current()?.getCachedRawOkIdByExternalId(e) ?? null, i || R.warn("muteParticipant: externalId not found in cache", e)), _c({
12663
12662
  uid: i,
12664
12663
  muteStates: t,
12665
12664
  requestedMedia: n,
@@ -12667,129 +12666,129 @@ async function mc({ externalId: e = null, muteStates: t, requestedMedia: n = [],
12667
12666
  roomId: r
12668
12667
  });
12669
12668
  }
12670
- async function hc({ uid: e = null, muteStates: t, requestedMedia: n = [], deviceIdx: r = 0, roomId: i = null }) {
12669
+ async function _c({ uid: e = null, muteStates: t, requestedMedia: n = [], deviceIdx: r = 0, roomId: i = null }) {
12671
12670
  let a = $.current();
12672
12671
  if (a) {
12673
12672
  let o = e ? j.composeParticipantId(e, A.USER, r) : null;
12674
12673
  await a.muteParticipant(o, t, n, i);
12675
12674
  }
12676
12675
  }
12677
- async function gc(e, t = !1, n = null) {
12676
+ async function vc(e, t = !1, n = null) {
12678
12677
  let r = $.current()?.getCachedRawOkIdByExternalId(e) ?? null;
12679
12678
  if (!r) {
12680
12679
  R.warn("pinParticipant: externalId not found in cache", e);
12681
12680
  return;
12682
12681
  }
12683
- return _c(r, t, Q.getDeviceIdx(e), n);
12682
+ return yc(r, t, Q.getDeviceIdx(e), n);
12684
12683
  }
12685
- async function _c(e, t = !1, n = 0, r = null) {
12684
+ async function yc(e, t = !1, n = 0, r = null) {
12686
12685
  let i = $.current();
12687
12686
  i && await i.pinParticipant(j.composeParticipantId(e, A.USER, n), t, r);
12688
12687
  }
12689
- async function vc(e) {
12688
+ async function bc(e) {
12690
12689
  let t = $.current();
12691
12690
  t && await t.updateMediaModifiers(e);
12692
12691
  }
12693
- async function yc(e) {
12692
+ async function xc(e) {
12694
12693
  let t = $.current();
12695
12694
  t && await t.enableVideoSuspend(e);
12696
12695
  }
12697
- async function bc(e) {
12696
+ async function Sc(e) {
12698
12697
  let t = $.current();
12699
12698
  t && await t.enableVideoSuspendSuggest(e);
12700
12699
  }
12701
- async function xc(e) {
12700
+ async function Cc(e) {
12702
12701
  let t = $.current();
12703
12702
  t && await t.changeOptions(e);
12704
12703
  }
12705
- async function Sc(e, t = null) {
12704
+ async function wc(e, t = null) {
12706
12705
  let n = null;
12707
- return t && (n = $.current()?.getCachedRawOkIdByExternalId(t) ?? null, n || R.warn("chatMessage: externalId not found in cache", t)), Cc(e, n);
12706
+ return t && (n = $.current()?.getCachedRawOkIdByExternalId(t) ?? null, n || R.warn("chatMessage: externalId not found in cache", t)), Tc(e, n);
12708
12707
  }
12709
- async function Cc(e, t = null) {
12708
+ async function Tc(e, t = null) {
12710
12709
  let n = $.current();
12711
12710
  if (n) {
12712
12711
  let r = t ? j.composeUserId(t) : null;
12713
12712
  await n.chatMessage(e, r);
12714
12713
  }
12715
12714
  }
12716
- async function wc(e = 10) {
12715
+ async function Ec(e = 10) {
12717
12716
  let t = $.current();
12718
12717
  if (t) return t.chatHistory(e);
12719
12718
  }
12720
- async function Tc(e, t = null) {
12719
+ async function Dc(e, t = null) {
12721
12720
  let n = null;
12722
- return t && (n = $.current()?.getCachedRawOkIdByExternalId(t) ?? null, n || R.warn("customData: externalId not found in cache", t)), Ec(e, n, Q.getDeviceIdx(t));
12721
+ return t && (n = $.current()?.getCachedRawOkIdByExternalId(t) ?? null, n || R.warn("customData: externalId not found in cache", t)), Oc(e, n, Q.getDeviceIdx(t));
12723
12722
  }
12724
- async function Ec(e, t = null, n = 0) {
12723
+ async function Oc(e, t = null, n = 0) {
12725
12724
  let r = $.current();
12726
12725
  if (r) {
12727
12726
  let i = t ? j.composeParticipantId(t, A.USER, n) : null;
12728
12727
  await r.customData(e, i);
12729
12728
  }
12730
12729
  }
12731
- async function Dc(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, waitForAdmin: r = !1, closedConversation: i = !1 } = {}, a) {
12732
- return (await ks.createConversation(a ?? j.uuid(), e, t, {
12730
+ async function kc(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, waitForAdmin: r = !1, closedConversation: i = !1 } = {}, a) {
12731
+ return (await js.createConversation(a ?? j.uuid(), e, t, {
12733
12732
  onlyAdminCanShareMovie: n,
12734
12733
  waitForAdmin: r,
12735
12734
  closedConversation: i
12736
12735
  })).join_link;
12737
12736
  }
12738
- async function Oc(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, audioOnly: r = !1 } = {}, i) {
12737
+ async function Ac(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, audioOnly: r = !1 } = {}, i) {
12739
12738
  let a = i.map((e) => Q.fromId(e));
12740
- return (await ks.createConversation(j.uuid(), e, t, {
12739
+ return (await js.createConversation(j.uuid(), e, t, {
12741
12740
  onlyAdminCanShareMovie: n,
12742
12741
  audienceMode: !0,
12743
12742
  audioOnly: r
12744
12743
  }, a)).join_link;
12745
12744
  }
12746
- async function kc() {
12745
+ async function jc() {
12747
12746
  let e = $.current();
12748
12747
  return e ? e.createJoinLink() : Promise.reject();
12749
12748
  }
12750
- async function Ac() {
12749
+ async function Mc() {
12751
12750
  let e = $.current();
12752
12751
  return e ? e.removeJoinLink() : Promise.reject();
12753
12752
  }
12754
- async function jc(e, t) {
12755
- return ks.getAnonymTokenByLink(e, t);
12753
+ async function Nc(e, t) {
12754
+ return js.getAnonymTokenByLink(e, t);
12756
12755
  }
12757
- function Mc(e) {
12756
+ function Pc(e) {
12758
12757
  let t = $.current();
12759
12758
  t && t.setVolume(e);
12760
12759
  }
12761
- function Nc(e) {
12760
+ function Fc(e) {
12762
12761
  M.forceRelayPolicy = e;
12763
12762
  }
12764
- async function Pc(e = !1, t = null, n = null, r = "DIRECT_LINK", i = null, a = null) {
12763
+ async function Ic(e = !1, t = null, n = null, r = "DIRECT_LINK", i = null, a = null) {
12765
12764
  let o = $.current();
12766
12765
  return o ? o.startStream(e, t, n, r, i, a) : Promise.reject();
12767
12766
  }
12768
- async function Fc(e = null, t) {
12767
+ async function Lc(e = null, t) {
12769
12768
  let n = $.current();
12770
12769
  return n ? n.stopStream(e, t) : Promise.reject();
12771
12770
  }
12772
- async function Ic(e = null) {
12771
+ async function Rc(e = null) {
12773
12772
  let t = $.current();
12774
12773
  return t ? t.publishStream(e) : Promise.reject();
12775
12774
  }
12776
- async function Lc() {
12775
+ async function zc() {
12777
12776
  let e = $.current();
12778
12777
  return e ? e.getStreamInfo() : Promise.reject();
12779
12778
  }
12780
- async function Rc(e) {
12779
+ async function Bc(e) {
12781
12780
  let t = $.current();
12782
12781
  return t ? t.addMovie(e) : Promise.reject();
12783
12782
  }
12784
- async function zc(e) {
12783
+ async function Vc(e) {
12785
12784
  let t = $.current();
12786
12785
  return t ? t.updateMovie(e) : Promise.reject();
12787
12786
  }
12788
- async function Bc(e) {
12787
+ async function Hc(e) {
12789
12788
  let t = $.current();
12790
12789
  return t ? t.removeMovie(e) : Promise.reject();
12791
12790
  }
12792
- async function Vc(e, t) {
12791
+ async function Uc(e, t) {
12793
12792
  let n = $.current();
12794
12793
  if (n) {
12795
12794
  let r = [];
@@ -12814,11 +12813,11 @@ async function Vc(e, t) {
12814
12813
  }
12815
12814
  return Promise.reject();
12816
12815
  }
12817
- async function Hc(e, t) {
12816
+ async function Wc(e, t) {
12818
12817
  let n = $.current();
12819
12818
  return n ? n.activateRooms(e, t) : Promise.reject();
12820
12819
  }
12821
- async function Uc(e = null, t = null) {
12820
+ async function Gc(e = null, t = null) {
12822
12821
  let n = $.current();
12823
12822
  if (!n) return Promise.reject();
12824
12823
  let r;
@@ -12833,33 +12832,33 @@ async function Uc(e = null, t = null) {
12833
12832
  }
12834
12833
  return n.switchRoom(e, r);
12835
12834
  }
12836
- async function Wc(e) {
12835
+ async function Kc(e) {
12837
12836
  let t = $.current();
12838
12837
  return t ? t.removeRooms(e) : Promise.reject();
12839
12838
  }
12840
- function Gc(e) {
12839
+ function qc(e) {
12841
12840
  M.statisticsInterval = e;
12842
12841
  let t = $.current();
12843
12842
  if (t) return t.updateStatisticsInterval();
12844
12843
  }
12845
- function Kc(t) {
12844
+ function Jc(t) {
12846
12845
  e.disableLog(!t), R.toggle(t);
12847
12846
  }
12848
- function qc(e, ...t) {
12847
+ function Yc(e, ...t) {
12849
12848
  M.debugLog && ($.debugMessage(e, "[external]", ...t) || R.send(e, "[external]", ...t));
12850
12849
  }
12851
- function Jc(e, t, ...n) {
12850
+ function Xc(e, t, ...n) {
12852
12851
  M.debugLog && ($.debugMessageWithContext(e, t, "[external]", ...n) || R.send(e, "[external]", ...n));
12853
12852
  }
12854
- var Yc = {
12855
- list: Ne,
12856
- get: Pe,
12857
- getJson: Fe,
12858
- download: Ie,
12859
- clear: Le,
12860
- stats: Re
12853
+ var Zc = {
12854
+ list: Pe,
12855
+ get: Fe,
12856
+ getJson: Ie,
12857
+ download: Le,
12858
+ clear: Re,
12859
+ stats: ze
12861
12860
  };
12862
- function Xc() {
12861
+ function Qc() {
12863
12862
  let e = [
12864
12863
  [`Calls SDK ${M.sdkVersion}`, M.toJSON()],
12865
12864
  ["UserAgent:", navigator.userAgent],
@@ -12876,31 +12875,31 @@ function Xc() {
12876
12875
  d: e
12877
12876
  }));
12878
12877
  }
12879
- async function Zc() {
12878
+ async function $c() {
12880
12879
  let e = $.id(), t = $.debugSessionId();
12881
12880
  if (!t || !e) throw R.error("[uploadDebugLogs]", "No conversation id found"), Error("No conversation id found");
12882
- let n = await Pe({ sessionId: t });
12881
+ let n = await Fe({ sessionId: t });
12883
12882
  if (n.length === 0) throw R.error("[uploadDebugLogs]", "No logs found"), Error("No logs found");
12884
12883
  let r = n[0].t, i = n[n.length - 1].t;
12885
12884
  try {
12886
- return ks?.uploadDebugLogs(e, r, i, JSON.stringify([...Xc(), ...n]));
12885
+ return js?.uploadDebugLogs(e, r, i, JSON.stringify([...Qc(), ...n]));
12887
12886
  } catch (e) {
12888
12887
  throw R.error("[uploadDebugLogs]", "Error while uploading logs", e), Error("Error while uploading logs", { cause: e });
12889
12888
  }
12890
12889
  }
12891
- async function Qc(e) {
12890
+ async function el(e) {
12892
12891
  let t = $.current();
12893
12892
  if (t) return t.videoEffect(e);
12894
12893
  }
12895
- async function $c(e, t) {
12894
+ async function tl(e, t) {
12896
12895
  let n = $.current();
12897
12896
  if (n) return n.audioEffect(e.length > 0 ? e : null, t);
12898
12897
  }
12899
- async function el(e) {
12898
+ async function nl(e) {
12900
12899
  let t = $.current();
12901
12900
  t && await t.setAudioStream(e);
12902
12901
  }
12903
- async function tl(e, t = null, n = null) {
12902
+ async function rl(e, t = null, n = null) {
12904
12903
  let r = $.current();
12905
12904
  if (!r) return;
12906
12905
  let i = n ?? t?.id, a = null;
@@ -12911,18 +12910,18 @@ async function tl(e, t = null, n = null) {
12911
12910
  }
12912
12911
  r.setAnimojiSvg(e, a, i);
12913
12912
  }
12914
- function nl(e) {
12913
+ function il(e) {
12915
12914
  let t = $.current();
12916
12915
  t && t.setAnimojiFill(e);
12917
12916
  }
12918
- async function rl(e = null, t, n = !1) {
12919
- return pl().getWaitingHall(e, t, n);
12917
+ async function al(e = null, t, n = !1) {
12918
+ return hl().getWaitingHall(e, t, n);
12920
12919
  }
12921
- async function il() {
12922
- return pl().getAudienceModeHands();
12920
+ async function ol() {
12921
+ return hl().getAudienceModeHands();
12923
12922
  }
12924
- async function al(e, t = !1) {
12925
- let n = pl(), r;
12923
+ async function sl(e, t = !1) {
12924
+ let n = hl(), r;
12926
12925
  if (e) {
12927
12926
  let t = n.getCachedRawOkIdByExternalId(e);
12928
12927
  if (!t) {
@@ -12933,67 +12932,67 @@ async function al(e, t = !1) {
12933
12932
  }
12934
12933
  return n.promoteParticipant(r, t);
12935
12934
  }
12936
- async function ol(e = !1) {
12937
- return pl().requestPromotion(e);
12935
+ async function cl(e = !1) {
12936
+ return hl().requestPromotion(e);
12938
12937
  }
12939
- async function sl(e = !1) {
12940
- return pl().acceptPromotion(e);
12938
+ async function ll(e = !1) {
12939
+ return hl().acceptPromotion(e);
12941
12940
  }
12942
- async function cl(e) {
12943
- return pl().getParticipantListChunk(e);
12941
+ async function ul(e) {
12942
+ return hl().getParticipantListChunk(e);
12944
12943
  }
12945
- async function ll(e) {
12946
- return pl().getParticipants(e);
12944
+ async function dl(e) {
12945
+ return hl().getParticipants(e);
12947
12946
  }
12948
- async function ul(e) {
12949
- return pl().feedback(e);
12947
+ async function fl(e) {
12948
+ return hl().feedback(e);
12950
12949
  }
12951
- async function dl(e, t, n) {
12952
- return pl(n).enableFeatureForRoles(e, t);
12950
+ async function pl(e, t, n) {
12951
+ return hl(n).enableFeatureForRoles(e, t);
12953
12952
  }
12954
- function fl(e) {
12953
+ function ml(e) {
12955
12954
  return e ? z.get(e) ?? null : $.current() ?? z.getFirst();
12956
12955
  }
12957
- function pl(e) {
12958
- let t = fl(e);
12956
+ function hl(e) {
12957
+ let t = ml(e);
12959
12958
  if (!t) throw Error("Conversation not found");
12960
12959
  return t;
12961
12960
  }
12962
- async function ml(e) {
12963
- await ks.removeHistoryRecords(e);
12961
+ async function gl(e) {
12962
+ await js.removeHistoryRecords(e);
12964
12963
  }
12965
- async function hl(e) {
12964
+ async function _l(e) {
12966
12965
  let t = $.current() ?? z.getFirst();
12967
12966
  t && await t.startAsr(e);
12968
12967
  }
12969
- async function gl(e) {
12968
+ async function vl(e) {
12970
12969
  let t = $.current() ?? z.getFirst();
12971
12970
  t && await t.stopAsr(e);
12972
12971
  }
12973
- async function _l(e) {
12972
+ async function yl(e) {
12974
12973
  let t = $.current() ?? z.getFirst();
12975
12974
  t && await t.requestAsr(e);
12976
12975
  }
12977
- async function vl(e) {
12976
+ async function bl(e) {
12978
12977
  let t = $.current();
12979
12978
  return t ? t.startUrlSharing(e) : Promise.reject();
12980
12979
  }
12981
- async function yl() {
12980
+ async function xl() {
12982
12981
  let e = $.current();
12983
12982
  return e ? e.stopUrlSharing() : Promise.reject();
12984
12983
  }
12985
- async function bl(e) {
12984
+ async function Sl(e) {
12986
12985
  await z.switchCall(e);
12987
12986
  }
12988
- function xl() {
12987
+ function Cl() {
12989
12988
  return z.getActiveId();
12990
12989
  }
12991
- function Sl() {
12990
+ function wl() {
12992
12991
  return $.getSyncedTime();
12993
12992
  }
12994
- function Cl() {
12993
+ function Tl() {
12995
12994
  return M.sdkVersion;
12996
12995
  }
12997
12996
  typeof window < "u" && (window.__CALLS_SDK = hn);
12998
12997
  //#endregion
12999
- export { Ss as Api, Os as ApiExternal, Ds as ArrayDequeue, y as AuthData, f as BaseLogger, Na as CallDirection, Pa as CallType, Fa as ChatRoomEventType, Ia as ConversationFeature, La as ConversationOption, vn as DebugMessageType, Ja as ExternalIdType, jt as FacingMode, x as FatalError, O as HangupReason, D as HangupType, S as MediaOption, k as MediaTrackKind, V as MediaType, Ba as MuteState, Z as ParticipantState, Es as ParticipantStateDataValue, N as ParticipantStatus, Ts as RecordRole, Va as RoomsEventType, Ma as Signaling, B as SignalingCommandType, fr as SignalingConnectionType, K as SignalingNotification, J as TransportTopology, Wa as UserRole, A as UserType, ho as VolumeDetector, Ws as acceptCall, sl as acceptPromotion, Hc as activateRooms, Rc as addMovie, Xs as addParticipant, Zs as addParticipantInternal, Us as authorize, js as browser, zs as callInternal, Rs as callTo, tc as captureScreen, nc as captureVmoji, $c as changeAudioEffect, xc as changeConversationOptions, ec as changeDevice, cc as changeParticipantState, sc as changePriorities, Qc as changeVideoEffect, wc as chatHistory, Sc as chatMessage, Cc as chatMessageInternal, kc as createJoinLink, Tc as customData, Ec as customDataInternal, Kc as debug, Yc as debugLogs, qc as debugMessage, Jc as debugMessageWithContext, Gs as declineCall, dl as enableFeatureForRoles, yc as enableVideoSuspend, bc as enableVideoSuspendSuggest, ul as feedback, Nc as forceRelayPolicy, xl as getActiveCallId, jc as getAnonymTokenByLink, il as getAudienceModeHands, Hs as getInbounds, cl as getParticipantListChunk, ll as getParticipants, Lc as getStreamInfo, Sl as getSyncedTime, rl as getWaitingHall, fc as grantRoles, pc as grantRolesInternal, Ys as hangup, Ls as init, Ks as joinCall, Js as joinCallByLink, qs as joinCallInternal, mc as muteParticipant, hc as muteParticipantInternal, gc as pinParticipant, _c as pinParticipantInternal, Bs as processPush, Vs as processPushInternal, al as promoteParticipant, Ic as publishStream, lc as putHandsDown, ml as removeHistoryRecords, Ac as removeJoinLink, Bc as removeMovie, Qs as removeParticipant, $s as removeParticipantInternal, Wc as removeRooms, _l as requestAsr, dc as requestDisplayLayout, ol as requestPromotion, Fs as setAudioEffects, el as setAudioStream, oc as setLocalResolution, Ns as setLogger, vc as setMediaModifiers, Gc as setStatisticsInterval, Ps as setVideoEffects, rc as setVideoStream, Is as setVmoji, nl as setVmojiFill, tl as setVmojiSvg, Mc as setVolume, hl as startAsr, Oc as startAudienceConversation, Dc as startConversation, Pc as startStream, vl as startUrlSharing, gl as stopAsr, Fc as stopStream, yl as stopUrlSharing, bl as switchCall, Uc as switchRoom, ac as toggleLocalAudio, ic as toggleLocalVideo, uc as updateDisplayLayout, zc as updateMovie, Vc as updateRooms, Zc as uploadDebugLogs, Ms as utils, Cl as version };
12998
+ export { ws as Api, As as ApiExternal, ks as ArrayDequeue, v as AuthData, f as BaseLogger, Na as CallDirection, Pa as CallType, Fa as ChatRoomEventType, Ia as ConversationFeature, La as ConversationOption, vn as DebugMessageType, Ja as ExternalIdType, jt as FacingMode, b as FatalError, O as HangupReason, D as HangupType, x as MediaOption, k as MediaTrackKind, V as MediaType, Ba as MuteState, Z as ParticipantState, Os as ParticipantStateDataValue, N as ParticipantStatus, Ds as RecordRole, Va as RoomsEventType, Ma as Signaling, B as SignalingCommandType, fr as SignalingConnectionType, K as SignalingNotification, J as TransportTopology, Wa as UserRole, A as UserType, _o as VolumeDetector, Ks as acceptCall, ll as acceptPromotion, Wc as activateRooms, Bc as addMovie, Qs as addParticipant, $s as addParticipantInternal, Gs as authorize, Ns as browser, Vs as callInternal, Bs as callTo, rc as captureScreen, ic as captureVmoji, tl as changeAudioEffect, Cc as changeConversationOptions, nc as changeDevice, uc as changeParticipantState, lc as changePriorities, el as changeVideoEffect, Ec as chatHistory, wc as chatMessage, Tc as chatMessageInternal, jc as createJoinLink, Dc as customData, Oc as customDataInternal, Jc as debug, Zc as debugLogs, Yc as debugMessage, Xc as debugMessageWithContext, qs as declineCall, pl as enableFeatureForRoles, xc as enableVideoSuspend, Sc as enableVideoSuspendSuggest, fl as feedback, Fc as forceRelayPolicy, Cl as getActiveCallId, Nc as getAnonymTokenByLink, ol as getAudienceModeHands, Ws as getInbounds, ul as getParticipantListChunk, dl as getParticipants, zc as getStreamInfo, wl as getSyncedTime, al as getWaitingHall, mc as grantRoles, hc as grantRolesInternal, Zs as hangup, zs as init, Js as joinCall, Xs as joinCallByLink, Ys as joinCallInternal, gc as muteParticipant, _c as muteParticipantInternal, vc as pinParticipant, yc as pinParticipantInternal, Hs as processPush, Us as processPushInternal, sl as promoteParticipant, Rc as publishStream, dc as putHandsDown, gl as removeHistoryRecords, Mc as removeJoinLink, Hc as removeMovie, ec as removeParticipant, tc as removeParticipantInternal, Kc as removeRooms, yl as requestAsr, pc as requestDisplayLayout, cl as requestPromotion, Ls as setAudioEffects, nl as setAudioStream, cc as setLocalResolution, Fs as setLogger, bc as setMediaModifiers, qc as setStatisticsInterval, Is as setVideoEffects, ac as setVideoStream, Rs as setVmoji, il as setVmojiFill, rl as setVmojiSvg, Pc as setVolume, _l as startAsr, Ac as startAudienceConversation, kc as startConversation, Ic as startStream, bl as startUrlSharing, vl as stopAsr, Lc as stopStream, xl as stopUrlSharing, Sl as switchCall, Gc as switchRoom, sc as toggleLocalAudio, oc as toggleLocalVideo, fc as updateDisplayLayout, Vc as updateMovie, Uc as updateRooms, $c as uploadDebugLogs, Ps as utils, Tl as version };