@vkontakte/calls-sdk 2.8.11-dev.a7bd7233.0 → 2.8.11-dev.a9627477.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/calls-sdk.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @vkontakte/calls-sdk v2.8.11-dev.a7bd7233.0
3
- * Wed, 10 Jun 2026 07:58:42 GMT
2
+ * @vkontakte/calls-sdk v2.8.11-dev.a9627477.0
3
+ * Tue, 30 Jun 2026 09:39:25 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", se = "chunks", ce = 120 * 1e3, le = new Set(["WARN", "ERROR"]);
59
- function ue() {
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
60
  return `${Date.now()}_${Math.random().toString(36).slice(2)}`;
61
61
  }
62
- function de() {
63
- let e = ue();
64
- return fe(e), e;
62
+ function ue() {
63
+ let e = le();
64
+ return de(e), e;
65
+ }
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);
65
68
  }
66
69
  function fe(e) {
67
- Ue.has(e) || Ue.set(e, []), We.has(e) || We.set(e, 0), Ge.has(e) || Ge.set(e, null);
70
+ return We.get(e) ?? null;
68
71
  }
69
72
  function pe(e) {
70
- return Ge.get(e) ?? null;
73
+ let t = Ue.get(e) ?? 0;
74
+ return Ue.set(e, t + 1), t;
71
75
  }
72
- function me(e) {
73
- let t = We.get(e) ?? 0;
74
- return We.set(e, t + 1), t;
75
- }
76
- function he(e, t) {
76
+ function me(e, t) {
77
77
  return `${e}:${String(t).padStart(12, "0")}`;
78
78
  }
79
- function ge(e) {
79
+ function he(e) {
80
80
  return new Blob([e]).size;
81
81
  }
82
- function _e() {
82
+ function ge() {
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 _e() {
87
87
  console.error("Storage is blocked", e);
88
88
  }
89
89
  }
90
- var _ = new class {
90
+ var v = 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 _ = new class {
140
140
  async getChunksBySession(e) {
141
141
  let t = await this.open();
142
142
  if (!t) return [];
143
- let n = t.transaction(se, "readonly"), r = await this.requestToPromise(n.objectStore(se).index("sessionId").getAll(e));
143
+ let n = t.transaction(_, "readonly"), r = await this.requestToPromise(n.objectStore(_).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 _ = 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, se], "readwrite");
156
- return r.objectStore(g).put(e), r.objectStore(se).put(t), await this.txDone(r), !0;
155
+ let r = n.transaction([g, _], "readwrite");
156
+ return r.objectStore(g).put(e), r.objectStore(_).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 _ = 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, se], "readwrite"), i = r.objectStore(se), a = 0;
169
+ let n = await this.getChunksBySession(e), r = t.transaction([g, _], "readwrite"), i = r.objectStore(_), 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(se, "readwrite"), r = n.objectStore(se);
176
+ let n = t.transaction(_, "readwrite"), r = n.objectStore(_);
177
177
  for (let t of e) r.delete(t.id);
178
178
  await this.txDone(n);
179
179
  }
@@ -207,7 +207,7 @@ var _ = 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(se) || e.createObjectStore(se, { keyPath: "id" }).createIndex("sessionId", "sessionId", { unique: !1 });
210
+ e.objectStoreNames.contains(_) || e.createObjectStore(_, { 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 _ = new class {
278
278
  return i;
279
279
  }
280
280
  }();
281
- async function ve(e) {
282
- return e.sessionId ? _.getSessionBySessionId(e.sessionId) : e.conversationId ? _.getSessionsByConversationId(e.conversationId) : [];
281
+ async function _e(e) {
282
+ return e.sessionId ? v.getSessionBySessionId(e.sessionId) : e.conversationId ? v.getSessionsByConversationId(e.conversationId) : [];
283
283
  }
284
- async function ye(e, t, n, r) {
284
+ async function ve(e, t, n, r) {
285
285
  if (!r.length) return;
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);
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);
288
288
  if (s > te) return;
289
- let c = a[0].t, l = a[a.length - 1].t, [u] = await _.getSessionBySessionId(e), d = u || {
289
+ let c = a[0].t, l = a[a.length - 1].t, [u] = await v.getSessionBySessionId(e), d = u || {
290
290
  sessionId: e,
291
291
  conversationId: i,
292
292
  startTime: c,
@@ -303,7 +303,7 @@ async function ye(e, t, n, r) {
303
303
  bytes: d.bytes + s,
304
304
  entriesCount: d.entriesCount + a.length
305
305
  }, p = {
306
- id: he(e, n),
306
+ id: me(e, n),
307
307
  sessionId: e,
308
308
  sequence: n,
309
309
  startTime: c,
@@ -311,9 +311,9 @@ async function ye(e, t, n, r) {
311
311
  bytes: s,
312
312
  items: a
313
313
  };
314
- await _.putSessionAndChunk(f, p) && await _.enforceRetentionPolicy();
314
+ await v.putSessionAndChunk(f, p) && await v.enforceRetentionPolicy();
315
315
  }
316
- function be(e) {
316
+ function ye(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 be(e) {
328
328
  return e.map((e) => String(e));
329
329
  }
330
330
  }
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) => {
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) => {
336
336
  console.warn("Failed to write debug log to storage", e);
337
- }), Je;
337
+ }), qe;
338
338
  }
339
- function Se(e) {
340
- if (e) return xe(e);
341
- for (let e of Ue.keys()) xe(e);
342
- return Je;
339
+ function xe(e) {
340
+ if (e) return be(e);
341
+ for (let e of He.keys()) be(e);
342
+ return qe;
343
343
  }
344
- async function Ce(e) {
344
+ async function Se(e) {
345
345
  let t = [];
346
346
  for (let n of e.sort((e, t) => e.startTime - t.startTime)) {
347
- let e = await _.getChunksBySession(n.sessionId);
347
+ let e = await v.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 we(e) {
353
- let t = await Ce(e);
352
+ async function Ce(e) {
353
+ let t = await Se(e);
354
354
  if (!t.length) return t;
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);
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);
357
357
  }
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 = [];
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 = [];
360
360
  for (let n of r) {
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)));
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)));
363
363
  }
364
364
  return i;
365
365
  }
366
- function Ee(e, t) {
366
+ function Te(e, t) {
367
367
  return e.t - t.t;
368
368
  }
369
- function De(e, t) {
369
+ function Ee(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 Oe() {
374
- Se();
373
+ function De() {
374
+ xe();
375
375
  }
376
- function ke() {
377
- document.visibilityState === "hidden" && Se();
376
+ function Oe() {
377
+ document.visibilityState === "hidden" && xe();
378
378
  }
379
- function Ae(e, t, n = Ke) {
380
- He || je(), fe(n);
379
+ function ke(e, t, n = Ge) {
380
+ Ve || Ae(), de(n);
381
381
  let r = /* @__PURE__ */ new Date(), i = {
382
382
  t: r.getTime(),
383
383
  l: e,
384
- d: be(t),
384
+ d: ye(t),
385
385
  h: r.toLocaleString("ru-RU", {
386
386
  dateStyle: "short",
387
387
  timeStyle: "long"
388
388
  })
389
389
  };
390
- return Ue.get(n)?.push(i), qe || (qe = window.setTimeout(() => {
391
- qe = null, Se();
390
+ return He.get(n)?.push(i), Ke || (Ke = window.setTimeout(() => {
391
+ Ke = null, xe();
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
+ }
394
397
  function je() {
395
- He || (He = !0, _e(), _.open(), window.addEventListener("pagehide", Oe), document.addEventListener("visibilitychange", ke));
398
+ return Ve || Ae(), xe(), ue();
396
399
  }
397
- function Me() {
398
- return He || je(), Se(), de();
400
+ function Me(e, t = Ge) {
401
+ t && (de(t), We.set(t, e), e && v.updateSessionConversationId(t, e));
399
402
  }
400
- function Ne(e, t = Ke) {
401
- t && (fe(t), Ge.set(t, e), e && _.updateSessionConversationId(t, e));
403
+ async function Ne() {
404
+ return await xe(), (await v.getAllSessions()).sort((e, t) => t.updatedAt - e.updatedAt);
402
405
  }
403
- async function Pe() {
404
- return await Se(), (await _.getAllSessions()).sort((e, t) => t.updatedAt - e.updatedAt);
406
+ async function Pe(e) {
407
+ return await xe(), Ce(await _e(e));
405
408
  }
406
409
  async function Fe(e) {
407
- return await Se(), we(await ve(e));
410
+ return JSON.stringify(await Pe(e));
408
411
  }
409
412
  async function Ie(e) {
410
- return JSON.stringify(await Fe(e));
413
+ let t = await Fe(e), n = `logs_${e.sessionId || e.conversationId}_${Date.now()}.json`;
414
+ return Ee(t, n), n;
411
415
  }
412
416
  async function Le(e) {
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);
417
+ await xe();
418
+ let t = e ? await _e(e) : await v.getAllSessions();
419
+ for (let e of t) await v.deleteSession(e.sessionId);
420
420
  }
421
- async function ze() {
422
- await Se();
423
- let e = await _.getStorageSummary(), t = await _.estimateStorage();
421
+ async function Re() {
422
+ await xe();
423
+ let e = await v.getStorageSummary(), t = await v.estimateStorage();
424
424
  return {
425
- supported: _.supported,
425
+ supported: v.supported,
426
426
  callsCount: e.callsCount,
427
427
  sessionsCount: e.sessions.length,
428
428
  usedBytes: e.usedBytes,
@@ -432,20 +432,20 @@ async function ze() {
432
432
  usageBytes: t?.usage
433
433
  };
434
434
  }
435
- async function Be() {
436
- await Se();
437
- let e = await Ce(await _.getAllSessions());
438
- return JSON.stringify(e.sort(Ee));
435
+ async function ze() {
436
+ await xe();
437
+ let e = await Se(await v.getAllSessions());
438
+ return JSON.stringify(e.sort(Te));
439
439
  }
440
- async function Ve() {
441
- let e = await Be(), t = `logs_${Date.now()}.json`;
442
- return De(e, t), t;
440
+ async function Be() {
441
+ let e = await ze(), t = `logs_${Date.now()}.json`;
442
+ return Ee(e, t), t;
443
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());
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());
446
446
  //#endregion
447
447
  //#region src/static/AuthData.ts
448
- var v = class e {
448
+ var y = class e {
449
449
  static get sessionKey() {
450
450
  return e._sessionKey;
451
451
  }
@@ -468,10 +468,10 @@ var v = class e {
468
468
  return !e._sessionKey;
469
469
  }
470
470
  };
471
- h(v, "_sessionKey", void 0), h(v, "_sessionSecretKey", void 0), h(v, "_accessToken", void 0);
471
+ h(y, "_sessionKey", void 0), h(y, "_sessionSecretKey", void 0), h(y, "_accessToken", void 0);
472
472
  //#endregion
473
473
  //#region src/classes/EventEmitter.ts
474
- var y = class {
474
+ var b = class {
475
475
  constructor() {
476
476
  h(this, "_handlers", {}), h(this, "_listeners", []);
477
477
  }
@@ -497,14 +497,14 @@ var y = class {
497
497
  e.dispose();
498
498
  });
499
499
  }
500
- }, b = /* @__PURE__ */ function(e) {
500
+ }, x = /* @__PURE__ */ function(e) {
501
501
  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;
502
- }(b || {}), x = /* @__PURE__ */ function(e) {
503
- 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;
504
502
  }(x || {}), S = /* @__PURE__ */ function(e) {
503
+ 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;
504
+ }(S || {}), C = /* @__PURE__ */ function(e) {
505
505
  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;
506
- }(S || {}), Ye = (e) => e.stop(), Xe = (e) => e.getTracks().forEach(Ye), Ze = (e) => e.getVideoTracks().forEach(Ye);
507
- async function Qe(e, t) {
506
+ }(C || {}), Je = (e) => e.stop(), Ye = (e) => e.getTracks().forEach(Je), Xe = (e) => e.getVideoTracks().forEach(Je);
507
+ async function Ze(e, t) {
508
508
  try {
509
509
  let n = typeof t.width == "number" ? t.width : void 0, r = typeof t.height == "number" ? t.height : void 0;
510
510
  await e.applyConstraints({
@@ -524,7 +524,7 @@ async function Qe(e, t) {
524
524
  }
525
525
  //#endregion
526
526
  //#region src/utils/NavigatorPermissions.ts
527
- var $e = class {
527
+ var Qe = class {
528
528
  constructor() {
529
529
  h(this, "_cameraPermissionStatus", void 0), h(this, "_microphonePermissionStatus", void 0), h(this, "_listener", void 0);
530
530
  }
@@ -565,7 +565,7 @@ var $e = class {
565
565
  }
566
566
  return t;
567
567
  }
568
- }, et = "_okcls_", tt = (() => {
568
+ }, $e = "_okcls_", et = (() => {
569
569
  try {
570
570
  let e = Date.now().toString(), t = window.localStorage, n = !1;
571
571
  return t.setItem(e, e), n = t.getItem(e) === e, t.removeItem(e), n ? t : null;
@@ -573,8 +573,8 @@ var $e = class {
573
573
  return null;
574
574
  }
575
575
  })();
576
- function nt(e) {
577
- let t = tt ? tt.getItem(et + e) : null;
576
+ function tt(e) {
577
+ let t = et ? et.getItem($e + e) : null;
578
578
  if (t === null) return null;
579
579
  try {
580
580
  return JSON.parse(t);
@@ -582,30 +582,30 @@ function nt(e) {
582
582
  return null;
583
583
  }
584
584
  }
585
- function rt(e, t) {
585
+ function nt(e, t) {
586
586
  try {
587
- tt && tt.setItem(et + e, JSON.stringify(t));
587
+ et && et.setItem($e + e, JSON.stringify(t));
588
588
  } catch {}
589
589
  }
590
- function it(e) {
591
- tt && tt.removeItem(et + e);
590
+ function rt(e) {
591
+ et && et.removeItem($e + e);
592
592
  }
593
- var at;
593
+ var it;
594
594
  (function(e) {
595
595
  function t(e) {
596
- return nt(e) || null;
596
+ return tt(e) || null;
597
597
  }
598
598
  e.get = t;
599
599
  function n(e, t) {
600
- rt(e, t);
600
+ nt(e, t);
601
601
  }
602
602
  e.set = n;
603
603
  function r(e) {
604
- it(e);
604
+ rt(e);
605
605
  }
606
606
  e.remove = r;
607
- })(at || (at = {}));
608
- 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 = {}, At = /* @__PURE__ */ function(e) {
607
+ })(it || (it = {}));
608
+ 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 = {}, At = /* @__PURE__ */ function(e) {
609
609
  return e.USER = "user", e.ENVIRONMENT = "environment", e;
610
610
  }({});
611
611
  (function(e) {
@@ -625,8 +625,8 @@ var jt = class {
625
625
  autoGainControl: !0
626
626
  };
627
627
  let t = w.getMicrophones(), n, r;
628
- if (mt && (r = mt.groupId, n = mt.deviceId), typeof e == "string") r = t.find((t) => t.deviceId === e)?.groupId, n = e;
629
- else if (!mt && w.os() === "MacOS" && t.find((e) => e.label.includes("iPhone"))) {
628
+ if (pt && (r = pt.groupId, n = pt.deviceId), typeof e == "string") r = t.find((t) => t.deviceId === e)?.groupId, n = e;
629
+ else if (!pt && w.os() === "MacOS" && t.find((e) => e.label.includes("iPhone"))) {
630
630
  let e = t.find((e) => !e.label.includes("Virtual") && !e.label.includes("iPhone"));
631
631
  e && (r = e.groupId, n = e.deviceId);
632
632
  }
@@ -649,8 +649,8 @@ var jt = class {
649
649
  frameRate: { ideal: i }
650
650
  };
651
651
  let e = w.getCameras(), a, s;
652
- if (pt && (s = pt.groupId, a = pt.deviceId), typeof t == "string") s = e.find((e) => e.deviceId === t)?.groupId, a = t;
653
- else if (!pt && w.os() === "MacOS" && e.find((e) => e.label.includes("iPhone"))) {
652
+ if (ft && (s = ft.groupId, a = ft.deviceId), typeof t == "string") s = e.find((e) => e.deviceId === t)?.groupId, a = t;
653
+ else if (!ft && w.os() === "MacOS" && e.find((e) => e.label.includes("iPhone"))) {
654
654
  let t = e.find((e) => !e.label.includes("Virtual") && !e.label.includes("iPhone"));
655
655
  t && (s = t.groupId, a = t.deviceId);
656
656
  }
@@ -701,7 +701,7 @@ var jt = class {
701
701
  h(this, "_lockId", Math.round(Math.random() * 99998) + 1);
702
702
  }
703
703
  busy(t = null) {
704
- if (e._lockId) throw t?.log(S.ERROR, "change_device"), R.warn("Device change failed: MediaSource is busy"), Error("MediaSource is busy");
704
+ if (e._lockId) throw t?.log(C.ERROR, "change_device"), R.warn("Device change failed: MediaSource is busy"), Error("MediaSource is busy");
705
705
  e._lockId = this._lockId;
706
706
  }
707
707
  free() {
@@ -710,7 +710,7 @@ var jt = class {
710
710
  };
711
711
  h(Nt, "_lockId", 0);
712
712
  async function Pt() {
713
- _t = !1, gt = !1, st = null;
713
+ gt = !1, ht = !1, ot = null;
714
714
  let e = {
715
715
  camera: w.getSavedCamera(),
716
716
  microphone: w.getSavedMicrophone(),
@@ -722,18 +722,18 @@ function Ft(e, ...t) {
722
722
  if (kt[e]) for (let n of kt[e]) n(...t);
723
723
  }
724
724
  async function It() {
725
- return st || (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices ? [] : (!ct && navigator.mediaDevices.addEventListener && (ct = j.debounce(Pt, M.enumerateDevicesDelay), navigator.mediaDevices.addEventListener("devicechange", ct)), !lt && $e.isSupported() && (lt = new $e(), await lt.init((e, t) => {
725
+ return ot || (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices ? [] : (!st && navigator.mediaDevices.addEventListener && (st = j.debounce(Pt, M.enumerateDevicesDelay), navigator.mediaDevices.addEventListener("devicechange", st)), !ct && Qe.isSupported() && (ct = new Qe(), await ct.init((e, t) => {
726
726
  switch (t) {
727
727
  case "denied":
728
728
  case "prompt":
729
- ct?.();
729
+ st?.();
730
730
  break;
731
731
  }
732
- })), st = navigator.mediaDevices.enumerateDevices().then((e) => {
733
- ut = e.filter((e) => e.kind === "videoinput" ? (e.label && (gt = !0), !0) : !1), dt = e.filter((e) => e.kind === "audioinput" ? (e.label ? _t = !0 : w.isMobile() && w.browserName() === "Firefox" && (_t = gt), !0) : !1), ft = e.filter((e) => e.kind === "audiooutput");
734
- let t = pt?.deviceId ?? ot.get("videoinput"), n = mt?.deviceId ?? ot.get("audioinput"), r = ht?.deviceId ?? ot.get("audiooutput");
735
- 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;
736
- }).catch(() => (st = null, []))));
732
+ })), ot = navigator.mediaDevices.enumerateDevices().then((e) => {
733
+ lt = e.filter((e) => e.kind === "videoinput" ? (e.label && (ht = !0), !0) : !1), ut = e.filter((e) => e.kind === "audioinput" ? (e.label ? gt = !0 : w.isMobile() && w.browserName() === "Firefox" && (gt = ht), !0) : !1), dt = e.filter((e) => e.kind === "audiooutput");
734
+ let t = ft?.deviceId ?? at.get("videoinput"), n = pt?.deviceId ?? at.get("audioinput"), r = mt?.deviceId ?? at.get("audiooutput");
735
+ 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;
736
+ }).catch(() => (ot = null, []))));
737
737
  }
738
738
  async function Lt() {
739
739
  if ("userAgentData" in navigator) try {
@@ -743,19 +743,19 @@ async function Lt() {
743
743
  return;
744
744
  }
745
745
  let t = parseInt(e.split(".")[0]);
746
- wt = isNaN(t) ? null : t;
746
+ Ct = isNaN(t) ? null : t;
747
747
  } catch (e) {
748
748
  R.warn("Failed to get OS version", e);
749
749
  }
750
750
  }
751
751
  function Rt(e) {
752
- if (pt && mt) return;
752
+ if (ft && pt) return;
753
753
  let t = (e, t) => {
754
754
  let n = t.getSettings()?.deviceId;
755
755
  return e.find((e) => e.deviceId === n || e.label === t.label) || null;
756
756
  };
757
757
  e?.getTracks().forEach((e) => {
758
- !mt && e.kind === k.audio ? mt = t(w.getMicrophones(), e) : !pt && e.kind === k.video && (pt = t(w.getCameras(), e));
758
+ !pt && e.kind === k.audio ? pt = t(w.getMicrophones(), e) : !ft && e.kind === k.video && (ft = t(w.getCameras(), e));
759
759
  });
760
760
  }
761
761
  async function zt(e, t, n = R, r = null) {
@@ -775,31 +775,31 @@ async function zt(e, t, n = R, r = null) {
775
775
  case "SecurityError":
776
776
  case "DOMException":
777
777
  case "NotFoundError":
778
- t = e.isVideoRequested() ? b.CAMERA_PERMISSION : b.MIC_PERMISSION;
778
+ t = e.isVideoRequested() ? x.CAMERA_PERMISSION : x.MIC_PERMISSION;
779
779
  break;
780
780
  case "OverconstrainedError":
781
- t = b.OVERCONSTRAINED;
781
+ t = x.OVERCONSTRAINED;
782
782
  break;
783
783
  case "TypeError":
784
- t = b.UNKNOWN;
784
+ t = x.UNKNOWN;
785
785
  break;
786
786
  case "AbortError":
787
787
  case "NotReadableError":
788
- t = e.isVideoRequested() ? b.CAMERA_ACCESS : b.MIC_ACCESS;
788
+ t = e.isVideoRequested() ? x.CAMERA_ACCESS : x.MIC_ACCESS;
789
789
  break;
790
790
  case "Error": if (i.message === "MediaSource is busy") {
791
- t = e.isVideoRequested() ? b.CAMERA_ACCESS : b.MIC_ACCESS;
791
+ t = e.isVideoRequested() ? x.CAMERA_ACCESS : x.MIC_ACCESS;
792
792
  break;
793
793
  }
794
794
  }
795
795
  if (e.canSimplify()) return zt(e.simplify(), t, n, r);
796
- let o = t || b.UNKNOWN;
796
+ let o = t || x.UNKNOWN;
797
797
  throw L.onPermissionsError(o, i), o;
798
798
  }
799
799
  }
800
800
  async function Bt(e = R) {
801
- if (!(xt || w.browserName() !== "Firefox" || !navigator.mediaDevices?.getUserMedia)) try {
802
- w.hasMicrophonePermission() || L.onPermissionsRequested(), xt = await navigator.mediaDevices.getUserMedia({
801
+ if (!(bt || w.browserName() !== "Firefox" || !navigator.mediaDevices?.getUserMedia)) try {
802
+ w.hasMicrophonePermission() || L.onPermissionsRequested(), bt = await navigator.mediaDevices.getUserMedia({
803
803
  audio: !0,
804
804
  video: !1
805
805
  });
@@ -826,17 +826,17 @@ async function Vt(e, t = R, n = null) {
826
826
  switch (e.name) {
827
827
  case "PermissionDeniedError":
828
828
  case "NotAllowedError":
829
- case "SecurityError": throw b.SCREEN_PERMISSION;
830
- default: throw b.SCREEN_ACCESS;
829
+ case "SecurityError": throw x.SCREEN_PERMISSION;
830
+ default: throw x.SCREEN_ACCESS;
831
831
  }
832
832
  } finally {
833
833
  r.free();
834
834
  }
835
835
  }
836
836
  function Ht() {
837
- return Tt.length || (Tt = (() => {
838
- let e, t = !1, n = 0, r = "0", i = C.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
839
- if (/trident/i.test(i[1])) return e = /\brv[ :]+(\d+)/g.exec(C), [
837
+ return wt.length || (wt = (() => {
838
+ let e, t = !1, n = 0, r = "0", i = Ot.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
839
+ if (/trident/i.test(i[1])) return e = /\brv[ :]+(\d+)/g.exec(Ot), [
840
840
  "IE",
841
841
  e && e[1] || "Unknown",
842
842
  t,
@@ -844,35 +844,35 @@ function Ht() {
844
844
  r
845
845
  ];
846
846
  if (i[1] === "Safari") {
847
- if (e = C.match(/\bEdge\/(\d+)/), e) return [
847
+ if (e = Ot.match(/\bEdge\/(\d+)/), e) return [
848
848
  "Edge",
849
849
  e[1] || "Unknown",
850
850
  t,
851
851
  n,
852
852
  r
853
853
  ];
854
- if (e = C.match(/\bCriOS\/(\d+)/), e) return [
854
+ if (e = Ot.match(/\bCriOS\/(\d+)/), e) return [
855
855
  "Chrome",
856
856
  e[1],
857
857
  !0,
858
858
  Number(e[1]),
859
859
  r
860
860
  ];
861
- if (e = C.match(/\bFxiOS\/(\d+)/), e) return [
861
+ if (e = Ot.match(/\bFxiOS\/(\d+)/), e) return [
862
862
  "Firefox",
863
863
  e[1],
864
864
  !1,
865
865
  n,
866
866
  r
867
867
  ];
868
- if (e = C.match(/\bYaBrowser\/(\d+)/), e) return [
868
+ if (e = Ot.match(/\bYaBrowser\/(\d+)/), e) return [
869
869
  "Yandex",
870
870
  e[1],
871
871
  !1,
872
872
  n,
873
873
  r
874
874
  ];
875
- if (e = C.match(/\bOPT\/(\d+)/), e) return [
875
+ if (e = Ot.match(/\bOPT\/(\d+)/), e) return [
876
876
  "Opera",
877
877
  e[1],
878
878
  !1,
@@ -881,28 +881,28 @@ function Ht() {
881
881
  ];
882
882
  }
883
883
  if (i[1] === "Chrome") {
884
- if (t = !0, n = Number(i[2]), e = C.match(/\bOPR\/(\d+)/), e) return [
884
+ if (t = !0, n = Number(i[2]), e = Ot.match(/\bOPR\/(\d+)/), e) return [
885
885
  "Opera",
886
886
  e[1] || "Unknown",
887
887
  t,
888
888
  n,
889
889
  r
890
890
  ];
891
- if (e = C.match(/\bYaBrowser\/(\d+)/), e) return [
891
+ if (e = Ot.match(/\bYaBrowser\/(\d+)/), e) return [
892
892
  "Yandex",
893
893
  e[1] || "Unknown",
894
894
  t,
895
895
  n,
896
896
  r
897
897
  ];
898
- if (e = C.match(/\bSferum\/((\d+)(?:\.\d+)*)/), e) return [
898
+ if (e = Ot.match(/\bSferum\/((\d+)(?:\.\d+)*)/), e) return [
899
899
  "Sferum",
900
900
  e[1] || "Unknown",
901
901
  t,
902
902
  n,
903
903
  r
904
904
  ];
905
- if (e = C.match(/\bEdge?\/(\d+)/), e) return [
905
+ if (e = Ot.match(/\bEdge?\/(\d+)/), e) return [
906
906
  "Edge",
907
907
  e[1] || "Unknown",
908
908
  t,
@@ -917,14 +917,14 @@ function Ht() {
917
917
  r
918
918
  ];
919
919
  }
920
- return e = C.match(/version\/(\d+)(?:(?:\.)(\d+))?/i), e && e[2] !== void 0 && (r = e[2]), [
921
- i[2] ? i[1] : Ot,
922
- e && e[1] || i[2] || Dt,
920
+ return e = Ot.match(/version\/(\d+)(?:(?:\.)(\d+))?/i), e && e[2] !== void 0 && (r = e[2]), [
921
+ i[2] ? i[1] : Dt,
922
+ e && e[1] || i[2] || Et,
923
923
  t,
924
924
  n,
925
925
  r
926
926
  ];
927
- })()), Tt;
927
+ })()), wt;
928
928
  }
929
929
  var w;
930
930
  (function(e) {
@@ -933,35 +933,35 @@ var w;
933
933
  }
934
934
  e.init = t;
935
935
  function n() {
936
- return ut;
936
+ return lt;
937
937
  }
938
938
  e.getCameras = n;
939
939
  function r() {
940
- return dt;
940
+ return ut;
941
941
  }
942
942
  e.getMicrophones = r;
943
943
  function i() {
944
- return ft;
944
+ return dt;
945
945
  }
946
946
  e.getOutput = i;
947
947
  function a() {
948
- return ut.length > 0;
948
+ return lt.length > 0;
949
949
  }
950
950
  e.hasCamera = a;
951
951
  function o() {
952
- return dt.length > 0;
952
+ return ut.length > 0;
953
953
  }
954
954
  e.hasMicrophone = o;
955
955
  function s() {
956
- return pt;
956
+ return ft;
957
957
  }
958
958
  e.getSavedCamera = s;
959
959
  function c() {
960
- return mt;
960
+ return pt;
961
961
  }
962
962
  e.getSavedMicrophone = c;
963
963
  function l() {
964
- return ht;
964
+ return mt;
965
965
  }
966
966
  e.getSavedOutput = l;
967
967
  function u() {
@@ -969,15 +969,15 @@ var w;
969
969
  }
970
970
  e.getVideoFacingMode = u;
971
971
  function d() {
972
- return gt;
972
+ return ht;
973
973
  }
974
974
  e.hasCameraPermission = d;
975
975
  function f() {
976
- return _t;
976
+ return gt;
977
977
  }
978
978
  e.hasMicrophonePermission = f;
979
979
  function p() {
980
- return lt?.getPermissionState("microphone") ?? null;
980
+ return ct?.getPermissionState("microphone") ?? null;
981
981
  }
982
982
  e.getMicrophonePermissionState = p;
983
983
  function m(e = !1) {
@@ -985,7 +985,7 @@ var w;
985
985
  }
986
986
  e.hasPermissions = m;
987
987
  function ee() {
988
- xt && (Xe(xt), xt = null);
988
+ bt && (Ye(bt), bt = null);
989
989
  }
990
990
  e.releaseFirefoxMicrophonePermissionWarmup = ee;
991
991
  async function h(e = !1, t = !0, n = !0, r = R, i = null) {
@@ -1020,32 +1020,32 @@ var w;
1020
1020
  async function ae(e, t) {
1021
1021
  let [n] = e.getVideoTracks();
1022
1022
  if (!n) throw Error("Video track not found in stream");
1023
- return Qe(n, t);
1023
+ return Ze(n, t);
1024
1024
  }
1025
1025
  e.setResolution = ae;
1026
1026
  async function oe(e, t) {
1027
1027
  let n = (await It()).find((n) => n.kind === e && n.deviceId === t);
1028
- return n ? (e === "videoinput" ? pt = n : e === "audioinput" ? mt = n : e === "audiooutput" && (ht = n), ot.set(e, t), n) : null;
1028
+ return n ? (e === "videoinput" ? ft = n : e === "audioinput" ? pt = n : e === "audiooutput" && (mt = n), at.set(e, t), n) : null;
1029
1029
  }
1030
1030
  e._saveDeviceId = oe;
1031
1031
  function g() {
1032
- if (!bt || bt.readyState === "ended") {
1032
+ if (!yt || yt.readyState === "ended") {
1033
1033
  let e = w.getAudioContext(), t = e.createMediaStreamDestination(), n = e.createGain();
1034
1034
  n.gain.value = 1e-5, n.connect(t), n.connect(e.destination);
1035
1035
  let r = e.createOscillator();
1036
- r.type = "sine", r.frequency.value = 0, r.connect(n), r.start(), bt = t.stream.getAudioTracks()[0];
1036
+ r.type = "sine", r.frequency.value = 0, r.connect(n), r.start(), yt = t.stream.getAudioTracks()[0];
1037
1037
  }
1038
- return Object.assign(bt.clone(), { enabled: !1 });
1038
+ return Object.assign(yt.clone(), { enabled: !1 });
1039
1039
  }
1040
1040
  e.getSilentMediaTrack = g;
1041
- function se(e = M.videoMinWidth, t = M.videoMinHeight) {
1042
- yt || (yt = document.createElement("canvas")), yt.width = e, yt.height = t;
1043
- let n = yt.getContext("2d");
1044
- 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 });
1045
- }
1046
- e.getBlackMediaTrack = se;
1047
- function ce() {
1048
- if (ve() === "Edge" && Number(ye()) < 70) return !1;
1041
+ function _(e = M.videoMinWidth, t = M.videoMinHeight) {
1042
+ vt || (vt = document.createElement("canvas")), vt.width = e, vt.height = t;
1043
+ let n = vt.getContext("2d");
1044
+ 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 });
1045
+ }
1046
+ e.getBlackMediaTrack = _;
1047
+ function se() {
1048
+ if (_e() === "Edge" && Number(ve()) < 70) return !1;
1049
1049
  try {
1050
1050
  let e = window;
1051
1051
  return "mediaDevices" in e.navigator && "getUserMedia" in e.navigator.mediaDevices && e.RTCPeerConnection && e.RTCIceCandidate && e.RTCSessionDescription && e.HTMLCanvasElement && e.HTMLCanvasElement.prototype.captureStream && e.RTCRtpSender && e.RTCRtpSender.prototype.replaceTrack && e.RTCRtpSender.prototype.getParameters && "sendBeacon" in navigator && !0 || !1;
@@ -1053,21 +1053,21 @@ var w;
1053
1053
  return !1;
1054
1054
  }
1055
1055
  }
1056
- e.isBrowserSupported = ce;
1057
- function le() {
1056
+ e.isBrowserSupported = se;
1057
+ function ce() {
1058
1058
  return !!navigator.mediaDevices.getDisplayMedia;
1059
1059
  }
1060
- e.isScreenCapturingSupported = le;
1061
- function ue() {
1060
+ e.isScreenCapturingSupported = ce;
1061
+ function le() {
1062
1062
  let e = w.browserName() === "Safari" && w.browserVersion() === "15" && w.browserSubVersion() === "1", t = w.browserName() === "Opera", n = w.browserName() === "Yandex";
1063
1063
  return e || t || n;
1064
1064
  }
1065
- e.isBrokenH264Decoder = ue;
1066
- function de() {
1065
+ e.isBrokenH264Decoder = le;
1066
+ function ue() {
1067
1067
  return w.browserName() === "Yandex" && w.os() === "Windows" || M.simulcast;
1068
1068
  }
1069
- e.isBrokenVP9Encoder = de;
1070
- function fe() {
1069
+ e.isBrokenVP9Encoder = ue;
1070
+ function de() {
1071
1071
  let e = w.browserName() === "Safari" && Number(w.browserVersion()) === 17 && [
1072
1072
  4,
1073
1073
  5,
@@ -1075,21 +1075,21 @@ var w;
1075
1075
  ].includes(Number(w.browserSubVersion())), t = w.os() === "Windows" && w.osVersion() === 10;
1076
1076
  return e || t;
1077
1077
  }
1078
- e.isBrokenVP9Decoder = fe;
1079
- function pe() {
1078
+ e.isBrokenVP9Decoder = de;
1079
+ function fe() {
1080
1080
  return w.browserName() === "Firefox" && Number(w.browserVersion()) < 60;
1081
1081
  }
1082
- e.isOldDataChannelDescription = pe;
1083
- function me() {
1082
+ e.isOldDataChannelDescription = fe;
1083
+ function pe() {
1084
1084
  return !(w.baseChromeVersion() && w.isMobile());
1085
1085
  }
1086
- e.canPreferH264 = me;
1087
- function he() {
1086
+ e.canPreferH264 = pe;
1087
+ function me() {
1088
1088
  return !(w.browserName() === "Firefox" || w.browserName() === "Safari");
1089
1089
  }
1090
- e.isSimulcastSupportedByBrowser = he;
1091
- function ge() {
1092
- return Ct || (Ct = (() => {
1090
+ e.isSimulcastSupportedByBrowser = me;
1091
+ function he() {
1092
+ return St || (St = (() => {
1093
1093
  let e = {
1094
1094
  Windows: /Win/,
1095
1095
  Android: /Android/,
@@ -1106,57 +1106,57 @@ var w;
1106
1106
  OS2: /OS\/2/,
1107
1107
  Bot: /(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver)/
1108
1108
  };
1109
- for (let t in e) if (Object.hasOwn(e, t) && e[t].test(C)) return t;
1109
+ for (let t in e) if (Object.hasOwn(e, t) && e[t].test(Ot)) return t;
1110
1110
  return "Unknown";
1111
- })()), Ct;
1111
+ })()), St;
1112
1112
  }
1113
- e.os = ge;
1114
- function _e() {
1115
- return wt;
1113
+ e.os = he;
1114
+ function ge() {
1115
+ return Ct;
1116
1116
  }
1117
- e.osVersion = _e;
1118
- function _() {
1119
- return St === null && (St = /Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(Dt)), St;
1117
+ e.osVersion = ge;
1118
+ function v() {
1119
+ return xt === null && (xt = /Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(Et)), xt;
1120
1120
  }
1121
- e.isMobile = _;
1122
- function ve() {
1121
+ e.isMobile = v;
1122
+ function _e() {
1123
1123
  return Ht()[0];
1124
1124
  }
1125
- e.browserName = ve;
1126
- function ye() {
1125
+ e.browserName = _e;
1126
+ function ve() {
1127
1127
  return Ht()[1];
1128
1128
  }
1129
- e.browserVersion = ye;
1130
- function be() {
1129
+ e.browserVersion = ve;
1130
+ function ye() {
1131
1131
  return Ht()[3];
1132
1132
  }
1133
- e.baseChromeVersion = be;
1134
- function xe() {
1135
- return Et || (Et = new (window.AudioContext || window.webkitAudioContext)()), Et.resume().catch(() => {
1133
+ e.baseChromeVersion = ye;
1134
+ function be() {
1135
+ return Tt || (Tt = new (window.AudioContext || window.webkitAudioContext)()), Tt.resume().catch(() => {
1136
1136
  R.warn("Failed to resume AudioContext");
1137
- }), Et;
1137
+ }), Tt;
1138
1138
  }
1139
- e.getAudioContext = xe;
1140
- function Se() {
1139
+ e.getAudioContext = be;
1140
+ function xe() {
1141
1141
  return Ht()[4];
1142
1142
  }
1143
- e.browserSubVersion = Se;
1144
- function Ce() {
1143
+ e.browserSubVersion = xe;
1144
+ function Se() {
1145
1145
  return w.baseChromeVersion() >= 105 && !w.isMobile();
1146
1146
  }
1147
- e.isAudioShareSupported = Ce;
1148
- function we(e, t) {
1147
+ e.isAudioShareSupported = Se;
1148
+ function Ce(e, t) {
1149
1149
  kt[e] || (kt[e] = []), kt[e].push(t);
1150
1150
  }
1151
- e.addEventListener = we;
1152
- function Te(e, t) {
1151
+ e.addEventListener = Ce;
1152
+ function we(e, t) {
1153
1153
  if (kt[e]) if (!t) delete kt[e];
1154
1154
  else {
1155
1155
  let n = kt[e].indexOf(t);
1156
1156
  n > -1 && kt[e].splice(n, 1);
1157
1157
  }
1158
1158
  }
1159
- e.removeEventListener = Te;
1159
+ e.removeEventListener = we;
1160
1160
  })(w || (w = {}));
1161
1161
  var T = w;
1162
1162
  //#endregion
@@ -1177,7 +1177,7 @@ function E(e) {
1177
1177
  //#endregion
1178
1178
  //#region src/enums/HangupType.ts
1179
1179
  var D = /* @__PURE__ */ function(e) {
1180
- return e.CANCELED = "CANCELED", e.REJECTED = "REJECTED", e.REMOVED = "REMOVED", e.HUNGUP = "HUNGUP", e.MISSED = "MISSED", e.BUSY = "BUSY", e.FAILED = "FAILED", e.NETWORK_ERROR = "NETWORK_ERROR", e.KILLED = "KILLED", e.BANNED = "BANNED", e.HAS_ACTIVE_CALL = "HAS_ACTIVE_CALL", e.CALLER_IS_BLOCKED = "CALLER_IS_BLOCKED", e.NOT_FRIENDS = "NOT_FRIENDS", e.CALLEE_IS_OFFLINE = "CALLEE_IS_OFFLINE", e.CALLER_IS_REJECTED = "CALLER_IS_REJECTED", e.UNKNOWN_ERROR = "UNKNOWN_ERROR", e.UNSUPPORTED = "UNSUPPORTED", e.OLD_VERSION = "OLD_VERSION", e.SERVICE_DISABLED = "SERVICE_DISABLED", e.SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE", e.EXTERNAL_API_ERROR = "EXTERNAL_API_ERROR", e.SOCKET_CLOSED = "SOCKET_CLOSED", e.ENDED = "ENDED", e.KILLED_WITHOUT_DELETE = "KILLED_WITHOUT_DELETE", e.ANOTHER_DEVICE = "ANOTHER_DEVICE", e.NOT_FOUND = "NOT_FOUND", e.VCHAT_DETAILED_ERROR = "VCHAT_DETAILED_ERROR", e.TIMEOUT = "TIMEOUT", e.PARTICIPANT_LIMIT_REACHED = "PARTICIPANT_LIMIT_REACHED", e.FAST_START_ERROR = "FAST_START_ERROR", e.FAST_JOIN_ERROR = "FAST_JOIN_ERROR", e.CALL_TIMEOUT = "CALL_TIMEOUT", e;
1180
+ return e.CANCELED = "CANCELED", e.REJECTED = "REJECTED", e.REMOVED = "REMOVED", e.HUNGUP = "HUNGUP", e.MISSED = "MISSED", e.BUSY = "BUSY", e.FAILED = "FAILED", e.NETWORK_ERROR = "NETWORK_ERROR", e.KILLED = "KILLED", e.BANNED = "BANNED", e.HAS_ACTIVE_CALL = "HAS_ACTIVE_CALL", e.CALLER_IS_BLOCKED = "CALLER_IS_BLOCKED", e.NOT_FRIENDS = "NOT_FRIENDS", e.CALLEE_IS_OFFLINE = "CALLEE_IS_OFFLINE", e.CALLER_IS_REJECTED = "CALLER_IS_REJECTED", e.UNKNOWN_ERROR = "UNKNOWN_ERROR", e.UNSUPPORTED = "UNSUPPORTED", e.OLD_VERSION = "OLD_VERSION", e.SERVICE_DISABLED = "SERVICE_DISABLED", e.SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE", e.EXTERNAL_API_ERROR = "EXTERNAL_API_ERROR", e.SOCKET_CLOSED = "SOCKET_CLOSED", e.ENDED = "ENDED", e.KILLED_WITHOUT_DELETE = "KILLED_WITHOUT_DELETE", e.ANOTHER_DEVICE = "ANOTHER_DEVICE", e.NOT_FOUND = "NOT_FOUND", e.VCHAT_DETAILED_ERROR = "VCHAT_DETAILED_ERROR", e.TIMEOUT = "TIMEOUT", e.PARTICIPANT_LIMIT_REACHED = "PARTICIPANT_LIMIT_REACHED", e.FAST_START_ERROR = "FAST_START_ERROR", e.FAST_JOIN_ERROR = "FAST_JOIN_ERROR", e.CALL_TIMEOUT = "CALL_TIMEOUT", e.OBSOLETE_CLIENT = "OBSOLETE_CLIENT", e;
1181
1181
  }(D || {}), O = class e extends Error {
1182
1182
  constructor(t, n) {
1183
1183
  super(), h(this, "message", void 0), h(this, "hangup", void 0), h(this, "error", void 0), h(this, "code", void 0), h(this, "remote", void 0), h(this, "custom_error", void 0), this.name = "HangupReason", this.code = n && n.code || 0, this.remote = n && n.remote || !1, this.custom_error = n?.custom_error ?? null, Object.values(D).indexOf(t) > -1 ? this.hangup = t : this.error = t;
@@ -1186,7 +1186,7 @@ var D = /* @__PURE__ */ function(e) {
1186
1186
  }
1187
1187
  }, Wt = /* @__PURE__ */ function(e) {
1188
1188
  return e.FpsLimit = "fps-limit", e;
1189
- }({}), Gt = class extends y {
1189
+ }({}), Gt = class extends b {
1190
1190
  constructor(e = R) {
1191
1191
  super(), h(this, "FPS_LIMITS", [
1192
1192
  13,
@@ -1232,7 +1232,7 @@ var D = /* @__PURE__ */ function(e) {
1232
1232
  return e.audio = "audio", e.video = "video", e.screen = "screen", e.audioshare = "audioshare", e;
1233
1233
  }({}), qt = /* @__PURE__ */ function(e) {
1234
1234
  return e[e.CAMERA = 1] = "CAMERA", e[e.SCREEN = 2] = "SCREEN", e;
1235
- }({}), Jt = class extends y {
1235
+ }({}), Jt = class extends b {
1236
1236
  constructor(e = R, t = null) {
1237
1237
  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", () => {
1238
1238
  this._mediaSettings.isVideoEnabled && this.toggleVideo(!0);
@@ -1244,10 +1244,10 @@ var D = /* @__PURE__ */ function(e) {
1244
1244
  set cameraVideoTrack(e) {
1245
1245
  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());
1246
1246
  }
1247
- async request(e = [x.AUDIO], t = !0) {
1247
+ async request(e = [S.AUDIO], t = !0) {
1248
1248
  if (this._stream) return;
1249
- let n = e.includes(x.VIDEO), r = e.includes(x.AUDIO), i = e.includes(x.ANIMOJI);
1250
- if (!T.isBrowserSupported()) throw new O(b.UNSUPPORTED);
1249
+ let n = e.includes(S.VIDEO), r = e.includes(S.AUDIO), i = e.includes(S.ANIMOJI);
1250
+ if (!T.isBrowserSupported()) throw new O(x.UNSUPPORTED);
1251
1251
  try {
1252
1252
  this._stream = await T.getUserMedia(n, r, t, this._debug, this._logger), this.cameraVideoTrack?.stop(), this.cameraVideoTrack = this._stream.getVideoTracks()[0], this._micAudioTrack?.stop(), this._micAudioTrack = this._stream.getAudioTracks()[0], this._audioEffectsTrack?.stop(), this._mediaSettings.isVideoEnabled = n && this._stream.getVideoTracks().filter((e) => e.enabled).length > 0 || !1, this._mediaSettings.isAudioEnabled = r && this._stream.getAudioTracks().filter((e) => e.enabled).length > 0 || !1, this._mediaSettings.isAnimojiEnabled = i && !this._mediaSettings.isVideoEnabled || !1, this._animojiEnabled = i, this._triggerEvent("SOURCE_READY");
1253
1253
  } catch (e) {
@@ -1288,11 +1288,11 @@ var D = /* @__PURE__ */ function(e) {
1288
1288
  case "audioinput":
1289
1289
  if (this._mediaSettings.isAudioEnabled) return this._changeAudioInput();
1290
1290
  break;
1291
- default: return Promise.reject(b.UNKNOWN);
1291
+ default: return Promise.reject(x.UNKNOWN);
1292
1292
  }
1293
1293
  }
1294
1294
  stopVideoTrack() {
1295
- this._mediaSettings.isVideoEnabled && (this._stopEffect(), this._stream && Ze(this._stream), this.cameraVideoTrack?.stop());
1295
+ this._mediaSettings.isVideoEnabled && (this._stopEffect(), this._stream && Xe(this._stream), this.cameraVideoTrack?.stop());
1296
1296
  }
1297
1297
  async setVideoStream(e, t) {
1298
1298
  return t ? this._changeScreen(!1, !1, e) : this._changeVideoInput(e);
@@ -1312,13 +1312,13 @@ var D = /* @__PURE__ */ function(e) {
1312
1312
  async _changeVideoInput(e) {
1313
1313
  try {
1314
1314
  let t = e ? "stream" : "video", n = e || await T._getUserVideo(!!this._effect, this._frameRate, this._debug, this._logger);
1315
- if (this.cameraVideoTrack?.stop(), this.cameraVideoTrack = n.getVideoTracks()[0], !this._stream) Xe(n);
1315
+ if (this.cameraVideoTrack?.stop(), this.cameraVideoTrack = n.getVideoTracks()[0], !this._stream) Ye(n);
1316
1316
  else {
1317
1317
  let e = await this._setEffect(this._effect, this.cameraVideoTrack);
1318
- 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" });
1318
+ 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" });
1319
1319
  }
1320
1320
  } catch (e) {
1321
- throw this._logger?.log(S.ERROR, "change_video"), this._debug.warn("Camera change failed", e), e;
1321
+ throw this._logger?.log(C.ERROR, "change_video"), this._debug.warn("Camera change failed", e), e;
1322
1322
  }
1323
1323
  }
1324
1324
  async setAudioStream(e) {
@@ -1327,30 +1327,30 @@ var D = /* @__PURE__ */ function(e) {
1327
1327
  async _changeAudioInput(e = null) {
1328
1328
  try {
1329
1329
  let t = e || await T.getUserAudio(void 0, this._debug, this._logger);
1330
- if (this._micAudioTrack?.stop(), this._micAudioTrack = t.getAudioTracks()[0], !this._stream) Xe(t);
1330
+ if (this._micAudioTrack?.stop(), this._micAudioTrack = t.getAudioTracks()[0], !this._stream) Ye(t);
1331
1331
  else {
1332
1332
  let e = await this._applyAudioEffect();
1333
- 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" });
1333
+ 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" });
1334
1334
  }
1335
1335
  } catch (e) {
1336
- throw this._logger?.log(S.ERROR, "change_audio"), this._debug.error("Microphone change failed", e), e;
1336
+ throw this._logger?.log(C.ERROR, "change_audio"), this._debug.error("Microphone change failed", e), e;
1337
1337
  }
1338
1338
  }
1339
1339
  async _changeScreen(e, t, n) {
1340
1340
  try {
1341
- if (n = n || await T.getScreenMedia(e, t, this._debug, this._logger), !this._stream) Xe(n);
1341
+ if (n = n || await T.getScreenMedia(e, t, this._debug, this._logger), !this._stream) Ye(n);
1342
1342
  else {
1343
1343
  let r = n.getVideoTracks()[0];
1344
1344
  if (r.addEventListener("ended", () => {
1345
1345
  this._mediaSettings.isScreenSharingEnabled && this.disableScreenCapturing();
1346
- }, !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) {
1346
+ }, !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) {
1347
1347
  let e = n.getAudioTracks()[0];
1348
1348
  e.contentHint = "music", this._audioShareTrack = e, await this._replaceLocalTrack(e), this._mediaSettings.isAudioSharingEnabled = !0;
1349
1349
  }
1350
1350
  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" });
1351
1351
  }
1352
1352
  } catch (e) {
1353
- throw this._logger?.log(S.ERROR, "screen"), this._debug.warn("Screen capturing failed", e), e;
1353
+ throw this._logger?.log(C.ERROR, "screen"), this._debug.warn("Screen capturing failed", e), e;
1354
1354
  }
1355
1355
  }
1356
1356
  async _disableScreenCapture() {
@@ -1398,15 +1398,15 @@ var D = /* @__PURE__ */ function(e) {
1398
1398
  }
1399
1399
  }
1400
1400
  destroy() {
1401
- 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();
1401
+ 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();
1402
1402
  }
1403
1403
  async stopLocalMedia() {
1404
1404
  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);
1405
1405
  }
1406
1406
  async resumeLocalMedia(e) {
1407
1407
  if (!this._lastMediaSettings) return;
1408
- let t = [], n = e ? e.isAudioEnabled : this._lastMediaSettings.isAudioEnabled, r = e ? e.isVideoEnabled : this._lastMediaSettings.isVideoEnabled;
1409
- if (n && (t.push(x.AUDIO), await this.toggleAudio(!0)), r && t.push(x.VIDEO), await this.request(t), this._lastMediaSettings = null, this._stream) for (let e of this._stream.getTracks()) this._triggerEvent("TRACK_REPLACED", e);
1408
+ let t = [];
1409
+ 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);
1410
1410
  }
1411
1411
  async toggleScreenCapturing(e) {
1412
1412
  if (e.captureScreen) {
@@ -1474,7 +1474,7 @@ var D = /* @__PURE__ */ function(e) {
1474
1474
  }
1475
1475
  async videoEffect(e) {
1476
1476
  if (!M.videoEffects) throw Error("Video Effects library is not set");
1477
- if (this._logger?.log(S.DEVICE_CHANGED, `effect_${e?.effect || "none"}`), !this._mediaSettings.isVideoEnabled) {
1477
+ if (this._logger?.log(C.DEVICE_CHANGED, `effect_${e?.effect || "none"}`), !this._mediaSettings.isVideoEnabled) {
1478
1478
  this._effect = e;
1479
1479
  return;
1480
1480
  }
@@ -1523,7 +1523,7 @@ var D = /* @__PURE__ */ function(e) {
1523
1523
  return this._effect ? Math.min(e, M.videoFrameRate) : void 0;
1524
1524
  }
1525
1525
  async _applyVideoConstraints(e, t) {
1526
- await Qe(e, {
1526
+ await Ze(e, {
1527
1527
  width: this._effect ? M.videoEffectMaxWidth : M.videoMaxWidth,
1528
1528
  height: this._effect ? M.videoEffectMaxHeight : M.videoMaxHeight,
1529
1529
  ...this._frameRate && { frameRate: { ideal: this._frameRate } },
@@ -1799,19 +1799,19 @@ var on = 533, sn = "a=fmtp:", cn = "sps-pps-idr-in-keyframe=1", ln;
1799
1799
  return ae(e.id, e.idType || A.USER, e.deviceIdx);
1800
1800
  }
1801
1801
  e.composeId = g;
1802
- function se(e) {
1802
+ function _(e) {
1803
1803
  if (e.decorativeUserId) return ae(e.decorativeUserId, e.idType || A.USER, e.deviceIdx);
1804
1804
  }
1805
- e.composeDecorativeId = se;
1806
- function ce(e) {
1805
+ e.composeDecorativeId = _;
1806
+ function se(e) {
1807
1807
  return e.participant ? g(e.participant) : ae(e.participantId, e.participantType || A.USER, e.deviceIdx);
1808
1808
  }
1809
- e.composeMessageId = ce;
1810
- function le(e) {
1811
- return typeof e == "string" ? ue(de(e).compositeUserId).id : e;
1809
+ e.composeMessageId = se;
1810
+ function ce(e) {
1811
+ return typeof e == "string" ? le(ue(e).compositeUserId).id : e;
1812
1812
  }
1813
- e.extractOkId = le;
1814
- function ue(e) {
1813
+ e.extractOkId = ce;
1814
+ function le(e) {
1815
1815
  let t = String(e), n = t.match(re);
1816
1816
  return n ? {
1817
1817
  id: Number(n[2]),
@@ -1821,24 +1821,24 @@ var on = 533, sn = "a=fmtp:", cn = "sps-pps-idr-in-keyframe=1", ln;
1821
1821
  type: A.USER
1822
1822
  });
1823
1823
  }
1824
- e.decomposeId = ue;
1825
- function de(e) {
1824
+ e.decomposeId = le;
1825
+ function ue(e) {
1826
1826
  let t = e.split(":d");
1827
1827
  return {
1828
1828
  compositeUserId: t[0],
1829
1829
  deviceIdx: t.length > 1 ? parseInt(t[1], 10) : 0
1830
1830
  };
1831
1831
  }
1832
- e.decomposeParticipantId = de;
1833
- function fe() {
1832
+ e.decomposeParticipantId = ue;
1833
+ function de() {
1834
1834
  let e = window.crypto?.randomUUID?.();
1835
1835
  if (e) return e;
1836
1836
  let t = "0123456789abcdefghijklmnopqrstuvwxyz".split(""), n = Array(36), r = 0, i, a;
1837
1837
  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]);
1838
1838
  return n.join("");
1839
1839
  }
1840
- e.uuid = fe;
1841
- function pe(e, t) {
1840
+ e.uuid = de;
1841
+ function fe(e, t) {
1842
1842
  let n;
1843
1843
  function r(...r) {
1844
1844
  let i = this;
@@ -1848,8 +1848,8 @@ var on = 533, sn = "a=fmtp:", cn = "sps-pps-idr-in-keyframe=1", ln;
1848
1848
  }
1849
1849
  return r;
1850
1850
  }
1851
- e.debounce = pe;
1852
- function me(e) {
1851
+ e.debounce = fe;
1852
+ function pe(e) {
1853
1853
  if (!window.BigInt) return null;
1854
1854
  let t = "", n = e.split("\n");
1855
1855
  for (let e of n) if (e.startsWith("a=fingerprint")) {
@@ -1867,8 +1867,8 @@ var on = 533, sn = "a=fmtp:", cn = "sps-pps-idr-in-keyframe=1", ln;
1867
1867
  }
1868
1868
  return BigInt.asIntN(64, i);
1869
1869
  }
1870
- e.sdpFingerprint = me;
1871
- async function he(e, { signal: t } = {}) {
1870
+ e.sdpFingerprint = pe;
1871
+ async function me(e, { signal: t } = {}) {
1872
1872
  return new Promise((n, r) => {
1873
1873
  if (t?.aborted) return r(t.reason);
1874
1874
  let i = setTimeout(() => {
@@ -1879,13 +1879,13 @@ var on = 533, sn = "a=fmtp:", cn = "sps-pps-idr-in-keyframe=1", ln;
1879
1879
  t?.addEventListener("abort", a, { once: !0 });
1880
1880
  });
1881
1881
  }
1882
- e.delay = he;
1883
- function ge(e, t, n, r = R) {
1882
+ e.delay = me;
1883
+ function he(e, t, n, r = R) {
1884
1884
  let i = [];
1885
- return e.getSenders().forEach((e) => _e(t, e, e.track, n, i, r)), i;
1885
+ return e.getSenders().forEach((e) => ge(t, e, e.track, n, i, r)), i;
1886
1886
  }
1887
- e.applySettings = ge;
1888
- function _e(e, t, n, r, i, a = R) {
1887
+ e.applySettings = he;
1888
+ function ge(e, t, n, r, i, a = R) {
1889
1889
  if (!RTCRtpSender.prototype.getParameters || !RTCRtpSender.prototype.setParameters || !e || !n || n.kind !== k.video) return;
1890
1890
  let o = n.getSettings();
1891
1891
  if (!o) return;
@@ -1924,21 +1924,21 @@ var on = 533, sn = "a=fmtp:", cn = "sps-pps-idr-in-keyframe=1", ln;
1924
1924
  a.log(`applyVideoTrackSettings: actual encodings= ${JSON.stringify(e.encodings)}`);
1925
1925
  }
1926
1926
  }
1927
- e.applyVideoTrackSettings = _e;
1928
- function _(e, t) {
1927
+ e.applyVideoTrackSettings = ge;
1928
+ function v(e, t) {
1929
1929
  Array.isArray(t) || (t = [t]);
1930
1930
  for (let n of t) if (e.includes(n)) return !0;
1931
1931
  return !1;
1932
1932
  }
1933
- e.includesOneOf = _;
1934
- function ve(e) {
1933
+ e.includesOneOf = v;
1934
+ function _e(e) {
1935
1935
  return Object.entries(e.participantState?.state || {}).reduce((t, [n, r]) => (e.participantState && (t[n] = {
1936
1936
  ts: e.participantState.stateUpdateTs[n],
1937
1937
  state: r
1938
1938
  }), t), {});
1939
1939
  }
1940
- e.mapParticipantState = ve;
1941
- function ye(e) {
1940
+ e.mapParticipantState = _e;
1941
+ function ve(e) {
1942
1942
  let t = e.map((e) => ({
1943
1943
  uid: e.externalId,
1944
1944
  mediaSettings: e.mediaSettings,
@@ -1952,37 +1952,37 @@ var on = 533, sn = "a=fmtp:", cn = "sps-pps-idr-in-keyframe=1", ln;
1952
1952
  }));
1953
1953
  return M.filterObservers ? t.filter((e) => !e.uid.observer) : t;
1954
1954
  }
1955
- e.mapSharedParticipants = ye;
1956
- function be(e, t) {
1955
+ e.mapSharedParticipants = ve;
1956
+ function ye(e, t) {
1957
1957
  let n = Object.keys(e), r = Object.keys(t);
1958
1958
  if (n.length !== r.length) return !1;
1959
1959
  for (let i of n) if (!Object.hasOwn(r, i) || e[i].state !== t[i].state || e[i].ts !== t[i].ts) return !1;
1960
1960
  return !0;
1961
1961
  }
1962
- e.isEqualParticipantState = be;
1963
- function xe(e, t, n = !1) {
1962
+ e.isEqualParticipantState = ye;
1963
+ function be(e, t, n = !1) {
1964
1964
  let r = Object.keys(e), i = Object.keys(t);
1965
1965
  if (r.length !== i.length) return !1;
1966
1966
  for (let i of r) {
1967
1967
  if (!Object.hasOwn(t, i)) return !1;
1968
1968
  let r = e[i], a = t[i];
1969
- if (n && De(r) && De(a)) return xe(r, a, n);
1969
+ if (n && Ee(r) && Ee(a)) return be(r, a, n);
1970
1970
  if (r !== a) return !1;
1971
1971
  }
1972
1972
  return !0;
1973
1973
  }
1974
- e.isObjectsEquals = xe;
1975
- function Se(e, t) {
1974
+ e.isObjectsEquals = be;
1975
+ function xe(e, t) {
1976
1976
  if (e.length !== t.length) return !1;
1977
1977
  for (let n of e) if (t.indexOf(n) < 0) return !1;
1978
1978
  return !0;
1979
1979
  }
1980
- e.isArraysEquals = Se;
1981
- function Ce(e) {
1980
+ e.isArraysEquals = xe;
1981
+ function Se(e) {
1982
1982
  return !Object.keys(e).length;
1983
1983
  }
1984
- e.isEmptyObject = Ce;
1985
- function we(e, t) {
1984
+ e.isEmptyObject = Se;
1985
+ function Ce(e, t) {
1986
1986
  if (!e && !t) return 0;
1987
1987
  if (!e || !t) return e ? -1 : 1;
1988
1988
  return r(t.rank, e.rank) || r(e.ts, t.ts) || n(e, t);
@@ -1990,24 +1990,24 @@ var on = 533, sn = "a=fmtp:", cn = "sps-pps-idr-in-keyframe=1", ln;
1990
1990
  let n = {
1991
1991
  [A.USER]: 0,
1992
1992
  [A.GROUP]: 1
1993
- }, { 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);
1993
+ }, { 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);
1994
1994
  return r(n[l], n[d]) || r(c, u) || r(a, s);
1995
1995
  }
1996
1996
  function r(e, t) {
1997
1997
  return e < t ? -1 : e === t ? 0 : 1;
1998
1998
  }
1999
1999
  }
2000
- e.participantMarkerCompare = we;
2001
- function Te(e, t) {
2000
+ e.participantMarkerCompare = Ce;
2001
+ function we(e, t) {
2002
2002
  return rn(Object.entries(e).filter(([, e]) => Array.isArray(t) ? !t.includes(e) : e !== t));
2003
2003
  }
2004
- e.objectFilterOutValues = Te;
2005
- function Ee(e, t, n) {
2004
+ e.objectFilterOutValues = we;
2005
+ function Te(e, t, n) {
2006
2006
  let r = n;
2007
2007
  for (let n in e) Object.hasOwn(e, n) && (r = t(r, e[n], n));
2008
2008
  return r;
2009
2009
  }
2010
- e.objectReduce = Ee, e.setImmediate = (() => {
2010
+ e.objectReduce = Te, e.setImmediate = (() => {
2011
2011
  let e = 1, t = {}, n = null;
2012
2012
  return typeof MessageChannel < "u" && (n = new MessageChannel(), n.port1.onmessage = (e) => {
2013
2013
  let n = e.data;
@@ -2023,11 +2023,11 @@ var on = 533, sn = "a=fmtp:", cn = "sps-pps-idr-in-keyframe=1", ln;
2023
2023
  return () => clearTimeout(i);
2024
2024
  };
2025
2025
  })();
2026
- function De(e) {
2026
+ function Ee(e) {
2027
2027
  return typeof e == "object" && !!e && !Array.isArray(e);
2028
2028
  }
2029
- e.isObject = De;
2030
- function Oe(e, n, r, i) {
2029
+ e.isObject = Ee;
2030
+ function De(e, n, r, i) {
2031
2031
  function a(e, t) {
2032
2032
  let n = 0, r = e.length, i = !1;
2033
2033
  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=")) {
@@ -2053,7 +2053,7 @@ var on = 533, sn = "a=fmtp:", cn = "sps-pps-idr-in-keyframe=1", ln;
2053
2053
  }
2054
2054
  return e;
2055
2055
  }
2056
- e.patchSimulcastAnswerSdp = Oe;
2056
+ e.patchSimulcastAnswerSdp = De;
2057
2057
  })(ln || (ln = {}));
2058
2058
  var j = ln, un = "__CALLS_SDK_DEVTOOLS_", dn = class {
2059
2059
  set(e, t) {
@@ -2142,7 +2142,7 @@ var j = ln, un = "__CALLS_SDK_DEVTOOLS_", dn = class {
2142
2142
  h(pn, "instance", null);
2143
2143
  var mn = pn.getInstance(), M = class e {
2144
2144
  static set(t) {
2145
- 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);
2145
+ 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);
2146
2146
  let n = mn.params.applyOverrides(t);
2147
2147
  Object.assign(e._params, j.objectFilterOutValues(n, void 0));
2148
2148
  }
@@ -2159,7 +2159,7 @@ var mn = pn.getInstance(), M = class e {
2159
2159
  return 1.1;
2160
2160
  }
2161
2161
  static get sdkVersion() {
2162
- return "2.8.11-dev.a7bd7233.0";
2162
+ return "2.8.11-dev.a9627477.0";
2163
2163
  }
2164
2164
  static get debug() {
2165
2165
  return e._params.debug;
@@ -2796,251 +2796,251 @@ var gn;
2796
2796
  F("onRemoteSharedUrl", e, t, n, r);
2797
2797
  }
2798
2798
  e.onRemoteSharedUrl = g;
2799
- function se(e, t, n) {
2799
+ function _(e, t, n) {
2800
2800
  F("onParticipantAdded", e, t, n);
2801
2801
  }
2802
- e.onParticipantAdded = se;
2803
- function ce(e, t, n) {
2802
+ e.onParticipantAdded = _;
2803
+ function se(e, t, n) {
2804
2804
  F("onParticipantJoined", e, t, n);
2805
2805
  }
2806
- e.onParticipantJoined = ce;
2807
- function le(e, t = !1, n) {
2806
+ e.onParticipantJoined = se;
2807
+ function ce(e, t = !1, n) {
2808
2808
  P("onLocalParticipantState", I(e), t, n);
2809
2809
  }
2810
- e.onLocalParticipantState = le;
2811
- function ue(e, t, n, r) {
2810
+ e.onLocalParticipantState = ce;
2811
+ function le(e, t, n, r) {
2812
2812
  F("onRemoteParticipantState", e, I(t), n, r);
2813
2813
  }
2814
- e.onRemoteParticipantState = ue;
2815
- function de(e, t, n) {
2814
+ e.onRemoteParticipantState = le;
2815
+ function ue(e, t, n) {
2816
2816
  P("onRemoteParticipantsState", e, t, n);
2817
2817
  }
2818
- e.onRemoteParticipantsState = de;
2819
- function fe(e, t, n = null, r) {
2818
+ e.onRemoteParticipantsState = ue;
2819
+ function de(e, t, n = null, r) {
2820
2820
  R.debug("Remote status:", t, e), F("onRemoteStatus", e, t, n, r);
2821
2821
  }
2822
- e.onRemoteStatus = fe;
2823
- function pe() {
2822
+ e.onRemoteStatus = de;
2823
+ function fe() {
2824
2824
  P("onPermissionsRequested");
2825
2825
  }
2826
- e.onPermissionsRequested = pe;
2827
- function me(e, t) {
2826
+ e.onPermissionsRequested = fe;
2827
+ function pe(e, t) {
2828
2828
  P("onPermissionsError", e, t);
2829
2829
  }
2830
- e.onPermissionsError = me;
2831
- function he(e, t, n) {
2830
+ e.onPermissionsError = pe;
2831
+ function me(e, t, n) {
2832
2832
  F("onRemoteRemoved", e, t, n);
2833
2833
  }
2834
- e.onRemoteRemoved = he;
2835
- function ge(e, t, n, r) {
2834
+ e.onRemoteRemoved = me;
2835
+ function he(e, t, n, r) {
2836
2836
  P("onCallState", e, t, I(n), r);
2837
2837
  }
2838
- e.onCallState = ge;
2839
- function _e(e, t, n) {
2838
+ e.onCallState = he;
2839
+ function ge(e, t, n) {
2840
2840
  P("onDeviceSwitched", e, t, n);
2841
2841
  }
2842
- e.onDeviceSwitched = _e;
2843
- function _(e, t, n, r = !1, i = !1, a = null, o = null, s, c, l = null, u) {
2842
+ e.onDeviceSwitched = ge;
2843
+ function v(e, t, n, r = !1, i = !1, a = null, o = null, s, c, l = null, u) {
2844
2844
  let d = c ? hn(c) : void 0;
2845
2845
  P("onMuteStates", I(e), hn(t), hn(n), r, i, a, o, s, d, l, u);
2846
2846
  }
2847
- e.onMuteStates = _;
2848
- function ve(e, t, n = !1, r) {
2847
+ e.onMuteStates = v;
2848
+ function _e(e, t, n = !1, r) {
2849
2849
  F("onRolesChanged", e, hn(t), n, r);
2850
2850
  }
2851
- e.onRolesChanged = ve;
2852
- function ye(e, t = !1, n) {
2851
+ e.onRolesChanged = _e;
2852
+ function ve(e, t = !1, n) {
2853
2853
  P("onLocalRolesChanged", hn(e), t, n);
2854
2854
  }
2855
- e.onLocalRolesChanged = ye;
2856
- function be(e, t, n, r, i) {
2855
+ e.onLocalRolesChanged = ve;
2856
+ function ye(e, t, n, r, i) {
2857
2857
  F("onPinnedParticipant", e, t, n, r, i);
2858
2858
  }
2859
- e.onPinnedParticipant = be;
2860
- function xe(e, t, n) {
2859
+ e.onPinnedParticipant = ye;
2860
+ function be(e, t, n) {
2861
2861
  P("onLocalPin", e, t, n);
2862
2862
  }
2863
- e.onLocalPin = xe;
2864
- function Se(e, t) {
2863
+ e.onLocalPin = be;
2864
+ function xe(e, t) {
2865
2865
  P("onOptionsChanged", hn(e), t);
2866
2866
  }
2867
- e.onOptionsChanged = Se;
2868
- function Ce(e) {
2867
+ e.onOptionsChanged = xe;
2868
+ function Se(e) {
2869
2869
  P("onCallAccepted", e);
2870
2870
  }
2871
- e.onCallAccepted = Ce;
2872
- function we(e) {
2871
+ e.onCallAccepted = Se;
2872
+ function Ce(e) {
2873
2873
  P("onCallActive", e);
2874
2874
  }
2875
- e.onCallActive = we;
2876
- function Te(e, t, n) {
2875
+ e.onCallActive = Ce;
2876
+ function we(e, t, n) {
2877
2877
  F("onAcceptedCall", e, t, n);
2878
2878
  }
2879
- e.onAcceptedCall = Te;
2880
- function Ee(e) {
2879
+ e.onAcceptedCall = we;
2880
+ function Te(e) {
2881
2881
  P("onRateNeeded", e);
2882
2882
  }
2883
- e.onRateNeeded = Ee;
2884
- function De(e, t) {
2883
+ e.onRateNeeded = Te;
2884
+ function Ee(e, t) {
2885
2885
  F("onSpeakerChanged", e, t);
2886
2886
  }
2887
- e.onSpeakerChanged = De;
2888
- function Oe(e, t) {
2887
+ e.onSpeakerChanged = Ee;
2888
+ function De(e, t) {
2889
2889
  P("onVolumesDetected", hn(e), t);
2890
2890
  }
2891
- e.onVolumesDetected = Oe;
2892
- function ke(e, t) {
2891
+ e.onVolumesDetected = De;
2892
+ function Oe(e, t) {
2893
2893
  P("onLocalVolume", e, t);
2894
2894
  }
2895
- e.onLocalVolume = ke;
2896
- function Ae(e, t, n) {
2895
+ e.onLocalVolume = Oe;
2896
+ function ke(e, t, n) {
2897
2897
  P("onJoinStatus", e, t, n);
2898
2898
  }
2899
- e.onJoinStatus = Ae;
2900
- function je(e, t) {
2899
+ e.onJoinStatus = ke;
2900
+ function Ae(e, t) {
2901
2901
  P("onHangup", e, t);
2902
2902
  }
2903
- e.onHangup = je;
2904
- function Me(e) {
2903
+ e.onHangup = Ae;
2904
+ function je(e) {
2905
2905
  P("onMultipartyChatCreated", I(e));
2906
2906
  }
2907
- e.onMultipartyChatCreated = Me;
2908
- function Ne() {
2907
+ e.onMultipartyChatCreated = je;
2908
+ function Me() {
2909
2909
  P("onDeviceChange");
2910
2910
  }
2911
- e.onDeviceChange = Ne;
2912
- function Pe(e) {
2911
+ e.onDeviceChange = Me;
2912
+ function Ne(e) {
2913
2913
  P("onFingerprintChange", e);
2914
2914
  }
2915
- e.onFingerprintChange = Pe;
2916
- function Fe() {
2915
+ e.onFingerprintChange = Ne;
2916
+ function Pe() {
2917
2917
  P("onTokenExpired");
2918
2918
  }
2919
- e.onTokenExpired = Fe;
2920
- function Ie(e, t, n = !1, r) {
2919
+ e.onTokenExpired = Pe;
2920
+ function Fe(e, t, n = !1, r) {
2921
2921
  P("onChatMessage", e, t, n, r);
2922
2922
  }
2923
- e.onChatMessage = Ie;
2924
- function Le(e, t, n = !1, r) {
2923
+ e.onChatMessage = Fe;
2924
+ function Ie(e, t, n = !1, r) {
2925
2925
  P("onCustomData", e, t, n, r);
2926
2926
  }
2927
- e.onCustomData = Le;
2928
- function Re(e, t, n, r, i, a, o = null, s) {
2927
+ e.onCustomData = Ie;
2928
+ function Le(e, t, n, r, i, a, o = null, s) {
2929
2929
  P("onRecordStarted", e, t, n, r, i, a, o, s);
2930
2930
  }
2931
- e.onRecordStarted = Re;
2932
- function ze(e = null, t, n) {
2931
+ e.onRecordStarted = Le;
2932
+ function Re(e = null, t, n) {
2933
2933
  P("onRecordStopped", e, t, n);
2934
2934
  }
2935
- e.onRecordStopped = ze;
2936
- function Be(e, t) {
2935
+ e.onRecordStopped = Re;
2936
+ function ze(e, t) {
2937
2937
  P("onLocalNetworkStatusChanged", e, t);
2938
2938
  }
2939
- e.onLocalNetworkStatusChanged = Be;
2940
- function Ve(e, t) {
2939
+ e.onLocalNetworkStatusChanged = ze;
2940
+ function Be(e, t) {
2941
2941
  P("onNetworkStatusChanged", e, t);
2942
2942
  }
2943
- e.onNetworkStatusChanged = Ve;
2944
- function He(e, ...t) {
2943
+ e.onNetworkStatusChanged = Be;
2944
+ function Ve(e, ...t) {
2945
2945
  P("onDebugMessage", e, ...t);
2946
2946
  }
2947
- e.onDebugMessage = He;
2948
- function Ue(e, t, ...n) {
2947
+ e.onDebugMessage = Ve;
2948
+ function He(e, t, ...n) {
2949
2949
  P("onDebugMessageWithContext", e, t, ...n);
2950
2950
  }
2951
- e.onDebugMessageWithContext = Ue;
2952
- function We(e, t) {
2951
+ e.onDebugMessageWithContext = He;
2952
+ function Ue(e, t) {
2953
2953
  P("onStatistics", Object.assign({}, e, { memory: t }));
2954
2954
  }
2955
- e.onStatistics = We;
2956
- function Ge() {
2955
+ e.onStatistics = Ue;
2956
+ function We() {
2957
2957
  P("onAutoplayError");
2958
2958
  }
2959
- e.onAutoplayError = Ge;
2960
- function Ke(e, t, n, r, i, a) {
2959
+ e.onAutoplayError = We;
2960
+ function Ge(e, t, n, r, i, a) {
2961
2961
  P("onChatRoomUpdated", e, t, n, r, i, a);
2962
2962
  }
2963
- e.onChatRoomUpdated = Ke;
2964
- function qe(e, t) {
2963
+ e.onChatRoomUpdated = Ge;
2964
+ function Ke(e, t) {
2965
2965
  P("onPromoted", e, t);
2966
2966
  }
2967
- e.onPromoted = qe;
2968
- function Je(e, t) {
2967
+ e.onPromoted = Ke;
2968
+ function qe(e, t) {
2969
2969
  P("onRemoteMixedAudioStream", e, t);
2970
2970
  }
2971
- e.onRemoteMixedAudioStream = Je;
2972
- function v(e, t) {
2971
+ e.onRemoteMixedAudioStream = qe;
2972
+ function y(e, t) {
2973
2973
  P("onJoinLinkChanged", e, t);
2974
2974
  }
2975
- e.onJoinLinkChanged = v;
2976
- function y(e, t) {
2975
+ e.onJoinLinkChanged = y;
2976
+ function b(e, t) {
2977
2977
  P("onRoomsUpdated", e, t);
2978
2978
  }
2979
- e.onRoomsUpdated = y;
2980
- function b(e, t, n, r, i) {
2979
+ e.onRoomsUpdated = b;
2980
+ function x(e, t, n, r, i) {
2981
2981
  P("onRoomUpdated", e, t, n, r, i);
2982
2982
  }
2983
- e.onRoomUpdated = b;
2984
- function x(e, t) {
2983
+ e.onRoomUpdated = x;
2984
+ function S(e, t) {
2985
2985
  P("onRoomParticipantsUpdated", e, t);
2986
2986
  }
2987
- e.onRoomParticipantsUpdated = x;
2988
- function S(e, t) {
2987
+ e.onRoomParticipantsUpdated = S;
2988
+ function C(e, t) {
2989
2989
  P("onRoomSwitched", e, t);
2990
2990
  }
2991
- e.onRoomSwitched = S;
2992
- function Ye(e, t) {
2991
+ e.onRoomSwitched = C;
2992
+ function Je(e, t) {
2993
2993
  P("onRoomStart", e, t);
2994
2994
  }
2995
- e.onRoomStart = Ye;
2996
- function Xe(e, t = null, n) {
2995
+ e.onRoomStart = Je;
2996
+ function Ye(e, t = null, n) {
2997
2997
  P("onFeedback", e, t, n);
2998
2998
  }
2999
- e.onFeedback = Xe;
3000
- function Ze(e, t) {
2999
+ e.onFeedback = Ye;
3000
+ function Xe(e, t) {
3001
3001
  P("onFeaturesPerRoleChanged", e, t);
3002
3002
  }
3003
- e.onFeaturesPerRoleChanged = Ze;
3004
- function Qe(e, t) {
3003
+ e.onFeaturesPerRoleChanged = Xe;
3004
+ function Ze(e, t) {
3005
3005
  P("onParticipantVmojiUpdate", e, t);
3006
3006
  }
3007
- e.onParticipantVmojiUpdate = Qe;
3008
- function $e(e, t, n) {
3007
+ e.onParticipantVmojiUpdate = Ze;
3008
+ function Qe(e, t, n) {
3009
3009
  P("onAsrSet", e, t, n);
3010
3010
  }
3011
- e.onAsrSet = $e;
3012
- function et(e, t, n, r) {
3011
+ e.onAsrSet = Qe;
3012
+ function $e(e, t, n, r) {
3013
3013
  P("onAsrStarted", e, t, n, r);
3014
3014
  }
3015
- e.onAsrStarted = et;
3016
- function tt(e, t) {
3015
+ e.onAsrStarted = $e;
3016
+ function et(e, t) {
3017
3017
  P("onAsrStopped", e, t);
3018
3018
  }
3019
- e.onAsrStopped = tt;
3020
- function nt(e, t, n, r, i) {
3019
+ e.onAsrStopped = et;
3020
+ function tt(e, t, n, r, i) {
3021
3021
  P("onAsrTranscription", e, t, n, r, i);
3022
3022
  }
3023
- e.onAsrTranscription = nt;
3024
- function rt(e, t, n) {
3023
+ e.onAsrTranscription = tt;
3024
+ function nt(e, t, n) {
3025
3025
  P("onParticipantIdChanged", e, t, n);
3026
3026
  }
3027
- e.onParticipantIdChanged = rt;
3028
- function it(e, t) {
3027
+ e.onParticipantIdChanged = nt;
3028
+ function rt(e, t) {
3029
3029
  P("onVideoSuspendSuggest", e, t);
3030
3030
  }
3031
- e.onVideoSuspendSuggest = it;
3032
- function at(e) {
3031
+ e.onVideoSuspendSuggest = rt;
3032
+ function it(e) {
3033
3033
  P("onSignalingMessage", typeof e == "string" ? e : I(e));
3034
3034
  }
3035
- e.onSignalingMessage = at;
3036
- function ot(e, t) {
3035
+ e.onSignalingMessage = it;
3036
+ function at(e, t) {
3037
3037
  P("onPromotionApproved", e, t);
3038
3038
  }
3039
- e.onPromotionApproved = ot;
3040
- function st(e) {
3039
+ e.onPromotionApproved = at;
3040
+ function ot(e) {
3041
3041
  P("onPeerRegistered", e);
3042
3042
  }
3043
- e.onPeerRegistered = st;
3043
+ e.onPeerRegistered = ot;
3044
3044
  })(gn || (gn = {}));
3045
3045
  var L = gn, _n = /* @__PURE__ */ function(e) {
3046
3046
  return e.DEBUG = "DEBUG", e.LOG = "LOG", e.WARN = "WARN", e.ERROR = "ERROR", e;
@@ -3062,7 +3062,7 @@ var L = gn, _n = /* @__PURE__ */ function(e) {
3062
3062
  }
3063
3063
  function u(e, t, n) {
3064
3064
  let u = l(n);
3065
- if (M.debugLog && Ae(e, t, u.sessionId || void 0), c) switch (e) {
3065
+ if (M.debugLog && ke(e, t, u.sessionId || void 0), c) switch (e) {
3066
3066
  case "DEBUG":
3067
3067
  i(...t);
3068
3068
  break;
@@ -3099,7 +3099,7 @@ var L = gn, _n = /* @__PURE__ */ function(e) {
3099
3099
  }
3100
3100
  e.enabled = ee;
3101
3101
  function h(e) {
3102
- c = e, M.debugLog && je();
3102
+ c = e, M.debugLog && Ae();
3103
3103
  }
3104
3104
  e.toggle = h;
3105
3105
  function te(e, ...t) {
@@ -3131,7 +3131,7 @@ var L = gn, _n = /* @__PURE__ */ function(e) {
3131
3131
  function re(e = null) {
3132
3132
  let t = null, n = e;
3133
3133
  function r() {
3134
- !M.debugLog || t || (t = Me(), n && Ne(n, t));
3134
+ !M.debugLog || t || (t = je(), n && Me(n, t));
3135
3135
  }
3136
3136
  let i = () => (r(), {
3137
3137
  sessionId: t,
@@ -3145,7 +3145,7 @@ var L = gn, _n = /* @__PURE__ */ function(e) {
3145
3145
  return n;
3146
3146
  },
3147
3147
  setConversationId(e) {
3148
- n = e, t && Ne(n, t);
3148
+ n = e, t && Me(n, t);
3149
3149
  },
3150
3150
  debug: (...e) => u("DEBUG", e, i),
3151
3151
  log: (...e) => u("LOG", e, i),
@@ -3174,6 +3174,10 @@ var R = vn, z = new class {
3174
3174
  getActive() {
3175
3175
  return this._activeId ? this._conversations.get(this._activeId) ?? null : null;
3176
3176
  }
3177
+ getFirstHeld() {
3178
+ for (let e of this._conversations.values()) if (e.isCallHeld) return e;
3179
+ return null;
3180
+ }
3177
3181
  getActiveId() {
3178
3182
  return this._activeId;
3179
3183
  }
@@ -3233,7 +3237,7 @@ var R = vn, z = new class {
3233
3237
  clear() {
3234
3238
  this._conversations.clear(), this._activeId = null;
3235
3239
  }
3236
- }(), yn = class extends y {
3240
+ }(), yn = class extends b {
3237
3241
  constructor(...e) {
3238
3242
  super(...e), h(this, "_abortSignal", void 0);
3239
3243
  }
@@ -3773,7 +3777,7 @@ function Cr() {
3773
3777
  }
3774
3778
  //#endregion
3775
3779
  //#region src/classes/transport/BaseTransport.ts
3776
- var wr = class extends y {
3780
+ var wr = class extends b {
3777
3781
  constructor(e, t) {
3778
3782
  super(), h(this, "_signaling", void 0), h(this, "_mediaSource", void 0), h(this, "_state", K.IDLE), h(this, "_pc", null), this._signaling = e, this._mediaSource = t;
3779
3783
  }
@@ -3798,7 +3802,7 @@ var wr = class extends y {
3798
3802
  getValue() {
3799
3803
  return this.value;
3800
3804
  }
3801
- }, Er = .25, Dr = .35, Or = 85, kr = .1, Ar = 1.5, jr = .1, Mr = 1, Nr = .6, Pr = .3, Fr = class extends y {
3805
+ }, Er = .25, Dr = .35, Or = 85, kr = .1, Ar = 1.5, jr = .1, Mr = 1, Nr = .6, Pr = .3, Fr = class extends b {
3802
3806
  constructor(e, t = R) {
3803
3807
  super(), h(this, "_signaling", void 0), h(this, "_localNetworkStat", void 0), h(this, "_remoteNetworkStat", void 0), h(this, "_lastNetworkStat", void 0), h(this, "_networkLimits", {
3804
3808
  badNet: {
@@ -3904,7 +3908,7 @@ var wr = class extends y {
3904
3908
  try {
3905
3909
  this._mediaSource.addTrackToPeerConnection(this._pc, !1, !0), this._applySettings();
3906
3910
  } catch (e) {
3907
- this._logger?.log(S.ERROR, "addTrack-direct"), this._debug.error("Unable to add media source tracks", e, { participantId: this._participantId }), this._failedOnCreate = e;
3911
+ this._logger?.log(C.ERROR, "addTrack-direct"), this._debug.error("Unable to add media source tracks", e, { participantId: this._participantId }), this._failedOnCreate = e;
3908
3912
  return;
3909
3913
  }
3910
3914
  this._createOffer(!1).catch((e) => {
@@ -3938,7 +3942,7 @@ var wr = class extends y {
3938
3942
  if (this._debug.debug("DirectTransport: Open transport", { participantId: this._participantId }), this._isOpen = !0, this._remotePeerId = e, !this._isMaster) try {
3939
3943
  this._mediaSource.addTrackToPeerConnection(this._pc, !1, !0), this._applySettings();
3940
3944
  } catch (e) {
3941
- this._logger?.log(S.ERROR, "addTrack-direct"), this._debug.error("DirectTransport: Unable to add media source tracks", e, { participantId: this._participantId }), this.close(e);
3945
+ this._logger?.log(C.ERROR, "addTrack-direct"), this._debug.error("DirectTransport: Unable to add media source tracks", e, { participantId: this._participantId }), this.close(e);
3942
3946
  return;
3943
3947
  }
3944
3948
  this._setState(K.OPENED);
@@ -4004,7 +4008,7 @@ var wr = class extends y {
4004
4008
  try {
4005
4009
  await this._pc.addIceCandidate(new RTCIceCandidate(t));
4006
4010
  } catch (e) {
4007
- throw this._logger?.log(S.ERROR, "addIceCandidate-direct"), this._debug.error("Unable to add remote ice candidate", e, {
4011
+ throw this._logger?.log(C.ERROR, "addIceCandidate-direct"), this._debug.error("Unable to add remote ice candidate", e, {
4008
4012
  participantId: this._participantId,
4009
4013
  candidate: t
4010
4014
  }), e;
@@ -4035,7 +4039,7 @@ var wr = class extends y {
4035
4039
  try {
4036
4040
  await this._pc.setRemoteDescription(n), await this._setRemoteCandidates(t), this._processAnimojiProtocolVersion(this._remoteAnimojiVersion);
4037
4041
  } catch (e) {
4038
- throw this._logger?.log(S.ERROR, "setRemoteDescription-direct"), this._debug.error("Unable to set remote description", e, {
4042
+ throw this._logger?.log(C.ERROR, "setRemoteDescription-direct"), this._debug.error("Unable to set remote description", e, {
4039
4043
  participantId: this._participantId,
4040
4044
  sdp: n
4041
4045
  }), e;
@@ -4087,11 +4091,11 @@ var wr = class extends y {
4087
4091
  }
4088
4092
  _markConnected() {
4089
4093
  this._neverConnected = !1, this._setState(K.CONNECTED), this._stopReconnection(), this._pc && j.getPeerConnectionHostInfo(this._pc).then((e) => {
4090
- e?.local && (this._logger?.log(S.ICE_CONNECTION_TYPE, e.local.type), this._debug.debug("Selected ICE candidates", e));
4094
+ e?.local && (this._logger?.log(C.ICE_CONNECTION_TYPE, e.local.type), this._debug.debug("Selected ICE candidates", e));
4091
4095
  }), this._startStatInterval();
4092
4096
  }
4093
4097
  _onConnectionStateChange() {
4094
- 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) {
4098
+ 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) {
4095
4099
  case "connected":
4096
4100
  this._markConnected();
4097
4101
  break;
@@ -4116,8 +4120,8 @@ var wr = class extends y {
4116
4120
  this._reconnectionTimeout && (clearTimeout(this._reconnectionTimeout), this._reconnectionTimeout = null), this._iceRestartTimeout && (clearTimeout(this._iceRestartTimeout), this._iceRestartTimeout = null);
4117
4121
  }
4118
4122
  _startIceRestart() {
4119
- 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(() => {
4120
- this._iceRestartTimeout = null, this._debug.error("Ice restart failed", { participantId: this._participantId }), this._logger?.log(S.ERROR, "iceRestart-direct"), this._requestTopologySwitch();
4123
+ 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(() => {
4124
+ this._iceRestartTimeout = null, this._debug.error("Ice restart failed", { participantId: this._participantId }), this._logger?.log(C.ERROR, "iceRestart-direct"), this._requestTopologySwitch();
4121
4125
  }, M.iceRestartWaitTime);
4122
4126
  }
4123
4127
  async _createOffer(t) {
@@ -4137,7 +4141,7 @@ var wr = class extends y {
4137
4141
  offer: r
4138
4142
  }), r = e._patchLocalDescription(r);
4139
4143
  } catch (e) {
4140
- throw this._debug.error("Unable to create offer", e, { participantId: this._participantId }), this._logger?.log(S.ERROR, "createOffer-direct"), e;
4144
+ throw this._debug.error("Unable to create offer", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "createOffer-direct"), e;
4141
4145
  }
4142
4146
  try {
4143
4147
  return this._debug.debug("Set local description", {
@@ -4145,7 +4149,7 @@ var wr = class extends y {
4145
4149
  offer: r
4146
4150
  }), this._calcFingerprint(r.sdp), await this._pc?.setLocalDescription(r), r;
4147
4151
  } catch (e) {
4148
- throw this._debug.error("Unable to set local description", e, { participantId: this._participantId }), this._logger?.log(S.ERROR, "setLocalDescription-direct"), e;
4152
+ throw this._debug.error("Unable to set local description", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "setLocalDescription-direct"), e;
4149
4153
  }
4150
4154
  }
4151
4155
  async _createAnswer() {
@@ -4157,7 +4161,7 @@ var wr = class extends y {
4157
4161
  answer: t
4158
4162
  }), t = e._patchLocalDescription(t);
4159
4163
  } catch (e) {
4160
- throw this._debug.error("Unable to create answer", e, { participantId: this._participantId }), this._logger?.log(S.ERROR, "createAnswer-direct"), e;
4164
+ throw this._debug.error("Unable to create answer", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "createAnswer-direct"), e;
4161
4165
  }
4162
4166
  try {
4163
4167
  return this._debug.debug("Set local description", {
@@ -4165,7 +4169,7 @@ var wr = class extends y {
4165
4169
  answer: t
4166
4170
  }), this._calcFingerprint(t.sdp), await this._pc?.setLocalDescription(t), t;
4167
4171
  } catch (e) {
4168
- throw this._debug.error("Unable to set local description", e, { participantId: this._participantId }), this._logger?.log(S.ERROR, "setLocalDescription-direct"), e;
4172
+ throw this._debug.error("Unable to set local description", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "setLocalDescription-direct"), e;
4169
4173
  }
4170
4174
  }
4171
4175
  static _patchLocalDescription(e) {
@@ -4178,7 +4182,7 @@ var wr = class extends y {
4178
4182
  _onReplacedTrack(e) {
4179
4183
  this._pc && (this._pc.getSenders().forEach((t) => {
4180
4184
  t.track && t.track.kind === e.kind && t.track.contentHint === e.contentHint && t.replaceTrack(e).catch((e) => {
4181
- this._debug.error("DirectTransport: Unable to replace track", e, { participantId: this._participantId }), this._logger?.log(S.ERROR, "replaceTrack-direct");
4185
+ this._debug.error("DirectTransport: Unable to replace track", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "replaceTrack-direct");
4182
4186
  });
4183
4187
  }), this._applySettings());
4184
4188
  }
@@ -4509,7 +4513,7 @@ var Ur = class {
4509
4513
  this._debug.debug(e.data.message);
4510
4514
  break;
4511
4515
  case Wr.LOG_ERROR:
4512
- this._logger?.log(S.ERROR, e.data.message);
4516
+ this._logger?.log(C.ERROR, e.data.message);
4513
4517
  break;
4514
4518
  }
4515
4519
  }, this._sendToWorker(Wr.INIT, r, i);
@@ -5569,7 +5573,7 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
5569
5573
  try {
5570
5574
  this._mediaSource.addTrackToPeerConnection(this._pc, this._observer, !1), this._prevConsumerSettings = {}, this._prevConsumerFastSharingSettings = {}, this._applyConsumerSettings();
5571
5575
  } catch (e) {
5572
- this._debug.error("ServerTransport: Unable to add media source tracks", e), this._logger?.log(S.ERROR, "addTrack-single"), this.close(e);
5576
+ this._debug.error("ServerTransport: Unable to add media source tracks", e), this._logger?.log(C.ERROR, "addTrack-single"), this.close(e);
5573
5577
  return;
5574
5578
  }
5575
5579
  this._createDataChannel(this._pc, gr.consumerScreenShare, (e) => {
@@ -5741,7 +5745,7 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
5741
5745
  try {
5742
5746
  await this._pc.setRemoteDescription(e);
5743
5747
  } catch (e) {
5744
- throw this._debug.error("[single] unable to set remote offer", e), this._logger?.log(S.ERROR, "setRemoteDescription-single"), e;
5748
+ throw this._debug.error("[single] unable to set remote offer", e), this._logger?.log(C.ERROR, "setRemoteDescription-single"), e;
5745
5749
  }
5746
5750
  let r = this._findFirstSimTransceiver();
5747
5751
  if (M.simulcast) if (r) {
@@ -5754,13 +5758,13 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
5754
5758
  if (await this._handleTracks(), this._debug.debug("[single] create local answer"), !this._pc) throw Error("Interrupt allocation");
5755
5759
  i = await this._pc.createAnswer();
5756
5760
  } catch (e) {
5757
- throw this._debug.error("[single] unable to create answer", e), this._logger?.log(S.ERROR, "createAnswer-single"), e;
5761
+ throw this._debug.error("[single] unable to create answer", e), this._logger?.log(C.ERROR, "createAnswer-single"), e;
5758
5762
  }
5759
5763
  try {
5760
5764
  if (!this._pc) throw Error("Interrupt allocation");
5761
5765
  i.sdp = j.patchLocalSDP(i.sdp, !1, T.isBrokenH264Decoder(), !1), this._debug.debug("[single] set local answer", { answer: i }), await this._pc.setLocalDescription(i);
5762
5766
  } catch (e) {
5763
- throw this._debug.error("[single] unable to set local answer", e), this._logger?.log(S.ERROR, "setLocalDescription-single"), e;
5767
+ throw this._debug.error("[single] unable to set local answer", e), this._logger?.log(C.ERROR, "setLocalDescription-single"), e;
5764
5768
  }
5765
5769
  if (n && r) {
5766
5770
  i.sdp = j.patchSimulcastAnswerSdp(i.sdp, r, Yt.WIDTH, Yt.HEIGHT);
@@ -5769,7 +5773,7 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
5769
5773
  try {
5770
5774
  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");
5771
5775
  } catch (e) {
5772
- this._debug.warn("[single] unable to send local answer", e), this._logger?.log(S.ERROR, "acceptProducer");
5776
+ this._debug.warn("[single] unable to send local answer", e), this._logger?.log(C.ERROR, "acceptProducer");
5773
5777
  }
5774
5778
  n && await this._changeSimulcastInfo(!0, !0);
5775
5779
  }
@@ -5843,7 +5847,7 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
5843
5847
  try {
5844
5848
  e.direction = "sendonly", await e.sender.replaceTrack(this._newAudioShareTrack), this._newAudioShareTrack = null;
5845
5849
  } catch (e) {
5846
- this._debug.error("ServerTransport: Unable to replace track", e), this._logger?.log(S.ERROR, "replaceTrack-single");
5850
+ this._debug.error("ServerTransport: Unable to replace track", e), this._logger?.log(C.ERROR, "replaceTrack-single");
5847
5851
  }
5848
5852
  }
5849
5853
  async _handleScreenShareTrack() {
@@ -5888,7 +5892,7 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
5888
5892
  this._debug.debug("[single] signaling state changed", { state: e.signalingState }, t);
5889
5893
  }
5890
5894
  _onConnectionStateChange(e, t) {
5891
- switch (this._debug.debug("[single] connection state changed", { state: e.connectionState }, t), this._logger?.log(S.ICE_CONNECTION_STATE, e.connectionState), e.connectionState) {
5895
+ switch (this._debug.debug("[single] connection state changed", { state: e.connectionState }, t), this._logger?.log(C.ICE_CONNECTION_STATE, e.connectionState), e.connectionState) {
5892
5896
  case "failed":
5893
5897
  this._reconnectionPrevented ? this.close(/* @__PURE__ */ Error("Ice connection failed")) : this._reconnect();
5894
5898
  break;
@@ -5901,7 +5905,7 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
5901
5905
  break;
5902
5906
  case "connected":
5903
5907
  this._setState(K.CONNECTED), j.getPeerConnectionHostInfo(e).then((e) => {
5904
- e?.local && (this._logger?.log(S.ICE_CONNECTION_TYPE, e.local.type), this._debug.debug("Selected ICE candidates", e));
5908
+ e?.local && (this._logger?.log(C.ICE_CONNECTION_TYPE, e.local.type), this._debug.debug("Selected ICE candidates", e));
5905
5909
  });
5906
5910
  break;
5907
5911
  }
@@ -5911,7 +5915,7 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
5911
5915
  this._debug.debug(`_onReplacedTrack: newTrack=${e}, sendTrack=${t}`), t && (e = t);
5912
5916
  let n = (e, t) => {
5913
5917
  e.replaceTrack(t).catch((e) => {
5914
- this._debug.error("ServerTransport: Unable to replace track", e), this._logger?.log(S.ERROR, "replaceTrack-single");
5918
+ this._debug.error("ServerTransport: Unable to replace track", e), this._logger?.log(C.ERROR, "replaceTrack-single");
5915
5919
  });
5916
5920
  };
5917
5921
  if (this._debug.log(`_onReplacedTrack: newTrack=${e.getSettings().width}x${e.getSettings().height}`), M.simulcast && e.kind === k.video) {
@@ -5928,14 +5932,14 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
5928
5932
  e === k.screen && M.consumerFastScreenShare && this._mediaSource.mediaSettings.isFastScreenSharingEnabled && await this._replaceScreenShareTrack(), this._applyConsumerSettings();
5929
5933
  }
5930
5934
  getStreamWaitingTimeMs(e, t) {
5931
- 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;
5932
- 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;
5935
+ 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;
5936
+ 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;
5933
5937
  let n = this._rtpReceiversByStreamId[e];
5934
- 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;
5938
+ 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;
5935
5939
  let r = n.getSynchronizationSources();
5936
5940
  if (!r || !r.length) return this._debug.log(`Cannot get stream waiting time, ${e} receiver has no synchronization sources`), 0;
5937
5941
  let i = r[0].rtpTimestamp;
5938
- 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;
5942
+ 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;
5939
5943
  let a = t - i & Qi, o = Math.ceil(a / Zi);
5940
5944
  return Math.min(100, Math.max(0, o));
5941
5945
  }
@@ -5996,7 +6000,7 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
5996
6000
  }
5997
6001
  }, J = /* @__PURE__ */ function(e) {
5998
6002
  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;
5999
- }({}), ea = class extends y {
6003
+ }({}), ea = class extends b {
6000
6004
  constructor(e, t, n, r, i = R, a = null, o = null, s = null) {
6001
6005
  super(), h(this, "_signaling", void 0), h(this, "_mediaSource", void 0), h(this, "_topology", void 0), h(this, "_allocated", []), h(this, "_opened", []), h(this, "_directTransport", null), h(this, "_serverTransport", null), h(this, "_serverSettings", void 0), h(this, "_dtListeners", []), h(this, "_stListeners", []), h(this, "_states", {}), h(this, "_localState", K.IDLE), h(this, "_animojiReceiver", null), h(this, "_animojiSender", null), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_codecStatsAggregator", void 0), this._signaling = t, this._mediaSource = n, this._topology = e, this._serverSettings = r, this._debug = i, this._logger = a, this._statAggregator = o, this._codecStatsAggregator = s, this.subscribe(this._signaling, fr.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, Kt.ANIMOJI_STATUS, this._onAnimojiStatus.bind(this)), this.subscribe(this._mediaSource, Kt.SOURCE_CHANGED, this._onSourceChanged.bind(this)), this._createAnimojiTransport(), e === q.SERVER && (this._serverTransport = this._createServerTransport());
6002
6006
  }
@@ -6078,7 +6082,7 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
6078
6082
  }
6079
6083
  _onTopologyChanged(e) {
6080
6084
  if (e.topology !== this._topology) {
6081
- 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 === q.SERVER && (this._serverTransport ? this._serverTransport.allowRestart() : (this._serverTransport = this._createServerTransport(), this._opened.length > 0 && (this._directTransport?.preventRestart(), this._serverTransport.open()))), this._topology === q.DIRECT) {
6085
+ 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 === q.SERVER && (this._serverTransport ? this._serverTransport.allowRestart() : (this._serverTransport = this._createServerTransport(), this._opened.length > 0 && (this._directTransport?.preventRestart(), this._serverTransport.open()))), this._topology === q.DIRECT) {
6082
6086
  let t = e.offerTo || [], n = e.offerToTypes || [], r = e.offerToDeviceIdxs || [], i = t.length && n.length ? j.composeParticipantId(t[0], n[0], r[0]) : null;
6083
6087
  if (this._serverTransport && this._serverTransport.preventRestart(), !this._allocated || this._allocated.length === 0) {
6084
6088
  this._debug.error("Topology changed to DIRECT, but the list of allocated participants is empty");
@@ -6186,9 +6190,9 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
6186
6190
  this._animojiSender?.destroy(), this._animojiSender = null, this._animojiReceiver?.destroy(), this._animojiReceiver = null;
6187
6191
  }
6188
6192
  getStreamWaitingTimeMs(e, t) {
6189
- return this._topology === q.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);
6193
+ return this._topology === q.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);
6190
6194
  }
6191
- }, ta = "videochat-epi", na = 5e3, ra = 500, ia = class extends y {
6195
+ }, ta = "videochat-epi", na = 5e3, ra = 500, ia = class extends b {
6192
6196
  constructor(e, t, n = null, r = !1, i = R) {
6193
6197
  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) => {
6194
6198
  this._screenShareStats.push(e);
@@ -6476,7 +6480,7 @@ var ua = la, da = {
6476
6480
  }
6477
6481
  }, xa = class {
6478
6482
  constructor(e, t = {}) {
6479
- h(this, "webTransport", void 0), h(this, "stream", null), h(this, "writer", null), h(this, "reader", 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, "onopen", null), h(this, "onmessage", null), h(this, "onerror", null), h(this, "onclose", null), h(this, "readyState", WebSocket.CONNECTING), this.url = e, this.options = t, this.readyState = WebSocket.CONNECTING, this.compression = this.getCompressionTypeFromUrl(e), this.encoder = new ya(this.compression), this.decoder = new ba(this.compression), this.connect();
6483
+ h(this, "webTransport", void 0), h(this, "stream", null), h(this, "writer", null), h(this, "reader", null), h(this, "url", void 0), h(this, "options", void 0), h(this, "compression", void 0), h(this, "closeRequested", null), h(this, "closeEventEmitted", !1), h(this, "encoder", void 0), h(this, "decoder", void 0), h(this, "onopen", null), h(this, "onmessage", null), h(this, "onerror", null), h(this, "onclose", null), h(this, "readyState", WebSocket.CONNECTING), this.url = e, this.options = t, this.readyState = WebSocket.CONNECTING, this.compression = this.getCompressionTypeFromUrl(e), this.encoder = new ya(this.compression), this.decoder = new ba(this.compression), this.connect();
6480
6484
  }
6481
6485
  getCompressionTypeFromUrl(e) {
6482
6486
  try {
@@ -6493,8 +6497,16 @@ var ua = la, da = {
6493
6497
  }
6494
6498
  async connect() {
6495
6499
  try {
6496
- this.webTransport = new WebTransport(this.url, { ...this.options }), await this.webTransport.ready, R.debug("[WebTransport] WebTransport connected to " + this.url), this.stream = await this.webTransport.createBidirectionalStream(), this.writer = this.stream.writable.getWriter(), this.reader = this.stream.readable.getReader(), this.readyState = WebSocket.OPEN, this.onopen?.(new Event("open")), await this.readLoop();
6500
+ if (this.webTransport = new WebTransport(this.url, { ...this.options }), await this.webTransport.ready, this.closeRequested) {
6501
+ this.closeConnectedTransport(this.closeRequested.code, this.closeRequested.reason);
6502
+ return;
6503
+ }
6504
+ R.debug("[WebTransport] WebTransport connected to " + this.url), this.stream = await this.webTransport.createBidirectionalStream(), this.writer = this.stream.writable.getWriter(), this.reader = this.stream.readable.getReader(), this.readyState = WebSocket.OPEN, this.onopen?.(new Event("open")), await this.readLoop();
6497
6505
  } catch (e) {
6506
+ if (this.closeRequested) {
6507
+ this.readyState = WebSocket.CLOSED, this.emitClose(this.closeRequested.code, this.closeRequested.reason);
6508
+ return;
6509
+ }
6498
6510
  R.error("[WebTransport] WebTransport connection failed. This will cause fallback to WebSocket", e), this.readyState = WebSocket.CLOSED, this.onerror?.(this.createErrorEvent(e, "connect")), this.onclose?.(new CloseEvent("close", {
6499
6511
  code: 1006,
6500
6512
  reason: "Connection Failed"
@@ -6552,57 +6564,197 @@ var ua = la, da = {
6552
6564
  }
6553
6565
  close(e = 1e3, t) {
6554
6566
  if (!(this.readyState === WebSocket.CLOSED || this.readyState === WebSocket.CLOSING)) {
6567
+ if (this.closeRequested = {
6568
+ code: e,
6569
+ reason: t
6570
+ }, this.readyState === WebSocket.CONNECTING) {
6571
+ this.readyState = WebSocket.CLOSING;
6572
+ return;
6573
+ }
6574
+ this.closeConnectedTransport(e, t);
6575
+ }
6576
+ }
6577
+ closeConnectedTransport(e = 1e3, t) {
6578
+ if (this.readyState !== WebSocket.CLOSED) {
6555
6579
  this.readyState = WebSocket.CLOSING, this.reader?.cancel();
6556
6580
  try {
6557
6581
  this.webTransport.close();
6558
6582
  } catch (e) {
6559
6583
  R.warn("[WebTransport] already closed. Did we get a STOP_SENDING? ignore", e);
6560
6584
  }
6561
- this.readyState = WebSocket.CLOSED, this.onclose?.(new CloseEvent("close", {
6562
- code: e,
6563
- reason: t
6564
- })), this.webTransport.closed.then(() => {
6585
+ this.readyState = WebSocket.CLOSED, this.emitClose(e, t), this.webTransport.closed.then(() => {
6565
6586
  this.writer = null, this.reader = null, this.stream = null;
6566
6587
  });
6567
6588
  }
6568
6589
  }
6590
+ emitClose(e, t) {
6591
+ this.closeEventEmitted || (this.closeEventEmitted = !0, this.onclose?.(new CloseEvent("close", {
6592
+ code: e,
6593
+ reason: t
6594
+ })));
6595
+ }
6569
6596
  static isBrowserSupported() {
6570
6597
  return "WebTransport" in window && typeof WebTransport == "function" ? T.browserName() === "Firefox" ? M.webtransportFF : T.browserName() !== "Safari" : !1;
6571
6598
  }
6572
- }, Sa = "open", Ca = 10, wa = [
6573
- "service-unavailable",
6574
- "conversation-ended",
6575
- "invalid-token"
6576
- ], Ta = class e extends yn {
6577
- static get RECONNECT_DELAY() {
6578
- return M.signalingReconnectDelay;
6599
+ }, Sa = /* @__PURE__ */ function(e) {
6600
+ return e.EMPTY_ENDPOINT = "EMPTY_ENDPOINT", e.NETWORK_ERROR = "NETWORK_ERROR", e.ABORTED = "ABORTED", e;
6601
+ }({}), Ca = class {
6602
+ constructor(e) {
6603
+ h(this, "handlers", void 0), h(this, "socket", null), h(this, "endpoint", ""), h(this, "wtEndpoint", null), h(this, "peerId", null), h(this, "lastStamp", 0), h(this, "connectionType", void 0), h(this, "reconnectCount", 0), h(this, "reconnectTimer", 0), h(this, "doctorTimer", 0), h(this, "forceWebSocket", !1), h(this, "abortSignal", void 0), h(this, "manualClose", !1), h(this, "currentType", pr.WEBSOCKET), this.handlers = e;
6604
+ }
6605
+ get readyState() {
6606
+ return this.socket?.readyState ?? null;
6607
+ }
6608
+ get type() {
6609
+ return this.currentType;
6610
+ }
6611
+ setEndpoint(e) {
6612
+ this.endpoint = e;
6613
+ }
6614
+ setWebTransportEndpoint(e) {
6615
+ this.wtEndpoint = e || null;
6616
+ }
6617
+ setPeerId(e) {
6618
+ this.peerId = e;
6619
+ }
6620
+ setLastStamp(e) {
6621
+ this.lastStamp = e;
6622
+ }
6623
+ setAbortSignal(e) {
6624
+ this.abortSignal = e;
6625
+ }
6626
+ resetReconnectCount() {
6627
+ this.reconnectCount = 0;
6628
+ }
6629
+ connect(e) {
6630
+ this.socket && this.socket.readyState < WebSocket.CLOSING || (e !== dr.RETRY && (this.forceWebSocket = !1, this.reconnectCount = 0), this.manualClose = !1, this.connectionType = e, this._connect());
6631
+ }
6632
+ close(e) {
6633
+ this.manualClose = !0, this._disconnect(e), window.clearTimeout(this.reconnectTimer), this.reconnectTimer = 0, this.lastStamp = 0;
6634
+ }
6635
+ send(e) {
6636
+ this.socket?.send(e);
6637
+ }
6638
+ _connect() {
6639
+ if (this._canUseWebTransport()) {
6640
+ this._connectWebTransport();
6641
+ return;
6642
+ }
6643
+ this._connectWebSocket();
6644
+ }
6645
+ _connectWebTransport() {
6646
+ if (!this.wtEndpoint) {
6647
+ this._connectWebSocket();
6648
+ return;
6649
+ }
6650
+ let e = this._buildUrl(this.wtEndpoint, !0);
6651
+ this.currentType = pr.WEBTRANSPORT, this.socket = new xa(e, { congestionControl: "low-latency" }), this._setSocketHandlers();
6652
+ }
6653
+ _connectWebSocket() {
6654
+ if (!this.endpoint) {
6655
+ this.handlers.onFailed({
6656
+ failure: "EMPTY_ENDPOINT",
6657
+ message: "Unable to connect to the signaling: endpoint is not set",
6658
+ remote: !0
6659
+ });
6660
+ return;
6661
+ }
6662
+ let e = this._buildUrl(this.endpoint, !1);
6663
+ this.currentType = pr.WEBSOCKET, this.socket = new WebSocket(e), this._setSocketHandlers();
6664
+ }
6665
+ _setSocketHandlers() {
6666
+ 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());
6667
+ }
6668
+ _buildUrl(e, t) {
6669
+ let n = new URL(e), r = n.searchParams;
6670
+ return r.set("platform", M.platform), r.set("appVersion", String(M.appVersion)), r.set("version", String(M.protocolVersion)), r.set("device", M.device), r.set("capabilities", fa.getFlags()), r.set("clientType", M.clientType), this.connectionType && r.set("tgt", this.connectionType), this.connectionType === dr.RETRY && this.lastStamp && r.set("recoverTs", String(this.lastStamp)), M.useParticipantListChunk && (r.set("partIdx", String(M.participantListChunkInitIndex)), M.participantListChunkInitCount !== null && r.set("partCount", String(M.participantListChunkInitCount))), t && (r.set("compression", "deflate-raw"), r.set("ua", navigator.userAgent)), this.peerId !== null && r.set("peerId", String(this.peerId)), n.toString();
6671
+ }
6672
+ _canUseWebTransport() {
6673
+ return !this.forceWebSocket && xa.isBrowserSupported() && this.wtEndpoint !== null && M.webtransport;
6579
6674
  }
6580
- static get RECONNECT_MAX_DELAY() {
6581
- return M.signalingReconnectMaxDelay;
6675
+ _onOpen() {
6676
+ this._startDoctor(), this.handlers.onOpen();
6677
+ }
6678
+ _onMessage(e) {
6679
+ this._startDoctor(), this.handlers.onMessage(e);
6680
+ }
6681
+ _onError(e) {
6682
+ this.handlers.onError(e);
6683
+ }
6684
+ _onClose(e) {
6685
+ if (this._stopDoctor(), this.handlers.onClose(e), !this.manualClose) {
6686
+ if (this.abortSignal?.aborted) {
6687
+ this.handlers.onFailed({
6688
+ failure: "ABORTED",
6689
+ message: "Signaling connection aborted"
6690
+ });
6691
+ return;
6692
+ }
6693
+ this.forceWebSocket = !0, this._scheduleReconnect();
6694
+ }
6695
+ }
6696
+ _disconnect(e) {
6697
+ this.socket && this.socket.readyState < WebSocket.CLOSING && (this.socket.onopen = null, this.socket.onmessage = null, this.socket.onerror = null, this.socket.onclose = null, this.socket.close(e)), this.socket = null, this._stopDoctor();
6582
6698
  }
6583
- static get RECONNECT_MAX_COUNT() {
6584
- return M.signalingReconnectMaxCount;
6699
+ _scheduleReconnect(e = this._getReconnectDelay()) {
6700
+ if (this.reconnectCount >= M.signalingReconnectMaxCount) {
6701
+ this.handlers.onFailed({
6702
+ failure: "NETWORK_ERROR",
6703
+ message: "Unable to connect to the signaling: reconnect attempts exhausted"
6704
+ });
6705
+ return;
6706
+ }
6707
+ this.reconnectCount++, this.handlers.onReconnectScheduled({
6708
+ count: this.reconnectCount,
6709
+ delay: e
6710
+ }), this.reconnectTimer = window.setTimeout(() => {
6711
+ this.connectionType = dr.RETRY, this._connect();
6712
+ }, e);
6713
+ }
6714
+ _getReconnectDelay() {
6715
+ return Math.min(M.signalingReconnectMaxDelay, M.signalingReconnectDelay * 2 ** this.reconnectCount);
6585
6716
  }
6717
+ _startDoctor() {
6718
+ this._stopDoctor(), !(this.reconnectCount >= M.signalingReconnectMaxCount) && (this.doctorTimer = window.setTimeout(() => {
6719
+ this.handlers.onConnectionDead(), this.forceWebSocket = !0, this._disconnect(4e3), this._scheduleReconnect(0);
6720
+ }, M.waitMessageDelay));
6721
+ }
6722
+ _stopDoctor() {
6723
+ window.clearTimeout(this.doctorTimer), this.doctorTimer = 0;
6724
+ }
6725
+ }, wa = "open", Ta = 10, Ea = [
6726
+ "service-unavailable",
6727
+ "conversation-ended",
6728
+ "invalid-token"
6729
+ ], Da = class e extends yn {
6586
6730
  static get WAIT_CONNECTION_DELAY() {
6587
6731
  return M.waitConnectionDelay;
6588
6732
  }
6589
6733
  static get WAIT_RESPONSE_DELAY() {
6590
6734
  return M.waitResponseDelay;
6591
6735
  }
6592
- static get WAIT_MESSAGE_DELAY() {
6593
- return M.waitMessageDelay;
6736
+ get ready() {
6737
+ return this.transport.readyState !== null;
6594
6738
  }
6595
6739
  constructor(e = R, t = null, n = null, r = null, i = null) {
6596
- super(), h(this, "socket", null), 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, "reconnectCount", 0), h(this, "endpoint", void 0), h(this, "wtEndpoint", null), 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, "reconnectTimer", 0), h(this, "connectionMessageWaitTimer", 0), h(this, "doctorTimer", 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, "_pings", void 0), h(this, "_signalingCommands", void 0), this._debug = e, this._logger = t, this._statAggregator = n, this._pings = r, this._signalingCommands = i, this.producerCommandSerializationService = new Kn(e);
6740
+ super(), h(this, "transport", new Ca({
6741
+ onOpen: this._onOpen.bind(this),
6742
+ onMessage: this._onMessage.bind(this),
6743
+ onError: this._onError.bind(this),
6744
+ onClose: this._onClose.bind(this),
6745
+ onFailed: this._onTransportFailed.bind(this),
6746
+ onReconnectScheduled: this._onTransportReconnectScheduled.bind(this),
6747
+ onConnectionDead: this._onTransportConnectionDead.bind(this)
6748
+ })), 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 Kn(e);
6597
6749
  }
6598
- get ready() {
6599
- return this.socket !== null;
6750
+ setAbortSignal(e) {
6751
+ super.setAbortSignal(e), this.transport.setAbortSignal(e);
6600
6752
  }
6601
6753
  setEndpoint(e) {
6602
- this.endpoint = e;
6754
+ this.transport.setEndpoint(e);
6603
6755
  }
6604
6756
  setWebTransportEndpoint(e) {
6605
- this.wtEndpoint = e;
6757
+ this.transport.setWebTransportEndpoint(e);
6606
6758
  }
6607
6759
  setConversationId(e) {
6608
6760
  this.conversationId = e;
@@ -6633,59 +6785,17 @@ var ua = la, da = {
6633
6785
  }
6634
6786
  async connect(e) {
6635
6787
  return new Promise((t, n) => {
6636
- if (this.socket && this.socket.readyState < WebSocket.CLOSING) {
6637
- this._logger?.log(S.SOCKET_ACTION, "already_opened"), n(Error("Socket already opened"));
6788
+ if (this.transport.readyState !== null && this.transport.readyState < WebSocket.CLOSING) {
6789
+ this._logger?.log(C.SOCKET_ACTION, "already_opened"), n(Error("Socket already opened"));
6638
6790
  return;
6639
6791
  }
6640
6792
  this.conversationResolve = (e) => {
6641
6793
  t(e), this.conversationResolve = null, this.conversationReject = null;
6642
6794
  }, this.conversationReject = (e) => {
6643
6795
  n(e), this.conversationResolve = null, this.conversationReject = null;
6644
- }, this._connect(e, this.isWebTransportAvailable());
6796
+ }, this.connectionType = e, this.transport.connect(e);
6645
6797
  });
6646
6798
  }
6647
- async _send(e, t = {}, n = !0, r = 0) {
6648
- if (t.participantId) {
6649
- let e = j.decomposeParticipantId(t.participantId), n = j.decomposeId(e.compositeUserId);
6650
- t = Object.assign({}, t, {
6651
- participantId: n.id,
6652
- participantType: n.type
6653
- }), e.deviceIdx && (t.deviceIdx = e.deviceIdx);
6654
- }
6655
- return this._sendRaw(e, t, n, r);
6656
- }
6657
- async _sendRaw(e, t = {}, n = !0, r = 0) {
6658
- let i = (t) => {
6659
- if (this._isDataChannelCommand(e)) this.datachannelCommandsQueue.push(t), this.producerCommandDataChannel?.readyState === Sa && this._handleCommandsQueue(this.datachannelCommandsQueue);
6660
- else {
6661
- if (!this.socket) {
6662
- 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);
6663
- return;
6664
- }
6665
- this.socket.readyState > WebSocket.OPEN && (this._logger?.log(S.SOCKET_ACTION, "invalid_state"), this._debug.warn(`[signaling] socket is not opened, state ${this.socket.readyState}`)), this.websocketCommandsQueue.push(t), this.socket && this.socket.readyState === WebSocket.OPEN && this._handleCommandsQueue(this.websocketCommandsQueue);
6666
- }
6667
- };
6668
- return new Promise((a, o) => {
6669
- let s = (t, n = !1) => {
6670
- !r || n ? o(t) : (this._debug.debug("[signaling] resending a signaling message", e, u.sequence), r--, i(u));
6671
- }, c = this.sequence++, l = `${e}_${c}`;
6672
- W.setMark(l);
6673
- let u = {
6674
- sequence: c,
6675
- name: e,
6676
- statMarkName: l,
6677
- params: t,
6678
- responseTimer: 0,
6679
- needResponse: n,
6680
- resolve: a,
6681
- reject: s
6682
- };
6683
- i(u);
6684
- });
6685
- }
6686
- _isDataChannelCommand(e) {
6687
- 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;
6688
- }
6689
6799
  getNextCommandSequenceNumber() {
6690
6800
  return this.sequence;
6691
6801
  }
@@ -6709,13 +6819,13 @@ var ua = la, da = {
6709
6819
  return this._send(B.TRANSMIT_DATA, {
6710
6820
  participantId: e,
6711
6821
  data: r
6712
- }, !0, Ca);
6822
+ }, !0, Ta);
6713
6823
  }
6714
6824
  async acceptCall(e) {
6715
6825
  return this._send(B.ACCEPT_CALL, { mediaSettings: e });
6716
6826
  }
6717
6827
  async changeMediaSettings(e) {
6718
- return this._send(B.CHANGE_MEDIA_SETTINGS, { mediaSettings: e }, !0, Ca);
6828
+ return this._send(B.CHANGE_MEDIA_SETTINGS, { mediaSettings: e }, !0, Ta);
6719
6829
  }
6720
6830
  async changeParticipantState(e, t) {
6721
6831
  let n = { participantState: { state: e } };
@@ -6916,7 +7026,7 @@ var ua = la, da = {
6916
7026
  return this._send(B.GET_HAND_QUEUE);
6917
7027
  }
6918
7028
  close() {
6919
- this.socket && this.socket.readyState < WebSocket.CLOSING && this._closeSocket(), this._stopWaitConnectionMessage(), this._stopDoctor(), clearTimeout(this.reconnectTimer);
7029
+ this.transport.readyState !== null && this.transport.readyState < WebSocket.CLOSING && this._closeSocket(), this._stopWaitConnectionMessage();
6920
7030
  }
6921
7031
  readyToSend(e = !0) {
6922
7032
  this.listenersReady = e, this._handleCachedMessages();
@@ -6939,51 +7049,67 @@ var ua = la, da = {
6939
7049
  async requestAsr(e) {
6940
7050
  return this._send(B.REQUEST_ASR, { request: e }, !1);
6941
7051
  }
6942
- _buildUrl(e, t, n) {
6943
- let r = new URL(e), i = r.searchParams;
6944
- return i.set("platform", M.platform), i.set("appVersion", String(M.appVersion)), i.set("version", String(M.protocolVersion)), i.set("device", M.device), i.set("capabilities", fa.getFlags()), i.set("clientType", M.clientType), t && i.set("tgt", t), t === dr.RETRY && this.lastStamp && i.set("recoverTs", String(this.lastStamp)), M.useParticipantListChunk && (i.set("partIdx", String(M.participantListChunkInitIndex)), M.participantListChunkInitCount !== null && i.set("partCount", String(M.participantListChunkInitCount))), n && (i.set("compression", "deflate-raw"), i.set("ua", navigator.userAgent)), this.peerId !== null && i.set("peerId", String(this.peerId)), r.toString();
6945
- }
6946
- _connect(e, t) {
6947
- if (!(this.socket && this.socket.readyState < WebSocket.CLOSING)) {
6948
- if (this.connectionType = e, t) {
6949
- if (!this.wtEndpoint) {
6950
- this._debug.error("[signaling] empty wt endpoint"), this.conversationReject?.(new O(b.SIGNALING_FAILED, {
6951
- message: "Unable to connect to the signaling: wtEndpoint is not set",
6952
- remote: !0
6953
- }));
7052
+ async _send(e, t = {}, n = !0, r = 0) {
7053
+ if (t.participantId) {
7054
+ let e = j.decomposeParticipantId(t.participantId), n = j.decomposeId(e.compositeUserId);
7055
+ t = Object.assign({}, t, {
7056
+ participantId: n.id,
7057
+ participantType: n.type
7058
+ }), e.deviceIdx && (t.deviceIdx = e.deviceIdx);
7059
+ }
7060
+ return this._sendRaw(e, t, n, r);
7061
+ }
7062
+ async _sendRaw(e, t = {}, n = !0, r = 0) {
7063
+ let i = (t) => {
7064
+ if (this._isDataChannelCommand(e)) this.datachannelCommandsQueue.push(t), this.producerCommandDataChannel?.readyState === wa && this._handleCommandsQueue(this.datachannelCommandsQueue);
7065
+ else {
7066
+ if (this.transport.readyState === null) {
7067
+ 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);
6954
7068
  return;
6955
7069
  }
6956
- let t = this._buildUrl(this.wtEndpoint, e, !0);
6957
- this._debug.debug("[signaling] connecting to wt " + t), this.socket = new xa(t, { congestionControl: "low-latency" });
6958
- } else {
6959
- let t = this._buildUrl(this.endpoint, e, !1);
6960
- this._debug.debug("[signaling] connecting to ws " + t), this.socket = new WebSocket(t);
7070
+ 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);
6961
7071
  }
6962
- this._markTransportStat(e === dr.RETRY ? mr.RECONNECTED : mr.CONNECTED), 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();
6963
- }
7072
+ };
7073
+ return new Promise((a, o) => {
7074
+ let s = (t, n = !1) => {
7075
+ !r || n ? o(t) : (this._debug.debug("[signaling] resending a signaling message", e, u.sequence), r--, i(u));
7076
+ }, c = this.sequence++, l = `${e}_${c}`;
7077
+ W.setMark(l);
7078
+ let u = {
7079
+ sequence: c,
7080
+ name: e,
7081
+ statMarkName: l,
7082
+ params: t,
7083
+ responseTimer: 0,
7084
+ needResponse: n,
7085
+ resolve: a,
7086
+ reject: s
7087
+ };
7088
+ i(u);
7089
+ });
6964
7090
  }
6965
- _disconnect(e) {
6966
- this.socket && this.socket.readyState < WebSocket.CLOSING && (this.socket.onopen = null, this.socket.onmessage = null, this.socket.onerror = null, this.socket.onclose = null, this.socket.close(e), this.socket = null), this._stopWaitConnectionMessage(), this._stopDoctor(), clearTimeout(this.reconnectTimer);
7091
+ _isDataChannelCommand(e) {
7092
+ 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;
6967
7093
  }
6968
7094
  _onOpen() {
6969
- this._debug.debug("[signaling] socket opened"), this._logger?.log(S.SOCKET_ACTION, "opened"), this._waitConnectionMessage(), this._startDoctor(), this._logTransportStat(this.connectionType === dr.RETRY ? mr.RECONNECTED : mr.CONNECTED);
7095
+ this._debug.debug("[signaling] socket opened"), this._logger?.log(C.SOCKET_ACTION, "opened"), this._waitConnectionMessage(), this._logTransportStat(this.connectionType === dr.RETRY ? mr.RECONNECTED : mr.CONNECTED);
6970
7096
  }
6971
7097
  _onMessage(e) {
6972
- if (this._startDoctor(), e.data === "ping") {
6973
- this._pings?.mark(this._getSocketType()), this._markTransportStat(mr.FAILED_PINGS), L.onSignalingMessage(e.data), this.socket && this.socket.readyState === WebSocket.OPEN && this.socket.send("pong");
7098
+ if (e.data === "ping") {
7099
+ this._statPings?.mark(this._getSocketType()), this._markTransportStat(mr.FAILED_PINGS), L.onSignalingMessage(e.data), this.transport.readyState === WebSocket.OPEN && this.transport.send("pong");
6974
7100
  return;
6975
7101
  }
6976
7102
  try {
6977
7103
  let t = JSON.parse(e.data);
6978
7104
  L.onSignalingMessage(t), this._handleMessage(t);
6979
7105
  } catch (t) {
6980
- this._logger?.log(S.SOCKET_ACTION, "parse_error"), this._debug.error("[signaling] unable to parse message", t, e.data);
7106
+ this._logger?.log(C.SOCKET_ACTION, "parse_error"), this._debug.error("[signaling] unable to parse message", t, e.data);
6981
7107
  }
6982
7108
  }
6983
7109
  _handleMessage(e) {
6984
7110
  switch (e.type) {
6985
7111
  case "notification":
6986
- e.notification === "connection" ? (this._debug.debug("[signaling] signaling connected", e), this.connected = !0, this.reconnectCount = 0, this.endpoint = e.endpoint, e.peerId && this.peerId !== e.peerId.id && (this.peerId = e.peerId.id), this._stopWaitConnectionMessage(), this.conversationResolve ? this.conversationResolve(e) : (this._logTransportStat(mr.RESTART), this._triggerEvent(fr.RECONNECT, e), e.conversation.topology && this._triggerEvent(fr.NOTIFICATION, {
7112
+ e.notification === "connection" ? (this._debug.debug("[signaling] signaling connected", e), this.connected = !0, this.transport.resetReconnectCount(), this.transport.setEndpoint(e.endpoint), e.peerId && this.peerId !== e.peerId.id && (this.peerId = e.peerId.id, this.transport.setPeerId(e.peerId.id)), this._stopWaitConnectionMessage(), this.conversationResolve ? this.conversationResolve(e) : (this._logTransportStat(mr.RESTART), this._triggerEvent(fr.RECONNECT, e), e.conversation.topology && this._triggerEvent(fr.NOTIFICATION, {
6987
7113
  type: "notification",
6988
7114
  notification: G.TOPOLOGY_CHANGED,
6989
7115
  topology: e.conversation.topology
@@ -6997,13 +7123,13 @@ var ua = la, da = {
6997
7123
  case "error":
6998
7124
  this._handleErrorMessage(e);
6999
7125
  break;
7000
- default: this._logger?.log(S.SOCKET_ACTION, "unknown_message"), this._debug.warn("[signaling] unhandled message", e);
7126
+ default: this._logger?.log(C.SOCKET_ACTION, "unknown_message"), this._debug.warn("[signaling] unhandled message", e);
7001
7127
  }
7002
- this.lastStamp = e.stamp || this.lastStamp;
7128
+ e.stamp && (this.lastStamp = e.stamp, this.transport.setLastStamp(e.stamp));
7003
7129
  }
7004
7130
  _handleErrorMessage(e) {
7005
- this._logger?.log(S.SOCKET_ACTION, `error-${e.error}`);
7006
- let t = e.error ? wa.includes(e.error) : !1;
7131
+ this._logger?.log(C.SOCKET_ACTION, `error-${e.error}`);
7132
+ let t = e.error ? Ea.includes(e.error) : !1;
7007
7133
  switch (this._debug.debug(`[signaling] error message [${e.sequence}]`, e), e.sequence && this.responseHandlers[e.sequence] && this._handleCommandResponse(!1, e), e.error) {
7008
7134
  case "service-unavailable":
7009
7135
  let n = new O(D.SERVICE_UNAVAILABLE, {
@@ -7016,7 +7142,7 @@ var ua = la, da = {
7016
7142
  });
7017
7143
  break;
7018
7144
  case "conversation-ended":
7019
- this.conversationReject ? this.conversationReject(new O(e.reason || b.SIGNALING_FAILED, {
7145
+ this.conversationReject ? this.conversationReject(new O(e.reason || x.SIGNALING_FAILED, {
7020
7146
  message: `Conversation ended: ${e.error}`,
7021
7147
  remote: !0
7022
7148
  })) : this._triggerEvent(fr.NOTIFICATION, {
@@ -7027,9 +7153,15 @@ var ua = la, da = {
7027
7153
  case "participant-not-found":
7028
7154
  this._throwError(/* @__PURE__ */ Error(`Signaling error: ${e.error}`));
7029
7155
  break;
7156
+ case "gen.obsoleteClient":
7157
+ this.conversationReject?.(new O(e.reason || D.OBSOLETE_CLIENT, {
7158
+ message: e.code || e.error,
7159
+ remote: !0
7160
+ }));
7161
+ break;
7030
7162
  default:
7031
7163
  if (!t) break;
7032
- this.connected ? this._throwError(/* @__PURE__ */ Error(`Signaling error: ${e.error}`)) : e.sequence || (this.conversationReject?.(new O(e.reason || b.SIGNALING_FAILED, {
7164
+ this.connected ? this._throwError(/* @__PURE__ */ Error(`Signaling error: ${e.error}`)) : e.sequence || (this.conversationReject?.(new O(e.reason || x.SIGNALING_FAILED, {
7033
7165
  message: `Unable to connect to the signaling: ${e.error}`,
7034
7166
  remote: !0
7035
7167
  })), this._closeSocket());
@@ -7046,51 +7178,43 @@ var ua = la, da = {
7046
7178
  this._triggerEvent(fr.FAILED, e);
7047
7179
  }
7048
7180
  _onError(e) {
7049
- this._logger?.log(S.SOCKET_ACTION, "error"), this._debug.error("[signaling] signaling error", e), this._logTransportStat(mr.FAILED_EXCEPTIONS, { string_value: this._serializeErrorEvent(e) });
7181
+ this._logger?.log(C.SOCKET_ACTION, "error"), this._debug.error("[signaling] signaling error", e), this._logTransportStat(mr.FAILED_EXCEPTIONS, { string_value: this._serializeErrorEvent(e) });
7050
7182
  }
7051
7183
  _serializeErrorEvent(e) {
7052
7184
  let t = e, n = t.error instanceof Error ? t.error : null;
7053
7185
  return JSON.stringify({
7054
7186
  eventType: e.type,
7055
7187
  socketType: this._getSocketType(),
7056
- readyState: this.socket?.readyState,
7188
+ readyState: this.transport.readyState,
7057
7189
  errorName: n?.name || t.errorInfo?.name,
7058
7190
  errorMessage: n?.message || t.errorInfo?.message || t.message,
7059
7191
  errorStack: n?.stack || t.errorInfo?.stack,
7060
7192
  errorInfo: t.errorInfo
7061
7193
  });
7062
7194
  }
7063
- _onClose(t) {
7064
- if (this._logger?.log(S.SOCKET_ACTION, "closed"), this._debug.debug("[signaling] connection closed", {
7065
- code: t.code,
7066
- reason: t.reason
7067
- }), this.connected = !1, this._stopDoctor(), this.socket && this._abortSignal?.aborted) {
7068
- this._debug.debug("[signaling] aborted reconnect"), this._closeSocket(new O(D.CANCELED));
7069
- return;
7070
- }
7071
- this.socket && this.reconnectCount++ < e.RECONNECT_MAX_COUNT ? this._reconnect() : this.socket && this._closeSocket(new O(D.NETWORK_ERROR));
7195
+ _onClose(e) {
7196
+ this._logger?.log(C.SOCKET_ACTION, "closed"), this._debug.debug("[signaling] connection closed", {
7197
+ code: e.code,
7198
+ reason: e.reason
7199
+ }), this.connected = !1;
7072
7200
  }
7073
7201
  _closeSocket(e = null) {
7074
- this.socket && (this._disconnect(), Object.values(this.responseHandlers).forEach((t) => {
7202
+ this.transport.readyState !== null && (this.transport.close(), this._stopWaitConnectionMessage(), Object.values(this.responseHandlers).forEach((t) => {
7075
7203
  window.clearTimeout(t.responseTimer), e && t.reject(/* @__PURE__ */ Error(`Connection closed. Command ${t.name}`), !0);
7076
7204
  }), this.websocketCommandsQueue = [], this.responseHandlers = {}, this.lastStamp = 0, e && this._throwError(e));
7077
7205
  }
7078
- _reconnect() {
7079
- let t = Math.min(e.RECONNECT_MAX_DELAY, e.RECONNECT_DELAY * 2 ** (this.reconnectCount - 1));
7080
- this._debug.log(`[signaling] reconnect websocket after ${t}ms (${this.reconnectCount})`), this._logger?.log(S.SOCKET_ACTION, "reconnect"), this.reconnectTimer = window.setTimeout(this._connect.bind(this, dr.RETRY, !1), t);
7081
- }
7082
7206
  _handleCommandResponse(t, n) {
7083
7207
  if (!Object.hasOwn(this.responseHandlers, n.sequence)) return;
7084
7208
  let r = this.responseHandlers[n.sequence];
7085
7209
  window.clearTimeout(r.responseTimer);
7086
7210
  let i = W.measureMark(r.statMarkName);
7087
- i !== null && this._signalingCommands?.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(n.error || `Response error [${r.name}]`), !0)) : this.socket?.readyState === WebSocket.OPEN ? (delete this.responseHandlers[n.sequence], this._logger?.log(S.SOCKET_ACTION, "response-timeout"), r.reject(Error(n.error || `Response timeout [${r.name}]`))) : r.responseTimer = window.setTimeout(() => this._handleCommandResponse(t, n), e.WAIT_RESPONSE_DELAY);
7211
+ 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(n.error || `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(n.error || `Response timeout [${r.name}]`))) : r.responseTimer = window.setTimeout(() => this._handleCommandResponse(t, n), e.WAIT_RESPONSE_DELAY);
7088
7212
  }
7089
7213
  _handleCommandsQueue(e) {
7090
7214
  for (; e.length > 0;) {
7091
7215
  let t = e.shift();
7092
7216
  if (this._debug.debug(`[signaling] command send [${t.sequence}]`, `'${t.name}'`, t.params), this._isDataChannelCommand(t.name)) {
7093
- if (this.producerCommandDataChannel?.readyState !== Sa) {
7217
+ if (this.producerCommandDataChannel?.readyState !== wa) {
7094
7218
  t.reject(/* @__PURE__ */ Error(`Invalid data channel state: ${this.producerCommandDataChannel?.readyState}`));
7095
7219
  return;
7096
7220
  }
@@ -7098,11 +7222,11 @@ var ua = la, da = {
7098
7222
  let e = this._serializeBinary(t);
7099
7223
  e !== null && this.producerCommandDataChannel.send(e);
7100
7224
  } else {
7101
- if (!this.socket || this.socket.readyState !== WebSocket.OPEN) {
7225
+ if (this.transport.readyState !== WebSocket.OPEN) {
7102
7226
  t.reject(/* @__PURE__ */ Error("Invalid state or socket already closed"));
7103
7227
  continue;
7104
7228
  }
7105
- this._startResponseTimer(t), this.socket.send(this._serializeJson(t));
7229
+ this._startResponseTimer(t), this.transport.send(this._serializeJson(t));
7106
7230
  }
7107
7231
  }
7108
7232
  }
@@ -7150,7 +7274,7 @@ var ua = la, da = {
7150
7274
  }
7151
7275
  _waitConnectionMessage() {
7152
7276
  this.connectionMessageWaitTimer = window.setTimeout(() => {
7153
- this.conversationReject && this.conversationReject(new O(b.SIGNALING_FAILED, {
7277
+ this.conversationReject && this.conversationReject(new O(x.SIGNALING_FAILED, {
7154
7278
  message: "Unable to connect to the signaling: connection timeout",
7155
7279
  remote: !0
7156
7280
  }));
@@ -7159,19 +7283,30 @@ var ua = la, da = {
7159
7283
  _stopWaitConnectionMessage() {
7160
7284
  window.clearTimeout(this.connectionMessageWaitTimer), this.connectionMessageWaitTimer = 0;
7161
7285
  }
7162
- _startDoctor() {
7163
- this._stopDoctor(), !(this.reconnectCount >= e.RECONNECT_MAX_COUNT) && (this.doctorTimer = window.setTimeout(() => {
7164
- this.isWebTransportAvailable() ? this._debug.warn(`[signaling] socket is dead. Fallback to WebSocket. Trying to connect ${this.reconnectCount}`) : this._debug.warn(`[signaling] socket is dead, trying to reconnect ${this.reconnectCount}`), this._logTransportStat(mr.FAILED_PINGS), this._disconnect(4e3), this._connect(dr.RETRY, !1), this.reconnectCount++;
7165
- }, e.WAIT_MESSAGE_DELAY));
7286
+ _onTransportFailed(e) {
7287
+ switch (e.failure) {
7288
+ case Sa.EMPTY_ENDPOINT:
7289
+ this.conversationReject?.(new O(x.SIGNALING_FAILED, {
7290
+ message: e.message,
7291
+ remote: e.remote
7292
+ }));
7293
+ break;
7294
+ case Sa.NETWORK_ERROR:
7295
+ this._closeSocket(new O(D.NETWORK_ERROR));
7296
+ break;
7297
+ case Sa.ABORTED:
7298
+ this._debug.debug("[signaling] aborted reconnect"), this._closeSocket(new O(D.CANCELED));
7299
+ break;
7300
+ }
7166
7301
  }
7167
- _stopDoctor() {
7168
- window.clearTimeout(this.doctorTimer), this.doctorTimer = 0;
7302
+ _onTransportReconnectScheduled(e) {
7303
+ this.connectionType = dr.RETRY, this._debug.log(`[signaling] reconnect websocket after ${e.delay}ms (${e.count})`), this._logger?.log(C.SOCKET_ACTION, "reconnect");
7169
7304
  }
7170
- isWebTransportAvailable() {
7171
- return xa.isBrowserSupported() && this.wtEndpoint !== null && M.webtransport;
7305
+ _onTransportConnectionDead() {
7306
+ this._debug.warn("[signaling] socket is dead, trying to reconnect"), this._logTransportStat(mr.FAILED_PINGS);
7172
7307
  }
7173
7308
  _getSocketType() {
7174
- return this.socket instanceof xa ? pr.WEBTRANSPORT : pr.WEBSOCKET;
7309
+ return this.transport.type;
7175
7310
  }
7176
7311
  _markTransportStat(e) {
7177
7312
  let t = this._getSocketType(), n = hr[e][t];
@@ -7186,37 +7321,37 @@ var ua = la, da = {
7186
7321
  }
7187
7322
  }, Y = /* @__PURE__ */ function(e) {
7188
7323
  return e.INCOMING = "INCOMING", e.OUTGOING = "OUTGOING", e.JOINING = "JOINING", e;
7189
- }(Y || {}), Ea = /* @__PURE__ */ function(e) {
7324
+ }(Y || {}), Oa = /* @__PURE__ */ function(e) {
7190
7325
  return e.USER = "USER", e.GROUP = "GROUP", e.CHAT = "CHAT", e;
7191
- }(Ea || {}), Da = /* @__PURE__ */ function(e) {
7326
+ }(Oa || {}), ka = /* @__PURE__ */ function(e) {
7192
7327
  return e.ATTENDEE = "ATTENDEE", e.HAND_UP = "HAND_UP", e;
7193
- }(Da || {}), Oa = /* @__PURE__ */ function(e) {
7328
+ }(ka || {}), Aa = /* @__PURE__ */ function(e) {
7194
7329
  return e.ADD_PARTICIPANT = "ADD_PARTICIPANT", e.RECORD = "RECORD", e.MOVIE_SHARE = "MOVIE_SHARE", e;
7195
- }(Oa || {}), ka = /* @__PURE__ */ function(e) {
7330
+ }(Aa || {}), ja = /* @__PURE__ */ function(e) {
7196
7331
  return e.REQUIRE_AUTH_TO_JOIN = "REQUIRE_AUTH_TO_JOIN", e.AUDIENCE_MODE = "AUDIENCE_MODE", e.WAITING_HALL = "WAITING_HALL", e.WAIT_FOR_ADMIN = "WAIT_FOR_ADMIN", e.ADMIN_IS_HERE = "ADMIN_IS_HERE", e.ASR = "ASR", e.FEEDBACK = "FEEDBACK", e.RECURRING = "RECURRING", e;
7197
- }(ka || {});
7198
- function Aa(e, t) {
7332
+ }(ja || {});
7333
+ function Ma(e, t) {
7199
7334
  if (e.length !== t.length) return !1;
7200
7335
  for (let n of e) if (!t.includes(n)) return !1;
7201
7336
  return !0;
7202
7337
  }
7203
- function ja(e, t) {
7338
+ function Na(e, t) {
7204
7339
  let n = new Set(e);
7205
7340
  for (let [e, r] of Object.entries(t)) r ? n.add(e) : n.delete(e);
7206
7341
  return Array.from(n);
7207
7342
  }
7208
7343
  //#endregion
7209
7344
  //#region src/enums/MuteState.ts
7210
- var Ma = /* @__PURE__ */ function(e) {
7345
+ var Pa = /* @__PURE__ */ function(e) {
7211
7346
  return e.UNMUTE = "UNMUTE", e.MUTE = "MUTE", e.MUTE_PERMANENT = "MUTE_PERMANENT", e;
7212
- }(Ma || {}), X = /* @__PURE__ */ function(e) {
7347
+ }(Pa || {}), X = /* @__PURE__ */ function(e) {
7213
7348
  return e.CALLED = "CALLED", e.ACCEPTED = "ACCEPTED", e.REJECTED = "REJECTED", e.HUNGUP = "HUNGUP", e;
7214
- }(X || {}), Na = /* @__PURE__ */ function(e) {
7349
+ }(X || {}), Fa = /* @__PURE__ */ function(e) {
7215
7350
  return e.UPDATE = "UPDATE", e.REMOVE = "REMOVE", e.ACTIVATE = "ACTIVATE", e.TIMEOUT = "TIMEOUT", e;
7216
- }(Na || {}), Pa = /* @__PURE__ */ function(e) {
7351
+ }(Fa || {}), Ia = /* @__PURE__ */ function(e) {
7217
7352
  return e.NO_AVAILABLE_TRACKS = "no-available-tracks", e.UNKNOWN_ERROR = "unknown-error", e;
7218
- }(Pa || {});
7219
- function Fa(e) {
7353
+ }(Ia || {});
7354
+ function La(e) {
7220
7355
  switch (e) {
7221
7356
  case 1: return "no-available-tracks";
7222
7357
  default: return "unknown-error";
@@ -7224,17 +7359,17 @@ function Fa(e) {
7224
7359
  }
7225
7360
  //#endregion
7226
7361
  //#region src/enums/UserRole.ts
7227
- var Ia = /* @__PURE__ */ function(e) {
7362
+ var Ra = /* @__PURE__ */ function(e) {
7228
7363
  return e.CREATOR = "CREATOR", e.ADMIN = "ADMIN", e;
7229
- }(Ia || {});
7230
- function La(e, t) {
7364
+ }(Ra || {});
7365
+ function za(e, t) {
7231
7366
  if (e.length !== t.length) return !1;
7232
7367
  for (let n of e) if (!t.includes(n)) return !1;
7233
7368
  return !0;
7234
7369
  }
7235
7370
  //#endregion
7236
7371
  //#region src/types/ExternalId.ts
7237
- var Ra = /* @__PURE__ */ function(e) {
7372
+ var Ba = /* @__PURE__ */ function(e) {
7238
7373
  return e.USER = "USER", e.ANONYM = "ANONYM", e.GROUP = "GROUP", e;
7239
7374
  }({}), Z;
7240
7375
  (function(e) {
@@ -7295,7 +7430,7 @@ var Ra = /* @__PURE__ */ function(e) {
7295
7430
  })(Z || (Z = {}));
7296
7431
  //#endregion
7297
7432
  //#region src/types/WaitingHall.ts
7298
- function za(e) {
7433
+ function Va(e) {
7299
7434
  try {
7300
7435
  return btoa(JSON.stringify(e));
7301
7436
  } catch (t) {
@@ -7303,7 +7438,7 @@ function za(e) {
7303
7438
  }
7304
7439
  return null;
7305
7440
  }
7306
- function Ba(e) {
7441
+ function Ha(e) {
7307
7442
  try {
7308
7443
  return JSON.parse(atob(e));
7309
7444
  } catch (t) {
@@ -7313,26 +7448,26 @@ function Ba(e) {
7313
7448
  }
7314
7449
  //#endregion
7315
7450
  //#region src/utils/Conversation.ts
7316
- var Va = (e, t) => j.objectReduce(e, (e, n, r) => (n === t && e.push(r), e), []);
7317
- function Ha(e) {
7451
+ var Ua = (e, t) => j.objectReduce(e, (e, n, r) => (n === t && e.push(r), e), []);
7452
+ function Wa(e) {
7318
7453
  if (e.conversation?.muteStates) return e.conversation.muteStates;
7319
7454
  if (e.muteState && e.muteOptions) return e.muteOptions.reduce((t, n) => (t[n] = e.muteState, t), {});
7320
7455
  }
7321
- function Ua(e, t) {
7456
+ function Ga(e, t) {
7322
7457
  switch (e) {
7323
- case x.AUDIO: return !!t.isAudioEnabled;
7324
- case x.AUDIO_SHARING: return !!t.isAudioSharingEnabled;
7325
- case x.VIDEO: return !!t.isVideoEnabled;
7326
- case x.SCREEN_SHARING: return !!t.isFastScreenSharingEnabled || !!t.isScreenSharingEnabled;
7458
+ case S.AUDIO: return !!t.isAudioEnabled;
7459
+ case S.AUDIO_SHARING: return !!t.isAudioSharingEnabled;
7460
+ case S.VIDEO: return !!t.isVideoEnabled;
7461
+ case S.SCREEN_SHARING: return !!t.isFastScreenSharingEnabled || !!t.isScreenSharingEnabled;
7327
7462
  default: return !1;
7328
7463
  }
7329
7464
  }
7330
- function Wa(e, t) {
7465
+ function Ka(e, t) {
7331
7466
  return j.objectReduce(e, (e, n, r) => {
7332
7467
  switch (n) {
7333
- case Ma.MUTE:
7334
- case Ma.MUTE_PERMANENT:
7335
- Ua(r, t) || (e[r] = n);
7468
+ case Pa.MUTE:
7469
+ case Pa.MUTE_PERMANENT:
7470
+ Ga(r, t) || (e[r] = n);
7336
7471
  break;
7337
7472
  default:
7338
7473
  e[r] = n;
@@ -7341,19 +7476,19 @@ function Wa(e, t) {
7341
7476
  return e;
7342
7477
  }, {});
7343
7478
  }
7344
- function Ga(e) {
7479
+ function qa(e) {
7345
7480
  let { muteStates: t = {}, mediaSettings: n } = e;
7346
- return Wa(t, n);
7481
+ return Ka(t, n);
7347
7482
  }
7348
- function Ka(e, t) {
7483
+ function Ja(e, t) {
7349
7484
  let n = e.conversation.participants.find((t) => j.comparePeerId(t.peerId, e.peerId));
7350
7485
  if (!n) return t;
7351
7486
  let { mediaSettings: r } = n;
7352
- return Wa(t, r);
7487
+ return Ka(t, r);
7353
7488
  }
7354
7489
  //#endregion
7355
7490
  //#region src/utils/Lz4.ts
7356
- function qa(e, t) {
7491
+ function Ya(e, t) {
7357
7492
  let n = new Uint8Array(t), r = 0, i = 0;
7358
7493
  for (; r < e.length && i < t;) {
7359
7494
  let a = e[r++], o = a >> 4, s = a & 15;
@@ -7380,17 +7515,17 @@ function qa(e, t) {
7380
7515
  }
7381
7516
  //#endregion
7382
7517
  //#region src/classes/AudioFix.ts
7383
- var Ja = class {
7518
+ var Xa = class {
7384
7519
  constructor(e, t = R, n = null) {
7385
7520
  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;
7386
7521
  }
7387
7522
  _fixAudioDeviceNoPackets(e) {
7388
7523
  if (!(this._fixNoPacketsApplied && this._fixNoPacketsChecked)) {
7389
7524
  if (this._fixNoPacketsApplied && !this._fixNoPacketsChecked) {
7390
- this._fixNoPacketsChecked = !0, this._logger?.log(S.ERROR, `audio_device_recover_${e.bandwidth ? "success" : "fail"}`);
7525
+ this._fixNoPacketsChecked = !0, this._logger?.log(C.ERROR, `audio_device_recover_${e.bandwidth ? "success" : "fail"}`);
7391
7526
  return;
7392
7527
  }
7393
- !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));
7528
+ !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));
7394
7529
  }
7395
7530
  }
7396
7531
  _fixAudioDeviceTooManyPackets(e) {
@@ -7399,7 +7534,7 @@ var Ja = class {
7399
7534
  if (!this._lastPacketsSentTime) e.packetsSent > 0 && (this._lastPacketsSentTime = t, this._lastPacketsSent = e.packetsSent);
7400
7535
  else if (t - this._lastPacketsSentTime > 500) {
7401
7536
  let n = (e.packetsSent - this._lastPacketsSent) * 1e3 / (t - this._lastPacketsSentTime);
7402
- 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) => {
7537
+ 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) => {
7403
7538
  this._debug.warn("[AudioFix] Failed to fix RV (too many packets)", e);
7404
7539
  }), this._fixTooManyPacketsTime = t);
7405
7540
  }
@@ -7418,7 +7553,7 @@ var Ja = class {
7418
7553
  this._debug.warn("[AudioFix] Failed to fix RV (no packets): video restart", e);
7419
7554
  }));
7420
7555
  }
7421
- }, Ya = class {
7556
+ }, Za = class {
7422
7557
  constructor(e, t = !1, n = R, r = null) {
7423
7558
  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;
7424
7559
  }
@@ -7459,7 +7594,7 @@ var Ja = class {
7459
7594
  let e = T.getSavedOutput();
7460
7595
  e && await this._audioElement.setSinkId?.(e.deviceId);
7461
7596
  } catch (e) {
7462
- throw this._logger?.log(S.ERROR, "change_output"), this._debug.error("[audio] Output change failed", e), e;
7597
+ throw this._logger?.log(C.ERROR, "change_output"), this._debug.error("[audio] Output change failed", e), e;
7463
7598
  }
7464
7599
  }
7465
7600
  _getTracks() {
@@ -7503,7 +7638,21 @@ var Ja = class {
7503
7638
  for (let e of this._audioTracks.values()) this._removeTrackFromAudioElement(e), e.stop();
7504
7639
  this._audioTracks.clear();
7505
7640
  }
7506
- }, Xa = 90, Za = 3, Qa = class extends y {
7641
+ };
7642
+ //#endregion
7643
+ //#region src/classes/ConversationResponseValidator.ts
7644
+ function Qa(e, t) {
7645
+ e || eo(t, "response is empty"), e.id || eo(t, "id is empty"), e.endpoint || eo(t, "endpoint is empty"), !$a(e.stun_server) && !$a(e.turn_server) && eo(t, "ice servers are empty");
7646
+ }
7647
+ function $a(e) {
7648
+ return Array.isArray(e?.urls) && e.urls.length > 0;
7649
+ }
7650
+ function eo(e, t) {
7651
+ throw new O(D.UNKNOWN_ERROR, { message: `Invalid ${e} response: ${t}` });
7652
+ }
7653
+ //#endregion
7654
+ //#region src/classes/DebugInfo.ts
7655
+ var to = 90, no = 3, ro = class extends b {
7507
7656
  constructor(e = R) {
7508
7657
  super(), h(this, "_lastMemoryStat", {
7509
7658
  percent: 0,
@@ -7519,9 +7668,9 @@ var Ja = class {
7519
7668
  let e = window?.performance?.memory;
7520
7669
  if (!e || !e.usedJSHeapSize || !e.jsHeapSizeLimit) return;
7521
7670
  let t = Number((100 * e.usedJSHeapSize / e.jsHeapSizeLimit).toFixed(2)), n = Number((e.usedJSHeapSize / 1024 / 1024).toFixed(1));
7522
- t > Xa ? this._debug.warn(`High memory usage: ${t}% (${n} MiB)`) : (!this._lastMemoryStat.percent || Math.abs(t - this._lastMemoryStat.percent) >= Za) && (this._debug.debug(`Memory usage: ${t}% (${n} MiB)`), this._lastMemoryStat.percent = t, this._lastMemoryStat.bytes = e.usedJSHeapSize);
7671
+ t > to ? this._debug.warn(`High memory usage: ${t}% (${n} MiB)`) : (!this._lastMemoryStat.percent || Math.abs(t - this._lastMemoryStat.percent) >= no) && (this._debug.debug(`Memory usage: ${t}% (${n} MiB)`), this._lastMemoryStat.percent = t, this._lastMemoryStat.bytes = e.usedJSHeapSize);
7523
7672
  }
7524
- }, $a = class {
7673
+ }, io = class {
7525
7674
  constructor({ api: e, debug: t, getParticipants: n, isMe: r, updateDisplayLayout: i }) {
7526
7675
  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;
7527
7676
  }
@@ -7631,7 +7780,7 @@ var Ja = class {
7631
7780
  let n = e, r = t;
7632
7781
  return n.width !== r.width || n.height !== r.height || n.fit !== r.fit || n.priority !== r.priority;
7633
7782
  }
7634
- }, eo = 44100, to = class {
7783
+ }, ao = 44100, oo = class {
7635
7784
  constructor(e, t) {
7636
7785
  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]);
7637
7786
  try {
@@ -7648,7 +7797,7 @@ var Ja = class {
7648
7797
  _getBins() {
7649
7798
  if (!this._fftBins || !this._analyser) return new Uint8Array();
7650
7799
  this._analyser.getByteFrequencyData(this._fftBins);
7651
- let e = eo / this._fftBins.length, t = Math.ceil(M.voiceParams.minFreq / e), n = Math.floor(M.voiceParams.maxFreq / e);
7800
+ let e = ao / this._fftBins.length, t = Math.ceil(M.voiceParams.minFreq / e), n = Math.floor(M.voiceParams.maxFreq / e);
7652
7801
  return this._fftBins.subarray(t, n);
7653
7802
  }
7654
7803
  getLevel() {
@@ -7661,7 +7810,7 @@ var Ja = class {
7661
7810
  destroy() {
7662
7811
  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);
7663
7812
  }
7664
- }, no = class extends y {
7813
+ }, so = class extends b {
7665
7814
  constructor(e) {
7666
7815
  super(), h(this, "_detector", null), h(this, "_interval", null);
7667
7816
  let t = () => {
@@ -7677,7 +7826,7 @@ var Ja = class {
7677
7826
  }), this.subscribe(e, Kt.SOURCE_READY, n), n();
7678
7827
  }
7679
7828
  init(e) {
7680
- this._stopDetector(), this._detector = new to("local", e.clone());
7829
+ this._stopDetector(), this._detector = new oo("local", e.clone());
7681
7830
  }
7682
7831
  _stopDetector() {
7683
7832
  this._detector && (this._detector.track.stop(), this._detector.destroy(), this._detector = null);
@@ -7685,7 +7834,7 @@ var Ja = class {
7685
7834
  destroy() {
7686
7835
  this.unsubscribe(), this._interval && (window.clearTimeout(this._interval), this._interval = null), this._stopDetector();
7687
7836
  }
7688
- }, ro = class {
7837
+ }, co = class {
7689
7838
  constructor(e, t = R) {
7690
7839
  h(this, "processor", void 0), h(this, "queue", []), h(this, "isProcessing", !1), h(this, "_debug", void 0), this.processor = e, this._debug = t;
7691
7840
  }
@@ -7705,9 +7854,9 @@ var Ja = class {
7705
7854
  this.isProcessing = !1;
7706
7855
  }
7707
7856
  }
7708
- }, io = /* @__PURE__ */ function(e) {
7857
+ }, lo = /* @__PURE__ */ function(e) {
7709
7858
  return e.VOLUMES_DETECTED = "VOLUMES_DETECTED", e;
7710
- }({}), ao = class extends y {
7859
+ }({}), uo = class extends b {
7711
7860
  constructor(e) {
7712
7861
  super(), h(this, "_detectors", /* @__PURE__ */ new Map()), h(this, "_interval", null), h(this, "_activeParticipants", void 0), h(this, "_removedParticipants", void 0), h(this, "_topology", void 0), this._topology = e.getTopology(), this.subscribe(e, J.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(e, J.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(e, J.SIGNALLED_ACTIVE_PARTICIPANTS, this._onSignalledActiveParticipants.bind(this)), this.subscribe(e, J.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this));
7713
7862
  }
@@ -7715,7 +7864,7 @@ var Ja = class {
7715
7864
  this._interval && (window.clearTimeout(this._interval), this._interval = null), this.unsubscribe(), this._destroyDetectors();
7716
7865
  }
7717
7866
  _onRemoteTrackAdded(e, t, n) {
7718
- if (n.kind === k.audio && (this._detectors.get(e)?.destroy(), this._detectors.set(e, new to(e, n)), !this._interval)) {
7867
+ if (n.kind === k.audio && (this._detectors.get(e)?.destroy(), this._detectors.set(e, new oo(e, n)), !this._interval)) {
7719
7868
  let e = () => {
7720
7869
  this._collectVolumes(), this._interval = window.setTimeout(e, M.voiceParams.interval);
7721
7870
  };
@@ -7773,11 +7922,11 @@ var Ja = class {
7773
7922
  e.destroy();
7774
7923
  }), this._detectors.clear();
7775
7924
  }
7776
- }, oo = /* @__PURE__ */ function(e) {
7925
+ }, fo = /* @__PURE__ */ function(e) {
7777
7926
  return e.SPEAKER_CHANGED = "SPEAKER_CHANGED", e;
7778
- }({}), so = class extends y {
7927
+ }({}), po = class extends b {
7779
7928
  constructor(e, t, n) {
7780
- super(), h(this, "_speakerId", null), h(this, "_serverSideSpeakerDetection", !1), this._serverSideSpeakerDetection = n === q.SERVER, this.subscribe(e, io.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this.subscribe(t, J.SIGNALLED_SPEAKER_CHANGED, this._onServerSpeakerChanged.bind(this)), this.subscribe(t, J.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this));
7929
+ super(), h(this, "_speakerId", null), h(this, "_serverSideSpeakerDetection", !1), this._serverSideSpeakerDetection = n === q.SERVER, this.subscribe(e, lo.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this.subscribe(t, J.SIGNALLED_SPEAKER_CHANGED, this._onServerSpeakerChanged.bind(this)), this.subscribe(t, J.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this));
7781
7930
  }
7782
7931
  destroy() {
7783
7932
  this.unsubscribe();
@@ -7799,9 +7948,9 @@ var Ja = class {
7799
7948
  _onTopologyChanged(e) {
7800
7949
  this._serverSideSpeakerDetection = e === q.SERVER;
7801
7950
  }
7802
- }, co = 15e3, lo = 15e3, uo = class extends y {
7951
+ }, mo = 15e3, ho = 15e3, go = class extends b {
7803
7952
  constructor(e, t, n, r = R, i = null) {
7804
- 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, J.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(t, io.VOLUMES_DETECTED, this._onVolumesDetected.bind(this));
7953
+ 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, J.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(t, lo.VOLUMES_DETECTED, this._onVolumesDetected.bind(this));
7805
7954
  }
7806
7955
  destroy() {
7807
7956
  this.unsubscribe(), this._connectionTimeout && window.clearTimeout(this._connectionTimeout), this._volumeTimeout && window.clearTimeout(this._volumeTimeout);
@@ -7813,13 +7962,13 @@ var Ja = class {
7813
7962
  this._connectionTimeout || !this._connectionTimeoutSuppressed || this._reportConnectionTimeout();
7814
7963
  }
7815
7964
  _getConnectionTimeout() {
7816
- return this._transport.getTopology() === q.DIRECT ? co : M.specListenerParams.connectionTimeout;
7965
+ return this._transport.getTopology() === q.DIRECT ? mo : M.specListenerParams.connectionTimeout;
7817
7966
  }
7818
7967
  _getVolumeTimeout() {
7819
- return this._transport.getTopology() === q.DIRECT ? lo : M.specListenerParams.volumeTimeout;
7968
+ return this._transport.getTopology() === q.DIRECT ? ho : M.specListenerParams.volumeTimeout;
7820
7969
  }
7821
7970
  _onTransportStateChanged(e, t) {
7822
- t === K.OPENED && (this._connectionTimeout || (this._connectionTimeoutSuppressed = !1, this._connectionTimeout = window.setTimeout(this._onConnectionTimeout.bind(this), this._getConnectionTimeout()))), t === K.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 === K.FAILED && this._connectionTimeout && (this._debug.warn("Transport failed, send callSpecError"), this._logger?.log(S.CALL_SPEC_ERROR, `${this._transport.getTopology()}_CONNECTION_TIMEOUT`));
7971
+ t === K.OPENED && (this._connectionTimeout || (this._connectionTimeoutSuppressed = !1, this._connectionTimeout = window.setTimeout(this._onConnectionTimeout.bind(this), this._getConnectionTimeout()))), t === K.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 === K.FAILED && this._connectionTimeout && (this._debug.warn("Transport failed, send callSpecError"), this._logger?.log(C.CALL_SPEC_ERROR, `${this._transport.getTopology()}_CONNECTION_TIMEOUT`));
7823
7972
  }
7824
7973
  _onVolumesDetected(e) {
7825
7974
  Object.keys(e).forEach((t) => {
@@ -7839,17 +7988,17 @@ var Ja = class {
7839
7988
  }
7840
7989
  t = !0;
7841
7990
  }
7842
- }), 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`));
7991
+ }), 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`));
7843
7992
  }
7844
7993
  _onVolumeTimeout() {
7845
7994
  let e = [];
7846
7995
  Object.keys(this._volumes).forEach((t) => {
7847
7996
  if (this._volumes[t] > 0) return;
7848
7997
  let n = "UNKNOWN", r = this._participants[t];
7849
- 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}`));
7998
+ 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}`));
7850
7999
  }), e.length && this._debug.warn("There is silent participant, send callSpecError"), this._volumeTimeout = 0;
7851
8000
  }
7852
- }, fo = class extends f {
8001
+ }, _o = class extends f {
7853
8002
  constructor(e, t, n) {
7854
8003
  super(), h(this, "_externalLogger", void 0), h(this, "_api", void 0), h(this, "_conversationIdProvider", void 0), h(this, "_batchInterval", 3e3), h(this, "_batchedClientStats", []), h(this, "_batchedClientEvents", []), h(this, "_batchTimeout", null), h(this, "_serverTimeDelta", 0), this._api = e, this._externalLogger = t, this._conversationIdProvider = n, this._calculateServerTimeDelta();
7855
8004
  }
@@ -7908,7 +8057,7 @@ var Ja = class {
7908
8057
  _now() {
7909
8058
  return Date.now() - this._serverTimeDelta;
7910
8059
  }
7911
- }, po = class {
8060
+ }, vo = class {
7912
8061
  constructor(e, t) {
7913
8062
  h(this, "_logger", void 0), h(this, "_codecUsages", /* @__PURE__ */ new Map()), h(this, "getCurrentTransportTopology", void 0), this._logger = e, this.getCurrentTransportTopology = t;
7914
8063
  }
@@ -7971,7 +8120,7 @@ var Ja = class {
7971
8120
  this.report(e);
7972
8121
  }), this._codecUsages.clear();
7973
8122
  }
7974
- }, mo = class {
8123
+ }, yo = class {
7975
8124
  constructor(e) {
7976
8125
  h(this, "_logger", void 0), h(this, "_eventualLogs", /* @__PURE__ */ new Set()), this._logger = e;
7977
8126
  }
@@ -7996,7 +8145,7 @@ var Ja = class {
7996
8145
  destroy() {
7997
8146
  this._eventualLogs.clear();
7998
8147
  }
7999
- }, ho = class {
8148
+ }, bo = class {
8000
8149
  constructor(e) {
8001
8150
  if (h(this, "q", void 0), h(this, "inits", []), h(this, "n", [
8002
8151
  1,
@@ -8055,7 +8204,7 @@ var Ja = class {
8055
8204
  5
8056
8205
  ];
8057
8206
  }
8058
- }, go = class {
8207
+ }, xo = class {
8059
8208
  constructor() {
8060
8209
  h(this, "n", 0), h(this, "mean", 0);
8061
8210
  }
@@ -8067,9 +8216,9 @@ var Ja = class {
8067
8216
  get avg() {
8068
8217
  return this.n ? this.mean : NaN;
8069
8218
  }
8070
- }, _o = class {
8219
+ }, So = class {
8071
8220
  constructor() {
8072
- h(this, "count", 0), h(this, "minVal", Infinity), h(this, "maxVal", -Infinity), h(this, "mean", new go()), h(this, "p50", new ho(.5)), h(this, "p95", new ho(.95));
8221
+ h(this, "count", 0), h(this, "minVal", Infinity), h(this, "maxVal", -Infinity), h(this, "mean", new xo()), h(this, "p50", new bo(.5)), h(this, "p95", new bo(.95));
8073
8222
  }
8074
8223
  add(e) {
8075
8224
  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++;
@@ -8087,11 +8236,11 @@ var Ja = class {
8087
8236
  get hasData() {
8088
8237
  return this.count > 0;
8089
8238
  }
8090
- }, vo = class {
8239
+ }, Co = class {
8091
8240
  constructor(e) {
8092
8241
  h(this, "_logger", void 0), h(this, "trackerByTransport", {
8093
- ws: new _o(),
8094
- wt: new _o()
8242
+ ws: new So(),
8243
+ wt: new So()
8095
8244
  }), h(this, "lastSeen", {}), this._logger = e;
8096
8245
  }
8097
8246
  mark(e) {
@@ -8121,17 +8270,17 @@ var Ja = class {
8121
8270
  }
8122
8271
  destroy() {
8123
8272
  this.trackerByTransport = {
8124
- ws: new _o(),
8125
- wt: new _o()
8273
+ ws: new So(),
8274
+ wt: new So()
8126
8275
  }, this.lastSeen = {};
8127
8276
  }
8128
- }, yo = class {
8277
+ }, wo = class {
8129
8278
  constructor(e) {
8130
8279
  h(this, "_logger", void 0), h(this, "trackerByCommand", /* @__PURE__ */ new Map()), this._logger = e;
8131
8280
  }
8132
8281
  mark(e, t, n) {
8133
8282
  let r = `${e}|${n}`, i;
8134
- this.trackerByCommand.has(r) ? i = this.trackerByCommand.get(r) : (i = new _o(), this.trackerByCommand.set(r, i)), i.add(t);
8283
+ this.trackerByCommand.has(r) ? i = this.trackerByCommand.get(r) : (i = new So(), this.trackerByCommand.set(r, i)), i.add(t);
8135
8284
  }
8136
8285
  logMetrics(e) {
8137
8286
  for (let [t, n] of this.trackerByCommand.entries()) {
@@ -8154,9 +8303,9 @@ var Ja = class {
8154
8303
  destroy() {
8155
8304
  this.trackerByCommand.clear();
8156
8305
  }
8157
- }, bo = class e {
8306
+ }, To = class e {
8158
8307
  constructor(e, t, n, r) {
8159
- h(this, "logger", void 0), h(this, "statAggregator", void 0), h(this, "codecStatsAggregator", void 0), h(this, "pings", void 0), h(this, "signalingCommands", void 0), this.logger = new fo(e, t, n), this.statAggregator = new mo(this.logger), this.codecStatsAggregator = new po(this.logger, r), this.pings = new vo(this.logger), this.signalingCommands = new yo(this.logger);
8308
+ h(this, "logger", void 0), h(this, "statAggregator", void 0), h(this, "codecStatsAggregator", void 0), h(this, "pings", void 0), h(this, "signalingCommands", void 0), this.logger = new _o(e, t, n), this.statAggregator = new yo(this.logger), this.codecStatsAggregator = new vo(this.logger, r), this.pings = new Co(this.logger), this.signalingCommands = new wo(this.logger);
8160
8309
  }
8161
8310
  logHangup(t, n) {
8162
8311
  if (![
@@ -8200,7 +8349,7 @@ var Ja = class {
8200
8349
  default: return "hangup";
8201
8350
  }
8202
8351
  }
8203
- }, xo = class {
8352
+ }, Eo = class {
8204
8353
  constructor(e) {
8205
8354
  h(this, "_statAggregator", void 0), h(this, "_isCallMarked", !1), h(this, "_isFinished", !1), h(this, "_callType", null), this._statAggregator = e;
8206
8355
  }
@@ -8210,14 +8359,14 @@ var Ja = class {
8210
8359
  markAcceptedCall(e) {
8211
8360
  e === q.DIRECT && this.mark("direct_outgoing");
8212
8361
  }
8213
- markParticipantJoined(e) {
8214
- e === q.DIRECT && this.mark("server_change_topology");
8215
- }
8216
8362
  markOnJoin(e) {
8217
- e === q.SERVER && this.mark("server_join_server");
8363
+ this.mark(e === q.DIRECT ? "direct_join" : "server_join_server", e === q.DIRECT);
8218
8364
  }
8219
- mark(e) {
8220
- this._isCallMarked || (this._isCallMarked = !0, this._callType = e, W.setMark(H.FIRST_MEDIA_RECEIVED));
8365
+ markTopologyChanged(e) {
8366
+ this._isFinished || e !== q.SERVER || (this._callType = "server_change_topology");
8367
+ }
8368
+ mark(e, t = !1) {
8369
+ (!this._isCallMarked || t) && (this._isCallMarked = !0, this._callType = e, W.setMark(H.FIRST_MEDIA_RECEIVED));
8221
8370
  }
8222
8371
  measure() {
8223
8372
  this._isFinished || (this._isFinished = !0, this._callType && this._statAggregator.logEventualStat({
@@ -8225,9 +8374,9 @@ var Ja = class {
8225
8374
  call_type: this._callType
8226
8375
  }));
8227
8376
  }
8228
- }, So = 1e3, Co = 1e4, wo = 15, Q = class e extends y {
8377
+ }, Do = 1e3, Oo = 1e4, ko = 15, Q = class e extends b {
8229
8378
  constructor(e, t) {
8230
- 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, "_participantState", X.CALLED), h(this, "_participants", {}), h(this, "_pendingParticipants", /* @__PURE__ */ new Map()), 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, "_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) => {
8379
+ 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", X.CALLED), h(this, "_participants", {}), h(this, "_pendingParticipants", /* @__PURE__ */ new Map()), 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, "_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) => {
8231
8380
  if (this._signaling.ready) try {
8232
8381
  await this._signaling.changeMediaSettings(e);
8233
8382
  } catch (e) {
@@ -8237,7 +8386,7 @@ var Ja = class {
8237
8386
  captureAudio: !1
8238
8387
  });
8239
8388
  }
8240
- }, 100)), this._stats = new bo(e, t, () => this._conversation?.id || null, () => this._transport?.getTopology()), this._api = e, this._signaling = new Ta(this._debug, this._stats.logger, this._stats.statAggregator, this._stats.pings, this._stats.signalingCommands), this._signalingActor = new ro(this._onSignalingNotification.bind(this), this._debug), this._displayLayoutRequester = new $a({
8389
+ }, 100)), this._stats = new To(e, t, () => this._conversation?.id || null, () => this._transport?.getTopology()), this._api = e, this._signaling = new Da(this._debug, this._stats.logger, this._stats.statAggregator, this._stats.pings, this._stats.signalingCommands), this._signalingActor = new co(this._onSignalingNotification.bind(this), this._debug), this._displayLayoutRequester = new io({
8241
8390
  api: this._api,
8242
8391
  debug: this._debug,
8243
8392
  getParticipants: () => this._getParticipants(),
@@ -8248,13 +8397,13 @@ var Ja = class {
8248
8397
  event_type: H.CALL_DECLINED_OR_HANGED_LOCALLY,
8249
8398
  reason: "none"
8250
8399
  }, !0)), this._stats.destroy();
8251
- }, window.addEventListener("pagehide", this._onUnload), this._statFirstMediaReceived = new xo(this._stats.statAggregator), this._audioOutput = new Ya(this._statFirstMediaReceived, M.transparentAudio, this._debug, this._stats.logger), M.videoTracksCount > 0 && (this._cooldownQueueCleanupTimer = window.setInterval(this._cleanupCooldownQueue.bind(this), So));
8400
+ }, window.addEventListener("pagehide", this._onUnload), this._statFirstMediaReceived = new Eo(this._stats.statAggregator), this._audioOutput = new Za(this._statFirstMediaReceived, M.transparentAudio, this._debug, this._stats.logger), M.videoTracksCount > 0 && (this._cooldownQueueCleanupTimer = window.setInterval(this._cleanupCooldownQueue.bind(this), Do));
8252
8401
  }
8253
8402
  static current() {
8254
8403
  return z.getActive();
8255
8404
  }
8256
8405
  static hangupAfterInit() {
8257
- let e = To;
8406
+ let e = Ao;
8258
8407
  e && e._delayedHangup === !1 && !e._conversation && (e._delayedHangup = !0, e._abortController?.abort(new O(D.CANCELED)));
8259
8408
  }
8260
8409
  static id() {
@@ -8283,11 +8432,11 @@ var Ja = class {
8283
8432
  }
8284
8433
  async onStart({ opponentIds: e, opponentType: t, mediaOptions: n, payload: r = "", joiningAllowed: i = !1, requireAuthToJoin: a = !1, onlyAdminCanShareMovie: o, externalIds: s, onFastStart: c, conversationId: l }) {
8285
8434
  let u = Date.now();
8286
- this._debug.setConversationId(l ?? null), To = this, this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal);
8435
+ this._debug.setConversationId(l ?? null), Ao = this, this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal);
8287
8436
  try {
8288
8437
  this._mediaSource = this._createMediaSource(), await this._mediaSource.request(n);
8289
8438
  let d = this._mediaSource.mediaSettings;
8290
- t === Ea.CHAT || e && e.length > 1 ? this._logWithMediaSettings(S.OUTGOING_MULTIPARTY_CALL, d) : this._logWithMediaSettings(S.OUTGOING_CALL, d);
8439
+ t === Oa.CHAT || e && e.length > 1 ? this._logWithMediaSettings(C.OUTGOING_MULTIPARTY_CALL, d) : this._logWithMediaSettings(C.OUTGOING_CALL, d);
8291
8440
  let f = await this._startConversation({
8292
8441
  opponentIds: e,
8293
8442
  opponentType: t,
@@ -8308,44 +8457,44 @@ var Ja = class {
8308
8457
  opponentIds: e,
8309
8458
  opponentType: t,
8310
8459
  mediaOptions: n
8311
- }), await this._processConnectionSharedMovieInfo(f), await this._processConversationUrlSharingInfo(f), L.onLocalStream(this._mediaSource.getStream(), this._mediaSource.mediaSettings, this.id), L.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), await this._getMainRoomParticipants(), void 0, this.id), await this._onConversationParticipantListChunk(f), await this._processPinnedParticipants(f), L.onLocalStatus(N.WAITING, this.id), this._toggleJoinAvailability(), this._changeFeatureSet(), this._changeNeedRate(), z.add(this), await z.setActive(this.id), To = null, this._conversation.concurrent && await this._acceptConcurrent(), this._conversation;
8460
+ }), await this._processConnectionSharedMovieInfo(f), await this._processConversationUrlSharingInfo(f), L.onLocalStream(this._mediaSource.getStream(), this._mediaSource.mediaSettings, this.id), L.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), await this._getMainRoomParticipants(), void 0, this.id), await this._onConversationParticipantListChunk(f), await this._processPinnedParticipants(f), L.onLocalStatus(N.WAITING, this.id), this._toggleJoinAvailability(), this._changeFeatureSet(), this._changeNeedRate(), z.add(this), await z.setActive(this.id), Ao = null, this._conversation.concurrent && await this._acceptConcurrent(), this._conversation;
8312
8461
  } catch (e) {
8313
- throw To = null, this._close(e, "Unable to start conversation"), e;
8462
+ throw Ao = null, this._close(e, "Unable to start conversation"), e;
8314
8463
  }
8315
8464
  }
8316
8465
  async onJoin(e) {
8317
8466
  let t = Date.now();
8318
- To = 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);
8467
+ Ao = 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);
8319
8468
  try {
8320
8469
  let n = !!e.observedIds?.length;
8321
8470
  if (n && M.videoTracksCount > 0) throw this._debug.error("Observer mode: please set videoTracksCount=0"), new O(D.UNSUPPORTED);
8322
8471
  this._mediaSource = this._createMediaSource(), await this._mediaSource.request(e.mediaOptions, !n);
8323
8472
  let r = this._mediaSource.mediaSettings;
8324
- this._logWithMediaSettings(S.JOIN_CONVERSATION, r);
8473
+ this._logWithMediaSettings(C.JOIN_CONVERSATION, r);
8325
8474
  let i = await this._joinConversation(e, t);
8326
8475
  if (!this._conversation) throw new O(D.UNKNOWN_ERROR);
8327
- return this._conversation.observer = n, L.onLocalStream(this._mediaSource.getStream(), r, this.id), this._conversation.waitForAdmin || this._conversation.waitingHall ? (this._debug.log(this._conversation.waitForAdmin ? "Wait for admin" : "In waiting hall"), z.add(this), To = null, this._signaling.readyToSend(), L.onLocalStatus(this._conversation.waitForAdmin ? N.WAIT_FOR_ADMIN : N.WAITING_HALL, this.id), this._conversation) : this._onJoinPart2(i);
8476
+ return this._conversation.observer = n, L.onLocalStream(this._mediaSource.getStream(), r, this.id), this._conversation.waitForAdmin || this._conversation.waitingHall ? (this._debug.log(this._conversation.waitForAdmin ? "Wait for admin" : "In waiting hall"), z.add(this), Ao = null, this._signaling.readyToSend(), L.onLocalStatus(this._conversation.waitForAdmin ? N.WAIT_FOR_ADMIN : N.WAITING_HALL, this.id), this._conversation) : this._onJoinPart2(i);
8328
8477
  } catch (e) {
8329
- throw To = null, this._close(e, "Unable to join conversation"), e;
8478
+ throw Ao = null, this._close(e, "Unable to join conversation"), e;
8330
8479
  }
8331
8480
  }
8332
- async _onJoinPart2(e) {
8481
+ async _onJoinPart2(e, t = !0, n = !1) {
8333
8482
  this._debug.debug("Join conversation part 2");
8334
8483
  try {
8335
8484
  if (this._participantState = X.ACCEPTED, !this._conversation || !this._mediaSource) throw new O(D.UNKNOWN_ERROR);
8336
- if (this._statFirstMediaReceived.markOnJoin(this._conversation.topology), !this._conversation.observer && !this._isAudienceModeListener() && this._changeMediaSettings(this._mediaSource.mediaSettings), await this._processConnection(e), await this._allocateTransport(), this._createSpeakerDetector(), await this._createSpecListener(), this._signaling.readyToSend(), this._state === "CLOSE") return this._conversation;
8485
+ if (this._statFirstMediaReceived.markOnJoin(this._conversation.topology), !this._conversation.observer && !this._isAudienceModeListener() && this._changeMediaSettings(this._mediaSource.mediaSettings), await this._processConnection(e), t && (await this._allocateTransport(), this._createSpeakerDetector(), await this._createSpecListener()), this._signaling.readyToSend(), this._state === "CLOSE") return this._conversation;
8337
8486
  if (this._delayedHangup) throw new O(D.CANCELED);
8338
8487
  await this._processConnectionSharedMovieInfo(e), await this._processConversationUrlSharingInfo(e), await this._processConnectionAsrInfo(e);
8339
- let t = await this._extractExternalRoomsData(e.rooms?.rooms, e.rooms?.roomId);
8340
- L.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), await this._getMainRoomParticipants(), t, this.id), await this._onConversationParticipantListChunk(e), await this._processPinnedParticipants(e), L.onLocalStatus(N.WAITING, this.id), this._toggleJoinAvailability(), this._changeNeedRate(), this._state = "ACTIVE", this._changeFeatureSet(), z.has(this.id) || z.add(this), await z.setActive(this.id), To = null;
8341
- let n = this._extractLocalParticipantFromConnection(e);
8342
- if (n) {
8343
- let e = j.mapParticipantState(n);
8488
+ let r = await this._extractExternalRoomsData(e.rooms?.rooms, e.rooms?.roomId);
8489
+ L.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), await this._getMainRoomParticipants(), r, this.id), await this._onConversationParticipantListChunk(e), await this._processPinnedParticipants(e), L.onLocalStatus(N.WAITING, this.id), this._toggleJoinAvailability(), this._changeNeedRate(), t && (this._state = "ACTIVE"), this._changeFeatureSet(), t && (z.has(this.id) || z.add(this), n ? await this._holdLocally() : await z.setActive(this.id), Ao = null);
8490
+ let i = this._extractLocalParticipantFromConnection(e);
8491
+ if (i) {
8492
+ let e = j.mapParticipantState(i);
8344
8493
  Object.keys(e).length > 0 && L.onLocalParticipantState(e, !1, this.id);
8345
8494
  }
8346
- return this._openTransport(Object.values(await this._getParticipants()), !1), this._conversation;
8495
+ return t && this._openTransport(Object.values(await this._getParticipants()), !1), this._conversation;
8347
8496
  } catch (e) {
8348
- throw To = null, this._close(e, "Unable to join conversation"), e;
8497
+ throw Ao = null, this._close(e, "Unable to join conversation"), e;
8349
8498
  }
8350
8499
  }
8351
8500
  async _extractExternalRooms(e) {
@@ -8359,22 +8508,22 @@ var Ja = class {
8359
8508
  }
8360
8509
  async onPush(e, t = A.USER, n, r, i) {
8361
8510
  if (z.has(e)) throw new O(D.HAS_ACTIVE_CALL);
8362
- this._debug.setConversationId(e), To = this, this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal);
8511
+ this._debug.setConversationId(e), Ao = this, this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal);
8363
8512
  try {
8364
8513
  let a = Date.now(), o = await this._prepareConversation(e, t, n, r, i);
8365
8514
  if (this._mediaSource = this._createMediaSource(), !this._conversation) throw new O(D.UNKNOWN_ERROR);
8366
- if (!o.conversation.participants.find((e) => e.state === X.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);
8367
- if (await this._processConnection(o), this._extractConnectionUrlSharingInfo(o), await this._allocateTransport(), this._createSpeakerDetector(), await this._createSpecListener(), await this._processPinnedParticipants(o), this._signaling.readyToSend(), this._logCallStartEvent(a, Y.INCOMING), this._stats.logger.log(S.PUSH, "accepted"), z.add(this), To = null, this._delayedHangup) throw new O(D.CANCELED);
8515
+ if (!o.conversation.participants.find((e) => e.state === X.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);
8516
+ if (await this._processConnection(o), this._extractConnectionUrlSharingInfo(o), await this._allocateTransport(), this._createSpeakerDetector(), await this._createSpecListener(), await this._processPinnedParticipants(o), this._signaling.readyToSend(), this._logCallStartEvent(a, Y.INCOMING), this._stats.logger.log(C.PUSH, "accepted"), z.add(this), Ao = null, this._delayedHangup) throw new O(D.CANCELED);
8368
8517
  } catch (e) {
8369
- throw To = null, this._close(e, "Unable to handle inbound call push"), e;
8518
+ throw Ao = null, this._close(e, "Unable to handle inbound call push"), e;
8370
8519
  }
8371
8520
  }
8372
8521
  _isInWaitingHall(e) {
8373
- return !e.conversation || !e.conversation.options.includes(ka.WAITING_HALL) ? !1 : this._isRestricted(e);
8522
+ return !e.conversation || !e.conversation.options.includes(ja.WAITING_HALL) ? !1 : this._isRestricted(e);
8374
8523
  }
8375
8524
  _isWaitForAdmin(e) {
8376
8525
  if (!e.conversation) return !1;
8377
- let t = e.conversation.options.includes(ka.WAIT_FOR_ADMIN), n = e.conversation.options.includes(ka.ADMIN_IS_HERE);
8526
+ let t = e.conversation.options.includes(ja.WAIT_FOR_ADMIN), n = e.conversation.options.includes(ja.ADMIN_IS_HERE);
8378
8527
  return !t || t && n ? !1 : this._isRestricted(e);
8379
8528
  }
8380
8529
  _isRestricted(e) {
@@ -8382,7 +8531,7 @@ var Ja = class {
8382
8531
  return t && t.restricted || !1;
8383
8532
  }
8384
8533
  _isAudienceMode(e) {
8385
- return e.conversation?.options?.includes(ka.AUDIENCE_MODE) || !1;
8534
+ return e.conversation?.options?.includes(ja.AUDIENCE_MODE) || !1;
8386
8535
  }
8387
8536
  _isAudienceModeListener() {
8388
8537
  return this._conversation?.audienceMode && this._conversation?.restricted;
@@ -8391,7 +8540,7 @@ var Ja = class {
8391
8540
  if (!this._mediaSource || !this._conversation || !this._transport) throw new O(D.UNKNOWN_ERROR);
8392
8541
  this._state = "PROCESSING";
8393
8542
  let e = this._mediaSource.mediaSettings;
8394
- this._logWithMediaSettings(S.ACCEPT_CONCURRENT, e), this._debug.debug("Concurrent call", { conversationId: this._conversation.id });
8543
+ this._logWithMediaSettings(C.ACCEPT_CONCURRENT, e), this._debug.debug("Concurrent call", { conversationId: this._conversation.id });
8395
8544
  try {
8396
8545
  this._statFirstMediaReceived.markAcceptCall(this._transport.getTopology()), await this._signaling.acceptCall(this._mediaSource.mediaSettings), L.onCallAccepted(this.id), this._state = "ACTIVE", this._participantState = X.ACCEPTED, this._changeFeatureSet(), this._openTransport(Object.values(await this._getParticipants()), !0);
8397
8546
  } catch (e) {
@@ -8408,7 +8557,7 @@ var Ja = class {
8408
8557
  let i = atob(n), a = new Uint8Array(i.length);
8409
8558
  for (let e = 0; e < i.length; e++) a[e] = i.charCodeAt(e);
8410
8559
  try {
8411
- let e = qa(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);
8560
+ let e = Ya(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);
8412
8561
  return {
8413
8562
  token: i,
8414
8563
  endpoint: l,
@@ -8438,13 +8587,13 @@ var Ja = class {
8438
8587
  });
8439
8588
  }
8440
8589
  async accept(e) {
8441
- 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");
8590
+ 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");
8442
8591
  if (!this._mediaSource || !this._conversation || !this._transport) throw new O(D.UNKNOWN_ERROR);
8443
8592
  this._state = "PROCESSING", this._debug.setConversationId(this._conversation.id), this._debug.debug("Accept incoming call", e);
8444
8593
  try {
8445
8594
  await this._mediaSource.request(e);
8446
8595
  let t = this._mediaSource.mediaSettings;
8447
- this._logWithMediaSettings(S.ACCEPT_INCOMING, t), this._changeMediaSettings(t), this._statFirstMediaReceived.markAcceptCall(this._transport.getTopology()), await this._signaling.acceptCall(t), this._participantState = X.ACCEPTED;
8596
+ this._logWithMediaSettings(C.ACCEPT_INCOMING, t), this._changeMediaSettings(t), this._statFirstMediaReceived.markAcceptCall(this._transport.getTopology()), await this._signaling.acceptCall(t), this._participantState = X.ACCEPTED;
8448
8597
  let n = this._getMuteStatesForCurrentRoom(), r = Object.keys(n);
8449
8598
  r.length && this._onMuteParticipant({
8450
8599
  muteStates: n,
@@ -8476,13 +8625,13 @@ var Ja = class {
8476
8625
  }
8477
8626
  }
8478
8627
  async decline() {
8479
- 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");
8480
- this._state = "PROCESSING", this._debug.debug("Decline incoming call"), this._logWithMediaSettings(S.DECLINE_INCOMING, this.mediaSettings), this._participantState = X.HUNGUP, this._signaling.ready && await this._signaling.hangup(D.REJECTED), this._close(new O(D.REJECTED));
8628
+ 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");
8629
+ this._state = "PROCESSING", this._debug.debug("Decline incoming call"), this._logWithMediaSettings(C.DECLINE_INCOMING, this.mediaSettings), this._participantState = X.HUNGUP, this._signaling.ready && await this._signaling.hangup(D.REJECTED), this._close(new O(D.REJECTED));
8481
8630
  }
8482
8631
  async hangup() {
8483
8632
  this._debug.debug("Hangup");
8484
- let e = this._state === "ACTIVE" ? D.HUNGUP : D.CANCELED;
8485
- this._stats.logger.log(S.HANGUP, e), this._signaling.ready ? (await this._signaling.hangup(e), this._close(new O(e))) : L.onHangup(new O(D.HUNGUP), this._conversation && this._conversation.id), this._conversation?.id && z.has(this._conversation.id) && z.remove(this._conversation.id);
8633
+ let e = this._state === "ACTIVE" || this._state === "HELD" ? D.HUNGUP : D.CANCELED;
8634
+ this._stats.logger.log(C.HANGUP, e), this._signaling.ready ? (await this._signaling.hangup(e), this._close(new O(e))) : L.onHangup(new O(D.HUNGUP), this._conversation && this._conversation.id), this._conversation?.id && z.has(this._conversation.id) && z.remove(this._conversation.id);
8486
8635
  }
8487
8636
  async addParticipant(e, t) {
8488
8637
  if (!this._signaling.ready) {
@@ -8521,7 +8670,7 @@ var Ja = class {
8521
8670
  r.length ? this._transport.open(r, null, !!this._conversation?.observer) : this._transport.getTopology() === q.SERVER && this._forceOpenTransportForAloneInCall();
8522
8671
  }
8523
8672
  async _close(e, t) {
8524
- t && this._debug.error(t, e), this._debug.debug("Close conversation", e), this._stats.logHangup(e, this._transport?.getTopology()), this._stats.flushCallMetrics(this._transport?.getTopology()), this._signaling.readyToSend(!1), e.error ? this._signaling.ready && this._signaling.hangup(D.FAILED) : this._stats.logger.log(S.ERROR, e.hangup);
8673
+ t && this._debug.error(t, e), this._debug.debug("Close conversation", e), this._stats.logHangup(e, this._transport?.getTopology()), this._stats.flushCallMetrics(this._transport?.getTopology()), this._signaling.readyToSend(!1), e.error ? this._signaling.ready && this._signaling.hangup(D.FAILED) : this._stats.logger.log(C.ERROR, e.hangup);
8525
8674
  let n = this._conversation && this._conversation.id;
8526
8675
  if ([
8527
8676
  D.CANCELED,
@@ -8596,7 +8745,7 @@ var Ja = class {
8596
8745
  opponentType: t,
8597
8746
  direction: n
8598
8747
  });
8599
- let p = r.includes(x.VIDEO), m;
8748
+ let p = r.includes(S.VIDEO), m;
8600
8749
  if (u) {
8601
8750
  let e = {
8602
8751
  deviceId: this._api.deviceId(),
@@ -8654,7 +8803,7 @@ var Ja = class {
8654
8803
  joinLink: a,
8655
8804
  observedIds: o
8656
8805
  }), n && z.has(n)) throw new O(D.HAS_ACTIVE_CALL);
8657
- let l = r.includes(x.VIDEO), u;
8806
+ let l = r.includes(S.VIDEO), u, d;
8658
8807
  if (c) {
8659
8808
  if (!a) throw new O(D.FAST_JOIN_ERROR, { message: "joinLink is required for fast join" });
8660
8809
  let e = {
@@ -8687,17 +8836,17 @@ var Ja = class {
8687
8836
  stun_server: e.stun,
8688
8837
  turn_server: e.turn,
8689
8838
  token: new URL(e.endpoint).searchParams.get("token") ?? ""
8690
- }, this._debug.debug("FastJoin", u);
8839
+ }, this._debug.debug("FastJoin", u), d = "fastJoin";
8691
8840
  } catch {
8692
8841
  throw new O(D.FAST_JOIN_ERROR, { message: "Cannot parse internal params" });
8693
8842
  }
8694
- } else if (n) u = await this._api.joinConversation(n, l, i);
8695
- else if (a) u = await this._api.joinConversationByLink(a, l, o, s);
8843
+ } else if (n) u = await this._api.joinConversation(n, l, i), d = "joinConversation";
8844
+ else if (a) u = await this._api.joinConversationByLink(a, l, o, s), d = "joinConversationByLink";
8696
8845
  else throw new O(D.UNKNOWN_ERROR);
8697
- if (this._debug.debug("Api.joinConversation", u), u.id && z.has(u.id)) throw new O(D.HAS_ACTIVE_CALL);
8846
+ if (this._debug.debug("Api.joinConversation", u), Qa(u, d), u.id && z.has(u.id)) throw new O(D.HAS_ACTIVE_CALL);
8698
8847
  this._setConversationParams(u);
8699
- let d = await this._connectSignaling(dr.JOIN, u);
8700
- return await this._setConversation(u, d, Y.JOINING), this._logCallStartEvent(t, Y.JOINING), d;
8848
+ let f = await this._connectSignaling(dr.JOIN, u);
8849
+ return await this._setConversation(u, f, Y.JOINING), this._logCallStartEvent(t, Y.JOINING), f;
8701
8850
  }
8702
8851
  async _prepareConversation(e, t = A.USER, n, r, i) {
8703
8852
  W.setMark(H.SIGNALING_CONNECTED), this._debug.debug("Conversation: push", {
@@ -8725,7 +8874,7 @@ var Ja = class {
8725
8874
  o = n.device_idx || 0, s = i ?? `${M.wssBase}?userId=${a}&entityType=${t}&deviceIdx=${o}&conversationId=${e}&token=${M.wssToken}`, s = this._addGeoParamsToEndpoint(s, n), l.token = n.token, l.endpoint = s, l.device_idx = o, M.wtsBase && (c = `${M.wtsBase}?userId=${a}&entityType=${t}&deviceIdx=${o}&conversationId=${e}&token=${M.wssToken}`, c = this._addGeoParamsToEndpoint(c, n), l.wt_endpoint = c);
8726
8875
  }
8727
8876
  let u = await this._connectSignaling(dr.ACCEPT, l);
8728
- 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))) : (await this._setConversation(l, u, Y.INCOMING, t), u);
8877
+ 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))) : (await this._setConversation(l, u, Y.INCOMING, t), u);
8729
8878
  }
8730
8879
  async _createParticipant(e, t) {
8731
8880
  let n = Object.assign({
@@ -8805,7 +8954,7 @@ var Ja = class {
8805
8954
  audienceMode: this._isAudienceMode(t),
8806
8955
  restricted: this._isRestricted(t),
8807
8956
  urlSharingInfoByRoom: /* @__PURE__ */ new Map()
8808
- }, 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();
8957
+ }, 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();
8809
8958
  }
8810
8959
  _updateConversation(e) {
8811
8960
  if (!this._conversation) throw new O(D.UNKNOWN_ERROR);
@@ -8813,7 +8962,7 @@ var Ja = class {
8813
8962
  }
8814
8963
  _createMediaSource() {
8815
8964
  let e = new Jt(this._debug, this._stats.logger);
8816
- return this.subscribe(e, Kt.SOURCE_CHANGED, this._onLocalMediaStreamChanged.bind(this)), this.subscribe(e, Kt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._audioFix = new Ja(e, this._debug, this._stats.logger), e;
8965
+ return this.subscribe(e, Kt.SOURCE_CHANGED, this._onLocalMediaStreamChanged.bind(this)), this.subscribe(e, Kt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._audioFix = new Xa(e, this._debug, this._stats.logger), e;
8817
8966
  }
8818
8967
  async _connectSignaling(e, t) {
8819
8968
  this._signaling.setEndpoint(t.endpoint), this._signaling.setWebTransportEndpoint(t.wt_endpoint ? t.wt_endpoint : null), this.subscribe(this._signaling, fr.NOTIFICATION, (e) => this._signalingActor.add(e)), this.subscribe(this._signaling, fr.FAILED, this._onSignalingFailed.bind(this)), this.subscribe(this._signaling, fr.RECONNECT, this._onSignalingReconnect.bind(this));
@@ -8821,7 +8970,7 @@ var Ja = class {
8821
8970
  return this._stats.statAggregator.logEventualStat({ name: H.SIGNALING_CONNECTED }), n;
8822
8971
  }
8823
8972
  async _processConnection(e) {
8824
- await this._registerConnectionParticipants(e), this._processRooms(e), this._processMuteStates(e), this._processRecordInfos(e), this._onOptionsChanged(e.conversation.options), e.chatRoom && e.chatRoom.totalCount && this._onChatRoomUpdated(Da.ATTENDEE, e.chatRoom.totalCount, e.chatRoom.firstParticipants, null, null);
8973
+ await this._registerConnectionParticipants(e), this._processRooms(e), this._processMuteStates(e), this._processRecordInfos(e), this._onOptionsChanged(e.conversation.options), e.chatRoom && e.chatRoom.totalCount && this._onChatRoomUpdated(ka.ATTENDEE, e.chatRoom.totalCount, e.chatRoom.firstParticipants, null, null);
8825
8974
  }
8826
8975
  async _onConversationParticipantListChunk(e) {
8827
8976
  let t = e.participants;
@@ -8874,7 +9023,8 @@ var Ja = class {
8874
9023
  participantState: j.mapParticipantState(n),
8875
9024
  state: n.state,
8876
9025
  roles: n.roles || [],
8877
- status: N.WAITING,
9026
+ status: n.onHold ? N.ONHOLD : N.WAITING,
9027
+ isOnHold: !!n.onHold,
8878
9028
  muteStates: n.muteStates || {},
8879
9029
  unmuteOptions: n.unmuteOptions || [],
8880
9030
  observedIds: n.observedIds || [],
@@ -8883,13 +9033,13 @@ var Ja = class {
8883
9033
  isInRoom: t
8884
9034
  }, i);
8885
9035
  let a = await this._getParticipant(e);
8886
- a && n.roles && n.roles.length && (this._debug.debug(`Roles for participant [${e}] changed: ${n.roles}`), L.onRolesChanged(a.externalId, n.roles, !0, this.id));
9036
+ a && n.roles && n.roles.length && (this._debug.debug(`Roles for participant [${e}] changed: ${n.roles}`), L.onRolesChanged(a.externalId, n.roles, !0, this.id)), a && a.isOnHold && L.onRemoteStatus([a.externalId], N.ONHOLD, null, this.id);
8887
9037
  }
8888
9038
  }
8889
9039
  _registerParticipantLocalMuteState({ muteStates: e, unmuteOptions: t }) {
8890
9040
  if (!e) return;
8891
9041
  let n = async () => {
8892
- let n = Va(e, Ma.MUTE), r = Va(e, Ma.MUTE_PERMANENT);
9042
+ let n = Ua(e, Pa.MUTE), r = Ua(e, Pa.MUTE_PERMANENT);
8893
9043
  for (let i of [n, r]) i.length && await this._onMuteParticipant({
8894
9044
  muteStates: e,
8895
9045
  unmuteOptions: t,
@@ -8946,11 +9096,11 @@ var Ja = class {
8946
9096
  this._onRoomSwitched(t, !0);
8947
9097
  }
8948
9098
  _processMuteStates(e, t = !1) {
8949
- let n = Ha(e);
9099
+ let n = Wa(e);
8950
9100
  this._setMuteStatesForRoomId(n, null);
8951
9101
  for (let t of e.rooms?.rooms ?? []) this._setMuteStatesForRoomId(t.muteStates, t.id);
8952
9102
  let r = this._getMuteStatesForCurrentRoom();
8953
- t && (r = Ka(e, r));
9103
+ t && (r = Ja(e, r));
8954
9104
  let i = Object.keys(r), a = this._conversation?.roomId;
8955
9105
  i.length && this._onMuteParticipant({
8956
9106
  muteStates: r,
@@ -8970,19 +9120,19 @@ var Ja = class {
8970
9120
  }
8971
9121
  async _allocateTransport() {
8972
9122
  if (!this._conversation || !this._mediaSource) return;
8973
- this._transport = new ea(this._conversation.topology, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._stats.logger, this._stats.statAggregator, this._stats.codecStatsAggregator), this._debugInfo = new Qa(this._debug), this.subscribe(this._transport, J.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(this._transport, J.LOCAL_STATE_CHANGED, this._onTransportLocalStateChanged.bind(this)), this.subscribe(this._transport, J.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(this._transport, J.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(this._transport, J.AUDIO_MIX_STALL, this._onAudioMixStall.bind(this)), this.subscribe(this._transport, J.REMOTE_DATA_STATS, this._onRemoteDataStats.bind(this)), this.subscribe(this._transport, J.SIGNALLED_STALLED_PARTICIPANTS, this._onRemoteSignalledStall.bind(this)), this.subscribe(this._transport, J.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this)), this.subscribe(this._transport, J.NETWORK_STATUS, this._onNetworkStatus.bind(this)), this.subscribe(this._transport, J.REMOTE_STREAM_SECOND, this._onRemoteStreamSecond.bind(this)), this.subscribe(this._transport, J.PEER_CONNECTION_CLOSED, this._onPeerConnectionClosed.bind(this)), this.subscribe(this._transport, J.ASR_TRANSCRIPTION, this._onAsrTranscription.bind(this)), this.subscribe(this._transport, J.ANIMOJI_STREAM, this._onAnimojiStream.bind(this)), this.subscribe(this._transport, J.ANIMOJI_ERROR, this._onAnimojiError.bind(this));
9123
+ this._transport = new ea(this._conversation.topology, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._stats.logger, this._stats.statAggregator, this._stats.codecStatsAggregator), this._debugInfo = new ro(this._debug), this.subscribe(this._transport, J.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(this._transport, J.LOCAL_STATE_CHANGED, this._onTransportLocalStateChanged.bind(this)), this.subscribe(this._transport, J.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(this._transport, J.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(this._transport, J.AUDIO_MIX_STALL, this._onAudioMixStall.bind(this)), this.subscribe(this._transport, J.REMOTE_DATA_STATS, this._onRemoteDataStats.bind(this)), this.subscribe(this._transport, J.SIGNALLED_STALLED_PARTICIPANTS, this._onRemoteSignalledStall.bind(this)), this.subscribe(this._transport, J.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this)), this.subscribe(this._transport, J.NETWORK_STATUS, this._onNetworkStatus.bind(this)), this.subscribe(this._transport, J.REMOTE_STREAM_SECOND, this._onRemoteStreamSecond.bind(this)), this.subscribe(this._transport, J.PEER_CONNECTION_CLOSED, this._onPeerConnectionClosed.bind(this)), this.subscribe(this._transport, J.ASR_TRANSCRIPTION, this._onAsrTranscription.bind(this)), this.subscribe(this._transport, J.ANIMOJI_STREAM, this._onAnimojiStream.bind(this)), this.subscribe(this._transport, J.ANIMOJI_ERROR, this._onAnimojiError.bind(this));
8974
9124
  let e = this._conversation.direction === Y.OUTGOING && !this._conversation.concurrent, t = await this._getParticipants();
8975
9125
  for (let n of Object.values(t)) (n.state === X.ACCEPTED || n.state === X.CALLED) && this._transport.allocate(n.id, e);
8976
9126
  }
8977
9127
  _createSpeakerDetector() {
8978
- this._transport && this._conversation && (this._volumesDetector = new ao(this._transport), this.subscribe(this._volumesDetector, io.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this._speakerDetector = new so(this._volumesDetector, this._transport, this._conversation.topology), this.subscribe(this._speakerDetector, oo.SPEAKER_CHANGED, this._onSpeakerChanged.bind(this)), this._localVolumeDetector = new no(this._mediaSource));
9128
+ this._transport && this._conversation && (this._volumesDetector = new uo(this._transport), this.subscribe(this._volumesDetector, lo.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this._speakerDetector = new po(this._volumesDetector, this._transport, this._conversation.topology), this.subscribe(this._speakerDetector, fo.SPEAKER_CHANGED, this._onSpeakerChanged.bind(this)), this._localVolumeDetector = new so(this._mediaSource));
8979
9129
  }
8980
9130
  async _createSpecListener() {
8981
- this._transport && this._volumesDetector && (this._specListener = new uo(this._transport, this._volumesDetector, await this._getParticipants(), this._debug, this._stats.logger));
9131
+ this._transport && this._volumesDetector && (this._specListener = new go(this._transport, this._volumesDetector, await this._getParticipants(), this._debug, this._stats.logger));
8982
9132
  }
8983
9133
  _logDevices() {
8984
9134
  let e = T.getCameras().length, t = T.getMicrophones().length;
8985
- this._debug.debug("Cameras: " + e + (T.hasCameraPermission() ? "✔" : "✖") + ", Microphones: " + t + (T.hasMicrophonePermission() ? "✔" : "✖")), this._stats.logger.log(S.DEVICES, `${e}_${t}`);
9135
+ this._debug.debug("Cameras: " + e + (T.hasCameraPermission() ? "✔" : "✖") + ", Microphones: " + t + (T.hasMicrophonePermission() ? "✔" : "✖")), this._stats.logger.log(C.DEVICES, `${e}_${t}`);
8986
9136
  }
8987
9137
  _logWithMediaSettings(e, t) {
8988
9138
  this._stats.logger.log(e, [t?.isAudioEnabled && "audio", t?.isVideoEnabled && "video"].filter(Boolean).join("_"));
@@ -9049,12 +9199,12 @@ var Ja = class {
9049
9199
  observedIds: t.observedIds || []
9050
9200
  }, n), r = await this._getParticipant(e);
9051
9201
  }
9052
- this._setParticipantsStatus([r], N.WAITING), n ? (r.state = X.HUNGUP, await this._removeParticipant(r, n)) : this._transport && (r.state = X.CALLED, this._transport.allocate(r.id, !0), this._stats.logger.log(S.ADD_PARTICIPANT), this._invokeRolesChangedCallbackIfNeeded(r));
9202
+ this._setParticipantsStatus([r], N.WAITING), n ? (r.state = X.HUNGUP, await this._removeParticipant(r, n)) : this._transport && (r.state = X.CALLED, this._transport.allocate(r.id, !0), this._stats.logger.log(C.ADD_PARTICIPANT), this._invokeRolesChangedCallbackIfNeeded(r));
9053
9203
  }
9054
9204
  async _onRemoveParticipant(e) {
9055
9205
  this._debug.debug(`Remove participant [${e}]`);
9056
9206
  let t = [], n = await this._getParticipants();
9057
- for (let r = 0; r <= wo; r++) {
9207
+ for (let r = 0; r <= ko; r++) {
9058
9208
  let i = n[j.compose(e, r)];
9059
9209
  i && t.push(i);
9060
9210
  }
@@ -9063,19 +9213,19 @@ var Ja = class {
9063
9213
  return;
9064
9214
  }
9065
9215
  if (this._transport) for (let e of t) this._transport.close(e.id);
9066
- this._stats.logger.log(S.REMOVE_PARTICIPANT);
9216
+ this._stats.logger.log(C.REMOVE_PARTICIPANT);
9067
9217
  }
9068
9218
  async changeDevice(e) {
9069
- return e === "audiooutput" ? this._audioOutput.changeOutput() : this._mediaSource ? this._mediaSource.changeDevice(e) : Promise.reject(b.UNKNOWN);
9219
+ return e === "audiooutput" ? this._audioOutput.changeOutput() : this._mediaSource ? this._mediaSource.changeDevice(e) : Promise.reject(x.UNKNOWN);
9070
9220
  }
9071
9221
  stopVideoTrack() {
9072
9222
  return this._mediaSource?.stopVideoTrack();
9073
9223
  }
9074
9224
  async toggleScreenCapturing(e) {
9075
- return this._mediaSource ? this._mediaSource.toggleScreenCapturing(e) : Promise.reject(b.UNKNOWN);
9225
+ return this._mediaSource ? this._mediaSource.toggleScreenCapturing(e) : Promise.reject(x.UNKNOWN);
9076
9226
  }
9077
9227
  async disableScreenCapturing() {
9078
- return this._mediaSource ? this._mediaSource.disableScreenCapturing() : Promise.reject(b.UNKNOWN);
9228
+ return this._mediaSource ? this._mediaSource.disableScreenCapturing() : Promise.reject(x.UNKNOWN);
9079
9229
  }
9080
9230
  toggleAnimojiCapturing(e) {
9081
9231
  this._mediaSource && this._mediaSource.toggleAnimojiCapturing(e);
@@ -9107,10 +9257,10 @@ var Ja = class {
9107
9257
  if (this._mediaSource) return this._mediaSource.setAudioStream(e);
9108
9258
  }
9109
9259
  async toggleLocalVideo(e) {
9110
- if (this._mediaSource) return this._stats.logger.log(S.MEDIA_STATUS, e ? "video_1" : "video_0"), this._mediaSource.toggleVideo(e);
9260
+ if (this._mediaSource) return this._stats.logger.log(C.MEDIA_STATUS, e ? "video_1" : "video_0"), this._mediaSource.toggleVideo(e);
9111
9261
  }
9112
9262
  async toggleLocalAudio(e) {
9113
- if (this._mediaSource) return this._stats.logger.log(S.MEDIA_STATUS, e ? "audio_1" : "audio_0"), this._mediaSource.toggleAudio(e);
9263
+ if (this._mediaSource) return this._stats.logger.log(C.MEDIA_STATUS, e ? "audio_1" : "audio_0"), this._mediaSource.toggleAudio(e);
9114
9264
  }
9115
9265
  async changePriorities(e) {
9116
9266
  if (e.length < 2 || !this._signaling.ready) return;
@@ -9131,17 +9281,41 @@ var Ja = class {
9131
9281
  t && !this._isCallAdmin() && (t = void 0), await this._signaling.changeParticipantState(e, t);
9132
9282
  }
9133
9283
  async hold(e, t) {
9134
- let n = ua.get();
9135
- if (await this._signaling.hold(e, e ? void 0 : n), e) (this._state === "ACTIVE" || this._state === "IDLE") && (this._previousState = this._state, this._state = "HELD"), await this._mediaSource?.stopLocalMedia(), L.onLocalStatus(N.ONHOLD, this.id);
9136
- else {
9137
- this._state === "HELD" && (this._state = this._previousState || "ACTIVE", this._previousState = null);
9138
- let e = null;
9139
- if (this._state === "IDLE" && this._participantState === X.ACCEPTED && (e = Object.values(await this._getParticipants()), e.some((e) => e.state === X.ACCEPTED) && (this._state = "ACTIVE", this._changeFeatureSet())), await this._mediaSource?.resumeLocalMedia(t), L.onLocalStatus(N.WAITING, this.id), this._mediaSource && L.onLocalStream(this._mediaSource?.getStream() ?? null, this._mediaSource.mediaSettings, this.id), this._state === "ACTIVE") {
9140
- let t = this._conversation?.direction === Y.OUTGOING && !this._conversation.concurrent;
9141
- this._openTransport(e ?? Object.values(await this._getParticipants()), t);
9284
+ if (e) {
9285
+ if (this._isWaitingForPromotion()) {
9286
+ this._waitingHallHoldPending = !0, await this._holdLocally();
9287
+ return;
9142
9288
  }
9289
+ await this._signaling.hold(!0), await this._holdLocally();
9290
+ return;
9291
+ }
9292
+ if (this._isWaitingForPromotion()) {
9293
+ this._waitingHallHoldPending = !1, await this._resumeLocalMedia(t, this._getWaitingForPromotionStatus());
9294
+ return;
9295
+ }
9296
+ let n = ua.get();
9297
+ await this._signaling.hold(!1, n), this._restoreStateAfterHold();
9298
+ let r = null;
9299
+ if (this._state === "IDLE" && this._participantState === X.ACCEPTED && (r = Object.values(await this._getParticipants()), r.some((e) => e.state === X.ACCEPTED) && (this._state = "ACTIVE", this._changeFeatureSet())), await this._resumeLocalMedia(t, N.WAITING), this._state === "ACTIVE") {
9300
+ let e = this._conversation?.direction === Y.OUTGOING && !this._conversation.concurrent;
9301
+ this._openTransport(r ?? Object.values(await this._getParticipants()), e);
9143
9302
  }
9144
9303
  }
9304
+ async _holdLocally() {
9305
+ this._state !== "HELD" && (this._previousState = this._state, this._state = "HELD"), await this._mediaSource?.stopLocalMedia(), L.onLocalStatus(N.ONHOLD, this.id);
9306
+ }
9307
+ async _resumeLocalMedia(e, t) {
9308
+ this._restoreStateAfterHold(), await this._mediaSource?.resumeLocalMedia(e), L.onLocalStatus(t, this.id), this._mediaSource && L.onLocalStream(this._mediaSource?.getStream() ?? null, this._mediaSource.mediaSettings, this.id);
9309
+ }
9310
+ _restoreStateAfterHold() {
9311
+ this._state === "HELD" && (this._state = this._previousState || "ACTIVE", this._previousState = null);
9312
+ }
9313
+ _isWaitingForPromotion() {
9314
+ return !!this._conversation?.waitingHall || !!this._conversation?.waitForAdmin;
9315
+ }
9316
+ _getWaitingForPromotionStatus() {
9317
+ return this._conversation?.waitForAdmin ? N.WAIT_FOR_ADMIN : N.WAITING_HALL;
9318
+ }
9145
9319
  async putHandsDown() {
9146
9320
  this._checkAdminRole(), await this._signaling.putHandsDown();
9147
9321
  }
@@ -9236,7 +9410,7 @@ var Ja = class {
9236
9410
  L.onRemoteScreenStream(r.externalId, null, this.id);
9237
9411
  break;
9238
9412
  }
9239
- this._stats.logger.log(S.PAT_DEALLOCATED);
9413
+ this._stats.logger.log(C.PAT_DEALLOCATED);
9240
9414
  } else this._debug.log(`Cannot find participant to stop streaming: ${n.participantId}`);
9241
9415
  }
9242
9416
  this._streamIdByStreamDescription.delete(e);
@@ -9256,13 +9430,13 @@ var Ja = class {
9256
9430
  let n = En(e), a = i[n.participantId];
9257
9431
  if (a) {
9258
9432
  let e;
9259
- typeof t == "number" ? e = Fa(t) : (this._debug.warn(`Unexpected error code ${t} received for participant ${n.participantId}`), e = Pa.UNKNOWN_ERROR), r.push({
9433
+ typeof t == "number" ? e = La(t) : (this._debug.warn(`Unexpected error code ${t} received for participant ${n.participantId}`), e = Ia.UNKNOWN_ERROR), r.push({
9260
9434
  externalId: a.externalId,
9261
9435
  errorReason: e
9262
9436
  });
9263
9437
  }
9264
9438
  }
9265
- if (r && r.length && (this._debug.warn("Could not allocate one or more participants", r), t)) throw new Eo("Could not allocate one or more participants", r);
9439
+ if (r && r.length && (this._debug.warn("Could not allocate one or more participants", r), t)) throw new jo("Could not allocate one or more participants", r);
9266
9440
  }
9267
9441
  async _cleanupCooldownQueue() {
9268
9442
  let e = {}, t = this._cooldownTimestampByStreamDescription.entries();
@@ -9270,7 +9444,7 @@ var Ja = class {
9270
9444
  let n = t.next();
9271
9445
  if (n.done) break;
9272
9446
  let r = n.value;
9273
- if (r[1] + Co > Date.now()) break;
9447
+ if (r[1] + Oo > Date.now()) break;
9274
9448
  let i = r[0];
9275
9449
  await this._stopStreaming(i), e[i] = { stopStream: !0 };
9276
9450
  } while (!0);
@@ -9284,7 +9458,7 @@ var Ja = class {
9284
9458
  }
9285
9459
  }
9286
9460
  async _onParticipantPromoted(e) {
9287
- this._conversation && this._conversation.audienceMode ? (this._debug.log("Promoted in audience mode", !e.demote), this._conversation.restricted = e.demote, this._processRecordInfos(e), !e.demote && this._mediaSource && this._changeMediaSettings(this._mediaSource.mediaSettings)) : (this._debug.log("Promoted in waiting hall", !e.demote), e.demote ? (this._debug.log("Kicked from waiting hall"), this._close(new O(D.REMOVED))) : (this._updateConversation(e), await this._onJoinPart2(e))), L.onPromoted(e.demote, this.id);
9461
+ this._conversation && this._conversation.audienceMode ? (this._debug.log("Promoted in audience mode", !e.demote), this._conversation.restricted = e.demote, this._processRecordInfos(e), !e.demote && this._mediaSource && this._changeMediaSettings(this._mediaSource.mediaSettings)) : (this._debug.log("Promoted in waiting hall", !e.demote), e.demote ? (this._debug.log("Kicked from waiting hall"), this._close(new O(D.REMOVED))) : (this._updateConversation(e), this._waitingHallHoldPending && !z.getActive() ? (await this._signaling.hold(!0), await this._onJoinPart2(e, !1), this._waitingHallHoldPending = !1) : this._waitingHallHoldPending && z.getActive() ? (await this._signaling.hold(!0), await this._onJoinPart2(e, !0, !0), this._waitingHallHoldPending = !1) : await this._onJoinPart2(e))), L.onPromoted(e.demote, this.id);
9288
9462
  }
9289
9463
  async _onChatRoomUpdated(e, t = 0, n = [], r, i) {
9290
9464
  this._debug.log(`Chat room updated: ${e}`);
@@ -9417,7 +9591,7 @@ var Ja = class {
9417
9591
  }
9418
9592
  let a = Tn(t), o = this._sequenceNumberByStreamDescription.get(a);
9419
9593
  if (o && o > e.sequenceNumber) {
9420
- 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);
9594
+ 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);
9421
9595
  return;
9422
9596
  }
9423
9597
  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));
@@ -9426,15 +9600,15 @@ var Ja = class {
9426
9600
  this._streamWaitTimerByStreamDescription.delete(a);
9427
9601
  let t = this._conversation?.externalId, n = this._isMe(r);
9428
9602
  if (!i && !n) {
9429
- this._stats.logger.log(S.PAT_ERROR, "participantMissing"), this._debug.error(`Could not find participant by ID: ${r}`);
9603
+ this._stats.logger.log(C.PAT_ERROR, "participantMissing"), this._debug.error(`Could not find participant by ID: ${r}`);
9430
9604
  return;
9431
9605
  }
9432
9606
  let o = n ? t : i.externalId, c = this._streamByStreamId.get(s);
9433
9607
  if (!c) {
9434
- this._stats.logger.log(S.PAT_ERROR, "streamNotFound"), this._debug.error(`Could not find stream by ID: ${s}`);
9608
+ this._stats.logger.log(C.PAT_ERROR, "streamNotFound"), this._debug.error(`Could not find stream by ID: ${s}`);
9435
9609
  return;
9436
9610
  }
9437
- this._stats.logger.log(S.PAT_ALLOCATED), this._streamIdByStreamDescription.set(a, s);
9611
+ this._stats.logger.log(C.PAT_ALLOCATED), this._streamIdByStreamDescription.set(a, s);
9438
9612
  let l = e.participantStreamDescription?.mediaType;
9439
9613
  if (l === V.STREAM || l === V.MOVIE) {
9440
9614
  if (e.participantStreamDescription?.streamName) {
@@ -9485,10 +9659,10 @@ var Ja = class {
9485
9659
  throw Error("transport is not initialized");
9486
9660
  }
9487
9661
  _isCallAdmin() {
9488
- return this._conversation ? j.includesOneOf(this._conversation.roles, [Ia.ADMIN, Ia.CREATOR]) : !1;
9662
+ return this._conversation ? j.includesOneOf(this._conversation.roles, [Ra.ADMIN, Ra.CREATOR]) : !1;
9489
9663
  }
9490
9664
  _checkAdminRole() {
9491
- if (this._conversation && !j.includesOneOf(this._conversation.roles, [Ia.ADMIN, Ia.CREATOR])) throw Error("You don't have the required permission");
9665
+ if (this._conversation && !j.includesOneOf(this._conversation.roles, [Ra.ADMIN, Ra.CREATOR])) throw Error("You don't have the required permission");
9492
9666
  }
9493
9667
  _isCalledState() {
9494
9668
  return this._participantState === X.CALLED;
@@ -9526,21 +9700,21 @@ var Ja = class {
9526
9700
  async changeOptions(e) {
9527
9701
  if (this._signaling.ready && this._conversation) {
9528
9702
  this._checkAdminRole(), await this._signaling.changeOptions(e);
9529
- let t = ja(this._conversation.options, e);
9703
+ let t = Na(this._conversation.options, e);
9530
9704
  this._onOptionsChanged(t);
9531
9705
  }
9532
9706
  }
9533
9707
  async getWaitingHall(e, t, n) {
9534
9708
  if (!this._signaling) return Promise.reject();
9535
9709
  let r = null;
9536
- if (e && (r = Ba(e), r)) {
9710
+ if (e && (r = Ha(e), r)) {
9537
9711
  let e = this._api.getDecorativeIdByInitialId(r.id);
9538
9712
  r.id = e ? j.composeUserId(e) : r.id;
9539
9713
  }
9540
9714
  let i = await this._signaling.getWaitingHall(r, t, n);
9541
9715
  if (i.error) return Promise.reject(i.message);
9542
9716
  let a = i.participants || [], { externalIds: o } = await this._resolveWaitingHallExternalIds(a), s = null;
9543
- return a.length && i.hasMore && (s = za(a[a.length - 1].id)), {
9717
+ return a.length && i.hasMore && (s = Va(a[a.length - 1].id)), {
9544
9718
  participants: o,
9545
9719
  pageMarker: s,
9546
9720
  totalCount: i.totalCount || 0
@@ -9578,7 +9752,7 @@ var Ja = class {
9578
9752
  }
9579
9753
  async promoteParticipant(e, t) {
9580
9754
  if (this._signaling && this._conversation) try {
9581
- if (!j.includesOneOf(this._conversation.options, [ka.WAITING_HALL, ka.AUDIENCE_MODE])) throw Error("Unable to promote a participant in the conversation with current options");
9755
+ if (!j.includesOneOf(this._conversation.options, [ja.WAITING_HALL, ja.AUDIENCE_MODE])) throw Error("Unable to promote a participant in the conversation with current options");
9582
9756
  if (this._checkAdminRole(), !e && t) throw Error("participantId is required");
9583
9757
  await this._signaling.promoteParticipant(e, t);
9584
9758
  } catch (t) {
@@ -9731,7 +9905,8 @@ var Ja = class {
9731
9905
  participantState: j.mapParticipantState(e),
9732
9906
  state: e.state,
9733
9907
  roles: e.roles || [],
9734
- status: this._getStatusByTransportState(i) ?? N.WAITING,
9908
+ status: e.onHold ? N.ONHOLD : this._getStatusByTransportState(i) ?? N.WAITING,
9909
+ isOnHold: !!e.onHold,
9735
9910
  muteStates: e.muteStates || {},
9736
9911
  unmuteOptions: e.unmuteOptions || [],
9737
9912
  observedIds: e.observedIds || [],
@@ -9748,7 +9923,7 @@ var Ja = class {
9748
9923
  let a = this._transport?.getState();
9749
9924
  return n.participants.forEach((e) => {
9750
9925
  let t = r[j.composeId(e)];
9751
- t.status = this._getStatusByTransportState(a) ?? N.WAITING, t.movieShareInfos = e.movieShareInfos, Object.assign(t.mediaSettings, E(e.mediaSettings)), Object.assign(t.muteStates, e.muteStates), t.unmuteOptions = e.unmuteOptions ?? t.unmuteOptions, this._openTransport([t], !0);
9926
+ t.isOnHold || (t.status = this._getStatusByTransportState(a) ?? N.WAITING), t.movieShareInfos = e.movieShareInfos, Object.assign(t.mediaSettings, E(e.mediaSettings)), Object.assign(t.muteStates, e.muteStates), t.unmuteOptions = e.unmuteOptions ?? t.unmuteOptions, this._openTransport([t], !0);
9752
9927
  }), this._participantListChunkToExternalChunk(n);
9753
9928
  }
9754
9929
  async _getInitialParticiapntListChunk() {
@@ -9762,7 +9937,7 @@ var Ja = class {
9762
9937
  _onLocalMediaStreamChanged(e) {
9763
9938
  if (!this._conversation || !this._mediaSource) return;
9764
9939
  let t = this._mediaSource.mediaSettings;
9765
- this._debug.debug("Local media stream changed", t), e.kind === k.audio && this._mediaSource && (this._audioFix = new Ja(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);
9940
+ this._debug.debug("Local media stream changed", t), e.kind === k.audio && this._mediaSource && (this._audioFix = new Xa(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);
9766
9941
  }
9767
9942
  _onScreenSharingStatus(e) {
9768
9943
  let t = this.mediaSettings;
@@ -9887,9 +10062,9 @@ var Ja = class {
9887
10062
  for (let n of e.conversation.participants) {
9888
10063
  let e = j.composeId(n), i = n.roles || [];
9889
10064
  if (this._isMe(e)) {
9890
- La(this._conversation.roles, i) || this._onRolesChanged(e, i), t = () => {
10065
+ za(this._conversation.roles, i) || this._onRolesChanged(e, i), t = () => {
9891
10066
  this._registerParticipantLocalMuteState({
9892
- muteStates: Ga(n),
10067
+ muteStates: qa(n),
9893
10068
  unmuteOptions: n.unmuteOptions
9894
10069
  });
9895
10070
  };
@@ -9906,7 +10081,7 @@ var Ja = class {
9906
10081
  let t = E(n.mediaSettings);
9907
10082
  Ut(t, a.mediaSettings) || await this._changeRemoteMediaSettings(e, t);
9908
10083
  let r = j.mapParticipantState(n), o = a.participantState;
9909
- j.isEqualParticipantState(r, o) || await this._changeRemoteParticipantState(e, r), La(i, a.roles) || this._onRolesChanged(a.id, i);
10084
+ j.isEqualParticipantState(r, o) || await this._changeRemoteParticipantState(e, r), za(i, a.roles) || this._onRolesChanged(a.id, i), !!n.onHold != !!a.isOnHold && (a.isOnHold = !!n.onHold, this._setParticipantsStatus([a], n.onHold ? N.ONHOLD : N.CONNECTED));
9910
10085
  }
9911
10086
  }
9912
10087
  let i = await this._getParticipants();
@@ -9936,7 +10111,7 @@ var Ja = class {
9936
10111
  mediaSettings: E(e.mediaSettings)
9937
10112
  }, i));
9938
10113
  }
9939
- r.state = X.ACCEPTED, r.mediaSettings = E(e.mediaSettings), this._logWithMediaSettings(S.ACCEPTED_OUTGOING, r.mediaSettings), this._conversation && this._conversation.direction === Y.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), this._state === "ACTIVE" && this._transport && this._transport.open([r.id], n), await this._changeRemoteMediaSettings(t, r.mediaSettings), await this._changeRemoteParticipantState(t);
10114
+ r.state = X.ACCEPTED, r.mediaSettings = E(e.mediaSettings), this._logWithMediaSettings(C.ACCEPTED_OUTGOING, r.mediaSettings), this._conversation && this._conversation.direction === Y.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), this._state === "ACTIVE" && this._transport && this._transport.open([r.id], n), await this._changeRemoteMediaSettings(t, r.mediaSettings), await this._changeRemoteParticipantState(t);
9940
10115
  let i = Object.keys(r.muteStates);
9941
10116
  i.length && this._onMuteParticipant({
9942
10117
  muteStates: r.muteStates,
@@ -9949,7 +10124,8 @@ var Ja = class {
9949
10124
  this._debug.debug(`Participant hungup [${e.participantId}]`, { reason: e.reason });
9950
10125
  let t = j.composeMessageId(e);
9951
10126
  if (this._conversation && this._isMe(t)) {
9952
- this._close(new O(e.reason, { remote: !0 }));
10127
+ let t = { remote: !0 };
10128
+ e.reason === D.OBSOLETE_CLIENT && e.errorCode && (t.message = e.errorCode), this._close(new O(e.reason, t));
9953
10129
  return;
9954
10130
  }
9955
10131
  await this._registerParticipantAndSetMarkersIfChunkEnabled(t, e.markers);
@@ -9958,7 +10134,7 @@ var Ja = class {
9958
10134
  this._warnParticipantNotInConversation(t);
9959
10135
  return;
9960
10136
  }
9961
- this._transport && this._transport.close(t), n.state = e.reason === D.REJECTED ? X.REJECTED : X.HUNGUP, this._state !== "CLOSE" && this._removeParticipant(n, D.HUNGUP);
10137
+ this._transport && this._transport.close(t), n.state = e.reason === D.REJECTED ? X.REJECTED : X.HUNGUP, this._state !== "CLOSE" && this._removeParticipant(n, e.reason ?? D.HUNGUP);
9962
10138
  }
9963
10139
  async _onAddedParticipant(e) {
9964
10140
  this._debug.debug(`Participant added [${e.participantId}]`);
@@ -9984,7 +10160,7 @@ var Ja = class {
9984
10160
  n.state = X.CALLED, n.mediaSettings = E(e.participant?.mediaSettings), n.participantState = j.mapParticipantState(e.participant), n.roles = e.participant?.roles || [], this._setParticipantsStatus([n], N.WAITING), this._state !== "IDLE" && this._transport && this._transport.allocate(n.id, !0), L.onParticipantAdded(n.externalId, n.markers, this.id), await this._changeRemoteMediaSettings(t, n.mediaSettings), await this._changeRemoteParticipantState(t, n.participantState), this._invokeRolesChangedCallbackIfNeeded(n);
9985
10161
  }
9986
10162
  async _onJoinedParticipant(e) {
9987
- this._debug.debug(`Participant joined [${e.participantId}]`), this._statFirstMediaReceived.markParticipantJoined(this._transport?.getTopology());
10163
+ this._debug.debug(`Participant joined [${e.participantId}]`), this._statFirstMediaReceived.markOnJoin(this._transport?.getTopology());
9988
10164
  let t = j.composeMessageId(e), n = await this._getParticipant(t);
9989
10165
  if (n && n.state === X.ACCEPTED) {
9990
10166
  this._debug.warn(`Participant [${t}] is already in conversation and is active`);
@@ -10003,10 +10179,11 @@ var Ja = class {
10003
10179
  movieShareInfos: r.movieShareInfos,
10004
10180
  unmuteOptions: r.unmuteOptions || [],
10005
10181
  observedIds: r.observedIds || [],
10006
- markers: this._denormalizeMarkers(t, r.markers)
10182
+ markers: this._denormalizeMarkers(t, r.markers),
10183
+ isOnHold: !!r.onHold
10007
10184
  }, i), n = await this._getParticipant(t);
10008
10185
  }
10009
- this._conversation && this._conversation.direction === Y.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), n.state = X.ACCEPTED, n.mediaSettings = E(e.mediaSettings), n.participantState = j.mapParticipantState(e.participant), n.roles = e.participant.roles || [], this._transport?.isAllocated(n.id) ? this._setParticipantsStatus([n], N.CONNECTED) : this._setParticipantsStatus([n], N.WAITING), this._state !== "IDLE" && this._transport && (this._transport.isAllocated(n.id) || this._transport.allocate(n.id, !0), this._transport.open([n.id], null, !!this._conversation?.observer)), L.onParticipantJoined(n.externalId, n.markers, this.id), await this._changeRemoteMediaSettings(t, n.mediaSettings), await this._changeRemoteParticipantState(t, n.participantState), this._invokeRolesChangedCallbackIfNeeded(n);
10186
+ this._conversation && this._conversation.direction === Y.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), n.state = X.ACCEPTED, n.mediaSettings = E(e.mediaSettings), n.participantState = j.mapParticipantState(e.participant), n.roles = e.participant.roles || [], e.participant.onHold ? (n.isOnHold = !0, this._setParticipantsStatus([n], N.ONHOLD)) : this._transport?.isAllocated(n.id) ? this._setParticipantsStatus([n], N.CONNECTED) : this._setParticipantsStatus([n], N.WAITING), this._state !== "IDLE" && this._transport && (this._transport.isAllocated(n.id) || this._transport.allocate(n.id, !0), this._transport.open([n.id], null, !!this._conversation?.observer)), L.onParticipantJoined(n.externalId, n.markers, this.id), await this._changeRemoteMediaSettings(t, n.mediaSettings), await this._changeRemoteParticipantState(t, n.participantState), this._invokeRolesChangedCallbackIfNeeded(n);
10010
10187
  let r = Object.keys(n.muteStates);
10011
10188
  r.length && this._onMuteParticipant({
10012
10189
  muteStates: n.muteStates,
@@ -10086,7 +10263,7 @@ var Ja = class {
10086
10263
  n && (n.clientType = e.clientType, n.platform = e.platform), L.onPeerRegistered(this.id);
10087
10264
  }
10088
10265
  async _onMicSwitched(e) {
10089
- L.onDeviceSwitched(x.AUDIO, !e.mute, this.id), await this.toggleLocalAudio(!e.mute);
10266
+ L.onDeviceSwitched(S.AUDIO, !e.mute, this.id), await this.toggleLocalAudio(!e.mute);
10090
10267
  }
10091
10268
  async _onChatMessage(e) {
10092
10269
  let t = j.composeMessageId(e), n = await this._getExternalIdByParticipantId(t);
@@ -10193,15 +10370,15 @@ var Ja = class {
10193
10370
  L.onAsrTranscription(t, e.text, e.timestamp, e.duration, this.id);
10194
10371
  }
10195
10372
  async _onRolesChanged(e, t) {
10196
- if (this._conversation && this._isMe(e) && !La(this._conversation.roles, t)) {
10373
+ if (this._conversation && this._isMe(e) && !za(this._conversation.roles, t)) {
10197
10374
  this._debug.debug(`Local roles changed: ${t}`), this._conversation.roles = t, L.onLocalRolesChanged(t, !1, this.id), this._processMuteState({
10198
- mediaOptions: Va(this._getMuteStatesForCurrentRoom(), Ma.MUTE_PERMANENT),
10375
+ mediaOptions: Ua(this._getMuteStatesForCurrentRoom(), Pa.MUTE_PERMANENT),
10199
10376
  stateUpdated: !0
10200
- }), j.includesOneOf(t, [Ia.ADMIN, Ia.CREATOR]) ? this._refreshRooms(!0) : t.length || this._onRoomSwitched(null);
10377
+ }), j.includesOneOf(t, [Ra.ADMIN, Ra.CREATOR]) ? this._refreshRooms(!0) : t.length || this._onRoomSwitched(null);
10201
10378
  return;
10202
10379
  }
10203
10380
  let n = await this._getParticipant(e);
10204
- n && !La(n.roles, t) && (this._debug.debug(`Roles for participant [${e}] changed: ${t}`), n.roles = t, L.onRolesChanged(n.externalId, t, !1, this.id));
10381
+ n && !za(n.roles, t) && (this._debug.debug(`Roles for participant [${e}] changed: ${t}`), n.roles = t, L.onRolesChanged(n.externalId, t, !1, this.id));
10205
10382
  }
10206
10383
  async _onMuteParticipant(e, t = !1) {
10207
10384
  if (!this._conversation) return;
@@ -10250,18 +10427,18 @@ var Ja = class {
10250
10427
  let { mediaOptions: t = [], muteAll: n, unmute: r, stateUpdated: i, requestedMedia: a, roomId: o = null, unmuteOptions: s = [] } = e, c = e.adminId ? await this._getExternalIdByParticipantId(e.adminId) : null, l = Object.assign({}, e.muteStates ?? this._getMuteStatesForRoomId(o)), u = this._mediaSource.mediaSettings, d = Object.entries(l);
10251
10428
  for (let [e, i] of d) {
10252
10429
  let a = this._isCallAdmin() && n;
10253
- if (!(i !== Ma.MUTE && i !== Ma.MUTE_PERMANENT || a) && (this._isCallAdmin() && i === Ma.MUTE_PERMANENT && !n && (l[e] = Ma.MUTE), !(!t.includes(e) || r))) switch (e) {
10254
- case x.VIDEO:
10255
- u.isVideoEnabled && (L.onDeviceSwitched(x.VIDEO, !1, this.id), await this.toggleLocalVideo(!1));
10430
+ if (!(i !== Pa.MUTE && i !== Pa.MUTE_PERMANENT || a) && (this._isCallAdmin() && i === Pa.MUTE_PERMANENT && !n && (l[e] = Pa.MUTE), !(!t.includes(e) || r))) switch (e) {
10431
+ case S.VIDEO:
10432
+ u.isVideoEnabled && (L.onDeviceSwitched(S.VIDEO, !1, this.id), await this.toggleLocalVideo(!1));
10256
10433
  break;
10257
- case x.AUDIO:
10258
- u.isAudioEnabled && (L.onDeviceSwitched(x.AUDIO, !1, this.id), await this.toggleLocalAudio(!1));
10434
+ case S.AUDIO:
10435
+ u.isAudioEnabled && (L.onDeviceSwitched(S.AUDIO, !1, this.id), await this.toggleLocalAudio(!1));
10259
10436
  break;
10260
- case x.SCREEN_SHARING:
10261
- u.isScreenSharingEnabled && (L.onDeviceSwitched(x.SCREEN_SHARING, !1, this.id), await this.disableScreenCapturing());
10437
+ case S.SCREEN_SHARING:
10438
+ u.isScreenSharingEnabled && (L.onDeviceSwitched(S.SCREEN_SHARING, !1, this.id), await this.disableScreenCapturing());
10262
10439
  break;
10263
- case x.AUDIO_SHARING:
10264
- u.isAudioSharingEnabled && (L.onDeviceSwitched(x.AUDIO_SHARING, !1, this.id), await this.toggleScreenCapturing({
10440
+ case S.AUDIO_SHARING:
10441
+ u.isAudioSharingEnabled && (L.onDeviceSwitched(S.AUDIO_SHARING, !1, this.id), await this.toggleScreenCapturing({
10265
10442
  captureScreen: u.isScreenSharingEnabled,
10266
10443
  fastScreenSharing: u.isFastScreenSharingEnabled,
10267
10444
  captureAudio: !1
@@ -10287,7 +10464,7 @@ var Ja = class {
10287
10464
  this._conversation.pinnedParticipantIdByRoom.set(r, t ? null : e);
10288
10465
  }
10289
10466
  _onOptionsChanged(e) {
10290
- this._conversation && !Aa(this._conversation.options, e) && (this._conversation.options = e, L.onOptionsChanged(e, this.id), e.includes(ka.ADMIN_IS_HERE) ? this._conversation.restricted && this._conversation.waitingHall && L.onLocalStatus(N.WAITING_HALL, this.id) : e.includes(ka.WAIT_FOR_ADMIN) && this._conversation.restricted && L.onLocalStatus(N.WAIT_FOR_ADMIN, this.id));
10467
+ this._conversation && !Ma(this._conversation.options, e) && (this._conversation.options = e, L.onOptionsChanged(e, this.id), e.includes(ja.ADMIN_IS_HERE) ? this._conversation.restricted && this._conversation.waitingHall && L.onLocalStatus(N.WAITING_HALL, this.id) : e.includes(ja.WAIT_FOR_ADMIN) && this._conversation.restricted && L.onLocalStatus(N.WAIT_FOR_ADMIN, this.id));
10291
10468
  }
10292
10469
  async _onNetworkStatus(e) {
10293
10470
  if (this._conversation) {
@@ -10342,7 +10519,7 @@ var Ja = class {
10342
10519
  }
10343
10520
  _changeFeatureSet() {
10344
10521
  if (this._conversation) {
10345
- let e = this._state === "ACTIVE", t = this._conversation.features.includes(Oa.ADD_PARTICIPANT);
10522
+ let e = this._state === "ACTIVE", t = this._conversation.features.includes(Aa.ADD_PARTICIPANT);
10346
10523
  L.onCallState(e, t, this._conversation, this.id);
10347
10524
  }
10348
10525
  }
@@ -10433,7 +10610,7 @@ var Ja = class {
10433
10610
  }
10434
10611
  _removeVideoTrack(e, t, n) {}
10435
10612
  _onTopologyChanged(e) {
10436
- e === q.DIRECT && (this._onRemoteSignalledStall([]), this._onAudioMixStall(!1)), this._conversation && (this._conversation.topology = e, this._changeFeatureSet(), this._forceOpenTransportForAloneInCall()), this._audioOutput.destroy();
10613
+ this._statFirstMediaReceived.markTopologyChanged(e), e === q.DIRECT && (this._onRemoteSignalledStall([]), this._onAudioMixStall(!1)), this._conversation && (this._conversation.topology = e, this._changeFeatureSet(), this._forceOpenTransportForAloneInCall()), this._audioOutput.destroy();
10437
10614
  }
10438
10615
  _onAudioMixStall(e) {
10439
10616
  this._audioMixStalled !== e && !this.isCallHeld && (this._audioMixStalled = e, this._debug.debug("Audio mix stalled:", e), L.onLocalStatus(e ? N.RECONNECT : N.CONNECTED, this.id));
@@ -10493,7 +10670,7 @@ var Ja = class {
10493
10670
  async _onRoomsUpdated(e) {
10494
10671
  if (this._isCalledState()) return;
10495
10672
  let t = {};
10496
- for (let n of Object.keys(Na)) {
10673
+ for (let n of Object.keys(Fa)) {
10497
10674
  let r = e.updates[n];
10498
10675
  r && (t[n] = {
10499
10676
  rooms: await Promise.all(r?.rooms?.map(this._convertRoomToExternal.bind(this)) || []),
@@ -10505,7 +10682,7 @@ var Ja = class {
10505
10682
  }
10506
10683
  async _onRoomUpdated(e) {
10507
10684
  let t = await this._convertRoomToExternal(e.room || null);
10508
- e.events.some((e) => e === Na.UPDATE) && (e.muteStates !== void 0 && this._setMuteStatesForRoomId(e.muteStates, e.roomId), e.recordInfo !== void 0 && this._conversation?.recordsInfoByRoom.set(e.roomId, e.recordInfo), e.asrInfo !== void 0 && this._conversation?.asrInfoByRoom.set(e.roomId, e.asrInfo)), this._isCalledState() || L.onRoomUpdated(e.events, e.roomId, t, e.deactivate || null, this.id);
10685
+ e.events.some((e) => e === Fa.UPDATE) && (e.muteStates !== void 0 && this._setMuteStatesForRoomId(e.muteStates, e.roomId), e.recordInfo !== void 0 && this._conversation?.recordsInfoByRoom.set(e.roomId, e.recordInfo), e.asrInfo !== void 0 && this._conversation?.asrInfoByRoom.set(e.roomId, e.asrInfo)), this._isCalledState() || L.onRoomUpdated(e.events, e.roomId, t, e.deactivate || null, this.id);
10509
10686
  }
10510
10687
  async _convertRoomToExternal(e) {
10511
10688
  if (!e) return null;
@@ -10602,7 +10779,7 @@ var Ja = class {
10602
10779
  n && r.push(n);
10603
10780
  }
10604
10781
  }
10605
- r.length && !this._isCalledState() && L.onRoomsUpdated({ [Na.UPDATE]: { rooms: r } }, this.id);
10782
+ r.length && !this._isCalledState() && L.onRoomsUpdated({ [Fa.UPDATE]: { rooms: r } }, this.id);
10606
10783
  }
10607
10784
  async _onFeedback(e) {
10608
10785
  let t = [];
@@ -10690,19 +10867,19 @@ var Ja = class {
10690
10867
  async _getParticipant(e) {
10691
10868
  return (await this._getParticipants())[e];
10692
10869
  }
10693
- }, To = null, Eo = class e extends Error {
10870
+ }, Ao = null, jo = class e extends Error {
10694
10871
  constructor(t, n) {
10695
10872
  super(t), h(this, "participantErrors", void 0), Object.setPrototypeOf(this, e.prototype), this.participantErrors = n;
10696
10873
  }
10697
- }, Do = null, Oo = null;
10698
- function ko() {
10699
- Do = null, Oo = null;
10874
+ }, Mo = null, No = null;
10875
+ function Po() {
10876
+ Mo = null, No = null;
10700
10877
  }
10701
- function Ao(e) {
10878
+ function Fo(e) {
10702
10879
  return e?.endsWith("/") ? e.slice(0, -1) : e;
10703
10880
  }
10704
- async function jo(e = null, t) {
10705
- let n = Ao(e ?? M.apiBaseUrl);
10881
+ async function Io(e = null, t) {
10882
+ let n = Fo(e ?? M.apiBaseUrl);
10706
10883
  if (n) return n;
10707
10884
  if ((t ?? M.apiEnv) !== "AUTO") return M.apiEndpoint(t);
10708
10885
  try {
@@ -10717,20 +10894,20 @@ async function jo(e = null, t) {
10717
10894
  return R.warn("Failed to resolve API endpoint using DNS, default is used", e), M.apiEndpoint(t);
10718
10895
  }
10719
10896
  }
10720
- async function Mo() {
10721
- return Do || Oo || (Oo = jo(), Do = await Oo, Oo = null, Do);
10897
+ async function Lo() {
10898
+ return Mo || No || (No = Io(), Mo = await No, No = null, Mo);
10722
10899
  }
10723
- async function No(e, t = {}, n = !1) {
10900
+ async function Ro(e, t = {}, n = !1) {
10724
10901
  if (!window.Blob || !window.navigator.sendBeacon) return;
10725
- await Mo();
10726
- let r = Lo(e, t, n), i = new window.Blob([r], { type: "application/x-www-form-urlencoded" });
10727
- window.navigator.sendBeacon(`${Do}/fb.do`, i);
10902
+ await Lo();
10903
+ let r = Ho(e, t, n), i = new window.Blob([r], { type: "application/x-www-form-urlencoded" });
10904
+ window.navigator.sendBeacon(`${Mo}/fb.do`, i);
10728
10905
  }
10729
- async function Po(e, t = {}, n = !1, r) {
10730
- return await Mo(), Fo(Lo(e, t, n), r);
10906
+ async function zo(e, t = {}, n = !1, r) {
10907
+ return await Lo(), Bo(Ho(e, t, n), r);
10731
10908
  }
10732
- async function Fo(e, t) {
10733
- let n = `${t ?? Do}/fb.do`, r = new AbortController(), i = setTimeout(() => r.abort(new O(D.NETWORK_ERROR)), M.apiTimeout), a = await fetch(n, {
10909
+ async function Bo(e, t) {
10910
+ let n = `${t ?? Mo}/fb.do`, r = new AbortController(), i = setTimeout(() => r.abort(new O(D.NETWORK_ERROR)), M.apiTimeout), a = await fetch(n, {
10734
10911
  method: "POST",
10735
10912
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
10736
10913
  body: e,
@@ -10746,7 +10923,7 @@ async function Fo(e, t) {
10746
10923
  if (!a.ok || Object.hasOwn(s, "error_msg")) throw s;
10747
10924
  return s;
10748
10925
  }
10749
- async function Io(e, t) {
10926
+ async function Vo(e, t) {
10750
10927
  try {
10751
10928
  let n = await fetch(e, {
10752
10929
  method: "POST",
@@ -10759,8 +10936,8 @@ async function Io(e, t) {
10759
10936
  throw R.warn("Failed to send form data", e), e;
10760
10937
  }
10761
10938
  }
10762
- function Lo(e, t = {}, n = !1) {
10763
- 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));
10939
+ function Ho(e, t = {}, n = !1) {
10940
+ 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));
10764
10941
  for (let [e, n] of Object.entries(t)) typeof n == "object" && (t[e] = JSON.stringify(n));
10765
10942
  let r = "";
10766
10943
  for (let [e, n] of Object.entries(t)) r && (r += "&"), r += `${e}=${encodeURIComponent(n)}`;
@@ -10768,7 +10945,7 @@ function Lo(e, t = {}, n = !1) {
10768
10945
  }
10769
10946
  //#endregion
10770
10947
  //#region src/abstract/BaseApi.ts
10771
- var Ro = class {
10948
+ var Uo = class {
10772
10949
  constructor() {
10773
10950
  h(this, "_abortSignal", void 0);
10774
10951
  }
@@ -10806,7 +10983,7 @@ var Ro = class {
10806
10983
  return Date.now();
10807
10984
  }
10808
10985
  cleanup() {}
10809
- }, zo = class {
10986
+ }, Wo = class {
10810
10987
  constructor() {
10811
10988
  h(this, "_okIdToExternalId", /* @__PURE__ */ new Map()), h(this, "_externalIdToOkId", /* @__PURE__ */ new Map()), h(this, "_decorativeIdToInitialId", /* @__PURE__ */ new Map()), h(this, "_initialIdToDecorativeId", /* @__PURE__ */ new Map());
10812
10989
  }
@@ -10851,19 +11028,19 @@ var Ro = class {
10851
11028
  clear() {
10852
11029
  this._okIdToExternalId.clear(), this._externalIdToOkId.clear(), this._decorativeIdToInitialId.clear(), this._initialIdToDecorativeId.clear();
10853
11030
  }
10854
- }, Bo = 700, Vo = 3e3, Ho = class extends Ro {
11031
+ }, Go = 700, Ko = 3e3, qo = class extends Uo {
10855
11032
  constructor(...e) {
10856
- super(...e), h(this, "_userId", null), h(this, "_uuid", void 0), h(this, "_idCache", new zo());
11033
+ super(...e), h(this, "_userId", null), h(this, "_uuid", void 0), h(this, "_idCache", new Wo());
10857
11034
  }
10858
11035
  async _callUnsafe(e, t = {}, n = !1) {
10859
11036
  let r = async (i) => {
10860
11037
  try {
10861
- return await Po(e, t, n);
11038
+ return await zo(e, t, n);
10862
11039
  } catch (t) {
10863
11040
  if (!Object.hasOwn(t, "error_msg")) {
10864
11041
  i++;
10865
11042
  let n = Object.getOwnPropertyNames(t).map((e) => `${e}: ${JSON.stringify(t[e])}`);
10866
- 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 * Bo, Vo), { signal: this._abortSignal }), r(i);
11043
+ 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 * Go, Ko), { signal: this._abortSignal }), r(i);
10867
11044
  }
10868
11045
  throw R.warn(e, "error", t), t;
10869
11046
  }
@@ -10875,7 +11052,7 @@ var Ro = class {
10875
11052
  return await this._callUnsafe(e, t, n);
10876
11053
  } catch (r) {
10877
11054
  R.warn("Api call error", r);
10878
- let i = b.API;
11055
+ let i = x.API;
10879
11056
  switch (r.error_code) {
10880
11057
  case 102:
10881
11058
  case 103:
@@ -10886,7 +11063,7 @@ var Ro = class {
10886
11063
  code: r.error_code
10887
11064
  };
10888
11065
  if (r instanceof O) throw r;
10889
- if (r.custom_error && (a.custom_error = r.custom_error), Uo(r)) switch (r.error_code) {
11066
+ if (r.custom_error && (a.custom_error = r.custom_error), Jo(r)) switch (r.error_code) {
10890
11067
  case 1101:
10891
11068
  i = D.SERVICE_DISABLED;
10892
11069
  break;
@@ -10910,7 +11087,7 @@ var Ro = class {
10910
11087
  i = D.CALLER_IS_REJECTED;
10911
11088
  break;
10912
11089
  case 1114:
10913
- i = D.VCHAT_DETAILED_ERROR;
11090
+ a.custom_error?.vchat_detailed_api_error?.code?.startsWith("obsolete_client") ? (i = D.OBSOLETE_CLIENT, a.message = a.custom_error.vchat_detailed_api_error.code) : i = D.VCHAT_DETAILED_ERROR;
10914
11091
  break;
10915
11092
  case 2:
10916
11093
  i = D.SERVICE_UNAVAILABLE;
@@ -10921,10 +11098,10 @@ var Ro = class {
10921
11098
  }
10922
11099
  async userId(e) {
10923
11100
  let t = j.extractOkId(e);
10924
- return v.isEmpty() ? Z.fromId(String(t)) : (this._idCache.hasByOkId(t) || await this._getExternalIdsByOkIds([t]), this._idCache.getExternalId(t) || Z.fromId(String(t)));
11101
+ return y.isEmpty() ? Z.fromId(String(t)) : (this._idCache.hasByOkId(t) || await this._getExternalIdsByOkIds([t]), this._idCache.getExternalId(t) || Z.fromId(String(t)));
10925
11102
  }
10926
11103
  async authorize() {
10927
- if (this._ensureUuid(), !M.apiKey) throw new O(b.API, { message: "Required argument apiAppKey not passed" });
11104
+ if (this._ensureUuid(), !M.apiKey) throw new O(x.API, { message: "Required argument apiAppKey not passed" });
10928
11105
  let e = { session_data: {
10929
11106
  version: 2,
10930
11107
  device_id: this._uuid,
@@ -10932,9 +11109,9 @@ var Ro = class {
10932
11109
  client_type: "SDK_JS"
10933
11110
  } };
10934
11111
  return M.authToken && (e.session_data.auth_token = M.authToken, e.session_data.version = 3), this._callUnsafe("auth.anonymLogin", e, !0).then((e) => {
10935
- e.uid && (this._userId = Number(e.uid)), v.sessionKey = e.session_key, v.sessionSecretKey = e.session_secret_key;
11112
+ e.uid && (this._userId = Number(e.uid)), y.sessionKey = e.session_key, y.sessionSecretKey = e.session_secret_key;
10936
11113
  }).catch((e) => {
10937
- throw e.error_code === 401 && L.onTokenExpired(), new O(b.AUTH, {
11114
+ throw e.error_code === 401 && L.onTokenExpired(), new O(x.AUTH, {
10938
11115
  message: e.error_msg,
10939
11116
  code: e.error_code
10940
11117
  });
@@ -10948,7 +11125,7 @@ var Ro = class {
10948
11125
  version: 1,
10949
11126
  items: e
10950
11127
  };
10951
- M.clientStatsPlatform && (t.platform = M.clientStatsPlatform), No("vchat.clientStats", { data: JSON.stringify(t) });
11128
+ M.clientStatsPlatform && (t.platform = M.clientStatsPlatform), Ro("vchat.clientStats", { data: JSON.stringify(t) });
10952
11129
  }
10953
11130
  logClientEvents(e) {
10954
11131
  let t = {
@@ -10958,7 +11135,7 @@ var Ro = class {
10958
11135
  version: 1,
10959
11136
  items: e
10960
11137
  };
10961
- M.clientStatsPlatform && (t.platform = M.clientStatsPlatform), No("vchat.clientEvents", { data: JSON.stringify(t) });
11138
+ M.clientStatsPlatform && (t.platform = M.clientStatsPlatform), Ro("vchat.clientEvents", { data: JSON.stringify(t) });
10962
11139
  }
10963
11140
  async uploadDebugLogs(e, t, n, r) {
10964
11141
  let i = {
@@ -10969,7 +11146,7 @@ var Ro = class {
10969
11146
  }, a = await this._callUnsafe("vchat.getLogUploadUrl", i), o = new FormData(), s = new Blob([r], { type: "application/json" });
10970
11147
  o.append("file", s, "log.json");
10971
11148
  let c = new URL(a.upload_url);
10972
- return c.searchParams.append("size", s.size.toString()), Io(c.toString(), o);
11149
+ return c.searchParams.append("size", s.size.toString()), Vo(c.toString(), o);
10973
11150
  }
10974
11151
  async joinConversation(e, t = !1, n) {
10975
11152
  let r = {
@@ -11008,13 +11185,13 @@ var Ro = class {
11008
11185
  externalIds: l
11009
11186
  });
11010
11187
  if (t && t.length) switch (n) {
11011
- case Ea.USER:
11188
+ case Oa.USER:
11012
11189
  u.uids = t.join(",");
11013
11190
  break;
11014
- case Ea.GROUP:
11191
+ case Oa.GROUP:
11015
11192
  u.gid = t[0];
11016
11193
  break;
11017
- case Ea.CHAT:
11194
+ case Oa.CHAT:
11018
11195
  u.chatId = t[0];
11019
11196
  break;
11020
11197
  }
@@ -11022,8 +11199,8 @@ var Ro = class {
11022
11199
  }
11023
11200
  _ensureUuid() {
11024
11201
  if (!this._uuid) {
11025
- let e = ot.get("uuid");
11026
- e || (e = j.uuid(), ot.set("uuid", e)), this._uuid = String(e);
11202
+ let e = at.get("uuid");
11203
+ e || (e = j.uuid(), at.set("uuid", e)), this._uuid = String(e);
11027
11204
  }
11028
11205
  }
11029
11206
  deviceId() {
@@ -11107,7 +11284,7 @@ var Ro = class {
11107
11284
  conversationId: e,
11108
11285
  reason: t
11109
11286
  };
11110
- M.anonymToken && (n.anonymToken = M.anonymToken), No("vchat.hangupConversation", n);
11287
+ M.anonymToken && (n.anonymToken = M.anonymToken), Ro("vchat.hangupConversation", n);
11111
11288
  }
11112
11289
  async removeHistoryRecords(e) {
11113
11290
  await this._call("vchat.removeHistoryRecords", { recordIds: e.join(",") });
@@ -11125,7 +11302,7 @@ var Ro = class {
11125
11302
  t.set(e, a), this.cacheExternalId(e, a);
11126
11303
  }
11127
11304
  };
11128
- n.external_ids && r(n.external_ids, Ra.USER), n.anonym_ids && r(n.anonym_ids, Ra.ANONYM);
11305
+ n.external_ids && r(n.external_ids, Ba.USER), n.anonym_ids && r(n.anonym_ids, Ba.ANONYM);
11129
11306
  for (let n of e) {
11130
11307
  let e = Number(n);
11131
11308
  if (!t.has(e)) {
@@ -11142,16 +11319,16 @@ var Ro = class {
11142
11319
  return (await this._call("system.getInfo")).serverTime;
11143
11320
  }
11144
11321
  };
11145
- function Uo(e) {
11322
+ function Jo(e) {
11146
11323
  return typeof e == "object" && !!e && "error_code" in e && "error_msg" in e;
11147
11324
  }
11148
11325
  //#endregion
11149
11326
  //#region src/enums/RecordRole.ts
11150
- var Wo = /* @__PURE__ */ function(e) {
11327
+ var Yo = /* @__PURE__ */ function(e) {
11151
11328
  return e.KING = "KING", e.PAWN = "PAWN", e;
11152
- }(Wo || {}), Go = /* @__PURE__ */ function(e) {
11329
+ }(Yo || {}), Xo = /* @__PURE__ */ function(e) {
11153
11330
  return e.OFF = "0", e.ON = "1", e;
11154
- }({}), Ko = class {
11331
+ }({}), Zo = class {
11155
11332
  constructor(e) {
11156
11333
  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;
11157
11334
  }
@@ -11174,12 +11351,12 @@ var Wo = /* @__PURE__ */ function(e) {
11174
11351
  let e = this._queue[this._readCursor];
11175
11352
  return e && (this._moveReadCursor = !1, this._queue[this._readCursor] = null, this._readCursor = this.nextCursor(this._readCursor), --this._left), e;
11176
11353
  }
11177
- }, qo = class {
11354
+ }, Qo = class {
11178
11355
  constructor(e, t, n, r = null) {
11179
11356
  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;
11180
11357
  }
11181
11358
  async authorize() {
11182
- let e = await Po("auth.anonymLogin", {
11359
+ let e = await zo("auth.anonymLogin", {
11183
11360
  session_data: {
11184
11361
  device_id: this._uuid,
11185
11362
  client_version: M.appVersion,
@@ -11188,18 +11365,18 @@ var Wo = /* @__PURE__ */ function(e) {
11188
11365
  version: 3
11189
11366
  },
11190
11367
  application_key: this._apiKey
11191
- }, !0, await jo(this._baseApiUrl, this._apiEnv));
11368
+ }, !0, await Io(this._baseApiUrl, this._apiEnv));
11192
11369
  return j.isObject(e) && !("error_msg" in e) ? (this._sessionKey = e.session_key, !0) : !1;
11193
11370
  }
11194
11371
  async hangupConversation(e) {
11195
- await Po("vchat.hangupConversation", {
11372
+ await zo("vchat.hangupConversation", {
11196
11373
  conversationId: e,
11197
11374
  reason: D.HUNGUP,
11198
11375
  application_key: this._apiKey,
11199
11376
  session_key: this._sessionKey
11200
- }, !0, await jo(this._baseApiUrl, this._apiEnv));
11377
+ }, !0, await Io(this._baseApiUrl, this._apiEnv));
11201
11378
  }
11202
- }, $, Jo = null, Yo = {
11379
+ }, $, $o = null, es = {
11203
11380
  getCameras: T.getCameras,
11204
11381
  getMicrophones: T.getMicrophones,
11205
11382
  getOutput: T.getOutput,
@@ -11225,33 +11402,33 @@ var Wo = /* @__PURE__ */ function(e) {
11225
11402
  baseChromeVersion: T.baseChromeVersion,
11226
11403
  getAudioContext: T.getAudioContext,
11227
11404
  isAudioShareSupported: T.isAudioShareSupported
11228
- }, Xo = { participantMarkerCompare: j.participantMarkerCompare };
11229
- function Zo(e) {
11230
- Jo = e;
11405
+ }, ts = { participantMarkerCompare: j.participantMarkerCompare };
11406
+ function ns(e) {
11407
+ $o = e;
11231
11408
  }
11232
- function Qo(e) {
11409
+ function rs(e) {
11233
11410
  M.videoEffects = e;
11234
11411
  }
11235
- function $o(e) {
11412
+ function is(e) {
11236
11413
  M.audioEffects = e;
11237
11414
  }
11238
- function es(e, t = null, n = {}, r = 1) {
11415
+ function as(e, t = null, n = {}, r = 1) {
11239
11416
  M.vmoji = e, M.vmojiOptions = {
11240
11417
  protocolVersion: r,
11241
11418
  renderingOptions: n
11242
11419
  }, t && e.setSDK(t);
11243
11420
  }
11244
- async function ts(t) {
11245
- if (M.set(t), $ || ($ = new Ho()), e.disableLog(!M.debug), R.toggle(M.debug), R.log(`Calls SDK ${M.sdkVersion}`, t), await T.init(), !T.isBrowserSupported()) throw new O(b.UNSUPPORTED);
11421
+ async function os(t) {
11422
+ if (M.set(t), $ || ($ = new qo()), e.disableLog(!M.debug), R.toggle(M.debug), R.log(`Calls SDK ${M.sdkVersion}`, t), await T.init(), !T.isBrowserSupported()) throw new O(x.UNSUPPORTED);
11246
11423
  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}`);
11247
11424
  }
11248
- async function ns(e, t = [x.AUDIO], n = "", r = !1, i = !1, a, o, s) {
11425
+ async function ss(e, t = [S.AUDIO], n = "", r = !1, i = !1, a, o, s) {
11249
11426
  let c = [];
11250
- return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]), rs([], Ea.USER, t, n, r, i, a, c, o, s);
11427
+ return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]), cs([], Oa.USER, t, n, r, i, a, c, o, s);
11251
11428
  }
11252
- async function rs(e, t = Ea.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
11429
+ async function cs(e, t = Oa.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
11253
11430
  if (!M.hold && z.callsLength > 0) throw R.error("There is already active call"), new O(D.FAILED);
11254
- return new Q($, Jo).onStart({
11431
+ return new Q($, $o).onStart({
11255
11432
  opponentIds: e,
11256
11433
  opponentType: t,
11257
11434
  mediaOptions: n,
@@ -11264,37 +11441,37 @@ async function rs(e, t = Ea.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
11264
11441
  conversationId: l
11265
11442
  });
11266
11443
  }
11267
- async function is(e, t) {
11268
- return as(e, A.USER, void 0, t);
11444
+ async function ls(e, t) {
11445
+ return us(e, A.USER, void 0, t);
11269
11446
  }
11270
- async function as(e, t = A.USER, n, r, i, a) {
11447
+ async function us(e, t = A.USER, n, r, i, a) {
11271
11448
  if (e === Q.id()) throw Error("Push has already been processed");
11272
- return a && $.setUserId(a), new Q($, Jo).onPush(e, t, n, r, i);
11449
+ return a && $.setUserId(a), new Q($, $o).onPush(e, t, n, r, i);
11273
11450
  }
11274
- async function os(e, t) {
11275
- return e && (M.authToken = e), t !== void 0 && M.apiBaseUrl !== t && (M.apiBaseUrl = t, ko()), $.authorize();
11451
+ async function ds(e, t) {
11452
+ return e && (M.authToken = e), t !== void 0 && M.apiBaseUrl !== t && (M.apiBaseUrl = t, Po()), $.authorize();
11276
11453
  }
11277
- async function ss(e = [x.AUDIO], t) {
11278
- return jc(t).accept(e);
11454
+ async function fs(e = [S.AUDIO], t) {
11455
+ return Ic(t).accept(e);
11279
11456
  }
11280
- async function cs(e) {
11281
- let t = Ac(e);
11457
+ async function ps(e) {
11458
+ let t = Fc(e);
11282
11459
  if (t) return t.decline();
11283
11460
  }
11284
- async function ls(e, t = [x.AUDIO]) {
11285
- return us(e, t);
11461
+ async function ms(e, t = [S.AUDIO]) {
11462
+ return hs(e, t);
11286
11463
  }
11287
- async function us(e, t, n) {
11464
+ async function hs(e, t, n) {
11288
11465
  if (!M.hold && z.callsLength > 0) throw R.error("There is already active call"), new O(D.FAILED);
11289
- return new Q($, Jo).onJoin({
11466
+ return new Q($, $o).onJoin({
11290
11467
  conversationId: e,
11291
11468
  mediaOptions: t,
11292
11469
  chatId: n
11293
11470
  });
11294
11471
  }
11295
- async function ds(e, t = [x.AUDIO], n, r, i, a) {
11472
+ async function gs(e, t = [S.AUDIO], n, r, i, a) {
11296
11473
  if (!M.hold && z.callsLength > 0) throw R.error("There is already active call"), new O(D.FAILED);
11297
- return n && (M.anonymToken = n), new Q($, Jo).onJoin({
11474
+ return n && (M.anonymToken = n), new Q($, $o).onJoin({
11298
11475
  joinLink: e,
11299
11476
  mediaOptions: t,
11300
11477
  observedIds: r,
@@ -11302,31 +11479,31 @@ async function ds(e, t = [x.AUDIO], n, r, i, a) {
11302
11479
  onFastJoin: a
11303
11480
  });
11304
11481
  }
11305
- async function fs(e) {
11306
- let t = Ac(e);
11482
+ async function _s(e) {
11483
+ let t = Fc(e);
11307
11484
  if (t) return t.hangup();
11308
11485
  Q.hangupAfterInit();
11309
11486
  }
11310
- async function ps(e, t) {
11487
+ async function vs(e, t) {
11311
11488
  let n = Array.isArray(e) ? e : [e], r = Q.current();
11312
11489
  r && await r.addParticipant(n, t);
11313
11490
  }
11314
- async function ms(e, t) {
11491
+ async function ys(e, t) {
11315
11492
  let n = Q.current();
11316
11493
  if (n) {
11317
11494
  let r = e.map((e) => j.composeUserId(e));
11318
11495
  await n.addParticipantLegacy(r, t);
11319
11496
  }
11320
11497
  }
11321
- async function hs(e, t = !1) {
11498
+ async function bs(e, t = !1) {
11322
11499
  let n = $.getCachedRawOkIdByExternalId(e);
11323
11500
  if (!n) {
11324
11501
  R.warn("removeParticipant: externalId not found in cache", e);
11325
11502
  return;
11326
11503
  }
11327
- return gs(n, t);
11504
+ return xs(n, t);
11328
11505
  }
11329
- async function gs(e, t = !1) {
11506
+ async function xs(e, t = !1) {
11330
11507
  let n = Q.current();
11331
11508
  if (n) try {
11332
11509
  await n.removeParticipant(j.composeUserId(e), t);
@@ -11334,13 +11511,13 @@ async function gs(e, t = !1) {
11334
11511
  R.warn(`Failed to remove participant ${e}. Perhaps he is no longer on the call. ${t}`);
11335
11512
  }
11336
11513
  }
11337
- async function _s(e, t) {
11514
+ async function Ss(e, t) {
11338
11515
  let n = Q.current();
11339
11516
  if (e === "videoinput" && At.contains(t)) return M.videoFacingMode = t, n ? (T.isMobile() && n.stopVideoTrack(), n.changeDevice(e)) : void 0;
11340
11517
  if (!await T._saveDeviceId(e, t)) throw Error(`Device not found: ${t}`);
11341
11518
  if (n) return n.changeDevice(e);
11342
11519
  }
11343
- async function vs(e, t) {
11520
+ async function Cs(e, t) {
11344
11521
  let n = typeof e == "object" ? {
11345
11522
  ...e,
11346
11523
  fastScreenSharing: e.captureScreen && e.fastScreenSharing,
@@ -11349,34 +11526,34 @@ async function vs(e, t) {
11349
11526
  captureScreen: e,
11350
11527
  fastScreenSharing: !1,
11351
11528
  captureAudio: !1
11352
- }, r = Ac(t);
11529
+ }, r = Fc(t);
11353
11530
  return r ? r.toggleScreenCapturing(n) : Promise.reject();
11354
11531
  }
11355
- function ys(e) {
11532
+ function ws(e) {
11356
11533
  let t = Q.current();
11357
11534
  t && t.toggleAnimojiCapturing(e);
11358
11535
  }
11359
- async function bs(e, t = !1) {
11536
+ async function Ts(e, t = !1) {
11360
11537
  let n = Q.current();
11361
11538
  n && await n.setVideoStream(e, t);
11362
11539
  }
11363
- async function xs(e, t) {
11364
- let n = Ac(t);
11540
+ async function Es(e, t) {
11541
+ let n = Fc(t);
11365
11542
  n && await n.toggleLocalVideo(e);
11366
11543
  }
11367
- async function Ss(e, t) {
11368
- let n = Ac(t);
11544
+ async function Ds(e, t) {
11545
+ let n = Fc(t);
11369
11546
  n && await n.toggleLocalAudio(e);
11370
11547
  }
11371
- async function Cs(e) {
11548
+ async function Os(e) {
11372
11549
  let t = Q.current();
11373
11550
  if (t) return t.setLocalResolution(e);
11374
11551
  }
11375
- async function ws(e) {
11552
+ async function ks(e) {
11376
11553
  let t = Q.current();
11377
11554
  t && await t.changePriorities(e);
11378
11555
  }
11379
- async function Ts(e, t) {
11556
+ async function As(e, t) {
11380
11557
  let n = Q.current();
11381
11558
  if (n) {
11382
11559
  let r;
@@ -11391,33 +11568,33 @@ async function Ts(e, t) {
11391
11568
  await n.changeParticipantState(e, r);
11392
11569
  }
11393
11570
  }
11394
- async function Es() {
11571
+ async function js() {
11395
11572
  let e = Q.current();
11396
11573
  e && await e.putHandsDown();
11397
11574
  }
11398
- async function Ds(e) {
11575
+ async function Ms(e) {
11399
11576
  let t = Q.current();
11400
11577
  t && await t.updateDisplayLayout(e);
11401
11578
  }
11402
- async function Os(e) {
11579
+ async function Ns(e) {
11403
11580
  let t = Q.current();
11404
11581
  t && await t.requestDisplayLayout(e);
11405
11582
  }
11406
- async function ks(e, t, n = !1) {
11583
+ async function Ps(e, t, n = !1) {
11407
11584
  let r = $.getCachedRawOkIdByExternalId(e);
11408
11585
  if (!r) {
11409
11586
  R.warn("grantRoles: externalId not found in cache", e);
11410
11587
  return;
11411
11588
  }
11412
- return As(r, Z.getDeviceIdx(e), t, n);
11589
+ return Fs(r, Z.getDeviceIdx(e), t, n);
11413
11590
  }
11414
- async function As(e, t, n, r = !1) {
11591
+ async function Fs(e, t, n, r = !1) {
11415
11592
  let i = Q.current();
11416
11593
  i && await i.grantRoles(j.composeParticipantId(e, A.USER, t), n, r);
11417
11594
  }
11418
- async function js({ externalId: e = null, muteStates: t, requestedMedia: n = [], roomId: r = null }) {
11595
+ async function Is({ externalId: e = null, muteStates: t, requestedMedia: n = [], roomId: r = null }) {
11419
11596
  let i = null;
11420
- return e && (i = $.getCachedRawOkIdByExternalId(e), i || R.warn("muteParticipant: externalId not found in cache", e)), Ms({
11597
+ return e && (i = $.getCachedRawOkIdByExternalId(e), i || R.warn("muteParticipant: externalId not found in cache", e)), Ls({
11421
11598
  uid: i,
11422
11599
  muteStates: t,
11423
11600
  requestedMedia: n,
@@ -11425,75 +11602,75 @@ async function js({ externalId: e = null, muteStates: t, requestedMedia: n = [],
11425
11602
  roomId: r
11426
11603
  });
11427
11604
  }
11428
- async function Ms({ uid: e = null, muteStates: t, requestedMedia: n = [], deviceIdx: r = 0, roomId: i = null }) {
11605
+ async function Ls({ uid: e = null, muteStates: t, requestedMedia: n = [], deviceIdx: r = 0, roomId: i = null }) {
11429
11606
  let a = Q.current();
11430
11607
  if (a) {
11431
11608
  let o = e ? j.composeParticipantId(e, A.USER, r) : null;
11432
11609
  await a.muteParticipant(o, t, n, i);
11433
11610
  }
11434
11611
  }
11435
- async function Ns(e, t = !1, n = null) {
11612
+ async function Rs(e, t = !1, n = null) {
11436
11613
  let r = $.getCachedRawOkIdByExternalId(e);
11437
11614
  if (!r) {
11438
11615
  R.warn("pinParticipant: externalId not found in cache", e);
11439
11616
  return;
11440
11617
  }
11441
- return Ps(r, t, Z.getDeviceIdx(e), n);
11618
+ return zs(r, t, Z.getDeviceIdx(e), n);
11442
11619
  }
11443
- async function Ps(e, t = !1, n = 0, r = null) {
11620
+ async function zs(e, t = !1, n = 0, r = null) {
11444
11621
  let i = Q.current();
11445
11622
  i && await i.pinParticipant(j.composeParticipantId(e, A.USER, n), t, r);
11446
11623
  }
11447
- async function Fs(e) {
11624
+ async function Bs(e) {
11448
11625
  let t = Q.current();
11449
11626
  t && await t.updateMediaModifiers(e);
11450
11627
  }
11451
- async function Is(e) {
11628
+ async function Vs(e) {
11452
11629
  let t = Q.current();
11453
11630
  t && await t.enableVideoSuspend(e);
11454
11631
  }
11455
- async function Ls(e) {
11632
+ async function Hs(e) {
11456
11633
  let t = Q.current();
11457
11634
  t && await t.enableVideoSuspendSuggest(e);
11458
11635
  }
11459
- async function Rs(e) {
11636
+ async function Us(e) {
11460
11637
  let t = Q.current();
11461
11638
  t && await t.changeOptions(e);
11462
11639
  }
11463
- async function zs(e, t = null) {
11640
+ async function Ws(e, t = null) {
11464
11641
  let n = null;
11465
- return t && (n = $.getCachedRawOkIdByExternalId(t), n || R.warn("chatMessage: externalId not found in cache", t)), Bs(e, n);
11642
+ return t && (n = $.getCachedRawOkIdByExternalId(t), n || R.warn("chatMessage: externalId not found in cache", t)), Gs(e, n);
11466
11643
  }
11467
- async function Bs(e, t = null) {
11644
+ async function Gs(e, t = null) {
11468
11645
  let n = Q.current();
11469
11646
  if (n) {
11470
11647
  let r = t ? j.composeUserId(t) : null;
11471
11648
  await n.chatMessage(e, r);
11472
11649
  }
11473
11650
  }
11474
- async function Vs(e = 10) {
11651
+ async function Ks(e = 10) {
11475
11652
  let t = Q.current();
11476
11653
  if (t) return t.chatHistory(e);
11477
11654
  }
11478
- async function Hs(e, t = null) {
11655
+ async function qs(e, t = null) {
11479
11656
  let n = null;
11480
- return t && (n = $.getCachedRawOkIdByExternalId(t), n || R.warn("customData: externalId not found in cache", t)), Us(e, n, Z.getDeviceIdx(t));
11657
+ return t && (n = $.getCachedRawOkIdByExternalId(t), n || R.warn("customData: externalId not found in cache", t)), Js(e, n, Z.getDeviceIdx(t));
11481
11658
  }
11482
- async function Us(e, t = null, n = 0) {
11659
+ async function Js(e, t = null, n = 0) {
11483
11660
  let r = Q.current();
11484
11661
  if (r) {
11485
11662
  let i = t ? j.composeParticipantId(t, A.USER, n) : null;
11486
11663
  await r.customData(e, i);
11487
11664
  }
11488
11665
  }
11489
- async function Ws(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, waitForAdmin: r = !1, closedConversation: i = !1 } = {}, a) {
11666
+ async function Ys(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, waitForAdmin: r = !1, closedConversation: i = !1 } = {}, a) {
11490
11667
  return (await $.createConversation(a ?? j.uuid(), e, t, {
11491
11668
  onlyAdminCanShareMovie: n,
11492
11669
  waitForAdmin: r,
11493
11670
  closedConversation: i
11494
11671
  })).join_link;
11495
11672
  }
11496
- async function Gs(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, audioOnly: r = !1 } = {}, i) {
11673
+ async function Xs(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, audioOnly: r = !1 } = {}, i) {
11497
11674
  let a = i.map((e) => Z.fromId(e));
11498
11675
  return (await $.createConversation(j.uuid(), e, t, {
11499
11676
  onlyAdminCanShareMovie: n,
@@ -11501,53 +11678,53 @@ async function Gs(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, audioOnly: r
11501
11678
  audioOnly: r
11502
11679
  }, a)).join_link;
11503
11680
  }
11504
- async function Ks() {
11681
+ async function Zs() {
11505
11682
  let e = Q.current();
11506
11683
  return e ? e.createJoinLink() : Promise.reject();
11507
11684
  }
11508
- async function qs() {
11685
+ async function Qs() {
11509
11686
  let e = Q.current();
11510
11687
  return e ? e.removeJoinLink() : Promise.reject();
11511
11688
  }
11512
- async function Js(e, t) {
11689
+ async function $s(e, t) {
11513
11690
  return $.getAnonymTokenByLink(e, t);
11514
11691
  }
11515
- function Ys(e) {
11692
+ function ec(e) {
11516
11693
  let t = Q.current();
11517
11694
  t && t.setVolume(e);
11518
11695
  }
11519
- function Xs(e) {
11696
+ function tc(e) {
11520
11697
  M.forceRelayPolicy = e;
11521
11698
  }
11522
- async function Zs(e = !1, t = null, n = null, r = "DIRECT_LINK", i = null, a = null) {
11699
+ async function nc(e = !1, t = null, n = null, r = "DIRECT_LINK", i = null, a = null) {
11523
11700
  let o = Q.current();
11524
11701
  return o ? o.startStream(e, t, n, r, i, a) : Promise.reject();
11525
11702
  }
11526
- async function Qs(e = null, t) {
11703
+ async function rc(e = null, t) {
11527
11704
  let n = Q.current();
11528
11705
  return n ? n.stopStream(e, t) : Promise.reject();
11529
11706
  }
11530
- async function $s(e = null) {
11707
+ async function ic(e = null) {
11531
11708
  let t = Q.current();
11532
11709
  return t ? t.publishStream(e) : Promise.reject();
11533
11710
  }
11534
- async function ec() {
11711
+ async function ac() {
11535
11712
  let e = Q.current();
11536
11713
  return e ? e.getStreamInfo() : Promise.reject();
11537
11714
  }
11538
- async function tc(e) {
11715
+ async function oc(e) {
11539
11716
  let t = Q.current();
11540
11717
  return t ? t.addMovie(e) : Promise.reject();
11541
11718
  }
11542
- async function nc(e) {
11719
+ async function sc(e) {
11543
11720
  let t = Q.current();
11544
11721
  return t ? t.updateMovie(e) : Promise.reject();
11545
11722
  }
11546
- async function rc(e) {
11723
+ async function cc(e) {
11547
11724
  let t = Q.current();
11548
11725
  return t ? t.removeMovie(e) : Promise.reject();
11549
11726
  }
11550
- async function ic(e, t) {
11727
+ async function lc(e, t) {
11551
11728
  let n = Q.current();
11552
11729
  if (n) {
11553
11730
  let r = [];
@@ -11572,11 +11749,11 @@ async function ic(e, t) {
11572
11749
  }
11573
11750
  return Promise.reject();
11574
11751
  }
11575
- async function ac(e, t) {
11752
+ async function uc(e, t) {
11576
11753
  let n = Q.current();
11577
11754
  return n ? n.activateRooms(e, t) : Promise.reject();
11578
11755
  }
11579
- async function oc(e = null, t = null) {
11756
+ async function dc(e = null, t = null) {
11580
11757
  let n = Q.current();
11581
11758
  if (!n) return Promise.reject();
11582
11759
  let r;
@@ -11591,30 +11768,30 @@ async function oc(e = null, t = null) {
11591
11768
  }
11592
11769
  return n.switchRoom(e, r);
11593
11770
  }
11594
- async function sc(e) {
11771
+ async function fc(e) {
11595
11772
  let t = Q.current();
11596
11773
  return t ? t.removeRooms(e) : Promise.reject();
11597
11774
  }
11598
- function cc(e) {
11775
+ function pc(e) {
11599
11776
  M.statisticsInterval = e;
11600
11777
  let t = Q.current();
11601
11778
  if (t) return t.updateStatisticsInterval();
11602
11779
  }
11603
- function lc(t) {
11780
+ function mc(t) {
11604
11781
  e.disableLog(!t), R.toggle(t);
11605
11782
  }
11606
- function uc(e, ...t) {
11783
+ function hc(e, ...t) {
11607
11784
  M.debugLog && R.send(e, "[external]", ...t);
11608
11785
  }
11609
- var dc = {
11610
- list: Pe,
11611
- get: Fe,
11612
- getJson: Ie,
11613
- download: Le,
11614
- clear: Re,
11615
- stats: ze
11786
+ var gc = {
11787
+ list: Ne,
11788
+ get: Pe,
11789
+ getJson: Fe,
11790
+ download: Ie,
11791
+ clear: Le,
11792
+ stats: Re
11616
11793
  };
11617
- function fc() {
11794
+ function _c() {
11618
11795
  let e = [
11619
11796
  [`Calls SDK ${M.sdkVersion}`, M.toJSON()],
11620
11797
  ["UserAgent:", navigator.userAgent],
@@ -11631,31 +11808,31 @@ function fc() {
11631
11808
  d: e
11632
11809
  }));
11633
11810
  }
11634
- async function pc() {
11811
+ async function vc() {
11635
11812
  let e = Q.id(), t = Q.debugSessionId();
11636
11813
  if (!t || !e) throw R.error("[uploadDebugLogs]", "No conversation id found"), Error("No conversation id found");
11637
- let n = await Fe({ sessionId: t });
11814
+ let n = await Pe({ sessionId: t });
11638
11815
  if (n.length === 0) throw R.error("[uploadDebugLogs]", "No logs found"), Error("No logs found");
11639
11816
  let r = n[0].t, i = n[n.length - 1].t;
11640
11817
  try {
11641
- return $?.uploadDebugLogs(e, r, i, JSON.stringify([...fc(), ...n]));
11818
+ return $?.uploadDebugLogs(e, r, i, JSON.stringify([..._c(), ...n]));
11642
11819
  } catch (e) {
11643
11820
  throw R.error("[uploadDebugLogs]", "Error while uploading logs", e), Error("Error while uploading logs", { cause: e });
11644
11821
  }
11645
11822
  }
11646
- async function mc(e) {
11823
+ async function yc(e) {
11647
11824
  let t = Q.current();
11648
11825
  if (t) return t.videoEffect(e);
11649
11826
  }
11650
- async function hc(e, t) {
11827
+ async function bc(e, t) {
11651
11828
  let n = Q.current();
11652
11829
  if (n) return n.audioEffect(e.length > 0 ? e : null, t);
11653
11830
  }
11654
- async function gc(e) {
11831
+ async function xc(e) {
11655
11832
  let t = Q.current();
11656
11833
  t && await t.setAudioStream(e);
11657
11834
  }
11658
- async function _c(e, t = null, n = null) {
11835
+ async function Sc(e, t = null, n = null) {
11659
11836
  let r = Q.current();
11660
11837
  if (!r) return;
11661
11838
  let i = n ?? t?.id, a = null;
@@ -11666,18 +11843,18 @@ async function _c(e, t = null, n = null) {
11666
11843
  }
11667
11844
  r.setAnimojiSvg(e, a, i);
11668
11845
  }
11669
- function vc(e) {
11846
+ function Cc(e) {
11670
11847
  let t = Q.current();
11671
11848
  t && t.setAnimojiFill(e);
11672
11849
  }
11673
- async function yc(e = null, t, n = !1) {
11674
- return jc().getWaitingHall(e, t, n);
11850
+ async function wc(e = null, t, n = !1) {
11851
+ return Ic().getWaitingHall(e, t, n);
11675
11852
  }
11676
- async function bc() {
11677
- return jc().getAudienceModeHands();
11853
+ async function Tc() {
11854
+ return Ic().getAudienceModeHands();
11678
11855
  }
11679
- async function xc(e, t = !1) {
11680
- let n = jc(), r;
11856
+ async function Ec(e, t = !1) {
11857
+ let n = Ic(), r;
11681
11858
  if (e) {
11682
11859
  let t = $.getCachedRawOkIdByExternalId(e);
11683
11860
  if (!t) {
@@ -11688,74 +11865,74 @@ async function xc(e, t = !1) {
11688
11865
  }
11689
11866
  return n.promoteParticipant(r, t);
11690
11867
  }
11691
- async function Sc(e = !1) {
11692
- return jc().requestPromotion(e);
11868
+ async function Dc(e = !1) {
11869
+ return Ic().requestPromotion(e);
11693
11870
  }
11694
- async function Cc(e = !1) {
11695
- return jc().acceptPromotion(e);
11871
+ async function Oc(e = !1) {
11872
+ return Ic().acceptPromotion(e);
11696
11873
  }
11697
- async function wc(e) {
11698
- return jc().getParticipantListChunk(e);
11874
+ async function kc(e) {
11875
+ return Ic().getParticipantListChunk(e);
11699
11876
  }
11700
- async function Tc(e) {
11701
- return jc().getParticipants(e);
11877
+ async function Ac(e) {
11878
+ return Ic().getParticipants(e);
11702
11879
  }
11703
- async function Ec(e) {
11704
- return jc().feedback(e);
11880
+ async function jc(e) {
11881
+ return Ic().feedback(e);
11705
11882
  }
11706
- function Dc(e, t, n) {
11707
- return jc().userFeedbackStats(e, t, n);
11883
+ function Mc(e, t, n) {
11884
+ return Ic().userFeedbackStats(e, t, n);
11708
11885
  }
11709
- function Oc(e, t = {}, n = !1) {
11886
+ function Nc(e, t = {}, n = !1) {
11710
11887
  let r = Q.current();
11711
11888
  r && r.sendClientEvent(e, t, n);
11712
11889
  }
11713
- async function kc(e, t, n) {
11714
- return jc(n).enableFeatureForRoles(e, t);
11890
+ async function Pc(e, t, n) {
11891
+ return Ic(n).enableFeatureForRoles(e, t);
11715
11892
  }
11716
- function Ac(e) {
11717
- return e ? z.get(e) ?? null : Q.current();
11893
+ function Fc(e) {
11894
+ return e ? z.get(e) ?? null : Q.current() ?? z.getFirstHeld();
11718
11895
  }
11719
- function jc(e) {
11720
- let t = Ac(e);
11896
+ function Ic(e) {
11897
+ let t = Fc(e);
11721
11898
  if (!t) throw Error("Conversation not found");
11722
11899
  return t;
11723
11900
  }
11724
- async function Mc(e) {
11901
+ async function Lc(e) {
11725
11902
  await $.removeHistoryRecords(e);
11726
11903
  }
11727
- async function Nc(e) {
11904
+ async function Rc(e) {
11728
11905
  let t = Q.current();
11729
11906
  t && await t.startAsr(e);
11730
11907
  }
11731
- async function Pc(e) {
11908
+ async function zc(e) {
11732
11909
  let t = Q.current();
11733
11910
  t && await t.stopAsr(e);
11734
11911
  }
11735
- async function Fc(e) {
11912
+ async function Bc(e) {
11736
11913
  let t = Q.current();
11737
11914
  t && await t.requestAsr(e);
11738
11915
  }
11739
- async function Ic(e) {
11916
+ async function Vc(e) {
11740
11917
  let t = Q.current();
11741
11918
  return t ? t.startUrlSharing(e) : Promise.reject();
11742
11919
  }
11743
- async function Lc() {
11920
+ async function Hc() {
11744
11921
  let e = Q.current();
11745
11922
  return e ? e.stopUrlSharing() : Promise.reject();
11746
11923
  }
11747
- async function Rc(e) {
11924
+ async function Uc(e) {
11748
11925
  await z.switchCall(e);
11749
11926
  }
11750
- function zc() {
11927
+ function Wc() {
11751
11928
  return z.getActiveId();
11752
11929
  }
11753
- function Bc() {
11930
+ function Gc() {
11754
11931
  return Q.getSyncedTime();
11755
11932
  }
11756
- function Vc() {
11933
+ function Kc() {
11757
11934
  return M.sdkVersion;
11758
11935
  }
11759
11936
  typeof window < "u" && (window.__CALLS_SDK = mn);
11760
11937
  //#endregion
11761
- export { Ho as Api, qo as ApiExternal, Ko as ArrayDequeue, v as AuthData, f as BaseLogger, Y as CallDirection, Ea as CallType, Da as ChatRoomEventType, Oa as ConversationFeature, ka as ConversationOption, _n as DebugMessageType, Ra as ExternalIdType, At as FacingMode, b as FatalError, O as HangupReason, D as HangupType, x as MediaOption, k as MediaTrackKind, V as MediaType, Ma as MuteState, X as ParticipantState, Go as ParticipantStateDataValue, N as ParticipantStatus, Wo as RecordRole, Na as RoomsEventType, Ta as Signaling, B as SignalingCommandType, dr as SignalingConnectionType, G as SignalingNotification, q as TransportTopology, Ia as UserRole, A as UserType, to as VolumeDetector, ss as acceptCall, Cc as acceptPromotion, ac as activateRooms, tc as addMovie, ps as addParticipant, ms as addParticipantInternal, os as authorize, Yo as browser, rs as callInternal, ns as callTo, vs as captureScreen, ys as captureVmoji, hc as changeAudioEffect, Rs as changeConversationOptions, _s as changeDevice, Ts as changeParticipantState, ws as changePriorities, mc as changeVideoEffect, Vs as chatHistory, zs as chatMessage, Bs as chatMessageInternal, Ks as createJoinLink, Hs as customData, Us as customDataInternal, lc as debug, dc as debugLogs, uc as debugMessage, cs as declineCall, kc as enableFeatureForRoles, Is as enableVideoSuspend, Ls as enableVideoSuspendSuggest, Ec as feedback, Xs as forceRelayPolicy, zc as getActiveCallId, Js as getAnonymTokenByLink, bc as getAudienceModeHands, wc as getParticipantListChunk, Tc as getParticipants, ec as getStreamInfo, Bc as getSyncedTime, yc as getWaitingHall, ks as grantRoles, As as grantRolesInternal, fs as hangup, ts as init, ls as joinCall, ds as joinCallByLink, us as joinCallInternal, Oc as logClientEvent, js as muteParticipant, Ms as muteParticipantInternal, Ns as pinParticipant, Ps as pinParticipantInternal, is as processPush, as as processPushInternal, xc as promoteParticipant, $s as publishStream, Es as putHandsDown, Mc as removeHistoryRecords, qs as removeJoinLink, rc as removeMovie, hs as removeParticipant, gs as removeParticipantInternal, sc as removeRooms, Fc as requestAsr, Os as requestDisplayLayout, Sc as requestPromotion, $o as setAudioEffects, gc as setAudioStream, Cs as setLocalResolution, Zo as setLogger, Fs as setMediaModifiers, cc as setStatisticsInterval, Qo as setVideoEffects, bs as setVideoStream, es as setVmoji, vc as setVmojiFill, _c as setVmojiSvg, Ys as setVolume, Nc as startAsr, Gs as startAudienceConversation, Ws as startConversation, Zs as startStream, Ic as startUrlSharing, Pc as stopAsr, Qs as stopStream, Lc as stopUrlSharing, Rc as switchCall, oc as switchRoom, Ss as toggleLocalAudio, xs as toggleLocalVideo, Ds as updateDisplayLayout, nc as updateMovie, ic as updateRooms, pc as uploadDebugLogs, Dc as userFeedbackStats, Xo as utils, Vc as version };
11938
+ export { qo as Api, Qo as ApiExternal, Zo as ArrayDequeue, y as AuthData, f as BaseLogger, Y as CallDirection, Oa as CallType, ka as ChatRoomEventType, Aa as ConversationFeature, ja as ConversationOption, _n as DebugMessageType, Ba as ExternalIdType, At as FacingMode, x as FatalError, O as HangupReason, D as HangupType, S as MediaOption, k as MediaTrackKind, V as MediaType, Pa as MuteState, X as ParticipantState, Xo as ParticipantStateDataValue, N as ParticipantStatus, Yo as RecordRole, Fa as RoomsEventType, Da as Signaling, B as SignalingCommandType, dr as SignalingConnectionType, G as SignalingNotification, q as TransportTopology, Ra as UserRole, A as UserType, oo as VolumeDetector, fs as acceptCall, Oc as acceptPromotion, uc as activateRooms, oc as addMovie, vs as addParticipant, ys as addParticipantInternal, ds as authorize, es as browser, cs as callInternal, ss as callTo, Cs as captureScreen, ws as captureVmoji, bc as changeAudioEffect, Us as changeConversationOptions, Ss as changeDevice, As as changeParticipantState, ks as changePriorities, yc as changeVideoEffect, Ks as chatHistory, Ws as chatMessage, Gs as chatMessageInternal, Zs as createJoinLink, qs as customData, Js as customDataInternal, mc as debug, gc as debugLogs, hc as debugMessage, ps as declineCall, Pc as enableFeatureForRoles, Vs as enableVideoSuspend, Hs as enableVideoSuspendSuggest, jc as feedback, tc as forceRelayPolicy, Wc as getActiveCallId, $s as getAnonymTokenByLink, Tc as getAudienceModeHands, kc as getParticipantListChunk, Ac as getParticipants, ac as getStreamInfo, Gc as getSyncedTime, wc as getWaitingHall, Ps as grantRoles, Fs as grantRolesInternal, _s as hangup, os as init, ms as joinCall, gs as joinCallByLink, hs as joinCallInternal, Nc as logClientEvent, Is as muteParticipant, Ls as muteParticipantInternal, Rs as pinParticipant, zs as pinParticipantInternal, ls as processPush, us as processPushInternal, Ec as promoteParticipant, ic as publishStream, js as putHandsDown, Lc as removeHistoryRecords, Qs as removeJoinLink, cc as removeMovie, bs as removeParticipant, xs as removeParticipantInternal, fc as removeRooms, Bc as requestAsr, Ns as requestDisplayLayout, Dc as requestPromotion, is as setAudioEffects, xc as setAudioStream, Os as setLocalResolution, ns as setLogger, Bs as setMediaModifiers, pc as setStatisticsInterval, rs as setVideoEffects, Ts as setVideoStream, as as setVmoji, Cc as setVmojiFill, Sc as setVmojiSvg, ec as setVolume, Rc as startAsr, Xs as startAudienceConversation, Ys as startConversation, nc as startStream, Vc as startUrlSharing, zc as stopAsr, rc as stopStream, Hc as stopUrlSharing, Uc as switchCall, dc as switchRoom, Ds as toggleLocalAudio, Es as toggleLocalVideo, Ms as updateDisplayLayout, sc as updateMovie, lc as updateRooms, vc as uploadDebugLogs, Mc as userFeedbackStats, ts as utils, Kc as version };