@16x/webphone-sdk 3.1.3 → 3.1.5

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.
@@ -1,5 +1,5 @@
1
1
  import { i as e, t } from "./SharedWorkerProtocol-DKVQ5-po.js";
2
- import { r as n, t as r } from "./Diagnostics-BRfc_7re.js";
2
+ import { r as n, t as r } from "./Diagnostics-DdxaOkkw.js";
3
3
  //#region src/events/TypedEventBus.ts
4
4
  var i = class {
5
5
  handlers = /* @__PURE__ */ new Map();
@@ -282,7 +282,7 @@ var c = class extends e {
282
282
  retryable: !1
283
283
  };
284
284
  }
285
- }, m = [
285
+ }, ee = [
286
286
  "progress",
287
287
  "accepted",
288
288
  "confirmed",
@@ -290,7 +290,7 @@ var c = class extends e {
290
290
  "failed",
291
291
  "hold",
292
292
  "unhold"
293
- ], h = 3e4, g = class {
293
+ ], m = 3e4, h = class {
294
294
  options;
295
295
  currentState = "new";
296
296
  sessionUnsubscribers = [];
@@ -306,7 +306,7 @@ var c = class extends e {
306
306
  constructor(t) {
307
307
  this.options = t, this.id = t.id, this.destination = t.destination, this.platform = t.platform, this.capabilities = t.capabilities ?? /* @__PURE__ */ new Set();
308
308
  try {
309
- m.forEach((e) => {
309
+ ee.forEach((e) => {
310
310
  this.sessionUnsubscribers.push(t.session.on(e, (t) => this.handleSessionEvent(e, t)));
311
311
  });
312
312
  } catch (n) {
@@ -336,8 +336,7 @@ var c = class extends e {
336
336
  this.assertNotDisposed(), this.assertOwner(e), this.assertMediaControlAllowed(), this.assertCapability("mute"), this.invoke(() => this.options.session.unmute());
337
337
  }
338
338
  async answer(e, t) {
339
- if (this.assertNotDisposed(), this.assertOwner(t), this.assertIncomingCall(), this.platform === "mobile-web") throw this.capabilityError();
340
- this.assertCapability("inbound"), this.assertIncomingOperationAvailable(), this.incomingOperation = "answer";
339
+ this.assertNotDisposed(), this.assertOwner(t), this.assertIncomingCall(), this.assertCapability("inbound"), this.assertIncomingOperationAvailable(), this.incomingOperation = "answer";
341
340
  try {
342
341
  this.options.session.answer(e);
343
342
  } catch (e) {
@@ -367,11 +366,11 @@ var c = class extends e {
367
366
  this.assertState("active"), this.assertCapability("dtmf"), this.invoke(() => this.options.session.sendDtmf(e));
368
367
  }
369
368
  async transfer(e, t) {
370
- if (this.assertNotDisposed(), this.assertOwner(t), this.assertTransferCapability(), this.assertState("active"), this.assertCapability("blind_transfer"), !v(e) || e.target.trim() === "") throw this.operationError();
369
+ if (this.assertNotDisposed(), this.assertOwner(t), this.assertTransferCapability(), this.assertState("active"), this.assertCapability("blind_transfer"), !te(e) || e.target.trim() === "") throw this.operationError();
371
370
  this.invoke(() => this.options.session.refer(e.target.trim()));
372
371
  }
373
372
  async hangup(e) {
374
- if (this.assertNotDisposed(), this.assertOwner(e), _(this.currentState)) throw this.operationError();
373
+ if (this.assertNotDisposed(), this.assertOwner(e), g(this.currentState)) throw this.operationError();
375
374
  try {
376
375
  this.options.session.terminate(), this.transitionTo("ended");
377
376
  } catch (e) {
@@ -401,7 +400,7 @@ var c = class extends e {
401
400
  }
402
401
  dispose() {
403
402
  if (!this.disposed) {
404
- if (this.rejectPendingOperation(), this.incomingOperation = void 0, this.disposed = !0, !_(this.currentState)) try {
403
+ if (this.rejectPendingOperation(), this.incomingOperation = void 0, this.disposed = !0, !g(this.currentState)) try {
405
404
  this.options.session.terminate();
406
405
  } catch (e) {
407
406
  this.reportOperationError(e);
@@ -413,7 +412,7 @@ var c = class extends e {
413
412
  }
414
413
  }
415
414
  handleSessionEvent(e, t) {
416
- if ((e === "accepted" || e === "confirmed" || e === "ended" || e === "failed") && (this.incomingOperation = void 0), !(this.disposed || _(this.currentState))) switch (e) {
415
+ if ((e === "accepted" || e === "confirmed" || e === "ended" || e === "failed") && (this.incomingOperation = void 0), !(this.disposed || g(this.currentState))) switch (e) {
417
416
  case "progress":
418
417
  this.transitionIfAllowed("ringing", t, e);
419
418
  break;
@@ -448,7 +447,7 @@ var c = class extends e {
448
447
  if (this.currentState === e) return;
449
448
  if (!o(this.currentState, e)) throw this.operationError();
450
449
  let n = this.currentState;
451
- this.currentState = e, _(e) && this.rejectPendingOperation();
450
+ this.currentState = e, g(e) && this.rejectPendingOperation();
452
451
  try {
453
452
  this.options.onStateChanged?.({
454
453
  callId: this.id,
@@ -456,7 +455,7 @@ var c = class extends e {
456
455
  to: e
457
456
  }, t);
458
457
  } catch {} finally {
459
- _(e) && this.dispose();
458
+ g(e) && this.dispose();
460
459
  }
461
460
  }
462
461
  startPendingOperation(e, t, n) {
@@ -468,7 +467,7 @@ var c = class extends e {
468
467
  resolve: r,
469
468
  reject: i
470
469
  };
471
- this.pendingOperation = a, a.timer = setTimeout(() => this.timeoutPendingOperation(a), h);
470
+ this.pendingOperation = a, a.timer = setTimeout(() => this.timeoutPendingOperation(a), m);
472
471
  let o;
473
472
  try {
474
473
  o = n();
@@ -481,7 +480,7 @@ var c = class extends e {
481
480
  }
482
481
  resolvePendingOperation(e) {
483
482
  if (this.pendingOperation === e) {
484
- if (this.clearPendingTimer(e), this.pendingOperation = void 0, this.disposed || _(this.currentState)) {
483
+ if (this.clearPendingTimer(e), this.pendingOperation = void 0, this.disposed || g(this.currentState)) {
485
484
  e.reject(this.operationError());
486
485
  return;
487
486
  }
@@ -580,22 +579,32 @@ var c = class extends e {
580
579
  });
581
580
  }
582
581
  };
583
- function _(e) {
582
+ function g(e) {
584
583
  return e === "ended" || e === "failed";
585
584
  }
586
- function v(e) {
585
+ function te(e) {
587
586
  return typeof e == "object" && !!e && e.type === "blind" && typeof e.target == "string";
588
587
  }
589
588
  //#endregion
590
589
  //#region src/core/callId.ts
591
- var y = 0;
592
- function b() {
593
- return y += 1, `call_${Date.now().toString(36)}_${y.toString(36)}`;
590
+ var _ = 0;
591
+ function v() {
592
+ return _ += 1, `call_${Date.now().toString(36)}_${_.toString(36)}`;
593
+ }
594
+ //#endregion
595
+ //#region src/core/userData.ts
596
+ var ne = "X-User-Data", re = /[^\x20-\x7E]/, y = "userdata 只能是可见 ASCII(不能有换行/制表/中文):换行会构成 SIP 头注入;要传中文或 JSON 请调用方先 encodeURIComponent / base64,再在平台侧解回来";
597
+ function b(t) {
598
+ if (typeof t != "string") return [];
599
+ let n = t.trim();
600
+ if (n === "") return [];
601
+ if (re.test(n)) throw new e("CALL_INVALID_USERDATA", "call", !1, { cause: y });
602
+ return [`${ne}: ${n}`];
594
603
  }
595
604
  //#endregion
596
605
  //#region src/core/CallManager.ts
597
606
  var x = class {
598
- events = new ee();
607
+ events = new ie();
599
608
  calls = /* @__PURE__ */ new Map();
600
609
  options;
601
610
  incomingUnsubscribe;
@@ -628,53 +637,54 @@ var x = class {
628
637
  this.assertNotDisposed();
629
638
  let r = this.operationGeneration, i = t.destination.trim();
630
639
  if (i === "") throw new e("CALL_INVALID_DESTINATION", "call", !1);
640
+ let a = b(t.userdata);
631
641
  this.requireCapability(n, "outbound");
632
- let a = this.callLimit(n);
633
- if (this.options.platform === "mobile-web" && this.calls.size + this.pendingDialCount >= a) throw this.capabilityError();
634
- if (this.calls.size + this.pendingDialCount >= a || this.pendingDestinations.has(i) || [...this.calls.values()].some((e) => e.destination === i)) throw new e("CALL_ALREADY_EXISTS", "call", !1);
642
+ let o = this.callLimit(n);
643
+ if (this.options.platform === "mobile-web" && this.calls.size + this.pendingDialCount >= o) throw this.capabilityError();
644
+ if (this.calls.size + this.pendingDialCount >= o || this.pendingDestinations.has(i) || [...this.calls.values()].some((e) => e.destination === i)) throw new e("CALL_ALREADY_EXISTS", "call", !1);
635
645
  this.pendingDialCount += 1, this.pendingDestinations.add(i);
636
- let o = b(), s;
646
+ let s = v(), c;
637
647
  try {
638
- s = await this.holdActiveCallForNewCall(), this.assertGeneration(r, o);
648
+ c = await this.holdActiveCallForNewCall(), this.assertGeneration(r, s);
639
649
  let e;
640
650
  try {
641
- e = this.options.sip.dial(i, this.dialOptions(o, n, t.type));
651
+ e = this.options.sip.dial(i, this.dialOptions(s, n, t.type, a));
642
652
  } catch (e) {
643
- throw this.dialError(e, o);
653
+ throw this.dialError(e, s);
644
654
  }
645
- this.assertGeneration(r, o);
646
- let a;
655
+ this.assertGeneration(r, s);
656
+ let o;
647
657
  try {
648
- a = new g({
649
- id: o,
658
+ o = new h({
659
+ id: s,
650
660
  destination: i,
651
661
  platform: this.options.platform,
652
662
  capabilities: this.effectiveCapabilities(n),
653
663
  session: e,
654
- onStateChanged: (e, t) => this.handleStateChanged(a, e, t),
664
+ onStateChanged: (e, t) => this.handleStateChanged(o, e, t),
655
665
  onError: (e) => this.events.emit("error", { error: e }),
656
- onDisposed: () => this.handleDisposed(a)
666
+ onDisposed: () => this.handleDisposed(o)
657
667
  });
658
668
  } catch (e) {
659
- throw this.dialError(e, o);
669
+ throw this.dialError(e, s);
660
670
  }
661
- if (!this.isCurrentGeneration(r)) throw a.dispose(), this.callOperationError(a.id);
662
- this.calls.set(a.id, a), this.callSessions.set(a.id, e), this.options.onCallCreated?.(a.id, e);
671
+ if (!this.isCurrentGeneration(r)) throw o.dispose(), this.callOperationError(o.id);
672
+ this.calls.set(o.id, o), this.callSessions.set(o.id, e), this.options.onCallCreated?.(o.id, e);
663
673
  try {
664
- a.beginOutbound();
674
+ o.beginOutbound();
665
675
  } catch (e) {
666
- throw a.dispose(), this.calls.delete(a.id), this.callSessions.delete(a.id), this.dialError(e, a.id);
676
+ throw o.dispose(), this.calls.delete(o.id), this.callSessions.delete(o.id), this.dialError(e, o.id);
667
677
  }
668
- if (!this.isCurrentGeneration(r)) throw a.dispose(), this.calls.delete(a.id), this.callSessions.delete(a.id), this.callOperationError(a.id);
678
+ if (!this.isCurrentGeneration(r)) throw o.dispose(), this.calls.delete(o.id), this.callSessions.delete(o.id), this.callOperationError(o.id);
669
679
  return this.events.emit("call.created", {
670
- callId: a.id,
671
- state: a.state
672
- }), a;
680
+ callId: o.id,
681
+ state: o.state
682
+ }), o;
673
683
  } catch (e) {
674
- if (this.isCurrentGeneration(r) && s !== void 0 && this.isManagedCall(s) && s.state === "held") try {
675
- await s.resume();
684
+ if (this.isCurrentGeneration(r) && c !== void 0 && this.isManagedCall(c) && c.state === "held") try {
685
+ await c.resume();
676
686
  } catch (t) {
677
- throw this.compensationError(s.id, void 0, e, t);
687
+ throw this.compensationError(c.id, void 0, e, t);
678
688
  }
679
689
  throw e;
680
690
  } finally {
@@ -684,7 +694,7 @@ var x = class {
684
694
  async answer(e, t, n, r) {
685
695
  this.assertNotDisposed();
686
696
  let i = this.requireCall(e);
687
- if (this.options.platform === "mobile-web") throw this.capabilityError(e);
697
+ if (this.options.platform === "mobile-web" && t.policy.mobileIncomingEnabled !== !0) throw this.capabilityError(e);
688
698
  let a = {
689
699
  iceServers: t.iceServers,
690
700
  pcConfig: { iceServers: t.iceServers },
@@ -827,10 +837,10 @@ var x = class {
827
837
  }
828
838
  t.to === "held" && this.activeCallId === e.id && this.automaticActiveTransition?.previous.id !== e.id && (this.activeCallId = null, this.events.emit("call.activeChanged", { callId: null })), (t.to === "ended" || t.to === "failed") && (this.calls.delete(e.id), this.callSessions.delete(e.id), this.callOwners.delete(e.id), this.ownerLostCalls.delete(e.id), this.activeCallId === e.id && this.automaticActiveTransition?.previous.id !== e.id && (this.activeCallId = null, this.events.emit("call.activeChanged", { callId: null })), this.notifyCallTerminal(e.id), t.to === "ended" ? this.events.emit("call.ended", {
829
839
  callId: e.id,
830
- reason: te(n)
840
+ reason: ae(n)
831
841
  }) : this.events.emit("call.failed", {
832
842
  callId: e.id,
833
- error: ne(n, e.id)
843
+ error: oe(n, e.id)
834
844
  }));
835
845
  }
836
846
  async switchAutomaticActiveCall(e, t, n) {
@@ -896,12 +906,7 @@ var x = class {
896
906
  }
897
907
  handleIncoming(t) {
898
908
  if (this.disposed) return;
899
- let n = b();
900
- if (this.options.platform === "mobile-web") {
901
- this.terminateUnsupportedIncoming(t), this.events.emit("error", { error: this.capabilityError(n) });
902
- return;
903
- }
904
- let r = this.incomingSessionSnapshot;
909
+ let n = v(), r = this.incomingSessionSnapshot;
905
910
  if (r === void 0 || !r.policy.incomingEnabled || !this.effectiveCapabilities(r).has("inbound")) {
906
911
  this.terminateUnsupportedIncoming(t), this.events.emit("error", { error: this.capabilityError(n) });
907
912
  return;
@@ -913,7 +918,7 @@ var x = class {
913
918
  }
914
919
  let a;
915
920
  try {
916
- a = new g({
921
+ a = new h({
917
922
  id: n,
918
923
  destination: i,
919
924
  platform: this.options.platform,
@@ -963,7 +968,7 @@ var x = class {
963
968
  }
964
969
  effectiveCapabilities(e) {
965
970
  let t = new Set(e.capabilities);
966
- return this.options.platform === "mobile-web" && (t.delete("inbound"), t.delete("hold"), t.delete("blind_transfer")), t;
971
+ return this.options.platform === "mobile-web" && (t.delete("hold"), t.delete("blind_transfer"), e.policy.mobileIncomingEnabled !== !0 && t.delete("inbound")), t;
967
972
  }
968
973
  requireCapability(e, t, n) {
969
974
  if (!this.effectiveCapabilities(e).has(t)) throw this.capabilityError(n);
@@ -1021,10 +1026,14 @@ var x = class {
1021
1026
  let t = this.options.platform === "mobile-web" ? 1 : 2, n = this.options.maxConcurrentCalls ?? t;
1022
1027
  return Math.min(t, Math.max(1, n), Math.max(1, e.policy.maxConcurrentCalls));
1023
1028
  }
1024
- dialOptions(e, t, n) {
1029
+ dialOptions(e, t, n, r = []) {
1025
1030
  return {
1026
1031
  iceServers: t.iceServers,
1027
- extraHeaders: [`X-XCall-Call-ID: ${e}`, `X-XCall-Session-ID: ${t.sessionId}`],
1032
+ extraHeaders: [
1033
+ `X-XCall-Call-ID: ${e}`,
1034
+ `X-XCall-Session-ID: ${t.sessionId}`,
1035
+ ...r
1036
+ ],
1028
1037
  ...n === void 0 ? {} : { type: n }
1029
1038
  };
1030
1039
  }
@@ -1038,7 +1047,7 @@ var x = class {
1038
1047
  cause: t
1039
1048
  });
1040
1049
  }
1041
- }, ee = class {
1050
+ }, ie = class {
1042
1051
  handlers = /* @__PURE__ */ new Map();
1043
1052
  on(e, t) {
1044
1053
  let n = this.handlers.get(e) ?? /* @__PURE__ */ new Set(), r = t;
@@ -1063,12 +1072,12 @@ var x = class {
1063
1072
  this.handlers.clear();
1064
1073
  }
1065
1074
  };
1066
- function te(e) {
1075
+ function ae(e) {
1067
1076
  if (typeof e != "object" || !e || !("reason" in e)) return "ended";
1068
1077
  let t = e.reason;
1069
1078
  return typeof t == "string" && t !== "" ? t : "ended";
1070
1079
  }
1071
- function ne(t, n) {
1080
+ function oe(t, n) {
1072
1081
  if (t instanceof e) return new e(t.code, t.category, t.retryable, {
1073
1082
  requestId: t.requestId,
1074
1083
  callId: n,
@@ -1093,7 +1102,7 @@ function ne(t, n) {
1093
1102
  }
1094
1103
  //#endregion
1095
1104
  //#region src/shared/SharedWorkerClient.ts
1096
- var S = class {
1105
+ var se = class {
1097
1106
  port;
1098
1107
  timeoutMs;
1099
1108
  pending = /* @__PURE__ */ new Map();
@@ -1130,13 +1139,13 @@ var S = class {
1130
1139
  try {
1131
1140
  let n = t(e);
1132
1141
  if (n.type === "event") {
1133
- n.event === "connection.stateChanged" && re(n.payload) && (this.lifecycleState = n.payload.state), this.eventHandlers.forEach((e) => e(n));
1142
+ n.event === "connection.stateChanged" && S(n.payload) && (this.lifecycleState = n.payload.state), this.eventHandlers.forEach((e) => e(n));
1134
1143
  return;
1135
1144
  }
1136
1145
  if (n.type !== "response") return;
1137
1146
  let r = this.pending.get(n.requestId);
1138
1147
  if (r === void 0) return;
1139
- this.pending.delete(n.requestId), clearTimeout(r.timer), n.ok ? r.resolve(n.result) : r.reject(C(n));
1148
+ this.pending.delete(n.requestId), clearTimeout(r.timer), n.ok ? r.resolve(n.result) : r.reject(ce(n));
1140
1149
  } catch (e) {
1141
1150
  this.pending.forEach((t) => {
1142
1151
  clearTimeout(t.timer), t.reject(e);
@@ -1144,10 +1153,10 @@ var S = class {
1144
1153
  }
1145
1154
  }
1146
1155
  };
1147
- function re(e) {
1156
+ function S(e) {
1148
1157
  return typeof e == "object" && !!e && "state" in e && (e.state === "connected" || e.state === "reconnecting");
1149
1158
  }
1150
- function C(t) {
1159
+ function ce(t) {
1151
1160
  let n = t.error;
1152
1161
  return new e(n?.code ?? "SDK_INTERNAL_ERROR", n?.category ?? "internal", n?.retryable ?? !1, {
1153
1162
  requestId: t.requestId,
@@ -1158,12 +1167,12 @@ function C(t) {
1158
1167
  }
1159
1168
  //#endregion
1160
1169
  //#region src/shared/SharedWorkerFactory.ts
1161
- function w(t = {}) {
1170
+ function C(t = {}) {
1162
1171
  if ((t.enabled ?? "auto") === !1) return {
1163
1172
  mode: "single-tab",
1164
1173
  reason: "disabled"
1165
1174
  };
1166
- let n = t.locationHref ?? E(), r = T(t.url, n), i = (n) => {
1175
+ let n = t.locationHref ?? T(), r = w(t.url, n), i = (n) => {
1167
1176
  if (t.fallback === "error") throw new e("CONFIG_INVALID", "configuration", !1, { cause: n });
1168
1177
  return {
1169
1178
  mode: "single-tab",
@@ -1171,8 +1180,8 @@ function w(t = {}) {
1171
1180
  };
1172
1181
  };
1173
1182
  if (r === void 0) return i("SharedWorker URL is unavailable");
1174
- if (!O(r, n)) return i("SharedWorker URL must be same-origin");
1175
- let a = t.workerCtor ?? D();
1183
+ if (!E(r, n)) return i("SharedWorker URL must be same-origin");
1184
+ let a = t.workerCtor ?? le();
1176
1185
  if (a === void 0) return i("SharedWorker is not supported");
1177
1186
  let o;
1178
1187
  try {
@@ -1180,10 +1189,10 @@ function w(t = {}) {
1180
1189
  } catch (e) {
1181
1190
  return i(`SharedWorker construction failed: ${e instanceof Error ? e.message : String(e)}`);
1182
1191
  }
1183
- let s = t.tabId ?? ie(), c = new S(o.port), l = {
1192
+ let s = t.tabId ?? D(), c = new se(o.port), l = {
1184
1193
  version: 1,
1185
1194
  type: "attach",
1186
- requestId: ae(),
1195
+ requestId: O(),
1187
1196
  tabId: s
1188
1197
  }, u = c.request(l).then(() => void 0).catch((e) => {
1189
1198
  throw c.close(), e;
@@ -1197,20 +1206,20 @@ function w(t = {}) {
1197
1206
  ready: u
1198
1207
  };
1199
1208
  }
1200
- function T(e, t = E()) {
1209
+ function w(e, t = T()) {
1201
1210
  try {
1202
1211
  return t === void 0 ? void 0 : new URL(e ?? "./shared-worker.js", t).toString();
1203
1212
  } catch {
1204
1213
  return;
1205
1214
  }
1206
1215
  }
1207
- function E() {
1216
+ function T() {
1208
1217
  return typeof location > "u" ? void 0 : location.href;
1209
1218
  }
1210
- function D() {
1219
+ function le() {
1211
1220
  if (typeof SharedWorker == "function") return SharedWorker;
1212
1221
  }
1213
- function O(e, t) {
1222
+ function E(e, t) {
1214
1223
  if (t === void 0) return !0;
1215
1224
  try {
1216
1225
  return new URL(e, t).origin === new URL(t).origin;
@@ -1218,15 +1227,15 @@ function O(e, t) {
1218
1227
  return !1;
1219
1228
  }
1220
1229
  }
1221
- function ie() {
1230
+ function D() {
1222
1231
  return `tab-${typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : Math.random().toString(36).slice(2)}`;
1223
1232
  }
1224
- function ae() {
1233
+ function O() {
1225
1234
  return `attach-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
1226
1235
  }
1227
1236
  //#endregion
1228
1237
  //#region src/media/DeviceManager.ts
1229
- var oe = class {
1238
+ var k = class {
1230
1239
  mediaDevices;
1231
1240
  createAudioElement;
1232
1241
  outputCapability;
@@ -1234,23 +1243,23 @@ var oe = class {
1234
1243
  outputGeneration = 0;
1235
1244
  outputTail;
1236
1245
  constructor(e = {}) {
1237
- this.mediaDevices = e.mediaDevices === null ? void 0 : e.mediaDevices ?? k(), this.createAudioElement = e.createAudioElement;
1246
+ this.mediaDevices = e.mediaDevices === null ? void 0 : e.mediaDevices ?? A(), this.createAudioElement = e.createAudioElement;
1238
1247
  }
1239
1248
  async requestPermission(e = {}) {
1240
1249
  let t = this.requireMediaDevices(), n;
1241
1250
  try {
1242
1251
  n = await t.getUserMedia({ audio: e });
1243
1252
  } catch (e) {
1244
- throw M(e);
1253
+ throw N(e);
1245
1254
  }
1246
- A(n);
1255
+ j(n);
1247
1256
  }
1248
1257
  async getDevices() {
1249
1258
  if (this.mediaDevices === void 0) return [];
1250
1259
  try {
1251
1260
  return (await this.mediaDevices.enumerateDevices()).filter((e) => e.kind === "audioinput" || e.kind === "audiooutput" && this.supportsOutputSelection());
1252
1261
  } catch (e) {
1253
- throw N(e);
1262
+ throw P(e);
1254
1263
  }
1255
1264
  }
1256
1265
  getCapabilities() {
@@ -1288,7 +1297,7 @@ var oe = class {
1288
1297
  try {
1289
1298
  await r.setSinkId(t);
1290
1299
  } catch (e) {
1291
- throw P(e);
1300
+ throw F(e);
1292
1301
  }
1293
1302
  }
1294
1303
  enqueueOutput(e) {
@@ -1302,7 +1311,7 @@ var oe = class {
1302
1311
  try {
1303
1312
  return await t.getUserMedia({ audio: { deviceId: { exact: e } } });
1304
1313
  } catch (e) {
1305
- throw j(e);
1314
+ throw M(e);
1306
1315
  }
1307
1316
  }
1308
1317
  requireMediaDevices() {
@@ -1322,10 +1331,10 @@ var oe = class {
1322
1331
  }
1323
1332
  }
1324
1333
  };
1325
- function k() {
1334
+ function A() {
1326
1335
  return globalThis.navigator?.mediaDevices;
1327
1336
  }
1328
- function A(e) {
1337
+ function j(e) {
1329
1338
  let t;
1330
1339
  try {
1331
1340
  t = e.getTracks();
@@ -1338,57 +1347,57 @@ function A(e) {
1338
1347
  } catch {}
1339
1348
  });
1340
1349
  }
1341
- function j(t) {
1342
- let n = F(t);
1343
- return n === "NotFoundError" || n === "OverconstrainedError" ? new e("MEDIA_DEVICE_NOT_FOUND", "media", !1, { cause: t }) : n === "NotReadableError" || n === "AbortError" ? new e("MEDIA_DEVICE_IN_USE", "media", !0, { cause: t }) : n === "NotAllowedError" || n === "SecurityError" ? new e("MEDIA_PERMISSION_DENIED", "media", !1, { cause: t }) : new e("SDK_INTERNAL_ERROR", "internal", !1, { cause: t });
1344
- }
1345
1350
  function M(t) {
1346
- let n = F(t);
1351
+ let n = I(t);
1347
1352
  return n === "NotFoundError" || n === "OverconstrainedError" ? new e("MEDIA_DEVICE_NOT_FOUND", "media", !1, { cause: t }) : n === "NotReadableError" || n === "AbortError" ? new e("MEDIA_DEVICE_IN_USE", "media", !0, { cause: t }) : n === "NotAllowedError" || n === "SecurityError" ? new e("MEDIA_PERMISSION_DENIED", "media", !1, { cause: t }) : new e("SDK_INTERNAL_ERROR", "internal", !1, { cause: t });
1348
1353
  }
1349
1354
  function N(t) {
1350
- let n = F(t);
1351
- return n === "NotFoundError" ? new e("MEDIA_DEVICE_NOT_FOUND", "media", !1, { cause: t }) : n === "NotAllowedError" || n === "SecurityError" ? new e("MEDIA_PERMISSION_DENIED", "media", !1, { cause: t }) : n === "AbortError" || n === "NotReadableError" ? new e("MEDIA_DEVICE_IN_USE", "media", !0, { cause: t }) : new e("SDK_INTERNAL_ERROR", "internal", !1, { cause: t });
1355
+ let n = I(t);
1356
+ return n === "NotFoundError" || n === "OverconstrainedError" ? new e("MEDIA_DEVICE_NOT_FOUND", "media", !1, { cause: t }) : n === "NotReadableError" || n === "AbortError" ? new e("MEDIA_DEVICE_IN_USE", "media", !0, { cause: t }) : n === "NotAllowedError" || n === "SecurityError" ? new e("MEDIA_PERMISSION_DENIED", "media", !1, { cause: t }) : new e("SDK_INTERNAL_ERROR", "internal", !1, { cause: t });
1352
1357
  }
1353
1358
  function P(t) {
1354
- let n = F(t);
1359
+ let n = I(t);
1360
+ return n === "NotFoundError" ? new e("MEDIA_DEVICE_NOT_FOUND", "media", !1, { cause: t }) : n === "NotAllowedError" || n === "SecurityError" ? new e("MEDIA_PERMISSION_DENIED", "media", !1, { cause: t }) : n === "AbortError" || n === "NotReadableError" ? new e("MEDIA_DEVICE_IN_USE", "media", !0, { cause: t }) : new e("SDK_INTERNAL_ERROR", "internal", !1, { cause: t });
1361
+ }
1362
+ function F(t) {
1363
+ let n = I(t);
1355
1364
  return n === "NotFoundError" ? new e("MEDIA_DEVICE_NOT_FOUND", "media", !1, { cause: t }) : n === "NotAllowedError" || n === "SecurityError" ? new e("MEDIA_PERMISSION_DENIED", "media", !1, { cause: t }) : n === "AbortError" || n === "NotReadableError" ? new e("MEDIA_DEVICE_IN_USE", "media", !0, { cause: t }) : new e("SDK_INTERNAL_ERROR", "internal", !1, { cause: t });
1356
1365
  }
1357
- function F(e) {
1366
+ function I(e) {
1358
1367
  if (typeof e != "object" || !e || !("name" in e)) return;
1359
1368
  let t = e.name;
1360
1369
  return typeof t == "string" ? t : void 0;
1361
1370
  }
1362
1371
  //#endregion
1363
1372
  //#region src/media/RemoteAudio.ts
1364
- var I = class {
1373
+ var L = class {
1365
1374
  createAudioElement;
1366
1375
  bindings = /* @__PURE__ */ new Map();
1367
1376
  audioOwners = /* @__PURE__ */ new Map();
1368
1377
  trackOwners = /* @__PURE__ */ new Map();
1369
1378
  generations = /* @__PURE__ */ new Map();
1370
1379
  pendingPlays = /* @__PURE__ */ new Map();
1371
- constructor(e = L) {
1380
+ constructor(e = R) {
1372
1381
  this.createAudioElement = e;
1373
1382
  }
1374
1383
  async bind(t, n) {
1375
1384
  let r = this.bindings.get(t);
1376
1385
  if (r?.stream === n) return;
1377
- let i = R(t, n), a;
1386
+ let i = z(t, n), a;
1378
1387
  try {
1379
1388
  a = this.createAudioElement();
1380
1389
  } catch (n) {
1381
- throw z(i, this.trackOwners), new e("CAPABILITY_NOT_SUPPORTED", "capability", !1, {
1390
+ throw B(i, this.trackOwners), new e("CAPABILITY_NOT_SUPPORTED", "capability", !1, {
1382
1391
  callId: t,
1383
1392
  cause: n
1384
1393
  });
1385
1394
  }
1386
1395
  let o = this.audioOwners.get(a);
1387
- if (o !== void 0 && o !== t) throw z(i, this.trackOwners), new e("CALL_OPERATION_NOT_ALLOWED", "call", !1, { callId: t });
1396
+ if (o !== void 0 && o !== t) throw B(i, this.trackOwners), new e("CALL_OPERATION_NOT_ALLOWED", "call", !1, { callId: t });
1388
1397
  try {
1389
1398
  a.autoplay = !0, a.playsInline = !0;
1390
1399
  } catch (n) {
1391
- throw z(i, this.trackOwners), new e("SDK_INTERNAL_ERROR", "internal", !1, {
1400
+ throw B(i, this.trackOwners), new e("SDK_INTERNAL_ERROR", "internal", !1, {
1392
1401
  callId: t,
1393
1402
  cause: n
1394
1403
  });
@@ -1396,7 +1405,7 @@ var I = class {
1396
1405
  try {
1397
1406
  a.srcObject = n;
1398
1407
  } catch (n) {
1399
- throw z(i, this.trackOwners), new e("SDK_INTERNAL_ERROR", "internal", !1, {
1408
+ throw B(i, this.trackOwners), new e("SDK_INTERNAL_ERROR", "internal", !1, {
1400
1409
  callId: t,
1401
1410
  cause: n
1402
1411
  });
@@ -1472,7 +1481,7 @@ var I = class {
1472
1481
  releaseTrack(e) {
1473
1482
  let t = this.trackOwners.get(e);
1474
1483
  if (t === void 0 || t <= 1) {
1475
- this.trackOwners.delete(e), V(e);
1484
+ this.trackOwners.delete(e), H(e);
1476
1485
  return;
1477
1486
  }
1478
1487
  this.trackOwners.set(e, t - 1);
@@ -1495,42 +1504,42 @@ var I = class {
1495
1504
  return this.generations.get(e) === t && this.bindings.get(e)?.generation === t;
1496
1505
  }
1497
1506
  };
1498
- function L() {
1507
+ function R() {
1499
1508
  if (typeof document > "u") throw new e("CAPABILITY_NOT_SUPPORTED", "capability", !1);
1500
1509
  return document.createElement("audio");
1501
1510
  }
1502
- function R(t, n) {
1511
+ function z(t, n) {
1503
1512
  try {
1504
1513
  return [...new Set(n.getAudioTracks())].filter((e) => e.kind === "audio");
1505
1514
  } catch (r) {
1506
1515
  try {
1507
1516
  return [...new Set(n.getTracks())].filter((e) => e.kind === "audio");
1508
1517
  } catch (i) {
1509
- throw B(n), new e("SDK_INTERNAL_ERROR", "internal", !1, {
1518
+ throw V(n), new e("SDK_INTERNAL_ERROR", "internal", !1, {
1510
1519
  callId: t,
1511
1520
  cause: r ?? i
1512
1521
  });
1513
1522
  }
1514
1523
  }
1515
1524
  }
1516
- function z(e, t) {
1525
+ function B(e, t) {
1517
1526
  e.forEach((e) => {
1518
- (t.get(e) ?? 0) === 0 && V(e);
1527
+ (t.get(e) ?? 0) === 0 && H(e);
1519
1528
  });
1520
1529
  }
1521
- function B(e) {
1530
+ function V(e) {
1522
1531
  try {
1523
- [...new Set(e.getTracks())].filter((e) => e.kind === "audio").forEach(V);
1532
+ [...new Set(e.getTracks())].filter((e) => e.kind === "audio").forEach(H);
1524
1533
  } catch {}
1525
1534
  }
1526
- function V(e) {
1535
+ function H(e) {
1527
1536
  try {
1528
1537
  e.stop();
1529
1538
  } catch {}
1530
1539
  }
1531
1540
  //#endregion
1532
1541
  //#region src/media/MediaManager.ts
1533
- var H = class {
1542
+ var U = class {
1534
1543
  deviceManager;
1535
1544
  remoteAudio;
1536
1545
  getActiveCall;
@@ -1551,7 +1560,7 @@ var H = class {
1551
1560
  mediaDevices: e.mediaDevices,
1552
1561
  createAudioElement: e.createAudioElement
1553
1562
  };
1554
- this.deviceManager = new oe(t), this.remoteAudio = new I(e.createAudioElement), this.getActiveCall = e.getActiveCall, this.createRemoteStream = e.createRemoteStream ?? se;
1563
+ this.deviceManager = new k(t), this.remoteAudio = new L(e.createAudioElement), this.getActiveCall = e.getActiveCall, this.createRemoteStream = e.createRemoteStream ?? de;
1555
1564
  }
1556
1565
  requestPermission(e) {
1557
1566
  return this.assertNotDisposed(), this.deviceManager.requestPermission(e);
@@ -1571,7 +1580,7 @@ var H = class {
1571
1580
  n !== void 0 && this.releaseResource(n).catch((e) => {
1572
1581
  this.releaseErrors.set(n, e);
1573
1582
  });
1574
- let r = U(t) ? t : { peerConnection: t }, i = {
1583
+ let r = W(t) ? t : { peerConnection: t }, i = {
1575
1584
  callId: e,
1576
1585
  peerConnection: r.peerConnection,
1577
1586
  senders: /* @__PURE__ */ new Map(),
@@ -1653,7 +1662,7 @@ var H = class {
1653
1662
  this.remoteAudio.release(r), this.releaseErrors.delete(t), this.calls.get(r) === t && this.calls.delete(r), t.generation += 1, t.released = !0, this.unsubscribeTrackSource(t);
1654
1663
  let i = /* @__PURE__ */ new Set([...t.localTracks, ...t.pendingTracks]), a = [...t.senders.values()].filter((e) => e.audio).map((e) => ({
1655
1664
  senderResource: e,
1656
- promise: this.enqueueSender(t, e, () => G(e.sender), !0)
1665
+ promise: this.enqueueSender(t, e, () => K(e.sender), !0)
1657
1666
  })), o = Promise.all(a.map(async (e) => {
1658
1667
  try {
1659
1668
  return await e.promise, {
@@ -1671,11 +1680,11 @@ var H = class {
1671
1680
  if (n.forEach((e) => {
1672
1681
  if (e.cause !== void 0) {
1673
1682
  o.push(e.cause);
1674
- let t = W(e.senderResource.sender);
1683
+ let t = G(e.senderResource.sender);
1675
1684
  t?.kind === "audio" && a.add(t);
1676
1685
  return;
1677
1686
  }
1678
- let t = W(e.senderResource.sender);
1687
+ let t = G(e.senderResource.sender);
1679
1688
  t?.kind === "audio" && i.add(t);
1680
1689
  }), i.forEach((e) => {
1681
1690
  a.has(e) || J(e);
@@ -1686,7 +1695,7 @@ var H = class {
1686
1695
  if (!t.peerClosed && t.peerConnection.close !== void 0) try {
1687
1696
  await t.peerConnection.close(), t.peerClosed = !0;
1688
1697
  } catch (n) {
1689
- let i = [...t.senders.values()].map((e) => W(e.sender)).find((e) => e?.kind === "audio");
1698
+ let i = [...t.senders.values()].map((e) => G(e.sender)).find((e) => e?.kind === "audio");
1690
1699
  throw t.localTracks.clear(), t.pendingTracks.clear(), i != null && t.localTracks.add(i), new e("SDK_INTERNAL_ERROR", "internal", !0, {
1691
1700
  callId: r,
1692
1701
  cause: n
@@ -1754,11 +1763,11 @@ var H = class {
1754
1763
  }
1755
1764
  async performInputSwitch(t, n, r) {
1756
1765
  if (this.assertActiveCall(n), this.assertDeviceSelectionCapability(n), !this.isCurrentResource(r) || n.peerConnection !== r.peerConnection) throw this.callOperationError(n.callId);
1757
- let i = this.findAudioSender(r), a = W(i.sender), o = r.generation, s = await this.deviceManager.openInputStream(t), c;
1766
+ let i = this.findAudioSender(r), a = G(i.sender), o = r.generation, s = await this.deviceManager.openInputStream(t), c;
1758
1767
  try {
1759
1768
  c = s.getTracks();
1760
1769
  } catch (t) {
1761
- throw K(s), new e("SDK_INTERNAL_ERROR", "internal", !1, {
1770
+ throw ue(s), new e("SDK_INTERNAL_ERROR", "internal", !1, {
1762
1771
  callId: n.callId,
1763
1772
  cause: t
1764
1773
  });
@@ -1786,7 +1795,7 @@ var H = class {
1786
1795
  }
1787
1796
  if (!this.canCommitInputSwitch(n, r, i, u, o)) {
1788
1797
  if (!r.released) try {
1789
- await this.enqueueSender(r, i, () => W(i.sender) === u ? G(i.sender) : Promise.resolve()), c.forEach((e) => r.pendingTracks.delete(e)), r.pendingTracks.delete(u), q(c);
1798
+ await this.enqueueSender(r, i, () => G(i.sender) === u ? K(i.sender) : Promise.resolve()), c.forEach((e) => r.pendingTracks.delete(e)), r.pendingTracks.delete(u), q(c);
1790
1799
  } catch (t) {
1791
1800
  throw new e("SDK_INTERNAL_ERROR", "internal", !0, {
1792
1801
  callId: n.callId,
@@ -1819,7 +1828,7 @@ var H = class {
1819
1828
  });
1820
1829
  }
1821
1830
  r.forEach((r) => {
1822
- let i = W(r), a;
1831
+ let i = G(r), a;
1823
1832
  try {
1824
1833
  a = n?.(r) ?? r.senderKind ?? r.kind;
1825
1834
  } catch (n) {
@@ -1836,7 +1845,7 @@ var H = class {
1836
1845
  });
1837
1846
  }
1838
1847
  findAudioSender(e) {
1839
- let t = [...e.senders.values()].find((e) => e.audio && (W(e.sender)?.kind === "audio" || W(e.sender) === null));
1848
+ let t = [...e.senders.values()].find((e) => e.audio && (G(e.sender)?.kind === "audio" || G(e.sender) === null));
1840
1849
  if (t === void 0) throw this.capabilityError(e.callId);
1841
1850
  return t;
1842
1851
  }
@@ -1852,7 +1861,7 @@ var H = class {
1852
1861
  } catch {
1853
1862
  return !1;
1854
1863
  }
1855
- return W(n.sender) === r;
1864
+ return G(n.sender) === r;
1856
1865
  }
1857
1866
  enqueueSender(e, t, n, r = !1) {
1858
1867
  t.queue.pending += 1;
@@ -1881,7 +1890,7 @@ var H = class {
1881
1890
  });
1882
1891
  }
1883
1892
  async rollbackSender(e, t, n, r) {
1884
- e.released || W(t.sender) !== r || await this.enqueueSender(e, t, () => t.sender.replaceTrack(n)).catch(() => void 0);
1893
+ e.released || G(t.sender) !== r || await this.enqueueSender(e, t, () => t.sender.replaceTrack(n)).catch(() => void 0);
1885
1894
  }
1886
1895
  isCurrentResource(e, t = e.generation) {
1887
1896
  return !this.disposed && this.calls.get(e.callId) === e && e.generation === t;
@@ -1908,24 +1917,24 @@ var H = class {
1908
1917
  if (this.disposed || this.disposing) throw new e("SDK_ALREADY_DISPOSED", "internal", !1);
1909
1918
  }
1910
1919
  };
1911
- function U(e) {
1920
+ function W(e) {
1912
1921
  return "peerConnection" in e;
1913
1922
  }
1914
- function W(e) {
1923
+ function G(e) {
1915
1924
  try {
1916
1925
  return e.track;
1917
1926
  } catch {
1918
1927
  return null;
1919
1928
  }
1920
1929
  }
1921
- function G(e) {
1930
+ function K(e) {
1922
1931
  try {
1923
1932
  return e.replaceTrack(null);
1924
1933
  } catch (e) {
1925
1934
  return Promise.reject(e);
1926
1935
  }
1927
1936
  }
1928
- function K(e) {
1937
+ function ue(e) {
1929
1938
  try {
1930
1939
  q(e.getTracks());
1931
1940
  } catch {}
@@ -1938,7 +1947,7 @@ function J(e) {
1938
1947
  e.stop();
1939
1948
  } catch {}
1940
1949
  }
1941
- function se(e) {
1950
+ function de(e) {
1942
1951
  if (typeof MediaStream < "u") try {
1943
1952
  return new MediaStream([e]);
1944
1953
  } catch {
@@ -1947,8 +1956,8 @@ function se(e) {
1947
1956
  }
1948
1957
  //#endregion
1949
1958
  //#region src/core/mediaBridge.ts
1950
- function ce(t, n = {}) {
1951
- let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set(), o = n.ownershipRequired === !0, s = !1, c = !1, l, u = () => t(), d = new H({ getActiveCall: u });
1959
+ function fe(t, n = {}) {
1960
+ let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set(), o = n.ownershipRequired === !0, s = !1, c = !1, l, u = () => t(), d = new U({ getActiveCall: u });
1952
1961
  return {
1953
1962
  publicMedia: {
1954
1963
  requestPermission: () => (f(), d.requestPermission()),
@@ -2006,7 +2015,7 @@ function ce(t, n = {}) {
2006
2015
  function p(e, t) {
2007
2016
  if (!Y(t) || typeof t.getMediaRegistration != "function") return;
2008
2017
  let n = t.getMediaRegistration();
2009
- if (le(n) && r.get(e)?.peerConnection !== n.peerConnection) {
2018
+ if (pe(n) && r.get(e)?.peerConnection !== n.peerConnection) {
2010
2019
  r.set(e, n);
2011
2020
  try {
2012
2021
  d.registerCallMedia(e, n);
@@ -2019,19 +2028,19 @@ function ce(t, n = {}) {
2019
2028
  function Y(e) {
2020
2029
  return typeof e == "object" && !!e;
2021
2030
  }
2022
- function le(e) {
2031
+ function pe(e) {
2023
2032
  return typeof e == "object" && !!e && "peerConnection" in e && typeof e.peerConnection == "object" && e.peerConnection !== null;
2024
2033
  }
2025
2034
  //#endregion
2026
2035
  //#region src/reconnect/backoff.ts
2027
- var ue = 1e3, de = 3e4;
2028
- function fe(e, t = Math.random) {
2029
- let n = Math.min(de, ue * 2 ** Math.max(0, Math.floor(e))), r = Math.min(1, Math.max(0, t()));
2036
+ var me = 1e3, he = 3e4;
2037
+ function ge(e, t = Math.random) {
2038
+ let n = Math.min(he, me * 2 ** Math.max(0, Math.floor(e))), r = Math.min(1, Math.max(0, t()));
2030
2039
  return Math.round(n * (1 + r * .2));
2031
2040
  }
2032
2041
  //#endregion
2033
2042
  //#region src/reconnect/ReconnectManager.ts
2034
- var pe = class {
2043
+ var _e = class {
2035
2044
  recover;
2036
2045
  random;
2037
2046
  isOnline;
@@ -2048,7 +2057,7 @@ var pe = class {
2048
2057
  }
2049
2058
  start() {
2050
2059
  if (this.disposed || !this.online || !this.isOnline() || this.pendingTimer !== void 0 || this.running) return;
2051
- let e = this.generation, t = fe(this.attempt, this.random);
2060
+ let e = this.generation, t = ge(this.attempt, this.random);
2052
2061
  this.pendingTimer = setTimeout(() => {
2053
2062
  this.pendingTimer = void 0, this.run(e);
2054
2063
  }, t);
@@ -2090,7 +2099,7 @@ var pe = class {
2090
2099
  clearPendingTimer() {
2091
2100
  this.pendingTimer !== void 0 && (clearTimeout(this.pendingTimer), this.pendingTimer = void 0);
2092
2101
  }
2093
- }, me = class t {
2102
+ }, ve = class t {
2094
2103
  media;
2095
2104
  options;
2096
2105
  api;
@@ -2135,7 +2144,7 @@ var pe = class {
2135
2144
  this.api = t.api === void 0 ? t.sessionProvider === void 0 ? new p({
2136
2145
  baseUrl: t.baseUrl ?? "",
2137
2146
  tokenProvider: i
2138
- }) : X(_e(t.sessionProvider)) : X(t.api), this.suppliedSip = t.sip === void 0 ? void 0 : ve(t.sip), this.mediaBridge = ce(() => this.getActiveMediaContext()), this.media = this.mediaBridge.publicMedia, this.reconnect = new pe({
2147
+ }) : X(xe(t.sessionProvider)) : X(t.api), this.suppliedSip = t.sip === void 0 ? void 0 : Se(t.sip), this.mediaBridge = fe(() => this.getActiveMediaContext()), this.media = this.mediaBridge.publicMedia, this.reconnect = new _e({
2139
2148
  recover: () => this.recoverConnection(),
2140
2149
  onAttempt: (e) => {
2141
2150
  this.disposed || this.events.emit("connection.reconnecting", { attempt: e });
@@ -2147,13 +2156,13 @@ var pe = class {
2147
2156
  }), this.sharedWorkerSelection = t.sharedWorker === void 0 ? {
2148
2157
  mode: "single-tab",
2149
2158
  reason: "disabled"
2150
- } : w({
2159
+ } : C({
2151
2160
  ...t.sharedWorker,
2152
2161
  ...t.sharedWorkerHost ?? {}
2153
2162
  });
2154
2163
  }
2155
2164
  static async checkSupport() {
2156
- let e = typeof navigator < "u" && navigator.mediaDevices !== void 0, t = typeof WebSocket < "u", n = ge(typeof navigator < "u" ? navigator.userAgent : "");
2165
+ let e = typeof navigator < "u" && navigator.mediaDevices !== void 0, t = typeof WebSocket < "u", n = be(typeof navigator < "u" ? navigator.userAgent : "");
2157
2166
  return {
2158
2167
  supported: e && t,
2159
2168
  platform: n,
@@ -2260,7 +2269,7 @@ var pe = class {
2260
2269
  sdkVersion: n,
2261
2270
  platform: a === "mobile-web" ? "mobile_web" : "web",
2262
2271
  ...this.options.locale === void 0 ? {} : { locale: this.options.locale },
2263
- requestedCapabilities: [...this.options.requestedCapabilities ?? Se(a)]
2272
+ requestedCapabilities: [...this.options.requestedCapabilities ?? Ee(a)]
2264
2273
  }), this.ownedSessionIds.add(t.sessionId), this.assertGeneration(e), r = await this.getSip(), this.assertGeneration(e), this.session = t;
2265
2274
  let o = this.callManager ?? this.createCallManager(r, t, a);
2266
2275
  this.callManager === void 0 && (i = o), o.updateSession(t), this.callManager = o, this.attachSipListener(r), this.attachNetworkListeners(), await r.connect(t), this.assertGeneration(e), this.setConnectionState("connected"), this.events.emit("connection.registered", { registered: !0 }), this.scheduleRefresh(t);
@@ -2366,7 +2375,7 @@ var pe = class {
2366
2375
  try {
2367
2376
  await this.media.releaseAll();
2368
2377
  } catch (t) {
2369
- ye(t) || (e ??= t);
2378
+ Ce(t) || (e ??= t);
2370
2379
  }
2371
2380
  try {
2372
2381
  await this.mediaBridge.dispose();
@@ -2566,7 +2575,7 @@ var pe = class {
2566
2575
  destination: e.destination
2567
2576
  })),
2568
2577
  permission: this.support?.hasMediaDevices === !1 ? "unsupported" : "unknown",
2569
- ice: he(e),
2578
+ ice: ye(e),
2570
2579
  wss: {
2571
2580
  configured: e !== void 0,
2572
2581
  secure: e?.transport.wssUrl.toLowerCase().startsWith("wss://") ?? !1,
@@ -2683,7 +2692,7 @@ var pe = class {
2683
2692
  return new e("SDK_ALREADY_DISPOSED", "internal", !1);
2684
2693
  }
2685
2694
  };
2686
- function he(e) {
2695
+ function ye(e) {
2687
2696
  if (e === void 0) return {
2688
2697
  configured: !1,
2689
2698
  serverCount: 0,
@@ -2701,14 +2710,14 @@ function he(e) {
2701
2710
  turnServerCount: n
2702
2711
  };
2703
2712
  }
2704
- function ge(e) {
2713
+ function be(e) {
2705
2714
  return e === "" ? "unknown" : /iPhone|iPad|Android/i.test(e) ? "mobile-web" : "web";
2706
2715
  }
2707
2716
  function X(t) {
2708
2717
  if (typeof t != "object" || !t) throw new e("CONFIG_INVALID", "configuration", !1);
2709
2718
  return t;
2710
2719
  }
2711
- function _e(t) {
2720
+ function xe(t) {
2712
2721
  let r = {
2713
2722
  createSession: (e) => t.createSession(e),
2714
2723
  refreshSession: (e) => t.refreshSession === void 0 ? t.createSession({
@@ -2722,7 +2731,7 @@ function _e(t) {
2722
2731
  }, i = t.invalidateToken;
2723
2732
  return i !== void 0 && (r.invalidateToken = () => i()), r;
2724
2733
  }
2725
- function ve(t) {
2734
+ function Se(t) {
2726
2735
  if (typeof t != "object" || !t) throw new e("CONFIG_INVALID", "configuration", !1);
2727
2736
  return t;
2728
2737
  }
@@ -2741,13 +2750,13 @@ function Z(t, n, r, i, a) {
2741
2750
  function Q(t) {
2742
2751
  return t instanceof e ? t.status !== void 0 && t.status >= 400 && t.status < 500 || t.serverCode === "SESSION_NOT_FOUND" || t.serverCode === "SESSION_EXPIRED" || t.serverCode === "TOKEN_INVALID" || t.serverCode === "TOKEN_EXPIRED" || t.code === "AUTH_TOKEN_UNAVAILABLE" || t.code === "AUTH_TOKEN_EXPIRED" : !1;
2743
2752
  }
2744
- function ye(t) {
2753
+ function Ce(t) {
2745
2754
  return t instanceof e && t.code === "SDK_ALREADY_DISPOSED";
2746
2755
  }
2747
2756
  function $(t) {
2748
2757
  return t instanceof e && (t.code === "SDK_ALREADY_DISPOSED" || t.code === "CALL_NOT_CONNECTED");
2749
2758
  }
2750
- var be = [
2759
+ var we = [
2751
2760
  "outbound",
2752
2761
  "inbound",
2753
2762
  "mute",
@@ -2755,13 +2764,13 @@ var be = [
2755
2764
  "dtmf",
2756
2765
  "blind_transfer",
2757
2766
  "device_selection"
2758
- ], xe = [
2767
+ ], Te = [
2759
2768
  "outbound",
2760
2769
  "mute",
2761
2770
  "dtmf"
2762
2771
  ];
2763
- function Se(e) {
2764
- return e === "mobile-web" ? xe : be;
2772
+ function Ee(e) {
2773
+ return e === "mobile-web" ? Te : we;
2765
2774
  }
2766
2775
  //#endregion
2767
- export { g as a, c, l as d, a as f, x as i, s as l, w as n, p as o, i as p, T as r, d as s, me as t, o as u };
2776
+ export { h as a, c, l as d, a as f, x as i, s as l, C as n, p as o, i as p, w as r, d as s, ve as t, o as u };