sip-connector 16.1.0 → 16.2.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.
@@ -1,13 +1,13 @@
1
- import { Events as D, TypedEvents as j } from "events-constructor";
1
+ import { Events as D, TypedEvents as K } from "events-constructor";
2
2
  import { CancelableRequest as Re } from "@krivega/cancelable-promise";
3
3
  import q from "debug";
4
- import { hasCanceledError as Ie, repeatedCallsAsync as K } from "repeated-calls";
4
+ import { hasCanceledError as Ie, repeatedCallsAsync as j } from "repeated-calls";
5
5
  import { setup as _e, createActor as Me } from "xstate";
6
6
  import { createStackPromises as Z } from "stack-promises";
7
7
  import { SetTimeoutRequest as ee } from "@krivega/timeout-requester";
8
8
  import "ua-parser-js";
9
9
  import "sequent-promises";
10
- 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))(C || {}), $ = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))($ || {});
10
+ var E = /* @__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))(E || {}), $ = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))($ || {});
11
11
  const te = [
12
12
  "peerconnection",
13
13
  "connecting",
@@ -53,7 +53,7 @@ const te = [
53
53
  } = {}) => {
54
54
  if (!n || e === "recvonly" && t === "recvonly")
55
55
  return;
56
- const i = t === "recvonly" ? [] : n.getAudioTracks(), r = e === "recvonly" ? [] : n.getVideoTracks(), a = [...i, ...r], o = new MediaStream(a);
56
+ const r = t === "recvonly" ? [] : n.getAudioTracks(), i = e === "recvonly" ? [] : n.getVideoTracks(), a = [...r, ...i], o = new MediaStream(a);
57
57
  return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" && pe(o, s), o;
58
58
  };
59
59
  function Pe(n) {
@@ -74,15 +74,15 @@ class De {
74
74
  this.events = e;
75
75
  }
76
76
  }
77
- var ie = /* @__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))(ie || {});
77
+ var re = /* @__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))(re || {});
78
78
  class ye {
79
79
  remoteStreams = {};
80
80
  reset() {
81
81
  this.remoteStreams = {};
82
82
  }
83
83
  generateStream(e, t) {
84
- const { id: s } = e, i = this.remoteStreams[s] ?? new MediaStream();
85
- return t && i.addTrack(t), i.addTrack(e), this.remoteStreams[s] = i, i;
84
+ const { id: s } = e, r = this.remoteStreams[s] ?? new MediaStream();
85
+ return t && r.addTrack(t), r.addTrack(e), this.remoteStreams[s] = r, r;
86
86
  }
87
87
  generateAudioStream(e) {
88
88
  const { id: t } = e, s = this.remoteStreams[t] ?? new MediaStream();
@@ -90,13 +90,13 @@ class ye {
90
90
  }
91
91
  generateStreams(e) {
92
92
  const t = [];
93
- return e.forEach((s, i) => {
93
+ return e.forEach((s, r) => {
94
94
  if (s.kind === "audio")
95
95
  return;
96
- const r = s, a = e[i - 1];
96
+ const i = s, a = e[r - 1];
97
97
  let o;
98
98
  a?.kind === "audio" && (o = a);
99
- const c = this.generateStream(r, o);
99
+ const c = this.generateStream(i, o);
100
100
  t.push(c);
101
101
  }), t;
102
102
  }
@@ -108,7 +108,7 @@ class be extends De {
108
108
  remoteStreamsManager = new ye();
109
109
  disposers = /* @__PURE__ */ new Set();
110
110
  constructor(e) {
111
- super(e), e.on(C.FAILED, this.handleEnded), e.on(C.ENDED, this.handleEnded);
111
+ super(e), e.on(E.FAILED, this.handleEnded), e.on(E.ENDED, this.handleEnded);
112
112
  }
113
113
  get requested() {
114
114
  return this.isPendingCall || this.isPendingAnswer;
@@ -124,24 +124,24 @@ class be extends De {
124
124
  }
125
125
  startCall = async (e, t, {
126
126
  number: s,
127
- mediaStream: i,
128
- extraHeaders: r = [],
127
+ mediaStream: r,
128
+ extraHeaders: i = [],
129
129
  ontrack: a,
130
130
  iceServers: o,
131
131
  directionVideo: c,
132
132
  directionAudio: d,
133
133
  contentHint: u,
134
134
  offerToReceiveAudio: T = !0,
135
- offerToReceiveVideo: h = !0,
135
+ offerToReceiveVideo: g = !0,
136
136
  degradationPreference: S,
137
137
  sendEncodings: m,
138
138
  onAddedTransceiver: I
139
- }) => (this.isPendingCall = !0, new Promise((A, y) => {
140
- this.callConfiguration.number = s, this.callConfiguration.answer = !1, this.handleCall({ ontrack: a }).then(A).catch((b) => {
139
+ }) => (this.isPendingCall = !0, new Promise((R, y) => {
140
+ this.callConfiguration.number = s, this.callConfiguration.answer = !1, this.handleCall({ ontrack: a }).then(R).catch((b) => {
141
141
  y(b);
142
142
  }), this.rtcSession = e.call(t(s), {
143
- extraHeaders: r,
144
- mediaStream: B(i, {
143
+ extraHeaders: i,
144
+ mediaStream: B(r, {
145
145
  directionVideo: c,
146
146
  directionAudio: d,
147
147
  contentHint: u
@@ -157,7 +157,7 @@ class be extends De {
157
157
  },
158
158
  rtcOfferConstraints: {
159
159
  offerToReceiveAudio: T,
160
- offerToReceiveVideo: h
160
+ offerToReceiveVideo: g
161
161
  },
162
162
  degradationPreference: S,
163
163
  sendEncodings: m,
@@ -170,7 +170,7 @@ class be extends De {
170
170
  const { rtcSession: e } = this;
171
171
  if (e && !e.isEnded())
172
172
  return e.terminateAsync({
173
- cause: ie.CANCELED
173
+ cause: re.CANCELED
174
174
  }).finally(() => {
175
175
  this.reset();
176
176
  });
@@ -179,20 +179,20 @@ class be extends De {
179
179
  answerToIncomingCall = async (e, {
180
180
  mediaStream: t,
181
181
  ontrack: s,
182
- extraHeaders: i = [],
183
- iceServers: r,
182
+ extraHeaders: r = [],
183
+ iceServers: i,
184
184
  directionVideo: a,
185
185
  directionAudio: o,
186
186
  offerToReceiveAudio: c,
187
187
  offerToReceiveVideo: d,
188
188
  contentHint: u,
189
189
  degradationPreference: T,
190
- sendEncodings: h,
190
+ sendEncodings: g,
191
191
  onAddedTransceiver: S
192
192
  }) => (this.isPendingAnswer = !0, new Promise((m, I) => {
193
193
  try {
194
- const A = e();
195
- this.rtcSession = A, this.subscribeToSessionEvents(A), this.callConfiguration.answer = !0, this.callConfiguration.number = A.remote_identity.uri.user, this.handleCall({ ontrack: s }).then(m).catch((b) => {
194
+ const R = e();
195
+ this.rtcSession = R, this.subscribeToSessionEvents(R), this.callConfiguration.answer = !0, this.callConfiguration.number = R.remote_identity.uri.user, this.handleCall({ ontrack: s }).then(m).catch((b) => {
196
196
  I(b);
197
197
  });
198
198
  const y = B(t, {
@@ -200,24 +200,24 @@ class be extends De {
200
200
  directionAudio: o,
201
201
  contentHint: u
202
202
  });
203
- A.answer({
204
- extraHeaders: i,
203
+ R.answer({
204
+ extraHeaders: r,
205
205
  directionVideo: a,
206
206
  directionAudio: o,
207
207
  mediaStream: y,
208
208
  pcConfig: {
209
- iceServers: r
209
+ iceServers: i
210
210
  },
211
211
  rtcOfferConstraints: {
212
212
  offerToReceiveAudio: c,
213
213
  offerToReceiveVideo: d
214
214
  },
215
215
  degradationPreference: T,
216
- sendEncodings: h,
216
+ sendEncodings: g,
217
217
  onAddedTransceiver: S
218
218
  });
219
- } catch (A) {
220
- I(A);
219
+ } catch (R) {
220
+ I(R);
221
221
  }
222
222
  }).finally(() => {
223
223
  this.isPendingAnswer = !1;
@@ -237,44 +237,49 @@ class be extends De {
237
237
  async replaceMediaStream(e, t) {
238
238
  if (!this.rtcSession)
239
239
  throw new Error("No rtcSession established");
240
- const { contentHint: s } = t ?? {}, i = B(e, { contentHint: s });
241
- if (i === void 0)
240
+ const { contentHint: s } = t ?? {}, r = B(e, { contentHint: s });
241
+ if (r === void 0)
242
242
  throw new Error("No preparedMediaStream");
243
- return this.rtcSession.replaceMediaStream(i, t);
243
+ return this.rtcSession.replaceMediaStream(r, t);
244
+ }
245
+ async restartIce(e) {
246
+ if (!this.rtcSession)
247
+ throw new Error("No rtcSession established");
248
+ return this.rtcSession.restartIce(e);
244
249
  }
245
250
  handleCall = async ({
246
251
  ontrack: e
247
252
  }) => new Promise((t, s) => {
248
- const i = () => {
249
- this.events.on(C.PEER_CONNECTION, u), this.events.on(C.CONFIRMED, T);
250
- }, r = () => {
251
- this.events.off(C.PEER_CONNECTION, u), this.events.off(C.CONFIRMED, T);
253
+ const r = () => {
254
+ this.events.on(E.PEER_CONNECTION, u), this.events.on(E.CONFIRMED, T);
255
+ }, i = () => {
256
+ this.events.off(E.PEER_CONNECTION, u), this.events.off(E.CONFIRMED, T);
252
257
  }, a = () => {
253
- this.events.on(C.FAILED, c), this.events.on(C.ENDED, c);
258
+ this.events.on(E.FAILED, c), this.events.on(E.ENDED, c);
254
259
  }, o = () => {
255
- this.events.off(C.FAILED, c), this.events.off(C.ENDED, c);
256
- }, c = (h) => {
257
- r(), o(), s(h);
260
+ this.events.off(E.FAILED, c), this.events.off(E.ENDED, c);
261
+ }, c = (g) => {
262
+ i(), o(), s(g);
258
263
  };
259
264
  let d;
260
- const u = ({ peerconnection: h }) => {
261
- d = h;
265
+ const u = ({ peerconnection: g }) => {
266
+ d = g;
262
267
  const S = (m) => {
263
- this.events.trigger(C.PEER_CONNECTION_ONTRACK, h), e && e(m);
268
+ this.events.trigger(E.PEER_CONNECTION_ONTRACK, g), e && e(m);
264
269
  };
265
- h.addEventListener("track", S), this.disposers.add(() => {
266
- h.removeEventListener("track", S);
270
+ g.addEventListener("track", S), this.disposers.add(() => {
271
+ g.removeEventListener("track", S);
267
272
  });
268
273
  }, T = () => {
269
- d !== void 0 && this.events.trigger(C.PEER_CONNECTION_CONFIRMED, d), r(), o(), t(d);
274
+ d !== void 0 && this.events.trigger(E.PEER_CONNECTION_CONFIRMED, d), i(), o(), t(d);
270
275
  };
271
- i(), a();
276
+ r(), a();
272
277
  });
273
278
  subscribeToSessionEvents(e) {
274
279
  this.events.eachTriggers((t, s) => {
275
- const i = te.find((r) => r === s);
276
- i && (e.on(i, t), this.disposers.add(() => {
277
- e.off(i, t);
280
+ const r = te.find((i) => i === s);
281
+ r && (e.on(r, t), this.disposers.add(() => {
282
+ e.off(r, t);
278
283
  }));
279
284
  });
280
285
  }
@@ -285,13 +290,13 @@ class be extends De {
285
290
  }
286
291
  handleEnded = (e) => {
287
292
  const { originator: t } = e;
288
- t === $.REMOTE && this.events.trigger(C.ENDED_FROM_SERVER, e), this.reset();
293
+ t === $.REMOTE && this.events.trigger(E.ENDED_FROM_SERVER, e), this.reset();
289
294
  };
290
295
  reset = () => {
291
296
  delete this.rtcSession, this.remoteStreamsManager.reset(), this.unsubscribeFromSessionEvents(), this.callConfiguration.number = void 0, this.callConfiguration.answer = !1;
292
297
  };
293
298
  }
294
- class we {
299
+ class Ue {
295
300
  events;
296
301
  strategy;
297
302
  constructor(e) {
@@ -338,14 +343,15 @@ class we {
338
343
  getCallConfiguration = () => this.strategy.getCallConfiguration();
339
344
  getRemoteStreams = () => this.strategy.getRemoteStreams();
340
345
  replaceMediaStream = async (...e) => this.strategy.replaceMediaStream(...e);
346
+ restartIce = async (e) => this.strategy.restartIce(e);
341
347
  }
342
- const G = "sip-connector", R = q(G), Tn = () => {
348
+ const G = "sip-connector", A = q(G), Tn = () => {
343
349
  q.enable(G);
344
350
  }, Sn = () => {
345
351
  q.enable(`-${G}`);
346
- }, Ue = "Error decline with 603", Le = 1006, Be = (n) => typeof n == "object" && n !== null && "code" in n && n.code === Le, ke = (n) => n.message === Ue;
347
- var l = /* @__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))(l || {}), k = /* @__PURE__ */ ((n) => (n.AVAILABLE_SECOND_REMOTE_STREAM = "YOUCANRECEIVECONTENT", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "CONTENTEND", n.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", n))(k || {}), F = /* @__PURE__ */ ((n) => (n.SPECTATOR = "SPECTATOR", n.PARTICIPANT = "PARTICIPANT", n.SPECTATOR_OVER_SFU = "SPECTATOROVERSFU", n))(F || {}), O = /* @__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))(O || {}), M = /* @__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))(M || {}), P = /* @__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))(P || {}), W = /* @__PURE__ */ ((n) => (n.ADMIN_STOP_MIC = "ADMINSTOPMIC", n.ADMIN_START_MIC = "ADMINSTARTMIC", n))(W || {}), H = /* @__PURE__ */ ((n) => (n.ADMIN_SYNC_FORCED = "1", n.ADMIN_SYNC_NOT_FORCED = "0", n))(H || {}), Fe = /* @__PURE__ */ ((n) => (n.AUDIO = "AUDIO", n.VIDEO = "VIDEO", n.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", n))(Fe || {}), 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_PARTICIPANTS = "participant:move-request-to-participants", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_OVER_SFU = "participant:move-request-to-spectators-over-sfu", 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 || {});
348
- const re = [
352
+ }, we = "Error decline with 603", Le = 1006, Be = (n) => typeof n == "object" && n !== null && "code" in n && n.code === Le, ke = (n) => n.message === we;
353
+ var h = /* @__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))(h || {}), k = /* @__PURE__ */ ((n) => (n.AVAILABLE_SECOND_REMOTE_STREAM = "YOUCANRECEIVECONTENT", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "CONTENTEND", n.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", n))(k || {}), F = /* @__PURE__ */ ((n) => (n.SPECTATOR = "SPECTATOR", n.PARTICIPANT = "PARTICIPANT", n.SPECTATOR_OVER_SFU = "SPECTATOROVERSFU", n))(F || {}), f = /* @__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.RESTART = "application/vinteo.webrtc.restart", n))(f || {}), M = /* @__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))(M || {}), P = /* @__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))(P || {}), W = /* @__PURE__ */ ((n) => (n.ADMIN_STOP_MIC = "ADMINSTOPMIC", n.ADMIN_START_MIC = "ADMINSTARTMIC", n))(W || {}), H = /* @__PURE__ */ ((n) => (n.ADMIN_SYNC_FORCED = "1", n.ADMIN_SYNC_NOT_FORCED = "0", n))(H || {}), Fe = /* @__PURE__ */ ((n) => (n.AUDIO = "AUDIO", n.VIDEO = "VIDEO", n.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", n))(Fe || {}), 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_PARTICIPANTS = "participant:move-request-to-participants", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_OVER_SFU = "participant:move-request-to-spectators-over-sfu", 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.RESTART = "restart", n))(l || {});
354
+ const ie = [
349
355
  "participation:accepting-word-request",
350
356
  "participation:cancelling-word-request",
351
357
  "participant:move-request-to-stream",
@@ -373,7 +379,8 @@ const re = [
373
379
  "availableSecondRemoteStream",
374
380
  "notAvailableSecondRemoteStream",
375
381
  "mustStopPresentation",
376
- "newDTMF"
382
+ "newDTMF",
383
+ "restart"
377
384
  ];
378
385
  var _ = /* @__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))(_ || {});
379
386
  class $e {
@@ -384,44 +391,44 @@ class $e {
384
391
  connectionManager: e,
385
392
  callManager: t
386
393
  }) {
387
- this.connectionManager = e, this.callManager = t, this.events = new D(re), this.subscribe();
394
+ this.connectionManager = e, this.callManager = t, this.events = new D(ie), this.subscribe();
388
395
  }
389
396
  async waitChannels() {
390
- return this.wait(g.CHANNELS);
397
+ return this.wait(l.CHANNELS);
391
398
  }
392
399
  async waitSyncMediaState() {
393
- return this.wait(g.ADMIN_FORCE_SYNC_MEDIA_STATE);
400
+ return this.wait(l.ADMIN_FORCE_SYNC_MEDIA_STATE);
394
401
  }
395
402
  async sendDTMF(e) {
396
403
  return new Promise((t, s) => {
397
- let i;
404
+ let r;
398
405
  try {
399
- i = this.getEstablishedRTCSessionProtected();
400
- } catch (r) {
401
- s(r);
406
+ r = this.getEstablishedRTCSessionProtected();
407
+ } catch (i) {
408
+ s(i);
402
409
  }
403
- i && (this.callManager.once("newDTMF", ({ originator: r }) => {
404
- r === $.LOCAL && t();
405
- }), i.sendDTMF(e, {
410
+ r && (this.callManager.once("newDTMF", ({ originator: i }) => {
411
+ i === $.LOCAL && t();
412
+ }), r.sendDTMF(e, {
406
413
  duration: 120,
407
414
  interToneGap: 600
408
415
  }));
409
416
  });
410
417
  }
411
418
  async sendChannels({ inputChannels: e, outputChannels: t }) {
412
- const s = this.getEstablishedRTCSessionProtected(), i = `${l.INPUT_CHANNELS}: ${e}`, r = `${l.OUTPUT_CHANNELS}: ${t}`, a = [
413
- i,
414
- r
419
+ const s = this.getEstablishedRTCSessionProtected(), r = `${h.INPUT_CHANNELS}: ${e}`, i = `${h.OUTPUT_CHANNELS}: ${t}`, a = [
420
+ r,
421
+ i
415
422
  ];
416
423
  return s.sendInfo(M.CHANNELS, void 0, { extraHeaders: a });
417
424
  }
418
425
  async sendMediaState({ cam: e, mic: t }, s = {}) {
419
- const i = this.getEstablishedRTCSessionProtected(), r = `${l.MEDIA_STATE}: currentstate`, a = `${l.MAIN_CAM_STATE}: ${Number(e)}`, o = `${l.MIC_STATE}: ${Number(t)}`, c = [
420
- r,
426
+ const r = this.getEstablishedRTCSessionProtected(), i = `${h.MEDIA_STATE}: currentstate`, a = `${h.MAIN_CAM_STATE}: ${Number(e)}`, o = `${h.MIC_STATE}: ${Number(t)}`, c = [
427
+ i,
421
428
  a,
422
429
  o
423
430
  ];
424
- return i.sendInfo(M.MEDIA_STATE, void 0, {
431
+ return r.sendInfo(M.MEDIA_STATE, void 0, {
425
432
  noTerminateWhenError: !0,
426
433
  ...s,
427
434
  extraHeaders: c
@@ -430,14 +437,14 @@ class $e {
430
437
  async sendStats({
431
438
  availableIncomingBitrate: e
432
439
  }) {
433
- const t = this.getEstablishedRTCSessionProtected(), i = [`${l.AVAILABLE_INCOMING_BITRATE}: ${e}`];
440
+ const t = this.getEstablishedRTCSessionProtected(), r = [`${h.AVAILABLE_INCOMING_BITRATE}: ${e}`];
434
441
  return t.sendInfo(M.STATS, void 0, {
435
442
  noTerminateWhenError: !0,
436
- extraHeaders: i
443
+ extraHeaders: r
437
444
  });
438
445
  }
439
446
  async sendRefusalToTurnOn(e, t = {}) {
440
- const s = this.getEstablishedRTCSessionProtected(), a = e === "mic" ? 0 : 1, c = [`${l.MEDIA_TYPE}: ${a}`];
447
+ const s = this.getEstablishedRTCSessionProtected(), a = e === "mic" ? 0 : 1, c = [`${h.MEDIA_TYPE}: ${a}`];
441
448
  return s.sendInfo(M.REFUSAL, void 0, {
442
449
  noTerminateWhenError: !0,
443
450
  ...t,
@@ -452,38 +459,38 @@ class $e {
452
459
  }
453
460
  async sendMustStopPresentationP2P() {
454
461
  await this.getEstablishedRTCSessionProtected().sendInfo(M.SHARE_STATE, void 0, {
455
- extraHeaders: [l.MUST_STOP_PRESENTATION_P2P]
462
+ extraHeaders: [h.MUST_STOP_PRESENTATION_P2P]
456
463
  });
457
464
  }
458
465
  async sendStoppedPresentationP2P() {
459
466
  await this.getEstablishedRTCSessionProtected().sendInfo(M.SHARE_STATE, void 0, {
460
- extraHeaders: [l.STOP_PRESENTATION_P2P]
467
+ extraHeaders: [h.STOP_PRESENTATION_P2P]
461
468
  });
462
469
  }
463
470
  async sendStoppedPresentation() {
464
471
  await this.getEstablishedRTCSessionProtected().sendInfo(M.SHARE_STATE, void 0, {
465
- extraHeaders: [l.STOP_PRESENTATION]
472
+ extraHeaders: [h.STOP_PRESENTATION]
466
473
  });
467
474
  }
468
475
  async askPermissionToStartPresentationP2P() {
469
476
  await this.getEstablishedRTCSessionProtected().sendInfo(M.SHARE_STATE, void 0, {
470
- extraHeaders: [l.START_PRESENTATION_P2P]
477
+ extraHeaders: [h.START_PRESENTATION_P2P]
471
478
  });
472
479
  }
473
480
  async askPermissionToStartPresentation() {
474
481
  await this.getEstablishedRTCSessionProtected().sendInfo(M.SHARE_STATE, void 0, {
475
- extraHeaders: [l.START_PRESENTATION]
482
+ extraHeaders: [h.START_PRESENTATION]
476
483
  });
477
484
  }
478
485
  async askPermissionToEnableCam(e = {}) {
479
- const t = this.getEstablishedRTCSessionProtected(), s = [l.ENABLE_MAIN_CAM];
486
+ const t = this.getEstablishedRTCSessionProtected(), s = [h.ENABLE_MAIN_CAM];
480
487
  return t.sendInfo(M.MAIN_CAM, void 0, {
481
488
  noTerminateWhenError: !0,
482
489
  ...e,
483
490
  extraHeaders: s
484
- }).catch((i) => {
485
- if (ke(i))
486
- throw i;
491
+ }).catch((r) => {
492
+ if (ke(r))
493
+ throw r;
487
494
  });
488
495
  }
489
496
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
@@ -521,13 +528,13 @@ class $e {
521
528
  };
522
529
  maybeHandleNotify = (e) => {
523
530
  try {
524
- const t = e.getHeader(l.NOTIFY);
531
+ const t = e.getHeader(h.NOTIFY);
525
532
  if (t) {
526
533
  const s = JSON.parse(t);
527
534
  this.handleNotify(s);
528
535
  }
529
536
  } catch (t) {
530
- R("error parse notify", t);
537
+ A("error parse notify", t);
531
538
  }
532
539
  };
533
540
  handleNotify = (e) => {
@@ -586,52 +593,56 @@ class $e {
586
593
  break;
587
594
  }
588
595
  default:
589
- R("unknown cmd", e);
596
+ A("unknown cmd", e);
590
597
  }
591
598
  };
592
599
  handleNewInfo = (e) => {
593
600
  const { originator: t } = e;
594
601
  if (t !== $.REMOTE)
595
602
  return;
596
- const { request: s } = e, i = s.getHeader(l.CONTENT_TYPE);
597
- if (i !== void 0)
598
- switch (i) {
599
- case O.ENTER_ROOM: {
603
+ const { request: s } = e, r = s.getHeader(h.CONTENT_TYPE);
604
+ if (r !== void 0)
605
+ switch (r) {
606
+ case f.ENTER_ROOM: {
600
607
  this.triggerEnterRoom(s), this.maybeTriggerChannels(s);
601
608
  break;
602
609
  }
603
- case O.NOTIFY: {
610
+ case f.NOTIFY: {
604
611
  this.maybeHandleNotify(s);
605
612
  break;
606
613
  }
607
- case O.SHARE_STATE: {
614
+ case f.SHARE_STATE: {
608
615
  this.triggerShareState(s);
609
616
  break;
610
617
  }
611
- case O.MAIN_CAM: {
618
+ case f.MAIN_CAM: {
612
619
  this.triggerMainCamControl(s);
613
620
  break;
614
621
  }
615
- case O.MIC: {
622
+ case f.MIC: {
616
623
  this.triggerMicControl(s);
617
624
  break;
618
625
  }
619
- case O.USE_LICENSE: {
626
+ case f.USE_LICENSE: {
620
627
  this.triggerUseLicense(s);
621
628
  break;
622
629
  }
623
- case O.PARTICIPANT_STATE: {
630
+ case f.PARTICIPANT_STATE: {
624
631
  this.maybeTriggerParticipantMoveRequest(s);
625
632
  break;
626
633
  }
634
+ case f.RESTART: {
635
+ this.triggerRestart(s);
636
+ break;
637
+ }
627
638
  }
628
639
  };
629
640
  triggerChannelsNotify = (e) => {
630
- const t = e.input, s = e.output, i = {
641
+ const t = e.input, s = e.output, r = {
631
642
  inputChannels: t,
632
643
  outputChannels: s
633
644
  };
634
- this.events.trigger(g.CHANNELS_NOTIFY, i);
645
+ this.events.trigger(l.CHANNELS_NOTIFY, r);
635
646
  };
636
647
  triggerWebcastStartedNotify = ({
637
648
  body: { conference: e, type: t }
@@ -640,7 +651,7 @@ class $e {
640
651
  conference: e,
641
652
  type: t
642
653
  };
643
- this.events.trigger(g.WEBCAST_STARTED, s);
654
+ this.events.trigger(l.WEBCAST_STARTED, s);
644
655
  };
645
656
  triggerWebcastStoppedNotify = ({
646
657
  body: { conference: e, type: t }
@@ -649,7 +660,7 @@ class $e {
649
660
  conference: e,
650
661
  type: t
651
662
  };
652
- this.events.trigger(g.WEBCAST_STOPPED, s);
663
+ this.events.trigger(l.WEBCAST_STOPPED, s);
653
664
  };
654
665
  triggerAddedToListModeratorsNotify = ({
655
666
  conference: e
@@ -658,7 +669,7 @@ class $e {
658
669
  conference: e
659
670
  };
660
671
  this.events.trigger(
661
- g.PARTICIPANT_ADDED_TO_LIST_MODERATORS,
672
+ l.PARTICIPANT_ADDED_TO_LIST_MODERATORS,
662
673
  t
663
674
  );
664
675
  };
@@ -669,7 +680,7 @@ class $e {
669
680
  conference: e
670
681
  };
671
682
  this.events.trigger(
672
- g.PARTICIPANT_REMOVED_FROM_LIST_MODERATORS,
683
+ l.PARTICIPANT_REMOVED_FROM_LIST_MODERATORS,
673
684
  t
674
685
  );
675
686
  };
@@ -679,7 +690,7 @@ class $e {
679
690
  const t = {
680
691
  conference: e
681
692
  };
682
- this.events.trigger(g.PARTICIPATION_ACCEPTING_WORD_REQUEST, t);
693
+ this.events.trigger(l.PARTICIPATION_ACCEPTING_WORD_REQUEST, t);
683
694
  };
684
695
  triggerParticipationCancellingWordRequest = ({
685
696
  body: { conference: e }
@@ -687,7 +698,7 @@ class $e {
687
698
  const t = {
688
699
  conference: e
689
700
  };
690
- this.events.trigger(g.PARTICIPATION_CANCELLING_WORD_REQUEST, t);
701
+ this.events.trigger(l.PARTICIPATION_CANCELLING_WORD_REQUEST, t);
691
702
  };
692
703
  triggerParticipantMoveRequestToStream = ({
693
704
  body: { conference: e }
@@ -695,87 +706,97 @@ class $e {
695
706
  const t = {
696
707
  conference: e
697
708
  };
698
- this.events.trigger(g.PARTICIPANT_MOVE_REQUEST_TO_STREAM, t);
709
+ this.events.trigger(l.PARTICIPANT_MOVE_REQUEST_TO_STREAM, t);
699
710
  };
700
711
  triggerAccountChangedNotify = () => {
701
- this.events.trigger(g.ACCOUNT_CHANGED, void 0);
712
+ this.events.trigger(l.ACCOUNT_CHANGED, void 0);
702
713
  };
703
714
  triggerAccountDeletedNotify = () => {
704
- this.events.trigger(g.ACCOUNT_DELETED, void 0);
715
+ this.events.trigger(l.ACCOUNT_DELETED, void 0);
705
716
  };
706
717
  triggerConferenceParticipantTokenIssued = ({
707
718
  body: { conference: e, participant: t, jwt: s }
708
719
  }) => {
709
- const i = {
720
+ const r = {
710
721
  conference: e,
711
722
  participant: t,
712
723
  jwt: s
713
724
  };
714
725
  this.events.trigger(
715
- g.CONFERENCE_PARTICIPANT_TOKEN_ISSUED,
716
- i
726
+ l.CONFERENCE_PARTICIPANT_TOKEN_ISSUED,
727
+ r
717
728
  );
718
729
  };
719
730
  maybeTriggerChannels = (e) => {
720
- const t = e.getHeader(l.INPUT_CHANNELS), s = e.getHeader(l.OUTPUT_CHANNELS);
731
+ const t = e.getHeader(h.INPUT_CHANNELS), s = e.getHeader(h.OUTPUT_CHANNELS);
721
732
  if (t && s) {
722
- const i = {
733
+ const r = {
723
734
  inputChannels: t,
724
735
  outputChannels: s
725
736
  };
726
- this.events.trigger(g.CHANNELS, i);
737
+ this.events.trigger(l.CHANNELS, r);
727
738
  }
728
739
  };
729
740
  triggerEnterRoom = (e) => {
730
- const t = e.getHeader(l.CONTENT_ENTER_ROOM), s = e.getHeader(l.PARTICIPANT_NAME);
731
- this.events.trigger(g.ENTER_ROOM, { room: t, participantName: s });
741
+ const t = e.getHeader(h.CONTENT_ENTER_ROOM), s = e.getHeader(h.PARTICIPANT_NAME);
742
+ this.events.trigger(l.ENTER_ROOM, { room: t, participantName: s });
732
743
  };
733
744
  triggerShareState = (e) => {
734
- const t = e.getHeader(l.CONTENT_SHARE_STATE);
745
+ const t = e.getHeader(h.CONTENT_SHARE_STATE);
735
746
  if (t !== void 0)
736
747
  switch (t) {
737
748
  case k.AVAILABLE_SECOND_REMOTE_STREAM: {
738
- this.events.trigger(g.AVAILABLE_SECOND_REMOTE_STREAM, void 0);
749
+ this.events.trigger(l.AVAILABLE_SECOND_REMOTE_STREAM, void 0);
739
750
  break;
740
751
  }
741
752
  case k.NOT_AVAILABLE_SECOND_REMOTE_STREAM: {
742
- this.events.trigger(g.NOT_AVAILABLE_SECOND_REMOTE_STREAM, void 0);
753
+ this.events.trigger(l.NOT_AVAILABLE_SECOND_REMOTE_STREAM, void 0);
743
754
  break;
744
755
  }
745
756
  case k.MUST_STOP_PRESENTATION: {
746
- this.events.trigger(g.MUST_STOP_PRESENTATION, void 0);
757
+ this.events.trigger(l.MUST_STOP_PRESENTATION, void 0);
747
758
  break;
748
759
  }
749
760
  }
750
761
  };
751
762
  maybeTriggerParticipantMoveRequest = (e) => {
752
- const t = e.getHeader(l.CONTENT_PARTICIPANT_STATE);
753
- t === F.SPECTATOR && this.events.trigger(g.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS, void 0), t === F.PARTICIPANT && this.events.trigger(g.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS, void 0), t === F.SPECTATOR_OVER_SFU && this.events.trigger(g.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_OVER_SFU, void 0);
763
+ const t = e.getHeader(h.CONTENT_PARTICIPANT_STATE);
764
+ t === F.SPECTATOR && this.events.trigger(l.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS, void 0), t === F.PARTICIPANT && this.events.trigger(l.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS, void 0), t === F.SPECTATOR_OVER_SFU && this.events.trigger(l.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_OVER_SFU, void 0);
754
765
  };
755
766
  triggerMainCamControl = (e) => {
756
- const t = e.getHeader(l.MAIN_CAM), s = e.getHeader(l.MEDIA_SYNC), i = s === H.ADMIN_SYNC_FORCED;
767
+ const t = e.getHeader(h.MAIN_CAM), s = e.getHeader(h.MEDIA_SYNC), r = s === H.ADMIN_SYNC_FORCED;
757
768
  if (t === P.ADMIN_START_MAIN_CAM) {
758
- this.events.trigger(g.ADMIN_START_MAIN_CAM, { isSyncForced: i });
769
+ this.events.trigger(l.ADMIN_START_MAIN_CAM, { isSyncForced: r });
759
770
  return;
760
771
  }
761
772
  if (t === P.ADMIN_STOP_MAIN_CAM) {
762
- this.events.trigger(g.ADMIN_STOP_MAIN_CAM, { isSyncForced: i });
773
+ this.events.trigger(l.ADMIN_STOP_MAIN_CAM, { isSyncForced: r });
763
774
  return;
764
775
  }
765
- (t === P.RESUME_MAIN_CAM || t === P.PAUSE_MAIN_CAM) && s !== void 0 && this.events.trigger(g.ADMIN_FORCE_SYNC_MEDIA_STATE, { isSyncForced: i });
766
- const r = e.getHeader(l.MAIN_CAM_RESOLUTION);
767
- this.events.trigger(g.MAIN_CAM_CONTROL, {
776
+ (t === P.RESUME_MAIN_CAM || t === P.PAUSE_MAIN_CAM) && s !== void 0 && this.events.trigger(l.ADMIN_FORCE_SYNC_MEDIA_STATE, { isSyncForced: r });
777
+ const i = e.getHeader(h.MAIN_CAM_RESOLUTION);
778
+ this.events.trigger(l.MAIN_CAM_CONTROL, {
768
779
  mainCam: t,
769
- resolutionMainCam: r
780
+ resolutionMainCam: i
770
781
  });
771
782
  };
772
783
  triggerMicControl = (e) => {
773
- const t = e.getHeader(l.MIC), i = e.getHeader(l.MEDIA_SYNC) === H.ADMIN_SYNC_FORCED;
774
- t === W.ADMIN_START_MIC ? this.events.trigger(g.ADMIN_START_MIC, { isSyncForced: i }) : t === W.ADMIN_STOP_MIC && this.events.trigger(g.ADMIN_STOP_MIC, { isSyncForced: i });
784
+ const t = e.getHeader(h.MIC), r = e.getHeader(h.MEDIA_SYNC) === H.ADMIN_SYNC_FORCED;
785
+ t === W.ADMIN_START_MIC ? this.events.trigger(l.ADMIN_START_MIC, { isSyncForced: r }) : t === W.ADMIN_STOP_MIC && this.events.trigger(l.ADMIN_STOP_MIC, { isSyncForced: r });
775
786
  };
776
787
  triggerUseLicense = (e) => {
777
- const t = e.getHeader(l.CONTENT_USE_LICENSE);
778
- this.events.trigger(g.USE_LICENSE, t);
788
+ const t = e.getHeader(h.CONTENT_USE_LICENSE);
789
+ this.events.trigger(l.USE_LICENSE, t);
790
+ };
791
+ triggerRestart = (e) => {
792
+ const t = e.getHeader(
793
+ h.TRACKS_DIRECTION
794
+ ), s = Number(
795
+ e.getHeader(h.AUDIO_TRACK_COUNT)
796
+ ), r = Number(
797
+ e.getHeader(h.VIDEO_TRACK_COUNT)
798
+ ), i = { tracksDirection: t, audioTrackCount: s, videoTrackCount: r };
799
+ this.events.trigger(l.RESTART, i);
779
800
  };
780
801
  }
781
802
  const Ve = (n, e) => (n.degradationPreference = e.degradationPreference, n), We = (n, e) => {
@@ -806,11 +827,11 @@ const Ve = (n, e) => (n.degradationPreference = e.degradationPreference, n), We
806
827
  return s !== void 0 && (n.scaleResolutionDownBy = s), n;
807
828
  }, ze = (n, e) => {
808
829
  const t = e.encodings?.length ?? 0;
809
- return We(n, t), n.encodings.forEach((s, i) => {
810
- const r = (e?.encodings ?? [])[i], a = r?.maxBitrate, o = r?.scaleResolutionDownBy;
830
+ return We(n, t), n.encodings.forEach((s, r) => {
831
+ const i = (e?.encodings ?? [])[r], a = i?.maxBitrate, o = i?.scaleResolutionDownBy;
811
832
  qe(s, a), Ye(s, o);
812
833
  }), n;
813
- }, Je = (n, e) => {
834
+ }, Xe = (n, e) => {
814
835
  if (n.codecs?.length !== e.codecs?.length)
815
836
  return !0;
816
837
  for (let t = 0; t < (n.codecs?.length ?? 0); t++)
@@ -827,15 +848,15 @@ const Ve = (n, e) => (n.degradationPreference = e.degradationPreference, n), We
827
848
  if (JSON.stringify(n.encodings[t]) !== JSON.stringify(e.encodings[t]))
828
849
  return !0;
829
850
  return n.rtcp?.cname !== e.rtcp?.cname || n.rtcp?.reducedSize !== e.rtcp?.reducedSize || n.degradationPreference !== e.degradationPreference;
830
- }, Xe = async (n, e) => {
851
+ }, Je = async (n, e) => {
831
852
  const t = n.getParameters(), s = JSON.parse(
832
853
  JSON.stringify(t)
833
854
  );
834
855
  ze(t, e), Ve(t, e);
835
- const i = Je(s, t);
836
- return i && await n.setParameters(t), { parameters: t, isChanged: i };
856
+ const r = Xe(s, t);
857
+ return r && await n.setParameters(t), { parameters: t, isChanged: r };
837
858
  }, ce = async (n, e, t) => {
838
- const { isChanged: s, parameters: i } = await Xe(n, {
859
+ const { isChanged: s, parameters: r } = await Je(n, {
839
860
  encodings: [
840
861
  {
841
862
  scaleResolutionDownBy: e.scaleResolutionDownBy,
@@ -843,20 +864,20 @@ const Ve = (n, e) => (n.degradationPreference = e.degradationPreference, n), We
843
864
  }
844
865
  ]
845
866
  });
846
- return s && t && t(i), { isChanged: s, parameters: i };
847
- }, je = (n, e) => n.find((t) => t.track !== null && e.getTracks().includes(t.track)), Ke = async (n, e, t) => {
848
- const s = je(n, e);
867
+ return s && t && t(r), { isChanged: s, parameters: r };
868
+ }, Ke = (n, e) => n.find((t) => t.track !== null && e.getTracks().includes(t.track)), je = async (n, e, t) => {
869
+ const s = Ke(n, e);
849
870
  if (s)
850
871
  return ce(s, { maxBitrate: t });
851
872
  };
852
- var f = /* @__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))(f || {});
873
+ var O = /* @__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))(O || {});
853
874
  const de = [
854
875
  "presentation:start",
855
876
  "presentation:started",
856
877
  "presentation:end",
857
878
  "presentation:ended",
858
879
  "presentation:failed"
859
- ], Ze = 1, En = (n) => Ie(n);
880
+ ], Ze = 1, Cn = (n) => Ie(n);
860
881
  class et {
861
882
  events;
862
883
  promisePendingStartPresentation;
@@ -877,8 +898,8 @@ class et {
877
898
  // eslint-disable-next-line @typescript-eslint/max-params
878
899
  async startPresentation(e, t, {
879
900
  isNeedReinvite: s,
880
- contentHint: i,
881
- sendEncodings: r,
901
+ contentHint: r,
902
+ sendEncodings: i,
882
903
  onAddedTransceiver: a
883
904
  } = {}, o) {
884
905
  const c = this.getRtcSessionProtected();
@@ -889,8 +910,8 @@ class et {
889
910
  stream: t,
890
911
  presentationOptions: {
891
912
  isNeedReinvite: s,
892
- contentHint: i,
893
- sendEncodings: r,
913
+ contentHint: r,
914
+ sendEncodings: i,
894
915
  onAddedTransceiver: a
895
916
  },
896
917
  options: o
@@ -902,17 +923,17 @@ class et {
902
923
  let s = this.promisePendingStartPresentation ?? Promise.resolve(void 0);
903
924
  this.promisePendingStartPresentation && await this.promisePendingStartPresentation.catch(() => {
904
925
  });
905
- const i = this.callManager.getEstablishedRTCSession();
906
- return i && t ? s = e().then(async () => i.stopPresentation(t)).catch((r) => {
907
- throw this.events.trigger(f.FAILED_PRESENTATION, r), r;
908
- }) : t && this.events.trigger(f.ENDED_PRESENTATION, t), this.promisePendingStopPresentation = s, s.finally(() => {
926
+ const r = this.callManager.getEstablishedRTCSession();
927
+ return r && t ? s = e().then(async () => r.stopPresentation(t)).catch((i) => {
928
+ throw this.events.trigger(O.FAILED_PRESENTATION, i), i;
929
+ }) : t && this.events.trigger(O.ENDED_PRESENTATION, t), this.promisePendingStopPresentation = s, s.finally(() => {
909
930
  this.resetPresentation();
910
931
  });
911
932
  }
912
933
  async updatePresentation(e, t, {
913
934
  contentHint: s,
914
- sendEncodings: i,
915
- onAddedTransceiver: r
935
+ sendEncodings: r,
936
+ onAddedTransceiver: i
916
937
  } = {}) {
917
938
  const a = this.getRtcSessionProtected();
918
939
  if (!this.streamPresentationCurrent)
@@ -920,8 +941,8 @@ class et {
920
941
  return this.promisePendingStartPresentation && await this.promisePendingStartPresentation, this.sendPresentation(e, a, t, {
921
942
  contentHint: s,
922
943
  isNeedReinvite: !1,
923
- sendEncodings: i,
924
- onAddedTransceiver: r
944
+ sendEncodings: r,
945
+ onAddedTransceiver: i
925
946
  }).then(async (o) => (await this.setMaxBitrate(), o));
926
947
  }
927
948
  cancelSendPresentationWithRepeatedCalls() {
@@ -948,22 +969,22 @@ class et {
948
969
  }
949
970
  subscribe() {
950
971
  this.callManager.on("presentation:start", (e) => {
951
- this.events.trigger(f.START_PRESENTATION, e);
972
+ this.events.trigger(O.START_PRESENTATION, e);
952
973
  }), this.callManager.on("presentation:started", (e) => {
953
- this.events.trigger(f.STARTED_PRESENTATION, e);
974
+ this.events.trigger(O.STARTED_PRESENTATION, e);
954
975
  }), this.callManager.on("presentation:end", (e) => {
955
- this.events.trigger(f.END_PRESENTATION, e);
976
+ this.events.trigger(O.END_PRESENTATION, e);
956
977
  }), this.callManager.on("presentation:ended", (e) => {
957
- this.events.trigger(f.ENDED_PRESENTATION, e);
978
+ this.events.trigger(O.ENDED_PRESENTATION, e);
958
979
  }), this.callManager.on("presentation:failed", (e) => {
959
- this.events.trigger(f.FAILED_PRESENTATION, e);
980
+ this.events.trigger(O.FAILED_PRESENTATION, e);
960
981
  }), this.callManager.on("failed", this.handleEnded), this.callManager.on("ended", this.handleEnded);
961
982
  }
962
983
  async sendPresentationWithDuplicatedCalls(e, {
963
984
  rtcSession: t,
964
985
  stream: s,
965
- presentationOptions: i,
966
- options: r = {
986
+ presentationOptions: r,
987
+ options: i = {
967
988
  callLimit: Ze
968
989
  }
969
990
  }) {
@@ -971,33 +992,33 @@ class et {
971
992
  e,
972
993
  t,
973
994
  s,
974
- i
995
+ r
975
996
  ), o = () => !!this.streamPresentationCurrent;
976
- return this.cancelableSendPresentationWithRepeatedCalls = K({
997
+ return this.cancelableSendPresentationWithRepeatedCalls = j({
977
998
  targetFunction: a,
978
999
  isComplete: o,
979
1000
  isRejectAsValid: !0,
980
- ...r
1001
+ ...i
981
1002
  }), this.cancelableSendPresentationWithRepeatedCalls.then((c) => c);
982
1003
  }
983
1004
  // eslint-disable-next-line @typescript-eslint/max-params
984
1005
  async sendPresentation(e, t, s, {
985
- isNeedReinvite: i = !0,
986
- contentHint: r = "detail",
1006
+ isNeedReinvite: r = !0,
1007
+ contentHint: i = "detail",
987
1008
  degradationPreference: a,
988
1009
  sendEncodings: o,
989
1010
  onAddedTransceiver: c
990
1011
  }) {
991
- const d = B(s, { contentHint: r });
1012
+ const d = B(s, { contentHint: i });
992
1013
  if (d === void 0)
993
1014
  throw new Error("No streamPresentationTarget");
994
1015
  this.streamPresentationCurrent = d;
995
- const u = e().then(async () => t.startPresentation(d, i, {
1016
+ const u = e().then(async () => t.startPresentation(d, r, {
996
1017
  degradationPreference: a,
997
1018
  sendEncodings: o,
998
1019
  onAddedTransceiver: c
999
1020
  })).then(this.setMaxBitrate).then(() => s).catch((T) => {
1000
- throw this.removeStreamPresentationCurrent(), this.events.trigger(f.FAILED_PRESENTATION, T), T;
1021
+ throw this.removeStreamPresentationCurrent(), this.events.trigger(O.FAILED_PRESENTATION, T), T;
1001
1022
  });
1002
1023
  return this.promisePendingStartPresentation = u, u.finally(() => {
1003
1024
  this.promisePendingStartPresentation = void 0;
@@ -1007,8 +1028,8 @@ class et {
1007
1028
  const { connection: e } = this.callManager, { streamPresentationCurrent: t } = this, { maxBitrate: s } = this;
1008
1029
  if (!e || !t || s === void 0)
1009
1030
  return;
1010
- const i = e.getSenders();
1011
- await Ke(i, t, s);
1031
+ const r = e.getSenders();
1032
+ await je(r, t, s);
1012
1033
  };
1013
1034
  getRtcSessionProtected = () => {
1014
1035
  const e = this.callManager.getEstablishedRTCSession();
@@ -1133,15 +1154,15 @@ class st {
1133
1154
  }
1134
1155
  connect = async (e, t) => (this.cancelRequests(), this.connectWithDuplicatedCalls(e, t));
1135
1156
  set = async ({ displayName: e }) => new Promise((t, s) => {
1136
- const i = this.getUa();
1137
- if (!i) {
1157
+ const r = this.getUa();
1158
+ if (!r) {
1138
1159
  s(new Error("this.ua is not initialized"));
1139
1160
  return;
1140
1161
  }
1141
- let r = !1;
1162
+ let i = !1;
1142
1163
  const a = this.getConnectionConfiguration();
1143
- e !== void 0 && e !== a.displayName && (r = i.set("display_name", se(e)), this.updateConnectionConfiguration("displayName", e));
1144
- const o = r;
1164
+ e !== void 0 && e !== a.displayName && (i = r.set("display_name", se(e)), this.updateConnectionConfiguration("displayName", e));
1165
+ const o = i;
1145
1166
  o ? t(o) : s(new Error("nothing changed"));
1146
1167
  });
1147
1168
  disconnect = async () => {
@@ -1158,68 +1179,68 @@ class st {
1158
1179
  this.cancelConnectWithRepeatedCalls();
1159
1180
  }
1160
1181
  connectWithDuplicatedCalls = async (e, { callLimit: t = nt } = {}) => {
1161
- const s = async () => this.connectInner(e), i = (r) => {
1162
- const c = this.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), d = r != null && !Be(r);
1182
+ const s = async () => this.connectInner(e), r = (i) => {
1183
+ const c = this.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), d = i != null && !Be(i);
1163
1184
  return c || d;
1164
1185
  };
1165
- return this.stateMachine.startConnect(), this.cancelableConnectWithRepeatedCalls = K({
1186
+ return this.stateMachine.startConnect(), this.cancelableConnectWithRepeatedCalls = j({
1166
1187
  targetFunction: s,
1167
- isComplete: i,
1188
+ isComplete: r,
1168
1189
  callLimit: t,
1169
1190
  isRejectAsValid: !0,
1170
1191
  isCheckBeforeCall: !1
1171
- }), this.cancelableConnectWithRepeatedCalls.then((r) => {
1172
- if (r instanceof this.JsSIP.UA)
1173
- return r;
1174
- throw r;
1192
+ }), this.cancelableConnectWithRepeatedCalls.then((i) => {
1193
+ if (i instanceof this.JsSIP.UA)
1194
+ return i;
1195
+ throw i;
1175
1196
  });
1176
1197
  };
1177
1198
  hasEqualConnectionConfiguration(e) {
1178
- const { configuration: t } = this.uaFactory.createConfiguration(e), i = this.getUa()?.configuration;
1179
- return i ? i.password === t.password && i.register === t.register && i.uri.toString() === t.uri && i.display_name === t.display_name && i.user_agent === t.user_agent && i.sockets === t.sockets && i.session_timers === t.session_timers && i.register_expires === t.register_expires && i.connection_recovery_min_interval === t.connection_recovery_min_interval && i.connection_recovery_max_interval === t.connection_recovery_max_interval : !1;
1199
+ const { configuration: t } = this.uaFactory.createConfiguration(e), r = this.getUa()?.configuration;
1200
+ return r ? r.password === t.password && r.register === t.register && r.uri.toString() === t.uri && r.display_name === t.display_name && r.user_agent === t.user_agent && r.sockets === t.sockets && r.session_timers === t.session_timers && r.register_expires === t.register_expires && r.connection_recovery_min_interval === t.connection_recovery_min_interval && r.connection_recovery_max_interval === t.connection_recovery_max_interval : !1;
1180
1201
  }
1181
1202
  connectInner = async (e) => this.initUa(e).then(async () => this.start());
1182
1203
  initUa = async ({
1183
1204
  user: e,
1184
1205
  password: t,
1185
1206
  sipServerUrl: s,
1186
- sipWebSocketServerURL: i,
1187
- remoteAddress: r,
1207
+ sipWebSocketServerURL: r,
1208
+ remoteAddress: i,
1188
1209
  sessionTimers: a,
1189
1210
  registerExpires: o,
1190
1211
  connectionRecoveryMinInterval: c,
1191
1212
  connectionRecoveryMaxInterval: d,
1192
1213
  userAgent: u,
1193
1214
  displayName: T = "",
1194
- register: h = !1,
1215
+ register: g = !1,
1195
1216
  extraHeaders: S = []
1196
1217
  }) => {
1197
1218
  this.stateMachine.startInitUa(), this.setConnectionConfiguration({
1198
1219
  sipServerUrl: s,
1199
1220
  displayName: T,
1200
- register: h,
1221
+ register: g,
1201
1222
  user: e,
1202
1223
  password: t
1203
1224
  }), this.getUa() && await this.disconnect();
1204
- const { ua: I, helpers: A } = this.uaFactory.createUAWithConfiguration(
1225
+ const { ua: I, helpers: R } = this.uaFactory.createUAWithConfiguration(
1205
1226
  {
1206
1227
  user: e,
1207
1228
  password: t,
1208
1229
  sipServerUrl: s,
1209
- sipWebSocketServerURL: i,
1230
+ sipWebSocketServerURL: r,
1210
1231
  displayName: T,
1211
- register: h,
1232
+ register: g,
1212
1233
  sessionTimers: a,
1213
1234
  registerExpires: o,
1214
1235
  connectionRecoveryMinInterval: c,
1215
1236
  connectionRecoveryMaxInterval: d,
1216
1237
  userAgent: u,
1217
- remoteAddress: r,
1238
+ remoteAddress: i,
1218
1239
  extraHeaders: S
1219
1240
  },
1220
1241
  this.events
1221
1242
  );
1222
- return this.setUa(I), this.setSipServerUrl(A.getSipServerUrl), this.setSocket(A.socket), I;
1243
+ return this.setUa(I), this.setSipServerUrl(R.getSipServerUrl), this.setSocket(R.socket), I;
1223
1244
  };
1224
1245
  start = async () => new Promise((e, t) => {
1225
1246
  const s = this.getUa();
@@ -1227,22 +1248,22 @@ class st {
1227
1248
  t(new Error("this.ua is not initialized"));
1228
1249
  return;
1229
1250
  }
1230
- let i;
1231
- i = ((c, d) => {
1251
+ let r;
1252
+ r = ((c, d) => {
1232
1253
  if (this.getConnectionConfiguration().register === !0)
1233
1254
  return this.registrationManager.subscribeToStartEvents(c, d);
1234
- const T = N.CONNECTED, h = [N.DISCONNECTED];
1235
- return this.events.on(T, c), h.forEach((S) => {
1255
+ const T = N.CONNECTED, g = [N.DISCONNECTED];
1256
+ return this.events.on(T, c), g.forEach((S) => {
1236
1257
  this.events.on(S, d);
1237
1258
  }), () => {
1238
- this.events.off(T, c), h.forEach((S) => {
1259
+ this.events.off(T, c), g.forEach((S) => {
1239
1260
  this.events.off(S, d);
1240
1261
  });
1241
1262
  };
1242
1263
  })(() => {
1243
- i?.(), e(s);
1264
+ r?.(), e(s);
1244
1265
  }, (c) => {
1245
- i?.(), t(c);
1266
+ r?.(), t(c);
1246
1267
  }), s.start();
1247
1268
  });
1248
1269
  cancelConnectWithRepeatedCalls() {
@@ -1250,17 +1271,17 @@ class st {
1250
1271
  }
1251
1272
  }
1252
1273
  var le = /* @__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))(le || {});
1253
- const it = _e({
1274
+ const rt = _e({
1254
1275
  types: {
1255
1276
  context: {},
1256
1277
  events: {}
1257
1278
  },
1258
1279
  actions: {
1259
1280
  logTransition: (n, e) => {
1260
- R(`State transition: ${e.from} -> ${e.to} (${e.event})`);
1281
+ A(`State transition: ${e.from} -> ${e.to} (${e.event})`);
1261
1282
  },
1262
1283
  logStateChange: (n, e) => {
1263
- R("ConnectionStateMachine state changed", e.state);
1284
+ A("ConnectionStateMachine state changed", e.state);
1264
1285
  }
1265
1286
  }
1266
1287
  }).createMachine({
@@ -1564,17 +1585,17 @@ const it = _e({
1564
1585
  }
1565
1586
  }
1566
1587
  });
1567
- class rt {
1588
+ class it {
1568
1589
  actor;
1569
1590
  stateChangeListeners = /* @__PURE__ */ new Set();
1570
1591
  events;
1571
1592
  unsubscribeFromEvents;
1572
1593
  actorSubscription;
1573
1594
  constructor(e) {
1574
- this.events = e, this.actor = Me(it), this.actorSubscription = this.actor.subscribe((t) => {
1595
+ this.events = e, this.actor = Me(rt), this.actorSubscription = this.actor.subscribe((t) => {
1575
1596
  const s = t.value;
1576
- this.stateChangeListeners.forEach((i) => {
1577
- i(s);
1597
+ this.stateChangeListeners.forEach((r) => {
1598
+ r(s);
1578
1599
  });
1579
1600
  }), this.actor.start(), this.subscribeToEvents();
1580
1601
  }
@@ -1665,7 +1686,7 @@ class rt {
1665
1686
  sendEvent(e) {
1666
1687
  const t = this.actor.getSnapshot(), s = { type: e };
1667
1688
  if (!t.can(s)) {
1668
- R(
1689
+ A(
1669
1690
  `Invalid transition: ${s.type} from ${this.state}. Event cannot be processed in current state.`
1670
1691
  );
1671
1692
  return;
@@ -1748,17 +1769,17 @@ class at {
1748
1769
  try {
1749
1770
  await this.unregister();
1750
1771
  } catch (e) {
1751
- R("tryRegister", e);
1772
+ A("tryRegister", e);
1752
1773
  }
1753
1774
  return this.register();
1754
1775
  }
1755
1776
  subscribeToStartEvents(e, t) {
1756
- const s = N.REGISTERED, i = [N.REGISTRATION_FAILED, N.DISCONNECTED];
1757
- return this.events.on(s, e), i.forEach((r) => {
1758
- this.events.on(r, t);
1777
+ const s = N.REGISTERED, r = [N.REGISTRATION_FAILED, N.DISCONNECTED];
1778
+ return this.events.on(s, e), r.forEach((i) => {
1779
+ this.events.on(i, t);
1759
1780
  }), () => {
1760
- this.events.off(s, e), i.forEach((r) => {
1761
- this.events.off(r, t);
1781
+ this.events.off(s, e), r.forEach((i) => {
1782
+ this.events.off(i, t);
1762
1783
  });
1763
1784
  };
1764
1785
  }
@@ -1773,14 +1794,14 @@ class ot {
1773
1794
  * Отправляет SIP OPTIONS запрос к указанному адресу
1774
1795
  */
1775
1796
  async sendOptions(e, t, s) {
1776
- const i = this.getUaProtected();
1777
- return new Promise((r, a) => {
1797
+ const r = this.getUaProtected();
1798
+ return new Promise((i, a) => {
1778
1799
  try {
1779
- i.sendOptions(e, t, {
1800
+ r.sendOptions(e, t, {
1780
1801
  extraHeaders: s,
1781
1802
  eventHandlers: {
1782
1803
  succeeded: () => {
1783
- r();
1804
+ i();
1784
1805
  },
1785
1806
  failed: a
1786
1807
  }
@@ -1794,8 +1815,8 @@ class ot {
1794
1815
  * Отправляет SIP OPTIONS запрос к собственному URI (ping)
1795
1816
  */
1796
1817
  async ping(e, t) {
1797
- const i = this.getUaProtected().configuration.uri;
1798
- return this.sendOptions(i, e, t);
1818
+ const r = this.getUaProtected().configuration.uri;
1819
+ return this.sendOptions(r, e, t);
1799
1820
  }
1800
1821
  /**
1801
1822
  * Проверяет доступность телефонии, создавая временное соединение
@@ -1804,27 +1825,27 @@ class ot {
1804
1825
  userAgent: e,
1805
1826
  displayName: t,
1806
1827
  sipServerUrl: s,
1807
- sipWebSocketServerURL: i,
1808
- remoteAddress: r,
1828
+ sipWebSocketServerURL: r,
1829
+ remoteAddress: i,
1809
1830
  extraHeaders: a
1810
1831
  }) {
1811
1832
  return new Promise((o, c) => {
1812
1833
  const { configuration: d } = this.uaFactory.createConfiguration({
1813
- sipWebSocketServerURL: i,
1834
+ sipWebSocketServerURL: r,
1814
1835
  displayName: t,
1815
1836
  userAgent: e,
1816
1837
  sipServerUrl: s
1817
- }), u = this.uaFactory.createUA({ ...d, remoteAddress: r, extraHeaders: a }), T = () => {
1838
+ }), u = this.uaFactory.createUA({ ...d, remoteAddress: i, extraHeaders: a }), T = () => {
1818
1839
  const S = new Error("Telephony is not available");
1819
1840
  c(S);
1820
1841
  };
1821
1842
  u.once(N.DISCONNECTED, T);
1822
- const h = () => {
1843
+ const g = () => {
1823
1844
  u.removeAllListeners(), u.once(N.DISCONNECTED, () => {
1824
1845
  o();
1825
1846
  }), u.stop();
1826
1847
  };
1827
- u.once(N.CONNECTED, h), u.start();
1848
+ u.once(N.CONNECTED, g), u.start();
1828
1849
  });
1829
1850
  }
1830
1851
  }
@@ -1844,12 +1865,12 @@ class v {
1844
1865
  register: e,
1845
1866
  password: t,
1846
1867
  user: s,
1847
- sipServerUrl: i,
1848
- sipWebSocketServerURL: r
1868
+ sipServerUrl: r,
1869
+ sipWebSocketServerURL: i
1849
1870
  }) {
1850
- if (!i)
1851
- throw new Error("sipServerUrl is required");
1852
1871
  if (!r)
1872
+ throw new Error("sipServerUrl is required");
1873
+ if (!i)
1853
1874
  throw new Error("sipWebSocketServerURL is required");
1854
1875
  if (e && (t === void 0 || t === ""))
1855
1876
  throw new Error("password is required for authorized connection");
@@ -1867,8 +1888,8 @@ class v {
1867
1888
  user: e,
1868
1889
  password: t,
1869
1890
  sipWebSocketServerURL: s,
1870
- displayName: i = "",
1871
- sipServerUrl: r,
1891
+ displayName: r = "",
1892
+ sipServerUrl: i,
1872
1893
  register: a = !1,
1873
1894
  sessionTimers: o = !1,
1874
1895
  registerExpires: c = 300,
@@ -1881,16 +1902,16 @@ class v {
1881
1902
  register: a,
1882
1903
  password: t,
1883
1904
  user: e,
1884
- sipServerUrl: r,
1905
+ sipServerUrl: i,
1885
1906
  sipWebSocketServerURL: s
1886
1907
  });
1887
- const h = v.resolveAuthorizationUser(a, e), S = Pe(r), m = S(h), I = new this.JsSIP.WebSocketInterface(s);
1908
+ const g = v.resolveAuthorizationUser(a, e), S = Pe(i), m = S(g), I = new this.JsSIP.WebSocketInterface(s);
1888
1909
  return {
1889
1910
  configuration: {
1890
1911
  password: t,
1891
1912
  register: a,
1892
1913
  uri: m,
1893
- display_name: se(i),
1914
+ display_name: se(r),
1894
1915
  user_agent: T,
1895
1916
  sdpSemantics: "unified-plan",
1896
1917
  sockets: [I],
@@ -1906,22 +1927,22 @@ class v {
1906
1927
  };
1907
1928
  }
1908
1929
  createUA({ remoteAddress: e, extraHeaders: t, ...s }) {
1909
- const i = new this.JsSIP.UA(s), r = v.buildExtraHeaders(e, t);
1910
- return r.length > 0 && i.registrator().setExtraHeaders(r), i;
1930
+ const r = new this.JsSIP.UA(s), i = v.buildExtraHeaders(e, t);
1931
+ return i.length > 0 && r.registrator().setExtraHeaders(i), r;
1911
1932
  }
1912
1933
  /**
1913
1934
  * Создает UA с полным жизненным циклом - конфигурация + создание + настройка событий
1914
1935
  */
1915
1936
  createUAWithConfiguration(e, t) {
1916
- const { configuration: s, helpers: i } = this.createConfiguration(e), r = this.createUA({
1937
+ const { configuration: s, helpers: r } = this.createConfiguration(e), i = this.createUA({
1917
1938
  ...s,
1918
1939
  remoteAddress: e.remoteAddress,
1919
1940
  extraHeaders: e.extraHeaders
1920
1941
  });
1921
1942
  return t.eachTriggers((a, o) => {
1922
1943
  const c = he.find((d) => d === o);
1923
- c && r.on(c, a);
1924
- }), { ua: r, helpers: i };
1944
+ c && i.on(c, a);
1945
+ }), { ua: i, helpers: r };
1925
1946
  }
1926
1947
  }
1927
1948
  class dt {
@@ -1939,7 +1960,7 @@ class dt {
1939
1960
  this.JsSIP = e, this.events = new D(ge), this.uaFactory = new v(e), this.registrationManager = new at({
1940
1961
  events: this.events,
1941
1962
  getUaProtected: this.getUaProtected
1942
- }), this.stateMachine = new rt(this.events), this.configurationManager = new tt({
1963
+ }), this.stateMachine = new it(this.events), this.configurationManager = new tt({
1943
1964
  getUa: this.getUa
1944
1965
  }), this.sipOperations = new ot({
1945
1966
  uaFactory: this.uaFactory,
@@ -2053,7 +2074,7 @@ class ht {
2053
2074
  ping = async (...e) => this.stackPromises.run(async () => this.connectionManager.ping(...e));
2054
2075
  set = async (...e) => this.stackPromises.run(async () => this.connectionManager.set(...e));
2055
2076
  }
2056
- 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 || {}), x = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))(x || {});
2077
+ var w = /* @__PURE__ */ ((n) => (n.INCOMING_CALL = "incomingCall", n.DECLINED_INCOMING_CALL = "declinedIncomingCall", n.TERMINATED_INCOMING_CALL = "terminatedIncomingCall", n.FAILED_INCOMING_CALL = "failedIncomingCall", n))(w || {}), x = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))(x || {});
2057
2078
  const ue = [
2058
2079
  "incomingCall",
2059
2080
  "declinedIncomingCall",
@@ -2099,10 +2120,10 @@ class ut {
2099
2120
  } = {}) {
2100
2121
  return new Promise((t, s) => {
2101
2122
  try {
2102
- const i = this.getIncomingRTCSession(), r = this.remoteCallerData;
2103
- this.removeIncomingSession(), this.events.trigger(U.DECLINED_INCOMING_CALL, r), i.terminate({ status_code: e }), t();
2104
- } catch (i) {
2105
- s(i);
2123
+ const r = this.getIncomingRTCSession(), i = this.remoteCallerData;
2124
+ this.removeIncomingSession(), this.events.trigger(w.DECLINED_INCOMING_CALL, i), r.terminate({ status_code: e }), t();
2125
+ } catch (r) {
2126
+ s(r);
2106
2127
  }
2107
2128
  });
2108
2129
  }
@@ -2144,15 +2165,15 @@ class ut {
2144
2165
  this.incomingRTCSession = e;
2145
2166
  const t = this.remoteCallerData;
2146
2167
  e.on("failed", (s) => {
2147
- this.removeIncomingSession(), s.originator === x.LOCAL ? this.events.trigger(U.TERMINATED_INCOMING_CALL, t) : this.events.trigger(U.FAILED_INCOMING_CALL, t);
2148
- }), this.events.trigger(U.INCOMING_CALL, t);
2168
+ this.removeIncomingSession(), s.originator === x.LOCAL ? this.events.trigger(w.TERMINATED_INCOMING_CALL, t) : this.events.trigger(w.FAILED_INCOMING_CALL, t);
2169
+ }), this.events.trigger(w.INCOMING_CALL, t);
2149
2170
  }
2150
2171
  removeIncomingSession() {
2151
2172
  delete this.incomingRTCSession;
2152
2173
  }
2153
2174
  }
2154
- const w = 1e3;
2155
- var E = /* @__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))(E || {});
2175
+ const U = 1e3;
2176
+ 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 || {});
2156
2177
  const Te = ["collected"], Y = () => "performance" in window ? performance.now() : Date.now(), L = (n) => [...n.keys()].reduce((e, t) => {
2157
2178
  const s = n.get(t);
2158
2179
  return s === void 0 ? e : { ...e, [s.type]: s };
@@ -2166,10 +2187,10 @@ const Te = ["collected"], Y = () => "performance" in window ? performance.now()
2166
2187
  };
2167
2188
  const e = L(n);
2168
2189
  return {
2169
- outboundRtp: e[E.OUTBOUND_RTP],
2170
- codec: e[E.CODEC],
2171
- mediaSource: e[E.MEDIA_SOURCE],
2172
- remoteInboundRtp: e[E.REMOTE_INBOUND_RTP]
2190
+ outboundRtp: e[C.OUTBOUND_RTP],
2191
+ codec: e[C.CODEC],
2192
+ mediaSource: e[C.MEDIA_SOURCE],
2193
+ remoteInboundRtp: e[C.REMOTE_INBOUND_RTP]
2173
2194
  };
2174
2195
  }, z = (n) => {
2175
2196
  if (!n)
@@ -2181,12 +2202,12 @@ const Te = ["collected"], Y = () => "performance" in window ? performance.now()
2181
2202
  };
2182
2203
  const e = L(n);
2183
2204
  return {
2184
- outboundRtp: e[E.OUTBOUND_RTP],
2185
- codec: e[E.CODEC],
2186
- mediaSource: e[E.MEDIA_SOURCE],
2187
- remoteInboundRtp: e[E.REMOTE_INBOUND_RTP]
2205
+ outboundRtp: e[C.OUTBOUND_RTP],
2206
+ codec: e[C.CODEC],
2207
+ mediaSource: e[C.MEDIA_SOURCE],
2208
+ remoteInboundRtp: e[C.REMOTE_INBOUND_RTP]
2188
2209
  };
2189
- }, J = ({
2210
+ }, X = ({
2190
2211
  videoReceiversStats: n,
2191
2212
  synchronizationSourcesVideo: e
2192
2213
  }) => {
@@ -2198,8 +2219,8 @@ const Te = ["collected"], Y = () => "performance" in window ? performance.now()
2198
2219
  };
2199
2220
  const t = L(n);
2200
2221
  return {
2201
- inboundRtp: t[E.INBOUND_RTP],
2202
- codec: t[E.CODEC],
2222
+ inboundRtp: t[C.INBOUND_RTP],
2223
+ codec: t[C.CODEC],
2203
2224
  synchronizationSources: e
2204
2225
  };
2205
2226
  }, St = ({
@@ -2215,9 +2236,9 @@ const Te = ["collected"], Y = () => "performance" in window ? performance.now()
2215
2236
  };
2216
2237
  const t = L(n);
2217
2238
  return {
2218
- inboundRtp: t[E.INBOUND_RTP],
2219
- codec: t[E.CODEC],
2220
- remoteOutboundRtp: t[E.REMOTE_OUTBOUND_RTP],
2239
+ inboundRtp: t[C.INBOUND_RTP],
2240
+ codec: t[C.CODEC],
2241
+ remoteOutboundRtp: t[C.REMOTE_OUTBOUND_RTP],
2221
2242
  synchronizationSources: e
2222
2243
  };
2223
2244
  }, Se = (n) => {
@@ -2231,13 +2252,13 @@ const Te = ["collected"], Y = () => "performance" in window ? performance.now()
2231
2252
  };
2232
2253
  const e = L(n);
2233
2254
  return {
2234
- candidatePair: e[E.CANDIDATE_PAIR],
2235
- certificate: e[E.CERTIFICATE],
2236
- localCandidate: e[E.LOCAL_CANDIDATE],
2237
- remoteCandidate: e[E.REMOTE_CANDIDATE],
2238
- transport: e[E.TRANSPORT]
2255
+ candidatePair: e[C.CANDIDATE_PAIR],
2256
+ certificate: e[C.CERTIFICATE],
2257
+ localCandidate: e[C.LOCAL_CANDIDATE],
2258
+ remoteCandidate: e[C.REMOTE_CANDIDATE],
2259
+ transport: e[C.TRANSPORT]
2239
2260
  };
2240
- }, Et = ({
2261
+ }, Ct = ({
2241
2262
  audioSenderStats: n,
2242
2263
  videoSenderFirstStats: e,
2243
2264
  videoSenderSecondStats: t
@@ -2248,17 +2269,17 @@ const Te = ["collected"], Y = () => "performance" in window ? performance.now()
2248
2269
  additional: Se(
2249
2270
  n ?? e ?? t
2250
2271
  )
2251
- }), Ct = ({
2272
+ }), Et = ({
2252
2273
  audioReceiverStats: n,
2253
2274
  videoReceiverFirstStats: e,
2254
2275
  videoReceiverSecondStats: t,
2255
2276
  synchronizationSources: s
2256
2277
  }) => ({
2257
- video: J({
2278
+ video: X({
2258
2279
  videoReceiversStats: e,
2259
2280
  synchronizationSourcesVideo: s.video
2260
2281
  }),
2261
- secondVideo: J({
2282
+ secondVideo: X({
2262
2283
  videoReceiversStats: t,
2263
2284
  synchronizationSourcesVideo: s.video
2264
2285
  }),
@@ -2274,18 +2295,18 @@ const Te = ["collected"], Y = () => "performance" in window ? performance.now()
2274
2295
  videoSenderFirstStats: e,
2275
2296
  videoSenderSecondStats: t,
2276
2297
  audioReceiverStats: s,
2277
- videoReceiverFirstStats: i,
2278
- videoReceiverSecondStats: r,
2298
+ videoReceiverFirstStats: r,
2299
+ videoReceiverSecondStats: i,
2279
2300
  synchronizationSources: a
2280
2301
  }) => {
2281
- const o = Et({
2302
+ const o = Ct({
2282
2303
  audioSenderStats: n,
2283
2304
  videoSenderFirstStats: e,
2284
2305
  videoSenderSecondStats: t
2285
- }), c = Ct({
2306
+ }), c = Et({
2286
2307
  audioReceiverStats: s,
2287
- videoReceiverFirstStats: i,
2288
- videoReceiverSecondStats: r,
2308
+ videoReceiverFirstStats: r,
2309
+ videoReceiverSecondStats: i,
2289
2310
  synchronizationSources: a
2290
2311
  });
2291
2312
  return {
@@ -2293,7 +2314,7 @@ const Te = ["collected"], Y = () => "performance" in window ? performance.now()
2293
2314
  inbound: c
2294
2315
  };
2295
2316
  }, At = async (n) => {
2296
- const e = "audio", t = "video", s = n.getSenders(), i = s.find((h) => h.track?.kind === e), r = s.filter((h) => h.track?.kind === t), a = n.getReceivers(), o = a.find((h) => h.track.kind === e), c = a.filter((h) => h.track.kind === t), d = {
2317
+ const e = "audio", t = "video", s = n.getSenders(), r = s.find((g) => g.track?.kind === e), i = s.filter((g) => g.track?.kind === t), a = n.getReceivers(), o = a.find((g) => g.track.kind === e), c = a.filter((g) => g.track.kind === t), d = {
2297
2318
  trackIdentifier: o?.track.id,
2298
2319
  item: o?.getSynchronizationSources()[0]
2299
2320
  }, u = {
@@ -2304,46 +2325,46 @@ const Te = ["collected"], Y = () => "performance" in window ? performance.now()
2304
2325
  video: u
2305
2326
  };
2306
2327
  return Promise.all([
2307
- i?.getStats(),
2308
- r[0]?.getStats(),
2309
- r[1]?.getStats(),
2328
+ r?.getStats(),
2329
+ i[0]?.getStats(),
2330
+ i[1]?.getStats(),
2310
2331
  o?.getStats(),
2311
2332
  c[0]?.getStats(),
2312
2333
  c[1]?.getStats()
2313
- ]).then((h) => {
2334
+ ]).then((g) => {
2314
2335
  const [
2315
2336
  S,
2316
2337
  m,
2317
2338
  I,
2318
- A,
2339
+ R,
2319
2340
  y,
2320
2341
  b
2321
- ] = h;
2342
+ ] = g;
2322
2343
  return {
2323
2344
  synchronizationSources: T,
2324
2345
  audioSenderStats: S,
2325
2346
  videoSenderFirstStats: m,
2326
2347
  videoSenderSecondStats: I,
2327
- audioReceiverStats: A,
2348
+ audioReceiverStats: R,
2328
2349
  videoReceiverFirstStats: y,
2329
2350
  videoReceiverSecondStats: b
2330
2351
  };
2331
2352
  });
2332
2353
  }, Rt = (n) => {
2333
- R(String(n));
2354
+ A(String(n));
2334
2355
  };
2335
2356
  class It {
2336
2357
  events;
2337
2358
  setTimeoutRequest;
2338
2359
  requesterAllStatistics = new Re(At);
2339
2360
  constructor() {
2340
- this.events = new j(Te), this.setTimeoutRequest = new ee();
2361
+ this.events = new K(Te), this.setTimeoutRequest = new ee();
2341
2362
  }
2342
2363
  get requested() {
2343
2364
  return this.setTimeoutRequest.requested;
2344
2365
  }
2345
2366
  start(e, {
2346
- interval: t = w,
2367
+ interval: t = U,
2347
2368
  onError: s = Rt
2348
2369
  } = {}) {
2349
2370
  this.stop(), this.setTimeoutRequest.request(() => {
@@ -2374,16 +2395,16 @@ class It {
2374
2395
  onError: t
2375
2396
  }) => {
2376
2397
  const s = Y();
2377
- this.requesterAllStatistics.request(e).then((i) => {
2378
- this.events.trigger("collected", Nt(i));
2398
+ this.requesterAllStatistics.request(e).then((r) => {
2399
+ this.events.trigger("collected", Nt(r));
2379
2400
  const a = Y() - s;
2380
- let o = w;
2381
- a > 48 ? o = w * 4 : a > 32 ? o = w * 3 : a > 16 && (o = w * 2), this.start(e, {
2401
+ let o = U;
2402
+ a > 48 ? o = U * 4 : a > 32 ? o = U * 3 : a > 16 && (o = U * 2), this.start(e, {
2382
2403
  onError: t,
2383
2404
  interval: o
2384
2405
  });
2385
- }).catch((i) => {
2386
- t && t(i);
2406
+ }).catch((r) => {
2407
+ t && t(r);
2387
2408
  });
2388
2409
  };
2389
2410
  }
@@ -2435,15 +2456,15 @@ class _t {
2435
2456
  };
2436
2457
  maybeSendStats() {
2437
2458
  this.availableIncomingBitrate !== void 0 && this.hasAvailableIncomingBitrateChangedQuarter() && this.apiManager.sendStats({ availableIncomingBitrate: this.availableIncomingBitrate }).catch((e) => {
2438
- R("Failed to send stats", e);
2459
+ A("Failed to send stats", e);
2439
2460
  });
2440
2461
  }
2441
2462
  }
2442
- const Mt = (n, e) => n.filter((s) => e.some((i) => i.clockRate === s.clockRate && i.mimeType === s.mimeType && i.channels === s.channels && i.sdpFmtpLine === s.sdpFmtpLine)), mt = (n) => {
2443
- const e = RTCRtpSender.getCapabilities(n), t = RTCRtpReceiver.getCapabilities(n), s = e === null ? [] : e.codecs, i = t === null ? [] : t.codecs;
2444
- return Mt(s, i);
2463
+ const Mt = (n, e) => n.filter((s) => e.some((r) => r.clockRate === s.clockRate && r.mimeType === s.mimeType && r.channels === s.channels && r.sdpFmtpLine === s.sdpFmtpLine)), mt = (n) => {
2464
+ const e = RTCRtpSender.getCapabilities(n), t = RTCRtpReceiver.getCapabilities(n), s = e === null ? [] : e.codecs, r = t === null ? [] : t.codecs;
2465
+ return Mt(s, r);
2445
2466
  }, pt = (n, e) => e === void 0 || e.length === 0 ? n : n.sort((t, s) => {
2446
- 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;
2467
+ const r = e.indexOf(t.mimeType), i = e.indexOf(s.mimeType), a = r === -1 ? Number.MAX_VALUE : r, o = i === -1 ? Number.MAX_VALUE : i;
2447
2468
  return a - o;
2448
2469
  }), Pt = (n, e) => e === void 0 || e.length === 0 ? n : n.filter((t) => !e.includes(t.mimeType)), ft = (n, {
2449
2470
  preferredMimeTypesVideoCodecs: e,
@@ -2451,11 +2472,11 @@ const Mt = (n, e) => n.filter((s) => e.some((i) => i.clockRate === s.clockRate &
2451
2472
  }) => {
2452
2473
  try {
2453
2474
  if (typeof n.setCodecPreferences == "function" && n.sender.track?.kind === "video" && (e !== void 0 && e.length > 0 || t !== void 0 && t.length > 0)) {
2454
- const s = mt("video"), i = Pt(s, t), r = pt(i, e);
2455
- n.setCodecPreferences(r);
2475
+ const s = mt("video"), r = Pt(s, t), i = pt(r, e);
2476
+ n.setCodecPreferences(i);
2456
2477
  }
2457
2478
  } catch (s) {
2458
- R("setCodecPreferences error", s);
2479
+ A("setCodecPreferences error", s);
2459
2480
  }
2460
2481
  }, Ot = (n) => [...n.keys()].map((e) => n.get(e)), vt = (n, e) => Ot(n).find((t) => t?.type === e), Dt = async (n) => n.getStats().then((e) => vt(e, "codec")?.mimeType);
2461
2482
  class yt {
@@ -2485,11 +2506,11 @@ class bt {
2485
2506
  */
2486
2507
  async run() {
2487
2508
  return this.stackPromises().catch((e) => {
2488
- R("TaskQueue: error", e);
2509
+ A("TaskQueue: error", e);
2489
2510
  });
2490
2511
  }
2491
2512
  }
2492
- class wt {
2513
+ class Ut {
2493
2514
  taskQueue;
2494
2515
  onSetParameters;
2495
2516
  constructor(e) {
@@ -2502,15 +2523,15 @@ class wt {
2502
2523
  this.taskQueue.stop();
2503
2524
  }
2504
2525
  }
2505
- const Ee = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()), Ut = 1e6, p = (n) => n * Ut, Ce = p(0.06), Ne = p(4), Lt = (n) => n <= 64 ? Ce : n <= 128 ? p(0.12) : n <= 256 ? p(0.25) : n <= 384 ? p(0.32) : n <= 426 ? p(0.38) : n <= 640 ? p(0.5) : n <= 848 ? p(0.7) : n <= 1280 ? p(1) : n <= 1920 ? p(2) : Ne, Bt = "av1", kt = (n) => Ee(n, Bt), Ft = 0.6, Q = (n, e) => kt(e) ? n * Ft : n, $t = (n) => Q(Ce, n), Vt = (n) => Q(Ne, n), X = (n, e) => {
2526
+ const Ce = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()), wt = 1e6, p = (n) => n * wt, Ee = p(0.06), Ne = p(4), Lt = (n) => n <= 64 ? Ee : n <= 128 ? p(0.12) : n <= 256 ? p(0.25) : n <= 384 ? p(0.32) : n <= 426 ? p(0.38) : n <= 640 ? p(0.5) : n <= 848 ? p(0.7) : n <= 1280 ? p(1) : n <= 1920 ? p(2) : Ne, Bt = "av1", kt = (n) => Ce(n, Bt), Ft = 0.6, Q = (n, e) => kt(e) ? n * Ft : n, $t = (n) => Q(Ee, n), Vt = (n) => Q(Ne, n), J = (n, e) => {
2506
2527
  const t = Lt(n);
2507
2528
  return Q(t, e);
2508
2529
  }, V = 1, Wt = ({
2509
2530
  videoTrack: n,
2510
2531
  targetSize: e
2511
2532
  }) => {
2512
- const t = n.getSettings(), s = t.width, i = t.height, r = s === void 0 ? V : s / e.width, a = i === void 0 ? V : i / e.height;
2513
- return Math.max(r, a, V);
2533
+ const t = n.getSettings(), s = t.width, r = t.height, i = s === void 0 ? V : s / e.width, a = r === void 0 ? V : r / e.height;
2534
+ return Math.max(i, a, V);
2514
2535
  };
2515
2536
  class Ht {
2516
2537
  ignoreForCodec;
@@ -2531,8 +2552,8 @@ class Ht {
2531
2552
  senderFinder: e,
2532
2553
  codecProvider: t,
2533
2554
  parametersSetter: s
2534
- }, i) {
2535
- this.senderFinder = e, this.codecProvider = t, this.parametersSetter = s, this.ignoreForCodec = i.ignoreForCodec;
2555
+ }, r) {
2556
+ this.senderFinder = e, this.codecProvider = t, this.parametersSetter = s, this.ignoreForCodec = r.ignoreForCodec;
2536
2557
  }
2537
2558
  /**
2538
2559
  * Выполняет балансировку на основе заголовков от сервера
@@ -2541,21 +2562,21 @@ class Ht {
2541
2562
  * @returns Promise с результатом балансировки
2542
2563
  */
2543
2564
  async balance(e, t) {
2544
- const s = e.getSenders(), i = this.senderFinder.findVideoSender(s);
2545
- if (!i?.track)
2546
- return { ...this.resultNoChanged, sender: i };
2547
- const r = await this.codecProvider.getCodecFromSender(i);
2548
- if (Ee(r, this.ignoreForCodec))
2549
- return { ...this.resultNoChanged, sender: i };
2565
+ const s = e.getSenders(), r = this.senderFinder.findVideoSender(s);
2566
+ if (!r?.track)
2567
+ return { ...this.resultNoChanged, sender: r };
2568
+ const i = await this.codecProvider.getCodecFromSender(r);
2569
+ if (Ce(i, this.ignoreForCodec))
2570
+ return { ...this.resultNoChanged, sender: r };
2550
2571
  const { mainCam: a, resolutionMainCam: o } = t ?? {};
2551
2572
  return this.processSender(
2552
2573
  { mainCam: a, resolutionMainCam: o },
2553
2574
  {
2554
- sender: i,
2555
- codec: r,
2556
- videoTrack: i.track
2575
+ sender: r,
2576
+ codec: i,
2577
+ videoTrack: r.track
2557
2578
  }
2558
- ).then((c) => ({ ...c, sender: i }));
2579
+ ).then((c) => ({ ...c, sender: r }));
2559
2580
  }
2560
2581
  /**
2561
2582
  * Обрабатывает отправитель в зависимости от команды управления
@@ -2563,14 +2584,14 @@ class Ht {
2563
2584
  * @returns Promise с результатом обработки
2564
2585
  */
2565
2586
  async processSender(e, t) {
2566
- const { mainCam: s, resolutionMainCam: i } = e;
2587
+ const { mainCam: s, resolutionMainCam: r } = e;
2567
2588
  switch (s) {
2568
2589
  case P.PAUSE_MAIN_CAM:
2569
2590
  return this.downgradeResolutionSender(t);
2570
2591
  case P.RESUME_MAIN_CAM:
2571
2592
  return this.setBitrateByTrackResolution(t);
2572
2593
  case P.MAX_MAIN_CAM_RESOLUTION:
2573
- return i !== void 0 ? this.setResolutionSender(i, t) : this.setBitrateByTrackResolution(t);
2594
+ return r !== void 0 ? this.setResolutionSender(r, t) : this.setBitrateByTrackResolution(t);
2574
2595
  case P.ADMIN_STOP_MAIN_CAM:
2575
2596
  case P.ADMIN_START_MAIN_CAM:
2576
2597
  case void 0:
@@ -2585,11 +2606,11 @@ class Ht {
2585
2606
  * @returns Promise с результатом
2586
2607
  */
2587
2608
  async downgradeResolutionSender(e) {
2588
- const { sender: t, codec: s } = e, i = {
2609
+ const { sender: t, codec: s } = e, r = {
2589
2610
  scaleResolutionDownBy: 200,
2590
2611
  maxBitrate: $t(s)
2591
2612
  };
2592
- return this.parametersSetter.setEncodingsToSender(t, i);
2613
+ return this.parametersSetter.setEncodingsToSender(t, r);
2593
2614
  }
2594
2615
  /**
2595
2616
  * Устанавливает битрейт на основе разрешения трека
@@ -2597,7 +2618,7 @@ class Ht {
2597
2618
  * @returns Promise с результатом
2598
2619
  */
2599
2620
  async setBitrateByTrackResolution(e) {
2600
- const { sender: t, videoTrack: s, codec: i } = e, a = s.getSettings().width, o = a === void 0 ? Vt(i) : X(a, i);
2621
+ const { sender: t, videoTrack: s, codec: r } = e, a = s.getSettings().width, o = a === void 0 ? Vt(r) : J(a, r);
2601
2622
  return this.parametersSetter.setEncodingsToSender(t, {
2602
2623
  scaleResolutionDownBy: 1,
2603
2624
  maxBitrate: o
@@ -2610,17 +2631,17 @@ class Ht {
2610
2631
  * @returns Promise с результатом
2611
2632
  */
2612
2633
  async setResolutionSender(e, t) {
2613
- const [s, i] = e.split("x"), { sender: r, videoTrack: a, codec: o } = t, c = {
2634
+ const [s, r] = e.split("x"), { sender: i, videoTrack: a, codec: o } = t, c = {
2614
2635
  width: Number(s),
2615
- height: Number(i)
2636
+ height: Number(r)
2616
2637
  }, d = Wt({
2617
2638
  videoTrack: a,
2618
2639
  targetSize: c
2619
- }), u = X(c.width, o), T = {
2640
+ }), u = J(c.width, o), T = {
2620
2641
  scaleResolutionDownBy: d,
2621
2642
  maxBitrate: u
2622
2643
  };
2623
- return this.parametersSetter.setEncodingsToSender(r, T);
2644
+ return this.parametersSetter.setEncodingsToSender(i, T);
2624
2645
  }
2625
2646
  }
2626
2647
  const xt = (n) => n.find((e) => e.track?.kind === "video");
@@ -2662,8 +2683,8 @@ class Gt {
2662
2683
  attachSender(e, t) {
2663
2684
  this.currentSender = e;
2664
2685
  const s = e.replaceTrack.bind(e);
2665
- this.originalReplaceTrack = s, e.replaceTrack = async (i) => {
2666
- await s(i), this.attachTrack(t, i ?? void 0), t();
2686
+ this.originalReplaceTrack = s, e.replaceTrack = async (r) => {
2687
+ await s(r), this.attachTrack(t, r ?? void 0), t();
2667
2688
  }, this.attachTrack(t, e.track);
2668
2689
  }
2669
2690
  detachSender() {
@@ -2672,8 +2693,8 @@ class Gt {
2672
2693
  attachTrack(e, t) {
2673
2694
  if (this.detachTrack(), !t)
2674
2695
  return;
2675
- const { width: s, height: i } = t.getSettings();
2676
- this.lastWidth = s, this.lastHeight = i, this.currentPollIntervalMs = this.pollIntervalMs, this.schedulePoll(t, e);
2696
+ const { width: s, height: r } = t.getSettings();
2697
+ this.lastWidth = s, this.lastHeight = r, this.currentPollIntervalMs = this.pollIntervalMs, this.schedulePoll(t, e);
2677
2698
  }
2678
2699
  /**
2679
2700
  * Периодически опрашивает track с экспоненциальной адаптацией частоты.
@@ -2682,8 +2703,8 @@ class Gt {
2682
2703
  */
2683
2704
  schedulePoll(e, t) {
2684
2705
  const s = () => {
2685
- const { width: i, height: r } = e.getSettings();
2686
- i !== this.lastWidth || r !== this.lastHeight ? (this.lastWidth = i, this.lastHeight = r, this.currentPollIntervalMs = this.pollIntervalMs, t()) : this.currentPollIntervalMs = Math.min(
2706
+ const { width: r, height: i } = e.getSettings();
2707
+ r !== this.lastWidth || i !== this.lastHeight ? (this.lastWidth = r, this.lastHeight = i, this.currentPollIntervalMs = this.pollIntervalMs, t()) : this.currentPollIntervalMs = Math.min(
2687
2708
  this.currentPollIntervalMs * 2,
2688
2709
  this.maxPollIntervalMs
2689
2710
  ), this.setTimeoutRequest.request(s, this.currentPollIntervalMs);
@@ -2723,10 +2744,10 @@ class Yt {
2723
2744
  trackMonitor;
2724
2745
  constructor(e, t, {
2725
2746
  ignoreForCodec: s,
2726
- onSetParameters: i,
2727
- pollIntervalMs: r
2747
+ onSetParameters: r,
2748
+ pollIntervalMs: i
2728
2749
  } = {}) {
2729
- this.getConnection = t, this.eventHandler = new Qt(e), this.parametersSetterWithQueue = new wt(i), this.senderBalancer = new Ht(
2750
+ this.getConnection = t, this.eventHandler = new Qt(e), this.parametersSetterWithQueue = new Ut(r), this.senderBalancer = new Ht(
2730
2751
  {
2731
2752
  senderFinder: new qt(),
2732
2753
  codecProvider: new yt(),
@@ -2735,7 +2756,7 @@ class Yt {
2735
2756
  {
2736
2757
  ignoreForCodec: s
2737
2758
  }
2738
- ), this.trackMonitor = new Gt({ pollIntervalMs: r });
2759
+ ), this.trackMonitor = new Gt({ pollIntervalMs: i });
2739
2760
  }
2740
2761
  /**
2741
2762
  * Подписывается на события управления главной камерой
@@ -2766,7 +2787,7 @@ class Yt {
2766
2787
  const t = await this.senderBalancer.balance(e, this.serverHeaders);
2767
2788
  return this.trackMonitor.subscribe(t.sender, () => {
2768
2789
  this.balance().catch((s) => {
2769
- R("balance on track change: error", s);
2790
+ A("balance on track change: error", s);
2770
2791
  });
2771
2792
  }), t;
2772
2793
  }
@@ -2776,7 +2797,7 @@ class Yt {
2776
2797
  */
2777
2798
  handleMainCamControl = (e) => {
2778
2799
  this.serverHeaders = e, this.balance().catch((t) => {
2779
- R("handleMainCamControl: error", t);
2800
+ A("handleMainCamControl: error", t);
2780
2801
  });
2781
2802
  };
2782
2803
  }
@@ -2794,13 +2815,13 @@ class zt {
2794
2815
  videoSendingBalancer;
2795
2816
  startBalancingTimer;
2796
2817
  constructor(e, t, s = {}) {
2797
- this.events = new j(Ae), this.callManager = e, this.balancingStartDelay = s.balancingStartDelay ?? 1e4, this.videoSendingBalancer = new Yt(
2818
+ this.events = new K(Ae), this.callManager = e, this.balancingStartDelay = s.balancingStartDelay ?? 1e4, this.videoSendingBalancer = new Yt(
2798
2819
  t,
2799
2820
  () => e.connection,
2800
2821
  {
2801
2822
  ...s,
2802
- onSetParameters: (i) => {
2803
- this.events.trigger("parameters-updated", i), s.onSetParameters?.(i);
2823
+ onSetParameters: (r) => {
2824
+ this.events.trigger("parameters-updated", r), s.onSetParameters?.(r);
2804
2825
  }
2805
2826
  }
2806
2827
  ), this.subscribe();
@@ -2856,7 +2877,7 @@ class zt {
2856
2877
  scheduleBalancingStart() {
2857
2878
  this.clearStartTimer(), this.startBalancingTimer = setTimeout(() => {
2858
2879
  this.startBalancingTimer = void 0, this.startBalancing().catch((e) => {
2859
- R("startBalancing: error", e);
2880
+ A("startBalancing: error", e);
2860
2881
  });
2861
2882
  }, this.balancingStartDelay), this.events.trigger("balancing-scheduled", { delay: this.balancingStartDelay });
2862
2883
  }
@@ -2864,16 +2885,16 @@ class zt {
2864
2885
  this.startBalancingTimer && (clearTimeout(this.startBalancingTimer), this.startBalancingTimer = void 0);
2865
2886
  }
2866
2887
  }
2867
- const Jt = 1e6, Xt = ge.map((n) => `connection:${n}`), jt = ne.map((n) => `call:${n}`), Kt = re.map((n) => `api:${n}`), Zt = ue.map((n) => `incoming-call:${n}`), en = de.map((n) => `presentation:${n}`), tn = Te.map((n) => `stats:${n}`), nn = Ae.map((n) => `video-balancer:${n}`), sn = [
2868
- ...Xt,
2869
- ...jt,
2888
+ const Xt = 1e6, Jt = ge.map((n) => `connection:${n}`), Kt = ne.map((n) => `call:${n}`), jt = ie.map((n) => `api:${n}`), Zt = ue.map((n) => `incoming-call:${n}`), en = de.map((n) => `presentation:${n}`), tn = Te.map((n) => `stats:${n}`), nn = Ae.map((n) => `video-balancer:${n}`), sn = [
2889
+ ...Jt,
2870
2890
  ...Kt,
2891
+ ...jt,
2871
2892
  ...Zt,
2872
2893
  ...en,
2873
2894
  ...tn,
2874
2895
  ...nn
2875
2896
  ];
2876
- class Cn {
2897
+ class En {
2877
2898
  events;
2878
2899
  connectionManager;
2879
2900
  connectionQueueManager;
@@ -2888,23 +2909,23 @@ class Cn {
2888
2909
  constructor({ JsSIP: e }, {
2889
2910
  preferredMimeTypesVideoCodecs: t,
2890
2911
  excludeMimeTypesVideoCodecs: s,
2891
- videoBalancerOptions: i
2912
+ videoBalancerOptions: r
2892
2913
  } = {}) {
2893
2914
  this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.events = new D(sn), this.connectionManager = new dt({ JsSIP: e }), this.connectionQueueManager = new ht({
2894
2915
  connectionManager: this.connectionManager
2895
- }), this.callManager = new we(), this.apiManager = new $e({
2916
+ }), this.callManager = new Ue(), this.apiManager = new $e({
2896
2917
  connectionManager: this.connectionManager,
2897
2918
  callManager: this.callManager
2898
2919
  }), this.incomingCallManager = new ut(this.connectionManager), this.presentationManager = new et({
2899
2920
  callManager: this.callManager,
2900
- maxBitrate: Jt
2921
+ maxBitrate: Xt
2901
2922
  }), this.statsManager = new _t({
2902
2923
  callManager: this.callManager,
2903
2924
  apiManager: this.apiManager
2904
2925
  }), this.videoSendingBalancerManager = new zt(
2905
2926
  this.callManager,
2906
2927
  this.apiManager,
2907
- i
2928
+ r
2908
2929
  ), this.subscribe();
2909
2930
  }
2910
2931
  get requestedConnection() {
@@ -2984,8 +3005,8 @@ class Cn {
2984
3005
  this.getSipServerUrl,
2985
3006
  {
2986
3007
  ...s,
2987
- onAddedTransceiver: async (i, r, a) => {
2988
- this.setCodecPreferences(i), await t?.(i, r, a);
3008
+ onAddedTransceiver: async (r, i, a) => {
3009
+ this.setCodecPreferences(r), await t?.(r, i, a);
2989
3010
  }
2990
3011
  }
2991
3012
  );
@@ -2997,8 +3018,8 @@ class Cn {
2997
3018
  this.incomingCallManager.extractIncomingRTCSession,
2998
3019
  {
2999
3020
  ...s,
3000
- onAddedTransceiver: async (i, r, a) => {
3001
- this.setCodecPreferences(i), await t?.(i, r, a);
3021
+ onAddedTransceiver: async (r, i, a) => {
3022
+ this.setCodecPreferences(r), await t?.(r, i, a);
3002
3023
  }
3003
3024
  }
3004
3025
  );
@@ -3009,7 +3030,7 @@ class Cn {
3009
3030
  getRemoteStreams = () => this.callManager.getRemoteStreams();
3010
3031
  replaceMediaStream = async (...e) => this.callManager.replaceMediaStream(...e);
3011
3032
  async startPresentation(e, t = {}) {
3012
- const { isP2P: s, callLimit: i, onAddedTransceiver: r, ...a } = t;
3033
+ const { isP2P: s, callLimit: r, onAddedTransceiver: i, ...a } = t;
3013
3034
  return this.presentationManager.startPresentation(
3014
3035
  async () => {
3015
3036
  s === !0 ? (await this.apiManager.sendMustStopPresentationP2P(), await this.apiManager.askPermissionToStartPresentationP2P()) : await this.apiManager.askPermissionToStartPresentation();
@@ -3018,10 +3039,10 @@ class Cn {
3018
3039
  {
3019
3040
  ...a,
3020
3041
  onAddedTransceiver: async (o, c, d) => {
3021
- this.setCodecPreferences(o), await r?.(o, c, d);
3042
+ this.setCodecPreferences(o), await i?.(o, c, d);
3022
3043
  }
3023
3044
  },
3024
- i === void 0 ? void 0 : { callLimit: i }
3045
+ r === void 0 ? void 0 : { callLimit: r }
3025
3046
  );
3026
3047
  }
3027
3048
  async stopPresentation(e = {}) {
@@ -3031,16 +3052,16 @@ class Cn {
3031
3052
  });
3032
3053
  }
3033
3054
  async updatePresentation(e, t = {}) {
3034
- const { isP2P: s, onAddedTransceiver: i, ...r } = t;
3055
+ const { isP2P: s, onAddedTransceiver: r, ...i } = t;
3035
3056
  return this.presentationManager.updatePresentation(
3036
3057
  async () => {
3037
3058
  s === !0 ? (await this.apiManager.sendMustStopPresentationP2P(), await this.apiManager.askPermissionToStartPresentationP2P()) : await this.apiManager.askPermissionToStartPresentation();
3038
3059
  },
3039
3060
  e,
3040
3061
  {
3041
- ...r,
3062
+ ...i,
3042
3063
  onAddedTransceiver: async (a, o, c) => {
3043
- this.setCodecPreferences(a), await i?.(a, o, c);
3064
+ this.setCodecPreferences(a), await r?.(a, o, c);
3044
3065
  }
3045
3066
  }
3046
3067
  );
@@ -3122,22 +3143,27 @@ class Cn {
3122
3143
  this.videoSendingBalancerManager.on(t, (s) => {
3123
3144
  this.events.trigger(`video-balancer:${t}`, s);
3124
3145
  });
3125
- });
3146
+ }), this.apiManager.on("restart", this.handleRestart);
3126
3147
  }
3148
+ handleRestart = () => {
3149
+ this.callManager.restartIce().catch((e) => {
3150
+ A("Failed to restart ICE", e);
3151
+ });
3152
+ };
3127
3153
  }
3128
3154
  export {
3129
- ie as E,
3155
+ re as E,
3130
3156
  $ as O,
3131
- Cn as S,
3132
- Xe as a,
3157
+ En as S,
3158
+ Je as a,
3133
3159
  Fe as b,
3134
- E as c,
3160
+ C as c,
3135
3161
  Sn as d,
3136
3162
  Tn as e,
3137
3163
  It as f,
3138
3164
  Dt as g,
3139
- En as h,
3140
- R as l,
3165
+ Cn as h,
3166
+ A as l,
3141
3167
  B as p,
3142
3168
  ce as s
3143
3169
  };