@vkontakte/calls-sdk 2.8.11-dev.50a3a6bf.0 → 2.8.11-dev.54a3a1c9.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.50a3a6bf.0
3
- * Fri, 03 Jul 2026 12:07:55 GMT
2
+ * @vkontakte/calls-sdk v2.8.11-dev.54a3a1c9.0
3
+ * Fri, 10 Jul 2026 08:53:31 GMT
4
4
  * https://calls-sdk.cdn-vk.ru/doc/latest/index.html
5
5
  */
6
6
 
@@ -16,7 +16,7 @@ var f = class {
16
16
  destroy() {}
17
17
  };
18
18
  //#endregion
19
- //#region \0@oxc-project+runtime@0.132.0/helpers/typeof.js
19
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/typeof.js
20
20
  function p(e) {
21
21
  "@babel/helpers - typeof";
22
22
  return p = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
@@ -26,7 +26,7 @@ function p(e) {
26
26
  }, p(e);
27
27
  }
28
28
  //#endregion
29
- //#region \0@oxc-project+runtime@0.132.0/helpers/toPrimitive.js
29
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/toPrimitive.js
30
30
  function m(e, t) {
31
31
  if (p(e) != "object" || !e) return e;
32
32
  var n = e[Symbol.toPrimitive];
@@ -38,13 +38,13 @@ function m(e, t) {
38
38
  return (t === "string" ? String : Number)(e);
39
39
  }
40
40
  //#endregion
41
- //#region \0@oxc-project+runtime@0.132.0/helpers/toPropertyKey.js
41
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/toPropertyKey.js
42
42
  function ee(e) {
43
43
  var t = m(e, "string");
44
44
  return p(t) == "symbol" ? t : t + "";
45
45
  }
46
46
  //#endregion
47
- //#region \0@oxc-project+runtime@0.132.0/helpers/defineProperty.js
47
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/defineProperty.js
48
48
  function h(e, t, n) {
49
49
  return (t = ee(t)) in e ? Object.defineProperty(e, t, {
50
50
  value: n,
@@ -55,31 +55,31 @@ function h(e, t, n) {
55
55
  }
56
56
  //#endregion
57
57
  //#region src/utils/DebugStorage.ts
58
- var te = 25 * 1024 * 1024, ne = 10, re = "_okcls_logs_session_", ie = 3e4, ae = "ok-calls-sdk-debug-logs", oe = 1, g = "sessions", _ = "chunks", se = 120 * 1e3, ce = new Set(["WARN", "ERROR"]);
59
- function le() {
60
- return `${Date.now()}_${Math.random().toString(36).slice(2)}`;
61
- }
58
+ var te = 25 * 1024 * 1024, ne = 10, re = "_okcls_logs_session_", ie = 3e4, ae = "ok-calls-sdk-debug-logs", oe = 1, g = "sessions", se = "chunks", ce = 120 * 1e3, le = /* @__PURE__ */ new Set(["WARN", "ERROR"]);
62
59
  function ue() {
63
- let e = le();
64
- return de(e), e;
60
+ return `${Date.now()}_${Math.random().toString(36).slice(2)}`;
65
61
  }
66
- function de(e) {
67
- He.has(e) || He.set(e, []), Ue.has(e) || Ue.set(e, 0), We.has(e) || We.set(e, null);
62
+ function de() {
63
+ let e = ue();
64
+ return fe(e), e;
68
65
  }
69
66
  function fe(e) {
70
- return We.get(e) ?? null;
67
+ Ue.has(e) || Ue.set(e, []), We.has(e) || We.set(e, 0), Ge.has(e) || Ge.set(e, null);
71
68
  }
72
69
  function pe(e) {
73
- let t = Ue.get(e) ?? 0;
74
- return Ue.set(e, t + 1), t;
70
+ return Ge.get(e) ?? null;
75
71
  }
76
- function me(e, t) {
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) {
77
77
  return `${e}:${String(t).padStart(12, "0")}`;
78
78
  }
79
- function he(e) {
79
+ function ge(e) {
80
80
  return new Blob([e]).size;
81
81
  }
82
- function ge() {
82
+ function _e() {
83
83
  try {
84
84
  let e = window.localStorage;
85
85
  for (let t of Object.keys(e)) t.indexOf(re) === 0 && e.removeItem(t);
@@ -87,7 +87,7 @@ function ge() {
87
87
  console.error("Storage is blocked", e);
88
88
  }
89
89
  }
90
- var v = new class {
90
+ var _ = new class {
91
91
  constructor() {
92
92
  h(this, "_db", null), h(this, "_dbPromise", null), h(this, "_supported", this.isSupported());
93
93
  }
@@ -140,7 +140,7 @@ var v = new class {
140
140
  async getChunksBySession(e) {
141
141
  let t = await this.open();
142
142
  if (!t) return [];
143
- let n = t.transaction(_, "readonly"), r = await this.requestToPromise(n.objectStore(_).index("sessionId").getAll(e));
143
+ let n = t.transaction(se, "readonly"), r = await this.requestToPromise(n.objectStore(se).index("sessionId").getAll(e));
144
144
  return await this.txDone(n), r.sort((e, t) => e.sequence - t.sequence);
145
145
  }
146
146
  async putSession(e) {
@@ -152,8 +152,8 @@ var v = new class {
152
152
  async putSessionAndChunk(e, t) {
153
153
  let n = await this.open();
154
154
  if (!n) return !1;
155
- let r = n.transaction([g, _], "readwrite");
156
- return r.objectStore(g).put(e), r.objectStore(_).put(t), await this.txDone(r), !0;
155
+ let r = n.transaction([g, se], "readwrite");
156
+ return r.objectStore(g).put(e), r.objectStore(se).put(t), await this.txDone(r), !0;
157
157
  }
158
158
  async updateSessionConversationId(e, t) {
159
159
  let [n] = await this.getSessionBySessionId(e);
@@ -166,14 +166,14 @@ var v = new class {
166
166
  async deleteSession(e) {
167
167
  let t = await this.open();
168
168
  if (!t) return 0;
169
- let n = await this.getChunksBySession(e), r = t.transaction([g, _], "readwrite"), i = r.objectStore(_), a = 0;
169
+ let n = await this.getChunksBySession(e), r = t.transaction([g, se], "readwrite"), i = r.objectStore(se), a = 0;
170
170
  for (let e of n) a += e.bytes, i.delete(e.id);
171
171
  return r.objectStore(g).delete(e), await this.txDone(r), a;
172
172
  }
173
173
  async deleteChunks(e) {
174
174
  let t = await this.open();
175
175
  if (!t || !e.length) return;
176
- let n = t.transaction(_, "readwrite"), r = n.objectStore(_);
176
+ let n = t.transaction(se, "readwrite"), r = n.objectStore(se);
177
177
  for (let t of e) r.delete(t.id);
178
178
  await this.txDone(n);
179
179
  }
@@ -207,7 +207,7 @@ var v = new class {
207
207
  let t = e.createObjectStore(g, { keyPath: "sessionId" });
208
208
  t.createIndex("conversationId", "conversationId", { unique: !1 }), t.createIndex("updatedAt", "updatedAt", { unique: !1 });
209
209
  }
210
- e.objectStoreNames.contains(_) || e.createObjectStore(_, { keyPath: "id" }).createIndex("sessionId", "sessionId", { unique: !1 });
210
+ e.objectStoreNames.contains(se) || e.createObjectStore(se, { keyPath: "id" }).createIndex("sessionId", "sessionId", { unique: !1 });
211
211
  }
212
212
  isSupported() {
213
213
  return typeof window < "u" && !!window.indexedDB;
@@ -278,15 +278,15 @@ var v = new class {
278
278
  return i;
279
279
  }
280
280
  }();
281
- async function _e(e) {
282
- return e.sessionId ? v.getSessionBySessionId(e.sessionId) : e.conversationId ? v.getSessionsByConversationId(e.conversationId) : [];
281
+ async function ve(e) {
282
+ return e.sessionId ? _.getSessionBySessionId(e.sessionId) : e.conversationId ? _.getSessionsByConversationId(e.conversationId) : [];
283
283
  }
284
- async function ve(e, t, n, r) {
284
+ async function ye(e, t, n, r) {
285
285
  if (!r.length) return;
286
- let i = fe(e) || t, a = r, o = JSON.stringify(a), s = he(o);
287
- for (; s > te && a.length > 1;) a = a.slice(Math.floor(a.length / 2)), o = JSON.stringify(a), s = he(o);
286
+ let i = pe(e) || t, a = r, o = JSON.stringify(a), s = ge(o);
287
+ for (; s > te && a.length > 1;) a = a.slice(Math.floor(a.length / 2)), o = JSON.stringify(a), s = ge(o);
288
288
  if (s > te) return;
289
- let c = a[0].t, l = a[a.length - 1].t, [u] = await v.getSessionBySessionId(e), d = u || {
289
+ let c = a[0].t, l = a[a.length - 1].t, [u] = await _.getSessionBySessionId(e), d = u || {
290
290
  sessionId: e,
291
291
  conversationId: i,
292
292
  startTime: c,
@@ -303,7 +303,7 @@ async function ve(e, t, n, r) {
303
303
  bytes: d.bytes + s,
304
304
  entriesCount: d.entriesCount + a.length
305
305
  }, p = {
306
- id: me(e, n),
306
+ id: he(e, n),
307
307
  sessionId: e,
308
308
  sequence: n,
309
309
  startTime: c,
@@ -311,9 +311,9 @@ async function ve(e, t, n, r) {
311
311
  bytes: s,
312
312
  items: a
313
313
  };
314
- await v.putSessionAndChunk(f, p) && await v.enforceRetentionPolicy();
314
+ await _.putSessionAndChunk(f, p) && await _.enforceRetentionPolicy();
315
315
  }
316
- function ye(e) {
316
+ function be(e) {
317
317
  let t = /* @__PURE__ */ new WeakSet();
318
318
  try {
319
319
  return JSON.parse(JSON.stringify(e, (e, n) => {
@@ -328,101 +328,101 @@ function ye(e) {
328
328
  return e.map((e) => String(e));
329
329
  }
330
330
  }
331
- function be(e) {
332
- let t = He.get(e);
333
- if (!t?.length) return qe;
334
- let n = t.splice(0), r = fe(e), i = pe(e);
335
- return qe = qe.then(() => ve(e, r, i, n)).catch((e) => {
331
+ function xe(e) {
332
+ let t = Ue.get(e);
333
+ if (!t?.length) return Je;
334
+ let n = t.splice(0), r = pe(e), i = me(e);
335
+ return Je = Je.then(() => ye(e, r, i, n)).catch((e) => {
336
336
  console.warn("Failed to write debug log to storage", e);
337
- }), qe;
337
+ }), Je;
338
338
  }
339
- function xe(e) {
340
- if (e) return be(e);
341
- for (let e of He.keys()) be(e);
342
- return qe;
339
+ function Se(e) {
340
+ if (e) return xe(e);
341
+ for (let e of Ue.keys()) xe(e);
342
+ return Je;
343
343
  }
344
- async function Se(e) {
344
+ async function Ce(e) {
345
345
  let t = [];
346
346
  for (let n of e.sort((e, t) => e.startTime - t.startTime)) {
347
- let e = await v.getChunksBySession(n.sessionId);
347
+ let e = await _.getChunksBySession(n.sessionId);
348
348
  for (let n of e) t.push(...n.items);
349
349
  }
350
350
  return t;
351
351
  }
352
- async function Ce(e) {
353
- let t = await Se(e);
352
+ async function we(e) {
353
+ let t = await Ce(e);
354
354
  if (!t.length) return t;
355
- let n = t.sort(Te), r = n[0].t, i = n[n.length - 1].t;
356
- return [...await we(r, i, new Set(e.map((e) => e.sessionId))), ...n].sort(Te);
355
+ let n = t.sort(Ee), r = n[0].t, i = n[n.length - 1].t;
356
+ return [...await Te(r, i, new Set(e.map((e) => e.sessionId))), ...n].sort(Ee);
357
357
  }
358
- async function we(e, t, n) {
359
- let r = (await v.getAllSessions()).filter((r) => !n.has(r.sessionId) && r.conversationId === null && r.endTime >= e - se && r.startTime <= t), i = [];
358
+ async function Te(e, t, n) {
359
+ let r = (await _.getAllSessions()).filter((r) => !n.has(r.sessionId) && r.conversationId === null && r.endTime >= e - ce && r.startTime <= t), i = [];
360
360
  for (let n of r) {
361
- let r = await v.getChunksBySession(n.sessionId);
362
- for (let n of r) n.endTime < e - se || n.startTime > t || i.push(...n.items.filter((n) => n.t >= e - se && n.t <= e ? !0 : n.t >= e && n.t <= t && ce.has(n.l)));
361
+ let r = await _.getChunksBySession(n.sessionId);
362
+ for (let n of r) n.endTime < e - ce || n.startTime > t || i.push(...n.items.filter((n) => n.t >= e - ce && n.t <= e || n.t >= e && n.t <= t && le.has(n.l)));
363
363
  }
364
364
  return i;
365
365
  }
366
- function Te(e, t) {
366
+ function Ee(e, t) {
367
367
  return e.t - t.t;
368
368
  }
369
- function Ee(e, t) {
369
+ function De(e, t) {
370
370
  let n = document.createElement("a"), r = new Blob([e], { type: "text/json" }), i = URL.createObjectURL(r);
371
371
  n.href = i, n.download = t, n.click(), URL.revokeObjectURL(i);
372
372
  }
373
- function De() {
374
- xe();
375
- }
376
373
  function Oe() {
377
- document.visibilityState === "hidden" && xe();
374
+ Se();
375
+ }
376
+ function ke() {
377
+ document.visibilityState === "hidden" && Se();
378
378
  }
379
- function ke(e, t, n = Ge) {
380
- Ve || Ae(), de(n);
379
+ function Ae(e, t, n = Ke) {
380
+ He || je(), fe(n);
381
381
  let r = /* @__PURE__ */ new Date(), i = {
382
382
  t: r.getTime(),
383
383
  l: e,
384
- d: ye(t),
384
+ d: be(t),
385
385
  h: r.toLocaleString("ru-RU", {
386
386
  dateStyle: "short",
387
387
  timeStyle: "long"
388
388
  })
389
389
  };
390
- return He.get(n)?.push(i), Ke || (Ke = window.setTimeout(() => {
391
- Ke = null, xe();
390
+ return Ue.get(n)?.push(i), qe || (qe = window.setTimeout(() => {
391
+ qe = null, Se();
392
392
  }, ie)), i;
393
393
  }
394
- function Ae() {
395
- Ve || (Ve = !0, ge(), v.open(), window.addEventListener("pagehide", De), document.addEventListener("visibilitychange", Oe));
396
- }
397
394
  function je() {
398
- return Ve || Ae(), xe(), ue();
395
+ He || (He = !0, _e(), _.open(), window.addEventListener("pagehide", Oe), document.addEventListener("visibilitychange", ke));
399
396
  }
400
- function Me(e, t = Ge) {
401
- t && (de(t), We.set(t, e), e && v.updateSessionConversationId(t, e));
397
+ function Me() {
398
+ return He || je(), Se(), de();
402
399
  }
403
- async function Ne() {
404
- return await xe(), (await v.getAllSessions()).sort((e, t) => t.updatedAt - e.updatedAt);
400
+ function Ne(e, t = Ke) {
401
+ t && (fe(t), Ge.set(t, e), e && _.updateSessionConversationId(t, e));
405
402
  }
406
- async function Pe(e) {
407
- return await xe(), Ce(await _e(e));
403
+ async function Pe() {
404
+ return await Se(), (await _.getAllSessions()).sort((e, t) => t.updatedAt - e.updatedAt);
408
405
  }
409
406
  async function Fe(e) {
410
- return JSON.stringify(await Pe(e));
407
+ return await Se(), we(await ve(e));
411
408
  }
412
409
  async function Ie(e) {
413
- let t = await Fe(e), n = `logs_${e.sessionId || e.conversationId}_${Date.now()}.json`;
414
- return Ee(t, n), n;
410
+ return JSON.stringify(await Fe(e));
415
411
  }
416
412
  async function Le(e) {
417
- await xe();
418
- let t = e ? await _e(e) : await v.getAllSessions();
419
- for (let e of t) await v.deleteSession(e.sessionId);
413
+ let t = await Ie(e), n = `logs_${e.sessionId || e.conversationId}_${Date.now()}.json`;
414
+ return De(t, n), n;
415
+ }
416
+ async function Re(e) {
417
+ await Se();
418
+ let t = e ? await ve(e) : await _.getAllSessions();
419
+ for (let e of t) await _.deleteSession(e.sessionId);
420
420
  }
421
- async function Re() {
422
- await xe();
423
- let e = await v.getStorageSummary(), t = await v.estimateStorage();
421
+ async function ze() {
422
+ await Se();
423
+ let e = await _.getStorageSummary(), t = await _.estimateStorage();
424
424
  return {
425
- supported: v.supported,
425
+ supported: _.supported,
426
426
  callsCount: e.callsCount,
427
427
  sessionsCount: e.sessions.length,
428
428
  usedBytes: e.usedBytes,
@@ -432,20 +432,20 @@ async function Re() {
432
432
  usageBytes: t?.usage
433
433
  };
434
434
  }
435
- async function ze() {
436
- await xe();
437
- let e = await Se(await v.getAllSessions());
438
- return JSON.stringify(e.sort(Te));
439
- }
440
435
  async function Be() {
441
- let e = await ze(), t = `logs_${Date.now()}.json`;
442
- return Ee(e, t), t;
436
+ await Se();
437
+ let e = await Ce(await _.getAllSessions());
438
+ return JSON.stringify(e.sort(Ee));
443
439
  }
444
- var Ve = !1, He = /* @__PURE__ */ new Map(), Ue = /* @__PURE__ */ new Map(), We = /* @__PURE__ */ new Map(), Ge = ue(), Ke = null, qe = Promise.resolve();
445
- window.__VKCallsSDKLogs__ = (e = !1) => (Ve || Ae(), e ? ze() : Be());
440
+ async function Ve() {
441
+ let e = await Be(), t = `logs_${Date.now()}.json`;
442
+ return De(e, t), t;
443
+ }
444
+ var He = !1, Ue = /* @__PURE__ */ new Map(), We = /* @__PURE__ */ new Map(), Ge = /* @__PURE__ */ new Map(), Ke = de(), qe = null, Je = Promise.resolve();
445
+ window.__VKCallsSDKLogs__ = (e = !1) => (He || je(), e ? Be() : Ve());
446
446
  //#endregion
447
447
  //#region src/static/AuthData.ts
448
- var y = class e {
448
+ var v = class e {
449
449
  static get sessionKey() {
450
450
  return e._sessionKey;
451
451
  }
@@ -468,10 +468,10 @@ var y = class e {
468
468
  return !e._sessionKey;
469
469
  }
470
470
  };
471
- h(y, "_sessionKey", void 0), h(y, "_sessionSecretKey", void 0), h(y, "_accessToken", void 0);
471
+ h(v, "_sessionKey", void 0), h(v, "_sessionSecretKey", void 0), h(v, "_accessToken", void 0);
472
472
  //#endregion
473
473
  //#region src/classes/EventEmitter.ts
474
- var b = class {
474
+ var y = class {
475
475
  constructor() {
476
476
  h(this, "_handlers", {}), h(this, "_listeners", []);
477
477
  }
@@ -497,14 +497,14 @@ var b = class {
497
497
  e.dispose();
498
498
  });
499
499
  }
500
- }, x = /* @__PURE__ */ function(e) {
500
+ }, b = /* @__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
- }(x || {}), S = /* @__PURE__ */ function(e) {
502
+ }(b || {}), x = /* @__PURE__ */ function(e) {
503
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) {
504
+ }(x || {}), S = /* @__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
- }(C || {}), Je = (e) => e.stop(), Ye = (e) => e.getTracks().forEach(Je), Xe = (e) => e.getVideoTracks().forEach(Je);
507
- async function Ze(e, t) {
506
+ }(S || {}), Ye = (e) => e.stop(), Xe = (e) => e.getTracks().forEach(Ye), Ze = (e) => e.getVideoTracks().forEach(Ye);
507
+ async function Qe(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 Ze(e, t) {
524
524
  }
525
525
  //#endregion
526
526
  //#region src/utils/NavigatorPermissions.ts
527
- var Qe = class {
527
+ var $e = 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 Qe = class {
565
565
  }
566
566
  return t;
567
567
  }
568
- }, $e = "_okcls_", et = (() => {
568
+ }, et = "_okcls_", tt = (() => {
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 Qe = class {
573
573
  return null;
574
574
  }
575
575
  })();
576
- function tt(e) {
577
- let t = et ? et.getItem($e + e) : null;
576
+ function nt(e) {
577
+ let t = tt ? tt.getItem(et + e) : null;
578
578
  if (t === null) return null;
579
579
  try {
580
580
  return JSON.parse(t);
@@ -582,30 +582,30 @@ function tt(e) {
582
582
  return null;
583
583
  }
584
584
  }
585
- function nt(e, t) {
585
+ function rt(e, t) {
586
586
  try {
587
- et && et.setItem($e + e, JSON.stringify(t));
587
+ tt && tt.setItem(et + e, JSON.stringify(t));
588
588
  } catch {}
589
589
  }
590
- function rt(e) {
591
- et && et.removeItem($e + e);
590
+ function it(e) {
591
+ tt && tt.removeItem(et + e);
592
592
  }
593
- var it;
593
+ var at;
594
594
  (function(e) {
595
595
  function t(e) {
596
- return tt(e) || null;
596
+ return nt(e) || null;
597
597
  }
598
598
  e.get = t;
599
599
  function n(e, t) {
600
- nt(e, t);
600
+ rt(e, t);
601
601
  }
602
602
  e.set = n;
603
603
  function r(e) {
604
- rt(e);
604
+ it(e);
605
605
  }
606
606
  e.remove = r;
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) {
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) {
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 (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"))) {
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"))) {
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 (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"))) {
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"))) {
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(C.ERROR, "change_device"), R.warn("Device change failed: MediaSource is busy"), Error("MediaSource is busy");
704
+ if (e._lockId) throw t?.log(S.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
- gt = !1, ht = !1, ot = null;
713
+ _t = !1, gt = !1, st = 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 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) => {
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) => {
726
726
  switch (t) {
727
727
  case "denied":
728
728
  case "prompt":
729
- st?.();
729
+ ct?.();
730
730
  break;
731
731
  }
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, []))));
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, []))));
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
- Ct = isNaN(t) ? null : t;
746
+ wt = 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 (ft && pt) return;
752
+ if (pt && mt) 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
- !pt && e.kind === k.audio ? pt = t(w.getMicrophones(), e) : !ft && e.kind === k.video && (ft = t(w.getCameras(), e));
758
+ !mt && e.kind === k.audio ? mt = t(w.getMicrophones(), e) : !pt && e.kind === k.video && (pt = 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() ? x.CAMERA_PERMISSION : x.MIC_PERMISSION;
778
+ t = e.isVideoRequested() ? b.CAMERA_PERMISSION : b.MIC_PERMISSION;
779
779
  break;
780
780
  case "OverconstrainedError":
781
- t = x.OVERCONSTRAINED;
781
+ t = b.OVERCONSTRAINED;
782
782
  break;
783
783
  case "TypeError":
784
- t = x.UNKNOWN;
784
+ t = b.UNKNOWN;
785
785
  break;
786
786
  case "AbortError":
787
787
  case "NotReadableError":
788
- t = e.isVideoRequested() ? x.CAMERA_ACCESS : x.MIC_ACCESS;
788
+ t = e.isVideoRequested() ? b.CAMERA_ACCESS : b.MIC_ACCESS;
789
789
  break;
790
790
  case "Error": if (i.message === "MediaSource is busy") {
791
- t = e.isVideoRequested() ? x.CAMERA_ACCESS : x.MIC_ACCESS;
791
+ t = e.isVideoRequested() ? b.CAMERA_ACCESS : b.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 || x.UNKNOWN;
796
+ let o = t || b.UNKNOWN;
797
797
  throw L.onPermissionsError(o, i), o;
798
798
  }
799
799
  }
800
800
  async function Bt(e = R) {
801
- if (!(bt || w.browserName() !== "Firefox" || !navigator.mediaDevices?.getUserMedia)) try {
802
- w.hasMicrophonePermission() || L.onPermissionsRequested(), bt = await navigator.mediaDevices.getUserMedia({
801
+ if (!(xt || w.browserName() !== "Firefox" || !navigator.mediaDevices?.getUserMedia)) try {
802
+ w.hasMicrophonePermission() || L.onPermissionsRequested(), xt = 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 x.SCREEN_PERMISSION;
830
- default: throw x.SCREEN_ACCESS;
829
+ case "SecurityError": throw b.SCREEN_PERMISSION;
830
+ default: throw b.SCREEN_ACCESS;
831
831
  }
832
832
  } finally {
833
833
  r.free();
834
834
  }
835
835
  }
836
836
  function Ht() {
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), [
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), [
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 = Ot.match(/\bEdge\/(\d+)/), e) return [
847
+ if (e = C.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 = Ot.match(/\bCriOS\/(\d+)/), e) return [
854
+ if (e = C.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 = Ot.match(/\bFxiOS\/(\d+)/), e) return [
861
+ if (e = C.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 = Ot.match(/\bYaBrowser\/(\d+)/), e) return [
868
+ if (e = C.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 = Ot.match(/\bOPT\/(\d+)/), e) return [
875
+ if (e = C.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 = Ot.match(/\bOPR\/(\d+)/), e) return [
884
+ if (t = !0, n = Number(i[2]), e = C.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 = Ot.match(/\bYaBrowser\/(\d+)/), e) return [
891
+ if (e = C.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 = Ot.match(/\bSferum\/((\d+)(?:\.\d+)*)/), e) return [
898
+ if (e = C.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 = Ot.match(/\bEdge?\/(\d+)/), e) return [
905
+ if (e = C.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 = 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,
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,
923
923
  t,
924
924
  n,
925
925
  r
926
926
  ];
927
- })()), wt;
927
+ })()), Tt;
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 lt;
936
+ return ut;
937
937
  }
938
938
  e.getCameras = n;
939
939
  function r() {
940
- return ut;
940
+ return dt;
941
941
  }
942
942
  e.getMicrophones = r;
943
943
  function i() {
944
- return dt;
944
+ return ft;
945
945
  }
946
946
  e.getOutput = i;
947
947
  function a() {
948
- return lt.length > 0;
948
+ return ut.length > 0;
949
949
  }
950
950
  e.hasCamera = a;
951
951
  function o() {
952
- return ut.length > 0;
952
+ return dt.length > 0;
953
953
  }
954
954
  e.hasMicrophone = o;
955
955
  function s() {
956
- return ft;
956
+ return pt;
957
957
  }
958
958
  e.getSavedCamera = s;
959
959
  function c() {
960
- return pt;
960
+ return mt;
961
961
  }
962
962
  e.getSavedMicrophone = c;
963
963
  function l() {
964
- return mt;
964
+ return ht;
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 ht;
972
+ return gt;
973
973
  }
974
974
  e.hasCameraPermission = d;
975
975
  function f() {
976
- return gt;
976
+ return _t;
977
977
  }
978
978
  e.hasMicrophonePermission = f;
979
979
  function p() {
980
- return ct?.getPermissionState("microphone") ?? null;
980
+ return lt?.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
- bt && (Ye(bt), bt = null);
988
+ xt && (Xe(xt), xt = 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 Ze(n, t);
1023
+ return Qe(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" ? ft = n : e === "audioinput" ? pt = n : e === "audiooutput" && (mt = n), at.set(e, t), n) : null;
1028
+ return n ? (e === "videoinput" ? pt = n : e === "audioinput" ? mt = n : e === "audiooutput" && (ht = n), ot.set(e, t), n) : null;
1029
1029
  }
1030
1030
  e._saveDeviceId = oe;
1031
1031
  function g() {
1032
- if (!yt || yt.readyState === "ended") {
1032
+ if (!bt || bt.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(), yt = t.stream.getAudioTracks()[0];
1036
+ r.type = "sine", r.frequency.value = 0, r.connect(n), r.start(), bt = t.stream.getAudioTracks()[0];
1037
1037
  }
1038
- return Object.assign(yt.clone(), { enabled: !1 });
1038
+ return Object.assign(bt.clone(), { enabled: !1 });
1039
1039
  }
1040
1040
  e.getSilentMediaTrack = g;
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;
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;
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 = se;
1057
- function ce() {
1056
+ e.isBrowserSupported = ce;
1057
+ function le() {
1058
1058
  return !!navigator.mediaDevices.getDisplayMedia;
1059
1059
  }
1060
- e.isScreenCapturingSupported = ce;
1061
- function le() {
1060
+ e.isScreenCapturingSupported = le;
1061
+ function ue() {
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 = le;
1066
- function ue() {
1065
+ e.isBrokenH264Decoder = ue;
1066
+ function de() {
1067
1067
  return w.browserName() === "Yandex" && w.os() === "Windows" || M.simulcast;
1068
1068
  }
1069
- e.isBrokenVP9Encoder = ue;
1070
- function de() {
1069
+ e.isBrokenVP9Encoder = de;
1070
+ function fe() {
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 = de;
1079
- function fe() {
1078
+ e.isBrokenVP9Decoder = fe;
1079
+ function pe() {
1080
1080
  return w.browserName() === "Firefox" && Number(w.browserVersion()) < 60;
1081
1081
  }
1082
- e.isOldDataChannelDescription = fe;
1083
- function pe() {
1082
+ e.isOldDataChannelDescription = pe;
1083
+ function me() {
1084
1084
  return !(w.baseChromeVersion() && w.isMobile());
1085
1085
  }
1086
- e.canPreferH264 = pe;
1087
- function me() {
1086
+ e.canPreferH264 = me;
1087
+ function he() {
1088
1088
  return !(w.browserName() === "Firefox" || w.browserName() === "Safari");
1089
1089
  }
1090
- e.isSimulcastSupportedByBrowser = me;
1091
- function he() {
1092
- return St || (St = (() => {
1090
+ e.isSimulcastSupportedByBrowser = he;
1091
+ function ge() {
1092
+ return Ct || (Ct = (() => {
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(Ot)) return t;
1109
+ for (let t in e) if (Object.hasOwn(e, t) && e[t].test(C)) return t;
1110
1110
  return "Unknown";
1111
- })()), St;
1111
+ })()), Ct;
1112
1112
  }
1113
- e.os = he;
1114
- function ge() {
1115
- return Ct;
1113
+ e.os = ge;
1114
+ function _e() {
1115
+ return wt;
1116
1116
  }
1117
- e.osVersion = ge;
1118
- function v() {
1119
- return xt === null && (xt = /Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(Et)), xt;
1117
+ e.osVersion = _e;
1118
+ function _() {
1119
+ return St === null && (St = /Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(Dt)), St;
1120
1120
  }
1121
- e.isMobile = v;
1122
- function _e() {
1121
+ e.isMobile = _;
1122
+ function ve() {
1123
1123
  return Ht()[0];
1124
1124
  }
1125
- e.browserName = _e;
1126
- function ve() {
1125
+ e.browserName = ve;
1126
+ function ye() {
1127
1127
  return Ht()[1];
1128
1128
  }
1129
- e.browserVersion = ve;
1130
- function ye() {
1129
+ e.browserVersion = ye;
1130
+ function be() {
1131
1131
  return Ht()[3];
1132
1132
  }
1133
- e.baseChromeVersion = ye;
1134
- function be() {
1135
- return Tt || (Tt = new (window.AudioContext || window.webkitAudioContext)()), Tt.resume().catch(() => {
1133
+ e.baseChromeVersion = be;
1134
+ function xe() {
1135
+ return Et || (Et = new (window.AudioContext || window.webkitAudioContext)()), Et.resume().catch(() => {
1136
1136
  R.warn("Failed to resume AudioContext");
1137
- }), Tt;
1137
+ }), Et;
1138
1138
  }
1139
- e.getAudioContext = be;
1140
- function xe() {
1139
+ e.getAudioContext = xe;
1140
+ function Se() {
1141
1141
  return Ht()[4];
1142
1142
  }
1143
- e.browserSubVersion = xe;
1144
- function Se() {
1143
+ e.browserSubVersion = Se;
1144
+ function Ce() {
1145
1145
  return w.baseChromeVersion() >= 105 && !w.isMobile();
1146
1146
  }
1147
- e.isAudioShareSupported = Se;
1148
- function Ce(e, t) {
1147
+ e.isAudioShareSupported = Ce;
1148
+ function we(e, t) {
1149
1149
  kt[e] || (kt[e] = []), kt[e].push(t);
1150
1150
  }
1151
- e.addEventListener = Ce;
1152
- function we(e, t) {
1151
+ e.addEventListener = we;
1152
+ function Te(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 = we;
1159
+ e.removeEventListener = Te;
1160
1160
  })(w || (w = {}));
1161
1161
  var T = w;
1162
1162
  //#endregion
@@ -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 b {
1189
+ }({}), Gt = class extends y {
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 b {
1235
+ }({}), Jt = class extends y {
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 = [S.AUDIO], t = !0) {
1247
+ async request(e = [x.AUDIO], t = !0) {
1248
1248
  if (this._stream) return;
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);
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);
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(x.UNKNOWN);
1291
+ default: return Promise.reject(b.UNKNOWN);
1292
1292
  }
1293
1293
  }
1294
1294
  stopVideoTrack() {
1295
- this._mediaSettings.isVideoEnabled && (this._stopEffect(), this._stream && Xe(this._stream), this.cameraVideoTrack?.stop());
1295
+ this._mediaSettings.isVideoEnabled && (this._stopEffect(), this._stream && Ze(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) Ye(n);
1315
+ if (this.cameraVideoTrack?.stop(), this.cameraVideoTrack = n.getVideoTracks()[0], !this._stream) Xe(n);
1316
1316
  else {
1317
1317
  let e = await this._setEffect(this._effect, this.cameraVideoTrack);
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" });
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" });
1319
1319
  }
1320
1320
  } catch (e) {
1321
- throw this._logger?.log(C.ERROR, "change_video"), this._debug.warn("Camera change failed", e), e;
1321
+ throw this._logger?.log(S.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) Ye(t);
1330
+ if (this._micAudioTrack?.stop(), this._micAudioTrack = t.getAudioTracks()[0], !this._stream) Xe(t);
1331
1331
  else {
1332
1332
  let e = await this._applyAudioEffect();
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" });
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" });
1334
1334
  }
1335
1335
  } catch (e) {
1336
- throw this._logger?.log(C.ERROR, "change_audio"), this._debug.error("Microphone change failed", e), e;
1336
+ throw this._logger?.log(S.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) Ye(n);
1341
+ if (n = n || await T.getScreenMedia(e, t, this._debug, this._logger), !this._stream) Xe(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(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) {
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) {
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(C.ERROR, "screen"), this._debug.warn("Screen capturing failed", e), e;
1353
+ throw this._logger?.log(S.ERROR, "screen"), this._debug.warn("Screen capturing failed", e), e;
1354
1354
  }
1355
1355
  }
1356
1356
  async _disableScreenCapture() {
@@ -1398,7 +1398,7 @@ 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 && (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();
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();
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);
@@ -1406,7 +1406,7 @@ var D = /* @__PURE__ */ function(e) {
1406
1406
  async resumeLocalMedia(e) {
1407
1407
  if (!this._lastMediaSettings) return;
1408
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);
1409
+ if ((e ? e.isAudioEnabled : this._lastMediaSettings.isAudioEnabled) && (t.push(x.AUDIO), await this.toggleAudio(!0)), await this.request(t), this._lastMediaSettings = null, this._stream) for (let e of this._stream.getTracks()) this._triggerEvent("TRACK_REPLACED", e);
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(C.DEVICE_CHANGED, `effect_${e?.effect || "none"}`), !this._mediaSettings.isVideoEnabled) {
1477
+ if (this._logger?.log(S.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 Ze(e, {
1526
+ await Qe(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 } },
@@ -1578,7 +1578,7 @@ var D = /* @__PURE__ */ function(e) {
1578
1578
  l: 4
1579
1579
  };
1580
1580
  function $t(e, t) {
1581
- return !e || !t ? e === t : e.streams.length === t.streams.length ? e.streams.every((e, n) => j.isObjectsEquals(e, t.streams[n])) : !1;
1581
+ return !e || !t ? e === t : e.streams.length === t.streams.length && e.streams.every((e, n) => j.isObjectsEquals(e, t.streams[n]));
1582
1582
  }
1583
1583
  function en(e, t) {
1584
1584
  for (let n of t) if (e <= n.dimension) return n.bitrate;
@@ -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 _(e) {
1803
- if (e.decorativeUserId) return ae(e.decorativeUserId, e.idType || A.USER, e.deviceIdx);
1804
- }
1805
- e.composeDecorativeId = _;
1806
1802
  function se(e) {
1807
- return e.participant ? g(e.participant) : ae(e.participantId, e.participantType || A.USER, e.deviceIdx);
1803
+ if (e.decorativeUserId) return ae(e.decorativeUserId, e.idType || A.USER, e.deviceIdx);
1808
1804
  }
1809
- e.composeMessageId = se;
1805
+ e.composeDecorativeId = se;
1810
1806
  function ce(e) {
1811
- return typeof e == "string" ? le(ue(e).compositeUserId).id : e;
1807
+ return e.participant ? g(e.participant) : ae(e.participantId, e.participantType || A.USER, e.deviceIdx);
1812
1808
  }
1813
- e.extractOkId = ce;
1809
+ e.composeMessageId = ce;
1814
1810
  function le(e) {
1811
+ return typeof e == "string" ? ue(de(e).compositeUserId).id : e;
1812
+ }
1813
+ e.extractOkId = le;
1814
+ function ue(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 = le;
1825
- function ue(e) {
1824
+ e.decomposeId = ue;
1825
+ function de(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 = ue;
1833
- function de() {
1832
+ e.decomposeParticipantId = de;
1833
+ function fe() {
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 = de;
1841
- function fe(e, t) {
1840
+ e.uuid = fe;
1841
+ function pe(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 = fe;
1852
- function pe(e) {
1851
+ e.debounce = pe;
1852
+ function me(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 = pe;
1871
- async function me(e, { signal: t } = {}) {
1870
+ e.sdpFingerprint = me;
1871
+ async function he(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 = me;
1883
- function he(e, t, n, r = R) {
1882
+ e.delay = he;
1883
+ function ge(e, t, n, r = R) {
1884
1884
  let i = [];
1885
- return e.getSenders().forEach((e) => ge(t, e, e.track, n, i, r)), i;
1885
+ return e.getSenders().forEach((e) => _e(t, e, e.track, n, i, r)), i;
1886
1886
  }
1887
- e.applySettings = he;
1888
- function ge(e, t, n, r, i, a = R) {
1887
+ e.applySettings = ge;
1888
+ function _e(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 = ge;
1928
- function v(e, t) {
1927
+ e.applyVideoTrackSettings = _e;
1928
+ function _(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 = v;
1934
- function _e(e) {
1933
+ e.includesOneOf = _;
1934
+ function ve(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 = _e;
1941
- function ve(e) {
1940
+ e.mapParticipantState = ve;
1941
+ function ye(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 = ve;
1956
- function ye(e, t) {
1955
+ e.mapSharedParticipants = ye;
1956
+ function be(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 = ye;
1963
- function be(e, t, n = !1) {
1962
+ e.isEqualParticipantState = be;
1963
+ function xe(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 && Ee(r) && Ee(a)) return be(r, a, n);
1969
+ if (n && De(r) && De(a)) return xe(r, a, n);
1970
1970
  if (r !== a) return !1;
1971
1971
  }
1972
1972
  return !0;
1973
1973
  }
1974
- e.isObjectsEquals = be;
1975
- function xe(e, t) {
1974
+ e.isObjectsEquals = xe;
1975
+ function Se(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 = xe;
1981
- function Se(e) {
1980
+ e.isArraysEquals = Se;
1981
+ function Ce(e) {
1982
1982
  return !Object.keys(e).length;
1983
1983
  }
1984
- e.isEmptyObject = Se;
1985
- function Ce(e, t) {
1984
+ e.isEmptyObject = Ce;
1985
+ function we(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 } = ue(e.id), { compositeUserId: o, deviceIdx: s } = ue(t.id), { id: c, type: l } = le(i), { id: u, type: d } = le(o);
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);
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 = Ce;
2001
- function we(e, t) {
2000
+ e.participantMarkerCompare = we;
2001
+ function Te(e, t) {
2002
2002
  return rn(Object.entries(e).filter(([, e]) => Array.isArray(t) ? !t.includes(e) : e !== t));
2003
2003
  }
2004
- e.objectFilterOutValues = we;
2005
- function Te(e, t, n) {
2004
+ e.objectFilterOutValues = Te;
2005
+ function Ee(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 = Te, e.setImmediate = (() => {
2010
+ e.objectReduce = Ee, 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 Ee(e) {
2026
+ function De(e) {
2027
2027
  return typeof e == "object" && !!e && !Array.isArray(e);
2028
2028
  }
2029
- e.isObject = Ee;
2030
- function De(e, n, r, i) {
2029
+ e.isObject = De;
2030
+ function Oe(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=")) {
@@ -2048,12 +2048,15 @@ var on = 533, sn = "a=fmtp:", cn = "sps-pps-idr-in-keyframe=1", ln;
2048
2048
  let c = e.split(t), { start: l, end: u } = a(c, n.mid), d = s.getParameters();
2049
2049
  if (d.encodings) return d.encodings.forEach((e) => {
2050
2050
  let t = e.rid, n = e.maxBitrate, a = e.scaleResolutionDownBy;
2051
- r && i && a && o(c, l, u, t, n, "" + Math.round(r / a), "" + Math.round(i / a));
2051
+ if (r && i && a) {
2052
+ let e = "" + Math.round(r / a), s = "" + Math.round(i / a);
2053
+ o(c, l, u, t, n, e, s);
2054
+ }
2052
2055
  }), c.join("\r\n");
2053
2056
  }
2054
2057
  return e;
2055
2058
  }
2056
- e.patchSimulcastAnswerSdp = De;
2059
+ e.patchSimulcastAnswerSdp = Oe;
2057
2060
  })(ln || (ln = {}));
2058
2061
  var j = ln, un = "__CALLS_SDK_DEVTOOLS_", dn = class {
2059
2062
  set(e, t) {
@@ -2142,7 +2145,7 @@ var j = ln, un = "__CALLS_SDK_DEVTOOLS_", dn = class {
2142
2145
  h(pn, "instance", null);
2143
2146
  var mn = pn.getInstance(), M = class e {
2144
2147
  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") && (y.accessToken = t.apiAuth.accessToken, y.sessionKey = t.apiAuth.sessionKey, y.sessionSecretKey = t.apiAuth.sessionSecretKey);
2148
+ 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);
2146
2149
  let n = mn.params.applyOverrides(t);
2147
2150
  Object.assign(e._params, j.objectFilterOutValues(n, void 0));
2148
2151
  }
@@ -2159,7 +2162,7 @@ var mn = pn.getInstance(), M = class e {
2159
2162
  return 1.1;
2160
2163
  }
2161
2164
  static get sdkVersion() {
2162
- return "2.8.11-dev.50a3a6bf.0";
2165
+ return "2.8.11-dev.54a3a1c9.0";
2163
2166
  }
2164
2167
  static get debug() {
2165
2168
  return e._params.debug;
@@ -2217,7 +2220,7 @@ var mn = pn.getInstance(), M = class e {
2217
2220
  case "CALLSTEST": return "https://calls-test.okcdn.ru/api";
2218
2221
  case "CALLS_BETA": return "https://api-beta.calls-test.oneme.ru/api";
2219
2222
  case "CALLS_BENDER": return "https://api-bender.calls-test.oneme.ru/api";
2220
- case "CALLS_MAMES": return "https://api-mames.calls-test.oneme.ru/api";
2223
+ case "CALLS_MAMES": return "https://calls-mames.okcdn.ru/api";
2221
2224
  case "CALLS_MARS": return "https://api-mars.calls-test.oneme.ru/api";
2222
2225
  default: return e._params.apiEnv;
2223
2226
  }
@@ -2339,6 +2342,18 @@ var mn = pn.getInstance(), M = class e {
2339
2342
  static set audioEffects(t) {
2340
2343
  e._params.audioEffects = t, e._params.audioEffects?.setLogger((e, ...t) => R.send(e, ...t));
2341
2344
  }
2345
+ static get vad() {
2346
+ return e._params.vad;
2347
+ }
2348
+ static set vad(t) {
2349
+ e._params.vad = t;
2350
+ }
2351
+ static get vadOptions() {
2352
+ return e._params.vadOptions;
2353
+ }
2354
+ static set vadOptions(t) {
2355
+ e._params.vadOptions = t;
2356
+ }
2342
2357
  static get videoEffects() {
2343
2358
  return e._params.videoEffects;
2344
2359
  }
@@ -2609,6 +2624,8 @@ h(M, "_params", {
2609
2624
  videoFacingMode: null,
2610
2625
  displaySurface: "monitor",
2611
2626
  audioEffects: null,
2627
+ vad: null,
2628
+ vadOptions: {},
2612
2629
  videoEffects: null,
2613
2630
  videoEffectMaxWidth: 640,
2614
2631
  videoEffectMaxHeight: 360,
@@ -2796,251 +2813,251 @@ var gn;
2796
2813
  F("onRemoteSharedUrl", e, t, n, r);
2797
2814
  }
2798
2815
  e.onRemoteSharedUrl = g;
2799
- function _(e, t, n) {
2816
+ function se(e, t, n) {
2800
2817
  F("onParticipantAdded", e, t, n);
2801
2818
  }
2802
- e.onParticipantAdded = _;
2803
- function se(e, t, n) {
2819
+ e.onParticipantAdded = se;
2820
+ function ce(e, t, n) {
2804
2821
  F("onParticipantJoined", e, t, n);
2805
2822
  }
2806
- e.onParticipantJoined = se;
2807
- function ce(e, t = !1, n) {
2823
+ e.onParticipantJoined = ce;
2824
+ function le(e, t = !1, n) {
2808
2825
  P("onLocalParticipantState", I(e), t, n);
2809
2826
  }
2810
- e.onLocalParticipantState = ce;
2811
- function le(e, t, n, r) {
2827
+ e.onLocalParticipantState = le;
2828
+ function ue(e, t, n, r) {
2812
2829
  F("onRemoteParticipantState", e, I(t), n, r);
2813
2830
  }
2814
- e.onRemoteParticipantState = le;
2815
- function ue(e, t, n) {
2831
+ e.onRemoteParticipantState = ue;
2832
+ function de(e, t, n) {
2816
2833
  P("onRemoteParticipantsState", e, t, n);
2817
2834
  }
2818
- e.onRemoteParticipantsState = ue;
2819
- function de(e, t, n = null, r) {
2835
+ e.onRemoteParticipantsState = de;
2836
+ function fe(e, t, n = null, r) {
2820
2837
  R.debug("Remote status:", t, e), F("onRemoteStatus", e, t, n, r);
2821
2838
  }
2822
- e.onRemoteStatus = de;
2823
- function fe() {
2839
+ e.onRemoteStatus = fe;
2840
+ function pe() {
2824
2841
  P("onPermissionsRequested");
2825
2842
  }
2826
- e.onPermissionsRequested = fe;
2827
- function pe(e, t) {
2843
+ e.onPermissionsRequested = pe;
2844
+ function me(e, t) {
2828
2845
  P("onPermissionsError", e, t);
2829
2846
  }
2830
- e.onPermissionsError = pe;
2831
- function me(e, t, n) {
2847
+ e.onPermissionsError = me;
2848
+ function he(e, t, n) {
2832
2849
  F("onRemoteRemoved", e, t, n);
2833
2850
  }
2834
- e.onRemoteRemoved = me;
2835
- function he(e, t, n, r) {
2851
+ e.onRemoteRemoved = he;
2852
+ function ge(e, t, n, r) {
2836
2853
  P("onCallState", e, t, I(n), r);
2837
2854
  }
2838
- e.onCallState = he;
2839
- function ge(e, t, n) {
2855
+ e.onCallState = ge;
2856
+ function _e(e, t, n) {
2840
2857
  P("onDeviceSwitched", e, t, n);
2841
2858
  }
2842
- e.onDeviceSwitched = ge;
2843
- function v(e, t, n, r = !1, i = !1, a = null, o = null, s, c, l = null, u) {
2859
+ e.onDeviceSwitched = _e;
2860
+ function _(e, t, n, r = !1, i = !1, a = null, o = null, s, c, l = null, u) {
2844
2861
  let d = c ? hn(c) : void 0;
2845
2862
  P("onMuteStates", I(e), hn(t), hn(n), r, i, a, o, s, d, l, u);
2846
2863
  }
2847
- e.onMuteStates = v;
2848
- function _e(e, t, n = !1, r) {
2864
+ e.onMuteStates = _;
2865
+ function ve(e, t, n = !1, r) {
2849
2866
  F("onRolesChanged", e, hn(t), n, r);
2850
2867
  }
2851
- e.onRolesChanged = _e;
2852
- function ve(e, t = !1, n) {
2868
+ e.onRolesChanged = ve;
2869
+ function ye(e, t = !1, n) {
2853
2870
  P("onLocalRolesChanged", hn(e), t, n);
2854
2871
  }
2855
- e.onLocalRolesChanged = ve;
2856
- function ye(e, t, n, r, i) {
2872
+ e.onLocalRolesChanged = ye;
2873
+ function be(e, t, n, r, i) {
2857
2874
  F("onPinnedParticipant", e, t, n, r, i);
2858
2875
  }
2859
- e.onPinnedParticipant = ye;
2860
- function be(e, t, n) {
2876
+ e.onPinnedParticipant = be;
2877
+ function xe(e, t, n) {
2861
2878
  P("onLocalPin", e, t, n);
2862
2879
  }
2863
- e.onLocalPin = be;
2864
- function xe(e, t) {
2880
+ e.onLocalPin = xe;
2881
+ function Se(e, t) {
2865
2882
  P("onOptionsChanged", hn(e), t);
2866
2883
  }
2867
- e.onOptionsChanged = xe;
2868
- function Se(e) {
2884
+ e.onOptionsChanged = Se;
2885
+ function Ce(e) {
2869
2886
  P("onCallAccepted", e);
2870
2887
  }
2871
- e.onCallAccepted = Se;
2872
- function Ce(e) {
2888
+ e.onCallAccepted = Ce;
2889
+ function we(e) {
2873
2890
  P("onCallActive", e);
2874
2891
  }
2875
- e.onCallActive = Ce;
2876
- function we(e, t, n) {
2892
+ e.onCallActive = we;
2893
+ function Te(e, t, n) {
2877
2894
  F("onAcceptedCall", e, t, n);
2878
2895
  }
2879
- e.onAcceptedCall = we;
2880
- function Te(e) {
2896
+ e.onAcceptedCall = Te;
2897
+ function Ee(e) {
2881
2898
  P("onRateNeeded", e);
2882
2899
  }
2883
- e.onRateNeeded = Te;
2884
- function Ee(e, t) {
2900
+ e.onRateNeeded = Ee;
2901
+ function De(e, t) {
2885
2902
  F("onSpeakerChanged", e, t);
2886
2903
  }
2887
- e.onSpeakerChanged = Ee;
2888
- function De(e, t) {
2904
+ e.onSpeakerChanged = De;
2905
+ function Oe(e, t) {
2889
2906
  P("onVolumesDetected", hn(e), t);
2890
2907
  }
2891
- e.onVolumesDetected = De;
2892
- function Oe(e, t) {
2908
+ e.onVolumesDetected = Oe;
2909
+ function ke(e, t) {
2893
2910
  P("onLocalVolume", e, t);
2894
2911
  }
2895
- e.onLocalVolume = Oe;
2896
- function ke(e, t, n) {
2912
+ e.onLocalVolume = ke;
2913
+ function Ae(e, t, n) {
2897
2914
  P("onJoinStatus", e, t, n);
2898
2915
  }
2899
- e.onJoinStatus = ke;
2900
- function Ae(e, t) {
2916
+ e.onJoinStatus = Ae;
2917
+ function je(e, t) {
2901
2918
  P("onHangup", e, t);
2902
2919
  }
2903
- e.onHangup = Ae;
2904
- function je(e) {
2920
+ e.onHangup = je;
2921
+ function Me(e) {
2905
2922
  P("onMultipartyChatCreated", I(e));
2906
2923
  }
2907
- e.onMultipartyChatCreated = je;
2908
- function Me() {
2924
+ e.onMultipartyChatCreated = Me;
2925
+ function Ne() {
2909
2926
  P("onDeviceChange");
2910
2927
  }
2911
- e.onDeviceChange = Me;
2912
- function Ne(e) {
2928
+ e.onDeviceChange = Ne;
2929
+ function Pe(e) {
2913
2930
  P("onFingerprintChange", e);
2914
2931
  }
2915
- e.onFingerprintChange = Ne;
2916
- function Pe() {
2932
+ e.onFingerprintChange = Pe;
2933
+ function Fe() {
2917
2934
  P("onTokenExpired");
2918
2935
  }
2919
- e.onTokenExpired = Pe;
2920
- function Fe(e, t, n = !1, r) {
2936
+ e.onTokenExpired = Fe;
2937
+ function Ie(e, t, n = !1, r) {
2921
2938
  P("onChatMessage", e, t, n, r);
2922
2939
  }
2923
- e.onChatMessage = Fe;
2924
- function Ie(e, t, n = !1, r) {
2940
+ e.onChatMessage = Ie;
2941
+ function Le(e, t, n = !1, r) {
2925
2942
  P("onCustomData", e, t, n, r);
2926
2943
  }
2927
- e.onCustomData = Ie;
2928
- function Le(e, t, n, r, i, a, o = null, s) {
2944
+ e.onCustomData = Le;
2945
+ function Re(e, t, n, r, i, a, o = null, s) {
2929
2946
  P("onRecordStarted", e, t, n, r, i, a, o, s);
2930
2947
  }
2931
- e.onRecordStarted = Le;
2932
- function Re(e = null, t, n) {
2948
+ e.onRecordStarted = Re;
2949
+ function ze(e = null, t, n) {
2933
2950
  P("onRecordStopped", e, t, n);
2934
2951
  }
2935
- e.onRecordStopped = Re;
2936
- function ze(e, t) {
2952
+ e.onRecordStopped = ze;
2953
+ function Be(e, t) {
2937
2954
  P("onLocalNetworkStatusChanged", e, t);
2938
2955
  }
2939
- e.onLocalNetworkStatusChanged = ze;
2940
- function Be(e, t) {
2956
+ e.onLocalNetworkStatusChanged = Be;
2957
+ function Ve(e, t) {
2941
2958
  P("onNetworkStatusChanged", e, t);
2942
2959
  }
2943
- e.onNetworkStatusChanged = Be;
2944
- function Ve(e, ...t) {
2960
+ e.onNetworkStatusChanged = Ve;
2961
+ function He(e, ...t) {
2945
2962
  P("onDebugMessage", e, ...t);
2946
2963
  }
2947
- e.onDebugMessage = Ve;
2948
- function He(e, t, ...n) {
2964
+ e.onDebugMessage = He;
2965
+ function Ue(e, t, ...n) {
2949
2966
  P("onDebugMessageWithContext", e, t, ...n);
2950
2967
  }
2951
- e.onDebugMessageWithContext = He;
2952
- function Ue(e, t) {
2968
+ e.onDebugMessageWithContext = Ue;
2969
+ function We(e, t) {
2953
2970
  P("onStatistics", Object.assign({}, e, { memory: t }));
2954
2971
  }
2955
- e.onStatistics = Ue;
2956
- function We() {
2972
+ e.onStatistics = We;
2973
+ function Ge() {
2957
2974
  P("onAutoplayError");
2958
2975
  }
2959
- e.onAutoplayError = We;
2960
- function Ge(e, t, n, r, i, a) {
2976
+ e.onAutoplayError = Ge;
2977
+ function Ke(e, t, n, r, i, a) {
2961
2978
  P("onChatRoomUpdated", e, t, n, r, i, a);
2962
2979
  }
2963
- e.onChatRoomUpdated = Ge;
2964
- function Ke(e, t) {
2980
+ e.onChatRoomUpdated = Ke;
2981
+ function qe(e, t) {
2965
2982
  P("onPromoted", e, t);
2966
2983
  }
2967
- e.onPromoted = Ke;
2968
- function qe(e, t) {
2984
+ e.onPromoted = qe;
2985
+ function Je(e, t) {
2969
2986
  P("onRemoteMixedAudioStream", e, t);
2970
2987
  }
2971
- e.onRemoteMixedAudioStream = qe;
2972
- function y(e, t) {
2988
+ e.onRemoteMixedAudioStream = Je;
2989
+ function v(e, t) {
2973
2990
  P("onJoinLinkChanged", e, t);
2974
2991
  }
2975
- e.onJoinLinkChanged = y;
2976
- function b(e, t) {
2992
+ e.onJoinLinkChanged = v;
2993
+ function y(e, t) {
2977
2994
  P("onRoomsUpdated", e, t);
2978
2995
  }
2979
- e.onRoomsUpdated = b;
2980
- function x(e, t, n, r, i) {
2996
+ e.onRoomsUpdated = y;
2997
+ function b(e, t, n, r, i) {
2981
2998
  P("onRoomUpdated", e, t, n, r, i);
2982
2999
  }
2983
- e.onRoomUpdated = x;
2984
- function S(e, t) {
3000
+ e.onRoomUpdated = b;
3001
+ function x(e, t) {
2985
3002
  P("onRoomParticipantsUpdated", e, t);
2986
3003
  }
2987
- e.onRoomParticipantsUpdated = S;
2988
- function C(e, t) {
3004
+ e.onRoomParticipantsUpdated = x;
3005
+ function S(e, t) {
2989
3006
  P("onRoomSwitched", e, t);
2990
3007
  }
2991
- e.onRoomSwitched = C;
2992
- function Je(e, t) {
3008
+ e.onRoomSwitched = S;
3009
+ function Ye(e, t) {
2993
3010
  P("onRoomStart", e, t);
2994
3011
  }
2995
- e.onRoomStart = Je;
2996
- function Ye(e, t = null, n) {
3012
+ e.onRoomStart = Ye;
3013
+ function Xe(e, t = null, n) {
2997
3014
  P("onFeedback", e, t, n);
2998
3015
  }
2999
- e.onFeedback = Ye;
3000
- function Xe(e, t) {
3016
+ e.onFeedback = Xe;
3017
+ function Ze(e, t) {
3001
3018
  P("onFeaturesPerRoleChanged", e, t);
3002
3019
  }
3003
- e.onFeaturesPerRoleChanged = Xe;
3004
- function Ze(e, t) {
3020
+ e.onFeaturesPerRoleChanged = Ze;
3021
+ function Qe(e, t) {
3005
3022
  P("onParticipantVmojiUpdate", e, t);
3006
3023
  }
3007
- e.onParticipantVmojiUpdate = Ze;
3008
- function Qe(e, t, n) {
3024
+ e.onParticipantVmojiUpdate = Qe;
3025
+ function $e(e, t, n) {
3009
3026
  P("onAsrSet", e, t, n);
3010
3027
  }
3011
- e.onAsrSet = Qe;
3012
- function $e(e, t, n, r) {
3028
+ e.onAsrSet = $e;
3029
+ function et(e, t, n, r) {
3013
3030
  P("onAsrStarted", e, t, n, r);
3014
3031
  }
3015
- e.onAsrStarted = $e;
3016
- function et(e, t) {
3032
+ e.onAsrStarted = et;
3033
+ function tt(e, t) {
3017
3034
  P("onAsrStopped", e, t);
3018
3035
  }
3019
- e.onAsrStopped = et;
3020
- function tt(e, t, n, r, i) {
3036
+ e.onAsrStopped = tt;
3037
+ function nt(e, t, n, r, i) {
3021
3038
  P("onAsrTranscription", e, t, n, r, i);
3022
3039
  }
3023
- e.onAsrTranscription = tt;
3024
- function nt(e, t, n) {
3040
+ e.onAsrTranscription = nt;
3041
+ function rt(e, t, n) {
3025
3042
  P("onParticipantIdChanged", e, t, n);
3026
3043
  }
3027
- e.onParticipantIdChanged = nt;
3028
- function rt(e, t) {
3044
+ e.onParticipantIdChanged = rt;
3045
+ function it(e, t) {
3029
3046
  P("onVideoSuspendSuggest", e, t);
3030
3047
  }
3031
- e.onVideoSuspendSuggest = rt;
3032
- function it(e) {
3048
+ e.onVideoSuspendSuggest = it;
3049
+ function at(e) {
3033
3050
  P("onSignalingMessage", typeof e == "string" ? e : I(e));
3034
3051
  }
3035
- e.onSignalingMessage = it;
3036
- function at(e, t) {
3052
+ e.onSignalingMessage = at;
3053
+ function ot(e, t) {
3037
3054
  P("onPromotionApproved", e, t);
3038
3055
  }
3039
- e.onPromotionApproved = at;
3040
- function ot(e) {
3056
+ e.onPromotionApproved = ot;
3057
+ function st(e) {
3041
3058
  P("onPeerRegistered", e);
3042
3059
  }
3043
- e.onPeerRegistered = ot;
3060
+ e.onPeerRegistered = st;
3044
3061
  })(gn || (gn = {}));
3045
3062
  var L = gn, _n = /* @__PURE__ */ function(e) {
3046
3063
  return e.DEBUG = "DEBUG", e.LOG = "LOG", e.WARN = "WARN", e.ERROR = "ERROR", e;
@@ -3062,7 +3079,7 @@ var L = gn, _n = /* @__PURE__ */ function(e) {
3062
3079
  }
3063
3080
  function u(e, t, n) {
3064
3081
  let u = l(n);
3065
- if (M.debugLog && ke(e, t, u.sessionId || void 0), c) switch (e) {
3082
+ if (M.debugLog && Ae(e, t, u.sessionId || void 0), c) switch (e) {
3066
3083
  case "DEBUG":
3067
3084
  i(...t);
3068
3085
  break;
@@ -3099,7 +3116,7 @@ var L = gn, _n = /* @__PURE__ */ function(e) {
3099
3116
  }
3100
3117
  e.enabled = ee;
3101
3118
  function h(e) {
3102
- c = e, M.debugLog && Ae();
3119
+ c = e, M.debugLog && je();
3103
3120
  }
3104
3121
  e.toggle = h;
3105
3122
  function te(e, ...t) {
@@ -3131,7 +3148,7 @@ var L = gn, _n = /* @__PURE__ */ function(e) {
3131
3148
  function re(e = null) {
3132
3149
  let t = null, n = e;
3133
3150
  function r() {
3134
- !M.debugLog || t || (t = je(), n && Me(n, t));
3151
+ !M.debugLog || t || (t = Me(), n && Ne(n, t));
3135
3152
  }
3136
3153
  let i = () => (r(), {
3137
3154
  sessionId: t,
@@ -3145,7 +3162,7 @@ var L = gn, _n = /* @__PURE__ */ function(e) {
3145
3162
  return n;
3146
3163
  },
3147
3164
  setConversationId(e) {
3148
- n = e, t && Me(n, t);
3165
+ n = e, t && Ne(n, t);
3149
3166
  },
3150
3167
  debug: (...e) => u("DEBUG", e, i),
3151
3168
  log: (...e) => u("LOG", e, i),
@@ -3237,7 +3254,7 @@ var R = vn, z = new class {
3237
3254
  clear() {
3238
3255
  this._conversations.clear(), this._activeId = null;
3239
3256
  }
3240
- }(), yn = class extends b {
3257
+ }(), yn = class extends y {
3241
3258
  constructor(...e) {
3242
3259
  super(...e), h(this, "_abortSignal", void 0);
3243
3260
  }
@@ -3777,7 +3794,7 @@ function Cr() {
3777
3794
  }
3778
3795
  //#endregion
3779
3796
  //#region src/classes/transport/BaseTransport.ts
3780
- var wr = class extends b {
3797
+ var wr = class extends y {
3781
3798
  constructor(e, t) {
3782
3799
  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;
3783
3800
  }
@@ -3802,7 +3819,7 @@ var wr = class extends b {
3802
3819
  getValue() {
3803
3820
  return this.value;
3804
3821
  }
3805
- }, Er = .25, Dr = .35, Or = 85, kr = .1, Ar = 1.5, jr = .1, Mr = 1, Nr = .6, Pr = .3, Fr = class extends b {
3822
+ }, Er = .25, Dr = .35, Or = 85, kr = .1, Ar = 1.5, jr = .1, Mr = 1, Nr = .6, Pr = .3, Fr = class extends y {
3806
3823
  constructor(e, t = R) {
3807
3824
  super(), h(this, "_signaling", void 0), h(this, "_localNetworkStat", void 0), h(this, "_remoteNetworkStat", void 0), h(this, "_lastNetworkStat", void 0), h(this, "_networkLimits", {
3808
3825
  badNet: {
@@ -3908,7 +3925,7 @@ var wr = class extends b {
3908
3925
  try {
3909
3926
  this._mediaSource.addTrackToPeerConnection(this._pc, !1, !0), this._applySettings();
3910
3927
  } catch (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;
3928
+ this._logger?.log(S.ERROR, "addTrack-direct"), this._debug.error("Unable to add media source tracks", e, { participantId: this._participantId }), this._failedOnCreate = e;
3912
3929
  return;
3913
3930
  }
3914
3931
  this._createOffer(!1).catch((e) => {
@@ -3942,7 +3959,7 @@ var wr = class extends b {
3942
3959
  if (this._debug.debug("DirectTransport: Open transport", { participantId: this._participantId }), this._isOpen = !0, this._remotePeerId = e, !this._isMaster) try {
3943
3960
  this._mediaSource.addTrackToPeerConnection(this._pc, !1, !0), this._applySettings();
3944
3961
  } catch (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);
3962
+ this._logger?.log(S.ERROR, "addTrack-direct"), this._debug.error("DirectTransport: Unable to add media source tracks", e, { participantId: this._participantId }), this.close(e);
3946
3963
  return;
3947
3964
  }
3948
3965
  this._setState(K.OPENED);
@@ -4033,7 +4050,7 @@ var wr = class extends b {
4033
4050
  try {
4034
4051
  await this._pc.addIceCandidate(new RTCIceCandidate(t));
4035
4052
  } catch (e) {
4036
- throw this._logger?.log(C.ERROR, "addIceCandidate-direct"), this._debug.error("Unable to add remote ice candidate", e, {
4053
+ throw this._logger?.log(S.ERROR, "addIceCandidate-direct"), this._debug.error("Unable to add remote ice candidate", e, {
4037
4054
  participantId: this._participantId,
4038
4055
  candidate: t
4039
4056
  }), e;
@@ -4064,7 +4081,7 @@ var wr = class extends b {
4064
4081
  try {
4065
4082
  await this._pc.setRemoteDescription(n), await this._setRemoteCandidates(t), this._processAnimojiProtocolVersion(this._remoteAnimojiVersion);
4066
4083
  } catch (e) {
4067
- throw this._logger?.log(C.ERROR, "setRemoteDescription-direct"), this._debug.error("Unable to set remote description", e, {
4084
+ throw this._logger?.log(S.ERROR, "setRemoteDescription-direct"), this._debug.error("Unable to set remote description", e, {
4068
4085
  participantId: this._participantId,
4069
4086
  sdp: n
4070
4087
  }), e;
@@ -4116,11 +4133,11 @@ var wr = class extends b {
4116
4133
  }
4117
4134
  _markConnected() {
4118
4135
  this._neverConnected = !1, this._setState(K.CONNECTED), this._stopReconnection(), this._pc && j.getPeerConnectionHostInfo(this._pc).then((e) => {
4119
- e?.local && (this._logger?.log(C.ICE_CONNECTION_TYPE, e.local.type), this._debug.debug("Selected ICE candidates", e));
4136
+ e?.local && (this._logger?.log(S.ICE_CONNECTION_TYPE, e.local.type), this._debug.debug("Selected ICE candidates", e));
4120
4137
  }), this._startStatInterval();
4121
4138
  }
4122
4139
  _onConnectionStateChange() {
4123
- 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) {
4140
+ 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) {
4124
4141
  case "connected":
4125
4142
  this._markConnected();
4126
4143
  break;
@@ -4145,8 +4162,8 @@ var wr = class extends b {
4145
4162
  this._reconnectionTimeout && (clearTimeout(this._reconnectionTimeout), this._reconnectionTimeout = null), this._iceRestartTimeout && (clearTimeout(this._iceRestartTimeout), this._iceRestartTimeout = null);
4146
4163
  }
4147
4164
  _startIceRestart() {
4148
- 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(() => {
4149
- this._iceRestartTimeout = null, this._debug.error("Ice restart failed", { participantId: this._participantId }), this._logger?.log(C.ERROR, "iceRestart-direct"), this._requestTopologySwitch();
4165
+ 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(() => {
4166
+ this._iceRestartTimeout = null, this._debug.error("Ice restart failed", { participantId: this._participantId }), this._logger?.log(S.ERROR, "iceRestart-direct"), this._requestTopologySwitch();
4150
4167
  }, M.iceRestartWaitTime);
4151
4168
  }
4152
4169
  async _createOffer(t) {
@@ -4166,7 +4183,7 @@ var wr = class extends b {
4166
4183
  offer: r
4167
4184
  }), r = e._patchLocalDescription(r);
4168
4185
  } catch (e) {
4169
- throw this._debug.error("Unable to create offer", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "createOffer-direct"), e;
4186
+ throw this._debug.error("Unable to create offer", e, { participantId: this._participantId }), this._logger?.log(S.ERROR, "createOffer-direct"), e;
4170
4187
  }
4171
4188
  try {
4172
4189
  return this._debug.debug("Set local description", {
@@ -4174,7 +4191,7 @@ var wr = class extends b {
4174
4191
  offer: r
4175
4192
  }), this._calcFingerprint(r.sdp), await this._pc?.setLocalDescription(r), r;
4176
4193
  } catch (e) {
4177
- throw this._debug.error("Unable to set local description", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "setLocalDescription-direct"), e;
4194
+ throw this._debug.error("Unable to set local description", e, { participantId: this._participantId }), this._logger?.log(S.ERROR, "setLocalDescription-direct"), e;
4178
4195
  }
4179
4196
  }
4180
4197
  async _createAnswer() {
@@ -4186,7 +4203,7 @@ var wr = class extends b {
4186
4203
  answer: t
4187
4204
  }), t = e._patchLocalDescription(t);
4188
4205
  } catch (e) {
4189
- throw this._debug.error("Unable to create answer", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "createAnswer-direct"), e;
4206
+ throw this._debug.error("Unable to create answer", e, { participantId: this._participantId }), this._logger?.log(S.ERROR, "createAnswer-direct"), e;
4190
4207
  }
4191
4208
  try {
4192
4209
  return this._debug.debug("Set local description", {
@@ -4194,7 +4211,7 @@ var wr = class extends b {
4194
4211
  answer: t
4195
4212
  }), this._calcFingerprint(t.sdp), await this._pc?.setLocalDescription(t), t;
4196
4213
  } catch (e) {
4197
- throw this._debug.error("Unable to set local description", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "setLocalDescription-direct"), e;
4214
+ throw this._debug.error("Unable to set local description", e, { participantId: this._participantId }), this._logger?.log(S.ERROR, "setLocalDescription-direct"), e;
4198
4215
  }
4199
4216
  }
4200
4217
  static _patchLocalDescription(e) {
@@ -4207,7 +4224,7 @@ var wr = class extends b {
4207
4224
  _onReplacedTrack(e) {
4208
4225
  this._pc && (this._pc.getSenders().forEach((t) => {
4209
4226
  t.track && t.track.kind === e.kind && t.track.contentHint === e.contentHint && t.replaceTrack(e).catch((e) => {
4210
- this._debug.error("DirectTransport: Unable to replace track", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "replaceTrack-direct");
4227
+ this._debug.error("DirectTransport: Unable to replace track", e, { participantId: this._participantId }), this._logger?.log(S.ERROR, "replaceTrack-direct");
4211
4228
  });
4212
4229
  }), this._applySettings());
4213
4230
  }
@@ -4522,14 +4539,31 @@ var Ur = class {
4522
4539
  }
4523
4540
  async _createWorker(e, t, n = [], r = {}, i = []) {
4524
4541
  return new Promise((a, o) => {
4525
- let s = n.join(","), c = new Blob([e, `exports.default(${s});`], { type: "application/javascript; charset=utf-8" }), l = window.URL.createObjectURL(c);
4526
- this._worker = new Worker(l), this._worker.onmessage = (e) => {
4542
+ let s = !1, c = !1, l = n.join(","), u = new Blob([e, `exports.default(${l});`], { type: "application/javascript; charset=utf-8" }), d = window.URL.createObjectURL(u), f = new Worker(d);
4543
+ window.URL.revokeObjectURL(d), this._worker = f;
4544
+ let p = (e) => {
4545
+ c || (c = !0, o(e));
4546
+ }, m = (e) => {
4547
+ if (this._debug.warn(e), !s) {
4548
+ p(e);
4549
+ return;
4550
+ }
4551
+ t({
4552
+ type: Wr.FRAME,
4553
+ error: e
4554
+ });
4555
+ };
4556
+ f.onerror = (e) => {
4557
+ e.preventDefault?.(), m(this._formatWorkerError(e));
4558
+ }, f.onmessageerror = (e) => {
4559
+ e.preventDefault?.(), m(this._formatWorkerMessageError(e));
4560
+ }, f.onmessage = (e) => {
4527
4561
  switch (e.data.type) {
4528
4562
  case Wr.READY:
4529
- a();
4563
+ s = !0, c || (c = !0, a());
4530
4564
  break;
4531
4565
  case Wr.ERROR:
4532
- o(e.data.error);
4566
+ s ? m(e.data.error) : p(e.data.error);
4533
4567
  break;
4534
4568
  case Wr.FRAME:
4535
4569
  t(e.data);
@@ -4538,7 +4572,7 @@ var Ur = class {
4538
4572
  this._debug.debug(e.data.message);
4539
4573
  break;
4540
4574
  case Wr.LOG_ERROR:
4541
- this._logger?.log(C.ERROR, e.data.message);
4575
+ this._logger?.log(S.ERROR, e.data.message);
4542
4576
  break;
4543
4577
  }
4544
4578
  }, this._sendToWorker(Wr.INIT, r, i);
@@ -4550,6 +4584,17 @@ var Ur = class {
4550
4584
  _sendToWorker(e, t = {}, n = []) {
4551
4585
  this._worker?.postMessage(Object.assign({ type: e }, t), n);
4552
4586
  }
4587
+ _formatWorkerError(e) {
4588
+ let t = e.message || e.error?.message || "Unknown worker error", n = [[
4589
+ e.filename,
4590
+ e.lineno,
4591
+ e.colno
4592
+ ].filter(Boolean).join(":"), [e.error?.name, e.error?.stack].filter(Boolean).join(": ")].filter(Boolean).join(" ");
4593
+ return `${this.constructor.name} Worker crashed: ${t}${n ? ` (${n})` : ""}`;
4594
+ }
4595
+ _formatWorkerMessageError(e) {
4596
+ return `${this.constructor.name} Worker message error${e.origin ? ` from ${e.origin}` : ""}`;
4597
+ }
4553
4598
  static isBrowserSupported() {
4554
4599
  throw Error("Not implemented");
4555
4600
  }
@@ -4582,7 +4627,7 @@ var Ur = class {
4582
4627
  super(e, t);
4583
4628
  }
4584
4629
  async init(e, t, n) {
4585
- this._debug.debug("WebCodecsDecoder started"), await this._createWorker("var workerExports=(function(){var e=function(e){return e.VP9=`vp09.00.50.08`,e.VP8=`vp8`,e}({}),t=function(e){return e.INIT=`init`,e.READY=`ready`,e.FRAME=`frame`,e.SET_BITRATE=`set_bitrate`,e.ERROR=`error`,e.DEBUG=`debug`,e.LOG_ERROR=`log_error`,e}({});return n=>{let r=null,i=`no-preference`,a=!0,o=!1,s=!1,c=null,l=null;function u(){self.postMessage({type:t.READY})}function d(e,n,r,i=!1){c={timestamp:e,data:n,isVP9:r,keyFrame:i};let a=p(r);if(o&&!i){self.postMessage({type:t.FRAME,error:`WebCodecsDecoder waiting for keyframe`}),f();return}else o&&i&&(o=!1,s=!1,self.postMessage({type:t.DEBUG,message:`WebCodecsDecoder got keyframe. Start decoding`}));let l=new EncodedVideoChunk({type:i?`key`:`delta`,timestamp:e,data:n});try{a.decode(l)}catch(e){m(`because failed call decode: ${e.message}`);return}h(i)}self.onmessage=e=>{switch(e.data.type){case t.INIT:u();break;case t.FRAME:d(e.data.timestamp,e.data.data,e.data.isVP9,e.data.keyFrame);break}};function f(){s||(self.postMessage({type:t.FRAME,requestKeyFrame:!0}),s=!0)}function p(e){return a!==e&&(a=e,m(`because codec is changed to ${a?`VP9`:`VP8`}`)),r||(o=!0,self.postMessage({type:t.DEBUG,message:`WebCodecsDecoder codec ${a?`VP9`:`VP8`}`}),r=new VideoDecoder({output:e=>{g();let r=n?[e]:[];self.postMessage({type:t.FRAME,data:e},r),e.close()},error:e=>{g(),m(`because error during decoding: ${e.message}`),i===`prefer-software`?self.postMessage({type:t.FRAME,error:`WebCodecsDecoder failed, reinitialize: `+String(e)}):(i=`prefer-software`,c&&c.keyFrame&&d(c.timestamp,c.data,c.isVP9,c.keyFrame),self.postMessage({type:t.DEBUG,message:`WebCodecsDecoder codec switch to prefer-software because decoding issue: ${e.message}`}))}}),r.configure(_(a,i))),r}function m(e){if(r){try{r&&r.state!==`closed`&&r.close()}catch{}r=null,self.postMessage({type:t.FRAME,error:`WebCodecsDecoder reset ${e}`})}}function h(e=!1){l=setTimeout(()=>{m(`because of decode timeout`)},3e3)}function g(){l&&clearTimeout(l),l=null}function _(t,n){return{codec:t?e.VP9:e.VP8,hardwareAcceleration:n}}}})(),exports={default:workerExports};", (r) => {
4630
+ this._debug.debug("WebCodecsDecoder started"), await this._createWorker("var workerExports=(function(){var e=function(e){return e.VP9=`vp09.00.50.08`,e.VP8=`vp8`,e}({}),t=function(e){return e.INIT=`init`,e.READY=`ready`,e.FRAME=`frame`,e.SET_BITRATE=`set_bitrate`,e.ERROR=`error`,e.DEBUG=`debug`,e.LOG_ERROR=`log_error`,e}({});return n=>{let r=null,i=`no-preference`,a=!0,o=!1,s=!1,c=null,l=null;function u(e){return e instanceof Error?[e.name,e.message,e.stack].filter(Boolean).join(`: `):String(e)}function d(e,n){try{self.postMessage({type:t.FRAME,error:`WebCodecsDecoder ${e} failed: ${u(n)}`})}catch{}}function f(){self.postMessage({type:t.READY})}function p(e,n,r,i=!1){try{c={timestamp:e,data:n,isVP9:r,keyFrame:i};let a=h(r);if(o&&!i){self.postMessage({type:t.FRAME,error:`WebCodecsDecoder waiting for keyframe`}),m();return}else o&&i&&(o=!1,s=!1,self.postMessage({type:t.DEBUG,message:`WebCodecsDecoder got keyframe. Start decoding`}));let l=new EncodedVideoChunk({type:i?`key`:`delta`,timestamp:e,data:n});a.decode(l)}catch(e){_(`because failed call decode: ${u(e)}`),d(`decode`,e);return}v(i)}self.onmessage=e=>{try{switch(e.data.type){case t.INIT:f();break;case t.FRAME:p(e.data.timestamp,e.data.data,e.data.isVP9,e.data.keyFrame);break}}catch(e){d(`message`,e)}};function m(){s||(self.postMessage({type:t.FRAME,requestKeyFrame:!0}),s=!0)}function h(e){if(a!==e&&(a=e,_(`because codec is changed to ${a?`VP9`:`VP8`}`)),!r){o=!0,self.postMessage({type:t.DEBUG,message:`WebCodecsDecoder codec ${a?`VP9`:`VP8`}`}),r=new VideoDecoder({output:e=>{y(),g(e)},error:e=>{y(),_(`because error during decoding: ${u(e)}`),i===`prefer-software`?self.postMessage({type:t.FRAME,error:`WebCodecsDecoder failed, reinitialize: `+u(e)}):(i=`prefer-software`,c&&c.keyFrame&&p(c.timestamp,c.data,c.isVP9,c.keyFrame),self.postMessage({type:t.DEBUG,message:`WebCodecsDecoder codec switch to prefer-software because decoding issue: ${u(e)}`}))}});try{r.configure(b(a,i))}catch(e){throw _(`because failed configure: ${u(e)}`),d(`configure`,e),e}}return r}function g(e){try{let r=n?[e]:[];self.postMessage({type:t.FRAME,data:e},r)}catch(n){try{self.postMessage({type:t.FRAME,data:e})}catch(e){d(`postMessage`,e),d(`postMessage transfer`,n)}}finally{try{e.close()}catch{}}}function _(e){if(r){try{r&&r.state!==`closed`&&r.close()}catch{}r=null,self.postMessage({type:t.FRAME,error:`WebCodecsDecoder reset ${e}`})}}function v(e=!1){l=setTimeout(()=>{_(`because of decode timeout`)},3e3)}function y(){l&&clearTimeout(l),l=null}function b(t,n){return{codec:t?e.VP9:e.VP8,hardwareAcceleration:n}}}})(),exports={default:workerExports};", (r) => {
4586
4631
  r.error ? (this._debug.warn("WebCodecsDecoder", r.error), t(r.error)) : r.requestKeyFrame ? (this._debug.debug("WebCodecsDecoder requests key frame"), n()) : (e(r.data), r.data.close());
4587
4632
  }, [T.baseChromeVersion() >= 92 || T.browserName() === "Safari"]);
4588
4633
  }
@@ -4788,6 +4833,8 @@ var Ur = class {
4788
4833
  this._decoderBusy = !1, this._decodeQueue(), this._decoder instanceof qr && typeof e == "string" && e.includes("EncodingError") && this._switchToLibVPXDecoder();
4789
4834
  }, this._onKeyFrameRequested).then(() => {
4790
4835
  this._decoderReady = !0, this._decodeQueue();
4836
+ }).catch((e) => {
4837
+ this._debug.warn("StreamBuilder decoder init failed", e), this._decoder instanceof qr && this._switchToLibVPXDecoder();
4791
4838
  });
4792
4839
  }
4793
4840
  _switchToLibVPXDecoder() {
@@ -4868,7 +4915,7 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
4868
4915
  this._sourceBuffer.appendBuffer(n);
4869
4916
  }
4870
4917
  static _buildQueue(e) {
4871
- if (!e.length) return new Uint8Array();
4918
+ if (!e.length) return /* @__PURE__ */ new Uint8Array();
4872
4919
  if (e.length === 1) return u.build(e[0]);
4873
4920
  let t = e.reduce((e, t) => e + t.countSize(), 0), n = new Uint8Array(t), r = 0;
4874
4921
  for (let t of e) {
@@ -5197,7 +5244,7 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
5197
5244
  }
5198
5245
  async init() {
5199
5246
  let e = this._sourceTrack.getSettings().width, t = this._sourceTrack.getSettings().height, n = this._trackProcessor.readable;
5200
- this._debug.debug(`WebCodecsEncoder started ${e}x${t}, codec ${this.isVP9() ? "VP9" : "VP8"}`), await this._createWorker("var workerExports=(function(){var e=function(e){return e.VP9=`vp09.00.50.08`,e.VP8=`vp8`,e}({}),t=function(e){return e.INIT=`init`,e.READY=`ready`,e.FRAME=`frame`,e.SET_BITRATE=`set_bitrate`,e.ERROR=`error`,e.DEBUG=`debug`,e.LOG_ERROR=`log_error`,e}({});return()=>{let n,r,i,a,o,s,c=null,l=0,u=!1,d=0,f,p,m=!1,h=!1;function g(e){n=e.readable,r=n.getReader(),i=e.width,a=e.height,o=e.isVP9,s=e.framerate,f=e.useCongestionControl,p=e.maxBitrate,f&&(d=p,m=e.useCbr),y(),self.postMessage({type:t.READY})}function _(e){e&&!h&&(h=!0),self.clearTimeout(l),l=self.setTimeout(()=>{c&&v(c,h)},1e3),!u&&(u=!0,r.read().finally(()=>{u=!1,self.clearTimeout(l)}).then(({done:e,value:t})=>{if(c?.close(),c=null,!(e||!t)){if(!x){r.releaseLock(),n.cancel();return}c=t,v(t,h)}}))}function v(e,t){(e.codedWidth!==i||e.codedHeight!==a)&&(i=e.codedWidth,a=e.codedHeight,y(),h=!0),x.encode(e,{keyFrame:t}),t&&(h=!1)}function y(){let t={framerate:s,codec:o?e.VP9:e.VP8,width:i,height:a,latencyMode:`realtime`,bitrateMode:m?`constant`:`variable`};d>0&&(t.bitrate=d),x.configure(t)}function b(e,t,n){d=e,m=t,s=n,y()}let x=new VideoEncoder({output:e=>{let n;e.data?n=e.data:(n=new ArrayBuffer(e.byteLength),e.copyTo(n)),self.postMessage({type:t.FRAME,frameType:e.type,timestamp:e.timestamp,duration:e.duration,width:i,height:a,data:n},[n])},error:e=>{self.postMessage({type:t.FRAME,error:String(e)})}});self.onmessage=e=>{switch(e.data.type){case t.INIT:g(e.data);break;case t.FRAME:_(e.data.keyFrame);break;case t.SET_BITRATE:b(e.data.bitrate,e.data.useCbr,e.data.fps);break}}}})(),exports={default:workerExports};", (e) => {
5247
+ this._debug.debug(`WebCodecsEncoder started ${e}x${t}, codec ${this.isVP9() ? "VP9" : "VP8"}`), await this._createWorker("var workerExports=(function(){var e=function(e){return e.VP9=`vp09.00.50.08`,e.VP8=`vp8`,e}({}),t=function(e){return e.INIT=`init`,e.READY=`ready`,e.FRAME=`frame`,e.SET_BITRATE=`set_bitrate`,e.ERROR=`error`,e.DEBUG=`debug`,e.LOG_ERROR=`log_error`,e}({});return()=>{let n,r,i,a,o,s,c=null,l=0,u=!1,d=0,f,p,m=!1,h=!1,g=null;function _(e){return e instanceof Error?[e.name,e.message,e.stack].filter(Boolean).join(`: `):String(e)}function v(e,n){try{self.postMessage({type:t.FRAME,error:`WebCodecsEncoder ${e} failed: ${_(n)}`})}catch{}}function y(e,n){try{self.postMessage({type:t.ERROR,error:`WebCodecsEncoder ${e} failed: ${_(n)}`})}catch{}}function b(e){try{n=e.readable,r=n.getReader(),i=e.width,a=e.height,o=e.isVP9,s=e.framerate,f=e.useCongestionControl,p=e.maxBitrate,f&&(d=p,m=e.useCbr),T(),C(),self.postMessage({type:t.READY})}catch(e){y(`init`,e)}}function x(e){e&&!h&&(h=!0),self.clearTimeout(l),l=self.setTimeout(()=>{c&&S(c,h)},1e3),!u&&(u=!0,r.read().finally(()=>{u=!1,self.clearTimeout(l)}).then(({done:e,value:t})=>{if(c?.close(),c=null,!(e||!t)){if(!g){r.releaseLock(),n.cancel();return}c=t,S(t,h)}}).catch(e=>{v(`read`,e)}))}function S(e,t){try{if((e.codedWidth!==i||e.codedHeight!==a)&&(i=e.codedWidth,a=e.codedHeight,C(),h=!0),!g)throw Error(`encoder is not initialized`);g.encode(e,{keyFrame:t}),t&&(h=!1)}catch(e){v(`encode`,e)}}function C(){if(!g)throw Error(`encoder is not initialized`);let t={framerate:s,codec:o?e.VP9:e.VP8,width:i,height:a,latencyMode:`realtime`,bitrateMode:m?`constant`:`variable`};d>0&&(t.bitrate=d),g.configure(t)}function w(e,t,n){try{d=e,m=t,s=n,C()}catch(e){v(`setBitrate`,e)}}function T(){g=new VideoEncoder({output:e=>{try{let n;e.data?n=e.data:(n=new ArrayBuffer(e.byteLength),e.copyTo(n)),self.postMessage({type:t.FRAME,frameType:e.type,timestamp:e.timestamp,duration:e.duration,width:i,height:a,data:n},[n])}catch(e){v(`output`,e)}},error:e=>{v(`codec`,e)}})}self.onmessage=e=>{try{switch(e.data.type){case t.INIT:b(e.data);break;case t.FRAME:x(e.data.keyFrame);break;case t.SET_BITRATE:w(e.data.bitrate,e.data.useCbr,e.data.fps);break}}catch(e){v(`message`,e)}}}})(),exports={default:workerExports};", (e) => {
5201
5248
  e.error ? this._onFrame(null, e.error) : this._onFrame({
5202
5249
  type: e.frameType,
5203
5250
  timestamp: e.timestamp,
@@ -5598,7 +5645,7 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
5598
5645
  try {
5599
5646
  this._mediaSource.addTrackToPeerConnection(this._pc, this._observer, !1), this._prevConsumerSettings = {}, this._prevConsumerFastSharingSettings = {}, this._applyConsumerSettings();
5600
5647
  } catch (e) {
5601
- this._debug.error("ServerTransport: Unable to add media source tracks", e), this._logger?.log(C.ERROR, "addTrack-single"), this.close(e);
5648
+ this._debug.error("ServerTransport: Unable to add media source tracks", e), this._logger?.log(S.ERROR, "addTrack-single"), this.close(e);
5602
5649
  return;
5603
5650
  }
5604
5651
  this._createDataChannel(this._pc, gr.consumerScreenShare, (e) => {
@@ -5770,7 +5817,7 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
5770
5817
  try {
5771
5818
  await this._pc.setRemoteDescription(e);
5772
5819
  } catch (e) {
5773
- throw this._debug.error("[single] unable to set remote offer", e), this._logger?.log(C.ERROR, "setRemoteDescription-single"), e;
5820
+ throw this._debug.error("[single] unable to set remote offer", e), this._logger?.log(S.ERROR, "setRemoteDescription-single"), e;
5774
5821
  }
5775
5822
  let r = this._findFirstSimTransceiver();
5776
5823
  if (M.simulcast) if (r) {
@@ -5783,13 +5830,13 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
5783
5830
  if (await this._handleTracks(), this._debug.debug("[single] create local answer"), !this._pc) throw Error("Interrupt allocation");
5784
5831
  i = await this._pc.createAnswer();
5785
5832
  } catch (e) {
5786
- throw this._debug.error("[single] unable to create answer", e), this._logger?.log(C.ERROR, "createAnswer-single"), e;
5833
+ throw this._debug.error("[single] unable to create answer", e), this._logger?.log(S.ERROR, "createAnswer-single"), e;
5787
5834
  }
5788
5835
  try {
5789
5836
  if (!this._pc) throw Error("Interrupt allocation");
5790
5837
  i.sdp = j.patchLocalSDP(i.sdp, !1, T.isBrokenH264Decoder(), !1), this._debug.debug("[single] set local answer", { answer: i }), await this._pc.setLocalDescription(i);
5791
5838
  } catch (e) {
5792
- throw this._debug.error("[single] unable to set local answer", e), this._logger?.log(C.ERROR, "setLocalDescription-single"), e;
5839
+ throw this._debug.error("[single] unable to set local answer", e), this._logger?.log(S.ERROR, "setLocalDescription-single"), e;
5793
5840
  }
5794
5841
  if (n && r) {
5795
5842
  i.sdp = j.patchSimulcastAnswerSdp(i.sdp, r, Yt.WIDTH, Yt.HEIGHT);
@@ -5798,7 +5845,7 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
5798
5845
  try {
5799
5846
  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");
5800
5847
  } catch (e) {
5801
- this._debug.warn("[single] unable to send local answer", e), this._logger?.log(C.ERROR, "acceptProducer");
5848
+ this._debug.warn("[single] unable to send local answer", e), this._logger?.log(S.ERROR, "acceptProducer");
5802
5849
  }
5803
5850
  n && await this._changeSimulcastInfo(!0, !0);
5804
5851
  }
@@ -5872,7 +5919,7 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
5872
5919
  try {
5873
5920
  e.direction = "sendonly", await e.sender.replaceTrack(this._newAudioShareTrack), this._newAudioShareTrack = null;
5874
5921
  } catch (e) {
5875
- this._debug.error("ServerTransport: Unable to replace track", e), this._logger?.log(C.ERROR, "replaceTrack-single");
5922
+ this._debug.error("ServerTransport: Unable to replace track", e), this._logger?.log(S.ERROR, "replaceTrack-single");
5876
5923
  }
5877
5924
  }
5878
5925
  async _handleScreenShareTrack() {
@@ -5917,7 +5964,7 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
5917
5964
  this._debug.debug("[single] signaling state changed", { state: e.signalingState }, t);
5918
5965
  }
5919
5966
  _onConnectionStateChange(e, t) {
5920
- switch (this._debug.debug("[single] connection state changed", { state: e.connectionState }, t), this._logger?.log(C.ICE_CONNECTION_STATE, e.connectionState), e.connectionState) {
5967
+ switch (this._debug.debug("[single] connection state changed", { state: e.connectionState }, t), this._logger?.log(S.ICE_CONNECTION_STATE, e.connectionState), e.connectionState) {
5921
5968
  case "failed":
5922
5969
  this._reconnectionPrevented ? this.close(/* @__PURE__ */ Error("Ice connection failed")) : this._reconnect();
5923
5970
  break;
@@ -5930,7 +5977,7 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
5930
5977
  break;
5931
5978
  case "connected":
5932
5979
  this._setState(K.CONNECTED), j.getPeerConnectionHostInfo(e).then((e) => {
5933
- e?.local && (this._logger?.log(C.ICE_CONNECTION_TYPE, e.local.type), this._debug.debug("Selected ICE candidates", e));
5980
+ e?.local && (this._logger?.log(S.ICE_CONNECTION_TYPE, e.local.type), this._debug.debug("Selected ICE candidates", e));
5934
5981
  });
5935
5982
  break;
5936
5983
  }
@@ -5940,7 +5987,7 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
5940
5987
  this._debug.debug(`_onReplacedTrack: newTrack=${e}, sendTrack=${t}`), t && (e = t);
5941
5988
  let n = (e, t) => {
5942
5989
  e.replaceTrack(t).catch((e) => {
5943
- this._debug.error("ServerTransport: Unable to replace track", e), this._logger?.log(C.ERROR, "replaceTrack-single");
5990
+ this._debug.error("ServerTransport: Unable to replace track", e), this._logger?.log(S.ERROR, "replaceTrack-single");
5944
5991
  });
5945
5992
  };
5946
5993
  if (this._debug.log(`_onReplacedTrack: newTrack=${e.getSettings().width}x${e.getSettings().height}`), M.simulcast && e.kind === k.video) {
@@ -5957,14 +6004,14 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
5957
6004
  e === k.screen && M.consumerFastScreenShare && this._mediaSource.mediaSettings.isFastScreenSharingEnabled && await this._replaceScreenShareTrack(), this._applyConsumerSettings();
5958
6005
  }
5959
6006
  getStreamWaitingTimeMs(e, t) {
5960
- 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;
5961
- 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;
6007
+ 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;
6008
+ 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;
5962
6009
  let n = this._rtpReceiversByStreamId[e];
5963
- 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;
6010
+ 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;
5964
6011
  let r = n.getSynchronizationSources();
5965
6012
  if (!r || !r.length) return this._debug.log(`Cannot get stream waiting time, ${e} receiver has no synchronization sources`), 0;
5966
6013
  let i = r[0].rtpTimestamp;
5967
- 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;
6014
+ 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;
5968
6015
  let a = t - i & Qi, o = Math.ceil(a / Zi);
5969
6016
  return Math.min(100, Math.max(0, o));
5970
6017
  }
@@ -6025,9 +6072,11 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
6025
6072
  }
6026
6073
  }, J = /* @__PURE__ */ function(e) {
6027
6074
  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;
6028
- }({}), ea = class extends b {
6075
+ }({}), ea = class extends y {
6029
6076
  constructor(e, t, n, r, i = R, a = null, o = null, s = null) {
6030
- 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());
6077
+ 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), h(this, "_vadController", null), h(this, "_updateVadTrack", () => {
6078
+ this._vadController?.setSendTrack(this._mediaSource.getSendAudioTrack());
6079
+ }), 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._createVad(), this._createAnimojiTransport(), e === q.SERVER && (this._serverTransport = this._createServerTransport());
6031
6080
  }
6032
6081
  updateSettings(e) {
6033
6082
  this._debug.log("Update transport settings", e), this._serverSettings = e, this._directTransport && this._directTransport.updateSettings(e), this._serverTransport && this._serverTransport.updateSettings(e);
@@ -6066,7 +6115,7 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
6066
6115
  this.unsubscribe();
6067
6116
  for (let e of this._dtListeners) e.dispose();
6068
6117
  for (let e of this._stListeners) e.dispose();
6069
- this._removeAnimojiTransport(), M.audioEffects?.destroy(), this._directTransport?.close(), this._directTransport = null, this._serverTransport?.close(), this._serverTransport = null, this._allocated = [], this._opened = [];
6118
+ this._removeAnimojiTransport(), M.audioEffects?.destroy(), this._vadController?.destroy(), this._vadController = null, this._directTransport?.close(), this._directTransport = null, this._serverTransport?.close(), this._serverTransport = null, this._allocated = [], this._opened = [];
6070
6119
  }
6071
6120
  holdClose() {
6072
6121
  this.unsubscribe();
@@ -6116,7 +6165,7 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
6116
6165
  }
6117
6166
  _onTopologyChanged(e) {
6118
6167
  if (e.topology !== this._topology) {
6119
- 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) {
6168
+ 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) {
6120
6169
  let t = e.offerTo || [], n = e.offerToTypes || [], r = e.offerToDeviceIdxs || [], i = t.length && n.length ? j.composeParticipantId(t[0], n[0], r[0]) : null;
6121
6170
  if (this._serverTransport && this._serverTransport.preventRestart(), !this._allocated || this._allocated.length === 0) {
6122
6171
  this._debug.error("Topology changed to DIRECT, but the list of allocated participants is empty");
@@ -6199,9 +6248,9 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
6199
6248
  _onAsrTranscription(e) {
6200
6249
  this._triggerEvent("ASR_TRANSCRIPTION", e);
6201
6250
  }
6202
- _onSourceChanged() {
6203
- let e = this._mediaSource.getStream();
6204
- e && this._animojiSender?.setStream(e);
6251
+ _onSourceChanged(e) {
6252
+ let t = this._mediaSource.getStream();
6253
+ t && this._animojiSender?.setStream(t), (!e || e.kind === k.audio) && this._updateVadTrack();
6205
6254
  }
6206
6255
  _onAnimojiStream(e, t) {
6207
6256
  this._triggerEvent("ANIMOJI_STREAM", e, t);
@@ -6209,6 +6258,11 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
6209
6258
  _onAnimojiStatus(e) {
6210
6259
  e ? this._animojiSender?.resume() : this._animojiSender?.pause(), this._mediaSource.onAnimojiSender(e);
6211
6260
  }
6261
+ _createVad() {
6262
+ M.vad && (this._vadController = new M.vad.VadController(this._mediaSource.getSendAudioTrack(), M.vadOptions), this._vadController.setLogger((e, ...t) => R.send(e, ...t), "VAD"), this._vadController.init().catch((e) => {
6263
+ R.warn("[Transport] VAD init failed, continuing without VAD", e), this._vadController?.destroy(), this._vadController = null;
6264
+ }));
6265
+ }
6212
6266
  _createAnimojiTransport() {
6213
6267
  if (!M.vmoji) return;
6214
6268
  this._animojiReceiver = new M.vmoji.AnimojiReceiver((e, t) => this._onAnimojiStream(e, t), (e) => this._onAnimojiStream(e, null), (e) => {
@@ -6224,9 +6278,9 @@ var gi = 2 ** 15 - 1, _i = 1, vi = 5, yi = 5, bi = class e {
6224
6278
  this._animojiSender?.destroy(), this._animojiSender = null, this._animojiReceiver?.destroy(), this._animojiReceiver = null;
6225
6279
  }
6226
6280
  getStreamWaitingTimeMs(e, t) {
6227
- 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);
6281
+ 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);
6228
6282
  }
6229
- }, ta = "videochat-epi", na = 5e3, ra = 500, ia = class extends b {
6283
+ }, ta = "videochat-epi", na = 5e3, ra = 500, ia = class extends y {
6230
6284
  constructor(e, t, n = null, r = !1, i = R) {
6231
6285
  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) => {
6232
6286
  this._screenShareStats.push(e);
@@ -6482,7 +6536,7 @@ var ua = la, da = {
6482
6536
  }
6483
6537
  }, ba = class {
6484
6538
  constructor(e) {
6485
- h(this, "decoder", void 0), h(this, "compression", void 0), h(this, "lengthDecoder", void 0), h(this, "buffer", void 0), h(this, "expectedLength", void 0), h(this, "offset", void 0), h(this, "lengthPrefixLength", void 0), this.decoder = new TextDecoder(), this.lengthDecoder = new va(), this.compression = e ?? null, this.buffer = new Uint8Array(), this.expectedLength = null, this.offset = 0;
6539
+ h(this, "decoder", void 0), h(this, "compression", void 0), h(this, "lengthDecoder", void 0), h(this, "buffer", void 0), h(this, "expectedLength", void 0), h(this, "offset", void 0), h(this, "lengthPrefixLength", void 0), this.decoder = new TextDecoder(), this.lengthDecoder = new va(), this.compression = e ?? null, this.buffer = /* @__PURE__ */ new Uint8Array(), this.expectedLength = null, this.offset = 0;
6486
6540
  }
6487
6541
  decode(e) {
6488
6542
  let t = [];
@@ -6820,7 +6874,7 @@ var ua = la, da = {
6820
6874
  async connect(e) {
6821
6875
  return new Promise((t, n) => {
6822
6876
  if (this.transport.readyState !== null && this.transport.readyState < WebSocket.CLOSING) {
6823
- this._logger?.log(C.SOCKET_ACTION, "already_opened"), n(Error("Socket already opened"));
6877
+ this._logger?.log(S.SOCKET_ACTION, "already_opened"), n(Error("Socket already opened"));
6824
6878
  return;
6825
6879
  }
6826
6880
  this.conversationResolve = (e) => {
@@ -7098,10 +7152,10 @@ var ua = la, da = {
7098
7152
  if (this._isDataChannelCommand(e)) this.datachannelCommandsQueue.push(t), this.producerCommandDataChannel?.readyState === wa && this._handleCommandsQueue(this.datachannelCommandsQueue);
7099
7153
  else {
7100
7154
  if (this.transport.readyState === null) {
7101
- 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);
7155
+ 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);
7102
7156
  return;
7103
7157
  }
7104
- 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);
7158
+ this.transport.readyState > WebSocket.OPEN && (this._logger?.log(S.SOCKET_ACTION, "invalid_state"), this._debug.warn(`[signaling] socket is not opened, state ${this.transport.readyState}`)), this.websocketCommandsQueue.push(t), this.transport.readyState === WebSocket.OPEN && this._handleCommandsQueue(this.websocketCommandsQueue);
7105
7159
  }
7106
7160
  };
7107
7161
  return new Promise((a, o) => {
@@ -7126,7 +7180,7 @@ var ua = la, da = {
7126
7180
  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;
7127
7181
  }
7128
7182
  _onOpen() {
7129
- 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);
7183
+ this._debug.debug("[signaling] socket opened"), this._logger?.log(S.SOCKET_ACTION, "opened"), this._waitConnectionMessage(), this._logTransportStat(this.connectionType === dr.RETRY ? mr.RECONNECTED : mr.CONNECTED);
7130
7184
  }
7131
7185
  _onMessage(e) {
7132
7186
  if (e.data === "ping") {
@@ -7137,7 +7191,7 @@ var ua = la, da = {
7137
7191
  let t = JSON.parse(e.data);
7138
7192
  L.onSignalingMessage(t), this._handleMessage(t);
7139
7193
  } catch (t) {
7140
- this._logger?.log(C.SOCKET_ACTION, "parse_error"), this._debug.error("[signaling] unable to parse message", t, e.data);
7194
+ this._logger?.log(S.SOCKET_ACTION, "parse_error"), this._debug.error("[signaling] unable to parse message", t, e.data);
7141
7195
  }
7142
7196
  }
7143
7197
  _handleMessage(e) {
@@ -7157,12 +7211,12 @@ var ua = la, da = {
7157
7211
  case "error":
7158
7212
  this._handleErrorMessage(e);
7159
7213
  break;
7160
- default: this._logger?.log(C.SOCKET_ACTION, "unknown_message"), this._debug.warn("[signaling] unhandled message", e);
7214
+ default: this._logger?.log(S.SOCKET_ACTION, "unknown_message"), this._debug.warn("[signaling] unhandled message", e);
7161
7215
  }
7162
7216
  e.stamp && (this.lastStamp = e.stamp, this.transport.setLastStamp(e.stamp));
7163
7217
  }
7164
7218
  _handleErrorMessage(e) {
7165
- this._logger?.log(C.SOCKET_ACTION, `error-${e.error}`);
7219
+ this._logger?.log(S.SOCKET_ACTION, `error-${e.error}`);
7166
7220
  let t = e.error ? Ea.includes(e.error) : !1;
7167
7221
  switch (this._debug.debug(`[signaling] error message [${e.sequence}]`, e), e.sequence && this.responseHandlers[e.sequence] && this._handleCommandResponse(!1, e), e.error) {
7168
7222
  case "service-unavailable":
@@ -7176,7 +7230,7 @@ var ua = la, da = {
7176
7230
  });
7177
7231
  break;
7178
7232
  case "conversation-ended":
7179
- this.conversationReject ? this.conversationReject(new O(e.reason || x.SIGNALING_FAILED, {
7233
+ this.conversationReject ? this.conversationReject(new O(e.reason || b.SIGNALING_FAILED, {
7180
7234
  message: `Conversation ended: ${e.error}`,
7181
7235
  remote: !0
7182
7236
  })) : this._triggerEvent(fr.NOTIFICATION, {
@@ -7195,7 +7249,7 @@ var ua = la, da = {
7195
7249
  break;
7196
7250
  default:
7197
7251
  if (!t) break;
7198
- this.connected ? this._throwError(/* @__PURE__ */ Error(`Signaling error: ${e.error}`)) : e.sequence || (this.conversationReject?.(new O(e.reason || x.SIGNALING_FAILED, {
7252
+ this.connected ? this._throwError(/* @__PURE__ */ Error(`Signaling error: ${e.error}`)) : e.sequence || (this.conversationReject?.(new O(e.reason || b.SIGNALING_FAILED, {
7199
7253
  message: `Unable to connect to the signaling: ${e.error}`,
7200
7254
  remote: !0
7201
7255
  })), this._closeSocket());
@@ -7212,7 +7266,7 @@ var ua = la, da = {
7212
7266
  this._triggerEvent(fr.FAILED, e);
7213
7267
  }
7214
7268
  _onError(e) {
7215
- this._logger?.log(C.SOCKET_ACTION, "error"), this._debug.error("[signaling] signaling error", e), this._logTransportStat(mr.FAILED_EXCEPTIONS, { string_value: this._serializeErrorEvent(e) });
7269
+ this._logger?.log(S.SOCKET_ACTION, "error"), this._debug.error("[signaling] signaling error", e), this._logTransportStat(mr.FAILED_EXCEPTIONS, { string_value: this._serializeErrorEvent(e) });
7216
7270
  }
7217
7271
  _serializeErrorEvent(e) {
7218
7272
  let t = e, n = t.error instanceof Error ? t.error : null;
@@ -7227,7 +7281,7 @@ var ua = la, da = {
7227
7281
  });
7228
7282
  }
7229
7283
  _onClose(e) {
7230
- this._logger?.log(C.SOCKET_ACTION, "closed"), this._debug.debug("[signaling] connection closed", {
7284
+ this._logger?.log(S.SOCKET_ACTION, "closed"), this._debug.debug("[signaling] connection closed", {
7231
7285
  code: e.code,
7232
7286
  reason: e.reason
7233
7287
  }), this.connected = !1;
@@ -7242,7 +7296,7 @@ var ua = la, da = {
7242
7296
  let r = this.responseHandlers[n.sequence];
7243
7297
  window.clearTimeout(r.responseTimer);
7244
7298
  let i = W.measureMark(r.statMarkName);
7245
- 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);
7299
+ i !== null && this._statSignalingCommands?.mark(r.name, i, this._getSocketType()), this._debug.debug(`[signaling] command response [${n.sequence}]`, n), t ? (delete this.responseHandlers[n.sequence], r.resolve(n)) : n.type === "error" ? (delete this.responseHandlers[n.sequence], this._logger?.log(S.SOCKET_ACTION, "response-error"), r.reject(Error(n.error || `Response error [${r.name}]`), !0)) : this.transport.readyState === WebSocket.OPEN ? (delete this.responseHandlers[n.sequence], this._logger?.log(S.SOCKET_ACTION, "response-timeout"), r.reject(Error(n.error || `Response timeout [${r.name}]`))) : r.responseTimer = window.setTimeout(() => this._handleCommandResponse(t, n), e.WAIT_RESPONSE_DELAY);
7246
7300
  }
7247
7301
  _handleCommandsQueue(e) {
7248
7302
  for (; e.length > 0;) {
@@ -7308,7 +7362,7 @@ var ua = la, da = {
7308
7362
  }
7309
7363
  _waitConnectionMessage() {
7310
7364
  this.connectionMessageWaitTimer = window.setTimeout(() => {
7311
- this.conversationReject && this.conversationReject(new O(x.SIGNALING_FAILED, {
7365
+ this.conversationReject && this.conversationReject(new O(b.SIGNALING_FAILED, {
7312
7366
  message: "Unable to connect to the signaling: connection timeout",
7313
7367
  remote: !0
7314
7368
  }));
@@ -7320,7 +7374,7 @@ var ua = la, da = {
7320
7374
  _onTransportFailed(e) {
7321
7375
  switch (e.failure) {
7322
7376
  case Sa.EMPTY_ENDPOINT:
7323
- this.conversationReject?.(new O(x.SIGNALING_FAILED, {
7377
+ this.conversationReject?.(new O(b.SIGNALING_FAILED, {
7324
7378
  message: e.message,
7325
7379
  remote: e.remote
7326
7380
  }));
@@ -7334,7 +7388,7 @@ var ua = la, da = {
7334
7388
  }
7335
7389
  }
7336
7390
  _onTransportReconnectScheduled(e) {
7337
- this.connectionType = dr.RETRY, this._debug.log(`[signaling] reconnect websocket after ${e.delay}ms (${e.count})`), this._logger?.log(C.SOCKET_ACTION, "reconnect");
7391
+ this.connectionType = dr.RETRY, this._debug.log(`[signaling] reconnect websocket after ${e.delay}ms (${e.count})`), this._logger?.log(S.SOCKET_ACTION, "reconnect");
7338
7392
  }
7339
7393
  _onTransportConnectionDead() {
7340
7394
  this._debug.warn("[signaling] socket is dead, trying to reconnect"), this._logTransportStat(mr.FAILED_PINGS);
@@ -7489,10 +7543,10 @@ function Wa(e) {
7489
7543
  }
7490
7544
  function Ga(e, t) {
7491
7545
  switch (e) {
7492
- case S.AUDIO: return !!t.isAudioEnabled;
7493
- case S.AUDIO_SHARING: return !!t.isAudioSharingEnabled;
7494
- case S.VIDEO: return !!t.isVideoEnabled;
7495
- case S.SCREEN_SHARING: return !!t.isFastScreenSharingEnabled || !!t.isScreenSharingEnabled;
7546
+ case x.AUDIO: return !!t.isAudioEnabled;
7547
+ case x.AUDIO_SHARING: return !!t.isAudioSharingEnabled;
7548
+ case x.VIDEO: return !!t.isVideoEnabled;
7549
+ case x.SCREEN_SHARING: return !!t.isFastScreenSharingEnabled || !!t.isScreenSharingEnabled;
7496
7550
  default: return !1;
7497
7551
  }
7498
7552
  }
@@ -7556,10 +7610,10 @@ var Xa = class {
7556
7610
  _fixAudioDeviceNoPackets(e) {
7557
7611
  if (!(this._fixNoPacketsApplied && this._fixNoPacketsChecked)) {
7558
7612
  if (this._fixNoPacketsApplied && !this._fixNoPacketsChecked) {
7559
- this._fixNoPacketsChecked = !0, this._logger?.log(C.ERROR, `audio_device_recover_${e.bandwidth ? "success" : "fail"}`);
7613
+ this._fixNoPacketsChecked = !0, this._logger?.log(S.ERROR, `audio_device_recover_${e.bandwidth ? "success" : "fail"}`);
7560
7614
  return;
7561
7615
  }
7562
- !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));
7616
+ !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));
7563
7617
  }
7564
7618
  }
7565
7619
  _fixAudioDeviceTooManyPackets(e) {
@@ -7568,7 +7622,7 @@ var Xa = class {
7568
7622
  if (!this._lastPacketsSentTime) e.packetsSent > 0 && (this._lastPacketsSentTime = t, this._lastPacketsSent = e.packetsSent);
7569
7623
  else if (t - this._lastPacketsSentTime > 500) {
7570
7624
  let n = (e.packetsSent - this._lastPacketsSent) * 1e3 / (t - this._lastPacketsSentTime);
7571
- 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) => {
7625
+ 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) => {
7572
7626
  this._debug.warn("[AudioFix] Failed to fix RV (too many packets)", e);
7573
7627
  }), this._fixTooManyPacketsTime = t);
7574
7628
  }
@@ -7628,7 +7682,7 @@ var Xa = class {
7628
7682
  let e = T.getSavedOutput();
7629
7683
  e && await this._audioElement.setSinkId?.(e.deviceId);
7630
7684
  } catch (e) {
7631
- throw this._logger?.log(C.ERROR, "change_output"), this._debug.error("[audio] Output change failed", e), e;
7685
+ throw this._logger?.log(S.ERROR, "change_output"), this._debug.error("[audio] Output change failed", e), e;
7632
7686
  }
7633
7687
  }
7634
7688
  _getTracks() {
@@ -7686,7 +7740,7 @@ function eo(e, t) {
7686
7740
  }
7687
7741
  //#endregion
7688
7742
  //#region src/classes/DebugInfo.ts
7689
- var to = 90, no = 3, ro = class extends b {
7743
+ var to = 90, no = 3, ro = class extends y {
7690
7744
  constructor(e = R) {
7691
7745
  super(), h(this, "_lastMemoryStat", {
7692
7746
  percent: 0,
@@ -7829,7 +7883,7 @@ var to = 90, no = 3, ro = class extends b {
7829
7883
  return this._trackId;
7830
7884
  }
7831
7885
  _getBins() {
7832
- if (!this._fftBins || !this._analyser) return new Uint8Array();
7886
+ if (!this._fftBins || !this._analyser) return /* @__PURE__ */ new Uint8Array();
7833
7887
  this._analyser.getByteFrequencyData(this._fftBins);
7834
7888
  let e = ao / this._fftBins.length, t = Math.ceil(M.voiceParams.minFreq / e), n = Math.floor(M.voiceParams.maxFreq / e);
7835
7889
  return this._fftBins.subarray(t, n);
@@ -7844,7 +7898,7 @@ var to = 90, no = 3, ro = class extends b {
7844
7898
  destroy() {
7845
7899
  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);
7846
7900
  }
7847
- }, so = class extends b {
7901
+ }, so = class extends y {
7848
7902
  constructor(e) {
7849
7903
  super(), h(this, "_detector", null), h(this, "_interval", null);
7850
7904
  let t = () => {
@@ -7890,7 +7944,7 @@ var to = 90, no = 3, ro = class extends b {
7890
7944
  }
7891
7945
  }, lo = /* @__PURE__ */ function(e) {
7892
7946
  return e.VOLUMES_DETECTED = "VOLUMES_DETECTED", e;
7893
- }({}), uo = class extends b {
7947
+ }({}), uo = class extends y {
7894
7948
  constructor(e) {
7895
7949
  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));
7896
7950
  }
@@ -7958,7 +8012,7 @@ var to = 90, no = 3, ro = class extends b {
7958
8012
  }
7959
8013
  }, fo = /* @__PURE__ */ function(e) {
7960
8014
  return e.SPEAKER_CHANGED = "SPEAKER_CHANGED", e;
7961
- }({}), po = class extends b {
8015
+ }({}), po = class extends y {
7962
8016
  constructor(e, t, n) {
7963
8017
  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));
7964
8018
  }
@@ -7982,7 +8036,7 @@ var to = 90, no = 3, ro = class extends b {
7982
8036
  _onTopologyChanged(e) {
7983
8037
  this._serverSideSpeakerDetection = e === q.SERVER;
7984
8038
  }
7985
- }, mo = 15e3, ho = 15e3, go = class extends b {
8039
+ }, mo = 15e3, ho = 15e3, go = class extends y {
7986
8040
  constructor(e, t, n, r = R, i = null) {
7987
8041
  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));
7988
8042
  }
@@ -8002,7 +8056,7 @@ var to = 90, no = 3, ro = class extends b {
8002
8056
  return this._transport.getTopology() === q.DIRECT ? ho : M.specListenerParams.volumeTimeout;
8003
8057
  }
8004
8058
  _onTransportStateChanged(e, t) {
8005
- 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`));
8059
+ 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`));
8006
8060
  }
8007
8061
  _onVolumesDetected(e) {
8008
8062
  Object.keys(e).forEach((t) => {
@@ -8022,14 +8076,14 @@ var to = 90, no = 3, ro = class extends b {
8022
8076
  }
8023
8077
  t = !0;
8024
8078
  }
8025
- }), 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`));
8079
+ }), 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`));
8026
8080
  }
8027
8081
  _onVolumeTimeout() {
8028
8082
  let e = [];
8029
8083
  Object.keys(this._volumes).forEach((t) => {
8030
- if (this._volumes[t] > 0) return;
8084
+ if (this._volumes[t] > 0 || this._participants[t]?.isOnHold) return;
8031
8085
  let n = "UNKNOWN", r = this._participants[t];
8032
- 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}`));
8086
+ 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}`));
8033
8087
  }), e.length && this._debug.warn("There is silent participant, send callSpecError"), this._volumeTimeout = 0;
8034
8088
  }
8035
8089
  }, _o = class extends f {
@@ -8408,7 +8462,7 @@ var to = 90, no = 3, ro = class extends b {
8408
8462
  call_type: this._callType
8409
8463
  }));
8410
8464
  }
8411
- }, Do = 1e3, Oo = 1e4, ko = 15, Q = class e extends b {
8465
+ }, Do = 1e3, Oo = 1e4, ko = 15, Q = class e extends y {
8412
8466
  constructor(e, t) {
8413
8467
  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) => {
8414
8468
  if (this._signaling.ready) try {
@@ -8470,7 +8524,7 @@ var to = 90, no = 3, ro = class extends b {
8470
8524
  try {
8471
8525
  this._mediaSource = this._createMediaSource(), await this._mediaSource.request(n);
8472
8526
  let d = this._mediaSource.mediaSettings;
8473
- t === Oa.CHAT || e && e.length > 1 ? this._logWithMediaSettings(C.OUTGOING_MULTIPARTY_CALL, d) : this._logWithMediaSettings(C.OUTGOING_CALL, d);
8527
+ t === Oa.CHAT || e && e.length > 1 ? this._logWithMediaSettings(S.OUTGOING_MULTIPARTY_CALL, d) : this._logWithMediaSettings(S.OUTGOING_CALL, d);
8474
8528
  let f = await this._startConversation({
8475
8529
  opponentIds: e,
8476
8530
  opponentType: t,
@@ -8504,7 +8558,7 @@ var to = 90, no = 3, ro = class extends b {
8504
8558
  if (n && M.videoTracksCount > 0) throw this._debug.error("Observer mode: please set videoTracksCount=0"), new O(D.UNSUPPORTED);
8505
8559
  this._mediaSource = this._createMediaSource(), await this._mediaSource.request(e.mediaOptions, !n);
8506
8560
  let r = this._mediaSource.mediaSettings;
8507
- this._logWithMediaSettings(C.JOIN_CONVERSATION, r);
8561
+ this._logWithMediaSettings(S.JOIN_CONVERSATION, r);
8508
8562
  let i = await this._joinConversation(e, t);
8509
8563
  if (!this._conversation) throw new O(D.UNKNOWN_ERROR);
8510
8564
  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);
@@ -8546,8 +8600,8 @@ var to = 90, no = 3, ro = class extends b {
8546
8600
  try {
8547
8601
  let a = Date.now(), o = await this._prepareConversation(e, t, n, r, i);
8548
8602
  if (this._mediaSource = this._createMediaSource(), !this._conversation) throw new O(D.UNKNOWN_ERROR);
8549
- 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);
8550
- 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);
8603
+ 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);
8604
+ 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), Ao = null, this._delayedHangup) throw new O(D.CANCELED);
8551
8605
  } catch (e) {
8552
8606
  throw Ao = null, this._close(e, "Unable to handle inbound call push"), e;
8553
8607
  }
@@ -8574,7 +8628,7 @@ var to = 90, no = 3, ro = class extends b {
8574
8628
  if (!this._mediaSource || !this._conversation || !this._transport) throw new O(D.UNKNOWN_ERROR);
8575
8629
  this._state = "PROCESSING";
8576
8630
  let e = this._mediaSource.mediaSettings;
8577
- this._logWithMediaSettings(C.ACCEPT_CONCURRENT, e), this._debug.debug("Concurrent call", { conversationId: this._conversation.id });
8631
+ this._logWithMediaSettings(S.ACCEPT_CONCURRENT, e), this._debug.debug("Concurrent call", { conversationId: this._conversation.id });
8578
8632
  try {
8579
8633
  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);
8580
8634
  } catch (e) {
@@ -8621,13 +8675,13 @@ var to = 90, no = 3, ro = class extends b {
8621
8675
  });
8622
8676
  }
8623
8677
  async accept(e) {
8624
- 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");
8678
+ 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");
8625
8679
  if (!this._mediaSource || !this._conversation || !this._transport) throw new O(D.UNKNOWN_ERROR);
8626
8680
  this._state = "PROCESSING", this._debug.setConversationId(this._conversation.id), this._debug.debug("Accept incoming call", e);
8627
8681
  try {
8628
8682
  await this._mediaSource.request(e);
8629
8683
  let t = this._mediaSource.mediaSettings;
8630
- this._logWithMediaSettings(C.ACCEPT_INCOMING, t), this._changeMediaSettings(t), this._statFirstMediaReceived.markAcceptCall(this._transport.getTopology()), await this._signaling.acceptCall(t), this._participantState = X.ACCEPTED;
8684
+ this._logWithMediaSettings(S.ACCEPT_INCOMING, t), this._changeMediaSettings(t), this._statFirstMediaReceived.markAcceptCall(this._transport.getTopology()), await this._signaling.acceptCall(t), this._participantState = X.ACCEPTED;
8631
8685
  let n = this._getMuteStatesForCurrentRoom(), r = Object.keys(n);
8632
8686
  r.length && this._onMuteParticipant({
8633
8687
  muteStates: n,
@@ -8649,23 +8703,25 @@ var to = 90, no = 3, ro = class extends b {
8649
8703
  if (L.onCallAccepted(this.id), L.onLocalStream(this._mediaSource.getStream(), t, this.id), L.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), await this._getMainRoomParticipants(), a, this.id), await this._emitHeldParticipantsStatus(), M.useParticipantListChunk) {
8650
8704
  let e = await this._getInitialParticiapntListChunk(), t = await this._getParticipants();
8651
8705
  e?.participants?.forEach((e) => {
8652
- let n = t[j.composeId(e)];
8653
- n && (n.movieShareInfos = e.movieShareInfos);
8706
+ let n = j.composeId(e), r = t[n];
8707
+ r && (r.movieShareInfos = e.movieShareInfos);
8654
8708
  }), await this._onConversationParticipantListChunk({ participants: e });
8655
8709
  }
8656
- return L.onLocalStatus(N.WAITING, this.id), this._toggleJoinAvailability(), this._changeNeedRate(), this._state = "ACTIVE", this._changeFeatureSet(), this._openTransport(Object.values(await this._getParticipants()), !0), await this._processConversationUrlSharingInfo(), await this._processConnectionAsrInfo(), z.setActive(this.id), this._conversation;
8710
+ return L.onLocalStatus(N.WAITING, this.id), this._toggleJoinAvailability(), this._changeNeedRate(), this._state = "ACTIVE", this._changeFeatureSet(), this._openTransport(Object.values(await this._getParticipants()), !0), await this._processConversationUrlSharingInfo(), await this._processConnectionAsrInfo(), z.setActive(this.id).catch((e) => {
8711
+ this._debug.error(e), this._close(e, "Unable to activated accepted call");
8712
+ }), this._conversation;
8657
8713
  } catch (e) {
8658
8714
  throw this._close(e, "Unable to accept call"), e;
8659
8715
  }
8660
8716
  }
8661
8717
  async decline() {
8662
- 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");
8663
- 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));
8718
+ 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");
8719
+ 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));
8664
8720
  }
8665
8721
  async hangup() {
8666
8722
  this._debug.debug("Hangup");
8667
8723
  let e = this._state === "ACTIVE" || this._state === "HELD" ? D.HUNGUP : D.CANCELED;
8668
- 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);
8724
+ 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);
8669
8725
  }
8670
8726
  async addParticipant(e, t) {
8671
8727
  if (!this._signaling.ready) {
@@ -8704,7 +8760,7 @@ var to = 90, no = 3, ro = class extends b {
8704
8760
  r.length ? this._transport.open(r, null, !!this._conversation?.observer) : this._transport.getTopology() === q.SERVER && this._forceOpenTransportForAloneInCall();
8705
8761
  }
8706
8762
  async _close(e, t) {
8707
- 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);
8763
+ 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);
8708
8764
  let n = this._conversation && this._conversation.id;
8709
8765
  if ([
8710
8766
  D.CANCELED,
@@ -8767,8 +8823,9 @@ var to = 90, no = 3, ro = class extends b {
8767
8823
  }
8768
8824
  M.iceServers = o, M.wssBase = n, M.wssToken = i, r && (M.wtsBase = r), a && (M.clientType = a);
8769
8825
  }
8770
- _addGeoParamsToEndpoint(e, t) {
8771
- return t.isp_as_no && (e += `&ispAsNo=${t.isp_as_no}`), t.isp_as_org && (e += `&ispAsOrg=${t.isp_as_org}`), t.loc_cc && (e += `&locCc=${t.loc_cc}`), t.loc_reg && (e += `&locReg=${t.loc_reg}`), e;
8826
+ _buildSignalingEndpoint({ baseEndpoint: e, userId: t, type: n, deviceIdx: r, conversationId: i, token: a, conversationParams: o }) {
8827
+ let s = new URL(e), c = s.searchParams;
8828
+ return c.set("userId", String(t)), c.set("entityType", n), c.set("deviceIdx", String(r)), c.set("conversationId", i), c.set("token", a), o?.isp_as_no && c.set("ispAsNo", String(o.isp_as_no)), o?.isp_as_org && c.set("ispAsOrg", o.isp_as_org), o?.loc_cc && c.set("locCc", o.loc_cc), o?.loc_reg && c.set("locReg", o.loc_reg), s.toString();
8772
8829
  }
8773
8830
  async _startConversation({ opponentIds: e, opponentType: t, direction: n, mediaOptions: r, payload: i = "", joiningAllowed: a = !1, requireAuthToJoin: o = !1, onlyAdminCanShareMovie: s, externalIds: c, startedTime: l, onFastStart: u, conversationId: d }) {
8774
8831
  let f = d ?? j.uuid();
@@ -8779,7 +8836,7 @@ var to = 90, no = 3, ro = class extends b {
8779
8836
  opponentType: t,
8780
8837
  direction: n
8781
8838
  });
8782
- let p = r.includes(S.VIDEO), m;
8839
+ let p = r.includes(x.VIDEO), m;
8783
8840
  if (u) {
8784
8841
  let e = {
8785
8842
  deviceId: this._api.deviceId(),
@@ -8837,7 +8894,7 @@ var to = 90, no = 3, ro = class extends b {
8837
8894
  joinLink: a,
8838
8895
  observedIds: o
8839
8896
  }), n && z.has(n)) throw new O(D.HAS_ACTIVE_CALL);
8840
- let l = r.includes(S.VIDEO), u, d;
8897
+ let l = r.includes(x.VIDEO), u, d;
8841
8898
  if (c) {
8842
8899
  if (!a) throw new O(D.FAST_JOIN_ERROR, { message: "joinLink is required for fast join" });
8843
8900
  let e = {
@@ -8902,13 +8959,43 @@ var to = 90, no = 3, ro = class extends b {
8902
8959
  };
8903
8960
  if (r) {
8904
8961
  let n = this._decodeExternalConversationParams(r);
8905
- this._setConversationParams(n), s = i ?? `${M.wssBase}?userId=${a}&entityType=${t}&deviceIdx=${o}&conversationId=${e}&token=${M.wssToken}`, l.token = n.token, l.endpoint = s, M.wtsBase && (c = `${M.wtsBase}?userId=${a}&entityType=${t}&deviceIdx=${o}&conversationId=${e}&token=${M.wssToken}`, l.wt_endpoint = c);
8962
+ this._setConversationParams(n), s = i ?? this._buildSignalingEndpoint({
8963
+ baseEndpoint: M.wssBase,
8964
+ userId: a,
8965
+ type: t,
8966
+ deviceIdx: o,
8967
+ conversationId: e,
8968
+ token: M.wssToken
8969
+ }), l.token = n.token, l.endpoint = s, M.wtsBase && (c = this._buildSignalingEndpoint({
8970
+ baseEndpoint: M.wtsBase,
8971
+ userId: a,
8972
+ type: t,
8973
+ deviceIdx: o,
8974
+ conversationId: e,
8975
+ token: M.wssToken
8976
+ }), l.wt_endpoint = c);
8906
8977
  } else {
8907
8978
  let n = await this._getConversationParams(e);
8908
- 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);
8979
+ o = n.device_idx || 0, s = i ?? this._buildSignalingEndpoint({
8980
+ baseEndpoint: M.wssBase,
8981
+ userId: a,
8982
+ type: t,
8983
+ deviceIdx: o,
8984
+ conversationId: e,
8985
+ token: M.wssToken,
8986
+ conversationParams: n
8987
+ }), l.token = n.token, l.endpoint = s, l.device_idx = o, M.wtsBase && (c = this._buildSignalingEndpoint({
8988
+ baseEndpoint: M.wtsBase,
8989
+ userId: a,
8990
+ type: t,
8991
+ deviceIdx: o,
8992
+ conversationId: e,
8993
+ token: M.wssToken,
8994
+ conversationParams: n
8995
+ }), l.wt_endpoint = c);
8909
8996
  }
8910
8997
  let u = await this._connectSignaling(dr.ACCEPT, l);
8911
- 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);
8998
+ 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);
8912
8999
  }
8913
9000
  async _createParticipant(e, t) {
8914
9001
  let n = Object.assign({
@@ -8988,7 +9075,7 @@ var to = 90, no = 3, ro = class extends b {
8988
9075
  audienceMode: this._isAudienceMode(t),
8989
9076
  restricted: this._isRestricted(t),
8990
9077
  urlSharingInfoByRoom: /* @__PURE__ */ new Map()
8991
- }, 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();
9078
+ }, 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();
8992
9079
  }
8993
9080
  _updateConversation(e) {
8994
9081
  if (!this._conversation) throw new O(D.UNKNOWN_ERROR);
@@ -9166,7 +9253,7 @@ var to = 90, no = 3, ro = class extends b {
9166
9253
  }
9167
9254
  _logDevices() {
9168
9255
  let e = T.getCameras().length, t = T.getMicrophones().length;
9169
- this._debug.debug("Cameras: " + e + (T.hasCameraPermission() ? "✔" : "✖") + ", Microphones: " + t + (T.hasMicrophonePermission() ? "✔" : "✖")), this._stats.logger.log(C.DEVICES, `${e}_${t}`);
9256
+ this._debug.debug("Cameras: " + e + (T.hasCameraPermission() ? "✔" : "✖") + ", Microphones: " + t + (T.hasMicrophonePermission() ? "✔" : "✖")), this._stats.logger.log(S.DEVICES, `${e}_${t}`);
9170
9257
  }
9171
9258
  _logWithMediaSettings(e, t) {
9172
9259
  this._stats.logger.log(e, [t?.isAudioEnabled && "audio", t?.isVideoEnabled && "video"].filter(Boolean).join("_"));
@@ -9236,7 +9323,7 @@ var to = 90, no = 3, ro = class extends b {
9236
9323
  observedIds: t.observedIds || []
9237
9324
  }, n), r = await this._getParticipant(e);
9238
9325
  }
9239
- 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));
9326
+ 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));
9240
9327
  }
9241
9328
  async _onRemoveParticipant(e) {
9242
9329
  this._debug.debug(`Remove participant [${e}]`);
@@ -9250,19 +9337,19 @@ var to = 90, no = 3, ro = class extends b {
9250
9337
  return;
9251
9338
  }
9252
9339
  if (this._transport) for (let e of t) this._transport.close(e.id);
9253
- this._stats.logger.log(C.REMOVE_PARTICIPANT);
9340
+ this._stats.logger.log(S.REMOVE_PARTICIPANT);
9254
9341
  }
9255
9342
  async changeDevice(e) {
9256
- return e === "audiooutput" ? this._audioOutput.changeOutput() : this._mediaSource ? this._mediaSource.changeDevice(e) : Promise.reject(x.UNKNOWN);
9343
+ return e === "audiooutput" ? this._audioOutput.changeOutput() : this._mediaSource ? this._mediaSource.changeDevice(e) : Promise.reject(b.UNKNOWN);
9257
9344
  }
9258
9345
  stopVideoTrack() {
9259
9346
  return this._mediaSource?.stopVideoTrack();
9260
9347
  }
9261
9348
  async toggleScreenCapturing(e) {
9262
- return this._mediaSource ? this._mediaSource.toggleScreenCapturing(e) : Promise.reject(x.UNKNOWN);
9349
+ return this._mediaSource ? this._mediaSource.toggleScreenCapturing(e) : Promise.reject(b.UNKNOWN);
9263
9350
  }
9264
9351
  async disableScreenCapturing() {
9265
- return this._mediaSource ? this._mediaSource.disableScreenCapturing() : Promise.reject(x.UNKNOWN);
9352
+ return this._mediaSource ? this._mediaSource.disableScreenCapturing() : Promise.reject(b.UNKNOWN);
9266
9353
  }
9267
9354
  toggleAnimojiCapturing(e) {
9268
9355
  this._mediaSource && this._mediaSource.toggleAnimojiCapturing(e);
@@ -9294,10 +9381,10 @@ var to = 90, no = 3, ro = class extends b {
9294
9381
  if (this._mediaSource) return this._mediaSource.setAudioStream(e);
9295
9382
  }
9296
9383
  async toggleLocalVideo(e) {
9297
- if (this._mediaSource) return this._stats.logger.log(C.MEDIA_STATUS, e ? "video_1" : "video_0"), this._mediaSource.toggleVideo(e);
9384
+ if (this._mediaSource) return this._stats.logger.log(S.MEDIA_STATUS, e ? "video_1" : "video_0"), this._mediaSource.toggleVideo(e);
9298
9385
  }
9299
9386
  async toggleLocalAudio(e) {
9300
- if (this._mediaSource) return this._stats.logger.log(C.MEDIA_STATUS, e ? "audio_1" : "audio_0"), this._mediaSource.toggleAudio(e);
9387
+ if (this._mediaSource) return this._stats.logger.log(S.MEDIA_STATUS, e ? "audio_1" : "audio_0"), this._mediaSource.toggleAudio(e);
9301
9388
  }
9302
9389
  async changePriorities(e) {
9303
9390
  if (e.length < 2 || !this._signaling.ready) return;
@@ -9447,7 +9534,7 @@ var to = 90, no = 3, ro = class extends b {
9447
9534
  L.onRemoteScreenStream(r.externalId, null, this.id);
9448
9535
  break;
9449
9536
  }
9450
- this._stats.logger.log(C.PAT_DEALLOCATED);
9537
+ this._stats.logger.log(S.PAT_DEALLOCATED);
9451
9538
  } else this._debug.log(`Cannot find participant to stop streaming: ${n.participantId}`);
9452
9539
  }
9453
9540
  this._streamIdByStreamDescription.delete(e);
@@ -9628,7 +9715,7 @@ var to = 90, no = 3, ro = class extends b {
9628
9715
  }
9629
9716
  let a = Tn(t), o = this._sequenceNumberByStreamDescription.get(a);
9630
9717
  if (o && o > e.sequenceNumber) {
9631
- 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);
9718
+ 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);
9632
9719
  return;
9633
9720
  }
9634
9721
  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));
@@ -9637,15 +9724,15 @@ var to = 90, no = 3, ro = class extends b {
9637
9724
  this._streamWaitTimerByStreamDescription.delete(a);
9638
9725
  let t = this._conversation?.externalId, n = this._isMe(r);
9639
9726
  if (!i && !n) {
9640
- this._stats.logger.log(C.PAT_ERROR, "participantMissing"), this._debug.error(`Could not find participant by ID: ${r}`);
9727
+ this._stats.logger.log(S.PAT_ERROR, "participantMissing"), this._debug.error(`Could not find participant by ID: ${r}`);
9641
9728
  return;
9642
9729
  }
9643
9730
  let o = n ? t : i.externalId, c = this._streamByStreamId.get(s);
9644
9731
  if (!c) {
9645
- this._stats.logger.log(C.PAT_ERROR, "streamNotFound"), this._debug.error(`Could not find stream by ID: ${s}`);
9732
+ this._stats.logger.log(S.PAT_ERROR, "streamNotFound"), this._debug.error(`Could not find stream by ID: ${s}`);
9646
9733
  return;
9647
9734
  }
9648
- this._stats.logger.log(C.PAT_ALLOCATED), this._streamIdByStreamDescription.set(a, s);
9735
+ this._stats.logger.log(S.PAT_ALLOCATED), this._streamIdByStreamDescription.set(a, s);
9649
9736
  let l = e.participantStreamDescription?.mediaType;
9650
9737
  if (l === V.STREAM || l === V.MOVIE) {
9651
9738
  if (e.participantStreamDescription?.streamName) {
@@ -9955,12 +10042,15 @@ var to = 90, no = 3, ro = class extends b {
9955
10042
  this._debug.log("Request participant list chunk", e);
9956
10043
  let t = await this._signaling.getParticipantListChunk(e);
9957
10044
  if (t.error) throw Error(t.error);
9958
- let n = this._createParticipantListChunk(t.chunk), r = await this._getParticipants(), i = n.participants.filter((e) => !r[j.composeId(e)]);
10045
+ let n = this._createParticipantListChunk(t.chunk), r = await this._getParticipants(), i = n.participants.filter((e) => {
10046
+ let t = j.composeId(e);
10047
+ return !r[t];
10048
+ });
9959
10049
  await this._registerParticipants(i);
9960
10050
  let a = this._transport?.getState();
9961
10051
  return n.participants.forEach((e) => {
9962
- let t = r[j.composeId(e)];
9963
- 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);
10052
+ let t = j.composeId(e), n = r[t];
10053
+ n.isOnHold || (n.status = this._getStatusByTransportState(a) ?? N.WAITING), n.movieShareInfos = e.movieShareInfos, Object.assign(n.mediaSettings, E(e.mediaSettings)), Object.assign(n.muteStates, e.muteStates), n.unmuteOptions = e.unmuteOptions ?? n.unmuteOptions, this._openTransport([n], !0);
9964
10054
  }), this._participantListChunkToExternalChunk(n);
9965
10055
  }
9966
10056
  async _getInitialParticiapntListChunk() {
@@ -10152,7 +10242,7 @@ var to = 90, no = 3, ro = class extends b {
10152
10242
  mediaSettings: E(e.mediaSettings)
10153
10243
  }, i));
10154
10244
  }
10155
- 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);
10245
+ 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);
10156
10246
  let i = Object.keys(r.muteStates);
10157
10247
  i.length && this._onMuteParticipant({
10158
10248
  muteStates: r.muteStates,
@@ -10304,7 +10394,7 @@ var to = 90, no = 3, ro = class extends b {
10304
10394
  n && (n.clientType = e.clientType, n.platform = e.platform), L.onPeerRegistered(this.id);
10305
10395
  }
10306
10396
  async _onMicSwitched(e) {
10307
- L.onDeviceSwitched(S.AUDIO, !e.mute, this.id), await this.toggleLocalAudio(!e.mute);
10397
+ L.onDeviceSwitched(x.AUDIO, !e.mute, this.id), await this.toggleLocalAudio(!e.mute);
10308
10398
  }
10309
10399
  async _onChatMessage(e) {
10310
10400
  let t = j.composeMessageId(e), n = await this._getExternalIdByParticipantId(t);
@@ -10457,7 +10547,7 @@ var to = 90, no = 3, ro = class extends b {
10457
10547
  if (!this._conversation) return;
10458
10548
  let n = this._getMuteStatesForRoomId(t), r = this._getMuteStatesForRoomId(e), i = Object.keys(n), a = Object.keys(r);
10459
10549
  this._processMuteState({
10460
- mediaOptions: Array.from(new Set([...i, ...a])),
10550
+ mediaOptions: Array.from(/* @__PURE__ */ new Set([...i, ...a])),
10461
10551
  roomId: e,
10462
10552
  muteAll: !0,
10463
10553
  stateUpdated: !0
@@ -10469,17 +10559,17 @@ var to = 90, no = 3, ro = class extends b {
10469
10559
  for (let [e, i] of d) {
10470
10560
  let a = this._isCallAdmin() && n;
10471
10561
  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) {
10472
- case S.VIDEO:
10473
- u.isVideoEnabled && (L.onDeviceSwitched(S.VIDEO, !1, this.id), await this.toggleLocalVideo(!1));
10562
+ case x.VIDEO:
10563
+ u.isVideoEnabled && (L.onDeviceSwitched(x.VIDEO, !1, this.id), await this.toggleLocalVideo(!1));
10474
10564
  break;
10475
- case S.AUDIO:
10476
- u.isAudioEnabled && (L.onDeviceSwitched(S.AUDIO, !1, this.id), await this.toggleLocalAudio(!1));
10565
+ case x.AUDIO:
10566
+ u.isAudioEnabled && (L.onDeviceSwitched(x.AUDIO, !1, this.id), await this.toggleLocalAudio(!1));
10477
10567
  break;
10478
- case S.SCREEN_SHARING:
10479
- u.isScreenSharingEnabled && (L.onDeviceSwitched(S.SCREEN_SHARING, !1, this.id), await this.disableScreenCapturing());
10568
+ case x.SCREEN_SHARING:
10569
+ u.isScreenSharingEnabled && (L.onDeviceSwitched(x.SCREEN_SHARING, !1, this.id), await this.disableScreenCapturing());
10480
10570
  break;
10481
- case S.AUDIO_SHARING:
10482
- u.isAudioSharingEnabled && (L.onDeviceSwitched(S.AUDIO_SHARING, !1, this.id), await this.toggleScreenCapturing({
10571
+ case x.AUDIO_SHARING:
10572
+ u.isAudioSharingEnabled && (L.onDeviceSwitched(x.AUDIO_SHARING, !1, this.id), await this.toggleScreenCapturing({
10483
10573
  captureScreen: u.isScreenSharingEnabled,
10484
10574
  fastScreenSharing: u.isFastScreenSharingEnabled,
10485
10575
  captureAudio: !1
@@ -10982,7 +11072,7 @@ async function Vo(e, t) {
10982
11072
  }
10983
11073
  }
10984
11074
  function Ho(e, t = {}, n = !1) {
10985
- 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));
11075
+ 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));
10986
11076
  for (let [e, n] of Object.entries(t)) typeof n == "object" && (t[e] = JSON.stringify(n));
10987
11077
  let r = "";
10988
11078
  for (let [e, n] of Object.entries(t)) r && (r += "&"), r += `${e}=${encodeURIComponent(n)}`;
@@ -11073,7 +11163,7 @@ var Uo = class {
11073
11163
  clear() {
11074
11164
  this._okIdToExternalId.clear(), this._externalIdToOkId.clear(), this._decorativeIdToInitialId.clear(), this._initialIdToDecorativeId.clear();
11075
11165
  }
11076
- }, Go = 700, Ko = 3e3, qo = class extends Uo {
11166
+ }, Go = "anonymLogin:", Ko = 700, qo = 3e3, Jo = class extends Uo {
11077
11167
  constructor(...e) {
11078
11168
  super(...e), h(this, "_userId", null), h(this, "_uuid", void 0), h(this, "_idCache", new Wo());
11079
11169
  }
@@ -11085,7 +11175,7 @@ var Uo = class {
11085
11175
  if (!Object.hasOwn(t, "error_msg")) {
11086
11176
  i++;
11087
11177
  let n = Object.getOwnPropertyNames(t).map((e) => `${e}: ${JSON.stringify(t[e])}`);
11088
- 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);
11178
+ 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 * Ko, qo), { signal: this._abortSignal }), r(i);
11089
11179
  }
11090
11180
  throw R.warn(e, "error", t), t;
11091
11181
  }
@@ -11097,18 +11187,18 @@ var Uo = class {
11097
11187
  return await this._callUnsafe(e, t, n);
11098
11188
  } catch (r) {
11099
11189
  R.warn("Api call error", r);
11100
- let i = x.API;
11190
+ let i = b.API;
11101
11191
  switch (r.error_code) {
11102
11192
  case 102:
11103
11193
  case 103:
11104
- case 104: return await this.authorize(), this._callUnsafe(e, t, n);
11194
+ case 104: return this._removeCachedAnonymLogin(), await this.authorize(), this._callUnsafe(e, t, n);
11105
11195
  }
11106
11196
  let a = {
11107
11197
  message: r.error_msg,
11108
11198
  code: r.error_code
11109
11199
  };
11110
11200
  if (r instanceof O) throw r;
11111
- if (r.custom_error && (a.custom_error = r.custom_error), Jo(r)) switch (r.error_code) {
11201
+ if (r.custom_error && (a.custom_error = r.custom_error), Yo(r)) switch (r.error_code) {
11112
11202
  case 1101:
11113
11203
  i = D.SERVICE_DISABLED;
11114
11204
  break;
@@ -11143,25 +11233,54 @@ var Uo = class {
11143
11233
  }
11144
11234
  async userId(e) {
11145
11235
  let t = j.extractOkId(e);
11146
- return y.isEmpty() ? Z.fromId(String(t)) : (this._idCache.hasByOkId(t) || await this._getExternalIdsByOkIds([t]), this._idCache.getExternalId(t) || Z.fromId(String(t)));
11236
+ return v.isEmpty() ? Z.fromId(String(t)) : (this._idCache.hasByOkId(t) || await this._getExternalIdsByOkIds([t]), this._idCache.getExternalId(t) || Z.fromId(String(t)));
11147
11237
  }
11148
11238
  async authorize() {
11149
- if (this._ensureUuid(), !M.apiKey) throw new O(x.API, { message: "Required argument apiAppKey not passed" });
11150
- let e = { session_data: {
11239
+ if (this._ensureUuid(), !M.apiKey) throw new O(b.API, { message: "Required argument apiAppKey not passed" });
11240
+ let e = this._getCachedAnonymLogin();
11241
+ if (e) {
11242
+ this._applyAnonymLogin(e);
11243
+ return;
11244
+ }
11245
+ let t = { session_data: {
11151
11246
  version: 2,
11152
11247
  device_id: this._uuid,
11153
11248
  client_version: M.appVersion,
11154
11249
  client_type: "SDK_JS"
11155
11250
  } };
11156
- return M.authToken && (e.session_data.auth_token = M.authToken, e.session_data.version = 3), this._callUnsafe("auth.anonymLogin", e, !0).then((e) => {
11157
- e.uid && (this._userId = Number(e.uid)), y.sessionKey = e.session_key, y.sessionSecretKey = e.session_secret_key;
11251
+ return M.authToken && (t.session_data.auth_token = M.authToken, t.session_data.version = 3), this._callUnsafe("auth.anonymLogin", t, !0).then((e) => {
11252
+ this._applyAnonymLogin(e), this._setCachedAnonymLogin(e);
11158
11253
  }).catch((e) => {
11159
- throw e.error_code === 401 && L.onTokenExpired(), new O(x.AUTH, {
11254
+ throw e.error_code === 401 && (this._removeCachedAnonymLogin(), L.onTokenExpired()), new O(b.AUTH, {
11160
11255
  message: e.error_msg,
11161
11256
  code: e.error_code
11162
11257
  });
11163
11258
  });
11164
11259
  }
11260
+ _getAnonymLoginCacheKey() {
11261
+ return M.authToken ? `${Go}${M.authToken}` : null;
11262
+ }
11263
+ _getCachedAnonymLogin() {
11264
+ let e = this._getAnonymLoginCacheKey();
11265
+ if (!e) return null;
11266
+ let t = ot.get(e);
11267
+ return Xo(t) ? t : (t && ot.remove(e), null);
11268
+ }
11269
+ _setCachedAnonymLogin(e) {
11270
+ let t = this._getAnonymLoginCacheKey();
11271
+ !t || !Xo(e) || ot.set(t, {
11272
+ session_key: e.session_key,
11273
+ session_secret_key: e.session_secret_key,
11274
+ uid: e.uid
11275
+ });
11276
+ }
11277
+ _removeCachedAnonymLogin() {
11278
+ let e = this._getAnonymLoginCacheKey();
11279
+ e && ot.remove(e);
11280
+ }
11281
+ _applyAnonymLogin(e) {
11282
+ e.uid && (this._userId = Number(e.uid)), v.sessionKey = e.session_key, v.sessionSecretKey = e.session_secret_key;
11283
+ }
11165
11284
  logClientStats(e) {
11166
11285
  let t = {
11167
11286
  app_version: String(M.appVersion),
@@ -11244,8 +11363,8 @@ var Uo = class {
11244
11363
  }
11245
11364
  _ensureUuid() {
11246
11365
  if (!this._uuid) {
11247
- let e = at.get("uuid");
11248
- e || (e = j.uuid(), at.set("uuid", e)), this._uuid = String(e);
11366
+ let e = ot.get("uuid");
11367
+ e || (e = j.uuid(), ot.set("uuid", e)), this._uuid = String(e);
11249
11368
  }
11250
11369
  }
11251
11370
  deviceId() {
@@ -11364,16 +11483,19 @@ var Uo = class {
11364
11483
  return (await this._call("system.getInfo")).serverTime;
11365
11484
  }
11366
11485
  };
11367
- function Jo(e) {
11486
+ function Yo(e) {
11368
11487
  return typeof e == "object" && !!e && "error_code" in e && "error_msg" in e;
11369
11488
  }
11489
+ function Xo(e) {
11490
+ return typeof e == "object" && !!e && "session_key" in e && "session_secret_key" in e && typeof e.session_key == "string" && e.session_key.length > 0 && typeof e.session_secret_key == "string" && e.session_secret_key.length > 0;
11491
+ }
11370
11492
  //#endregion
11371
11493
  //#region src/enums/RecordRole.ts
11372
- var Yo = /* @__PURE__ */ function(e) {
11494
+ var Zo = /* @__PURE__ */ function(e) {
11373
11495
  return e.KING = "KING", e.PAWN = "PAWN", e;
11374
- }(Yo || {}), Xo = /* @__PURE__ */ function(e) {
11496
+ }(Zo || {}), Qo = /* @__PURE__ */ function(e) {
11375
11497
  return e.OFF = "0", e.ON = "1", e;
11376
- }({}), Zo = class {
11498
+ }({}), $o = class {
11377
11499
  constructor(e) {
11378
11500
  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;
11379
11501
  }
@@ -11396,7 +11518,7 @@ var Yo = /* @__PURE__ */ function(e) {
11396
11518
  let e = this._queue[this._readCursor];
11397
11519
  return e && (this._moveReadCursor = !1, this._queue[this._readCursor] = null, this._readCursor = this.nextCursor(this._readCursor), --this._left), e;
11398
11520
  }
11399
- }, Qo = class {
11521
+ }, es = class {
11400
11522
  constructor(e, t, n, r = null) {
11401
11523
  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;
11402
11524
  }
@@ -11421,7 +11543,7 @@ var Yo = /* @__PURE__ */ function(e) {
11421
11543
  session_key: this._sessionKey
11422
11544
  }, !0, await Io(this._baseApiUrl, this._apiEnv));
11423
11545
  }
11424
- }, $, $o = null, es = {
11546
+ }, $, ts = null, ns = {
11425
11547
  getCameras: T.getCameras,
11426
11548
  getMicrophones: T.getMicrophones,
11427
11549
  getOutput: T.getOutput,
@@ -11447,33 +11569,36 @@ var Yo = /* @__PURE__ */ function(e) {
11447
11569
  baseChromeVersion: T.baseChromeVersion,
11448
11570
  getAudioContext: T.getAudioContext,
11449
11571
  isAudioShareSupported: T.isAudioShareSupported
11450
- }, ts = { participantMarkerCompare: j.participantMarkerCompare };
11451
- function ns(e) {
11452
- $o = e;
11572
+ }, rs = { participantMarkerCompare: j.participantMarkerCompare };
11573
+ function is(e) {
11574
+ ts = e;
11453
11575
  }
11454
- function rs(e) {
11576
+ function as(e) {
11455
11577
  M.videoEffects = e;
11456
11578
  }
11457
- function is(e) {
11579
+ function os(e) {
11458
11580
  M.audioEffects = e;
11459
11581
  }
11460
- function as(e, t = null, n = {}, r = 1) {
11582
+ function ss(e, t = {}) {
11583
+ M.vad = e, M.vadOptions = t;
11584
+ }
11585
+ function cs(e, t = null, n = {}, r = 1) {
11461
11586
  M.vmoji = e, M.vmojiOptions = {
11462
11587
  protocolVersion: r,
11463
11588
  renderingOptions: n
11464
11589
  }, t && e.setSDK(t);
11465
11590
  }
11466
- async function os(t) {
11467
- 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);
11591
+ async function ls(t) {
11592
+ if (M.set(t), $ || ($ = new Jo()), 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);
11468
11593
  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}`);
11469
11594
  }
11470
- async function ss(e, t = [S.AUDIO], n = "", r = !1, i = !1, a, o, s) {
11595
+ async function us(e, t = [x.AUDIO], n = "", r = !1, i = !1, a, o, s) {
11471
11596
  let c = [];
11472
- return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]), cs([], Oa.USER, t, n, r, i, a, c, o, s);
11597
+ return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]), ds([], Oa.USER, t, n, r, i, a, c, o, s);
11473
11598
  }
11474
- async function cs(e, t = Oa.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
11599
+ async function ds(e, t = Oa.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
11475
11600
  if (!M.hold && z.callsLength > 0) throw R.error("There is already active call"), new O(D.FAILED);
11476
- return new Q($, $o).onStart({
11601
+ return new Q($, ts).onStart({
11477
11602
  opponentIds: e,
11478
11603
  opponentType: t,
11479
11604
  mediaOptions: n,
@@ -11486,37 +11611,37 @@ async function cs(e, t = Oa.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
11486
11611
  conversationId: l
11487
11612
  });
11488
11613
  }
11489
- async function ls(e, t) {
11490
- return us(e, A.USER, void 0, t);
11614
+ async function fs(e, t) {
11615
+ return ps(e, A.USER, void 0, t);
11491
11616
  }
11492
- async function us(e, t = A.USER, n, r, i, a) {
11617
+ async function ps(e, t = A.USER, n, r, i, a) {
11493
11618
  if (e === Q.id()) throw Error("Push has already been processed");
11494
- return a && $.setUserId(a), new Q($, $o).onPush(e, t, n, r, i);
11619
+ return a && $.setUserId(a), new Q($, ts).onPush(e, t, n, r, i);
11495
11620
  }
11496
- async function ds(e, t) {
11621
+ async function ms(e, t) {
11497
11622
  return e && (M.authToken = e), t !== void 0 && M.apiBaseUrl !== t && (M.apiBaseUrl = t, Po()), $.authorize();
11498
11623
  }
11499
- async function fs(e = [S.AUDIO], t) {
11500
- return Ic(t).accept(e);
11624
+ async function hs(e = [x.AUDIO], t) {
11625
+ return zc(t).accept(e);
11501
11626
  }
11502
- async function ps(e) {
11503
- let t = Fc(e);
11627
+ async function gs(e) {
11628
+ let t = Rc(e);
11504
11629
  if (t) return t.decline();
11505
11630
  }
11506
- async function ms(e, t = [S.AUDIO]) {
11507
- return hs(e, t);
11631
+ async function _s(e, t = [x.AUDIO]) {
11632
+ return vs(e, t);
11508
11633
  }
11509
- async function hs(e, t, n) {
11634
+ async function vs(e, t, n) {
11510
11635
  if (!M.hold && z.callsLength > 0) throw R.error("There is already active call"), new O(D.FAILED);
11511
- return new Q($, $o).onJoin({
11636
+ return new Q($, ts).onJoin({
11512
11637
  conversationId: e,
11513
11638
  mediaOptions: t,
11514
11639
  chatId: n
11515
11640
  });
11516
11641
  }
11517
- async function gs(e, t = [S.AUDIO], n, r, i, a) {
11642
+ async function ys(e, t = [x.AUDIO], n, r, i, a) {
11518
11643
  if (!M.hold && z.callsLength > 0) throw R.error("There is already active call"), new O(D.FAILED);
11519
- return n && (M.anonymToken = n), new Q($, $o).onJoin({
11644
+ return n && (M.anonymToken = n), new Q($, ts).onJoin({
11520
11645
  joinLink: e,
11521
11646
  mediaOptions: t,
11522
11647
  observedIds: r,
@@ -11524,31 +11649,31 @@ async function gs(e, t = [S.AUDIO], n, r, i, a) {
11524
11649
  onFastJoin: a
11525
11650
  });
11526
11651
  }
11527
- async function _s(e) {
11528
- let t = Fc(e);
11652
+ async function bs(e) {
11653
+ let t = Rc(e);
11529
11654
  if (t) return t.hangup();
11530
11655
  Q.hangupAfterInit();
11531
11656
  }
11532
- async function vs(e, t) {
11657
+ async function xs(e, t) {
11533
11658
  let n = Array.isArray(e) ? e : [e], r = Q.current();
11534
11659
  r && await r.addParticipant(n, t);
11535
11660
  }
11536
- async function ys(e, t) {
11661
+ async function Ss(e, t) {
11537
11662
  let n = Q.current();
11538
11663
  if (n) {
11539
11664
  let r = e.map((e) => j.composeUserId(e));
11540
11665
  await n.addParticipantLegacy(r, t);
11541
11666
  }
11542
11667
  }
11543
- async function bs(e, t = !1) {
11668
+ async function Cs(e, t = !1) {
11544
11669
  let n = $.getCachedRawOkIdByExternalId(e);
11545
11670
  if (!n) {
11546
11671
  R.warn("removeParticipant: externalId not found in cache", e);
11547
11672
  return;
11548
11673
  }
11549
- return xs(n, t);
11674
+ return ws(n, t);
11550
11675
  }
11551
- async function xs(e, t = !1) {
11676
+ async function ws(e, t = !1) {
11552
11677
  let n = Q.current();
11553
11678
  if (n) try {
11554
11679
  await n.removeParticipant(j.composeUserId(e), t);
@@ -11556,13 +11681,13 @@ async function xs(e, t = !1) {
11556
11681
  R.warn(`Failed to remove participant ${e}. Perhaps he is no longer on the call. ${t}`);
11557
11682
  }
11558
11683
  }
11559
- async function Ss(e, t) {
11684
+ async function Ts(e, t) {
11560
11685
  let n = Q.current();
11561
11686
  if (e === "videoinput" && At.contains(t)) return M.videoFacingMode = t, n ? (T.isMobile() && n.stopVideoTrack(), n.changeDevice(e)) : void 0;
11562
11687
  if (!await T._saveDeviceId(e, t)) throw Error(`Device not found: ${t}`);
11563
11688
  if (n) return n.changeDevice(e);
11564
11689
  }
11565
- async function Cs(e, t) {
11690
+ async function Es(e, t) {
11566
11691
  let n = typeof e == "object" ? {
11567
11692
  ...e,
11568
11693
  fastScreenSharing: e.captureScreen && e.fastScreenSharing,
@@ -11571,34 +11696,34 @@ async function Cs(e, t) {
11571
11696
  captureScreen: e,
11572
11697
  fastScreenSharing: !1,
11573
11698
  captureAudio: !1
11574
- }, r = Fc(t);
11699
+ }, r = Rc(t);
11575
11700
  return r ? r.toggleScreenCapturing(n) : Promise.reject();
11576
11701
  }
11577
- function ws(e) {
11702
+ function Ds(e) {
11578
11703
  let t = Q.current();
11579
11704
  t && t.toggleAnimojiCapturing(e);
11580
11705
  }
11581
- async function Ts(e, t = !1) {
11706
+ async function Os(e, t = !1) {
11582
11707
  let n = Q.current();
11583
11708
  n && await n.setVideoStream(e, t);
11584
11709
  }
11585
- async function Es(e, t) {
11586
- let n = Fc(t);
11710
+ async function ks(e, t) {
11711
+ let n = Rc(t);
11587
11712
  n && await n.toggleLocalVideo(e);
11588
11713
  }
11589
- async function Ds(e, t) {
11590
- let n = Fc(t);
11714
+ async function As(e, t) {
11715
+ let n = Rc(t);
11591
11716
  n && await n.toggleLocalAudio(e);
11592
11717
  }
11593
- async function Os(e) {
11718
+ async function js(e) {
11594
11719
  let t = Q.current();
11595
11720
  if (t) return t.setLocalResolution(e);
11596
11721
  }
11597
- async function ks(e) {
11722
+ async function Ms(e) {
11598
11723
  let t = Q.current();
11599
11724
  t && await t.changePriorities(e);
11600
11725
  }
11601
- async function As(e, t) {
11726
+ async function Ns(e, t) {
11602
11727
  let n = Q.current();
11603
11728
  if (n) {
11604
11729
  let r;
@@ -11613,33 +11738,33 @@ async function As(e, t) {
11613
11738
  await n.changeParticipantState(e, r);
11614
11739
  }
11615
11740
  }
11616
- async function js() {
11741
+ async function Ps() {
11617
11742
  let e = Q.current();
11618
11743
  e && await e.putHandsDown();
11619
11744
  }
11620
- async function Ms(e) {
11745
+ async function Fs(e) {
11621
11746
  let t = Q.current();
11622
11747
  t && await t.updateDisplayLayout(e);
11623
11748
  }
11624
- async function Ns(e) {
11749
+ async function Is(e) {
11625
11750
  let t = Q.current();
11626
11751
  t && await t.requestDisplayLayout(e);
11627
11752
  }
11628
- async function Ps(e, t, n = !1) {
11753
+ async function Ls(e, t, n = !1) {
11629
11754
  let r = $.getCachedRawOkIdByExternalId(e);
11630
11755
  if (!r) {
11631
11756
  R.warn("grantRoles: externalId not found in cache", e);
11632
11757
  return;
11633
11758
  }
11634
- return Fs(r, Z.getDeviceIdx(e), t, n);
11759
+ return Rs(r, Z.getDeviceIdx(e), t, n);
11635
11760
  }
11636
- async function Fs(e, t, n, r = !1) {
11761
+ async function Rs(e, t, n, r = !1) {
11637
11762
  let i = Q.current();
11638
11763
  i && await i.grantRoles(j.composeParticipantId(e, A.USER, t), n, r);
11639
11764
  }
11640
- async function Is({ externalId: e = null, muteStates: t, requestedMedia: n = [], roomId: r = null }) {
11765
+ async function zs({ externalId: e = null, muteStates: t, requestedMedia: n = [], roomId: r = null }) {
11641
11766
  let i = null;
11642
- return e && (i = $.getCachedRawOkIdByExternalId(e), i || R.warn("muteParticipant: externalId not found in cache", e)), Ls({
11767
+ return e && (i = $.getCachedRawOkIdByExternalId(e), i || R.warn("muteParticipant: externalId not found in cache", e)), Bs({
11643
11768
  uid: i,
11644
11769
  muteStates: t,
11645
11770
  requestedMedia: n,
@@ -11647,75 +11772,75 @@ async function Is({ externalId: e = null, muteStates: t, requestedMedia: n = [],
11647
11772
  roomId: r
11648
11773
  });
11649
11774
  }
11650
- async function Ls({ uid: e = null, muteStates: t, requestedMedia: n = [], deviceIdx: r = 0, roomId: i = null }) {
11775
+ async function Bs({ uid: e = null, muteStates: t, requestedMedia: n = [], deviceIdx: r = 0, roomId: i = null }) {
11651
11776
  let a = Q.current();
11652
11777
  if (a) {
11653
11778
  let o = e ? j.composeParticipantId(e, A.USER, r) : null;
11654
11779
  await a.muteParticipant(o, t, n, i);
11655
11780
  }
11656
11781
  }
11657
- async function Rs(e, t = !1, n = null) {
11782
+ async function Vs(e, t = !1, n = null) {
11658
11783
  let r = $.getCachedRawOkIdByExternalId(e);
11659
11784
  if (!r) {
11660
11785
  R.warn("pinParticipant: externalId not found in cache", e);
11661
11786
  return;
11662
11787
  }
11663
- return zs(r, t, Z.getDeviceIdx(e), n);
11788
+ return Hs(r, t, Z.getDeviceIdx(e), n);
11664
11789
  }
11665
- async function zs(e, t = !1, n = 0, r = null) {
11790
+ async function Hs(e, t = !1, n = 0, r = null) {
11666
11791
  let i = Q.current();
11667
11792
  i && await i.pinParticipant(j.composeParticipantId(e, A.USER, n), t, r);
11668
11793
  }
11669
- async function Bs(e) {
11794
+ async function Us(e) {
11670
11795
  let t = Q.current();
11671
11796
  t && await t.updateMediaModifiers(e);
11672
11797
  }
11673
- async function Vs(e) {
11798
+ async function Ws(e) {
11674
11799
  let t = Q.current();
11675
11800
  t && await t.enableVideoSuspend(e);
11676
11801
  }
11677
- async function Hs(e) {
11802
+ async function Gs(e) {
11678
11803
  let t = Q.current();
11679
11804
  t && await t.enableVideoSuspendSuggest(e);
11680
11805
  }
11681
- async function Us(e) {
11806
+ async function Ks(e) {
11682
11807
  let t = Q.current();
11683
11808
  t && await t.changeOptions(e);
11684
11809
  }
11685
- async function Ws(e, t = null) {
11810
+ async function qs(e, t = null) {
11686
11811
  let n = null;
11687
- return t && (n = $.getCachedRawOkIdByExternalId(t), n || R.warn("chatMessage: externalId not found in cache", t)), Gs(e, n);
11812
+ return t && (n = $.getCachedRawOkIdByExternalId(t), n || R.warn("chatMessage: externalId not found in cache", t)), Js(e, n);
11688
11813
  }
11689
- async function Gs(e, t = null) {
11814
+ async function Js(e, t = null) {
11690
11815
  let n = Q.current();
11691
11816
  if (n) {
11692
11817
  let r = t ? j.composeUserId(t) : null;
11693
11818
  await n.chatMessage(e, r);
11694
11819
  }
11695
11820
  }
11696
- async function Ks(e = 10) {
11821
+ async function Ys(e = 10) {
11697
11822
  let t = Q.current();
11698
11823
  if (t) return t.chatHistory(e);
11699
11824
  }
11700
- async function qs(e, t = null) {
11825
+ async function Xs(e, t = null) {
11701
11826
  let n = null;
11702
- return t && (n = $.getCachedRawOkIdByExternalId(t), n || R.warn("customData: externalId not found in cache", t)), Js(e, n, Z.getDeviceIdx(t));
11827
+ return t && (n = $.getCachedRawOkIdByExternalId(t), n || R.warn("customData: externalId not found in cache", t)), Zs(e, n, Z.getDeviceIdx(t));
11703
11828
  }
11704
- async function Js(e, t = null, n = 0) {
11829
+ async function Zs(e, t = null, n = 0) {
11705
11830
  let r = Q.current();
11706
11831
  if (r) {
11707
11832
  let i = t ? j.composeParticipantId(t, A.USER, n) : null;
11708
11833
  await r.customData(e, i);
11709
11834
  }
11710
11835
  }
11711
- async function Ys(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, waitForAdmin: r = !1, closedConversation: i = !1 } = {}, a) {
11836
+ async function Qs(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, waitForAdmin: r = !1, closedConversation: i = !1 } = {}, a) {
11712
11837
  return (await $.createConversation(a ?? j.uuid(), e, t, {
11713
11838
  onlyAdminCanShareMovie: n,
11714
11839
  waitForAdmin: r,
11715
11840
  closedConversation: i
11716
11841
  })).join_link;
11717
11842
  }
11718
- async function Xs(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, audioOnly: r = !1 } = {}, i) {
11843
+ async function $s(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, audioOnly: r = !1 } = {}, i) {
11719
11844
  let a = i.map((e) => Z.fromId(e));
11720
11845
  return (await $.createConversation(j.uuid(), e, t, {
11721
11846
  onlyAdminCanShareMovie: n,
@@ -11723,53 +11848,53 @@ async function Xs(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, audioOnly: r
11723
11848
  audioOnly: r
11724
11849
  }, a)).join_link;
11725
11850
  }
11726
- async function Zs() {
11851
+ async function ec() {
11727
11852
  let e = Q.current();
11728
11853
  return e ? e.createJoinLink() : Promise.reject();
11729
11854
  }
11730
- async function Qs() {
11855
+ async function tc() {
11731
11856
  let e = Q.current();
11732
11857
  return e ? e.removeJoinLink() : Promise.reject();
11733
11858
  }
11734
- async function $s(e, t) {
11859
+ async function nc(e, t) {
11735
11860
  return $.getAnonymTokenByLink(e, t);
11736
11861
  }
11737
- function ec(e) {
11862
+ function rc(e) {
11738
11863
  let t = Q.current();
11739
11864
  t && t.setVolume(e);
11740
11865
  }
11741
- function tc(e) {
11866
+ function ic(e) {
11742
11867
  M.forceRelayPolicy = e;
11743
11868
  }
11744
- async function nc(e = !1, t = null, n = null, r = "DIRECT_LINK", i = null, a = null) {
11869
+ async function ac(e = !1, t = null, n = null, r = "DIRECT_LINK", i = null, a = null) {
11745
11870
  let o = Q.current();
11746
11871
  return o ? o.startStream(e, t, n, r, i, a) : Promise.reject();
11747
11872
  }
11748
- async function rc(e = null, t) {
11873
+ async function oc(e = null, t) {
11749
11874
  let n = Q.current();
11750
11875
  return n ? n.stopStream(e, t) : Promise.reject();
11751
11876
  }
11752
- async function ic(e = null) {
11877
+ async function sc(e = null) {
11753
11878
  let t = Q.current();
11754
11879
  return t ? t.publishStream(e) : Promise.reject();
11755
11880
  }
11756
- async function ac() {
11881
+ async function cc() {
11757
11882
  let e = Q.current();
11758
11883
  return e ? e.getStreamInfo() : Promise.reject();
11759
11884
  }
11760
- async function oc(e) {
11885
+ async function lc(e) {
11761
11886
  let t = Q.current();
11762
11887
  return t ? t.addMovie(e) : Promise.reject();
11763
11888
  }
11764
- async function sc(e) {
11889
+ async function uc(e) {
11765
11890
  let t = Q.current();
11766
11891
  return t ? t.updateMovie(e) : Promise.reject();
11767
11892
  }
11768
- async function cc(e) {
11893
+ async function dc(e) {
11769
11894
  let t = Q.current();
11770
11895
  return t ? t.removeMovie(e) : Promise.reject();
11771
11896
  }
11772
- async function lc(e, t) {
11897
+ async function fc(e, t) {
11773
11898
  let n = Q.current();
11774
11899
  if (n) {
11775
11900
  let r = [];
@@ -11794,11 +11919,11 @@ async function lc(e, t) {
11794
11919
  }
11795
11920
  return Promise.reject();
11796
11921
  }
11797
- async function uc(e, t) {
11922
+ async function pc(e, t) {
11798
11923
  let n = Q.current();
11799
11924
  return n ? n.activateRooms(e, t) : Promise.reject();
11800
11925
  }
11801
- async function dc(e = null, t = null) {
11926
+ async function mc(e = null, t = null) {
11802
11927
  let n = Q.current();
11803
11928
  if (!n) return Promise.reject();
11804
11929
  let r;
@@ -11813,30 +11938,30 @@ async function dc(e = null, t = null) {
11813
11938
  }
11814
11939
  return n.switchRoom(e, r);
11815
11940
  }
11816
- async function fc(e) {
11941
+ async function hc(e) {
11817
11942
  let t = Q.current();
11818
11943
  return t ? t.removeRooms(e) : Promise.reject();
11819
11944
  }
11820
- function pc(e) {
11945
+ function gc(e) {
11821
11946
  M.statisticsInterval = e;
11822
11947
  let t = Q.current();
11823
11948
  if (t) return t.updateStatisticsInterval();
11824
11949
  }
11825
- function mc(t) {
11950
+ function _c(t) {
11826
11951
  e.disableLog(!t), R.toggle(t);
11827
11952
  }
11828
- function hc(e, ...t) {
11953
+ function vc(e, ...t) {
11829
11954
  M.debugLog && R.send(e, "[external]", ...t);
11830
11955
  }
11831
- var gc = {
11832
- list: Ne,
11833
- get: Pe,
11834
- getJson: Fe,
11835
- download: Ie,
11836
- clear: Le,
11837
- stats: Re
11956
+ var yc = {
11957
+ list: Pe,
11958
+ get: Fe,
11959
+ getJson: Ie,
11960
+ download: Le,
11961
+ clear: Re,
11962
+ stats: ze
11838
11963
  };
11839
- function _c() {
11964
+ function bc() {
11840
11965
  let e = [
11841
11966
  [`Calls SDK ${M.sdkVersion}`, M.toJSON()],
11842
11967
  ["UserAgent:", navigator.userAgent],
@@ -11853,31 +11978,31 @@ function _c() {
11853
11978
  d: e
11854
11979
  }));
11855
11980
  }
11856
- async function vc() {
11981
+ async function xc() {
11857
11982
  let e = Q.id(), t = Q.debugSessionId();
11858
11983
  if (!t || !e) throw R.error("[uploadDebugLogs]", "No conversation id found"), Error("No conversation id found");
11859
- let n = await Pe({ sessionId: t });
11984
+ let n = await Fe({ sessionId: t });
11860
11985
  if (n.length === 0) throw R.error("[uploadDebugLogs]", "No logs found"), Error("No logs found");
11861
11986
  let r = n[0].t, i = n[n.length - 1].t;
11862
11987
  try {
11863
- return $?.uploadDebugLogs(e, r, i, JSON.stringify([..._c(), ...n]));
11988
+ return $?.uploadDebugLogs(e, r, i, JSON.stringify([...bc(), ...n]));
11864
11989
  } catch (e) {
11865
11990
  throw R.error("[uploadDebugLogs]", "Error while uploading logs", e), Error("Error while uploading logs", { cause: e });
11866
11991
  }
11867
11992
  }
11868
- async function yc(e) {
11993
+ async function Sc(e) {
11869
11994
  let t = Q.current();
11870
11995
  if (t) return t.videoEffect(e);
11871
11996
  }
11872
- async function bc(e, t) {
11997
+ async function Cc(e, t) {
11873
11998
  let n = Q.current();
11874
11999
  if (n) return n.audioEffect(e.length > 0 ? e : null, t);
11875
12000
  }
11876
- async function xc(e) {
12001
+ async function wc(e) {
11877
12002
  let t = Q.current();
11878
12003
  t && await t.setAudioStream(e);
11879
12004
  }
11880
- async function Sc(e, t = null, n = null) {
12005
+ async function Tc(e, t = null, n = null) {
11881
12006
  let r = Q.current();
11882
12007
  if (!r) return;
11883
12008
  let i = n ?? t?.id, a = null;
@@ -11888,18 +12013,18 @@ async function Sc(e, t = null, n = null) {
11888
12013
  }
11889
12014
  r.setAnimojiSvg(e, a, i);
11890
12015
  }
11891
- function Cc(e) {
12016
+ function Ec(e) {
11892
12017
  let t = Q.current();
11893
12018
  t && t.setAnimojiFill(e);
11894
12019
  }
11895
- async function wc(e = null, t, n = !1) {
11896
- return Ic().getWaitingHall(e, t, n);
12020
+ async function Dc(e = null, t, n = !1) {
12021
+ return zc().getWaitingHall(e, t, n);
11897
12022
  }
11898
- async function Tc() {
11899
- return Ic().getAudienceModeHands();
12023
+ async function Oc() {
12024
+ return zc().getAudienceModeHands();
11900
12025
  }
11901
- async function Ec(e, t = !1) {
11902
- let n = Ic(), r;
12026
+ async function kc(e, t = !1) {
12027
+ let n = zc(), r;
11903
12028
  if (e) {
11904
12029
  let t = $.getCachedRawOkIdByExternalId(e);
11905
12030
  if (!t) {
@@ -11910,74 +12035,74 @@ async function Ec(e, t = !1) {
11910
12035
  }
11911
12036
  return n.promoteParticipant(r, t);
11912
12037
  }
11913
- async function Dc(e = !1) {
11914
- return Ic().requestPromotion(e);
12038
+ async function Ac(e = !1) {
12039
+ return zc().requestPromotion(e);
11915
12040
  }
11916
- async function Oc(e = !1) {
11917
- return Ic().acceptPromotion(e);
12041
+ async function jc(e = !1) {
12042
+ return zc().acceptPromotion(e);
11918
12043
  }
11919
- async function kc(e) {
11920
- return Ic().getParticipantListChunk(e);
12044
+ async function Mc(e) {
12045
+ return zc().getParticipantListChunk(e);
11921
12046
  }
11922
- async function Ac(e) {
11923
- return Ic().getParticipants(e);
12047
+ async function Nc(e) {
12048
+ return zc().getParticipants(e);
11924
12049
  }
11925
- async function jc(e) {
11926
- return Ic().feedback(e);
12050
+ async function Pc(e) {
12051
+ return zc().feedback(e);
11927
12052
  }
11928
- function Mc(e, t, n) {
11929
- return Ic().userFeedbackStats(e, t, n);
12053
+ function Fc(e, t, n) {
12054
+ return zc().userFeedbackStats(e, t, n);
11930
12055
  }
11931
- function Nc(e, t = {}, n = !1) {
12056
+ function Ic(e, t = {}, n = !1) {
11932
12057
  let r = Q.current();
11933
12058
  r && r.sendClientEvent(e, t, n);
11934
12059
  }
11935
- async function Pc(e, t, n) {
11936
- return Ic(n).enableFeatureForRoles(e, t);
12060
+ async function Lc(e, t, n) {
12061
+ return zc(n).enableFeatureForRoles(e, t);
11937
12062
  }
11938
- function Fc(e) {
12063
+ function Rc(e) {
11939
12064
  return e ? z.get(e) ?? null : Q.current() ?? z.getFirstHeld();
11940
12065
  }
11941
- function Ic(e) {
11942
- let t = Fc(e);
12066
+ function zc(e) {
12067
+ let t = Rc(e);
11943
12068
  if (!t) throw Error("Conversation not found");
11944
12069
  return t;
11945
12070
  }
11946
- async function Lc(e) {
12071
+ async function Bc(e) {
11947
12072
  await $.removeHistoryRecords(e);
11948
12073
  }
11949
- async function Rc(e) {
12074
+ async function Vc(e) {
11950
12075
  let t = Q.current();
11951
12076
  t && await t.startAsr(e);
11952
12077
  }
11953
- async function zc(e) {
12078
+ async function Hc(e) {
11954
12079
  let t = Q.current();
11955
12080
  t && await t.stopAsr(e);
11956
12081
  }
11957
- async function Bc(e) {
12082
+ async function Uc(e) {
11958
12083
  let t = Q.current();
11959
12084
  t && await t.requestAsr(e);
11960
12085
  }
11961
- async function Vc(e) {
12086
+ async function Wc(e) {
11962
12087
  let t = Q.current();
11963
12088
  return t ? t.startUrlSharing(e) : Promise.reject();
11964
12089
  }
11965
- async function Hc() {
12090
+ async function Gc() {
11966
12091
  let e = Q.current();
11967
12092
  return e ? e.stopUrlSharing() : Promise.reject();
11968
12093
  }
11969
- async function Uc(e) {
12094
+ async function Kc(e) {
11970
12095
  await z.switchCall(e);
11971
12096
  }
11972
- function Wc() {
12097
+ function qc() {
11973
12098
  return z.getActiveId();
11974
12099
  }
11975
- function Gc() {
12100
+ function Jc() {
11976
12101
  return Q.getSyncedTime();
11977
12102
  }
11978
- function Kc() {
12103
+ function Yc() {
11979
12104
  return M.sdkVersion;
11980
12105
  }
11981
12106
  typeof window < "u" && (window.__CALLS_SDK = mn);
11982
12107
  //#endregion
11983
- 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 };
12108
+ export { Jo as Api, es as ApiExternal, $o as ArrayDequeue, v 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, b as FatalError, O as HangupReason, D as HangupType, x as MediaOption, k as MediaTrackKind, V as MediaType, Pa as MuteState, X as ParticipantState, Qo as ParticipantStateDataValue, N as ParticipantStatus, Zo 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, hs as acceptCall, jc as acceptPromotion, pc as activateRooms, lc as addMovie, xs as addParticipant, Ss as addParticipantInternal, ms as authorize, ns as browser, ds as callInternal, us as callTo, Es as captureScreen, Ds as captureVmoji, Cc as changeAudioEffect, Ks as changeConversationOptions, Ts as changeDevice, Ns as changeParticipantState, Ms as changePriorities, Sc as changeVideoEffect, Ys as chatHistory, qs as chatMessage, Js as chatMessageInternal, ec as createJoinLink, Xs as customData, Zs as customDataInternal, _c as debug, yc as debugLogs, vc as debugMessage, gs as declineCall, Lc as enableFeatureForRoles, Ws as enableVideoSuspend, Gs as enableVideoSuspendSuggest, Pc as feedback, ic as forceRelayPolicy, qc as getActiveCallId, nc as getAnonymTokenByLink, Oc as getAudienceModeHands, Mc as getParticipantListChunk, Nc as getParticipants, cc as getStreamInfo, Jc as getSyncedTime, Dc as getWaitingHall, Ls as grantRoles, Rs as grantRolesInternal, bs as hangup, ls as init, _s as joinCall, ys as joinCallByLink, vs as joinCallInternal, Ic as logClientEvent, zs as muteParticipant, Bs as muteParticipantInternal, Vs as pinParticipant, Hs as pinParticipantInternal, fs as processPush, ps as processPushInternal, kc as promoteParticipant, sc as publishStream, Ps as putHandsDown, Bc as removeHistoryRecords, tc as removeJoinLink, dc as removeMovie, Cs as removeParticipant, ws as removeParticipantInternal, hc as removeRooms, Uc as requestAsr, Is as requestDisplayLayout, Ac as requestPromotion, os as setAudioEffects, wc as setAudioStream, js as setLocalResolution, is as setLogger, Us as setMediaModifiers, gc as setStatisticsInterval, ss as setVad, as as setVideoEffects, Os as setVideoStream, cs as setVmoji, Ec as setVmojiFill, Tc as setVmojiSvg, rc as setVolume, Vc as startAsr, $s as startAudienceConversation, Qs as startConversation, ac as startStream, Wc as startUrlSharing, Hc as stopAsr, oc as stopStream, Gc as stopUrlSharing, Kc as switchCall, mc as switchRoom, As as toggleLocalAudio, ks as toggleLocalVideo, Fs as updateDisplayLayout, uc as updateMovie, fc as updateRooms, xc as uploadDebugLogs, Fc as userFeedbackStats, rs as utils, Yc as version };