sip-connector 20.4.1 → 20.5.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.
Files changed (45) hide show
  1. package/README.md +18 -1264
  2. package/dist/{@SipConnector-FYEV5h4G.js → @SipConnector-DoyWexFp.js} +758 -719
  3. package/dist/@SipConnector-TNDGO7MW.cjs +1 -0
  4. package/dist/ApiManager/events.d.ts +0 -1
  5. package/dist/ApiManager/index.d.ts +2 -2
  6. package/dist/AutoConnectorManager/index.d.ts +2 -1
  7. package/dist/CallManager/CallStateMachine.d.ts +0 -7
  8. package/dist/CallManager/events.d.ts +3 -3
  9. package/dist/CallManager/index.d.ts +2 -2
  10. package/dist/ConferenceStateManager/events.d.ts +0 -1
  11. package/dist/ConferenceStateManager/index.d.ts +2 -3
  12. package/dist/ConnectionManager/ConnectionStateMachine.d.ts +20 -17
  13. package/dist/ConnectionManager/events.d.ts +0 -1
  14. package/dist/ConnectionManager/index.d.ts +1 -1
  15. package/dist/IncomingCallManager/@IncomingCallManager.d.ts +1 -1
  16. package/dist/IncomingCallManager/events.d.ts +3 -4
  17. package/dist/IncomingCallManager/index.d.ts +2 -2
  18. package/dist/MainStreamHealthMonitor/index.d.ts +2 -0
  19. package/dist/PresentationManager/events.d.ts +0 -1
  20. package/dist/PresentationManager/index.d.ts +2 -1
  21. package/dist/SessionManager/@SessionManager.d.ts +30 -0
  22. package/dist/SessionManager/events.d.ts +14 -0
  23. package/dist/{session → SessionManager}/index.d.ts +3 -2
  24. package/dist/SipConnector/@SipConnector.d.ts +5 -4
  25. package/dist/SipConnector/events.d.ts +15 -13
  26. package/dist/SipConnector/index.d.ts +1 -1
  27. package/dist/SipConnectorFacade/@SipConnectorFacade.d.ts +3 -3
  28. package/dist/StatsManager/@StatsManager.d.ts +12 -8
  29. package/dist/StatsManager/constants.d.ts +1 -0
  30. package/dist/StatsManager/events.d.ts +2 -2
  31. package/dist/StatsManager/index.d.ts +2 -1
  32. package/dist/StatsPeerConnection/index.d.ts +2 -2
  33. package/dist/VideoSendingBalancerManager/events.d.ts +0 -1
  34. package/dist/VideoSendingBalancerManager/index.d.ts +2 -2
  35. package/dist/__fixtures__/eventNames.d.ts +1 -1
  36. package/dist/doMock.cjs +1 -1
  37. package/dist/doMock.js +1 -1
  38. package/dist/index.cjs +1 -1
  39. package/dist/index.d.ts +8 -8
  40. package/dist/index.js +2 -2
  41. package/package.json +1 -1
  42. package/dist/@SipConnector-DB4bLDI5.cjs +0 -1
  43. package/dist/session/createSession.d.ts +0 -26
  44. /package/dist/{session → SessionManager}/selectors.d.ts +0 -0
  45. /package/dist/{session → SessionManager}/types.d.ts +0 -0
@@ -1,20 +1,20 @@
1
- import X from "debug";
2
- import { TypedEvents as M } from "events-constructor";
3
- import { CancelableRequest as G, isCanceledError as Ue } from "@krivega/cancelable-promise";
4
- import { resolveRequesterByTimeout as Fe, requesterByTimeoutsWithFailCalls as Be, DelayRequester as ke, hasCanceledError as Ge, SetTimeoutRequest as ce } from "@krivega/timeout-requester";
5
- import { hasCanceledError as $e, repeatedCallsAsync as de } from "repeated-calls";
6
- import { createActor as qe, setup as $, assign as b } from "xstate";
7
- import { createStackPromises as le, isPromiseIsNotActualError as Ve } from "stack-promises";
1
+ import J from "debug";
2
+ import { TypedEvents as A } from "events-constructor";
3
+ import { CancelableRequest as $, isCanceledError as $e } from "@krivega/cancelable-promise";
4
+ import { resolveRequesterByTimeout as Ge, requesterByTimeoutsWithFailCalls as qe, DelayRequester as He, hasCanceledError as Ve, SetTimeoutRequest as ce } from "@krivega/timeout-requester";
5
+ import { hasCanceledError as We, repeatedCallsAsync as he } from "repeated-calls";
6
+ import { createActor as xe, setup as G, assign as P } from "xstate";
7
+ import { createStackPromises as de, isPromiseIsNotActualError as Qe } from "stack-promises";
8
8
  import "ua-parser-js";
9
9
  import "sequent-promises";
10
- import He from "lodash";
11
- const J = "sip-connector", d = X(J), Us = () => {
12
- X.enable(J);
13
- }, Fs = () => {
14
- X.enable(`-${J}`);
15
- }, We = "Error decline with 603", xe = 1006, Qe = (n) => typeof n == "object" && n !== null && "code" in n && n.code === xe, Ye = (n) => n.message === We;
16
- var E = /* @__PURE__ */ ((n) => (n.CONTENT_TYPE = "content-type", n.CONTENT_ENTER_ROOM = "x-webrtc-enter-room", n.CONTENT_USE_LICENSE = "X-WEBRTC-USE-LICENSE", n.PARTICIPANT_NAME = "X-WEBRTC-PARTICIPANT-NAME", n.INPUT_CHANNELS = "X-WEBRTC-INPUT-CHANNELS", n.OUTPUT_CHANNELS = "X-WEBRTC-OUTPUT-CHANNELS", n.MAIN_CAM = "X-WEBRTC-MAINCAM", n.MIC = "X-WEBRTC-MIC", n.MEDIA_SYNC = "X-WEBRTC-SYNC", n.MAIN_CAM_RESOLUTION = "X-WEBRTC-MAINCAM-RESOLUTION", n.MEDIA_STATE = "X-WEBRTC-MEDIA-STATE", n.MEDIA_TYPE = "X-Vinteo-Media-Type", n.MAIN_CAM_STATE = "X-Vinteo-MainCam-State", n.MIC_STATE = "X-Vinteo-Mic-State", n.CONTENT_PARTICIPANT_STATE = "X-WEBRTC-PARTSTATE", n.NOTIFY = "X-VINTEO-NOTIFY", n.CONTENT_ENABLE_MEDIA_DEVICE = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", n.CONTENT_SHARE_STATE = "x-webrtc-share-state", n.MUST_STOP_PRESENTATION_P2P = "x-webrtc-share-state: YOUMUSTSTOPSENDCONTENT", n.START_PRESENTATION_P2P = "x-webrtc-share-state: YOUCANRECEIVECONTENT", n.STOP_PRESENTATION_P2P = "x-webrtc-share-state: CONTENTEND", n.STOP_PRESENTATION = "x-webrtc-share-state: STOPPRESENTATION", n.START_PRESENTATION = "x-webrtc-share-state: LETMESTARTPRESENTATION", n.ENABLE_MAIN_CAM = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE: LETMESTARTMAINCAM", n.AVAILABLE_INCOMING_BITRATE = "X-WEBRTC-AVAILABLE-INCOMING-BITRATE", n.AUDIO_TRACK_COUNT = "X-WEBRTC-AUDIO-TRACK-COUNT", n.VIDEO_TRACK_COUNT = "X-WEBRTC-VIDEO-TRACK-COUNT", n.TRACKS_DIRECTION = "X-WEBRTC-TRACKS-DIRECTION", n.AUDIO_ID = "X-WEBRTC-AUDIOID", n))(E || {}), B = /* @__PURE__ */ ((n) => (n.AVAILABLE_SECOND_REMOTE_STREAM = "YOUCANRECEIVECONTENT", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "CONTENTEND", n.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", n))(B || {}), x = /* @__PURE__ */ ((n) => (n.SPECTATOR = "SPECTATOR", n.PARTICIPANT = "PARTICIPANT", n))(x || {}), y = /* @__PURE__ */ ((n) => (n.ENTER_ROOM = "application/vinteo.webrtc.roomname", n.MIC = "application/vinteo.webrtc.mic", n.USE_LICENSE = "application/vinteo.webrtc.uselic", n.PARTICIPANT_STATE = "application/vinteo.webrtc.partstate", n.NOTIFY = "application/vinteo.webrtc.notify", n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n))(y || {}), I = /* @__PURE__ */ ((n) => (n.CHANNELS = "application/vinteo.webrtc.channels", n.MEDIA_STATE = "application/vinteo.webrtc.mediastate", n.REFUSAL = "application/vinteo.webrtc.refusal", n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n.STATS = "application/vinteo.webrtc.stats", n))(I || {}), _ = /* @__PURE__ */ ((n) => (n.PAUSE_MAIN_CAM = "PAUSEMAINCAM", n.RESUME_MAIN_CAM = "RESUMEMAINCAM", n.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", n.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", n.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", n))(_ || {}), Q = /* @__PURE__ */ ((n) => (n.ADMIN_STOP_MIC = "ADMINSTOPMIC", n.ADMIN_START_MIC = "ADMINSTARTMIC", n))(Q || {}), Y = /* @__PURE__ */ ((n) => (n.ADMIN_SYNC_FORCED = "1", n.ADMIN_SYNC_NOT_FORCED = "0", n))(Y || {}), ze = /* @__PURE__ */ ((n) => (n.AUDIO = "AUDIO", n.VIDEO = "VIDEO", n.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", n))(ze || {}), g = /* @__PURE__ */ ((n) => (n.CHANNELS_NOTIFY = "channels:notify", n.PARTICIPANT_ADDED_TO_LIST_MODERATORS = "participant:added-to-list-moderators", n.PARTICIPANT_REMOVED_FROM_LIST_MODERATORS = "participant:removed-from-list-moderators", n.PARTICIPANT_MOVE_REQUEST_TO_STREAM = "participant:move-request-to-stream", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS = "participant:move-request-to-spectators", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_SYNTHETIC = "participant:move-request-to-spectators-synthetic", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_WITH_AUDIO_ID = "participant:move-request-to-spectators-with-audio-id", n.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS = "participant:move-request-to-participants", n.PARTICIPATION_ACCEPTING_WORD_REQUEST = "participation:accepting-word-request", n.PARTICIPATION_CANCELLING_WORD_REQUEST = "participation:cancelling-word-request", n.WEBCAST_STARTED = "webcast:started", n.WEBCAST_STOPPED = "webcast:stopped", n.ACCOUNT_CHANGED = "account:changed", n.ACCOUNT_DELETED = "account:deleted", n.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = "conference:participant-token-issued", n.CHANNELS = "channels", n.ENTER_ROOM = "enterRoom", n.SHARE_STATE = "shareState", n.MAIN_CAM_CONTROL = "main-cam-control", n.USE_LICENSE = "useLicense", n.ADMIN_START_MAIN_CAM = "admin-start-main-cam", n.ADMIN_STOP_MAIN_CAM = "admin-stop-main-cam", n.ADMIN_START_MIC = "admin-start-mic", n.ADMIN_STOP_MIC = "admin-stop-mic", n.ADMIN_FORCE_SYNC_MEDIA_STATE = "admin-force-sync-media-state", n.AVAILABLE_SECOND_REMOTE_STREAM = "availableSecondRemoteStream", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "notAvailableSecondRemoteStream", n.MUST_STOP_PRESENTATION = "mustStopPresentation", n.NEW_DTMF = "newDTMF", n))(g || {});
17
- const he = [
10
+ import Ye from "lodash";
11
+ const z = "sip-connector", h = J(z), Hs = () => {
12
+ J.enable(z);
13
+ }, Vs = () => {
14
+ J.enable(`-${z}`);
15
+ }, Xe = "Error decline with 603", Je = 1006, ze = (n) => typeof n == "object" && n !== null && "code" in n && n.code === Je, Ke = (n) => n.message === Xe;
16
+ var g = /* @__PURE__ */ ((n) => (n.CONTENT_TYPE = "content-type", n.CONTENT_ENTER_ROOM = "x-webrtc-enter-room", n.CONTENT_USE_LICENSE = "X-WEBRTC-USE-LICENSE", n.PARTICIPANT_NAME = "X-WEBRTC-PARTICIPANT-NAME", n.INPUT_CHANNELS = "X-WEBRTC-INPUT-CHANNELS", n.OUTPUT_CHANNELS = "X-WEBRTC-OUTPUT-CHANNELS", n.MAIN_CAM = "X-WEBRTC-MAINCAM", n.MIC = "X-WEBRTC-MIC", n.MEDIA_SYNC = "X-WEBRTC-SYNC", n.MAIN_CAM_RESOLUTION = "X-WEBRTC-MAINCAM-RESOLUTION", n.MEDIA_STATE = "X-WEBRTC-MEDIA-STATE", n.MEDIA_TYPE = "X-Vinteo-Media-Type", n.MAIN_CAM_STATE = "X-Vinteo-MainCam-State", n.MIC_STATE = "X-Vinteo-Mic-State", n.CONTENT_PARTICIPANT_STATE = "X-WEBRTC-PARTSTATE", n.NOTIFY = "X-VINTEO-NOTIFY", n.CONTENT_ENABLE_MEDIA_DEVICE = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", n.CONTENT_SHARE_STATE = "x-webrtc-share-state", n.MUST_STOP_PRESENTATION_P2P = "x-webrtc-share-state: YOUMUSTSTOPSENDCONTENT", n.START_PRESENTATION_P2P = "x-webrtc-share-state: YOUCANRECEIVECONTENT", n.STOP_PRESENTATION_P2P = "x-webrtc-share-state: CONTENTEND", n.STOP_PRESENTATION = "x-webrtc-share-state: STOPPRESENTATION", n.START_PRESENTATION = "x-webrtc-share-state: LETMESTARTPRESENTATION", n.ENABLE_MAIN_CAM = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE: LETMESTARTMAINCAM", n.AVAILABLE_INCOMING_BITRATE = "X-WEBRTC-AVAILABLE-INCOMING-BITRATE", n.AUDIO_TRACK_COUNT = "X-WEBRTC-AUDIO-TRACK-COUNT", n.VIDEO_TRACK_COUNT = "X-WEBRTC-VIDEO-TRACK-COUNT", n.TRACKS_DIRECTION = "X-WEBRTC-TRACKS-DIRECTION", n.AUDIO_ID = "X-WEBRTC-AUDIOID", n))(g || {}), k = /* @__PURE__ */ ((n) => (n.AVAILABLE_SECOND_REMOTE_STREAM = "YOUCANRECEIVECONTENT", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "CONTENTEND", n.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", n))(k || {}), x = /* @__PURE__ */ ((n) => (n.SPECTATOR = "SPECTATOR", n.PARTICIPANT = "PARTICIPANT", n))(x || {}), D = /* @__PURE__ */ ((n) => (n.ENTER_ROOM = "application/vinteo.webrtc.roomname", n.MIC = "application/vinteo.webrtc.mic", n.USE_LICENSE = "application/vinteo.webrtc.uselic", n.PARTICIPANT_STATE = "application/vinteo.webrtc.partstate", n.NOTIFY = "application/vinteo.webrtc.notify", n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n))(D || {}), I = /* @__PURE__ */ ((n) => (n.CHANNELS = "application/vinteo.webrtc.channels", n.MEDIA_STATE = "application/vinteo.webrtc.mediastate", n.REFUSAL = "application/vinteo.webrtc.refusal", n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n.STATS = "application/vinteo.webrtc.stats", n))(I || {}), v = /* @__PURE__ */ ((n) => (n.PAUSE_MAIN_CAM = "PAUSEMAINCAM", n.RESUME_MAIN_CAM = "RESUMEMAINCAM", n.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", n.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", n.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", n))(v || {}), Q = /* @__PURE__ */ ((n) => (n.ADMIN_STOP_MIC = "ADMINSTOPMIC", n.ADMIN_START_MIC = "ADMINSTARTMIC", n))(Q || {}), Y = /* @__PURE__ */ ((n) => (n.ADMIN_SYNC_FORCED = "1", n.ADMIN_SYNC_NOT_FORCED = "0", n))(Y || {}), je = /* @__PURE__ */ ((n) => (n.AUDIO = "AUDIO", n.VIDEO = "VIDEO", n.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", n))(je || {}), l = /* @__PURE__ */ ((n) => (n.CHANNELS_NOTIFY = "channels:notify", n.PARTICIPANT_ADDED_TO_LIST_MODERATORS = "participant:added-to-list-moderators", n.PARTICIPANT_REMOVED_FROM_LIST_MODERATORS = "participant:removed-from-list-moderators", n.PARTICIPANT_MOVE_REQUEST_TO_STREAM = "participant:move-request-to-stream", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS = "participant:move-request-to-spectators", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_SYNTHETIC = "participant:move-request-to-spectators-synthetic", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_WITH_AUDIO_ID = "participant:move-request-to-spectators-with-audio-id", n.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS = "participant:move-request-to-participants", n.PARTICIPATION_ACCEPTING_WORD_REQUEST = "participation:accepting-word-request", n.PARTICIPATION_CANCELLING_WORD_REQUEST = "participation:cancelling-word-request", n.WEBCAST_STARTED = "webcast:started", n.WEBCAST_STOPPED = "webcast:stopped", n.ACCOUNT_CHANGED = "account:changed", n.ACCOUNT_DELETED = "account:deleted", n.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = "conference:participant-token-issued", n.CHANNELS = "channels", n.ENTER_ROOM = "enterRoom", n.SHARE_STATE = "shareState", n.MAIN_CAM_CONTROL = "main-cam-control", n.USE_LICENSE = "useLicense", n.ADMIN_START_MAIN_CAM = "admin-start-main-cam", n.ADMIN_STOP_MAIN_CAM = "admin-stop-main-cam", n.ADMIN_START_MIC = "admin-start-mic", n.ADMIN_STOP_MIC = "admin-stop-mic", n.ADMIN_FORCE_SYNC_MEDIA_STATE = "admin-force-sync-media-state", n.AVAILABLE_SECOND_REMOTE_STREAM = "availableSecondRemoteStream", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "notAvailableSecondRemoteStream", n.MUST_STOP_PRESENTATION = "mustStopPresentation", n.NEW_DTMF = "newDTMF", n))(l || {});
17
+ const le = [
18
18
  "participation:accepting-word-request",
19
19
  "participation:cancelling-word-request",
20
20
  "participant:move-request-to-stream",
@@ -44,9 +44,9 @@ const he = [
44
44
  "notAvailableSecondRemoteStream",
45
45
  "mustStopPresentation",
46
46
  "newDTMF"
47
- ], Xe = () => new M(he);
47
+ ], Ze = () => new A(le);
48
48
  var R = /* @__PURE__ */ ((n) => (n.CHANNELS = "channels", n.WEBCAST_STARTED = "WebcastStarted", n.WEBCAST_STOPPED = "WebcastStopped", n.ACCOUNT_CHANGED = "accountChanged", n.ACCOUNT_DELETED = "accountDeleted", n.ADDED_TO_LIST_MODERATORS = "addedToListModerators", n.REMOVED_FROM_LIST_MODERATORS = "removedFromListModerators", n.ACCEPTING_WORD_REQUEST = "ParticipationRequestAccepted", n.CANCELLING_WORD_REQUEST = "ParticipationRequestRejected", n.MOVE_REQUEST_TO_STREAM = "ParticipantMovedToWebcast", n.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = "ConferenceParticipantTokenIssued", n))(R || {});
49
- class Je {
49
+ class et {
50
50
  events;
51
51
  connectionManager;
52
52
  callManager;
@@ -54,13 +54,13 @@ class Je {
54
54
  connectionManager: e,
55
55
  callManager: t
56
56
  }) {
57
- this.connectionManager = e, this.callManager = t, this.events = Xe(), this.subscribe();
57
+ this.connectionManager = e, this.callManager = t, this.events = Ze(), this.subscribe();
58
58
  }
59
59
  async waitChannels() {
60
- return this.wait(g.CHANNELS);
60
+ return this.wait(l.CHANNELS);
61
61
  }
62
62
  async waitSyncMediaState() {
63
- return this.wait(g.ADMIN_FORCE_SYNC_MEDIA_STATE);
63
+ return this.wait(l.ADMIN_FORCE_SYNC_MEDIA_STATE);
64
64
  }
65
65
  async sendDTMF(e) {
66
66
  return new Promise((t, s) => {
@@ -79,14 +79,14 @@ class Je {
79
79
  });
80
80
  }
81
81
  async sendChannels({ inputChannels: e, outputChannels: t }) {
82
- const s = this.getEstablishedRTCSessionProtected(), i = `${E.INPUT_CHANNELS}: ${e}`, r = `${E.OUTPUT_CHANNELS}: ${t}`, a = [
82
+ const s = this.getEstablishedRTCSessionProtected(), i = `${g.INPUT_CHANNELS}: ${e}`, r = `${g.OUTPUT_CHANNELS}: ${t}`, a = [
83
83
  i,
84
84
  r
85
85
  ];
86
86
  return s.sendInfo(I.CHANNELS, void 0, { extraHeaders: a });
87
87
  }
88
88
  async sendMediaState({ cam: e, mic: t }, s = {}) {
89
- const i = this.getEstablishedRTCSessionProtected(), r = `${E.MEDIA_STATE}: currentstate`, a = `${E.MAIN_CAM_STATE}: ${Number(e)}`, o = `${E.MIC_STATE}: ${Number(t)}`, c = [
89
+ const i = this.getEstablishedRTCSessionProtected(), r = `${g.MEDIA_STATE}: currentstate`, a = `${g.MAIN_CAM_STATE}: ${Number(e)}`, o = `${g.MIC_STATE}: ${Number(t)}`, c = [
90
90
  r,
91
91
  a,
92
92
  o
@@ -100,14 +100,14 @@ class Je {
100
100
  async sendStats({
101
101
  availableIncomingBitrate: e
102
102
  }) {
103
- const t = this.getEstablishedRTCSessionProtected(), i = [`${E.AVAILABLE_INCOMING_BITRATE}: ${e}`];
103
+ const t = this.getEstablishedRTCSessionProtected(), i = [`${g.AVAILABLE_INCOMING_BITRATE}: ${e}`];
104
104
  return t.sendInfo(I.STATS, void 0, {
105
105
  noTerminateWhenError: !0,
106
106
  extraHeaders: i
107
107
  });
108
108
  }
109
109
  async sendRefusalToTurnOn(e, t = {}) {
110
- const s = this.getEstablishedRTCSessionProtected(), a = e === "mic" ? 0 : 1, c = [`${E.MEDIA_TYPE}: ${a}`];
110
+ const s = this.getEstablishedRTCSessionProtected(), a = e === "mic" ? 0 : 1, c = [`${g.MEDIA_TYPE}: ${a}`];
111
111
  return s.sendInfo(I.REFUSAL, void 0, {
112
112
  noTerminateWhenError: !0,
113
113
  ...t,
@@ -122,37 +122,37 @@ class Je {
122
122
  }
123
123
  async sendMustStopPresentationP2P() {
124
124
  await this.getEstablishedRTCSessionProtected().sendInfo(I.SHARE_STATE, void 0, {
125
- extraHeaders: [E.MUST_STOP_PRESENTATION_P2P]
125
+ extraHeaders: [g.MUST_STOP_PRESENTATION_P2P]
126
126
  });
127
127
  }
128
128
  async sendStoppedPresentationP2P() {
129
129
  await this.getEstablishedRTCSessionProtected().sendInfo(I.SHARE_STATE, void 0, {
130
- extraHeaders: [E.STOP_PRESENTATION_P2P]
130
+ extraHeaders: [g.STOP_PRESENTATION_P2P]
131
131
  });
132
132
  }
133
133
  async sendStoppedPresentation() {
134
134
  await this.getEstablishedRTCSessionProtected().sendInfo(I.SHARE_STATE, void 0, {
135
- extraHeaders: [E.STOP_PRESENTATION]
135
+ extraHeaders: [g.STOP_PRESENTATION]
136
136
  });
137
137
  }
138
138
  async askPermissionToStartPresentationP2P() {
139
139
  await this.getEstablishedRTCSessionProtected().sendInfo(I.SHARE_STATE, void 0, {
140
- extraHeaders: [E.START_PRESENTATION_P2P]
140
+ extraHeaders: [g.START_PRESENTATION_P2P]
141
141
  });
142
142
  }
143
143
  async askPermissionToStartPresentation() {
144
144
  await this.getEstablishedRTCSessionProtected().sendInfo(I.SHARE_STATE, void 0, {
145
- extraHeaders: [E.START_PRESENTATION]
145
+ extraHeaders: [g.START_PRESENTATION]
146
146
  });
147
147
  }
148
148
  async askPermissionToEnableCam(e = {}) {
149
- const t = this.getEstablishedRTCSessionProtected(), s = [E.ENABLE_MAIN_CAM];
149
+ const t = this.getEstablishedRTCSessionProtected(), s = [g.ENABLE_MAIN_CAM];
150
150
  return t.sendInfo(I.MAIN_CAM, void 0, {
151
151
  noTerminateWhenError: !0,
152
152
  ...e,
153
153
  extraHeaders: s
154
154
  }).catch((i) => {
155
- if (Ye(i))
155
+ if (Ke(i))
156
156
  throw i;
157
157
  });
158
158
  }
@@ -187,13 +187,13 @@ class Je {
187
187
  };
188
188
  maybeHandleNotify = (e) => {
189
189
  try {
190
- const t = e.getHeader(E.NOTIFY);
190
+ const t = e.getHeader(g.NOTIFY);
191
191
  if (t) {
192
192
  const s = JSON.parse(t);
193
193
  this.handleNotify(s);
194
194
  }
195
195
  } catch (t) {
196
- d("error parse notify", t);
196
+ h("error parse notify", t);
197
197
  }
198
198
  };
199
199
  handleNotify = (e) => {
@@ -252,41 +252,41 @@ class Je {
252
252
  break;
253
253
  }
254
254
  default:
255
- d("unknown cmd", e);
255
+ h("unknown cmd", e);
256
256
  }
257
257
  };
258
258
  handleNewInfo = (e) => {
259
259
  const { originator: t } = e;
260
260
  if (t !== "remote")
261
261
  return;
262
- const { request: s } = e, i = s, r = i.getHeader(E.CONTENT_TYPE);
262
+ const { request: s } = e, i = s, r = i.getHeader(g.CONTENT_TYPE);
263
263
  if (r !== void 0)
264
264
  switch (r) {
265
- case y.ENTER_ROOM: {
265
+ case D.ENTER_ROOM: {
266
266
  this.triggerEnterRoom(i), this.maybeTriggerChannels(i);
267
267
  break;
268
268
  }
269
- case y.NOTIFY: {
269
+ case D.NOTIFY: {
270
270
  this.maybeHandleNotify(i);
271
271
  break;
272
272
  }
273
- case y.SHARE_STATE: {
273
+ case D.SHARE_STATE: {
274
274
  this.triggerShareState(i);
275
275
  break;
276
276
  }
277
- case y.MAIN_CAM: {
277
+ case D.MAIN_CAM: {
278
278
  this.triggerMainCamControl(i);
279
279
  break;
280
280
  }
281
- case y.MIC: {
281
+ case D.MIC: {
282
282
  this.triggerMicControl(i);
283
283
  break;
284
284
  }
285
- case y.USE_LICENSE: {
285
+ case D.USE_LICENSE: {
286
286
  this.triggerUseLicense(i);
287
287
  break;
288
288
  }
289
- case y.PARTICIPANT_STATE: {
289
+ case D.PARTICIPANT_STATE: {
290
290
  this.maybeTriggerParticipantMoveRequest(i);
291
291
  break;
292
292
  }
@@ -297,7 +297,7 @@ class Je {
297
297
  inputChannels: t,
298
298
  outputChannels: s
299
299
  };
300
- this.events.trigger(g.CHANNELS_NOTIFY, i);
300
+ this.events.trigger(l.CHANNELS_NOTIFY, i);
301
301
  };
302
302
  triggerWebcastStartedNotify = ({
303
303
  body: { conference: e, type: t }
@@ -306,7 +306,7 @@ class Je {
306
306
  conference: e,
307
307
  type: t
308
308
  };
309
- this.events.trigger(g.WEBCAST_STARTED, s);
309
+ this.events.trigger(l.WEBCAST_STARTED, s);
310
310
  };
311
311
  triggerWebcastStoppedNotify = ({
312
312
  body: { conference: e, type: t }
@@ -315,7 +315,7 @@ class Je {
315
315
  conference: e,
316
316
  type: t
317
317
  };
318
- this.events.trigger(g.WEBCAST_STOPPED, s);
318
+ this.events.trigger(l.WEBCAST_STOPPED, s);
319
319
  };
320
320
  triggerAddedToListModeratorsNotify = ({
321
321
  conference: e
@@ -324,7 +324,7 @@ class Je {
324
324
  conference: e
325
325
  };
326
326
  this.events.trigger(
327
- g.PARTICIPANT_ADDED_TO_LIST_MODERATORS,
327
+ l.PARTICIPANT_ADDED_TO_LIST_MODERATORS,
328
328
  t
329
329
  );
330
330
  };
@@ -335,7 +335,7 @@ class Je {
335
335
  conference: e
336
336
  };
337
337
  this.events.trigger(
338
- g.PARTICIPANT_REMOVED_FROM_LIST_MODERATORS,
338
+ l.PARTICIPANT_REMOVED_FROM_LIST_MODERATORS,
339
339
  t
340
340
  );
341
341
  };
@@ -345,7 +345,7 @@ class Je {
345
345
  const t = {
346
346
  conference: e
347
347
  };
348
- this.events.trigger(g.PARTICIPATION_ACCEPTING_WORD_REQUEST, t);
348
+ this.events.trigger(l.PARTICIPATION_ACCEPTING_WORD_REQUEST, t);
349
349
  };
350
350
  triggerParticipationCancellingWordRequest = ({
351
351
  body: { conference: e }
@@ -353,7 +353,7 @@ class Je {
353
353
  const t = {
354
354
  conference: e
355
355
  };
356
- this.events.trigger(g.PARTICIPATION_CANCELLING_WORD_REQUEST, t);
356
+ this.events.trigger(l.PARTICIPATION_CANCELLING_WORD_REQUEST, t);
357
357
  };
358
358
  triggerParticipantMoveRequestToStream = ({
359
359
  body: { conference: e }
@@ -361,13 +361,13 @@ class Je {
361
361
  const t = {
362
362
  conference: e
363
363
  };
364
- this.events.trigger(g.PARTICIPANT_MOVE_REQUEST_TO_STREAM, t);
364
+ this.events.trigger(l.PARTICIPANT_MOVE_REQUEST_TO_STREAM, t);
365
365
  };
366
366
  triggerAccountChangedNotify = () => {
367
- this.events.trigger(g.ACCOUNT_CHANGED, {});
367
+ this.events.trigger(l.ACCOUNT_CHANGED, {});
368
368
  };
369
369
  triggerAccountDeletedNotify = () => {
370
- this.events.trigger(g.ACCOUNT_DELETED, {});
370
+ this.events.trigger(l.ACCOUNT_DELETED, {});
371
371
  };
372
372
  triggerConferenceParticipantTokenIssued = ({
373
373
  body: { conference: e, participant: t, jwt: s }
@@ -378,82 +378,82 @@ class Je {
378
378
  jwt: s
379
379
  };
380
380
  this.events.trigger(
381
- g.CONFERENCE_PARTICIPANT_TOKEN_ISSUED,
381
+ l.CONFERENCE_PARTICIPANT_TOKEN_ISSUED,
382
382
  i
383
383
  );
384
384
  };
385
385
  maybeTriggerChannels = (e) => {
386
- const t = e.getHeader(E.INPUT_CHANNELS), s = e.getHeader(E.OUTPUT_CHANNELS);
386
+ const t = e.getHeader(g.INPUT_CHANNELS), s = e.getHeader(g.OUTPUT_CHANNELS);
387
387
  if (t && s) {
388
388
  const i = {
389
389
  inputChannels: t,
390
390
  outputChannels: s
391
391
  };
392
- this.events.trigger(g.CHANNELS, i);
392
+ this.events.trigger(l.CHANNELS, i);
393
393
  }
394
394
  };
395
395
  triggerEnterRoom = (e) => {
396
- const t = e.getHeader(E.CONTENT_ENTER_ROOM), s = e.getHeader(E.PARTICIPANT_NAME);
397
- this.events.trigger(g.ENTER_ROOM, { room: t, participantName: s });
396
+ const t = e.getHeader(g.CONTENT_ENTER_ROOM), s = e.getHeader(g.PARTICIPANT_NAME);
397
+ this.events.trigger(l.ENTER_ROOM, { room: t, participantName: s });
398
398
  };
399
399
  triggerShareState = (e) => {
400
- const t = e.getHeader(E.CONTENT_SHARE_STATE);
400
+ const t = e.getHeader(g.CONTENT_SHARE_STATE);
401
401
  if (t !== void 0)
402
402
  switch (t) {
403
- case B.AVAILABLE_SECOND_REMOTE_STREAM: {
404
- this.events.trigger(g.AVAILABLE_SECOND_REMOTE_STREAM, {});
403
+ case k.AVAILABLE_SECOND_REMOTE_STREAM: {
404
+ this.events.trigger(l.AVAILABLE_SECOND_REMOTE_STREAM, {});
405
405
  break;
406
406
  }
407
- case B.NOT_AVAILABLE_SECOND_REMOTE_STREAM: {
408
- this.events.trigger(g.NOT_AVAILABLE_SECOND_REMOTE_STREAM, {});
407
+ case k.NOT_AVAILABLE_SECOND_REMOTE_STREAM: {
408
+ this.events.trigger(l.NOT_AVAILABLE_SECOND_REMOTE_STREAM, {});
409
409
  break;
410
410
  }
411
- case B.MUST_STOP_PRESENTATION: {
412
- this.events.trigger(g.MUST_STOP_PRESENTATION, {});
411
+ case k.MUST_STOP_PRESENTATION: {
412
+ this.events.trigger(l.MUST_STOP_PRESENTATION, {});
413
413
  break;
414
414
  }
415
415
  }
416
416
  };
417
417
  maybeTriggerParticipantMoveRequest = (e) => {
418
- const t = e.getHeader(E.CONTENT_PARTICIPANT_STATE), s = e.getHeader(E.AUDIO_ID);
419
- t === x.SPECTATOR && (s ? (this.events.trigger(g.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_WITH_AUDIO_ID, {
418
+ const t = e.getHeader(g.CONTENT_PARTICIPANT_STATE), s = e.getHeader(g.AUDIO_ID);
419
+ t === x.SPECTATOR && (s ? (this.events.trigger(l.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_WITH_AUDIO_ID, {
420
420
  audioId: s
421
- }), this.events.trigger(g.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS, {
421
+ }), this.events.trigger(l.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS, {
422
422
  isSynthetic: !1,
423
423
  audioId: s
424
- })) : (this.events.trigger(g.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_SYNTHETIC, {}), this.events.trigger(g.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS, { isSynthetic: !0 }))), t === x.PARTICIPANT && this.events.trigger(g.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS, {});
424
+ })) : (this.events.trigger(l.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_SYNTHETIC, {}), this.events.trigger(l.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS, { isSynthetic: !0 }))), t === x.PARTICIPANT && this.events.trigger(l.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS, {});
425
425
  };
426
426
  triggerMainCamControl = (e) => {
427
- const t = e.getHeader(E.MAIN_CAM), s = e.getHeader(E.MEDIA_SYNC), i = s === Y.ADMIN_SYNC_FORCED;
428
- if (t === _.ADMIN_START_MAIN_CAM) {
429
- this.events.trigger(g.ADMIN_START_MAIN_CAM, { isSyncForced: i });
427
+ const t = e.getHeader(g.MAIN_CAM), s = e.getHeader(g.MEDIA_SYNC), i = s === Y.ADMIN_SYNC_FORCED;
428
+ if (t === v.ADMIN_START_MAIN_CAM) {
429
+ this.events.trigger(l.ADMIN_START_MAIN_CAM, { isSyncForced: i });
430
430
  return;
431
431
  }
432
- if (t === _.ADMIN_STOP_MAIN_CAM) {
433
- this.events.trigger(g.ADMIN_STOP_MAIN_CAM, { isSyncForced: i });
432
+ if (t === v.ADMIN_STOP_MAIN_CAM) {
433
+ this.events.trigger(l.ADMIN_STOP_MAIN_CAM, { isSyncForced: i });
434
434
  return;
435
435
  }
436
- (t === _.RESUME_MAIN_CAM || t === _.PAUSE_MAIN_CAM) && s !== void 0 && this.events.trigger(g.ADMIN_FORCE_SYNC_MEDIA_STATE, { isSyncForced: i });
437
- const r = e.getHeader(E.MAIN_CAM_RESOLUTION);
438
- this.events.trigger(g.MAIN_CAM_CONTROL, {
436
+ (t === v.RESUME_MAIN_CAM || t === v.PAUSE_MAIN_CAM) && s !== void 0 && this.events.trigger(l.ADMIN_FORCE_SYNC_MEDIA_STATE, { isSyncForced: i });
437
+ const r = e.getHeader(g.MAIN_CAM_RESOLUTION);
438
+ this.events.trigger(l.MAIN_CAM_CONTROL, {
439
439
  mainCam: t,
440
440
  resolutionMainCam: r
441
441
  });
442
442
  };
443
443
  triggerMicControl = (e) => {
444
- const t = e.getHeader(E.MIC), i = e.getHeader(E.MEDIA_SYNC) === Y.ADMIN_SYNC_FORCED;
445
- t === Q.ADMIN_START_MIC ? this.events.trigger(g.ADMIN_START_MIC, { isSyncForced: i }) : t === Q.ADMIN_STOP_MIC && this.events.trigger(g.ADMIN_STOP_MIC, { isSyncForced: i });
444
+ const t = e.getHeader(g.MIC), i = e.getHeader(g.MEDIA_SYNC) === Y.ADMIN_SYNC_FORCED;
445
+ t === Q.ADMIN_START_MIC ? this.events.trigger(l.ADMIN_START_MIC, { isSyncForced: i }) : t === Q.ADMIN_STOP_MIC && this.events.trigger(l.ADMIN_STOP_MIC, { isSyncForced: i });
446
446
  };
447
447
  triggerUseLicense = (e) => {
448
- const t = e.getHeader(E.CONTENT_USE_LICENSE);
449
- this.events.trigger(g.USE_LICENSE, t);
448
+ const t = e.getHeader(g.CONTENT_USE_LICENSE);
449
+ this.events.trigger(l.USE_LICENSE, t);
450
450
  };
451
451
  }
452
452
  class q {
453
453
  actor;
454
454
  subscriptions = [];
455
455
  constructor(e) {
456
- this.actor = qe(e), this.actor.start();
456
+ this.actor = xe(e), this.actor.start();
457
457
  }
458
458
  get actorRef() {
459
459
  return this.actor;
@@ -483,17 +483,17 @@ class q {
483
483
  return this.subscriptions.push(t), t;
484
484
  }
485
485
  }
486
- var Ke = /* @__PURE__ */ ((n) => (n.IDLE = "call:idle", n.CONNECTING = "call:connecting", n.RINGING = "call:ringing", n.ACCEPTED = "call:accepted", n.IN_CALL = "call:inCall", n.ENDED = "call:ended", n.FAILED = "call:failed", n))(Ke || {});
487
- const je = $({
486
+ var tt = /* @__PURE__ */ ((n) => (n.IDLE = "call:idle", n.CONNECTING = "call:connecting", n.ACCEPTED = "call:accepted", n.IN_CALL = "call:inCall", n.ENDED = "call:ended", n.FAILED = "call:failed", n))(tt || {});
487
+ const nt = G({
488
488
  types: {
489
489
  context: {},
490
490
  events: {}
491
491
  },
492
492
  actions: {
493
- rememberError: b(({ event: n }) => "error" in n && n.error !== void 0 ? {
493
+ rememberError: P(({ event: n }) => "error" in n && n.error !== void 0 ? {
494
494
  lastError: n.error instanceof Error ? n.error : new Error(JSON.stringify(n.error))
495
495
  } : { lastError: void 0 }),
496
- resetError: b({ lastError: void 0 })
496
+ resetError: P({ lastError: void 0 })
497
497
  }
498
498
  }).createMachine({
499
499
  id: "call",
@@ -505,29 +505,12 @@ const je = $({
505
505
  "CALL.CONNECTING": {
506
506
  target: "call:connecting",
507
507
  actions: "resetError"
508
- },
509
- "CALL.RINGING": {
510
- target: "call:ringing",
511
- actions: "resetError"
512
508
  }
513
509
  }
514
510
  },
515
511
  "call:connecting": {
516
- on: {
517
- "CALL.RINGING": "call:ringing",
518
- "CALL.ACCEPTED": "call:accepted",
519
- "CALL.CONFIRMED": "call:inCall",
520
- "CALL.ENDED": "call:ended",
521
- "CALL.FAILED": {
522
- target: "call:failed",
523
- actions: "rememberError"
524
- }
525
- }
526
- },
527
- "call:ringing": {
528
512
  on: {
529
513
  "CALL.ACCEPTED": "call:accepted",
530
- "CALL.CONFIRMED": "call:inCall",
531
514
  "CALL.ENDED": "call:ended",
532
515
  "CALL.FAILED": {
533
516
  target: "call:failed",
@@ -584,9 +567,9 @@ const je = $({
584
567
  }
585
568
  }
586
569
  });
587
- class Ze extends q {
570
+ class st extends q {
588
571
  constructor(e) {
589
- super(je), this.subscribeToEvents(e);
572
+ super(nt), this.subscribeToEvents(e);
590
573
  }
591
574
  get isIdle() {
592
575
  return this.state === "call:idle";
@@ -594,9 +577,6 @@ class Ze extends q {
594
577
  get isConnecting() {
595
578
  return this.state === "call:connecting";
596
579
  }
597
- get isRinging() {
598
- return this.state === "call:ringing";
599
- }
600
580
  get isAccepted() {
601
581
  return this.state === "call:accepted";
602
582
  }
@@ -613,7 +593,7 @@ class Ze extends q {
613
593
  return this.isAccepted || this.isInCall;
614
594
  }
615
595
  get isPending() {
616
- return this.isConnecting || this.isRinging;
596
+ return this.isConnecting;
617
597
  }
618
598
  get lastError() {
619
599
  return this.getSnapshot().context.lastError;
@@ -635,10 +615,6 @@ class Ze extends q {
635
615
  e.on("connecting", () => {
636
616
  this.send({ type: "CALL.CONNECTING" });
637
617
  })
638
- ), this.addSubscription(
639
- e.on("progress", () => {
640
- this.send({ type: "CALL.RINGING" });
641
- })
642
618
  ), this.addSubscription(
643
619
  e.on("accepted", () => {
644
620
  this.send({ type: "CALL.ACCEPTED" });
@@ -658,7 +634,7 @@ class Ze extends q {
658
634
  );
659
635
  }
660
636
  }
661
- var C = /* @__PURE__ */ ((n) => (n.PEER_CONNECTION = "peerconnection", n.CONNECTING = "connecting", n.SENDING = "sending", n.PROGRESS = "progress", n.ACCEPTED = "accepted", n.CONFIRMED = "confirmed", n.ENDED = "ended", n.FAILED = "failed", n.NEW_DTMF = "newDTMF", n.NEW_INFO = "newInfo", n.HOLD = "hold", n.UNHOLD = "unhold", n.MUTED = "muted", n.UNMUTED = "unmuted", n.REINVITE = "reinvite", n.UPDATE = "update", n.REFER = "refer", n.REPLACES = "replaces", n.SDP = "sdp", n.ICE_CANDIDATE = "icecandidate", n.GET_USER_MEDIA_FAILED = "getusermediafailed", n.PEER_CONNECTION_CREATE_OFFER_FAILED = "peerconnection:createofferfailed", n.PEER_CONNECTION_CREATE_ANSWER_FAILED = "peerconnection:createanswerfailed", n.PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED = "peerconnection:setlocaldescriptionfailed", n.PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED = "peerconnection:setremotedescriptionfailed", n.START_PRESENTATION = "presentation:start", n.STARTED_PRESENTATION = "presentation:started", n.END_PRESENTATION = "presentation:end", n.ENDED_PRESENTATION = "presentation:ended", n.FAILED_PRESENTATION = "presentation:failed", n.PEER_CONNECTION_CONFIRMED = "peerconnection:confirmed", n.PEER_CONNECTION_ONTRACK = "peerconnection:ontrack", n.ENDED_FROM_SERVER = "ended:fromserver", n.CALL_STATUS_CHANGED = "call-status-changed", n.REMOTE_STREAMS_CHANGED = "remote-streams-changed", n))(C || {}), et = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))(et || {});
637
+ var S = /* @__PURE__ */ ((n) => (n.PEER_CONNECTION = "peerconnection", n.CONNECTING = "connecting", n.SENDING = "sending", n.PROGRESS = "progress", n.ACCEPTED = "accepted", n.CONFIRMED = "confirmed", n.ENDED = "ended", n.FAILED = "failed", n.NEW_DTMF = "newDTMF", n.NEW_INFO = "newInfo", n.HOLD = "hold", n.UNHOLD = "unhold", n.MUTED = "muted", n.UNMUTED = "unmuted", n.REINVITE = "reinvite", n.UPDATE = "update", n.REFER = "refer", n.REPLACES = "replaces", n.SDP = "sdp", n.ICE_CANDIDATE = "icecandidate", n.GET_USER_MEDIA_FAILED = "getusermediafailed", n.PEER_CONNECTION_CREATE_OFFER_FAILED = "peerconnection:createofferfailed", n.PEER_CONNECTION_CREATE_ANSWER_FAILED = "peerconnection:createanswerfailed", n.PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED = "peerconnection:setlocaldescriptionfailed", n.PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED = "peerconnection:setremotedescriptionfailed", n.START_PRESENTATION = "presentation:start", n.STARTED_PRESENTATION = "presentation:started", n.END_PRESENTATION = "presentation:end", n.ENDED_PRESENTATION = "presentation:ended", n.FAILED_PRESENTATION = "presentation:failed", n.PEER_CONNECTION_CONFIRMED = "peerconnection:confirmed", n.PEER_CONNECTION_ONTRACK = "peerconnection:ontrack", n.ENDED_FROM_SERVER = "ended:fromserver", n.CALL_STATUS_CHANGED = "call-status-changed", n.REMOTE_STREAMS_CHANGED = "remote-streams-changed", n))(S || {}), it = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))(it || {});
662
638
  const ge = [
663
639
  "peerconnection",
664
640
  "connecting",
@@ -668,6 +644,10 @@ const ge = [
668
644
  "confirmed",
669
645
  "ended",
670
646
  "failed",
647
+ "hold",
648
+ "unhold",
649
+ "muted",
650
+ "unmuted",
671
651
  "newInfo",
672
652
  "newDTMF",
673
653
  "presentation:start",
@@ -686,7 +666,7 @@ const ge = [
686
666
  "peerconnection:createanswerfailed",
687
667
  "peerconnection:setlocaldescriptionfailed",
688
668
  "peerconnection:setremotedescriptionfailed"
689
- ], tt = [
669
+ ], rt = [
690
670
  "peerconnection:confirmed",
691
671
  "peerconnection:ontrack",
692
672
  "ended:fromserver",
@@ -694,12 +674,12 @@ const ge = [
694
674
  "remote-streams-changed"
695
675
  ], ue = [
696
676
  ...ge,
697
- ...tt
698
- ], nt = () => new M(ue), st = (n, e) => {
677
+ ...rt
678
+ ], at = () => new A(ue), ot = (n, e) => {
699
679
  n.getVideoTracks().forEach((s) => {
700
680
  "contentHint" in s && s.contentHint !== e && (s.contentHint = e);
701
681
  });
702
- }, k = (n, {
682
+ }, B = (n, {
703
683
  directionVideo: e,
704
684
  directionAudio: t,
705
685
  contentHint: s
@@ -707,16 +687,16 @@ const ge = [
707
687
  if (!n || e === "recvonly" && t === "recvonly")
708
688
  return;
709
689
  const i = t === "recvonly" ? [] : n.getAudioTracks(), r = e === "recvonly" ? [] : n.getVideoTracks(), a = [...i, ...r], o = new MediaStream(a);
710
- return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" && st(o, s), o;
690
+ return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" && ot(o, s), o;
711
691
  };
712
692
  var Te = /* @__PURE__ */ ((n) => (n.BYE = "Terminated", n.WEBRTC_ERROR = "WebRTC Error", n.CANCELED = "Canceled", n.REQUEST_TIMEOUT = "Request Timeout", n.REJECTED = "Rejected", n.REDIRECTED = "Redirected", n.UNAVAILABLE = "Unavailable", n.NOT_FOUND = "Not Found", n.ADDRESS_INCOMPLETE = "Address Incomplete", n.INCOMPATIBLE_SDP = "Incompatible SDP", n.BAD_MEDIA_DESCRIPTION = "Bad Media Description", n))(Te || {});
713
- class it {
693
+ class ct {
714
694
  events;
715
695
  rtcSession;
716
696
  disposers = /* @__PURE__ */ new Set();
717
697
  onReset;
718
698
  constructor(e, { onReset: t }) {
719
- this.events = e, this.onReset = t, e.on(C.FAILED, this.handleEnded), e.on(C.ENDED, this.handleEnded);
699
+ this.events = e, this.onReset = t, e.on(S.FAILED, this.handleEnded), e.on(S.ENDED, this.handleEnded);
720
700
  }
721
701
  get connection() {
722
702
  return this.rtcSession?.connection;
@@ -737,27 +717,27 @@ class it {
737
717
  iceServers: a,
738
718
  directionVideo: o,
739
719
  directionAudio: c,
740
- contentHint: l,
741
- offerToReceiveAudio: T = !0,
742
- offerToReceiveVideo: h = !0,
743
- degradationPreference: u,
744
- sendEncodings: p,
745
- onAddedTransceiver: A
746
- }) => new Promise((N, D) => {
747
- this.handleCall().then(N).catch((V) => {
748
- D(V);
720
+ contentHint: d,
721
+ offerToReceiveAudio: E = !0,
722
+ offerToReceiveVideo: u = !0,
723
+ degradationPreference: T,
724
+ sendEncodings: m,
725
+ onAddedTransceiver: O
726
+ }) => new Promise((N, y) => {
727
+ this.handleCall().then(N).catch((H) => {
728
+ y(H);
749
729
  }), this.rtcSession = e.call(t(s), {
750
- mediaStream: k(i, {
730
+ mediaStream: B(i, {
751
731
  directionVideo: o,
752
732
  directionAudio: c,
753
- contentHint: l
733
+ contentHint: d
754
734
  }),
755
735
  pcConfig: {
756
736
  iceServers: a
757
737
  },
758
738
  rtcOfferConstraints: {
759
- offerToReceiveAudio: T,
760
- offerToReceiveVideo: h
739
+ offerToReceiveAudio: E,
740
+ offerToReceiveVideo: u
761
741
  },
762
742
  // необходимо передавать в методе call, чтобы подписаться на события peerconnection,
763
743
  // так как в методе call создается RTCSession
@@ -766,9 +746,9 @@ class it {
766
746
  extraHeaders: r,
767
747
  directionVideo: o,
768
748
  directionAudio: c,
769
- degradationPreference: u,
770
- sendEncodings: p,
771
- onAddedTransceiver: A
749
+ degradationPreference: T,
750
+ sendEncodings: m,
751
+ onAddedTransceiver: O
772
752
  });
773
753
  });
774
754
  async endCall() {
@@ -789,14 +769,14 @@ class it {
789
769
  directionAudio: a,
790
770
  offerToReceiveAudio: o,
791
771
  offerToReceiveVideo: c,
792
- contentHint: l,
793
- degradationPreference: T,
794
- sendEncodings: h,
795
- onAddedTransceiver: u
796
- }) => new Promise((p, A) => {
772
+ contentHint: d,
773
+ degradationPreference: E,
774
+ sendEncodings: u,
775
+ onAddedTransceiver: T
776
+ }) => new Promise((m, O) => {
797
777
  try {
798
- this.rtcSession = e, this.subscribeToSessionEvents(e), this.handleCall().then(p).catch((N) => {
799
- A(N);
778
+ this.rtcSession = e, this.subscribeToSessionEvents(e), this.handleCall().then(m).catch((N) => {
779
+ O(N);
800
780
  }), e.answer({
801
781
  pcConfig: {
802
782
  iceServers: i
@@ -805,26 +785,26 @@ class it {
805
785
  offerToReceiveAudio: o,
806
786
  offerToReceiveVideo: c
807
787
  },
808
- mediaStream: k(t, {
788
+ mediaStream: B(t, {
809
789
  directionVideo: r,
810
790
  directionAudio: a,
811
- contentHint: l
791
+ contentHint: d
812
792
  }),
813
793
  extraHeaders: s,
814
794
  directionVideo: r,
815
795
  directionAudio: a,
816
- degradationPreference: T,
817
- sendEncodings: h,
818
- onAddedTransceiver: u
796
+ degradationPreference: E,
797
+ sendEncodings: u,
798
+ onAddedTransceiver: T
819
799
  });
820
800
  } catch (N) {
821
- A(N);
801
+ O(N);
822
802
  }
823
803
  });
824
804
  async replaceMediaStream(e, t) {
825
805
  if (!this.rtcSession)
826
806
  throw new Error("No rtcSession established");
827
- const { contentHint: s } = t ?? {}, i = k(e, { contentHint: s });
807
+ const { contentHint: s } = t ?? {}, i = B(e, { contentHint: s });
828
808
  if (i === void 0)
829
809
  throw new Error("No preparedMediaStream");
830
810
  return this.rtcSession.replaceMediaStream(i, t);
@@ -836,27 +816,27 @@ class it {
836
816
  }
837
817
  handleCall = async () => new Promise((e, t) => {
838
818
  const s = () => {
839
- this.events.on(C.PEER_CONNECTION, l), this.events.on(C.CONFIRMED, T);
819
+ this.events.on(S.PEER_CONNECTION, d), this.events.on(S.CONFIRMED, E);
840
820
  }, i = () => {
841
- this.events.off(C.PEER_CONNECTION, l), this.events.off(C.CONFIRMED, T);
821
+ this.events.off(S.PEER_CONNECTION, d), this.events.off(S.CONFIRMED, E);
842
822
  }, r = () => {
843
- this.events.on(C.FAILED, o), this.events.on(C.ENDED, o);
823
+ this.events.on(S.FAILED, o), this.events.on(S.ENDED, o);
844
824
  }, a = () => {
845
- this.events.off(C.FAILED, o), this.events.off(C.ENDED, o);
846
- }, o = (h) => {
847
- i(), a(), t(h);
825
+ this.events.off(S.FAILED, o), this.events.off(S.ENDED, o);
826
+ }, o = (u) => {
827
+ i(), a(), t(u);
848
828
  };
849
829
  let c;
850
- const l = ({ peerconnection: h }) => {
851
- c = h;
852
- const u = (p) => {
853
- this.events.trigger(C.PEER_CONNECTION_ONTRACK, p);
830
+ const d = ({ peerconnection: u }) => {
831
+ c = u;
832
+ const T = (m) => {
833
+ this.events.trigger(S.PEER_CONNECTION_ONTRACK, m);
854
834
  };
855
- h.addEventListener("track", u), this.disposers.add(() => {
856
- h.removeEventListener("track", u);
835
+ u.addEventListener("track", T), this.disposers.add(() => {
836
+ u.removeEventListener("track", T);
857
837
  });
858
- }, T = () => {
859
- c !== void 0 && this.events.trigger(C.PEER_CONNECTION_CONFIRMED, c), i(), a(), e(c);
838
+ }, E = () => {
839
+ c !== void 0 && this.events.trigger(S.PEER_CONNECTION_CONFIRMED, c), i(), a(), e(c);
860
840
  };
861
841
  s(), r();
862
842
  });
@@ -875,13 +855,13 @@ class it {
875
855
  }
876
856
  handleEnded = (e) => {
877
857
  const { originator: t } = e;
878
- t === "remote" && this.events.trigger(C.ENDED_FROM_SERVER, e), this.reset();
858
+ t === "remote" && this.events.trigger(S.ENDED_FROM_SERVER, e), this.reset();
879
859
  };
880
860
  reset = () => {
881
861
  delete this.rtcSession, this.unsubscribeFromSessionEvents(), this.onReset();
882
862
  };
883
863
  }
884
- class rt {
864
+ class ht {
885
865
  config;
886
866
  tools;
887
867
  connection;
@@ -930,13 +910,13 @@ class rt {
930
910
  return this.connection.addTransceiver(e, t);
931
911
  }
932
912
  }
933
- const Ee = (n) => n.getSettings(), at = (n, e) => {
913
+ const Ee = (n) => n.getSettings(), dt = (n, e) => {
934
914
  const t = Ee(n);
935
915
  let s = e;
936
916
  s ??= n.label;
937
917
  let i = t?.msid;
938
918
  return i ??= s, i ??= n.id, i;
939
- }, ot = (n, e) => {
919
+ }, lt = (n, e) => {
940
920
  const t = Ee(n);
941
921
  let s = e;
942
922
  return s ??= t?.msid, s ??= n.label, (s && s.length > 0 ? s : void 0) ?? n.id;
@@ -958,7 +938,7 @@ class Z {
958
938
  onRemoved: t,
959
939
  streamHint: s
960
940
  } = {}) {
961
- const i = ot(e, s), r = at(e, s);
941
+ const i = lt(e, s), r = dt(e, s);
962
942
  if (this.trackToGroup.has(e.id))
963
943
  return { isAdded: !1 };
964
944
  const a = this.getParticipantGroups(i);
@@ -994,8 +974,8 @@ class Z {
994
974
  let i = !1;
995
975
  return [...s.values()].forEach((a) => {
996
976
  [...a.trackIds].filter((c) => !t.includes(c)).forEach((c) => {
997
- const l = this.removeTrack(c);
998
- i ||= l;
977
+ const d = this.removeTrack(c);
978
+ i ||= d;
999
979
  });
1000
980
  }), i;
1001
981
  }
@@ -1018,16 +998,16 @@ class Z {
1018
998
  return this.participantGroups.set(e, s), s;
1019
999
  }
1020
1000
  }
1021
- const H = {
1001
+ const V = {
1022
1002
  type: "participant"
1023
- }, ct = {
1003
+ }, gt = {
1024
1004
  type: "spectator_synthetic"
1025
- }, dt = (n) => ({
1005
+ }, ut = (n) => ({
1026
1006
  type: "spectator",
1027
1007
  recvParams: n
1028
1008
  });
1029
- class O {
1030
- role = H;
1009
+ class _ {
1010
+ role = V;
1031
1011
  mainManager;
1032
1012
  recvManager;
1033
1013
  onRoleChanged;
@@ -1050,13 +1030,13 @@ class O {
1050
1030
  return this.role;
1051
1031
  }
1052
1032
  setCallRoleParticipant() {
1053
- this.changeRole(H);
1033
+ this.changeRole(V);
1054
1034
  }
1055
1035
  setCallRoleSpectatorSynthetic() {
1056
- this.changeRole(ct);
1036
+ this.changeRole(gt);
1057
1037
  }
1058
1038
  setCallRoleSpectator(e) {
1059
- this.changeRole(dt(e));
1039
+ this.changeRole(ut(e));
1060
1040
  }
1061
1041
  changeRole(e) {
1062
1042
  const t = this.role;
@@ -1064,22 +1044,22 @@ class O {
1064
1044
  this.setRole(e);
1065
1045
  return;
1066
1046
  }
1067
- O.hasSpectator(e) && O.hasSpectator(t) && t.recvParams.audioId !== e.recvParams.audioId && this.setRole(e);
1047
+ _.hasSpectator(e) && _.hasSpectator(t) && t.recvParams.audioId !== e.recvParams.audioId && this.setRole(e);
1068
1048
  }
1069
1049
  reset() {
1070
- this.role = H, this.recvManager.reset();
1050
+ this.role = V, this.recvManager.reset();
1071
1051
  }
1072
1052
  getActiveManager() {
1073
1053
  return this.hasSpectator() ? this.recvManager : this.mainManager;
1074
1054
  }
1075
1055
  hasParticipant() {
1076
- return O.hasParticipant(this.role);
1056
+ return _.hasParticipant(this.role);
1077
1057
  }
1078
1058
  hasSpectatorSynthetic() {
1079
- return O.hasSpectatorSynthetic(this.role);
1059
+ return _.hasSpectatorSynthetic(this.role);
1080
1060
  }
1081
1061
  hasSpectator() {
1082
- return O.hasSpectator(this.role);
1062
+ return _.hasSpectator(this.role);
1083
1063
  }
1084
1064
  setRole(e) {
1085
1065
  const t = this.role;
@@ -1087,7 +1067,7 @@ class O {
1087
1067
  }
1088
1068
  }
1089
1069
  const ee = (n) => n.streams[0]?.id;
1090
- class lt {
1070
+ class Tt {
1091
1071
  events;
1092
1072
  callStateMachine;
1093
1073
  isPendingCall = !1;
@@ -1096,7 +1076,7 @@ class lt {
1096
1076
  conferenceStateManager;
1097
1077
  mainRemoteStreamsManager = new Z();
1098
1078
  recvRemoteStreamsManager = new Z();
1099
- roleManager = new O(
1079
+ roleManager = new _(
1100
1080
  { mainManager: this.mainRemoteStreamsManager, recvManager: this.recvRemoteStreamsManager },
1101
1081
  (e) => {
1102
1082
  this.onRoleChanged(e);
@@ -1106,7 +1086,7 @@ class lt {
1106
1086
  recvSession;
1107
1087
  disposeRecvSessionTrackListener;
1108
1088
  constructor(e) {
1109
- this.conferenceStateManager = e, this.events = nt(), this.mcuSession = new it(this.events, { onReset: this.reset }), this.callStateMachine = new Ze(this.events), this.subscribeCallStatusChange(), this.subscribeMcuRemoteTrackEvents();
1089
+ this.conferenceStateManager = e, this.events = at(), this.mcuSession = new ct(this.events, { onReset: this.reset }), this.callStateMachine = new st(this.events), this.subscribeCallStatusChange(), this.subscribeMcuRemoteTrackEvents();
1110
1090
  }
1111
1091
  get callActor() {
1112
1092
  return this.callStateMachine.actorRef;
@@ -1184,17 +1164,17 @@ class lt {
1184
1164
  };
1185
1165
  subscribeCallStatusChange() {
1186
1166
  let { isCallActive: e } = this;
1187
- const { ACCEPTED: t, CONFIRMED: s, ENDED: i, FAILED: r } = C;
1167
+ const { ACCEPTED: t, CONFIRMED: s, ENDED: i, FAILED: r } = S;
1188
1168
  this.onRace([t, s, i, r], () => {
1189
1169
  e = this.maybeTriggerCallStatus(e);
1190
1170
  });
1191
1171
  }
1192
1172
  maybeTriggerCallStatus(e) {
1193
1173
  const t = this.isCallActive;
1194
- return t !== e && this.events.trigger(C.CALL_STATUS_CHANGED, { isCallActive: t }), t;
1174
+ return t !== e && this.events.trigger(S.CALL_STATUS_CHANGED, { isCallActive: t }), t;
1195
1175
  }
1196
1176
  subscribeMcuRemoteTrackEvents() {
1197
- this.on(C.PEER_CONNECTION_ONTRACK, (e) => {
1177
+ this.on(S.PEER_CONNECTION_ONTRACK, (e) => {
1198
1178
  this.addRemoteTrack(this.mainRemoteStreamsManager, e.track, ee(e));
1199
1179
  });
1200
1180
  }
@@ -1218,7 +1198,7 @@ class lt {
1218
1198
  if (e !== r)
1219
1199
  return;
1220
1200
  const a = [...r.getStreams()];
1221
- this.events.trigger(C.REMOTE_STREAMS_CHANGED, {
1201
+ this.events.trigger(S.REMOTE_STREAMS_CHANGED, {
1222
1202
  participantId: i,
1223
1203
  changeType: t,
1224
1204
  trackId: s,
@@ -1244,7 +1224,7 @@ class lt {
1244
1224
  const i = {
1245
1225
  quality: "high",
1246
1226
  audioChannel: e
1247
- }, r = new rt(i, { sendOffer: t });
1227
+ }, r = new ht(i, { sendOffer: t });
1248
1228
  this.recvSession = r, this.recvRemoteStreamsManager.reset(), this.attachRecvSessionTracks(r), r.call(s).catch(() => {
1249
1229
  this.stopRecvSession();
1250
1230
  });
@@ -1256,45 +1236,45 @@ class lt {
1256
1236
  previous: e,
1257
1237
  next: t
1258
1238
  }) => {
1259
- if (O.hasSpectator(e) && !O.hasSpectator(t) && this.stopRecvSession(), O.hasSpectator(t)) {
1239
+ if (_.hasSpectator(e) && !_.hasSpectator(t) && this.stopRecvSession(), _.hasSpectator(t)) {
1260
1240
  const s = t.recvParams;
1261
1241
  this.startRecvSession(s.audioId, s.sendOffer);
1262
1242
  }
1263
1243
  };
1264
1244
  }
1265
- const ht = (n, e) => (n.degradationPreference = e.degradationPreference, n), gt = (n, e) => {
1245
+ const Et = (n, e) => (n.degradationPreference = e.degradationPreference, n), St = (n, e) => {
1266
1246
  n.encodings ??= [];
1267
1247
  for (let t = n.encodings.length; t < e; t += 1)
1268
1248
  n.encodings.push({});
1269
1249
  return n;
1270
- }, Ce = (n) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== n, ut = Ce(), Tt = (n, e) => {
1271
- if (ut(n, e))
1250
+ }, Se = (n) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== n, pt = Se(), Ct = (n, e) => {
1251
+ if (pt(n, e))
1272
1252
  return n;
1273
- }, Et = (n, e) => {
1274
- const t = n.maxBitrate, s = Tt(e, t);
1253
+ }, mt = (n, e) => {
1254
+ const t = n.maxBitrate, s = Ct(e, t);
1275
1255
  return s !== void 0 && (n.maxBitrate = s), n;
1276
- }, Se = 1, Ct = Ce(
1277
- Se
1278
- ), St = (n, e) => {
1279
- const t = n === void 0 ? void 0 : Math.max(n, Se);
1280
- if (t !== void 0 && Ct(
1256
+ }, pe = 1, Nt = Se(
1257
+ pe
1258
+ ), Rt = (n, e) => {
1259
+ const t = n === void 0 ? void 0 : Math.max(n, pe);
1260
+ if (t !== void 0 && Nt(
1281
1261
  t,
1282
1262
  e
1283
1263
  ))
1284
1264
  return t;
1285
- }, pt = (n, e) => {
1286
- const t = n.scaleResolutionDownBy, s = St(
1265
+ }, At = (n, e) => {
1266
+ const t = n.scaleResolutionDownBy, s = Rt(
1287
1267
  e,
1288
1268
  t
1289
1269
  );
1290
1270
  return s !== void 0 && (n.scaleResolutionDownBy = s), n;
1291
- }, mt = (n, e) => {
1271
+ }, It = (n, e) => {
1292
1272
  const t = e.encodings?.length ?? 0;
1293
- return gt(n, t), n.encodings.forEach((s, i) => {
1273
+ return St(n, t), n.encodings.forEach((s, i) => {
1294
1274
  const r = (e?.encodings ?? [])[i], a = r?.maxBitrate, o = r?.scaleResolutionDownBy;
1295
- Et(s, a), pt(s, o);
1275
+ mt(s, a), At(s, o);
1296
1276
  }), n;
1297
- }, Nt = (n, e) => {
1277
+ }, ft = (n, e) => {
1298
1278
  if (n.codecs?.length !== e.codecs?.length)
1299
1279
  return !0;
1300
1280
  for (let t = 0; t < (n.codecs?.length ?? 0); t++)
@@ -1311,15 +1291,15 @@ const ht = (n, e) => (n.degradationPreference = e.degradationPreference, n), gt
1311
1291
  if (JSON.stringify(n.encodings[t]) !== JSON.stringify(e.encodings[t]))
1312
1292
  return !0;
1313
1293
  return n.rtcp?.cname !== e.rtcp?.cname || n.rtcp?.reducedSize !== e.rtcp?.reducedSize || n.degradationPreference !== e.degradationPreference;
1314
- }, Rt = async (n, e) => {
1294
+ }, Mt = async (n, e) => {
1315
1295
  const t = n.getParameters(), s = JSON.parse(
1316
1296
  JSON.stringify(t)
1317
1297
  );
1318
- mt(t, e), ht(t, e);
1319
- const i = Nt(s, t);
1298
+ It(t, e), Et(t, e);
1299
+ const i = ft(s, t);
1320
1300
  return i && await n.setParameters(t), { parameters: t, isChanged: i };
1321
- }, pe = async (n, e, t) => {
1322
- const { isChanged: s, parameters: i } = await Rt(n, {
1301
+ }, Ce = async (n, e, t) => {
1302
+ const { isChanged: s, parameters: i } = await Mt(n, {
1323
1303
  encodings: [
1324
1304
  {
1325
1305
  scaleResolutionDownBy: e.scaleResolutionDownBy,
@@ -1328,36 +1308,36 @@ const ht = (n, e) => (n.degradationPreference = e.degradationPreference, n), gt
1328
1308
  ]
1329
1309
  });
1330
1310
  return s && t && t(i), { isChanged: s, parameters: i };
1331
- }, At = (n, e) => n.find((t) => t.track !== null && e.getTracks().includes(t.track)), It = async (n, e, t) => {
1332
- const s = At(n, e);
1311
+ }, vt = (n, e) => n.find((t) => t.track !== null && e.getTracks().includes(t.track)), _t = async (n, e, t) => {
1312
+ const s = vt(n, e);
1333
1313
  if (s)
1334
- return pe(s, { maxBitrate: t });
1314
+ return Ce(s, { maxBitrate: t });
1335
1315
  };
1336
- var P = /* @__PURE__ */ ((n) => (n.START_PRESENTATION = "presentation:start", n.STARTED_PRESENTATION = "presentation:started", n.END_PRESENTATION = "presentation:end", n.ENDED_PRESENTATION = "presentation:ended", n.FAILED_PRESENTATION = "presentation:failed", n))(P || {});
1316
+ var b = /* @__PURE__ */ ((n) => (n.START_PRESENTATION = "presentation:start", n.STARTED_PRESENTATION = "presentation:started", n.END_PRESENTATION = "presentation:end", n.ENDED_PRESENTATION = "presentation:ended", n.FAILED_PRESENTATION = "presentation:failed", n))(b || {});
1337
1317
  const me = [
1338
1318
  "presentation:start",
1339
1319
  "presentation:started",
1340
1320
  "presentation:end",
1341
1321
  "presentation:ended",
1342
1322
  "presentation:failed"
1343
- ], ft = () => new M(me);
1344
- var Mt = /* @__PURE__ */ ((n) => (n.IDLE = "presentation:idle", n.STARTING = "presentation:starting", n.ACTIVE = "presentation:active", n.STOPPING = "presentation:stopping", n.FAILED = "presentation:failed", n))(Mt || {});
1345
- const vt = $({
1323
+ ], Ot = () => new A(me);
1324
+ var bt = /* @__PURE__ */ ((n) => (n.IDLE = "presentation:idle", n.STARTING = "presentation:starting", n.ACTIVE = "presentation:active", n.STOPPING = "presentation:stopping", n.FAILED = "presentation:failed", n))(bt || {});
1325
+ const Pt = G({
1346
1326
  types: {
1347
1327
  context: {},
1348
1328
  events: {}
1349
1329
  },
1350
1330
  actions: {
1351
1331
  logTransition: (n, e) => {
1352
- d(`State transition: ${e.from} -> ${e.to} (${e.event})`);
1332
+ h(`State transition: ${e.from} -> ${e.to} (${e.event})`);
1353
1333
  },
1354
1334
  logStateChange: (n, e) => {
1355
- d("PresentationStateMachine state changed", e.state);
1335
+ h("PresentationStateMachine state changed", e.state);
1356
1336
  },
1357
- setError: b(({ event: n }) => "error" in n && n.error !== void 0 ? {
1337
+ setError: P(({ event: n }) => "error" in n && n.error !== void 0 ? {
1358
1338
  lastError: n.error instanceof Error ? n.error : new Error(JSON.stringify(n.error))
1359
1339
  } : { lastError: void 0 }),
1360
- clearError: b({ lastError: void 0 })
1340
+ clearError: P({ lastError: void 0 })
1361
1341
  }
1362
1342
  }).createMachine({
1363
1343
  id: "presentation",
@@ -1667,9 +1647,9 @@ const vt = $({
1667
1647
  }
1668
1648
  }
1669
1649
  });
1670
- class _t extends q {
1650
+ class Dt extends q {
1671
1651
  constructor(e) {
1672
- super(vt), this.subscribeCallEvents(e);
1652
+ super(Pt), this.subscribeCallEvents(e);
1673
1653
  }
1674
1654
  get isIdle() {
1675
1655
  return this.state === "presentation:idle";
@@ -1709,38 +1689,38 @@ class _t extends q {
1709
1689
  }
1710
1690
  subscribeCallEvents(e) {
1711
1691
  this.addSubscription(
1712
- e.on(C.START_PRESENTATION, () => {
1692
+ e.on(S.START_PRESENTATION, () => {
1713
1693
  this.send({ type: "SCREEN.STARTING" });
1714
1694
  })
1715
1695
  ), this.addSubscription(
1716
- e.on(C.STARTED_PRESENTATION, () => {
1696
+ e.on(S.STARTED_PRESENTATION, () => {
1717
1697
  this.send({ type: "SCREEN.STARTED" });
1718
1698
  })
1719
1699
  ), this.addSubscription(
1720
- e.on(C.END_PRESENTATION, () => {
1700
+ e.on(S.END_PRESENTATION, () => {
1721
1701
  this.send({ type: "SCREEN.ENDING" });
1722
1702
  })
1723
1703
  ), this.addSubscription(
1724
- e.on(C.ENDED_PRESENTATION, () => {
1704
+ e.on(S.ENDED_PRESENTATION, () => {
1725
1705
  this.send({ type: "SCREEN.ENDED" });
1726
1706
  })
1727
1707
  ), this.addSubscription(
1728
- e.on(C.FAILED_PRESENTATION, (t) => {
1708
+ e.on(S.FAILED_PRESENTATION, (t) => {
1729
1709
  this.send({ type: "SCREEN.FAILED", error: t });
1730
1710
  })
1731
1711
  ), this.addSubscription(
1732
- e.on(C.ENDED, () => {
1712
+ e.on(S.ENDED, () => {
1733
1713
  this.send({ type: "CALL.ENDED" });
1734
1714
  })
1735
1715
  ), this.addSubscription(
1736
- e.on(C.FAILED, (t) => {
1716
+ e.on(S.FAILED, (t) => {
1737
1717
  this.send({ type: "CALL.FAILED", error: t });
1738
1718
  })
1739
1719
  );
1740
1720
  }
1741
1721
  }
1742
- const Ot = 1, Bs = (n) => $e(n);
1743
- class Pt {
1722
+ const yt = 1, Ws = (n) => We(n);
1723
+ class wt {
1744
1724
  events;
1745
1725
  presentationStateMachine;
1746
1726
  promisePendingStartPresentation;
@@ -1753,7 +1733,7 @@ class Pt {
1753
1733
  callManager: e,
1754
1734
  maxBitrate: t
1755
1735
  }) {
1756
- this.callManager = e, this.maxBitrate = t, this.events = ft(), this.presentationStateMachine = new _t(this.callManager.events), this.subscribe();
1736
+ this.callManager = e, this.maxBitrate = t, this.events = Ot(), this.presentationStateMachine = new Dt(this.callManager.events), this.subscribe();
1757
1737
  }
1758
1738
  get presentationActor() {
1759
1739
  return this.presentationStateMachine.actorRef;
@@ -1795,8 +1775,8 @@ class Pt {
1795
1775
  const i = this.callManager.getEstablishedRTCSession();
1796
1776
  return i && t ? s = e().then(async () => i.stopPresentation(t)).catch((r) => {
1797
1777
  const a = r instanceof Error ? r : new Error(String(r));
1798
- throw this.events.trigger(P.FAILED_PRESENTATION, a), r;
1799
- }) : t && this.events.trigger(P.ENDED_PRESENTATION, t), this.promisePendingStopPresentation = s, s.finally(() => {
1778
+ throw this.events.trigger(b.FAILED_PRESENTATION, a), r;
1779
+ }) : t && this.events.trigger(b.ENDED_PRESENTATION, t), this.promisePendingStopPresentation = s, s.finally(() => {
1800
1780
  this.resetPresentation();
1801
1781
  });
1802
1782
  }
@@ -1835,15 +1815,15 @@ class Pt {
1835
1815
  }
1836
1816
  subscribe() {
1837
1817
  this.callManager.on("presentation:start", (e) => {
1838
- this.events.trigger(P.START_PRESENTATION, e);
1818
+ this.events.trigger(b.START_PRESENTATION, e);
1839
1819
  }), this.callManager.on("presentation:started", (e) => {
1840
- this.events.trigger(P.STARTED_PRESENTATION, e);
1820
+ this.events.trigger(b.STARTED_PRESENTATION, e);
1841
1821
  }), this.callManager.on("presentation:end", (e) => {
1842
- this.events.trigger(P.END_PRESENTATION, e);
1822
+ this.events.trigger(b.END_PRESENTATION, e);
1843
1823
  }), this.callManager.on("presentation:ended", (e) => {
1844
- this.events.trigger(P.ENDED_PRESENTATION, e);
1824
+ this.events.trigger(b.ENDED_PRESENTATION, e);
1845
1825
  }), this.callManager.on("presentation:failed", (e) => {
1846
- this.events.trigger(P.FAILED_PRESENTATION, e);
1826
+ this.events.trigger(b.FAILED_PRESENTATION, e);
1847
1827
  }), this.callManager.on("failed", this.handleEnded), this.callManager.on("ended", this.handleEnded);
1848
1828
  }
1849
1829
  async sendPresentationWithDuplicatedCalls(e, {
@@ -1851,7 +1831,7 @@ class Pt {
1851
1831
  stream: s,
1852
1832
  presentationOptions: i,
1853
1833
  options: r = {
1854
- callLimit: Ot
1834
+ callLimit: yt
1855
1835
  }
1856
1836
  }) {
1857
1837
  const a = async () => this.sendPresentation(
@@ -1860,7 +1840,7 @@ class Pt {
1860
1840
  s,
1861
1841
  i
1862
1842
  ), o = () => !!this.streamPresentationCurrent;
1863
- return this.cancelableSendPresentationWithRepeatedCalls = de({
1843
+ return this.cancelableSendPresentationWithRepeatedCalls = he({
1864
1844
  targetFunction: a,
1865
1845
  isComplete: o,
1866
1846
  isRejectAsValid: !0,
@@ -1875,20 +1855,20 @@ class Pt {
1875
1855
  sendEncodings: o,
1876
1856
  onAddedTransceiver: c
1877
1857
  }) {
1878
- const l = k(s, { contentHint: r });
1879
- if (l === void 0)
1858
+ const d = B(s, { contentHint: r });
1859
+ if (d === void 0)
1880
1860
  throw new Error("No streamPresentationTarget");
1881
- this.streamPresentationCurrent = l;
1882
- const T = e().then(async () => t.startPresentation(l, i, {
1861
+ this.streamPresentationCurrent = d;
1862
+ const E = e().then(async () => t.startPresentation(d, i, {
1883
1863
  degradationPreference: a,
1884
1864
  sendEncodings: o,
1885
1865
  onAddedTransceiver: c
1886
- })).then(this.setMaxBitrate).then(() => s).catch((h) => {
1866
+ })).then(this.setMaxBitrate).then(() => s).catch((u) => {
1887
1867
  this.removeStreamPresentationCurrent();
1888
- const u = h instanceof Error ? h : new Error(String(h));
1889
- throw this.events.trigger(P.FAILED_PRESENTATION, u), h;
1868
+ const T = u instanceof Error ? u : new Error(String(u));
1869
+ throw this.events.trigger(b.FAILED_PRESENTATION, T), u;
1890
1870
  });
1891
- return this.promisePendingStartPresentation = T, T.finally(() => {
1871
+ return this.promisePendingStartPresentation = E, E.finally(() => {
1892
1872
  this.promisePendingStartPresentation = void 0;
1893
1873
  });
1894
1874
  }
@@ -1897,7 +1877,7 @@ class Pt {
1897
1877
  if (!e || !t || s === void 0)
1898
1878
  return;
1899
1879
  const i = e.getSenders();
1900
- await It(i, t, s);
1880
+ await _t(i, t, s);
1901
1881
  };
1902
1882
  getRtcSessionProtected = () => {
1903
1883
  const e = this.callManager.getEstablishedRTCSession();
@@ -1918,7 +1898,7 @@ class Pt {
1918
1898
  delete this.streamPresentationCurrent;
1919
1899
  }
1920
1900
  }
1921
- class bt {
1901
+ class Lt {
1922
1902
  data;
1923
1903
  getUa;
1924
1904
  constructor(e) {
@@ -2004,7 +1984,7 @@ class bt {
2004
1984
  return this.data?.register === !0;
2005
1985
  }
2006
1986
  }
2007
- var S = /* @__PURE__ */ ((n) => (n.CONNECTING = "connecting", n.CONNECTED = "connected", n.DISCONNECTED = "disconnected", n.DISCONNECTING = "disconnecting", n.NEW_RTC_SESSION = "newRTCSession", n.REGISTERED = "registered", n.UNREGISTERED = "unregistered", n.REGISTRATION_FAILED = "registrationFailed", n.NEW_MESSAGE = "newMessage", n.SIP_EVENT = "sipEvent", n.CONNECT_STARTED = "connect-started", n.CONNECT_SUCCEEDED = "connect-succeeded", n.CONNECT_FAILED = "connect-failed", n.CONNECT_PARAMETERS_RESOLVE_SUCCESS = "connect-parameters-resolve-success", n.CONNECT_PARAMETERS_RESOLVE_FAILED = "connect-parameters-resolve-failed", n.CONNECTED_WITH_CONFIGURATION = "connected-with-configuration", n))(S || {});
1987
+ var p = /* @__PURE__ */ ((n) => (n.CONNECTING = "connecting", n.CONNECTED = "connected", n.DISCONNECTED = "disconnected", n.DISCONNECTING = "disconnecting", n.NEW_RTC_SESSION = "newRTCSession", n.REGISTERED = "registered", n.UNREGISTERED = "unregistered", n.REGISTRATION_FAILED = "registrationFailed", n.NEW_MESSAGE = "newMessage", n.SIP_EVENT = "sipEvent", n.CONNECT_STARTED = "connect-started", n.CONNECT_SUCCEEDED = "connect-succeeded", n.CONNECT_FAILED = "connect-failed", n.CONNECT_PARAMETERS_RESOLVE_SUCCESS = "connect-parameters-resolve-success", n.CONNECT_PARAMETERS_RESOLVE_FAILED = "connect-parameters-resolve-failed", n.CONNECTED_WITH_CONFIGURATION = "connected-with-configuration", n))(p || {});
2008
1988
  const Ne = [
2009
1989
  "connecting",
2010
1990
  "connected",
@@ -2015,7 +1995,7 @@ const Ne = [
2015
1995
  "registrationFailed",
2016
1996
  "newMessage",
2017
1997
  "sipEvent"
2018
- ], Dt = [
1998
+ ], Ut = [
2019
1999
  "disconnecting",
2020
2000
  "connect-started",
2021
2001
  "connect-succeeded",
@@ -2023,12 +2003,12 @@ const Ne = [
2023
2003
  "connect-parameters-resolve-success",
2024
2004
  "connect-parameters-resolve-failed",
2025
2005
  "connected-with-configuration"
2026
- ], Re = [...Ne, ...Dt], yt = () => new M(Re);
2027
- function Lt(n) {
2006
+ ], Re = [...Ne, ...Ut], Ft = () => new A(Re);
2007
+ function kt(n) {
2028
2008
  return (e) => `sip:${e}@${n}`;
2029
2009
  }
2030
- const wt = (n, e) => () => Math.floor(Math.random() * (e - n)) + n, Ae = (n) => n.trim().replaceAll(" ", "_"), Ut = wt(1e5, 99999999), Ft = 3;
2031
- class Bt {
2010
+ const Bt = (n, e) => () => Math.floor(Math.random() * (e - n)) + n, Ae = (n) => n.trim().replaceAll(" ", "_"), $t = Bt(1e5, 99999999), Gt = 3;
2011
+ class qt {
2032
2012
  cancelableConnectWithRepeatedCalls;
2033
2013
  JsSIP;
2034
2014
  events;
@@ -2059,25 +2039,25 @@ class Bt {
2059
2039
  o ? t(o) : s(new Error("nothing changed"));
2060
2040
  });
2061
2041
  disconnect = async () => {
2062
- this.events.trigger(S.DISCONNECTING, {});
2042
+ this.events.trigger(p.DISCONNECTING, {});
2063
2043
  const e = new Promise((s) => {
2064
- this.events.once(S.DISCONNECTED, () => {
2044
+ this.events.once(p.DISCONNECTED, () => {
2065
2045
  s();
2066
2046
  });
2067
2047
  }), t = this.getUa();
2068
- return t ? t.stop() : this.events.trigger(S.DISCONNECTED, { socket: {}, error: !1 }), e.finally(() => {
2048
+ return t ? t.stop() : this.events.trigger(p.DISCONNECTED, { socket: {}, error: !1 }), e.finally(() => {
2069
2049
  t?.removeAllListeners(), this.setUa(void 0), this.stateMachine.reset();
2070
2050
  });
2071
2051
  };
2072
2052
  cancelRequests() {
2073
2053
  this.cancelConnectWithRepeatedCalls();
2074
2054
  }
2075
- connectWithDuplicatedCalls = async (e, { callLimit: t = Ft } = {}) => {
2055
+ connectWithDuplicatedCalls = async (e, { callLimit: t = Gt } = {}) => {
2076
2056
  const s = async () => this.connectInner(e), i = (r) => {
2077
- const c = this.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), l = r != null && !Qe(r);
2078
- return c || l;
2057
+ const c = this.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), d = r != null && !ze(r);
2058
+ return c || d;
2079
2059
  };
2080
- return this.stateMachine.startConnect(), this.cancelableConnectWithRepeatedCalls = de({
2060
+ return this.stateMachine.startConnect(), this.cancelableConnectWithRepeatedCalls = he({
2081
2061
  targetFunction: s,
2082
2062
  isComplete: i,
2083
2063
  callLimit: t,
@@ -2111,39 +2091,39 @@ class Bt {
2111
2091
  sessionTimers: a,
2112
2092
  registerExpires: o,
2113
2093
  connectionRecoveryMinInterval: c,
2114
- connectionRecoveryMaxInterval: l,
2115
- userAgent: T,
2116
- displayName: h = "",
2117
- register: u = !1,
2118
- extraHeaders: p = []
2094
+ connectionRecoveryMaxInterval: d,
2095
+ userAgent: E,
2096
+ displayName: u = "",
2097
+ register: T = !1,
2098
+ extraHeaders: m = []
2119
2099
  }) => {
2120
2100
  this.stateMachine.startInitUa(), this.setConnectionConfiguration({
2121
2101
  sipServerIp: s,
2122
2102
  sipServerUrl: i,
2123
- displayName: h,
2124
- register: u,
2103
+ displayName: u,
2104
+ register: T,
2125
2105
  user: e,
2126
2106
  password: t
2127
2107
  }), this.getUa() && await this.disconnect();
2128
- const { ua: N, helpers: D } = this.uaFactory.createUAWithConfiguration(
2108
+ const { ua: N, helpers: y } = this.uaFactory.createUAWithConfiguration(
2129
2109
  {
2130
2110
  user: e,
2131
2111
  password: t,
2132
2112
  sipServerIp: s,
2133
2113
  sipServerUrl: i,
2134
- displayName: h,
2135
- register: u,
2114
+ displayName: u,
2115
+ register: T,
2136
2116
  sessionTimers: a,
2137
2117
  registerExpires: o,
2138
2118
  connectionRecoveryMinInterval: c,
2139
- connectionRecoveryMaxInterval: l,
2140
- userAgent: T,
2119
+ connectionRecoveryMaxInterval: d,
2120
+ userAgent: E,
2141
2121
  remoteAddress: r,
2142
- extraHeaders: p
2122
+ extraHeaders: m
2143
2123
  },
2144
2124
  this.events
2145
2125
  );
2146
- return this.setUa(N), this.setGetUri(D.getUri), this.setSocket(D.socket), N;
2126
+ return this.setUa(N), this.setGetUri(y.getUri), this.setSocket(y.socket), N;
2147
2127
  };
2148
2128
  start = async () => new Promise((e, t) => {
2149
2129
  const s = this.getUa();
@@ -2152,15 +2132,15 @@ class Bt {
2152
2132
  return;
2153
2133
  }
2154
2134
  let i;
2155
- i = ((c, l) => {
2135
+ i = ((c, d) => {
2156
2136
  if (this.getConnectionConfiguration()?.register === !0)
2157
- return this.registrationManager.subscribeToStartEvents(c, l);
2158
- const h = S.CONNECTED, u = [S.DISCONNECTED];
2159
- return this.events.on(h, c), u.forEach((p) => {
2160
- this.events.on(p, l);
2137
+ return this.registrationManager.subscribeToStartEvents(c, d);
2138
+ const u = p.CONNECTED, T = [p.DISCONNECTED];
2139
+ return this.events.on(u, c), T.forEach((m) => {
2140
+ this.events.on(m, d);
2161
2141
  }), () => {
2162
- this.events.off(h, c), u.forEach((p) => {
2163
- this.events.off(p, l);
2142
+ this.events.off(u, c), T.forEach((m) => {
2143
+ this.events.off(m, d);
2164
2144
  });
2165
2145
  };
2166
2146
  })(() => {
@@ -2173,37 +2153,35 @@ class Bt {
2173
2153
  this.cancelableConnectWithRepeatedCalls?.cancel();
2174
2154
  }
2175
2155
  proxyEvents() {
2176
- this.events.on(S.CONNECTED, () => {
2156
+ this.events.on(p.CONNECTED, () => {
2177
2157
  const e = this.getConnectionConfiguration(), t = this.getUa();
2178
- e !== void 0 && t !== void 0 && this.events.trigger(S.CONNECTED_WITH_CONFIGURATION, {
2158
+ e !== void 0 && t !== void 0 && this.events.trigger(p.CONNECTED_WITH_CONFIGURATION, {
2179
2159
  ...e,
2180
2160
  ua: t
2181
2161
  });
2182
2162
  });
2183
2163
  }
2184
2164
  }
2185
- var Ie = /* @__PURE__ */ ((n) => (n.START_CONNECT = "START_CONNECT", n.START_INIT_UA = "START_INIT_UA", n.UA_CONNECTED = "UA_CONNECTED", n.UA_REGISTERED = "UA_REGISTERED", n.UA_UNREGISTERED = "UA_UNREGISTERED", n.UA_DISCONNECTED = "UA_DISCONNECTED", n.CONNECTION_FAILED = "CONNECTION_FAILED", n.RESET = "RESET", n))(Ie || {});
2186
- const kt = Object.values(Ie);
2187
- var Gt = /* @__PURE__ */ ((n) => (n.IDLE = "connection:idle", n.CONNECTING = "connection:connecting", n.INITIALIZING = "connection:initializing", n.CONNECTED = "connection:connected", n.REGISTERED = "connection:registered", n.DISCONNECTED = "connection:disconnected", n.FAILED = "connection:failed", n))(Gt || {});
2188
- const $t = $({
2165
+ var Ht = /* @__PURE__ */ ((n) => (n.IDLE = "connection:idle", n.PREPARING = "connection:preparing", n.CONNECTING = "connection:connecting", n.CONNECTED = "connection:connected", n.REGISTERED = "connection:registered", n.ESTABLISHED = "connection:established", n.DISCONNECTED = "connection:disconnected", n.FAILED = "connection:failed", n))(Ht || {}), Ie = /* @__PURE__ */ ((n) => (n.START_CONNECT = "START_CONNECT", n.START_INIT_UA = "START_INIT_UA", n.UA_CONNECTED = "UA_CONNECTED", n.UA_REGISTERED = "UA_REGISTERED", n.UA_UNREGISTERED = "UA_UNREGISTERED", n.UA_DISCONNECTED = "UA_DISCONNECTED", n.CONNECTION_FAILED = "CONNECTION_FAILED", n.RESET = "RESET", n))(Ie || {});
2166
+ const Vt = Object.values(Ie), Wt = G({
2189
2167
  types: {
2190
2168
  context: {},
2191
2169
  events: {}
2192
2170
  },
2193
2171
  actions: {
2194
2172
  logTransition: (n, e) => {
2195
- d(`State transition: ${e.from} -> ${e.to} (${e.event})`);
2173
+ h(`State transition: ${e.from} -> ${e.to} (${e.event})`);
2196
2174
  },
2197
2175
  logStateChange: (n, e) => {
2198
- d("ConnectionStateMachine state changed", e.state);
2176
+ h("ConnectionStateMachine state changed", e.state);
2199
2177
  },
2200
- setError: b({
2178
+ setError: P({
2201
2179
  error: ({ event: n }) => {
2202
2180
  if (n.type === "CONNECTION_FAILED" && "error" in n)
2203
2181
  return n.error;
2204
2182
  }
2205
2183
  }),
2206
- clearError: b({
2184
+ clearError: P({
2207
2185
  error: () => {
2208
2186
  }
2209
2187
  })
@@ -2223,12 +2201,12 @@ const $t = $({
2223
2201
  },
2224
2202
  on: {
2225
2203
  START_CONNECT: {
2226
- target: "connection:connecting",
2204
+ target: "connection:preparing",
2227
2205
  actions: {
2228
2206
  type: "logTransition",
2229
2207
  params: {
2230
2208
  from: "connection:idle",
2231
- to: "connection:connecting",
2209
+ to: "connection:preparing",
2232
2210
  event: "START_CONNECT"
2233
2211
  /* START_CONNECT */
2234
2212
  }
@@ -2236,22 +2214,22 @@ const $t = $({
2236
2214
  }
2237
2215
  }
2238
2216
  },
2239
- "connection:connecting": {
2217
+ "connection:preparing": {
2240
2218
  entry: {
2241
2219
  type: "logStateChange",
2242
2220
  params: {
2243
- state: "connection:connecting"
2244
- /* CONNECTING */
2221
+ state: "connection:preparing"
2222
+ /* PREPARING */
2245
2223
  }
2246
2224
  },
2247
2225
  on: {
2248
2226
  START_INIT_UA: {
2249
- target: "connection:initializing",
2227
+ target: "connection:connecting",
2250
2228
  actions: {
2251
2229
  type: "logTransition",
2252
2230
  params: {
2253
- from: "connection:connecting",
2254
- to: "connection:initializing",
2231
+ from: "connection:preparing",
2232
+ to: "connection:connecting",
2255
2233
  event: "START_INIT_UA"
2256
2234
  /* START_INIT_UA */
2257
2235
  }
@@ -2262,7 +2240,7 @@ const $t = $({
2262
2240
  actions: {
2263
2241
  type: "logTransition",
2264
2242
  params: {
2265
- from: "connection:connecting",
2243
+ from: "connection:preparing",
2266
2244
  to: "connection:disconnected",
2267
2245
  event: "UA_DISCONNECTED"
2268
2246
  /* UA_DISCONNECTED */
@@ -2275,7 +2253,7 @@ const $t = $({
2275
2253
  {
2276
2254
  type: "logTransition",
2277
2255
  params: {
2278
- from: "connection:connecting",
2256
+ from: "connection:preparing",
2279
2257
  to: "connection:failed",
2280
2258
  event: "CONNECTION_FAILED"
2281
2259
  /* CONNECTION_FAILED */
@@ -2289,12 +2267,12 @@ const $t = $({
2289
2267
  }
2290
2268
  }
2291
2269
  },
2292
- "connection:initializing": {
2270
+ "connection:connecting": {
2293
2271
  entry: {
2294
2272
  type: "logStateChange",
2295
2273
  params: {
2296
- state: "connection:initializing"
2297
- /* INITIALIZING */
2274
+ state: "connection:connecting"
2275
+ /* CONNECTING */
2298
2276
  }
2299
2277
  },
2300
2278
  on: {
@@ -2303,7 +2281,7 @@ const $t = $({
2303
2281
  actions: {
2304
2282
  type: "logTransition",
2305
2283
  params: {
2306
- from: "connection:initializing",
2284
+ from: "connection:connecting",
2307
2285
  to: "connection:connected",
2308
2286
  event: "UA_CONNECTED"
2309
2287
  /* UA_CONNECTED */
@@ -2315,7 +2293,7 @@ const $t = $({
2315
2293
  actions: {
2316
2294
  type: "logTransition",
2317
2295
  params: {
2318
- from: "connection:initializing",
2296
+ from: "connection:connecting",
2319
2297
  to: "connection:registered",
2320
2298
  event: "UA_REGISTERED"
2321
2299
  /* UA_REGISTERED */
@@ -2327,7 +2305,7 @@ const $t = $({
2327
2305
  actions: {
2328
2306
  type: "logTransition",
2329
2307
  params: {
2330
- from: "connection:initializing",
2308
+ from: "connection:connecting",
2331
2309
  to: "connection:disconnected",
2332
2310
  event: "UA_DISCONNECTED"
2333
2311
  /* UA_DISCONNECTED */
@@ -2340,7 +2318,7 @@ const $t = $({
2340
2318
  {
2341
2319
  type: "logTransition",
2342
2320
  params: {
2343
- from: "connection:initializing",
2321
+ from: "connection:connecting",
2344
2322
  to: "connection:failed",
2345
2323
  event: "CONNECTION_FAILED"
2346
2324
  /* CONNECTION_FAILED */
@@ -2362,6 +2340,17 @@ const $t = $({
2362
2340
  /* CONNECTED */
2363
2341
  }
2364
2342
  },
2343
+ always: {
2344
+ target: "connection:established",
2345
+ actions: {
2346
+ type: "logTransition",
2347
+ params: {
2348
+ from: "connection:connected",
2349
+ to: "connection:established",
2350
+ event: "always"
2351
+ }
2352
+ }
2353
+ },
2365
2354
  on: {
2366
2355
  UA_REGISTERED: {
2367
2356
  target: "connection:registered",
@@ -2386,24 +2375,6 @@ const $t = $({
2386
2375
  /* UA_DISCONNECTED */
2387
2376
  }
2388
2377
  }
2389
- },
2390
- CONNECTION_FAILED: {
2391
- target: "connection:failed",
2392
- actions: [
2393
- {
2394
- type: "logTransition",
2395
- params: {
2396
- from: "connection:connected",
2397
- to: "connection:failed",
2398
- event: "CONNECTION_FAILED"
2399
- /* CONNECTION_FAILED */
2400
- }
2401
- },
2402
- {
2403
- type: "setError"
2404
- /* SET_ERROR */
2405
- }
2406
- ]
2407
2378
  }
2408
2379
  }
2409
2380
  },
@@ -2415,6 +2386,17 @@ const $t = $({
2415
2386
  /* REGISTERED */
2416
2387
  }
2417
2388
  },
2389
+ always: {
2390
+ target: "connection:established",
2391
+ actions: {
2392
+ type: "logTransition",
2393
+ params: {
2394
+ from: "connection:registered",
2395
+ to: "connection:established",
2396
+ event: "always"
2397
+ }
2398
+ }
2399
+ },
2418
2400
  on: {
2419
2401
  UA_UNREGISTERED: {
2420
2402
  target: "connection:connected",
@@ -2439,24 +2421,41 @@ const $t = $({
2439
2421
  /* UA_DISCONNECTED */
2440
2422
  }
2441
2423
  }
2424
+ }
2425
+ }
2426
+ },
2427
+ "connection:established": {
2428
+ entry: {
2429
+ type: "logStateChange",
2430
+ params: {
2431
+ state: "connection:established"
2432
+ /* ESTABLISHED */
2433
+ }
2434
+ },
2435
+ on: {
2436
+ UA_DISCONNECTED: {
2437
+ target: "connection:disconnected",
2438
+ actions: {
2439
+ type: "logTransition",
2440
+ params: {
2441
+ from: "connection:established",
2442
+ to: "connection:disconnected",
2443
+ event: "UA_DISCONNECTED"
2444
+ /* UA_DISCONNECTED */
2445
+ }
2446
+ }
2442
2447
  },
2443
- CONNECTION_FAILED: {
2444
- target: "connection:failed",
2445
- actions: [
2446
- {
2447
- type: "logTransition",
2448
- params: {
2449
- from: "connection:registered",
2450
- to: "connection:failed",
2451
- event: "CONNECTION_FAILED"
2452
- /* CONNECTION_FAILED */
2453
- }
2454
- },
2455
- {
2456
- type: "setError"
2457
- /* SET_ERROR */
2448
+ RESET: {
2449
+ target: "connection:idle",
2450
+ actions: {
2451
+ type: "logTransition",
2452
+ params: {
2453
+ from: "connection:established",
2454
+ to: "connection:idle",
2455
+ event: "RESET"
2456
+ /* RESET */
2458
2457
  }
2459
- ]
2458
+ }
2460
2459
  }
2461
2460
  }
2462
2461
  },
@@ -2482,12 +2481,12 @@ const $t = $({
2482
2481
  }
2483
2482
  },
2484
2483
  START_CONNECT: {
2485
- target: "connection:connecting",
2484
+ target: "connection:preparing",
2486
2485
  actions: {
2487
2486
  type: "logTransition",
2488
2487
  params: {
2489
2488
  from: "connection:disconnected",
2490
- to: "connection:connecting",
2489
+ to: "connection:preparing",
2491
2490
  event: "START_CONNECT"
2492
2491
  /* START_CONNECT */
2493
2492
  }
@@ -2523,13 +2522,13 @@ const $t = $({
2523
2522
  ]
2524
2523
  },
2525
2524
  START_CONNECT: {
2526
- target: "connection:connecting",
2525
+ target: "connection:preparing",
2527
2526
  actions: [
2528
2527
  {
2529
2528
  type: "logTransition",
2530
2529
  params: {
2531
2530
  from: "connection:failed",
2532
- to: "connection:connecting",
2531
+ to: "connection:preparing",
2533
2532
  event: "START_CONNECT"
2534
2533
  /* START_CONNECT */
2535
2534
  }
@@ -2544,12 +2543,12 @@ const $t = $({
2544
2543
  }
2545
2544
  }
2546
2545
  });
2547
- class qt extends q {
2546
+ class xt extends q {
2548
2547
  stateChangeListeners = /* @__PURE__ */ new Set();
2549
2548
  events;
2550
2549
  unsubscribeFromEvents;
2551
2550
  constructor(e) {
2552
- super($t), this.events = e, this.addSubscription(
2551
+ super(Wt), this.events = e, this.addSubscription(
2553
2552
  this.subscribe((t) => {
2554
2553
  const s = t.value;
2555
2554
  this.stateChangeListeners.forEach((i) => {
@@ -2564,16 +2563,16 @@ class qt extends q {
2564
2563
  /* IDLE */
2565
2564
  );
2566
2565
  }
2567
- get isConnecting() {
2566
+ get isPreparing() {
2568
2567
  return this.hasState(
2569
- "connection:connecting"
2570
- /* CONNECTING */
2568
+ "connection:preparing"
2569
+ /* PREPARING */
2571
2570
  );
2572
2571
  }
2573
- get isInitializing() {
2572
+ get isConnecting() {
2574
2573
  return this.hasState(
2575
- "connection:initializing"
2576
- /* INITIALIZING */
2574
+ "connection:connecting"
2575
+ /* CONNECTING */
2577
2576
  );
2578
2577
  }
2579
2578
  get isConnected() {
@@ -2588,6 +2587,12 @@ class qt extends q {
2588
2587
  /* REGISTERED */
2589
2588
  );
2590
2589
  }
2590
+ get isEstablished() {
2591
+ return this.hasState(
2592
+ "connection:established"
2593
+ /* ESTABLISHED */
2594
+ );
2595
+ }
2591
2596
  get isDisconnected() {
2592
2597
  return this.hasState(
2593
2598
  "connection:disconnected"
@@ -2604,16 +2609,16 @@ class qt extends q {
2604
2609
  return this.getSnapshot().context.error;
2605
2610
  }
2606
2611
  get isPending() {
2607
- return this.isConnecting || this.isInitializing;
2612
+ return this.isPreparing || this.isConnecting;
2608
2613
  }
2609
2614
  get isPendingConnect() {
2610
- return this.isConnecting;
2615
+ return this.isPreparing;
2611
2616
  }
2612
2617
  get isPendingInitUa() {
2613
- return this.isInitializing;
2618
+ return this.isConnecting;
2614
2619
  }
2615
2620
  get isActiveConnection() {
2616
- return this.isConnected || this.isRegistered;
2621
+ return this.isEstablished || this.isConnected || this.isRegistered;
2617
2622
  }
2618
2623
  // Публичные методы для уведомления о начале операций
2619
2624
  startConnect() {
@@ -2637,14 +2642,14 @@ class qt extends q {
2637
2642
  return this.getSnapshot().can({ type: e });
2638
2643
  }
2639
2644
  getValidEvents() {
2640
- return kt.filter((e) => this.canTransition(e));
2645
+ return Vt.filter((e) => this.canTransition(e));
2641
2646
  }
2642
2647
  hasState(e) {
2643
2648
  return this.getSnapshot().matches(e);
2644
2649
  }
2645
2650
  sendEvent(e) {
2646
2651
  if (!this.getSnapshot().can(e)) {
2647
- d(
2652
+ h(
2648
2653
  `Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`
2649
2654
  );
2650
2655
  return;
@@ -2709,7 +2714,7 @@ class qt extends q {
2709
2714
  this.toFailed(e instanceof Error ? e : void 0);
2710
2715
  };
2711
2716
  }
2712
- class Vt {
2717
+ class Qt {
2713
2718
  events;
2714
2719
  getUaProtected;
2715
2720
  constructor(e) {
@@ -2718,25 +2723,25 @@ class Vt {
2718
2723
  async register() {
2719
2724
  const e = this.getUaProtected();
2720
2725
  return new Promise((t, s) => {
2721
- e.on(S.REGISTERED, t), e.on(S.REGISTRATION_FAILED, s), e.register();
2726
+ e.on(p.REGISTERED, t), e.on(p.REGISTRATION_FAILED, s), e.register();
2722
2727
  });
2723
2728
  }
2724
2729
  async unregister() {
2725
2730
  const e = this.getUaProtected();
2726
2731
  return new Promise((t) => {
2727
- e.on(S.UNREGISTERED, t), e.unregister();
2732
+ e.on(p.UNREGISTERED, t), e.unregister();
2728
2733
  });
2729
2734
  }
2730
2735
  async tryRegister() {
2731
2736
  try {
2732
2737
  await this.unregister();
2733
2738
  } catch (e) {
2734
- d("tryRegister", e);
2739
+ h("tryRegister", e);
2735
2740
  }
2736
2741
  return this.register();
2737
2742
  }
2738
2743
  subscribeToStartEvents(e, t) {
2739
- const s = S.REGISTERED, i = [S.REGISTRATION_FAILED, S.DISCONNECTED];
2744
+ const s = p.REGISTERED, i = [p.REGISTRATION_FAILED, p.DISCONNECTED];
2740
2745
  return this.events.on(s, e), i.forEach((r) => {
2741
2746
  this.events.on(r, t);
2742
2747
  }), () => {
@@ -2746,7 +2751,7 @@ class Vt {
2746
2751
  };
2747
2752
  }
2748
2753
  }
2749
- class Ht {
2754
+ class Yt {
2750
2755
  uaFactory;
2751
2756
  getUaProtected;
2752
2757
  constructor(e) {
@@ -2792,30 +2797,30 @@ class Ht {
2792
2797
  extraHeaders: a
2793
2798
  }) {
2794
2799
  return new Promise((o, c) => {
2795
- const { configuration: l } = this.uaFactory.createConfiguration({
2800
+ const { configuration: d } = this.uaFactory.createConfiguration({
2796
2801
  sipServerUrl: i,
2797
2802
  displayName: t,
2798
2803
  userAgent: e,
2799
2804
  sipServerIp: s
2800
- }), T = this.uaFactory.createUA({ ...l, remoteAddress: r, extraHeaders: a }), h = () => {
2801
- const p = new Error("Telephony is not available");
2802
- c(p);
2805
+ }), E = this.uaFactory.createUA({ ...d, remoteAddress: r, extraHeaders: a }), u = () => {
2806
+ const m = new Error("Telephony is not available");
2807
+ c(m);
2803
2808
  };
2804
- T.once(S.DISCONNECTED, h);
2805
- const u = () => {
2806
- T.removeAllListeners(), T.once(S.DISCONNECTED, () => {
2809
+ E.once(p.DISCONNECTED, u);
2810
+ const T = () => {
2811
+ E.removeAllListeners(), E.once(p.DISCONNECTED, () => {
2807
2812
  o();
2808
- }), T.stop();
2813
+ }), E.stop();
2809
2814
  };
2810
- T.once(S.CONNECTED, u), T.start();
2815
+ E.once(p.CONNECTED, T), E.start();
2811
2816
  });
2812
2817
  }
2813
2818
  }
2814
- const Wt = (n) => {
2819
+ const Xt = (n) => {
2815
2820
  const e = [];
2816
2821
  return n !== void 0 && n !== "" && e.push(`X-Vinteo-Remote: ${n}`), e;
2817
2822
  };
2818
- class L {
2823
+ class w {
2819
2824
  JsSIP;
2820
2825
  constructor(e) {
2821
2826
  this.JsSIP = e;
@@ -2840,10 +2845,10 @@ class L {
2840
2845
  throw new Error("user is required for authorized connection");
2841
2846
  }
2842
2847
  static resolveAuthorizationUser(e, t) {
2843
- return e && t !== void 0 && t.trim() !== "" ? t.trim() : `${Ut()}`;
2848
+ return e && t !== void 0 && t.trim() !== "" ? t.trim() : `${$t()}`;
2844
2849
  }
2845
2850
  static buildExtraHeaders(e, t) {
2846
- const s = e !== void 0 && e !== "" ? Wt(e) : [];
2851
+ const s = e !== void 0 && e !== "" ? Xt(e) : [];
2847
2852
  return t === void 0 ? s : [...s, ...t];
2848
2853
  }
2849
2854
  createConfiguration({
@@ -2856,40 +2861,40 @@ class L {
2856
2861
  sessionTimers: o = !1,
2857
2862
  registerExpires: c = 300,
2858
2863
  // 5 minutes in sec
2859
- connectionRecoveryMinInterval: l = 2,
2860
- connectionRecoveryMaxInterval: T = 6,
2861
- userAgent: h
2864
+ connectionRecoveryMinInterval: d = 2,
2865
+ connectionRecoveryMaxInterval: E = 6,
2866
+ userAgent: u
2862
2867
  }) {
2863
- L.validateParametersConnection({
2868
+ w.validateParametersConnection({
2864
2869
  register: a,
2865
2870
  password: t,
2866
2871
  user: e,
2867
2872
  sipServerIp: r,
2868
2873
  sipServerUrl: s
2869
2874
  });
2870
- const u = L.resolveAuthorizationUser(a, e), p = Lt(r), A = p(u), N = new this.JsSIP.WebSocketInterface(`wss://${s}/webrtc/wss/`);
2875
+ const T = w.resolveAuthorizationUser(a, e), m = kt(r), O = m(T), N = new this.JsSIP.WebSocketInterface(`wss://${s}/webrtc/wss/`);
2871
2876
  return {
2872
2877
  configuration: {
2873
2878
  password: t,
2874
2879
  register: a,
2875
- uri: A,
2880
+ uri: O,
2876
2881
  display_name: Ae(i),
2877
- user_agent: h,
2882
+ user_agent: u,
2878
2883
  sdpSemantics: "unified-plan",
2879
2884
  sockets: [N],
2880
2885
  session_timers: o,
2881
2886
  register_expires: c,
2882
- connection_recovery_min_interval: l,
2883
- connection_recovery_max_interval: T
2887
+ connection_recovery_min_interval: d,
2888
+ connection_recovery_max_interval: E
2884
2889
  },
2885
2890
  helpers: {
2886
2891
  socket: N,
2887
- getUri: p
2892
+ getUri: m
2888
2893
  }
2889
2894
  };
2890
2895
  }
2891
2896
  createUA({ remoteAddress: e, extraHeaders: t, ...s }) {
2892
- const i = new this.JsSIP.UA(s), r = L.buildExtraHeaders(e, t);
2897
+ const i = new this.JsSIP.UA(s), r = w.buildExtraHeaders(e, t);
2893
2898
  return r.length > 0 && i.registrator().setExtraHeaders(r), i;
2894
2899
  }
2895
2900
  /**
@@ -2902,13 +2907,13 @@ class L {
2902
2907
  extraHeaders: e.extraHeaders
2903
2908
  });
2904
2909
  return t.eachTriggers((a, o) => {
2905
- const c = Ne.find((l) => l === o);
2910
+ const c = Ne.find((d) => d === o);
2906
2911
  c && r.on(c, a);
2907
2912
  }), { ua: r, helpers: i };
2908
2913
  }
2909
2914
  }
2910
- const fe = "Not ready for connection", xt = (n) => n instanceof Error && n.message === fe, Qt = () => new Error(fe), Yt = async (n) => typeof n == "function" ? n() : n;
2911
- class zt {
2915
+ const fe = "Not ready for connection", Jt = (n) => n instanceof Error && n.message === fe, zt = () => new Error(fe), Kt = async (n) => typeof n == "function" ? n() : n;
2916
+ class jt {
2912
2917
  events;
2913
2918
  ua;
2914
2919
  socket;
@@ -2920,15 +2925,15 @@ class zt {
2920
2925
  configurationManager;
2921
2926
  JsSIP;
2922
2927
  constructor({ JsSIP: e }) {
2923
- this.JsSIP = e, this.events = yt(), this.uaFactory = new L(e), this.registrationManager = new Vt({
2928
+ this.JsSIP = e, this.events = Ft(), this.uaFactory = new w(e), this.registrationManager = new Qt({
2924
2929
  events: this.events,
2925
2930
  getUaProtected: this.getUaProtected
2926
- }), this.stateMachine = new qt(this.events), this.configurationManager = new bt({
2931
+ }), this.stateMachine = new xt(this.events), this.configurationManager = new Lt({
2927
2932
  getUa: this.getUa
2928
- }), this.sipOperations = new Ht({
2933
+ }), this.sipOperations = new Yt({
2929
2934
  uaFactory: this.uaFactory,
2930
2935
  getUaProtected: this.getUaProtected
2931
- }), this.connectionFlow = new Bt({
2936
+ }), this.connectionFlow = new qt({
2932
2937
  JsSIP: this.JsSIP,
2933
2938
  events: this.events,
2934
2939
  uaFactory: this.uaFactory,
@@ -2978,13 +2983,13 @@ class zt {
2978
2983
  return this.stateMachine.state;
2979
2984
  }
2980
2985
  get isRegistered() {
2981
- return L.isRegisteredUA(this.ua);
2986
+ return w.isRegisteredUA(this.ua);
2982
2987
  }
2983
2988
  get isRegisterConfig() {
2984
2989
  return this.configurationManager.isRegister();
2985
2990
  }
2986
2991
  connect = async (e, t) => this.disconnect().catch((s) => {
2987
- d("connect: disconnect error", s);
2992
+ h("connect: disconnect error", s);
2988
2993
  }).then(async () => this.connectWithProcessError(e, t));
2989
2994
  set = async ({ displayName: e }) => this.connectionFlow.set({ displayName: e });
2990
2995
  disconnect = async () => {
@@ -3033,7 +3038,7 @@ class zt {
3033
3038
  getUa = () => this.ua;
3034
3039
  connectWithProcessError = async (e, t) => {
3035
3040
  if (!(t?.hasReadyForConnection?.() ?? !0))
3036
- throw Qt();
3041
+ throw zt();
3037
3042
  return this.processConnect(e, t).catch(async (i) => {
3038
3043
  const r = i;
3039
3044
  return this.disconnect().then(() => {
@@ -3043,18 +3048,18 @@ class zt {
3043
3048
  });
3044
3049
  });
3045
3050
  };
3046
- processConnect = async (e, t) => (this.events.trigger(S.CONNECT_STARTED, {}), Yt(e).then((s) => (this.events.trigger(S.CONNECT_PARAMETERS_RESOLVE_SUCCESS, s), s)).catch((s) => {
3047
- throw this.events.trigger(S.CONNECT_PARAMETERS_RESOLVE_FAILED, s), s;
3048
- }).then(async (s) => this.connectionFlow.connect(s, t)).then((s) => (this.events.trigger(S.CONNECT_SUCCEEDED, {
3051
+ processConnect = async (e, t) => (this.events.trigger(p.CONNECT_STARTED, {}), Kt(e).then((s) => (this.events.trigger(p.CONNECT_PARAMETERS_RESOLVE_SUCCESS, s), s)).catch((s) => {
3052
+ throw this.events.trigger(p.CONNECT_PARAMETERS_RESOLVE_FAILED, s), s;
3053
+ }).then(async (s) => this.connectionFlow.connect(s, t)).then((s) => (this.events.trigger(p.CONNECT_SUCCEEDED, {
3049
3054
  ...s
3050
3055
  }), s)).catch((s) => {
3051
3056
  const i = s ?? new Error("Failed to connect to server");
3052
- throw this.events.trigger(S.CONNECT_FAILED, i), i;
3057
+ throw this.events.trigger(p.CONNECT_FAILED, i), i;
3053
3058
  }));
3054
3059
  }
3055
- class Xt {
3060
+ class Zt {
3056
3061
  connectionManager;
3057
- stackPromises = le({
3062
+ stackPromises = de({
3058
3063
  noRunIsNotActual: !0
3059
3064
  });
3060
3065
  constructor({ connectionManager: e }) {
@@ -3066,11 +3071,11 @@ class Xt {
3066
3071
  this.stackPromises.stop();
3067
3072
  }
3068
3073
  }
3069
- const te = 0, Jt = 30;
3070
- class Kt {
3074
+ const te = 0, en = 30;
3075
+ class tn {
3071
3076
  countInner = te;
3072
3077
  initialCount = te;
3073
- limitInner = Jt;
3078
+ limitInner = en;
3074
3079
  isInProgress = !1;
3075
3080
  onStatusChange;
3076
3081
  constructor({
@@ -3103,7 +3108,7 @@ class Kt {
3103
3108
  this.countInner = this.initialCount, this.finishAttempt();
3104
3109
  }
3105
3110
  }
3106
- class jt {
3111
+ class nn {
3107
3112
  connectionManager;
3108
3113
  interval;
3109
3114
  checkTelephonyByTimeout = void 0;
@@ -3119,7 +3124,7 @@ class jt {
3119
3124
  onSuccessRequest: t,
3120
3125
  onFailRequest: s
3121
3126
  }) {
3122
- this.stop(), this.cancelableBeforeRequest = new G(e), this.checkTelephonyByTimeout = Fe({
3127
+ this.stop(), this.cancelableBeforeRequest = new $(e), this.checkTelephonyByTimeout = Ge({
3123
3128
  isDontStopOnFail: !0,
3124
3129
  requestInterval: this.interval,
3125
3130
  request: async () => {
@@ -3148,7 +3153,7 @@ const Me = [
3148
3153
  "changed-attempt-status",
3149
3154
  "stop-attempts-by-error",
3150
3155
  "limit-reached-attempts"
3151
- ], Zt = () => new M(Me);
3156
+ ], sn = () => new A(Me);
3152
3157
  class K {
3153
3158
  callManager;
3154
3159
  disposers = [];
@@ -3174,40 +3179,40 @@ class K {
3174
3179
  this.callManager.isCallActive ? e?.() : t();
3175
3180
  }
3176
3181
  }
3177
- const en = 15e3, tn = 2;
3178
- class nn {
3182
+ const rn = 15e3, an = 2;
3183
+ class on {
3179
3184
  connectionManager;
3180
3185
  pingServerByTimeoutWithFailCalls;
3181
3186
  constructor({ connectionManager: e }) {
3182
- this.connectionManager = e, this.pingServerByTimeoutWithFailCalls = Be(tn, {
3187
+ this.connectionManager = e, this.pingServerByTimeoutWithFailCalls = qe(an, {
3183
3188
  whenPossibleRequest: async () => {
3184
3189
  },
3185
- requestInterval: en,
3186
- request: async () => (d("ping"), this.connectionManager.ping().then(() => {
3187
- d("ping success");
3190
+ requestInterval: rn,
3191
+ request: async () => (h("ping"), this.connectionManager.ping().then(() => {
3192
+ h("ping success");
3188
3193
  }))
3189
3194
  });
3190
3195
  }
3191
3196
  start({ onFailRequest: e }) {
3192
- this.pingServerByTimeoutWithFailCalls.start(void 0, { onFailRequest: e }).catch(d);
3197
+ this.pingServerByTimeoutWithFailCalls.start(void 0, { onFailRequest: e }).catch(h);
3193
3198
  }
3194
3199
  stop() {
3195
3200
  this.pingServerByTimeoutWithFailCalls.stop();
3196
3201
  }
3197
3202
  }
3198
- class sn {
3203
+ class cn {
3199
3204
  pingServerRequester;
3200
3205
  notActiveCallSubscriber;
3201
3206
  constructor({
3202
3207
  connectionManager: e,
3203
3208
  callManager: t
3204
3209
  }) {
3205
- this.pingServerRequester = new nn({
3210
+ this.pingServerRequester = new on({
3206
3211
  connectionManager: e
3207
3212
  }), this.notActiveCallSubscriber = new K({ callManager: t });
3208
3213
  }
3209
3214
  start({ onFailRequest: e }) {
3210
- d("start"), this.notActiveCallSubscriber.subscribe({
3215
+ h("start"), this.notActiveCallSubscriber.subscribe({
3211
3216
  onActive: () => {
3212
3217
  this.pingServerRequester.stop();
3213
3218
  },
@@ -3217,13 +3222,13 @@ class sn {
3217
3222
  });
3218
3223
  }
3219
3224
  stop() {
3220
- d("stop"), this.pingServerRequester.stop(), this.unsubscribeCallStatusChange();
3225
+ h("stop"), this.pingServerRequester.stop(), this.unsubscribeCallStatusChange();
3221
3226
  }
3222
3227
  unsubscribeCallStatusChange() {
3223
3228
  this.notActiveCallSubscriber.unsubscribe();
3224
3229
  }
3225
3230
  }
3226
- class rn {
3231
+ class hn {
3227
3232
  connectionManager;
3228
3233
  isRegistrationFailed = !1;
3229
3234
  disposers = [];
@@ -3259,12 +3264,12 @@ class rn {
3259
3264
  this.isRegistrationFailed = !1;
3260
3265
  }
3261
3266
  }
3262
- const an = 3e3, on = 15e3, ne = {
3267
+ const dn = 3e3, ln = 15e3, ne = {
3263
3268
  LIMIT_REACHED: "Limit reached",
3264
3269
  FAILED_TO_RECONNECT: "Failed to reconnect"
3265
- }, cn = async () => {
3266
- }, dn = (n) => !0;
3267
- class ln {
3270
+ }, gn = async () => {
3271
+ }, un = (n) => !0;
3272
+ class Tn {
3268
3273
  events;
3269
3274
  connectionManager;
3270
3275
  connectionQueueManager;
@@ -3284,28 +3289,28 @@ class ln {
3284
3289
  connectionManager: t,
3285
3290
  callManager: s
3286
3291
  }, i) {
3287
- const r = i?.onBeforeRetry ?? cn, a = i?.canRetryOnError ?? dn;
3288
- this.connectionQueueManager = e, this.connectionManager = t, this.onBeforeRetry = r, this.canRetryOnError = a, this.networkInterfacesSubscriber = i?.networkInterfacesSubscriber, this.resumeFromSleepModeSubscriber = i?.resumeFromSleepModeSubscriber, this.events = Zt(), this.checkTelephonyRequester = new jt({
3292
+ const r = i?.onBeforeRetry ?? gn, a = i?.canRetryOnError ?? un;
3293
+ this.connectionQueueManager = e, this.connectionManager = t, this.onBeforeRetry = r, this.canRetryOnError = a, this.networkInterfacesSubscriber = i?.networkInterfacesSubscriber, this.resumeFromSleepModeSubscriber = i?.resumeFromSleepModeSubscriber, this.events = sn(), this.checkTelephonyRequester = new nn({
3289
3294
  connectionManager: t,
3290
- interval: i?.checkTelephonyRequestInterval ?? on
3291
- }), this.pingServerIfNotActiveCallRequester = new sn({
3295
+ interval: i?.checkTelephonyRequestInterval ?? ln
3296
+ }), this.pingServerIfNotActiveCallRequester = new cn({
3292
3297
  connectionManager: t,
3293
3298
  callManager: s
3294
- }), this.registrationFailedOutOfCallSubscriber = new rn({
3299
+ }), this.registrationFailedOutOfCallSubscriber = new hn({
3295
3300
  connectionManager: t,
3296
3301
  callManager: s
3297
- }), this.attemptsState = new Kt({
3302
+ }), this.attemptsState = new tn({
3298
3303
  onStatusChange: this.emitStatusChange
3299
- }), this.cancelableRequestBeforeRetry = new G(r), this.delayBetweenAttempts = new ke(
3300
- i?.timeoutBetweenAttempts ?? an
3304
+ }), this.cancelableRequestBeforeRetry = new $(r), this.delayBetweenAttempts = new He(
3305
+ i?.timeoutBetweenAttempts ?? dn
3301
3306
  ), this.notActiveCallSubscriber = new K({ callManager: s });
3302
3307
  }
3303
3308
  start(e) {
3304
- d("auto connector start"), this.restartConnectionAttempts(e), this.subscribeToNotActiveCall(e);
3309
+ h("auto connector start"), this.restartConnectionAttempts(e), this.subscribeToNotActiveCall(e);
3305
3310
  }
3306
3311
  stop() {
3307
- d("auto connector stop"), this.unsubscribeFromNotActiveCall(), this.unsubscribeFromHardwareTriggers(), this.stopConnectionFlow().catch((e) => {
3308
- d("auto connector stop from stop method: error", e);
3312
+ h("auto connector stop"), this.unsubscribeFromNotActiveCall(), this.unsubscribeFromHardwareTriggers(), this.stopConnectionFlow().catch((e) => {
3313
+ h("auto connector stop from stop method: error", e);
3309
3314
  });
3310
3315
  }
3311
3316
  on(e, t) {
@@ -3324,77 +3329,77 @@ class ln {
3324
3329
  this.events.off(e, t);
3325
3330
  }
3326
3331
  restartConnectionAttempts(e) {
3327
- d("auto connector restart connection attempts"), this.stopConnectionFlow().then(async () => this.attemptConnection(e)).catch((t) => {
3328
- d("auto connector failed to restart connection attempts:", t);
3332
+ h("auto connector restart connection attempts"), this.stopConnectionFlow().then(async () => this.attemptConnection(e)).catch((t) => {
3333
+ h("auto connector failed to restart connection attempts:", t);
3329
3334
  });
3330
3335
  }
3331
3336
  async stopConnectionFlow() {
3332
- d("stopConnectionFlow"), this.stopAttempts(), this.stopConnectTriggers(), await this.connectionQueueManager.disconnect();
3337
+ h("stopConnectionFlow"), this.stopAttempts(), this.stopConnectTriggers(), await this.connectionQueueManager.disconnect();
3333
3338
  }
3334
3339
  stopAttempts() {
3335
3340
  this.attemptsState.isAttemptInProgress && this.connectionQueueManager.stop(), this.delayBetweenAttempts.cancelRequest(), this.cancelableRequestBeforeRetry.cancelRequest(), this.attemptsState.reset();
3336
3341
  }
3337
3342
  stopConnectTriggers() {
3338
- d("stopConnectTriggers"), this.stopPingRequester(), this.checkTelephonyRequester.stop(), this.registrationFailedOutOfCallSubscriber.unsubscribe();
3343
+ h("stopConnectTriggers"), this.stopPingRequester(), this.checkTelephonyRequester.stop(), this.registrationFailedOutOfCallSubscriber.unsubscribe();
3339
3344
  }
3340
3345
  startCheckTelephony(e) {
3341
- d("startCheckTelephony"), this.checkTelephonyRequester.start({
3346
+ h("startCheckTelephony"), this.checkTelephonyRequester.start({
3342
3347
  onBeforeRequest: async () => (await this.onBeforeRetry(), e.getParameters()),
3343
3348
  onSuccessRequest: () => {
3344
- d("startCheckTelephony: onSuccessRequest"), this.connectIfDisconnected(e);
3349
+ h("startCheckTelephony: onSuccessRequest"), this.connectIfDisconnected(e);
3345
3350
  },
3346
3351
  onFailRequest: (t) => {
3347
- d("startCheckTelephony: onFailRequest", t.message);
3352
+ h("startCheckTelephony: onFailRequest", t.message);
3348
3353
  }
3349
3354
  });
3350
3355
  }
3351
3356
  async attemptConnection(e) {
3352
- if (d("attemptConnection: attempts.count", this.attemptsState.count), this.events.trigger(f.BEFORE_ATTEMPT, {}), this.stopConnectTriggers(), this.attemptsState.hasLimitReached()) {
3353
- d("attemptConnection: limit reached"), this.handleLimitReached(e);
3357
+ if (h("attemptConnection: attempts.count", this.attemptsState.count), this.events.trigger(f.BEFORE_ATTEMPT, {}), this.stopConnectTriggers(), this.attemptsState.hasLimitReached()) {
3358
+ h("attemptConnection: limit reached"), this.handleLimitReached(e);
3354
3359
  return;
3355
3360
  }
3356
3361
  return this.attemptsState.startAttempt(), this.attemptsState.increment(), this.executeConnectionAttempt(e);
3357
3362
  }
3358
3363
  async executeConnectionAttempt(e) {
3359
3364
  try {
3360
- await this.connectionQueueManager.connect(e.getParameters, e.options), d("executeConnectionAttempt: success"), this.handleSucceededAttempt(e);
3365
+ await this.connectionQueueManager.connect(e.getParameters, e.options), h("executeConnectionAttempt: success"), this.handleSucceededAttempt(e);
3361
3366
  } catch (t) {
3362
3367
  this.handleConnectionError(t, e);
3363
3368
  }
3364
3369
  }
3365
3370
  handleConnectionError(e, t) {
3366
- if (xt(e)) {
3371
+ if (Jt(e)) {
3367
3372
  this.attemptsState.finishAttempt(), this.events.trigger(f.STOP_ATTEMPTS_BY_ERROR, e);
3368
3373
  return;
3369
3374
  }
3370
3375
  if (!this.canRetryOnError(e)) {
3371
- d("executeConnectionAttempt: error does not allow retry", e), this.attemptsState.finishAttempt(), this.events.trigger(f.STOP_ATTEMPTS_BY_ERROR, e);
3376
+ h("executeConnectionAttempt: error does not allow retry", e), this.attemptsState.finishAttempt(), this.events.trigger(f.STOP_ATTEMPTS_BY_ERROR, e);
3372
3377
  return;
3373
3378
  }
3374
- if (Ve(e)) {
3375
- d("executeConnectionAttempt: not actual error", e), this.attemptsState.finishAttempt(), this.events.trigger(f.CANCELLED_ATTEMPTS, e);
3379
+ if (Qe(e)) {
3380
+ h("executeConnectionAttempt: not actual error", e), this.attemptsState.finishAttempt(), this.events.trigger(f.CANCELLED_ATTEMPTS, e);
3376
3381
  return;
3377
3382
  }
3378
- d("executeConnectionAttempt: error", e), this.scheduleReconnect(t);
3383
+ h("executeConnectionAttempt: error", e), this.scheduleReconnect(t);
3379
3384
  }
3380
3385
  handleLimitReached(e) {
3381
3386
  this.attemptsState.finishAttempt(), this.events.trigger(f.LIMIT_REACHED_ATTEMPTS, new Error(ne.LIMIT_REACHED)), this.startCheckTelephony(e);
3382
3387
  }
3383
3388
  handleSucceededAttempt(e) {
3384
- d("handleSucceededAttempt"), this.subscribeToConnectTriggers(e), this.events.trigger(f.SUCCESS);
3389
+ h("handleSucceededAttempt"), this.subscribeToConnectTriggers(e), this.events.trigger(f.SUCCESS);
3385
3390
  }
3386
3391
  subscribeToConnectTriggers(e) {
3387
3392
  this.startPingRequester(e), this.registrationFailedOutOfCallSubscriber.subscribe(() => {
3388
- d("registrationFailedOutOfCallListener callback"), this.restartConnectionAttempts(e);
3393
+ h("registrationFailedOutOfCallListener callback"), this.restartConnectionAttempts(e);
3389
3394
  });
3390
3395
  }
3391
3396
  subscribeToNotActiveCall(e) {
3392
3397
  this.notActiveCallSubscriber.subscribe({
3393
3398
  onActive: () => {
3394
- d("subscribeToNotActiveCall onActive"), this.unsubscribeFromHardwareTriggers();
3399
+ h("subscribeToNotActiveCall onActive"), this.unsubscribeFromHardwareTriggers();
3395
3400
  },
3396
3401
  onInactive: () => {
3397
- d("subscribeToNotActiveCall onInactive"), this.subscribeToHardwareTriggers(e);
3402
+ h("subscribeToNotActiveCall onInactive"), this.subscribeToHardwareTriggers(e);
3398
3403
  }
3399
3404
  });
3400
3405
  }
@@ -3402,13 +3407,13 @@ class ln {
3402
3407
  this.notActiveCallSubscriber.unsubscribe();
3403
3408
  }
3404
3409
  subscribeToHardwareTriggers(e) {
3405
- this.unsubscribeFromHardwareTriggers(), d("subscribeToHardwareTriggers"), this.networkInterfacesSubscriber?.subscribe({
3410
+ this.unsubscribeFromHardwareTriggers(), h("subscribeToHardwareTriggers"), this.networkInterfacesSubscriber?.subscribe({
3406
3411
  onChange: () => {
3407
- d("networkInterfacesSubscriber onChange"), this.restartConnectionAttempts(e);
3412
+ h("networkInterfacesSubscriber onChange"), this.restartConnectionAttempts(e);
3408
3413
  },
3409
3414
  onUnavailable: () => {
3410
- d("networkInterfacesSubscriber onUnavailable"), this.stopConnectionFlow().catch((t) => {
3411
- d(
3415
+ h("networkInterfacesSubscriber onUnavailable"), this.stopConnectionFlow().catch((t) => {
3416
+ h(
3412
3417
  "auto connector stop from networkInterfacesSubscriber onUnavailable: error",
3413
3418
  t
3414
3419
  );
@@ -3416,12 +3421,12 @@ class ln {
3416
3421
  }
3417
3422
  }), this.resumeFromSleepModeSubscriber?.subscribe({
3418
3423
  onResume: () => {
3419
- d("resumeFromSleepModeSubscriber onResume"), this.restartConnectionAttempts(e);
3424
+ h("resumeFromSleepModeSubscriber onResume"), this.restartConnectionAttempts(e);
3420
3425
  }
3421
3426
  });
3422
3427
  }
3423
3428
  unsubscribeFromHardwareTriggers() {
3424
- d("unsubscribeFromHardwareTriggers"), this.networkInterfacesSubscriber?.unsubscribe(), this.resumeFromSleepModeSubscriber?.unsubscribe();
3429
+ h("unsubscribeFromHardwareTriggers"), this.networkInterfacesSubscriber?.unsubscribe(), this.resumeFromSleepModeSubscriber?.unsubscribe();
3425
3430
  }
3426
3431
  stopPingRequester() {
3427
3432
  this.pingServerIfNotActiveCallRequester.stop();
@@ -3429,18 +3434,18 @@ class ln {
3429
3434
  startPingRequester(e) {
3430
3435
  this.pingServerIfNotActiveCallRequester.start({
3431
3436
  onFailRequest: () => {
3432
- d("pingRequester: onFailRequest"), this.restartConnectionAttempts(e);
3437
+ h("pingRequester: onFailRequest"), this.restartConnectionAttempts(e);
3433
3438
  }
3434
3439
  });
3435
3440
  }
3436
3441
  connectIfDisconnected(e) {
3437
3442
  const t = this.isConnectionUnavailable();
3438
- d("connectIfDisconnected: isUnavailable", t), t ? this.restartConnectionAttempts(e) : (this.stopConnectTriggers(), this.events.trigger(f.SUCCESS));
3443
+ h("connectIfDisconnected: isUnavailable", t), t ? this.restartConnectionAttempts(e) : (this.stopConnectTriggers(), this.events.trigger(f.SUCCESS));
3439
3444
  }
3440
3445
  scheduleReconnect(e) {
3441
- d("scheduleReconnect"), this.delayBetweenAttempts.request().then(async () => (d("scheduleReconnect: delayBetweenAttempts success"), this.cancelableRequestBeforeRetry.request())).then(async () => (d("scheduleReconnect: onBeforeRetry success"), this.attemptConnection(e))).catch((t) => {
3446
+ h("scheduleReconnect"), this.delayBetweenAttempts.request().then(async () => (h("scheduleReconnect: delayBetweenAttempts success"), this.cancelableRequestBeforeRetry.request())).then(async () => (h("scheduleReconnect: onBeforeRetry success"), this.attemptConnection(e))).catch((t) => {
3442
3447
  const s = t instanceof Error ? t : new Error(ne.FAILED_TO_RECONNECT);
3443
- this.attemptsState.finishAttempt(), Ue(t) || Ge(t) ? this.events.trigger(f.CANCELLED_ATTEMPTS, s) : this.events.trigger(f.FAILED_ALL_ATTEMPTS, s), d("scheduleReconnect: error", t);
3448
+ this.attemptsState.finishAttempt(), $e(t) || Ve(t) ? this.events.trigger(f.CANCELLED_ATTEMPTS, s) : this.events.trigger(f.FAILED_ALL_ATTEMPTS, s), h("scheduleReconnect: error", t);
3444
3449
  });
3445
3450
  }
3446
3451
  isConnectionUnavailable() {
@@ -3451,27 +3456,27 @@ class ln {
3451
3456
  this.events.trigger(f.CHANGED_ATTEMPT_STATUS, { isInProgress: e });
3452
3457
  };
3453
3458
  }
3454
- var z = /* @__PURE__ */ ((n) => (n.STATE_CHANGED = "state-changed", n.STATE_RESET = "state-reset", n))(z || {});
3455
- const hn = ["state-changed", "state-reset"], gn = () => new M(hn);
3456
- class un {
3459
+ var X = /* @__PURE__ */ ((n) => (n.STATE_CHANGED = "state-changed", n.STATE_RESET = "state-reset", n))(X || {});
3460
+ const ve = ["state-changed", "state-reset"], En = () => new A(ve);
3461
+ class Sn {
3457
3462
  events;
3458
3463
  state = {};
3459
3464
  constructor() {
3460
- this.events = gn();
3465
+ this.events = En();
3461
3466
  }
3462
3467
  getState() {
3463
3468
  return { ...this.state };
3464
3469
  }
3465
3470
  updateState(e) {
3466
3471
  const t = { ...this.state };
3467
- this.state = { ...this.state, ...e }, this.events.trigger(z.STATE_CHANGED, {
3472
+ this.state = { ...this.state, ...e }, this.events.trigger(X.STATE_CHANGED, {
3468
3473
  previous: t,
3469
3474
  current: this.state,
3470
3475
  updates: e
3471
3476
  });
3472
3477
  }
3473
3478
  reset() {
3474
- this.state = {}, this.events.trigger(z.STATE_RESET, {});
3479
+ this.state = {}, this.events.trigger(X.STATE_RESET, {});
3475
3480
  }
3476
3481
  getToken() {
3477
3482
  return this.state.token;
@@ -3507,31 +3512,31 @@ class un {
3507
3512
  this.events.off(e, t);
3508
3513
  }
3509
3514
  }
3510
- var U = /* @__PURE__ */ ((n) => (n.INCOMING_CALL = "incomingCall", n.DECLINED_INCOMING_CALL = "declinedIncomingCall", n.TERMINATED_INCOMING_CALL = "terminatedIncomingCall", n.FAILED_INCOMING_CALL = "failedIncomingCall", n))(U || {});
3511
- const ve = [
3512
- "incomingCall",
3515
+ var U = /* @__PURE__ */ ((n) => (n.RINGING = "ringing", n.DECLINED_INCOMING_CALL = "declinedIncomingCall", n.TERMINATED_INCOMING_CALL = "terminatedIncomingCall", n.FAILED_INCOMING_CALL = "failedIncomingCall", n))(U || {});
3516
+ const _e = [
3517
+ "ringing",
3513
3518
  "declinedIncomingCall",
3514
3519
  "terminatedIncomingCall",
3515
3520
  "failedIncomingCall"
3516
- ], Tn = () => new M(ve);
3517
- var En = /* @__PURE__ */ ((n) => (n.IDLE = "incoming:idle", n.RINGING = "incoming:ringing", n.CONSUMED = "incoming:consumed", n.DECLINED = "incoming:declined", n.TERMINATED = "incoming:terminated", n.FAILED = "incoming:failed", n))(En || {});
3518
- const Cn = $({
3521
+ ], pn = () => new A(_e);
3522
+ var Cn = /* @__PURE__ */ ((n) => (n.IDLE = "incoming:idle", n.RINGING = "incoming:ringing", n.CONSUMED = "incoming:consumed", n.DECLINED = "incoming:declined", n.TERMINATED = "incoming:terminated", n.FAILED = "incoming:failed", n))(Cn || {});
3523
+ const mn = G({
3519
3524
  types: {
3520
3525
  context: {},
3521
3526
  events: {}
3522
3527
  },
3523
3528
  actions: {
3524
3529
  logTransition: (n, e) => {
3525
- d(`State transition: ${e.from} -> ${e.to} (${e.event})`);
3530
+ h(`State transition: ${e.from} -> ${e.to} (${e.event})`);
3526
3531
  },
3527
3532
  logStateChange: (n, e) => {
3528
- d("IncomingCallStateMachine state changed", e.state);
3533
+ h("IncomingCallStateMachine state changed", e.state);
3529
3534
  },
3530
- rememberIncoming: b(({ event: n }) => {
3535
+ rememberIncoming: P(({ event: n }) => {
3531
3536
  const { data: e } = n;
3532
3537
  return { remoteCallerData: e, lastReason: void 0 };
3533
3538
  }),
3534
- rememberReason: b(({ event: n, context: e }) => n.type === "INCOMING.CONSUMED" ? {
3539
+ rememberReason: P(({ event: n, context: e }) => n.type === "INCOMING.CONSUMED" ? {
3535
3540
  remoteCallerData: e.remoteCallerData,
3536
3541
  lastReason: "incoming:consumed"
3537
3542
  /* CONSUMED */
@@ -3548,7 +3553,7 @@ const Cn = $({
3548
3553
  lastReason: "incoming:failed"
3549
3554
  /* FAILED */
3550
3555
  }),
3551
- clearIncoming: b(() => ({ remoteCallerData: void 0, lastReason: void 0 }))
3556
+ clearIncoming: P(() => ({ remoteCallerData: void 0, lastReason: void 0 }))
3552
3557
  }
3553
3558
  }).createMachine({
3554
3559
  id: "incoming",
@@ -3847,9 +3852,9 @@ const Cn = $({
3847
3852
  }
3848
3853
  }
3849
3854
  });
3850
- class Sn extends q {
3855
+ class Nn extends q {
3851
3856
  constructor({ incomingEvents: e, connectionEvents: t }) {
3852
- super(Cn), this.subscribeIncomingEvents(e), this.subscribeConnectionEvents(t);
3857
+ super(mn), this.subscribeIncomingEvents(e), this.subscribeConnectionEvents(t);
3853
3858
  }
3854
3859
  get isIdle() {
3855
3860
  return this.state === "incoming:idle";
@@ -3898,7 +3903,7 @@ class Sn extends q {
3898
3903
  }
3899
3904
  subscribeIncomingEvents(e) {
3900
3905
  this.addSubscription(
3901
- e.on("incomingCall", (t) => {
3906
+ e.on("ringing", (t) => {
3902
3907
  this.send({ type: "INCOMING.RINGING", data: t });
3903
3908
  })
3904
3909
  ), this.addSubscription(
@@ -3917,15 +3922,15 @@ class Sn extends q {
3917
3922
  }
3918
3923
  subscribeConnectionEvents(e) {
3919
3924
  this.addSubscription(
3920
- e.on(S.DISCONNECTED, () => {
3925
+ e.on(p.DISCONNECTED, () => {
3921
3926
  this.toClearIncoming();
3922
3927
  })
3923
3928
  ), this.addSubscription(
3924
- e.on(S.REGISTRATION_FAILED, () => {
3929
+ e.on(p.REGISTRATION_FAILED, () => {
3925
3930
  this.toClearIncoming();
3926
3931
  })
3927
3932
  ), this.addSubscription(
3928
- e.on(S.CONNECT_FAILED, () => {
3933
+ e.on(p.CONNECT_FAILED, () => {
3929
3934
  this.toClearIncoming();
3930
3935
  })
3931
3936
  );
@@ -3934,14 +3939,14 @@ class Sn extends q {
3934
3939
  this.send({ type: "INCOMING.CLEAR" });
3935
3940
  }
3936
3941
  }
3937
- const pn = 486, mn = 487;
3938
- class Nn {
3942
+ const Rn = 486, An = 487;
3943
+ class In {
3939
3944
  events;
3940
3945
  incomingStateMachine;
3941
3946
  incomingRTCSession;
3942
3947
  connectionManager;
3943
3948
  constructor(e) {
3944
- this.connectionManager = e, this.events = Tn(), this.incomingStateMachine = new Sn({
3949
+ this.connectionManager = e, this.events = pn(), this.incomingStateMachine = new Nn({
3945
3950
  incomingEvents: this.events,
3946
3951
  connectionEvents: this.connectionManager.events
3947
3952
  }), this.start();
@@ -3977,7 +3982,7 @@ class Nn {
3977
3982
  return this.incomingStateMachine.toConsumed(), this.removeIncomingSession(), e;
3978
3983
  };
3979
3984
  async declineToIncomingCall({
3980
- statusCode: e = mn
3985
+ statusCode: e = An
3981
3986
  } = {}) {
3982
3987
  return new Promise((t, s) => {
3983
3988
  try {
@@ -3989,7 +3994,7 @@ class Nn {
3989
3994
  });
3990
3995
  }
3991
3996
  async busyIncomingCall() {
3992
- return this.declineToIncomingCall({ statusCode: pn });
3997
+ return this.declineToIncomingCall({ statusCode: Rn });
3993
3998
  }
3994
3999
  on(e, t) {
3995
4000
  return this.events.on(e, t);
@@ -4023,62 +4028,79 @@ class Nn {
4023
4028
  const t = this.remoteCallerData;
4024
4029
  e.on("failed", (s) => {
4025
4030
  this.removeIncomingSession(), s.originator === "local" ? this.events.trigger(U.TERMINATED_INCOMING_CALL, t) : this.events.trigger(U.FAILED_INCOMING_CALL, t);
4026
- }), this.events.trigger(U.INCOMING_CALL, t);
4031
+ }), this.events.trigger(U.RINGING, t);
4027
4032
  }
4028
4033
  removeIncomingSession() {
4029
4034
  delete this.incomingRTCSession;
4030
4035
  }
4031
4036
  }
4032
- const Rn = (n, e) => Object.is(n, e), se = (n) => ({
4037
+ var Oe = /* @__PURE__ */ ((n) => (n.SNAPSHOT_CHANGED = "snapshot-changed", n))(Oe || {});
4038
+ const be = ["snapshot-changed"], fn = () => new A(be), Mn = (n, e) => Object.is(n, e), se = (n) => ({
4033
4039
  connection: n.connection.getSnapshot(),
4034
4040
  call: n.call.getSnapshot(),
4035
4041
  incoming: n.incoming.getSnapshot(),
4036
4042
  presentation: n.presentation.getSnapshot()
4037
- }), An = (n) => {
4038
- const e = {
4039
- connection: n.connectionManager.connectionActor,
4040
- call: n.callManager.callActor,
4041
- incoming: n.incomingCallManager.incomingActor,
4042
- presentation: n.presentationManager.presentationActor
4043
- };
4044
- let t = se(e);
4045
- const s = /* @__PURE__ */ new Set(), i = () => {
4046
- t = se(e);
4047
- for (const o of s) {
4048
- const c = o.selector(t);
4049
- o.equals(o.current, c) || (o.current = c, o.listener(c));
4050
- }
4051
- }, r = [
4052
- e.connection.subscribe(i),
4053
- e.call.subscribe(i),
4054
- e.incoming.subscribe(i),
4055
- e.presentation.subscribe(i)
4056
- ];
4057
- function a(o, c, l) {
4058
- const T = typeof c == "function", h = T ? o : (D) => D, u = T ? c : o, p = (T ? l : void 0) ?? Rn, A = h(t), N = {
4059
- selector: h,
4060
- listener: u,
4061
- equals: p,
4062
- current: A
4043
+ });
4044
+ class vn {
4045
+ events;
4046
+ actors;
4047
+ currentSnapshot;
4048
+ subscribers = /* @__PURE__ */ new Set();
4049
+ actorSubscriptions = [];
4050
+ constructor(e) {
4051
+ this.events = fn(), this.actors = {
4052
+ connection: e.connectionManager.connectionActor,
4053
+ call: e.callManager.callActor,
4054
+ incoming: e.incomingCallManager.incomingActor,
4055
+ presentation: e.presentationManager.presentationActor
4056
+ }, this.currentSnapshot = se(this.actors), this.actorSubscriptions.push(
4057
+ this.actors.connection.subscribe(this.notifySubscribers),
4058
+ this.actors.call.subscribe(this.notifySubscribers),
4059
+ this.actors.incoming.subscribe(this.notifySubscribers),
4060
+ this.actors.presentation.subscribe(this.notifySubscribers)
4061
+ );
4062
+ }
4063
+ getSnapshot() {
4064
+ return this.currentSnapshot;
4065
+ }
4066
+ subscribe(e, t, s) {
4067
+ const i = typeof t == "function", r = i ? e : (E) => E, a = i ? t : e, o = (i ? s : void 0) ?? Mn, c = r(this.currentSnapshot), d = {
4068
+ selector: r,
4069
+ listener: a,
4070
+ equals: o,
4071
+ current: c
4063
4072
  };
4064
- return s.add(N), () => {
4065
- s.delete(N);
4073
+ return this.subscribers.add(d), () => {
4074
+ this.subscribers.delete(d);
4066
4075
  };
4067
4076
  }
4068
- return {
4069
- actor: e,
4070
- actors: e,
4071
- getSnapshot: () => t,
4072
- subscribe: a,
4073
- stop: () => {
4074
- s.clear(), r.forEach((o) => {
4075
- o.unsubscribe();
4076
- });
4077
+ stop() {
4078
+ this.subscribers.clear(), this.actorSubscriptions.forEach((e) => {
4079
+ e.unsubscribe();
4080
+ });
4081
+ }
4082
+ on(e, t) {
4083
+ return this.events.on(e, t);
4084
+ }
4085
+ off(e, t) {
4086
+ this.events.off(e, t);
4087
+ }
4088
+ notifySubscribers = () => {
4089
+ const e = this.currentSnapshot;
4090
+ this.currentSnapshot = se(this.actors);
4091
+ for (const t of this.subscribers) {
4092
+ const s = t.selector(this.currentSnapshot);
4093
+ t.equals(t.current, s) || (t.current = s, t.listener(s));
4077
4094
  }
4095
+ this.events.trigger(Oe.SNAPSHOT_CHANGED, {
4096
+ previous: e,
4097
+ current: this.currentSnapshot
4098
+ });
4078
4099
  };
4079
- }, w = 1e3;
4080
- var m = /* @__PURE__ */ ((n) => (n.INBOUND_RTP = "inbound-rtp", n.REMOTE_OUTBOUND_RTP = "remote-outbound-rtp", n.MEDIA_SOURCE = "media-source", n.OUTBOUND_RTP = "outbound-rtp", n.REMOTE_INBOUND_RTP = "remote-inbound-rtp", n.CODEC = "codec", n.CANDIDATE_PAIR = "candidate-pair", n.CERTIFICATE = "certificate", n.TRANSPORT = "transport", n.LOCAL_CANDIDATE = "local-candidate", n.REMOTE_CANDIDATE = "remote-candidate", n))(m || {});
4081
- const _e = ["collected"], In = () => new M(_e), fn = "api/v2/rtp2webrtc/offer", Mn = async ({
4100
+ }
4101
+ const L = 1e3;
4102
+ var C = /* @__PURE__ */ ((n) => (n.INBOUND_RTP = "inbound-rtp", n.REMOTE_OUTBOUND_RTP = "remote-outbound-rtp", n.MEDIA_SOURCE = "media-source", n.OUTBOUND_RTP = "outbound-rtp", n.REMOTE_INBOUND_RTP = "remote-inbound-rtp", n.CODEC = "codec", n.CANDIDATE_PAIR = "candidate-pair", n.CERTIFICATE = "certificate", n.TRANSPORT = "transport", n.LOCAL_CANDIDATE = "local-candidate", n.REMOTE_CANDIDATE = "remote-candidate", n))(C || {});
4103
+ const Pe = ["collected"], _n = () => new A(Pe), On = "api/v2/rtp2webrtc/offer", bn = async ({
4082
4104
  serverUrl: n,
4083
4105
  conferenceNumber: e,
4084
4106
  quality: t,
@@ -4087,7 +4109,7 @@ const _e = ["collected"], In = () => new M(_e), fn = "api/v2/rtp2webrtc/offer",
4087
4109
  token: r
4088
4110
  }) => {
4089
4111
  const a = new URL(
4090
- `https://${n.replace(/\/$/, "")}/${fn}/${encodeURIComponent(e)}`
4112
+ `https://${n.replace(/\/$/, "")}/${On}/${encodeURIComponent(e)}`
4091
4113
  );
4092
4114
  a.searchParams.set("quality", t), a.searchParams.set("audio", String(s));
4093
4115
  const o = {
@@ -4102,18 +4124,18 @@ const _e = ["collected"], In = () => new M(_e), fn = "api/v2/rtp2webrtc/offer",
4102
4124
  });
4103
4125
  if (!c.ok)
4104
4126
  throw new Error(`sendOffer failed with status ${c.status}`);
4105
- const l = await c.json();
4127
+ const d = await c.json();
4106
4128
  return {
4107
- type: l.type,
4108
- sdp: l.sdp,
4129
+ type: d.type,
4130
+ sdp: d.sdp,
4109
4131
  toJSON() {
4110
- return l;
4132
+ return d;
4111
4133
  }
4112
4134
  };
4113
4135
  }, ie = () => "performance" in window ? performance.now() : Date.now(), F = (n) => [...n.keys()].reduce((e, t) => {
4114
4136
  const s = n.get(t);
4115
4137
  return s === void 0 ? e : { ...e, [s.type]: s };
4116
- }, {}), vn = (n) => {
4138
+ }, {}), Pn = (n) => {
4117
4139
  if (!n)
4118
4140
  return {
4119
4141
  outboundRtp: void 0,
@@ -4123,10 +4145,10 @@ const _e = ["collected"], In = () => new M(_e), fn = "api/v2/rtp2webrtc/offer",
4123
4145
  };
4124
4146
  const e = F(n);
4125
4147
  return {
4126
- outboundRtp: e[m.OUTBOUND_RTP],
4127
- codec: e[m.CODEC],
4128
- mediaSource: e[m.MEDIA_SOURCE],
4129
- remoteInboundRtp: e[m.REMOTE_INBOUND_RTP]
4148
+ outboundRtp: e[C.OUTBOUND_RTP],
4149
+ codec: e[C.CODEC],
4150
+ mediaSource: e[C.MEDIA_SOURCE],
4151
+ remoteInboundRtp: e[C.REMOTE_INBOUND_RTP]
4130
4152
  };
4131
4153
  }, re = (n) => {
4132
4154
  if (!n)
@@ -4138,10 +4160,10 @@ const _e = ["collected"], In = () => new M(_e), fn = "api/v2/rtp2webrtc/offer",
4138
4160
  };
4139
4161
  const e = F(n);
4140
4162
  return {
4141
- outboundRtp: e[m.OUTBOUND_RTP],
4142
- codec: e[m.CODEC],
4143
- mediaSource: e[m.MEDIA_SOURCE],
4144
- remoteInboundRtp: e[m.REMOTE_INBOUND_RTP]
4163
+ outboundRtp: e[C.OUTBOUND_RTP],
4164
+ codec: e[C.CODEC],
4165
+ mediaSource: e[C.MEDIA_SOURCE],
4166
+ remoteInboundRtp: e[C.REMOTE_INBOUND_RTP]
4145
4167
  };
4146
4168
  }, ae = ({
4147
4169
  videoReceiversStats: n,
@@ -4155,11 +4177,11 @@ const _e = ["collected"], In = () => new M(_e), fn = "api/v2/rtp2webrtc/offer",
4155
4177
  };
4156
4178
  const t = F(n);
4157
4179
  return {
4158
- inboundRtp: t[m.INBOUND_RTP],
4159
- codec: t[m.CODEC],
4180
+ inboundRtp: t[C.INBOUND_RTP],
4181
+ codec: t[C.CODEC],
4160
4182
  synchronizationSources: e
4161
4183
  };
4162
- }, _n = ({
4184
+ }, Dn = ({
4163
4185
  audioReceiverStats: n,
4164
4186
  synchronizationSourcesAudio: e
4165
4187
  }) => {
@@ -4172,12 +4194,12 @@ const _e = ["collected"], In = () => new M(_e), fn = "api/v2/rtp2webrtc/offer",
4172
4194
  };
4173
4195
  const t = F(n);
4174
4196
  return {
4175
- inboundRtp: t[m.INBOUND_RTP],
4176
- codec: t[m.CODEC],
4177
- remoteOutboundRtp: t[m.REMOTE_OUTBOUND_RTP],
4197
+ inboundRtp: t[C.INBOUND_RTP],
4198
+ codec: t[C.CODEC],
4199
+ remoteOutboundRtp: t[C.REMOTE_OUTBOUND_RTP],
4178
4200
  synchronizationSources: e
4179
4201
  };
4180
- }, Oe = (n) => {
4202
+ }, De = (n) => {
4181
4203
  if (!n)
4182
4204
  return {
4183
4205
  candidatePair: void 0,
@@ -4188,24 +4210,24 @@ const _e = ["collected"], In = () => new M(_e), fn = "api/v2/rtp2webrtc/offer",
4188
4210
  };
4189
4211
  const e = F(n);
4190
4212
  return {
4191
- candidatePair: e[m.CANDIDATE_PAIR],
4192
- certificate: e[m.CERTIFICATE],
4193
- localCandidate: e[m.LOCAL_CANDIDATE],
4194
- remoteCandidate: e[m.REMOTE_CANDIDATE],
4195
- transport: e[m.TRANSPORT]
4213
+ candidatePair: e[C.CANDIDATE_PAIR],
4214
+ certificate: e[C.CERTIFICATE],
4215
+ localCandidate: e[C.LOCAL_CANDIDATE],
4216
+ remoteCandidate: e[C.REMOTE_CANDIDATE],
4217
+ transport: e[C.TRANSPORT]
4196
4218
  };
4197
- }, On = ({
4219
+ }, yn = ({
4198
4220
  audioSenderStats: n,
4199
4221
  videoSenderFirstStats: e,
4200
4222
  videoSenderSecondStats: t
4201
4223
  }) => ({
4202
4224
  video: re(e),
4203
4225
  secondVideo: re(t),
4204
- audio: vn(n),
4205
- additional: Oe(
4226
+ audio: Pn(n),
4227
+ additional: De(
4206
4228
  n ?? e ?? t
4207
4229
  )
4208
- }), Pn = ({
4230
+ }), wn = ({
4209
4231
  audioReceiverStats: n,
4210
4232
  videoReceiverFirstStats: e,
4211
4233
  videoReceiverSecondStats: t,
@@ -4219,14 +4241,14 @@ const _e = ["collected"], In = () => new M(_e), fn = "api/v2/rtp2webrtc/offer",
4219
4241
  videoReceiversStats: t,
4220
4242
  synchronizationSourcesVideo: s.video
4221
4243
  }),
4222
- audio: _n({
4244
+ audio: Dn({
4223
4245
  audioReceiverStats: n,
4224
4246
  synchronizationSourcesAudio: s.audio
4225
4247
  }),
4226
- additional: Oe(
4248
+ additional: De(
4227
4249
  n ?? e ?? t
4228
4250
  )
4229
- }), bn = ({
4251
+ }), Ln = ({
4230
4252
  audioSenderStats: n,
4231
4253
  videoSenderFirstStats: e,
4232
4254
  videoSenderSecondStats: t,
@@ -4235,11 +4257,11 @@ const _e = ["collected"], In = () => new M(_e), fn = "api/v2/rtp2webrtc/offer",
4235
4257
  videoReceiverSecondStats: r,
4236
4258
  synchronizationSources: a
4237
4259
  }) => {
4238
- const o = On({
4260
+ const o = yn({
4239
4261
  audioSenderStats: n,
4240
4262
  videoSenderFirstStats: e,
4241
4263
  videoSenderSecondStats: t
4242
- }), c = Pn({
4264
+ }), c = wn({
4243
4265
  audioReceiverStats: s,
4244
4266
  videoReceiverFirstStats: i,
4245
4267
  videoReceiverSecondStats: r,
@@ -4249,16 +4271,16 @@ const _e = ["collected"], In = () => new M(_e), fn = "api/v2/rtp2webrtc/offer",
4249
4271
  outbound: o,
4250
4272
  inbound: c
4251
4273
  };
4252
- }, Dn = async (n) => {
4253
- const e = "audio", t = "video", s = n.getSenders(), i = s.find((u) => u.track?.kind === e), r = s.filter((u) => u.track?.kind === t), a = n.getReceivers(), o = a.find((u) => u.track.kind === e), c = a.filter((u) => u.track.kind === t), l = {
4274
+ }, Un = async (n) => {
4275
+ const e = "audio", t = "video", s = n.getSenders(), i = s.find((T) => T.track?.kind === e), r = s.filter((T) => T.track?.kind === t), a = n.getReceivers(), o = a.find((T) => T.track.kind === e), c = a.filter((T) => T.track.kind === t), d = {
4254
4276
  trackIdentifier: o?.track.id,
4255
4277
  item: o?.getSynchronizationSources()[0]
4256
- }, T = {
4278
+ }, E = {
4257
4279
  trackIdentifier: c[0]?.track.id,
4258
4280
  item: c[0]?.getSynchronizationSources()[0]
4259
- }, h = {
4260
- audio: l,
4261
- video: T
4281
+ }, u = {
4282
+ audio: d,
4283
+ video: E
4262
4284
  };
4263
4285
  return Promise.all([
4264
4286
  i?.getStats() ?? Promise.resolve(void 0),
@@ -4267,41 +4289,41 @@ const _e = ["collected"], In = () => new M(_e), fn = "api/v2/rtp2webrtc/offer",
4267
4289
  o?.getStats() ?? Promise.resolve(void 0),
4268
4290
  c[0]?.getStats() ?? Promise.resolve(void 0),
4269
4291
  c[1]?.getStats() ?? Promise.resolve(void 0)
4270
- ]).then((u) => {
4292
+ ]).then((T) => {
4271
4293
  const [
4272
- p,
4273
- A,
4294
+ m,
4295
+ O,
4274
4296
  N,
4275
- D,
4276
- V,
4277
- we
4278
- ] = u;
4297
+ y,
4298
+ H,
4299
+ Be
4300
+ ] = T;
4279
4301
  return {
4280
- synchronizationSources: h,
4281
- audioSenderStats: p,
4282
- videoSenderFirstStats: A,
4302
+ synchronizationSources: u,
4303
+ audioSenderStats: m,
4304
+ videoSenderFirstStats: O,
4283
4305
  videoSenderSecondStats: N,
4284
- audioReceiverStats: D,
4285
- videoReceiverFirstStats: V,
4286
- videoReceiverSecondStats: we
4306
+ audioReceiverStats: y,
4307
+ videoReceiverFirstStats: H,
4308
+ videoReceiverSecondStats: Be
4287
4309
  };
4288
4310
  });
4289
- }, yn = (n) => {
4290
- d(String(n));
4311
+ }, Fn = (n) => {
4312
+ h(String(n));
4291
4313
  };
4292
- class Ln {
4314
+ class kn {
4293
4315
  events;
4294
4316
  setTimeoutRequest;
4295
- requesterAllStatistics = new G(Dn);
4317
+ requesterAllStatistics = new $(Un);
4296
4318
  constructor() {
4297
- this.events = In(), this.setTimeoutRequest = new ce();
4319
+ this.events = _n(), this.setTimeoutRequest = new ce();
4298
4320
  }
4299
4321
  get requested() {
4300
4322
  return this.setTimeoutRequest.requested;
4301
4323
  }
4302
4324
  start(e, {
4303
- interval: t = w,
4304
- onError: s = yn
4325
+ interval: t = L,
4326
+ onError: s = Fn
4305
4327
  } = {}) {
4306
4328
  this.stop(), this.setTimeoutRequest.request(() => {
4307
4329
  this.collectStatistics(e, {
@@ -4332,10 +4354,10 @@ class Ln {
4332
4354
  }) => {
4333
4355
  const s = ie();
4334
4356
  this.requesterAllStatistics.request(e).then((i) => {
4335
- this.events.trigger("collected", bn(i));
4357
+ this.events.trigger("collected", Ln(i));
4336
4358
  const a = ie() - s;
4337
- let o = w;
4338
- a > 48 ? o = w * 4 : a > 32 ? o = w * 3 : a > 16 && (o = w * 2), this.start(e, {
4359
+ let o = L;
4360
+ a > 48 ? o = L * 4 : a > 32 ? o = L * 3 : a > 16 && (o = L * 2), this.start(e, {
4339
4361
  onError: t,
4340
4362
  interval: o
4341
4363
  });
@@ -4344,7 +4366,8 @@ class Ln {
4344
4366
  });
4345
4367
  };
4346
4368
  }
4347
- class wn {
4369
+ const Bn = 500;
4370
+ class $n {
4348
4371
  statsPeerConnection;
4349
4372
  availableStats;
4350
4373
  previousAvailableStats;
@@ -4354,7 +4377,7 @@ class wn {
4354
4377
  callManager: e,
4355
4378
  apiManager: t
4356
4379
  }) {
4357
- this.callManager = e, this.apiManager = t, this.statsPeerConnection = new Ln(), this.subscribe();
4380
+ this.callManager = e, this.apiManager = t, this.statsPeerConnection = new kn(), this.subscribe();
4358
4381
  }
4359
4382
  get events() {
4360
4383
  return this.statsPeerConnection.events;
@@ -4362,7 +4385,10 @@ class wn {
4362
4385
  get availableIncomingBitrate() {
4363
4386
  return this.availableStats?.inbound.additional.candidatePair?.availableIncomingBitrate;
4364
4387
  }
4365
- get isNotValidFramesStats() {
4388
+ get isInvalidInboundFrames() {
4389
+ return this.isEmptyInboundFrames && this.isReceivingPackets;
4390
+ }
4391
+ get isEmptyInboundFrames() {
4366
4392
  return !this.isFramesReceived || !this.isFramesDecoded;
4367
4393
  }
4368
4394
  get previousAvailableIncomingBitrate() {
@@ -4394,6 +4420,16 @@ class wn {
4394
4420
  const e = this.framesDecoded !== void 0 && this.framesDecoded > 0, t = this.framesDecoded !== this.previousFramesDecoded;
4395
4421
  return e && t;
4396
4422
  }
4423
+ get packetsReceived() {
4424
+ return this.inboundRtp?.packetsReceived;
4425
+ }
4426
+ get previousPacketsReceived() {
4427
+ return this.previousInboundRtp?.packetsReceived;
4428
+ }
4429
+ get isReceivingPackets() {
4430
+ const e = this.packetsReceived !== void 0 && this.packetsReceived >= Bn, t = this.packetsReceived !== this.previousPacketsReceived;
4431
+ return e && t;
4432
+ }
4397
4433
  on(e, t) {
4398
4434
  return this.statsPeerConnection.on(e, t);
4399
4435
  }
@@ -4427,37 +4463,37 @@ class wn {
4427
4463
  };
4428
4464
  maybeSendStats() {
4429
4465
  this.availableIncomingBitrate !== void 0 && this.hasAvailableIncomingBitrateChangedQuarter() && this.apiManager.sendStats({ availableIncomingBitrate: this.availableIncomingBitrate }).catch((e) => {
4430
- d("Failed to send stats", e);
4466
+ h("Failed to send stats", e);
4431
4467
  });
4432
4468
  }
4433
4469
  }
4434
- const Un = (n, e) => n.filter((s) => e.some((i) => i.clockRate === s.clockRate && i.mimeType === s.mimeType && i.channels === s.channels && i.sdpFmtpLine === s.sdpFmtpLine)), Fn = (n) => {
4470
+ const Gn = (n, e) => n.filter((s) => e.some((i) => i.clockRate === s.clockRate && i.mimeType === s.mimeType && i.channels === s.channels && i.sdpFmtpLine === s.sdpFmtpLine)), qn = (n) => {
4435
4471
  const e = RTCRtpSender.getCapabilities(n), t = RTCRtpReceiver.getCapabilities(n), s = e === null ? [] : e.codecs, i = t === null ? [] : t.codecs;
4436
- return Un(s, i);
4437
- }, Bn = (n, e) => e === void 0 || e.length === 0 ? n : n.sort((t, s) => {
4472
+ return Gn(s, i);
4473
+ }, Hn = (n, e) => e === void 0 || e.length === 0 ? n : n.sort((t, s) => {
4438
4474
  const i = e.indexOf(t.mimeType), r = e.indexOf(s.mimeType), a = i === -1 ? Number.MAX_VALUE : i, o = r === -1 ? Number.MAX_VALUE : r;
4439
4475
  return a - o;
4440
- }), kn = (n, e) => e === void 0 || e.length === 0 ? n : n.filter((t) => !e.includes(t.mimeType)), Gn = (n, {
4476
+ }), Vn = (n, e) => e === void 0 || e.length === 0 ? n : n.filter((t) => !e.includes(t.mimeType)), Wn = (n, {
4441
4477
  preferredMimeTypesVideoCodecs: e,
4442
4478
  excludeMimeTypesVideoCodecs: t
4443
4479
  }) => {
4444
4480
  try {
4445
4481
  if (typeof n.setCodecPreferences == "function" && n.sender.track?.kind === "video" && (e !== void 0 && e.length > 0 || t !== void 0 && t.length > 0)) {
4446
- const s = Fn("video"), i = kn(s, t), r = Bn(i, e);
4482
+ const s = qn("video"), i = Vn(s, t), r = Hn(i, e);
4447
4483
  n.setCodecPreferences(r);
4448
4484
  }
4449
4485
  } catch (s) {
4450
- d("setCodecPreferences error", s);
4486
+ h("setCodecPreferences error", s);
4451
4487
  }
4452
- }, $n = (n) => [...n.keys()].map((e) => n.get(e)), qn = (n, e) => $n(n).find((t) => t?.type === e), Vn = async (n) => n.getStats().then((e) => qn(e, "codec")?.mimeType);
4453
- class Hn {
4488
+ }, xn = (n) => [...n.keys()].map((e) => n.get(e)), Qn = (n, e) => xn(n).find((t) => t?.type === e), Yn = async (n) => n.getStats().then((e) => Qn(e, "codec")?.mimeType);
4489
+ class Xn {
4454
4490
  // eslint-disable-next-line @typescript-eslint/class-methods-use-this
4455
4491
  async getCodecFromSender(e) {
4456
- return await Vn(e) ?? "";
4492
+ return await Yn(e) ?? "";
4457
4493
  }
4458
4494
  }
4459
- class Wn {
4460
- stackPromises = le({
4495
+ class Jn {
4496
+ stackPromises = de({
4461
4497
  noRunIsNotActual: !0
4462
4498
  });
4463
4499
  /**
@@ -4477,34 +4513,34 @@ class Wn {
4477
4513
  */
4478
4514
  async run() {
4479
4515
  return this.stackPromises().catch((e) => {
4480
- d("TaskQueue: error", e);
4516
+ h("TaskQueue: error", e);
4481
4517
  });
4482
4518
  }
4483
4519
  }
4484
- class xn {
4520
+ class zn {
4485
4521
  taskQueue;
4486
4522
  onSetParameters;
4487
4523
  constructor(e) {
4488
- this.onSetParameters = e, this.taskQueue = new Wn();
4524
+ this.onSetParameters = e, this.taskQueue = new Jn();
4489
4525
  }
4490
4526
  async setEncodingsToSender(e, t) {
4491
- return this.taskQueue.add(async () => pe(e, t, this.onSetParameters));
4527
+ return this.taskQueue.add(async () => Ce(e, t, this.onSetParameters));
4492
4528
  }
4493
4529
  stop() {
4494
4530
  this.taskQueue.stop();
4495
4531
  }
4496
4532
  }
4497
- const Pe = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()), Qn = 1e6, v = (n) => n * Qn, be = v(0.06), De = v(4), Yn = (n) => n <= 64 ? be : n <= 128 ? v(0.12) : n <= 256 ? v(0.25) : n <= 384 ? v(0.32) : n <= 426 ? v(0.38) : n <= 640 ? v(0.5) : n <= 848 ? v(0.7) : n <= 1280 ? v(1) : n <= 1920 ? v(2) : De, zn = "av1", Xn = (n) => Pe(n, zn), Jn = 0.6, j = (n, e) => Xn(e) ? n * Jn : n, Kn = (n) => j(be, n), jn = (n) => j(De, n), oe = (n, e) => {
4498
- const t = Yn(n);
4533
+ const ye = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()), Kn = 1e6, M = (n) => n * Kn, we = M(0.06), Le = M(4), jn = (n) => n <= 64 ? we : n <= 128 ? M(0.12) : n <= 256 ? M(0.25) : n <= 384 ? M(0.32) : n <= 426 ? M(0.38) : n <= 640 ? M(0.5) : n <= 848 ? M(0.7) : n <= 1280 ? M(1) : n <= 1920 ? M(2) : Le, Zn = "av1", es = (n) => ye(n, Zn), ts = 0.6, j = (n, e) => es(e) ? n * ts : n, ns = (n) => j(we, n), ss = (n) => j(Le, n), oe = (n, e) => {
4534
+ const t = jn(n);
4499
4535
  return j(t, e);
4500
- }, W = 1, Zn = ({
4536
+ }, W = 1, is = ({
4501
4537
  videoTrack: n,
4502
4538
  targetSize: e
4503
4539
  }) => {
4504
4540
  const t = n.getSettings(), s = t.width, i = t.height, r = s === void 0 ? W : s / e.width, a = i === void 0 ? W : i / e.height;
4505
4541
  return Math.max(r, a, W);
4506
4542
  };
4507
- class es {
4543
+ class rs {
4508
4544
  ignoreForCodec;
4509
4545
  senderFinder;
4510
4546
  codecProvider;
@@ -4537,7 +4573,7 @@ class es {
4537
4573
  if (!i?.track)
4538
4574
  return { ...this.resultNoChanged, sender: i };
4539
4575
  const r = await this.codecProvider.getCodecFromSender(i);
4540
- if (Pe(r, this.ignoreForCodec))
4576
+ if (ye(r, this.ignoreForCodec))
4541
4577
  return { ...this.resultNoChanged, sender: i };
4542
4578
  const { mainCam: a, resolutionMainCam: o } = t ?? {};
4543
4579
  return this.processSender(
@@ -4557,14 +4593,14 @@ class es {
4557
4593
  async processSender(e, t) {
4558
4594
  const { mainCam: s, resolutionMainCam: i } = e;
4559
4595
  switch (s) {
4560
- case _.PAUSE_MAIN_CAM:
4596
+ case v.PAUSE_MAIN_CAM:
4561
4597
  return this.downgradeResolutionSender(t);
4562
- case _.RESUME_MAIN_CAM:
4598
+ case v.RESUME_MAIN_CAM:
4563
4599
  return this.setBitrateByTrackResolution(t);
4564
- case _.MAX_MAIN_CAM_RESOLUTION:
4600
+ case v.MAX_MAIN_CAM_RESOLUTION:
4565
4601
  return i !== void 0 ? this.setResolutionSender(i, t) : this.setBitrateByTrackResolution(t);
4566
- case _.ADMIN_STOP_MAIN_CAM:
4567
- case _.ADMIN_START_MAIN_CAM:
4602
+ case v.ADMIN_STOP_MAIN_CAM:
4603
+ case v.ADMIN_START_MAIN_CAM:
4568
4604
  case void 0:
4569
4605
  return this.setBitrateByTrackResolution(t);
4570
4606
  default:
@@ -4579,7 +4615,7 @@ class es {
4579
4615
  async downgradeResolutionSender(e) {
4580
4616
  const { sender: t, codec: s } = e, i = {
4581
4617
  scaleResolutionDownBy: 200,
4582
- maxBitrate: Kn(s)
4618
+ maxBitrate: ns(s)
4583
4619
  };
4584
4620
  return this.parametersSetter.setEncodingsToSender(t, i);
4585
4621
  }
@@ -4589,7 +4625,7 @@ class es {
4589
4625
  * @returns Promise с результатом
4590
4626
  */
4591
4627
  async setBitrateByTrackResolution(e) {
4592
- const { sender: t, videoTrack: s, codec: i } = e, a = s.getSettings().width, o = a === void 0 ? jn(i) : oe(a, i);
4628
+ const { sender: t, videoTrack: s, codec: i } = e, a = s.getSettings().width, o = a === void 0 ? ss(i) : oe(a, i);
4593
4629
  return this.parametersSetter.setEncodingsToSender(t, {
4594
4630
  scaleResolutionDownBy: 1,
4595
4631
  maxBitrate: o
@@ -4605,24 +4641,24 @@ class es {
4605
4641
  const [s, i] = e.split("x"), { sender: r, videoTrack: a, codec: o } = t, c = {
4606
4642
  width: Number(s),
4607
4643
  height: Number(i)
4608
- }, l = Zn({
4644
+ }, d = is({
4609
4645
  videoTrack: a,
4610
4646
  targetSize: c
4611
- }), T = oe(c.width, o), h = {
4612
- scaleResolutionDownBy: l,
4613
- maxBitrate: T
4647
+ }), E = oe(c.width, o), u = {
4648
+ scaleResolutionDownBy: d,
4649
+ maxBitrate: E
4614
4650
  };
4615
- return this.parametersSetter.setEncodingsToSender(r, h);
4651
+ return this.parametersSetter.setEncodingsToSender(r, u);
4616
4652
  }
4617
4653
  }
4618
- const ts = (n) => n.find((e) => e.track?.kind === "video");
4619
- class ns {
4654
+ const as = (n) => n.find((e) => e.track?.kind === "video");
4655
+ class os {
4620
4656
  // eslint-disable-next-line @typescript-eslint/class-methods-use-this
4621
4657
  findVideoSender(e) {
4622
- return ts(e);
4658
+ return as(e);
4623
4659
  }
4624
4660
  }
4625
- class ss {
4661
+ class cs {
4626
4662
  currentSender;
4627
4663
  originalReplaceTrack;
4628
4664
  lastWidth;
@@ -4686,7 +4722,7 @@ class ss {
4686
4722
  this.setTimeoutRequest.cancelRequest(), this.lastWidth = void 0, this.lastHeight = void 0;
4687
4723
  }
4688
4724
  }
4689
- class is {
4725
+ class hs {
4690
4726
  apiManager;
4691
4727
  currentHandler;
4692
4728
  constructor(e) {
@@ -4706,7 +4742,7 @@ class is {
4706
4742
  this.currentHandler && (this.apiManager.off("main-cam-control", this.currentHandler), this.currentHandler = void 0);
4707
4743
  }
4708
4744
  }
4709
- class rs {
4745
+ class ds {
4710
4746
  eventHandler;
4711
4747
  senderBalancer;
4712
4748
  parametersSetterWithQueue;
@@ -4718,16 +4754,16 @@ class rs {
4718
4754
  onSetParameters: i,
4719
4755
  pollIntervalMs: r
4720
4756
  } = {}) {
4721
- this.getConnection = t, this.eventHandler = new is(e), this.parametersSetterWithQueue = new xn(i), this.senderBalancer = new es(
4757
+ this.getConnection = t, this.eventHandler = new hs(e), this.parametersSetterWithQueue = new zn(i), this.senderBalancer = new rs(
4722
4758
  {
4723
- senderFinder: new ns(),
4724
- codecProvider: new Hn(),
4759
+ senderFinder: new os(),
4760
+ codecProvider: new Xn(),
4725
4761
  parametersSetter: this.parametersSetterWithQueue
4726
4762
  },
4727
4763
  {
4728
4764
  ignoreForCodec: s
4729
4765
  }
4730
- ), this.trackMonitor = new ss({ pollIntervalMs: r });
4766
+ ), this.trackMonitor = new cs({ pollIntervalMs: r });
4731
4767
  }
4732
4768
  /**
4733
4769
  * Подписывается на события управления главной камерой
@@ -4758,7 +4794,7 @@ class rs {
4758
4794
  const t = await this.senderBalancer.balance(e, this.serverHeaders);
4759
4795
  return this.trackMonitor.subscribe(t.sender, () => {
4760
4796
  this.balance().catch((s) => {
4761
- d("balance on track change: error", s);
4797
+ h("balance on track change: error", s);
4762
4798
  });
4763
4799
  }), t;
4764
4800
  }
@@ -4768,17 +4804,17 @@ class rs {
4768
4804
  */
4769
4805
  handleMainCamControl = (e) => {
4770
4806
  this.serverHeaders = e, this.balance().catch((t) => {
4771
- d("handleMainCamControl: error", t);
4807
+ h("handleMainCamControl: error", t);
4772
4808
  });
4773
4809
  };
4774
4810
  }
4775
- const ye = [
4811
+ const Ue = [
4776
4812
  "balancing-scheduled",
4777
4813
  "balancing-started",
4778
4814
  "balancing-stopped",
4779
4815
  "parameters-updated"
4780
- ], as = () => new M(ye);
4781
- class os {
4816
+ ], ls = () => new A(Ue);
4817
+ class gs {
4782
4818
  isBalancingActive = !1;
4783
4819
  events;
4784
4820
  callManager;
@@ -4786,7 +4822,7 @@ class os {
4786
4822
  videoSendingBalancer;
4787
4823
  startBalancingTimer;
4788
4824
  constructor(e, t, s = {}) {
4789
- this.events = as(), this.callManager = e, this.balancingStartDelay = s.balancingStartDelay ?? 1e4, this.videoSendingBalancer = new rs(
4825
+ this.events = ls(), this.callManager = e, this.balancingStartDelay = s.balancingStartDelay ?? 1e4, this.videoSendingBalancer = new ds(
4790
4826
  t,
4791
4827
  () => e.connection,
4792
4828
  {
@@ -4848,7 +4884,7 @@ class os {
4848
4884
  scheduleBalancingStart() {
4849
4885
  this.clearStartTimer(), this.startBalancingTimer = setTimeout(() => {
4850
4886
  this.startBalancingTimer = void 0, this.startBalancing().catch((e) => {
4851
- d("startBalancing: error", e);
4887
+ h("startBalancing: error", e);
4852
4888
  });
4853
4889
  }, this.balancingStartDelay), this.events.trigger("balancing-scheduled", { delay: this.balancingStartDelay });
4854
4890
  }
@@ -4856,13 +4892,13 @@ class os {
4856
4892
  this.startBalancingTimer && (clearTimeout(this.startBalancingTimer), this.startBalancingTimer = void 0);
4857
4893
  }
4858
4894
  }
4859
- const Le = "no-inbound-frames", cs = [Le], ds = () => new M(cs);
4860
- class ls {
4895
+ const Fe = "no-inbound-frames", ke = [Fe], us = () => new A(ke);
4896
+ class Ts {
4861
4897
  events;
4862
4898
  statsManager;
4863
4899
  callManager;
4864
4900
  constructor(e, t) {
4865
- this.statsManager = e, this.callManager = t, this.events = ds(), this.subscribe();
4901
+ this.statsManager = e, this.callManager = t, this.events = us(), this.subscribe();
4866
4902
  }
4867
4903
  get mainVideoTrack() {
4868
4904
  return this.callManager.getMainStream()?.getVideoTracks()[0];
@@ -4875,36 +4911,36 @@ class ls {
4875
4911
  return this.events.on(e, t);
4876
4912
  }
4877
4913
  handleStatsCollected = () => {
4878
- this.hasNoIncomingFrames() && this.events.trigger(Le, {});
4914
+ this.hasNoIncomingFrames() && this.events.trigger(Fe, {});
4879
4915
  };
4880
- hasNoIncomingFrames = () => this.statsManager.isNotValidFramesStats && this.isMutedMainVideoTrack;
4916
+ hasNoIncomingFrames = () => this.statsManager.isInvalidInboundFrames && this.isMutedMainVideoTrack;
4881
4917
  subscribe() {
4882
4918
  this.statsManager.on("collected", this.handleStatsCollected);
4883
4919
  }
4884
4920
  }
4885
- const hs = 3e3;
4886
- class gs {
4921
+ const Es = 3e3;
4922
+ class Ss {
4887
4923
  renegotiateRequester;
4888
4924
  renegotiateThrottled;
4889
4925
  callManager;
4890
- constructor(e, t = hs) {
4891
- this.callManager = e, this.renegotiateRequester = new G(e.renegotiate.bind(e)), this.renegotiateThrottled = He.throttle(
4926
+ constructor(e, t = Es) {
4927
+ this.callManager = e, this.renegotiateRequester = new $(e.renegotiate.bind(e)), this.renegotiateThrottled = Ye.throttle(
4892
4928
  this.requestRenegotiate.bind(this),
4893
4929
  t
4894
4930
  ), this.subscribe();
4895
4931
  }
4896
4932
  recover() {
4897
- d("trying to recover main stream"), this.renegotiateThrottled();
4933
+ h("trying to recover main stream"), this.renegotiateThrottled();
4898
4934
  }
4899
4935
  requestRenegotiate = () => {
4900
- if (d("trying to renegotiate"), this.renegotiateRequester.requested) {
4901
- d("previous renegotiate is not finished yet");
4936
+ if (h("trying to renegotiate"), this.renegotiateRequester.requested) {
4937
+ h("previous renegotiate is not finished yet");
4902
4938
  return;
4903
4939
  }
4904
4940
  this.renegotiateRequester.request().then(() => {
4905
- d("renegotiate has successful");
4941
+ h("renegotiate has successful");
4906
4942
  }).catch((e) => {
4907
- d("failed to renegotiate main media stream", e);
4943
+ h("failed to renegotiate main media stream", e);
4908
4944
  });
4909
4945
  };
4910
4946
  subscribe() {
@@ -4913,25 +4949,28 @@ class gs {
4913
4949
  });
4914
4950
  }
4915
4951
  cancel() {
4916
- d("cancel recover main stream"), this.renegotiateThrottled.cancel(), this.renegotiateRequester.cancelRequest();
4952
+ h("cancel recover main stream"), this.renegotiateThrottled.cancel(), this.renegotiateRequester.cancelRequest();
4917
4953
  }
4918
4954
  }
4919
- const us = 1e6, Ts = Me.map((n) => `auto-connect:${n}`), Es = Re.map((n) => `connection:${n}`), Cs = ue.map((n) => `call:${n}`), Ss = he.map((n) => `api:${n}`), ps = ve.map((n) => `incoming-call:${n}`), ms = me.map((n) => `presentation:${n}`), Ns = _e.map((n) => `stats:${n}`), Rs = ye.map((n) => `video-balancer:${n}`), As = [
4955
+ const ps = 1e6, Cs = Me.map((n) => `auto-connect:${n}`), ms = Re.map((n) => `connection:${n}`), Ns = ue.map((n) => `call:${n}`), Rs = ve.map((n) => `conference-state:${n}`), As = le.map((n) => `api:${n}`), Is = _e.map((n) => `incoming-call:${n}`), fs = me.map((n) => `presentation:${n}`), Ms = Pe.map((n) => `stats:${n}`), vs = Ue.map((n) => `video-balancer:${n}`), _s = ke.map((n) => `main-stream-health:${n}`), Os = be.map((n) => `session:${n}`), bs = [
4920
4956
  "disconnected-from-out-of-call",
4921
4957
  "connected-with-configuration-from-out-of-call",
4922
4958
  "stopped-presentation-by-server-command"
4923
- ], Is = [
4924
- ...Ts,
4925
- ...Es,
4959
+ ], Ps = [
4926
4960
  ...Cs,
4927
- ...Ss,
4928
- ...ps,
4929
4961
  ...ms,
4930
4962
  ...Ns,
4931
4963
  ...Rs,
4932
- ...As
4933
- ], fs = () => new M(Is);
4934
- class ks {
4964
+ ...As,
4965
+ ...Is,
4966
+ ...fs,
4967
+ ...Ms,
4968
+ ...vs,
4969
+ ..._s,
4970
+ ...Os,
4971
+ ...bs
4972
+ ], Ds = () => new A(Ps);
4973
+ class xs {
4935
4974
  events;
4936
4975
  connectionManager;
4937
4976
  connectionQueueManager;
@@ -4943,7 +4982,7 @@ class ks {
4943
4982
  presentationManager;
4944
4983
  statsManager;
4945
4984
  videoSendingBalancerManager;
4946
- session;
4985
+ sessionManager;
4947
4986
  mainStreamHealthMonitor;
4948
4987
  mainStreamRecovery;
4949
4988
  preferredMimeTypesVideoCodecs;
@@ -4954,29 +4993,29 @@ class ks {
4954
4993
  videoBalancerOptions: i,
4955
4994
  autoConnectorOptions: r
4956
4995
  } = {}) {
4957
- this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.events = fs(), this.connectionManager = new zt({ JsSIP: e }), this.connectionQueueManager = new Xt({
4996
+ this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.events = Ds(), this.connectionManager = new jt({ JsSIP: e }), this.connectionQueueManager = new Zt({
4958
4997
  connectionManager: this.connectionManager
4959
- }), this.conferenceStateManager = new un(), this.callManager = new lt(this.conferenceStateManager), this.apiManager = new Je({
4998
+ }), this.conferenceStateManager = new Sn(), this.callManager = new Tt(this.conferenceStateManager), this.apiManager = new et({
4960
4999
  connectionManager: this.connectionManager,
4961
5000
  callManager: this.callManager
4962
- }), this.incomingCallManager = new Nn(this.connectionManager), this.presentationManager = new Pt({
5001
+ }), this.incomingCallManager = new In(this.connectionManager), this.presentationManager = new wt({
4963
5002
  callManager: this.callManager,
4964
- maxBitrate: us
4965
- }), this.statsManager = new wn({
5003
+ maxBitrate: ps
5004
+ }), this.statsManager = new $n({
4966
5005
  callManager: this.callManager,
4967
5006
  apiManager: this.apiManager
4968
- }), this.autoConnectorManager = new ln(
5007
+ }), this.autoConnectorManager = new Tn(
4969
5008
  {
4970
5009
  connectionQueueManager: this.connectionQueueManager,
4971
5010
  connectionManager: this.connectionManager,
4972
5011
  callManager: this.callManager
4973
5012
  },
4974
5013
  r
4975
- ), this.videoSendingBalancerManager = new os(
5014
+ ), this.videoSendingBalancerManager = new gs(
4976
5015
  this.callManager,
4977
5016
  this.apiManager,
4978
5017
  i
4979
- ), this.mainStreamHealthMonitor = new ls(this.statsManager, this.callManager), this.mainStreamRecovery = new gs(this.callManager), this.session = An({
5018
+ ), this.mainStreamHealthMonitor = new Ts(this.statsManager, this.callManager), this.mainStreamRecovery = new Ss(this.callManager), this.sessionManager = new vn({
4980
5019
  connectionManager: this.connectionManager,
4981
5020
  callManager: this.callManager,
4982
5021
  incomingCallManager: this.incomingCallManager,
@@ -5195,7 +5234,7 @@ class ks {
5195
5234
  if (i === void 0)
5196
5235
  throw new Error("No sipServerUrl for sendOffer");
5197
5236
  const r = this.conferenceStateManager.getToken();
5198
- return Mn({
5237
+ return bn({
5199
5238
  serverUrl: i,
5200
5239
  offer: t,
5201
5240
  token: r,
@@ -5205,13 +5244,13 @@ class ks {
5205
5244
  });
5206
5245
  };
5207
5246
  setCodecPreferences(e) {
5208
- Gn(e, {
5247
+ Wn(e, {
5209
5248
  preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
5210
5249
  excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
5211
5250
  });
5212
5251
  }
5213
5252
  subscribe() {
5214
- this.bridgeEvents("auto-connect", this.autoConnectorManager), this.bridgeEvents("connection", this.connectionManager), this.bridgeEvents("call", this.callManager), this.bridgeEvents("api", this.apiManager), this.bridgeEvents("incoming-call", this.incomingCallManager), this.bridgeEvents("presentation", this.presentationManager), this.bridgeEvents("stats", this.statsManager), this.bridgeEvents("video-balancer", this.videoSendingBalancerManager), this.subscribeToApiEvents(), this.subscribeDisconnectedFromOutOfCall(), this.subscribeConnectedWithConfigurationFromOutOfCall(), this.subscribeToMainStreamHealthMonitorEvents();
5253
+ this.bridgeEvents("auto-connect", this.autoConnectorManager), this.bridgeEvents("connection", this.connectionManager), this.bridgeEvents("call", this.callManager), this.bridgeEvents("conference-state", this.conferenceStateManager), this.bridgeEvents("api", this.apiManager), this.bridgeEvents("incoming-call", this.incomingCallManager), this.bridgeEvents("presentation", this.presentationManager), this.bridgeEvents("stats", this.statsManager), this.bridgeEvents("video-balancer", this.videoSendingBalancerManager), this.bridgeEvents("main-stream-health", this.mainStreamHealthMonitor), this.bridgeEvents("session", this.sessionManager), this.subscribeToApiEvents(), this.subscribeDisconnectedFromOutOfCall(), this.subscribeConnectedWithConfigurationFromOutOfCall(), this.subscribeToMainStreamHealthMonitorEvents();
5215
5254
  }
5216
5255
  subscribeToMainStreamHealthMonitorEvents() {
5217
5256
  this.mainStreamHealthMonitor.on("no-inbound-frames", () => {
@@ -5231,23 +5270,23 @@ class ks {
5231
5270
  }
5232
5271
  export {
5233
5272
  Te as E,
5234
- et as O,
5235
- ks as S,
5236
- Ke as a,
5237
- En as b,
5238
- pe as c,
5239
- Rt as d,
5240
- ze as e,
5241
- Fs as f,
5242
- Us as g,
5243
- xt as h,
5244
- Bs as i,
5245
- m as j,
5246
- Ln as k,
5247
- d as l,
5248
- Vn as m,
5249
- Gt as n,
5250
- Mt as o,
5251
- k as p,
5252
- Mn as s
5273
+ it as O,
5274
+ xs as S,
5275
+ tt as a,
5276
+ Cn as b,
5277
+ Ce as c,
5278
+ Mt as d,
5279
+ je as e,
5280
+ Vs as f,
5281
+ Hs as g,
5282
+ Jt as h,
5283
+ Ws as i,
5284
+ C as j,
5285
+ kn as k,
5286
+ h as l,
5287
+ Yn as m,
5288
+ Ht as n,
5289
+ bt as o,
5290
+ B as p,
5291
+ bn as s
5253
5292
  };